xm
2024-06-14 722af26bc6fec32bb289b1df51a9016a4935610f
提交 | 用户 | 时间
722af2 1 <template>
X 2   <div class="panel-tab__content">
3     <el-form size="mini" label-width="96px" @submit.native.prevent>
4 <!--      <el-form-item label="异步延续">-->
5 <!--        <el-checkbox v-model="taskConfigForm.asyncBefore" label="异步前" @change="changeTaskAsync" />-->
6 <!--        <el-checkbox v-model="taskConfigForm.asyncAfter" label="异步后" @change="changeTaskAsync" />-->
7 <!--        <el-checkbox v-model="taskConfigForm.exclusive" v-if="taskConfigForm.asyncAfter || taskConfigForm.asyncBefore" label="排除" @change="changeTaskAsync" />-->
8 <!--      </el-form-item>-->
9       <component :is="witchTaskComponent" v-bind="$props" />
10     </el-form>
11   </div>
12 </template>
13
14 <script>
15 import UserTask from "./task-components/UserTask";
16 import ServiceTask from "./task-components/ServiceTask";
17 import ScriptTask from "./task-components/ScriptTask";
18 import ReceiveTask from "./task-components/ReceiveTask";
19
20 export default {
21   name: "ElementTaskConfig",
22   components: { UserTask, ServiceTask, ScriptTask, ReceiveTask },
23   props: {
24     id: String,
25     type: String
26   },
27   data() {
28     return {
29       taskConfigForm: {
30         asyncAfter: false,
31         asyncBefore: false,
32         exclusive: false
33       },
34       witchTaskComponent: "",
35       installedComponent: {
36         // 手工任务与普通任务一致,不需要其他配置
37         // 接收消息任务,需要在全局下插入新的消息实例,并在该节点下的 messageRef 属性绑定该实例
38         // 发送任务、服务任务、业务规则任务共用一个相同配置
39         UserTask: "UserTask", // 用户任务配置
40         ServiceTask: "ServiceTask", // 服务任务配置
41         ScriptTask: "ScriptTask", // 脚本任务配置
42         ReceiveTask: "ReceiveTask" // 消息接收任务
43       }
44     };
45   },
46   watch: {
47     id: {
48       immediate: true,
49       handler() {
50         this.bpmnElement = window.bpmnInstances.bpmnElement;
51         this.taskConfigForm.asyncBefore = this.bpmnElement?.businessObject?.asyncBefore;
52         this.taskConfigForm.asyncAfter = this.bpmnElement?.businessObject?.asyncAfter;
53         this.taskConfigForm.exclusive = this.bpmnElement?.businessObject?.exclusive;
54       }
55     },
56     type: {
57       immediate: true,
58       handler() {
59         this.witchTaskComponent = this.installedComponent[this.type];
60       }
61     }
62   },
63   methods: {
64     changeTaskAsync() {
65       if (!this.taskConfigForm.asyncBefore && !this.taskConfigForm.asyncAfter) {
66         this.taskConfigForm.exclusive = false;
67       }
68       window.bpmnInstances.modeling.updateProperties(window.bpmnInstances.bpmnElement, {
69         ...this.taskConfigForm
70       });
71     }
72   }
73 };
74 </script>