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
|
@@ -47,401 +47,403 @@
|
|
|
47
47
|
</template>
|
|
48
48
|
|
|
49
49
|
<script setup>
|
|
50
|
-
import { EleMessage } from
|
|
51
|
-
import { DragOutlined } from
|
|
52
|
-
import { nextTick, onMounted, reactive, ref, watch } from
|
|
53
|
-
import { merge,cloneDeep } from
|
|
54
|
-
import DefaultProps from
|
|
55
|
-
import { Search } from
|
|
56
|
-
import DefaultGridOptions from
|
|
57
|
-
|
|
58
|
-
/**判断配置是否初始化完毕*/
|
|
59
|
-
const emit = defineEmits([
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
]);
|
|
74
|
-
|
|
75
|
-
const isPage = ref(false);
|
|
76
|
-
const selectedValue = ref([]);
|
|
77
|
-
const selectedData = ref([]);
|
|
78
|
-
const keywords = ref(
|
|
79
|
-
const props = defineProps(cloneDeep(DefaultProps));
|
|
80
|
-
|
|
81
|
-
/**列表实例*/
|
|
82
|
-
const sohelpVxeGridRef = ref(null);
|
|
83
|
-
|
|
84
|
-
const gridOptions = reactive(cloneDeep(DefaultGridOptions));
|
|
85
|
-
if (props.gridOptions) {
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
50
|
+
import { EleMessage } from '@/components/ele-admin-plus/components';
|
|
51
|
+
import { DragOutlined } from '../sohelp-icon-select/icons';
|
|
52
|
+
import { nextTick, onMounted, reactive, ref, watch } from 'vue';
|
|
53
|
+
import { merge, cloneDeep } from 'lodash-es'; // 正确导入
|
|
54
|
+
import DefaultProps from './DefaultProps';
|
|
55
|
+
import { Search } from '@element-plus/icons-vue';
|
|
56
|
+
import DefaultGridOptions from './DefaultGridOptions';
|
|
57
|
+
|
|
58
|
+
/**判断配置是否初始化完毕*/
|
|
59
|
+
const emit = defineEmits([
|
|
60
|
+
'filter',
|
|
61
|
+
'reset',
|
|
62
|
+
'pageChange',
|
|
63
|
+
'checkboxAll',
|
|
64
|
+
'checkboxChange',
|
|
65
|
+
'toolbarButtonClick',
|
|
66
|
+
'menuClick',
|
|
67
|
+
'cellClick',
|
|
68
|
+
'pageChange',
|
|
69
|
+
'refresh',
|
|
70
|
+
'radioChange',
|
|
71
|
+
'update:value',
|
|
72
|
+
'update:value'
|
|
73
|
+
]);
|
|
74
|
+
|
|
75
|
+
const isPage = ref(false);
|
|
76
|
+
const selectedValue = ref([]);
|
|
77
|
+
const selectedData = ref([]);
|
|
78
|
+
const keywords = ref('');
|
|
79
|
+
const props = defineProps(cloneDeep(DefaultProps));
|
|
80
|
+
|
|
81
|
+
/**列表实例*/
|
|
82
|
+
const sohelpVxeGridRef = ref(null);
|
|
83
|
+
|
|
84
|
+
const gridOptions = reactive(cloneDeep(DefaultGridOptions));
|
|
85
|
+
if (props.gridOptions) {
|
|
86
|
+
merge(gridOptions, props.gridOptions);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (props.gridOptions) {
|
|
90
|
+
merge(gridOptions, props.gridOptions);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**根据URL动态加载数据**/
|
|
94
|
+
if (props.url) {
|
|
95
|
+
merge(gridOptions, {
|
|
96
|
+
proxyConfig: {
|
|
97
|
+
response: {
|
|
98
|
+
result: 'result',
|
|
99
|
+
total: 'page.total'
|
|
100
|
+
},
|
|
101
|
+
ajax: {
|
|
102
|
+
query: () => {
|
|
103
|
+
refresh();
|
|
104
|
+
}
|
|
99
105
|
}
|
|
100
106
|
}
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**根据参数加载数据*/
|
|
111
|
+
const reload = async (param = {}) => {
|
|
112
|
+
emit('filter', param);
|
|
113
|
+
gridOptions.loading = true;
|
|
114
|
+
gridOptions.params = param;
|
|
115
|
+
//配置初始化完毕后,才可以执行刷新
|
|
116
|
+
|
|
117
|
+
const url = props.url;
|
|
118
|
+
if (!url) {
|
|
119
|
+
gridOptions.loading = false;
|
|
120
|
+
return { results: [], total: 0 };
|
|
101
121
|
}
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
122
|
|
|
123
|
+
let pageConfig = {};
|
|
124
|
+
// 是否分页
|
|
125
|
+
if (gridOptions.pagerConfig?.enabled) {
|
|
126
|
+
pageConfig.page = gridOptions.pagerConfig?.currentPage ?? 1;
|
|
127
|
+
pageConfig.limit = gridOptions.pagerConfig?.pageSize ?? 50;
|
|
128
|
+
}
|
|
105
129
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
130
|
+
const res = await SohelpHttp.get(url, {
|
|
131
|
+
...param,
|
|
132
|
+
keywords: keywords.value,
|
|
133
|
+
...pageConfig
|
|
134
|
+
}).catch((e) => {
|
|
135
|
+
gridOptions.loading = false;
|
|
136
|
+
EleMessage.error(e);
|
|
137
|
+
});
|
|
112
138
|
|
|
113
|
-
const url = props.url;
|
|
114
|
-
if (!url) {
|
|
115
139
|
gridOptions.loading = false;
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
140
|
+
if (!res.meta.success) {
|
|
141
|
+
EleMessage.error(res.meta.message);
|
|
142
|
+
return { results: [], total: 0 };
|
|
143
|
+
}
|
|
144
|
+
const $grid = sohelpVxeGridRef.value;
|
|
145
|
+
$grid.loadData(res.data.results || res.data);
|
|
146
|
+
if (gridOptions?.pagerConfig?.enabled) {
|
|
147
|
+
gridOptions.pagerConfig.total = res.data.total;
|
|
148
|
+
}
|
|
125
149
|
|
|
126
|
-
const res = await SohelpHttp.get(url, {
|
|
127
|
-
...param,
|
|
128
|
-
keywords: keywords.value,
|
|
129
|
-
...pageConfig
|
|
130
|
-
}).catch((e) => {
|
|
131
150
|
gridOptions.loading = false;
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
/**刷新数据*/
|
|
160
|
-
const refresh = () => {
|
|
161
|
-
if (!isPage.value) {
|
|
162
|
-
keywords.value = "";
|
|
163
|
-
if (gridOptions.pagerConfig && gridOptions.pagerConfig.enabled) {
|
|
164
|
-
gridOptions.pagerConfig.currentPage = 1;
|
|
165
|
-
} else {
|
|
166
|
-
gridOptions.pagerConfig = {
|
|
167
|
-
currentPage: 1
|
|
168
|
-
};
|
|
151
|
+
initValue();
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
/**实现分页事件*/
|
|
155
|
+
const pageChangeEvent = (page) => {
|
|
156
|
+
isPage.value = true;
|
|
157
|
+
gridOptions.pagerConfig.currentPage = page.currentPage;
|
|
158
|
+
gridOptions.pagerConfig.pageSize = page.pageSize;
|
|
159
|
+
emit('pageChange', page);
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
/**刷新数据*/
|
|
163
|
+
const refresh = () => {
|
|
164
|
+
if (!isPage.value) {
|
|
165
|
+
keywords.value = '';
|
|
166
|
+
if (gridOptions.pagerConfig && gridOptions.pagerConfig.enabled) {
|
|
167
|
+
gridOptions.pagerConfig.currentPage = 1;
|
|
168
|
+
} else {
|
|
169
|
+
gridOptions.pagerConfig = {
|
|
170
|
+
currentPage: 1
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
//清空选中
|
|
174
|
+
selectedValue.value = [];
|
|
175
|
+
sohelpVxeGridRef.value?.clearCheckboxRow();
|
|
176
|
+
emit('refresh');
|
|
169
177
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
*/
|
|
183
|
-
const menuEvents = async ({ menu, row, column, rowIndex }) => {
|
|
184
|
-
const $grid = sohelpVxeGridRef.value;
|
|
185
|
-
if ($grid) {
|
|
186
|
-
$grid.setCurrentRow(row);
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* 工具栏点击事件
|
|
192
|
-
* @param params
|
|
193
|
-
*/
|
|
194
|
-
const onToolbarButtonClick = (params) => {
|
|
195
|
-
emit("toolbarButtonClick", params);
|
|
196
|
-
};
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* checkbox 点击
|
|
200
|
-
* @param params
|
|
201
|
-
*/
|
|
202
|
-
const onCheckboxChange = (params) => {
|
|
203
|
-
emit("checkboxChange", params);
|
|
204
|
-
if (props.multiple) {
|
|
205
|
-
setSelectedValue(params.row);
|
|
206
|
-
updateData();
|
|
207
|
-
}
|
|
208
|
-
};
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* 获取表格当前页数据
|
|
212
|
-
*/
|
|
213
|
-
const getTableData = () => {
|
|
214
|
-
return JSON.parse(JSON.stringify(sohelpVxeGridRef.value?.getTableData().tableData));
|
|
215
|
-
};
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* 全选、取消全选 更新value,data值
|
|
219
|
-
* @param param0
|
|
220
|
-
*/
|
|
221
|
-
const onCheckboxAllChange = (params) => {
|
|
222
|
-
const data = getTableData();
|
|
223
|
-
const ids = data.map((item) => item.id);
|
|
224
|
-
if (params.checked) {
|
|
225
|
-
selectedValue.value = [...new Set([...selectedValue.value, ...ids])];
|
|
226
|
-
selectedData.value = Array.from(
|
|
227
|
-
[...selectedData.value, ...data].reduce((map, item) => map.set(item.id, item), new Map()).values()
|
|
228
|
-
);
|
|
229
|
-
} else {
|
|
230
|
-
selectedValue.value = selectedValue.value.filter((item) => !ids.includes(item));
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
emit("checkboxAll", params);
|
|
234
|
-
updateData();
|
|
235
|
-
};
|
|
236
|
-
|
|
237
|
-
/**
|
|
238
|
-
* checkbox row click selectValue, selectedData设置是否选中
|
|
239
|
-
* @param row
|
|
240
|
-
*/
|
|
241
|
-
const setSelectedValue = (row) => {
|
|
242
|
-
let idx = selectedValue.value.findIndex((id) => id === row.id);
|
|
243
|
-
if (idx != -1) {
|
|
244
|
-
selectedValue.value.splice(idx, 1);
|
|
245
|
-
} else {
|
|
246
|
-
selectedValue.value.push(row.id);
|
|
247
|
-
let _idx = selectedData.value.findIndex((item) => item.id === row.id);
|
|
248
|
-
if (_idx === -1) {
|
|
249
|
-
selectedData.value.push({ ...row });
|
|
178
|
+
isPage.value = false;
|
|
179
|
+
reload({ ...gridOptions.params });
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* grid事件
|
|
184
|
+
* @param param0
|
|
185
|
+
*/
|
|
186
|
+
const menuEvents = async ({ menu, row, column, rowIndex }) => {
|
|
187
|
+
const $grid = sohelpVxeGridRef.value;
|
|
188
|
+
if ($grid) {
|
|
189
|
+
$grid.setCurrentRow(row);
|
|
250
190
|
}
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* 工具栏点击事件
|
|
195
|
+
* @param params
|
|
196
|
+
*/
|
|
197
|
+
const onToolbarButtonClick = (params) => {
|
|
198
|
+
emit('toolbarButtonClick', params);
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* checkbox 点击
|
|
203
|
+
* @param params
|
|
204
|
+
*/
|
|
205
|
+
const onCheckboxChange = (params) => {
|
|
206
|
+
emit('checkboxChange', params);
|
|
207
|
+
if (props.multiple) {
|
|
208
|
+
setSelectedValue(params.row);
|
|
209
|
+
updateData();
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* 获取表格当前页数据
|
|
215
|
+
*/
|
|
216
|
+
const getTableData = () => {
|
|
217
|
+
return JSON.parse(JSON.stringify(sohelpVxeGridRef.value?.getTableData().tableData));
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* 全选、取消全选 更新value,data值
|
|
222
|
+
* @param param0
|
|
223
|
+
*/
|
|
224
|
+
const onCheckboxAllChange = (params) => {
|
|
225
|
+
const data = getTableData();
|
|
226
|
+
const ids = data.map((item) => item.id);
|
|
227
|
+
if (params.checked) {
|
|
228
|
+
selectedValue.value = [...new Set([...selectedValue.value, ...ids])];
|
|
273
229
|
selectedData.value = Array.from(
|
|
274
|
-
|
|
230
|
+
[...selectedData.value, ...data].reduce((map, item) => map.set(item.id, item), new Map()).values()
|
|
275
231
|
);
|
|
276
232
|
} else {
|
|
277
|
-
|
|
278
|
-
selectedValue.value = [];
|
|
233
|
+
selectedValue.value = selectedValue.value.filter((item) => !ids.includes(item));
|
|
279
234
|
}
|
|
280
235
|
|
|
236
|
+
emit('checkboxAll', params);
|
|
281
237
|
updateData();
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
const
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
$grid.setCurrentRow(row);
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* checkbox row click selectValue, selectedData设置是否选中
|
|
242
|
+
* @param row
|
|
243
|
+
*/
|
|
244
|
+
const setSelectedValue = (row) => {
|
|
245
|
+
let idx = selectedValue.value.findIndex((id) => id === row.id);
|
|
246
|
+
if (idx != -1) {
|
|
247
|
+
selectedValue.value.splice(idx, 1);
|
|
248
|
+
} else {
|
|
249
|
+
selectedValue.value.push(row.id);
|
|
250
|
+
let _idx = selectedData.value.findIndex((item) => item.id === row.id);
|
|
251
|
+
if (_idx === -1) {
|
|
252
|
+
selectedData.value.push({ ...row });
|
|
253
|
+
}
|
|
299
254
|
}
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* 行点击
|
|
259
|
+
* @param params
|
|
260
|
+
*/
|
|
261
|
+
const onCellClick = (params) => {
|
|
262
|
+
emit('cellClick', params);
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
*
|
|
267
|
+
* @param params 单选框点击
|
|
268
|
+
*/
|
|
269
|
+
const onRadioChange = (params) => {
|
|
270
|
+
emit('radioChange', params);
|
|
271
|
+
if (!props.multiple) {
|
|
272
|
+
clear();
|
|
273
|
+
const row = sohelpVxeGridRef.value?.getRadioRecord();
|
|
274
|
+
if (row) {
|
|
275
|
+
selectedValue.value = [row.id];
|
|
276
|
+
selectedData.value = Array.from(new Map([row, ...selectedData.value].map((item) => [item.id, item])).values());
|
|
277
|
+
} else {
|
|
278
|
+
selectedData.value = props.data;
|
|
279
|
+
selectedValue.value = [];
|
|
280
|
+
}
|
|
310
281
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
282
|
+
updateData();
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* 更新value,data
|
|
288
|
+
*/
|
|
289
|
+
const updateData = () => {
|
|
290
|
+
emit('update:value', [...selectedValue.value]);
|
|
291
|
+
emit('update:data', [...selectedData.value]);
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
/**grid 事件处理 */
|
|
295
|
+
const gridEvents = {
|
|
296
|
+
cellMenu({ row, rowIndex }) {
|
|
297
|
+
const $grid = sohelpVxeGridRef.value;
|
|
298
|
+
if ($grid) {
|
|
299
|
+
$grid.setCurrentRow(row);
|
|
314
300
|
}
|
|
301
|
+
},
|
|
302
|
+
menuClick({ menu, column, row, rowIndex }) {
|
|
303
|
+
const $grid = sohelpVxeGridRef.value;
|
|
304
|
+
if ($grid) {
|
|
305
|
+
switch (menu.code) {
|
|
306
|
+
case 'insert':
|
|
307
|
+
// $grid.insert();
|
|
308
|
+
$grid.insertAt({}, rowIndex);
|
|
309
|
+
|
|
310
|
+
let _table = $grid.getTableData();
|
|
311
|
+
|
|
312
|
+
break;
|
|
313
|
+
case 'copy':
|
|
314
|
+
break;
|
|
315
|
+
}
|
|
315
316
|
|
|
316
|
-
|
|
317
|
+
emit('menuClick', $grid, code);
|
|
318
|
+
}
|
|
317
319
|
}
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
const loadData = (data) => {
|
|
322
|
-
const $grid = sohelpVxeGridRef.value;
|
|
323
|
-
$grid.loadData(data);
|
|
324
|
-
};
|
|
325
|
-
|
|
326
|
-
/**
|
|
327
|
-
* 数据回显
|
|
328
|
-
*/
|
|
329
|
-
const initValue = () => {
|
|
330
|
-
nextTick(() => {
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
const loadData = (data) => {
|
|
331
323
|
const $grid = sohelpVxeGridRef.value;
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
324
|
+
$grid.loadData(data);
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* 数据回显
|
|
329
|
+
*/
|
|
330
|
+
const initValue = () => {
|
|
331
|
+
nextTick(() => {
|
|
332
|
+
const $grid = sohelpVxeGridRef.value;
|
|
333
|
+
if ($grid && selectedValue.value.length) {
|
|
334
|
+
setTimeout(() => {
|
|
335
|
+
$grid.setCheckboxRowKey(selectedValue.value, true);
|
|
336
|
+
}, 100);
|
|
337
|
+
}
|
|
338
|
+
});
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
onMounted(() => {
|
|
342
|
+
if (props.autoLoad) {
|
|
343
|
+
// reload({});
|
|
336
344
|
}
|
|
337
345
|
});
|
|
338
|
-
};
|
|
339
346
|
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
const
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
if (props.data && props.data?.length > 0) {
|
|
366
|
-
selectedData.value = [...props.data];
|
|
347
|
+
/**
|
|
348
|
+
* 清空
|
|
349
|
+
*/
|
|
350
|
+
const clear = () => {
|
|
351
|
+
const $grid = sohelpVxeGridRef.value;
|
|
352
|
+
$grid?.clearCheckboxReserve();
|
|
353
|
+
$grid?.clearCheckboxRow();
|
|
354
|
+
$grid.clearSelected();
|
|
355
|
+
};
|
|
356
|
+
|
|
357
|
+
const getSelection = () => {
|
|
358
|
+
return sohelpVxeGridRef.value?.getCheckboxRecords() || [];
|
|
359
|
+
};
|
|
360
|
+
|
|
361
|
+
watch(
|
|
362
|
+
() => props.value,
|
|
363
|
+
(val) => {
|
|
364
|
+
let arr = Array.isArray(val) ? val : val ? [val] : [];
|
|
365
|
+
selectedValue.value = props.multiple ? [...arr] : [arr[0]];
|
|
366
|
+
if (props.data && props.data?.length > 0) {
|
|
367
|
+
selectedData.value = [...props.data];
|
|
368
|
+
}
|
|
369
|
+
},
|
|
370
|
+
{
|
|
371
|
+
immediate: true
|
|
367
372
|
}
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
clearRadioRow: () => {
|
|
397
|
-
sohelpVxeGridRef.value.clearRadioRow();
|
|
398
|
-
}
|
|
399
|
-
});
|
|
373
|
+
);
|
|
374
|
+
|
|
375
|
+
defineExpose({
|
|
376
|
+
$grid: sohelpVxeGridRef,
|
|
377
|
+
getSelection,
|
|
378
|
+
gridOptions,
|
|
379
|
+
loadData,
|
|
380
|
+
refresh,
|
|
381
|
+
reload,
|
|
382
|
+
pageChangeEvent,
|
|
383
|
+
gridEvents,
|
|
384
|
+
menuEvents,
|
|
385
|
+
onToolbarButtonClick,
|
|
386
|
+
onCheckboxChange,
|
|
387
|
+
onCellClick,
|
|
388
|
+
onCheckboxAllChange,
|
|
389
|
+
onRadioChange,
|
|
390
|
+
selectedData,
|
|
391
|
+
selectedValue,
|
|
392
|
+
updateData,
|
|
393
|
+
initValue,
|
|
394
|
+
clear,
|
|
395
|
+
getTableData,
|
|
396
|
+
keywords,
|
|
397
|
+
clearRadioRow: () => {
|
|
398
|
+
sohelpVxeGridRef.value.clearRadioRow();
|
|
399
|
+
}
|
|
400
|
+
});
|
|
400
401
|
</script>
|
|
401
402
|
<script>
|
|
402
|
-
export default {
|
|
403
|
-
|
|
404
|
-
};
|
|
403
|
+
export default {
|
|
404
|
+
name: 'SohelpVxeGrid'
|
|
405
|
+
};
|
|
405
406
|
</script>
|
|
406
407
|
|
|
407
408
|
<style lang="scss" scoped>
|
|
408
|
-
.sohelp-vxe-grid {
|
|
409
|
-
width: 100%;
|
|
410
|
-
height: 100%;
|
|
411
|
-
box-sizing: border-box;
|
|
412
|
-
|
|
413
|
-
:deep(.vxe-grid) {
|
|
414
|
-
height: 100%;
|
|
409
|
+
.sohelp-vxe-grid {
|
|
415
410
|
width: 100%;
|
|
416
|
-
|
|
411
|
+
height: 100%;
|
|
412
|
+
box-sizing: border-box;
|
|
417
413
|
|
|
418
|
-
.vxe-grid
|
|
419
|
-
|
|
420
|
-
|
|
414
|
+
:deep(.vxe-grid) {
|
|
415
|
+
height: 100%;
|
|
416
|
+
width: 100%;
|
|
417
|
+
min-width: 100px;
|
|
421
418
|
|
|
422
|
-
.vxe-grid--
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
padding: 0 5px 5px 5px;
|
|
426
|
-
}
|
|
427
|
-
}
|
|
419
|
+
.vxe-grid--layout-body-content-wrapper {
|
|
420
|
+
display: flex;
|
|
421
|
+
flex-direction: column;
|
|
428
422
|
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
423
|
+
.vxe-grid--toolbar-wrapper {
|
|
424
|
+
.vxe-toolbar {
|
|
425
|
+
box-sizing: border-box;
|
|
426
|
+
padding: 0 5px 5px 5px;
|
|
427
|
+
}
|
|
428
|
+
}
|
|
432
429
|
|
|
433
|
-
.vxe-table {
|
|
430
|
+
.vxe-grid--table-container {
|
|
431
|
+
flex: 1;
|
|
434
432
|
height: 100%;
|
|
435
433
|
|
|
436
|
-
.vxe-table
|
|
434
|
+
.vxe-table {
|
|
437
435
|
height: 100%;
|
|
438
436
|
|
|
439
|
-
.vxe-table--
|
|
440
|
-
height:
|
|
437
|
+
.vxe-table--render-wrapper {
|
|
438
|
+
height: 100%;
|
|
439
|
+
|
|
440
|
+
.vxe-table--layout-wrapper {
|
|
441
|
+
height: calc(100% - 10px);
|
|
441
442
|
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
443
|
+
.col--selected {
|
|
444
|
+
//去除单元格选中效果
|
|
445
|
+
box-shadow: none;
|
|
446
|
+
}
|
|
445
447
|
}
|
|
446
448
|
}
|
|
447
449
|
}
|
|
@@ -449,27 +451,26 @@ export default {
|
|
|
449
451
|
}
|
|
450
452
|
}
|
|
451
453
|
}
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
.vxe-body--row.sortable-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
454
|
+
|
|
455
|
+
.drag-btn {
|
|
456
|
+
cursor: move;
|
|
457
|
+
font-size: 12px;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
.vxe-body--row.sortable-ghost,
|
|
461
|
+
.vxe-body--row.sortable-chosen {
|
|
462
|
+
background-color: #dfecfb;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
.search-wrap {
|
|
466
|
+
display: flex;
|
|
467
|
+
align-items: center;
|
|
468
|
+
justify-content: flex-start;
|
|
469
|
+
gap: 10px;
|
|
470
|
+
margin-right: 10px;
|
|
471
|
+
|
|
472
|
+
.search-box {
|
|
473
|
+
width: 200px;
|
|
474
|
+
}
|
|
473
475
|
}
|
|
474
|
-
}
|
|
475
476
|
</style>
|