|
@@ -1,24 +1,47 @@
|
|
<template>
|
|
<template>
|
|
<el-collapse-item name="element-unusual-tasks">
|
|
<el-collapse-item name="element-unusual-tasks">
|
|
<template #title>
|
|
<template #title>
|
|
- <collapse-title title="异常任务">
|
|
|
|
|
|
+ <collapse-title title="管道节点">
|
|
<lucide-icon name="FileX2" />
|
|
<lucide-icon name="FileX2" />
|
|
</collapse-title>
|
|
</collapse-title>
|
|
<number-tag :value="listeners.length" margin-left="12px" />
|
|
<number-tag :value="listeners.length" margin-left="12px" />
|
|
</template>
|
|
</template>
|
|
|
|
+ <el-form label-width="110px" :model="scriptForm">
|
|
|
|
+ <el-form-item label="脚本执行时机:">
|
|
|
|
+ <el-switch
|
|
|
|
+ active-text="节点后"
|
|
|
|
+ inactive-text="节点前"
|
|
|
|
+ v-model="scriptForm.scriptTriggerType"
|
|
|
|
+ @change="updateScriptTriggerType"
|
|
|
|
+ />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-form>
|
|
<div class="element-unusual-tasks">
|
|
<div class="element-unusual-tasks">
|
|
<el-table border :data="listeners" style="width: 100%" height="200px">
|
|
<el-table border :data="listeners" style="width: 100%" height="200px">
|
|
<el-table-column label="序号" type="index" width="50" />
|
|
<el-table-column label="序号" type="index" width="50" />
|
|
<el-table-column
|
|
<el-table-column
|
|
label="执行脚本"
|
|
label="执行脚本"
|
|
- prop="scriptKey"
|
|
|
|
|
|
+ prop="scriptName"
|
|
show-overflow-tooltip
|
|
show-overflow-tooltip
|
|
- />
|
|
|
|
|
|
+ >
|
|
|
|
+ <!-- <template slot-scope="scope">
|
|
|
|
+ {{ getDictLabel(scope.row.scriptType, dict.type.bpm_script_type) }}
|
|
|
|
+ </template> -->
|
|
|
|
+ </el-table-column>
|
|
<el-table-column
|
|
<el-table-column
|
|
label="触发方式"
|
|
label="触发方式"
|
|
prop="scriptTriggerType"
|
|
prop="scriptTriggerType"
|
|
show-overflow-tooltip
|
|
show-overflow-tooltip
|
|
- />
|
|
|
|
|
|
+ >
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ {{
|
|
|
|
+ getDictLabel(
|
|
|
|
+ scope.row.scriptTriggerType,
|
|
|
|
+ dict.type.script_trigger_type
|
|
|
|
+ )
|
|
|
|
+ }}
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
<el-table-column label="操作" width="140">
|
|
<el-table-column label="操作" width="140">
|
|
<template slot-scope="{ row, $index }">
|
|
<template slot-scope="{ row, $index }">
|
|
<el-button type="text" @click="openScriptModel($index, row)"
|
|
<el-button type="text" @click="openScriptModel($index, row)"
|
|
@@ -37,13 +60,13 @@
|
|
icon="el-icon-plus"
|
|
icon="el-icon-plus"
|
|
@click="openScriptModel(-1)"
|
|
@click="openScriptModel(-1)"
|
|
>
|
|
>
|
|
- 添加执行监听
|
|
|
|
|
|
+ 添加执行脚本
|
|
</el-button>
|
|
</el-button>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<el-dialog
|
|
<el-dialog
|
|
:visible.sync="modelVisible"
|
|
:visible.sync="modelVisible"
|
|
- title="添加可触发的异常任务"
|
|
|
|
|
|
+ title="添加可触发的脚本任务"
|
|
width="640px"
|
|
width="640px"
|
|
append-to-body
|
|
append-to-body
|
|
destroy-on-close
|
|
destroy-on-close
|
|
@@ -55,26 +78,40 @@
|
|
class="need-filled"
|
|
class="need-filled"
|
|
aria-modal="true"
|
|
aria-modal="true"
|
|
>
|
|
>
|
|
- <el-form-item path="scriptKey" label="任务脚本">
|
|
|
|
- <el-select v-model="newUnusualTask.scriptKey">
|
|
|
|
|
|
+ <el-form-item path="industryType" label="行业类型">
|
|
|
|
+ <el-select v-model="newUnusualTask.industryType">
|
|
<el-option
|
|
<el-option
|
|
- v-for="{ label, value } in scriptKeyList"
|
|
|
|
|
|
+ v-for="{ label, value } in dict.type.industry_type"
|
|
:label="label"
|
|
:label="label"
|
|
:value="value"
|
|
:value="value"
|
|
:key="value"
|
|
:key="value"
|
|
/>
|
|
/>
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item path="scriptTriggerType" label="事件触发类型">
|
|
|
|
- <el-select v-model="newUnusualTask.scriptTriggerType">
|
|
|
|
|
|
+ <el-form-item path="scriptKey" label="任务脚本">
|
|
|
|
+ <el-select
|
|
|
|
+ v-model="newUnusualTask.scriptKey"
|
|
|
|
+ @change="scriptKeyChange"
|
|
|
|
+ :disabled="!newUnusualTask.industryType"
|
|
|
|
+ >
|
|
<el-option
|
|
<el-option
|
|
- v-for="{ label, value } in scriptTriggerTypeList"
|
|
|
|
|
|
+ v-for="{ label, value } in scriptKeyList"
|
|
:label="label"
|
|
:label="label"
|
|
:value="value"
|
|
:value="value"
|
|
:key="value"
|
|
:key="value"
|
|
/>
|
|
/>
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
+ <el-form-item path="scriptTriggerType" label="事件触发机制">
|
|
|
|
+ <el-select v-model="newUnusualTask.scriptTriggerType">
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="item in dict.type.script_trigger_type"
|
|
|
|
+ :label="item.label"
|
|
|
|
+ :value="item.value"
|
|
|
|
+ :key="item.value"
|
|
|
|
+ />
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
</el-form>
|
|
</el-form>
|
|
<template #footer>
|
|
<template #footer>
|
|
<el-button @click="modelVisible = false">取 消</el-button>
|
|
<el-button @click="modelVisible = false">取 消</el-button>
|
|
@@ -92,18 +129,25 @@ import {
|
|
removeUnusualTask,
|
|
removeUnusualTask,
|
|
updateUnusualTask,
|
|
updateUnusualTask,
|
|
getUnusualTaskTableData,
|
|
getUnusualTaskTableData,
|
|
|
|
+ getScriptTriggerType,
|
|
|
|
+ setScriptTriggerType,
|
|
} from "@packages/bo-utils/myFieldUtil";
|
|
} from "@packages/bo-utils/myFieldUtil";
|
|
import { getScriptType } from "@packages/bo-utils/scriptUtil";
|
|
import { getScriptType } from "@packages/bo-utils/scriptUtil";
|
|
import EventEmitter from "@utils/EventEmitter";
|
|
import EventEmitter from "@utils/EventEmitter";
|
|
import { getActive } from "@packages/bpmn-utils/BpmnDesignerUtils";
|
|
import { getActive } from "@packages/bpmn-utils/BpmnDesignerUtils";
|
|
|
|
+import { listScript } from "@/api/bpmprocess/process";
|
|
|
|
|
|
export default {
|
|
export default {
|
|
name: "ElementUnusualTasks",
|
|
name: "ElementUnusualTasks",
|
|
|
|
+ dicts: ["script_trigger_type", "bpm_script_type", "industry_type"],
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
modelVisible: false,
|
|
modelVisible: false,
|
|
listeners: [],
|
|
listeners: [],
|
|
newUnusualTask: {},
|
|
newUnusualTask: {},
|
|
|
|
+ scriptForm: {
|
|
|
|
+ scriptTriggerType: false,
|
|
|
|
+ },
|
|
formRules: {
|
|
formRules: {
|
|
scriptKey: {
|
|
scriptKey: {
|
|
required: true,
|
|
required: true,
|
|
@@ -113,19 +157,10 @@ export default {
|
|
scriptTriggerType: {
|
|
scriptTriggerType: {
|
|
required: true,
|
|
required: true,
|
|
trigger: ["blur", "change"],
|
|
trigger: ["blur", "change"],
|
|
- message: "任务触发方式不能为空",
|
|
|
|
|
|
+ message: "事件触发机制不能为空",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
- scriptKeyList: [
|
|
|
|
- {
|
|
|
|
- value: 1,
|
|
|
|
- label: "缺货异常",
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- value: 2,
|
|
|
|
- label: "人员异常",
|
|
|
|
- },
|
|
|
|
- ],
|
|
|
|
|
|
+ scriptKeyList: [],
|
|
scriptTriggerTypeList: [
|
|
scriptTriggerTypeList: [
|
|
{
|
|
{
|
|
value: 0,
|
|
value: 0,
|
|
@@ -148,11 +183,14 @@ export default {
|
|
this.modelVisible = false;
|
|
this.modelVisible = false;
|
|
this.newUnusualTask = {
|
|
this.newUnusualTask = {
|
|
scriptKey: "",
|
|
scriptKey: "",
|
|
- scriptTriggerType: 0,
|
|
|
|
|
|
+ scriptTriggerType: "0",
|
|
|
|
+ industryType: "0",
|
|
|
|
+ scriptName: "",
|
|
// event: getDefaultEvent(getActive()),
|
|
// event: getDefaultEvent(getActive()),
|
|
// type: "class",
|
|
// type: "class",
|
|
};
|
|
};
|
|
this._listenersRaw = getUnusualTasks(getActive());
|
|
this._listenersRaw = getUnusualTasks(getActive());
|
|
|
|
+ this.scriptForm.scriptTriggerType = getScriptTriggerType(getActive());
|
|
|
|
|
|
this.listeners = getUnusualTaskTableData(this._listenersRaw);
|
|
this.listeners = getUnusualTaskTableData(this._listenersRaw);
|
|
console.log(this.listeners);
|
|
console.log(this.listeners);
|
|
@@ -161,7 +199,7 @@ export default {
|
|
updateScriptType(value) {
|
|
updateScriptType(value) {
|
|
this.newUnusualTask.script = {
|
|
this.newUnusualTask.script = {
|
|
scriptFormat: this.newUnusualTask.script?.scriptFormat,
|
|
scriptFormat: this.newUnusualTask.script?.scriptFormat,
|
|
- scriptType: value,
|
|
|
|
|
|
+ industryType: value,
|
|
};
|
|
};
|
|
},
|
|
},
|
|
removeScript(index) {
|
|
removeScript(index) {
|
|
@@ -171,6 +209,7 @@ export default {
|
|
},
|
|
},
|
|
async saveUnusualTask(index) {
|
|
async saveUnusualTask(index) {
|
|
await this.$refs.formRef.validate();
|
|
await this.$refs.formRef.validate();
|
|
|
|
+ console.log(this.newUnusualTask);
|
|
this.activeIndex === -1
|
|
this.activeIndex === -1
|
|
? addUnusualTask(getActive(), this.newUnusualTask)
|
|
? addUnusualTask(getActive(), this.newUnusualTask)
|
|
: updateUnusualTask(
|
|
: updateUnusualTask(
|
|
@@ -183,11 +222,33 @@ export default {
|
|
|
|
|
|
async openScriptModel(index, TaskData) {
|
|
async openScriptModel(index, TaskData) {
|
|
this.activeIndex = index;
|
|
this.activeIndex = index;
|
|
|
|
+ console.log(TaskData);
|
|
TaskData && (this.newUnusualTask = JSON.parse(JSON.stringify(TaskData)));
|
|
TaskData && (this.newUnusualTask = JSON.parse(JSON.stringify(TaskData)));
|
|
this.modelVisible = true;
|
|
this.modelVisible = true;
|
|
|
|
+ let res = await listScript({ isEnablePaging: false, scriptType: 0 });
|
|
|
|
+ this.scriptKeyList = res.rows.map((item) => ({
|
|
|
|
+ value: item.scriptKey,
|
|
|
|
+ label: item.scriptName,
|
|
|
|
+ }));
|
|
await this.$nextTick();
|
|
await this.$nextTick();
|
|
this.$refs.formRef && this.$refs.formRef.clearValidate();
|
|
this.$refs.formRef && this.$refs.formRef.clearValidate();
|
|
},
|
|
},
|
|
|
|
+ // 脚本名改变
|
|
|
|
+ scriptKeyChange(value) {
|
|
|
|
+ this.newUnusualTask.scriptName =
|
|
|
|
+ this.scriptKeyList.filter((item) => item.value == value)[0]?.label ||
|
|
|
|
+ "未命名脚本";
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ updateScriptTriggerType(value) {
|
|
|
|
+ setScriptTriggerType(getActive(), value);
|
|
|
|
+ },
|
|
|
|
+ // 获取字典对应label
|
|
|
|
+ getDictLabel(value, dictLsit = []) {
|
|
|
|
+ return dictLsit.find((item) => {
|
|
|
|
+ return item.value == value;
|
|
|
|
+ })?.label;
|
|
|
|
+ },
|
|
},
|
|
},
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|