cloud-web-corejs 1.1.0-dev.82 → 1.1.0-dev.84

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 (21) hide show
  1. package/package.json +1 -1
  2. package/src/components/VabUpload/mixins.js +5 -0
  3. package/src/components/VabUpload/view.vue +4 -0
  4. package/src/components/baseAttachment/index.vue +1 -0
  5. package/src/components/baseAttachment/mixins.js +17 -0
  6. package/src/components/baseAttachment/showList.vue +12 -2
  7. package/src/components/baseAttachment/uploadDialog.vue +2 -1
  8. package/src/components/hiprint/hiprint.bundle.js +5 -1
  9. package/src/components/table/vxeFilter/mixin.js +326 -326
  10. package/src/components/xform/form-designer/form-widget/field-widget/baseAttachment-widget.vue +7 -0
  11. package/src/components/xform/form-designer/form-widget/field-widget/vabUpload-widget.vue +1 -0
  12. package/src/components/xform/form-designer/form-widget/field-widget/vabUpload2-widget.vue +186 -153
  13. package/src/components/xform/form-designer/setting-panel/property-editor/field-vabUpload/field-vabUpload-editor.vue +22 -9
  14. package/src/components/xform/form-designer/setting-panel/property-editor/field-vabUpload2/field-vabUpload2-editor.vue +13 -0
  15. package/src/components/xform/form-designer/setting-panel/property-editor/showDownloadButton-editor.vue +29 -0
  16. package/src/components/xform/form-designer/setting-panel/propertyRegister.js +1 -0
  17. package/src/components/xform/form-designer/widget-panel/widgetsConfig.js +3 -0
  18. package/src/components/xform/form-render/container-item/data-table-item.vue +1 -0
  19. package/src/components/xform/form-render/container-item/data-table-mixin.js +116 -0
  20. package/src/microRouter/index.js +5 -0
  21. package/src/store/modules/permission.js +2 -0
@@ -1,326 +1,326 @@
1
- // 直接引用工具函数,不走 $table 实例上的补丁方法:
2
- // initVxeTable 只把 getCellValue/createParams 挂在初始化时的那个 xTable 实例上,
3
- // 页面若用 v-if 销毁重建 vxe-grid(如 product_problem_record/list.vue),
4
- // 新实例上没有这两个方法,筛选面板会报 $table.getCellValue is not a function
5
- // (createParams 已不再直接使用:候选值取值统一走下面 load() 里的 readCellValue 缓存)
6
- import { getCellValue } from "../util/index";
7
-
8
- let modules = {};
9
-
10
- modules = {
11
- contentMixin: {
12
- name: "FilterContent",
13
- props: {
14
- params: Object,
15
- },
16
- data() {
17
- return {
18
- size: "mini",
19
- isAll: false,
20
- option: null,
21
- colValList: [],
22
- valList: [],
23
- valMap: null,
24
- };
25
- },
26
- created() {
27
- this.load();
28
- },
29
- methods: {
30
- getShowValue(val) {
31
- if (this.valMap && Object.keys(this.valMap).length > 0) {
32
- return this.valMap[val];
33
- } else {
34
- return val;
35
- }
36
- },
37
- load() {
38
- const { $table, column } = this.params;
39
- const { fullColumn, tableColumn } = $table.getTableColumn();
40
- const { fullData } = $table.getTableData();
41
- const option = column.filters[0];
42
- if (!option.data) {
43
- option.data = {
44
- sVal: "",
45
- };
46
- } else if (option.data.sVal == null) {
47
- option.data.sVal = "";
48
- }
49
-
50
- if (!option.data.hasFilter) {
51
- this.isAll = true;
52
- }
53
-
54
- let vals = option.data && option.data.vals ? option.data.vals : [];
55
- let valMap =
56
- option.data && option.data.valMap ? option.data.valMap : null;
57
-
58
- // 取值可能落到 getCellValue 的兜底渲染:非 filterVal 白名单的组件列每个单元格
59
- // 都要 new Vue + $mount + 爬 DOM,还会跑一遍用户的表单脚本。而本方法要把全表
60
- // 跑三遍(候选值 → 按其他筛选列过滤 → 过滤后计数),行多列宽时打开一次筛选面板
61
- // 就是几千次同步挂载,主线程直接定住。同一 (列, 行) 只算一次。
62
- // 注:第三遍原本按过滤后子集的下标取值,改用缓存后统一为整表下标——只有依赖
63
- // 行下标的自定义渲染列会有差异,而这类列本就不该出现在值列表筛选里。
64
- let cellValueCache = new Map();
65
- const readCellValue = (row, col, $rowIndex) => {
66
- let colCache = cellValueCache.get(col);
67
- if (!colCache) {
68
- colCache = new Map();
69
- cellValueCache.set(col, colCache);
70
- }
71
- if (colCache.has(row)) return colCache.get(row);
72
- let value = getCellValue({
73
- row,
74
- $rowIndex,
75
- $table,
76
- column: col,
77
- });
78
- colCache.set(row, value);
79
- return value;
80
- };
81
-
82
- let lsm = {};
83
- let colValList = [];
84
- fullData.map((row, $rowIndex) => {
85
- let cellValue = readCellValue(row, column, $rowIndex);
86
- let sortValue = cellValue
87
- let sortField = column.params?.sortField;
88
- if(sortField){
89
- sortValue = row[sortField]??null;
90
- }
91
- if (lsm[cellValue]) {
92
- lsm[cellValue].count = lsm[cellValue].count + 1;
93
- } else {
94
- lsm[cellValue] = {
95
- checked: !option.data.hasFilter || vals.includes(cellValue),
96
- value: cellValue,
97
- sortValue: sortValue,
98
- count: 1,
99
- };
100
- }
101
- });
102
- for (let key in lsm) {
103
- colValList.push(lsm[key]);
104
- }
105
- colValList = this.sortByField(colValList, "sortValue");
106
-
107
- const columnsArr = [];
108
-
109
- this.option = option;
110
- this.colValList = colValList;
111
- this.valList = colValList;
112
- this.valMap = valMap;
113
-
114
- let filterColumns = fullColumn.filter((row, $rowIndex) => {
115
- return (
116
- row.filterRender &&
117
- row.filterRender.name == "FilterContent" &&
118
- row.field != column.field
119
- );
120
- });
121
-
122
- let datas = fullData.filter((row, $rowIndex) => {
123
- let item = filterColumns.find((filterColumn) => {
124
- let option1 = filterColumn.filters[0];
125
- if (!option1.data.hasFilter) {
126
- return false;
127
- }
128
- const vals = option1.data.vals || [];
129
- let cellValue = readCellValue(row, filterColumn);
130
- return !vals.includes(cellValue);
131
- });
132
- return item == null;
133
- });
134
- let lsm2 = {};
135
- datas.map((row, $rowIndex) => {
136
- let cellValue = readCellValue(row, column, $rowIndex);
137
- if (lsm2[cellValue]) {
138
- lsm2[cellValue].count = lsm2[cellValue].count + 1;
139
- } else {
140
- lsm2[cellValue] = {
141
- value: cellValue,
142
- count: 1,
143
- };
144
- }
145
- });
146
- colValList.forEach((colVal) => {
147
- let item = lsm2[colVal.value];
148
- if (item) {
149
- colVal.filterCount = item.count;
150
- } else {
151
- colVal.filterCount = 0;
152
- }
153
- });
154
-
155
- this.searchEvent();
156
- },
157
- sortByField(array, field) {
158
- return [...array].sort((a, b) => {
159
- const valA = a[field];
160
- const valB = b[field];
161
-
162
- // 处理 null/undefined(视为最小值)
163
- if (valA == null) return -1;
164
- if (valB == null) return 1;
165
- if (valA == null && valB == null) return 0;
166
-
167
- // 尝试数值比较
168
- const numA = Number(valA);
169
- const numB = Number(valB);
170
- if (!isNaN(numA) && !isNaN(numB)) {
171
- return numA - numB;
172
- }
173
-
174
- // 字符串比较
175
- return String(valA).localeCompare(String(valB));
176
- });
177
- },
178
- searchEvent() {
179
- let that = this;
180
- const { option, colValList } = this;
181
- this.valList = option.data.sVal
182
- ? colValList.filter(function (item) {
183
- let value = item.value;
184
- // 空单元格的 value 为 null/undefined,数值列为 number,必须转字符串再匹配
185
- return (
186
- value != null &&
187
- String(value).indexOf(option.data.sVal) > -1
188
- );
189
- })
190
- : colValList;
191
- let isAll = this.valList.every((item) => {
192
- return item.checked == true;
193
- });
194
- this.isAll = isAll;
195
- },
196
- changeAllEvent() {
197
- const { isAll } = this;
198
- this.valList.forEach((item) => {
199
- item.checked = isAll;
200
- });
201
- },
202
- checkItem(checked) {
203
- if (checked) {
204
- let isAll = this.valList.every((item) => {
205
- return item.checked == true;
206
- });
207
- this.isAll = isAll;
208
- } else {
209
- this.isAll = false;
210
- }
211
- },
212
- confirmFilterEvent(evnt) {
213
- const { params, option, valList, colValList } = this;
214
- const { data } = option;
215
- const { $panel, $table } = params;
216
- let vals = valList
217
- .filter((item) => item.checked)
218
- .map((item) => item.value);
219
- if (!option.data.sVal && colValList.length == vals.length) {
220
- this.resetFilterEvent();
221
- return;
222
- }
223
- data.vals = vals;
224
- option.data.hasFilter = true;
225
- $panel.changeOption(evnt, true, option);
226
- $panel.confirmFilter();
227
- $table.setAllCheckboxRow(false);
228
- },
229
- resetFilterEvent() {
230
- const { $panel, $table } = this.params;
231
- this.option.data.hasFilter = false;
232
- $panel.resetFilter();
233
- $table.setAllCheckboxRow(false);
234
- },
235
- },
236
- },
237
- complexMixin: {
238
- name: "FilterComplex",
239
- props: {
240
- params: Object,
241
- events: Object,
242
- },
243
- data() {
244
- return {
245
- size: "mini", // 被所有子组件继承 size
246
- column: null,
247
- option: null,
248
- };
249
- },
250
- created() {
251
- this.load();
252
- },
253
- methods: {
254
- load() {
255
- const { column } = this.params;
256
- const option = column.filters[0];
257
- if (!option.data) {
258
- option.data = {
259
- type: "lt",
260
- };
261
- } else if (!option.data.type) {
262
- option.data.type = "lt";
263
- }
264
-
265
- this.column = column;
266
- this.option = option;
267
- },
268
- changeOptionEvent() {
269
- const { params, option } = this;
270
- const { $panel } = params;
271
- const checked = !!option.data.name;
272
- $panel.changeOption(null, checked, option);
273
- },
274
- confirmEvent() {
275
- const { $panel, column } = this.params;
276
- $panel.confirmFilter();
277
- },
278
- resetEvent() {
279
- // eslint-disable-next-line no-unused-vars
280
- const { $panel } = this.params;
281
- $panel.resetFilter();
282
- },
283
- },
284
- },
285
- inputMixin: {
286
- name: "FilterInput",
287
- props: {
288
- params: Object,
289
- },
290
- data() {
291
- return {
292
- column: null,
293
- option: null,
294
- };
295
- },
296
- created() {
297
- this.load();
298
- },
299
- methods: {
300
- load() {
301
- const { column } = this.params;
302
- const option = column.filters[0];
303
- this.column = column;
304
- this.option = option;
305
- },
306
- changeOptionEvent() {
307
- const { params, option } = this;
308
- const { $panel } = params;
309
- const checked = !!option.data;
310
- $panel.changeOption(null, checked, option);
311
- },
312
- keyupEvent({ $event }) {
313
- const { params } = this;
314
- const { $panel } = params;
315
- if ($event.keyCode === 13) {
316
- $panel.confirmFilter();
317
- }
318
- },
319
- },
320
- },
321
- };
322
-
323
- export const inputMixin = modules.inputMixin;
324
- export const complexMixin = modules.complexMixin;
325
- export const contentMixin = modules.contentMixin;
326
- export default modules;
1
+ // 直接引用工具函数,不走 $table 实例上的补丁方法:
2
+ // initVxeTable 只把 getCellValue/createParams 挂在初始化时的那个 xTable 实例上,
3
+ // 页面若用 v-if 销毁重建 vxe-grid(如 product_problem_record/list.vue),
4
+ // 新实例上没有这两个方法,筛选面板会报 $table.getCellValue is not a function
5
+ // (createParams 已不再直接使用:候选值取值统一走下面 load() 里的 readCellValue 缓存)
6
+ import { getCellValue } from "../util/index";
7
+
8
+ let modules = {};
9
+
10
+ modules = {
11
+ contentMixin: {
12
+ name: "FilterContent",
13
+ props: {
14
+ params: Object,
15
+ },
16
+ data() {
17
+ return {
18
+ size: "mini",
19
+ isAll: false,
20
+ option: null,
21
+ colValList: [],
22
+ valList: [],
23
+ valMap: null,
24
+ };
25
+ },
26
+ created() {
27
+ this.load();
28
+ },
29
+ methods: {
30
+ getShowValue(val) {
31
+ if (this.valMap && Object.keys(this.valMap).length > 0) {
32
+ return this.valMap[val];
33
+ } else {
34
+ return val;
35
+ }
36
+ },
37
+ load() {
38
+ const { $table, column } = this.params;
39
+ const { fullColumn, tableColumn } = $table.getTableColumn();
40
+ const { fullData } = $table.getTableData();
41
+ const option = column.filters[0];
42
+ if (!option.data) {
43
+ option.data = {
44
+ sVal: "",
45
+ };
46
+ } else if (option.data.sVal == null) {
47
+ option.data.sVal = "";
48
+ }
49
+
50
+ if (!option.data.hasFilter) {
51
+ this.isAll = true;
52
+ }
53
+
54
+ let vals = option.data && option.data.vals ? option.data.vals : [];
55
+ let valMap =
56
+ option.data && option.data.valMap ? option.data.valMap : null;
57
+
58
+ // 取值可能落到 getCellValue 的兜底渲染:非 filterVal 白名单的组件列每个单元格
59
+ // 都要 new Vue + $mount + 爬 DOM,还会跑一遍用户的表单脚本。而本方法要把全表
60
+ // 跑三遍(候选值 → 按其他筛选列过滤 → 过滤后计数),行多列宽时打开一次筛选面板
61
+ // 就是几千次同步挂载,主线程直接定住。同一 (列, 行) 只算一次。
62
+ // 注:第三遍原本按过滤后子集的下标取值,改用缓存后统一为整表下标——只有依赖
63
+ // 行下标的自定义渲染列会有差异,而这类列本就不该出现在值列表筛选里。
64
+ let cellValueCache = new Map();
65
+ const readCellValue = (row, col, $rowIndex) => {
66
+ let colCache = cellValueCache.get(col);
67
+ if (!colCache) {
68
+ colCache = new Map();
69
+ cellValueCache.set(col, colCache);
70
+ }
71
+ if (colCache.has(row)) return colCache.get(row);
72
+ let value = getCellValue({
73
+ row,
74
+ $rowIndex,
75
+ $table,
76
+ column: col,
77
+ });
78
+ colCache.set(row, value);
79
+ return value;
80
+ };
81
+
82
+ let lsm = {};
83
+ let colValList = [];
84
+ fullData.map((row, $rowIndex) => {
85
+ let cellValue = readCellValue(row, column, $rowIndex);
86
+ let sortValue = cellValue
87
+ let sortField = column.params?.sortField;
88
+ if(sortField){
89
+ sortValue = row[sortField]??null;
90
+ }
91
+ if (lsm[cellValue]) {
92
+ lsm[cellValue].count = lsm[cellValue].count + 1;
93
+ } else {
94
+ lsm[cellValue] = {
95
+ checked: !option.data.hasFilter || vals.includes(cellValue),
96
+ value: cellValue,
97
+ sortValue: sortValue,
98
+ count: 1,
99
+ };
100
+ }
101
+ });
102
+ for (let key in lsm) {
103
+ colValList.push(lsm[key]);
104
+ }
105
+ colValList = this.sortByField(colValList, "sortValue");
106
+
107
+ const columnsArr = [];
108
+
109
+ this.option = option;
110
+ this.colValList = colValList;
111
+ this.valList = colValList;
112
+ this.valMap = valMap;
113
+
114
+ let filterColumns = fullColumn.filter((row, $rowIndex) => {
115
+ return (
116
+ row.filterRender &&
117
+ row.filterRender.name == "FilterContent" &&
118
+ row.field != column.field
119
+ );
120
+ });
121
+
122
+ let datas = fullData.filter((row, $rowIndex) => {
123
+ let item = filterColumns.find((filterColumn) => {
124
+ let option1 = filterColumn.filters[0];
125
+ if (!option1.data.hasFilter) {
126
+ return false;
127
+ }
128
+ const vals = option1.data.vals || [];
129
+ let cellValue = readCellValue(row, filterColumn);
130
+ return !vals.includes(cellValue);
131
+ });
132
+ return item == null;
133
+ });
134
+ let lsm2 = {};
135
+ datas.map((row, $rowIndex) => {
136
+ let cellValue = readCellValue(row, column, $rowIndex);
137
+ if (lsm2[cellValue]) {
138
+ lsm2[cellValue].count = lsm2[cellValue].count + 1;
139
+ } else {
140
+ lsm2[cellValue] = {
141
+ value: cellValue,
142
+ count: 1,
143
+ };
144
+ }
145
+ });
146
+ colValList.forEach((colVal) => {
147
+ let item = lsm2[colVal.value];
148
+ if (item) {
149
+ colVal.filterCount = item.count;
150
+ } else {
151
+ colVal.filterCount = 0;
152
+ }
153
+ });
154
+
155
+ this.searchEvent();
156
+ },
157
+ sortByField(array, field) {
158
+ return [...array].sort((a, b) => {
159
+ const valA = a[field];
160
+ const valB = b[field];
161
+
162
+ // 处理 null/undefined(视为最小值)
163
+ if (valA == null) return -1;
164
+ if (valB == null) return 1;
165
+ if (valA == null && valB == null) return 0;
166
+
167
+ // 尝试数值比较
168
+ const numA = Number(valA);
169
+ const numB = Number(valB);
170
+ if (!isNaN(numA) && !isNaN(numB)) {
171
+ return numA - numB;
172
+ }
173
+
174
+ // 字符串比较
175
+ return String(valA).localeCompare(String(valB));
176
+ });
177
+ },
178
+ searchEvent() {
179
+ let that = this;
180
+ const { option, colValList } = this;
181
+ this.valList = option.data.sVal
182
+ ? colValList.filter(function (item) {
183
+ let value = item.value;
184
+ // 空单元格的 value 为 null/undefined,数值列为 number,必须转字符串再匹配
185
+ return (
186
+ value != null &&
187
+ String(value).indexOf(option.data.sVal) > -1
188
+ );
189
+ })
190
+ : colValList;
191
+ let isAll = this.valList.every((item) => {
192
+ return item.checked == true;
193
+ });
194
+ this.isAll = isAll;
195
+ },
196
+ changeAllEvent() {
197
+ const { isAll } = this;
198
+ this.valList.forEach((item) => {
199
+ item.checked = isAll;
200
+ });
201
+ },
202
+ checkItem(checked) {
203
+ if (checked) {
204
+ let isAll = this.valList.every((item) => {
205
+ return item.checked == true;
206
+ });
207
+ this.isAll = isAll;
208
+ } else {
209
+ this.isAll = false;
210
+ }
211
+ },
212
+ confirmFilterEvent(evnt) {
213
+ const { params, option, valList, colValList } = this;
214
+ const { data } = option;
215
+ const { $panel, $table } = params;
216
+ let vals = valList
217
+ .filter((item) => item.checked)
218
+ .map((item) => item.value);
219
+ if (!option.data.sVal && colValList.length == vals.length) {
220
+ this.resetFilterEvent();
221
+ return;
222
+ }
223
+ data.vals = vals;
224
+ option.data.hasFilter = true;
225
+ $panel.changeOption(evnt, true, option);
226
+ $panel.confirmFilter();
227
+ $table.setAllCheckboxRow(false);
228
+ },
229
+ resetFilterEvent() {
230
+ const { $panel, $table } = this.params;
231
+ this.option.data.hasFilter = false;
232
+ $panel.resetFilter();
233
+ $table.setAllCheckboxRow(false);
234
+ },
235
+ },
236
+ },
237
+ complexMixin: {
238
+ name: "FilterComplex",
239
+ props: {
240
+ params: Object,
241
+ events: Object,
242
+ },
243
+ data() {
244
+ return {
245
+ size: "mini", // 被所有子组件继承 size
246
+ column: null,
247
+ option: null,
248
+ };
249
+ },
250
+ created() {
251
+ this.load();
252
+ },
253
+ methods: {
254
+ load() {
255
+ const { column } = this.params;
256
+ const option = column.filters[0];
257
+ if (!option.data) {
258
+ option.data = {
259
+ type: "lt",
260
+ };
261
+ } else if (!option.data.type) {
262
+ option.data.type = "lt";
263
+ }
264
+
265
+ this.column = column;
266
+ this.option = option;
267
+ },
268
+ changeOptionEvent() {
269
+ const { params, option } = this;
270
+ const { $panel } = params;
271
+ const checked = !!option.data.name;
272
+ $panel.changeOption(null, checked, option);
273
+ },
274
+ confirmEvent() {
275
+ const { $panel, column } = this.params;
276
+ $panel.confirmFilter();
277
+ },
278
+ resetEvent() {
279
+ // eslint-disable-next-line no-unused-vars
280
+ const { $panel } = this.params;
281
+ $panel.resetFilter();
282
+ },
283
+ },
284
+ },
285
+ inputMixin: {
286
+ name: "FilterInput",
287
+ props: {
288
+ params: Object,
289
+ },
290
+ data() {
291
+ return {
292
+ column: null,
293
+ option: null,
294
+ };
295
+ },
296
+ created() {
297
+ this.load();
298
+ },
299
+ methods: {
300
+ load() {
301
+ const { column } = this.params;
302
+ const option = column.filters[0];
303
+ this.column = column;
304
+ this.option = option;
305
+ },
306
+ changeOptionEvent() {
307
+ const { params, option } = this;
308
+ const { $panel } = params;
309
+ const checked = !!option.data;
310
+ $panel.changeOption(null, checked, option);
311
+ },
312
+ keyupEvent({ $event }) {
313
+ const { params } = this;
314
+ const { $panel } = params;
315
+ if ($event.keyCode === 13) {
316
+ $panel.confirmFilter();
317
+ }
318
+ },
319
+ },
320
+ },
321
+ };
322
+
323
+ export const inputMixin = modules.inputMixin;
324
+ export const complexMixin = modules.complexMixin;
325
+ export const contentMixin = modules.contentMixin;
326
+ export default modules;
@@ -93,6 +93,9 @@ export default {
93
93
  'field.options.disabled'(val) {
94
94
  this.option.edit = !val;
95
95
  },
96
+ 'field.options.showDownloadButton'(val) {
97
+ this.option.showDownloadButton = val !== false;
98
+ },
96
99
  'option':function(){
97
100
 
98
101
  }
@@ -170,10 +173,14 @@ export default {
170
173
  if (!this.field.options.hasOwnProperty('disabled')) {
171
174
  this.$set(this.field.options, 'disabled', false);
172
175
  }
176
+ if (!this.field.options.hasOwnProperty('showDownloadButton')) {
177
+ this.$set(this.field.options, 'showDownloadButton', true);
178
+ }
173
179
  this.option = {
174
180
  title: this.$t1('附件'),
175
181
  edit: !this.field.options.disabled,
176
182
  showViewButton: this.field.options.showViewButton !== false,
183
+ showDownloadButton: this.field.options.showDownloadButton !== false,
177
184
  uploadConfig: {
178
185
  limit: this.field.options.limit,
179
186
  fileTypes: this.field.options.fileTypes || [],