1 |
- import{by as Q,a7 as w,_ as X,d as Z,O as uu,m as h,bs as eu,bz as tu,r as O,o as B,A as S,x as _,h as D,a as V,f as y,c as x,F as lu,y as au,G as I,e as ou,H as M,bm as L,ac as iu,bt as ru,az as q,bp as U}from"./index.js";import{g as su}from"./index.004a0bb2.js";import{e as nu}from"./execl-upload.8692a4ce.js";import{b as pu,c as z,d as du}from"./status.b7512d56.js";import{E as cu}from"./index.71c29d4d.js";import{I as fu}from"./index.e25db4d1.js";import{m as N}from"./shared.129caa24.js";const b=[{type:"index",fixed:"left",label:"\u5E8F\u53F7",width:"50"},{label:"\u8D2D\u4E70\u65B9\u516C\u53F8\u7EB3\u7A0E\u53F7",prop:"buyer_code",minWidth:"130px",required:!0,defaultData:["91110118MACEA1R94G","91110118MACEA1R94G"]},{label:"\u8D2D\u4E70\u65B9\u516C\u53F8\u540D\u79F0",prop:"buyer_name",minWidth:"130px",required:!0,defaultData:["\u5317\u4EAC\u9526\u5174\u5F18\u660C\u79D1\u6280\u6709\u9650\u516C\u53F8","\u5317\u4EAC\u9526\u5174\u5F18\u660C\u79D1\u6280\u6709\u9650\u516C\u53F8"]},{label:"\u9500\u552E\u65B9\u516C\u53F8\u7EB3\u7A0E\u53F7",prop:"seller_code",minWidth:"130px",required:!0,defaultData:["91110113MA008J790J","91110113MA008J790J"]},{label:"\u9500\u552E\u65B9\u516C\u53F8\u540D\u79F0",prop:"seller_name",minWidth:"130px",required:!0,defaultData:["\u5317\u4EAC\u767E\u8FB0\u8363\u8FBE\u56FD\u9645\u79D1\u8D38\u6709\u9650\u516C\u53F8","\u5317\u4EAC\u767E\u8FB0\u8363\u8FBE\u56FD\u9645\u79D1\u8D38\u6709\u9650\u516C\u53F8"]},{label:"\u5546\u54C1\u6765\u6E90",prop:"good_source",minWidth:"100px",required:!0,defaultData:["\u91C7\u9500\u7ED3\u7B97","\u975E\u91C7\u9500\u7ED3\u7B97"]},{label:"\u8BA2\u5355\u5546\u54C1\u7C7B\u578B",prop:"good_type",minWidth:"120px",required:!0,defaultData:["\u54A8\u8BE2\u5546\u54C1","\u5E93\u5B58\u5546\u54C1"]},{label:"\u6210\u672C\u72B6\u6001",prop:"basic_status",minWidth:"120px",required:!0,defaultData:["\u771F\u5B9E\u6210\u672C","\u9884\u4F30\u6210\u672C"]},{label:"\u53D1\u7968\u5546\u54C1\u540D\u79F0",prop:"inv_good_name",minWidth:"100px",required:!0,defaultData:["\u6CF0\u5EB7\u4E13\u7248\u91D1\u94A5\u53195g","\u62C9\u6746\u7BB1"]},{label:"\u8BA2\u5355\u5546\u54C1\u540D\u79F0",prop:"goodName",minWidth:"100px",required:!0,defaultData:["\u6CF0\u5EB7\u4E13\u7248\u91D1\u94A5\u53195g","\u62C9\u6746\u7BB1"]},{label:"\u5546\u54C1\u7F16\u53F7",prop:"skuCode",minWidth:"100px",required:"\u5546\u54C1\u6765\u6E90\u4E3A\u91C7\u9500\u7ED3\u7B97\u65F6\u5FC5\u586B",defaultData:["SKU2408091355123018",""]},{label:"\u8BA2\u5355\u5355\u4F4D",prop:"unit",minWidth:"80px",required:!0,defaultData:["\u4E2A","\u4E2A"]},{label:"\u89C4\u683C",prop:"spec",minWidth:"80px",defaultData:["",""]},{label:"\u91CD\u91CF(g)",prop:"unit_weight",minWidth:"80px",defaultData:["",""]},{label:"\u53D1\u7968\u7C7B\u578B",prop:"inv_type",minWidth:"80px",required:!0,defaultData:["\u4E13\u7968","\u666E\u7968"]},{label:"\u6210\u672C\u7A0E\u524D\u5355\u4EF7",prop:"subunit_price",minWidth:"110px",required:!0,defaultData:["725.2","194.04"]},{label:"\u6210\u672C\u7A0E\u540E\u5355\u4EF7",prop:"unit_price",minWidth:"110px",required:!0,defaultData:["725.2","194.04"]},{label:"\u5546\u54C1\u4EE3\u7801",prop:"good_code",minWidth:"110px",defaultData:["",""]},{label:"\u8FDB\u9879\u7A0E\u76EE\u7F16\u53F7",prop:"cat_code",required:!0,minWidth:"110px",defaultData:["6160000000000000000","6160000000000000000"]},{label:"\u8FDB\u9879\u7A0E\u7387",prop:"cat_tax",required:!0,minWidth:"110px",defaultData:["1%","3%"]},{label:"\u5206\u5149",prop:"spectral",minWidth:"110px",defaultData:["",""]}],Tu=new Array(3).fill(1).map((t,u)=>b.slice(1).reduce((d,n)=>{const v=u===0;let r="";return v?typeof n.required=="string"?r=n.required:r=n.required?"\u5FC5\u586B":"":r=n.defaultData[u-1],{...d,[n.label]:r}},{})),mu=b.reduce((t,u)=>({...t,[u.label]:u.prop}),{}),R=b.reduce((t,u)=>({...t,[u.prop]:u.label}),{}),Eu=b.filter(t=>!!t.required&&typeof t.required=="boolean").map(t=>t.prop),Cu=[{value:"1",label:"\u5165\u5E93"},{value:"2",label:"\u51FA\u5E93"},{value:"3",label:"\u5165\u5E93\u7EA2\u51B2"},{value:"4",label:"\u51FA\u5E93\u7EA2\u51B2"}];Cu.reduce((t,u)=>({...t,[u.label]:u.value}),{});const j=[{value:"1",label:"\u91C7\u9500\u7ED3\u7B97"},{value:"2",label:"\u975E\u91C7\u9500\u7ED3\u7B97"}],bu=j.reduce((t,u)=>({...t,[u.label]:u.value}),{}),W=[{value:"1",label:"\u771F\u5B9E\u6210\u672C"},{value:"2",label:"\u9884\u4F30\u6210\u672C"}],G=W.reduce((t,u)=>({...t,[u.label]:u.value}),{});W.reduce((t,u)=>({...t,[u.value]:u.label}),{});const T=[{value:"0",label:"\u666E\u7968"},{value:"1",label:"\u4E13\u7968"}],H=T.reduce((t,u)=>({...t,[u.label]:u.value}),{});function vu(t){Q({type:"warning",title:"\u6570\u636E\u6821\u9A8C\u5931\u8D25",message:w("div",{style:"display: flex, flex-direction: column"},{default:()=>Object.keys(t).reduce((u,d)=>[...u,w("p",{},"\u7B2C"+d+"\u884C,"+t[d])],[])})})}function Fu(t){const u={};let d=!1,n=!1,v=!1,r=!1,s=!1;for(const c in t){const p=t[c],o=Number(c)+1;for(const l in p){const E=String(p[l]).trim();Eu.includes(l)&&(!E||!String(E).trim())?u[o]?u[o]=u[o]+="\u3001"+R[l]:u[o]=R[l]:l==="basic_status"&&!G[E]?d=!0:l==="good_source"&&!bu[E]?n=!0:l==="inv_type"&&!H[E]?v=!0:l==="good_type"&&!pu[E]?r=!0:l==="skuCode"&&String(p.good_source).trim()==="\u91C7\u9500\u7ED3\u7B97"&&!E&&(s=!0)}u[o]?(u[o]+="\u4E0D\u80FD\u4E3A\u7A7A",d&&(u[o]+=" , \u6210\u672C\u72B6\u6001\u5FC5\u987B\u4E3A"+W.map(({label:l})=>l).join("\u3001")),n&&(u[o]+=" ,\u8BA2\u5355\u6765\u6E90\u5FC5\u987B\u4E3A"+j.map(({label:l})=>l).join("\u3001")),v&&(u[o]+=" ,\u53D1\u7968\u7C7B\u578B\u5FC5\u987B\u4E3A"+T.map(({label:l})=>l).join("\u3001")),r&&(u[o]+=" ,\u5546\u54C1\u7C7B\u578B\u5FC5\u987B\u4E3A"+z.map(({label:l})=>l).join("\u3001")),s&&(u[o]+=" ,\u5546\u54C1\u6765\u6E90\u4E3A\u91C7\u9500\u7ED3\u7B97\u65F6\u5546\u54C1\u7F16\u53F7\u4E0D\u80FD\u4E3A\u7A7A")):(d&&(u[o]="\u6210\u672C\u72B6\u6001\u5FC5\u987B\u4E3A"+W.map(({label:l})=>l).join("\u3001")),n&&(u[o]=" \u8BA2\u5355\u6765\u6E90\u5FC5\u987B\u4E3A"+j.map(({label:l})=>l).join("\u3001")),v&&(u[o]=" \u53D1\u7968\u7C7B\u578B\u5FC5\u987B\u4E3A"+T.map(({label:l})=>l).join("\u3001")),r&&(u[o]="\u5546\u54C1\u7C7B\u578B\u5FC5\u987B\u4E3A"+z.map(({label:l})=>l).join("\u3001")),s&&(u[o]="\u5546\u54C1\u6765\u6E90\u4E3A\u91C7\u9500\u7ED3\u7B97\u65F6\u5546\u54C1\u7F16\u53F7\u4E0D\u80FD\u4E3A\u7A7A"))}return Object.keys(u).length===0?!0:(vu(u),!1)}function Bu(t){return!!Fu(t)}const Du={key:0},gu={key:1},_u={key:1,flex:"","justify-end":"","gap-2":"",style:{padding:"10px 0 0 0"}},yu=Z({__name:"index",props:{visible:{type:Boolean,required:!0}},emits:["refresh"],setup(t,{emit:u}){const d=t,n=u,{getCurrentLicense:v}=uu(),r=h([]),s=h(!1),c=h({visible:!1,list:[],title:""}),p=h({visible:!1,importColumns:[],columns:[]}),o=eu(d,"visible"),l=tu(),E=({results:i,header:e})=>{if(s.value=!0,i.length===0){q.error("\u8868\u683C\u65E0\u6709\u6548\u6570\u636E\uFF01"),s.value=!1;return}let f=!0;if(e.length!==b.length-1?f=!1:b.slice(1).forEach((C,A)=>{C.label!==e[A]&&(f=!1)}),!f){p.value.visible=!0,p.value.importColumns=[...e],p.value.columns=b.slice(1).map(({label:C})=>C),s.value=!1;return}r.value=[];const m=[];for(const C of i){const A={};Object.keys(C).forEach((k,hu)=>{const $=mu[k.replace("_1","")];let F=C[k];k==="\u53D1\u7968\u7C7B\u578B"&&(F=F.replace("(","\uFF08"),F=F.replace(")","\uFF09")),A[$]=F&&String(F).trim()}),m.push(A)}const a=v(),g=[...new Set(m.map(({buyer_code:C})=>C))];if(g.length!==1){q.warning("\u5BFC\u5165\u6570\u636E\u7684\u8D2D\u4E70\u65B9\u516C\u53F8\u5FC5\u987B\u4E00\u81F4");return}if(g[0]!==a){q.warning("\u5BFC\u5165\u6570\u636E\u8D2D\u4E70\u65B9\u516C\u53F8\u4E0E\u5F53\u524D\u9009\u62E9\u516C\u53F8\u4E0D\u4E00\u81F4");return}Bu(m)&&(r.value=m),s.value=!1};function P(i,e){return i=Math.ceil(i),e=Math.floor(e),Math.floor(Math.random()*(e-i+1))+i}function J(){let i=U(new Date).format("YY-MM-DD HH:mm:ss");i=i.replace(/-/g,""),i=i.replace(/:/g,""),i=i.replace(/ /g,"");let e=String(U().get("millisecond"));e.length===2&&(e="0"+e),e.length===1&&(e="00"+e);const f=P(10,99);return"PKU"+i+e+f}const K=async()=>{try{if(s.value)return;s.value=!0;const i=[];r.value.forEach(a=>{N[a.good_source]=="2"&&(a.skuCode=J()),i.push({...a,good_source:N[a.good_source],good_type:du[a.good_type],inv_type:H[a.inv_type],basic_status:G[a.basic_status]})});const{code:e,message:f,data:m}=await su({list:i});if(s.value=!1,e==1004&&m){c.value.visible=!0,c.value.list=m,c.value.title=f;return}l({code:e,message:f,noMessage:!1,handler:()=>{q.success("\u6570\u636E\u5BFC\u5165\u6210\u529F\uFF01"),n("refresh"),o.value=!1}})}catch{}},Y=()=>{r.value=[]};return(i,e)=>{const f=O("el-table-column"),m=O("el-table");return B(),S(D(ru),{modelValue:D(o),"onUpdate:modelValue":e[2]||(e[2]=a=>iu(o)?o.value=a:null),"close-on-click-modal":!1,title:"\u6279\u91CF\u521B\u5EFA\u5546\u54C1",width:"1040px",top:"8vh",center:"",onClose:e[3]||(e[3]=a=>r.value=[])},{default:_(()=>[r.value.length===0?(B(),S(D(nu),{key:0,style:{"margin-bottom":"10px"},onOnSuccess:E})):V("v-if",!0),y(m,{data:r.value,stripe:"",border:"","max-height":"500px",size:"small",style:{width:"100%"}},{default:_(()=>[(B(!0),x(lu,null,au(D(b),(a,g)=>(B(),S(f,{minWidth:a.minWidth,"show-overflow-tooltip":"",fixed:a.fixed,prop:a.prop,type:a.type,key:g},{header:_(()=>[a.required?(B(),x("p",gu,[e[4]||(e[4]=ou("span",{style:{color:"#f56c6c","font-size":"14px"}},"* ",-1)),M(" "+I(a.label),1)])):(B(),x("span",Du,I(a.label),1))]),_:2},1032,["minWidth","fixed","prop","type"]))),128))]),_:1},8,["data"]),r.value.length!==0?(B(),x("div",_u,[y(D(L),{size:"small",onClick:Y},{default:_(()=>e[5]||(e[5]=[M("\u53D6\u6D88")])),_:1}),y(D(L),{size:"small",type:"primary",loading:s.value,onClick:K},{default:_(()=>e[6]||(e[6]=[M("\u4FDD\u5B58")])),_:1},8,["loading"])])):V("v-if",!0),y(cu,{visible:c.value.visible,"onUpdate:visible":e[0]||(e[0]=a=>c.value.visible=a),list:c.value.list,title:c.value.title},null,8,["visible","list","title"]),y(fu,{visible:p.value.visible,"onUpdate:visible":e[1]||(e[1]=a=>p.value.visible=a),"import-columns":p.value.importColumns,columns:p.value.columns},null,8,["visible","import-columns","columns"])]),_:1},8,["modelValue"])}}});var Au=X(yu,[["__file","C:/Users/89793/Desktop/projects/ticket-system/src/views/invoiceInOut/productManager/components/BatchCreateModal/index.vue"]]),wu=Object.freeze(Object.defineProperty({__proto__:null,default:Au},Symbol.toStringTag,{value:"Module"}));export{Au as B,wu as i,Tu as p};
|