@steedos-labs/plugin-workflow 3.0.0-beta.17 → 3.0.0-beta.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/main/default/objects/instance_tasks/buttons/instance_new.button.yml +1 -3
- package/main/default/objects/instances/buttons/instance_new.button.yml +1 -3
- package/main/default/objects/instances/buttons/instance_related.button.yml +2 -2
- package/main/default/objects/instances/buttons/instance_save.button.yml +2 -8
- package/main/default/triggers/instances.trigger.js +9 -7
- package/package.json +1 -1
- package/src/instance_record_queue.js +1 -3
|
@@ -43,12 +43,10 @@ amis_schema: |-
|
|
|
43
43
|
"flow": "$event.data.value"
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
|
+
"adaptor": "return payload.instance ? {data: {...payload}, status: 0, msg: t('instance_action_new_dialog_msg_success')} : {...payload, status: 1, msg: t('instance_action_new_dialog_msg_failed')};",
|
|
46
47
|
"headers": {
|
|
47
48
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
48
49
|
}
|
|
49
|
-
},
|
|
50
|
-
"messages": {
|
|
51
|
-
"success": "创建成功!"
|
|
52
50
|
}
|
|
53
51
|
},
|
|
54
52
|
"actionType": "ajax"
|
|
@@ -43,12 +43,10 @@ amis_schema: |-
|
|
|
43
43
|
"flow": "$event.data.value"
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
|
+
"adaptor": "return payload.instance ? {data: {...payload}, status: 0, msg: t('instance_action_new_dialog_msg_success')} : {...payload, status: 1, msg: t('instance_action_new_dialog_msg_failed')};",
|
|
46
47
|
"headers": {
|
|
47
48
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
48
49
|
}
|
|
49
|
-
},
|
|
50
|
-
"messages": {
|
|
51
|
-
"success": "创建成功!"
|
|
52
50
|
}
|
|
53
51
|
},
|
|
54
52
|
"actionType": "ajax"
|
|
@@ -78,7 +78,7 @@ amis_schema: |-
|
|
|
78
78
|
"actions": [
|
|
79
79
|
{
|
|
80
80
|
"type": "button",
|
|
81
|
-
"label": "
|
|
81
|
+
"label": "${'Cancel' | t}",
|
|
82
82
|
"onEvent": {
|
|
83
83
|
"click": {
|
|
84
84
|
"actions": [
|
|
@@ -94,7 +94,7 @@ amis_schema: |-
|
|
|
94
94
|
},
|
|
95
95
|
{
|
|
96
96
|
"type": "button",
|
|
97
|
-
"label": "
|
|
97
|
+
"label": "${'OK' | t}",
|
|
98
98
|
"onEvent": {
|
|
99
99
|
"click": {
|
|
100
100
|
"actions": [
|
|
@@ -18,16 +18,13 @@ amis_schema: |-
|
|
|
18
18
|
"method": "post",
|
|
19
19
|
"sendOn": "",
|
|
20
20
|
"requestAdaptor": "var _SteedosUI$getRef$get, _approveValues$next_s;\nconst formValues = context._scoped.getComponentById(\"instance_form\").getValues();\nconst approveValues = (_SteedosUI$getRef$get = context._scoped.getComponentById(\"instance_approval\")) === null || _SteedosUI$getRef$get === void 0 ? void 0 : _SteedosUI$getRef$get.getValues();\nlet nextUsers = approveValues === null || approveValues === void 0 ? void 0 : approveValues.next_users;\nif (_.isString(nextUsers)) {\n nextUsers = [approveValues.next_users];\n}\nconst instance = context.record;\nconst body = {\n instance: {\n _id: instance._id,\n applicant: formValues.applicant,\n submitter: formValues.submitter,\n traces: [{\n _id: instance.trace._id,\n step: instance.step._id,\n approves: [{\n _id: instance.approve._id,\n next_steps: [{\n step: approveValues === null || approveValues === void 0 || (_approveValues$next_s = approveValues.next_step) === null || _approveValues$next_s === void 0 ? void 0 : _approveValues$next_s._id,\n users: nextUsers\n }],\n description: approveValues === null || approveValues === void 0 ? void 0 : approveValues.suggestion,\n values: formValues\n }]\n }]\n }\n};\napi.data = body;\nreturn api;",
|
|
21
|
+
"adaptor": "return payload.instance === true ? {...payload, status: 0, msg: t('instance_action_instance_save_msg_success')} : {...payload, status: 1, msg: t('instance_action_instance_save_msg_failed')};",
|
|
21
22
|
"headers": {
|
|
22
23
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
23
24
|
},
|
|
24
25
|
"data": {
|
|
25
26
|
"&": "$$"
|
|
26
27
|
}
|
|
27
|
-
},
|
|
28
|
-
"messages": {
|
|
29
|
-
"success": "暂存成功",
|
|
30
|
-
"failed": "暂存失败"
|
|
31
28
|
}
|
|
32
29
|
},
|
|
33
30
|
"actionType": "ajax",
|
|
@@ -40,16 +37,13 @@ amis_schema: |-
|
|
|
40
37
|
"method": "post",
|
|
41
38
|
"sendOn": "",
|
|
42
39
|
"requestAdaptor": "var _SteedosUI$getRef$get, _approveValues$next_s;\nconst formValues = context._scoped.getComponentById(\"instance_form\").getValues();\nconst approveValues = (_SteedosUI$getRef$get = context._scoped.getComponentById(\"instance_approval\")) === null || _SteedosUI$getRef$get === void 0 ? void 0 : _SteedosUI$getRef$get.getValues();\nlet nextUsers = approveValues === null || approveValues === void 0 ? void 0 : approveValues.next_users;\nif (_.isString(nextUsers)) {\n nextUsers = [approveValues.next_users];\n}\nconst instance = context.record;\nconst body = {\n approve: {\n id: instance.approve._id,\n instance: instance._id,\n trace: instance.trace._id,\n next_steps: [{\n step: approveValues === null || approveValues === void 0 || (_approveValues$next_s = approveValues.next_step) === null || _approveValues$next_s === void 0 ? void 0 : _approveValues$next_s._id,\n users: nextUsers\n }],\n description: approveValues === null || approveValues === void 0 ? void 0 : approveValues.suggestion,\n judge: approveValues === null || approveValues === void 0 ? void 0 : approveValues.judge,\n values: formValues\n }\n};\napi.data = body;\nreturn api;",
|
|
40
|
+
"adaptor": "return payload.instance ? {...payload, status: 0, msg: t('instance_action_instance_save_msg_success')} : {...payload, status: 1, msg: t('instance_action_instance_save_msg_failed')};",
|
|
43
41
|
"headers": {
|
|
44
42
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
45
43
|
},
|
|
46
44
|
"data": {
|
|
47
45
|
"&": "$$"
|
|
48
46
|
}
|
|
49
|
-
},
|
|
50
|
-
"messages": {
|
|
51
|
-
"success": "暂存成功",
|
|
52
|
-
"failed": "暂存失败"
|
|
53
47
|
}
|
|
54
48
|
},
|
|
55
49
|
"actionType": "ajax",
|
|
@@ -22,13 +22,15 @@ module.exports = {
|
|
|
22
22
|
},
|
|
23
23
|
|
|
24
24
|
afterDelete: async function () {
|
|
25
|
-
const {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
25
|
+
const { previousDoc } = this;
|
|
26
|
+
if(previousDoc){
|
|
27
|
+
let recordIds = previousDoc.record_ids;
|
|
28
|
+
if (recordIds && recordIds.length == 1) {
|
|
29
|
+
let recordObjName = recordIds[0].o;
|
|
30
|
+
let recordId = recordIds[0].ids[0];
|
|
31
|
+
if (recordObjName && recordId) {
|
|
32
|
+
await objectql.getObject(recordObjName).update(recordId, { "instances": null, "instance_state": null, "locked": false })
|
|
33
|
+
}
|
|
32
34
|
}
|
|
33
35
|
}
|
|
34
36
|
},
|
package/package.json
CHANGED
|
@@ -926,7 +926,7 @@ InstanceRecordQueue.syncRelatedObjectsValue = async function (mainRecordId, rela
|
|
|
926
926
|
}
|
|
927
927
|
}
|
|
928
928
|
//清理申请单上被删除子表记录对应的相关表记录
|
|
929
|
-
for (
|
|
929
|
+
for (let [tableCode, tableIds] of Object.entries(tableMap)) {
|
|
930
930
|
tableIds = _.compact(tableIds);
|
|
931
931
|
var docsForRemove = await objectFind(relatedObject.object_name, { filters: [[relatedObject.foreign_key, '=', mainRecordId], ['_table._code', '=', tableCode]] });
|
|
932
932
|
for (const doc of docsForRemove) {
|
|
@@ -1025,10 +1025,8 @@ InstanceRecordQueue.sendDoc = async function (doc) {
|
|
|
1025
1025
|
|
|
1026
1026
|
// 同步新附件
|
|
1027
1027
|
await InstanceRecordQueue.syncAttach(sync_attachment, insId, record.space, record._id, objectName);
|
|
1028
|
-
console.log(`1031 ===>`)
|
|
1029
1028
|
// 执行公式
|
|
1030
1029
|
await runQuoted(objectName, record._id);
|
|
1031
|
-
console.log(`runQuoted===>`)
|
|
1032
1030
|
} catch (error) {
|
|
1033
1031
|
console.error(error);
|
|
1034
1032
|
|