|
- var R=Object.defineProperty,M=Object.defineProperties;var T=Object.getOwnPropertyDescriptors;var D=Object.getOwnPropertySymbols;var E=Object.prototype.hasOwnProperty,K=Object.prototype.propertyIsEnumerable;var j=(o,a,l)=>a in o?R(o,a,{enumerable:!0,configurable:!0,writable:!0,value:l}):o[a]=l,h=(o,a)=>{for(var l in a||(a={}))E.call(a,l)&&j(o,l,a[l]);if(D)for(var l of D(a))K.call(a,l)&&j(o,l,a[l]);return o},N=(o,a)=>M(o,T(a));var b=(o,a,l)=>new Promise((C,_)=>{var L=p=>{try{e(l.next(p))}catch(P){_(P)}},y=p=>{try{e(l.throw(p))}catch(P){_(P)}},e=p=>p.done?C(p.value):Promise.resolve(p.value).then(L,y);e((l=l.apply(o,a)).next())});import{_ as z,d as A,D as G,r as w,L as H,e as g,f as k,I as F,l as i,k as n,m as V,g as U,F as W,J as X,h as $,j as v,t as Y,i as Z,p as ee}from"./index.11dc4694.js";import{h as le,f as ae,c as q,b as te,e as oe,g as se,r as ie}from"./uploadAction.c865409e.js";import{s as re,d as ne}from"./securityPersonnelControl.59feabab.js";const ue={class:"flex-1"},pe={class:"el-upload__tip"},ce=A({name:"editSupplierDialog"}),fe=Object.assign(ce,{props:{visible:{type:Boolean,default:!1,required:!0},data:Object},emits:["close"],setup(o,{emit:a}){const{proxy:l}=ee(),C=G.dictStore.uploadUrl,_=o,L=a,y=w(!1),e=w({infoList:[{safetyProtocol:[]}]}),p=w(),P=r=>b(this,null,function*(){!r||r.validate(t=>b(this,null,function*(){if(t){y.value=!0;try{const c=e.value.infoList.map(s=>{var d;return N(h({},s),{supplierName:e.value.supplierName,projectCode:_.data.projectCode,safetyProtocol:((d=s==null?void 0:s.safetyProtocol)==null?void 0:d.length)&&JSON.stringify(se(s.safetyProtocol))||void 0})});yield re(c),l.$message.success("\u63D0\u4EA4\u6210\u529F\uFF01"),y.value=!1,L("close",!0)}catch(c){y.value=!1}}}))}),x=()=>{var r;if(((r=e.value.infoList)==null?void 0:r.length)>=10){l.$message.warning("\u6700\u591A\u589E\u52A010\u4E2A\uFF01");return}e.value.infoList.push({safetyQualification:[]})},B=r=>{var t;(t=e.value.infoList)==null||t.splice(r,1)},I=()=>b(this,null,function*(){var t,c;const r=yield ne(_.data.projectCode);e.value.supplierName=(t=r.data.supplierSafetyQualification)==null?void 0:t[0].supplierName,e.value.infoList=((c=r.data.supplierSafetyQualification)==null?void 0:c.map(s=>N(h({},s),{safetyProtocol:s.safetyProtocol?ie(JSON.parse(s.safetyProtocol)):[]})))||[{}]});return H(()=>_.visible,r=>b(this,null,function*(){r?I():e.value={infoList:[{safetyProtocol:[]}]}})),(r,t)=>{const c=g("el-input"),s=g("el-form-item"),d=g("el-button"),J=g("el-upload"),O=g("el-form"),Q=g("el-dialog");return k(),F(Q,{"model-value":o.visible,title:"\u586B\u5199\u4F9B\u5E94\u5546\u5B89\u5168\u8D44\u8D28",width:"600px","destroy-on-close":"",onClose:t[3]||(t[3]=f=>L("close"))},{footer:i(()=>[n(d,{type:"primary",loading:y.value,onClick:t[1]||(t[1]=f=>P(p.value))},{default:i(()=>[V(" \u63D0\u4EA4 ")]),_:1},8,["loading"]),n(d,{onClick:t[2]||(t[2]=f=>L("close"))},{default:i(()=>[V(" \u5173\u95ED ")]),_:1})]),default:i(()=>[n(O,{ref_key:"dialogFormRef",ref:p,model:e.value,"label-width":"auto","status-icon":"",class:"mt-16","label-suffix":"\uFF1A"},{default:i(()=>[n(s,{label:"\u4F9B\u5E94\u5546\u540D\u79F0",prop:"supplierName",rules:[{required:!0,message:"\u8BF7\u586B\u5199"}]},{default:i(()=>[n(c,{modelValue:e.value.supplierName,"onUpdate:modelValue":t[0]||(t[0]=f=>e.value.supplierName=f),placeholder:"\u8BF7\u586B\u5199"},null,8,["modelValue"])]),_:1}),(k(!0),U(W,null,X(e.value.infoList,(f,m)=>{var S;return k(),U("div",{key:m,class:"flex items-start"},[$("div",ue,[n(s,{label:"\u5382\u5546\u4EBA\u5458\u540D\u79F0",prop:`infoList[${m}].username`,rules:[{required:!0,message:"\u8BF7\u586B\u5199"}]},{default:i(()=>[n(c,{modelValue:f.username,"onUpdate:modelValue":u=>f.username=u,placeholder:"\u8BF7\u586B\u5199"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"]),n(s,{label:"\u8054\u7CFB\u65B9\u5F0F",prop:`infoList[${m}].contactInfo`,rules:[{required:!0,message:"\u8BF7\u586B\u5199"}]},{default:i(()=>[n(c,{modelValue:f.contactInfo,"onUpdate:modelValue":u=>f.contactInfo=u,placeholder:"\u8BF7\u586B\u5199",maxlength:11},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"]),n(s,{label:"\u4FDD\u5BC6\u534F\u8BAE",prop:`infoList[${m}].safetyProtocol`,rules:[{required:!0,message:"\u8BF7\u4E0A\u4F20"}]},{default:i(()=>[n(J,{"file-list":e.value.infoList[m].safetyProtocol,"onUpdate:fileList":u=>e.value.infoList[m].safetyProtocol=u,class:"w-full",action:v(C),limit:1,"on-success":u=>v(le)(u,e.value.infoList[m].safetyProtocol,!0),"before-upload":u=>v(ae)(u,{types:v(q)}),accept:v(q).map(u=>`.${u}`).join(","),"on-preview":v(te)},{tip:i(()=>[$("div",pe," \u652F\u6301"+Y(v(oe))+"\u6587\u4EF6 ",1)]),default:i(()=>[n(d,{type:"primary",plain:""},{default:i(()=>[V("\u9009\u62E9\u6587\u4EF6")]),_:1})]),_:2},1032,["file-list","onUpdate:fileList","action","on-success","before-upload","accept","on-preview"])]),_:2},1032,["prop"])]),((S=e.value.infoList)==null?void 0:S.length)>1?(k(),F(d,{key:0,icon:"Delete",type:"danger",plain:"",class:"ml-16",link:"",onClick:u=>B(m)},{default:i(()=>[V("\u5220\u9664")]),_:2},1032,["onClick"])):Z("v-if",!0)])}),128)),n(d,{icon:"Plus",type:"primary",plain:"",onClick:x},{default:i(()=>[V("\u589E\u52A0")]),_:1})]),_:1},8,["model"])]),_:1},8,["model-value"])}}}),ye=z(fe,[["__file","/Users/chenlixin/Documents/work/NDKJ/MyProject/ls-project-v2.0/src/pages/projectSafetyRiskMonitor/securityPersonnelControl/components/editSupplierDialog.vue"]]);export{ye as default};
|