v-nuxt-ui 0.2.34 → 0.3.0
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/module.json +1 -1
- package/dist/runtime/components/AsyncSelect.vue +13 -2
- package/dist/runtime/components/ScrollArea.vue +2 -2
- package/dist/runtime/components/Select.vue +13 -2
- package/dist/runtime/components/Watermark.d.vue.ts +2 -2
- package/dist/runtime/components/Watermark.vue.d.ts +2 -2
- package/dist/runtime/components/button/Confirm.d.vue.ts +22 -0
- package/dist/runtime/components/button/Confirm.vue +47 -0
- package/dist/runtime/components/button/Confirm.vue.d.ts +22 -0
- package/dist/runtime/components/button/Theme.vue +7 -13
- package/dist/runtime/components/date-picker/Input.d.vue.ts +1 -0
- package/dist/runtime/components/date-picker/Input.vue +12 -3
- package/dist/runtime/components/date-picker/Input.vue.d.ts +1 -0
- package/dist/runtime/components/form/save-modal-template/WithApi.vue +1 -2
- package/dist/runtime/components/form/save-modal-template/index.vue +23 -23
- package/dist/runtime/components/layout/button/ThemePicker.vue +2 -2
- package/dist/runtime/components/layout/default.vue +10 -4
- package/dist/runtime/components/simple-table/index.d.vue.ts +1 -1
- package/dist/runtime/components/simple-table/index.vue +72 -1
- package/dist/runtime/components/simple-table/index.vue.d.ts +1 -1
- package/dist/runtime/components/sys/department/SaveModal.vue +0 -1
- package/dist/runtime/components/sys/flow/EditNodeModal.vue +5 -4
- package/dist/runtime/components/sys/flow/SaveModal.vue +0 -1
- package/dist/runtime/components/sys/menu/SaveModal.vue +0 -1
- package/dist/runtime/components/sys/role/SaveModal.vue +0 -1
- package/dist/runtime/components/sys/table/SaveModal.vue +0 -1
- package/dist/runtime/components/sys/table/TableColumnModal.vue +5 -4
- package/dist/runtime/components/sys/user/SaveModal.vue +0 -1
- package/dist/runtime/components/sys/user/Table.vue +19 -29
- package/dist/runtime/components/table/Page.vue +23 -2
- package/dist/runtime/components/table/Pagination.vue +1 -1
- package/dist/runtime/components/table/header/index.vue +231 -84
- package/dist/runtime/components/table/header/settings/columns/DndList.d.vue.ts +1 -0
- package/dist/runtime/components/table/header/settings/columns/DndList.vue +3 -1
- package/dist/runtime/components/table/header/settings/columns/DndList.vue.d.ts +1 -0
- package/dist/runtime/components/table/header/settings/columns/Item.d.vue.ts +1 -0
- package/dist/runtime/components/table/header/settings/columns/Item.vue +7 -3
- package/dist/runtime/components/table/header/settings/columns/Item.vue.d.ts +1 -0
- package/dist/runtime/components/table/header/settings/columns/index.d.vue.ts +3 -3
- package/dist/runtime/components/table/header/settings/columns/index.vue +7 -5
- package/dist/runtime/components/table/header/settings/columns/index.vue.d.ts +3 -3
- package/dist/runtime/components/table/header/settings/index.d.vue.ts +3 -2
- package/dist/runtime/components/table/header/settings/index.vue +5 -4
- package/dist/runtime/components/table/header/settings/index.vue.d.ts +3 -2
- package/dist/runtime/components/table/query/order/Newer.d.vue.ts +1 -0
- package/dist/runtime/components/table/query/order/Newer.vue +9 -2
- package/dist/runtime/components/table/query/order/Newer.vue.d.ts +1 -0
- package/dist/runtime/components/table/query/order/index.vue +46 -54
- package/dist/runtime/components/table/query/order/{Item.d.vue.ts → item.d.vue.ts} +2 -0
- package/dist/runtime/components/table/query/order/{Item.vue → item.vue} +25 -17
- package/dist/runtime/components/table/query/order/{Item.vue.d.ts → item.vue.d.ts} +2 -0
- package/dist/runtime/components/table/query/where/Newer.vue +2 -2
- package/dist/runtime/components/table/query/where/index.vue +90 -77
- package/dist/runtime/components/table/query/where/simple/item/ColumnPicker.vue +8 -7
- package/dist/runtime/components/table/query/where/simple/item/OprPicker.d.vue.ts +1 -0
- package/dist/runtime/components/table/query/where/simple/item/OprPicker.vue +6 -1
- package/dist/runtime/components/table/query/where/simple/item/OprPicker.vue.d.ts +1 -0
- package/dist/runtime/components/table/query/where/simple/item/index.d.vue.ts +3 -1
- package/dist/runtime/components/table/query/where/simple/item/index.vue +84 -39
- package/dist/runtime/components/table/query/where/simple/item/index.vue.d.ts +3 -1
- package/dist/runtime/components/table/query/where/simple/item/opr/AsyncSelect.vue +0 -1
- package/dist/runtime/components/table/query/where/simple/item/opr/DatePicker.d.vue.ts +1 -0
- package/dist/runtime/components/table/query/where/simple/item/opr/DatePicker.vue +42 -40
- package/dist/runtime/components/table/query/where/simple/item/opr/DatePicker.vue.d.ts +1 -0
- package/dist/runtime/components/table/query/where/simple/item/opr/Input.vue +3 -0
- package/dist/runtime/components/table/query/where/simple/item/opr/Select.vue +0 -1
- package/dist/runtime/components/table/query/where/simple/item/opr/index.vue +3 -0
- package/dist/runtime/composables/api/useApi.js +1 -0
- package/dist/runtime/composables/form/useForm.d.ts +2 -2
- package/dist/runtime/composables/form/useForm.js +10 -9
- package/dist/runtime/composables/table/useTable.js +9 -1
- package/dist/runtime/composables/table/useTableColumns.d.ts +1 -1
- package/dist/runtime/composables/table/useTableColumns.js +2 -2
- package/dist/runtime/composables/table/useTableQuery.d.ts +1 -0
- package/dist/runtime/composables/table/useTableQuery.js +8 -3
- package/dist/runtime/composables/table/useTableView.js +209 -11
- package/dist/runtime/composables/useTheme.js +10 -3
- package/dist/runtime/constants/columns.js +6 -6
- package/dist/runtime/types/components/form/index.d.ts +1 -1
- package/dist/runtime/types/components/table/column.d.ts +3 -1
- package/dist/runtime/types/components/table/header.d.ts +3 -1
- package/dist/runtime/types/components/table/query/order.d.ts +2 -0
- package/dist/runtime/types/components/table/query/where.d.ts +0 -1
- package/dist/runtime/types/query.d.ts +1 -0
- package/dist/runtime/types/storage.d.ts +1 -0
- package/package.json +1 -1
- package/dist/runtime/components/form/save-model-template/ConfirmUpdateModal.d.vue.ts +0 -19
- package/dist/runtime/components/form/save-model-template/ConfirmUpdateModal.vue +0 -111
- package/dist/runtime/components/form/save-model-template/ConfirmUpdateModal.vue.d.ts +0 -19
- package/dist/runtime/components/form/save-model-template/WithApi.d.vue.ts +0 -19
- package/dist/runtime/components/form/save-model-template/WithApi.vue +0 -37
- package/dist/runtime/components/form/save-model-template/WithApi.vue.d.ts +0 -19
- package/dist/runtime/components/form/save-model-template/index.d.vue.ts +0 -21
- package/dist/runtime/components/form/save-model-template/index.vue +0 -123
- package/dist/runtime/components/form/save-model-template/index.vue.d.ts +0 -21
|
@@ -22,6 +22,10 @@ const fields = computed(() => [
|
|
|
22
22
|
{ name: "fixed", type: "select", label: "\u56FA\u5B9A", colSpan: "8", items: fixedItems, enableEmptyOption: false, zodType: z.string().optional() },
|
|
23
23
|
{ name: "visible", type: "switch", label: "\u662F\u5426\u663E\u793A", colSpan: "24", zodType: z.boolean().optional() }
|
|
24
24
|
]);
|
|
25
|
+
async function onSubmit() {
|
|
26
|
+
props.onSaveColumn(newValues.value);
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
25
29
|
</script>
|
|
26
30
|
|
|
27
31
|
<template>
|
|
@@ -32,9 +36,6 @@ const fields = computed(() => [
|
|
|
32
36
|
:model-value="newValues"
|
|
33
37
|
:old-model-value="oldValues"
|
|
34
38
|
@update-model-value="(newVal) => newValues = { id: 0, ...newVal }"
|
|
35
|
-
@submit="
|
|
36
|
-
props.onSaveColumn(newValues);
|
|
37
|
-
emit('close', true);
|
|
38
|
-
}"
|
|
39
|
+
@submit="onSubmit"
|
|
39
40
|
/>
|
|
40
41
|
</template>
|
|
@@ -14,7 +14,6 @@ const { oldValues, newValues } = useFormValues(toRef(props.model), { id: 0, need
|
|
|
14
14
|
const { onSubmit } = useFormSubmission(
|
|
15
15
|
toRef(oldValues),
|
|
16
16
|
toRef(newValues),
|
|
17
|
-
(close) => emit("close", close),
|
|
18
17
|
(model) => emit("save", model),
|
|
19
18
|
useUserApi,
|
|
20
19
|
["roles", "menus"],
|
|
@@ -3,7 +3,7 @@ import dayjs from "dayjs";
|
|
|
3
3
|
import { useOverlay } from "@nuxt/ui/composables";
|
|
4
4
|
import { isEmptyString } from "#v/utils";
|
|
5
5
|
import { useDepartmentApi, useRoleApi, useUserApi } from "#v/composables";
|
|
6
|
-
import { booleanOptions, dateFormat, genderOptions
|
|
6
|
+
import { booleanOptions, dateFormat, genderOptions } from "#v/constants";
|
|
7
7
|
import SysUsersSaveModal from "./SaveModal.vue";
|
|
8
8
|
import UBadge from "@nuxt/ui/components/Badge.vue";
|
|
9
9
|
import TablePage from "#v/components/table/Page.vue";
|
|
@@ -54,9 +54,9 @@ const columns = [
|
|
|
54
54
|
header: "\u76F4\u5C5E\u4E0A\u7EA7",
|
|
55
55
|
sortOption: true,
|
|
56
56
|
cell: ({ row }) => row.original.supervisor?.nickname,
|
|
57
|
-
preferred: false,
|
|
58
57
|
filterOption: {
|
|
59
58
|
type: "async-select",
|
|
59
|
+
preferred: false,
|
|
60
60
|
listApi: useUserApi().list,
|
|
61
61
|
likeSearchFields: ["nickname"],
|
|
62
62
|
labelField: "nickname",
|
|
@@ -68,10 +68,11 @@ const columns = [
|
|
|
68
68
|
{
|
|
69
69
|
accessorKey: "roles",
|
|
70
70
|
header: "\u6743\u9650\u89D2\u8272",
|
|
71
|
-
preferred: false,
|
|
72
71
|
cell: ({ row }) => row.original.roles?.map((role) => role.name).join(", "),
|
|
73
72
|
filterOption: {
|
|
74
73
|
type: "async-select",
|
|
74
|
+
preferred: false,
|
|
75
|
+
initHide: true,
|
|
75
76
|
listApi: useRoleApi().list,
|
|
76
77
|
likeSearchFields: ["name"],
|
|
77
78
|
labelField: "name",
|
|
@@ -95,11 +96,6 @@ const columns = [
|
|
|
95
96
|
{
|
|
96
97
|
accessorKey: "loginType",
|
|
97
98
|
header: "\u767B\u5F55\u65B9\u5F0F",
|
|
98
|
-
filterOption: {
|
|
99
|
-
type: "select",
|
|
100
|
-
items: loginTypeOptions
|
|
101
|
-
},
|
|
102
|
-
preferred: false,
|
|
103
99
|
meta: {
|
|
104
100
|
class: {
|
|
105
101
|
td: "min-w-24"
|
|
@@ -110,23 +106,13 @@ const columns = [
|
|
|
110
106
|
accessorKey: "email",
|
|
111
107
|
header: "\u90AE\u7BB1",
|
|
112
108
|
filterOption: {
|
|
113
|
-
type: "input"
|
|
109
|
+
type: "input",
|
|
110
|
+
initHide: true
|
|
114
111
|
}
|
|
115
112
|
},
|
|
116
113
|
{
|
|
117
114
|
accessorKey: "needFillWh",
|
|
118
|
-
header: "\
|
|
119
|
-
preferred: false,
|
|
120
|
-
filterOption: {
|
|
121
|
-
type: "select",
|
|
122
|
-
items: booleanOptions,
|
|
123
|
-
multiple: true,
|
|
124
|
-
empty: {
|
|
125
|
-
label: "\u5426",
|
|
126
|
-
variant: "outline",
|
|
127
|
-
color: "neutral"
|
|
128
|
-
}
|
|
129
|
-
}
|
|
115
|
+
header: "\u5DE5\u65F6\u586B\u62A5"
|
|
130
116
|
},
|
|
131
117
|
{
|
|
132
118
|
accessorKey: "gender",
|
|
@@ -151,18 +137,20 @@ const columns = [
|
|
|
151
137
|
accessorKey: "entryDate",
|
|
152
138
|
header: "\u5165\u804C\u65F6\u95F4",
|
|
153
139
|
sortOption: true,
|
|
154
|
-
preferred: false,
|
|
155
140
|
filterOption: {
|
|
156
|
-
type: "date-picker"
|
|
141
|
+
type: "date-picker",
|
|
142
|
+
preferred: false,
|
|
143
|
+
initHide: true
|
|
157
144
|
},
|
|
158
145
|
cell: ({ row }) => dayjs(row.getValue("entryDate")).format(dateFormat)
|
|
159
146
|
},
|
|
160
147
|
{
|
|
161
148
|
accessorKey: "resignDate",
|
|
162
149
|
header: "\u79BB\u804C\u65F6\u95F4",
|
|
163
|
-
preferred: false,
|
|
164
150
|
filterOption: {
|
|
165
|
-
type: "date-picker"
|
|
151
|
+
type: "date-picker",
|
|
152
|
+
preferred: false,
|
|
153
|
+
initHide: true
|
|
166
154
|
},
|
|
167
155
|
sortOption: true,
|
|
168
156
|
cell: ({ row }) => dayjs(row.getValue("resignDate")).format(dateFormat)
|
|
@@ -171,7 +159,8 @@ const columns = [
|
|
|
171
159
|
accessorKey: "telNo",
|
|
172
160
|
header: "\u7535\u8BDD",
|
|
173
161
|
filterOption: {
|
|
174
|
-
type: "input"
|
|
162
|
+
type: "input",
|
|
163
|
+
initHide: true
|
|
175
164
|
},
|
|
176
165
|
meta: {
|
|
177
166
|
class: {
|
|
@@ -181,12 +170,13 @@ const columns = [
|
|
|
181
170
|
},
|
|
182
171
|
{
|
|
183
172
|
accessorKey: "isAdmin",
|
|
184
|
-
header: "\
|
|
173
|
+
header: "\u7CFB\u7EDF\u7BA1\u7406\u5458",
|
|
185
174
|
sortOption: true,
|
|
186
|
-
preferred: false,
|
|
187
175
|
filterOption: {
|
|
188
176
|
type: "select",
|
|
189
|
-
items: booleanOptions
|
|
177
|
+
items: booleanOptions,
|
|
178
|
+
preferred: false,
|
|
179
|
+
initHide: true
|
|
190
180
|
}
|
|
191
181
|
}
|
|
192
182
|
];
|
|
@@ -4,6 +4,7 @@ import { useProTableView } from "#v/composables/table/useTableView";
|
|
|
4
4
|
import USlideover from "@nuxt/ui/components/Slideover.vue";
|
|
5
5
|
import TableHeader from "#v/components/table/header/index.vue";
|
|
6
6
|
import TableQueryWhere from "#v/components/table/query/where/index.vue";
|
|
7
|
+
import TableQueryOrder from "#v/components/table/query/order/index.vue";
|
|
7
8
|
import TablePagination from "#v/components/table/Pagination.vue";
|
|
8
9
|
import ScrollArea from "#v/components/ScrollArea.vue";
|
|
9
10
|
import LayoutButtonCollapse from "#v/components/layout/button/Collapse.vue";
|
|
@@ -129,16 +130,16 @@ defineExpose({ createRow, updateRow, deleteRow, refresh: fetchList, stats, data
|
|
|
129
130
|
<USlideover
|
|
130
131
|
:open="tblHeaderProps.whereQueryProps.whereQueryOpen"
|
|
131
132
|
side="top"
|
|
133
|
+
inset
|
|
132
134
|
:close="false"
|
|
133
135
|
:portal="`#${tablePortalId}`"
|
|
134
136
|
:ui="{
|
|
135
137
|
content: '!absolute z-2',
|
|
136
|
-
body: 'p-0 sm:p-0',
|
|
137
138
|
overlay: 'z-1'
|
|
138
139
|
}"
|
|
139
140
|
@update:open="tblHeaderProps.whereQueryProps.onUpdateWhereQueryOpen"
|
|
140
141
|
>
|
|
141
|
-
<template #
|
|
142
|
+
<template #content>
|
|
142
143
|
<TableQueryWhere
|
|
143
144
|
ref="proTableQueryWhere"
|
|
144
145
|
v-bind="tblWhereQueryProps"
|
|
@@ -149,5 +150,25 @@ defineExpose({ createRow, updateRow, deleteRow, refresh: fetchList, stats, data
|
|
|
149
150
|
/>
|
|
150
151
|
</template>
|
|
151
152
|
</USlideover>
|
|
153
|
+
|
|
154
|
+
<!-- query order (drawer from right) -->
|
|
155
|
+
<USlideover
|
|
156
|
+
:open="tblHeaderProps.orderQueryProps.orderQueryOpen"
|
|
157
|
+
side="top"
|
|
158
|
+
inset
|
|
159
|
+
:portal="`#${tablePortalId}`"
|
|
160
|
+
:ui="{
|
|
161
|
+
content: '!absolute z-2 h-fit w-fit ml-auto',
|
|
162
|
+
overlay: 'z-1'
|
|
163
|
+
}"
|
|
164
|
+
@update:open="tblHeaderProps.orderQueryProps.onUpdateOrderQueryOpen"
|
|
165
|
+
>
|
|
166
|
+
<template #content>
|
|
167
|
+
<TableQueryOrder
|
|
168
|
+
v-bind="tblHeaderProps.orderQueryProps"
|
|
169
|
+
:trigger-fetching="tblHeaderProps.orderQueryProps.triggerFetching"
|
|
170
|
+
/>
|
|
171
|
+
</template>
|
|
172
|
+
</USlideover>
|
|
152
173
|
</div>
|
|
153
174
|
</template>
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { markRaw } from "vue";
|
|
2
|
+
import { markRaw, computed } from "vue";
|
|
3
3
|
import { defu } from "defu";
|
|
4
|
+
import { compareObjArrays } from "#v/utils";
|
|
4
5
|
import { useOverlay } from "@nuxt/ui/composables";
|
|
5
6
|
import UButton from "@nuxt/ui/components/Button.vue";
|
|
6
7
|
import UChip from "@nuxt/ui/components/Chip.vue";
|
|
7
8
|
import UKbd from "@nuxt/ui/components/Kbd.vue";
|
|
9
|
+
import UDropdownMenu from "@nuxt/ui/components/DropdownMenu.vue";
|
|
10
|
+
import UFieldGroup from "@nuxt/ui/components/FieldGroup.vue";
|
|
8
11
|
import PermissionWrapper from "#v/components/PermissionWrapper.vue";
|
|
9
|
-
import TableQueryOrder from "#v/components/table/query/order/index.vue";
|
|
10
12
|
import DeleteModal from "#v/components/DeleteModal.vue";
|
|
11
13
|
import TableHeaderSettings from "#v/components/table/header/settings/index.vue";
|
|
12
14
|
import TableExcelExportModal from "#v/components/table/ExcelExportModal.vue";
|
|
15
|
+
import { useApp } from "#v/composables";
|
|
13
16
|
const props = defineProps({
|
|
14
17
|
name: { type: String, required: true },
|
|
18
|
+
tblName: { type: String, required: false },
|
|
15
19
|
fetching: { type: Boolean, required: false },
|
|
16
20
|
rawBizColumns: { type: Array, required: true },
|
|
17
21
|
onUpdateBizColumns: { type: Function, required: false },
|
|
@@ -38,6 +42,8 @@ const props = defineProps({
|
|
|
38
42
|
extraButtons: { type: Array, required: false },
|
|
39
43
|
size: { type: null, required: false, default: "md" }
|
|
40
44
|
});
|
|
45
|
+
const app = useApp();
|
|
46
|
+
const isMobile = app.isMobile;
|
|
41
47
|
const defaultNewRow = { id: 0 };
|
|
42
48
|
const overlay = useOverlay();
|
|
43
49
|
const deleteModal = markRaw(overlay.create(DeleteModal));
|
|
@@ -57,9 +63,10 @@ async function handleSettings() {
|
|
|
57
63
|
if (!props.onUpdateBizColumns) return;
|
|
58
64
|
const updateFn = props.onUpdateBizColumns;
|
|
59
65
|
await settingsModal.open({
|
|
60
|
-
|
|
66
|
+
name: props.name,
|
|
67
|
+
tblName: props.tblName ?? props.name,
|
|
61
68
|
rawBizColumns: props.rawBizColumns,
|
|
62
|
-
onUpdateBizColumns: ((cols) => updateFn(cols))
|
|
69
|
+
onUpdateBizColumns: ((cols, storageColumns) => updateFn(cols, storageColumns))
|
|
63
70
|
});
|
|
64
71
|
}
|
|
65
72
|
async function handleExportExcel() {
|
|
@@ -107,77 +114,227 @@ async function onRightExtraButtonClick(btn, e) {
|
|
|
107
114
|
originalOnClick?.(e);
|
|
108
115
|
}
|
|
109
116
|
}
|
|
117
|
+
const headerActions = computed(() => {
|
|
118
|
+
const actions = [];
|
|
119
|
+
props.extraButtons?.forEach((btn) => {
|
|
120
|
+
const visible = (!btn.withBatchData || !!props.selectedIds?.length) && btn.appendTo === "left";
|
|
121
|
+
if (visible) {
|
|
122
|
+
actions.push({
|
|
123
|
+
key: `extra-left-${btn.button.label}`,
|
|
124
|
+
label: btn.button.label ?? "",
|
|
125
|
+
icon: btn.button.icon,
|
|
126
|
+
visible,
|
|
127
|
+
onSelect: () => onLeftExtraButtonClick(btn, new MouseEvent("click"))
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
for (const opr of props.oprOrder) {
|
|
132
|
+
if (opr === "create") {
|
|
133
|
+
actions.push({
|
|
134
|
+
key: "create",
|
|
135
|
+
label: "\u65B0\u589E",
|
|
136
|
+
icon: "i-lucide-plus",
|
|
137
|
+
visible: !props.disableCreation,
|
|
138
|
+
onSelect: () => handleCreate()
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
if (opr === "refresh") {
|
|
142
|
+
actions.push({
|
|
143
|
+
key: "refresh",
|
|
144
|
+
label: "\u5237\u65B0",
|
|
145
|
+
icon: "i-lucide-refresh-ccw",
|
|
146
|
+
visible: true,
|
|
147
|
+
onSelect: () => props.fetchList()
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
if (opr === "whereQuery") {
|
|
151
|
+
actions.push({
|
|
152
|
+
key: "whereQuery",
|
|
153
|
+
label: "\u67E5\u8BE2",
|
|
154
|
+
icon: "i-lucide-list-filter",
|
|
155
|
+
visible: !props.disableWhereQuery,
|
|
156
|
+
onSelect: () => props.whereQueryProps.onUpdateWhereQueryOpen?.(!props.whereQueryProps.whereQueryOpen)
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
if (opr === "orderQuery") {
|
|
160
|
+
actions.push({
|
|
161
|
+
key: "orderQuery",
|
|
162
|
+
label: "\u6392\u5E8F",
|
|
163
|
+
icon: "i-lucide-arrow-up-down",
|
|
164
|
+
visible: !props.disableOrderQuery,
|
|
165
|
+
onSelect: () => {
|
|
166
|
+
props.orderQueryProps.onUpdateOrderQueryOpen?.(true);
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
if (opr === "settings") {
|
|
171
|
+
actions.push({
|
|
172
|
+
key: "settings",
|
|
173
|
+
label: "\u8BBE\u7F6E",
|
|
174
|
+
icon: "i-lucide-settings",
|
|
175
|
+
visible: !props.disableSettings && !!props.rawBizColumns?.length && !!props.onUpdateBizColumns,
|
|
176
|
+
onSelect: () => handleSettings()
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
if (opr === "exportExcel") {
|
|
180
|
+
actions.push({
|
|
181
|
+
key: "exportExcel",
|
|
182
|
+
label: "\u5BFC\u51FA",
|
|
183
|
+
icon: "i-lucide-sheet",
|
|
184
|
+
visible: !!props.exportExcel,
|
|
185
|
+
onSelect: () => handleExportExcel()
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
if (opr === "batchDelete") {
|
|
189
|
+
actions.push({
|
|
190
|
+
key: "batchDelete",
|
|
191
|
+
label: "\u6279\u91CF\u5220\u9664",
|
|
192
|
+
icon: "i-lucide-trash-2",
|
|
193
|
+
color: "error",
|
|
194
|
+
visible: !props.disableBatchDeletion && !!props.selectedIds?.length,
|
|
195
|
+
onSelect: () => handleBatchDelete()
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
props.extraButtons?.forEach((btn) => {
|
|
200
|
+
const visible = (!btn.withBatchData || !!props.selectedIds?.length) && btn.appendTo === "right";
|
|
201
|
+
if (visible) {
|
|
202
|
+
actions.push({
|
|
203
|
+
key: `extra-right-${btn.button.label}`,
|
|
204
|
+
label: btn.button.label ?? "",
|
|
205
|
+
icon: btn.button.icon,
|
|
206
|
+
visible,
|
|
207
|
+
onSelect: () => onRightExtraButtonClick(btn, new MouseEvent("click"))
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
return actions.filter((a) => a.visible);
|
|
212
|
+
});
|
|
213
|
+
const mobileMoreItems = computed(
|
|
214
|
+
() => headerActions.value.filter((a) => a.key !== "create").map((a) => ({
|
|
215
|
+
label: a.label,
|
|
216
|
+
icon: a.icon,
|
|
217
|
+
color: a.color,
|
|
218
|
+
onSelect: a.onSelect
|
|
219
|
+
}))
|
|
220
|
+
);
|
|
110
221
|
</script>
|
|
111
222
|
|
|
112
223
|
<template>
|
|
113
|
-
|
|
114
|
-
|
|
224
|
+
<!-- 移动端:新增 + 更多操作下拉 -->
|
|
225
|
+
<div v-if="isMobile" class="flex flex-wrap items-center gap-3">
|
|
226
|
+
<UFieldGroup>
|
|
115
227
|
<UButton
|
|
116
|
-
v-if="
|
|
117
|
-
v-bind="omitOnClick(btn.button)"
|
|
118
|
-
@click="(e) => onLeftExtraButtonClick(btn, e)"
|
|
119
|
-
/>
|
|
120
|
-
</template>
|
|
121
|
-
|
|
122
|
-
<template v-for="opr in oprOrder" :key="opr">
|
|
123
|
-
<UButton
|
|
124
|
-
v-if="opr === 'create' && !disableCreation"
|
|
228
|
+
v-if="!disableCreation"
|
|
125
229
|
icon="i-lucide-plus"
|
|
126
230
|
:size="size"
|
|
231
|
+
variant="subtle"
|
|
127
232
|
@click="handleCreate"
|
|
128
233
|
>
|
|
129
234
|
新增
|
|
130
235
|
</UButton>
|
|
236
|
+
<UDropdownMenu v-if="mobileMoreItems.length" :items="mobileMoreItems">
|
|
237
|
+
<UButton
|
|
238
|
+
icon="i-lucide-ellipsis"
|
|
239
|
+
:size="size"
|
|
240
|
+
color="neutral"
|
|
241
|
+
variant="outline"
|
|
242
|
+
:loading="fetching"
|
|
243
|
+
/>
|
|
244
|
+
</UDropdownMenu>
|
|
245
|
+
</UFieldGroup>
|
|
246
|
+
</div>
|
|
247
|
+
<template v-else>
|
|
248
|
+
<div class="flex flex-wrap items-center gap-3">
|
|
249
|
+
<template v-for="(btn, i) in extraButtons" :key="`extra-left-${i}`">
|
|
250
|
+
<UButton
|
|
251
|
+
v-if="(!btn.withBatchData || selectedIds?.length) && btn.appendTo === 'left'"
|
|
252
|
+
v-bind="omitOnClick(btn.button)"
|
|
253
|
+
@click="(e) => onLeftExtraButtonClick(btn, e)"
|
|
254
|
+
/>
|
|
255
|
+
</template>
|
|
131
256
|
|
|
132
|
-
<
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
</UButton>
|
|
257
|
+
<template v-for="opr in oprOrder" :key="opr">
|
|
258
|
+
<UButton
|
|
259
|
+
v-if="opr === 'create' && !disableCreation"
|
|
260
|
+
icon="i-lucide-plus"
|
|
261
|
+
:size="size"
|
|
262
|
+
variant="subtle"
|
|
263
|
+
@click="handleCreate"
|
|
264
|
+
>
|
|
265
|
+
新增
|
|
266
|
+
</UButton>
|
|
143
267
|
|
|
144
|
-
<!-- whereQuery: toggle panel -->
|
|
145
|
-
<UChip
|
|
146
|
-
v-if="opr === 'whereQuery' && !disableWhereQuery"
|
|
147
|
-
:show="!whereQueryProps.isWhereQueryValueEmpty"
|
|
148
|
-
>
|
|
149
268
|
<UButton
|
|
150
|
-
|
|
269
|
+
v-if="opr === 'refresh'"
|
|
270
|
+
icon="i-lucide-refresh-ccw"
|
|
151
271
|
:size="size"
|
|
152
|
-
|
|
272
|
+
color="neutral"
|
|
153
273
|
:loading="fetching"
|
|
154
274
|
variant="outline"
|
|
155
|
-
@click="
|
|
275
|
+
@click="fetchList"
|
|
156
276
|
>
|
|
157
|
-
|
|
277
|
+
刷新
|
|
158
278
|
</UButton>
|
|
159
|
-
</UChip>
|
|
160
279
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
280
|
+
<!-- whereQuery: toggle panel -->
|
|
281
|
+
<UChip
|
|
282
|
+
v-if="opr === 'whereQuery' && !disableWhereQuery"
|
|
283
|
+
:show="!whereQueryProps.isWhereQueryValueEmpty"
|
|
284
|
+
>
|
|
285
|
+
<UButton
|
|
286
|
+
icon="i-lucide-list-filter"
|
|
287
|
+
:size="size"
|
|
288
|
+
:color="whereQueryProps.whereQueryOpen ? 'primary' : 'neutral'"
|
|
289
|
+
:loading="fetching"
|
|
290
|
+
variant="outline"
|
|
291
|
+
@click="whereQueryProps.onUpdateWhereQueryOpen?.(!whereQueryProps.whereQueryOpen)"
|
|
292
|
+
>
|
|
293
|
+
查询
|
|
294
|
+
</UButton>
|
|
295
|
+
</UChip>
|
|
166
296
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
297
|
+
<UChip
|
|
298
|
+
v-if="opr === 'orderQuery' && !disableOrderQuery"
|
|
299
|
+
:show="!compareObjArrays(orderQueryProps.orderQuery, orderQueryProps.defaultOrderQuery)"
|
|
300
|
+
>
|
|
301
|
+
<UButton
|
|
302
|
+
icon="i-lucide-arrow-up-down"
|
|
303
|
+
:size="size"
|
|
304
|
+
:color="orderQueryProps.orderQueryOpen ? 'primary' : 'neutral'"
|
|
305
|
+
:loading="fetching"
|
|
306
|
+
variant="outline"
|
|
307
|
+
@click="orderQueryProps.onUpdateOrderQueryOpen?.(!orderQueryProps.orderQueryOpen)"
|
|
308
|
+
>
|
|
309
|
+
排序
|
|
310
|
+
</UButton>
|
|
311
|
+
</UChip>
|
|
312
|
+
|
|
313
|
+
<UButton
|
|
314
|
+
v-if="opr === 'settings' && !disableSettings && rawBizColumns?.length && onUpdateBizColumns"
|
|
315
|
+
icon="i-lucide-settings"
|
|
316
|
+
:size="size"
|
|
317
|
+
color="neutral"
|
|
318
|
+
variant="outline"
|
|
319
|
+
@click="handleSettings"
|
|
320
|
+
>
|
|
321
|
+
设置
|
|
322
|
+
</UButton>
|
|
177
323
|
|
|
178
|
-
|
|
179
|
-
|
|
324
|
+
<template v-if="opr === 'exportExcel' && exportExcel">
|
|
325
|
+
<PermissionWrapper v-if="exportExcel.permissionKey" :permission="exportExcel.permissionKey">
|
|
326
|
+
<UButton
|
|
327
|
+
icon="i-lucide-sheet"
|
|
328
|
+
:size="size"
|
|
329
|
+
color="neutral"
|
|
330
|
+
variant="outline"
|
|
331
|
+
@click="handleExportExcel"
|
|
332
|
+
>
|
|
333
|
+
导出
|
|
334
|
+
</UButton>
|
|
335
|
+
</PermissionWrapper>
|
|
180
336
|
<UButton
|
|
337
|
+
v-else
|
|
181
338
|
icon="i-lucide-sheet"
|
|
182
339
|
:size="size"
|
|
183
340
|
color="neutral"
|
|
@@ -186,42 +343,32 @@ async function onRightExtraButtonClick(btn, e) {
|
|
|
186
343
|
>
|
|
187
344
|
导出
|
|
188
345
|
</UButton>
|
|
189
|
-
</
|
|
346
|
+
</template>
|
|
347
|
+
|
|
190
348
|
<UButton
|
|
191
|
-
v-
|
|
192
|
-
icon="i-lucide-
|
|
349
|
+
v-if="opr === 'batchDelete' && !disableBatchDeletion && selectedIds?.length"
|
|
350
|
+
icon="i-lucide-trash-2"
|
|
193
351
|
:size="size"
|
|
194
|
-
color="
|
|
352
|
+
color="error"
|
|
195
353
|
variant="outline"
|
|
196
|
-
@click="
|
|
354
|
+
@click="handleBatchDelete"
|
|
197
355
|
>
|
|
198
|
-
|
|
356
|
+
批量删除
|
|
357
|
+
<template #trailing>
|
|
358
|
+
<UKbd size="sm">
|
|
359
|
+
{{ selectedIds?.length ?? 0 }}
|
|
360
|
+
</UKbd>
|
|
361
|
+
</template>
|
|
199
362
|
</UButton>
|
|
200
363
|
</template>
|
|
201
364
|
|
|
202
|
-
<
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
<template #trailing>
|
|
212
|
-
<UKbd size="sm">
|
|
213
|
-
{{ selectedIds?.length ?? 0 }}
|
|
214
|
-
</UKbd>
|
|
215
|
-
</template>
|
|
216
|
-
</UButton>
|
|
217
|
-
</template>
|
|
218
|
-
|
|
219
|
-
<template v-for="(btn, i) in extraButtons" :key="`extra-right-${i}`">
|
|
220
|
-
<UButton
|
|
221
|
-
v-if="(!btn.withBatchData || selectedIds?.length) && btn.appendTo === 'right'"
|
|
222
|
-
v-bind="omitOnClick(btn.button)"
|
|
223
|
-
@click="(e) => onRightExtraButtonClick(btn, e)"
|
|
224
|
-
/>
|
|
225
|
-
</template>
|
|
226
|
-
</div>
|
|
365
|
+
<template v-for="(btn, i) in extraButtons" :key="`extra-right-${i}`">
|
|
366
|
+
<UButton
|
|
367
|
+
v-if="(!btn.withBatchData || selectedIds?.length) && btn.appendTo === 'right'"
|
|
368
|
+
v-bind="omitOnClick(btn.button)"
|
|
369
|
+
@click="(e) => onRightExtraButtonClick(btn, e)"
|
|
370
|
+
/>
|
|
371
|
+
</template>
|
|
372
|
+
</div>
|
|
373
|
+
</template>
|
|
227
374
|
</template>
|
|
@@ -8,6 +8,7 @@ declare const __VLS_export: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_se
|
|
|
8
8
|
group: DndProps<T>["group"];
|
|
9
9
|
handle: DndProps<T>["handle"];
|
|
10
10
|
onFixCol: (col: Column, fixType: FixType) => void;
|
|
11
|
+
onToggleChecked?: (col: Column) => void;
|
|
11
12
|
onAfterDrag?: () => void;
|
|
12
13
|
} & {
|
|
13
14
|
list: Column[];
|
|
@@ -8,6 +8,7 @@ defineProps({
|
|
|
8
8
|
group: { type: null, required: true },
|
|
9
9
|
handle: { type: String, required: true },
|
|
10
10
|
onFixCol: { type: Function, required: true },
|
|
11
|
+
onToggleChecked: { type: Function, required: false },
|
|
11
12
|
onAfterDrag: { type: Function, required: false }
|
|
12
13
|
});
|
|
13
14
|
const list = defineModel("list", { type: Array, ...{ required: true } });
|
|
@@ -38,7 +39,8 @@ const list = defineModel("list", { type: Array, ...{ required: true } });
|
|
|
38
39
|
v-model:checked="element.checked"
|
|
39
40
|
:stg-col="element"
|
|
40
41
|
:columns="rawBizColumns"
|
|
41
|
-
|
|
42
|
+
:on-fix-col="onFixCol"
|
|
43
|
+
:on-toggle-checked="onToggleChecked"
|
|
42
44
|
/>
|
|
43
45
|
</Dnd>
|
|
44
46
|
</ScrollArea>
|
|
@@ -8,6 +8,7 @@ declare const __VLS_export: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_se
|
|
|
8
8
|
group: DndProps<T>["group"];
|
|
9
9
|
handle: DndProps<T>["handle"];
|
|
10
10
|
onFixCol: (col: Column, fixType: FixType) => void;
|
|
11
|
+
onToggleChecked?: (col: Column) => void;
|
|
11
12
|
onAfterDrag?: () => void;
|
|
12
13
|
} & {
|
|
13
14
|
list: Column[];
|
|
@@ -5,6 +5,7 @@ declare const __VLS_export: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_se
|
|
|
5
5
|
columns: VColumn<T>[];
|
|
6
6
|
stgCol: Column;
|
|
7
7
|
onFixCol: (col: Column, fixType: FixType) => void;
|
|
8
|
+
onToggleChecked?: (col: Column) => void;
|
|
8
9
|
} & {
|
|
9
10
|
checked: boolean | undefined;
|
|
10
11
|
}) & {
|