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.

userDialog.a4380deb.js 11KB

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