@steedos-labs/plugin-workflow 3.0.58 → 3.0.60

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.
Files changed (33) hide show
  1. package/designer/dist/amis-renderer/amis-renderer.js +1 -1
  2. package/designer/dist/assets/{index-0cQynRDB.js → index-D5-hZ3Ut.js} +199 -159
  3. package/designer/dist/index.html +1 -1
  4. package/main/default/manager/instance_tasks_manager.js +36 -32
  5. package/main/default/manager/push_manager.js +63 -63
  6. package/main/default/manager/uuflowManagerForInitApproval.js +192 -98
  7. package/main/default/manager/uuflow_manager.js +31 -32
  8. package/main/default/objectTranslations/instances.en/instances.en.objectTranslation.yml +9 -0
  9. package/main/default/objectTranslations/instances.zh-CN/instances.zh-CN.objectTranslation.yml +9 -0
  10. package/main/default/objects/instance_tasks/buttons/instance_new.button.js +3 -0
  11. package/main/default/objects/instance_tasks/buttons/instance_new.button.yml +1 -1
  12. package/main/default/objects/instances/buttons/instance_cc.button.yml +1 -0
  13. package/main/default/objects/instances/buttons/instance_delete.button.yml +1 -1
  14. package/main/default/objects/instances/buttons/instance_distribute.button.yml +2 -1
  15. package/main/default/objects/instances/buttons/instance_export.button.js +1 -6
  16. package/main/default/objects/instances/buttons/instance_export.button.yml +12 -9
  17. package/main/default/objects/instances/buttons/instance_forward.button.yml +2 -1
  18. package/main/default/objects/instances/buttons/instance_new.button.js +3 -0
  19. package/main/default/objects/instances/buttons/instance_reassign.button.yml +2 -1
  20. package/main/default/objects/instances/buttons/instance_relocate.button.yml +3 -1
  21. package/main/default/objects/instances/buttons/instance_return.button.yml +1 -0
  22. package/main/default/objects/instances/buttons/instance_terminate.button.yml +1 -0
  23. package/main/default/objects/instances/listviews/monitor.listview.yml +13 -0
  24. package/main/default/objects/instances/listviews/outbox.listview.yml +36 -0
  25. package/main/default/routes/api_workflow_instance_terminate.router.js +26 -27
  26. package/main/default/routes/api_workflow_nav.router.js +65 -55
  27. package/main/default/routes/api_workflow_reassign.router.js +20 -17
  28. package/main/default/routes/api_workflow_redirect.router.js +11 -1
  29. package/main/default/routes/api_workflow_relocate.router.js +9 -4
  30. package/package.json +1 -1
  31. package/public/amis-renderer/amis-renderer.js +1 -1
  32. package/src/instance_record_queue.js +142 -12
  33. package/src/rests/badgeRecalcExecute.js +7 -11
@@ -100,45 +100,115 @@ const getFieldOdataValue = async (objName, id, referenceToFieldName) => {
100
100
  return;
101
101
  };
102
102
 
103
- const getSelectUserValue = (userId, spaceId) => {
104
- const su = Creator.getCollection('space_users').findOne({ space: spaceId, user: userId });
105
- su.id = userId;
106
- return su;
103
+ const getSelectUserValue = async (userId, spaceId) => {
104
+ const coll = await getCollection('space_users');
105
+ const su = await coll.findOne({ space: spaceId, user: userId });
106
+ if (su) {
107
+ su.id = userId;
108
+ return su;
109
+ }
110
+ return null;
107
111
  };
108
112
 
109
- const getSelectUserValues = (userIds, spaceId) => {
113
+ const getSelectUserValues = async (userIds, spaceId) => {
110
114
  const sus = [];
111
- if (_.isArray(userIds)) {
112
- _.each(userIds, (userId) => {
113
- const su = getSelectUserValue(userId, spaceId);
114
- if (su) {
115
- sus.push(su);
115
+
116
+ // 处理多种输入格式
117
+ if (!userIds) {
118
+ return sus;
119
+ }
120
+
121
+ let idArray = [];
122
+ if (typeof userIds === 'string') {
123
+ // 字符串:单个 ID 或逗号分隔的 ID 列表
124
+ idArray = userIds.includes(',')
125
+ ? userIds.split(',').map(id => id.trim()).filter(id => id)
126
+ : [userIds];
127
+ } else if (Array.isArray(userIds)) {
128
+ // 数组:可能是字符串数组或对象数组
129
+ idArray = userIds.map(item => {
130
+ if (typeof item === 'string') {
131
+ return item.trim();
132
+ } else if (typeof item === 'object' && item !== null) {
133
+ // 对象格式:{id, ...} 或 {_id, ...} 或 {user, ...}
134
+ return item.id || item._id || item.user;
116
135
  }
117
- });
136
+ return null;
137
+ }).filter(id => id);
138
+ } else if (typeof userIds === 'object' && userIds !== null) {
139
+ // 单个对象:{id, ...}
140
+ const userId = userIds.id || userIds._id || userIds.user;
141
+ if (userId) {
142
+ idArray = [userId];
143
+ }
118
144
  }
145
+
146
+ // 获取用户详细信息
147
+ for (const userId of idArray) {
148
+ const su = await getSelectUserValue(userId, spaceId);
149
+ if (su) {
150
+ sus.push(su);
151
+ }
152
+ }
153
+
119
154
  return sus;
120
155
  };
121
156
 
122
- const getSelectOrgValue = (orgId, spaceId) => {
123
- const org = Creator.getCollection('organizations').findOne(orgId, { fields: { _id: 1, name: 1, fullname: 1 } });
124
- org.id = orgId;
125
- return org;
157
+ const getSelectOrgValue = async (orgId, spaceId) => {
158
+ const coll = await getCollection('organizations');
159
+ const org = await coll.findOne(orgId, { fields: { _id: 1, name: 1, fullname: 1 } });
160
+ if (org) {
161
+ org.id = orgId;
162
+ return org;
163
+ }
164
+ return null;
126
165
  };
127
166
 
128
- const getSelectOrgValues = (orgIds, spaceId) => {
167
+ const getSelectOrgValues = async (orgIds, spaceId) => {
129
168
  const orgs = [];
130
- if (_.isArray(orgIds)) {
131
- _.each(orgIds, (orgId) => {
132
- const org = getSelectOrgValue(orgId, spaceId);
133
- if (org) {
134
- orgs.push(org);
169
+
170
+ // 处理多种输入格式
171
+ if (!orgIds) {
172
+ return orgs;
173
+ }
174
+
175
+ let idArray = [];
176
+ if (typeof orgIds === 'string') {
177
+ // 字符串:单个 ID 或逗号分隔的 ID 列表
178
+ idArray = orgIds.includes(',')
179
+ ? orgIds.split(',').map(id => id.trim()).filter(id => id)
180
+ : [orgIds];
181
+ } else if (Array.isArray(orgIds)) {
182
+ // 数组:可能是字符串数组或对象数组
183
+ idArray = orgIds.map(item => {
184
+ if (typeof item === 'string') {
185
+ return item.trim();
186
+ } else if (typeof item === 'object' && item !== null) {
187
+ // 对象格式:{id, ...} 或 {_id, ...}
188
+ return item.id || item._id;
135
189
  }
136
- });
190
+ return null;
191
+ }).filter(id => id);
192
+ } else if (typeof orgIds === 'object' && orgIds !== null) {
193
+ // 单个对象:{id, ...}
194
+ const orgId = orgIds.id || orgIds._id;
195
+ if (orgId) {
196
+ idArray = [orgId];
197
+ }
198
+ }
199
+
200
+ // 获取组织详细信息
201
+ for (const orgId of idArray) {
202
+ const org = await getSelectOrgValue(orgId, spaceId);
203
+ if (org) {
204
+ orgs.push(org);
205
+ }
137
206
  }
207
+
138
208
  return orgs;
139
209
  };
140
210
 
141
- const getFileFieldValue = (recordFieldId, fType) => {
211
+ const getFileFieldValue = async (recordFieldId, fType) => {
142
212
  if (_.isEmpty(recordFieldId)) {
143
213
  return;
144
214
  }
@@ -154,7 +224,8 @@ const getFileFieldValue = (recordFieldId, fType) => {
154
224
  } else {
155
225
  query = { _id: { $in: recordFieldId } };
156
226
  }
157
- const files = Creator.Collections[`cfs.${collection}.filerecord`].find(query);
227
+ const coll = await getCollection(`cfs.${collection}.filerecord`);
228
+ const files = await coll.find(query).toArray();
158
229
  const value = [];
159
230
  files.forEach((f) => {
160
231
  const newFile = new FS.File();
@@ -200,27 +271,26 @@ const getInstanceFieldValue = (objField, formField, record, object_field, spaceI
200
271
  odataFieldValue = getFieldOdataValue(referenceToObjectName, recordFieldValue, referenceToFieldName);
201
272
  }
202
273
  value = odataFieldValue;
203
- } else if (formField && objField && ['user', 'group'].includes(formField.type) && ['lookup', 'master_detail'].includes(objField.type) && (['users', 'organizations'].includes(objField.reference_to) || ('space_users' == objField.reference_to && 'user' == objField.reference_to_field))) {
274
+ }
275
+ // 对象的 lookup/master_detail 字段(users/space_users reference_to)→ 审批单的 member/memberMulti 字段
276
+ else if (formField && objField && (formField.type === 'user' || formField.code === 'member' || formField.code === 'memberMulti')
277
+ && ['lookup', 'master_detail'].includes(objField.type)
278
+ && ['users', 'space_users'].includes(objField.reference_to)) {
204
279
  if (!_.isEmpty(recordFieldValue)) {
205
- let selectFieldValue;
206
- if (formField.type == 'user') {
207
- if (objField.multiple && formField.is_multiselect) {
208
- selectFieldValue = getSelectUserValues(recordFieldValue, spaceId);
209
- } else if (!objField.multiple && !formField.is_multiselect) {
210
- selectFieldValue = getSelectUserValue(recordFieldValue, spaceId);
211
- }
212
- } else if (formField.type == 'group') {
213
- if (objField.multiple && formField.is_multiselect) {
214
- selectFieldValue = getSelectOrgValues(recordFieldValue, spaceId);
215
- } else if (!objField.multiple && !formField.is_multiselect) {
216
- selectFieldValue = getSelectOrgValue(recordFieldValue, spaceId);
217
- }
218
- }
219
- if (selectFieldValue) {
220
- value = selectFieldValue;
221
- }
280
+ // recordFieldValue 可能是字符串、字符数组、或 ID 数组,都统一处理
281
+ value = getSelectUserValues(recordFieldValue, spaceId);
282
+ }
283
+ }
284
+ // 对象的 lookup/master_detail 字段(organizations reference_to)→ 审批单的 org/orgMulti 字段
285
+ else if (formField && objField && (formField.type === 'group' || formField.code === 'org' || formField.code === 'orgMulti')
286
+ && ['lookup', 'master_detail'].includes(objField.type)
287
+ && objField.reference_to === 'organizations') {
288
+ if (!_.isEmpty(recordFieldValue)) {
289
+ // recordFieldValue 可能是字符串、字符数组、或 ID 数组,都统一处理
290
+ value = getSelectOrgValues(recordFieldValue, spaceId);
222
291
  }
223
- } else if (formField && objField && formField.type == 'date' && recordFieldValue) {
292
+ }
293
+ else if (formField && objField && formField.type == 'date' && recordFieldValue) {
224
294
  value = uuflowManagerForInitApproval.formatDate(recordFieldValue);
225
295
  } else if (formField && objField && formField.type == 'time' && recordFieldValue) {
226
296
  value = uuflowManagerForInitApproval.formatTime(recordFieldValue);
@@ -256,7 +326,7 @@ const checkRequiredDetails = (requiredDetails, masterRecord) => {
256
326
 
257
327
  const uuflowManagerForInitApproval = {};
258
328
 
259
- uuflowManagerForInitApproval.check_authorization = (req) => {
329
+ uuflowManagerForInitApproval.check_authorization = async (req) => {
260
330
  const query = req.query;
261
331
  const userId = query["X-User-Id"];
262
332
  const authToken = query["X-Auth-Token"];
@@ -265,17 +335,22 @@ uuflowManagerForInitApproval.check_authorization = (req) => {
265
335
  throw new Error(401, 'Unauthorized');
266
336
  }
267
337
 
268
- const hashedToken = Accounts._hashLoginToken(authToken);
269
- const user = Meteor.users.findOne({
270
- _id: userId,
271
- "services.resume.loginTokens.hashedToken": hashedToken
272
- });
338
+ // 使用 objectql 查询 users 对象
339
+ try {
340
+ const users = await objectql.getObject('users').find({
341
+ filters: [['_id', '=', userId]],
342
+ fields: ['_id', 'username']
343
+ });
344
+
345
+ if (!users || users.length === 0) {
346
+ throw new Error(401, 'Unauthorized');
347
+ }
273
348
 
274
- if (!user) {
349
+ const user = users[0];
350
+ return user;
351
+ } catch (error) {
275
352
  throw new Error(401, 'Unauthorized');
276
353
  }
277
-
278
- return user;
279
354
  };
280
355
 
281
356
  uuflowManagerForInitApproval.getSpace = async (space_id) => {
@@ -710,38 +785,47 @@ uuflowManagerForInitApproval.evalFieldMapScript = (field_map_script, objectName,
710
785
  return {};
711
786
  };
712
787
 
713
- uuflowManagerForInitApproval.initiateAttach = (recordIds, spaceId, insId, approveId) => {
714
- Creator.Collections['cms_files'].find({
788
+ uuflowManagerForInitApproval.initiateAttach = async (recordIds, spaceId, insId, approveId) => {
789
+ const cfsColl = await getCollection('cms_files');
790
+ const cfsFileRecordColl = await getCollection('cfs.files.filerecord');
791
+
792
+ const cmsFiles = await cfsColl.find({
715
793
  space: spaceId,
716
794
  parent: recordIds
717
- }).forEach((cf) => {
718
- _.each(cf.versions, (versionId, idx) => {
719
- const f = Creator.Collections['cfs.files.filerecord'].findOne(versionId);
720
- const newFile = new FS.File();
721
- newFile.attachData(f.createReadStream('files'), {
722
- type: f.original.type
723
- }, (err) => {
724
- if (err) {
725
- throw new Error(err.error, err.reason);
726
- }
727
- newFile.name(f.name());
728
- newFile.size(f.size());
729
- const metadata = {
730
- owner: f.metadata.owner,
731
- owner_name: f.metadata.owner_name,
732
- space: spaceId,
733
- instance: insId,
734
- approve: approveId,
735
- parent: cf._id
736
- };
737
- if (idx === 0) {
738
- metadata.current = true;
739
- }
740
- newFile.metadata = metadata;
741
- cfs.instances.insert(newFile);
742
- });
743
- });
744
- });
795
+ }).toArray();
796
+
797
+ for (const cf of cmsFiles) {
798
+ for (let idx = 0; idx < cf.versions.length; idx++) {
799
+ const versionId = cf.versions[idx];
800
+ const f = await cfsFileRecordColl.findOne(versionId);
801
+
802
+ if (f) {
803
+ const newFile = new FS.File();
804
+ newFile.attachData(f.createReadStream('files'), {
805
+ type: f.original.type
806
+ }, (err) => {
807
+ if (err) {
808
+ throw new Error(err.error, err.reason);
809
+ }
810
+ newFile.name(f.name());
811
+ newFile.size(f.size());
812
+ const metadata = {
813
+ owner: f.metadata.owner,
814
+ owner_name: f.metadata.owner_name,
815
+ space: spaceId,
816
+ instance: insId,
817
+ approve: approveId,
818
+ parent: cf._id
819
+ };
820
+ if (idx === 0) {
821
+ metadata.current = true;
822
+ }
823
+ newFile.metadata = metadata;
824
+ cfs.instances.insert(newFile);
825
+ });
826
+ }
827
+ }
828
+ }
745
829
  return;
746
830
  };
747
831
 
@@ -757,28 +841,38 @@ uuflowManagerForInitApproval.initiateRecordInstanceInfo = async (recordIds, insI
757
841
  return;
758
842
  };
759
843
 
760
- uuflowManagerForInitApproval.initiateRelatedRecordInstanceInfo = (relatedTablesInfo, insId, spaceId) => {
761
- _.each(relatedTablesInfo, (tableItems, relatedObjectName) => {
762
- const relatedCollection = Creator.getCollection(relatedObjectName, spaceId);
763
- _.each(tableItems, (item) => {
764
- relatedCollection.direct.update(item._table._id, {
765
- $set: {
766
- instances: [{
767
- _id: insId,
768
- state: 'draft'
769
- }],
770
- _table: item._table
844
+ uuflowManagerForInitApproval.initiateRelatedRecordInstanceInfo = async (relatedTablesInfo, insId, spaceId) => {
845
+ for (const [relatedObjectName, tableItems] of Object.entries(relatedTablesInfo)) {
846
+ const relatedColl = await getCollection(relatedObjectName);
847
+ for (const item of tableItems) {
848
+ await relatedColl.updateOne(
849
+ { _id: item._table._id },
850
+ {
851
+ $set: {
852
+ instances: [{
853
+ _id: insId,
854
+ state: 'draft'
855
+ }],
856
+ _table: item._table
857
+ }
771
858
  }
772
- });
773
- });
774
- });
859
+ );
860
+ }
861
+ }
775
862
  return;
776
863
  };
777
864
 
778
865
  uuflowManagerForInitApproval.checkIsInApproval = async (recordIds, spaceId) => {
779
866
  const record = await objectFindOne(recordIds.o, { filters: [['_id', '=', recordIds.ids[0]]], fields: ['instances'] });
780
- if (record && record.instances && record.instances[0].state !== 'completed' && Creator.Collections.instances.find(record.instances[0]._id).count() > 0) {
781
- throw new Error('error!', "此记录已发起流程正在审批中,待审批结束方可发起下一次审批!");
867
+ if (record && record.instances && record.instances[0].state !== 'completed') {
868
+ // 使用 objectql 查询 instances 集合
869
+ const instances = await objectql.getObject('instances').find({
870
+ filters: [['_id', '=', record.instances[0]._id]],
871
+ fields: ['_id']
872
+ });
873
+ if (instances && instances.length > 0) {
874
+ throw new Error('error!', "此记录已发起流程正在审批中,待审批结束方可发起下一次审批!");
875
+ }
782
876
  }
783
877
  return;
784
878
  };
@@ -4493,6 +4493,7 @@ UUFlowManager.relocate = async function (instance_from_client, current_user_info
4493
4493
 
4494
4494
  // Verify permissions
4495
4495
  const permissions = await PermissionManager.getFlowPermissions(instance.flow, current_user);
4496
+
4496
4497
  const space = await db.spaces.findOne(
4497
4498
  { _id: instance.space },
4498
4499
  { projection: { admins: 1 } }
@@ -4560,9 +4561,9 @@ UUFlowManager.relocate = async function (instance_from_client, current_user_info
4560
4561
  let signShowApproveId = null;
4561
4562
 
4562
4563
  for (let l = sameTraces.length - 1; l >= 0; l--) {
4563
- const found = sameTraces[l].approves.find(a =>
4564
- a.user === traces[i].approves[h].user &&
4565
- a.judge !== "terminated" &&
4564
+ const found = sameTraces[l].approves.find(a =>
4565
+ a.user === traces[i].approves[h].user &&
4566
+ a.judge !== "terminated" &&
4566
4567
  a.description
4567
4568
  );
4568
4569
  if (found) {
@@ -4725,7 +4726,7 @@ UUFlowManager.relocate = async function (instance_from_client, current_user_info
4725
4726
  setObj.traces = traces;
4726
4727
 
4727
4728
  // Update instance
4728
- const updateOperation = setObj.state === 'completed'
4729
+ const updateOperation = setObj.state === 'completed'
4729
4730
  ? { $set: setObj }
4730
4731
  : { $set: setObj, $unset: { finish_date: 1 } };
4731
4732
 
@@ -4739,46 +4740,44 @@ UUFlowManager.relocate = async function (instance_from_client, current_user_info
4739
4740
  await remove_many_instance_tasks(finishedApproveIds);
4740
4741
  if (newTrace.approves?.length) {
4741
4742
  await insert_many_instance_tasks(
4742
- instance_id,
4743
- newTrace._id,
4743
+ instance_id,
4744
+ newTrace._id,
4744
4745
  newTrace.approves.map(a => a._id)
4745
4746
  );
4746
4747
  }
4747
4748
 
4748
4749
  const updatedInstance = await UUFlowManager.getInstance(instance_id);
4749
4750
 
4750
- // Send notifications
4751
- await pushManager.send_message_current_user(current_user_info);
4752
- await Promise.all(not_in_inbox_users
4753
- .filter(user_id => user_id !== current_user)
4754
- .map(user_id => pushManager.send_message_to_specifyUser("current_user", user_id))
4755
- );
4756
-
4751
+ // Send notifications (并行)
4757
4752
  const notifyUsers = [...new Set([
4758
4753
  updatedInstance.applicant,
4759
4754
  updatedInstance.submitter,
4760
4755
  ...(updatedInstance.outbox_users || [])
4761
4756
  ])];
4762
4757
 
4763
- await Promise.all(notifyUsers.map(user_id =>
4764
- pushManager.send_message_to_specifyUser("current_user", user_id)
4765
- ));
4766
-
4767
- await pushManager.send_instance_notification(
4768
- "reassign_new_inbox_users",
4769
- updatedInstance,
4770
- relocate_comment,
4771
- current_user_info
4772
- );
4773
-
4774
- await pushManager.triggerWebhook(
4775
- updatedInstance.flow,
4776
- updatedInstance,
4777
- {},
4778
- 'relocate',
4779
- current_user,
4780
- updatedInstance.inbox_users
4781
- );
4758
+ await Promise.all([
4759
+ pushManager.send_message_current_user(current_user_info),
4760
+ ...not_in_inbox_users
4761
+ .filter(user_id => user_id !== current_user)
4762
+ .map(user_id => pushManager.send_message_to_specifyUser("current_user", user_id)),
4763
+ ...notifyUsers.map(user_id =>
4764
+ pushManager.send_message_to_specifyUser("current_user", user_id)
4765
+ ),
4766
+ pushManager.send_instance_notification(
4767
+ "reassign_new_inbox_users",
4768
+ updatedInstance,
4769
+ relocate_comment,
4770
+ current_user_info
4771
+ ),
4772
+ pushManager.triggerWebhook(
4773
+ updatedInstance.flow,
4774
+ updatedInstance,
4775
+ {},
4776
+ 'relocate',
4777
+ current_user,
4778
+ updatedInstance.inbox_users
4779
+ )
4780
+ ]);
4782
4781
  }
4783
4782
 
4784
4783
  return result;
@@ -181,6 +181,8 @@ actions:
181
181
  label: Delete
182
182
  instance_delete_many:
183
183
  label: Delete
184
+ instance_export:
185
+ label: Export
184
186
  CustomLabels:
185
187
  instance_action_new_dialog_title: Please select the process
186
188
  instance_action_new_dialog_msg_success: Created successfully!
@@ -209,4 +211,11 @@ CustomLabels:
209
211
  instance_action_relocate_dialog_msg_success: Relocated successful
210
212
  instance_action_relocate_dialog_msg_failed: Relocated failed
211
213
  instance_action_instance_save_msg_upgraded: The workflow has been upgraded. The page will refresh automatically.
214
+ instance_export_tooltip: Export to Excel after selecting a workflow
215
+ instance_export_msg_no_flow: Please select a workflow to export
216
+ instance_export_msg_max_flow: Export up to 5 workflows at a time
217
+ instance_export_this_month: This Month
218
+ instance_export_last_month: Last Month
219
+ instance_export_this_year: This Year
220
+ instance_export_all: All
212
221
 
@@ -179,6 +179,8 @@ actions:
179
179
  label: 新建
180
180
  instance_delete_many:
181
181
  label: 删除
182
+ instance_export:
183
+ label: 导出
182
184
  CustomLabels:
183
185
  instance_action_new_dialog_title: 请选择流程
184
186
  instance_action_new_dialog_msg_success: 创建成功!
@@ -207,3 +209,10 @@ CustomLabels:
207
209
  instance_action_relocate_dialog_msg_success: 重定位成功
208
210
  instance_action_relocate_dialog_msg_failed: 重定位失败
209
211
  instance_action_instance_save_msg_upgraded: 流程已升级,页面将自动刷新。
212
+ instance_export_tooltip: 选择流程后可导出为Excel
213
+ instance_export_msg_no_flow: 请先选择要导出的流程
214
+ instance_export_msg_max_flow: 最多导出5个流程
215
+ instance_export_this_month: 本月
216
+ instance_export_last_month: 上月
217
+ instance_export_this_year: 本年度
218
+ instance_export_all: 所有
@@ -9,6 +9,9 @@ module.exports = {
9
9
  if (data && data._isRelated) {
10
10
  return false;
11
11
  }
12
+ if (typeof Builder !== 'undefined' && Builder.settings && Builder.settings.STEEDOS_PUBLIC_WORKFLOW_READONLY === 'true'){
13
+ return false;
14
+ }
12
15
  return true;
13
16
  }
14
17
  }
@@ -56,7 +56,7 @@ amis_schema: |-
56
56
  },
57
57
  {
58
58
  "actionType": "custom",
59
- "script": "\nconst {instance, appId, objectName} = event.data;\nconsole.log(`instance===`);doAction({\n actionType: 'link',\n args: {\n blank: false,\n url: `/app/${appId}/instances/view/${instance._id}?side_object=instances&side_listview_id=draft&additionalFilters=&flowId=&categoryId=`\n }\n});\n"
59
+ "script": "\nconst {instance, appId, objectName} = event.data;\nconsole.log(`instance===`);doAction({\n actionType: 'link',\n args: {\n blank: false,\n link: `/app/${appId}/instances/view/${instance._id}?side_object=instances&side_listview_id=draft&additionalFilters=&flowId=&categoryId=`\n }\n});\n"
60
60
  },
61
61
  {
62
62
  "componentId": "",
@@ -15,6 +15,7 @@ amis_schema: |-
15
15
  "actionType": "dialog",
16
16
  "dialog": {
17
17
  "type": "dialog",
18
+ "className": "instance-action-dialog",
18
19
  "title": "${'CustomAction.instances.instance_cc' | t}",
19
20
  "body": [
20
21
  {
@@ -48,7 +48,7 @@ amis_schema: |-
48
48
  }
49
49
  },
50
50
  "confirmText": "${'CustomLabels.confirm_delete' | t}",
51
- "hiddenOn": "!(record.box == 'draft' || (record.box == 'monitor' && context.user.is_space_admin) \n || (_.includes(record.flow.perms.users_can_admin, context.user.userId) \n || _.intersection(record.flow.perms.orgs_can_admin, context.user.organizations_parents) > 0)\n || (record.box == 'inbox' && record.state == 'draft' && record.forward_from_instance))"
51
+ "hiddenOn": "(window.Builder && window.Builder.settings && window.Builder.settings.STEEDOS_PUBLIC_WORKFLOW_READONLY === 'true') || !(record.box == 'draft' || (record.box == 'monitor' && context.user.is_space_admin) \n || (_.includes(record.flow.perms.users_can_admin, context.user.userId) \n || _.intersection(record.flow.perms.orgs_can_admin, context.user.organizations_parents) > 0)\n || (record.box == 'inbox' && record.state == 'draft' && record.forward_from_instance))"
52
52
  }
53
53
  ],
54
54
  "regions": [
@@ -21,6 +21,7 @@ amis_schema: |-
21
21
  "actionType": "dialog",
22
22
  "dialog": {
23
23
  "type": "dialog",
24
+ "className": "instance-action-dialog",
24
25
  "size": "lg",
25
26
  "showLoading": true,
26
27
  "title": {
@@ -299,7 +300,7 @@ amis_schema: |-
299
300
  "weight": 0
300
301
  }
301
302
  },
302
- "hiddenOn": "!(record.box === 'inbox' && record.step.allowDistribute == true)"
303
+ "hiddenOn": "!(record.box === 'inbox' && record.step.allowDistribute == true) || (window.Builder && window.Builder.settings && window.Builder.settings.STEEDOS_PUBLIC_WORKFLOW_READONLY === 'true')"
303
304
  }
304
305
  ],
305
306
  "regions": [
@@ -1,10 +1,5 @@
1
1
  module.exports = {
2
2
  instance_exportVisible: function (object_name, record_id, record_permissions, data) {
3
- var box = data.listName;
4
- var flowId = data.flowId;
5
- if (box === "monitor" && flowId) {
6
- return true;
7
- }
8
- return false;
3
+ return data.listName === "monitor";
9
4
  }
10
5
  }