sohelp-eleplus 1.1.17 → 1.1.19
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/README.md +24 -0
- package/cache/ModuleCache.js +2 -32
- package/package.json +1 -1
- package/sohelp-entity-grid/index.vue +3 -3
- package/sohelp-grid/index.vue +93 -18
- package/sohelp-grid/js/DefaultGridOptions.js +5 -1
- package/sohelp-grid/js/DefaultProps.js +3 -3
- package/sohelp-grid/js/useSohelpGridConfig.js +7 -1
- package/sohelp-grid-select/index.vue +2 -2
- package/sohelp-grid-view/filter/config/grid-filter-field.vue +1 -1
- package/sohelp-grid-view/filter/config/grid-filter-keywords.vue +1 -1
- package/sohelp-grid-view/filter/config/grid-filter-list.vue +1 -1
- package/sohelp-grid-view/filter/config/grid-filter-sort.vue +1 -1
- package/sohelp-grid-view/filter/filter-form.vue +31 -12
- package/sohelp-grid-view/filter/index.vue +1 -1
- package/sohelp-icon-select/index.vue +3 -3
- package/sohelp-modal/index.vue +28 -21
- package/sohelp-module/useSohelpModule.js +9 -11
- package/sohelp-org-user-tree/index.vue +1 -1
- package/sohelp-table/index.vue +3 -3
- package/sohelp-vform-drawer/index.vue +1 -1
- package/sohelp-vxe-grid/DefaultGridOptions.js +7 -16
- package/sohelp-vxe-grid/DefaultProps.js +10 -20
- package/sohelp-vxe-grid/SohelpGridConfig.js +28 -27
- package/sohelp-vxe-grid/index.vue +397 -440
- package/sohelp-vxe-table/index.vue +4 -4
- package/style/index.scss +0 -0
|
@@ -12,13 +12,12 @@
|
|
|
12
12
|
@radioChange="onRadioChange"
|
|
13
13
|
@cellClick.stop="onCellClick"
|
|
14
14
|
>
|
|
15
|
-
<template #
|
|
15
|
+
<template #keywords>
|
|
16
16
|
<div class="search-wrap">
|
|
17
17
|
<div class="search-box">
|
|
18
|
-
<ele-tooltip
|
|
18
|
+
<ele-tooltip content="请输入关键字按回车搜索." placement="top" :offset="3">
|
|
19
19
|
<sohelp-input
|
|
20
20
|
v-model="keywords"
|
|
21
|
-
:placeholder="getKeywordsPlaceholder"
|
|
22
21
|
clearable
|
|
23
22
|
@keyup.enter="reload(gridOptions.params)"
|
|
24
23
|
class="input-with-select"
|
|
@@ -47,446 +46,402 @@
|
|
|
47
46
|
</div>
|
|
48
47
|
</template>
|
|
49
48
|
|
|
50
|
-
<script>
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
ajax: {
|
|
101
|
-
query: () => refresh() // 简写箭头函数
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
Object.assign(gridOptions, config.gridOptions);
|
|
107
|
-
Object.assign(sohelpConfig, config.sohelpConfig);
|
|
108
|
-
Object.assign(propertiesMap, config.propertiesMap);
|
|
109
|
-
|
|
110
|
-
/**配置初始化完成*/
|
|
111
|
-
isConfigInitialized.value = true;
|
|
112
|
-
})
|
|
113
|
-
.catch((e) => {
|
|
114
|
-
EleMessage.error(e.message);
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
const getKeywordsPlaceholder = computed(() => {
|
|
118
|
-
if (sohelpConfig?.filter?.keywords?.length) {
|
|
119
|
-
return (
|
|
120
|
-
'请输入关键 ' +
|
|
121
|
-
sohelpConfig.filter.keywords
|
|
122
|
-
.filter((key) => propertiesMap[key])
|
|
123
|
-
.map((key) => propertiesMap[key].label)
|
|
124
|
-
.join('、') +
|
|
125
|
-
' 进行查询'
|
|
126
|
-
);
|
|
127
|
-
}
|
|
128
|
-
return '请输入关键字';
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
/**判断配置是否初始化完毕*/
|
|
132
|
-
const isConfigDone = async () => {
|
|
133
|
-
return new Promise((resolve) => {
|
|
134
|
-
if (isConfigInitialized.value) {
|
|
135
|
-
resolve();
|
|
136
|
-
} else {
|
|
137
|
-
let timer = setInterval(() => {
|
|
138
|
-
if (isConfigInitialized.value) {
|
|
139
|
-
clearInterval(timer);
|
|
140
|
-
resolve();
|
|
141
|
-
}
|
|
142
|
-
}, 10);
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
/**根据参数加载数据*/
|
|
148
|
-
const reload = async (param = {}) => {
|
|
149
|
-
gridOptions.loading = true;
|
|
150
|
-
gridOptions.params = param;
|
|
151
|
-
//配置初始化完毕后,才可以执行刷新
|
|
152
|
-
await isConfigDone();
|
|
153
|
-
const $grid = sohelpVxeGridRef.value;
|
|
154
|
-
if ($grid) {
|
|
155
|
-
const url = props.url || sohelpConfig.requestValue;
|
|
156
|
-
if (!url) {
|
|
157
|
-
gridOptions.loading = false;
|
|
158
|
-
return { results: [], total: 0 };
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
let pageConfig = {};
|
|
162
|
-
// 是否分页
|
|
163
|
-
if (gridOptions.pagerConfig?.enabled) {
|
|
164
|
-
pageConfig.page = gridOptions.pagerConfig?.currentPage ?? 1;
|
|
165
|
-
pageConfig.limit = gridOptions.pagerConfig?.pageSize ?? 50;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
const res = await SohelpHttp.get(url, {
|
|
169
|
-
...param,
|
|
170
|
-
keywords: keywords.value,
|
|
171
|
-
...pageConfig
|
|
172
|
-
}).catch((e) => {
|
|
173
|
-
gridOptions.loading = false;
|
|
174
|
-
EleMessage.error(e);
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
gridOptions.loading = false;
|
|
178
|
-
if (!res.meta.success) {
|
|
179
|
-
EleMessage.error(res.meta.message);
|
|
180
|
-
return { results: [], total: 0 };
|
|
181
|
-
}
|
|
182
|
-
$grid.loadData(res.data.results || res.data);
|
|
183
|
-
if (gridOptions?.pagerConfig?.enabled) {
|
|
184
|
-
gridOptions.pagerConfig.total = res.data.total;
|
|
185
|
-
}
|
|
49
|
+
<script setup>
|
|
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
|
+
/**根据URL动态加载数据**/
|
|
90
|
+
if (props.url) {
|
|
91
|
+
merge(gridOptions, {
|
|
92
|
+
proxyConfig: {
|
|
93
|
+
response: {
|
|
94
|
+
result: "result",
|
|
95
|
+
total: "page.total"
|
|
96
|
+
},
|
|
97
|
+
ajax: {
|
|
98
|
+
query: () => {
|
|
186
99
|
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
}
|
|
190
104
|
|
|
191
|
-
/**实现分页事件*/
|
|
192
|
-
const pageChangeEvent = (page) => {
|
|
193
|
-
isPage.value = true;
|
|
194
|
-
gridOptions.pagerConfig.currentPage = page.currentPage;
|
|
195
|
-
gridOptions.pagerConfig.pageSize = page.pageSize;
|
|
196
|
-
emit('pageChange', page);
|
|
197
|
-
};
|
|
198
105
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
} else {
|
|
206
|
-
gridOptions.pagerConfig = {
|
|
207
|
-
currentPage: 1
|
|
208
|
-
};
|
|
209
|
-
}
|
|
210
|
-
//清空选中
|
|
211
|
-
selectedValue.value = [];
|
|
212
|
-
sohelpVxeGridRef.value?.clearCheckboxRow();
|
|
213
|
-
emit('refresh');
|
|
214
|
-
}
|
|
215
|
-
isPage.value = false;
|
|
216
|
-
const autoLoad = props.autoLoad || sohelpConfig?.autoLoad || true;
|
|
106
|
+
/**根据参数加载数据*/
|
|
107
|
+
const reload = async (param = {}) => {
|
|
108
|
+
emit("filter", param);
|
|
109
|
+
gridOptions.loading = true;
|
|
110
|
+
gridOptions.params = param;
|
|
111
|
+
//配置初始化完毕后,才可以执行刷新
|
|
217
112
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
/**
|
|
224
|
-
* grid事件
|
|
225
|
-
* @param param0
|
|
226
|
-
*/
|
|
227
|
-
const menuEvents = async ({ menu, row, column, rowIndex }) => {
|
|
228
|
-
const $grid = sohelpVxeGridRef.value;
|
|
229
|
-
if ($grid) {
|
|
230
|
-
$grid.setCurrentRow(row);
|
|
231
|
-
switch (menu.code) {
|
|
232
|
-
case 'insert':
|
|
233
|
-
const { row } = await $grid.insertAt(
|
|
234
|
-
{
|
|
235
|
-
role_name: 'sales user'
|
|
236
|
-
},
|
|
237
|
-
rowIndex
|
|
238
|
-
);
|
|
239
|
-
break;
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
};
|
|
113
|
+
const url = props.url;
|
|
114
|
+
if (!url) {
|
|
115
|
+
gridOptions.loading = false;
|
|
116
|
+
return { results: [], total: 0 };
|
|
117
|
+
}
|
|
243
118
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
};
|
|
119
|
+
let pageConfig = {};
|
|
120
|
+
// 是否分页
|
|
121
|
+
if (gridOptions.pagerConfig?.enabled) {
|
|
122
|
+
pageConfig.page = gridOptions.pagerConfig?.currentPage ?? 1;
|
|
123
|
+
pageConfig.limit = gridOptions.pagerConfig?.pageSize ?? 50;
|
|
124
|
+
}
|
|
251
125
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
126
|
+
const res = await SohelpHttp.get(url, {
|
|
127
|
+
...param,
|
|
128
|
+
keywords: keywords.value,
|
|
129
|
+
...pageConfig
|
|
130
|
+
}).catch((e) => {
|
|
131
|
+
gridOptions.loading = false;
|
|
132
|
+
EleMessage.error(e);
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
gridOptions.loading = false;
|
|
136
|
+
if (!res.meta.success) {
|
|
137
|
+
EleMessage.error(res.meta.message);
|
|
138
|
+
return { results: [], total: 0 };
|
|
139
|
+
}
|
|
140
|
+
const $grid = sohelpVxeGridRef.value;
|
|
141
|
+
$grid.loadData(res.data.results || res.data);
|
|
142
|
+
if (gridOptions?.pagerConfig?.enabled) {
|
|
143
|
+
gridOptions.pagerConfig.total = res.data.total;
|
|
144
|
+
}
|
|
263
145
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
146
|
+
gridOptions.loading = false;
|
|
147
|
+
initValue();
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
/**实现分页事件*/
|
|
152
|
+
const pageChangeEvent = (page) => {
|
|
153
|
+
isPage.value = true;
|
|
154
|
+
gridOptions.pagerConfig.currentPage = page.currentPage;
|
|
155
|
+
gridOptions.pagerConfig.pageSize = page.pageSize;
|
|
156
|
+
emit("pageChange", page);
|
|
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
|
|
269
168
|
};
|
|
169
|
+
}
|
|
170
|
+
//清空选中
|
|
171
|
+
selectedValue.value = [];
|
|
172
|
+
sohelpVxeGridRef.value?.clearCheckboxRow();
|
|
173
|
+
emit("refresh");
|
|
174
|
+
}
|
|
175
|
+
isPage.value = false;
|
|
176
|
+
reload({ ...gridOptions.params });
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* grid事件
|
|
181
|
+
* @param param0
|
|
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
|
+
}
|
|
270
232
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
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 });
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* 行点击
|
|
256
|
+
* @param params
|
|
257
|
+
*/
|
|
258
|
+
const onCellClick = (params) => {
|
|
259
|
+
emit("cellClick", params);
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
*
|
|
264
|
+
* @param params 单选框点击
|
|
265
|
+
*/
|
|
266
|
+
const onRadioChange = (params) => {
|
|
267
|
+
emit("radioChange", params);
|
|
268
|
+
if (!props.multiple) {
|
|
269
|
+
clear();
|
|
270
|
+
const row = sohelpVxeGridRef.value?.getRadioRecord();
|
|
271
|
+
if (row) {
|
|
272
|
+
selectedValue.value = [row.id];
|
|
273
|
+
selectedData.value = Array.from(
|
|
274
|
+
new Map([row, ...selectedData.value].map((item) => [item.id, item])).values()
|
|
275
|
+
);
|
|
276
|
+
} else {
|
|
277
|
+
selectedData.value = props.data;
|
|
278
|
+
selectedValue.value = [];
|
|
279
|
+
}
|
|
290
280
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
281
|
+
updateData();
|
|
282
|
+
}
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* 更新value,data
|
|
287
|
+
*/
|
|
288
|
+
const updateData = () => {
|
|
289
|
+
emit("update:value", [...selectedValue.value]);
|
|
290
|
+
emit("update:data", [...selectedData.value]);
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
/**grid 事件处理 */
|
|
294
|
+
const gridEvents = {
|
|
295
|
+
cellMenu({ row, rowIndex }) {
|
|
296
|
+
const $grid = sohelpVxeGridRef.value;
|
|
297
|
+
if ($grid) {
|
|
298
|
+
$grid.setCurrentRow(row);
|
|
299
|
+
}
|
|
300
|
+
},
|
|
301
|
+
menuClick({ menu, column, row, rowIndex }) {
|
|
302
|
+
const $grid = sohelpVxeGridRef.value;
|
|
303
|
+
if ($grid) {
|
|
304
|
+
switch (menu.code) {
|
|
305
|
+
case "insert":
|
|
306
|
+
// $grid.insert();
|
|
307
|
+
$grid.insertAt({}, rowIndex);
|
|
308
|
+
|
|
309
|
+
let _table = $grid.getTableData();
|
|
310
|
+
|
|
311
|
+
break;
|
|
312
|
+
case "copy":
|
|
313
|
+
break;
|
|
314
|
+
}
|
|
307
315
|
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
316
|
+
emit("menuClick", $grid, code);
|
|
317
|
+
}
|
|
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(() => {
|
|
331
|
+
const $grid = sohelpVxeGridRef.value;
|
|
332
|
+
if ($grid && selectedValue.value.length) {
|
|
333
|
+
setTimeout(() => {
|
|
334
|
+
$grid.setCheckboxRowKey(selectedValue.value, true);
|
|
335
|
+
}, 100);
|
|
336
|
+
}
|
|
337
|
+
});
|
|
338
|
+
};
|
|
315
339
|
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
340
|
+
onMounted(() => {
|
|
341
|
+
if (props.autoLoad) {
|
|
342
|
+
reload({});
|
|
343
|
+
}
|
|
344
|
+
});
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* 清空
|
|
348
|
+
*/
|
|
349
|
+
const clear = () => {
|
|
350
|
+
const $grid = sohelpVxeGridRef.value;
|
|
351
|
+
$grid?.clearCheckboxReserve();
|
|
352
|
+
$grid?.clearCheckboxRow();
|
|
353
|
+
$grid.clearSelected();
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
const getSelection = () => {
|
|
357
|
+
return sohelpVxeGridRef.value?.getCheckboxRecords() || [];
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
watch(
|
|
361
|
+
() => props.value,
|
|
362
|
+
(val) => {
|
|
363
|
+
let arr = Array.isArray(val) ? val : val ? [val] : [];
|
|
364
|
+
selectedValue.value = props.multiple ? [...arr] : [arr[0]];
|
|
365
|
+
if (props.data && props.data?.length > 0) {
|
|
366
|
+
selectedData.value = [...props.data];
|
|
367
|
+
}
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
immediate: true
|
|
371
|
+
}
|
|
372
|
+
);
|
|
373
|
+
|
|
374
|
+
defineExpose({
|
|
375
|
+
$grid: sohelpVxeGridRef,
|
|
376
|
+
getSelection,
|
|
377
|
+
gridOptions,
|
|
378
|
+
loadData,
|
|
379
|
+
refresh,
|
|
380
|
+
reload,
|
|
381
|
+
pageChangeEvent,
|
|
382
|
+
gridEvents,
|
|
383
|
+
menuEvents,
|
|
384
|
+
onToolbarButtonClick,
|
|
385
|
+
onCheckboxChange,
|
|
386
|
+
onCellClick,
|
|
387
|
+
onCheckboxAllChange,
|
|
388
|
+
onRadioChange,
|
|
389
|
+
selectedData,
|
|
390
|
+
selectedValue,
|
|
391
|
+
updateData,
|
|
392
|
+
initValue,
|
|
393
|
+
clear,
|
|
394
|
+
getTableData,
|
|
395
|
+
keywords,
|
|
396
|
+
clearRadioRow: () => {
|
|
397
|
+
sohelpVxeGridRef.value.clearRadioRow();
|
|
398
|
+
}
|
|
399
|
+
});
|
|
400
|
+
</script>
|
|
401
|
+
<script>
|
|
402
|
+
export default {
|
|
403
|
+
name: "SohelpVxeGrid"
|
|
404
|
+
};
|
|
405
|
+
</script>
|
|
334
406
|
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
407
|
+
<style lang="scss" scoped>
|
|
408
|
+
.sohelp-vxe-grid {
|
|
409
|
+
width: 100%;
|
|
410
|
+
height: 100%;
|
|
411
|
+
box-sizing: border-box;
|
|
338
412
|
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
emit('update:value', [...selectedValue.value]);
|
|
344
|
-
emit('update:data', [...selectedData.value]);
|
|
345
|
-
};
|
|
413
|
+
:deep(.vxe-grid) {
|
|
414
|
+
height: 100%;
|
|
415
|
+
width: 100%;
|
|
416
|
+
min-width: 100px;
|
|
346
417
|
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
const $grid = sohelpVxeGridRef.value;
|
|
351
|
-
if ($grid) {
|
|
352
|
-
$grid.setCurrentRow(row);
|
|
353
|
-
}
|
|
354
|
-
},
|
|
355
|
-
menuClick({ menu, column, row, rowIndex }) {
|
|
356
|
-
const $grid = sohelpVxeGridRef.value;
|
|
357
|
-
if ($grid) {
|
|
358
|
-
switch (menu.code) {
|
|
359
|
-
case 'insert':
|
|
360
|
-
// $grid.insert();
|
|
361
|
-
$grid.insertAt({}, rowIndex);
|
|
362
|
-
|
|
363
|
-
let _table = $grid.getTableData();
|
|
364
|
-
|
|
365
|
-
break;
|
|
366
|
-
case 'copy':
|
|
367
|
-
break;
|
|
368
|
-
}
|
|
418
|
+
.vxe-grid--layout-body-content-wrapper {
|
|
419
|
+
display: flex;
|
|
420
|
+
flex-direction: column;
|
|
369
421
|
|
|
370
|
-
|
|
371
|
-
|
|
422
|
+
.vxe-grid--toolbar-wrapper {
|
|
423
|
+
.vxe-toolbar {
|
|
424
|
+
box-sizing: border-box;
|
|
425
|
+
padding: 0 5px 5px 5px;
|
|
372
426
|
}
|
|
373
|
-
};
|
|
374
|
-
|
|
375
|
-
const loadData = (data) =>{
|
|
376
|
-
const $grid = sohelpVxeGridRef.value;
|
|
377
|
-
$grid.loadData(data);
|
|
378
427
|
}
|
|
379
428
|
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
const initValue = () => {
|
|
384
|
-
nextTick(() => {
|
|
385
|
-
const $grid = sohelpVxeGridRef.value;
|
|
386
|
-
if ($grid && selectedValue.value.length) {
|
|
387
|
-
setTimeout(() => {
|
|
388
|
-
$grid.setCheckboxRowKey(selectedValue.value, true);
|
|
389
|
-
}, 100);
|
|
390
|
-
}
|
|
391
|
-
});
|
|
392
|
-
};
|
|
429
|
+
.vxe-grid--table-container {
|
|
430
|
+
flex: 1;
|
|
431
|
+
height: 100%;
|
|
393
432
|
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
*/
|
|
397
|
-
const clear = () => {
|
|
398
|
-
const $grid = sohelpVxeGridRef.value;
|
|
399
|
-
$grid?.clearCheckboxReserve();
|
|
400
|
-
$grid?.clearCheckboxRow();
|
|
401
|
-
$grid.clearSelected();
|
|
402
|
-
};
|
|
433
|
+
.vxe-table {
|
|
434
|
+
height: 100%;
|
|
403
435
|
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
};
|
|
436
|
+
.vxe-table--render-wrapper {
|
|
437
|
+
height: 100%;
|
|
407
438
|
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
(val) => {
|
|
411
|
-
let arr = Array.isArray(val) ? val : val ? [val] : [];
|
|
412
|
-
selectedValue.value = props.multiple ? [...arr] : [arr[0]];
|
|
413
|
-
if (props.data && props.data?.length > 0) {
|
|
414
|
-
selectedData.value = [...props.data];
|
|
415
|
-
}
|
|
416
|
-
},
|
|
417
|
-
{
|
|
418
|
-
immediate: true
|
|
419
|
-
}
|
|
420
|
-
);
|
|
439
|
+
.vxe-table--layout-wrapper {
|
|
440
|
+
height: calc(100% - 10px);
|
|
421
441
|
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
loadData,
|
|
426
|
-
sohelpVxeGridRef,
|
|
427
|
-
DragOutlined,
|
|
428
|
-
refresh,
|
|
429
|
-
reload,
|
|
430
|
-
pageChangeEvent,
|
|
431
|
-
gridEvents,
|
|
432
|
-
menuEvents,
|
|
433
|
-
onToolbarButtonClick,
|
|
434
|
-
onCheckboxChange,
|
|
435
|
-
onCellClick,
|
|
436
|
-
onCheckboxAllChange,
|
|
437
|
-
onRadioChange,
|
|
438
|
-
selectedData,
|
|
439
|
-
selectedValue,
|
|
440
|
-
updateData,
|
|
441
|
-
initValue,
|
|
442
|
-
clear,
|
|
443
|
-
getTableData,
|
|
444
|
-
keywords,
|
|
445
|
-
Search,
|
|
446
|
-
getKeywordsPlaceholder,
|
|
447
|
-
propertiesMap,
|
|
448
|
-
clearRadioRow: () => {
|
|
449
|
-
sohelpVxeGridRef.value.clearRadioRow();
|
|
450
|
-
}
|
|
451
|
-
};
|
|
452
|
-
}
|
|
453
|
-
};
|
|
454
|
-
</script>
|
|
455
|
-
|
|
456
|
-
<style lang="scss" scoped>
|
|
457
|
-
.sohelp-vxe-grid {
|
|
458
|
-
width: 100%;
|
|
459
|
-
height: 100%;
|
|
460
|
-
box-sizing: border-box;
|
|
461
|
-
:deep(.vxe-grid) {
|
|
462
|
-
height: 100%;
|
|
463
|
-
width: 100%;
|
|
464
|
-
min-width: 100px;
|
|
465
|
-
|
|
466
|
-
.vxe-grid--layout-body-content-wrapper {
|
|
467
|
-
display: flex;
|
|
468
|
-
flex-direction: column;
|
|
469
|
-
|
|
470
|
-
.vxe-grid--toolbar-wrapper {
|
|
471
|
-
.vxe-toolbar {
|
|
472
|
-
box-sizing: border-box;
|
|
473
|
-
padding: 0 5px 5px 5px;
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
.vxe-grid--table-container {
|
|
478
|
-
flex: 1;
|
|
479
|
-
height: 100%;
|
|
480
|
-
.vxe-table {
|
|
481
|
-
height: 100%;
|
|
482
|
-
.vxe-table--render-wrapper {
|
|
483
|
-
height: 100%;
|
|
484
|
-
.vxe-table--layout-wrapper {
|
|
485
|
-
height: calc(100% - 10px);
|
|
486
|
-
.col--selected {
|
|
487
|
-
//去除单元格选中效果
|
|
488
|
-
box-shadow: none;
|
|
489
|
-
}
|
|
442
|
+
.col--selected {
|
|
443
|
+
//去除单元格选中效果
|
|
444
|
+
box-shadow: none;
|
|
490
445
|
}
|
|
491
446
|
}
|
|
492
447
|
}
|
|
@@ -494,25 +449,27 @@
|
|
|
494
449
|
}
|
|
495
450
|
}
|
|
496
451
|
}
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
.drag-btn {
|
|
455
|
+
cursor: move;
|
|
456
|
+
font-size: 12px;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
.vxe-body--row.sortable-ghost,
|
|
460
|
+
.vxe-body--row.sortable-chosen {
|
|
461
|
+
background-color: #dfecfb;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
.search-wrap {
|
|
465
|
+
display: flex;
|
|
466
|
+
align-items: center;
|
|
467
|
+
justify-content: flex-start;
|
|
468
|
+
gap: 10px;
|
|
469
|
+
margin-right: 10px;
|
|
470
|
+
|
|
471
|
+
.search-box {
|
|
472
|
+
width: 200px;
|
|
517
473
|
}
|
|
474
|
+
}
|
|
518
475
|
</style>
|