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