2 lines
5.3 KiB
Java
2 lines
5.3 KiB
Java
var _=(M,b,p)=>new Promise((n,l)=>{var a=u=>{try{d(p.next(u))}catch(N){l(N)}},S=u=>{try{d(p.throw(u))}catch(N){l(N)}},d=u=>u.done?n(u.value):Promise.resolve(u.value).then(a,S);d((p=p.apply(M,b)).next())});import{d as P,aC as E,as as L,u as k,aG as z,aF as F,k as R,r as W,f as B}from"./vue-vendor-C7Zq48Yl.js";import{B as q}from"./index-Du0A3ksf.js";import{u as G}from"./index-BgJbdjPf.js";import{l as V,q as v}from"./MesXslCustomer.api-CkDsRb9F.js";import{ak as X}from"./index-BI6CMai0.js";import $ from"./BasicTable-DfLkrEeh.js";import"./BasicModal-0sAdFEk_.js";import"./ModalHeader-keHdAHWH.js";import"./antd-vue-vendor-BPnV8VqP.js";import"./useTimeout-DDl4l82I.js";import"./vxe-table-vendor-B88kchpX.js";import"./index-DeEq83Ov.js";import"./useWindowSizeFn-PRZSD86C.js";import"./index-pxs5MULf.js";import"./index-BgYCgfME.js";import"./index-f8O7TghW.js";import"./useIntersectionObserver-BMxdTqP3.js";import"./componentMap-BBZeqR-K.js";import"./useFormItem-BdW6EoZe.js";import"./download-UE0L9Rfp.js";import"./base64Conver-24EVOS6V.js";import"./index-CIBZG4nR.js";import"./index-BhQEwnQQ.js";import"./useCountdown-DqnNWBp6.js";import"./useFormItemSingle-BbRhswfn.js";import"./JSelectUser-B71zikzw.js";import"./props-DAezUTeZ.js";import"./JSelectBiz-CnEaVMUF.js";import"./JAddInput-D6qcyZjQ.js";import"./areaDataUtil-CbYCy3Ig.js";import"./index-CNkz_PUv.js";import"./index-CUdllngZ.js";import"./bem-EhXRi4nW.js";import"./props-D4vdsy3J.js";import"./useContextMenu-Cwx1lIOK.js";import"./depart.api-DeMNV8zW.js";import"./TreeIcon-DE4jdeZV.js";import"./JSelectDept-DRDVeruW.js";import"./JPopup-Bva6u6tk.js";import"./usePopBiz-CG0vVpgI.js";import"./useMethods-DVip17X8.js";import"./index-Dg4HCEvo.js";import"./JEllipsis-DqRFTSm0.js";import"./JUpload-Cz9HN61B.js";import"./index-MGIrEF-A.js";import"./index-MREkPhsT.js";import"./index-Di-j2gt4.js";import"./BasicForm-BJnSRkIE.js";import"./useForm-BZtHZyx2.js";import"./JAreaLinkage-BeRUFHSB.js";import"./JCodeEditor-CLVZA7Uj.js";import"./htmlmixed-NhwyF9-q.js";import"./vue-CgbRSACy.js";/* empty css */import"./EasyCronInput-7xfJ3nBh.js";import"./injectionKey-DPVn4AgL.js";const Jt=P({__name:"MesXslCustomerSelectModal",emits:["register","select"],setup(M,{emit:b}){const p=b,n=W({}),l=B(null),a=B(!0);function S(e,m){var i;if(!a.value){if(l.value=(i=m==null?void 0:m[0])!=null?i:null,l.value){const t=l.value,r=t.customerShortName&&String(t.customerShortName).trim()||"";n[t.id]=r||t.customerName||""}return}m.forEach(t=>{const r=t.customerShortName&&String(t.customerShortName).trim()||"";n[t.id]=r||t.customerName||""}),Object.keys(n).forEach(t=>{e.includes(t)||delete n[t]})}const[d,{reload:u,setProps:N,getSelectRowKeys:f,getSelectRows:y,setSelectedRowKeys:I,clearSelectedRowKeys:C}]=G({api:V,beforeFetch:e=>Object.assign(e,{status:"0"}),columns:[{title:"客户编码",dataIndex:"customerCode",width:120},{title:"客户名称",dataIndex:"customerName",width:160},{title:"客户简称",dataIndex:"customerShortName",width:120}],rowKey:"id",useSearchForm:!0,formConfig:{labelWidth:80,schemas:[{label:"客户名称",field:"customerName",component:"Input",colProps:{span:8}},{label:"客户简称",field:"customerShortName",component:"Input",colProps:{span:8}}]},pagination:{pageSize:10},canResize:!1,showIndexColumn:!1,immediate:!0,rowSelection:{type:"checkbox",columnWidth:48,onChange:S},clickToRowSelect:!1}),[T,{setModalProps:x,closeModal:g}]=X(e=>_(null,null,function*(){Object.keys(n).forEach(t=>delete n[t]),l.value=null,C==null||C(),a.value=(e==null?void 0:e.multiple)!==!1,N({rowSelection:{type:a.value?"checkbox":"radio",columnWidth:48,onChange:S},clickToRowSelect:!a.value}),x({confirmLoading:!1});const m=e==null?void 0:e.customerIds,i=e==null?void 0:e.customerShortName;if(m){const t=String(m).split(",").map(o=>o.trim()).filter(Boolean),r=(i||"").split(",");t.forEach((o,s)=>{var h;n[o]=((h=r[s])==null?void 0:h.trim())||""});const c=a.value?t:t.length?[t[0]]:[];if(c.length&&(I==null||I(c)),!a.value&&c.length)try{const o=yield v({id:c[0]}),s=(o==null?void 0:o.id)!=null?o:o==null?void 0:o.result;s&&(l.value=s)}catch(o){}for(const o of t)if(!n[o])try{const s=yield v({id:o}),h=(s==null?void 0:s.id)!=null?s:s==null?void 0:s.result;if(h){const O=h.customerShortName&&String(h.customerShortName).trim()||"";n[o]=O||h.customerName||""}}catch(s){}}u()}));function j(){return _(this,null,function*(){if(!a.value){const m=(f==null?void 0:f())||[];let i=l.value||((y==null?void 0:y())||[])[0];if(!i&&m.length)try{const r=yield v({id:m[0]});i=(r==null?void 0:r.id)!=null?r:r==null?void 0:r.result}catch(r){}if(!(i!=null&&i.id)){p("select",{customerIds:"",customerShortName:""}),g();return}const t=i.customerShortName&&String(i.customerShortName).trim()||i.customerName||"";p("select",{customerIds:i.id,customerShortName:t}),g();return}const e=(f==null?void 0:f())||[];if(!e.length){g();return}x({confirmLoading:!0});try{const m=[];for(const t of e){let r=n[t];if(!r)try{const c=yield v({id:t}),o=(c==null?void 0:c.id)!=null?c:c==null?void 0:c.result;o&&(r=o.customerShortName&&String(o.customerShortName).trim()||""||o.customerName||"",n[t]=r)}catch(c){}m.push(r||"")}const i=m.join(",");p("select",{customerIds:e.join(","),customerShortName:i})}finally{x({confirmLoading:!1})}g()})}return(e,m)=>(L(),E(k(q),z(e.$attrs,{title:"选择客户",width:960,onRegister:k(T),onOk:j}),{default:F(()=>[R(k($),{onRegister:k(d)},null,8,["onRegister"])]),_:1},16,["onRegister"]))}});export{Jt as default};
|