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