@steedos/standard-ui 2.5.12-beta.8 → 2.5.12

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.
@@ -159,6 +159,6 @@ tab_items:
159
159
  group: development
160
160
  index: 42
161
161
  objects: []
162
- sort: 9100
162
+ sort: 999999
163
163
  #url: /app/admin
164
- visible: false
164
+ visible: true
@@ -2,118 +2,12 @@
2
2
  * @Author: 殷亮辉 yinlianghui@hotoa.com
3
3
  * @Date: 2023-05-16 17:00:38
4
4
  * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
5
- * @LastEditTime: 2023-08-11 16:19:45
5
+ * @LastEditTime: 2023-08-24 16:25:28
6
6
  */
7
7
  var buttonTriggerHistoryPathsChange;
8
- ; (function () {
9
- try {
10
- Meteor.startup(function () {
11
- var rootId = "steedosHistoryPathsRoot";
12
- var modalRoot = document.getElementById(rootId);
13
- if (!modalRoot) {
14
- modalRoot = document.createElement('div');
15
- modalRoot.setAttribute('id', rootId);
16
- $("body")[0].appendChild(modalRoot);
17
- }
18
- const page = {
19
- name: "pageSteedosHistoryPaths",
20
- render_engine: "amis",
21
- schema: {
22
- name: "serviceSteedosHistoryPaths",
23
- id: "serviceSteedosHistoryPaths",
24
- type: "service",
25
- className: "service-steedos-history-paths",
26
- body: [{
27
- "type": "button",
28
- "label": "触发@history_paths.changed",
29
- "name": "buttonTriggerHistoryPathsChange",
30
- "className": "button-trigger-history-paths-change hidden",
31
- "onEvent": {
32
- "click": {
33
- "actions": [
34
- {
35
- "actionType": "broadcast",
36
- "args": {
37
- "eventName": "@history_paths.changed"
38
- }
39
- }
40
- ]
41
- }
42
- }
43
- }]
44
- }
45
- };
46
- const root = $("#" + rootId)[0];
47
- Tracker.autorun(function (c) {
48
- if (Creator.steedosInit.get() && Creator.validated.get()) {
49
- Steedos.Page.render(root, page, {});
50
- const findVars = (obj, vars) => {
51
- try {
52
- return vars.length === vars.filter(function (item) {
53
- return item.split(".").reduce(function (sum, n) {
54
- return sum[n];
55
- }, obj) !== undefined;
56
- }).length;
57
- }
58
- catch (ex) {
59
- return false;
60
- }
61
- }
62
- const waittingVars = ["SteedosUI.refs.serviceSteedosHistoryPaths.getComponentByName"];
63
- Promise.all([
64
- waitForThing(window, waittingVars, findVars)
65
- ]).then(() => {
66
- var scope = SteedosUI.refs["serviceSteedosHistoryPaths"];
67
- buttonTriggerHistoryPathsChange = scope.getComponentByName("serviceSteedosHistoryPaths.buttonTriggerHistoryPathsChange");
68
- Object.assign(Steedos, {
69
- goBack
70
- });
71
- });
72
- }
73
- });
74
- });
75
-
76
- } catch (error) {
77
- console.error(error)
78
- };
79
- })();
80
8
 
81
9
  let historyPathsStoreKey = "history_paths";
82
10
 
83
- // 使用debounce防抖动函数,连续多次自动触发enter事件时,只需要捕获最后一次
84
- FlowRouter.triggers.enter(debounce(function (context, redirect, stop) {
85
- if(!!window.opener){
86
- // 记录详细页面点击右上角查看审批单等打开新窗口情况下,新窗口的history path继承了opener页面的history path,所以需要区别出来,否则会报错
87
- historyPathsStoreKey = "history_paths_opener_level" + getOpenerLevel(window,0);
88
- }
89
- const path = context.path;
90
- const params = context.params || {};
91
- // const pathDef = context.route.pathDef;
92
- const recordId = params.record_id;
93
- var paths = getHistoryPaths() || [];
94
- let lastPath = paths && paths[paths.length - 1];
95
- if (recordId) {
96
- //判断当前路由与记录的路由是否相同,为解决从设计器微页面返回重复记录的问题#4978
97
- if(path.split('?')[0] != lastPath?.path?.split('?')[0]){
98
- // 触发广播事件前,把当前path和params累加存入amis变量historyPaths中
99
- pushHistoryPath(path, params);
100
- }
101
- }
102
- else {
103
- clearHistoryFilters(context, lastPath);
104
- // 触发广播事件前重置amis变量historyPaths值为空数组,并把当前path和params存入amis变量historyPaths中
105
- resetHistoryPath(path, params);
106
- }
107
- triggerBroadcastHistoryPathsChanged(buttonTriggerHistoryPathsChange);
108
- }, 200));
109
-
110
- function goBack(){
111
- let prevPath = popHistoryPath();
112
- if(prevPath && prevPath.path){
113
- FlowRouter.go(prevPath.path);
114
- }
115
- }
116
-
117
11
  // 切换应用、对象、列表视图时清除本地存储中的过滤条件
118
12
  function clearHistoryFilters(context, lastPath) {
119
13
  const path = context.path;
@@ -212,10 +106,132 @@ function debounce(fn, delay) {
212
106
  }
213
107
  }
214
108
 
215
- function getOpenerLevel(opener,level){
109
+ function getOpenerLevel(opener, level) {
110
+ if (level > 3) {
111
+ return level + 1;
112
+ }
216
113
  if (!!opener['opener']) {
217
114
  return getOpenerLevel(opener['opener'], level + 1);
218
- }else{
219
- return level;
115
+ } else {
116
+ return level;
117
+ }
118
+ }
119
+
120
+
121
+ function goBack(){
122
+ let prevPath = popHistoryPath();
123
+ if(prevPath && prevPath.path){
124
+ FlowRouter.go(prevPath.path);
220
125
  }
221
- }
126
+ }
127
+
128
+ window.goBack = goBack;
129
+
130
+ ; (function () {
131
+ try {
132
+ Meteor.startup(function () {
133
+ Object.assign(Steedos, {
134
+ goBack
135
+ });
136
+ var rootId = "steedosHistoryPathsRoot";
137
+ var modalRoot = document.getElementById(rootId);
138
+ if (!modalRoot) {
139
+ modalRoot = document.createElement('div');
140
+ modalRoot.setAttribute('id', rootId);
141
+ $("body")[0].appendChild(modalRoot);
142
+ }
143
+ const page = {
144
+ name: "pageSteedosHistoryPaths",
145
+ render_engine: "amis",
146
+ schema: {
147
+ name: "serviceSteedosHistoryPaths",
148
+ id: "serviceSteedosHistoryPaths",
149
+ type: "service",
150
+ className: "service-steedos-history-paths",
151
+ body: [{
152
+ "type": "button",
153
+ "label": "触发@history_paths.changed",
154
+ "name": "buttonTriggerHistoryPathsChange",
155
+ "className": "button-trigger-history-paths-change hidden",
156
+ "onEvent": {
157
+ "click": {
158
+ "actions": [
159
+ {
160
+ "actionType": "broadcast",
161
+ "args": {
162
+ "eventName": "@history_paths.changed"
163
+ }
164
+ }
165
+ ]
166
+ }
167
+ }
168
+ }]
169
+ }
170
+ };
171
+ const root = $("#" + rootId)[0];
172
+ Tracker.autorun(function (c) {
173
+ if (Creator.steedosInit.get() && Creator.validated.get()) {
174
+ Steedos.Page.render(root, page, {});
175
+ const findVars = (obj, vars) => {
176
+ try {
177
+ return vars.length === vars.filter(function (item) {
178
+ return item.split(".").reduce(function (sum, n) {
179
+ return sum[n];
180
+ }, obj) !== undefined;
181
+ }).length;
182
+ }
183
+ catch (ex) {
184
+ return false;
185
+ }
186
+ }
187
+ Promise.all([
188
+ waitForThing(window, 'SteedosUI'),
189
+ ]).then(() => {
190
+ const waittingVars = ["SteedosUI.refs.serviceSteedosHistoryPaths.getComponentByName"];
191
+ Promise.all([
192
+ waitForThing(window, waittingVars, findVars)
193
+ ]).then(() => {
194
+ var scope = SteedosUI.refs["serviceSteedosHistoryPaths"];
195
+ buttonTriggerHistoryPathsChange = scope.getComponentByName("serviceSteedosHistoryPaths.buttonTriggerHistoryPathsChange");
196
+ });
197
+ });
198
+ }
199
+ });
200
+ });
201
+
202
+ } catch (error) {
203
+ console.error(error)
204
+ };
205
+ })();
206
+
207
+
208
+ // 使用debounce防抖动函数,连续多次自动触发enter事件时,只需要捕获最后一次
209
+ FlowRouter.triggers.enter(debounce(function (context, redirect, stop) {
210
+ if(!!window.opener){
211
+ // 记录详细页面点击右上角查看审批单等打开新窗口情况下,新窗口的history path继承了opener页面的history path,所以需要区别出来,否则会报错
212
+ historyPathsStoreKey = "history_paths_opener_level" + getOpenerLevel(window,0);
213
+ }
214
+ const path = context.path;
215
+ const params = context.params || {};
216
+ // const pathDef = context.route.pathDef;
217
+ const recordId = params.record_id;
218
+ var paths = getHistoryPaths() || [];
219
+ let lastPath = paths && paths[paths.length - 1];
220
+ if (recordId) {
221
+ //判断当前路由与记录的路由是否相同,为解决从设计器微页面返回重复记录的问题#4978
222
+ var top0 = null;
223
+ if(lastPath && lastPath.path && lastPath.path.split){
224
+ top0 = lastPath.path.split('?')[0]
225
+ }
226
+ if(path.split('?')[0] != top0){
227
+ // 触发广播事件前,把当前path和params累加存入amis变量historyPaths中
228
+ pushHistoryPath(path, params);
229
+ }
230
+ }
231
+ else {
232
+ clearHistoryFilters(context, lastPath);
233
+ // 触发广播事件前重置amis变量historyPaths值为空数组,并把当前path和params存入amis变量historyPaths中
234
+ resetHistoryPath(path, params);
235
+ }
236
+ triggerBroadcastHistoryPathsChanged(buttonTriggerHistoryPathsChange);
237
+ }, 200));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steedos/standard-ui",
3
- "version": "2.5.12-beta.8",
3
+ "version": "2.5.12",
4
4
  "main": "package.service.js",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -12,5 +12,5 @@
12
12
  "description": "steedos package",
13
13
  "repository": {},
14
14
  "license": "MIT",
15
- "gitHead": "4fc36005f5c00f97de66b68bb48ac3d0450cdefd"
15
+ "gitHead": "cdf06aa70a7b55d8dae3fdd62bb24d8fe004b5c9"
16
16
  }
@@ -1,8 +1,8 @@
1
1
  /*
2
2
  * @Author: sunhaolin@hotoa.com
3
3
  * @Date: 2022-07-29 09:40:31
4
- * @LastEditors: sunhaolin@hotoa.com
5
- * @LastEditTime: 2022-12-09 13:41:00
4
+ * @LastEditors: baozhoutao@steedos.com
5
+ * @LastEditTime: 2023-08-19 19:56:00
6
6
  * @Description:
7
7
  */
8
8
  "use strict";
@@ -36,7 +36,29 @@ module.exports = {
36
36
  * Actions
37
37
  */
38
38
  actions: {
39
-
39
+ getUsersName: {
40
+ rest: {
41
+ method: "POST",
42
+ fullPath: "/service/api/standard-ui/getUsersName"
43
+ },
44
+ async handler(ctx) {
45
+ const { userIds } = ctx.params;
46
+ if(!userIds || userIds.length == 0){
47
+ return []
48
+ }
49
+ //此查询不带权限, 使用userIds 获取用户姓名
50
+ return await ctx.broker.call(
51
+ 'objectql.find',
52
+ {
53
+ objectName: 'space_users',
54
+ query: {
55
+ fields: ['_id', 'user', 'name'],
56
+ filters: [["user", "in", userIds]]
57
+ },
58
+ }
59
+ );
60
+ }
61
+ }
40
62
  },
41
63
 
42
64
  /**