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.

2 lines
7.1KB

  1. var G=Object.defineProperty,H=Object.defineProperties;var J=Object.getOwnPropertyDescriptors;var O=Object.getOwnPropertySymbols;var K=Object.prototype.hasOwnProperty,Q=Object.prototype.propertyIsEnumerable;var z=(o,d,r)=>d in o?G(o,d,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[d]=r,x=(o,d)=>{for(var r in d||(d={}))K.call(d,r)&&z(o,r,d[r]);if(O)for(var r of O(d))Q.call(d,r)&&z(o,r,d[r]);return o},A=(o,d)=>H(o,J(d));var j=(o,d,r)=>new Promise((w,f)=>{var k=i=>{try{v(r.next(i))}catch(l){f(l)}},L=i=>{try{v(r.throw(i))}catch(l){f(l)}},v=i=>i.done?w(i.value):Promise.resolve(i.value).then(k,L);v((r=r.apply(o,d)).next())});import{s as W}from"./projectManage.8eea9df0.js";import{d as X,y as Y,r as N,s as B,z as Z,f as b,g as u,n as y,w as t,e as s,v as g,c as V,q as _,F as C,p as ee,h,i as ae}from"./index.091505b9.js";import{u as le}from"./useTreeSelectData.bbae3661.js";import{l as $}from"./userManage.ba0cb8e0.js";const re=h(" \u63D0\u4EA4 "),oe=h(" \u5173\u95ED "),de=X({name:"projectDialog"}),pe=Object.assign(de,{props:{visible:{type:Boolean,default:!1,required:!0},data:Object,cascaderOption:Array,companyOptions:Array},emits:["close"],setup(o,{emit:d}){const r=o,{proxy:w}=ae(),f=Y.userStore.userBaseInfo,{cascaderProps:k}=le(),L=N([]),v=N([]),i=N(),l=N({projectManagerUserIdList:[],engineerUserIdList:[]}),D={projectName:[{required:!0,message:"\u8BF7\u8F93\u5165\u9879\u76EE\u540D\u79F0",trigger:"blur"}],projectNum:[{required:!0,message:"\u8BF7\u8F93\u5165\u9879\u76EE\u7F16\u53F7",trigger:"blur"}],companyId:[{required:!0,message:"\u8BF7\u9009\u62E9\u4F01\u4E1A",trigger:"change"}],regionCode:[{required:!0,message:"\u8BF7\u9009\u62E9\u6240\u5C5E\u533A\u57DF",trigger:"change"}],projectManagerUserIdList:[{required:!0,message:"\u8BF7\u9009\u62E9\u9879\u76EE\u7ECF\u7406",trigger:"change"}],engineerUserIdList:[{required:!0,message:"\u8BF7\u9009\u62E9\u5DE5\u7A0B\u5E08",trigger:"change"}],projectLeaderId:[{required:!0,message:"\u8BF7\u9009\u62E9\u9879\u76EE\u8D1F\u8D23\u4EBA",trigger:"change"}]},S=p=>j(this,null,function*(){!p||(yield p.validate(a=>j(this,null,function*(){var m,n;if(a){const c=A(x({},l.value),{companyId:f.role==="enterprise_admin"?f.companyId:l.value.companyId,regionCode:Array.isArray(l.value.regionCode)?(m=l.value.regionCode)==null?void 0:m.at(-1):l.value.regionCode});yield W(c),w.$message.success(`${(n=r.data)!=null&&n.companyId?"\u7F16\u8F91":"\u65B0\u589E"}\u6210\u529F\uFF01`),d("close",!0)}})))}),q=(p,a)=>j(this,null,function*(){var m,n,c,I;L.value=(n=(m=(yield $({role:"engineer",companyId:p,pageNumber:1,pageSize:2e3})).data)==null?void 0:m.records)!=null?n:[],v.value=(I=(c=(yield $({role:"project_manager",companyId:p,pageNumber:1,pageSize:2e3})).data)==null?void 0:c.records)!=null?I:[],a||(l.value.projectManagerUserIdList=[],l.value.engineerUserIdList=[],l.value.orderAuditUserId=void 0)}),F=p=>{var a;p.includes((a=l.value)==null?void 0:a.orderAuditUserId)||(l.value.orderAuditUserId=void 0)},U=B(()=>f.role==="project_manager"),R=B(()=>v.value.filter(a=>l.value.projectManagerUserIdList.includes(a==null?void 0:a.userId)));return Z(()=>r.visible,p=>j(this,null,function*(){var a,m;if(p){const n=(a=r==null?void 0:r.data)!=null&&a.companyId?r.data.companyId:f.companyId;q(n,1),(m=r.data)!=null&&m.projectId&&(l.value=A(x({},r.data),{regionCode:r.data.regionCode}))}else l.value={projectManagerUserIdList:[],engineerUserIdList:[]},i.value.resetFields()})),(p,a)=>{const m=b("el-input"),n=b("el-form-item"),c=b("el-option"),I=b("el-select"),T=b("el-cascader"),P=b("el-form"),M=b("el-button"),E=b("el-dialog");return u(),y(E,{"model-value":o.visible,title:`${o.data&&o.data.projectId?"\u7F16\u8F91":"\u65B0\u589E"}\u9879\u76EE`,width:"560px","destroy-on-close":"",onClose:a[10]||(a[10]=e=>d("close"))},{footer:t(()=>[s(M,{type:"primary",size:"small",onClick:a[8]||(a[8]=e=>S(i.value))},{default:t(()=>[re]),_:1}),s(M,{type:"info",size:"small",onClick:a[9]||(a[9]=e=>d("close"))},{default:t(()=>[oe]),_:1})]),default:t(()=>[s(P,{ref_key:"formRef",ref:i,model:l.value,rules:D,"label-width":"115px","label-suffix":":",size:"small"},{default:t(()=>[s(n,{label:"\u9879\u76EE\u540D\u79F0",prop:"projectName"},{default:t(()=>[s(m,{modelValue:l.value.projectName,"onUpdate:modelValue":a[0]||(a[0]=e=>l.value.projectName=e),maxlength:"30",placeholder:"\u8BF7\u8F93\u5165",disabled:g(U)},null,8,["modelValue","disabled"])]),_:1}),s(n,{label:"\u9879\u76EE\u7F16\u53F7",prop:"projectNum"},{default:t(()=>[s(m,{modelValue:l.value.projectNum,"onUpdate:modelValue":a[1]||(a[1]=e=>l.value.projectNum=e),maxlength:"30",placeholder:"\u8BF7\u8F93\u5165",disabled:g(U)},null,8,["modelValue","disabled"])]),_:1}),g(f).role!=="enterprise_admin"?(u(),y(n,{key:0,label:"\u6240\u5C5E\u4F01\u4E1A",prop:"companyId"},{default:t(()=>[s(I,{modelValue:l.value.companyId,"onUpdate:modelValue":a[2]||(a[2]=e=>l.value.companyId=e),clearable:!0,placeholder:"\u8BF7\u9009\u62E9",class:"w-full",disabled:g(U),onChange:q},{default:t(()=>[(u(!0),V(C,null,_(o.companyOptions,e=>(u(),y(c,{key:e.companyId,label:e.companyName,value:e.companyId},null,8,["label","value"]))),128))]),_:1},8,["modelValue","disabled"])]),_:1})):ee("",!0),s(n,{label:"\u6240\u5C5E\u533A\u57DF",prop:"regionCode"},{default:t(()=>[s(T,{modelValue:l.value.regionCode,"onUpdate:modelValue":a[3]||(a[3]=e=>l.value.regionCode=e),props:g(k),options:o.cascaderOption,clearable:"",class:"w-full",disabled:g(U)},null,8,["modelValue","props","options","disabled"])]),_:1}),s(n,{label:"\u9879\u76EE\u7ECF\u7406",prop:"projectManagerUserIdList"},{default:t(()=>[s(I,{modelValue:l.value.projectManagerUserIdList,"onUpdate:modelValue":a[4]||(a[4]=e=>l.value.projectManagerUserIdList=e),multiple:"",placeholder:"\u8BF7\u9009\u62E9",class:"w-full",disabled:g(U),onChange:F},{default:t(()=>[(u(!0),V(C,null,_(v.value,e=>(u(),y(c,{key:e.userId,label:e.realName,value:e.userId},null,8,["label","value"]))),128))]),_:1},8,["modelValue","disabled"])]),_:1}),s(n,{label:"\u5DE5\u7A0B\u5E08",prop:"engineerUserIdList"},{default:t(()=>[s(I,{modelValue:l.value.engineerUserIdList,"onUpdate:modelValue":a[5]||(a[5]=e=>l.value.engineerUserIdList=e),multiple:"",placeholder:"\u8BF7\u9009\u62E9",class:"w-full"},{default:t(()=>[(u(!0),V(C,null,_(L.value,e=>(u(),y(c,{key:e.userId,label:e.realName,value:e.userId},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),s(n,{label:"\u8BA2\u5355\u5BA1\u6838\u5458",prop:"orderAuditUserId"},{default:t(()=>[s(I,{modelValue:l.value.orderAuditUserId,"onUpdate:modelValue":a[6]||(a[6]=e=>l.value.orderAuditUserId=e),placeholder:"\u8BF7\u9009\u62E9",class:"w-full"},{default:t(()=>[(u(!0),V(C,null,_(g(R),e=>(u(),y(c,{key:e.userId,label:e.realName,value:e.userId},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),s(n,{label:"\u9879\u76EE\u8D1F\u8D23\u4EBA",prop:"projectLeaderId"},{default:t(()=>[s(I,{modelValue:l.value.projectLeaderId,"onUpdate:modelValue":a[7]||(a[7]=e=>l.value.projectLeaderId=e),placeholder:"\u8BF7\u9009\u62E9",class:"w-full",disabled:g(U)},{default:t(()=>[(u(!0),V(C,null,_(v.value,e=>(u(),y(c,{key:e.userId,label:e.realName,value:e.userId},null,8,["label","value"]))),128))]),_:1},8,["modelValue","disabled"])]),_:1})]),_:1},8,["model"])]),_:1},8,["model-value","title"])}}});export{pe as default};