import{d as ue,a0 as pe,az as me,aE as de,r as i,A as ce,w as fe,b as ve,aA as ye,o as m,g as _,B as r,c as A,i as J,a as e,F as L,P as M,C as S,D as x,k as o,I as ke,h as F,Q as _e,aF as be,aG as he,aH as Ue,am as ge,Z as Ve,O as v,S as Ce,aD as we,a7 as xe,$ as Te,R as Ie,W as De,U as Fe,V as Re}from"./index-CHTXMeh8.js";import{_ as Se}from"./ContentWrap.vue_vue_type_script_setup_true_lang-BjvrLlUT.js";import{E as Ee}from"./el-card-Bdk9qx7q.js";import{b as Y}from"./formCreate-Cdf7i8Tu.js";import{a as Be}from"./index-BnVkKGRw.js";import{g as $e}from"./index-GzuMZCCW.js";import{g as ze,a as Ae,r as Pe}from"./index-vcfoyZY6.js";import{_ as qe}from"./ProcessInstanceBpmnViewer.vue_vue_type_style_index_0_lang-CfySswyA.js";import{_ as Ge}from"./ProcessInstanceTaskList.vue_vue_type_script_setup_true_lang-kERBllAK.js";import{_ as Ne}from"./TaskReturnForm.vue_vue_type_script_name_TaskRollbackDialogForm_setup_true_lang-DwCxW8rR.js";import{_ as Oe}from"./TaskDelegateForm.vue_vue_type_script_setup_true_lang-CnXRIIOm.js";import{_ as je}from"./TaskTransferForm.vue_vue_type_script_setup_true_lang-CPKw41sf.js";import{_ as He}from"./TaskSignCreateForm.vue_vue_type_script_setup_true_lang-DXaIK5tX.js";import{g as Ke}from"./index-DYclHsjD.js";import"./bpmn-embedded-BQWcRx7_.js";import"./Dialog.vue_vue_type_style_index_0_lang-DH0TiLYN.js";import"./XTextButton-DNeufsj_.js";import"./XButton-C1WkVWZR.js";import"./index-CQckL2qL.js";import"./el-tree-select-DhIHMmfG.js";import"./tree-BBZY150N.js";import"./index-VglbY8ty.js";import"./index-BFn6KXm4.js";import"./index-63VBDaUm.js";import"./index-eJzt9aew.js";import"./index.vue_vue_type_script_setup_true_lang-Cenk7Bi3.js";import"./index-DVe591HI.js";import"./constants-CuOBQ73z.js";import"./index-BbWSenFL.js";import"./el-drawer-DCGXHIlf.js";import"./DictTag.vue_vue_type_script_lang-DPOZRs0A.js";import"./color-DXkOL5Tu.js";import"./index-CO7BRHFB.js";import"./formatTime-DG99nHw2.js";import"./el-timeline-item-96ngSrpR.js";import"./TaskSignList.vue_vue_type_script_setup_true_lang-C1L2UaCa.js";import"./TaskSignDeleteForm.vue_vue_type_script_setup_true_lang-XacdJ-us.js";const Qe={class:"el-icon-picture-outline"},We={class:"el-icon-picture-outline"},Xe={style:{"margin-bottom":"20px","margin-left":"10%","font-size":"14px"}},Ze={class:"el-icon-document"},Je={key:1},Le=ue({name:"BpmProcessInstanceDetail",__name:"index",setup(Me){const{query:ee}=pe(),E=_e(),{proxy:ae}=me(),oe=de().getUser.id,B=ee.id,T=i(!1),n=i({}),P=i(""),$=i(!0),b=i([]),h=i([]),f=i([]),se=ce({reason:[{required:!0,message:"\u5BA1\u6279\u5EFA\u8BAE\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}]}),y=i([]),I=i([]),U=i(),D=i({rule:[],option:{},value:{}});fe(()=>I.value,u=>{u==null||u.forEach(a=>{a.btn.show(!1),a.resetBtn.show(!1)})},{deep:!0});const q=async(u,a)=>{const l=h.value.indexOf(u),V=ae.$refs["form"+l][0],k=e(V);if(!k||!await k.validate())return;const d={id:u.id,reason:f.value[l].reason,copyUserIds:f.value[l].copyUserIds};if(a){const R=I.value[l];R&&(await R.validate(),d.variables=y.value[l].value),await Ae(d),E.success("\u5BA1\u6279\u901A\u8FC7\u6210\u529F")}else await Pe(d),E.success("\u5BA1\u6279\u4E0D\u901A\u8FC7\u6210\u529F");g()},G=i(),N=i(),O=i(),j=i(),g=()=>{le(),K()},H=i(null),le=async()=>{var u;try{T.value=!0;const a=await $e(B);if(!a)return void E.error("\u67E5\u8BE2\u4E0D\u5230\u6D41\u7A0B\u4FE1\u606F\uFF01");n.value=a;const l=a.processDefinition;l.formType===10?(Y(D,l.formConf,l.formFields,a.formVariables),be().then(()=>{var V,k,d;(V=U.value)==null||V.btn.show(!1),(k=U.value)==null||k.resetBtn.show(!1),(d=U.value)==null||d.disabled(!0)})):H.value=he(a.processDefinition.formCustomViewPath),P.value=(u=await Be(l.id))==null?void 0:u.bpmnXml}finally{T.value=!1}},K=async()=>{h.value=[],f.value=[],y.value=[],I.value=[];try{$.value=!0;const u=await ze(B);b.value=[],u.forEach(a=>{a.status!==4&&b.value.push(a)}),b.value.sort((a,l)=>a.endTime&&l.endTime?l.endTime-a.endTime:a.endTime?1:l.endTime?-1:l.createTime-a.createTime),Q(b.value)}finally{$.value=!1}},Q=u=>{u.forEach(a=>{if(Ue(a.children)||Q(a.children),(a.status===1||a.status===6)&&a.assigneeUser&&a.assigneeUser.id===oe)if(h.value.push({...a}),f.value.push({reason:"",copyUserIds:[]}),a.formId&&a.formConf){const l={};Y(l,a.formConf,a.formFields,a.formVariables),y.value.push(l)}else y.value.push({})})},W=i([]);return ve(async()=>{g(),W.value=await Ke()}),(u,a)=>{const l=Ce,V=we,k=ye("form-create"),d=Ee,R=xe,re=Te,te=Ie,ie=De,C=Fe,w=Re,X=ge,ne=Se,Z=Ve;return m(),_(ne,null,{default:r(()=>[(m(!0),A(L,null,J(e(h),(c,t)=>M((m(),_(d,{key:t,class:"box-card"},{header:r(()=>[S("span",Qe,"\u5BA1\u6279\u4EFB\u52A1\u3010"+x(c.name)+"\u3011",1)]),default:r(()=>[o(X,{offset:6,span:16},{default:r(()=>[o(ie,{ref_for:!0,ref:"form"+t,model:e(f)[t],rules:e(se),"label-width":"100px"},{default:r(()=>[e(n)&&e(n).name?(m(),_(l,{key:0,label:"\u6D41\u7A0B\u540D"},{default:r(()=>[v(x(e(n).name),1)]),_:1})):F("",!0),e(n)&&e(n).startUser?(m(),_(l,{key:1,label:"\u6D41\u7A0B\u53D1\u8D77\u4EBA"},{default:r(()=>{var s;return[v(x((s=e(n))==null?void 0:s.startUser.nickname)+" ",1),o(V,{size:"small",type:"info"},{default:r(()=>{var p;return[v(x((p=e(n))==null?void 0:p.startUser.deptName),1)]}),_:1})]}),_:1})):F("",!0),e(h)[t].formId>0?(m(),_(d,{key:2,class:"mb-15px !-mt-10px"},{header:r(()=>{var s;return[S("span",We," \u586B\u5199\u8868\u5355\u3010"+x((s=e(h)[t])==null?void 0:s.formName)+"\u3011 ",1)]}),default:r(()=>[o(k,{modelValue:e(y)[t].value,"onUpdate:modelValue":s=>e(y)[t].value=s,api:e(I)[t],"onUpdate:api":s=>e(I)[t]=s,option:e(y)[t].option,rule:e(y)[t].rule},null,8,["modelValue","onUpdate:modelValue","api","onUpdate:api","option","rule"])]),_:2},1024)):F("",!0),o(l,{label:"\u5BA1\u6279\u5EFA\u8BAE",prop:"reason"},{default:r(()=>[o(R,{modelValue:e(f)[t].reason,"onUpdate:modelValue":s=>e(f)[t].reason=s,placeholder:"\u8BF7\u8F93\u5165\u5BA1\u6279\u5EFA\u8BAE",type:"textarea"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1024),o(l,{label:"\u6284\u9001\u4EBA",prop:"copyUserIds"},{default:r(()=>[o(te,{modelValue:e(f)[t].copyUserIds,"onUpdate:modelValue":s=>e(f)[t].copyUserIds=s,multiple:"",placeholder:"\u8BF7\u9009\u62E9\u6284\u9001\u4EBA"},{default:r(()=>[(m(!0),A(L,null,J(e(W),s=>(m(),_(re,{key:s.id,label:s.nickname,value:s.id},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1024)]),_:2},1032,["model","rules"]),S("div",Xe,[o(w,{type:"success",onClick:s=>q(c,!0)},{default:r(()=>[o(C,{icon:"ep:select"}),v(" \u901A\u8FC7 ")]),_:2},1032,["onClick"]),o(w,{type:"danger",onClick:s=>q(c,!1)},{default:r(()=>[o(C,{icon:"ep:close"}),v(" \u4E0D\u901A\u8FC7 ")]),_:2},1032,["onClick"]),o(w,{type:"primary",onClick:s=>{return p=c.id,void G.value.open(p);var p}},{default:r(()=>[o(C,{icon:"ep:edit"}),v(" \u8F6C\u529E ")]),_:2},1032,["onClick"]),o(w,{type:"primary",onClick:s=>(async p=>{N.value.open(p.id)})(c)},{default:r(()=>[o(C,{icon:"ep:position"}),v(" \u59D4\u6D3E ")]),_:2},1032,["onClick"]),o(w,{type:"primary",onClick:s=>(async p=>{j.value.open(p.id)})(c)},{default:r(()=>[o(C,{icon:"ep:plus"}),v(" \u52A0\u7B7E ")]),_:2},1032,["onClick"]),o(w,{type:"warning",onClick:s=>(async p=>{O.value.open(p.id)})(c)},{default:r(()=>[o(C,{icon:"ep:back"}),v(" \u56DE\u9000 ")]),_:2},1032,["onClick"])])]),_:2},1024)]),_:2},1024)),[[Z,e(T)]])),128)),M((m(),_(d,{class:"box-card"},{header:r(()=>[S("span",Ze,"\u7533\u8BF7\u4FE1\u606F\u3010"+x(e(n).name)+"\u3011",1)]),default:r(()=>{var c,t,s,p;return[((t=(c=e(n))==null?void 0:c.processDefinition)==null?void 0:t.formType)===10?(m(),_(X,{key:0,offset:6,span:16},{default:r(()=>[o(k,{modelValue:e(D).value,"onUpdate:modelValue":a[0]||(a[0]=z=>e(D).value=z),api:e(U),"onUpdate:api":a[1]||(a[1]=z=>ke(U)?U.value=z:null),option:e(D).option,rule:e(D).rule},null,8,["modelValue","api","option","rule"])]),_:1})):F("",!0),((p=(s=e(n))==null?void 0:s.processDefinition)==null?void 0:p.formType)===20?(m(),A("div",Je,[o(e(H),{id:e(n).businessKey},null,8,["id"])])):F("",!0)]}),_:1})),[[Z,e(T)]]),o(Ge,{loading:e($),"process-instance":e(n),tasks:e(b),onRefresh:K},null,8,["loading","process-instance","tasks"]),o(qe,{id:`${e(B)}`,"bpmn-xml":e(P),loading:e(T),"process-instance":e(n),tasks:e(b)},null,8,["id","bpmn-xml","loading","process-instance","tasks"]),o(je,{ref_key:"taskTransferFormRef",ref:G,onSuccess:g},null,512),o(Ne,{ref_key:"taskReturnFormRef",ref:O,onSuccess:g},null,512),o(Oe,{ref_key:"taskDelegateForm",ref:N,onSuccess:g},null,512),o(He,{ref_key:"taskSignCreateFormRef",ref:j,onSuccess:g},null,512)]),_:1})}}});export{Le as default};