2025-05-29 15:03:59 +08:00

2 lines
4.7 KiB
JavaScript

import{d as u,f as D}from"./definition-CHRXcxuP.js";import{B as F}from"./index-CTXhDomq.js";import{f as T}from"./process-DnLyt1wg.js";import{g as C}from"./todo-DB3o-Pr4.js";import{F as R,a as U}from"./index-CSt_GYBb.js";import{_ as B,c as x,e as a,w as l,j as r,f,m as c,h as k,i as y,o as p}from"./index-CrAWI0wi.js";import"./vue-treeselect-DSnm48_Q.js";import"./user-Bxl06CMk.js";import"./StrUtil-DZsLURBF.js";import"./role-pNEACQin.js";const N={name:"Record",components:{BpmnViewer:F,FlowUser:U,FlowRole:R},props:{},data(){return{flowData:{},activeName:"1",queryParams:{deptId:void 0},loading:!0,deployId:"",procDefId:"",formRenderData:{},variables:[],taskTitle:null,taskOpen:!1,checkSendUser:!1,checkSendRole:!1,checkType:"",checkValues:null,formData:{},multiInstanceVars:"",formJson:{}}},created(){this.deployId=this.$route.query&&this.$route.query.deployId,this.procDefId=this.$route.query&&this.$route.query.procDefId,this.getFlowFormData(this.deployId)},methods:{handleClick(t,e){t.index==="2"&&D({deployId:this.deployId}).then(s=>{this.flowData=s.data})},getFlowFormData(t){T({deployId:t}).then(s=>{this.$nextTick(()=>{this.$refs.vFormRef.setFormJson(s.data),this.formJson=s.data})}).catch(s=>{this.goBack()})},goBack(){const t={path:"/task/process",query:{t:Date.now()}};this.$tab.closeOpenPage(t)},submitForm(){this.$refs.vFormRef.getFormData().then(t=>{C({deploymentId:this.deployId,variables:t}).then(e=>{const s=e.data;if(s){if(this.formData=t,s.dataType==="dynamic")s.type==="assignee"?(this.checkSendUser=!0,this.checkType="single"):s.type==="candidateUsers"?(this.checkSendUser=!0,this.checkType="multiple"):s.type==="candidateGroups"?this.checkSendRole=!0:(this.multiInstanceVars=s.vars,this.checkSendUser=!0,this.checkType="multiple"),this.taskOpen=!0,this.taskTitle="选择任务接收";else if(this.procDefId){const m={formJson:this.formJson};Object.assign(m,t),u(this.procDefId,m).then(o=>{this.$modal.msgSuccess(o.msg),this.goBack()})}}})}).catch(t=>{})},resetForm(){this.$refs.vFormRef.resetForm()},submitTask(){if(!this.checkValues&&this.checkSendUser){this.$modal.msgError("请选择任务接收!");return}if(!this.checkValues&&this.checkSendRole){this.$modal.msgError("请选择流程接收角色组!");return}if(this.formData){const t={formJson:this.formJson};Object.assign(t,this.formData),this.multiInstanceVars?t[this.multiInstanceVars]=this.checkValues:t.approval=this.checkValues,u(this.procDefId,t).then(e=>{this.$modal.msgSuccess(e.msg),this.goBack()})}},handleUserSelect(t){if(t)if(t instanceof Array){const e=t.map(s=>s.userId);this.multiInstanceVars?this.checkValues=e:this.checkValues=e.join(",")}else this.checkValues=t.userId},handleRoleSelect(t){if(t)if(t instanceof Array){const e=t.map(s=>s.roleId);this.checkValues=e.join(",")}else this.checkValues=t}}},O={class:"app-container"},j={style:{display:"flex","justify-content":"center"}},J={class:"dialog-footer"};function q(t,e,s,m,o,n){const i=r("el-button"),_=r("v-form-render"),V=r("el-col"),h=r("el-tab-pane"),g=r("bpmn-viewer"),b=r("el-tabs"),I=r("flow-user"),w=r("flow-role"),S=r("el-dialog"),v=r("el-card");return p(),x("div",O,[a(v,{class:"box-card"},{header:l(()=>[e[4]||(e[4]=f("span",{class:"el-icon-document"},"发起任务",-1)),a(i,{style:{float:"right"},size:"small",type:"danger",onClick:n.goBack},{default:l(()=>e[3]||(e[3]=[c("关闭")])),_:1},8,["onClick"])]),default:l(()=>[a(b,{"tab-position":"top",modelValue:o.activeName,"onUpdate:modelValue":e[0]||(e[0]=d=>o.activeName=d),onTabClick:n.handleClick},{default:l(()=>[a(h,{label:"表单信息",name:"1"},{default:l(()=>[a(V,{span:16,offset:4},{default:l(()=>[a(_,{"form-data":o.formRenderData,ref:"vFormRef"},null,8,["form-data"]),f("div",j,[a(i,{type:"primary",onClick:n.submitForm},{default:l(()=>e[5]||(e[5]=[c("提 交")])),_:1},8,["onClick"]),a(i,{type:"primary",onClick:n.resetForm},{default:l(()=>e[6]||(e[6]=[c("重 置")])),_:1},8,["onClick"])])]),_:1})]),_:1}),a(h,{label:"流程图",name:"2"},{default:l(()=>[a(g,{flowData:o.flowData},null,8,["flowData"])]),_:1})]),_:1},8,["modelValue","onTabClick"]),a(S,{title:o.taskTitle,modelValue:o.taskOpen,"onUpdate:modelValue":e[2]||(e[2]=d=>o.taskOpen=d),width:"65%","append-to-body":""},{footer:l(()=>[f("span",J,[a(i,{onClick:e[1]||(e[1]=d=>o.taskOpen=!1)},{default:l(()=>e[7]||(e[7]=[c("取 消")])),_:1}),a(i,{type:"primary",onClick:n.submitTask},{default:l(()=>e[8]||(e[8]=[c("提 交")])),_:1},8,["onClick"])])]),default:l(()=>[o.checkSendUser?(p(),k(I,{key:0,checkType:o.checkType,onHandleUserSelect:n.handleUserSelect},null,8,["checkType","onHandleUserSelect"])):y("",!0),o.checkSendRole?(p(),k(w,{key:1,onHandleRoleSelect:n.handleRoleSelect},null,8,["onHandleRoleSelect"])):y("",!0)]),_:1},8,["title","modelValue"])]),_:1})])}const Q=B(N,[["render",q],["__scopeId","data-v-3b06f419"]]);export{Q as default};