sohelp-eleplus 1.1.19 → 1.1.21
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-dyn-select/props.js +4 -4
- package/sohelp-entity-form/index.vue +31 -6
- package/sohelp-grid/components/filter-condition-item.vue +9 -3
- package/sohelp-grid/index.vue +348 -156
- package/sohelp-grid/js/DefaultGridOptions.js +25 -16
- package/sohelp-grid/js/useSohelpGridConfig.js +180 -91
- package/sohelp-grid-view/filter/config/grid-filter-condition.vue +8 -37
- package/sohelp-grid-view/filter/config/index.vue +6 -9
- package/sohelp-grid-view/filter/filter-form.vue +21 -17
- package/sohelp-grid-view/filter/index.vue +5 -2
- package/sohelp-grid-view/index.vue +22 -9
- package/sohelp-import/index.vue +470 -0
- package/sohelp-modal/index.vue +7 -2
- package/sohelp-page/index.vue +13 -0
- package/sohelp-pro-form/components/pro-form-item.vue +1 -0
- package/sohelp-rich-text/index.vue +3 -21
- package/sohelp-vxe-grid/DefaultGridOptions.js +51 -26
- package/sohelp-vxe-grid/index.vue +383 -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
|
|
|
@@ -89,23 +89,24 @@ const switchVxeProperty = (property, sortList, f, formulaMap) => {
|
|
|
89
89
|
editor.editRender.maxlength = property.length;
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
// 字典
|
|
93
|
+
if (property.type === 'SohelpDict') {
|
|
94
|
+
editor.editRender['code'] = property.editRender?.code || property.dict;
|
|
94
95
|
}
|
|
95
96
|
|
|
96
97
|
// 取默认显示值
|
|
97
|
-
if (property.type ===
|
|
98
|
-
const fields = property.relationList?.split(
|
|
99
|
-
editor.labelField = fields.includes(
|
|
98
|
+
if (property.type === 'RELATION' && editor.labelField === '') {
|
|
99
|
+
const fields = property.relationList?.split(',');
|
|
100
|
+
editor.labelField = fields.includes('id') && fields.length > 1 ? fields[1] : fields[0];
|
|
100
101
|
}
|
|
101
102
|
|
|
102
103
|
// 自定义编辑插槽
|
|
103
104
|
if (property.edit) {
|
|
104
|
-
editor.slots.edit =
|
|
105
|
+
editor.slots.edit = 'edit_' + property.name;
|
|
105
106
|
}
|
|
106
107
|
|
|
107
108
|
if (
|
|
108
|
-
[
|
|
109
|
+
['SohelpImageUpload', 'SohelpFileUpload', 'SohelpRate', 'SohelpSwitch', 'SohelpProcess'].includes(property.editor)
|
|
109
110
|
) {
|
|
110
111
|
delete editor.slots.edit; //不渲染编辑
|
|
111
112
|
editor.editRender.enabled = false;
|
|
@@ -120,16 +121,16 @@ const switchVxeProperty = (property, sortList, f, formulaMap) => {
|
|
|
120
121
|
const isSummary = f.find((item) => item.field === property.name);
|
|
121
122
|
|
|
122
123
|
if (isSummary) {
|
|
123
|
-
editor.slots[
|
|
124
|
+
editor.slots['footer'] = 'footer_' + property.name;
|
|
124
125
|
}
|
|
125
126
|
|
|
126
127
|
// 排序
|
|
127
128
|
if (sortList?.includes(property.name)) {
|
|
128
|
-
editor[
|
|
129
|
+
editor['sortable'] = true;
|
|
129
130
|
}
|
|
130
131
|
|
|
131
|
-
if (property.name ===
|
|
132
|
-
editor[
|
|
132
|
+
if (property.name === 'id') {
|
|
133
|
+
editor['width'] = 150;
|
|
133
134
|
}
|
|
134
135
|
|
|
135
136
|
return editor;
|
|
@@ -139,11 +140,11 @@ const switchVxeProperty = (property, sortList, f, formulaMap) => {
|
|
|
139
140
|
* 筛选配置
|
|
140
141
|
*/
|
|
141
142
|
const switchFilterConfig = (editor) => {
|
|
142
|
-
editor.filters = [{ data:
|
|
143
|
+
editor.filters = [{ data: '', checked: false }];
|
|
143
144
|
editor.filterRender = {};
|
|
144
145
|
editor.slots = {
|
|
145
146
|
...editor.slots,
|
|
146
|
-
filter:
|
|
147
|
+
filter: 'filter_' + editor.field
|
|
147
148
|
};
|
|
148
149
|
};
|
|
149
150
|
|
|
@@ -168,10 +169,10 @@ const filterFieldsByProperties = (_data) => {
|
|
|
168
169
|
});
|
|
169
170
|
|
|
170
171
|
data.filter.keywords = filterArray(data.filter.keywords);
|
|
171
|
-
data.filter.field = filterArray(data.filter.field,
|
|
172
|
+
data.filter.field = filterArray(data.filter.field, 'name');
|
|
172
173
|
|
|
173
174
|
//过滤掉不在列表中的sort属性
|
|
174
|
-
data.filter.sort = filterArray(data.filter.sort.filter((item) => data.
|
|
175
|
+
data.filter.sort = filterArray(data.filter.sort.filter((item) => data.list.some((f) => f === item)));
|
|
175
176
|
data.properties = data.properties.filter((item) => item.name && !item.hidden);
|
|
176
177
|
return data;
|
|
177
178
|
};
|
|
@@ -180,14 +181,14 @@ const filterFieldsByProperties = (_data) => {
|
|
|
180
181
|
* 工具栏默认图标
|
|
181
182
|
*/
|
|
182
183
|
const defaultIcons = {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
184
|
+
'crud.edit': 'vxe-icon-edit',
|
|
185
|
+
'crud.delete': 'vxe-icon-delete',
|
|
186
|
+
'crud.create': 'vxe-icon-add',
|
|
187
|
+
'crud.save': 'vxe-icon-save',
|
|
188
|
+
'crud.view': 'vxe-icon-eye-fill',
|
|
189
|
+
'workflow.submit': 'vxe-icon-success-circle',
|
|
190
|
+
'workflow.view': 'vxe-icon-file-txt',
|
|
191
|
+
'report.print': 'vxe-icon-print'
|
|
191
192
|
};
|
|
192
193
|
|
|
193
194
|
/**
|
|
@@ -209,11 +210,11 @@ const getToolbarsButtons = (data) => {
|
|
|
209
210
|
const formatterButton = (arr, type) => {
|
|
210
211
|
return arr.map((item) => {
|
|
211
212
|
let params = {};
|
|
212
|
-
if (item.params && typeof item.params ===
|
|
213
|
+
if (item.params && typeof item.params === 'string') {
|
|
213
214
|
try {
|
|
214
215
|
params = JSON.parse(item.params);
|
|
215
216
|
} catch (e) {
|
|
216
|
-
console.error(
|
|
217
|
+
console.error('FormatterButton Error:', e);
|
|
217
218
|
params = {};
|
|
218
219
|
}
|
|
219
220
|
}
|
|
@@ -237,16 +238,16 @@ const getToolbarsButtons = (data) => {
|
|
|
237
238
|
let arr = [...formatterButton(common)];
|
|
238
239
|
if (more.length > 0) {
|
|
239
240
|
arr.push({
|
|
240
|
-
code:
|
|
241
|
-
name:
|
|
241
|
+
code: 'more',
|
|
242
|
+
name: '更多操作',
|
|
242
243
|
dropdowns: formatterButton(more)
|
|
243
244
|
});
|
|
244
245
|
}
|
|
245
246
|
if (batch.length > 0) {
|
|
246
247
|
arr.push({
|
|
247
|
-
code:
|
|
248
|
-
name:
|
|
249
|
-
dropdowns: formatterButton(batch,
|
|
248
|
+
code: 'batchMore',
|
|
249
|
+
name: '批量操作',
|
|
250
|
+
dropdowns: formatterButton(batch, 'batch'),
|
|
250
251
|
disabled: true
|
|
251
252
|
});
|
|
252
253
|
}
|
|
@@ -284,13 +285,30 @@ export function useSohelpGridConfig() {
|
|
|
284
285
|
*/
|
|
285
286
|
const isConfigInitialized = ref(false);
|
|
286
287
|
const { t } = useI18n();
|
|
288
|
+
/**
|
|
289
|
+
* placeholder占位符映射
|
|
290
|
+
*/
|
|
291
|
+
const placeholderMap = {
|
|
292
|
+
SohelpSelect: '请选择ss',
|
|
293
|
+
SohelpTreeSelect: '请选择',
|
|
294
|
+
SohelpDict: '请选择',
|
|
295
|
+
SohelpUserSelect: '请选择用户',
|
|
296
|
+
SohelpDeptSelect: '请选择部门',
|
|
297
|
+
SohelpRoleSelect: '请选择角色',
|
|
298
|
+
SohelpDatePicker: '请选择日期',
|
|
299
|
+
SohelpTimePicker: '请选择时间',
|
|
300
|
+
SohelpDateTimePicker: '请选择日期时间',
|
|
301
|
+
SohelpInput: '请输入',
|
|
302
|
+
SohelpNumberInput: '请输入'
|
|
303
|
+
};
|
|
304
|
+
|
|
287
305
|
/**
|
|
288
306
|
* 初始化商邦网格列表配置
|
|
289
307
|
*/
|
|
290
308
|
const initial = async (isGridConfig, refid) => {
|
|
291
|
-
if (!refid) throw new Error(
|
|
309
|
+
if (!refid) throw new Error('配置列表请配置地址!');
|
|
292
310
|
let _refid = refid;
|
|
293
|
-
if (_refid.indexOf(
|
|
311
|
+
if (_refid.indexOf('!') === -1) _refid = refid + '!default';
|
|
294
312
|
|
|
295
313
|
isConfigInitialized.value = false;
|
|
296
314
|
const permission = usePermission();
|
|
@@ -302,7 +320,7 @@ export function useSohelpGridConfig() {
|
|
|
302
320
|
const config = isGridConfig ? await moduleCache.getGrid(_refid) : await moduleCache.getEntityGrid(_refid);
|
|
303
321
|
|
|
304
322
|
if (!config) {
|
|
305
|
-
throw new Error(_refid +
|
|
323
|
+
throw new Error(_refid + ' : 没有发现网格列表配置!');
|
|
306
324
|
}
|
|
307
325
|
|
|
308
326
|
try {
|
|
@@ -311,13 +329,14 @@ export function useSohelpGridConfig() {
|
|
|
311
329
|
propertiesMap,
|
|
312
330
|
(SohelpConfig?.properties || []).reduce((acc, cur) => {
|
|
313
331
|
let param = {};
|
|
314
|
-
if (cur?.editorParam && typeof cur.editorParam ===
|
|
332
|
+
if (cur?.editorParam && typeof cur.editorParam === 'string') {
|
|
315
333
|
try {
|
|
316
334
|
param = JSON.parse(cur.editorParam);
|
|
317
335
|
} catch (e) {
|
|
318
|
-
console.error(
|
|
336
|
+
console.error('解析editorParam失败:', e);
|
|
319
337
|
}
|
|
320
338
|
}
|
|
339
|
+
param.placeholder = param?.placeholder || placeholderMap[cur?.editor] || '';
|
|
321
340
|
acc[cur.name] = { ...cur, editorParam: param };
|
|
322
341
|
return acc;
|
|
323
342
|
}, {})
|
|
@@ -343,14 +362,14 @@ export function useSohelpGridConfig() {
|
|
|
343
362
|
DefaultGridOptions.toolbarConfig.buttons = buttons;
|
|
344
363
|
// 更多下拉菜单索引
|
|
345
364
|
batchButtonsIndex = buttons.reduce((acc, curr, index) => {
|
|
346
|
-
if (curr.code ===
|
|
365
|
+
if (curr.code === 'batchMore') acc.push(index);
|
|
347
366
|
return acc;
|
|
348
367
|
}, []);
|
|
349
368
|
|
|
350
369
|
//把标题转成国际化
|
|
351
370
|
buttons.forEach((item) => {
|
|
352
|
-
const code = item.code.replace(
|
|
353
|
-
const i18nKey = item.i18n ===
|
|
371
|
+
const code = item.code.replace('.', '-');
|
|
372
|
+
const i18nKey = item.i18n === '' || code !== 'custom' ? 'grid.toolbar.' + code : item.i18n;
|
|
354
373
|
if (i18nKey) {
|
|
355
374
|
const i18n = t(i18nKey);
|
|
356
375
|
item.name = i18n ? i18n : item.name;
|
|
@@ -359,38 +378,60 @@ export function useSohelpGridConfig() {
|
|
|
359
378
|
}
|
|
360
379
|
|
|
361
380
|
//初始化属性列表配置
|
|
362
|
-
let columns = [
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
381
|
+
let columns = [];
|
|
382
|
+
|
|
383
|
+
//是否支持选择
|
|
384
|
+
if (config?.selectionType === 'checkbox') {
|
|
385
|
+
columns.push({
|
|
386
|
+
field: '_checkbox',
|
|
387
|
+
title: '',
|
|
388
|
+
fixed: mobile.value ? false : 'left',
|
|
389
|
+
type: 'checkbox',
|
|
390
|
+
align: 'center',
|
|
369
391
|
width: 40
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
if (config?.selectionType === 'radio') {
|
|
396
|
+
columns.push({
|
|
397
|
+
field: '_radio',
|
|
398
|
+
title: '',
|
|
399
|
+
fixed: mobile.value ? false : 'left',
|
|
400
|
+
type: 'radio',
|
|
401
|
+
align: 'center',
|
|
377
402
|
width: 40
|
|
378
|
-
}
|
|
379
|
-
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
//是否显示行号
|
|
407
|
+
if (config?.rowNumber) {
|
|
408
|
+
columns.push({
|
|
409
|
+
field: '_seq',
|
|
410
|
+
type: 'seq',
|
|
411
|
+
title: '#',
|
|
412
|
+
fixed: mobile.value ? false : 'left',
|
|
413
|
+
align: 'center',
|
|
414
|
+
width: 40
|
|
415
|
+
});
|
|
416
|
+
}
|
|
380
417
|
|
|
381
|
-
const isRowDrag = config.rowDrag;
|
|
382
418
|
//是否支持拖动
|
|
383
|
-
if (
|
|
419
|
+
if (config?.rowDrag) {
|
|
384
420
|
columns.unshift({
|
|
385
|
-
title:
|
|
386
|
-
fixed: mobile.value ? false :
|
|
421
|
+
title: '',
|
|
422
|
+
fixed: mobile.value ? false : 'left',
|
|
387
423
|
width: 40,
|
|
388
|
-
align:
|
|
424
|
+
align: 'center',
|
|
389
425
|
dragSort: true,
|
|
390
|
-
field:
|
|
426
|
+
field: '_drag'
|
|
391
427
|
});
|
|
392
428
|
}
|
|
393
429
|
|
|
430
|
+
//列拖动
|
|
431
|
+
if (config?.columnDrag) {
|
|
432
|
+
DefaultGridOptions.columnConfig.drag = true;
|
|
433
|
+
}
|
|
434
|
+
|
|
394
435
|
const requireData = {};
|
|
395
436
|
//商邦列转换成Vxe列
|
|
396
437
|
if (SohelpConfig.properties?.length > 0) {
|
|
@@ -402,10 +443,10 @@ export function useSohelpGridConfig() {
|
|
|
402
443
|
row.visible = SohelpConfig.list.includes(item.name);
|
|
403
444
|
row.fixed = mobile.value ? false : row.fixed;
|
|
404
445
|
// 添加操作栏插槽
|
|
405
|
-
if (item.name ===
|
|
446
|
+
if (item.name === '_operation') {
|
|
406
447
|
row.visible = true;
|
|
407
448
|
row.slots = {
|
|
408
|
-
default:
|
|
449
|
+
default: '_operation'
|
|
409
450
|
};
|
|
410
451
|
}
|
|
411
452
|
|
|
@@ -416,22 +457,22 @@ export function useSohelpGridConfig() {
|
|
|
416
457
|
requireData[item.name] = [
|
|
417
458
|
{
|
|
418
459
|
required: true,
|
|
419
|
-
message: row.title +
|
|
460
|
+
message: row.title + '不能为空'
|
|
420
461
|
}
|
|
421
462
|
];
|
|
422
463
|
}
|
|
423
464
|
});
|
|
424
465
|
|
|
425
466
|
//没有工具栏则不显示操作拦
|
|
426
|
-
if (config?.
|
|
427
|
-
columns = columns.filter((item) => item.field !=
|
|
467
|
+
if (config?.operations?.length == 0) {
|
|
468
|
+
columns = columns.filter((item) => item.field != '_operation');
|
|
428
469
|
}
|
|
429
470
|
|
|
430
471
|
//将columns按照fields排序
|
|
431
472
|
const sortColumns = columns
|
|
432
473
|
.sort((a, b) => {
|
|
433
|
-
if (a.field ===
|
|
434
|
-
if (b.field ===
|
|
474
|
+
if (a.field === '_operation') return 1;
|
|
475
|
+
if (b.field === '_operation') return -1;
|
|
435
476
|
return config.list.indexOf(a.field) - config.list.indexOf(b.field);
|
|
436
477
|
})
|
|
437
478
|
.sort((a, b) => {
|
|
@@ -440,8 +481,8 @@ export function useSohelpGridConfig() {
|
|
|
440
481
|
|
|
441
482
|
//_operation列安排最后一列
|
|
442
483
|
DefaultGridOptions.columns = [
|
|
443
|
-
...sortColumns.filter((col) => col.field !==
|
|
444
|
-
...sortColumns.filter((col) => col.field ===
|
|
484
|
+
...sortColumns.filter((col) => col.field !== '_operation'),
|
|
485
|
+
...sortColumns.filter((col) => col.field === '_operation')
|
|
445
486
|
];
|
|
446
487
|
DefaultGridOptions.editRules = { ...requireData };
|
|
447
488
|
}
|
|
@@ -464,7 +505,7 @@ export function useSohelpGridConfig() {
|
|
|
464
505
|
|
|
465
506
|
// 拦截编辑
|
|
466
507
|
DefaultGridOptions.editConfig.beforeEditMethod = ({ row, column }) => {
|
|
467
|
-
if (column.type ===
|
|
508
|
+
if (column.type === 'SohelpTextarea') {
|
|
468
509
|
return false;
|
|
469
510
|
}
|
|
470
511
|
return true;
|
|
@@ -476,8 +517,8 @@ export function useSohelpGridConfig() {
|
|
|
476
517
|
|
|
477
518
|
// 行列样式
|
|
478
519
|
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 ===
|
|
520
|
+
const rowData = config.colors.filter((item) => item.type !== 'c');
|
|
521
|
+
const cellData = config.colors.filter((item) => item.type === 'c');
|
|
481
522
|
if (rowData.length > 0) {
|
|
482
523
|
DefaultGridOptions.rowStyle = createDynamicRowStyle(rowData);
|
|
483
524
|
} else {
|
|
@@ -488,21 +529,69 @@ export function useSohelpGridConfig() {
|
|
|
488
529
|
}
|
|
489
530
|
}
|
|
490
531
|
isConfigInitialized.value = true;
|
|
532
|
+
|
|
533
|
+
//序号列配置
|
|
534
|
+
DefaultGridOptions.seqConfig = {
|
|
535
|
+
seqMethod: ({ rowIndex }) => {
|
|
536
|
+
const { pageSize, currentPage } = DefaultGridOptions.pagerConfig;
|
|
537
|
+
return (currentPage - 1) * pageSize + rowIndex + 1;
|
|
538
|
+
}
|
|
539
|
+
};
|
|
540
|
+
|
|
491
541
|
//转化初始化其他参数...
|
|
492
542
|
} catch (error) {
|
|
493
543
|
throw error; //重新抛出错误,以便调用者可以处理它
|
|
494
544
|
}
|
|
495
545
|
|
|
546
|
+
const operationsButtons = getOperationToolbars();
|
|
496
547
|
return {
|
|
497
548
|
gridOptions: DefaultGridOptions,
|
|
498
549
|
sohelpConfig: SohelpConfig,
|
|
499
550
|
propertiesMap: propertiesMap,
|
|
500
551
|
batchButtonsIndex: batchButtonsIndex,
|
|
501
552
|
footerData: footerData,
|
|
502
|
-
formulaMap: formulaMap
|
|
553
|
+
formulaMap: formulaMap,
|
|
554
|
+
operationsButtons: operationsButtons
|
|
503
555
|
};
|
|
504
556
|
};
|
|
505
557
|
|
|
558
|
+
// 操作栏按钮分类
|
|
559
|
+
const getOperationToolbars = () => {
|
|
560
|
+
const buttonsMap = {};
|
|
561
|
+
const permission = usePermission();
|
|
562
|
+
SohelpConfig.operations
|
|
563
|
+
?.filter((f) => !f.authority || permission.hasPermission(f.authority))
|
|
564
|
+
.map((button) => {
|
|
565
|
+
const type = button.buttonType || 'common';
|
|
566
|
+
const code = button.type === 'custom' ? button.id : button.type;
|
|
567
|
+
if (!buttonsMap[type]) {
|
|
568
|
+
buttonsMap[type] = [];
|
|
569
|
+
}
|
|
570
|
+
const title = button.type === 'custom' ? button.title : t('grid.toolbar.' + button.type?.replaceAll('.', '-'));
|
|
571
|
+
let params = button.params || {};
|
|
572
|
+
if (button.params && typeof button.params === 'string') {
|
|
573
|
+
try {
|
|
574
|
+
params = JSON.parse(button.params);
|
|
575
|
+
} catch (e) {
|
|
576
|
+
params = {};
|
|
577
|
+
EleMessage.error('button.params配置JSON参数格式错误');
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
buttonsMap[type].push({
|
|
581
|
+
title: title || button.title,
|
|
582
|
+
id: button.id,
|
|
583
|
+
code: code,
|
|
584
|
+
handler: button.handler,
|
|
585
|
+
icon: button.iconCls,
|
|
586
|
+
params: params,
|
|
587
|
+
refid: button.refid,
|
|
588
|
+
openType: button.openType,
|
|
589
|
+
render: button.render
|
|
590
|
+
});
|
|
591
|
+
});
|
|
592
|
+
return buttonsMap;
|
|
593
|
+
};
|
|
594
|
+
|
|
506
595
|
/**
|
|
507
596
|
* 配置是否加载完成
|
|
508
597
|
*/
|
|
@@ -9,11 +9,7 @@
|
|
|
9
9
|
<el-option label="满足所有条件" value="and" />
|
|
10
10
|
<el-option label="满足任一条件" value="or" />
|
|
11
11
|
</el-select>
|
|
12
|
-
<el-icon
|
|
13
|
-
@click="addSubCondition(0)"
|
|
14
|
-
style="margin-left: 10px; cursor: pointer"
|
|
15
|
-
size="24"
|
|
16
|
-
>
|
|
12
|
+
<el-icon @click="addSubCondition(0)" style="margin-left: 10px; cursor: pointer" size="24">
|
|
17
13
|
<Fold />
|
|
18
14
|
</el-icon>
|
|
19
15
|
<el-dropdown trigger="click">
|
|
@@ -22,11 +18,7 @@
|
|
|
22
18
|
</el-icon>
|
|
23
19
|
<template #dropdown>
|
|
24
20
|
<el-dropdown-menu>
|
|
25
|
-
<el-dropdown-item
|
|
26
|
-
@click="addCondition(item)"
|
|
27
|
-
v-for="item in fields"
|
|
28
|
-
>{{ item.label }}</el-dropdown-item
|
|
29
|
-
>
|
|
21
|
+
<el-dropdown-item @click="addCondition(item)" v-for="item in fields">{{ item.label }}</el-dropdown-item>
|
|
30
22
|
</el-dropdown-menu>
|
|
31
23
|
</template>
|
|
32
24
|
</el-dropdown>
|
|
@@ -35,39 +27,19 @@
|
|
|
35
27
|
v-if="obj.children && obj.children.length"
|
|
36
28
|
v-for="(item, index) in obj.children"
|
|
37
29
|
:style="{
|
|
38
|
-
borderLeft:
|
|
39
|
-
obj.type === 'and' ? '4px solid #38c10b' : '4px solid #c59d0a'
|
|
30
|
+
borderLeft: obj.type === 'and' ? '4px solid #38c10b' : '4px solid #c59d0a'
|
|
40
31
|
}"
|
|
41
32
|
>
|
|
42
|
-
<div
|
|
43
|
-
v-if="!item.type"
|
|
44
|
-
style="
|
|
45
|
-
display: flex;
|
|
46
|
-
align-items: center;
|
|
47
|
-
justify-content: space-between;
|
|
48
|
-
padding: 10px;
|
|
49
|
-
"
|
|
50
|
-
>
|
|
33
|
+
<div v-if="!item.type" style="display: flex; align-items: center; justify-content: space-between; padding: 10px">
|
|
51
34
|
<div style="display: flex; align-items: center; width: 240px">
|
|
52
|
-
<div style="font-size: 16px; margin-right: 10px">{{
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
<select
|
|
56
|
-
v-model="item.comparison"
|
|
57
|
-
style="border: none; width: auto; background-color: #dedede"
|
|
58
|
-
>
|
|
59
|
-
<option v-for="op in options" :value="op.value">{{
|
|
60
|
-
op.label
|
|
61
|
-
}}</option>
|
|
35
|
+
<div style="font-size: 16px; margin-right: 10px">{{ item.label }}</div>
|
|
36
|
+
<select v-model="item.comparison" style="border: none; width: auto; background-color: #dedede">
|
|
37
|
+
<option v-for="op in options" :value="op.value">{{ op.label }}</option>
|
|
62
38
|
</select>
|
|
63
39
|
</div>
|
|
64
40
|
<div style="display: flex; align-items: center">
|
|
65
41
|
<el-input v-model="item.value" placeholder="请输入" />
|
|
66
|
-
<el-icon
|
|
67
|
-
@click="removeCondition(index)"
|
|
68
|
-
style="margin-left: 8px"
|
|
69
|
-
size="20"
|
|
70
|
-
>
|
|
42
|
+
<el-icon @click="removeCondition(index)" style="margin-left: 8px" size="20">
|
|
71
43
|
<Delete />
|
|
72
44
|
</el-icon>
|
|
73
45
|
</div>
|
|
@@ -185,7 +157,6 @@
|
|
|
185
157
|
});
|
|
186
158
|
}
|
|
187
159
|
|
|
188
|
-
|
|
189
160
|
data.push(row);
|
|
190
161
|
this.obj.children = data.concat(datato);
|
|
191
162
|
},
|