2 lines
7.8 KiB
JavaScript
2 lines
7.8 KiB
JavaScript
import{k as Z,g as G,A as ee,C as a,N as W,l as K,m as ae}from"./consts-D1Imw0A8.js";import{c as y,a as Q,P as te}from"./biz-bpm-enum-DQJBn5Qr.js";import{b9 as o,w as O,aE as _,u as D,R as se,n as z}from"../jse/index-index-BAlyf32H.js";function oe(t){const s=o(t.flowNode);return O(()=>t.flowNode,n=>{s.value=n}),s}function N(t){const s=[];return t&&t.forEach(n=>{Y(JSON.parse(n),s)}),s}const Y=(t,s=[],n="")=>{const{type:l,field:v,$required:T,title:p,children:E}=t;if(v&&p){let e=p;n&&(e=`${n}.${p}`);let R=!1;T&&(R=!0),s.push({field:v,title:e,type:l,required:R})}E&&Array.isArray(E)&&E.forEach(e=>{Y(e,s)})};function ce(t){const s=o([]),n=_("formType",o()),l=_("formFields",o([]));function v(e){e=se(e),s.value=!e||e.length===0?p(D(l)):T(e,D(l))}function T(e,R){let L=[];return R&&(L=N(R).map(U=>{const r=e.find(u=>u.field===U.field);return{field:U.field,title:U.title,permission:r?r.permission:t}})),L}function p(e){let R=[];return e&&(R=N(e).map(L=>({field:L.field,title:L.title,permission:t}))),R}const E=N(D(l));return{formType:n,fieldsPermissionConfig:s,formFieldOptions:E,getNodeConfigFormFields:v}}function Ee(){const t=_("formFields",o([]));return N(D(t))}function de(){const t=_("formFields",o([])),s=N(D(t));return s.unshift({field:te.START_USER_ID,title:"发起人",required:!0}),s}function fe(t){const s=_("roleList",o([])),n=_("postList",o([])),l=_("userList",o([])),v=_("deptList",o([])),T=_("userGroupList",o([])),p=_("deptTree",o([])),E=_("formFields",o([])),e=o();(t===Q.USER_TASK_NODE||t===Q.TRANSACTOR_NODE)&&(e.value={candidateStrategy:a.USER,approveMethod:ee.SEQUENTIAL_APPROVE,approveRatio:100,rejectHandlerType:G.FINISH_PROCESS,assignStartUserHandlerType:Z.START_USER_AUDIT,returnNodeId:"",timeoutHandlerEnable:!1,timeoutHandlerType:1,timeDuration:6,maxRemindCount:1,buttonsSetting:[]}),e.value={candidateStrategy:a.USER};function R(){var u,g,i,A,h,I,P,m,F,b,M,k,C,$,j,w,V,x,H,B,X,q,J;let r="";if(((u=e.value)==null?void 0:u.candidateStrategy)===a.USER&&((i=(g=e.value)==null?void 0:g.userIds)==null?void 0:i.length)>0){const d=[];l==null||l.value.forEach(c=>{var S,f;(f=(S=e.value)==null?void 0:S.userIds)!=null&&f.includes(c.id)&&d.push(c.nickname)}),r=`指定成员:${d.join(",")}`}if(((A=e.value)==null?void 0:A.candidateStrategy)===a.ROLE&&((h=e.value.roleIds)==null?void 0:h.length)>0){const d=[];s==null||s.value.forEach(c=>{var S,f;(f=(S=e.value)==null?void 0:S.roleIds)!=null&&f.includes(c.id)&&d.push(c.name)}),r=`指定角色:${d.join(",")}`}if((((I=e.value)==null?void 0:I.candidateStrategy)===a.DEPT_MEMBER||((P=e.value)==null?void 0:P.candidateStrategy)===a.DEPT_LEADER||((m=e.value)==null?void 0:m.candidateStrategy)===a.MULTI_LEVEL_DEPT_LEADER)&&((b=(F=e.value)==null?void 0:F.deptIds)==null?void 0:b.length)>0){const d=[];v==null||v.value.forEach(c=>{var S,f;(f=(S=e.value)==null?void 0:S.deptIds)!=null&&f.includes(c.id)&&d.push(c.name)}),e.value.candidateStrategy===a.DEPT_MEMBER?r=`部门成员:${d.join(",")}`:e.value.candidateStrategy===a.DEPT_LEADER?r=`部门的负责人:${d.join(",")}`:r=`多级部门的负责人:${d.join(",")}`}if(((M=e.value)==null?void 0:M.candidateStrategy)===a.POST&&((k=e.value.postIds)==null?void 0:k.length)>0){const d=[];n==null||n.value.forEach(c=>{var S,f;(f=(S=e.value)==null?void 0:S.postIds)!=null&&f.includes(c.id)&&d.push(c.name)}),r=`指定岗位: ${d.join(",")}`}if(((C=e.value)==null?void 0:C.candidateStrategy)===a.USER_GROUP&&((j=($=e.value)==null?void 0:$.userGroups)==null?void 0:j.length)>0){const d=[];T==null||T.value.forEach(c=>{var S,f;(f=(S=e.value)==null?void 0:S.userGroups)!=null&&f.includes(c.id)&&d.push(c.name)}),r=`指定用户组: ${d.join(",")}`}if(((w=e.value)==null?void 0:w.candidateStrategy)===a.FORM_USER){const c=N(D(E)).find(S=>{var f;return S.field===((f=e.value)==null?void 0:f.formUser)});r=`表单用户:${c==null?void 0:c.title}`}return((V=e.value)==null?void 0:V.candidateStrategy)===a.FORM_DEPT_LEADER&&(r="表单内部门负责人"),((x=e.value)==null?void 0:x.candidateStrategy)===a.APPROVE_USER_SELECT&&(r="审批人自选"),((H=e.value)==null?void 0:H.candidateStrategy)===a.START_USER_SELECT&&(r="发起人自选"),((B=e.value)==null?void 0:B.candidateStrategy)===a.START_USER&&(r="发起人自己"),((X=e.value)==null?void 0:X.candidateStrategy)===a.START_USER_DEPT_LEADER&&(r="发起人的部门负责人"),((q=e.value)==null?void 0:q.candidateStrategy)===a.START_USER_MULTI_LEVEL_DEPT_LEADER&&(r="发起人连续部门负责人"),((J=e.value)==null?void 0:J.candidateStrategy)===a.EXPRESSION&&(r=`流程表达式:${e.value.expression}`),r}function L(){var u,g,i,A,h,I,P;let r;if(!e.value)return r;switch(e.value.candidateStrategy){case a.DEPT_LEADER:case a.DEPT_MEMBER:{r=(u=e.value.deptIds)==null?void 0:u.join(",");break}case a.EXPRESSION:{r=e.value.expression;break}case a.FORM_DEPT_LEADER:{const m=e.value.formDept;r=m==null?void 0:m.concat(`|${e.value.deptLevel}`);break}case a.FORM_USER:{r=(g=e.value)==null?void 0:g.formUser;break}case a.MULTI_LEVEL_DEPT_LEADER:{const m=(i=e.value.deptIds)==null?void 0:i.join(",");r=m==null?void 0:m.concat(`|${e.value.deptLevel}`);break}case a.POST:{r=(A=e.value.postIds)==null?void 0:A.join(",");break}case a.ROLE:{r=(h=e.value.roleIds)==null?void 0:h.join(",");break}case a.START_USER_DEPT_LEADER:case a.START_USER_MULTI_LEVEL_DEPT_LEADER:{r=`${e.value.deptLevel}`;break}case a.USER:{r=(I=e.value.userIds)==null?void 0:I.join(",");break}case a.USER_GROUP:{r=(P=e.value.userGroups)==null?void 0:P.join(",");break}}return r}function U(r,u){var g;if(!(!e.value||!u))switch(r){case a.DEPT_LEADER:case a.DEPT_MEMBER:{e.value.deptIds=u.split(",").map(i=>+i);break}case a.EXPRESSION:{e.value.expression=u;break}case a.FORM_DEPT_LEADER:{const i=u.split("|");i.length>1&&(e.value.formDept=i[0],i[1]&&(e.value.deptLevel=+i[1]));break}case a.FORM_USER:{e.value.formUser=u;break}case a.MULTI_LEVEL_DEPT_LEADER:{const i=u.split("|");i.length>1&&(e.value.deptIds=(g=i[0])==null?void 0:g.split(",").map(A=>+A),i[1]&&(e.value.deptLevel=+i[1]));break}case a.POST:{e.value.postIds=u.split(",").map(i=>+i);break}case a.ROLE:{e.value.roleIds=u.split(",").map(i=>+i);break}case a.START_USER_DEPT_LEADER:case a.START_USER_MULTI_LEVEL_DEPT_LEADER:{e.value.deptLevel=+u;break}case a.USER:{e.value.userIds=u.split(",").map(i=>+i);break}case a.USER_GROUP:{e.value.userGroups=u.split(",").map(i=>+i);break}}}return{configForm:e,roleOptions:s,postOptions:n,userOptions:l,userGroupOptions:T,deptTreeOptions:p,handleCandidateParam:L,parseCandidateParam:U,getShowText:R}}function ve(t){const s=o(),n=o(!1),l=o(null);function v(){n.value=!0}function T(){n.value=!1,s.value=s.value||W.get(t)}return O(n,p=>{p&&z(()=>{var E;(E=l.value)==null||E.focus()})}),{nodeName:s,showInput:n,inputRef:l,clickIcon:v,changeNodeName:T}}function Re(t,s){const n=o(!1),l=o(null);O(n,p=>{p&&z(()=>{var E;(E=l.value)==null||E.focus()})});function v(){n.value=!1,t.value.name=t.value.name||W.get(s),console.warn("node.value.name===>",t.value.name)}function T(){n.value=!0}return{showInput:n,inputRef:l,clickTitle:T,changeNodeName:v}}function Se(t){return t?t===y.APPROVE?"status-pass":t===y.RUNNING?"status-running":t===y.REJECT?"status-reject":t===y.CANCEL?"status-cancel":"":""}function Te(t,s,n,l){let v;if(t===K.EXPRESSION&&s&&(v=`表达式:${s}`),t===K.RULE){const T=n==null?void 0:n.and;let p;const E=n==null?void 0:n.conditions.map(e=>`(${e.rules.map(R=>R.leftSide&&R.rightSide?`${ne(l,R.leftSide)} ${re(R.opCode)} ${R.rightSide}`:(p="请完善条件规则","")).join(e.and?" 且 ":" 或 ")} ) `);v=p?"":E==null?void 0:E.join(T?" 且 ":" 或 ")}return v}function ne(t,s){const n=t.find(l=>l.field===s);return n==null?void 0:n.title}function re(t){const s=ae.find(n=>n.value===t);return s==null?void 0:s.label}function pe(t,s){return s?"其它情况":`条件${t+1}`}function _e(t,s){return s?"其它情况":`包容条件${t+1}`}export{oe as a,ve as b,Ee as c,de as d,pe as e,fe as f,Te as g,Re as h,Se as i,_e as j,Y as p,ce as u};
|