@steedos-labs/plugin-workflow 3.0.0-beta.13 → 3.0.0-beta.15
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/object_workflows.client.js +7 -7
- package/main/default/objects/flows/flows.object.yml +8 -2
- package/main/default/routes/am.router.js +8 -6
- package/main/default/routes/flow_form_design.ejs +22 -7
- package/main/default/triggers/amis_form_design.trigger.js +3 -0
- package/main/default/utils/designerManager.js +3 -3
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
Steedos.authRequest("/api/workflow/v2/get_object_workflows", {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
});
|
|
1
|
+
// Steedos.authRequest("/api/workflow/v2/get_object_workflows", {
|
|
2
|
+
// type: 'get',
|
|
3
|
+
// success: (data)=>{
|
|
4
|
+
// window.Creator.object_workflows = data;
|
|
5
|
+
// Creator.dataInit.set(true);
|
|
6
|
+
// }
|
|
7
|
+
// });
|
|
@@ -687,7 +687,10 @@ actions:
|
|
|
687
687
|
'on': list
|
|
688
688
|
todo: !<tag:yaml.org,2002:js/function> |-
|
|
689
689
|
function (object_name, record_id, fields) {
|
|
690
|
-
|
|
690
|
+
let locale = 'ZH-CN';
|
|
691
|
+
if(Builder.settings.context.user.language != 'zh-CN'){
|
|
692
|
+
locale = 'en-us'
|
|
693
|
+
}
|
|
691
694
|
const space = Builder.settings.context.user.spaceId;
|
|
692
695
|
const flow = null;
|
|
693
696
|
const companyId = Builder.settings.context.user.company_id;
|
|
@@ -721,7 +724,10 @@ actions:
|
|
|
721
724
|
todo: !<tag:yaml.org,2002:js/function> |-
|
|
722
725
|
function (object_name, record_id, record_permissions, data) {
|
|
723
726
|
const flow = data && data.record;
|
|
724
|
-
|
|
727
|
+
let locale = 'ZH-CN';
|
|
728
|
+
if(Builder.settings.context.user.language != 'zh-CN'){
|
|
729
|
+
locale = 'en-us'
|
|
730
|
+
}
|
|
725
731
|
const space = Builder.settings.context.user.spaceId;
|
|
726
732
|
const companyId = Builder.settings.context.user.company_id;
|
|
727
733
|
let url = `/applications/designer/current/${locale.toLocaleLowerCase()}/?spaceId=${space}` + `&flowId=${flow._id}`;
|
|
@@ -84,6 +84,7 @@ router.get('/am/designer/startup', async function (req, res) {
|
|
|
84
84
|
router.post('/am/forms', async function (req, res) {
|
|
85
85
|
try {
|
|
86
86
|
let userId = req.user.userId;
|
|
87
|
+
let language = req.user.language;
|
|
87
88
|
let data = req.body;
|
|
88
89
|
let formCollection = await getCollection('forms');
|
|
89
90
|
let flowCollection = await getCollection('flows');
|
|
@@ -156,12 +157,13 @@ router.post('/am/forms', async function (req, res) {
|
|
|
156
157
|
if (objectName) {
|
|
157
158
|
current.fields = Object.values(formFields).concat(tables);
|
|
158
159
|
amis_schema = {
|
|
159
|
-
type:
|
|
160
|
+
type: 'steedos-flow-form',
|
|
160
161
|
id: "instanceForm",
|
|
161
|
-
name:
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
"
|
|
162
|
+
name: newForm.name,
|
|
163
|
+
label: newForm.name,
|
|
164
|
+
description: newForm.description,
|
|
165
|
+
className: "steedos-flow-form steedos-flow-layout-page",
|
|
166
|
+
body: []
|
|
165
167
|
}
|
|
166
168
|
|
|
167
169
|
const getFieldEditTpl = async (field) => {
|
|
@@ -250,7 +252,7 @@ router.post('/am/forms', async function (req, res) {
|
|
|
250
252
|
flow.perms = flowPerms;
|
|
251
253
|
let flow_current = {
|
|
252
254
|
_id: _makeNewID(),
|
|
253
|
-
steps: await designerManager.makeSteps(userId, newForm.current.fields),
|
|
255
|
+
steps: await designerManager.makeSteps(userId, newForm.current.fields, language),
|
|
254
256
|
_rev: 1,
|
|
255
257
|
flow: flow._id,
|
|
256
258
|
form_version: form["current"]["id"],
|
|
@@ -115,6 +115,12 @@
|
|
|
115
115
|
tenantId,
|
|
116
116
|
authToken,
|
|
117
117
|
},
|
|
118
|
+
global: {
|
|
119
|
+
userId: userId,
|
|
120
|
+
spaceId: tenantId,
|
|
121
|
+
user: <%- JSON.stringify(userSession) %>,
|
|
122
|
+
now: new Date(),
|
|
123
|
+
}
|
|
118
124
|
},
|
|
119
125
|
};
|
|
120
126
|
|
|
@@ -144,14 +150,14 @@
|
|
|
144
150
|
|
|
145
151
|
if (!schema) {
|
|
146
152
|
//进if说明schema字段为空 说明为旧表单 对schema重新赋值
|
|
147
|
-
schema =
|
|
148
|
-
|
|
149
|
-
type: "form",
|
|
153
|
+
schema = {
|
|
154
|
+
type: 'steedos-flow-form',
|
|
150
155
|
id: "instanceForm",
|
|
151
|
-
name:
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
"
|
|
156
|
+
name: result.data.data.record.name,
|
|
157
|
+
label: result.data.data.record.name,
|
|
158
|
+
description: result.data.data.record.description,
|
|
159
|
+
className: "steedos-flow-form steedos-flow-layout-page",
|
|
160
|
+
body: []
|
|
155
161
|
}
|
|
156
162
|
if (result.data.data.record.current.fields) {
|
|
157
163
|
for (let i = 0; i < result.data.data.record.current.fields.length; i++) {
|
|
@@ -190,6 +196,14 @@
|
|
|
190
196
|
schema.data.context.tenantId = tenantId;
|
|
191
197
|
schema.data.context.userId = userId;
|
|
192
198
|
schema.data.context.authToken = authToken;
|
|
199
|
+
|
|
200
|
+
schema.data.global = {
|
|
201
|
+
userId: userId,
|
|
202
|
+
spaceId: tenantId,
|
|
203
|
+
user: <%- JSON.stringify(userSession) %>,
|
|
204
|
+
now: new Date(),
|
|
205
|
+
}
|
|
206
|
+
|
|
193
207
|
return schema || initialContent
|
|
194
208
|
}
|
|
195
209
|
} else {
|
|
@@ -462,6 +476,7 @@
|
|
|
462
476
|
);
|
|
463
477
|
if (schema.data && typeof schema.data.context === 'object') {
|
|
464
478
|
delete schema.data.context
|
|
479
|
+
delete schema.data.global
|
|
465
480
|
}
|
|
466
481
|
|
|
467
482
|
return await axios.post(
|
|
@@ -56,6 +56,9 @@ const AmisInputTypes = [
|
|
|
56
56
|
|
|
57
57
|
// getInstanceFormSchema() 在用户创建的表单中获取到type为form name为instanceForm的表单,其他的表单不要
|
|
58
58
|
function getInstanceFormSchema(amis_schema) {
|
|
59
|
+
if(!amis_schema){
|
|
60
|
+
return ;
|
|
61
|
+
}
|
|
59
62
|
|
|
60
63
|
if (amis_schema.type === 'form' && amis_schema.name === 'instanceForm' || amis_schema.type === 'steedos-flow-form') {
|
|
61
64
|
const proper_schema = amis_schema;
|
|
@@ -293,7 +293,7 @@ async function isSpaceAdmin(spaceId, userId, roles) {
|
|
|
293
293
|
}
|
|
294
294
|
}
|
|
295
295
|
|
|
296
|
-
async function makeSteps(userId, fields = []) {
|
|
296
|
+
async function makeSteps(userId, fields = [], language) {
|
|
297
297
|
let blank_ayy = [];
|
|
298
298
|
let stepEnd = _makeNewID();
|
|
299
299
|
let steps = [];
|
|
@@ -303,7 +303,7 @@ async function makeSteps(userId, fields = []) {
|
|
|
303
303
|
start_step.approver_roles = blank_ayy;
|
|
304
304
|
start_step.approver_users = blank_ayy;
|
|
305
305
|
start_step.fields_modifiable = blank_ayy;
|
|
306
|
-
start_step.name = '开始';
|
|
306
|
+
start_step.name = language === 'zh-CN' ? '开始' : 'Start';
|
|
307
307
|
start_step.step_type = "start";
|
|
308
308
|
start_step.posx = -1;
|
|
309
309
|
start_step.posy = -1;
|
|
@@ -336,7 +336,7 @@ async function makeSteps(userId, fields = []) {
|
|
|
336
336
|
end_step.approver_users = blank_ayy;
|
|
337
337
|
end_step.fields_modifiable = blank_ayy;
|
|
338
338
|
end_step.lines = blank_ayy;
|
|
339
|
-
end_step.name = '结束';
|
|
339
|
+
end_step.name = language === 'zh-CN' ? '结束' : 'End';
|
|
340
340
|
end_step.step_type = "end";
|
|
341
341
|
end_step.posx = -1;
|
|
342
342
|
end_step.posy = -1;
|