1 |
- import{_ as q,d as L,E as w,aC as P,x as m,o as r,N as S,K as f,u as d,a as U,y as C,c as B,M as Z,L as K,W as y,aS as v,T as j,R as $,$ as G,a0 as J,b as Q}from"./index.1417328f.js";import{e as X}from"./execl-upload.2ed330c3.js";import{d as Y}from"./index.57ad1f95.js";import"./xlsx.ed122d16.js";const V=["\u5546\u54C1\u7F16\u53F7","\u7A0E\u7387","\u7C7B\u76EE\u7F16\u53F7","\u5F00\u7968\u5546\u54C1\u540D\u79F0","\u7A0E\u7387\u6807\u8BC6","\u662F\u5426\u6709\u4F18\u60E0\u653F\u7B56","\u589E\u503C\u7A0E\u7BA1\u7406\u5185\u5BB9"],g={value0:"spuCode",value1:"tax",value2:"cat_code",value3:"inv_good_name",value4:"inv_tag",value5:"is_discount",value6:"addTax"},uu=["spuCode","tax","cat_code","inv_good_name","is_discount"],eu=()=>{const i=[{type:"index",width:"50",fixed:"left",label:"\u5E8F\u53F7"}];return V.forEach((A,E)=>{i.push({prop:"value"+E,label:A,minWidth:E===0||E===1?"120px":"90px"})}),i};const au=i=>(G("data-v-7261064a"),i=i(),J(),i),tu={key:0,class:"flex"},ou={key:1},su={key:2},lu=au(()=>Q("span",{style:{color:"#f56c6c","font-size":"14px"}},"* ",-1)),nu={key:1,flex:"","justify-end":"","gap-2":"",style:{padding:"10px 0 0 0"}},cu=y("\u53D6\u6D88"),ru=y("\u4FDD\u5B58"),iu=L({__name:"index",emits:["onSuccess"],setup(i,{expose:A,emit:E}){const x=w(!1),e=w(!1),c=w([]),W=eu(),D={\u514D\u7A0E:"1",\u4E0D\u5F81\u7A0E:"2",\u96F6\u7A0E\u7387:"3"},I={\u662F:"1",\u5426:"0"},H=P();let b=!1;const M=({results:_,header:o})=>{if(e.value=!0,b=!1,_.length===0){v.error("\u8868\u683C\u65E0\u6709\u6548\u6570\u636E\uFF01"),e.value=!1;return}let a=!0;if(o.length!==V.length?a=!1:V.forEach((s,p)=>{s!==o[p]&&(a=!1)}),!a){v.error("\u8868\u5934\u4E0E\u5BFC\u5165\u6A21\u677F\u4E0D\u5339\u914D\uFF01"),e.value=!1;return}c.value=[];try{for(const s of _){const p=Object.values(s);let l={};p.forEach((t,u)=>{const n="value"+u;switch(l[n]=t+"",g[n]){case"inv_tag":t+""&&!D[t+""]&&(b=!0,l[n]="");break;case"is_discount":t+""&&!I[t+""]&&(b=!0,l[n]="");break}}),c.value.push(l)}e.value=!1}catch(s){return s}},O=async()=>{if(e.value)return;e.value=!0;const _=[],o=[],a=[];if(c.value.forEach((l,t)=>{const u={};Object.keys(l).forEach(z=>{const F=g[z],h=l[z];switch(F){case"tax":u[F]=h*100+"%";break;case"is_discount":u[F]=I[h];break;case"inv_tag":u[F]=h?D[h]:"0";break;default:u[F]=h;break}});const{tax:n,is_discount:k,addTax:N,inv_tag:T}=u;n==="0%"&&k==="1"&&(!N||D[N]!==T)&&o.push(t+1),n==="0%"&&k==="0"&&T!=="3"&&a.push(t+1),_.push(u)}),b){v.warning("\u4E0A\u4F20\u90E8\u5206\u5B57\u6BB5\u89E3\u6790\u4E0D\u6210\u529F,\u8BF7\u6838\u5BF9\u540E\u91CD\u8BD5."),e.value=!1;return}if(o.length>0){v.warning("\u7B2C"+o.join(",")+"\u884C\u6570\u636E\u586B\u5199\u9519\u8BEF,\u7A0E\u7387\u4E3A0\u4E14\u662F\u5426\u6709\u4F18\u60E0\u653F\u7B56\u4E3A\u662F\u65F6,\u589E\u503C\u7A0E\u548C\u6C47\u7387\u6807\u8BC6\u662F\u5FC5\u586B\u9879\uFF0C\u4E14\u589E\u503C\u7A0E\u7BA1\u7406\u5185\u5BB9\u8981\u548C\u6C47\u7387\u6807\u8BC6\u4E00\u81F4"),e.value=!1;return}if(a.length>0){v.warning("\u7B2C"+a.join(",")+"\u884C\u6570\u636E\u586B\u5199\u9519\u8BEF,\u7A0E\u7387\u4E3A0\u4E14\u662F\u5426\u6709\u4F18\u60E0\u653F\u7B56\u4E3A\u5426\u65F6,\u7A0E\u7387\u6807\u8BC6\u503C\u5FC5\u987B\u4E3A:'\u96F6\u7A0E\u7387'"),e.value=!1;return}const{code:s,message:p}=await Y({list:_});e.value=!1,H({code:s,message:p,handler:()=>{v.success("\u6570\u636E\u5BFC\u5165\u6210\u529F\uFF01"),E("onSuccess"),x.value=!1}})},R=()=>{c.value=[]};return A({onDisplay:()=>(x.value=!0,c.value=[])}),(_,o)=>{const a=m("el-button"),s=m("el-popover"),p=m("el-table-column"),l=m("el-table"),t=m("el-dialog");return r(),S(t,{modelValue:x.value,"onUpdate:modelValue":o[0]||(o[0]=u=>x.value=u),title:"\u6279\u91CF\u5BFC\u5165\u8BA4\u8BC1\u7ED3\u679C",width:"1040px",top:"8vh",center:""},{default:f(()=>[c.value.length===0?(r(),S(d(X),{key:0,onOnSuccess:M})):U("v-if",!0),C(l,{data:c.value,stripe:"",border:"","max-height":"500px",size:"small",style:{width:"100%"}},{default:f(()=>[(r(!0),B(K,null,Z(d(W),(u,n)=>(r(),S(p,{type:u.type,minWidth:u.minWidth,fixed:u.fixed,key:n,prop:u.prop,"show-overflow-tooltip":""},{header:f(()=>[d(g)[u.prop]==="inv_tag"||d(g)[u.prop]==="addTax"?(r(),B("p",tu,[y(j(u.label)+" ",1),C(s,{placement:"top-start",title:"\u9009\u9879",width:200,trigger:"hover",content:"\u514D\u7A0E\u3001\u4E0D\u5F81\u7A0E\u3001\u96F6\u7A0E\u7387"},{reference:f(()=>[C(a,{link:"",size:"small",icon:d($)("question-filled")},null,8,["icon"])]),_:1})])):!d(uu).includes(d(g)[u.prop])||u.label==="\u5E8F\u53F7"?(r(),B("span",ou,j(u.label),1)):(r(),B("p",su,[lu,y(" "+j(u.label),1)]))]),_:2},1032,["type","minWidth","fixed","prop"]))),128))]),_:1},8,["data"]),c.value.length!==0?(r(),B("div",nu,[C(a,{size:"small",onClick:R},{default:f(()=>[cu]),_:1}),C(a,{size:"small",type:"primary",loading:e.value,onClick:O},{default:f(()=>[ru]),_:1},8,["loading"])])):U("v-if",!0)]),_:1},8,["modelValue"])}}});var vu=q(iu,[["__scopeId","data-v-7261064a"],["__file","/Users/apple/Desktop/Company Projects/accout-vue3-ui/src/views/InvoiceSaleSettings/_component/execl-files-upload/index.vue"]]);export{vu as default};
|