v-nuxt-ui 0.2.24 → 0.2.26

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.
Files changed (88) hide show
  1. package/README.md +6 -0
  2. package/dist/module.json +1 -1
  3. package/dist/runtime/components/AsyncSelect.vue +16 -1
  4. package/dist/runtime/components/AsyncTreeSelect.vue +15 -9
  5. package/dist/runtime/components/DeleteModal.d.vue.ts +25 -22
  6. package/dist/runtime/components/DeleteModal.vue +39 -4
  7. package/dist/runtime/components/DeleteModal.vue.d.ts +25 -22
  8. package/dist/runtime/components/ScrollArea.vue +20 -9
  9. package/dist/runtime/components/form/field/AsyncObjectSelect.vue +14 -3
  10. package/dist/runtime/components/form/save-model-template/ConfirmUpdateModal.d.vue.ts +19 -0
  11. package/dist/runtime/components/form/save-model-template/ConfirmUpdateModal.vue +111 -0
  12. package/dist/runtime/components/form/save-model-template/ConfirmUpdateModal.vue.d.ts +19 -0
  13. package/dist/runtime/components/form/{create-modal-template → save-model-template}/WithApi.d.vue.ts +2 -2
  14. package/dist/runtime/components/form/{create-modal-template → save-model-template}/WithApi.vue +4 -3
  15. package/dist/runtime/components/form/{create-modal-template → save-model-template}/WithApi.vue.d.ts +2 -2
  16. package/dist/runtime/components/form/{create-modal-template → save-model-template}/index.d.vue.ts +2 -2
  17. package/dist/runtime/components/form/{create-modal-template → save-model-template}/index.vue +54 -7
  18. package/dist/runtime/components/form/{create-modal-template → save-model-template}/index.vue.d.ts +2 -2
  19. package/dist/runtime/components/layout/button/UserMenu.vue +1 -2
  20. package/dist/runtime/components/sys/company/{CreateModal.vue → SaveModal.vue} +2 -2
  21. package/dist/runtime/components/sys/company/Table.vue +5 -4
  22. package/dist/runtime/components/sys/department/{CreateModal.vue → SaveModal.vue} +3 -2
  23. package/dist/runtime/components/sys/department/Table.vue +6 -5
  24. package/dist/runtime/components/sys/flow/EditNodeModal.vue +4 -3
  25. package/dist/runtime/components/sys/flow/{CreateModal.vue → SaveModal.vue} +3 -2
  26. package/dist/runtime/components/sys/flow/Table.vue +5 -4
  27. package/dist/runtime/components/sys/issue-record/{CreateModal.vue → SaveModal.vue} +2 -2
  28. package/dist/runtime/components/sys/issue-record/Table.vue +5 -4
  29. package/dist/runtime/components/sys/job-title/{CreateModal.vue → SaveModal.vue} +2 -2
  30. package/dist/runtime/components/sys/job-title/Table.vue +5 -4
  31. package/dist/runtime/components/sys/menu/{CreateModal.vue → SaveModal.vue} +3 -2
  32. package/dist/runtime/components/sys/menu/Table.vue +6 -5
  33. package/dist/runtime/components/sys/role/{CreateModal.vue → SaveModal.vue} +8 -5
  34. package/dist/runtime/components/sys/role/Table.vue +5 -4
  35. package/dist/runtime/components/sys/table/{CreateModal.vue → SaveModal.vue} +4 -3
  36. package/dist/runtime/components/sys/table/Table.vue +4 -4
  37. package/dist/runtime/components/sys/table/TableColumnModal.vue +4 -3
  38. package/dist/runtime/components/sys/user/{CreateModal.vue → SaveModal.vue} +4 -3
  39. package/dist/runtime/components/sys/user/Table.vue +7 -6
  40. package/dist/runtime/components/table/Page.vue +2 -1
  41. package/dist/runtime/components/table/UpdateDiffModal.d.vue.ts +14 -0
  42. package/dist/runtime/components/table/UpdateDiffModal.vue +156 -0
  43. package/dist/runtime/components/table/UpdateDiffModal.vue.d.ts +14 -0
  44. package/dist/runtime/components/table/header/index.vue +181 -183
  45. package/dist/runtime/components/table/index.vue +2 -1
  46. package/dist/runtime/composables/form/index.d.ts +2 -0
  47. package/dist/runtime/composables/form/index.js +2 -0
  48. package/dist/runtime/composables/form/useForm.d.ts +21 -0
  49. package/dist/runtime/composables/{useForm.js → form/useForm.js} +23 -1
  50. package/dist/runtime/composables/form/useFormUpdate.d.ts +6 -0
  51. package/dist/runtime/composables/form/useFormUpdate.js +101 -0
  52. package/dist/runtime/composables/index.d.ts +1 -1
  53. package/dist/runtime/composables/index.js +1 -1
  54. package/dist/runtime/composables/table/useTable.js +10 -1
  55. package/dist/runtime/composables/table/useTableRowActions.d.ts +3 -0
  56. package/dist/runtime/composables/table/useTableRowActions.js +24 -0
  57. package/dist/runtime/composables/useDate.js +2 -0
  58. package/dist/runtime/types/components/form/field.d.ts +2 -0
  59. package/dist/runtime/types/components/form/index.d.ts +4 -3
  60. package/dist/runtime/types/components/table/header.d.ts +2 -0
  61. package/dist/runtime/types/components/table/index.d.ts +1 -0
  62. package/dist/runtime/types/time.d.ts +1 -1
  63. package/dist/runtime/utils/cron.d.ts +1 -0
  64. package/dist/runtime/utils/cron.js +182 -0
  65. package/dist/runtime/utils/index.d.ts +1 -0
  66. package/dist/runtime/utils/index.js +1 -0
  67. package/dist/runtime/utils/vueuse.d.ts +1 -1
  68. package/dist/runtime/utils/vueuse.js +1 -0
  69. package/package.json +16 -15
  70. package/dist/runtime/composables/useForm.d.ts +0 -9
  71. /package/dist/runtime/components/sys/company/{CreateModal.d.vue.ts → SaveModal.d.vue.ts} +0 -0
  72. /package/dist/runtime/components/sys/company/{CreateModal.vue.d.ts → SaveModal.vue.d.ts} +0 -0
  73. /package/dist/runtime/components/sys/department/{CreateModal.d.vue.ts → SaveModal.d.vue.ts} +0 -0
  74. /package/dist/runtime/components/sys/department/{CreateModal.vue.d.ts → SaveModal.vue.d.ts} +0 -0
  75. /package/dist/runtime/components/sys/flow/{CreateModal.d.vue.ts → SaveModal.d.vue.ts} +0 -0
  76. /package/dist/runtime/components/sys/flow/{CreateModal.vue.d.ts → SaveModal.vue.d.ts} +0 -0
  77. /package/dist/runtime/components/sys/issue-record/{CreateModal.d.vue.ts → SaveModal.d.vue.ts} +0 -0
  78. /package/dist/runtime/components/sys/issue-record/{CreateModal.vue.d.ts → SaveModal.vue.d.ts} +0 -0
  79. /package/dist/runtime/components/sys/job-title/{CreateModal.d.vue.ts → SaveModal.d.vue.ts} +0 -0
  80. /package/dist/runtime/components/sys/job-title/{CreateModal.vue.d.ts → SaveModal.vue.d.ts} +0 -0
  81. /package/dist/runtime/components/sys/menu/{CreateModal.d.vue.ts → SaveModal.d.vue.ts} +0 -0
  82. /package/dist/runtime/components/sys/menu/{CreateModal.vue.d.ts → SaveModal.vue.d.ts} +0 -0
  83. /package/dist/runtime/components/sys/role/{CreateModal.d.vue.ts → SaveModal.d.vue.ts} +0 -0
  84. /package/dist/runtime/components/sys/role/{CreateModal.vue.d.ts → SaveModal.vue.d.ts} +0 -0
  85. /package/dist/runtime/components/sys/table/{CreateModal.d.vue.ts → SaveModal.d.vue.ts} +0 -0
  86. /package/dist/runtime/components/sys/table/{CreateModal.vue.d.ts → SaveModal.vue.d.ts} +0 -0
  87. /package/dist/runtime/components/sys/user/{CreateModal.d.vue.ts → SaveModal.d.vue.ts} +0 -0
  88. /package/dist/runtime/components/sys/user/{CreateModal.vue.d.ts → SaveModal.vue.d.ts} +0 -0
@@ -1,13 +1,16 @@
1
1
  <script setup>
2
- import { computed, useTemplateRef } from "vue";
3
- import { useSubmitting } from "#v/composables/useBoolean";
2
+ import { computed, ref, useTemplateRef } from "vue";
3
+ import { useOverlay } from "@nuxt/ui/composables";
4
+ import { useSubmitting } from "#v/composables";
4
5
  import Form from "../index.vue";
6
+ import ConfirmUpdateModal from "./ConfirmUpdateModal.vue";
5
7
  const props = defineProps({
6
8
  title: { type: String, required: true },
7
9
  description: { type: String, required: false },
8
10
  onClose: { type: Function, required: true },
9
11
  onSubmit: { type: Function, required: true },
10
12
  fields: { type: Array, required: true },
13
+ oldModelValue: { type: Object, required: true },
11
14
  modelValue: { type: Object, required: true },
12
15
  onUpdateModelValue: { type: Function, required: false },
13
16
  rowKey: { type: null, required: false, default: "id" },
@@ -15,10 +18,42 @@ const props = defineProps({
15
18
  });
16
19
  const form = useTemplateRef("form");
17
20
  const action = computed(() => props.modelValue[props.rowKey] === 0 ? "\u521B\u5EFA" : "\u66F4\u65B0");
21
+ const isUpdate = computed(() => props.modelValue[props.rowKey] !== 0);
18
22
  const titleWithAction = computed(() => `${action.value}${props.title}`);
19
23
  const descWithAction = computed(() => props.description ?? `\u8BF7${action.value}${props.title}`);
20
24
  const submitIcon = computed(() => props.modelValue[props.rowKey] === 0 ? "i-lucide-clipboard-plus" : "i-lucide-clipboard-pen-line");
25
+ const initialModelValue = ref(JSON.parse(JSON.stringify(props.modelValue)));
26
+ const overlay = useOverlay();
27
+ const confirmModal = overlay.create(ConfirmUpdateModal);
28
+ function computeDiff() {
29
+ const items = [];
30
+ for (const field of props.fields) {
31
+ if (!field.name || field.hidden) continue;
32
+ const name = field.name;
33
+ const oldVal = initialModelValue.value[name];
34
+ const newVal = props.modelValue[name];
35
+ if ((oldVal === null || oldVal === void 0) && (newVal === null || newVal === void 0)) continue;
36
+ if (oldVal === newVal) continue;
37
+ if (typeof oldVal === "object" && typeof newVal === "object" && oldVal !== null && newVal !== null) {
38
+ if (JSON.stringify(oldVal) === JSON.stringify(newVal)) continue;
39
+ }
40
+ items.push({
41
+ fieldName: name,
42
+ oldValue: oldVal,
43
+ newValue: newVal
44
+ });
45
+ }
46
+ return items;
47
+ }
21
48
  const { submitting, startSubmitting, endSubmitting } = useSubmitting();
49
+ async function doSubmit() {
50
+ try {
51
+ startSubmitting();
52
+ await props.onSubmit();
53
+ } finally {
54
+ endSubmitting();
55
+ }
56
+ }
22
57
  async function onSubmitWithValidation(e) {
23
58
  e.preventDefault();
24
59
  e.stopPropagation();
@@ -27,12 +62,24 @@ async function onSubmitWithValidation(e) {
27
62
  } catch {
28
63
  return;
29
64
  }
30
- try {
31
- startSubmitting();
32
- await props.onSubmit();
33
- } finally {
34
- endSubmitting();
65
+ if (isUpdate.value) {
66
+ const items = computeDiff();
67
+ if (items.length === 0) {
68
+ await doSubmit();
69
+ return;
70
+ }
71
+ const confirmed = await confirmModal.open({
72
+ fields: props.fields,
73
+ diffItems: items,
74
+ oldModelValue: props.oldModelValue,
75
+ newModelValue: props.modelValue
76
+ }).result;
77
+ if (confirmed) {
78
+ await doSubmit();
79
+ }
80
+ return;
35
81
  }
82
+ await doSubmit();
36
83
  }
37
84
  </script>
38
85
 
@@ -1,6 +1,6 @@
1
- import type { BaseModel, CreateModalFormTemplateProps } from '#v/types';
1
+ import type { BaseModel, SaveModalFormTemplateProps } from '#v/types';
2
2
  declare const __VLS_export: <T extends BaseModel>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
3
- props: import("vue").PublicProps & __VLS_PrettifyLocal<CreateModalFormTemplateProps<T>> & (typeof globalThis extends {
3
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<SaveModalFormTemplateProps<T>> & (typeof globalThis extends {
4
4
  __VLS_PROPS_FALLBACK: infer P;
5
5
  } ? P : {});
6
6
  expose: (exposed: {}) => void;
@@ -1,5 +1,5 @@
1
1
  <script setup>
2
- import { useAuth, useApp } from "#v/composables";
2
+ import { useAuth } from "#v/composables";
3
3
  import { useRoute } from "nuxt/app";
4
4
  import { getEmojiFlag } from "#v/utils";
5
5
  import { computed } from "vue";
@@ -8,7 +8,6 @@ defineProps({
8
8
  headerMode: { type: Boolean, required: false }
9
9
  });
10
10
  const auth = useAuth();
11
- const app = useApp();
12
11
  const route = useRoute();
13
12
  const items = computed(() => [
14
13
  [
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
2
  import * as z from "zod";
3
- import FormCreateModalTemplateWithApi from "#v/components/form/create-modal-template/WithApi.vue";
3
+ import FormSaveModelTemplateWithApi from "#v/components/form/save-model-template/WithApi.vue";
4
4
  import { useCompanyApi } from "#v/composables";
5
5
  defineProps({
6
6
  model: { type: Object, required: true }
@@ -9,7 +9,7 @@ const emit = defineEmits(["close", "save"]);
9
9
  </script>
10
10
 
11
11
  <template>
12
- <FormCreateModalTemplateWithApi
12
+ <FormSaveModelTemplateWithApi
13
13
  title="公司信息"
14
14
  :on-close="(ok) => emit('close', ok)"
15
15
  :on-save="(model) => emit('save', model)"
@@ -1,11 +1,11 @@
1
1
  <script setup>
2
2
  import { useOverlay } from "@nuxt/ui/composables";
3
3
  import { useCompanyApi } from "#v/composables";
4
- import SysCompaniesCreateModal from "./CreateModal.vue";
4
+ import SysCompaniesSaveModal from "./SaveModal.vue";
5
5
  import { getOprColumns } from "#v/constants";
6
6
  import TablePage from "#v/components/table/Page.vue";
7
7
  const overlay = useOverlay();
8
- const createModal = overlay.create(SysCompaniesCreateModal);
8
+ const saveModal = overlay.create(SysCompaniesSaveModal);
9
9
  const columns = [
10
10
  {
11
11
  accessorKey: "fullname",
@@ -41,13 +41,14 @@ const columns = [
41
41
 
42
42
  <template>
43
43
  <TablePage
44
- name="sys-company"
44
+ name="companies"
45
45
  cn-name="公司信息"
46
46
  :use-api-group="useCompanyApi"
47
47
  :biz-columns="columns"
48
48
  :extra-order-query-options="[
49
49
  { field: 'createdAt', label: '\u521B\u5EFA\u65F6\u95F4', defaultOpr: 'desc' }
50
50
  ]"
51
- @edit-row-from-modal="async (row) => await createModal.open({ model: row }).result"
51
+ :display-fn-in-delete-modal="(model) => model.fullname"
52
+ @edit-row-from-modal="async (row) => await saveModal.open({ model: row }).result"
52
53
  />
53
54
  </template>
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
2
  import * as z from "zod";
3
- import FormCreateModalTemplate from "#v/components/form/create-modal-template/index.vue";
3
+ import FormSaveModelTemplate from "#v/components/form/save-model-template/index.vue";
4
4
  import { useCompanyApi, useDepartmentApi, useFormSubmission, useFormValues, useUserApi } from "#v/composables";
5
5
  import { toRef, watch } from "vue";
6
6
  const props = defineProps({
@@ -27,7 +27,7 @@ const { onSubmit } = useFormSubmission(
27
27
  </script>
28
28
 
29
29
  <template>
30
- <FormCreateModalTemplate
30
+ <FormSaveModelTemplate
31
31
  title="部门信息"
32
32
  :on-close="(ok) => emit('close', ok)"
33
33
  :fields="[
@@ -74,6 +74,7 @@ const { onSubmit } = useFormSubmission(
74
74
  }
75
75
  ]"
76
76
  :model-value="newValues"
77
+ :old-model-value="oldValues"
77
78
  @update-model-value="(newVal) => newValues = { id: 0, ...newVal }"
78
79
  @submit="onSubmit"
79
80
  />
@@ -1,11 +1,11 @@
1
1
  <script setup>
2
2
  import { useOverlay } from "@nuxt/ui/composables";
3
3
  import { useDepartmentApi } from "#v/composables";
4
- import SysDepartmentsCreateModal from "./CreateModal.vue";
4
+ import SysDepartmentsSaveModal from "./SaveModal.vue";
5
5
  import { getOprColumns } from "#v/constants";
6
6
  import TablePage from "#v/components/table/Page.vue";
7
7
  const overlay = useOverlay();
8
- const createModal = overlay.create(SysDepartmentsCreateModal);
8
+ const saveModal = overlay.create(SysDepartmentsSaveModal);
9
9
  const columns = [
10
10
  {
11
11
  accessorKey: "name",
@@ -40,7 +40,7 @@ const columns = [
40
40
 
41
41
  <template>
42
42
  <TablePage
43
- name="sys-department"
43
+ name="departments"
44
44
  cn-name="部门信息"
45
45
  :use-api-group="useDepartmentApi"
46
46
  :biz-columns="columns"
@@ -53,9 +53,10 @@ const columns = [
53
53
  icon: 'i-lucide-clipboard-plus',
54
54
  label: '\u4EE5\u6B64\u4F5C\u4E3A\u7236\u90E8\u95E8\u590D\u5236',
55
55
  asyncFn: async (raw) => {
56
- await createModal.open({ model: useDepartmentApi().copyAsParent?.(raw) ?? { id: 0 } });
56
+ await saveModal.open({ model: useDepartmentApi().copyAsParent?.(raw) ?? { id: 0 } });
57
57
  }
58
58
  }]"
59
- @edit-row-from-modal="async (row) => await createModal.open({ model: row }).result"
59
+ :display-fn-in-delete-modal="(model) => model.name"
60
+ @edit-row-from-modal="async (row) => await saveModal.open({ model: row }).result"
60
61
  />
61
62
  </template>
@@ -1,26 +1,27 @@
1
1
  <script setup>
2
2
  import * as z from "zod";
3
- import FormCreateModalTemplate from "#v/components/form/create-modal-template/index.vue";
3
+ import FormSaveModelTemplate from "#v/components/form/save-model-template/index.vue";
4
4
  import { useFormValues } from "#v/composables";
5
5
  import { toRef } from "vue";
6
6
  const props = defineProps({
7
7
  model: { type: Object, required: true }
8
8
  });
9
9
  const emit = defineEmits(["close", "save"]);
10
- const { newValues } = useFormValues(toRef(props.model), {
10
+ const { oldValues, newValues } = useFormValues(toRef(props.model), {
11
11
  id: 0,
12
12
  name: ""
13
13
  });
14
14
  </script>
15
15
 
16
16
  <template>
17
- <FormCreateModalTemplate
17
+ <FormSaveModelTemplate
18
18
  title="编辑节点"
19
19
  :on-close="(ok) => emit('close', ok)"
20
20
  :fields="[
21
21
  { name: 'name', type: 'input', label: '\u8282\u70B9\u540D\u79F0', colSpan: '24', zodType: z.string().min(1, '\u8BF7\u8F93\u5165\u8282\u70B9\u540D\u79F0') }
22
22
  ]"
23
23
  :model-value="newValues"
24
+ :old-model-value="oldValues"
24
25
  @update-model-value="(newVal) => newValues = { ...props.model, ...newVal }"
25
26
  @submit="async () => {
26
27
  emit('save', newValues);
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
2
  import * as z from "zod";
3
- import FormCreateModalTemplate from "#v/components/form/create-modal-template/index.vue";
3
+ import FormSaveModelTemplate from "#v/components/form/save-model-template/index.vue";
4
4
  import { useFlowApi, useFormSubmission, useFormValues } from "#v/composables";
5
5
  import { toRef } from "vue";
6
6
  const props = defineProps({
@@ -18,7 +18,7 @@ const { onSubmit } = useFormSubmission(
18
18
  </script>
19
19
 
20
20
  <template>
21
- <FormCreateModalTemplate
21
+ <FormSaveModelTemplate
22
22
  title="流程信息"
23
23
  :on-close="(ok) => emit('close', ok)"
24
24
  :fields="[
@@ -26,6 +26,7 @@ const { onSubmit } = useFormSubmission(
26
26
  { name: 'description', type: 'textarea', label: '\u6D41\u7A0B\u63CF\u8FF0', colSpan: '24' }
27
27
  ]"
28
28
  :model-value="newValues"
29
+ :old-model-value="oldValues"
29
30
  @update-model-value="(newVal) => newValues = { ...newValues, ...newVal }"
30
31
  @submit="onSubmit"
31
32
  />
@@ -5,10 +5,10 @@ import { getCreateAtColumn } from "#v/constants";
5
5
  import { useFlowApi, useFlowNodeApi, useFlowEdgeApi } from "#v/composables";
6
6
  import TablePage from "#v/components/table/Page.vue";
7
7
  import FlowEditor from "#v/components/flow/FlowEditor.client.vue";
8
- import CreateModal from "./CreateModal.vue";
8
+ import SaveModal from "./SaveModal.vue";
9
9
  import EditNodeModal from "./EditNodeModal.vue";
10
10
  const overlay = useOverlay();
11
- const createModal = overlay.create(CreateModal);
11
+ const saveModal = overlay.create(SaveModal);
12
12
  const editNodeModal = overlay.create(EditNodeModal);
13
13
  const tablePageRef = ref(null);
14
14
  const columns = [
@@ -87,12 +87,13 @@ function getExpandVNode(row) {
87
87
  <template>
88
88
  <TablePage
89
89
  ref="tablePageRef"
90
- name="sys-flow"
90
+ name="flows"
91
91
  cn-name="流程列表"
92
92
  :use-api-group="useFlowApi"
93
93
  :biz-columns="columns"
94
94
  expandable
95
95
  :expand-v-node="getExpandVNode"
96
- @edit-row-from-modal="async (row) => Boolean(await createModal.open({ model: { ...row } }).result)"
96
+ :display-fn-in-delete-modal="(model) => model.name"
97
+ @edit-row-from-modal="async (row) => Boolean(await saveModal.open({ model: { ...row } }).result)"
97
98
  />
98
99
  </template>
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
2
  import * as z from "zod";
3
- import FormCreateModalTemplateWithApi from "#v/components/form/create-modal-template/WithApi.vue";
3
+ import FormSaveModelTemplateWithApi from "#v/components/form/save-model-template/WithApi.vue";
4
4
  import { useIssueRecordApi } from "#v/composables";
5
5
  defineProps({
6
6
  model: { type: Object, required: true }
@@ -9,7 +9,7 @@ const emit = defineEmits(["close", "save"]);
9
9
  </script>
10
10
 
11
11
  <template>
12
- <FormCreateModalTemplateWithApi
12
+ <FormSaveModelTemplateWithApi
13
13
  title="改进建议"
14
14
  description="您可以针对该网页提出任何改进建议或直接联系chenrn@mail.veken.com"
15
15
  :on-close="(ok) => emit('close', ok)"
@@ -2,10 +2,10 @@
2
2
  import { getOprColumns } from "#v/constants";
3
3
  import { useOverlay } from "@nuxt/ui/composables";
4
4
  import { useIssueRecordApi } from "#v/composables";
5
- import SysIssueRecordsCreateModal from "./CreateModal.vue";
5
+ import SysIssueRecordsSaveModal from "./SaveModal.vue";
6
6
  import TablePage from "#v/components/table/Page.vue";
7
7
  const overlay = useOverlay();
8
- const createModal = overlay.create(SysIssueRecordsCreateModal);
8
+ const saveModal = overlay.create(SysIssueRecordsSaveModal);
9
9
  const columns = [
10
10
  {
11
11
  accessorKey: "description",
@@ -20,13 +20,14 @@ const columns = [
20
20
 
21
21
  <template>
22
22
  <TablePage
23
- name="sys-issue-record"
23
+ name="issue_records"
24
24
  cn-name="改进建议"
25
25
  :use-api-group="useIssueRecordApi"
26
26
  :biz-columns="columns"
27
27
  :extra-order-query-options="[
28
28
  { field: 'createdAt', label: '\u521B\u5EFA\u65F6\u95F4', defaultOpr: 'desc' }
29
29
  ]"
30
- @edit-row-from-modal="async (row) => await createModal.open({ model: row }).result"
30
+ :display-fn-in-delete-modal="(model) => model.description"
31
+ @edit-row-from-modal="async (row) => await saveModal.open({ model: row }).result"
31
32
  />
32
33
  </template>
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
2
  import * as z from "zod";
3
- import FormCreateModalTemplateWithApi from "#v/components/form/create-modal-template/WithApi.vue";
3
+ import FormSaveModelTemplateWithApi from "#v/components/form/save-model-template/WithApi.vue";
4
4
  import { useJobTitleApi } from "#v/composables";
5
5
  defineProps({
6
6
  model: { type: Object, required: true }
@@ -9,7 +9,7 @@ const emit = defineEmits(["close", "save"]);
9
9
  </script>
10
10
 
11
11
  <template>
12
- <FormCreateModalTemplateWithApi
12
+ <FormSaveModelTemplateWithApi
13
13
  title="职位信息"
14
14
  :on-close="(ok) => emit('close', ok)"
15
15
  :on-save="(model) => emit('save', model)"
@@ -1,13 +1,13 @@
1
1
  <script setup>
2
2
  import { useOverlay } from "@nuxt/ui/composables";
3
3
  import { useJobTitleApi } from "#v/composables";
4
- import SysJobTitlesCreateModal from "./CreateModal.vue";
4
+ import SysJobTitlesSaveModal from "./SaveModal.vue";
5
5
  import { getOprColumns, booleanOptions } from "#v/constants";
6
6
  import UBadge from "@nuxt/ui/components/Badge.vue";
7
7
  import { h } from "vue";
8
8
  import TablePage from "#v/components/table/Page.vue";
9
9
  const overlay = useOverlay();
10
- const createModal = overlay.create(SysJobTitlesCreateModal);
10
+ const saveModal = overlay.create(SysJobTitlesSaveModal);
11
11
  const columns = [
12
12
  {
13
13
  accessorKey: "name",
@@ -55,13 +55,14 @@ const columns = [
55
55
 
56
56
  <template>
57
57
  <TablePage
58
- name="sys-job-title"
58
+ name="job_titles"
59
59
  cn-name="职位信息"
60
60
  :use-api-group="useJobTitleApi"
61
61
  :biz-columns="columns"
62
62
  :extra-order-query-options="[
63
63
  { field: 'createdAt', label: '\u521B\u5EFA\u65F6\u95F4', defaultOpr: 'desc' }
64
64
  ]"
65
- @edit-row-from-modal="async (row) => await createModal.open({ model: row }).result"
65
+ :display-fn-in-delete-modal="(model) => model.name"
66
+ @edit-row-from-modal="async (row) => await saveModal.open({ model: row }).result"
66
67
  />
67
68
  </template>
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
2
  import * as z from "zod";
3
- import FormCreateModalTemplate from "#v/components/form/create-modal-template/index.vue";
3
+ import FormSaveModelTemplate from "#v/components/form/save-model-template/index.vue";
4
4
  import { useMenuApi, useFormSubmission, useFormValues } from "#v/composables";
5
5
  import { toRef } from "vue";
6
6
  import { menuTypeOptions } from "#v/constants";
@@ -20,7 +20,7 @@ const { onSubmit } = useFormSubmission(
20
20
  </script>
21
21
 
22
22
  <template>
23
- <FormCreateModalTemplate
23
+ <FormSaveModelTemplate
24
24
  title="菜单信息"
25
25
  :on-close="(ok) => emit('close', ok)"
26
26
  :fields="[
@@ -53,6 +53,7 @@ const { onSubmit } = useFormSubmission(
53
53
  { name: 'isAdmin', type: 'button-switch', label: '\u662F\u5426\u662F\u7CFB\u7EDF\u83DC\u5355', colSpan: '12', zodType: z.boolean() }
54
54
  ]"
55
55
  :model-value="newValues"
56
+ :old-model-value="oldValues"
56
57
  @update-model-value="(newVal) => newValues = { id: 0, ...newVal }"
57
58
  @submit="onSubmit"
58
59
  />
@@ -1,13 +1,13 @@
1
1
  <script setup>
2
2
  import { useOverlay } from "@nuxt/ui/composables";
3
3
  import { useMenuApi } from "#v/composables";
4
- import SysMenusCreateModal from "./CreateModal.vue";
4
+ import SysMenusSaveModal from "./SaveModal.vue";
5
5
  import { getOprColumns } from "#v/constants";
6
6
  import UBadge from "@nuxt/ui/components/Badge.vue";
7
7
  import TablePage from "#v/components/table/Page.vue";
8
8
  import { h } from "vue";
9
9
  const overlay = useOverlay();
10
- const createModal = overlay.create(SysMenusCreateModal);
10
+ const saveModal = overlay.create(SysMenusSaveModal);
11
11
  const columns = [
12
12
  {
13
13
  accessorKey: "type",
@@ -82,7 +82,7 @@ const columns = [
82
82
 
83
83
  <template>
84
84
  <TablePage
85
- name="sys-menu"
85
+ name="menus"
86
86
  cn-name="菜单信息"
87
87
  :use-api-group="useMenuApi"
88
88
  :biz-columns="columns"
@@ -94,8 +94,9 @@ const columns = [
94
94
  :extra-row-actions="[{
95
95
  icon: 'i-lucide-clipboard-plus',
96
96
  label: '\u4EE5\u6B64\u4F5C\u4E3A\u7236\u83DC\u5355\u590D\u5236',
97
- fnWithModal: async (raw) => await createModal.open({ model: useMenuApi().copyAsParent?.(raw) ?? { id: 0 } }).result
97
+ fnWithModal: async (raw) => await saveModal.open({ model: useMenuApi().copyAsParent?.(raw) ?? { id: 0 } }).result
98
98
  }]"
99
- @edit-row-from-modal="async (row) => await createModal.open({ model: row }).result"
99
+ :display-fn-in-delete-modal="(model) => `${model.name} ${model.staticRouteKeys?.join(',')}`"
100
+ @edit-row-from-modal="async (row) => await saveModal.open({ model: row }).result"
100
101
  />
101
102
  </template>
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
2
  import * as z from "zod";
3
- import FormCreateModalTemplate from "#v/components/form/create-modal-template/index.vue";
3
+ import FormSaveModelTemplate from "#v/components/form/save-model-template/index.vue";
4
4
  import TablePermissionTab from "#v/components/table/permission/TablePermissionTab.vue";
5
5
  import { useFormSubmission, useFormValues, useMenuApi, useRoleApi } from "#v/composables";
6
6
  import { computed, onMounted, ref, toRef } from "vue";
@@ -9,7 +9,7 @@ const props = defineProps({
9
9
  model: { type: Object, required: true }
10
10
  });
11
11
  const emit = defineEmits(["close", "save"]);
12
- const { oldValues, newValues } = useFormValues(toRef(props.model), { id: 0, disabled: false, isAdmin: false });
12
+ const { oldValues, newValues } = useFormValues(toRef(props.model), { id: 0, disabled: false, isAdmin: false, menus: [] });
13
13
  const { onSubmit } = useFormSubmission(
14
14
  toRef(oldValues),
15
15
  toRef(newValues),
@@ -86,19 +86,22 @@ onMounted(async () => {
86
86
  </script>
87
87
 
88
88
  <template>
89
- <FormCreateModalTemplate
89
+ <FormSaveModelTemplate
90
90
  title="角色信息"
91
91
  :on-close="(ok) => emit('close', ok)"
92
92
  :fields="fields"
93
93
  :model-value="newValues"
94
+ :old-model-value="oldValues"
94
95
  @update-model-value="updateModelValue"
95
96
  @submit="onSubmit"
96
97
  >
97
98
  <template #after-form>
98
99
  <div class="border-t pt-4 mt-4">
99
- <div class="font-semibold mb-2">Table 权限</div>
100
+ <div class="font-semibold mb-2">
101
+ Table 权限
102
+ </div>
100
103
  <TablePermissionTab v-model="tablePermissions" />
101
104
  </div>
102
105
  </template>
103
- </FormCreateModalTemplate>
106
+ </FormSaveModelTemplate>
104
107
  </template>
@@ -1,13 +1,13 @@
1
1
  <script setup>
2
2
  import { useOverlay } from "@nuxt/ui/composables";
3
3
  import { useRoleApi } from "#v/composables";
4
- import SysRolesCreateModal from "./CreateModal.vue";
4
+ import SysRolesSaveModal from "./SaveModal.vue";
5
5
  import { booleanOptions, getOprColumns } from "#v/constants";
6
6
  import UBadge from "@nuxt/ui/components/Badge.vue";
7
7
  import TablePage from "#v/components/table/Page.vue";
8
8
  import { h } from "vue";
9
9
  const overlay = useOverlay();
10
- const createModal = overlay.create(SysRolesCreateModal);
10
+ const saveModal = overlay.create(SysRolesSaveModal);
11
11
  const columns = [
12
12
  {
13
13
  accessorKey: "name",
@@ -60,10 +60,11 @@ const columns = [
60
60
 
61
61
  <template>
62
62
  <TablePage
63
- name="sys-role"
63
+ name="roles"
64
64
  cn-name="角色信息"
65
65
  :use-api-group="useRoleApi"
66
66
  :biz-columns="columns"
67
- @edit-row-from-modal="async (row) => await createModal.open({ model: row }).result"
67
+ :display-fn-in-delete-modal="(model) => model.name"
68
+ @edit-row-from-modal="async (row) => await saveModal.open({ model: row }).result"
68
69
  />
69
70
  </template>
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
2
  import * as z from "zod";
3
- import FormCreateModalTemplate from "#v/components/form/create-modal-template/index.vue";
3
+ import FormSaveModelTemplate from "#v/components/form/save-model-template/index.vue";
4
4
  import TableColumnList from "./TableColumnList.vue";
5
5
  import { useFormSubmission, useFormValues, useTableApi } from "#v/composables";
6
6
  import { computed, ref, toRef } from "vue";
@@ -40,16 +40,17 @@ function updateModelValue(newVal) {
40
40
  </script>
41
41
 
42
42
  <template>
43
- <FormCreateModalTemplate
43
+ <FormSaveModelTemplate
44
44
  title="Table"
45
45
  :on-close="(ok) => emit('close', ok)"
46
46
  :fields="fields"
47
47
  :model-value="newValues"
48
+ :old-model-value="oldValues"
48
49
  @update-model-value="updateModelValue"
49
50
  @submit="onSubmit"
50
51
  >
51
52
  <template #after-form>
52
53
  <TableColumnList ref="columnListRef" :initial-columns="model.columns" />
53
54
  </template>
54
- </FormCreateModalTemplate>
55
+ </FormSaveModelTemplate>
55
56
  </template>
@@ -3,10 +3,10 @@ import { useOverlay } from "@nuxt/ui/composables";
3
3
  import { useTableApi, useTableColumnApi, useTablePermissionApi } from "#v/composables/api";
4
4
  import { getOprColumns } from "#v/constants";
5
5
  import TablePage from "#v/components/table/Page.vue";
6
- import CreateModal from "./CreateModal.vue";
6
+ import SaveModal from "./SaveModal.vue";
7
7
  import { h, ref, watch } from "vue";
8
8
  const overlay = useOverlay();
9
- const createModal = overlay.create(CreateModal);
9
+ const saveModal = overlay.create(SaveModal);
10
10
  const tableMeta = ref({});
11
11
  const columns = [
12
12
  {
@@ -93,14 +93,14 @@ watch(
93
93
  <template>
94
94
  <TablePage
95
95
  ref="tablePageRef"
96
- name="sys-table"
96
+ name="tables"
97
97
  cn-name="Table 配置"
98
98
  :use-api-group="useTableApi"
99
99
  :biz-columns="columns"
100
100
  :expandable="true"
101
101
  :expand-v-node="getExpandVNode"
102
102
  @edit-row-from-modal="async (row) => {
103
- const result = await createModal.open({ model: { ...row } }).result;
103
+ const result = await saveModal.open({ model: { ...row } }).result;
104
104
  return result === true;
105
105
  }"
106
106
  />
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
2
  import * as z from "zod";
3
- import FormCreateModalTemplate from "#v/components/form/create-modal-template/index.vue";
3
+ import FormSaveModelTemplate from "#v/components/form/save-model-template/index.vue";
4
4
  import { useFormValues } from "#v/composables";
5
5
  import { computed, toRef } from "vue";
6
6
  const props = defineProps({
@@ -8,7 +8,7 @@ const props = defineProps({
8
8
  onSaveColumn: { type: Function, required: true }
9
9
  });
10
10
  const emit = defineEmits(["close"]);
11
- const { newValues } = useFormValues(toRef(props.column), { id: 0 });
11
+ const { oldValues, newValues } = useFormValues(toRef(props.column), { id: 0 });
12
12
  const fixedItems = [
13
13
  { label: "\u4E0D\u56FA\u5B9A", value: "" },
14
14
  { label: "\u5DE6\u4FA7\u56FA\u5B9A", value: "left" },
@@ -25,11 +25,12 @@ const fields = computed(() => [
25
25
  </script>
26
26
 
27
27
  <template>
28
- <FormCreateModalTemplate
28
+ <FormSaveModelTemplate
29
29
  title="列配置"
30
30
  :on-close="(ok) => emit('close', ok)"
31
31
  :fields="fields"
32
32
  :model-value="newValues"
33
+ :old-model-value="oldValues"
33
34
  @update-model-value="(newVal) => newValues = { id: 0, ...newVal }"
34
35
  @submit="async () => {
35
36
  props.onSaveColumn(newValues);