import{_ as U,d as Z,O as P,n as B,cb as R,r as _,o as r,A as D,y as d,i as c,a as A,h as F,c as E,F as T,z as G,H as b,G as k,D as L,e as M,cm as m}from"./index.js";import{e as J}from"./execl-upload.d28cb458.js";import{b as K}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"},Q=["spuCode","tax","cat_code"],X=()=>{const x=[{type:"index",width:"50",fixed:"left",label:"\u5E8F\u53F7"}];return N.forEach((C,f)=>{x.push({prop:"value"+f,label:C,minWidth:"120px"})}),x};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=Z({__name:"index",props:{isZx:{type:String,required:!0,default:"1"}},emits:["onSuccess"],setup(x,{expose:C,emit:f}){const S=x,V=P(),y=B(!1),o=B(!1),t=B([]),z=X(),j=f,H=R(),I=({results:i,header:a})=>{if(o.value=!0,i.length===0){m.error("\u8868\u683C\u65E0\u6709\u6548\u6570\u636E\uFF01"),o.value=!1;return}let n=!0;if(a.length!==N.length?n=!1:N.forEach((l,v)=>{l!==a[v]&&(n=!1)}),!n){m.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 s={};e.forEach((g,q)=>{const w="value"+q;s[w]=g+"";const ae=h[w]}),t.value.push(s)}const l=[...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),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=[],o.value=!1;return}else if(l.length!==1){m.error("\u4E0A\u4F20\u7684\u4E70\u5165\u65B9\u516C\u53F8\u5FC5\u987B\u4E00\u81F4"),t.value=[],o.value=!1;return}else if(l[0]!==V.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=[],o.value=!1;return}o.value=!1}catch(l){return l}},O=async()=>{if(o.value)return;o.value=!0;const i=[];t.value.forEach((l,v)=>{const p={};Object.keys(l).forEach(u=>{const e=h[u],s=l[u];switch(e){case"tax":p[e]=s*100+"%";break;default:p[e]=s;break}}),i.push(p)});const{code:a,message:n}=await K({list:i,status:"1",isZx:S.isZx});o.value=!1,H({code:a,message:n,handler:()=>{m.success("\u6570\u636E\u5BFC\u5165\u6210\u529F\uFF01"),j("onSuccess"),y.value=!1}})},W=()=>{t.value=[]};return C({onDisplay:()=>(y.value=!0,t.value=[])}),(i,a)=>{const n=_("el-button"),l=_("el-popover"),v=_("el-table-column"),p=_("el-table"),u=_("el-dialog");return r(),D(u,{modelValue:y.value,"onUpdate:modelValue":a[0]||(a[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:d(()=>[t.value.length===0?(r(),D(c(J),{key:0,onOnSuccess:I})):A("v-if",!0),F(p,{data:t.value,stripe:"",border:"","max-height":"500px",size:"small",style:{width:"100%"}},{default:d(()=>[(r(!0),E(T,null,G(c(z),(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),F(l,{placement:"top-start",title:"\u9009\u9879",width:200,trigger:"hover",content:"\u514D\u7A0E\u3001\u4E0D\u5F81\u7A0E\u3001\u96F6\u7A0E\u7387"},{reference:d(()=>[F(n,{link:"",size:"small",icon:c(L)("question-filled")},null,8,["icon"])]),_:1})])):!c(Q).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,[F(n,{size:"small",onClick:W},{default:d(()=>a[2]||(a[2]=[b("\u53D6\u6D88")])),_:1}),F(n,{size:"small",type:"primary",loading:o.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-1e450e72"],["__file","D:/work/jiesuan/settle-vue3/src/views/InvoiceSaleSettings/_component/procure-import/index.vue"]]);export{re as default};
