sohelp-eleplus 1.1.19 → 1.1.20
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/components.js +2 -0
- package/http/SohelpHttp.js +14 -5
- package/package.json +1 -1
- package/sohelp-card/index.vue +13 -0
- package/sohelp-dict/index.vue +25 -1
- package/sohelp-grid/components/filter-condition-item.vue +7 -3
- package/sohelp-grid/index.vue +289 -148
- package/sohelp-grid/js/DefaultGridOptions.js +25 -16
- package/sohelp-grid/js/useSohelpGridConfig.js +159 -89
- package/sohelp-grid-view/filter/filter-form.vue +10 -4
- package/sohelp-grid-view/filter/index.vue +5 -2
- package/sohelp-grid-view/index.vue +15 -6
- package/sohelp-import/index.vue +470 -0
- package/sohelp-modal/index.vue +6 -2
- package/sohelp-page/index.vue +13 -0
- package/sohelp-vxe-grid/DefaultGridOptions.js +51 -26
- package/sohelp-vxe-grid/index.vue +376 -375
- package/sohelp-workflow/nodes/approver.vue +0 -1
|
@@ -1,15 +1,28 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
2
|
+
showFooter: false,
|
|
3
|
+
round: true,
|
|
4
|
+
border: true,
|
|
5
|
+
stripe: true,
|
|
6
|
+
loading: false,
|
|
7
|
+
minHeight: 300,
|
|
8
|
+
maxHeight: '100%',
|
|
9
|
+
size: 'mini',
|
|
10
|
+
params: {},
|
|
11
|
+
columnConfig: {
|
|
12
|
+
resizable: true,
|
|
13
|
+
drag: false
|
|
14
|
+
},
|
|
3
15
|
customConfig: {
|
|
4
16
|
//默认不会将列设置保存到本地存储中
|
|
5
17
|
storage: false,
|
|
6
18
|
placement: 'top-right' // 自定义列工具栏位置
|
|
7
19
|
},
|
|
8
20
|
rowConfig: {
|
|
21
|
+
keyField: 'id',
|
|
9
22
|
useKey: true, //sortable 排序
|
|
10
|
-
|
|
23
|
+
isHover: true,
|
|
11
24
|
isCurrent: true,
|
|
12
|
-
resizable:
|
|
25
|
+
resizable: false,
|
|
13
26
|
drag: true
|
|
14
27
|
},
|
|
15
28
|
rowDragConfig: {
|
|
@@ -51,6 +64,13 @@ export default {
|
|
|
51
64
|
range: true,
|
|
52
65
|
reserve: true
|
|
53
66
|
},
|
|
67
|
+
radioConfig: {
|
|
68
|
+
strict: false,
|
|
69
|
+
checkRowKey: 'id',
|
|
70
|
+
highlight: true,
|
|
71
|
+
reserve: true,
|
|
72
|
+
trigger: 'cell' // 关键配置:点击行触发选中
|
|
73
|
+
},
|
|
54
74
|
scrollX: {
|
|
55
75
|
gt: 0,
|
|
56
76
|
//自动启用纵向虚拟滚动
|
|
@@ -61,15 +81,6 @@ export default {
|
|
|
61
81
|
//自动启用纵向虚拟滚动
|
|
62
82
|
enabled: true
|
|
63
83
|
},
|
|
64
|
-
showFooter: false,
|
|
65
|
-
round: true,
|
|
66
|
-
border: true,
|
|
67
|
-
stripe: false,
|
|
68
|
-
loading: false,
|
|
69
|
-
minHeight: 300,
|
|
70
|
-
maxHeight: '100%',
|
|
71
|
-
size: 'mini',
|
|
72
|
-
params: {},
|
|
73
84
|
pagerConfig: {
|
|
74
85
|
enabled: true,
|
|
75
86
|
total: 0,
|
|
@@ -79,6 +90,8 @@ export default {
|
|
|
79
90
|
},
|
|
80
91
|
customConfig: {
|
|
81
92
|
immediate: false,
|
|
93
|
+
isCurrent: true,
|
|
94
|
+
resizable: true,
|
|
82
95
|
storage: {
|
|
83
96
|
visible: true, // 保存列显示/隐藏状态
|
|
84
97
|
resizable: true, // 保存列宽调整
|
|
@@ -89,10 +102,6 @@ export default {
|
|
|
89
102
|
header: 'setting'
|
|
90
103
|
}
|
|
91
104
|
},
|
|
92
|
-
columnConfig: {
|
|
93
|
-
isCurrent: true,
|
|
94
|
-
resizable: true
|
|
95
|
-
},
|
|
96
105
|
sortConfig: {
|
|
97
106
|
remote: true
|
|
98
107
|
},
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { reactive, ref } from
|
|
2
|
-
import _DefaultGridOptions from
|
|
3
|
-
import { moduleCache } from
|
|
4
|
-
import { usePermission } from
|
|
5
|
-
import { useMobile } from
|
|
6
|
-
import { useI18n } from
|
|
1
|
+
import { reactive, ref } from 'vue';
|
|
2
|
+
import _DefaultGridOptions from '../js/DefaultGridOptions';
|
|
3
|
+
import { moduleCache } from '../../cache/ModuleCache';
|
|
4
|
+
import { usePermission } from '@/utils/use-permission';
|
|
5
|
+
import { useMobile } from '@/utils/use-mobile';
|
|
6
|
+
import { useI18n } from 'vue-i18n';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* 深拷贝
|
|
@@ -19,27 +19,27 @@ function createDynamicStyle(styleConfigs = [], isCell = true) {
|
|
|
19
19
|
// 预编译条件表达式为函数
|
|
20
20
|
const compiledConfigs = styleConfigs.map((config) => ({
|
|
21
21
|
...config,
|
|
22
|
-
conditionFn: new Function(
|
|
22
|
+
conditionFn: new Function('row', `return ${config.condition}`)
|
|
23
23
|
}));
|
|
24
24
|
|
|
25
|
-
return function({ row, column }) {
|
|
25
|
+
return function ({ row, column }) {
|
|
26
26
|
const _config = isCell ? compiledConfigs.filter((c) => c.name === column.field) : compiledConfigs;
|
|
27
27
|
if (!_config || !_config.length) return null;
|
|
28
28
|
try {
|
|
29
29
|
for (const config of _config) {
|
|
30
|
-
const conditionFn = new Function(
|
|
30
|
+
const conditionFn = new Function('row', `return ${config.condition}`);
|
|
31
31
|
if (conditionFn(row)) {
|
|
32
32
|
return {
|
|
33
33
|
color: config.fontColor,
|
|
34
34
|
backgroundColor: config.bgColor,
|
|
35
|
-
fontWeight: config?.bold ?
|
|
36
|
-
fontStyle: config.italic ?
|
|
37
|
-
textDecoration: config.strikethrough ?
|
|
35
|
+
fontWeight: config?.bold ? 'bold' : '',
|
|
36
|
+
fontStyle: config.italic ? 'italic' : '',
|
|
37
|
+
textDecoration: config.strikethrough ? 'line-through' : config.underline ? 'underline' : ''
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
} catch (e) {
|
|
42
|
-
console.error(
|
|
42
|
+
console.error('条件解析错误:', e);
|
|
43
43
|
}
|
|
44
44
|
return null;
|
|
45
45
|
};
|
|
@@ -64,8 +64,8 @@ const switchVxeProperty = (property, sortList, f, formulaMap) => {
|
|
|
64
64
|
query: property.query,
|
|
65
65
|
width: property.width || 120,
|
|
66
66
|
type: property.editor || property.type,
|
|
67
|
-
align: property.align ||
|
|
68
|
-
titleSuffix: property.tooltip ? { content: property.tooltip, placement:
|
|
67
|
+
align: property.align || 'left',
|
|
68
|
+
titleSuffix: property.tooltip ? { content: property.tooltip, placement: 'top' } : '',
|
|
69
69
|
|
|
70
70
|
showOverflow: true,
|
|
71
71
|
editRender: {
|
|
@@ -75,13 +75,13 @@ const switchVxeProperty = (property, sortList, f, formulaMap) => {
|
|
|
75
75
|
},
|
|
76
76
|
fixed: !property.lock ? false : property.lockAlign,
|
|
77
77
|
slots: {
|
|
78
|
-
default:
|
|
79
|
-
header:
|
|
78
|
+
default: 'default_' + property.name,
|
|
79
|
+
header: 'header_' + property.name
|
|
80
80
|
},
|
|
81
81
|
contentRender: {
|
|
82
82
|
name: property.render,
|
|
83
83
|
props: property.renderParam || {},
|
|
84
|
-
event:
|
|
84
|
+
event: 'event'
|
|
85
85
|
}
|
|
86
86
|
};
|
|
87
87
|
|
|
@@ -90,22 +90,22 @@ const switchVxeProperty = (property, sortList, f, formulaMap) => {
|
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
if (property.dict) {
|
|
93
|
-
editor.editRender[
|
|
93
|
+
editor.editRender['code'] = property.dict;
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
// 取默认显示值
|
|
97
|
-
if (property.type ===
|
|
98
|
-
const fields = property.relationList?.split(
|
|
99
|
-
editor.labelField = fields.includes(
|
|
97
|
+
if (property.type === 'RELATION' && editor.labelField === '') {
|
|
98
|
+
const fields = property.relationList?.split(',');
|
|
99
|
+
editor.labelField = fields.includes('id') && fields.length > 1 ? fields[1] : fields[0];
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
// 自定义编辑插槽
|
|
103
103
|
if (property.edit) {
|
|
104
|
-
editor.slots.edit =
|
|
104
|
+
editor.slots.edit = 'edit_' + property.name;
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
if (
|
|
108
|
-
[
|
|
108
|
+
['SohelpImageUpload', 'SohelpFileUpload', 'SohelpRate', 'SohelpSwitch', 'SohelpProcess'].includes(property.editor)
|
|
109
109
|
) {
|
|
110
110
|
delete editor.slots.edit; //不渲染编辑
|
|
111
111
|
editor.editRender.enabled = false;
|
|
@@ -120,16 +120,16 @@ const switchVxeProperty = (property, sortList, f, formulaMap) => {
|
|
|
120
120
|
const isSummary = f.find((item) => item.field === property.name);
|
|
121
121
|
|
|
122
122
|
if (isSummary) {
|
|
123
|
-
editor.slots[
|
|
123
|
+
editor.slots['footer'] = 'footer_' + property.name;
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
// 排序
|
|
127
127
|
if (sortList?.includes(property.name)) {
|
|
128
|
-
editor[
|
|
128
|
+
editor['sortable'] = true;
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
-
if (property.name ===
|
|
132
|
-
editor[
|
|
131
|
+
if (property.name === 'id') {
|
|
132
|
+
editor['width'] = 150;
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
return editor;
|
|
@@ -139,11 +139,11 @@ const switchVxeProperty = (property, sortList, f, formulaMap) => {
|
|
|
139
139
|
* 筛选配置
|
|
140
140
|
*/
|
|
141
141
|
const switchFilterConfig = (editor) => {
|
|
142
|
-
editor.filters = [{ data:
|
|
142
|
+
editor.filters = [{ data: '', checked: false }];
|
|
143
143
|
editor.filterRender = {};
|
|
144
144
|
editor.slots = {
|
|
145
145
|
...editor.slots,
|
|
146
|
-
filter:
|
|
146
|
+
filter: 'filter_' + editor.field
|
|
147
147
|
};
|
|
148
148
|
};
|
|
149
149
|
|
|
@@ -168,7 +168,7 @@ const filterFieldsByProperties = (_data) => {
|
|
|
168
168
|
});
|
|
169
169
|
|
|
170
170
|
data.filter.keywords = filterArray(data.filter.keywords);
|
|
171
|
-
data.filter.field = filterArray(data.filter.field,
|
|
171
|
+
data.filter.field = filterArray(data.filter.field, 'name');
|
|
172
172
|
|
|
173
173
|
//过滤掉不在列表中的sort属性
|
|
174
174
|
data.filter.sort = filterArray(data.filter.sort.filter((item) => data.filter.field.some((f) => f.name === item)));
|
|
@@ -180,14 +180,14 @@ const filterFieldsByProperties = (_data) => {
|
|
|
180
180
|
* 工具栏默认图标
|
|
181
181
|
*/
|
|
182
182
|
const defaultIcons = {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
183
|
+
'crud.edit': 'vxe-icon-edit',
|
|
184
|
+
'crud.delete': 'vxe-icon-delete',
|
|
185
|
+
'crud.create': 'vxe-icon-add',
|
|
186
|
+
'crud.save': 'vxe-icon-save',
|
|
187
|
+
'crud.view': 'vxe-icon-eye-fill',
|
|
188
|
+
'workflow.submit': 'vxe-icon-success-circle',
|
|
189
|
+
'workflow.view': 'vxe-icon-file-txt',
|
|
190
|
+
'report.print': 'vxe-icon-print'
|
|
191
191
|
};
|
|
192
192
|
|
|
193
193
|
/**
|
|
@@ -209,11 +209,11 @@ const getToolbarsButtons = (data) => {
|
|
|
209
209
|
const formatterButton = (arr, type) => {
|
|
210
210
|
return arr.map((item) => {
|
|
211
211
|
let params = {};
|
|
212
|
-
if (item.params && typeof item.params ===
|
|
212
|
+
if (item.params && typeof item.params === 'string') {
|
|
213
213
|
try {
|
|
214
214
|
params = JSON.parse(item.params);
|
|
215
215
|
} catch (e) {
|
|
216
|
-
console.error(
|
|
216
|
+
console.error('FormatterButton Error:', e);
|
|
217
217
|
params = {};
|
|
218
218
|
}
|
|
219
219
|
}
|
|
@@ -237,16 +237,16 @@ const getToolbarsButtons = (data) => {
|
|
|
237
237
|
let arr = [...formatterButton(common)];
|
|
238
238
|
if (more.length > 0) {
|
|
239
239
|
arr.push({
|
|
240
|
-
code:
|
|
241
|
-
name:
|
|
240
|
+
code: 'more',
|
|
241
|
+
name: '更多操作',
|
|
242
242
|
dropdowns: formatterButton(more)
|
|
243
243
|
});
|
|
244
244
|
}
|
|
245
245
|
if (batch.length > 0) {
|
|
246
246
|
arr.push({
|
|
247
|
-
code:
|
|
248
|
-
name:
|
|
249
|
-
dropdowns: formatterButton(batch,
|
|
247
|
+
code: 'batchMore',
|
|
248
|
+
name: '批量操作',
|
|
249
|
+
dropdowns: formatterButton(batch, 'batch'),
|
|
250
250
|
disabled: true
|
|
251
251
|
});
|
|
252
252
|
}
|
|
@@ -288,9 +288,9 @@ export function useSohelpGridConfig() {
|
|
|
288
288
|
* 初始化商邦网格列表配置
|
|
289
289
|
*/
|
|
290
290
|
const initial = async (isGridConfig, refid) => {
|
|
291
|
-
if (!refid) throw new Error(
|
|
291
|
+
if (!refid) throw new Error('配置列表请配置地址!');
|
|
292
292
|
let _refid = refid;
|
|
293
|
-
if (_refid.indexOf(
|
|
293
|
+
if (_refid.indexOf('!') === -1) _refid = refid + '!default';
|
|
294
294
|
|
|
295
295
|
isConfigInitialized.value = false;
|
|
296
296
|
const permission = usePermission();
|
|
@@ -302,7 +302,7 @@ export function useSohelpGridConfig() {
|
|
|
302
302
|
const config = isGridConfig ? await moduleCache.getGrid(_refid) : await moduleCache.getEntityGrid(_refid);
|
|
303
303
|
|
|
304
304
|
if (!config) {
|
|
305
|
-
throw new Error(_refid +
|
|
305
|
+
throw new Error(_refid + ' : 没有发现网格列表配置!');
|
|
306
306
|
}
|
|
307
307
|
|
|
308
308
|
try {
|
|
@@ -311,11 +311,11 @@ export function useSohelpGridConfig() {
|
|
|
311
311
|
propertiesMap,
|
|
312
312
|
(SohelpConfig?.properties || []).reduce((acc, cur) => {
|
|
313
313
|
let param = {};
|
|
314
|
-
if (cur?.editorParam && typeof cur.editorParam ===
|
|
314
|
+
if (cur?.editorParam && typeof cur.editorParam === 'string') {
|
|
315
315
|
try {
|
|
316
316
|
param = JSON.parse(cur.editorParam);
|
|
317
317
|
} catch (e) {
|
|
318
|
-
console.error(
|
|
318
|
+
console.error('解析editorParam失败:', e);
|
|
319
319
|
}
|
|
320
320
|
}
|
|
321
321
|
acc[cur.name] = { ...cur, editorParam: param };
|
|
@@ -343,14 +343,14 @@ export function useSohelpGridConfig() {
|
|
|
343
343
|
DefaultGridOptions.toolbarConfig.buttons = buttons;
|
|
344
344
|
// 更多下拉菜单索引
|
|
345
345
|
batchButtonsIndex = buttons.reduce((acc, curr, index) => {
|
|
346
|
-
if (curr.code ===
|
|
346
|
+
if (curr.code === 'batchMore') acc.push(index);
|
|
347
347
|
return acc;
|
|
348
348
|
}, []);
|
|
349
349
|
|
|
350
350
|
//把标题转成国际化
|
|
351
351
|
buttons.forEach((item) => {
|
|
352
|
-
const code = item.code.replace(
|
|
353
|
-
const i18nKey = item.i18n ===
|
|
352
|
+
const code = item.code.replace('.', '-');
|
|
353
|
+
const i18nKey = item.i18n === '' || code !== 'custom' ? 'grid.toolbar.' + code : item.i18n;
|
|
354
354
|
if (i18nKey) {
|
|
355
355
|
const i18n = t(i18nKey);
|
|
356
356
|
item.name = i18n ? i18n : item.name;
|
|
@@ -359,38 +359,60 @@ export function useSohelpGridConfig() {
|
|
|
359
359
|
}
|
|
360
360
|
|
|
361
361
|
//初始化属性列表配置
|
|
362
|
-
let columns = [
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
362
|
+
let columns = [];
|
|
363
|
+
|
|
364
|
+
//是否支持选择
|
|
365
|
+
if (config?.selectionType === 'checkbox') {
|
|
366
|
+
columns.push({
|
|
367
|
+
field: '_checkbox',
|
|
368
|
+
title: '',
|
|
369
|
+
fixed: mobile.value ? false : 'left',
|
|
370
|
+
type: 'checkbox',
|
|
371
|
+
align: 'center',
|
|
369
372
|
width: 40
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
if (config?.selectionType === 'radio') {
|
|
377
|
+
columns.push({
|
|
378
|
+
field: '_radio',
|
|
379
|
+
title: '',
|
|
380
|
+
fixed: mobile.value ? false : 'left',
|
|
381
|
+
type: 'radio',
|
|
382
|
+
align: 'center',
|
|
377
383
|
width: 40
|
|
378
|
-
}
|
|
379
|
-
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
//是否显示行号
|
|
388
|
+
if (config?.rowNumber) {
|
|
389
|
+
columns.push({
|
|
390
|
+
field: '_seq',
|
|
391
|
+
type: 'seq',
|
|
392
|
+
title: '#',
|
|
393
|
+
fixed: mobile.value ? false : 'left',
|
|
394
|
+
align: 'center',
|
|
395
|
+
width: 40
|
|
396
|
+
});
|
|
397
|
+
}
|
|
380
398
|
|
|
381
|
-
const isRowDrag = config.rowDrag;
|
|
382
399
|
//是否支持拖动
|
|
383
|
-
if (
|
|
400
|
+
if (config?.rowDrag) {
|
|
384
401
|
columns.unshift({
|
|
385
|
-
title:
|
|
386
|
-
fixed: mobile.value ? false :
|
|
402
|
+
title: '',
|
|
403
|
+
fixed: mobile.value ? false : 'left',
|
|
387
404
|
width: 40,
|
|
388
|
-
align:
|
|
405
|
+
align: 'center',
|
|
389
406
|
dragSort: true,
|
|
390
|
-
field:
|
|
407
|
+
field: '_drag'
|
|
391
408
|
});
|
|
392
409
|
}
|
|
393
410
|
|
|
411
|
+
//列拖动
|
|
412
|
+
if (config?.columnDrag) {
|
|
413
|
+
DefaultGridOptions.columnConfig.drag = true;
|
|
414
|
+
}
|
|
415
|
+
|
|
394
416
|
const requireData = {};
|
|
395
417
|
//商邦列转换成Vxe列
|
|
396
418
|
if (SohelpConfig.properties?.length > 0) {
|
|
@@ -402,10 +424,10 @@ export function useSohelpGridConfig() {
|
|
|
402
424
|
row.visible = SohelpConfig.list.includes(item.name);
|
|
403
425
|
row.fixed = mobile.value ? false : row.fixed;
|
|
404
426
|
// 添加操作栏插槽
|
|
405
|
-
if (item.name ===
|
|
427
|
+
if (item.name === '_operation') {
|
|
406
428
|
row.visible = true;
|
|
407
429
|
row.slots = {
|
|
408
|
-
default:
|
|
430
|
+
default: '_operation'
|
|
409
431
|
};
|
|
410
432
|
}
|
|
411
433
|
|
|
@@ -416,22 +438,22 @@ export function useSohelpGridConfig() {
|
|
|
416
438
|
requireData[item.name] = [
|
|
417
439
|
{
|
|
418
440
|
required: true,
|
|
419
|
-
message: row.title +
|
|
441
|
+
message: row.title + '不能为空'
|
|
420
442
|
}
|
|
421
443
|
];
|
|
422
444
|
}
|
|
423
445
|
});
|
|
424
446
|
|
|
425
447
|
//没有工具栏则不显示操作拦
|
|
426
|
-
if (config?.
|
|
427
|
-
columns = columns.filter((item) => item.field !=
|
|
448
|
+
if (config?.operations?.length == 0) {
|
|
449
|
+
columns = columns.filter((item) => item.field != '_operation');
|
|
428
450
|
}
|
|
429
451
|
|
|
430
452
|
//将columns按照fields排序
|
|
431
453
|
const sortColumns = columns
|
|
432
454
|
.sort((a, b) => {
|
|
433
|
-
if (a.field ===
|
|
434
|
-
if (b.field ===
|
|
455
|
+
if (a.field === '_operation') return 1;
|
|
456
|
+
if (b.field === '_operation') return -1;
|
|
435
457
|
return config.list.indexOf(a.field) - config.list.indexOf(b.field);
|
|
436
458
|
})
|
|
437
459
|
.sort((a, b) => {
|
|
@@ -440,8 +462,8 @@ export function useSohelpGridConfig() {
|
|
|
440
462
|
|
|
441
463
|
//_operation列安排最后一列
|
|
442
464
|
DefaultGridOptions.columns = [
|
|
443
|
-
...sortColumns.filter((col) => col.field !==
|
|
444
|
-
...sortColumns.filter((col) => col.field ===
|
|
465
|
+
...sortColumns.filter((col) => col.field !== '_operation'),
|
|
466
|
+
...sortColumns.filter((col) => col.field === '_operation')
|
|
445
467
|
];
|
|
446
468
|
DefaultGridOptions.editRules = { ...requireData };
|
|
447
469
|
}
|
|
@@ -464,7 +486,7 @@ export function useSohelpGridConfig() {
|
|
|
464
486
|
|
|
465
487
|
// 拦截编辑
|
|
466
488
|
DefaultGridOptions.editConfig.beforeEditMethod = ({ row, column }) => {
|
|
467
|
-
if (column.type ===
|
|
489
|
+
if (column.type === 'SohelpTextarea') {
|
|
468
490
|
return false;
|
|
469
491
|
}
|
|
470
492
|
return true;
|
|
@@ -476,8 +498,8 @@ export function useSohelpGridConfig() {
|
|
|
476
498
|
|
|
477
499
|
// 行列样式
|
|
478
500
|
if (config.colors && config.colors.length > 0) {
|
|
479
|
-
const rowData = config.colors.filter((item) => item.type !==
|
|
480
|
-
const cellData = config.colors.filter((item) => item.type ===
|
|
501
|
+
const rowData = config.colors.filter((item) => item.type !== 'c');
|
|
502
|
+
const cellData = config.colors.filter((item) => item.type === 'c');
|
|
481
503
|
if (rowData.length > 0) {
|
|
482
504
|
DefaultGridOptions.rowStyle = createDynamicRowStyle(rowData);
|
|
483
505
|
} else {
|
|
@@ -488,21 +510,69 @@ export function useSohelpGridConfig() {
|
|
|
488
510
|
}
|
|
489
511
|
}
|
|
490
512
|
isConfigInitialized.value = true;
|
|
513
|
+
|
|
514
|
+
//序号列配置
|
|
515
|
+
DefaultGridOptions.seqConfig = {
|
|
516
|
+
seqMethod: ({ rowIndex }) => {
|
|
517
|
+
const { pageSize, currentPage } = DefaultGridOptions.pagerConfig;
|
|
518
|
+
return (currentPage - 1) * pageSize + rowIndex + 1;
|
|
519
|
+
}
|
|
520
|
+
};
|
|
521
|
+
|
|
491
522
|
//转化初始化其他参数...
|
|
492
523
|
} catch (error) {
|
|
493
524
|
throw error; //重新抛出错误,以便调用者可以处理它
|
|
494
525
|
}
|
|
495
526
|
|
|
527
|
+
const operationsButtons = getOperationToolbars();
|
|
496
528
|
return {
|
|
497
529
|
gridOptions: DefaultGridOptions,
|
|
498
530
|
sohelpConfig: SohelpConfig,
|
|
499
531
|
propertiesMap: propertiesMap,
|
|
500
532
|
batchButtonsIndex: batchButtonsIndex,
|
|
501
533
|
footerData: footerData,
|
|
502
|
-
formulaMap: formulaMap
|
|
534
|
+
formulaMap: formulaMap,
|
|
535
|
+
operationsButtons: operationsButtons
|
|
503
536
|
};
|
|
504
537
|
};
|
|
505
538
|
|
|
539
|
+
// 操作栏按钮分类
|
|
540
|
+
const getOperationToolbars = () => {
|
|
541
|
+
const buttonsMap = {};
|
|
542
|
+
const permission = usePermission();
|
|
543
|
+
SohelpConfig.operations
|
|
544
|
+
?.filter((f) => !f.authority || permission.hasPermission(f.authority))
|
|
545
|
+
.map((button) => {
|
|
546
|
+
const type = button.buttonType || 'common';
|
|
547
|
+
const code = button.type === 'custom' ? button.id : button.type;
|
|
548
|
+
if (!buttonsMap[type]) {
|
|
549
|
+
buttonsMap[type] = [];
|
|
550
|
+
}
|
|
551
|
+
const title = button.type === 'custom' ? button.title : t('grid.toolbar.' + button.type?.replaceAll('.', '-'));
|
|
552
|
+
let params = button.params || {};
|
|
553
|
+
if (button.params && typeof button.params === 'string') {
|
|
554
|
+
try {
|
|
555
|
+
params = JSON.parse(button.params);
|
|
556
|
+
} catch (e) {
|
|
557
|
+
params = {};
|
|
558
|
+
EleMessage.error('button.params配置JSON参数格式错误');
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
buttonsMap[type].push({
|
|
562
|
+
title: title || button.title,
|
|
563
|
+
id: button.id,
|
|
564
|
+
code: code,
|
|
565
|
+
handler: button.handler,
|
|
566
|
+
icon: button.iconCls,
|
|
567
|
+
params: params,
|
|
568
|
+
refid: button.refid,
|
|
569
|
+
openType: button.openType,
|
|
570
|
+
render: button.render
|
|
571
|
+
});
|
|
572
|
+
});
|
|
573
|
+
return buttonsMap;
|
|
574
|
+
};
|
|
575
|
+
|
|
506
576
|
/**
|
|
507
577
|
* 配置是否加载完成
|
|
508
578
|
*/
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
<!-- advanced -->
|
|
26
26
|
<div class="advanced-box" ref="advancedBoxRef">
|
|
27
27
|
<filter-condition-item
|
|
28
|
+
@search="filter"
|
|
28
29
|
v-for="(item, index) in getFilterList"
|
|
29
30
|
:key="item.name"
|
|
30
31
|
v-model="filterValue.filter[index]"
|
|
@@ -37,8 +38,8 @@
|
|
|
37
38
|
v-if="filterList.length > 0 && config.filter?.config.filterPosition !== 'MODAL'"
|
|
38
39
|
ref="searchButtonRef"
|
|
39
40
|
>
|
|
40
|
-
<el-button size="small" plain @click="reset">{{ t('grid.toolbar.reset') }}</el-button>
|
|
41
|
-
<el-button type="primary" size="small" @click="filter">{{ t('grid.toolbar.filter') }}</el-button>
|
|
41
|
+
<el-button size="small" plain @click="reset" :icon="Refresh">{{ t('grid.toolbar.reset') }}</el-button>
|
|
42
|
+
<el-button type="primary" size="small" @click="filter" :icon="Search">{{ t('grid.toolbar.filter') }}</el-button>
|
|
42
43
|
<el-link
|
|
43
44
|
plain
|
|
44
45
|
@click="toggleFilter"
|
|
@@ -62,7 +63,7 @@
|
|
|
62
63
|
import FilterConditionItem from '../../sohelp-grid/components/filter-condition-item.vue';
|
|
63
64
|
import { useMobile } from '@/utils/use-mobile';
|
|
64
65
|
import { useI18n } from 'vue-i18n';
|
|
65
|
-
import { Plus, Minus } from '@element-plus/icons-vue';
|
|
66
|
+
import { Plus, Minus, Search, Refresh } from '@element-plus/icons-vue';
|
|
66
67
|
|
|
67
68
|
const { mobile } = useMobile();
|
|
68
69
|
const { t } = useI18n();
|
|
@@ -298,11 +299,12 @@
|
|
|
298
299
|
.scheme-box {
|
|
299
300
|
padding-top: 10px;
|
|
300
301
|
display: flex;
|
|
301
|
-
align-items:
|
|
302
|
+
align-items: flex-start;
|
|
302
303
|
gap: 10px;
|
|
303
304
|
|
|
304
305
|
.scheme-list {
|
|
305
306
|
display: flex;
|
|
307
|
+
gap: 5px;
|
|
306
308
|
}
|
|
307
309
|
}
|
|
308
310
|
|
|
@@ -396,6 +398,10 @@
|
|
|
396
398
|
bottom: 0px;
|
|
397
399
|
position: absolute;
|
|
398
400
|
}
|
|
401
|
+
|
|
402
|
+
.scheme-box {
|
|
403
|
+
flex-direction: column;
|
|
404
|
+
}
|
|
399
405
|
}
|
|
400
406
|
|
|
401
407
|
.sohelp-filter.right .sohelp-filter-condition {
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { computed, ref } from 'vue';
|
|
5
5
|
import FilterConfig from './config/index.vue';
|
|
6
6
|
import { useI18n } from 'vue-i18n';
|
|
7
|
+
import { Search, Refresh } from '@element-plus/icons-vue';
|
|
7
8
|
|
|
8
9
|
const emit = defineEmits('change', 'filter', 'update:modelValue', 'close', 'reset', 'save', 'changeFilterScheme');
|
|
9
10
|
|
|
@@ -143,8 +144,10 @@
|
|
|
143
144
|
></filter-form>
|
|
144
145
|
<template #footer>
|
|
145
146
|
<div class="footer-right" v-if="config.filter.config.filterPosition !== 'TOP'">
|
|
146
|
-
<el-button size="small" plain @click="reset">{{ t('grid.toolbar.reset') }}</el-button>
|
|
147
|
-
<el-button type="primary" size="small" @click="filter(false)">{{
|
|
147
|
+
<el-button size="small" plain @click="reset" :icon="Refresh">{{ t('grid.toolbar.reset') }}</el-button>
|
|
148
|
+
<el-button type="primary" size="small" @click="filter(false)" :icon="Search">{{
|
|
149
|
+
t('grid.toolbar.filter')
|
|
150
|
+
}}</el-button>
|
|
148
151
|
</div>
|
|
149
152
|
</template>
|
|
150
153
|
</ele-modal>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
|
|
2
|
+
import { computed, nextTick, reactive, ref, watch } from "vue";
|
|
3
3
|
import { useMobile } from '@/utils/use-mobile';
|
|
4
4
|
import SohelpFilter from './filter/index.vue';
|
|
5
5
|
import SohelpGrid from '../sohelp-grid/index.vue';
|
|
@@ -128,19 +128,28 @@
|
|
|
128
128
|
|
|
129
129
|
/**
|
|
130
130
|
* 查询数据
|
|
131
|
-
* @param
|
|
131
|
+
* @param params 区分是高级筛选,还是列筛选
|
|
132
132
|
*/
|
|
133
|
-
const reload = (
|
|
134
|
-
sohelpGridRef.value.reload(
|
|
133
|
+
const reload = (params = {}, callback) => {
|
|
134
|
+
sohelpGridRef.value.reload(params, callback);
|
|
135
135
|
};
|
|
136
|
-
|
|
137
|
-
|
|
136
|
+
/**
|
|
137
|
+
* 加载数据
|
|
138
|
+
* @param params
|
|
139
|
+
* @param callback
|
|
140
|
+
*/
|
|
141
|
+
const load = (params = {}, callback) => {
|
|
142
|
+
sohelpGridRef.value.load(params, callback);
|
|
138
143
|
};
|
|
144
|
+
/**
|
|
145
|
+
* 刷新数据
|
|
146
|
+
*/
|
|
139
147
|
const refresh = () => {
|
|
140
148
|
sohelpGridRef.value.refresh();
|
|
141
149
|
};
|
|
142
150
|
|
|
143
151
|
const changeFilterScheme = (schemeValue, filterValue) => {
|
|
152
|
+
sohelpGridRef.value.reload({});
|
|
144
153
|
emit('changeFilterScheme', schemeValue, filterValue);
|
|
145
154
|
};
|
|
146
155
|
/**
|