1 |
- import{_ as L,d as P,x as g,aO as T,r as w,o as t,G as D,D as c,m as k,a as N,l as y,c as h,F as q,E as I,L as C,M as v,aZ as f,Q as M,R,h as S}from"./index.js";import{e as G}from"./execl-upload.7c83427b.js";import{g as $}from"./index.26d6ac45.js";import"./xlsx.ed122d16.js";const V=[{label:"\u53D1\u7968\u4FE1\u606F",child:[{label:"\u53D1\u7968\u660E\u7EC6ID",width:"110px",prop:"itemId",required:!0},{label:"\u5BF9\u8D26\u56DE\u7968\u7F16\u53F7",width:"160px",prop:"hpNo"},{label:"\u53D1\u7968\u7C7B\u578B",width:"120px",prop:"invoiceType"},{label:"\u53D1\u7968\u53F7\u7801",width:"120px",prop:"invoiceNumber"},{label:"\u5F00\u7968\u65E5\u671F",width:"100px",prop:"openDate"},{label:"\u8D2D\u4E70\u65B9\u540D\u79F0",width:"160px",prop:"buyerName"},{label:"\u8D2D\u4E70\u65B9\u7EB3\u7A0E\u4EBA\u8BC6\u522B\u53F7",width:"160px",prop:"buyerId"},{label:"\u9500\u552E\u65B9\u540D\u79F0",width:"160px",prop:"buyerName"},{label:"\u9500\u552E\u65B9\u7EB3\u7A0E\u4EBA\u8BC6\u522B\u53F7",width:"160px",prop:"buyerId"},{label:"\u7C7B\u76EE\u7F16\u53F7",width:"120px",prop:"catCode"},{label:"\u8D27\u7269\u6216\u5E94\u7A0E\u52B3\u52A1\u3001\u670D\u52A1\u540D\u79F0",width:"170px",prop:"name"},{label:"\u5355\u4F4D",width:"80px",prop:"name"},{label:"\u6570\u91CF",width:"80px",prop:"num"},{label:"\u5355\u4EF7",width:"80px",prop:"before_good_price"},{label:"\u91D1\u989D",width:"80px",prop:"amount"},{label:"\u7A0E\u7387",width:"80px",prop:"tax"},{label:"\u7A0E\u989D",width:"80px",prop:"tax_amount"},{label:"\u7A0E\u540E\u5355\u4EF7",width:"80px",prop:"good_price"},{label:"\u7A0E\u540E\u91D1\u989D",width:"80px",prop:"after_tax_amount"}]},{label:"\u91C7\u8D2D\u5355\u5173\u8054\u91D1\u989D",prop:"total_amount",width:"110px",required:!0},{label:"\u8BA2\u5355\u4FE1\u606F",child:[{label:"\u91C7\u8D2D\u5355\u7F16\u53F7",prop:"code",width:"160px",required:!0},{label:"\u9500\u552E\u5355\u7F16\u53F7",prop:"code_1",width:"120px"},{label:"\u4F9B\u8D27\u5546",prop:"supplierName",width:"120px"},{label:"\u4E1A\u52A1\u516C\u53F8",prop:"companyName",width:"120px"},{label:"\u8BA2\u5355\u5355\u4F4D",prop:"orderUnit",width:"90px"},{label:"\u5546\u54C1\u6570\u91CF",prop:"goodNum",width:"90px"},{label:"\u5546\u54C1\u5355\u4EF7",prop:"goodPrice",width:"90px"},{label:"\u603B\u8D27\u6B3E",prop:"totalAmount",width:"90px"},{label:"\u9500\u552E\u4E3B\u5355\u53F7",prop:"goodPrice",width:"120px"},{label:"\u5546\u54C1\u7F16\u7801",prop:"goodCode",width:"120px"},{label:"\u5546\u54C1\u540D\u79F0",prop:"goodName",width:"120px"},{label:"\u8D27\u7269\u548C\u52B3\u52A1\u540D\u79F0",prop:"orderCatCode",width:"120px"},{label:"\u5546\u54C1\u5F00\u7968\u7C7B\u76EE",prop:"goodOpenCatCode",width:"120px"},{label:"\u5546\u54C1\u548C\u670D\u52A1\u5206\u7C7B\u7B80\u79F0",prop:"goodShortName",width:"140px"},{label:"\u5F00\u7968\u7A0E\u7387",prop:"orderTax",width:"100px"},{label:"\u5F00\u7968\u5546\u54C1\u540D\u79F0",prop:"openGoodName",width:"120px"},{label:"\u5F00\u7968\u7C7B\u578B",prop:"openGoodName",width:"100px"},{label:"\u91C7\u8D2D\u5355\u53EF\u5173\u8054\u91D1\u989D",prop:"balance_amount",width:"120px"}]}];function Q(){const r=[],m=new Map,x=[];return V.forEach(({prop:s,label:u,child:a,required:B})=>{s&&(r.push(u),m.set(u,s),B&&x.push({prop:s,label:u})),a&&a.forEach(l=>{r.push(l.label),m.set(l.label,l.prop),l.required&&x.push({prop:l.prop,label:l.label})})}),{initHeader:r,mapLabelToProp:m,requireFields:x}}const j=r=>(M("data-v-2821d250"),r=r(),R(),r),Z={key:0},J={key:1},K=j(()=>S("span",{style:{color:"#f56c6c","font-size":"14px"}},"* ",-1)),W={key:0},X={key:1},Y=j(()=>S("span",{style:{color:"#f56c6c","font-size":"14px"}},"* ",-1)),ee={key:1,flex:"","justify-end":"","gap-2":"",style:{padding:"10px 0 0 0"}},ue=P({__name:"index",emits:["onSuccess"],setup(r,{expose:m,emit:x}){const s=g(!1),u=g(!1),a=g([]),{mapLabelToProp:B,initHeader:l,requireFields:A}=Q(),O=T(),U=({results:b,header:n})=>{if(u.value=!0,b.length===0){f.error("\u8868\u683C\u65E0\u6709\u6548\u6570\u636E\uFF01"),u.value=!1;return}if(n.length!==l.length){f.warning("\u5BFC\u5165\u8868\u5934\u4E0E\u6A21\u677F\u4E0D\u4E00\u81F4"),u.value=!1;return}for(const e in l)if(l[e]!==n[e]){f.warning("\u5BFC\u5165\u8868\u5934\u4E0E\u6A21\u677F\u4E0D\u4E00\u81F4"),u.value=!1;return}const p=[];for(const e of b){const d=Object.keys(e),o={};d.forEach(F=>{o[B.get(F)]=e[F]}),p.push(o)}u.value=!1;const E=A.map(({prop:e})=>e),_=A.map(({label:e})=>e).join("\u3001"),i=[];for(const e in p){const d=p[e];Object.keys(d).forEach(F=>{E.includes(F)&&String(d[F]).trim()===""&&i.indexOf(Number(e)+1)===-1&&i.push(Number(e)+1)})}if(i.length>0){f.error(`\u7B2C ${i.join(",")} \u884C\uFF0C${_}\u4E0D\u80FD\u4E3A\u7A7A\u3002`),u.value=!1;return}a.value=p},z=async()=>{if(u.value)return;let b=[];a.value.forEach(E=>{const{itemId:_,code:i,num:e,total_amount:d,good_price:o}=E;b.push({itemId:_,code:i,num:e,good_price:o,total_amount:d,remark:""})}),u.value=!0;const{code:n,message:p}=await $({order_type:"2",list:b});u.value=!1,O({code:n,message:p,handler:()=>{f.success("\u6570\u636E\u5BFC\u5165\u6210\u529F\uFF01"),x("onSuccess"),s.value=!1}})},H=()=>{a.value=[]};return m({onDisplay:()=>(s.value=!0,a.value=[])}),(b,n)=>{const p=w("el-table-column"),E=w("el-table"),_=w("el-button"),i=w("el-dialog");return t(),D(i,{"close-on-click-modal":!1,modelValue:s.value,"onUpdate:modelValue":n[0]||(n[0]=e=>s.value=e),title:"\u6279\u91CF\u5BFC\u5165\u53D1\u7968\u4E0E\u8BA2\u5355\u5173\u8054\u7ED3\u679C",width:"1040px",top:"8vh",center:""},{default:c(()=>[a.value.length===0?(t(),D(k(G),{key:0,onOnSuccess:U})):N("v-if",!0),y(E,{data:a.value,stripe:"",border:"","max-height":"500px",size:"small",style:{width:"100%"}},{default:c(()=>[(t(!0),h(q,null,I(k(V),(e,d)=>(t(),D(p,{key:d,label:e.label,prop:e.prop,width:e.width,"show-overflow-tooltip":""},{header:c(()=>[e.required?(t(),h("p",J,[K,v(" "+C(e.label),1)])):(t(),h("span",Z,C(e.label),1))]),default:c(()=>[(t(!0),h(q,null,I(e.child,o=>(t(),D(p,{prop:o.prop,label:o.label,width:o.width,"show-overflow-tooltip":""},{header:c(()=>[o.required?(t(),h("p",X,[Y,v(" "+C(o.label),1)])):(t(),h("span",W,C(o.label),1))]),_:2},1032,["prop","label","width"]))),256))]),_:2},1032,["label","prop","width"]))),128))]),_:1},8,["data"]),a.value.length!==0?(t(),h("div",ee,[y(_,{size:"small",onClick:H},{default:c(()=>[v("\u53D6\u6D88")]),_:1}),y(_,{size:"small",type:"primary",loading:u.value,onClick:z},{default:c(()=>[v("\u4FDD\u5B58")]),_:1},8,["loading"])])):N("v-if",!0)]),_:1},8,["modelValue"])}}});var pe=L(ue,[["__scopeId","data-v-2821d250"],["__file","C:/Users/89793/Desktop/projects/settle-vue3/src/views/purchase/invoiceRelation/components/excel-files-upload-relation/index.vue"]]);export{pe as default};
|