m-eleplus-crud 0.0.12 → 0.0.13
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/dist/index.full.js +1 -1
- package/dist/index.full.min.js +1 -1
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +1 -1
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +1 -1
- package/es/index.mjs +5 -5
- package/es/packages/components/crud/index.mjs +2 -2
- package/es/packages/components/crud/src/crud.mjs +53 -621
- package/es/packages/components/crud/src/crud.mjs.map +1 -1
- package/es/packages/components/crud/src/crud2.mjs +621 -53
- package/es/packages/components/crud/src/crud2.mjs.map +1 -1
- package/es/packages/components/form/src/form.mjs +1 -1
- package/es/packages/components/form/src/form.mjs.map +1 -1
- package/es/packages/components/index.mjs +5 -5
- package/es/packages/components/picture/index.mjs +2 -2
- package/es/packages/components/picture/src/picture.mjs +19 -26
- package/es/packages/components/picture/src/picture.mjs.map +1 -1
- package/es/packages/components/picture/src/picture2.mjs +26 -19
- package/es/packages/components/picture/src/picture2.mjs.map +1 -1
- package/es/packages/components/qrcode/index.mjs +2 -2
- package/es/packages/components/qrcode/src/qrcode.mjs +62 -22
- package/es/packages/components/qrcode/src/qrcode.mjs.map +1 -1
- package/es/packages/components/qrcode/src/qrcode2.mjs +22 -62
- package/es/packages/components/qrcode/src/qrcode2.mjs.map +1 -1
- package/es/packages/components/search/index.mjs +2 -2
- package/es/packages/components/search/src/search.mjs +438 -25
- package/es/packages/components/search/src/search.mjs.map +1 -1
- package/es/packages/components/search/src/search2.mjs +25 -438
- package/es/packages/components/search/src/search2.mjs.map +1 -1
- package/es/packages/components/table/index.mjs +2 -2
- package/es/packages/components/table/src/table.mjs +37 -420
- package/es/packages/components/table/src/table.mjs.map +1 -1
- package/es/packages/components/table/src/table2.mjs +420 -37
- package/es/packages/components/table/src/table2.mjs.map +1 -1
- package/lib/index.js +5 -5
- package/lib/packages/components/crud/index.js +2 -2
- package/lib/packages/components/crud/src/crud.js +54 -621
- package/lib/packages/components/crud/src/crud.js.map +1 -1
- package/lib/packages/components/crud/src/crud2.js +621 -54
- package/lib/packages/components/crud/src/crud2.js.map +1 -1
- package/lib/packages/components/form/src/form.js +1 -1
- package/lib/packages/components/form/src/form.js.map +1 -1
- package/lib/packages/components/index.js +5 -5
- package/lib/packages/components/picture/index.js +2 -2
- package/lib/packages/components/picture/src/picture.js +20 -26
- package/lib/packages/components/picture/src/picture.js.map +1 -1
- package/lib/packages/components/picture/src/picture2.js +26 -20
- package/lib/packages/components/picture/src/picture2.js.map +1 -1
- package/lib/packages/components/qrcode/index.js +2 -2
- package/lib/packages/components/qrcode/src/qrcode.js +66 -23
- package/lib/packages/components/qrcode/src/qrcode.js.map +1 -1
- package/lib/packages/components/qrcode/src/qrcode2.js +23 -66
- package/lib/packages/components/qrcode/src/qrcode2.js.map +1 -1
- package/lib/packages/components/search/index.js +2 -2
- package/lib/packages/components/search/src/search.js +438 -26
- package/lib/packages/components/search/src/search.js.map +1 -1
- package/lib/packages/components/search/src/search2.js +26 -438
- package/lib/packages/components/search/src/search2.js.map +1 -1
- package/lib/packages/components/table/index.js +2 -2
- package/lib/packages/components/table/src/table.js +38 -425
- package/lib/packages/components/table/src/table.js.map +1 -1
- package/lib/packages/components/table/src/table2.js +425 -38
- package/lib/packages/components/table/src/table2.js.map +1 -1
- package/package.json +1 -1
- package/web-types.json +1 -1
|
@@ -2,631 +2,64 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var index$1 = require('../../../../node_modules/.pnpm/element-plus@2.9.1_vue@3.5.13_typescript@5.5.4_/node_modules/element-plus/es/components/message-box/index.js');
|
|
10
|
-
var useGlobalConfig = require('../../config-provider/src/hooks/use-global-config.js');
|
|
11
|
-
var index = require('../../../hooks/use-locale/index.js');
|
|
5
|
+
var types = require('../../../utils/types.js');
|
|
6
|
+
var runtime = require('../../../utils/vue/props/runtime.js');
|
|
7
|
+
var index = require('../../../hooks/use-size/index.js');
|
|
8
|
+
var shared = require('@vue/shared');
|
|
12
9
|
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const keys = Object.keys(slots);
|
|
39
|
-
const result = {};
|
|
40
|
-
for (const key of keys) {
|
|
41
|
-
if (key.endsWith("Form")) {
|
|
42
|
-
result[key.replace("Form", "")] = slots[key];
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return result;
|
|
46
|
-
});
|
|
47
|
-
const tableSlots = vue.computed(() => {
|
|
48
|
-
const whites = ["topLeft", "topRight", "addBtn"];
|
|
49
|
-
const keys = Object.keys(slots);
|
|
50
|
-
const result = {};
|
|
51
|
-
for (const key of keys) {
|
|
52
|
-
if (!whites.includes(key) && !key.endsWith("Search") && !key.endsWith("Form")) {
|
|
53
|
-
result[key] = slots[key];
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return result;
|
|
57
|
-
});
|
|
58
|
-
const crudOption = vue.ref({
|
|
10
|
+
const crudProps = runtime.buildProps({
|
|
11
|
+
size: index.useSizeProp,
|
|
12
|
+
loading: {
|
|
13
|
+
type: Boolean,
|
|
14
|
+
default: false
|
|
15
|
+
},
|
|
16
|
+
data: {
|
|
17
|
+
type: Array,
|
|
18
|
+
required: true
|
|
19
|
+
},
|
|
20
|
+
search: {
|
|
21
|
+
type: Object,
|
|
22
|
+
default: () => ({})
|
|
23
|
+
},
|
|
24
|
+
total: {
|
|
25
|
+
type: Number,
|
|
26
|
+
default: 0
|
|
27
|
+
},
|
|
28
|
+
modelValue: {
|
|
29
|
+
type: Object,
|
|
30
|
+
required: true
|
|
31
|
+
},
|
|
32
|
+
permission: {
|
|
33
|
+
type: Object,
|
|
34
|
+
default: () => ({
|
|
59
35
|
addBtn: true,
|
|
60
36
|
editBtn: true,
|
|
61
|
-
delBtn: true
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
const dialogVisible = vue.ref(false);
|
|
75
|
-
const tableHeight = vue.ref(void 0);
|
|
76
|
-
const _modelForm = vue.ref();
|
|
77
|
-
const _rowIndex = vue.ref(-1);
|
|
78
|
-
const dialogTitle = vue.computed(() => {
|
|
79
|
-
if (dialogType.value === "add") {
|
|
80
|
-
return crudOption.value.addDialogTitle;
|
|
81
|
-
}
|
|
82
|
-
if (dialogType.value === "edit") {
|
|
83
|
-
return crudOption.value.editDialogTitle;
|
|
84
|
-
}
|
|
85
|
-
return crudOption.value.viewDialogTitle;
|
|
86
|
-
});
|
|
87
|
-
const modelForm = vue.computed({
|
|
88
|
-
get() {
|
|
89
|
-
return props.modelValue;
|
|
90
|
-
},
|
|
91
|
-
set(value) {
|
|
92
|
-
emit("update:modelValue", value);
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
const __firstModelForm = vue.ref({});
|
|
96
|
-
__firstModelForm.value = props.modelValue;
|
|
97
|
-
const tableOption = vue.ref({
|
|
98
|
-
menu: true,
|
|
99
|
-
column: []
|
|
100
|
-
});
|
|
101
|
-
const searchOption = vue.ref({
|
|
102
|
-
column: []
|
|
103
|
-
});
|
|
104
|
-
const formOption = vue.computed(() => {
|
|
105
|
-
let option = {
|
|
106
|
-
column: []
|
|
107
|
-
};
|
|
108
|
-
option = transFormOption(
|
|
109
|
-
Object.assign({}, option, copyObjectExcept(crudOption.value, ["column"]))
|
|
110
|
-
);
|
|
111
|
-
for (let i = 0; i < crudOption.value.column.length; i++) {
|
|
112
|
-
const item = lodashUnified.cloneDeep(crudOption.value.column[i]);
|
|
113
|
-
const formColumn = transFormColumn(item);
|
|
114
|
-
if (["index", "single", "selection"].includes(item.type || "")) {
|
|
115
|
-
continue;
|
|
116
|
-
}
|
|
117
|
-
if (dialogType.value === "add") {
|
|
118
|
-
if (!item.addHide) {
|
|
119
|
-
option.column.push(formColumn);
|
|
120
|
-
}
|
|
121
|
-
} else if (dialogType.value === "edit") {
|
|
122
|
-
if (!item.editHide) {
|
|
123
|
-
option.column.push(formColumn);
|
|
124
|
-
}
|
|
125
|
-
} else {
|
|
126
|
-
if (!item.viewHide) {
|
|
127
|
-
option.column.push(formColumn);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
return option;
|
|
132
|
-
});
|
|
133
|
-
const searchProxys = new Proxy(props.search, {
|
|
134
|
-
get(target, key) {
|
|
135
|
-
return lodashUnified.get(target, key);
|
|
136
|
-
},
|
|
137
|
-
set(target, key, value) {
|
|
138
|
-
lodashUnified.set(target, key, value);
|
|
139
|
-
return true;
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
const selectData = vue.computed({
|
|
143
|
-
get() {
|
|
144
|
-
return props.select;
|
|
145
|
-
},
|
|
146
|
-
set(value) {
|
|
147
|
-
emit("update:select", value);
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
const transSearchColumn = (column) => {
|
|
151
|
-
const result = lodashUnified.cloneDeep(column);
|
|
152
|
-
if (column.searchOrder) {
|
|
153
|
-
result.order = column.searchOrder;
|
|
154
|
-
} else {
|
|
155
|
-
delete result.order;
|
|
156
|
-
}
|
|
157
|
-
if (column.searchValue) {
|
|
158
|
-
result.value = column.searchValue;
|
|
159
|
-
} else {
|
|
160
|
-
delete result.value;
|
|
161
|
-
}
|
|
162
|
-
if (column.searchPlaceholder) {
|
|
163
|
-
result.placeholder = column.searchPlaceholder;
|
|
164
|
-
} else {
|
|
165
|
-
delete result.placeholder;
|
|
166
|
-
}
|
|
167
|
-
if (column.searchRules) {
|
|
168
|
-
result.rules = column.searchRules;
|
|
169
|
-
} else {
|
|
170
|
-
delete result.rules;
|
|
171
|
-
}
|
|
172
|
-
if (column.searchSpan) {
|
|
173
|
-
result.span = column.searchSpan;
|
|
174
|
-
} else {
|
|
175
|
-
delete result.span;
|
|
176
|
-
}
|
|
177
|
-
if (column.searchLabelWidth) {
|
|
178
|
-
result.labelWidth = column.searchLabelWidth;
|
|
179
|
-
} else {
|
|
180
|
-
delete result.labelWidth;
|
|
181
|
-
}
|
|
182
|
-
if (column.searchClearable) {
|
|
183
|
-
result.clearable = column.searchClearable;
|
|
184
|
-
} else {
|
|
185
|
-
delete result.clearable;
|
|
186
|
-
}
|
|
187
|
-
return result;
|
|
188
|
-
};
|
|
189
|
-
const transFormColumn = (column) => {
|
|
190
|
-
const result = lodashUnified.cloneDeep(column);
|
|
191
|
-
if (column.formOrder) {
|
|
192
|
-
result.order = column.formOrder;
|
|
193
|
-
} else {
|
|
194
|
-
delete result.order;
|
|
195
|
-
}
|
|
196
|
-
if (column.formValue) {
|
|
197
|
-
result.value = column.formValue;
|
|
198
|
-
} else {
|
|
199
|
-
delete result.value;
|
|
200
|
-
}
|
|
201
|
-
if (column.formPlaceholder) {
|
|
202
|
-
result.placeholder = column.formPlaceholder;
|
|
203
|
-
} else {
|
|
204
|
-
delete result.placeholder;
|
|
205
|
-
}
|
|
206
|
-
if (column.formRules) {
|
|
207
|
-
result.rules = column.formRules;
|
|
208
|
-
} else {
|
|
209
|
-
delete result.rules;
|
|
210
|
-
}
|
|
211
|
-
if (column.formLabelWidth) {
|
|
212
|
-
result.labelWidth = column.formLabelWidth;
|
|
213
|
-
} else {
|
|
214
|
-
delete result.labelWidth;
|
|
215
|
-
}
|
|
216
|
-
if (column.formClearable) {
|
|
217
|
-
result.clearable = column.formClearable;
|
|
218
|
-
} else {
|
|
219
|
-
delete result.clearable;
|
|
220
|
-
}
|
|
221
|
-
if (column.formSpan || column.addSpan || column.editSpan || column.viewSpan) {
|
|
222
|
-
if (column.formSpan) {
|
|
223
|
-
result.span = column.formSpan;
|
|
224
|
-
}
|
|
225
|
-
if (dialogType.value === "add" && column.addSpan) {
|
|
226
|
-
result.span = column.addSpan;
|
|
227
|
-
} else if (dialogType.value === "edit" && column.editSpan) {
|
|
228
|
-
result.span = column.editSpan;
|
|
229
|
-
} else if (dialogType.value === "view" && column.viewSpan) {
|
|
230
|
-
result.span = column.viewSpan;
|
|
231
|
-
}
|
|
232
|
-
} else {
|
|
233
|
-
delete result.span;
|
|
234
|
-
}
|
|
235
|
-
if (column.addDisabled || column.editDisabled) {
|
|
236
|
-
if (dialogType.value === "add" && column.addDisabled) {
|
|
237
|
-
result.disabled = column.addDisabled;
|
|
238
|
-
} else if (dialogType.value === "edit" && column.editDisabled) {
|
|
239
|
-
result.disabled = column.editDisabled;
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
return result;
|
|
243
|
-
};
|
|
244
|
-
const transSearchOption = (option) => {
|
|
245
|
-
const result = lodashUnified.cloneDeep(option);
|
|
246
|
-
if (option.searchLabelWidth) {
|
|
247
|
-
result.labelWidth = option.searchLabelWidth;
|
|
248
|
-
} else {
|
|
249
|
-
delete result.labelWidth;
|
|
250
|
-
}
|
|
251
|
-
return result;
|
|
252
|
-
};
|
|
253
|
-
const transFormOption = (option) => {
|
|
254
|
-
const result = lodashUnified.cloneDeep(option);
|
|
255
|
-
if (option.formLabelWidth) {
|
|
256
|
-
result.labelWidth = option.formLabelWidth;
|
|
257
|
-
} else {
|
|
258
|
-
delete result.labelWidth;
|
|
259
|
-
}
|
|
260
|
-
return result;
|
|
261
|
-
};
|
|
262
|
-
const currentPageChange = (page) => {
|
|
263
|
-
var _a;
|
|
264
|
-
(_a = searchRef.value) == null ? void 0 : _a.search(page);
|
|
265
|
-
};
|
|
266
|
-
const pageSizeChange = (pageSize) => {
|
|
267
|
-
var _a;
|
|
268
|
-
searchProxys.limit = pageSize;
|
|
269
|
-
(_a = searchRef.value) == null ? void 0 : _a.search();
|
|
270
|
-
};
|
|
271
|
-
const handleSearch = (form) => {
|
|
272
|
-
var _a;
|
|
273
|
-
(_a = tableRef.value) == null ? void 0 : _a.clearSelection();
|
|
274
|
-
emit("search", form);
|
|
275
|
-
};
|
|
276
|
-
const handleReset = () => {
|
|
277
|
-
var _a;
|
|
278
|
-
(_a = tableRef.value) == null ? void 0 : _a.clearSelection();
|
|
279
|
-
emit("reset");
|
|
280
|
-
};
|
|
281
|
-
const setTableHeight = () => {
|
|
282
|
-
vue.nextTick(() => {
|
|
283
|
-
var _a, _b;
|
|
284
|
-
if (crudOption.value.height === "auto") {
|
|
285
|
-
const tableStyle = (_a = tableRef.value) == null ? void 0 : _a.$el;
|
|
286
|
-
const calcHeight = crudOption.value.calcHeight || ((_b = globalConfig.value) == null ? void 0 : _b.calcHeight) || 0;
|
|
287
|
-
tableHeight.value = document.documentElement.clientHeight - ((tableStyle == null ? void 0 : tableStyle.offsetTop) || 0) - 72 - calcHeight;
|
|
288
|
-
} else {
|
|
289
|
-
tableHeight.value = crudOption.value.height;
|
|
290
|
-
}
|
|
291
|
-
});
|
|
292
|
-
};
|
|
293
|
-
const rowAdd = () => {
|
|
294
|
-
dialogType.value = "add";
|
|
295
|
-
dialogVisible.value = true;
|
|
296
|
-
};
|
|
297
|
-
const rowEdit = (row, index) => {
|
|
298
|
-
_modelForm.value = lodashUnified.cloneDeep(row);
|
|
299
|
-
_rowIndex.value = index;
|
|
300
|
-
dialogType.value = "edit";
|
|
301
|
-
modelForm.value = lodashUnified.cloneDeep(row);
|
|
302
|
-
dialogVisible.value = true;
|
|
303
|
-
};
|
|
304
|
-
const rowView = (row, index) => {
|
|
305
|
-
_modelForm.value = lodashUnified.cloneDeep(row);
|
|
306
|
-
_rowIndex.value = index;
|
|
307
|
-
dialogType.value = "view";
|
|
308
|
-
modelForm.value = lodashUnified.cloneDeep(row);
|
|
309
|
-
dialogVisible.value = true;
|
|
310
|
-
};
|
|
311
|
-
const rowDel = (row, index) => {
|
|
312
|
-
index$1.ElMessageBox.confirm("\u6B64\u64CD\u4F5C\u5C06\u5220\u9664\u8BE5\u6570\u636E, \u662F\u5426\u7EE7\u7EED?", "\u63D0\u793A", {
|
|
313
|
-
confirmButtonText: "\u786E\u5B9A",
|
|
314
|
-
cancelButtonText: "\u53D6\u6D88",
|
|
315
|
-
type: "warning"
|
|
316
|
-
}).then(() => {
|
|
317
|
-
emit("rowDel", row, index);
|
|
318
|
-
}).catch(() => {
|
|
319
|
-
});
|
|
320
|
-
};
|
|
321
|
-
const dialogEnter = async (done, loading) => {
|
|
322
|
-
const valid = await formRef.value.validForm();
|
|
323
|
-
if (!valid) {
|
|
324
|
-
loading();
|
|
325
|
-
return;
|
|
326
|
-
}
|
|
327
|
-
if (props.beforeEnter && !await props.beforeEnter()) {
|
|
328
|
-
loading();
|
|
329
|
-
return;
|
|
330
|
-
}
|
|
331
|
-
if (dialogType.value === "add") {
|
|
332
|
-
emit("rowSave", modelForm.value, done, loading);
|
|
333
|
-
} else if (dialogType.value === "edit") {
|
|
334
|
-
emit("rowEdit", modelForm.value, done, loading);
|
|
335
|
-
}
|
|
336
|
-
};
|
|
337
|
-
const dialogCancel = () => {
|
|
338
|
-
emit("rowCancel", _modelForm.value || {}, _rowIndex.value, dialogType.value);
|
|
339
|
-
};
|
|
340
|
-
const dialogClose = () => {
|
|
341
|
-
_modelForm.value = null;
|
|
342
|
-
_rowIndex.value = -1;
|
|
343
|
-
if (formRef.value) {
|
|
344
|
-
formRef.value.clear();
|
|
345
|
-
modelForm.value = lodashUnified.cloneDeep(__firstModelForm.value);
|
|
346
|
-
} else {
|
|
347
|
-
emit("update:modelValue", lodashUnified.cloneDeep(__firstModelForm.value));
|
|
348
|
-
}
|
|
349
|
-
};
|
|
350
|
-
const copyObjectExcept = (sourceObj, excludeKeys = []) => {
|
|
351
|
-
const result = {};
|
|
352
|
-
Object.keys(sourceObj).forEach((key) => {
|
|
353
|
-
if (!excludeKeys.includes(key)) {
|
|
354
|
-
result[key] = sourceObj[key];
|
|
355
|
-
}
|
|
356
|
-
});
|
|
357
|
-
return result;
|
|
358
|
-
};
|
|
359
|
-
vue.watch(
|
|
360
|
-
() => props.option,
|
|
361
|
-
(newVal) => {
|
|
362
|
-
if (newVal) {
|
|
363
|
-
crudOption.value = Object.assign({}, crudOption.value, newVal);
|
|
364
|
-
tableOption.value = Object.assign(
|
|
365
|
-
{},
|
|
366
|
-
tableOption.value,
|
|
367
|
-
copyObjectExcept(crudOption.value, ["column"])
|
|
368
|
-
);
|
|
369
|
-
searchOption.value = transSearchOption(
|
|
370
|
-
Object.assign(
|
|
371
|
-
{},
|
|
372
|
-
searchOption.value,
|
|
373
|
-
copyObjectExcept(crudOption.value, ["column"])
|
|
374
|
-
)
|
|
375
|
-
);
|
|
376
|
-
const searchColumns = [];
|
|
377
|
-
const tableColumns = [];
|
|
378
|
-
if (newVal.column && newVal.column.length) {
|
|
379
|
-
for (let i = 0; i < newVal.column.length; i++) {
|
|
380
|
-
const item = newVal.column[i];
|
|
381
|
-
if (item.search && !["index", "single", "selection"].includes(item.type || "")) {
|
|
382
|
-
searchColumns.push(transSearchColumn(item));
|
|
383
|
-
}
|
|
384
|
-
if (!item.hide) {
|
|
385
|
-
tableColumns.push(item);
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
searchOption.value.column = searchColumns;
|
|
389
|
-
tableOption.value.column = tableColumns;
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
},
|
|
393
|
-
{
|
|
394
|
-
immediate: true,
|
|
395
|
-
deep: true
|
|
396
|
-
}
|
|
397
|
-
);
|
|
398
|
-
vue.onMounted(() => {
|
|
399
|
-
if (crudOption.value.height) {
|
|
400
|
-
setTableHeight();
|
|
401
|
-
}
|
|
402
|
-
});
|
|
403
|
-
__expose({
|
|
404
|
-
rowAdd,
|
|
405
|
-
rowEdit,
|
|
406
|
-
rowView,
|
|
407
|
-
rowDel
|
|
408
|
-
});
|
|
409
|
-
return (_ctx, _cache) => {
|
|
410
|
-
const _component_MSearch = vue.resolveComponent("MSearch");
|
|
411
|
-
const _component_el_button = vue.resolveComponent("el-button");
|
|
412
|
-
const _component_el_link = vue.resolveComponent("el-link");
|
|
413
|
-
const _component_MTable = vue.resolveComponent("MTable");
|
|
414
|
-
const _component_m_pagination = vue.resolveComponent("m-pagination");
|
|
415
|
-
const _component_MForm = vue.resolveComponent("MForm");
|
|
416
|
-
const _component_MDialog = vue.resolveComponent("MDialog");
|
|
417
|
-
return vue.openBlock(), vue.createElementBlock("div", { class: "m-crud" }, [
|
|
418
|
-
vue.createVNode(_component_MSearch, {
|
|
419
|
-
ref_key: "searchRef",
|
|
420
|
-
ref: searchRef,
|
|
421
|
-
model: vue.unref(searchProxys),
|
|
422
|
-
option: searchOption.value,
|
|
423
|
-
size: _ctx.size || vue.unref(globalConfig).size,
|
|
424
|
-
permission: _ctx.permission,
|
|
425
|
-
onSearch: handleSearch,
|
|
426
|
-
onReset: handleReset
|
|
427
|
-
}, vue.createSlots({
|
|
428
|
-
_: 2
|
|
429
|
-
}, [
|
|
430
|
-
vue.renderList(Object.keys(searchSlots.value), (slotKey, index) => {
|
|
431
|
-
return {
|
|
432
|
-
name: slotKey,
|
|
433
|
-
fn: vue.withCtx((scope) => [
|
|
434
|
-
vue.renderSlot(_ctx.$slots, slotKey + "Search", vue.normalizeProps(vue.guardReactiveProps(scope)))
|
|
435
|
-
])
|
|
436
|
-
};
|
|
437
|
-
})
|
|
438
|
-
]), 1032, ["model", "option", "size", "permission"]),
|
|
439
|
-
vue.createCommentVNode("\u9876\u90E8\u64CD\u4F5C\u533A\u57DF"),
|
|
440
|
-
crudOption.value.addBtn || vue.unref(slots).topLeft || vue.unref(slots).topRight ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
441
|
-
key: 0,
|
|
442
|
-
class: "m-search-top"
|
|
443
|
-
}, [
|
|
444
|
-
crudOption.value.addBtn || vue.unref(slots).topLeft ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
445
|
-
key: 0,
|
|
446
|
-
class: "m-search-left"
|
|
447
|
-
}, [
|
|
448
|
-
crudOption.value.addBtn && !vue.unref(slots).addBtn && _ctx.permission["add"] !== false ? (vue.openBlock(), vue.createBlock(_component_el_button, {
|
|
449
|
-
key: 0,
|
|
450
|
-
size: _ctx.size || vue.unref(globalConfig).size,
|
|
451
|
-
type: "primary",
|
|
452
|
-
icon: crudOption.value.addBtnIcon,
|
|
453
|
-
onClick: ($event) => rowAdd()
|
|
454
|
-
}, {
|
|
455
|
-
default: vue.withCtx(() => [
|
|
456
|
-
vue.createTextVNode(
|
|
457
|
-
vue.toDisplayString(crudOption.value.addBtnText),
|
|
458
|
-
1
|
|
459
|
-
)
|
|
460
|
-
]),
|
|
461
|
-
_: 1
|
|
462
|
-
}, 8, ["size", "icon", "onClick"])) : vue.createCommentVNode("v-if", true),
|
|
463
|
-
_ctx.permission["add"] !== false ? vue.renderSlot(_ctx.$slots, "addBtn", vue.normalizeProps(vue.mergeProps({ key: 1 }, { size: _ctx.size || vue.unref(globalConfig).size }))) : vue.createCommentVNode("v-if", true),
|
|
464
|
-
vue.renderSlot(_ctx.$slots, "topLeft", vue.normalizeProps(vue.guardReactiveProps({ size: _ctx.size || vue.unref(globalConfig).size })))
|
|
465
|
-
])) : (vue.openBlock(), vue.createElementBlock("div", {
|
|
466
|
-
key: 1,
|
|
467
|
-
class: "m-search-left"
|
|
468
|
-
})),
|
|
469
|
-
vue.createElementVNode("div", { class: "m-search-right" }, [
|
|
470
|
-
vue.renderSlot(_ctx.$slots, "topRight", vue.normalizeProps(vue.guardReactiveProps({ size: _ctx.size || vue.unref(globalConfig).size })))
|
|
471
|
-
])
|
|
472
|
-
])) : vue.createCommentVNode("v-if", true),
|
|
473
|
-
vue.createCommentVNode(""),
|
|
474
|
-
vue.createCommentVNode("\u8868\u683C"),
|
|
475
|
-
vue.createVNode(_component_MTable, {
|
|
476
|
-
ref_key: "tableRef",
|
|
477
|
-
ref: tableRef,
|
|
478
|
-
select: selectData.value,
|
|
479
|
-
"onUpdate:select": ($event) => selectData.value = $event,
|
|
480
|
-
data: _ctx.data,
|
|
481
|
-
size: _ctx.size || vue.unref(globalConfig).size,
|
|
482
|
-
loading: _ctx.loading,
|
|
483
|
-
permission: _ctx.permission,
|
|
484
|
-
option: tableOption.value,
|
|
485
|
-
height: tableHeight.value,
|
|
486
|
-
"max-height": tableHeight.value
|
|
487
|
-
}, vue.createSlots({
|
|
488
|
-
menu: vue.withCtx((scope) => [
|
|
489
|
-
crudOption.value.editBtn && !vue.unref(slots).editBtn && _ctx.permission["edit"] !== false ? (vue.openBlock(), vue.createBlock(_component_el_link, {
|
|
490
|
-
key: 0,
|
|
491
|
-
class: "m-control-btns",
|
|
492
|
-
type: "primary",
|
|
493
|
-
size: _ctx.size || vue.unref(globalConfig).size,
|
|
494
|
-
underline: "never",
|
|
495
|
-
icon: "Edit",
|
|
496
|
-
onClick: ($event) => rowEdit(scope.row, scope.$index)
|
|
497
|
-
}, {
|
|
498
|
-
default: vue.withCtx(() => [
|
|
499
|
-
vue.createTextVNode(
|
|
500
|
-
vue.toDisplayString(vue.unref(t)("m.crud.editBtnText")),
|
|
501
|
-
1
|
|
502
|
-
)
|
|
503
|
-
]),
|
|
504
|
-
_: 2
|
|
505
|
-
}, 1032, ["size", "onClick"])) : vue.createCommentVNode("v-if", true),
|
|
506
|
-
crudOption.value.editBtn && vue.unref(slots).editBtn && _ctx.permission["edit"] !== false ? vue.renderSlot(_ctx.$slots, "editBtn", vue.normalizeProps(vue.mergeProps({ key: 1 }, scope))) : vue.createCommentVNode("v-if", true),
|
|
507
|
-
crudOption.value.delBtn && !vue.unref(slots).delBtn && _ctx.permission["del"] !== false ? (vue.openBlock(), vue.createBlock(_component_el_link, {
|
|
508
|
-
key: 2,
|
|
509
|
-
class: "m-control-btns",
|
|
510
|
-
type: "primary",
|
|
511
|
-
underline: "never",
|
|
512
|
-
size: _ctx.size || vue.unref(globalConfig).size,
|
|
513
|
-
icon: "Delete",
|
|
514
|
-
onClick: ($event) => rowDel(scope.row, scope.$index)
|
|
515
|
-
}, {
|
|
516
|
-
default: vue.withCtx(() => [
|
|
517
|
-
vue.createTextVNode(
|
|
518
|
-
vue.toDisplayString(vue.unref(t)("m.crud.delBtnText")),
|
|
519
|
-
1
|
|
520
|
-
)
|
|
521
|
-
]),
|
|
522
|
-
_: 2
|
|
523
|
-
}, 1032, ["size", "onClick"])) : vue.createCommentVNode("v-if", true),
|
|
524
|
-
crudOption.value.delBtn && vue.unref(slots).delBtn && _ctx.permission["del"] !== false ? vue.renderSlot(_ctx.$slots, "delBtn", vue.normalizeProps(vue.mergeProps({ key: 3 }, scope))) : vue.createCommentVNode("v-if", true),
|
|
525
|
-
crudOption.value.menu && vue.unref(slots).menu && !(vue.unref(slots).editBtn || vue.unref(slots).delBtn) ? vue.renderSlot(_ctx.$slots, "menu", vue.normalizeProps(vue.mergeProps({ key: 4 }, scope))) : vue.createCommentVNode("v-if", true)
|
|
526
|
-
]),
|
|
527
|
-
_: 2
|
|
528
|
-
}, [
|
|
529
|
-
vue.renderList(Object.keys(tableSlots.value), (slotKey, index) => {
|
|
530
|
-
return {
|
|
531
|
-
name: slotKey,
|
|
532
|
-
fn: vue.withCtx((scope) => [
|
|
533
|
-
vue.renderSlot(_ctx.$slots, slotKey, vue.normalizeProps(vue.guardReactiveProps(scope)))
|
|
534
|
-
])
|
|
535
|
-
};
|
|
536
|
-
})
|
|
537
|
-
]), 1032, ["select", "onUpdate:select", "data", "size", "loading", "permission", "option", "height", "max-height"]),
|
|
538
|
-
vue.createCommentVNode(""),
|
|
539
|
-
vue.createCommentVNode("\u5206\u9875\u533A\u57DF"),
|
|
540
|
-
vue.unref(searchProxys).page && _ctx.total ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
541
|
-
key: 1,
|
|
542
|
-
class: "m-pagination-box"
|
|
543
|
-
}, [
|
|
544
|
-
vue.createVNode(_component_m_pagination, {
|
|
545
|
-
small: (_ctx.size || vue.unref(globalConfig).size) === "small",
|
|
546
|
-
total: _ctx.total,
|
|
547
|
-
"current-page": vue.unref(searchProxys).page,
|
|
548
|
-
"page-size": vue.unref(searchProxys).limit,
|
|
549
|
-
disabled: _ctx.loading,
|
|
550
|
-
onCurrentPage: currentPageChange,
|
|
551
|
-
onPageSize: pageSizeChange
|
|
552
|
-
}, null, 8, ["small", "total", "current-page", "page-size", "disabled"])
|
|
553
|
-
])) : vue.createCommentVNode("v-if", true),
|
|
554
|
-
vue.createCommentVNode("\u65B0\u589E/\u7F16\u8F91/\u67E5\u770B\u5BF9\u8BDD\u6846"),
|
|
555
|
-
vue.createVNode(_component_MDialog, {
|
|
556
|
-
modelValue: dialogVisible.value,
|
|
557
|
-
"onUpdate:modelValue": ($event) => dialogVisible.value = $event,
|
|
558
|
-
size: _ctx.size || vue.unref(globalConfig).size,
|
|
559
|
-
title: dialogTitle.value,
|
|
560
|
-
width: crudOption.value.dialogWidth,
|
|
561
|
-
"save-btn": dialogType.value !== "view",
|
|
562
|
-
"cancel-btn": dialogType.value !== "view",
|
|
563
|
-
"save-btn-text": vue.unref(t)("m.crud.dialogSaveBtnText"),
|
|
564
|
-
"cancel-btn-text": vue.unref(t)("m.crud.dialogCancelBtnText"),
|
|
565
|
-
"save-btn-icon": dialogType.value === "add" ? "CirclePlus" : "CircleCheck",
|
|
566
|
-
onEnter: dialogEnter,
|
|
567
|
-
onCancel: dialogCancel,
|
|
568
|
-
onClose: dialogClose
|
|
569
|
-
}, {
|
|
570
|
-
default: vue.withCtx(({ loading }) => [
|
|
571
|
-
vue.createCommentVNode("\u6240\u6709\u7C7B\u578B\u9876\u90E8"),
|
|
572
|
-
vue.renderSlot(_ctx.$slots, "allTop", vue.normalizeProps(vue.guardReactiveProps({ size: _ctx.size || vue.unref(globalConfig).size, loading }))),
|
|
573
|
-
vue.createCommentVNode(""),
|
|
574
|
-
vue.createCommentVNode("\u65B0\u589E/\u7F16\u8F91\u7C7B\u578B\u9876\u90E8"),
|
|
575
|
-
dialogType.value !== "view" ? vue.renderSlot(_ctx.$slots, "formTop", vue.normalizeProps(vue.mergeProps({ key: 0 }, { size: _ctx.size || vue.unref(globalConfig).size, loading }))) : vue.createCommentVNode("v-if", true),
|
|
576
|
-
vue.createCommentVNode(""),
|
|
577
|
-
vue.createCommentVNode("\u65B0\u589E\u7C7B\u578B\u9876\u90E8"),
|
|
578
|
-
dialogType.value === "add" ? vue.renderSlot(_ctx.$slots, "addTop", vue.normalizeProps(vue.mergeProps({ key: 1 }, { size: _ctx.size || vue.unref(globalConfig).size, loading }))) : vue.createCommentVNode("v-if", true),
|
|
579
|
-
vue.createCommentVNode(""),
|
|
580
|
-
vue.createCommentVNode("\u7F16\u8F91\u7C7B\u578B\u9876\u90E8"),
|
|
581
|
-
dialogType.value === "edit" ? vue.renderSlot(_ctx.$slots, "editTop", vue.normalizeProps(vue.mergeProps({ key: 2 }, { size: _ctx.size || vue.unref(globalConfig).size, loading }))) : vue.createCommentVNode("v-if", true),
|
|
582
|
-
vue.createCommentVNode(""),
|
|
583
|
-
vue.createCommentVNode("\u67E5\u770B\u7C7B\u578B\u9876\u90E8"),
|
|
584
|
-
dialogType.value === "view" ? vue.renderSlot(_ctx.$slots, "viewTop", vue.normalizeProps(vue.mergeProps({ key: 3 }, { size: _ctx.size || vue.unref(globalConfig).size, loading }))) : vue.createCommentVNode("v-if", true),
|
|
585
|
-
vue.createCommentVNode(""),
|
|
586
|
-
vue.createVNode(_component_MForm, {
|
|
587
|
-
ref_key: "formRef",
|
|
588
|
-
ref: formRef,
|
|
589
|
-
loading,
|
|
590
|
-
size: _ctx.size || vue.unref(globalConfig).size,
|
|
591
|
-
option: formOption.value,
|
|
592
|
-
model: modelForm.value,
|
|
593
|
-
readonly: dialogType.value === "view"
|
|
594
|
-
}, vue.createSlots({
|
|
595
|
-
_: 2
|
|
596
|
-
}, [
|
|
597
|
-
vue.renderList(Object.keys(formSlots.value), (slotKey, index) => {
|
|
598
|
-
return {
|
|
599
|
-
name: slotKey,
|
|
600
|
-
fn: vue.withCtx((scope) => [
|
|
601
|
-
vue.renderSlot(_ctx.$slots, slotKey + "Form", vue.normalizeProps(vue.guardReactiveProps(scope)))
|
|
602
|
-
])
|
|
603
|
-
};
|
|
604
|
-
})
|
|
605
|
-
]), 1032, ["loading", "size", "option", "model", "readonly"]),
|
|
606
|
-
vue.createCommentVNode("\u6240\u6709\u7C7B\u578B\u5E95\u90E8"),
|
|
607
|
-
vue.renderSlot(_ctx.$slots, "allBottom", vue.normalizeProps(vue.guardReactiveProps({ size: _ctx.size || vue.unref(globalConfig).size, loading }))),
|
|
608
|
-
vue.createCommentVNode(""),
|
|
609
|
-
vue.createCommentVNode("\u65B0\u589E/\u7F16\u8F91\u7C7B\u578B\u5E95\u90E8"),
|
|
610
|
-
dialogType.value !== "view" ? vue.renderSlot(_ctx.$slots, "formBottom", vue.normalizeProps(vue.mergeProps({ key: 4 }, { size: _ctx.size || vue.unref(globalConfig).size, loading }))) : vue.createCommentVNode("v-if", true),
|
|
611
|
-
vue.createCommentVNode(""),
|
|
612
|
-
vue.createCommentVNode("\u65B0\u589E\u7C7B\u578B\u5E95\u90E8"),
|
|
613
|
-
dialogType.value === "add" ? vue.renderSlot(_ctx.$slots, "addBottom", vue.normalizeProps(vue.mergeProps({ key: 5 }, { size: _ctx.size || vue.unref(globalConfig).size, loading }))) : vue.createCommentVNode("v-if", true),
|
|
614
|
-
vue.createCommentVNode(""),
|
|
615
|
-
vue.createCommentVNode("\u7F16\u8F91\u7C7B\u578B\u5E95\u90E8"),
|
|
616
|
-
dialogType.value === "edit" ? vue.renderSlot(_ctx.$slots, "editBottom", vue.normalizeProps(vue.mergeProps({ key: 6 }, { size: _ctx.size || vue.unref(globalConfig).size, loading }))) : vue.createCommentVNode("v-if", true),
|
|
617
|
-
vue.createCommentVNode(""),
|
|
618
|
-
vue.createCommentVNode("\u67E5\u770B\u7C7B\u578B\u5E95\u90E8"),
|
|
619
|
-
dialogType.value === "view" ? vue.renderSlot(_ctx.$slots, "viewBottom", vue.normalizeProps(vue.mergeProps({ key: 7 }, { size: _ctx.size || vue.unref(globalConfig).size, loading }))) : vue.createCommentVNode("v-if", true),
|
|
620
|
-
vue.createCommentVNode("")
|
|
621
|
-
]),
|
|
622
|
-
_: 3
|
|
623
|
-
}, 8, ["modelValue", "onUpdate:modelValue", "size", "title", "width", "save-btn", "cancel-btn", "save-btn-text", "cancel-btn-text", "save-btn-icon"]),
|
|
624
|
-
vue.createCommentVNode("")
|
|
625
|
-
]);
|
|
626
|
-
};
|
|
37
|
+
delBtn: true
|
|
38
|
+
})
|
|
39
|
+
},
|
|
40
|
+
select: {
|
|
41
|
+
type: Array,
|
|
42
|
+
default: () => []
|
|
43
|
+
},
|
|
44
|
+
beforeEnter: {
|
|
45
|
+
type: Function
|
|
46
|
+
},
|
|
47
|
+
option: {
|
|
48
|
+
type: runtime.definePropType(Object),
|
|
49
|
+
required: false
|
|
627
50
|
}
|
|
628
51
|
});
|
|
629
|
-
|
|
52
|
+
const crudEmits = {
|
|
53
|
+
"update:select": (arr) => shared.isArray(arr),
|
|
54
|
+
"update:modelValue": (value) => shared.isObject(value),
|
|
55
|
+
search: (form) => shared.isObject(form),
|
|
56
|
+
reset: () => true,
|
|
57
|
+
rowSave: (form, done, loading) => shared.isObject(form) && shared.isFunction(done) && shared.isFunction(loading),
|
|
58
|
+
rowEdit: (form, done, loading) => shared.isObject(form) && shared.isFunction(done) && shared.isFunction(loading),
|
|
59
|
+
rowCancel: (form, index, type) => shared.isObject(form) && types.isNumber(index) && shared.isString(type),
|
|
60
|
+
rowDel: (row, index) => shared.isObject(row) && types.isNumber(index)
|
|
61
|
+
};
|
|
630
62
|
|
|
631
|
-
exports
|
|
63
|
+
exports.crudEmits = crudEmits;
|
|
64
|
+
exports.crudProps = crudProps;
|
|
632
65
|
//# sourceMappingURL=crud.js.map
|