@steedos-labs/plugin-workflow 3.0.1-beta.4 → 3.0.1-beta.6
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/manager/uuflow_manager.js +1 -0
- package/main/default/objects/instances/buttons/instance_return.button.yml +1 -1
- package/main/default/objects/process_delegation_rules.object.yml +5 -4
- package/main/default/pages/instance_detail.page.amis.json +1 -0
- package/main/default/pages/instance_tasks_detail.page.amis.json +1 -0
- package/main/default/pages/instance_tasks_list.page.amis.json +1 -0
- package/main/default/pages/instances_list.page.amis.json +1 -0
- package/main/default/pages/page_instance_view.page.amis.json +67 -0
- package/main/default/pages/page_instance_view.page.yml +9 -0
- package/main/default/routes/amis_form_design.ejs +6 -6
- package/main/default/routes/amis_form_design.router.js +1 -11
- package/main/default/routes/api_formula_users.router.js +7 -50
- package/main/default/routes/api_workflow_instance_permissions.router.js +40 -0
- package/main/default/routes/api_workflow_nav.router.js +113 -97
- package/main/default/routes/flow_form_design.ejs +11 -6
- package/main/default/routes/flow_form_design.router.js +1 -12
- package/main/default/triggers/amis_form_design.trigger.js +11 -4
- package/package.json +1 -1
- package/public/workflow/index.css +12 -0
|
@@ -4161,6 +4161,7 @@ UUFlowManager.draft_save_instance = async function (ins, userId) {
|
|
|
4161
4161
|
flows: await getCollection('flows'),
|
|
4162
4162
|
forms: await getCollection('forms'),
|
|
4163
4163
|
users: await getCollection('users'),
|
|
4164
|
+
space_users: await getCollection('space_users'),
|
|
4164
4165
|
organizations: await getCollection('organizations'),
|
|
4165
4166
|
};
|
|
4166
4167
|
|
|
@@ -77,7 +77,7 @@ amis_schema: |-
|
|
|
77
77
|
"&": "$$",
|
|
78
78
|
"record": "${record}"
|
|
79
79
|
},
|
|
80
|
-
"requestAdaptor": "const record = api.data.record;\napi.data = {\n reason: api.data.reason,\n approve: {\n instance: record._id,\n type: record.approve.type,\n trace: record.approve.trace,\n values: record.approve.values\n }\n}\nreturn api;"
|
|
80
|
+
"requestAdaptor": "const record = api.data.record;\napi.data = {\n reason: api.data.reason,\n approve: {\n _id: record.approve._id,\n instance: record._id,\n type: record.approve.type,\n trace: record.approve.trace,\n values: record.approve.values\n }\n}\nreturn api;"
|
|
81
81
|
},
|
|
82
82
|
"messages": {}
|
|
83
83
|
},
|
|
@@ -10,9 +10,10 @@ fields:
|
|
|
10
10
|
label: Client
|
|
11
11
|
reference_to: users
|
|
12
12
|
index: true
|
|
13
|
-
readonly:
|
|
14
|
-
defaultValue: "{
|
|
15
|
-
|
|
13
|
+
readonly: false
|
|
14
|
+
defaultValue: "${global.userId}"
|
|
15
|
+
amis:
|
|
16
|
+
"staticOn": "${!(global.user.is_space_admin|| ARRAYINCLUDES(global.user.roles,'organization_admin'))}"
|
|
16
17
|
name: from
|
|
17
18
|
is_name: true
|
|
18
19
|
filterable: true
|
|
@@ -39,7 +40,7 @@ fields:
|
|
|
39
40
|
enabled:
|
|
40
41
|
type: boolean
|
|
41
42
|
label: Enabled
|
|
42
|
-
defaultValue:
|
|
43
|
+
defaultValue: true
|
|
43
44
|
name: enabled
|
|
44
45
|
list_views:
|
|
45
46
|
all:
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "page",
|
|
3
|
+
"title": "Welcome to Steedos",
|
|
4
|
+
"body": [
|
|
5
|
+
{
|
|
6
|
+
"type": "wrapper",
|
|
7
|
+
"className": "steedos-instance-detail-wrapper m-0 p-0 flex-1 focus:outline-none lg:order-last sm:m-4 shadow sm:rounded",
|
|
8
|
+
"body": [
|
|
9
|
+
{
|
|
10
|
+
"type": "service",
|
|
11
|
+
"className": "h-full",
|
|
12
|
+
"body": [],
|
|
13
|
+
"id": "u:d6db0c84f150",
|
|
14
|
+
"dsType": "api",
|
|
15
|
+
"schemaApi": {
|
|
16
|
+
"method": "get",
|
|
17
|
+
"url": "/api/health_check?trace=${recordId}",
|
|
18
|
+
"adaptor": "const result = {data: {'type':'wrapper','className':'p-0 h-full','body':[{'type':'steedos-instance-detail','id':'u:40052b3812c1','label':'Instance Detail','instanceId':context.recordId,'boxName':context.side_listview_id}],'id':'u:829a40757f0a'}};console.log('result===>', result); return result;"
|
|
19
|
+
},
|
|
20
|
+
"visibleOn": "${permission === true}"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"id": "u:259e5e73a3e2",
|
|
24
|
+
"type": "tpl",
|
|
25
|
+
"tpl": "无权限",
|
|
26
|
+
"visibleOn": "${permission === false}"
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
"id": "u:f101829e8710"
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
"regions": [
|
|
33
|
+
"body"
|
|
34
|
+
],
|
|
35
|
+
"data": {},
|
|
36
|
+
"id": "u:d37465183f56",
|
|
37
|
+
"className": "steedos-instance-related-view-wrapper flex justify-center",
|
|
38
|
+
"bodyClassName": "p-0 flex flex-1 overflow-hidden h-full",
|
|
39
|
+
"name": "amis-root-workflow",
|
|
40
|
+
"initApi": {
|
|
41
|
+
"url": "http://127.0.0.1:8443/api/workflow/v2/instance/${recordId}/permission",
|
|
42
|
+
"method": "get",
|
|
43
|
+
"data": {},
|
|
44
|
+
"requestAdaptor": "",
|
|
45
|
+
"adaptor": "",
|
|
46
|
+
"messages": {},
|
|
47
|
+
"sendOn": "${recordId}"
|
|
48
|
+
},
|
|
49
|
+
"initFetch": null,
|
|
50
|
+
"asideResizor": false,
|
|
51
|
+
"pullRefresh": {
|
|
52
|
+
"disabled": true
|
|
53
|
+
},
|
|
54
|
+
"editorState": "default",
|
|
55
|
+
"css": {
|
|
56
|
+
".steedos-instance-related-view-wrapper > .antd-Page-content": {
|
|
57
|
+
"max-width": "1024px"
|
|
58
|
+
},
|
|
59
|
+
".steedos-global-header-root": {
|
|
60
|
+
"display": "none"
|
|
61
|
+
},
|
|
62
|
+
".creator-content-wrapper": {
|
|
63
|
+
"margin-top": "0px"
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"wrapperCustomStyle": {}
|
|
67
|
+
}
|
|
@@ -238,15 +238,15 @@
|
|
|
238
238
|
case "user":
|
|
239
239
|
const useTpl = {
|
|
240
240
|
"type": "steedos-field",
|
|
241
|
-
"id":
|
|
242
|
-
"
|
|
241
|
+
"id": `u:${field.code}`,
|
|
242
|
+
"config": {
|
|
243
243
|
name: field.code,
|
|
244
244
|
label: field.name,
|
|
245
245
|
reference_to: "space_users",
|
|
246
246
|
reference_to_field: 'user',
|
|
247
247
|
multiple: field.is_multiselect,
|
|
248
248
|
type: "lookup"
|
|
249
|
-
}
|
|
249
|
+
},
|
|
250
250
|
}
|
|
251
251
|
// const useTpl = await lookupToAmis(
|
|
252
252
|
// {
|
|
@@ -265,14 +265,14 @@
|
|
|
265
265
|
case "group":
|
|
266
266
|
const orgTpl = {
|
|
267
267
|
"type": "steedos-field",
|
|
268
|
-
"id":
|
|
269
|
-
"
|
|
268
|
+
"id": `u:${field.code}`,
|
|
269
|
+
"config": {
|
|
270
270
|
name: field.code,
|
|
271
271
|
label: field.name,
|
|
272
272
|
reference_to: "organizations",
|
|
273
273
|
multiple: field.is_multiselect,
|
|
274
274
|
type: "lookup"
|
|
275
|
-
}
|
|
275
|
+
}
|
|
276
276
|
}
|
|
277
277
|
|
|
278
278
|
// const orgTpl = await lookupToAmis(
|
|
@@ -13,16 +13,6 @@ const fs = require('fs');
|
|
|
13
13
|
const _ = require('lodash');
|
|
14
14
|
const path = require('path');
|
|
15
15
|
|
|
16
|
-
const getPublicAssetUrls = function(assetUrls){
|
|
17
|
-
const values = _.map(_.split(assetUrls), (item)=>{
|
|
18
|
-
if(_.startsWith(item, '/')){
|
|
19
|
-
return Meteor.absoluteUrl(item) ;
|
|
20
|
-
}else{
|
|
21
|
-
return item;
|
|
22
|
-
}
|
|
23
|
-
})
|
|
24
|
-
return _.join(values, ',')
|
|
25
|
-
}
|
|
26
16
|
|
|
27
17
|
router.get('/api/amisFormDesign', requireAuthentication, async function (req, res) {
|
|
28
18
|
try {
|
|
@@ -32,7 +22,7 @@ router.get('/api/amisFormDesign', requireAuthentication, async function (req, re
|
|
|
32
22
|
let assetUrl = "";
|
|
33
23
|
let assetUrls = null;
|
|
34
24
|
if(process.env.STEEDOS_PUBLIC_PAGE_ASSETURLS && _.isString(process.env.STEEDOS_PUBLIC_PAGE_ASSETURLS)){
|
|
35
|
-
assetUrls =
|
|
25
|
+
assetUrls = process.env.STEEDOS_PUBLIC_PAGE_ASSETURLS.split(',');
|
|
36
26
|
assetUrl = `assetUrl=${assetUrls.join("&assetUrl=")}&`;
|
|
37
27
|
}else{
|
|
38
28
|
var fullPath = path.resolve(path.dirname(require.resolve('@steedos-ui/builder-widgets' + '/package.json')));
|
|
@@ -11,59 +11,16 @@ const express = require('express');
|
|
|
11
11
|
const router = express.Router();
|
|
12
12
|
const { requireAuthentication } = require("@steedos/auth");
|
|
13
13
|
const WorkflowManager = require('../manager/workflow_manager');
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
@api {post} /api/formula/users 获取用户
|
|
17
|
-
@apiVersion 0.0.0
|
|
18
|
-
@apiName /api/formula/users
|
|
19
|
-
@apiGroup service-workflow
|
|
20
|
-
@apiBody {String[]} userIds 用户ID
|
|
21
|
-
@apiBody {String} spaceId 工作区ID
|
|
22
|
-
@apiSuccessExample {json} Success-Response:
|
|
23
|
-
HTTP/1.1 200 OK
|
|
24
|
-
{
|
|
25
|
-
'spaceUsers': [],
|
|
26
|
-
}
|
|
27
|
-
@apiErrorExample {json} Error-Response:
|
|
28
|
-
HTTP/1.1 200 OK
|
|
29
|
-
{
|
|
30
|
-
errors: ''
|
|
31
|
-
}
|
|
32
|
-
*/
|
|
33
|
-
router.post('/api/formula/users', requireAuthentication, async function (req, res) {
|
|
14
|
+
|
|
15
|
+
router.get('/api/formula/user/:userId', requireAuthentication, async function (req, res) {
|
|
34
16
|
try {
|
|
35
17
|
let userSession = req.user;
|
|
36
|
-
const userId = userSession.userId;
|
|
37
|
-
Fiber(async function () {
|
|
38
|
-
try {
|
|
39
|
-
var spaceId, spaceUsers, space_user, userIds;
|
|
40
|
-
userIds = req.body.userIds;
|
|
41
|
-
spaceId = req.body.spaceId;
|
|
42
|
-
spaceUsers = [];
|
|
43
|
-
space_user = db.space_users.findOne({
|
|
44
|
-
user: userId,
|
|
45
|
-
space: spaceId
|
|
46
|
-
}, {
|
|
47
|
-
fields: {
|
|
48
|
-
_id: 1
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
if (!space_user) {
|
|
52
|
-
return res.status(200).send({ 'errors': '无权限' });
|
|
53
|
-
}
|
|
54
|
-
if (!userIds || !spaceId) {
|
|
55
|
-
return res.status(200).send({ 'errors': '缺少参数' });
|
|
56
|
-
}
|
|
57
|
-
spaceUsers = WorkflowManager.getFormulaUserObjects(spaceId, userIds);
|
|
58
18
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
}).run()
|
|
19
|
+
const { userId } = req.params;
|
|
20
|
+
|
|
21
|
+
const result = await WorkflowManager.getFormulaUserObject(userSession.spaceId, userId);
|
|
22
|
+
|
|
23
|
+
res.status(200).send(result);
|
|
67
24
|
} catch (e) {
|
|
68
25
|
res.status(200).send({
|
|
69
26
|
errors: [{ errorMessage: e.message }]
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
// @ts-check
|
|
3
|
+
const objectql = require('@steedos/objectql');
|
|
4
|
+
const express = require('express');
|
|
5
|
+
const router = express.Router();
|
|
6
|
+
const { requireAuthentication } = require("@steedos/auth");
|
|
7
|
+
const WorkflowManager = require('../manager/workflow_manager');
|
|
8
|
+
const _ = require('underscore');
|
|
9
|
+
const { getCollection } = require('../utils/collection');
|
|
10
|
+
|
|
11
|
+
router.get('/api/workflow/v2/instance/:instanceId/permission', requireAuthentication, async function (req, res) {
|
|
12
|
+
try {
|
|
13
|
+
const { instanceId } = req.params;
|
|
14
|
+
const userSession = req.user;
|
|
15
|
+
const current_user_info = userSession;
|
|
16
|
+
const current_user_id = current_user_info.userId;
|
|
17
|
+
const db = {
|
|
18
|
+
users: await getCollection('users'),
|
|
19
|
+
instances: await getCollection('instances')
|
|
20
|
+
}
|
|
21
|
+
const user = await db.users.findOne({_id: current_user_id});
|
|
22
|
+
const instance = await db.instances.findOne({_id: instanceId})
|
|
23
|
+
console.log(`user`, user)
|
|
24
|
+
console.log(`instance`, instance)
|
|
25
|
+
const permission = await WorkflowManager.hasInstancePermissions(user, instance)
|
|
26
|
+
res.status(200).send({
|
|
27
|
+
data: {
|
|
28
|
+
permission: permission
|
|
29
|
+
},
|
|
30
|
+
msg: "",
|
|
31
|
+
status: 0
|
|
32
|
+
});
|
|
33
|
+
} catch (e) {
|
|
34
|
+
console.log(`e`, e)
|
|
35
|
+
res.status(200).send({
|
|
36
|
+
errors: [{ errorMessage: e.message }]
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
exports.default = router;
|
|
@@ -119,116 +119,126 @@ const getCategoriesMonitor = async (userSession, req, currentUrl) => {
|
|
|
119
119
|
let hasFlowsPer = userSession.is_space_admin;
|
|
120
120
|
const { appId } = req.params;
|
|
121
121
|
let output = [];
|
|
122
|
-
let data = {};
|
|
123
122
|
let monitorIsUnfolded = false;
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
123
|
+
|
|
124
|
+
try {
|
|
125
|
+
// const sa = new Date().getTime();
|
|
126
|
+
const apps = await objectql.getObject('apps').find({filters: ['space', '=', userSession.spaceId], fields: ['_id', 'code']});
|
|
127
|
+
// console.log(`find apps`, new Date().getTime() - sa)
|
|
128
|
+
const appsMap = new Map(Object.entries(lodash.keyBy(apps, '_id')));
|
|
129
|
+
// const sc = new Date().getTime();
|
|
130
|
+
const categories = await objectql.getObject('categories').find({filters: ["space", "=", `${userSession.spaceId}`], sort: "sort_no desc"})
|
|
131
|
+
// console.log(`find categories`, new Date().getTime() - sc)
|
|
132
|
+
for (const item of categories) {
|
|
133
|
+
if(item.app){
|
|
134
|
+
item.app__expand = appsMap.get(item.app)
|
|
135
|
+
}else{
|
|
136
|
+
item.app__expand = {}
|
|
133
137
|
}
|
|
134
|
-
`}
|
|
135
|
-
)
|
|
136
|
-
let currentAppCategories = [];
|
|
137
|
-
if(appId == "approve_workflow"){
|
|
138
|
-
currentAppCategories = categoriesData.data.categories;
|
|
139
|
-
}else{
|
|
140
|
-
currentAppCategories = lodash.filter(categoriesData.data.categories, (category) => {
|
|
141
|
-
if(category.app__expand?.code == appId) return true;
|
|
142
|
-
else return false;
|
|
143
|
-
})
|
|
144
|
-
if(currentAppCategories.length == 0) {
|
|
145
|
-
//如果没有任何分类绑定该app,则该app显示所有分类(该规则为审批王规则)
|
|
146
|
-
currentAppCategories = categoriesData.data.categories;
|
|
147
138
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
}
|
|
162
|
-
`
|
|
163
|
-
data = await objectql.broker.call('api.graphql', {
|
|
164
|
-
query }
|
|
165
|
-
)
|
|
139
|
+
|
|
140
|
+
let currentAppCategories = [];
|
|
141
|
+
if(appId == "approve_workflow"){
|
|
142
|
+
currentAppCategories = categories;
|
|
143
|
+
}else{
|
|
144
|
+
currentAppCategories = lodash.filter(categories, (category) => {
|
|
145
|
+
if(category.app__expand?.code == appId) return true;
|
|
146
|
+
else return false;
|
|
147
|
+
})
|
|
148
|
+
if(currentAppCategories.length == 0) {
|
|
149
|
+
//如果没有任何分类绑定该app,则该app显示所有分类(该规则为审批王规则)
|
|
150
|
+
currentAppCategories = categories;
|
|
151
|
+
}
|
|
166
152
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
153
|
+
let categoriesIds = lodash.map(currentAppCategories, '_id');
|
|
154
|
+
// console.log(`getCategoriesMonitor categoriesIds`, categoriesIds)
|
|
155
|
+
// console.log(`getCategoriesMonitor hasFlowsPer`, hasFlowsPer)
|
|
156
|
+
let flows = [];
|
|
157
|
+
if (!hasFlowsPer) {
|
|
158
|
+
const flowIds = await WorkflowManager.getMyAdminOrMonitorFlows(userSession.spaceId, userSession.userId);
|
|
159
|
+
hasFlowsPer = flowIds && flowIds.length > 0;
|
|
160
|
+
if (hasFlowsPer) {
|
|
161
|
+
flows = await objectql.getObject('flows').find({
|
|
162
|
+
filters: [["_id","in", flowIds],"and",["category","in", categoriesIds], "and", ["state", "=", "enabled"]],
|
|
163
|
+
fields: ['_id', 'name', 'category', 'sort_no'],
|
|
164
|
+
sort:"sort_no desc"
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
} else {
|
|
168
|
+
// const s1 = new Date().getTime();
|
|
169
|
+
flows = await objectql.getObject('flows').find({
|
|
170
|
+
filters:[["space", "=", userSession.spaceId],["category","in", categoriesIds],["state", "=", "enabled"]],
|
|
171
|
+
fields: ['_id', 'name', 'category', 'sort_no'],
|
|
172
|
+
sort:"sort_no desc"
|
|
173
|
+
})
|
|
174
|
+
// console.log(`find flows`, new Date().getTime() - s1)
|
|
175
|
+
}
|
|
176
|
+
if (flows.length > 0) {
|
|
177
|
+
const categoriesMap = new Map(Object.entries(lodash.keyBy(categories, '_id')));
|
|
178
|
+
|
|
179
|
+
for (const item of flows) {
|
|
180
|
+
if(item.category){
|
|
181
|
+
item.category__expand = categoriesMap.get(item.category)
|
|
182
|
+
}else{
|
|
183
|
+
item.category__expand = {}
|
|
176
184
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
const categoryGroups = lodash.groupBy(flows, 'category__expand.name');
|
|
188
|
+
lodash.each(categoryGroups, (v, k) => {
|
|
189
|
+
const flowGroups = lodash.groupBy(v, 'name');
|
|
190
|
+
const flows = [];
|
|
191
|
+
const categoryValue = `/app/${appId}/instances/view/none?side_object=instances&side_listview_id=monitor&additionalFilters=['category','=',${v[0].category__expand?"'" + v[0].category__expand._id + "'":null}]&flowId=&categoryId=${v[0].category__expand && v[0].category__expand._id}`;
|
|
192
|
+
let categoryIsUnfolded = false;
|
|
193
|
+
lodash.each(flowGroups, (v2, k2) => {
|
|
194
|
+
const flowValue = `/app/${appId}/instances/view/none?side_object=instances&side_listview_id=monitor&additionalFilters=['flow','=','${v2[0]._id}']&flowId=${v2[0]._id}&categoryId=${v[0].category__expand && v[0].category__expand._id}`;
|
|
195
|
+
let flowIsUnfolded = false;
|
|
196
|
+
if(currentUrl == flowValue){
|
|
197
|
+
flowIsUnfolded = true;
|
|
198
|
+
categoryIsUnfolded = true;
|
|
199
|
+
monitorIsUnfolded = true;
|
|
200
|
+
}
|
|
201
|
+
flows.push({
|
|
202
|
+
label: k2,
|
|
203
|
+
flow_name: k2,
|
|
204
|
+
options: {
|
|
205
|
+
level: 3,
|
|
206
|
+
value: v2[0]._id,
|
|
207
|
+
name: 'flow',
|
|
208
|
+
to: flowValue,
|
|
209
|
+
},
|
|
210
|
+
value: flowValue,
|
|
211
|
+
unfolded: flowIsUnfolded
|
|
212
|
+
})
|
|
213
|
+
})
|
|
214
|
+
if(currentUrl == categoryValue){
|
|
192
215
|
categoryIsUnfolded = true;
|
|
193
216
|
monitorIsUnfolded = true;
|
|
194
217
|
}
|
|
195
|
-
|
|
196
|
-
label:
|
|
197
|
-
|
|
218
|
+
output.push({
|
|
219
|
+
label: k == 'null' || k == 'undefined' || !k? "未分类" : k,
|
|
220
|
+
children: flows,
|
|
221
|
+
category_name: k == 'null' || k == 'undefined' || !k ? "未分类" : k,
|
|
198
222
|
options: {
|
|
199
|
-
level:
|
|
200
|
-
value:
|
|
201
|
-
name: '
|
|
202
|
-
to:
|
|
223
|
+
level: 2,
|
|
224
|
+
value: v[0].category__expand && v[0].category__expand._id,
|
|
225
|
+
name: 'category',
|
|
226
|
+
to: categoryValue,
|
|
203
227
|
},
|
|
204
|
-
value:
|
|
205
|
-
unfolded:
|
|
228
|
+
value: categoryValue,
|
|
229
|
+
unfolded: categoryIsUnfolded
|
|
206
230
|
})
|
|
207
231
|
})
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
options: {
|
|
217
|
-
level: 2,
|
|
218
|
-
value: v[0].category__expand && v[0].category__expand._id,
|
|
219
|
-
name: 'category',
|
|
220
|
-
to: categoryValue,
|
|
221
|
-
},
|
|
222
|
-
value: categoryValue,
|
|
223
|
-
unfolded: categoryIsUnfolded
|
|
224
|
-
})
|
|
225
|
-
})
|
|
226
|
-
output = lodash.sortBy(output, [function (o) {
|
|
227
|
-
return lodash.findIndex(categoriesData.data.categories, (e) => {
|
|
228
|
-
return e._id == o.options.value;
|
|
229
|
-
});
|
|
230
|
-
}]);
|
|
232
|
+
output = lodash.sortBy(output, [function (o) {
|
|
233
|
+
return lodash.findIndex(categories, (e) => {
|
|
234
|
+
return e._id == o.options.value;
|
|
235
|
+
});
|
|
236
|
+
}]);
|
|
237
|
+
}
|
|
238
|
+
} catch (error) {
|
|
239
|
+
console.log(error)
|
|
231
240
|
}
|
|
241
|
+
|
|
232
242
|
return {
|
|
233
243
|
schema: output,
|
|
234
244
|
hasFlowsPer: hasFlowsPer,
|
|
@@ -242,9 +252,15 @@ router.get('/api/:appId/workflow/nav', requireAuthentication, async function (re
|
|
|
242
252
|
currentUrl = currentUrl.substring(currentUrl.indexOf("/app"));
|
|
243
253
|
let userSession = req.user;
|
|
244
254
|
const { appId } = req.params;
|
|
255
|
+
// const s1 = new Date().getTime();
|
|
245
256
|
let inboxResult = await getCategoriesInbox(userSession, req, currentUrl);
|
|
257
|
+
// console.log(`inboxResult time`, new Date().getTime() - s1);
|
|
258
|
+
// const s2 = new Date().getTime();
|
|
246
259
|
let monitorResult = await getCategoriesMonitor(userSession, req, currentUrl)
|
|
260
|
+
// console.log(`monitorResult time`, new Date().getTime() - s2);
|
|
261
|
+
// const s3 = new Date().getTime();
|
|
247
262
|
let draftCount = await getDraftCount(userSession,req);
|
|
263
|
+
// console.log(`getDraftCount time`, new Date().getTime() - s3);
|
|
248
264
|
|
|
249
265
|
var options = [
|
|
250
266
|
{
|
|
@@ -289,6 +289,11 @@
|
|
|
289
289
|
(field.is_list_display ? ' is_list_display' : '') +
|
|
290
290
|
(field.is_searchable ? ' is_searchable' : '')
|
|
291
291
|
};
|
|
292
|
+
|
|
293
|
+
if(field.formula){
|
|
294
|
+
tpl.value = `$${field.formula}`;
|
|
295
|
+
}
|
|
296
|
+
|
|
292
297
|
switch (field.type) {
|
|
293
298
|
case "input":
|
|
294
299
|
if (field.is_textarea) {
|
|
@@ -339,15 +344,15 @@
|
|
|
339
344
|
case "user":
|
|
340
345
|
const useTpl = {
|
|
341
346
|
"type": "steedos-field",
|
|
342
|
-
"id":
|
|
343
|
-
"
|
|
347
|
+
"id": `u:${field.code}`,
|
|
348
|
+
"config": {
|
|
344
349
|
name: field.code,
|
|
345
350
|
label: field.name,
|
|
346
351
|
reference_to: "space_users",
|
|
347
352
|
reference_to_field: 'user',
|
|
348
353
|
multiple: field.is_multiselect,
|
|
349
354
|
type: "lookup"
|
|
350
|
-
}
|
|
355
|
+
},
|
|
351
356
|
}
|
|
352
357
|
// const useTpl = await lookupToAmis(
|
|
353
358
|
// {
|
|
@@ -366,14 +371,14 @@
|
|
|
366
371
|
case "group":
|
|
367
372
|
const orgTpl = {
|
|
368
373
|
"type": "steedos-field",
|
|
369
|
-
"id":
|
|
370
|
-
"
|
|
374
|
+
"id": `u:${field.code}`,
|
|
375
|
+
"config": {
|
|
371
376
|
name: field.code,
|
|
372
377
|
label: field.name,
|
|
373
378
|
reference_to: "organizations",
|
|
374
379
|
multiple: field.is_multiselect,
|
|
375
380
|
type: "lookup"
|
|
376
|
-
}
|
|
381
|
+
}
|
|
377
382
|
}
|
|
378
383
|
|
|
379
384
|
// const orgTpl = await lookupToAmis(
|
|
@@ -10,22 +10,11 @@ const ejs = require('ejs');
|
|
|
10
10
|
const _ = require('lodash');
|
|
11
11
|
const objectql = require('@steedos/objectql');
|
|
12
12
|
|
|
13
|
-
const getPublicAssetUrls = function(assetUrls){
|
|
14
|
-
const values = _.map(_.split(assetUrls), (item)=>{
|
|
15
|
-
if(_.startsWith(item, '/')){
|
|
16
|
-
return Meteor.absoluteUrl(item) ;
|
|
17
|
-
}else{
|
|
18
|
-
return item;
|
|
19
|
-
}
|
|
20
|
-
})
|
|
21
|
-
return _.join(values, ',')
|
|
22
|
-
}
|
|
23
|
-
|
|
24
13
|
router.get('/api/workflow/form_design', auth.requireAuthentication, async function (req, res) {
|
|
25
14
|
try {
|
|
26
15
|
res.set('Content-Type', 'text/html');
|
|
27
16
|
const userSession = req.user;
|
|
28
|
-
let assetUrls =
|
|
17
|
+
let assetUrls = req.query.assetUrls;
|
|
29
18
|
const assetUrl = `assetUrl=${assetUrls.split(',').join("&assetUrl=")}&`;
|
|
30
19
|
|
|
31
20
|
// const dataContext = {
|
|
@@ -158,7 +158,6 @@ function transformFormFields(amisField) {
|
|
|
158
158
|
amisField = transformFormSField(amisField);
|
|
159
159
|
};
|
|
160
160
|
|
|
161
|
-
|
|
162
161
|
if(amisField.type === 'steedos-field'){
|
|
163
162
|
const sfield = {
|
|
164
163
|
_id: amisField.config.name,
|
|
@@ -171,7 +170,9 @@ function transformFormFields(amisField) {
|
|
|
171
170
|
is_list_display: amisField.config.is_list_display,
|
|
172
171
|
is_searchable: amisField.config.is_searchable,
|
|
173
172
|
type: 'steedos-field',
|
|
174
|
-
config: amisField.config
|
|
173
|
+
config: amisField.config,
|
|
174
|
+
visibleOn: amisField.visibleOn,
|
|
175
|
+
requiredOn: amisField.requiredOn
|
|
175
176
|
}
|
|
176
177
|
|
|
177
178
|
let tempConfig = amisField.config;
|
|
@@ -195,7 +196,9 @@ function transformFormFields(amisField) {
|
|
|
195
196
|
is_required: amisField.required == true ? true : false,
|
|
196
197
|
is_multiselect: amisField.multiple == true ? true : false,
|
|
197
198
|
is_list_display: _.includes(amisField.className, "is_list_display"),
|
|
198
|
-
is_searchable: _.includes(amisField.className, "is_searchable")
|
|
199
|
+
is_searchable: _.includes(amisField.className, "is_searchable"),
|
|
200
|
+
visibleOn: amisField.visibleOn,
|
|
201
|
+
requiredOn: amisField.requiredOn
|
|
199
202
|
}
|
|
200
203
|
|
|
201
204
|
switch (amisField.type) {
|
|
@@ -461,6 +464,8 @@ function transformFormFields(amisField) {
|
|
|
461
464
|
is_wide: _.includes(amisField.className, "is_wide"),
|
|
462
465
|
is_list_display: _.includes(amisField.className, "is_list_display"),
|
|
463
466
|
is_searchable: _.includes(amisField.className, "is_searchable"),
|
|
467
|
+
visibleOn: amisField.visibleOn,
|
|
468
|
+
requiredOn: amisField.requiredOn
|
|
464
469
|
}
|
|
465
470
|
|
|
466
471
|
if (tempConfig.reference_to === "organizations") {
|
|
@@ -489,6 +494,8 @@ function transformFormFields(amisField) {
|
|
|
489
494
|
is_wide: _.includes(amisField.className, "is_wide"),
|
|
490
495
|
is_list_display: _.includes(amisField.className, "is_list_display"),
|
|
491
496
|
is_searchable: _.includes(amisField.className, "is_searchable"),
|
|
497
|
+
visibleOn: amisField.visibleOn,
|
|
498
|
+
requiredOn: amisField.requiredOn
|
|
492
499
|
}
|
|
493
500
|
|
|
494
501
|
if (tempField.reference_to === "organizations") {
|
|
@@ -503,6 +510,7 @@ function transformFormFields(amisField) {
|
|
|
503
510
|
|
|
504
511
|
}
|
|
505
512
|
|
|
513
|
+
|
|
506
514
|
return formFieldsItem
|
|
507
515
|
}
|
|
508
516
|
|
|
@@ -531,7 +539,6 @@ module.exports = {
|
|
|
531
539
|
const form = await objectql.getObject('forms').findOne(this.id);
|
|
532
540
|
delete form.historys;
|
|
533
541
|
|
|
534
|
-
|
|
535
542
|
// 数据库更新操作:将forms表current的fields字段更新为最终数组
|
|
536
543
|
form.current.fields = getFinalFormFields(inputFields);
|
|
537
544
|
form.current.amis_schema = this.doc.amis_schema;
|
package/package.json
CHANGED
|
@@ -370,4 +370,16 @@ tbody .color-priority-muted *{
|
|
|
370
370
|
|
|
371
371
|
.steedos-amis-instance-view-body .approve-button{
|
|
372
372
|
z-index: 900;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
.instances-sidebar-wrapper{
|
|
376
|
+
overflow-y: auto;
|
|
377
|
+
height: calc(100vh - 82px);
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
.steedos-instance-related-view-wrapper{
|
|
382
|
+
.antd-Page-header{
|
|
383
|
+
display: none;
|
|
384
|
+
}
|
|
373
385
|
}
|