index.8c2cb5.js 4.2 KB

1
  1. import{_ as W,d as O,W as U,w as b,aO as H,r as f,o as s,G as B,C as _,l as i,a as S,j as F,c as h,F as R,D as q,M as y,L as D,J as L,aZ as E,Q as M,R as P,h as T}from"./index.js";import{e as G}from"./execl-upload.d3ce6778.js";import{c as J}from"./index.a5f19a12.js";import"./xlsx.ed122d16.js";const k=["\u5546\u54C1\u7F16\u7801","\u5546\u54C1\u540D\u79F0","\u4E70\u5165\u65B9\u516C\u53F8\u7F16\u7801","\u4E70\u5165\u65B9\u516C\u53F8\u540D\u79F0","\u5356\u51FA\u65B9\u516C\u53F8\u7F16\u7801","\u5356\u51FA\u65B9\u516C\u53F8\u540D\u79F0","\u7A0E\u7387","\u7C7B\u76EE\u7F16\u7801","\u5F00\u7968\u5546\u54C1\u540D\u79F0"],C={value0:"spuCode",value1:"spuName",value2:"companyNo",value3:"companyName",value4:"suppplierNo",value5:"supplierName",value6:"tax",value7:"cat_code",value8:"inv_good_name"},Q=["spuCode","tax","cat_code"],Z=()=>{const n=[{type:"index",width:"50",fixed:"left",label:"\u5E8F\u53F7"}];return k.forEach((g,m)=>{n.push({prop:"value"+m,label:g,minWidth:"120px"})}),n};const K=n=>(M("data-v-1e450e72"),n=n(),P(),n),X={key:0,class:"flex"},Y={key:1},$={key:2},ee=K(()=>T("span",{style:{color:"#f56c6c","font-size":"14px"}},"* ",-1)),ue={key:1,flex:"","justify-end":"","gap-2":"",style:{padding:"10px 0 0 0"}},ae=O({__name:"index",emits:["onSuccess"],setup(n,{expose:g,emit:m}){const N=U(),x=b(!1),t=b(!1),u=b([]),A=Z(),I=H(),V=({results:d,header:r})=>{if(t.value=!0,d.length===0){E.error("\u8868\u683C\u65E0\u6709\u6548\u6570\u636E\uFF01"),t.value=!1;return}let o=!0;if(r.length!==k.length?o=!1:k.forEach((a,l)=>{a!==r[l]&&(o=!1)}),!o){E.error("\u8868\u5934\u4E0E\u5BFC\u5165\u6A21\u677F\u4E0D\u5339\u914D\uFF01"),t.value=!1;return}u.value=[];try{for(const l of d){const c=Object.values(l);let p={};c.forEach((e,v)=>{const w="value"+v;p[w]=e+"";const te=C[w]}),u.value.push(p)}const a=[...new Set(u.value.map(({value3:l})=>l))];if(a.length!==1){E.error("\u4E0A\u4F20\u7684\u4E70\u5165\u65B9\u516C\u53F8\u5FC5\u987B\u4E00\u81F4"),u.value=[];return}else if(a[0]!==N.currentCompany.value.companyName){E.error("\u4E0A\u4F20\u7684\u4E70\u5165\u65B9\u516C\u53F8\u4E0E\u5F53\u524D\u9009\u62E9\u516C\u53F8\u5FC5\u987B\u4E00\u81F4"),u.value=[],t.value=!1;return}t.value=!1}catch(a){return a}},j=async()=>{if(t.value)return;t.value=!0;const d=[];u.value.forEach((a,l)=>{const c={};Object.keys(a).forEach(p=>{const e=C[p],v=a[p];switch(e){case"tax":c[e]=v*100+"%";break;default:c[e]=v;break}}),d.push(c)});const{code:r,message:o}=await J({list:d,status:"1"});t.value=!1,I({code:r,message:o,handler:()=>{E.success("\u6570\u636E\u5BFC\u5165\u6210\u529F\uFF01"),m("onSuccess"),x.value=!1}})},z=()=>{u.value=[]};return g({onDisplay:()=>(x.value=!0,u.value=[])}),(d,r)=>{const o=f("el-button"),a=f("el-popover"),l=f("el-table-column"),c=f("el-table"),p=f("el-dialog");return s(),B(p,{modelValue:x.value,"onUpdate:modelValue":r[0]||(r[0]=e=>x.value=e),title:"\u6279\u91CF\u5BFC\u5165\u91C7\u8D2D\u8BBE\u7F6E\u7C7B\u76EE\u7ED3\u679C",width:"1040px",top:"8vh",center:""},{default:_(()=>[u.value.length===0?(s(),B(i(G),{key:0,onOnSuccess:V})):S("v-if",!0),F(c,{data:u.value,stripe:"",border:"","max-height":"500px",size:"small",style:{width:"100%"}},{default:_(()=>[(s(!0),h(R,null,q(i(A),(e,v)=>(s(),B(l,{type:e.type,minWidth:e.minWidth,fixed:e.fixed,key:v,prop:e.prop,"show-overflow-tooltip":""},{header:_(()=>[i(C)[e.prop]==="inv_tag"||i(C)[e.prop]==="addTax"?(s(),h("p",X,[y(D(e.label)+" ",1),F(a,{placement:"top-start",title:"\u9009\u9879",width:200,trigger:"hover",content:"\u514D\u7A0E\u3001\u4E0D\u5F81\u7A0E\u3001\u96F6\u7A0E\u7387"},{reference:_(()=>[F(o,{link:"",size:"small",icon:i(L)("question-filled")},null,8,["icon"])]),_:1})])):!i(Q).includes(i(C)[e.prop])||e.label==="\u5E8F\u53F7"?(s(),h("span",Y,D(e.label),1)):(s(),h("p",$,[ee,y(" "+D(e.label),1)]))]),_:2},1032,["type","minWidth","fixed","prop"]))),128))]),_:1},8,["data"]),u.value.length!==0?(s(),h("div",ue,[F(o,{size:"small",onClick:z},{default:_(()=>[y("\u53D6\u6D88")]),_:1}),F(o,{size:"small",type:"primary",loading:t.value,onClick:j},{default:_(()=>[y("\u4FDD\u5B58")]),_:1},8,["loading"])])):S("v-if",!0)]),_:1},8,["modelValue"])}}});var re=W(ae,[["__scopeId","data-v-1e450e72"],["__file","C:/Users/63107/Desktop/projects/settle-vue3/src/views/InvoiceSaleSettings/_component/procure-import/index.vue"]]);export{re as default};