|
1 |
- import{h as I,f as S,c as L,b as D,e as B,g as N,r as q}from"./uploadAction.95992a5e.js";import{d as O,D as P,r as g,L as J,c as d,e as _,I as T,i as o,h as a,j as y,f as V,F as z,J as A,g as h,u as r,t as E,x as G}from"./index.d340e473.js";import{p as H,d as K}from"./securityPersonnelControl.9ffce8d1.js";const M={class:"flex-1"},Q={class:"el-upload__tip"},W=O({name:"editPersonInfoDialog"}),ee=Object.assign(W,{props:{visible:{type:Boolean,default:!1,required:!0},data:Object},emits:["close"],setup(b,{emit:w}){const{proxy:C}=G(),F=P.dictStore.uploadUrl,m=b,v=w,f=g(!1),p=g({infoList:[{investigationReport:[]}]}),R=g(),U=async i=>{!i||i.validate(async e=>{if(e)try{f.value=!0;const l=p.value.infoList.map(s=>{var u;return{...s,projectCode:m.data.projectCode,investigationReport:((u=s==null?void 0:s.investigationReport)==null?void 0:u.length)&&JSON.stringify(N(s.investigationReport))||void 0}});await H(l),C.$message.success("\u63D0\u4EA4\u6210\u529F\uFF01"),f.value=!1,v("close",!0)}catch{f.value=!1}})},$=async()=>{var e;const i=await K(m.data.projectCode);p.value.infoList=((e=i.data.personSafetyInfo)==null?void 0:e.map(l=>({...l,investigationReport:l.investigationReport?q(JSON.parse(l.investigationReport)):[]})))||[{investigationReport:[]}]};return J(()=>m.visible,async i=>{i?$():p.value={infoList:[{investigationReport:[]}]}}),(i,e)=>{const l=d("el-input"),s=d("el-form-item"),u=d("el-button"),j=d("el-upload"),k=d("el-form"),x=d("el-dialog");return _(),T(x,{"model-value":b.visible,title:"\u586B\u5199\u5B89\u5168\u4EBA\u5458\u4FE1\u606F",width:"600px","destroy-on-close":"",onClose:e[2]||(e[2]=n=>v("close"))},{footer:o(()=>[a(u,{type:"primary",loading:f.value,onClick:e[0]||(e[0]=n=>U(R.value))},{default:o(()=>[y(" \u63D0\u4EA4 ")]),_:1},8,["loading"]),a(u,{onClick:e[1]||(e[1]=n=>v("close"))},{default:o(()=>[y(" \u5173\u95ED ")]),_:1})]),default:o(()=>[a(k,{ref_key:"dialogFormRef",ref:R,model:p.value,"label-width":"auto","status-icon":"",class:"mt-16","label-suffix":"\uFF1A"},{default:o(()=>[(_(!0),V(z,null,A(p.value.infoList,(n,c)=>(_(),V("div",{key:c,class:"flex items-start"},[h("div",M,[a(s,{label:"\u9879\u76EE\u5B89\u5168\u8D1F\u8D23\u4EBA",prop:`infoList[${c}].username`,rules:[{required:!0,message:"\u8BF7\u586B\u5199"}]},{default:o(()=>[a(l,{modelValue:n.username,"onUpdate:modelValue":t=>n.username=t,placeholder:"\u8BF7\u586B\u5199"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"]),a(s,{label:"\u8054\u7CFB\u65B9\u5F0F",prop:`infoList[${c}].contactInfo`,rules:[{required:!0,message:"\u8BF7\u586B\u5199"}]},{default:o(()=>[a(l,{modelValue:n.contactInfo,"onUpdate:modelValue":t=>n.contactInfo=t,placeholder:"\u8BF7\u586B\u5199",maxlength:11},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"]),a(s,{label:"\u9879\u76EE\u4FDD\u5BC6\u534F\u8BAE",prop:`infoList[${c}].investigationReport`,rules:[{required:!0,message:"\u8BF7\u4E0A\u4F20"}]},{default:o(()=>[a(j,{"file-list":n.investigationReport,"onUpdate:fileList":t=>n.investigationReport=t,class:"w-full",action:r(F),limit:1,"on-success":t=>r(I)(t,p.value.infoList[c].investigationReport,!0),"before-upload":t=>r(S)(t,{types:r(L)}),accept:r(L).map(t=>`.${t}`).join(","),"on-preview":r(D)},{tip:o(()=>[h("div",Q," \u652F\u6301"+E(r(B))+"\u6587\u4EF6 ",1)]),default:o(()=>[a(u,{type:"primary",plain:""},{default:o(()=>[y("\u9009\u62E9\u6587\u4EF6")]),_:1})]),_:2},1032,["file-list","onUpdate:fileList","action","on-success","before-upload","accept","on-preview"])]),_:2},1032,["prop"])])]))),128))]),_:1},8,["model"])]),_:1},8,["model-value"])}}});export{ee as default};
|