2 lines
9.7 KiB
Java
2 lines
9.7 KiB
Java
var ne=Object.defineProperty;var R=Object.getOwnPropertySymbols;var ie=Object.prototype.hasOwnProperty,ue=Object.prototype.propertyIsEnumerable;var U=(s,o,r)=>o in s?ne(s,o,{enumerable:!0,configurable:!0,writable:!0,value:r}):s[o]=r,M=(s,o)=>{for(var r in o||(o={}))ie.call(o,r)&&U(s,r,o[r]);if(R)for(var r of R(o))ue.call(o,r)&&U(s,r,o[r]);return s};var I=(s,o,r)=>new Promise((P,f)=>{var d=p=>{try{l(r.next(p))}catch(v){f(v)}},g=p=>{try{l(r.throw(p))}catch(v){f(v)}},l=p=>p.done?P(p.value):Promise.resolve(p.value).then(d,g);l((r=r.apply(s,o)).next())});import{d as ce,ah as F,aC as k,as as B,aF as u,k as c,ag as O,f as b,G as N,u as i,aG as de,e as pe}from"./vue-vendor-C7Zq48Yl.js";import{B as me}from"./index-Du0A3ksf.js";import"./index-Di-j2gt4.js";import{u as H,f as y,ak as he,al as D}from"./index-BI6CMai0.js";import fe from"./MesXslCustomerSelectModal-BsK4R6Ym.js";import ge from"./MesXslSupplierSelectModal-BDZFJLUg.js";import{i as we}from"./JAddInput-D6qcyZjQ.js";import{u as Se}from"./useForm-BZtHZyx2.js";import{B as Ie}from"./BasicForm-BJnSRkIE.js";const C="XSLMES_WH_F2_KH",x="XSLMES_WH_F2_GYS",Te=[{title:"ID",align:"center",dataIndex:"id",width:280,ellipsis:!0,defaultHidden:!0},{title:"仓库编码",align:"center",dataIndex:"warehouseCode",width:120},{title:"仓库名称",align:"center",dataIndex:"warehouseName",width:160},{title:"仓库分类",align:"center",dataIndex:"warehouseCategory_dictText",width:120},{title:"ERP编码",align:"center",dataIndex:"erpCode",width:120},{title:"客户简称",align:"center",dataIndex:"customerShortName",width:120,ellipsis:!0},{title:"供应商简称",align:"center",dataIndex:"supplierShortName",width:120},{title:"状态",align:"center",dataIndex:"status_dictText",width:90},{title:"创建人",align:"center",dataIndex:"createBy",width:100},{title:"创建时间",align:"center",dataIndex:"createTime",width:165,customRender:({text:s})=>s?String(s).length>19?String(s).substring(0,19):s:""},{title:"租户ID",align:"center",dataIndex:"tenantId",width:90,defaultHidden:!0}],Ee=[{label:"仓库编码",field:"warehouseCode",component:"JInput",colProps:{span:6}},{label:"仓库名称",field:"warehouseName",component:"JInput",colProps:{span:6}},{label:"仓库分类",field:"warehouseCategory",component:"JDictSelectTag",componentProps:{dictCode:"sys_category,name,id"},colProps:{span:6}},{label:"状态",field:"status",component:"JDictSelectTag",componentProps:{dictCode:"xslmes_unit_status"},colProps:{span:6}}],ye=[{label:"",field:"id",component:"Input",show:!1},{label:"仓库编码",field:"warehouseCode",required:!0,component:"Input",componentProps:{placeholder:"请输入仓库编码"}},{label:"仓库名称",field:"warehouseName",required:!0,component:"Input",componentProps:{placeholder:"请输入仓库名称"}},{label:"仓库分类",field:"warehouseCategory",required:!0,component:"Input",slot:"warehouseCategoryField"},{label:"ERP编码",field:"erpCode",component:"Input",componentProps:{placeholder:"请输入ERP编码"}},{label:"状态",field:"status",component:"JDictSelectTag",componentProps:{dictCode:"xslmes_unit_status",placeholder:"请选择状态"}},{label:"客户ID",field:"customerId",component:"Input",show:!1},{label:"客户简称",field:"customerShortName",component:"Input",slot:"customerPicker",ifShow:!1},{label:"供应商ID",field:"supplierId",component:"Input",show:!1},{label:"供应商简称",field:"supplierShortName",component:"Input",slot:"supplierPicker",ifShow:!1},{label:"租户ID",field:"tenantId",component:"InputNumber",componentProps:{placeholder:"租户ID,可空",style:{width:"100%"}}}],Re={warehouseCode:{title:"仓库编码",order:0,view:"text"},warehouseName:{title:"仓库名称",order:1,view:"text"},warehouseCategory:{title:"仓库分类",order:2,view:"list",dictCode:"sys_category,name,id"},status:{title:"状态",order:3,view:"list",dictCode:"xslmes_unit_status"}},{createConfirm:ve}=H();const Ue="/xslmes/mesXslWarehouse/exportXls",Oe="/xslmes/mesXslWarehouse/importExcel",De=s=>y.get({url:"/xslmes/mesXslWarehouse/list",params:s});const He=(s,o)=>y.delete({url:"/xslmes/mesXslWarehouse/delete",params:s},{joinParamsToUrl:!0}).then(()=>{o()}),qe=(s,o)=>{ve({iconType:"warning",title:"确认删除",content:"是否删除选中数据",okText:"确认",cancelText:"取消",onOk:()=>y.delete({url:"/xslmes/mesXslWarehouse/deleteBatch",data:s},{joinParamsToUrl:!0}).then(()=>{o()})})},Ce=(s,o)=>{const r=o?"/xslmes/mesXslWarehouse/edit":"/xslmes/mesXslWarehouse/add";return y.post({url:r,params:s})},Le=(s,o)=>y.post({url:"/xslmes/mesXslWarehouse/updateStatus",params:s},{joinParamsToUrl:!0}).then(()=>{o==null||o()}),xe=ce({__name:"MesXslWarehouseModal",emits:["register","success"],setup(s,{emit:o}){const{createMessage:r}=H(),P=o,f=b(!0),d=b(!1),g=b(""),l=b(""),[p,{openModal:v}]=D(),[q,{openModal:L}]=D(),[j,{setProps:G,resetFields:V,setFieldsValue:S,validate:J,scrollToField:$,getFieldsValue:T,updateSchema:Y}]=Se({labelWidth:120,schemas:ye,showActionButtonGroup:!1,baseColProps:{span:24}});function W(e){return I(this,null,function*(){yield Y([{field:"customerShortName",ifShow:e===C},{field:"supplierShortName",ifShow:e===x}])})}function _(e){return I(this,null,function*(){const t=e!=null&&e!==""?String(e):"";if(!t){l.value="",yield W("");return}try{const a=yield y.get({url:"/sys/category/queryById",params:{id:t}});l.value=(a==null?void 0:a.code)!=null?String(a.code):""}catch(a){l.value=""}yield W(l.value)})}const[z,{setModalProps:X,closeModal:K}]=he(e=>I(null,null,function*(){if(yield V(),X({confirmLoading:!1,showCancelBtn:!!(e!=null&&e.showFooter),showOkBtn:!!(e!=null&&e.showFooter)}),f.value=!!(e!=null&&e.isUpdate),d.value=!(e!=null&&e.showFooter),i(f)){const t=e.record||{},a=t.warehouseCategory!=null&&t.warehouseCategory!==""?String(t.warehouseCategory):"";g.value=a,yield S(M({},t)),yield _(a)}else g.value="",l.value="",yield S({status:"0"}),yield W("");G({disabled:!(e!=null&&e.showFooter)})})),Q=pe(()=>i(f)?i(d)?"仓库详情":"编辑仓库":"新增仓库");function Z(e,t){return I(this,null,function*(){const a=t!=null&&t!==""?String(t):"";if(a===""){g.value="",yield _(""),e.customerId=void 0,e.customerShortName="",e.supplierId=void 0,e.supplierShortName="";return}if(a===g.value)return;g.value=a,yield _(a);const w=l.value;w===C?(e.supplierId=void 0,e.supplierShortName=""):w===x?(e.customerId=void 0,e.customerShortName=""):(e.customerId=void 0,e.customerShortName="",e.supplierId=void 0,e.supplierShortName="")})}function A(e){const t=l.value;return t===C?(e.supplierId=void 0,e.supplierShortName=""):t===x?(e.customerId=void 0,e.customerShortName=""):(e.customerId=void 0,e.customerShortName="",e.supplierId=void 0,e.supplierShortName=""),e}function ee(){if(l.value!==C){r.warning("请先选择仓库分类为「客户库」");return}const e=T();v(!0,{multiple:!1,customerIds:e.customerId,customerShortName:e.customerShortName})}function te(e){S({customerId:e.customerIds||void 0,customerShortName:e.customerShortName||""})}function se(e){e.customerId=void 0,e.customerShortName="",S({customerId:void 0,customerShortName:""})}function oe(){if(l.value!==x){r.warning("请先选择仓库分类为「供应商库」");return}const e=T();L(!0,{supplierId:e.supplierId})}function re(e){S({supplierId:e.supplierId||void 0,supplierShortName:e.supplierShortName||""})}function ae(e){e.supplierId=void 0,e.supplierShortName="",S({supplierId:void 0,supplierShortName:""})}function le(){return I(this,null,function*(){try{const e=yield J();yield _(e.warehouseCategory!=null?String(e.warehouseCategory):"");const t=A(M({},e)),a=l.value;if(a===C&&!t.customerId){r.warning("客户库须选择客户");return}if(a===x&&!t.supplierId){r.warning("供应商库须选择供应商");return}X({confirmLoading:!0}),yield Ce(t,i(f)),K(),P("success")}catch(e){if(e!=null&&e.errorFields){const t=e.errorFields[0];t&&$(t.name,{behavior:"smooth",block:"center"})}return Promise.reject(e)}finally{X({confirmLoading:!1})}})}return(e,t)=>{const a=F("a-input"),w=F("a-button"),E=F("a-input-group");return B(),k(i(me),de(e.$attrs,{onRegister:i(z),destroyOnClose:"",title:Q.value,width:720,onOk:le}),{default:u(()=>[c(i(Ie),{onRegister:i(j),name:"MesXslWarehouseForm"},{warehouseCategoryField:u(({model:n,field:h})=>[c(i(we),{value:n[h],"onUpdate:value":m=>n[h]=m,pcode:"XSLMES_WH",placeholder:"请选择仓库分类(系统-分类字典)",disabled:d.value,onChange:m=>Z(n,m)},null,8,["value","onUpdate:value","disabled","onChange"])]),customerPicker:u(({model:n,field:h})=>[c(E,{compact:"",style:{display:"flex",width:"100%"}},{default:u(()=>[c(a,{value:n[h],"onUpdate:value":m=>n[h]=m,"read-only":"",placeholder:"分类为客户库时请选择客户",style:{flex:"1"}},null,8,["value","onUpdate:value"]),c(w,{type:"primary",disabled:d.value,onClick:ee},{default:u(()=>[...t[0]||(t[0]=[N("选择客户",-1)])]),_:1},8,["disabled"]),n.customerId&&!d.value?(B(),k(w,{key:0,onClick:m=>se(n)},{default:u(()=>[...t[1]||(t[1]=[N("清除",-1)])]),_:1},8,["onClick"])):O("",!0)]),_:2},1024)]),supplierPicker:u(({model:n,field:h})=>[c(E,{compact:"",style:{display:"flex",width:"100%"}},{default:u(()=>[c(a,{value:n[h],"onUpdate:value":m=>n[h]=m,"read-only":"",placeholder:"分类为供应商库时请选择供应商",style:{flex:"1"}},null,8,["value","onUpdate:value"]),c(w,{type:"primary",disabled:d.value,onClick:oe},{default:u(()=>[...t[2]||(t[2]=[N("选择供应商",-1)])]),_:1},8,["disabled"]),n.supplierId&&!d.value?(B(),k(w,{key:0,onClick:m=>ae(n)},{default:u(()=>[...t[3]||(t[3]=[N("清除",-1)])]),_:1},8,["onClick"])):O("",!0)]),_:2},1024)]),_:1},8,["onRegister"]),c(fe,{onRegister:i(p),onSelect:te},null,8,["onRegister"]),c(ge,{onRegister:i(q),onSelect:re},null,8,["onRegister"])]),_:1},16,["onRegister","title"])}}}),je=Object.freeze(Object.defineProperty({__proto__:null,default:xe},Symbol.toStringTag,{value:"Module"}));export{je as M,C as W,xe as _,x as a,qe as b,Ue as c,Ee as d,Te as e,He as f,Oe as g,De as l,Re as s,Le as u};
|