index.d62c2482.js 5.3 KB

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