@steedos-labs/plugin-workflow 3.0.0 → 3.0.1-beta.2
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/client/socket.client.js +46 -3
- package/main/default/manager/instance_manager.js +20 -6
- package/main/default/manager/uuflow_manager.js +3 -1
- package/main/default/methods/instance_approve.js +258 -0
- package/main/default/methods/trace_approve_cc.js +13 -10
- package/main/default/objectTranslations/forms.en/forms.en.objectTranslation.yml +191 -0
- package/main/default/objectTranslations/forms.zh-CN/forms.zh-CN.objectTranslation.yml +246 -0
- package/main/default/objectTranslations/instance_tasks.en/instance_tasks.en.objectTranslation.yml +2 -0
- package/main/default/objectTranslations/instance_tasks.zh-CN/instance_tasks.zh-CN.objectTranslation.yml +2 -0
- package/main/default/objects/forms/forms.object.yml +46 -0
- package/main/default/pages/flowdetail.page.amis.json +2 -2
- package/main/default/pages/instance_detail.page.amis.json +22 -34
- package/main/default/pages/instance_tasks_detail.page.amis.json +18 -2
- package/main/default/routes/afterHook.js +34 -0
- package/main/default/routes/amis_form_design.ejs +67 -26
- package/main/default/routes/api_have_read.router.js +73 -0
- package/main/default/routes/api_workflow_approve_save.router.js +2 -1
- package/main/default/routes/api_workflow_engine.router.js +3 -3
- package/main/default/routes/api_workflow_flow_version.router.js +61 -0
- package/main/default/routes/api_workflow_form_version.router.js +61 -0
- package/main/default/routes/api_workflow_next_step_users.router.js +1 -1
- package/main/default/routes/api_workflow_relocate.router.js +2 -1
- package/main/default/routes/flow_form_design.ejs +57 -18
- package/package.json +1 -1
|
@@ -6,11 +6,13 @@ window.waitForThing(window, 'socket').then(()=>{
|
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
const SocketEvents = {
|
|
9
|
-
badgeChange: 's:workflow:badge:change'
|
|
9
|
+
badgeChange: 's:workflow:badge:change',
|
|
10
|
+
instanceRecordChange: 's:record:instances:change'
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
const SocketRoomParts = {
|
|
13
|
-
badgeChange: 'workflow:badge:change'
|
|
14
|
+
badgeChange: 'workflow:badge:change',
|
|
15
|
+
instanceRecordChange: 'record:instances:change'
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
if(socket.connected){
|
|
@@ -18,12 +20,20 @@ window.waitForThing(window, 'socket').then(()=>{
|
|
|
18
20
|
roomParts: SocketRoomParts.badgeChange,
|
|
19
21
|
individual: true
|
|
20
22
|
});
|
|
23
|
+
|
|
24
|
+
socket.emit(SocketCommands.subscribe, {
|
|
25
|
+
roomParts: SocketRoomParts.instanceRecordChange,
|
|
26
|
+
individual: true
|
|
27
|
+
});
|
|
21
28
|
}else{
|
|
22
29
|
socket.on("connection-init", ()=>{
|
|
23
30
|
socket.emit(SocketCommands.subscribe, {
|
|
24
31
|
roomParts: SocketRoomParts.badgeChange,
|
|
25
32
|
individual: true
|
|
26
33
|
});
|
|
34
|
+
socket.emit(SocketCommands.subscribe, {
|
|
35
|
+
roomParts: SocketRoomParts.instanceRecordChange
|
|
36
|
+
});
|
|
27
37
|
})
|
|
28
38
|
}
|
|
29
39
|
|
|
@@ -36,5 +46,38 @@ window.waitForThing(window, 'socket').then(()=>{
|
|
|
36
46
|
if (shouldReloadView()) {
|
|
37
47
|
window.$(".list-view-btn-reload").click()
|
|
38
48
|
}
|
|
39
|
-
})
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
socket.on(SocketEvents.instanceRecordChange, (data)=>{
|
|
52
|
+
console.log(`socket 「${SocketEvents.instanceRecordChange}」`, data)
|
|
53
|
+
const shouldReloadView = () => {
|
|
54
|
+
const pathname = window.location.pathname;
|
|
55
|
+
return pathname.endsWith(`/instances`) || pathname.includes(`/instances/view`) || pathname.includes(`/instances/grid`) || pathname.endsWith(`/instance_tasks`) || pathname.includes(`/instance_tasks/view`) || pathname.includes(`/instance_tasks/grid`);
|
|
56
|
+
};
|
|
57
|
+
if (shouldReloadView()) {
|
|
58
|
+
window.$(".list-view-btn-reload").click()
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
window.addEventListener('message', (event)=>{
|
|
64
|
+
const data = event.data;
|
|
65
|
+
// 判断是不是我们发的路由变化消息
|
|
66
|
+
if (data && data.type === 'ROUTE_CHANGE') {
|
|
67
|
+
console.log('📬 收到路由变化消息:', data);
|
|
68
|
+
if(data.path.startsWith('/app/approve_workflow/instances/view/')){
|
|
69
|
+
const recordId = _.last(_.split(data.path, '/'));
|
|
70
|
+
socket.emit(SocketCommands.subscribe, {
|
|
71
|
+
roomParts: `${SocketRoomParts.instanceRecordChange}-${recordId}`
|
|
72
|
+
});
|
|
73
|
+
socket.on(`${SocketEvents.instanceRecordChange}-${recordId}`, (eventData)=>{
|
|
74
|
+
if(window.location.pathname.startsWith('/app/approve_workflow/instances/view/'+eventData._id)){
|
|
75
|
+
if(window.location.search.indexOf("side_listview_id=monitor") > 0){
|
|
76
|
+
$(".steedos-workflow-reload-btn").trigger('click')
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
})
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
});
|
|
40
83
|
})
|
|
@@ -2,9 +2,11 @@ var _eval, logger;
|
|
|
2
2
|
|
|
3
3
|
_eval = require('eval');
|
|
4
4
|
|
|
5
|
+
const _ = require('lodash');
|
|
6
|
+
|
|
5
7
|
global.InstanceManager = {};
|
|
6
8
|
|
|
7
|
-
logger = new Logger('Workflow -> InstanceManager');
|
|
9
|
+
// logger = new Logger('Workflow -> InstanceManager');
|
|
8
10
|
|
|
9
11
|
InstanceManager.handlerInstanceByFieldMap = function (ins, field_map) {
|
|
10
12
|
var context, e, flow, res, script;
|
|
@@ -33,24 +35,33 @@ InstanceManager.handlerInstanceByFieldMap = function (ins, field_map) {
|
|
|
33
35
|
res = {
|
|
34
36
|
_error: e
|
|
35
37
|
};
|
|
36
|
-
logger.error(e);
|
|
38
|
+
// logger.error(e);
|
|
39
|
+
console.error(e);
|
|
37
40
|
}
|
|
38
41
|
}
|
|
39
42
|
}
|
|
40
43
|
return res;
|
|
41
44
|
};
|
|
42
45
|
|
|
43
|
-
InstanceManager.getCurrentApprove = function (instance, handler) {
|
|
46
|
+
InstanceManager.getCurrentApprove = function (instance, handler, type) {
|
|
44
47
|
var currentApprove, currentApproves, currentTraces;
|
|
45
48
|
if (!instance || !instance.traces || instance.traces.length < 1) {
|
|
46
49
|
return;
|
|
47
50
|
}
|
|
48
|
-
|
|
51
|
+
|
|
52
|
+
currentTraces = _.filter(instance.traces, { is_finished: false });
|
|
53
|
+
|
|
49
54
|
if (currentTraces.length) {
|
|
50
|
-
|
|
55
|
+
if (type){
|
|
56
|
+
currentApproves = _.filter(currentTraces[0].approves, { is_finished: false, handler: handler, type: type});
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
currentApproves = _.filter(currentTraces[0].approves, { is_finished: false, handler: handler });
|
|
60
|
+
}
|
|
51
61
|
currentApprove = currentApproves.length > 0 ? currentApproves[0] : null;
|
|
52
62
|
}
|
|
53
|
-
|
|
63
|
+
|
|
64
|
+
if (!currentApprove) {
|
|
54
65
|
// 当前是传阅
|
|
55
66
|
_.each(instance.traces, function (t) {
|
|
56
67
|
_.each(t.approves, function (a) {
|
|
@@ -180,3 +191,6 @@ InstanceManager.getBatchInstances = function (space, categoryId, flowIds, inbox_
|
|
|
180
191
|
// console.log("批量审批-异常数据", ins._id)
|
|
181
192
|
return _batch_instances;
|
|
182
193
|
};
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
module.exports = InstanceManager;
|
|
@@ -607,6 +607,8 @@ UUFlowManager.calculateConditionWithAmis = function (values, condition_str) {
|
|
|
607
607
|
UUFlowManager.calculateCondition = function (values, condition_str) {
|
|
608
608
|
try {
|
|
609
609
|
const __values = values;
|
|
610
|
+
|
|
611
|
+
condition_str = condition_str.replace(/\=/g, "==").replace(/\>==/g, ">=").replace(/\<==/g, "<=").replace(/\======/g, "===").replace(/\====/g, "==");
|
|
610
612
|
|
|
611
613
|
// Helper functions for condition calculation
|
|
612
614
|
const sum = (subform_field) => {
|
|
@@ -666,7 +668,7 @@ UUFlowManager.calculateCondition = function (values, condition_str) {
|
|
|
666
668
|
|
|
667
669
|
return eval(condition_str);
|
|
668
670
|
} catch (error) {
|
|
669
|
-
console.error(error.stack);
|
|
671
|
+
console.error(error.stack, condition_str);
|
|
670
672
|
return false;
|
|
671
673
|
}
|
|
672
674
|
};
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
const { getCollection } = require('../utils/collection');
|
|
2
|
+
const {
|
|
3
|
+
update_instance_tasks,
|
|
4
|
+
update_many_instance_tasks,
|
|
5
|
+
} = require('../manager/instance_tasks_manager')
|
|
6
|
+
module.exports = {
|
|
7
|
+
set_approve_have_read: async function (instanceId, traceId, approveId, ctx = {}) {
|
|
8
|
+
const db = {
|
|
9
|
+
instances: await getCollection('instances')
|
|
10
|
+
};
|
|
11
|
+
var instance, ref, setObj, trace;
|
|
12
|
+
var userId = ctx.userId || this.userId;
|
|
13
|
+
if (!userId) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
instance = await db.instances.findOne({
|
|
17
|
+
_id: instanceId,
|
|
18
|
+
"traces._id": traceId
|
|
19
|
+
}, {
|
|
20
|
+
fields: {
|
|
21
|
+
"traces.$": 1
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
if ((instance != null ? (ref = instance.traces) != null ? ref.length : void 0 : void 0) > 0) {
|
|
25
|
+
trace = instance.traces[0];
|
|
26
|
+
setObj = {
|
|
27
|
+
modified: new Date,
|
|
28
|
+
modified_by: userId
|
|
29
|
+
};
|
|
30
|
+
let key_str = ''
|
|
31
|
+
const approveDoc = {}
|
|
32
|
+
trace.approves.forEach(function (approve, idx) {
|
|
33
|
+
if (approve._id === approveId && !approve.is_read) {
|
|
34
|
+
key_str = `traces.$.approves.${idx}.`;
|
|
35
|
+
// setObj[`traces.$.approves.${idx}.is_read`] = true;
|
|
36
|
+
// return setObj[`traces.$.approves.${idx}.read_date`] = new Date();
|
|
37
|
+
approveDoc[`is_read`] = true;
|
|
38
|
+
approveDoc[`read_date`] = new Date();
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
if (!_.isEmpty(approveDoc) && key_str) {
|
|
42
|
+
for (const key in approveDoc) {
|
|
43
|
+
if (Object.hasOwnProperty.call(approveDoc, key)) {
|
|
44
|
+
setObj[key_str + key] = approveDoc[key]
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
await db.instances.update({
|
|
48
|
+
_id: instanceId,
|
|
49
|
+
"traces._id": traceId
|
|
50
|
+
}, {
|
|
51
|
+
$set: setObj
|
|
52
|
+
});
|
|
53
|
+
await update_instance_tasks(instanceId, traceId, approveId, approveDoc)
|
|
54
|
+
}
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
// change_approve_info: function (instanceId, traceId, approveId, description, finish_date) {
|
|
59
|
+
// var instance, ref, setObj, trace;
|
|
60
|
+
// if (!this.userId) {
|
|
61
|
+
// return;
|
|
62
|
+
// }
|
|
63
|
+
// check(instanceId, String);
|
|
64
|
+
// check(traceId, String);
|
|
65
|
+
// check(approveId, String);
|
|
66
|
+
// check(description, String);
|
|
67
|
+
// check(finish_date, Date);
|
|
68
|
+
// instance = db.instances.findOne({
|
|
69
|
+
// _id: instanceId,
|
|
70
|
+
// "traces._id": traceId
|
|
71
|
+
// }, {
|
|
72
|
+
// fields: {
|
|
73
|
+
// "traces.$": 1
|
|
74
|
+
// }
|
|
75
|
+
// });
|
|
76
|
+
// if ((instance != null ? (ref = instance.traces) != null ? ref.length : void 0 : void 0) > 0) {
|
|
77
|
+
// trace = instance.traces[0];
|
|
78
|
+
// setObj = {};
|
|
79
|
+
// let key_str = ''
|
|
80
|
+
// const approveDoc = {}
|
|
81
|
+
// trace.approves.forEach(function (approve, idx) {
|
|
82
|
+
// if (approve._id === approveId) {
|
|
83
|
+
// setObj['change_time'] = new Date();
|
|
84
|
+
// key_str = `traces.$.approves.${idx}.`
|
|
85
|
+
// // setObj[`traces.$.approves.${idx}.description`] = description;
|
|
86
|
+
// // setObj[`traces.$.approves.${idx}.finish_date`] = finish_date;
|
|
87
|
+
// // setObj[`traces.$.approves.${idx}.cost_time`] = new Date() - approve.start_date;
|
|
88
|
+
// // return setObj[`traces.$.approves.${idx}.read_date`] = new Date();
|
|
89
|
+
// approveDoc[`description`] = description;
|
|
90
|
+
// approveDoc[`finish_date`] = finish_date;
|
|
91
|
+
// approveDoc[`cost_time`] = new Date() - approve.start_date;
|
|
92
|
+
// approveDoc[`read_date`] = new Date();
|
|
93
|
+
// }
|
|
94
|
+
// });
|
|
95
|
+
// if (!_.isEmpty(setObj)) {
|
|
96
|
+
// for (const key in approveDoc) {
|
|
97
|
+
// if (Object.hasOwnProperty.call(approveDoc, key)) {
|
|
98
|
+
// setObj[key_str + key] = approveDoc[key]
|
|
99
|
+
// }
|
|
100
|
+
// }
|
|
101
|
+
// db.instances.update({
|
|
102
|
+
// _id: instanceId,
|
|
103
|
+
// "traces._id": traceId
|
|
104
|
+
// }, {
|
|
105
|
+
// $set: setObj
|
|
106
|
+
// });
|
|
107
|
+
// update_instance_tasks(instanceId, traceId, approveId, approveDoc)
|
|
108
|
+
// }
|
|
109
|
+
// return true;
|
|
110
|
+
// }
|
|
111
|
+
// },
|
|
112
|
+
// update_approve_sign: function (instanceId, traceId, approveId, sign_field_code, description, sign_type, lastSignApprove) {
|
|
113
|
+
// var currentApproveDescription, currentStep, currentTrace, ins, instance, ref, ref1, ref2, ref3, session_userId, showBlankApproveDescription, trace, traces, trimDescription, upObj;
|
|
114
|
+
// check(instanceId, String);
|
|
115
|
+
// check(traceId, String);
|
|
116
|
+
// check(approveId, String);
|
|
117
|
+
// check(sign_field_code, String);
|
|
118
|
+
// check(description, String);
|
|
119
|
+
// if (!this.userId) {
|
|
120
|
+
// return;
|
|
121
|
+
// }
|
|
122
|
+
// trimDescription = description.trim();
|
|
123
|
+
// showBlankApproveDescription = (ref = Meteor.settings.public.workflow) != null ? ref.showBlankApproveDescription : void 0;
|
|
124
|
+
// session_userId = this.userId;
|
|
125
|
+
// if (lastSignApprove) {
|
|
126
|
+
// if (((ref1 = Meteor.settings.public.workflow) != null ? ref1.keepLastSignApproveDescription : void 0) !== false) {
|
|
127
|
+
// if (lastSignApprove.custom_sign_show) {
|
|
128
|
+
// return;
|
|
129
|
+
// }
|
|
130
|
+
// }
|
|
131
|
+
// }
|
|
132
|
+
// instance = db.instances.findOne({
|
|
133
|
+
// _id: instanceId,
|
|
134
|
+
// "traces._id": traceId
|
|
135
|
+
// }, {
|
|
136
|
+
// fields: {
|
|
137
|
+
// "traces.$": 1
|
|
138
|
+
// }
|
|
139
|
+
// });
|
|
140
|
+
// if ((instance != null ? (ref2 = instance.traces) != null ? ref2.length : void 0 : void 0) > 0) {
|
|
141
|
+
// trace = instance.traces[0];
|
|
142
|
+
// upObj = {};
|
|
143
|
+
// currentApproveDescription = '';
|
|
144
|
+
// const approveDoc = {}
|
|
145
|
+
// let key_str = ''
|
|
146
|
+
// trace.approves.forEach(function (approve, idx) {
|
|
147
|
+
// if (approve._id === approveId) {
|
|
148
|
+
// key_str = `traces.$.approves.${idx}.`
|
|
149
|
+
// currentApproveDescription = approve.description;
|
|
150
|
+
// if (sign_field_code) {
|
|
151
|
+
// upObj[`traces.$.approves.${idx}.sign_field_code`] = sign_field_code;
|
|
152
|
+
// }
|
|
153
|
+
// // upObj[`traces.$.approves.${idx}.description`] = description;
|
|
154
|
+
// // upObj[`traces.$.approves.${idx}.sign_show`] = trimDescription || showBlankApproveDescription ? true : false;
|
|
155
|
+
// // upObj[`traces.$.approves.${idx}.modified`] = new Date();
|
|
156
|
+
// // upObj[`traces.$.approves.${idx}.modified_by`] = session_userId;
|
|
157
|
+
// // return upObj[`traces.$.approves.${idx}.read_date`] = new Date();
|
|
158
|
+
// approveDoc[`description`] = description;
|
|
159
|
+
// if (trimDescription || showBlankApproveDescription) {
|
|
160
|
+
// approveDoc[`sign_show`] = true;
|
|
161
|
+
// }
|
|
162
|
+
// approveDoc[`modified`] = new Date();
|
|
163
|
+
// approveDoc[`modified_by`] = session_userId;
|
|
164
|
+
// approveDoc[`read_date`] = new Date();
|
|
165
|
+
// }
|
|
166
|
+
// });
|
|
167
|
+
// if (key_str && !_.isEmpty(approveDoc)) {
|
|
168
|
+
// for (const key in approveDoc) {
|
|
169
|
+
// if (Object.hasOwnProperty.call(approveDoc, key)) {
|
|
170
|
+
// upObj[key_str + key] = approveDoc[key]
|
|
171
|
+
// }
|
|
172
|
+
// }
|
|
173
|
+
// }
|
|
174
|
+
|
|
175
|
+
// const needUpdateApproveIds = []
|
|
176
|
+
// if (((ref3 = Meteor.settings.public.workflow) != null ? ref3.keepLastSignApproveDescription : void 0) === false && (!!currentApproveDescription !== !!trimDescription || showBlankApproveDescription)) {
|
|
177
|
+
// ins = db.instances.findOne({
|
|
178
|
+
// _id: instanceId
|
|
179
|
+
// }, {
|
|
180
|
+
// fields: {
|
|
181
|
+
// "traces": 1
|
|
182
|
+
// }
|
|
183
|
+
// });
|
|
184
|
+
// traces = ins.traces;
|
|
185
|
+
// currentTrace = _.find(traces, function (t) {
|
|
186
|
+
// return t._id === traceId;
|
|
187
|
+
// });
|
|
188
|
+
// currentStep = currentTrace.step;
|
|
189
|
+
// traces.forEach(function (t, tIdx) {
|
|
190
|
+
// if (t.step === currentStep) {
|
|
191
|
+
// return t != null ? t.approves.forEach(function (appr, aIdx) {
|
|
192
|
+
// if (appr.handler === session_userId && appr.is_finished && appr._id !== approveId && !_.has(appr, 'custom_sign_show')) {
|
|
193
|
+
// if ((trimDescription && appr.sign_show === true && (sign_field_code === "" || !appr.sign_field_code || sign_field_code === appr.sign_field_code)) || showBlankApproveDescription) {
|
|
194
|
+
// upObj[`traces.${tIdx}.approves.${aIdx}.sign_show`] = false;
|
|
195
|
+
// return upObj[`traces.${tIdx}.approves.${aIdx}.keepLastSignApproveDescription`] = approveId;
|
|
196
|
+
// } else if (appr.keepLastSignApproveDescription === approveId) {
|
|
197
|
+
// upObj[`traces.${tIdx}.approves.${aIdx}.sign_show`] = true;
|
|
198
|
+
// return upObj[`traces.${tIdx}.approves.${aIdx}.keepLastSignApproveDescription`] = null;
|
|
199
|
+
// }
|
|
200
|
+
// needUpdateApproveIds.push(appr._id)
|
|
201
|
+
// }
|
|
202
|
+
// }) : void 0;
|
|
203
|
+
// }
|
|
204
|
+
// });
|
|
205
|
+
// }
|
|
206
|
+
// if (!_.isEmpty(upObj)) {
|
|
207
|
+
// db.instances.update({
|
|
208
|
+
// _id: instanceId,
|
|
209
|
+
// "traces._id": traceId
|
|
210
|
+
// }, {
|
|
211
|
+
// $set: upObj
|
|
212
|
+
// });
|
|
213
|
+
// update_instance_tasks(instanceId, traceId, approveId, approveDoc)
|
|
214
|
+
// if (needUpdateApproveIds.length > 0) {
|
|
215
|
+
// update_many_instance_tasks(instanceId, traceId, needUpdateApproveIds, ['sign_show', 'keepLastSignApproveDescription'])
|
|
216
|
+
// }
|
|
217
|
+
// }
|
|
218
|
+
// return true;
|
|
219
|
+
// }
|
|
220
|
+
// },
|
|
221
|
+
// update_sign_show: function (objs, myApprove_id) {
|
|
222
|
+
// objs.forEach(function (obj, index) {
|
|
223
|
+
// var instance, ref, setObj, trace;
|
|
224
|
+
// instance = db.instances.findOne({
|
|
225
|
+
// _id: obj.instance,
|
|
226
|
+
// "traces._id": obj.trace
|
|
227
|
+
// }, {
|
|
228
|
+
// fields: {
|
|
229
|
+
// "traces.$": 1
|
|
230
|
+
// }
|
|
231
|
+
// });
|
|
232
|
+
// if ((instance != null ? (ref = instance.traces) != null ? ref.length : void 0 : void 0) > 0) {
|
|
233
|
+
// trace = instance.traces[0];
|
|
234
|
+
// setObj = {};
|
|
235
|
+
// trace.approves.forEach(function (approve, idx) {
|
|
236
|
+
// if (approve._id === obj._id) {
|
|
237
|
+
// setObj[`traces.$.approves.${idx}.sign_show`] = obj.sign_show;
|
|
238
|
+
// setObj[`traces.$.approves.${idx}.custom_sign_show`] = obj.sign_show;
|
|
239
|
+
// setObj[`traces.$.approves.${idx}.read_date`] = new Date();
|
|
240
|
+
// }
|
|
241
|
+
// if (approve._id === myApprove_id) {
|
|
242
|
+
// return setObj[`traces.$.approves.${idx}.read_date`] = new Date();
|
|
243
|
+
// }
|
|
244
|
+
// });
|
|
245
|
+
// if (!_.isEmpty(setObj)) {
|
|
246
|
+
// db.instances.update({
|
|
247
|
+
// _id: obj.instance,
|
|
248
|
+
// "traces._id": obj.trace
|
|
249
|
+
// }, {
|
|
250
|
+
// $set: setObj
|
|
251
|
+
// });
|
|
252
|
+
// update_many_instance_tasks(obj.instance, obj.trace, [obj._id, myApprove_id], ['sign_show', 'custom_sign_show', 'read_date'])
|
|
253
|
+
// }
|
|
254
|
+
// }
|
|
255
|
+
// });
|
|
256
|
+
// return true;
|
|
257
|
+
// }
|
|
258
|
+
};
|
|
@@ -141,18 +141,20 @@ module.exports = {
|
|
|
141
141
|
return true;
|
|
142
142
|
},
|
|
143
143
|
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
cc_read: async function (instance, approve, ctx = {}) {
|
|
145
|
+
const db = {
|
|
146
|
+
instances: await getCollection('instances')
|
|
147
|
+
};
|
|
146
148
|
var setObj = {};
|
|
147
149
|
var ins_id = approve.instance;
|
|
148
150
|
var trace_id = approve.trace;
|
|
149
151
|
var approve_id = approve._id;
|
|
150
|
-
var instance = db.instances.findOne(ins_id, {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
});
|
|
155
|
-
var current_user_id = this.userId;
|
|
152
|
+
// var instance = await db.instances.findOne({ _id: ins_id }, {
|
|
153
|
+
// fields: {
|
|
154
|
+
// traces: 1
|
|
155
|
+
// }
|
|
156
|
+
// });
|
|
157
|
+
var current_user_id = ctx.userId || this.userId;
|
|
156
158
|
var current_trace = _.find(instance.traces, function (t) {
|
|
157
159
|
return t._id == trace_id;
|
|
158
160
|
})
|
|
@@ -179,16 +181,17 @@ module.exports = {
|
|
|
179
181
|
}
|
|
180
182
|
|
|
181
183
|
|
|
182
|
-
db.instances.update({
|
|
184
|
+
await db.instances.update({
|
|
183
185
|
_id: ins_id,
|
|
184
186
|
'traces._id': trace_id
|
|
185
187
|
}, {
|
|
186
188
|
$set: setObj
|
|
187
189
|
});
|
|
188
|
-
update_instance_tasks(ins_id, trace_id, current_trace.approves[index]._id, approveDoc)
|
|
190
|
+
await update_instance_tasks(ins_id, trace_id, current_trace.approves[index]._id, approveDoc)
|
|
189
191
|
return true;
|
|
190
192
|
},
|
|
191
193
|
|
|
194
|
+
/**
|
|
192
195
|
cc_submit: function (ins_id, description, myApprove, ccHasEditPermission) {
|
|
193
196
|
var setObj = {};
|
|
194
197
|
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
name: forms
|
|
2
|
+
label: Form
|
|
3
|
+
description:
|
|
4
|
+
fields:
|
|
5
|
+
name:
|
|
6
|
+
label: Name
|
|
7
|
+
help:
|
|
8
|
+
description:
|
|
9
|
+
state:
|
|
10
|
+
label: State
|
|
11
|
+
help:
|
|
12
|
+
options:
|
|
13
|
+
- label: Enabled
|
|
14
|
+
value: enabled
|
|
15
|
+
- label: Disabled
|
|
16
|
+
value: disabled
|
|
17
|
+
description:
|
|
18
|
+
description:
|
|
19
|
+
label: Description
|
|
20
|
+
help:
|
|
21
|
+
description:
|
|
22
|
+
category:
|
|
23
|
+
label: Category
|
|
24
|
+
help:
|
|
25
|
+
description:
|
|
26
|
+
is_valid:
|
|
27
|
+
label: Valid
|
|
28
|
+
help:
|
|
29
|
+
description:
|
|
30
|
+
instance_style:
|
|
31
|
+
label: Instance Style
|
|
32
|
+
help:
|
|
33
|
+
options:
|
|
34
|
+
- label: Table
|
|
35
|
+
value: table
|
|
36
|
+
- label: Default
|
|
37
|
+
value: default
|
|
38
|
+
description:
|
|
39
|
+
historys:
|
|
40
|
+
label: historys
|
|
41
|
+
help:
|
|
42
|
+
description:
|
|
43
|
+
approve_on_create:
|
|
44
|
+
label: Approve on Create
|
|
45
|
+
help:
|
|
46
|
+
description:
|
|
47
|
+
approve_on_modify:
|
|
48
|
+
label: Approve on Modify
|
|
49
|
+
help:
|
|
50
|
+
description:
|
|
51
|
+
approve_on_delete:
|
|
52
|
+
label: Approve on Delete
|
|
53
|
+
help:
|
|
54
|
+
description:
|
|
55
|
+
enable_workflow:
|
|
56
|
+
label: Enable Workflow
|
|
57
|
+
help:
|
|
58
|
+
description:
|
|
59
|
+
enable_view_others:
|
|
60
|
+
label: Enable View Others
|
|
61
|
+
help:
|
|
62
|
+
description:
|
|
63
|
+
current:
|
|
64
|
+
label: current
|
|
65
|
+
help:
|
|
66
|
+
description:
|
|
67
|
+
current.form_script:
|
|
68
|
+
label: Form Script
|
|
69
|
+
help:
|
|
70
|
+
description:
|
|
71
|
+
current.name_forumla:
|
|
72
|
+
label: Name Forumla
|
|
73
|
+
help:
|
|
74
|
+
description:
|
|
75
|
+
current.fields:
|
|
76
|
+
label: Fields
|
|
77
|
+
help:
|
|
78
|
+
description:
|
|
79
|
+
current.fields.$.code:
|
|
80
|
+
label: Code
|
|
81
|
+
help:
|
|
82
|
+
description:
|
|
83
|
+
current.fields.$.name:
|
|
84
|
+
label: Name
|
|
85
|
+
help:
|
|
86
|
+
description:
|
|
87
|
+
current.fields.$.type:
|
|
88
|
+
label: Type
|
|
89
|
+
help:
|
|
90
|
+
options:
|
|
91
|
+
- label: Checkbox
|
|
92
|
+
value: checkbox
|
|
93
|
+
- label: DateTimeE
|
|
94
|
+
value: dateTimeD
|
|
95
|
+
- label: Date
|
|
96
|
+
value: date
|
|
97
|
+
- label: Time
|
|
98
|
+
value: time
|
|
99
|
+
- label: EmailGM
|
|
100
|
+
- label: Group
|
|
101
|
+
value: group
|
|
102
|
+
- label: Input
|
|
103
|
+
value: input
|
|
104
|
+
- label: MultiSelect
|
|
105
|
+
value: multiSelect
|
|
106
|
+
- label: Number
|
|
107
|
+
value: number
|
|
108
|
+
- label: Password
|
|
109
|
+
value: password
|
|
110
|
+
- label: Radio
|
|
111
|
+
value: radio
|
|
112
|
+
- label: Section
|
|
113
|
+
value: section
|
|
114
|
+
- label: Select
|
|
115
|
+
value: select
|
|
116
|
+
- label: Table
|
|
117
|
+
value: table
|
|
118
|
+
- label: URL
|
|
119
|
+
value: url
|
|
120
|
+
- label: User
|
|
121
|
+
value: user
|
|
122
|
+
- label: GeolocationR
|
|
123
|
+
value: geolocationR
|
|
124
|
+
- label: Image
|
|
125
|
+
value: image
|
|
126
|
+
- label: File
|
|
127
|
+
value: file
|
|
128
|
+
- label: Lookup
|
|
129
|
+
value: lookup
|
|
130
|
+
description:
|
|
131
|
+
current.fields.$.is_required:
|
|
132
|
+
label: Required
|
|
133
|
+
help:
|
|
134
|
+
description:
|
|
135
|
+
current.fields.$.is_wide:
|
|
136
|
+
label: Wide
|
|
137
|
+
help:
|
|
138
|
+
description:
|
|
139
|
+
current.fields.$.is_list_display:
|
|
140
|
+
label: Display in List
|
|
141
|
+
help:
|
|
142
|
+
description:
|
|
143
|
+
current.fields.$.is_searchable:
|
|
144
|
+
label: Searchable
|
|
145
|
+
help:
|
|
146
|
+
description:
|
|
147
|
+
current.fields.$.is_multiselect:
|
|
148
|
+
label: Multiselect
|
|
149
|
+
help:
|
|
150
|
+
description:
|
|
151
|
+
listviews:
|
|
152
|
+
all:
|
|
153
|
+
label: All Forms
|
|
154
|
+
actions:
|
|
155
|
+
standard_new:
|
|
156
|
+
label: New
|
|
157
|
+
standard_edit:
|
|
158
|
+
label: Edit
|
|
159
|
+
standard_delete:
|
|
160
|
+
label: Delete
|
|
161
|
+
designForm:
|
|
162
|
+
label: Form Designer
|
|
163
|
+
CustomLabels:
|
|
164
|
+
_forms_field_code_error: Code %s must not contain '.'
|
|
165
|
+
forms_field_current.fields:
|
|
166
|
+
forms_field_current.fields_$_code:
|
|
167
|
+
forms_field_current.fields_$_is_list_display:
|
|
168
|
+
forms_field_current.fields_$_is_multiselect:
|
|
169
|
+
forms_field_current.fields_$_is_required:
|
|
170
|
+
forms_field_current.fields_$_is_searchable:
|
|
171
|
+
forms_field_current.fields_$_is_wide:
|
|
172
|
+
forms_field_current.fields_$_name:
|
|
173
|
+
forms_field_current.fields_$_type:
|
|
174
|
+
forms_field_current.fields_$_type_options_checkbox:
|
|
175
|
+
forms_field_current.fields_$_type_options_date:
|
|
176
|
+
forms_field_current.fields_$_type_options_dateTime:
|
|
177
|
+
forms_field_current.fields_$_type_options_email:
|
|
178
|
+
forms_field_current.fields_$_type_options_geolocation:
|
|
179
|
+
forms_field_current.fields_$_type_options_group:
|
|
180
|
+
forms_field_current.fields_$_type_options_input:
|
|
181
|
+
forms_field_current.fields_$_type_options_multiSelect:
|
|
182
|
+
forms_field_current.fields_$_type_options_number:
|
|
183
|
+
forms_field_current.fields_$_type_options_password:
|
|
184
|
+
forms_field_current.fields_$_type_options_radio:
|
|
185
|
+
forms_field_current.fields_$_type_options_section:
|
|
186
|
+
forms_field_current.fields_$_type_options_select:
|
|
187
|
+
forms_field_current.fields_$_type_options_table:
|
|
188
|
+
forms_field_current.fields_$_type_options_url:
|
|
189
|
+
forms_field_current.fields_$_type_options_user:
|
|
190
|
+
forms_field_current.form_script:
|
|
191
|
+
forms_field_current.name_forumla:
|