25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
4.5KB

  1. import{h as O,f as h,c as C,b as x,e as J,g as Q,r as R}from"./uploadAction.0eabe13b.js";import{d as T,B as G,r as _,J as H,c as d,e as v,G as k,i as a,h as s,j as m,f as N,F as z,H as A,g as w,u as f,t as E,k as K,q as M}from"./index.a2494fc2.js";import{s as W,d as X}from"./securityPersonnelControl.8f366098.js";const Y={class:"flex-1"},Z={class:"el-upload__tip"},ee=T({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(),$=G.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(Q(t.safetyProtocol))||void 0}});await W(r),b.$message.success("\u63D0\u4EA4\u6210\u529F\uFF01"),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("\u6700\u591A\u589E\u52A010\u4E2A\uFF01");return}l.value.infoList.push({safetyQualification:[]})},j=o=>{var e;(e=l.value.infoList)==null||e.splice(o,1)},q=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 H(()=>y.visible,async o=>{o?q():l.value={infoList:[{safetyProtocol:[]}]}}),(o,e)=>{const r=d("el-input"),t=d("el-form-item"),u=d("el-button"),B=d("el-upload"),D=d("el-form"),I=d("el-dialog");return v(),k(I,{"model-value":L.visible,title:"\u586B\u5199\u4F9B\u5E94\u5546\u5B89\u5168\u8D44\u8D28",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(" \u63D0\u4EA4 ")])),_:1},8,["loading"]),s(u,{onClick:e[2]||(e[2]=n=>g("close"))},{default:a(()=>e[8]||(e[8]=[m(" \u5173\u95ED ")])),_:1})]),default:a(()=>[s(D,{ref_key:"dialogFormRef",ref:P,model:l.value,"label-width":"auto","status-icon":"",class:"mt-16","label-suffix":"\uFF1A"},{default:a(()=>[s(t,{label:"\u4F9B\u5E94\u5546\u540D\u79F0",prop:"supplierName",rules:[{required:!0,message:"\u8BF7\u586B\u5199"}]},{default:a(()=>[s(r,{modelValue:l.value.supplierName,"onUpdate:modelValue":e[0]||(e[0]=n=>l.value.supplierName=n),placeholder:"\u8BF7\u586B\u5199"},null,8,["modelValue"])]),_:1}),(v(!0),N(z,null,A(l.value.infoList,(n,p)=>{var V;return v(),N("div",{key:p,class:"flex items-start"},[w("div",Y,[s(t,{label:"\u5382\u5546\u4EBA\u5458\u540D\u79F0",prop:`infoList[${p}].username`,rules:[{required:!0,message:"\u8BF7\u586B\u5199"}]},{default:a(()=>[s(r,{modelValue:n.username,"onUpdate:modelValue":i=>n.username=i,placeholder:"\u8BF7\u586B\u5199"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"]),s(t,{label:"\u8054\u7CFB\u65B9\u5F0F",prop:`infoList[${p}].contactInfo`,rules:[{required:!0,message:"\u8BF7\u586B\u5199"}]},{default:a(()=>[s(r,{modelValue:n.contactInfo,"onUpdate:modelValue":i=>n.contactInfo=i,placeholder:"\u8BF7\u586B\u5199",maxlength:11},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"]),s(t,{label:"\u4FDD\u5BC6\u534F\u8BAE",prop:`infoList[${p}].safetyProtocol`,rules:[{required:!0,message:"\u8BF7\u4E0A\u4F20"}]},{default:a(()=>[s(B,{"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," \u652F\u6301"+E(f(J))+"\u6587\u4EF6 ",1)]),default:a(()=>[s(u,{type:"primary",plain:""},{default:a(()=>e[4]||(e[4]=[m("\u9009\u62E9\u6587\u4EF6")])),_: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("\u5220\u9664")])),_:2},1032,["onClick"])):K("",!0)])}),128)),s(u,{icon:"Plus",type:"primary",plain:"",onClick:U},{default:a(()=>e[6]||(e[6]=[m("\u589E\u52A0")])),_:1})]),_:1},8,["model"])]),_:1},8,["model-value"])}}});export{oe as default};