v-nuxt-ui 0.1.35 → 0.2.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/module.mjs +1 -0
- package/dist/runtime/components/Watermark.d.vue.ts +3 -3
- package/dist/runtime/components/Watermark.vue.d.ts +3 -3
- package/dist/runtime/components/button/CircleColor.d.vue.ts +17 -0
- package/dist/runtime/components/button/CircleColor.vue +37 -0
- package/dist/runtime/components/button/CircleColor.vue.d.ts +17 -0
- package/dist/runtime/components/button/Dropdown.vue +5 -1
- package/dist/runtime/components/date-picker/Input.d.vue.ts +9 -1
- package/dist/runtime/components/date-picker/Input.vue +55 -11
- package/dist/runtime/components/date-picker/Input.vue.d.ts +9 -1
- package/dist/runtime/components/date-picker/index.vue +3 -3
- package/dist/runtime/components/flow/FlowEdge.client.vue +170 -41
- package/dist/runtime/components/flow/FlowEditor.client.d.vue.ts +51 -0
- package/dist/runtime/components/flow/FlowEditor.client.vue +287 -0
- package/dist/runtime/components/flow/FlowEditor.client.vue.d.ts +51 -0
- package/dist/runtime/components/flow/FlowNode.client.d.vue.ts +13 -2
- package/dist/runtime/components/flow/FlowNode.client.vue +44 -48
- package/dist/runtime/components/flow/FlowNode.client.vue.d.ts +13 -2
- package/dist/runtime/components/flow/FlowToolbar.d.vue.ts +41 -5
- package/dist/runtime/components/flow/FlowToolbar.vue +554 -88
- package/dist/runtime/components/flow/FlowToolbar.vue.d.ts +41 -5
- package/dist/runtime/components/flow/FlowToolbarItemWrapper.d.vue.ts +17 -0
- package/dist/runtime/components/flow/FlowToolbarItemWrapper.vue +16 -0
- package/dist/runtime/components/flow/FlowToolbarItemWrapper.vue.d.ts +17 -0
- package/dist/runtime/components/form/field/DatePicker.vue +1 -1
- package/dist/runtime/components/sys/flow/CreateModal.d.vue.ts +13 -0
- package/dist/runtime/components/sys/flow/CreateModal.vue +32 -0
- package/dist/runtime/components/sys/flow/CreateModal.vue.d.ts +13 -0
- package/dist/runtime/components/sys/flow/EditNodeModal.d.vue.ts +13 -0
- package/dist/runtime/components/sys/flow/EditNodeModal.vue +30 -0
- package/dist/runtime/components/sys/flow/EditNodeModal.vue.d.ts +13 -0
- package/dist/runtime/components/sys/flow/Table.d.vue.ts +3 -0
- package/dist/runtime/components/sys/flow/Table.vue +103 -0
- package/dist/runtime/components/sys/flow/Table.vue.d.ts +3 -0
- package/dist/runtime/components/sys/table/CreateModal.vue +9 -193
- package/dist/runtime/components/sys/table/Table.vue +6 -15
- package/dist/runtime/components/sys/table/TableColumnList.d.vue.ts +54 -0
- package/dist/runtime/components/sys/table/TableColumnList.vue +196 -0
- package/dist/runtime/components/sys/table/TableColumnList.vue.d.ts +54 -0
- package/dist/runtime/components/sys/table/TableColumnModal.d.vue.ts +3 -13
- package/dist/runtime/components/sys/table/TableColumnModal.vue +32 -100
- package/dist/runtime/components/sys/table/TableColumnModal.vue.d.ts +3 -13
- package/dist/runtime/components/sys/user/Table.vue +44 -27
- package/dist/runtime/components/table/permission/TablePermissionConfig.d.vue.ts +2 -2
- package/dist/runtime/components/table/permission/TablePermissionConfig.vue +3 -3
- package/dist/runtime/components/table/permission/TablePermissionConfig.vue.d.ts +2 -2
- package/dist/runtime/components/table/permission/TablePermissionTab.vue +7 -4
- package/dist/runtime/components/table/query/order/Item.d.vue.ts +2 -2
- package/dist/runtime/components/table/query/order/Item.vue.d.ts +2 -2
- package/dist/runtime/components/table/query/where/Newer.vue +2 -0
- package/dist/runtime/components/table/query/where/index.vue +46 -15
- package/dist/runtime/components/table/query/where/simple/item/ColumnPicker.vue +9 -4
- package/dist/runtime/components/table/query/where/simple/item/OprPicker.vue +3 -3
- package/dist/runtime/components/table/query/where/simple/item/opr/AsyncSelect.vue +45 -48
- package/dist/runtime/components/table/query/where/simple/item/opr/DatePicker.vue +137 -131
- package/dist/runtime/components/table/query/where/simple/item/opr/Select.d.vue.ts +4 -2
- package/dist/runtime/components/table/query/where/simple/item/opr/Select.vue +40 -40
- package/dist/runtime/components/table/query/where/simple/item/opr/Select.vue.d.ts +4 -2
- package/dist/runtime/components/table/query/where/simple/item/opr/index.vue +2 -0
- package/dist/runtime/components/table/settings/TableSettings.d.vue.ts +1 -1
- package/dist/runtime/components/table/settings/TableSettings.vue +0 -3
- package/dist/runtime/components/table/settings/TableSettings.vue.d.ts +1 -1
- package/dist/runtime/composables/api/sys/index.d.ts +3 -0
- package/dist/runtime/composables/api/sys/index.js +3 -0
- package/dist/runtime/composables/api/sys/useFlowApi.d.ts +2 -0
- package/dist/runtime/composables/api/sys/useFlowApi.js +5 -0
- package/dist/runtime/composables/api/sys/useFlowEdgeApi.d.ts +2 -0
- package/dist/runtime/composables/api/sys/useFlowEdgeApi.js +3 -0
- package/dist/runtime/composables/api/sys/useFlowNodeApi.d.ts +2 -0
- package/dist/runtime/composables/api/sys/useFlowNodeApi.js +3 -0
- package/dist/runtime/composables/api/sys/useRoleApi.js +3 -1
- package/dist/runtime/composables/api/sys/useUserApi.js +3 -1
- package/dist/runtime/composables/flow/index.d.ts +3 -0
- package/dist/runtime/composables/flow/index.js +3 -0
- package/dist/runtime/composables/flow/useFlow.d.ts +33 -0
- package/dist/runtime/composables/flow/useFlow.js +401 -0
- package/dist/runtime/composables/flow/useFlowNode.d.ts +17 -0
- package/dist/runtime/composables/flow/useFlowNode.js +106 -0
- package/dist/runtime/composables/flow/useFlowResize.d.ts +21 -0
- package/dist/runtime/composables/flow/useFlowResize.js +84 -0
- package/dist/runtime/composables/flow/useFlowStyles.d.ts +62 -9
- package/dist/runtime/composables/flow/useFlowStyles.js +127 -23
- package/dist/runtime/composables/table/useTableColumnPermission.d.ts +36 -0
- package/dist/runtime/composables/useDate.js +8 -8
- package/dist/runtime/composables/useSidebarMenu.js +0 -2
- package/dist/runtime/composables/useTheme.d.ts +1 -1
- package/dist/runtime/composables/useTheme.js +0 -1
- package/dist/runtime/constants/flow.d.ts +166 -0
- package/dist/runtime/constants/flow.js +171 -0
- package/dist/runtime/constants/index.d.ts +1 -0
- package/dist/runtime/constants/index.js +1 -0
- package/dist/runtime/constants/options.js +2 -3
- package/dist/runtime/constants/table.d.ts +2 -0
- package/dist/runtime/constants/table.js +8 -0
- package/dist/runtime/index.css +1 -1
- package/dist/runtime/types/components/table/column.d.ts +4 -3
- package/dist/runtime/types/components/table/query/where.d.ts +1 -5
- package/dist/runtime/types/models/flow.d.ts +61 -0
- package/dist/runtime/types/models/flow.js +0 -0
- package/dist/runtime/types/models/index.d.ts +1 -0
- package/dist/runtime/types/models/index.js +1 -0
- package/dist/runtime/types/models/table.d.ts +1 -0
- package/dist/runtime/types/storage.d.ts +3 -4
- package/dist/runtime/types/storage.js +3 -4
- package/package.json +3 -2
- package/dist/runtime/components/table/query/where/simple/index.d.vue.ts +0 -21
- package/dist/runtime/components/table/query/where/simple/index.vue +0 -52
- package/dist/runtime/components/table/query/where/simple/index.vue.d.ts +0 -21
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { TableColumn } from '#v/types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
initialColumns?: TableColumn[];
|
|
4
|
+
};
|
|
5
|
+
interface ColumnRow extends TableColumn {
|
|
6
|
+
_isDirty?: boolean;
|
|
7
|
+
}
|
|
8
|
+
/** 供父组件在提交时调用:创建新表后批量创建列 */
|
|
9
|
+
declare function createAllColumns(tableId: number): Promise<void>;
|
|
10
|
+
/** 供父组件在提交时调用:保存已有表的列变更 */
|
|
11
|
+
declare function saveDirtyColumns(tableId: number): Promise<void>;
|
|
12
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
|
|
13
|
+
columns: import("vue").Ref<{
|
|
14
|
+
_isDirty?: boolean | undefined;
|
|
15
|
+
tableId?: number | undefined;
|
|
16
|
+
columnKey?: string | undefined;
|
|
17
|
+
label?: string | undefined;
|
|
18
|
+
labelI18nKey?: string | undefined;
|
|
19
|
+
order?: number | undefined;
|
|
20
|
+
width?: number | undefined;
|
|
21
|
+
fixed?: "left" | "right" | "" | undefined;
|
|
22
|
+
visible?: boolean | undefined;
|
|
23
|
+
id: number;
|
|
24
|
+
createdAt?: string | undefined;
|
|
25
|
+
updatedAt?: string | undefined;
|
|
26
|
+
version?: number | undefined;
|
|
27
|
+
createdBy?: number | undefined;
|
|
28
|
+
creator?: any;
|
|
29
|
+
updatedBy?: number | undefined;
|
|
30
|
+
updater?: any;
|
|
31
|
+
}[], ColumnRow[] | {
|
|
32
|
+
_isDirty?: boolean | undefined;
|
|
33
|
+
tableId?: number | undefined;
|
|
34
|
+
columnKey?: string | undefined;
|
|
35
|
+
label?: string | undefined;
|
|
36
|
+
labelI18nKey?: string | undefined;
|
|
37
|
+
order?: number | undefined;
|
|
38
|
+
width?: number | undefined;
|
|
39
|
+
fixed?: "left" | "right" | "" | undefined;
|
|
40
|
+
visible?: boolean | undefined;
|
|
41
|
+
id: number;
|
|
42
|
+
createdAt?: string | undefined;
|
|
43
|
+
updatedAt?: string | undefined;
|
|
44
|
+
version?: number | undefined;
|
|
45
|
+
createdBy?: number | undefined;
|
|
46
|
+
creator?: any;
|
|
47
|
+
updatedBy?: number | undefined;
|
|
48
|
+
updater?: any;
|
|
49
|
+
}[]>;
|
|
50
|
+
createAllColumns: typeof createAllColumns;
|
|
51
|
+
saveDirtyColumns: typeof saveDirtyColumns;
|
|
52
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
53
|
+
declare const _default: typeof __VLS_export;
|
|
54
|
+
export default _default;
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { useOverlay } from "@nuxt/ui/composables";
|
|
3
|
+
import TableColumnModal from "./TableColumnModal.vue";
|
|
4
|
+
import { useTableColumnApi } from "#v/composables";
|
|
5
|
+
import { ref, watch } from "vue";
|
|
6
|
+
import ScrollArea from "#v/components/ScrollArea.vue";
|
|
7
|
+
const props = defineProps({
|
|
8
|
+
initialColumns: { type: Array, required: false }
|
|
9
|
+
});
|
|
10
|
+
const overlay = useOverlay();
|
|
11
|
+
const columnModal = overlay.create(TableColumnModal);
|
|
12
|
+
const tableColumnApi = useTableColumnApi();
|
|
13
|
+
const columns = ref([]);
|
|
14
|
+
const deletedColumnIds = ref([]);
|
|
15
|
+
watch(() => props.initialColumns, (val) => {
|
|
16
|
+
if (val && val.length && columns.value.length === 0) {
|
|
17
|
+
columns.value = val.map((col) => ({
|
|
18
|
+
...col,
|
|
19
|
+
columnKey: col.columnKey ?? "",
|
|
20
|
+
label: col.label ?? "",
|
|
21
|
+
order: col.order ?? 0,
|
|
22
|
+
width: col.width ?? 100,
|
|
23
|
+
fixed: col.fixed ?? "",
|
|
24
|
+
visible: col.visible ?? true
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
27
|
+
}, { immediate: true });
|
|
28
|
+
function addColumn() {
|
|
29
|
+
const maxOrder = columns.value.reduce((max, col) => Math.max(max, col.order ?? 0), 0);
|
|
30
|
+
const defaultCol = {
|
|
31
|
+
id: 0,
|
|
32
|
+
columnKey: "",
|
|
33
|
+
label: "",
|
|
34
|
+
order: maxOrder + 1,
|
|
35
|
+
width: 100,
|
|
36
|
+
fixed: "",
|
|
37
|
+
visible: true
|
|
38
|
+
};
|
|
39
|
+
columnModal.open({
|
|
40
|
+
column: defaultCol,
|
|
41
|
+
onSaveColumn: (col) => {
|
|
42
|
+
columns.value.push({ ...col, id: 0, _isDirty: true });
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
function removeColumn(index) {
|
|
47
|
+
const col = columns.value[index];
|
|
48
|
+
if (!col) return;
|
|
49
|
+
if (col.id !== 0) {
|
|
50
|
+
deletedColumnIds.value.push(col.id);
|
|
51
|
+
}
|
|
52
|
+
columns.value.splice(index, 1);
|
|
53
|
+
}
|
|
54
|
+
function editColumn(index) {
|
|
55
|
+
const col = columns.value[index];
|
|
56
|
+
if (!col) return;
|
|
57
|
+
columnModal.open({
|
|
58
|
+
column: col,
|
|
59
|
+
onSaveColumn: (updated) => {
|
|
60
|
+
columns.value[index] = { ...updated, id: col.id, _isDirty: true };
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
function fixedLabel(fixed) {
|
|
65
|
+
const map = { left: "\u56FA\u5B9A\u5DE6", right: "\u56FA\u5B9A\u53F3" };
|
|
66
|
+
return map[fixed] ?? "";
|
|
67
|
+
}
|
|
68
|
+
async function createAllColumns(tableId) {
|
|
69
|
+
for (const col of columns.value) {
|
|
70
|
+
await tableColumnApi.create(tableColumnApi.prune({
|
|
71
|
+
...col,
|
|
72
|
+
tableId
|
|
73
|
+
}));
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
async function saveDirtyColumns(tableId) {
|
|
77
|
+
for (const col of columns.value) {
|
|
78
|
+
if (col._isDirty) {
|
|
79
|
+
const colData = {
|
|
80
|
+
id: col.id,
|
|
81
|
+
tableId,
|
|
82
|
+
columnKey: col.columnKey,
|
|
83
|
+
label: col.label,
|
|
84
|
+
order: col.order,
|
|
85
|
+
width: col.width,
|
|
86
|
+
fixed: col.fixed,
|
|
87
|
+
visible: col.visible
|
|
88
|
+
};
|
|
89
|
+
if (col.id === 0) {
|
|
90
|
+
await tableColumnApi.create(tableColumnApi.prune(colData));
|
|
91
|
+
} else {
|
|
92
|
+
await tableColumnApi.update(tableColumnApi.prune(colData));
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
for (const id of deletedColumnIds.value) {
|
|
97
|
+
await tableColumnApi.deleteById(id);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
defineExpose({
|
|
101
|
+
columns,
|
|
102
|
+
createAllColumns,
|
|
103
|
+
saveDirtyColumns
|
|
104
|
+
});
|
|
105
|
+
</script>
|
|
106
|
+
|
|
107
|
+
<template>
|
|
108
|
+
<div class="pt-6">
|
|
109
|
+
<div class="flex items-center justify-between mb-3">
|
|
110
|
+
<div>
|
|
111
|
+
<div class="font-semibold text-sm">
|
|
112
|
+
列配置
|
|
113
|
+
</div>
|
|
114
|
+
<div class="text-sm text-dimmed text-xs">
|
|
115
|
+
配置 Table 的列信息
|
|
116
|
+
</div>
|
|
117
|
+
</div>
|
|
118
|
+
<UButton
|
|
119
|
+
label="添加列"
|
|
120
|
+
icon="i-lucide-plus"
|
|
121
|
+
variant="soft"
|
|
122
|
+
size="sm"
|
|
123
|
+
@click="addColumn"
|
|
124
|
+
/>
|
|
125
|
+
</div>
|
|
126
|
+
|
|
127
|
+
<div v-if="columns.length === 0" class="py-8 text-center text-dimmed text-xs">
|
|
128
|
+
暂无列配置,点击"添加列"创建
|
|
129
|
+
</div>
|
|
130
|
+
<ScrollArea v-else class="max-h-72 rounded-md border border-default">
|
|
131
|
+
<div class="flex flex-col divide-y divide-default">
|
|
132
|
+
<div
|
|
133
|
+
v-for="(col, index) in columns"
|
|
134
|
+
:key="col.id + '-' + index"
|
|
135
|
+
class="group flex items-center gap-3 px-3 py-2.5 transition-colors hover:bg-muted"
|
|
136
|
+
>
|
|
137
|
+
<!-- index box -->
|
|
138
|
+
<div class="flex size-8 shrink-0 items-center justify-center rounded-md bg-primary/10 text-primary text-xs font-semibold">
|
|
139
|
+
{{ col.order }}
|
|
140
|
+
</div>
|
|
141
|
+
|
|
142
|
+
<div class="min-w-0 flex-1">
|
|
143
|
+
<div class="flex items-center gap-2">
|
|
144
|
+
<span class="font-medium text-sm truncate">{{ col.label || "\u672A\u547D\u540D" }}</span>
|
|
145
|
+
<span class="text-xs text-dimmed font-mono truncate">{{ col.columnKey || "-" }}</span>
|
|
146
|
+
</div>
|
|
147
|
+
<div class="flex items-center gap-2 mt-0.5">
|
|
148
|
+
<span class="text-xs text-dimmed">宽 {{ col.width }}px</span>
|
|
149
|
+
<UBadge
|
|
150
|
+
v-if="col.fixed"
|
|
151
|
+
size="xs"
|
|
152
|
+
variant="subtle"
|
|
153
|
+
color="info"
|
|
154
|
+
>
|
|
155
|
+
{{ fixedLabel(col.fixed) }}
|
|
156
|
+
</UBadge>
|
|
157
|
+
<UBadge
|
|
158
|
+
v-if="!col.visible"
|
|
159
|
+
size="xs"
|
|
160
|
+
variant="subtle"
|
|
161
|
+
color="warning"
|
|
162
|
+
>
|
|
163
|
+
已隐藏
|
|
164
|
+
</UBadge>
|
|
165
|
+
<UBadge
|
|
166
|
+
v-if="col.id === 0"
|
|
167
|
+
size="xs"
|
|
168
|
+
variant="subtle"
|
|
169
|
+
color="success"
|
|
170
|
+
>
|
|
171
|
+
新增
|
|
172
|
+
</UBadge>
|
|
173
|
+
</div>
|
|
174
|
+
</div>
|
|
175
|
+
|
|
176
|
+
<div class="flex shrink-0 items-center opacity-0 group-hover:opacity-100 transition-opacity">
|
|
177
|
+
<UButton
|
|
178
|
+
icon="i-lucide-pencil"
|
|
179
|
+
variant="ghost"
|
|
180
|
+
size="xs"
|
|
181
|
+
color="neutral"
|
|
182
|
+
@click="editColumn(index)"
|
|
183
|
+
/>
|
|
184
|
+
<UButton
|
|
185
|
+
icon="i-lucide-trash-2"
|
|
186
|
+
variant="ghost"
|
|
187
|
+
size="xs"
|
|
188
|
+
color="error"
|
|
189
|
+
@click="removeColumn(index)"
|
|
190
|
+
/>
|
|
191
|
+
</div>
|
|
192
|
+
</div>
|
|
193
|
+
</div>
|
|
194
|
+
</ScrollArea>
|
|
195
|
+
</div>
|
|
196
|
+
</template>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { TableColumn } from '#v/types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
initialColumns?: TableColumn[];
|
|
4
|
+
};
|
|
5
|
+
interface ColumnRow extends TableColumn {
|
|
6
|
+
_isDirty?: boolean;
|
|
7
|
+
}
|
|
8
|
+
/** 供父组件在提交时调用:创建新表后批量创建列 */
|
|
9
|
+
declare function createAllColumns(tableId: number): Promise<void>;
|
|
10
|
+
/** 供父组件在提交时调用:保存已有表的列变更 */
|
|
11
|
+
declare function saveDirtyColumns(tableId: number): Promise<void>;
|
|
12
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
|
|
13
|
+
columns: import("vue").Ref<{
|
|
14
|
+
_isDirty?: boolean | undefined;
|
|
15
|
+
tableId?: number | undefined;
|
|
16
|
+
columnKey?: string | undefined;
|
|
17
|
+
label?: string | undefined;
|
|
18
|
+
labelI18nKey?: string | undefined;
|
|
19
|
+
order?: number | undefined;
|
|
20
|
+
width?: number | undefined;
|
|
21
|
+
fixed?: "left" | "right" | "" | undefined;
|
|
22
|
+
visible?: boolean | undefined;
|
|
23
|
+
id: number;
|
|
24
|
+
createdAt?: string | undefined;
|
|
25
|
+
updatedAt?: string | undefined;
|
|
26
|
+
version?: number | undefined;
|
|
27
|
+
createdBy?: number | undefined;
|
|
28
|
+
creator?: any;
|
|
29
|
+
updatedBy?: number | undefined;
|
|
30
|
+
updater?: any;
|
|
31
|
+
}[], ColumnRow[] | {
|
|
32
|
+
_isDirty?: boolean | undefined;
|
|
33
|
+
tableId?: number | undefined;
|
|
34
|
+
columnKey?: string | undefined;
|
|
35
|
+
label?: string | undefined;
|
|
36
|
+
labelI18nKey?: string | undefined;
|
|
37
|
+
order?: number | undefined;
|
|
38
|
+
width?: number | undefined;
|
|
39
|
+
fixed?: "left" | "right" | "" | undefined;
|
|
40
|
+
visible?: boolean | undefined;
|
|
41
|
+
id: number;
|
|
42
|
+
createdAt?: string | undefined;
|
|
43
|
+
updatedAt?: string | undefined;
|
|
44
|
+
version?: number | undefined;
|
|
45
|
+
createdBy?: number | undefined;
|
|
46
|
+
creator?: any;
|
|
47
|
+
updatedBy?: number | undefined;
|
|
48
|
+
updater?: any;
|
|
49
|
+
}[]>;
|
|
50
|
+
createAllColumns: typeof createAllColumns;
|
|
51
|
+
saveDirtyColumns: typeof saveDirtyColumns;
|
|
52
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
53
|
+
declare const _default: typeof __VLS_export;
|
|
54
|
+
export default _default;
|
|
@@ -1,22 +1,12 @@
|
|
|
1
|
-
import type { TableColumn
|
|
1
|
+
import type { TableColumn } from '#v/types';
|
|
2
2
|
type __VLS_Props = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
id: number;
|
|
6
|
-
columnKey: string;
|
|
7
|
-
label: string;
|
|
8
|
-
order: number;
|
|
9
|
-
width: number;
|
|
10
|
-
fixed: 'left' | 'right' | '';
|
|
11
|
-
visible: boolean;
|
|
12
|
-
};
|
|
3
|
+
column: TableColumn;
|
|
4
|
+
onSaveColumn: (col: TableColumn) => void;
|
|
13
5
|
};
|
|
14
6
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
15
7
|
close: (args_0: boolean) => any;
|
|
16
|
-
save: (args_0: Partial<TableColumn>) => any;
|
|
17
8
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
18
9
|
onClose?: ((args_0: boolean) => any) | undefined;
|
|
19
|
-
onSave?: ((args_0: Partial<TableColumn>) => any) | undefined;
|
|
20
10
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
21
11
|
declare const _default: typeof __VLS_export;
|
|
22
12
|
export default _default;
|
|
@@ -1,107 +1,39 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
2
|
+
import * as z from "zod";
|
|
3
|
+
import FormCreateModalTemplate from "#v/components/form/create-modal-template/index.vue";
|
|
4
|
+
import { useFormValues } from "#v/composables";
|
|
5
|
+
import { computed, toRef } from "vue";
|
|
5
6
|
const props = defineProps({
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
column: { type: Object, required: true },
|
|
8
|
+
onSaveColumn: { type: Function, required: true }
|
|
8
9
|
});
|
|
9
|
-
const emit = defineEmits(["close"
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
label:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
id: props.column?.id,
|
|
25
|
-
columnKey: formData.value.columnKey,
|
|
26
|
-
label: formData.value.label,
|
|
27
|
-
order: formData.value.order,
|
|
28
|
-
width: formData.value.width,
|
|
29
|
-
fixed: formData.value.fixed,
|
|
30
|
-
visible: formData.value.visible
|
|
31
|
-
});
|
|
32
|
-
emit("close", true);
|
|
33
|
-
} catch (error) {
|
|
34
|
-
useToast().add({
|
|
35
|
-
title: "\u4FDD\u5B58\u5931\u8D25",
|
|
36
|
-
description: String(error),
|
|
37
|
-
color: "error",
|
|
38
|
-
icon: "i-lucide-x-circle"
|
|
39
|
-
});
|
|
40
|
-
emit("close", false);
|
|
41
|
-
} finally {
|
|
42
|
-
saving.value = false;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
10
|
+
const emit = defineEmits(["close"]);
|
|
11
|
+
const { newValues } = useFormValues(toRef(props.column), { id: 0 });
|
|
12
|
+
const fixedItems = [
|
|
13
|
+
{ label: "\u4E0D\u56FA\u5B9A", value: "" },
|
|
14
|
+
{ label: "\u5DE6\u4FA7\u56FA\u5B9A", value: "left" },
|
|
15
|
+
{ label: "\u53F3\u4FA7\u56FA\u5B9A", value: "right" }
|
|
16
|
+
];
|
|
17
|
+
const fields = computed(() => [
|
|
18
|
+
{ name: "columnKey", type: "input", label: "\u5217\u6807\u8BC6", colSpan: "12", zodType: z.string().min(1, "\u5217\u6807\u8BC6\u4E0D\u80FD\u4E3A\u7A7A") },
|
|
19
|
+
{ name: "label", type: "input", label: "\u663E\u793A\u540D", colSpan: "12", zodType: z.string().min(1, "\u663E\u793A\u540D\u4E0D\u80FD\u4E3A\u7A7A") },
|
|
20
|
+
{ name: "order", type: "input-number", label: "\u987A\u5E8F", colSpan: "8", zodType: z.number() },
|
|
21
|
+
{ name: "width", type: "input-number", label: "\u5BBD\u5EA6", colSpan: "8", zodType: z.number() },
|
|
22
|
+
{ name: "fixed", type: "select", label: "\u56FA\u5B9A", colSpan: "8", items: fixedItems, enableEmptyOption: false, zodType: z.string().optional() },
|
|
23
|
+
{ name: "visible", type: "switch", label: "\u662F\u5426\u663E\u793A", colSpan: "24", zodType: z.boolean().optional() }
|
|
24
|
+
]);
|
|
45
25
|
</script>
|
|
46
26
|
|
|
47
27
|
<template>
|
|
48
|
-
<
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
:
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
<div>
|
|
60
|
-
<label class="text-sm font-medium mb-1 block">显示名</label>
|
|
61
|
-
<UInput v-model="formData.label" placeholder="显示名" />
|
|
62
|
-
</div>
|
|
63
|
-
</div>
|
|
64
|
-
<div class="grid grid-cols-3 gap-4">
|
|
65
|
-
<div>
|
|
66
|
-
<label class="text-sm font-medium mb-1 block">顺序</label>
|
|
67
|
-
<UInputNumber v-model="formData.order" :min="0" class="w-full" />
|
|
68
|
-
</div>
|
|
69
|
-
<div>
|
|
70
|
-
<label class="text-sm font-medium mb-1 block">宽度</label>
|
|
71
|
-
<UInputNumber v-model="formData.width" :min="0" class="w-full" />
|
|
72
|
-
</div>
|
|
73
|
-
<div>
|
|
74
|
-
<label class="text-sm font-medium mb-1 block">固定</label>
|
|
75
|
-
<USelect
|
|
76
|
-
v-model="formData.fixed"
|
|
77
|
-
:items="[
|
|
78
|
-
{ label: '\u4E0D\u56FA\u5B9A', value: '' },
|
|
79
|
-
{ label: '\u5DE6\u4FA7', value: 'left' },
|
|
80
|
-
{ label: '\u53F3\u4FA7', value: 'right' }
|
|
81
|
-
]"
|
|
82
|
-
class="w-full"
|
|
83
|
-
/>
|
|
84
|
-
</div>
|
|
85
|
-
</div>
|
|
86
|
-
<div class="flex items-center gap-2">
|
|
87
|
-
<USwitch v-model="formData.visible" />
|
|
88
|
-
<span class="text-sm">{{ formData.visible ? "\u663E\u793A" : "\u9690\u85CF" }}</span>
|
|
89
|
-
</div>
|
|
90
|
-
</div>
|
|
91
|
-
<template #footer>
|
|
92
|
-
<UButton
|
|
93
|
-
label="取消"
|
|
94
|
-
color="neutral"
|
|
95
|
-
variant="subtle"
|
|
96
|
-
@click="emit('close', false)"
|
|
97
|
-
/>
|
|
98
|
-
<UButton
|
|
99
|
-
label="保存"
|
|
100
|
-
color="primary"
|
|
101
|
-
variant="solid"
|
|
102
|
-
:loading="saving"
|
|
103
|
-
@click="handleSave"
|
|
104
|
-
/>
|
|
105
|
-
</template>
|
|
106
|
-
</UModal>
|
|
28
|
+
<FormCreateModalTemplate
|
|
29
|
+
title="列配置"
|
|
30
|
+
:on-close="(ok) => emit('close', ok)"
|
|
31
|
+
:fields="fields"
|
|
32
|
+
:model-value="newValues"
|
|
33
|
+
@update-model-value="(newVal) => newValues = { id: 0, ...newVal }"
|
|
34
|
+
@submit="async () => {
|
|
35
|
+
props.onSaveColumn(newValues);
|
|
36
|
+
emit('close', true);
|
|
37
|
+
}"
|
|
38
|
+
/>
|
|
107
39
|
</template>
|
|
@@ -1,22 +1,12 @@
|
|
|
1
|
-
import type { TableColumn
|
|
1
|
+
import type { TableColumn } from '#v/types';
|
|
2
2
|
type __VLS_Props = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
id: number;
|
|
6
|
-
columnKey: string;
|
|
7
|
-
label: string;
|
|
8
|
-
order: number;
|
|
9
|
-
width: number;
|
|
10
|
-
fixed: 'left' | 'right' | '';
|
|
11
|
-
visible: boolean;
|
|
12
|
-
};
|
|
3
|
+
column: TableColumn;
|
|
4
|
+
onSaveColumn: (col: TableColumn) => void;
|
|
13
5
|
};
|
|
14
6
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
15
7
|
close: (args_0: boolean) => any;
|
|
16
|
-
save: (args_0: Partial<TableColumn>) => any;
|
|
17
8
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
18
9
|
onClose?: ((args_0: boolean) => any) | undefined;
|
|
19
|
-
onSave?: ((args_0: Partial<TableColumn>) => any) | undefined;
|
|
20
10
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
21
11
|
declare const _default: typeof __VLS_export;
|
|
22
12
|
export default _default;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import dayjs from "dayjs";
|
|
3
3
|
import { useOverlay } from "@nuxt/ui/composables";
|
|
4
4
|
import { isEmptyString } from "#v/utils";
|
|
5
|
-
import { useDepartmentApi, useUserApi } from "#v/composables";
|
|
5
|
+
import { useDepartmentApi, useRoleApi, useUserApi } from "#v/composables";
|
|
6
6
|
import { booleanOptions, dateFormat, genderOptions, loginTypeOptions } from "#v/constants";
|
|
7
7
|
import SysUsersCreateModal from "./CreateModal.vue";
|
|
8
8
|
import UBadge from "@nuxt/ui/components/Badge.vue";
|
|
@@ -15,10 +15,6 @@ const columns = [
|
|
|
15
15
|
accessorKey: "isResigned",
|
|
16
16
|
header: "\u662F\u5426\u79BB\u804C",
|
|
17
17
|
sortOption: true,
|
|
18
|
-
filterOption: {
|
|
19
|
-
type: "input",
|
|
20
|
-
initHide: false
|
|
21
|
-
},
|
|
22
18
|
cell: ({ row }) => h(
|
|
23
19
|
UBadge,
|
|
24
20
|
{
|
|
@@ -56,16 +52,37 @@ const columns = [
|
|
|
56
52
|
accessorKey: "supervisorId",
|
|
57
53
|
header: "\u76F4\u5C5E\u4E0A\u7EA7",
|
|
58
54
|
sortOption: true,
|
|
59
|
-
cell: ({ row }) => row.original.supervisor?.nickname
|
|
55
|
+
cell: ({ row }) => row.original.supervisor?.nickname,
|
|
56
|
+
filterOption: {
|
|
57
|
+
type: "async-select",
|
|
58
|
+
listApi: useUserApi().list,
|
|
59
|
+
searchFields: ["name"],
|
|
60
|
+
labelField: "name",
|
|
61
|
+
valueField: "id",
|
|
62
|
+
multiple: true,
|
|
63
|
+
defaultOpr: "in"
|
|
64
|
+
}
|
|
60
65
|
},
|
|
61
66
|
{
|
|
62
67
|
accessorKey: "roles",
|
|
63
68
|
header: "\u7CFB\u7EDF\u6743\u9650\u89D2\u8272",
|
|
64
|
-
cell: ({ row }) => row.original.roles?.map((role) => role.name).join(", ")
|
|
69
|
+
cell: ({ row }) => row.original.roles?.map((role) => role.name).join(", "),
|
|
70
|
+
filterOption: {
|
|
71
|
+
type: "async-select",
|
|
72
|
+
listApi: useRoleApi().list,
|
|
73
|
+
searchFields: ["name"],
|
|
74
|
+
labelField: "name",
|
|
75
|
+
valueField: "id",
|
|
76
|
+
multiple: true,
|
|
77
|
+
defaultOpr: "in"
|
|
78
|
+
}
|
|
65
79
|
},
|
|
66
80
|
{
|
|
67
81
|
accessorKey: "username",
|
|
68
82
|
header: "\u7528\u6237\u540D",
|
|
83
|
+
filterOption: {
|
|
84
|
+
type: "input"
|
|
85
|
+
},
|
|
69
86
|
meta: {
|
|
70
87
|
class: {
|
|
71
88
|
td: "min-w-24"
|
|
@@ -75,23 +92,22 @@ const columns = [
|
|
|
75
92
|
{
|
|
76
93
|
accessorKey: "loginType",
|
|
77
94
|
header: "\u767B\u5F55\u65B9\u5F0F",
|
|
95
|
+
filterOption: {
|
|
96
|
+
type: "select",
|
|
97
|
+
items: loginTypeOptions
|
|
98
|
+
},
|
|
78
99
|
meta: {
|
|
79
100
|
class: {
|
|
80
101
|
td: "min-w-24"
|
|
81
102
|
}
|
|
82
|
-
},
|
|
83
|
-
cell: ({ row }) => {
|
|
84
|
-
const loginTypes = row.original.loginType?.split(",");
|
|
85
|
-
return h(
|
|
86
|
-
"div",
|
|
87
|
-
{ class: "flex flex-wrap items-center gap-1" },
|
|
88
|
-
[loginTypes?.map((loginType) => h(UBadge, { variant: "outline" }, () => loginTypeOptions.find((opt) => opt.value === loginType)?.label))]
|
|
89
|
-
);
|
|
90
103
|
}
|
|
91
104
|
},
|
|
92
105
|
{
|
|
93
106
|
accessorKey: "email",
|
|
94
|
-
header: "\u90AE\u7BB1"
|
|
107
|
+
header: "\u90AE\u7BB1",
|
|
108
|
+
filterOption: {
|
|
109
|
+
type: "input"
|
|
110
|
+
}
|
|
95
111
|
},
|
|
96
112
|
{
|
|
97
113
|
accessorKey: "needFillWh",
|
|
@@ -128,17 +144,26 @@ const columns = [
|
|
|
128
144
|
accessorKey: "entryDate",
|
|
129
145
|
header: "\u5165\u804C\u65F6\u95F4",
|
|
130
146
|
sortOption: true,
|
|
147
|
+
filterOption: {
|
|
148
|
+
type: "date-picker"
|
|
149
|
+
},
|
|
131
150
|
cell: ({ row }) => dayjs(row.getValue("entryDate")).format(dateFormat)
|
|
132
151
|
},
|
|
133
152
|
{
|
|
134
153
|
accessorKey: "resignDate",
|
|
135
154
|
header: "\u79BB\u804C\u65F6\u95F4",
|
|
155
|
+
filterOption: {
|
|
156
|
+
type: "date-picker"
|
|
157
|
+
},
|
|
136
158
|
sortOption: true,
|
|
137
159
|
cell: ({ row }) => dayjs(row.getValue("resignDate")).format(dateFormat)
|
|
138
160
|
},
|
|
139
161
|
{
|
|
140
162
|
accessorKey: "telNo",
|
|
141
163
|
header: "\u7535\u8BDD",
|
|
164
|
+
filterOption: {
|
|
165
|
+
type: "input"
|
|
166
|
+
},
|
|
142
167
|
meta: {
|
|
143
168
|
class: {
|
|
144
169
|
td: "min-w-24"
|
|
@@ -150,17 +175,9 @@ const columns = [
|
|
|
150
175
|
header: "\u662F\u5426\u662F\u7CFB\u7EDF\u7BA1\u7406\u5458",
|
|
151
176
|
sortOption: true,
|
|
152
177
|
filterOption: {
|
|
153
|
-
type: "
|
|
154
|
-
|
|
155
|
-
}
|
|
156
|
-
cell: ({ row }) => h(
|
|
157
|
-
UBadge,
|
|
158
|
-
{
|
|
159
|
-
label: row.original.isAdmin ? "\u662F" : "\u5426",
|
|
160
|
-
variant: "soft",
|
|
161
|
-
color: row.original.isAdmin ? "primary" : "neutral"
|
|
162
|
-
}
|
|
163
|
-
)
|
|
178
|
+
type: "select",
|
|
179
|
+
items: booleanOptions
|
|
180
|
+
}
|
|
164
181
|
}
|
|
165
182
|
];
|
|
166
183
|
</script>
|
|
@@ -4,10 +4,10 @@ type __VLS_Props = {
|
|
|
4
4
|
tableId?: number;
|
|
5
5
|
};
|
|
6
6
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
7
|
-
close: (
|
|
7
|
+
close: (result: false | TablePermission) => any;
|
|
8
8
|
save: (args_0: TablePermission) => any;
|
|
9
9
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
10
|
-
onClose?: ((
|
|
10
|
+
onClose?: ((result: false | TablePermission) => any) | undefined;
|
|
11
11
|
onSave?: ((args_0: TablePermission) => any) | undefined;
|
|
12
12
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
13
13
|
declare const _default: typeof __VLS_export;
|
|
@@ -92,7 +92,7 @@ function onTableChange(tableId) {
|
|
|
92
92
|
const table = tables.value.find((t) => t.id === tableId);
|
|
93
93
|
if (table) {
|
|
94
94
|
selectedTable.value = table;
|
|
95
|
-
fetchMergedColumns(table.tblName);
|
|
95
|
+
fetchMergedColumns(table.tblName ?? "");
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
async function handleSave() {
|
|
@@ -114,7 +114,7 @@ async function handleSave() {
|
|
|
114
114
|
columnPermissions: columnPermissions.value
|
|
115
115
|
};
|
|
116
116
|
emit("save", result);
|
|
117
|
-
emit("close",
|
|
117
|
+
emit("close", result);
|
|
118
118
|
} catch (e) {
|
|
119
119
|
useToast().add({
|
|
120
120
|
title: "\u4FDD\u5B58\u5931\u8D25",
|
|
@@ -135,7 +135,7 @@ onMounted(async () => {
|
|
|
135
135
|
const table = tables.value.find((t) => t.id === props.tableId);
|
|
136
136
|
if (table) {
|
|
137
137
|
selectedTable.value = table;
|
|
138
|
-
await fetchMergedColumns(table.tblName);
|
|
138
|
+
await fetchMergedColumns(table.tblName ?? "");
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
if (props.permission) {
|