Files
qhmes/deploy-qhmes/frontend/js/MesXslVehicleModal-DxJa2zmV.js
2026-05-15 11:34:12 +08:00

2 lines
11 KiB
Java

var se=Object.defineProperty;var V=Object.getOwnPropertySymbols;var ae=Object.prototype.hasOwnProperty,pe=Object.prototype.propertyIsEnumerable;var R=(r,s,o)=>s in r?se(r,s,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[s]=o,T=(r,s)=>{for(var o in s||(s={}))ae.call(s,o)&&R(r,o,s[o]);if(V)for(var o of V(s))pe.call(s,o)&&R(r,o,s[o]);return r};var C=(r,s,o)=>new Promise((y,g)=>{var S=d=>{try{_(o.next(d))}catch(N){g(N)}},I=d=>{try{_(o.throw(d))}catch(N){g(N)}},_=d=>d.done?y(d.value):Promise.resolve(d.value).then(S,I);_((o=o.apply(r,s)).next())});import{d as ue,ah as M,aC as b,as as x,aF as a,k as p,ag as k,G as w,f as U,u as c,aG as ce,e as de}from"./vue-vendor-C7Zq48Yl.js";import{B as me}from"./index-Du0A3ksf.js";import"./index-Di-j2gt4.js";import{u as he}from"./JAddInput-D6qcyZjQ.js";import{s as fe}from"./MesXslVehicle.api-DeNnfdcU.js";import{q as ge}from"./MesXslSupplier.api-BhlMOAyt.js";import{ak as Ie,al as F,u as ve,d as we}from"./index-BI6CMai0.js";import Se from"./MesXslCustomerSelectModal-BsK4R6Ym.js";import _e from"./MesXslUnitSelectModal-BgXLEf6P.js";import Ne from"./MesXslSupplierSelectModal-BDZFJLUg.js";import{u as be}from"./useForm-BZtHZyx2.js";import{B as xe}from"./BasicForm-BJnSRkIE.js";const We=[{title:"ID",align:"center",dataIndex:"id",width:280,ellipsis:!0,defaultHidden:!0},{title:"车牌号",align:"center",dataIndex:"plateNumber",width:120},{title:"车辆归属",align:"center",dataIndex:"vehicleBelong_dictText",width:100},{title:"车辆皮重(KG)",align:"center",dataIndex:"tareWeightKg",width:110},{title:"装载量",align:"center",dataIndex:"loadCapacity",width:100},{title:"单位ID",align:"center",dataIndex:"unitId",width:200,ellipsis:!0,defaultHidden:!0},{title:"单位",align:"center",dataIndex:"loadUnit",width:100},{title:"客户简称",align:"center",dataIndex:"customerShortName",width:160,ellipsis:!0},{title:"客户ID",align:"center",dataIndex:"customerIds",width:180,ellipsis:!0,defaultHidden:!0},{title:"供应商ID",align:"center",dataIndex:"supplierId",width:200,ellipsis:!0,defaultHidden:!0},{title:"供应商简称",align:"center",dataIndex:"supplierShortName",width:140,ellipsis:!0},{title:"司机",align:"center",dataIndex:"driverName",width:90},{title:"联系电话",align:"center",dataIndex:"driverPhone",width:120},{title:"车长",align:"center",dataIndex:"vehicleLength",width:80},{title:"车宽",align:"center",dataIndex:"vehicleWidth",width:80},{title:"车高",align:"center",dataIndex:"vehicleHeight",width:80},{title:"状态",align:"center",dataIndex:"status_dictText",width:90},{title:"租户ID",align:"center",dataIndex:"tenantId",width:90,defaultHidden:!0}],$e=[{label:"车牌号",field:"plateNumber",component:"JInput",colProps:{span:6}},{label:"车辆归属",field:"vehicleBelong",component:"JDictSelectTag",componentProps:{dictCode:"xslmes_vehicle_belong"},colProps:{span:6}},{label:"状态",field:"status",component:"JDictSelectTag",componentProps:{dictCode:"xslmes_vehicle_status"},colProps:{span:6}}],ye=[{label:"",field:"id",component:"Input",show:!1},{label:"车牌号",field:"plateNumber",required:!0,component:"Input",componentProps:{placeholder:"请输入车牌号"}},{label:"车辆归属",field:"vehicleBelong",required:!0,component:"Input",slot:"vehicleBelongPicker"},{label:"车辆皮重(KG)",field:"tareWeightKg",component:"InputNumber",componentProps:{min:0,placeholder:"车辆皮重",style:{width:"100%"}}},{label:"装载量",field:"loadCapacity",component:"InputNumber",componentProps:{min:0,placeholder:"装载量",style:{width:"100%"}}},{label:"单位ID",field:"unitId",component:"Input",show:!1},{label:"单位",field:"loadUnit",component:"Input",slot:"unitPicker"},{label:"客户ID",field:"customerIds",component:"Input",show:!1},{label:"客户简称",field:"customerShortName",component:"Input",slot:"customerPicker",ifShow:({values:r})=>r.vehicleBelong==="1"},{label:"供应商ID",field:"supplierId",component:"Input",show:!1},{label:"供应商名称",field:"supplierName",component:"Input",show:!1},{label:"供应商简称",field:"supplierShortName",component:"Input",slot:"supplierPicker",ifShow:({values:r})=>r.vehicleBelong==="2"},{label:"车长",field:"vehicleLength",component:"InputNumber",componentProps:{min:0,placeholder:"车长",style:{width:"100%"}}},{label:"车宽",field:"vehicleWidth",component:"InputNumber",componentProps:{min:0,placeholder:"车宽",style:{width:"100%"}}},{label:"车高",field:"vehicleHeight",component:"InputNumber",componentProps:{min:0,placeholder:"车高",style:{width:"100%"}}},{label:"司机",field:"driverName",component:"Input",componentProps:{placeholder:"请输入司机姓名"}},{label:"联系电话",field:"driverPhone",component:"Input",componentProps:{placeholder:"请输入联系电话"}},{label:"状态",field:"status",component:"JDictSelectTag",componentProps:{dictCode:"xslmes_vehicle_status",placeholder:"请选择状态"},defaultValue:"0"}],qe={plateNumber:{title:"车牌号",order:0,view:"text"},vehicleBelong:{title:"车辆归属",order:1,view:"list",dictCode:"xslmes_vehicle_belong"},status:{title:"状态",order:2,view:"list",dictCode:"xslmes_vehicle_status"}},Be=ue({__name:"MesXslVehicleModal",emits:["register","success"],setup(r,{emit:s}){const{createMessage:o}=ve(),y=s,g=U(!0),S=U(!1),I=U(""),[_,{openModal:d}]=F(),[N,{openModal:H}]=F(),[O,{openModal:G}]=F(),[L,{setProps:W,resetFields:$,setFieldsValue:f,validate:q,scrollToField:J,getFieldsValue:B}]=be({labelWidth:120,schemas:ye,showActionButtonGroup:!1,baseColProps:{span:24}}),[K,{setModalProps:P,closeModal:X}]=Ie(e=>C(null,null,function*(){var l,u,m,v,i;if(yield $(),P({confirmLoading:!1,showCancelBtn:!!(e!=null&&e.showFooter),showOkBtn:!!(e!=null&&e.showFooter)}),g.value=!!(e!=null&&e.isUpdate),S.value=!(e!=null&&e.showFooter),c(g)){yield f(T({},e.record));const t=e.record;if(I.value=(t==null?void 0:t.vehicleBelong)!=null&&(t==null?void 0:t.vehicleBelong)!==""?String(t.vehicleBelong):"",(t==null?void 0:t.vehicleBelong)==="2"&&(t!=null&&t.supplierId))try{const n=yield ge({id:t.supplierId}),h=(n==null?void 0:n.id)!=null?n:n==null?void 0:n.result;if(h){const re=((l=h.supplierShortName)!=null?l:h.supplier_short_name)!=null&&String((u=h.supplierShortName)!=null?u:h.supplier_short_name).trim()!==""?String((m=h.supplierShortName)!=null?m:h.supplier_short_name).trim():"",D=(i=(v=h.supplierName)!=null?v:h.supplier_name)!=null?i:"";yield f({supplierShortName:re,supplierName:D!=null?String(D):""})}}catch(n){}}else I.value="";W({disabled:!(e!=null&&e.showFooter)})})),j=de(()=>c(g)?c(S)?"详情":"编辑":"新增");function z(){const e=B();H(!0,{unitId:e.unitId})}function A(e){f({unitId:e.unitId||void 0,loadUnit:e.unitName||""})}function E(){f({unitId:void 0,loadUnit:""})}function Q(e,l){const u=l!=null&&l!==""?String(l):"";u!==""&&u!==I.value&&(I.value=u,u==="1"?(e.supplierId=void 0,e.supplierName="",e.supplierShortName=""):u==="2"?(e.customerIds="",e.customerShortName=""):(e.customerIds="",e.customerShortName="",e.supplierId=void 0,e.supplierName="",e.supplierShortName=""))}function Y(e){const l=e.vehicleBelong!=null&&e.vehicleBelong!==""?String(e.vehicleBelong):"";return l==="1"?(e.supplierId=void 0,e.supplierName="",e.supplierShortName=""):l==="2"?(e.customerIds="",e.customerShortName=""):(e.customerIds="",e.customerShortName="",e.supplierId=void 0,e.supplierName="",e.supplierShortName=""),e}function Z(){const e=B();if(!e.vehicleBelong){o.warning("请先选择车辆归属");return}if(e.vehicleBelong!=="1"){o.warning("仅当车辆归属为「客户」时可选择客户");return}d(!0,{customerIds:e.customerIds,customerShortName:e.customerShortName,multiple:!1})}function ee(e){f({customerIds:e.customerIds,customerShortName:e.customerShortName})}function te(){f({customerIds:"",customerShortName:""})}function le(){const e=B();if(!e.vehicleBelong){o.warning("请先选择车辆归属");return}if(e.vehicleBelong!=="2"){o.warning("仅当车辆归属为「供应商」时可选择供应商");return}G(!0,{supplierId:e.supplierId})}function oe(e){f({supplierId:e.supplierId||void 0,supplierName:e.supplierName||"",supplierShortName:e.supplierShortName||""})}function ie(){f({supplierId:void 0,supplierName:"",supplierShortName:""})}function ne(){return C(this,null,function*(){try{const e=yield q();if(!e.vehicleBelong){o.warning("请先选择车辆归属");return}if(e.vehicleBelong==="1"&&!e.customerIds){o.warning("归属为客户时必须选择客户");return}if(e.vehicleBelong==="2"&&!e.supplierId){o.warning("归属为供应商时必须选择供应商");return}Y(e),P({confirmLoading:!0}),yield fe(e,c(g)),X(),y("success")}catch(e){if(e!=null&&e.errorFields){const l=e.errorFields[0];l&&J(l.name,{behavior:"smooth",block:"center"})}return Promise.reject(e)}finally{P({confirmLoading:!1})}})}return(e,l)=>{const u=M("a-input"),m=M("a-button"),v=M("a-input-group");return x(),b(c(me),ce(e.$attrs,{onRegister:c(K),destroyOnClose:"",title:j.value,width:900,onOk:ne}),{default:a(()=>[p(c(xe),{onRegister:c(L),name:"MesXslVehicleForm"},{vehicleBelongPicker:a(({model:i,field:t})=>[p(he,{value:i[t],"onUpdate:value":[n=>i[t]=n,n=>Q(i,n)],dictCode:"xslmes_vehicle_belong",placeholder:"请先选择车辆归属",disabled:S.value},null,8,["value","onUpdate:value","disabled"])]),unitPicker:a(({model:i,field:t})=>[p(v,{compact:"",style:{display:"flex",width:"100%"}},{default:a(()=>[p(u,{value:i[t],"onUpdate:value":n=>i[t]=n,"read-only":"",placeholder:"请点击选择单位(名称)",style:{flex:"1"}},null,8,["value","onUpdate:value"]),p(m,{type:"primary",onClick:z},{default:a(()=>[...l[0]||(l[0]=[w("选择单位",-1)])]),_:1}),i.unitId?(x(),b(m,{key:0,onClick:E},{default:a(()=>[...l[1]||(l[1]=[w("清除",-1)])]),_:1})):k("",!0)]),_:2},1024)]),customerPicker:a(({model:i,field:t})=>[p(v,{compact:"",style:{display:"flex",width:"100%"}},{default:a(()=>[p(u,{value:i[t],"onUpdate:value":n=>i[t]=n,"read-only":"",placeholder:"请先选车辆归属为「客户」后再选择",style:{flex:"1"}},null,8,["value","onUpdate:value"]),p(m,{type:"primary",onClick:Z},{default:a(()=>[...l[2]||(l[2]=[w("选择客户",-1)])]),_:1}),i.customerIds?(x(),b(m,{key:0,onClick:te},{default:a(()=>[...l[3]||(l[3]=[w("清除",-1)])]),_:1})):k("",!0)]),_:2},1024)]),supplierPicker:a(({model:i,field:t})=>[p(v,{compact:"",style:{display:"flex",width:"100%"}},{default:a(()=>[p(u,{value:i[t],"onUpdate:value":n=>i[t]=n,"read-only":"",placeholder:"请先选车辆归属为「供应商」后再选择(展示简称)",style:{flex:"1"}},null,8,["value","onUpdate:value"]),p(m,{type:"primary",onClick:le},{default:a(()=>[...l[4]||(l[4]=[w("选择供应商",-1)])]),_:1}),i.supplierId?(x(),b(m,{key:0,onClick:ie},{default:a(()=>[...l[5]||(l[5]=[w("清除",-1)])]),_:1})):k("",!0)]),_:2},1024)]),_:1},8,["onRegister"]),p(_e,{onRegister:c(N),onSelect:A},null,8,["onRegister"]),p(Se,{onRegister:c(_),onSelect:ee},null,8,["onRegister"]),p(Ne,{onRegister:c(O),onSelect:oe},null,8,["onRegister"])]),_:1},16,["onRegister","title"])}}}),Pe=we(Be,[["__scopeId","data-v-628535e4"]]),Je=Object.freeze(Object.defineProperty({__proto__:null,default:Pe},Symbol.toStringTag,{value:"Module"}));export{Pe as M,$e as a,Je as b,We as c,qe as s};