|
@@ -7,7 +7,7 @@ import {
|
|
|
} from "@packages/bpmn-utils/BpmnExtensionElements";
|
|
|
import { getBusinessObject, is, isAny } from "bpmn-js/lib/util/ModelUtil";
|
|
|
import { add as collectionAdd } from "diagram-js/lib/util/Collections";
|
|
|
-
|
|
|
+import { v4 as uuidv4 } from "uuid";
|
|
|
|
|
|
// 版本描述
|
|
|
export function getNoteValue(element) {
|
|
@@ -95,13 +95,18 @@ export function isUserTask(element) {
|
|
|
return is(element, 'bpmn:UserTask');
|
|
|
}
|
|
|
|
|
|
-export function setExecuteUser(element, value) {
|
|
|
+export function setExecuteUser(element, value, isUpdate) {
|
|
|
const prefix = getProcessEngine();
|
|
|
const modeling = getModeler.getModeling();
|
|
|
const businessObject = getBusinessObject(element);
|
|
|
+ let uuid = uuidv4()
|
|
|
modeling.updateModdleProperties(element, businessObject, {
|
|
|
[`${prefix}:executeUser`]: value
|
|
|
});
|
|
|
+ if (isUpdate) return
|
|
|
+ modeling.updateModdleProperties(element, businessObject, {
|
|
|
+ [`${prefix}:virtuallyRole`]: uuid
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
|
|
@@ -185,7 +190,7 @@ export function getAfterNdoe(element) {
|
|
|
}
|
|
|
|
|
|
|
|
|
-/* 异常任务 */
|
|
|
+/* 脚本任务 */
|
|
|
|
|
|
export function getUnusualTasksContainer(element) {
|
|
|
const businessObject = getBusinessObject(element);
|
|
@@ -205,10 +210,13 @@ export function addUnusualTask(element, props) {
|
|
|
// 获取异常任务表数据
|
|
|
export function getUnusualTaskTableData(moddleList = []) {
|
|
|
const prefix = getProcessEngine();
|
|
|
+ console.log(moddleList);
|
|
|
let res = moddleList.map(item => {
|
|
|
return {
|
|
|
- scriptKey: item?.$attrs[prefix + ':scriptKey'] || '',
|
|
|
- scriptTriggerType: item?.$attrs[prefix + ':scriptTriggerType'] || 0
|
|
|
+ scriptKey: item?.$attrs.scriptKey || '',
|
|
|
+ scriptTriggerType: item?.$attrs.scriptTriggerType || '0',
|
|
|
+ scriptName: item?.$attrs.scriptName || '',
|
|
|
+ industryType: item?.$attrs.industryType || '0',
|
|
|
}
|
|
|
})
|
|
|
return res
|
|
@@ -217,13 +225,15 @@ export function getUnusualTaskTableData(moddleList = []) {
|
|
|
function updateTaskProperty(element, listener, props) {
|
|
|
const modeling = getModeler.getModeling();
|
|
|
const prefix = getProcessEngine();
|
|
|
- const { scriptKey, scriptTriggerType } = props;
|
|
|
+ const { scriptKey, scriptTriggerType, scriptName, industryType } = props;
|
|
|
|
|
|
const updateProperty = (key, value) =>
|
|
|
- modeling.updateModdleProperties(element, listener, { [`${prefix}:${key}`]: value });
|
|
|
+ modeling.updateModdleProperties(element, listener, { [`${key}`]: value });
|
|
|
|
|
|
scriptKey && updateProperty("scriptKey", scriptKey);
|
|
|
scriptTriggerType && updateProperty("scriptTriggerType", scriptTriggerType);
|
|
|
+ scriptName && updateProperty('scriptName', scriptName);
|
|
|
+ industryType && updateProperty('industryType', industryType);
|
|
|
}
|
|
|
// 修改任务
|
|
|
export function updateUnusualTask(element, props, listener) {
|
|
@@ -253,3 +263,76 @@ export function getUnusualTasksType(listener) {
|
|
|
return "";
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+/* 脚本执行时机 */
|
|
|
+
|
|
|
+export function getScriptTriggerType(element) {
|
|
|
+ const prefix = getProcessEngine();
|
|
|
+ return element.businessObject.get(`${prefix}:scriptTriggerType`);
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+export function setScriptTriggerType(element, value) {
|
|
|
+
|
|
|
+ const modeling = getModeler.getModeling();
|
|
|
+ const prefix = getProcessEngine();
|
|
|
+
|
|
|
+ modeling.updateProperties(element, {
|
|
|
+ [`${prefix}:scriptTriggerType`]: value
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+/* 正常任务 */
|
|
|
+
|
|
|
+export function setIndustryType(element, value) {
|
|
|
+ const prefix = getProcessEngine();
|
|
|
+ const modeling = getModeler.getModeling();
|
|
|
+ const businessObject = getBusinessObject(element);
|
|
|
+ modeling.updateModdleProperties(element, businessObject, {
|
|
|
+ [`${prefix}:IndustryType`]: value
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+export function getIndustryType(element) {
|
|
|
+ const prefix = getProcessEngine();
|
|
|
+ const businessObject = getBusinessObject(element);
|
|
|
+
|
|
|
+ return businessObject.get(`${prefix}:IndustryType`);
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+export function setNormalScriptKey(element, value) {
|
|
|
+ const prefix = getProcessEngine();
|
|
|
+ const modeling = getModeler.getModeling();
|
|
|
+ const businessObject = getBusinessObject(element);
|
|
|
+ modeling.updateModdleProperties(element, businessObject, {
|
|
|
+ [`${prefix}:NormalScriptKey`]: value
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+export function getNormalScriptKey(element) {
|
|
|
+ const prefix = getProcessEngine();
|
|
|
+ const businessObject = getBusinessObject(element);
|
|
|
+
|
|
|
+ return businessObject.get(`${prefix}:NormalScriptKey`);
|
|
|
+}
|
|
|
+export function setNormalScriptTriggerType(element, value) {
|
|
|
+ const prefix = getProcessEngine();
|
|
|
+ const modeling = getModeler.getModeling();
|
|
|
+ const businessObject = getBusinessObject(element);
|
|
|
+ modeling.updateModdleProperties(element, businessObject, {
|
|
|
+ [`${prefix}:NormalScriptTriggerType`]: value
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+export function getNormalScriptTriggerType(element) {
|
|
|
+ const prefix = getProcessEngine();
|
|
|
+ const businessObject = getBusinessObject(element);
|
|
|
+
|
|
|
+ return businessObject.get(`${prefix}:NormalScriptTriggerType`);
|
|
|
+}
|