|
- var W=Object.defineProperty,X=Object.defineProperties;var ee=Object.getOwnPropertyDescriptors;var S=Object.getOwnPropertySymbols;var ae=Object.prototype.hasOwnProperty,le=Object.prototype.propertyIsEnumerable;var A=(i,d,n)=>d in i?W(i,d,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[d]=n,O=(i,d)=>{for(var n in d||(d={}))ae.call(d,n)&&A(i,n,d[n]);if(S)for(var n of S(d))le.call(d,n)&&A(i,n,d[n]);return i},E=(i,d)=>X(i,ee(d));var F=(i,d,n)=>new Promise((P,m)=>{var z=v=>{try{N(n.next(v))}catch(x){m(x)}},w=v=>{try{N(n.throw(v))}catch(x){m(x)}},N=v=>v.done?P(v.value):Promise.resolve(v.value).then(z,w);N((n=n.apply(i,d)).next())});import{b as te,e as re,s as oe}from"./userManage.3cd236bd.js";import{l as ne}from"./companyManage.fe0d2fc0.js";import{l as ue}from"./projectManage.1555dd0a.js";import{d as Y}from"./uploadAction.80a87a78.js";import{d as de,y as G,x as se,r as h,z as ie,f as c,g as p,n as _,w as a,e as l,p as D,c as j,q as U,v as $,F as q,h as C,b as pe,i as me}from"./index.ef739cdb.js";const ve=C("\u6309\u5730\u533A"),fe=C("\u6309\u4E2A\u4EBA"),ce=pe("span",{class:"text-info"},"\u5143",-1),_e=C("\u6708\u7ED3"),ge=C("\u5468\u7ED3"),ye=C("\u767D\u5929"),be=C("\u665A\u4E0A"),Ie=C(" \u63D0\u4EA4 "),Ve=C(" \u5173\u95ED "),Ce=de({name:"userDialog"}),Te=Object.assign(Ce,{props:{visible:{type:Boolean,default:!1,required:!0},data:Object},emits:["close"],setup(i,{emit:d}){const n=i,{proxy:P}=me(),m=G.userStore.userBaseInfo,{roleList:z}=se(G.dictStore),w=h([]),N=h([]),v=h(!0),x=h(),e=h({avatarFile:[],licenseOfDriverFile:[],responsibleCompanyIdList:[],companyId:m.role==="project_manager"?m.companyId:void 0}),H={realName:[{required:!0,message:"\u8BF7\u8F93\u5165\u7528\u6237\u59D3\u540D",trigger:"blur"}],phoneNo:[{required:!0,pattern:/^1[3456789]\d{9}$/,message:"\u624B\u673A\u53F7\u7801\u683C\u5F0F\u4E0D\u6B63\u786E",trigger:"blur"}],userName:[{required:!0,message:"\u8BF7\u8F93\u5165\u8D26\u53F7",trigger:"blur"}],password:[{required:!0,pattern:/^[a-zA-Z0-9]{6,10}$/,message:"\u8BF7\u8F93\u51656-10\u4F4D\u5927\u5C0F\u5199\u5B57\u6BCD\u6216\u6570\u5B57",trigger:"blur"}],role:[{required:!0,message:"\u8BF7\u9009\u62E9\u7528\u6237\u89D2\u8272",trigger:"change"}],companyId:[{required:!0,message:"\u8BF7\u9009\u62E9\u4F01\u4E1A",trigger:"change"}],responsibleCompanyIdList:[{required:!0,message:"\u8BF7\u9009\u62E9\u4F01\u4E1A",trigger:"change"}],carExpenseType:[{required:!0,message:"\u8BF7\u9009\u62E9\u51FA\u8F66\u8D39",trigger:"change"}],carExpense:[{required:!0,message:"\u8BF7\u8F93\u5165\u4E2A\u4EBA\u51FA\u8F66\u8D39",trigger:"blur"}],settlementPeriod:[{required:!0,message:"\u8BF7\u9009\u62E9\u7ED3\u7B97\u65B9\u5F0F",trigger:"change"}],driveTime:[{required:!0,message:"\u8BF7\u9009\u62E9\u51FA\u8F66\u65F6\u95F4",trigger:"blur"}]},Z=()=>F(this,null,function*(){N.value=(yield ue({pageNumber:1,pageSize:99999})).data.records}),J=y=>{e.value.responsibleCompanyIdList=void 0,e.value.idCard=void 0,e.value.avatarFile=[],y==="driver"?(B(),e.value.carExpenseType=2,e.value.settlementPeriod=2,e.value.driveTime="DAY"):(e.value.carExpenseType=void 0,e.value.carExpense=void 0,e.value.driveTime=void 0)},B=y=>F(this,null,function*(){w.value=(yield ne(E(O({},y),{pageNumber:1,pageSize:2e3}))).data.records}),K=y=>F(this,null,function*(){!y||(yield y.validate(t=>F(this,null,function*(){var g,u;if(t){const s=E(O({},e.value),{companyId:m.role==="enterprise_admin"?m.companyId:e.value.companyId,avatarFileId:e.value.avatarFile&&e.value.avatarFile.length?e.value.avatarFile[0].response.data.id:void 0,licenseOfDriver:e.value.licenseOfDriverFile&&e.value.licenseOfDriverFile.length?e.value.licenseOfDriverFile[0].response.data.id:void 0,responsibleCompanyIdList:(g=e.value.responsibleCompanyIdList)!=null&&g.length?e.value.responsibleCompanyIdList:void 0});yield oe(s),P.$message.success(`${(u=n.data)!=null&&u.userId?"\u7F16\u8F91":"\u65B0\u589E"}\u6210\u529F\uFF01`),d("close",!0)}})))});return ie(()=>n.visible,y=>F(this,null,function*(){var t,g,u,s,I,V,L,b,k;if(y){if(B({managed:!0}),(t=n.data)!=null&&t.userId){const f=yield te(n.data.userId);e.value=E(O({},f.data),{avatarFile:(g=f.data)!=null&&g.avatarFileId?[{name:`${new Date().getTime()}`,url:(yield Y(f.data.avatarFileId)).url,response:{data:{id:f.data.avatarFileId}}}]:[],licenseOfDriverFile:(u=f.data)!=null&&u.licenseOfDriver?[{name:`${new Date().getTime()}`,url:(yield Y(f.data.licenseOfDriver)).url,response:{data:{id:f.data.licenseOfDriver}}}]:[],responsibleCompanyIdList:(I=(s=f.data)==null?void 0:s.responsibleCompanyIdList)!=null?I:[],driverProjects:(L=(V=f.data)==null?void 0:V.driverProjects)!=null?L:[],driveCompanyList:(k=(b=f.data)==null?void 0:b.driveCompanyList)!=null?k:[]}),v.value=(yield re(n.data.userId)).data}Z()}else e.value={avatarFile:[],responsibleCompanyIdList:[],companyId:m.role==="project_manager"?m.companyId:void 0},v.value=!0,x.value.resetFields()})),(y,t)=>{const g=c("el-input"),u=c("el-form-item"),s=c("el-col"),I=c("el-option"),V=c("el-select"),L=c("el-row"),b=c("el-radio"),k=c("el-radio-group"),f=c("el-input-number"),M=c("el-form"),R=c("el-button"),Q=c("el-dialog");return p(),_(Q,{"model-value":i.visible,title:`${i.data&&i.data.userId?"\u7F16\u8F91":"\u65B0\u589E"}\u7528\u6237`,width:"840px","destroy-on-close":"",onClose:t[15]||(t[15]=r=>d("close"))},{footer:a(()=>[l(R,{type:"primary",size:"small",onClick:t[13]||(t[13]=r=>K(x.value))},{default:a(()=>[Ie]),_:1}),l(R,{type:"info",size:"small",onClick:t[14]||(t[14]=r=>d("close"))},{default:a(()=>[Ve]),_:1})]),default:a(()=>[l(M,{ref_key:"formRef",ref:x,model:e.value,rules:H,"label-width":"100px","label-suffix":":",size:"small"},{default:a(()=>[l(L,{gutter:30},{default:a(()=>{var r;return[l(s,{span:12},{default:a(()=>[l(u,{label:"\u7528\u6237\u59D3\u540D",prop:"realName"},{default:a(()=>[l(g,{modelValue:e.value.realName,"onUpdate:modelValue":t[0]||(t[0]=o=>e.value.realName=o),maxlength:"10",placeholder:"\u8BF7\u8F93\u5165"},null,8,["modelValue"])]),_:1})]),_:1}),l(s,{span:12},{default:a(()=>[l(u,{label:"\u624B\u673A\u53F7\u7801",prop:"phoneNo"},{default:a(()=>[l(g,{modelValue:e.value.phoneNo,"onUpdate:modelValue":t[1]||(t[1]=o=>e.value.phoneNo=o),maxlength:"11",placeholder:"\u8BF7\u8F93\u5165"},null,8,["modelValue"])]),_:1})]),_:1}),l(s,{span:12},{default:a(()=>[l(u,{label:"\u8D26\u53F7",prop:"userName"},{default:a(()=>[l(g,{modelValue:e.value.userName,"onUpdate:modelValue":t[2]||(t[2]=o=>e.value.userName=o),maxlength:"30",placeholder:"\u8BF7\u8F93\u5165"},null,8,["modelValue"])]),_:1})]),_:1}),(r=i.data)!=null&&r.userId?D("",!0):(p(),_(s,{key:0,span:12},{default:a(()=>[l(u,{label:"\u5BC6\u7801",prop:"password"},{default:a(()=>[l(g,{modelValue:e.value.password,"onUpdate:modelValue":t[3]||(t[3]=o=>e.value.password=o),maxlength:"30",placeholder:"\u8BF7\u8F93\u5165"},null,8,["modelValue"])]),_:1})]),_:1})),l(s,{span:12},{default:a(()=>[l(u,{label:"\u7528\u6237\u89D2\u8272",prop:"role"},{default:a(()=>[l(V,{modelValue:e.value.role,"onUpdate:modelValue":t[4]||(t[4]=o=>e.value.role=o),placeholder:"\u8BF7\u9009\u62E9",class:"w-full",disabled:!v.value,onChange:J},{default:a(()=>[(p(!0),j(q,null,U($(z).filter(o=>o.auth.includes($(m).role)),o=>(p(),_(I,{key:o.key,label:o.name,value:o.key},null,8,["label","value"]))),128))]),_:1},8,["modelValue","disabled"])]),_:1})]),_:1}),$(m).role!=="enterprise_admin"?(p(),_(s,{key:1,span:12},{default:a(()=>[l(u,{label:"\u6240\u5C5E\u4F01\u4E1A",prop:"companyId"},{default:a(()=>{var o;return[l(V,{modelValue:e.value.companyId,"onUpdate:modelValue":t[5]||(t[5]=T=>e.value.companyId=T),placeholder:"\u8BF7\u9009\u62E9",class:"w-full",disabled:!v.value||!((o=n.data)!=null&&o.userId)&&$(m).role==="project_manager"},{default:a(()=>[(p(!0),j(q,null,U(w.value,T=>(p(),_(I,{key:T.companyId,label:T.companyName,value:T.companyId},null,8,["label","value"]))),128))]),_:1},8,["modelValue","disabled"])]}),_:1})]),_:1})):D("",!0),e.value.role==="regional_general_manager"?(p(),_(s,{key:2,span:24},{default:a(()=>[l(u,{label:"\u8D1F\u8D23\u4F01\u4E1A",prop:"responsibleCompanyIdList"},{default:a(()=>[l(V,{modelValue:e.value.responsibleCompanyIdList,"onUpdate:modelValue":t[6]||(t[6]=o=>e.value.responsibleCompanyIdList=o),multiple:!0,placeholder:"\u8BF7\u9009\u62E9",class:"w-full"},{default:a(()=>[(p(!0),j(q,null,U(w.value,o=>(p(),_(I,{key:o.companyId,label:o.companyName,value:o.companyId},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1})):D("",!0)]}),_:1}),e.value.role==="driver"?(p(),_(L,{key:0,gutter:30},{default:a(()=>[l(s,{span:12},{default:a(()=>[l(u,{label:"\u51FA\u8F66\u8D39",prop:"carExpenseType"},{default:a(()=>[l(k,{modelValue:e.value.carExpenseType,"onUpdate:modelValue":t[7]||(t[7]=r=>e.value.carExpenseType=r)},{default:a(()=>[l(b,{label:2},{default:a(()=>[ve]),_:1}),l(b,{label:1},{default:a(()=>[fe]),_:1})]),_:1},8,["modelValue"])]),_:1})]),_:1}),e.value.carExpenseType===1?(p(),_(s,{key:0,span:12},{default:a(()=>[l(u,{label:"\u4E2A\u4EBA\u51FA\u8F66\u8D39",prop:"carExpense"},{default:a(()=>[l(f,{modelValue:e.value.carExpense,"onUpdate:modelValue":t[8]||(t[8]=r=>e.value.carExpense=r),min:.01,max:99999.99,precision:2,controls:!1,placeholder:"\u8BF7\u8F93\u5165",class:"flex-1 mr-8"},null,8,["modelValue","min","max"]),ce]),_:1})]),_:1})):D("",!0),l(s,{span:12},{default:a(()=>[l(u,{label:"\u7ED3\u7B97\u65B9\u5F0F",prop:"settlementPeriod"},{default:a(()=>[l(k,{modelValue:e.value.settlementPeriod,"onUpdate:modelValue":t[9]||(t[9]=r=>e.value.settlementPeriod=r)},{default:a(()=>[l(b,{label:2},{default:a(()=>[_e]),_:1}),l(b,{label:1},{default:a(()=>[ge]),_:1})]),_:1},8,["modelValue"])]),_:1})]),_:1}),l(s,{span:12},{default:a(()=>[l(u,{label:"\u51FA\u8F66\u65F6\u95F4",prop:"driveTime"},{default:a(()=>[l(k,{modelValue:e.value.driveTime,"onUpdate:modelValue":t[10]||(t[10]=r=>e.value.driveTime=r)},{default:a(()=>[l(b,{label:"DAY"},{default:a(()=>[ye]),_:1}),l(b,{label:"NIGHT"},{default:a(()=>[be]),_:1})]),_:1},8,["modelValue"])]),_:1})]),_:1}),l(s,{span:12},{default:a(()=>[l(u,{label:"\u6240\u5C5E\u9879\u76EE"},{default:a(()=>[l(V,{modelValue:e.value.driverProjects,"onUpdate:modelValue":t[11]||(t[11]=r=>e.value.driverProjects=r),multiple:!0,placeholder:"\u8BF7\u9009\u62E9",class:"w-full"},{default:a(()=>[(p(!0),j(q,null,U(N.value,r=>(p(),_(I,{key:r.projectId,label:r.projectName,value:r.projectId},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),l(s,{span:12},{default:a(()=>[l(u,{label:"\u53EF\u63A5\u5355\u4F01\u4E1A"},{default:a(()=>[l(V,{modelValue:e.value.driveCompanyList,"onUpdate:modelValue":t[12]||(t[12]=r=>e.value.driveCompanyList=r),multiple:!0,placeholder:"\u8BF7\u9009\u62E9",class:"w-full"},{default:a(()=>[(p(!0),j(q,null,U(w.value,r=>(p(),_(I,{key:r.companyId,label:r.companyName,value:r.companyId},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1})):D("",!0)]),_:1},8,["model"])]),_:1},8,["model-value","title"])}}});export{Te as default};
|