import{D as k,F as A}from"./element-plus.55d71530.js";import{P as y}from"./index.e651cfa0.js";import{r as E,o as v}from"./index.e2bd5212.js";import{r as x,u as R}from"./xlsx.b6ebc5e2.js";import{d as S,s as d,r as f,b as I,o as N,c as V,V as l,M as i,a as p}from"./@vue.96c135a1.js";function H(n){return E.get({url:"/master_worker.engineer_settlement/lists",params:n})}function P(n){return E.post({url:"/master_worker.engineer_settlement/add",params:n})}const q={class:"edit-popup"},K={class:"mt-4"},J=S({__name:"edit",props:{dictData:{type:Object,default:()=>({})}},emits:["success","close"],setup(n,{expose:F,emit:D}){const c=D,B=d(),r=d(),m=f("add"),C=(a="add")=>{var e;m.value=a,(e=r.value)==null||e.open()};I(()=>m.value=="\u5BFC\u5165\u8868\u683C");const s=f([]),g=a=>{let e={\u5DE5\u7A0B\u5E08ID:"master_worker_id",\u5DE5\u7A0B\u5E08\u7F16\u53F7:"worker_number",\u5DE5\u7A0B\u5E08\u59D3\u540D:"engineer_name",\u5DE5\u7A0B\u5E08\u94F6\u884C\u5361\u53F7:"bank_account",\u6240\u5C5E\u94F6\u884C:"bank_name",\u5DE5\u7A0B\u5E08\u5F00\u6237\u884C\u53CA\u652F\u884C\u4FE1\u606F:"opening_branch",\u5BFC\u51FA\u65F6\u8D26\u53F7\u4F59\u989D:"original_balance",\u6279\u6B21\u7F16\u53F7:"batch_number",\u5E94\u53D1\u91D1\u989D:"total_settlement_amount",\u6263\u6B3E\u91D1\u989D:"deduction_amount",\u6263\u6B3E\u8BF4\u660E:"deduction_describe",\u5B9E\u53D1\u91D1\u989D:"final_settlement_amount",\u6253\u6B3E\u65F6\u95F4:"settlement_time",\u5907\u6CE8:"settlement_details_remarks"};a.forEach(t=>{Object.keys(t).map(o=>{let u=e[o];u&&(u=="settlement_time"?t[u]=v(t[o]):t[u]=t[o],delete t[o])})}),s.value=a},h=a=>{const e=a.target.files[0];if(!e)return;const t=new FileReader;t.onload=o=>{try{if(o.target&&o.target.result){const u=x(o.target.result,{type:"binary"}),_=R.sheet_to_json(u.Sheets[u.SheetNames[0]]);console.log("ws",_),g(_),console.log("tableData",s.value)}else throw new Error("Invalid file format")}catch(u){console.error("Error reading file:",u)}},t.readAsArrayBuffer(e)},w=async()=>{var e;const a=s.value;await P(a),(e=r.value)==null||e.close(),c("success")},b=()=>{c("close")};return F({open:C}),(a,e)=>{const t=k,o=A;return N(),V("div",q,[l(y,{ref_key:"popupRef",ref:r,title:"\u5DE5\u7A0B\u5E08\u7ED3\u7B97\u660E\u7EC6\u6570\u636E\u5BFC\u5165",async:!0,width:"80%",onConfirm:w,onClose:b,confirmButtonText:"\u786E\u5B9A\u5BFC\u5165"},{default:i(()=>[l(o,{ref_key:"formRef",ref:B},{default:i(()=>[p("div",K,[l(t,{label:"\u5BFC\u5165\u8868\u683C"},{default:i(()=>[p("input",{type:"file",accept:".xls,.xlsx",class:"upload-file",onChange:e[0]||(e[0]=u=>h(u))},null,32)]),_:1})])]),_:1},512)]),_:1},512)])}}});export{J as _,H as a};
