v-nuxt-ui 0.1.34 → 0.1.36
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/EChart.client.vue +13 -6
- package/dist/runtime/components/SqlEditor.d.vue.ts +1 -1
- package/dist/runtime/components/SqlEditor.vue.d.ts +1 -1
- 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/form/field/DatePicker.vue +1 -1
- package/dist/runtime/components/sys/table/CreateModal.vue +31 -33
- package/dist/runtime/components/sys/table/Table.vue +6 -4
- 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/useRoleApi.js +3 -1
- package/dist/runtime/composables/api/sys/useUserApi.js +3 -1
- package/dist/runtime/composables/useDate.js +8 -8
- package/dist/runtime/composables/useEChart.d.ts +1 -3
- package/dist/runtime/composables/useEChart.js +155 -33
- 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/types/components/table/column.d.ts +4 -3
- package/dist/runtime/types/components/table/query/where.d.ts +1 -5
- package/dist/runtime/types/storage.d.ts +2 -1
- package/dist/runtime/types/storage.js +1 -0
- package/package.json +1 -1
- 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
package/dist/module.json
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { ref, useTemplateRef, watch } from "vue";
|
|
3
|
-
import { useTheme } from "#v/composables/useTheme";
|
|
4
|
-
import { useApp } from "#v/composables/useApp";
|
|
5
|
-
import { useEChart } from "#v/composables/useEChart";
|
|
6
2
|
import { use } from "echarts/core";
|
|
7
3
|
import { CanvasRenderer } from "echarts/renderers";
|
|
8
4
|
import { BarChart, PieChart, LineChart } from "echarts/charts";
|
|
@@ -14,7 +10,10 @@ import {
|
|
|
14
10
|
ToolboxComponent
|
|
15
11
|
} from "echarts/components";
|
|
16
12
|
import VChart from "vue-echarts";
|
|
17
|
-
import {
|
|
13
|
+
import { useTheme, useApp, useEChart } from "#v/composables";
|
|
14
|
+
import { useColorMode, useLocalStorage } from "@vueuse/core";
|
|
15
|
+
import { ref, useTemplateRef, watch } from "vue";
|
|
16
|
+
import { StorageKey } from "#v/types";
|
|
18
17
|
const props = defineProps({
|
|
19
18
|
option: { type: null, required: true },
|
|
20
19
|
useBar: { type: Boolean, required: false, default: false },
|
|
@@ -47,13 +46,21 @@ const theme = useTheme();
|
|
|
47
46
|
const colorMode = useColorMode();
|
|
48
47
|
const app = useApp();
|
|
49
48
|
const echart = useEChart();
|
|
49
|
+
const rotateXAxisLabel = useLocalStorage(StorageKey.ECHART_ROTATE_X_AXIS_LABEL, false);
|
|
50
50
|
const finalOption = ref({});
|
|
51
51
|
const updateOption = () => {
|
|
52
52
|
finalOption.value = echart.mergeOption(props.option);
|
|
53
53
|
};
|
|
54
54
|
const chartRef = useTemplateRef("v-chart");
|
|
55
55
|
watch(
|
|
56
|
-
[
|
|
56
|
+
[
|
|
57
|
+
() => props.option,
|
|
58
|
+
colorMode,
|
|
59
|
+
() => theme.primary.value,
|
|
60
|
+
() => theme.neutral.value,
|
|
61
|
+
() => app.appConfig.value.radius,
|
|
62
|
+
() => rotateXAxisLabel.value
|
|
63
|
+
],
|
|
57
64
|
() => setTimeout(() => {
|
|
58
65
|
updateOption();
|
|
59
66
|
}, 1),
|
|
@@ -16,8 +16,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
|
16
16
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
17
17
|
"onUpdate:modelValue"?: ((value: string | null | undefined) => any) | undefined;
|
|
18
18
|
}>, {
|
|
19
|
-
tables: string[];
|
|
20
19
|
columns: Record<string, string[]>;
|
|
20
|
+
tables: string[];
|
|
21
21
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
22
22
|
declare const _default: typeof __VLS_export;
|
|
23
23
|
export default _default;
|
|
@@ -16,8 +16,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
|
16
16
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
17
17
|
"onUpdate:modelValue"?: ((value: string | null | undefined) => any) | undefined;
|
|
18
18
|
}>, {
|
|
19
|
-
tables: string[];
|
|
20
19
|
columns: Record<string, string[]>;
|
|
20
|
+
tables: string[];
|
|
21
21
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
22
22
|
declare const _default: typeof __VLS_export;
|
|
23
23
|
export default _default;
|
|
@@ -86,8 +86,12 @@ defineExpose({
|
|
|
86
86
|
:model-value="commandPaletteModelValue"
|
|
87
87
|
:selection-behavior="multiple ? 'toggle' : 'replace'"
|
|
88
88
|
:groups="groups"
|
|
89
|
+
size="sm"
|
|
89
90
|
:multiple="multiple"
|
|
90
|
-
:ui="{
|
|
91
|
+
:ui="{
|
|
92
|
+
input: '[&>input]:h-7',
|
|
93
|
+
itemLeadingIcon: 'size-3 self-center'
|
|
94
|
+
}"
|
|
91
95
|
placeholder="搜索"
|
|
92
96
|
:search-term="searchTerm"
|
|
93
97
|
@update:model-value="(newValue) => {
|
|
@@ -2,6 +2,8 @@ import type { InputProps } from '@nuxt/ui';
|
|
|
2
2
|
type __VLS_Props = {
|
|
3
3
|
placeholder?: InputProps['placeholder'];
|
|
4
4
|
size?: InputProps['size'];
|
|
5
|
+
icon?: InputProps['icon'];
|
|
6
|
+
inputClass?: string;
|
|
5
7
|
};
|
|
6
8
|
type __VLS_ModelProps = {
|
|
7
9
|
'value': undefined | string;
|
|
@@ -10,9 +12,15 @@ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
|
10
12
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
11
13
|
focus: () => any;
|
|
12
14
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
15
|
+
blur: (e: FocusEvent) => any;
|
|
16
|
+
focus: (e: FocusEvent) => any;
|
|
13
17
|
"update:value": (value: string | undefined) => any;
|
|
14
18
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
19
|
+
onBlur?: ((e: FocusEvent) => any) | undefined;
|
|
20
|
+
onFocus?: ((e: FocusEvent) => any) | undefined;
|
|
15
21
|
"onUpdate:value"?: ((value: string | undefined) => any) | undefined;
|
|
16
|
-
}>, {
|
|
22
|
+
}>, {
|
|
23
|
+
icon: InputProps["icon"];
|
|
24
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
17
25
|
declare const _default: typeof __VLS_export;
|
|
18
26
|
export default _default;
|
|
@@ -1,12 +1,52 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { useTemplateRef } from "vue";
|
|
2
|
+
import { ref, watch, computed, useTemplateRef } from "vue";
|
|
3
3
|
import { vMaska } from "maska/vue";
|
|
4
|
+
import dayjs from "dayjs";
|
|
4
5
|
defineProps({
|
|
5
6
|
placeholder: { type: String, required: false },
|
|
6
|
-
size: { type: null, required: false }
|
|
7
|
+
size: { type: null, required: false },
|
|
8
|
+
icon: { type: null, required: false, default: "i-lucide-calendar" },
|
|
9
|
+
inputClass: { type: String, required: false }
|
|
7
10
|
});
|
|
8
11
|
const value = defineModel("value", { type: null, ...{ required: true } });
|
|
12
|
+
const emit = defineEmits(["focus", "blur"]);
|
|
9
13
|
const input = useTemplateRef("input");
|
|
14
|
+
const inputBuffer = ref(value.value ?? "");
|
|
15
|
+
let isInternalUpdate = false;
|
|
16
|
+
watch(value, (newVal) => {
|
|
17
|
+
if (isInternalUpdate) return;
|
|
18
|
+
inputBuffer.value = newVal ?? "";
|
|
19
|
+
});
|
|
20
|
+
const isValidDate = (str) => {
|
|
21
|
+
if (!str || str.length < 10) return false;
|
|
22
|
+
return dayjs(str, "YYYY-MM-DD", true).isValid();
|
|
23
|
+
};
|
|
24
|
+
const isInvalid = computed(() => {
|
|
25
|
+
const buf = inputBuffer.value;
|
|
26
|
+
if (!buf || buf.length === 0) return false;
|
|
27
|
+
return !isValidDate(buf);
|
|
28
|
+
});
|
|
29
|
+
const onInput = () => {
|
|
30
|
+
const buf = inputBuffer.value;
|
|
31
|
+
if (!buf || buf.length === 0) {
|
|
32
|
+
isInternalUpdate = true;
|
|
33
|
+
value.value = void 0;
|
|
34
|
+
isInternalUpdate = false;
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (isValidDate(buf)) {
|
|
38
|
+
isInternalUpdate = true;
|
|
39
|
+
value.value = buf;
|
|
40
|
+
isInternalUpdate = false;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
const handleClear = () => {
|
|
44
|
+
inputBuffer.value = "";
|
|
45
|
+
isInternalUpdate = true;
|
|
46
|
+
value.value = void 0;
|
|
47
|
+
isInternalUpdate = false;
|
|
48
|
+
input.value?.inputRef?.focus();
|
|
49
|
+
};
|
|
10
50
|
defineExpose({
|
|
11
51
|
focus: () => input.value?.inputRef?.focus()
|
|
12
52
|
});
|
|
@@ -15,24 +55,28 @@ defineExpose({
|
|
|
15
55
|
<template>
|
|
16
56
|
<UInput
|
|
17
57
|
ref="input"
|
|
18
|
-
v-model="
|
|
19
|
-
v-maska="'
|
|
58
|
+
v-model="inputBuffer"
|
|
59
|
+
v-maska="'####-##-##'"
|
|
20
60
|
size="sm"
|
|
21
|
-
class="
|
|
22
|
-
|
|
61
|
+
class="font-semibold"
|
|
62
|
+
:class="inputClass"
|
|
63
|
+
:icon="icon"
|
|
23
64
|
:placeholder="placeholder"
|
|
65
|
+
:color="isInvalid ? 'error' : 'neutral'"
|
|
66
|
+
:highlight="isInvalid"
|
|
67
|
+
@input="onInput"
|
|
68
|
+
@focus="(e) => emit('focus', e)"
|
|
69
|
+
@blur="(e) => emit('blur', e)"
|
|
24
70
|
>
|
|
25
|
-
<template v-if="
|
|
71
|
+
<template v-if="inputBuffer?.length" #trailing>
|
|
26
72
|
<UButton
|
|
27
73
|
color="neutral"
|
|
28
74
|
variant="link"
|
|
29
75
|
size="sm"
|
|
30
76
|
icon="i-lucide-circle-x"
|
|
31
77
|
aria-label="Clear input"
|
|
32
|
-
@
|
|
33
|
-
|
|
34
|
-
input?.inputRef?.focus();
|
|
35
|
-
}"
|
|
78
|
+
@mousedown.prevent
|
|
79
|
+
@click="handleClear"
|
|
36
80
|
/>
|
|
37
81
|
</template>
|
|
38
82
|
</UInput>
|
|
@@ -2,6 +2,8 @@ import type { InputProps } from '@nuxt/ui';
|
|
|
2
2
|
type __VLS_Props = {
|
|
3
3
|
placeholder?: InputProps['placeholder'];
|
|
4
4
|
size?: InputProps['size'];
|
|
5
|
+
icon?: InputProps['icon'];
|
|
6
|
+
inputClass?: string;
|
|
5
7
|
};
|
|
6
8
|
type __VLS_ModelProps = {
|
|
7
9
|
'value': undefined | string;
|
|
@@ -10,9 +12,15 @@ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
|
10
12
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
11
13
|
focus: () => any;
|
|
12
14
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
15
|
+
blur: (e: FocusEvent) => any;
|
|
16
|
+
focus: (e: FocusEvent) => any;
|
|
13
17
|
"update:value": (value: string | undefined) => any;
|
|
14
18
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
19
|
+
onBlur?: ((e: FocusEvent) => any) | undefined;
|
|
20
|
+
onFocus?: ((e: FocusEvent) => any) | undefined;
|
|
15
21
|
"onUpdate:value"?: ((value: string | undefined) => any) | undefined;
|
|
16
|
-
}>, {
|
|
22
|
+
}>, {
|
|
23
|
+
icon: InputProps["icon"];
|
|
24
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
17
25
|
declare const _default: typeof __VLS_export;
|
|
18
26
|
export default _default;
|
|
@@ -169,19 +169,19 @@ defineExpose({
|
|
|
169
169
|
<DatePickerInput
|
|
170
170
|
ref="startDateStrValueInput"
|
|
171
171
|
v-model:value="startDateStrValue"
|
|
172
|
-
placeholder="YYYY
|
|
172
|
+
placeholder="YYYY-MM-DD 开始日期"
|
|
173
173
|
/>
|
|
174
174
|
<DatePickerInput
|
|
175
175
|
ref="endDateStrValueInput"
|
|
176
176
|
v-model:value="endDateStrValue"
|
|
177
|
-
placeholder="YYYY
|
|
177
|
+
placeholder="YYYY-MM-DD 结束日期"
|
|
178
178
|
/>
|
|
179
179
|
</div>
|
|
180
180
|
<DatePickerInput
|
|
181
181
|
v-else
|
|
182
182
|
ref="singleDateStrValueInput"
|
|
183
183
|
v-model:value="singleDateStrValue"
|
|
184
|
-
placeholder="YYYY
|
|
184
|
+
placeholder="YYYY-MM-DD 日期"
|
|
185
185
|
/>
|
|
186
186
|
<UCalendar
|
|
187
187
|
:model-value="modelValue"
|
|
@@ -5,7 +5,8 @@ import FormCreateModalTemplate from "#v/components/form/create-modal-template/in
|
|
|
5
5
|
import ProSimpleTable from "#v/components/simple-table/index.vue";
|
|
6
6
|
import TableColumnModal from "./TableColumnModal.vue";
|
|
7
7
|
import { useFormSubmission, useFormValues, useTableApi, useTableColumnApi } from "#v/composables";
|
|
8
|
-
import { computed, ref, toRef, onMounted } from "vue";
|
|
8
|
+
import { computed, ref, toRef, onMounted, h } from "vue";
|
|
9
|
+
import UButton from "@nuxt/ui/components/Button.vue";
|
|
9
10
|
const props = defineProps({
|
|
10
11
|
model: { type: Object, required: true }
|
|
11
12
|
});
|
|
@@ -30,12 +31,12 @@ async function fetchColumns() {
|
|
|
30
31
|
if (data.value.data) {
|
|
31
32
|
columns.value = data.value.data.list.map((col) => ({
|
|
32
33
|
id: col.id,
|
|
33
|
-
columnKey: col.columnKey,
|
|
34
|
-
label: col.label,
|
|
35
|
-
order: col.order,
|
|
36
|
-
width: col.width,
|
|
37
|
-
fixed: col.fixed,
|
|
38
|
-
visible: col.visible
|
|
34
|
+
columnKey: col.columnKey ?? "",
|
|
35
|
+
label: col.label ?? "",
|
|
36
|
+
order: col.order ?? 0,
|
|
37
|
+
width: col.width ?? 100,
|
|
38
|
+
fixed: col.fixed ?? "",
|
|
39
|
+
visible: col.visible ?? true
|
|
39
40
|
}));
|
|
40
41
|
}
|
|
41
42
|
loading.value = false;
|
|
@@ -56,6 +57,7 @@ function addColumn() {
|
|
|
56
57
|
}
|
|
57
58
|
function removeColumn(index) {
|
|
58
59
|
const col = columns.value[index];
|
|
60
|
+
if (!col) return;
|
|
59
61
|
if (col.id !== 0) {
|
|
60
62
|
deletedColumnIds.value.push(col.id);
|
|
61
63
|
}
|
|
@@ -63,6 +65,7 @@ function removeColumn(index) {
|
|
|
63
65
|
}
|
|
64
66
|
async function editColumn(index) {
|
|
65
67
|
const col = columns.value[index];
|
|
68
|
+
if (!col) return;
|
|
66
69
|
const isNew = col.id === 0;
|
|
67
70
|
if (isNew) {
|
|
68
71
|
return;
|
|
@@ -100,43 +103,38 @@ const tableColumns = [
|
|
|
100
103
|
size: 80,
|
|
101
104
|
cell: ({ row }) => {
|
|
102
105
|
const fixedMap = { "": "\u5426", left: "\u5DE6", right: "\u53F3" };
|
|
103
|
-
return fixedMap[row.fixed] ?? "\u5426";
|
|
106
|
+
return fixedMap[row.original.fixed] ?? "\u5426";
|
|
104
107
|
}
|
|
105
108
|
},
|
|
106
109
|
{
|
|
107
110
|
accessorKey: "visible",
|
|
108
111
|
header: "\u663E\u793A",
|
|
109
112
|
size: 60,
|
|
110
|
-
cell: ({ row }) => row.visible ? "\u662F" : "\u5426"
|
|
113
|
+
cell: ({ row }) => row.original.visible ? "\u662F" : "\u5426"
|
|
111
114
|
},
|
|
112
115
|
{
|
|
113
116
|
accessorKey: "actions",
|
|
114
117
|
header: "\u64CD\u4F5C",
|
|
115
118
|
size: 100,
|
|
116
|
-
cell: ({ row
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
size: "xs",
|
|
136
|
-
onClick: () => removeColumn(index)
|
|
137
|
-
}
|
|
138
|
-
]
|
|
139
|
-
};
|
|
119
|
+
cell: ({ row }) => {
|
|
120
|
+
const index = columns.value.findIndex((c) => c === row.original);
|
|
121
|
+
return h("div", { class: "flex gap-1" }, [
|
|
122
|
+
h(UButton, {
|
|
123
|
+
label: "\u7F16\u8F91",
|
|
124
|
+
icon: "i-lucide-edit",
|
|
125
|
+
variant: "ghost",
|
|
126
|
+
size: "xs",
|
|
127
|
+
onClick: () => editColumn(index)
|
|
128
|
+
}),
|
|
129
|
+
h(UButton, {
|
|
130
|
+
label: "\u5220\u9664",
|
|
131
|
+
icon: "i-lucide-trash-2",
|
|
132
|
+
color: "error",
|
|
133
|
+
variant: "ghost",
|
|
134
|
+
size: "xs",
|
|
135
|
+
onClick: () => removeColumn(index)
|
|
136
|
+
})
|
|
137
|
+
]);
|
|
140
138
|
}
|
|
141
139
|
}
|
|
142
140
|
];
|
|
@@ -47,20 +47,22 @@ async function fetchTableMeta(tables) {
|
|
|
47
47
|
await Promise.all(
|
|
48
48
|
tables.map(async (table) => {
|
|
49
49
|
const [columnResult, permissionResult] = await Promise.all([
|
|
50
|
-
tableColumnApi.
|
|
50
|
+
tableColumnApi.list({
|
|
51
|
+
pagination: { pageNum: 1, pageSize: 1 },
|
|
51
52
|
whereQuery: {
|
|
52
53
|
items: [{ field: "tableId", value: table.id, opr: "eq" }]
|
|
53
54
|
}
|
|
54
55
|
}),
|
|
55
|
-
tablePermissionApi.
|
|
56
|
+
tablePermissionApi.list({
|
|
57
|
+
pagination: { pageNum: 1, pageSize: 1 },
|
|
56
58
|
whereQuery: {
|
|
57
59
|
items: [{ field: "tableId", value: table.id, opr: "eq" }]
|
|
58
60
|
}
|
|
59
61
|
})
|
|
60
62
|
]);
|
|
61
63
|
newMeta[table.id] = {
|
|
62
|
-
columnCount: columnResult.data.value?.data ?? 0,
|
|
63
|
-
permissionCount: permissionResult.data.value?.data ?? 0
|
|
64
|
+
columnCount: columnResult.data.value?.data?.total ?? 0,
|
|
65
|
+
permissionCount: permissionResult.data.value?.data?.total ?? 0
|
|
64
66
|
};
|
|
65
67
|
})
|
|
66
68
|
);
|
|
@@ -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) {
|
|
@@ -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;
|
|
@@ -10,23 +10,26 @@ const toast = useToast();
|
|
|
10
10
|
const tablePermissionConfigModal = overlay.create(TablePermissionConfig);
|
|
11
11
|
function openAddModal() {
|
|
12
12
|
tablePermissionConfigModal.open({}).result.then((result) => {
|
|
13
|
-
if (result
|
|
14
|
-
const
|
|
13
|
+
if (result && typeof result === "object") {
|
|
14
|
+
const saved = result;
|
|
15
|
+
const newPermissions = [...props.modelValue, saved];
|
|
15
16
|
emit("update:modelValue", newPermissions);
|
|
16
17
|
}
|
|
17
18
|
});
|
|
18
19
|
}
|
|
19
20
|
function openEditModal(permission) {
|
|
20
21
|
tablePermissionConfigModal.open({ permission }).result.then((result) => {
|
|
21
|
-
if (result
|
|
22
|
+
if (result && typeof result === "object") {
|
|
23
|
+
const saved = result;
|
|
22
24
|
const newPermissions = props.modelValue.map(
|
|
23
|
-
(p) => p.tableId ===
|
|
25
|
+
(p) => p.tableId === saved.tableId ? saved : p
|
|
24
26
|
);
|
|
25
27
|
emit("update:modelValue", newPermissions);
|
|
26
28
|
}
|
|
27
29
|
});
|
|
28
30
|
}
|
|
29
31
|
function removePermission(tableId) {
|
|
32
|
+
if (tableId === void 0) return;
|
|
30
33
|
toast.add({
|
|
31
34
|
title: "\u786E\u8BA4\u5220\u9664",
|
|
32
35
|
description: "\u786E\u5B9A\u8981\u5220\u9664\u8BE5 Table \u6743\u9650\u5417\uFF1F",
|
|
@@ -7,15 +7,15 @@ declare const __VLS_export: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_se
|
|
|
7
7
|
orderOptions: OrderQueryOption<T>[];
|
|
8
8
|
unselectedFields: string[];
|
|
9
9
|
} & {
|
|
10
|
-
onChange?: ((args_0: string, args_1: OrderQueryOpr) => any) | undefined;
|
|
11
10
|
onRemove?: (() => any) | undefined;
|
|
11
|
+
onChange?: ((args_0: string, args_1: OrderQueryOpr) => any) | undefined;
|
|
12
12
|
}> & (typeof globalThis extends {
|
|
13
13
|
__VLS_PROPS_FALLBACK: infer P;
|
|
14
14
|
} ? P : {});
|
|
15
15
|
expose: (exposed: {}) => void;
|
|
16
16
|
attrs: any;
|
|
17
17
|
slots: {};
|
|
18
|
-
emit: ((evt: "
|
|
18
|
+
emit: ((evt: "remove") => void) & ((evt: "change", args_0: string, args_1: OrderQueryOpr) => void);
|
|
19
19
|
}>) => import("vue").VNode & {
|
|
20
20
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
21
21
|
};
|