import{_ as Z,d as q,W as H,x as B,aO as R,r as F,o as r,G as D,D as f,m as p,a as S,l as h,c as E,F as L,E as M,M as C,L as k,J as P,aZ as m,Q as T,R as G,h as J}from"./index.js";import{e as Q}from"./execl-upload.7c83427b.js";import{b as K}from"./index.24943c38.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"},X=["spuCode","tax","cat_code"],Y=()=>{const n=[{type:"index",width:"50",fixed:"left",label:"\u5E8F\u53F7"}];return N.forEach((b,v)=>{n.push({prop:"value"+v,label:b,minWidth:"120px"})}),n};const $=n=>(T("data-v-1e450e72"),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=q({__name:"index",props:{isZx:{type:String,required:!0,default:"1"}},emits:["onSuccess"],setup(n,{expose:b,emit:v}){const A=n,I=H(),y=B(!1),a=B(!1),t=B([]),V=Y(),j=R(),z=({results:i,header:c})=>{if(a.value=!0,i.length===0){m.error("\u8868\u683C\u65E0\u6709\u6548\u6570\u636E\uFF01"),a.value=!1;return}let s=!0;if(c.length!==N.length?s=!1:N.forEach((o,_)=>{o!==c[_]&&(s=!1)}),!s){m.error("\u8868\u5934\u4E0E\u5BFC\u5165\u6A21\u677F\u4E0D\u5339\u914D\uFF01"),a.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 o=[...new Set(t.value.map(({value3: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)})){m.error("\u8BF7\u5BFC\u51652024\u5E748\u670816\u65E5\u524D\u7684\u5546\u54C1"),t.value=[],a.value=!1;return}else if(o.length!==1){m.error("\u4E0A\u4F20\u7684\u4E70\u5165\u65B9\u516C\u53F8\u5FC5\u987B\u4E00\u81F4"),t.value=[],a.value=!1;return}else if(o[0]!==I.currentCompany.value.companyName){m.error("\u4E0A\u4F20\u7684\u4E70\u5165\u65B9\u516C\u53F8\u4E0E\u5F53\u524D\u9009\u62E9\u516C\u53F8\u5FC5\u987B\u4E00\u81F4"),t.value=[],a.value=!1;return}a.value=!1}catch(o){return o}},W=async()=>{if(a.value)return;a.value=!0;const i=[];t.value.forEach((o,_)=>{const d={};Object.keys(o).forEach(u=>{const e=x[u],l=o[u];switch(e){case"tax":d[e]=l*100+"%";break;default:d[e]=l;break}}),i.push(d)});const{code:c,message:s}=await K({list:i,status:"1",isZx:A.isZx});a.value=!1,j({code:c,message:s,handler:()=>{m.success("\u6570\u636E\u5BFC\u5165\u6210\u529F\uFF01"),v("onSuccess"),y.value=!1}})},O=()=>{t.value=[]};return b({onDisplay:()=>(y.value=!0,t.value=[])}),(i,c)=>{const s=F("el-button"),o=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\u7C7B\u76EE\u7ED3\u679C",width:"1040px",top:"8vh",center:"","close-on-click-modal":!1,"close-on-press-escape":!1},{default:f(()=>[t.value.length===0?(r(),D(p(Q),{key:0,onOnSuccess:z})):S("v-if",!0),h(d,{data:t.value,stripe:"",border:"","max-height":"500px",size:"small",style:{width:"100%"}},{default:f(()=>[(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:f(()=>[p(x)[e.prop]==="inv_tag"||p(x)[e.prop]==="addTax"?(r(),E("p",ee,[C(k(e.label)+" ",1),h(o,{placement:"top-start",title:"\u9009\u9879",width:200,trigger:"hover",content:"\u514D\u7A0E\u3001\u4E0D\u5F81\u7A0E\u3001\u96F6\u7A0E\u7387"},{reference:f(()=>[h(s,{link:"",size:"small",icon:p(P)("question-filled")},null,8,["icon"])]),_:1})])):!p(X).includes(p(x)[e.prop])||e.label==="\u5E8F\u53F7"?(r(),E("span",ue,k(e.label),1)):(r(),E("p",te,[ae,C(" "+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:f(()=>[C("\u53D6\u6D88")]),_:1}),h(s,{size:"small",type:"primary",loading:a.value,onClick:W},{default:f(()=>[C("\u4FDD\u5B58")]),_:1},8,["loading"])])):S("v-if",!0)]),_:1},8,["modelValue"])}}});var ie=Z(le,[["__scopeId","data-v-1e450e72"],["__file","C:/Users/89793/Desktop/projects/settle-vue3/src/views/InvoiceSaleSettings/_component/procure-import/index.vue"]]);export{ie as default};