|
- import{h as O,f as h,b as C,c as x,e as Q,g as J,r as R}from"./uploadAction-3962500e.js";import{E as T,r as _,B as E,b as d,c as v,L as k,h as a,f as s,i as m,d as N,F as H,H as z,e as w,u as f,t as A,j as G,k as K,s as M}from"./index-dd5fae99.js";import{s as W,d as X}from"./securityPersonnelControl-9b4e1dfe.js";const Y={class:"flex-1"},Z={class:"el-upload__tip"},ee=K({name:"editSupplierDialog"}),oe=Object.assign(ee,{props:{visible:{type:Boolean,default:!1,required:!0},data:Object},emits:["close"],setup(L,{emit:F}){const{proxy:b}=M(),$=T.dictStore.uploadUrl,y=L,g=F,c=_(!1),l=_({infoList:[{safetyProtocol:[]}]}),P=_(),S=async o=>{o&&o.validate(async e=>{if(e){c.value=!0;try{const r=l.value.infoList.map(t=>{var u;return{...t,supplierName:l.value.supplierName,projectCode:y.data.projectCode,safetyProtocol:((u=t==null?void 0:t.safetyProtocol)==null?void 0:u.length)&&JSON.stringify(J(t.safetyProtocol))||void 0}});await W(r),b.$message.success("提交成功!"),c.value=!1,g("close",!0)}catch{c.value=!1}}})},U=()=>{var o;if(((o=l.value.infoList)==null?void 0:o.length)>=10){b.$message.warning("最多增加10个!");return}l.value.infoList.push({safetyQualification:[]})},j=o=>{var e;(e=l.value.infoList)==null||e.splice(o,1)},B=async()=>{var e,r;const o=await X(y.data.projectCode);l.value.supplierName=(e=o.data.supplierSafetyQualification)==null?void 0:e[0].supplierName,l.value.infoList=((r=o.data.supplierSafetyQualification)==null?void 0:r.map(t=>({...t,safetyProtocol:t.safetyProtocol?R(JSON.parse(t.safetyProtocol)):[]})))||[{}]};return E(()=>y.visible,async o=>{o?B():l.value={infoList:[{safetyProtocol:[]}]}}),(o,e)=>{const r=d("el-input"),t=d("el-form-item"),u=d("el-button"),D=d("el-upload"),q=d("el-form"),I=d("el-dialog");return v(),k(I,{"model-value":L.visible,title:"填写供应商安全资质",width:"600px","destroy-on-close":"",onClose:e[3]||(e[3]=n=>g("close"))},{footer:a(()=>[s(u,{type:"primary",loading:c.value,onClick:e[1]||(e[1]=n=>S(P.value))},{default:a(()=>e[7]||(e[7]=[m(" 提交 ")])),_:1},8,["loading"]),s(u,{onClick:e[2]||(e[2]=n=>g("close"))},{default:a(()=>e[8]||(e[8]=[m(" 关闭 ")])),_:1})]),default:a(()=>[s(q,{ref_key:"dialogFormRef",ref:P,model:l.value,"label-width":"auto","status-icon":"",class:"mt-16","label-suffix":":"},{default:a(()=>[s(t,{label:"供应商名称",prop:"supplierName",rules:[{required:!0,message:"请填写"}]},{default:a(()=>[s(r,{modelValue:l.value.supplierName,"onUpdate:modelValue":e[0]||(e[0]=n=>l.value.supplierName=n),placeholder:"请填写"},null,8,["modelValue"])]),_:1}),(v(!0),N(H,null,z(l.value.infoList,(n,p)=>{var V;return v(),N("div",{key:p,class:"flex items-start"},[w("div",Y,[s(t,{label:"厂商人员名称",prop:`infoList[${p}].username`,rules:[{required:!0,message:"请填写"}]},{default:a(()=>[s(r,{modelValue:n.username,"onUpdate:modelValue":i=>n.username=i,placeholder:"请填写"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"]),s(t,{label:"联系方式",prop:`infoList[${p}].contactInfo`,rules:[{required:!0,message:"请填写"}]},{default:a(()=>[s(r,{modelValue:n.contactInfo,"onUpdate:modelValue":i=>n.contactInfo=i,placeholder:"请填写",maxlength:11},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"]),s(t,{label:"保密协议",prop:`infoList[${p}].safetyProtocol`,rules:[{required:!0,message:"请上传"}]},{default:a(()=>[s(D,{"file-list":l.value.infoList[p].safetyProtocol,"onUpdate:fileList":i=>l.value.infoList[p].safetyProtocol=i,class:"w-full",action:f($),limit:1,"on-success":i=>f(O)(i,l.value.infoList[p].safetyProtocol,!0),"before-upload":i=>f(h)(i,{types:f(C)}),accept:f(C).map(i=>`.${i}`).join(","),"on-preview":f(x)},{tip:a(()=>[w("div",Z," 支持"+A(f(Q))+"文件 ",1)]),default:a(()=>[s(u,{type:"primary",plain:""},{default:a(()=>e[4]||(e[4]=[m("选择文件")])),_:1})]),_:2},1032,["file-list","onUpdate:fileList","action","on-success","before-upload","accept","on-preview"])]),_:2},1032,["prop"])]),((V=l.value.infoList)==null?void 0:V.length)>1?(v(),k(u,{key:0,icon:"Delete",type:"danger",plain:"",class:"ml-16",link:"",onClick:i=>j(p)},{default:a(()=>e[5]||(e[5]=[m("删除")])),_:2},1032,["onClick"])):G("",!0)])}),128)),s(u,{icon:"Plus",type:"primary",plain:"",onClick:U},{default:a(()=>e[6]||(e[6]=[m("增加")])),_:1})]),_:1},8,["model"])]),_:1},8,["model-value"])}}});export{oe as default};
|