@steedos-labs/plugin-workflow 3.0.2 → 3.0.4

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.
@@ -0,0 +1,120 @@
1
+ ; (function () {
2
+ // 全局配置
3
+ window.instancePrint = window.instancePrint || {
4
+ step: 1,
5
+
6
+ /**
7
+ * 增加字体大小
8
+ * @param {jQuery} node - jQuery节点
9
+ */
10
+ plusFontSize: function(node) {
11
+ adjustFontSize(node, true);
12
+ },
13
+
14
+ /**
15
+ * 减少字体大小
16
+ * @param {jQuery} node - jQuery节点
17
+ */
18
+ minusFontSize: function(node) {
19
+ adjustFontSize(node, false);
20
+ }
21
+ };
22
+
23
+ /**
24
+ * 调整字体大小的核心函数
25
+ * @param {jQuery} node - jQuery节点
26
+ * @param {boolean} isIncrease - 是否为增加操作
27
+ */
28
+ function adjustFontSize(node, isIncrease) {
29
+ if (!node || !node.children || !_.isFunction(node.children)) {
30
+ return;
31
+ }
32
+
33
+ node.children().each((i, n) => {
34
+ const $child = $(n);
35
+
36
+ // 跳过不需要处理的标签
37
+ if ($child.prop("tagName") === "STYLE") {
38
+ return;
39
+ }
40
+
41
+ // 检查是否需要处理该元素
42
+ if (shouldProcessElement($child)) {
43
+ adjustElementFontSize($child, isIncrease);
44
+ }
45
+
46
+ // 递归处理子元素
47
+ if (shouldRecurse($child)) {
48
+ adjustFontSize($child, isIncrease);
49
+ }
50
+ });
51
+ }
52
+
53
+ /**
54
+ * 判断是否应该处理该元素
55
+ * @param {jQuery} $el - jQuery元素
56
+ * @returns {boolean}
57
+ */
58
+ function shouldProcessElement($el) {
59
+ // 检查是否有文本内容
60
+ const hasTextContent = $el.contents()
61
+ .filter(function() { return this.nodeType === 3; })
62
+ .text()
63
+ .trim().length > 0;
64
+
65
+ // 检查是否为输入元素
66
+ const isInputElement = _.includes(["INPUT", "TEXTAREA"], $el.prop("tagName"));
67
+
68
+ return hasTextContent || isInputElement;
69
+ }
70
+
71
+ /**
72
+ * 调整单个元素的字体大小
73
+ * @param {jQuery} $el - jQuery元素
74
+ * @param {boolean} isIncrease - 是否为增加操作
75
+ */
76
+ function adjustElementFontSize($el, isIncrease) {
77
+ const fontSize = $el.css("font-size");
78
+ const parentFontSize = $el.parent().prop("style")?.fontSize;
79
+
80
+ // 检查是否有独立的字体大小设置
81
+ if (!fontSize || fontSize === parentFontSize) {
82
+ return;
83
+ }
84
+
85
+ // 解析当前字体大小
86
+ const match = fontSize.match(/^([\d.]+)(px|pt|em|rem|%)$/);
87
+ if (!match) {
88
+ return;
89
+ }
90
+
91
+ const [, valueStr, unit] = match;
92
+ const currentValue = parseFloat(valueStr);
93
+
94
+ if (_.isNaN(currentValue)) {
95
+ return;
96
+ }
97
+
98
+ // 计算新的字体大小
99
+ const step = window.instancePrint.step || 1;
100
+ const newValue = isIncrease ? currentValue + step : currentValue - step;
101
+
102
+ // 设置新的字体大小(确保最小值)
103
+ if (newValue > 0) {
104
+ $el.css("font-size", `${newValue}${unit}`);
105
+ }
106
+ }
107
+
108
+ /**
109
+ * 判断是否应该递归处理子元素
110
+ * @param {jQuery} $el - jQuery元素
111
+ * @returns {boolean}
112
+ */
113
+ function shouldRecurse($el) {
114
+ const children = $el.children();
115
+ const brCount = $el.children("br").length;
116
+
117
+ return children.length > 0 && brCount < children.length;
118
+ }
119
+ })();
120
+
@@ -233,7 +233,7 @@ async function upgradeFlow(flowCome, userId, flowId) {
233
233
  updateObj.$set.modified_by = userId;
234
234
  updateObj.$set.events = flowCome['events'] || '';
235
235
 
236
- const form = await formCollection.findOne(flow.form, { projection: { category: 1 } });
236
+ const form = await formCollection.findOne({ _id: flow.form }, { projection: { category: 1 } });
237
237
  updateObj.$set.category = form['category'];
238
238
 
239
239
  return flowCollection.updateOne({ _id: flowId }, updateObj);
@@ -0,0 +1,134 @@
1
+ name: copy_flow
2
+ amis_schema: |-
3
+ {
4
+ "type": "service",
5
+ "body": [
6
+ {
7
+ "type": "button",
8
+ "label": "复制流程",
9
+ "id": "u:copy_flow",
10
+ "editorState": "default",
11
+ "onEvent": {
12
+ "click": {
13
+ "weight": 0,
14
+ "actions": [
15
+ {
16
+ "ignoreError": false,
17
+ "actionType": "dialog",
18
+ "dialog": {
19
+ "type": "dialog",
20
+ "title": "复制流程",
21
+ "body": [
22
+ {
23
+ "type": "form",
24
+ "label": "对象表单",
25
+ "recordId": "",
26
+ "mode": "edit",
27
+ "enableInitApi": false,
28
+ "className": "",
29
+ "id": "u:e7d13bb946af",
30
+ "layout": "horizontal",
31
+ "enableTabs": false,
32
+ "tabsMode": "",
33
+ "body": [
34
+ {
35
+ "type": "input-text",
36
+ "label": "${'flows.standard_new.flow_name' | t}",
37
+ "name": "copy_name",
38
+ "id": "u:4af5bdaa813a",
39
+ "required": false,
40
+ "labelClassName": "text-left",
41
+ "className": "mt-3",
42
+ "editorState": "default"
43
+ },
44
+ {
45
+ "type": "steedos-field",
46
+ "className": "mb-3",
47
+ "config": {
48
+ "name": "copy_company_id",
49
+ "type": "lookup",
50
+ "reference_to": "company",
51
+ "label": "${'flows.standard_new.division' | t}",
52
+ "object": "flows",
53
+ "deleted_lookup_record_behavior": "clear"
54
+ },
55
+ "id": "u:64bb2afaefd1"
56
+ }
57
+ ],
58
+ "feat": "Insert",
59
+ "api": {
60
+ "method": "post",
61
+ "url": "${context.rootUrl}/api/workflow/flow_copy",
62
+ "data": {
63
+ "flowId": "${recordId}",
64
+ "&": "$$"
65
+ },
66
+ "requestAdaptor": "const { copy_name, copy_company_id, flowId } = api.body;\n\napi.data = {\n flowId,\n options: {\n name: copy_name,\n company_id: copy_company_id,\n }\n\n};\n\nreturn api;",
67
+ "adaptor": "",
68
+ "messages": {}
69
+ },
70
+ "actions": [
71
+ {
72
+ "type": "submit",
73
+ "label": "提交",
74
+ "primary": true
75
+ }
76
+ ],
77
+ "dsType": "api",
78
+ "canAccessSuperData": false
79
+ }
80
+ ],
81
+ "id": "u:e77ebd5faad5",
82
+ "actions": [
83
+ {
84
+ "type": "button",
85
+ "actionType": "cancel",
86
+ "label": "取消",
87
+ "id": "u:a670fb5670ac"
88
+ },
89
+ {
90
+ "type": "button",
91
+ "actionType": "confirm",
92
+ "label": "确定",
93
+ "primary": true,
94
+ "id": "u:f5f7ad9b30ff"
95
+ }
96
+ ],
97
+ "showCloseButton": true,
98
+ "closeOnOutside": false,
99
+ "closeOnEsc": false,
100
+ "showErrorMsg": true,
101
+ "showLoading": true,
102
+ "draggable": false,
103
+ "actionType": "dialog",
104
+ "size": "lg",
105
+ "inputParams": {
106
+ "type": "object",
107
+ "properties": {},
108
+ "required": []
109
+ }
110
+ }
111
+ }
112
+ ]
113
+ }
114
+ }
115
+ }
116
+ ],
117
+ "data": {
118
+ "context": {},
119
+ "dataComponentId": "",
120
+ "record_id": "",
121
+ "record": {},
122
+ "permissions": {}
123
+ },
124
+ "id": "u:c8964758ae87",
125
+ "bodyClassName": "p-0",
126
+ "dsType": "api",
127
+ "definitions": {}
128
+ }
129
+ is_enable: true
130
+ label: 复制流程
131
+ locked: false
132
+ 'on': record_more
133
+ type: amis_button
134
+ visible: true
@@ -0,0 +1,149 @@
1
+ name: upgrade_flow
2
+ amis_schema: |-
3
+ {
4
+ "type": "service",
5
+ "body": [
6
+ {
7
+ "type": "button",
8
+ "label": "导入流程(升级)",
9
+ "id": "u:upgrade_flow",
10
+ "editorState": "default",
11
+ "onEvent": {
12
+ "click": {
13
+ "weight": 0,
14
+ "actions": [
15
+ {
16
+ "ignoreError": false,
17
+ "actionType": "dialog",
18
+ "dialog": {
19
+ "type": "dialog",
20
+ "title": "导入流程",
21
+ "body": [
22
+ {
23
+ "id": "u:3fd36519bbfe",
24
+ "type": "form",
25
+ "title": "表单",
26
+ "mode": "horizontal",
27
+ "dsType": "api",
28
+ "feat": "Insert",
29
+ "body": [
30
+ {
31
+ "name": "file",
32
+ "label": "流程文件",
33
+ "type": "input-file",
34
+ "id": "u:47177b9dfe46",
35
+ "btnLabel": "文件上传",
36
+ "multiple": false,
37
+ "uploadType": "asForm",
38
+ "proxy": false,
39
+ "autoUpload": true,
40
+ "useChunk": false,
41
+ "accept": ".json",
42
+ "drag": true,
43
+ "required": true,
44
+ "asBlob": true,
45
+ "formType": "asBlob"
46
+ }
47
+ ],
48
+ "api": {
49
+ "url": "${context.rootUrl}/api/workflow/import/form?space=${global.spaceId}&flowId=${recordId}",
50
+ "method": "post",
51
+ "requestAdaptor": "",
52
+ "adaptor": "",
53
+ "messages": {}
54
+ },
55
+ "actions": [
56
+ {
57
+ "type": "button",
58
+ "label": "提交",
59
+ "onEvent": {
60
+ "click": {
61
+ "actions": [
62
+ {
63
+ "actionType": "submit",
64
+ "componentId": "u:3fd36519bbfe"
65
+ }
66
+ ]
67
+ }
68
+ },
69
+ "level": "primary"
70
+ }
71
+ ],
72
+ "resetAfterSubmit": true,
73
+ "onEvent": {
74
+ "submitSucc": {
75
+ "weight": 0,
76
+ "actions": [
77
+ {
78
+ "actionType": "toast",
79
+ "args": {
80
+ "msgType": "success",
81
+ "position": "top-center",
82
+ "closeButton": true,
83
+ "showIcon": true,
84
+ "msg": "升级成功",
85
+ "className": "theme-toast-action-scope"
86
+ },
87
+ "ignoreError": false
88
+ },
89
+ {
90
+ "actionType": "broadcast",
91
+ "args": {
92
+ "eventName": "@data.changed.flows",
93
+ "recordId": "${recordId}"
94
+ }
95
+ }
96
+ ]
97
+ }
98
+ }
99
+ }
100
+ ],
101
+ "id": "u:86c7924f888a",
102
+ "actions": [
103
+ {
104
+ "type": "button",
105
+ "actionType": "cancel",
106
+ "label": "取消",
107
+ "id": "u:489b8a00f7ad"
108
+ },
109
+ {
110
+ "type": "button",
111
+ "actionType": "confirm",
112
+ "label": "确定",
113
+ "primary": true,
114
+ "id": "u:b7416af96743"
115
+ }
116
+ ],
117
+ "showCloseButton": true,
118
+ "closeOnOutside": false,
119
+ "closeOnEsc": false,
120
+ "showErrorMsg": true,
121
+ "showLoading": true,
122
+ "draggable": false,
123
+ "size": "lg",
124
+ "actionType": "dialog"
125
+ }
126
+ }
127
+ ]
128
+ }
129
+ }
130
+ }
131
+ ],
132
+ "data": {
133
+ "context": {},
134
+ "dataComponentId": "",
135
+ "record_id": "",
136
+ "record": {},
137
+ "permissions": {}
138
+ },
139
+ "bodyClassName": "p-0",
140
+ "id": "u:b91c18b3c1f8",
141
+ "dsType": "api",
142
+ "definitions": {}
143
+ }
144
+ is_enable: true
145
+ label: 导入流程(升级)
146
+ locked: false
147
+ 'on': record_more
148
+ type: amis_button
149
+ visible: true
@@ -1,7 +1,7 @@
1
1
  name: flows
2
2
  icon: environment_hub
3
3
  label: Workflow
4
- hidden: true
4
+ hidden: false
5
5
  enable_files: true
6
6
  enable_dataloader: false
7
7
  version: 2
@@ -887,34 +887,6 @@ actions:
887
887
  # toastr.warning("请选择要导出的流程");
888
888
  # }
889
889
  # }
890
- upgradeFlow:
891
- label: Upgrade Workflow
892
- visible: true
893
- 'on': record_more
894
- todo: !<tag:yaml.org,2002:js/function> |-
895
- function (object_name, record_id, fields) {
896
- return Modal.show("admin_import_flow_modal", {
897
- flowId: record_id,
898
- onSuccess: function () {
899
- toastr.success("流程升级成功")
900
- }
901
- });
902
- }
903
- copyFlow:
904
- label: Copy Workflow
905
- visible: true
906
- 'on': record_more
907
- todo: !<tag:yaml.org,2002:js/function> |-
908
- function (object_name, record_id, fields) {
909
- return Modal.show("copy_flow_modal", {
910
- record_id: record_id,
911
- onSuccess: function (flows) {
912
- if (flows.length > 0) {
913
- return FlowRouter.go("/app/admin/flows/view/" + flows[0]);
914
- }
915
- }
916
- });
917
- }
918
890
  relatedList:
919
891
  - cms_files
920
892
  - object_workflows
@@ -58,7 +58,7 @@ amis_schema: |-
58
58
  }
59
59
  },
60
60
  "confirmText": "${'CustomLabels.confirm_delete' | t}",
61
- "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 ) \n || (record.box == 'inbox' && record.state == 'draft' && record.forward_from_instance))"
61
+ "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))"
62
62
  }
63
63
  ],
64
64
  "regions": [
@@ -15,7 +15,7 @@ amis_schema: |-
15
15
  "ignoreError": false,
16
16
  "actionType": "url",
17
17
  "args": {
18
- "url": "/api/workflow/instances/print/${instanceId || record._id}"
18
+ "url": "/app/approve_workflow/page/page_instance_print?recordId=${instanceId || record._id}"
19
19
  }
20
20
  }
21
21
  ],
@@ -0,0 +1,311 @@
1
+ {
2
+ "type": "page",
3
+ "title": "Welcome to Steedos",
4
+ "toolbarClassName": "no-print",
5
+ "toolbar": [
6
+ {
7
+ "type": "grid",
8
+ "columns": [
9
+ {
10
+ "body": [
11
+ {
12
+ "type": "button",
13
+ "label": "打印",
14
+ "level": "primary",
15
+ "className": "mr-4",
16
+ "onEvent": {
17
+ "click": {
18
+ "actions": [
19
+ {
20
+ "actionType": "custom",
21
+ "script": "window.print()"
22
+ }
23
+ ]
24
+ }
25
+ }
26
+ },
27
+ {
28
+ "name": "files",
29
+ "type": "checkbox",
30
+ "label": false,
31
+ "option": "附件",
32
+ "mode": "inline",
33
+ "onEvent": {
34
+ "change": {
35
+ "actions": [
36
+ {
37
+ "actionType": "custom",
38
+ "script": "if(event.data.value){$('.instance-file-list').show()}else{$('.instance-file-list').hide()}"
39
+ }
40
+ ]
41
+ }
42
+ }
43
+ },
44
+ {
45
+ "name": "his",
46
+ "type": "checkbox",
47
+ "id": "u:his",
48
+ "label": false,
49
+ "option": "签核历程",
50
+ "mode": "inline",
51
+ "onEvent": {
52
+ "change": {
53
+ "actions": [
54
+ {
55
+ "actionType": "custom",
56
+ "script": "if(event.data.value){$('.instance-approve-history').show()}else{doAction({actionType: 'setValue', componentId: 'u:mini', args: {value: false}});$('.instance-approve-history').hide()}"
57
+ }
58
+ ]
59
+ }
60
+ }
61
+ },
62
+ {
63
+ "name": "mini",
64
+ "id": "u:mini",
65
+ "type": "checkbox",
66
+ "label": false,
67
+ "option": "精简",
68
+ "mode": "inline",
69
+ "onEvent": {
70
+ "change": {
71
+ "actions": [
72
+ {
73
+ "actionType": "custom",
74
+ "script": "if(event.data.value){doAction({actionType: 'setValue', componentId: 'u:his', args: {value: true}}); $('.steedos-amis-instance-view').addClass('simplify-traces'); $('.instance-approve-history').show()}else{$('.steedos-amis-instance-view').removeClass('simplify-traces');}"
75
+ }
76
+ ]
77
+ }
78
+ }
79
+ }
80
+ ]
81
+ },
82
+ {
83
+ "columnClassName": "text-end",
84
+ "body": [
85
+ {
86
+ "name": "radios",
87
+ "type": "radios",
88
+ "label": false,
89
+ "value": "210",
90
+ "className": "mr-0",
91
+ "options": [
92
+ {
93
+ "label": "A4纵向",
94
+ "value": "210"
95
+ },
96
+ {
97
+ "label": "A4横向",
98
+ "value": "297"
99
+ }
100
+ ],
101
+ "mode": "inline",
102
+ "onEvent": {
103
+ "change": {
104
+ "actions": [
105
+ {
106
+ "actionType": "custom",
107
+ "script": "doAction({actionType: 'setValue', componentId: 'u:print-width', args: {value: Number(event.data.value)}}); $('.steedos-instance-related-view-wrapper > .antd-Page-content').css('width', event.data.value + 'mm');"
108
+ }
109
+ ]
110
+ }
111
+ }
112
+ },
113
+ {
114
+ "name": "width",
115
+ "type": "input-number",
116
+ "id": "u:print-width",
117
+ "value": "210",
118
+ "mode": "inline",
119
+ "className": "w-20 mr-0",
120
+ "min": "100",
121
+ "onEvent": {
122
+ "change": {
123
+ "actions": [
124
+ {
125
+ "actionType": "custom",
126
+ "script": "$('.steedos-instance-related-view-wrapper > .antd-Page-content').css('width', event.data.value + 'mm');"
127
+ }
128
+ ]
129
+ }
130
+ }
131
+ },
132
+ {
133
+ "type": "tpl",
134
+ "tpl": "|",
135
+ "className": "text-gray-400 mx-4",
136
+ "mode": "inline"
137
+ },
138
+ {
139
+ "label": "",
140
+ "type": "button",
141
+ "icon": "fa fa-plus",
142
+ "mode": "inline",
143
+ "onEvent": {
144
+ "click": {
145
+ "actions": [
146
+ {
147
+ "actionType": "custom",
148
+ "script": "window.instancePrint.plusFontSize($('.steedos-amis-instance-view-body'))"
149
+ }
150
+ ]
151
+ }
152
+ }
153
+ },
154
+ {
155
+ "label": "",
156
+ "type": "button",
157
+ "icon": "fa fa-minus",
158
+ "mode": "inline",
159
+ "onEvent": {
160
+ "click": {
161
+ "actions": [
162
+ {
163
+ "actionType": "custom",
164
+ "script": "window.instancePrint.minusFontSize($('.steedos-amis-instance-view-body'))"
165
+ }
166
+ ]
167
+ }
168
+ }
169
+ }
170
+ ]
171
+ }
172
+ ]
173
+ }
174
+ ],
175
+ "body": [
176
+ {
177
+ "type": "wrapper",
178
+ "className": "steedos-instance-detail-wrapper m-0 p-0 flex-1 focus:outline-none lg:order-last sm:m-4 shadow sm:rounded",
179
+ "body": [
180
+ {
181
+ "type": "service",
182
+ "className": "h-full",
183
+ "body": [],
184
+ "id": "u:d6db0c84f150",
185
+ "dsType": "api",
186
+ "schemaApi": {
187
+ "method": "get",
188
+ "url": "/api/health_check?trace=${recordId}",
189
+ "adaptor": "const result = {data: {'type':'wrapper','className':'p-0 h-full','body':[{'type':'steedos-instance-detail','id':'u:steedos-instance-detail','label':'Instance Detail','instanceId':context.recordId,'boxName':context.side_listview_id}],'id':'u:steedos-instance-detail-service'}};console.log('result===>', result); return result;"
190
+ },
191
+ "visibleOn": "${permission === true}"
192
+ },
193
+ {
194
+ "id": "u:259e5e73a3e2",
195
+ "type": "tpl",
196
+ "tpl": "无权限",
197
+ "visibleOn": "${permission === false}"
198
+ }
199
+ ],
200
+ "id": "u:f101829e8710"
201
+ }
202
+ ],
203
+ "regions": [
204
+ "toolbar",
205
+ "body"
206
+ ],
207
+ "data": {},
208
+ "id": "u:d37465183f56",
209
+ "className": "steedos-instance-related-view-wrapper flex justify-center",
210
+ "bodyClassName": "p-0 flex flex-1 overflow-hidden h-full",
211
+ "name": "amis-root-workflow",
212
+ "initApi": {
213
+ "url": "http://127.0.0.1:8443/api/workflow/v2/instance/${recordId}/permission",
214
+ "method": "get",
215
+ "data": {},
216
+ "requestAdaptor": "",
217
+ "adaptor": "",
218
+ "messages": {},
219
+ "sendOn": "${recordId}"
220
+ },
221
+ "initFetch": null,
222
+ "asideResizor": false,
223
+ "pullRefresh": {
224
+ "disabled": true
225
+ },
226
+ "editorState": "default",
227
+ "css": {
228
+ ".steedos-instance-related-view-wrapper > .antd-Page-content": {
229
+ "width": "210mm",
230
+ "transition": "width 0.5s ease-in-out"
231
+ },
232
+ ".steedos-global-header-root": {
233
+ "display": "none"
234
+ },
235
+ ".creator-content-wrapper": {
236
+ "margin-top": "0px",
237
+ "height": "100%"
238
+ },
239
+ ".steedos-instance-detail-wrapper": {
240
+ "margin": "0px !important"
241
+ },
242
+ ".antd-Page-toolbar": {
243
+ "background": "#e5e5e5"
244
+ },
245
+ ".antd-Page-toolbar .antd-Grid": {
246
+ "padding-top": "12px",
247
+ "padding-left": "10px"
248
+ },
249
+ ".instance-approve-history": {
250
+ "display": "none"
251
+ },
252
+ ".instance-file-list": {
253
+ "display": "none"
254
+ },
255
+ ".instance-related-list": {
256
+ "display": "none"
257
+ },
258
+ ".antd-Form-star":{
259
+ "display": "none !important"
260
+ },
261
+ ".text-end": {
262
+ "text-align": "end"
263
+ },
264
+ ".steedos-amis-instance-view-content": {
265
+ "max-width": "none !important"
266
+ },
267
+ ".simplify-traces .step-type-start":{
268
+ "display": "none !important"
269
+ },
270
+ ".simplify-traces .step-type-end":{
271
+ "display": "none !important"
272
+ },
273
+ ".simplify-traces .rejected": {
274
+ "display": "none !important"
275
+ },
276
+ ".simplify-traces .relocated": {
277
+ "display": "none !important"
278
+ },
279
+ ".simplify-traces .retrieved": {
280
+ "display": "none !important"
281
+ },
282
+ ".simplify-traces .returned": {
283
+ "display": "none !important"
284
+ },
285
+ ".simplify-traces .approve-judge-reassigned": {
286
+ "display": "none !important"
287
+ },
288
+ ".simplify-traces .approve-judge-retrieved": {
289
+ "display": "none !important"
290
+ },
291
+ ".simplify-traces .approve-judge-returned": {
292
+ "display": "none !important"
293
+ },
294
+ ".simplify-traces .approve-judge-rejected": {
295
+ "display": "none !important"
296
+ },
297
+ ".simplify-traces approve-type-cc": {
298
+ "display": "none !important"
299
+ },
300
+ ".simplify-traces approve-type-distribute": {
301
+ "display": "none !important"
302
+ },
303
+ ".simplify-traces approve-type-forward": {
304
+ "display": "none !important"
305
+ },
306
+ ".text-muted": {
307
+ "display": "none !important"
308
+ }
309
+ },
310
+ "wrapperCustomStyle": {}
311
+ }
@@ -0,0 +1,9 @@
1
+ name: page_instance_print
2
+ allow_anonymous: false
3
+ is_active: true
4
+ label: 审批单打印页面
5
+ locked: false
6
+ pageAssignments: []
7
+ render_engine: amis
8
+ type: app
9
+ widgets: []
package/package.json CHANGED
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "name": "@steedos-labs/plugin-workflow",
3
- "version": "3.0.2",
3
+ "version": "3.0.4",
4
4
  "main": "package.service.js",
5
5
  "license": "MIT",
6
6
  "scripts": {
7
7
  "build:watch": "tsc --watch",
8
- "release": "npm publish --registry https://registry.npmjs.org && open https://npmmirror.com/sync/@steedos-labs/plugin-workflow && cnpm sync @steedos-labs/plugin-workflow"
8
+ "release": "npm publish --registry https://registry.npmjs.org && npx cnpm sync @steedos-labs/plugin-workflow"
9
9
  },
10
10
  "dependencies": {
11
11
  "graphql-parse-resolve-info": "^4.12.3",
12
- "he": "1.2.0",
12
+ "he": "^1.2.0",
13
13
  "lodash": "^4.17.21",
14
14
  "node-schedule": "^2.0.0",
15
- "formidable": "2.0.1",
16
- "jszip": "3.10.1"
15
+ "formidable": "^2.1.5",
16
+ "jszip": "^3.10.1"
17
17
  },
18
18
  "private": false,
19
19
  "publishConfig": {
@@ -381,4 +381,23 @@ tbody .color-priority-muted *{
381
381
  .antd-Page-header{
382
382
  display: none;
383
383
  }
384
- }
384
+ }
385
+
386
+
387
+ /* 公共打印隐藏样式 */
388
+ @media print {
389
+ .no-print {
390
+ display: none !important;
391
+ visibility: hidden !important;
392
+ }
393
+ .antd-Form-item{
394
+ border: none !important;
395
+ content: none !important;
396
+ }
397
+ .antd-Form-item::after{
398
+ border: none !important;
399
+ }
400
+ .steedos-amis-instance-view-body{
401
+ margin: 20px 0 0 0 !important;
402
+ }
403
+ }
@@ -0,0 +1,81 @@
1
+ const objectql = require('@steedos/objectql');
2
+ const ImportManager = require('../../main/default/manager/import');
3
+ const ExportManager = require('../../main/default/manager/export');
4
+ const { getCollection } = require("../../main/default/utils/collection");
5
+ const _ = require('lodash');
6
+
7
+ module.exports = {
8
+ rest: {
9
+ method: 'POST',
10
+ fullPath: '/api/workflow/flow_copy'
11
+ },
12
+ params: {
13
+ flowId: { type: 'string' }, // 流程id
14
+ options: { type: 'object', optional: true }, // 复制选项
15
+ },
16
+ async handler(ctx) {
17
+ const userSession = ctx.meta.user;
18
+ const { userId, spaceId, locale } = userSession
19
+ const lang = locale === 'zh-cn' ? 'zh-CN' : 'en';
20
+ const { flowId, options } = ctx.params;
21
+
22
+ const { company_id } = options || {};
23
+
24
+ const flowsObj = this.getObject('flows');
25
+ const db = {
26
+ flows: await getCollection('flows')
27
+ }
28
+
29
+ var flow, form, newFlowName, newName, ref;
30
+ var templateSpaceId = objectql.getTemplateSpaceId();
31
+ if (templateSpaceId === 'template' && options.from === 'template') {
32
+ var data = await flowsObj.findOne(flowId, {}, Object.assign({ roles: ['admin'] }, { spaceId: templateSpaceId }));
33
+ await ImportManager.workflow(userId, spaceId, data, enabled, company_id);
34
+ } else {
35
+ var flowQuery = {
36
+ _id: flowId
37
+ }
38
+ if (templateSpaceId) {
39
+ flowQuery["$or"] = [{ space: templateSpaceId }, { space: spaceId }]
40
+ } else {
41
+ flowQuery.space = spaceId
42
+ }
43
+ flow = await db.flows.findOne(flowQuery, {
44
+ projection: {
45
+ _id: 1,
46
+ name: 1,
47
+ form: 1
48
+ }
49
+ });
50
+ if (!flow) {
51
+ throw new Error(`[flow.copy]未找到flow, space: ${spaceId}, flowId: ${flowId}`);
52
+ }
53
+ newFlowName = options != null ? options.name : void 0;
54
+ if (newFlowName) {
55
+ newName = newFlowName;
56
+ } else {
57
+ newName = "复制:" + flow.name;
58
+ }
59
+ form = await ExportManager.exportForm(flow.form, flow._id, true, company_id);
60
+ if (_.isEmpty(form)) {
61
+ throw new Error(`[flow.copy]未找到form, formId: ${flow.form}`);
62
+ }
63
+ form.name = newName;
64
+ if ((ref = form.flows) != null) {
65
+ ref.forEach(function (f) {
66
+ delete f.api_name
67
+ return f.name = newName;
68
+ });
69
+ }
70
+ delete form.api_name
71
+
72
+ await ImportManager.workflow(userId, spaceId, form, false, company_id);
73
+ }
74
+
75
+ return {
76
+ 'status': 0, // 返回 0,表示当前接口正确返回,否则按错误请求处理
77
+ 'msg': t('workflow_copy_flow_success', {}, lang),//'草稿已删除',
78
+ 'data': {}
79
+ }
80
+ }
81
+ }
@@ -9,5 +9,6 @@
9
9
  module.exports = {
10
10
  api_workflow_instance_batch_remove: require('./api_workflow_instance_batch_remove'),
11
11
  updateFormFields: require('./updateFormFields'),
12
- ...require('./getInstanceServiceSchema')
12
+ ...require('./getInstanceServiceSchema'),
13
+ flow_copy: require('./flow_copy'),
13
14
  }