You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
3.5KB

  1. import{h as B,f as I,c as L,b as h,e as q,g as D,r as N}from"./uploadAction.a771741b.js";import{d as O,B as P,r as g,J,c as d,e as _,G as T,i as o,h as a,j as y,f as V,F as G,H,g as w,u as r,t as z,q as A}from"./index.88314652.js";import{p as E,d as K}from"./securityPersonnelControl.ec32c059.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:C}){const{proxy:F}=A(),U=P.dictStore.uploadUrl,m=b,v=C,c=g(!1),p=g({infoList:[{investigationReport:[]}]}),R=g(),$=async i=>{!i||i.validate(async e=>{if(e)try{c.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(D(s.investigationReport))||void 0}});await E(l),F.$message.success("\u63D0\u4EA4\u6210\u529F\uFF01"),c.value=!1,v("close",!0)}catch{c.value=!1}})},j=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?N(JSON.parse(l.investigationReport)):[]})))||[{investigationReport:[]}]};return J(()=>m.visible,async i=>{i?j():p.value={infoList:[{investigationReport:[]}]}}),(i,e)=>{const l=d("el-input"),s=d("el-form-item"),u=d("el-button"),k=d("el-upload"),S=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:c.value,onClick:e[0]||(e[0]=n=>$(R.value))},{default:o(()=>e[4]||(e[4]=[y(" \u63D0\u4EA4 ")])),_:1},8,["loading"]),a(u,{onClick:e[1]||(e[1]=n=>v("close"))},{default:o(()=>e[5]||(e[5]=[y(" \u5173\u95ED ")])),_:1})]),default:o(()=>[a(S,{ref_key:"dialogFormRef",ref:R,model:p.value,"label-width":"auto","status-icon":"",class:"mt-16","label-suffix":"\uFF1A"},{default:o(()=>[(_(!0),V(G,null,H(p.value.infoList,(n,f)=>(_(),V("div",{key:f,class:"flex items-start"},[w("div",M,[a(s,{label:"\u9879\u76EE\u5B89\u5168\u8D1F\u8D23\u4EBA",prop:`infoList[${f}].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[${f}].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[${f}].investigationReport`,rules:[{required:!0,message:"\u8BF7\u4E0A\u4F20"}]},{default:o(()=>[a(k,{"file-list":n.investigationReport,"onUpdate:fileList":t=>n.investigationReport=t,class:"w-full",action:r(U),limit:1,"on-success":t=>r(B)(t,p.value.infoList[f].investigationReport,!0),"before-upload":t=>r(I)(t,{types:r(L)}),accept:r(L).map(t=>`.${t}`).join(","),"on-preview":r(h)},{tip:o(()=>[w("div",Q," \u652F\u6301"+z(r(q))+"\u6587\u4EF6 ",1)]),default:o(()=>[a(u,{type:"primary",plain:""},{default:o(()=>e[3]||(e[3]=[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};