@steedos-labs/plugin-workflow 3.0.11 → 3.0.13
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/AI_PLUGIN_GUIDE.md +939 -0
- package/main/default/applications/approve_workflow.app.yml +159 -3
- package/main/default/manager/handlers_manager.js +1 -1
- package/main/default/manager/instance_number_rules.js +84 -0
- package/main/default/manager/instance_tasks_manager.js +79 -1
- package/main/default/manager/uuflow_manager.js +60 -45
- package/main/default/objects/flows/flows.object.yml +1 -4
- package/main/default/objects/instances/buttons/instance_delete.button.yml +4 -24
- package/main/default/objects/instances/buttons/instance_new.button.yml +11 -11
- package/main/default/objects/instances/buttons/instance_reassign.button.yml +5 -4
- package/main/default/objects/instances/buttons/instance_save.button.yml +6 -8
- package/main/default/pages/flow_selector.page.amis.json +5 -0
- package/main/default/pages/flow_selector.page.yml +7 -0
- package/main/default/pages/instance_detail.page.amis.json +1 -99
- package/main/default/pages/instance_tasks_detail.page.amis.json +0 -100
- package/main/default/pages/page_instance_view.page.amis.json +1 -1
- package/main/default/routes/api_auto_number.router.js +233 -0
- package/main/default/routes/api_files.router.js +21 -0
- package/main/default/routes/api_have_read.router.js +20 -2
- package/main/default/routes/api_workflow_chart.router.js +23 -3
- package/main/default/routes/api_workflow_next_step.router.js +135 -30
- package/main/default/routes/api_workflow_next_step_users.router.js +63 -10
- package/main/default/routes/nextStepUsers.router.js +3 -3
- package/main/default/services/instance.service.js +1 -9
- package/package.json +1 -1
- package/public/workflow/index.css +12 -4
- package/main/default/pages/instance_tasks_list.page.amis.json +0 -330
- package/main/default/pages/instance_tasks_list.page.yml +0 -12
- package/main/default/pages/instances_list.page.amis.json +0 -327
- package/main/default/pages/instances_list.page.yml +0 -12
|
@@ -450,6 +450,7 @@ const FlowversionAPI = {
|
|
|
450
450
|
let query = req.query;
|
|
451
451
|
let instance_id = query.instance_id;
|
|
452
452
|
let direction = query.direction || 'TD';
|
|
453
|
+
let noAutoFit = query.noAutoFit === '1' || query.noAutoFit === 'true';
|
|
453
454
|
const allowDirections = ['TB', 'BT', 'RL', 'LR', 'TD'];
|
|
454
455
|
if (!_.includes(allowDirections, direction)) {
|
|
455
456
|
return this.writeResponse(res, 500, "Invalid direction. The value of direction should be in ['TB', 'BT', 'RL', 'LR', 'TD']");
|
|
@@ -619,6 +620,7 @@ const FlowversionAPI = {
|
|
|
619
620
|
});
|
|
620
621
|
$(function(){
|
|
621
622
|
var graphNodes = ${JSON.stringify(graphSyntax)};
|
|
623
|
+
var noAutoFit = ${noAutoFit ? 'true' : 'false'};
|
|
622
624
|
//方便前面可以通过调用mermaid.currentNodes调式,特意增加currentNodes属性。
|
|
623
625
|
mermaid.currentNodes = graphNodes;
|
|
624
626
|
var graphSyntax = graphNodes.join("\\n");
|
|
@@ -634,12 +636,30 @@ const FlowversionAPI = {
|
|
|
634
636
|
callback(id);
|
|
635
637
|
}
|
|
636
638
|
bindFunctions(element[0]);
|
|
639
|
+
|
|
640
|
+
// 修复SVG左侧内容被裁剪的问题
|
|
641
|
+
if(!noAutoFit) {
|
|
642
|
+
setTimeout(function() {
|
|
643
|
+
var svg = $("svg");
|
|
644
|
+
if(svg.length > 0) {
|
|
645
|
+
// 关键修复:允许SVG溢出显示,解决左侧节点被裁剪的问题
|
|
646
|
+
svg.css('overflow', 'visible');
|
|
647
|
+
}
|
|
648
|
+
}, 50);
|
|
649
|
+
}
|
|
637
650
|
};
|
|
638
651
|
mermaid.render(id, graphSyntax, insertSvg, element[0]);
|
|
652
|
+
|
|
653
|
+
var currentZoom = 1;
|
|
639
654
|
var zoomSVG = function(zoom){
|
|
640
|
-
var
|
|
641
|
-
|
|
642
|
-
|
|
655
|
+
var svg = $("svg");
|
|
656
|
+
currentZoom = currentZoom * zoom;
|
|
657
|
+
var baseWidth = svg.data('baseWidth') || svg.width();
|
|
658
|
+
if(!svg.data('baseWidth')) {
|
|
659
|
+
svg.data('baseWidth', baseWidth);
|
|
660
|
+
}
|
|
661
|
+
var newWidth = baseWidth * currentZoom;
|
|
662
|
+
svg.css("maxWidth",newWidth + "px").width(newWidth);
|
|
643
663
|
}
|
|
644
664
|
//支持鼠标滚轮缩放画布
|
|
645
665
|
$(window).on("mousewheel",function(event){
|
|
@@ -11,6 +11,8 @@ const { requireAuthentication } = require("@steedos/auth");
|
|
|
11
11
|
const _ = require('lodash');
|
|
12
12
|
const objectql = require('@steedos/objectql');
|
|
13
13
|
const UUFlowManager = require('../manager/uuflow_manager');
|
|
14
|
+
const HandlersManager = require('../manager/handlers_manager');
|
|
15
|
+
const WorkflowManager = require('../manager/workflow_manager');
|
|
14
16
|
|
|
15
17
|
const getFlowVersion = (flow, flowVersionId) => {
|
|
16
18
|
if (flow.current._id === flowVersionId) {
|
|
@@ -53,7 +55,7 @@ const isSkipStep = function (instance, step) {
|
|
|
53
55
|
return _.includes(instance.skip_steps, step._id)
|
|
54
56
|
}
|
|
55
57
|
|
|
56
|
-
const getNextSteps = async (flow, flowVersionId, instance, currentStep, judge, autoFormDoc, fields, showSkipStep) => {
|
|
58
|
+
const getNextSteps = async (flow, flowVersionId, instance, currentStep, judge, autoFormDoc, fields, showSkipStep, userId) => {
|
|
57
59
|
if (!currentStep)
|
|
58
60
|
return;
|
|
59
61
|
|
|
@@ -149,42 +151,39 @@ const getNextSteps = async (flow, flowVersionId, instance, currentStep, judge, a
|
|
|
149
151
|
//去除重复
|
|
150
152
|
nextSteps = _.compact(_.uniqBy(nextSteps, 'id'));
|
|
151
153
|
|
|
152
|
-
|
|
153
|
-
for (const nextStep of nextSteps) {
|
|
154
|
+
const conditionResults = await Promise.all(nextSteps.map(async (nextStep) => {
|
|
154
155
|
if (nextStep.step_type == "condition") {
|
|
155
|
-
|
|
156
|
-
|
|
156
|
+
let currentJudge = judge;
|
|
157
|
+
if (!currentJudge && nextStep.step_type == 'sign') {
|
|
158
|
+
currentJudge = 'approved';
|
|
157
159
|
}
|
|
158
|
-
|
|
159
|
-
condition_next_steps = condition_next_steps.concat(conditionSteps);
|
|
160
|
+
return await getNextSteps(flow, flowVersionId, instance, nextStep, currentJudge, autoFormDoc, fields, showSkipStep, userId);
|
|
160
161
|
}
|
|
161
|
-
|
|
162
|
+
return [];
|
|
163
|
+
}));
|
|
164
|
+
const condition_next_steps = _.flatten(conditionResults);
|
|
162
165
|
|
|
163
166
|
nextSteps = nextSteps.concat(condition_next_steps);
|
|
164
167
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
for (const nextStep of nextSteps) {
|
|
168
|
+
const skipStepPromises = nextSteps.map(async (nextStep) => {
|
|
168
169
|
if (nextStep.step_type != "condition") {
|
|
169
170
|
if (!showSkipStep && isSkipStep(instance, nextStep)) {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
let nextStepsAfterSkipStep = await getNextSteps(flow, flowVersionId, instance, nextStep, judge, autoFormDoc, fields, showSkipStep);
|
|
174
|
-
let stepsWithOutCurrentStep = [];
|
|
175
|
-
for (const s of nextStepsAfterSkipStep) {
|
|
176
|
-
if (currentStep.id == s.id) {
|
|
177
|
-
continue;
|
|
178
|
-
}
|
|
179
|
-
stepsWithOutCurrentStep.push(s);
|
|
171
|
+
let currentJudge = judge;
|
|
172
|
+
if (!currentJudge && nextStep.step_type == 'sign') {
|
|
173
|
+
currentJudge = 'approved';
|
|
180
174
|
}
|
|
175
|
+
let nextStepsAfterSkipStep = await getNextSteps(flow, flowVersionId, instance, nextStep, currentJudge, autoFormDoc, fields, showSkipStep, userId);
|
|
181
176
|
// 后续步骤不应包含当前步骤
|
|
182
|
-
|
|
177
|
+
return nextStepsAfterSkipStep.filter(s => currentStep.id != s.id);
|
|
183
178
|
} else {
|
|
184
|
-
|
|
179
|
+
return [nextStep];
|
|
185
180
|
}
|
|
186
181
|
}
|
|
187
|
-
|
|
182
|
+
return [];
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
const nestedSteps = await Promise.all(skipStepPromises);
|
|
186
|
+
let rev_nextSteps = _.flatten(nestedSteps);
|
|
188
187
|
|
|
189
188
|
//去除重复
|
|
190
189
|
rev_nextSteps = _.compact(_.uniqBy(rev_nextSteps, 'id'));
|
|
@@ -193,17 +192,98 @@ const getNextSteps = async (flow, flowVersionId, instance, currentStep, judge, a
|
|
|
193
192
|
if (currentStep.step_type == "counterSign" && rev_nextSteps.length > 1 && !currentStep.oneClickRejection) {
|
|
194
193
|
rev_nextSteps = [];
|
|
195
194
|
}
|
|
195
|
+
|
|
196
|
+
// 如果步骤的 always_enter_step (始终进入此步骤(默认选中,历史流程如果未配置,也是选中)) 值为false,那么需要运行脚本 enter_step_condition (步骤条件)
|
|
197
|
+
// 如结果中包含条件节点则需要继续计算条件节点下一步
|
|
198
|
+
const needRemoveSteps = {}, needAddSteps = {};
|
|
199
|
+
await Promise.all(rev_nextSteps.map(step =>
|
|
200
|
+
caculateNextStepsByEnterStepCondition(flow, flowVersionId, instance, step, autoFormDoc, fields, needRemoveSteps, needAddSteps, userId)
|
|
201
|
+
));
|
|
202
|
+
if (!_.isEmpty(needRemoveSteps) && !_.isEmpty(needAddSteps)) {
|
|
203
|
+
for (const id in needAddSteps) {
|
|
204
|
+
if (Object.hasOwnProperty.call(needAddSteps, id)) {
|
|
205
|
+
const index = rev_nextSteps.findIndex(item => item.id == id)
|
|
206
|
+
if (-1 === index) {
|
|
207
|
+
rev_nextSteps.push(needAddSteps[id])
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
for (const id in needRemoveSteps) {
|
|
212
|
+
if (Object.hasOwnProperty.call(needRemoveSteps, id)) {
|
|
213
|
+
const index = rev_nextSteps.findIndex(item => item.id == id)
|
|
214
|
+
if (-1 != index) {
|
|
215
|
+
rev_nextSteps.splice(index, 1)
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
var conditionNextSteps = new Array();
|
|
220
|
+
|
|
221
|
+
for (const [idx, nextStep] of rev_nextSteps.entries()) {
|
|
222
|
+
if (nextStep.step_type == "condition") {
|
|
223
|
+
if(!judge && nextStep.step_type == 'sign'){
|
|
224
|
+
judge = 'approved'
|
|
225
|
+
}
|
|
226
|
+
conditionNextSteps = conditionNextSteps.concat(await getNextSteps(instance, nextStep, judge, autoFormDoc, fields, showSkipStep, userId));
|
|
227
|
+
// 移除条件节点
|
|
228
|
+
rev_nextSteps.splice(idx, 1)
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
rev_nextSteps = rev_nextSteps.concat(conditionNextSteps);
|
|
232
|
+
//去除重复
|
|
233
|
+
rev_nextSteps = _.compact(_.uniqBy(rev_nextSteps, 'id'));
|
|
234
|
+
}
|
|
235
|
+
|
|
196
236
|
return rev_nextSteps;
|
|
197
237
|
}
|
|
198
238
|
|
|
239
|
+
async function caculateNextStepsByEnterStepCondition(flow, flowVersionId, instance, step, autoFormDoc, fields, needRemoveSteps = {}, needAddSteps = {}, userId) {
|
|
240
|
+
if (false === step.always_enter_step) {
|
|
241
|
+
const stepId = step.id;
|
|
242
|
+
// 获取step处理人
|
|
243
|
+
const users = await HandlersManager.getHandlers(instance._id, stepId, userId);
|
|
244
|
+
const spaceId = instance.space;
|
|
245
|
+
const approvers = await Promise.all(users.map(user => WorkflowManager.getFormulaUserObject(spaceId, user)));
|
|
246
|
+
|
|
247
|
+
let enterStepCondition = step.enter_step_condition;
|
|
248
|
+
const fieldValues = await UUFlowManager.initFormulaValues(instance, autoFormDoc);
|
|
249
|
+
fieldValues.step = {
|
|
250
|
+
...step,
|
|
251
|
+
approvers
|
|
252
|
+
};
|
|
253
|
+
fieldValues.loginUserId = userId; // 当前登录用户
|
|
254
|
+
if (!UUFlowManager.isAmisFormula(enterStepCondition)) {
|
|
255
|
+
throw new Error('Not Amis Formula, Contact Admin Please.')
|
|
256
|
+
}
|
|
257
|
+
let result = UUFlowManager.calculateConditionWithAmis(fieldValues, enterStepCondition);
|
|
258
|
+
if (false === result) {
|
|
259
|
+
needRemoveSteps[step.id] = step;
|
|
260
|
+
if (step.lines && step.lines.length > 0) {
|
|
261
|
+
const toStepIds = step.lines.map(function(s){ return s.to_step});
|
|
262
|
+
await Promise.all(toStepIds.map(async (stepId) => {
|
|
263
|
+
const s = getStep(flow, flowVersionId, stepId);
|
|
264
|
+
if (s) {
|
|
265
|
+
await caculateNextStepsByEnterStepCondition(flow, flowVersionId, instance, s, autoFormDoc, fields, needRemoveSteps, needAddSteps, userId);
|
|
266
|
+
}
|
|
267
|
+
}));
|
|
268
|
+
}
|
|
269
|
+
} else {
|
|
270
|
+
needAddSteps[step.id] = step;
|
|
271
|
+
}
|
|
272
|
+
} else {
|
|
273
|
+
needAddSteps[step.id] = step;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
|
|
199
278
|
router.post('/api/workflow/v2/nextStep', requireAuthentication, async function (req, res) {
|
|
200
279
|
try {
|
|
201
280
|
const userSession = req.user;
|
|
281
|
+
const { userId } = userSession;
|
|
202
282
|
const { instanceId, flowId, step, judge, values, flowVersionId } = req.body;
|
|
203
283
|
const flow = await objectql.getObject('flows').findOne(flowId);
|
|
204
284
|
const instance = await objectql.getObject('instances').findOne(instanceId);
|
|
205
285
|
|
|
206
|
-
const resNextSteps = await getNextSteps(flow, flowVersionId, instance, step, judge, values);
|
|
286
|
+
const resNextSteps = await getNextSteps(flow, flowVersionId, instance, step, judge, values, null, null, userId);
|
|
207
287
|
res.status(200).send({
|
|
208
288
|
'nextSteps': resNextSteps
|
|
209
289
|
});
|
|
@@ -228,17 +308,18 @@ const calcSteps = async function(instance, flow, flowVersionId, formFields, valu
|
|
|
228
308
|
|
|
229
309
|
_steps.push(step);
|
|
230
310
|
try {
|
|
231
|
-
var nextSteps = await getNextSteps(flow, flowVersionId, instance, step, judge, values);
|
|
232
|
-
|
|
311
|
+
var nextSteps = await getNextSteps(flow, flowVersionId, instance, step, judge, values, null, null, instance.submitter);
|
|
312
|
+
const recursiveResults = await Promise.all(nextSteps.map(async (nextStep) => {
|
|
233
313
|
try {
|
|
234
314
|
if (!_.includes(track, nextStep._id)) {
|
|
235
|
-
|
|
236
|
-
_steps = _steps.concat(__steps)
|
|
315
|
+
return await calcSteps(instance, flow, flowVersionId, formFields, values, nextStep, track.concat(_.map(_steps, '_id')));
|
|
237
316
|
}
|
|
238
317
|
} catch (e) {
|
|
239
318
|
console.log(e)
|
|
240
319
|
}
|
|
241
|
-
|
|
320
|
+
return [];
|
|
321
|
+
}));
|
|
322
|
+
_steps = _steps.concat(_.flatten(recursiveResults));
|
|
242
323
|
} catch (error) {
|
|
243
324
|
console.log(error)
|
|
244
325
|
}
|
|
@@ -266,6 +347,30 @@ router.post('/api/workflow/v2/nextSteps', requireAuthentication, async function
|
|
|
266
347
|
}
|
|
267
348
|
})
|
|
268
349
|
|
|
350
|
+
router.get('/api/workflow/v2/get_instance_steps/:instanceId', requireAuthentication, async function (req, res) {
|
|
351
|
+
try {
|
|
352
|
+
const { instanceId } = req.params;
|
|
353
|
+
if(instanceId === 'none'){
|
|
354
|
+
return res.status(200).send({ status: 0 });
|
|
355
|
+
}
|
|
356
|
+
const instance = await objectql.getObject('instances').findOne(instanceId);
|
|
357
|
+
if(!instance){
|
|
358
|
+
return res.status(200).send({
|
|
359
|
+
error: 'not find instance'
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
return res.status(200).send({ status: 0, data: {
|
|
363
|
+
step_approve: instance.step_approve,
|
|
364
|
+
skip_steps: instance.skip_steps
|
|
365
|
+
} });
|
|
366
|
+
} catch (error) {
|
|
367
|
+
console.error(error);
|
|
368
|
+
res.status(200).send({
|
|
369
|
+
error: error.message
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
})
|
|
373
|
+
|
|
269
374
|
router.post('/api/workflow/v2/set_instance_steps', requireAuthentication, async function (req, res) {
|
|
270
375
|
try {
|
|
271
376
|
const userSession = req.user;
|
|
@@ -14,6 +14,23 @@ const { excuteTriggers } = require('../utils/trigger');
|
|
|
14
14
|
const objectql = require('@steedos/objectql');
|
|
15
15
|
const WorkflowManager = require('../manager/workflow_manager');
|
|
16
16
|
const UUFlowManager = require('../manager/uuflow_manager');
|
|
17
|
+
|
|
18
|
+
const getFieldName = (fields, fieldId)=>{
|
|
19
|
+
const field = _.find(fields, (item)=>{
|
|
20
|
+
return item._id === fieldId
|
|
21
|
+
});
|
|
22
|
+
return field?.code || fieldId
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const getFieldValue = (values, code)=>{
|
|
26
|
+
return values[code]
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const getFormFieldValue = (fields, values, fieldId)=>{
|
|
30
|
+
const code = getFieldName(fields, fieldId);
|
|
31
|
+
return getFieldValue(values, code);
|
|
32
|
+
}
|
|
33
|
+
|
|
17
34
|
/**
|
|
18
35
|
* 计算下一步处理人
|
|
19
36
|
* body {
|
|
@@ -41,8 +58,15 @@ router.post('/api/workflow/v2/nextStepUsers', requireAuthentication, async funct
|
|
|
41
58
|
} = req.body;
|
|
42
59
|
|
|
43
60
|
let instance = await UUFlowManager.getInstance(insId);
|
|
44
|
-
|
|
45
|
-
|
|
61
|
+
const [flow, form] = await Promise.all([
|
|
62
|
+
UUFlowManager.getFlow(instance.flow),
|
|
63
|
+
UUFlowManager.getForm(instance.form)
|
|
64
|
+
]);
|
|
65
|
+
const [formVersion, nextStep] = await Promise.all([
|
|
66
|
+
UUFlowManager.getFormVersion(form, instance.form_version),
|
|
67
|
+
UUFlowManager.getStep(instance, flow, nextStepId)
|
|
68
|
+
]);
|
|
69
|
+
const formFields = formVersion.fields;
|
|
46
70
|
switch (nextStep.step_type) {
|
|
47
71
|
case 'start':
|
|
48
72
|
var applicantId = instance.applicant;
|
|
@@ -82,7 +106,7 @@ router.post('/api/workflow/v2/nextStepUsers', requireAuthentication, async funct
|
|
|
82
106
|
case 'userField':
|
|
83
107
|
var
|
|
84
108
|
userField = nextStep.approver_user_field,
|
|
85
|
-
userFieldValue = values
|
|
109
|
+
userFieldValue = getFormFieldValue(formFields, values, userField);
|
|
86
110
|
if(userFieldValue){
|
|
87
111
|
if (_.isArray(userFieldValue)) { //如果多选,以userFieldValue值为Array
|
|
88
112
|
nextStepUsers = await WorkflowManager.getUsers(spaceId, userFieldValue);
|
|
@@ -90,7 +114,7 @@ router.post('/api/workflow/v2/nextStepUsers', requireAuthentication, async funct
|
|
|
90
114
|
nextStepUsers.push(await WorkflowManager.getUser(spaceId, userFieldValue));
|
|
91
115
|
}
|
|
92
116
|
}else {
|
|
93
|
-
error = "
|
|
117
|
+
error = "请先填写表单值";
|
|
94
118
|
}
|
|
95
119
|
|
|
96
120
|
break;
|
|
@@ -99,7 +123,7 @@ router.post('/api/workflow/v2/nextStepUsers', requireAuthentication, async funct
|
|
|
99
123
|
orgs,
|
|
100
124
|
orgChildrens,
|
|
101
125
|
orgField = nextStep.approver_org_field,
|
|
102
|
-
orgFieldValue = values
|
|
126
|
+
orgFieldValue = getFormFieldValue(formFields, values, orgField);
|
|
103
127
|
if (orgFieldValue) {
|
|
104
128
|
if (_.isArray(orgFieldValue)) { //如果多选,以orgFieldValue值为Array
|
|
105
129
|
orgs = await WorkflowManager.getOrganizations(orgFieldValue);
|
|
@@ -118,7 +142,7 @@ router.post('/api/workflow/v2/nextStepUsers', requireAuthentication, async funct
|
|
|
118
142
|
error = "ORG_NO_MEMBERS";
|
|
119
143
|
}
|
|
120
144
|
} else {
|
|
121
|
-
error = "
|
|
145
|
+
error = "请先填写表单值";
|
|
122
146
|
}
|
|
123
147
|
|
|
124
148
|
break;
|
|
@@ -133,7 +157,7 @@ router.post('/api/workflow/v2/nextStepUsers', requireAuthentication, async funct
|
|
|
133
157
|
case 'userFieldRole':
|
|
134
158
|
var
|
|
135
159
|
userField = nextStep.approver_user_field,
|
|
136
|
-
userFieldValue = values
|
|
160
|
+
userFieldValue = getFormFieldValue(formFields, values, userField),
|
|
137
161
|
approverRoleIds = nextStep.approver_roles;
|
|
138
162
|
if (userFieldValue) {
|
|
139
163
|
if (_.isArray(userFieldValue)) { //如果多选,以userFieldValue值为Array
|
|
@@ -146,7 +170,7 @@ router.post('/api/workflow/v2/nextStepUsers', requireAuthentication, async funct
|
|
|
146
170
|
error = "ROLE_NO_MEMBERS";
|
|
147
171
|
}
|
|
148
172
|
} else {
|
|
149
|
-
error = "
|
|
173
|
+
error = "请先填写表单值";
|
|
150
174
|
}
|
|
151
175
|
|
|
152
176
|
|
|
@@ -154,7 +178,7 @@ router.post('/api/workflow/v2/nextStepUsers', requireAuthentication, async funct
|
|
|
154
178
|
case 'orgFieldRole':
|
|
155
179
|
var
|
|
156
180
|
orgField = nextStep.approver_org_field,
|
|
157
|
-
orgFieldValue = values
|
|
181
|
+
orgFieldValue = getFormFieldValue(formFields, values, orgField),
|
|
158
182
|
approverRoleIds = nextStep.approver_roles;
|
|
159
183
|
|
|
160
184
|
if (orgFieldValue) {
|
|
@@ -168,7 +192,7 @@ router.post('/api/workflow/v2/nextStepUsers', requireAuthentication, async funct
|
|
|
168
192
|
error = "ROLE_NO_MEMBERS";
|
|
169
193
|
}
|
|
170
194
|
} else {
|
|
171
|
-
error = "
|
|
195
|
+
error = "请先填写表单值";
|
|
172
196
|
}
|
|
173
197
|
break;
|
|
174
198
|
default:
|
|
@@ -214,4 +238,33 @@ router.post('/api/workflow/v2/nextStepUsers', requireAuthentication, async funct
|
|
|
214
238
|
});
|
|
215
239
|
}
|
|
216
240
|
});
|
|
241
|
+
|
|
242
|
+
router.post('/api/workflow/v2/nextStepUsersValue', requireAuthentication, async function (req, res) {
|
|
243
|
+
try {
|
|
244
|
+
let userSession = req.user;
|
|
245
|
+
const userId = userSession.userId;
|
|
246
|
+
const spaceId = userSession.spaceId;
|
|
247
|
+
var error = "";
|
|
248
|
+
|
|
249
|
+
if (!spaceId) {
|
|
250
|
+
throw new Error('缺少参数')
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
const { instanceId, nextStepId } = req.body;
|
|
254
|
+
|
|
255
|
+
let instance = await UUFlowManager.getInstance(instanceId);
|
|
256
|
+
const step_approve = instance.step_approve || {};
|
|
257
|
+
const newNextUsers = step_approve[nextStepId] || []
|
|
258
|
+
res.status(200).send({
|
|
259
|
+
'value': newNextUsers,
|
|
260
|
+
'error': error
|
|
261
|
+
});
|
|
262
|
+
} catch (error) {
|
|
263
|
+
console.error(error);
|
|
264
|
+
res.status(200).send({
|
|
265
|
+
error: error.message
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
|
|
217
270
|
exports.default = router;
|
|
@@ -114,7 +114,7 @@ router.post('/api/workflow/nextStepUsers', requireAuthentication, async function
|
|
|
114
114
|
error = "ORG_NO_MEMBERS";
|
|
115
115
|
}
|
|
116
116
|
} else {
|
|
117
|
-
error = "
|
|
117
|
+
error = "请先填写表单值";
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
break;
|
|
@@ -142,7 +142,7 @@ router.post('/api/workflow/nextStepUsers', requireAuthentication, async function
|
|
|
142
142
|
error = "ROLE_NO_MEMBERS";
|
|
143
143
|
}
|
|
144
144
|
} else {
|
|
145
|
-
error = "
|
|
145
|
+
error = "请先填写表单值";
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
|
|
@@ -164,7 +164,7 @@ router.post('/api/workflow/nextStepUsers', requireAuthentication, async function
|
|
|
164
164
|
error = "ROLE_NO_MEMBERS";
|
|
165
165
|
}
|
|
166
166
|
} else {
|
|
167
|
-
error = "
|
|
167
|
+
error = "请先填写表单值";
|
|
168
168
|
}
|
|
169
169
|
break;
|
|
170
170
|
default:
|
|
@@ -166,15 +166,7 @@ module.exports = {
|
|
|
166
166
|
case 'monitor':
|
|
167
167
|
filter.push(['state', 'in', ["pending", "completed"]]);
|
|
168
168
|
if(!is_space_admin){
|
|
169
|
-
const flowIds = await
|
|
170
|
-
Fiber(function () {
|
|
171
|
-
try {
|
|
172
|
-
resolve(WorkflowManager.getMyAdminOrMonitorFlows(spaceId, userId));
|
|
173
|
-
} catch (error) {
|
|
174
|
-
reject(error);
|
|
175
|
-
}
|
|
176
|
-
}).run()
|
|
177
|
-
})
|
|
169
|
+
const flowIds = await WorkflowManager.getMyAdminOrMonitorFlows(spaceId, userId);
|
|
178
170
|
if(flowId){
|
|
179
171
|
if(!_.includes(flowIds, flowId)){
|
|
180
172
|
// filter.push([
|
package/package.json
CHANGED
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
.instance-box-tree .antd-TreeControl{
|
|
54
|
-
padding:
|
|
54
|
+
padding: 0;
|
|
55
55
|
}
|
|
56
56
|
/* .instance-box-tree .antd-TreeControl{
|
|
57
57
|
padding: 0;
|
|
@@ -372,10 +372,10 @@ tbody .color-priority-muted *{
|
|
|
372
372
|
z-index: 900;
|
|
373
373
|
}
|
|
374
374
|
|
|
375
|
-
.instances-sidebar-wrapper{
|
|
375
|
+
/* .instances-sidebar-wrapper{
|
|
376
376
|
overflow-y: auto;
|
|
377
377
|
height: calc(100vh - 50px);
|
|
378
|
-
}
|
|
378
|
+
} */
|
|
379
379
|
|
|
380
380
|
.steedos-instance-related-view-wrapper{
|
|
381
381
|
.antd-Page-header{
|
|
@@ -400,4 +400,12 @@ tbody .color-priority-muted *{
|
|
|
400
400
|
.steedos-amis-instance-view-body{
|
|
401
401
|
margin: 20px 0 0 0 !important;
|
|
402
402
|
}
|
|
403
|
-
|
|
403
|
+
|
|
404
|
+
a[href]:after {
|
|
405
|
+
content: none !important;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
.font-normal{
|
|
409
|
+
border: none !important;
|
|
410
|
+
}
|
|
411
|
+
}
|