@befly-addon/admin 1.1.30 → 1.1.32

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 (111) hide show
  1. package/apis/admin/cacheRefresh.ts +29 -21
  2. package/apis/admin/del.ts +10 -10
  3. package/apis/admin/detail.ts +7 -7
  4. package/apis/admin/ins.ts +11 -11
  5. package/apis/admin/list.ts +10 -10
  6. package/apis/admin/upd.ts +14 -14
  7. package/apis/api/all.ts +8 -8
  8. package/apis/api/list.ts +10 -10
  9. package/apis/auth/login.ts +43 -43
  10. package/apis/auth/sendSmsCode.ts +6 -6
  11. package/apis/dashboard/configStatus.ts +18 -18
  12. package/apis/dashboard/environmentInfo.ts +12 -12
  13. package/apis/dashboard/performanceMetrics.ts +5 -5
  14. package/apis/dashboard/permissionStats.ts +7 -7
  15. package/apis/dashboard/serviceStatus.ts +29 -29
  16. package/apis/dashboard/systemInfo.ts +5 -5
  17. package/apis/dashboard/systemOverview.ts +7 -7
  18. package/apis/dashboard/systemResources.ts +8 -8
  19. package/apis/dict/all.ts +16 -16
  20. package/apis/dict/del.ts +6 -6
  21. package/apis/dict/detail.ts +19 -19
  22. package/apis/dict/ins.ts +9 -9
  23. package/apis/dict/items.ts +8 -8
  24. package/apis/dict/list.ts +22 -22
  25. package/apis/dict/upd.ts +11 -11
  26. package/apis/dictType/all.ts +5 -5
  27. package/apis/dictType/del.ts +8 -8
  28. package/apis/dictType/detail.ts +6 -6
  29. package/apis/dictType/ins.ts +7 -7
  30. package/apis/dictType/list.ts +8 -10
  31. package/apis/dictType/upd.ts +8 -8
  32. package/apis/email/config.ts +4 -4
  33. package/apis/email/logList.ts +8 -8
  34. package/apis/email/send.ts +18 -18
  35. package/apis/email/verify.ts +5 -5
  36. package/apis/loginLog/list.ts +8 -8
  37. package/apis/menu/all.ts +16 -18
  38. package/apis/menu/list.ts +12 -12
  39. package/apis/operateLog/list.ts +8 -8
  40. package/apis/role/all.ts +7 -7
  41. package/apis/role/apiSave.ts +10 -13
  42. package/apis/role/apis.ts +7 -12
  43. package/apis/role/del.ts +14 -14
  44. package/apis/role/detail.ts +6 -6
  45. package/apis/role/ins.ts +10 -10
  46. package/apis/role/list.ts +11 -11
  47. package/apis/role/menuSave.ts +8 -11
  48. package/apis/role/menus.ts +7 -12
  49. package/apis/role/save.ts +12 -12
  50. package/apis/role/upd.ts +10 -10
  51. package/apis/sysConfig/all.ts +5 -5
  52. package/apis/sysConfig/del.ts +9 -9
  53. package/apis/sysConfig/get.ts +9 -9
  54. package/apis/sysConfig/ins.ts +11 -11
  55. package/apis/sysConfig/list.ts +9 -9
  56. package/apis/sysConfig/upd.ts +10 -10
  57. package/libs/emailHelper.ts +7 -7
  58. package/package.json +46 -34
  59. package/plugins/email.ts +9 -9
  60. package/tables/role.json +4 -2
  61. package/views/403_1/index.vue +19 -3
  62. package/views/config/dict/components/edit.vue +26 -28
  63. package/views/config/dict/index.vue +88 -52
  64. package/views/config/dictType/components/edit.vue +22 -23
  65. package/views/config/dictType/index.vue +82 -46
  66. package/views/config/index.vue +12 -0
  67. package/views/config/system/components/edit.vue +36 -36
  68. package/views/config/system/index.vue +79 -50
  69. package/views/index/components/addonList.vue +3 -3
  70. package/views/index/components/environmentInfo.vue +10 -10
  71. package/views/index/components/operationLogs.vue +10 -10
  72. package/views/index/components/performanceMetrics.vue +8 -8
  73. package/views/index/components/quickActions.vue +3 -3
  74. package/views/index/components/serviceStatus.vue +19 -19
  75. package/views/index/components/systemNotifications.vue +12 -12
  76. package/views/index/components/systemOverview.vue +7 -7
  77. package/views/index/components/systemResources.vue +11 -11
  78. package/views/index/components/userInfo.vue +20 -19
  79. package/views/index/index.vue +12 -5
  80. package/views/log/email/index.vue +58 -51
  81. package/views/log/index.vue +12 -0
  82. package/views/log/login/index.vue +45 -38
  83. package/views/log/operate/index.vue +55 -48
  84. package/views/login_1/index.vue +25 -18
  85. package/views/people/admin/components/edit.vue +25 -26
  86. package/views/people/admin/index.vue +76 -40
  87. package/views/people/index.vue +12 -0
  88. package/views/permission/api/index.vue +21 -15
  89. package/views/permission/index.vue +12 -0
  90. package/views/permission/menu/index.vue +31 -16
  91. package/views/permission/role/components/api.vue +21 -21
  92. package/views/permission/role/components/edit.vue +18 -18
  93. package/views/permission/role/components/menu.vue +14 -16
  94. package/views/permission/role/index.vue +84 -49
  95. package/views/403_1/meta.json +0 -4
  96. package/views/config/dict/meta.json +0 -4
  97. package/views/config/dictType/meta.json +0 -4
  98. package/views/config/meta.json +0 -4
  99. package/views/config/system/meta.json +0 -4
  100. package/views/index/meta.json +0 -4
  101. package/views/log/email/meta.json +0 -4
  102. package/views/log/login/meta.json +0 -4
  103. package/views/log/meta.json +0 -4
  104. package/views/log/operate/meta.json +0 -4
  105. package/views/login_1/meta.json +0 -4
  106. package/views/people/admin/meta.json +0 -4
  107. package/views/people/meta.json +0 -4
  108. package/views/permission/api/meta.json +0 -4
  109. package/views/permission/menu/meta.json +0 -4
  110. package/views/permission/meta.json +0 -4
  111. package/views/permission/role/meta.json +0 -4
@@ -18,8 +18,8 @@
18
18
  </template>
19
19
 
20
20
  <script setup>
21
- import { Dialog as TDialog, Form as TForm, FormItem as TFormItem, Input as TInput, Textarea as TTextarea, InputNumber as TInputNumber, MessagePlugin } from 'tdesign-vue-next';
22
- import { $Http } from '@/plugins/http';
21
+ import { Dialog as TDialog, Form as TForm, FormItem as TFormItem, Input as TInput, Textarea as TTextarea, InputNumber as TInputNumber, MessagePlugin } from "tdesign-vue-next";
22
+ import { $Http } from "@/plugins/http";
23
23
 
24
24
  const props = defineProps({
25
25
  modelValue: Boolean,
@@ -27,25 +27,25 @@ const props = defineProps({
27
27
  rowData: Object
28
28
  });
29
29
 
30
- const emit = defineEmits(['update:modelValue', 'success']);
30
+ const emit = defineEmits(["update:modelValue", "success"]);
31
31
 
32
32
  const visible = computed({
33
33
  get: () => props.modelValue,
34
- set: (val) => emit('update:modelValue', val)
34
+ set: (val) => emit("update:modelValue", val)
35
35
  });
36
36
 
37
37
  const formRef = $ref(null);
38
38
 
39
39
  const $Data = $ref({
40
40
  formData: {
41
- code: '',
42
- name: '',
43
- description: '',
41
+ code: "",
42
+ name: "",
43
+ description: "",
44
44
  sort: 0
45
45
  },
46
46
  rules: {
47
- code: [{ required: true, message: '请输入类型代码' }],
48
- name: [{ required: true, message: '请输入类型名称' }]
47
+ code: [{ required: true, message: "请输入类型代码" }],
48
+ name: [{ required: true, message: "请输入类型名称" }]
49
49
  }
50
50
  });
51
51
 
@@ -55,28 +55,27 @@ const $Method = {
55
55
  if (!valid) return;
56
56
 
57
57
  try {
58
- const apiUrl = props.actionType === 'add' ? '/addon/admin/dictType/ins' : '/addon/admin/dictType/upd';
58
+ const apiUrl = props.actionType === "add" ? "/addon/admin/dictType/ins" : "/addon/admin/dictType/upd";
59
59
  const params = {
60
60
  code: $Data.formData.code,
61
61
  name: $Data.formData.name,
62
62
  description: $Data.formData.description,
63
63
  sort: $Data.formData.sort
64
64
  };
65
- if (props.actionType === 'upd') {
65
+ if (props.actionType === "upd") {
66
66
  params.id = props.rowData.id;
67
67
  }
68
68
 
69
69
  const res = await $Http(apiUrl, params);
70
70
  if (res.code === 0) {
71
- MessagePlugin.success(props.actionType === 'add' ? '添加成功' : '更新成功');
71
+ MessagePlugin.success(props.actionType === "add" ? "添加成功" : "更新成功");
72
72
  visible.value = false;
73
- emit('success');
73
+ emit("success");
74
74
  } else {
75
- MessagePlugin.error(res.msg || '操作失败');
75
+ MessagePlugin.error(res.msg || "操作失败");
76
76
  }
77
77
  } catch (error) {
78
- console.error('提交失败:', error);
79
- MessagePlugin.error('操作失败');
78
+ MessagePlugin.error("操作失败");
80
79
  }
81
80
  },
82
81
  handleClose() {
@@ -88,15 +87,15 @@ watch(
88
87
  () => props.modelValue,
89
88
  (val) => {
90
89
  if (val) {
91
- if (props.actionType === 'upd' && props.rowData) {
92
- $Data.formData.code = props.rowData.code || '';
93
- $Data.formData.name = props.rowData.name || '';
94
- $Data.formData.description = props.rowData.description || '';
90
+ if (props.actionType === "upd" && props.rowData) {
91
+ $Data.formData.code = props.rowData.code || "";
92
+ $Data.formData.name = props.rowData.name || "";
93
+ $Data.formData.description = props.rowData.description || "";
95
94
  $Data.formData.sort = props.rowData.sort || 0;
96
95
  } else {
97
- $Data.formData.code = '';
98
- $Data.formData.name = '';
99
- $Data.formData.description = '';
96
+ $Data.formData.code = "";
97
+ $Data.formData.name = "";
98
+ $Data.formData.description = "";
100
99
  $Data.formData.sort = 0;
101
100
  }
102
101
  }
@@ -23,7 +23,16 @@
23
23
  </div>
24
24
  <div class="main-content">
25
25
  <div class="main-table">
26
- <TTable :data="$Data.tableData" :columns="$Data.columns" :loading="$Data.loading" :active-row-keys="$Data.activeRowKeys" row-key="id" height="calc(100vh - var(--search-height) - var(--pagination-height) - var(--layout-gap) * 4)" active-row-type="single" @active-change="$Method.onActiveChange">
26
+ <TTable
27
+ :data="$Data.tableData"
28
+ :columns="$Data.columns"
29
+ :loading="$Data.loading"
30
+ :active-row-keys="$Data.activeRowKeys"
31
+ row-key="id"
32
+ height="calc(100vh - var(--search-height) - var(--pagination-height) - var(--layout-gap) * 4)"
33
+ active-row-type="single"
34
+ @active-change="$Method.onActiveChange"
35
+ >
27
36
  <template #operation="{ row }">
28
37
  <TDropdown trigger="click" placement="bottom-right" @click="(data) => $Method.onAction(data.value, row)">
29
38
  <TButton theme="primary" size="small">
@@ -59,41 +68,48 @@
59
68
  </template>
60
69
 
61
70
  <script setup>
62
- import { Button as TButton, Table as TTable, Input as TInput, Dropdown as TDropdown, DropdownMenu as TDropdownMenu, DropdownItem as TDropdownItem, Pagination as TPagination, MessagePlugin, DialogPlugin } from 'tdesign-vue-next';
63
- import ILucidePlus from '~icons/lucide/plus';
64
- import ILucideRotateCw from '~icons/lucide/rotate-cw';
65
- import ILucideSearch from '~icons/lucide/search';
66
- import ILucidePencil from '~icons/lucide/pencil';
67
- import ILucideTrash2 from '~icons/lucide/trash-2';
68
- import ILucideChevronDown from '~icons/lucide/chevron-down';
69
- import EditDialog from './components/edit.vue';
70
- import DetailPanel from '@/components/DetailPanel.vue';
71
- import { $Http } from '@/plugins/http';
72
- import { withDefaultColumns } from 'befly-shared/withDefaultColumns';
71
+ import { Button as TButton, Table as TTable, Input as TInput, Dropdown as TDropdown, DropdownMenu as TDropdownMenu, DropdownItem as TDropdownItem, Pagination as TPagination, MessagePlugin, DialogPlugin } from "tdesign-vue-next";
72
+ import ILucidePlus from "~icons/lucide/plus";
73
+ import ILucideRotateCw from "~icons/lucide/rotate-cw";
74
+ import ILucideSearch from "~icons/lucide/search";
75
+ import ILucidePencil from "~icons/lucide/pencil";
76
+ import ILucideTrash2 from "~icons/lucide/trash-2";
77
+ import ILucideChevronDown from "~icons/lucide/chevron-down";
78
+ import EditDialog from "./components/edit.vue";
79
+ import DetailPanel from "@/components/DetailPanel.vue";
80
+ import { $Http } from "@/plugins/http";
81
+ import { withDefaultColumns } from "befly-vite/utils/withDefaultColumns";
82
+
83
+ definePage({
84
+ meta: {
85
+ title: "字典类型",
86
+ order: 0
87
+ }
88
+ });
73
89
 
74
90
  const $Data = $ref({
75
91
  tableData: [],
76
92
  loading: false,
77
93
  activeRowKeys: [],
78
94
  currentRow: null,
79
- searchKeyword: '',
95
+ searchKeyword: "",
80
96
  columns: withDefaultColumns([
81
- { colKey: 'id', title: 'ID' },
82
- { colKey: 'code', title: '类型代码' },
83
- { colKey: 'name', title: '类型名称' },
84
- { colKey: 'description', title: '描述' },
85
- { colKey: 'sort', title: '排序' },
86
- { colKey: 'operation', title: '操作' }
97
+ { colKey: "id", title: "ID" },
98
+ { colKey: "code", title: "类型代码" },
99
+ { colKey: "name", title: "类型名称" },
100
+ { colKey: "description", title: "描述" },
101
+ { colKey: "sort", title: "排序" },
102
+ { colKey: "operation", title: "操作" }
87
103
  ]),
88
104
  pagerConfig: {
89
105
  currentPage: 1,
90
106
  limit: 30,
91
107
  total: 0,
92
- align: 'right',
93
- layout: 'total, prev, pager, next, jumper'
108
+ align: "right",
109
+ layout: "total, prev, pager, next, jumper"
94
110
  },
95
111
  editVisible: false,
96
- actionType: 'add',
112
+ actionType: "add",
97
113
  rowData: {}
98
114
  });
99
115
 
@@ -104,7 +120,7 @@ const $Method = {
104
120
  async apiDictTypeList() {
105
121
  $Data.loading = true;
106
122
  try {
107
- const res = await $Http('/addon/admin/dictType/list', {
123
+ const res = await $Http("/addon/admin/dictType/list", {
108
124
  page: $Data.pagerConfig.currentPage,
109
125
  limit: $Data.pagerConfig.limit,
110
126
  keyword: $Data.searchKeyword
@@ -120,29 +136,49 @@ const $Method = {
120
136
  $Data.activeRowKeys = [];
121
137
  }
122
138
  } catch (error) {
123
- console.error('加载字典类型列表失败:', error);
124
- MessagePlugin.error('加载数据失败');
139
+ MessagePlugin.error("加载数据失败");
125
140
  } finally {
126
141
  $Data.loading = false;
127
142
  }
128
143
  },
129
144
  async apiDictTypeDel(row) {
130
- DialogPlugin.confirm({
131
- header: '确认删除',
132
- body: `确定要删除类型"${row.name}"吗?删除前会检查是否有字典项引用此类型。`,
133
- status: 'warning'
134
- }).then(async () => {
135
- try {
136
- const res = await $Http('/addon/admin/dictType/del', { id: row.id });
137
- if (res.code === 0) {
138
- MessagePlugin.success('删除成功');
139
- $Method.apiDictTypeList();
140
- } else {
141
- MessagePlugin.error(res.msg || '删除失败');
145
+ let dialog = null;
146
+ let destroyed = false;
147
+
148
+ const destroy = () => {
149
+ if (destroyed) return;
150
+ destroyed = true;
151
+ if (dialog && typeof dialog.destroy === "function") {
152
+ dialog.destroy();
153
+ }
154
+ };
155
+
156
+ dialog = DialogPlugin.confirm({
157
+ header: "确认删除",
158
+ body: `确认删除类型“${row.name}”吗?`,
159
+ status: "warning",
160
+ confirmBtn: "删除",
161
+ cancelBtn: "取消",
162
+ onConfirm: async () => {
163
+ if (dialog && typeof dialog.setConfirmLoading === "function") {
164
+ dialog.setConfirmLoading(true);
165
+ }
166
+
167
+ try {
168
+ await $Http("/addon/admin/dictType/del", { id: row.id });
169
+ MessagePlugin.success("删除成功");
170
+ destroy();
171
+ await $Method.apiDictTypeList();
172
+ } catch (error) {
173
+ MessagePlugin.error("删除失败");
174
+ } finally {
175
+ if (dialog && typeof dialog.setConfirmLoading === "function") {
176
+ dialog.setConfirmLoading(false);
177
+ }
142
178
  }
143
- } catch (error) {
144
- console.error('删除失败:', error);
145
- MessagePlugin.error('删除失败');
179
+ },
180
+ onClose: () => {
181
+ destroy();
146
182
  }
147
183
  });
148
184
  },
@@ -151,7 +187,7 @@ const $Method = {
151
187
  $Method.apiDictTypeList();
152
188
  },
153
189
  handleRefresh() {
154
- $Data.searchKeyword = '';
190
+ $Data.searchKeyword = "";
155
191
  $Data.pagerConfig.currentPage = 1;
156
192
  $Method.apiDictTypeList();
157
193
  },
@@ -172,15 +208,15 @@ const $Method = {
172
208
  $Data.currentRow = context.currentRowData;
173
209
  },
174
210
  onAction(type, row) {
175
- if (type === 'add') {
176
- $Data.actionType = 'add';
211
+ if (type === "add") {
212
+ $Data.actionType = "add";
177
213
  $Data.rowData = {};
178
214
  $Data.editVisible = true;
179
- } else if (type === 'upd') {
180
- $Data.actionType = 'upd';
215
+ } else if (type === "upd") {
216
+ $Data.actionType = "upd";
181
217
  $Data.rowData = { ...row };
182
218
  $Data.editVisible = true;
183
- } else if (type === 'del') {
219
+ } else if (type === "del") {
184
220
  $Method.apiDictTypeDel(row);
185
221
  }
186
222
  }
@@ -0,0 +1,12 @@
1
+ <template>
2
+ <RouterView />
3
+ </template>
4
+
5
+ <script setup>
6
+ definePage({
7
+ meta: {
8
+ title: "配置管理",
9
+ order: 30
10
+ }
11
+ });
12
+ </script>
@@ -45,9 +45,9 @@
45
45
  </template>
46
46
 
47
47
  <script setup>
48
- import { watch } from 'vue';
49
- import { Dialog as TDialog, Form as TForm, FormItem as TFormItem, Input as TInput, Textarea as TTextarea, InputNumber as TInputNumber, Select as TSelect, Option as TOption, RadioGroup as TRadioGroup, Radio as TRadio, Button as TButton, MessagePlugin } from 'tdesign-vue-next';
50
- import { $Http } from '@/plugins/http';
48
+ import { watch } from "vue";
49
+ import { Dialog as TDialog, Form as TForm, FormItem as TFormItem, Input as TInput, Textarea as TTextarea, InputNumber as TInputNumber, Select as TSelect, Option as TOption, RadioGroup as TRadioGroup, Radio as TRadio, Button as TButton, MessagePlugin } from "tdesign-vue-next";
50
+ import { $Http } from "@/plugins/http";
51
51
 
52
52
  const $Prop = defineProps({
53
53
  modelValue: {
@@ -56,7 +56,7 @@ const $Prop = defineProps({
56
56
  },
57
57
  actionType: {
58
58
  type: String,
59
- default: 'add'
59
+ default: "add"
60
60
  },
61
61
  rowData: {
62
62
  type: Object,
@@ -64,7 +64,7 @@ const $Prop = defineProps({
64
64
  }
65
65
  });
66
66
 
67
- const $Emit = defineEmits(['update:modelValue', 'success']);
67
+ const $Emit = defineEmits(["update:modelValue", "success"]);
68
68
 
69
69
  // 表单引用
70
70
  const $Form = $shallowRef({
@@ -77,28 +77,28 @@ const $Data = $ref({
77
77
  isSystem: false,
78
78
  formData: {
79
79
  id: 0,
80
- name: '',
81
- code: '',
82
- value: '',
83
- valueType: 'string',
84
- group: '',
80
+ name: "",
81
+ code: "",
82
+ value: "",
83
+ valueType: "string",
84
+ group: "",
85
85
  sort: 0,
86
- description: '',
86
+ description: "",
87
87
  state: 1
88
88
  }
89
89
  });
90
90
 
91
91
  const $Data2 = $shallowRef({
92
92
  formRules: {
93
- name: [{ required: true, message: '请输入配置名称', trigger: 'blur' }],
93
+ name: [{ required: true, message: "请输入配置名称", trigger: "blur" }],
94
94
  code: [
95
- { required: true, message: '请输入配置代码', trigger: 'blur' },
96
- { pattern: /^[a-zA-Z0-9_]+$/, message: '配置代码只能包含字母、数字和下划线', trigger: 'blur' }
95
+ { required: true, message: "请输入配置代码", trigger: "blur" },
96
+ { pattern: /^[a-zA-Z0-9_]+$/, message: "配置代码只能包含字母、数字和下划线", trigger: "blur" }
97
97
  ],
98
- value: [{ required: true, message: '请输入配置值', trigger: 'blur' }],
99
- valueType: [{ required: true, message: '请选择值类型', trigger: 'change' }]
98
+ value: [{ required: true, message: "请输入配置值", trigger: "blur" }],
99
+ valueType: [{ required: true, message: "请选择值类型", trigger: "change" }]
100
100
  },
101
- groupOptions: ['基础配置', '邮件配置', '存储配置', '安全配置', '其他']
101
+ groupOptions: ["基础配置", "邮件配置", "存储配置", "安全配置", "其他"]
102
102
  });
103
103
 
104
104
  // 方法集合
@@ -109,27 +109,27 @@ const $Method = {
109
109
 
110
110
  onShow() {
111
111
  $Data.visible = true;
112
- if ($Prop.actionType === 'upd' && $Prop.rowData) {
112
+ if ($Prop.actionType === "upd" && $Prop.rowData) {
113
113
  $Data.formData.id = $Prop.rowData.id || 0;
114
- $Data.formData.name = $Prop.rowData.name || '';
115
- $Data.formData.code = $Prop.rowData.code || '';
116
- $Data.formData.value = $Prop.rowData.value || '';
117
- $Data.formData.valueType = $Prop.rowData.valueType || 'string';
118
- $Data.formData.group = $Prop.rowData.group || '';
114
+ $Data.formData.name = $Prop.rowData.name || "";
115
+ $Data.formData.code = $Prop.rowData.code || "";
116
+ $Data.formData.value = $Prop.rowData.value || "";
117
+ $Data.formData.valueType = $Prop.rowData.valueType || "string";
118
+ $Data.formData.group = $Prop.rowData.group || "";
119
119
  $Data.formData.sort = $Prop.rowData.sort || 0;
120
- $Data.formData.description = $Prop.rowData.description || '';
120
+ $Data.formData.description = $Prop.rowData.description || "";
121
121
  $Data.formData.state = $Prop.rowData.state || 1;
122
122
  $Data.isSystem = $Prop.rowData.isSystem === 1;
123
123
  } else {
124
124
  $Data.formData = {
125
125
  id: 0,
126
- name: '',
127
- code: '',
128
- value: '',
129
- valueType: 'string',
130
- group: '',
126
+ name: "",
127
+ code: "",
128
+ value: "",
129
+ valueType: "string",
130
+ group: "",
131
131
  sort: 0,
132
- description: '',
132
+ description: "",
133
133
  state: 1
134
134
  };
135
135
  $Data.isSystem = false;
@@ -138,7 +138,7 @@ const $Method = {
138
138
 
139
139
  onClose() {
140
140
  $Data.visible = false;
141
- $Emit('update:modelValue', false);
141
+ $Emit("update:modelValue", false);
142
142
  },
143
143
 
144
144
  async onSubmit() {
@@ -147,18 +147,18 @@ const $Method = {
147
147
 
148
148
  $Data.submitting = true;
149
149
  try {
150
- const api = $Prop.actionType === 'upd' ? '/addon/admin/sysConfig/upd' : '/addon/admin/sysConfig/ins';
150
+ const api = $Prop.actionType === "upd" ? "/addon/admin/sysConfig/upd" : "/addon/admin/sysConfig/ins";
151
151
  const res = await $Http(api, $Data.formData);
152
152
 
153
153
  if (res.code === 0) {
154
- MessagePlugin.success($Prop.actionType === 'upd' ? '编辑成功' : '添加成功');
155
- $Emit('success');
154
+ MessagePlugin.success($Prop.actionType === "upd" ? "编辑成功" : "添加成功");
155
+ $Emit("success");
156
156
  $Method.onClose();
157
157
  } else {
158
- MessagePlugin.error(res.msg || '操作失败');
158
+ MessagePlugin.error(res.msg || "操作失败");
159
159
  }
160
160
  } catch (error) {
161
- MessagePlugin.error('操作失败');
161
+ MessagePlugin.error("操作失败");
162
162
  } finally {
163
163
  $Data.submitting = false;
164
164
  }
@@ -82,42 +82,49 @@
82
82
  </template>
83
83
 
84
84
  <script setup>
85
- import { Button as TButton, Table as TTable, Tag as TTag, Select as TSelect, Option as TOption, Dropdown as TDropdown, DropdownMenu as TDropdownMenu, DropdownItem as TDropdownItem, Pagination as TPagination, MessagePlugin, DialogPlugin } from 'tdesign-vue-next';
86
- import ILucidePlus from '~icons/lucide/plus';
87
- import ILucideRotateCw from '~icons/lucide/rotate-cw';
88
- import ILucidePencil from '~icons/lucide/pencil';
89
- import ILucideTrash2 from '~icons/lucide/trash-2';
90
- import ILucideChevronDown from '~icons/lucide/chevron-down';
91
- import EditDialog from './components/edit.vue';
92
- import DetailPanel from '@/components/DetailPanel.vue';
93
- import { $Http } from '@/plugins/http';
94
- import { withDefaultColumns } from 'befly-shared/withDefaultColumns';
85
+ import { Button as TButton, Table as TTable, Tag as TTag, Select as TSelect, Option as TOption, Dropdown as TDropdown, DropdownMenu as TDropdownMenu, DropdownItem as TDropdownItem, Pagination as TPagination, MessagePlugin, DialogPlugin } from "tdesign-vue-next";
86
+ import ILucidePlus from "~icons/lucide/plus";
87
+ import ILucideRotateCw from "~icons/lucide/rotate-cw";
88
+ import ILucidePencil from "~icons/lucide/pencil";
89
+ import ILucideTrash2 from "~icons/lucide/trash-2";
90
+ import ILucideChevronDown from "~icons/lucide/chevron-down";
91
+ import EditDialog from "./components/edit.vue";
92
+ import DetailPanel from "@/components/DetailPanel.vue";
93
+ import { $Http } from "@/plugins/http";
94
+ import { withDefaultColumns } from "befly-vite/utils/withDefaultColumns";
95
+
96
+ definePage({
97
+ meta: {
98
+ title: "系统配置",
99
+ order: 2
100
+ }
101
+ });
95
102
 
96
103
  // 响应式数据
97
104
  const $Data = $ref({
98
105
  tableData: [],
99
106
  loading: false,
100
107
  columns: withDefaultColumns([
101
- { colKey: 'name', title: '配置名称', fixed: 'left', width: 150 },
102
- { colKey: 'id', title: '序号', width: 80 },
103
- { colKey: 'code', title: '配置代码', ellipsis: true },
104
- { colKey: 'value', title: '配置值', ellipsis: true, width: 200 },
105
- { colKey: 'valueType', title: '值类型', width: 100 },
106
- { colKey: 'group', title: '分组', width: 100 },
107
- { colKey: 'sort', title: '排序', width: 80 },
108
- { colKey: 'isSystem', title: '类型', width: 80 },
109
- { colKey: 'state', title: '状态', width: 80 },
110
- { colKey: 'operation', title: '操作', width: 100 }
108
+ { colKey: "name", title: "配置名称", fixed: "left", width: 150 },
109
+ { colKey: "id", title: "序号", width: 80 },
110
+ { colKey: "code", title: "配置代码", ellipsis: true },
111
+ { colKey: "value", title: "配置值", ellipsis: true, width: 200 },
112
+ { colKey: "valueType", title: "值类型", width: 100 },
113
+ { colKey: "group", title: "分组", width: 100 },
114
+ { colKey: "sort", title: "排序", width: 80 },
115
+ { colKey: "isSystem", title: "类型", width: 80 },
116
+ { colKey: "state", title: "状态", width: 80 },
117
+ { colKey: "operation", title: "操作", width: 100 }
111
118
  ]),
112
119
  detailFields: [
113
- { colKey: 'name', title: '配置名称' },
114
- { colKey: 'code', title: '配置代码' },
115
- { colKey: 'value', title: '配置值' },
116
- { colKey: 'valueType', title: '值类型' },
117
- { colKey: 'group', title: '配置分组' },
118
- { colKey: 'sort', title: '排序' },
119
- { colKey: 'isSystem', title: '配置类型' },
120
- { colKey: 'description', title: '描述说明' }
120
+ { colKey: "name", title: "配置名称" },
121
+ { colKey: "code", title: "配置代码" },
122
+ { colKey: "value", title: "配置值" },
123
+ { colKey: "valueType", title: "值类型" },
124
+ { colKey: "group", title: "配置分组" },
125
+ { colKey: "sort", title: "排序" },
126
+ { colKey: "isSystem", title: "配置类型" },
127
+ { colKey: "description", title: "描述说明" }
121
128
  ],
122
129
  pagerConfig: {
123
130
  currentPage: 1,
@@ -127,12 +134,12 @@ const $Data = $ref({
127
134
  currentRow: null,
128
135
  activeRowKeys: [],
129
136
  editVisible: false,
130
- actionType: 'add',
137
+ actionType: "add",
131
138
  rowData: {},
132
139
  filter: {
133
- group: ''
140
+ group: ""
134
141
  },
135
- groupOptions: ['基础配置', '邮件配置', '存储配置', '安全配置', '其他']
142
+ groupOptions: ["基础配置", "邮件配置", "存储配置", "安全配置", "其他"]
136
143
  });
137
144
 
138
145
  // 方法
@@ -145,7 +152,7 @@ const $Method = {
145
152
  async apiConfigList() {
146
153
  $Data.loading = true;
147
154
  try {
148
- const res = await $Http('/addon/admin/sysConfig/list', {
155
+ const res = await $Http("/addon/admin/sysConfig/list", {
149
156
  page: $Data.pagerConfig.currentPage,
150
157
  limit: $Data.pagerConfig.limit
151
158
  });
@@ -160,7 +167,7 @@ const $Method = {
160
167
  $Data.activeRowKeys = [];
161
168
  }
162
169
  } catch (error) {
163
- MessagePlugin.error('加载数据失败');
170
+ MessagePlugin.error("加载数据失败");
164
171
  } finally {
165
172
  $Data.loading = false;
166
173
  }
@@ -169,25 +176,47 @@ const $Method = {
169
176
  // 删除配置
170
177
  async apiConfigDel(row) {
171
178
  if (row.isSystem === 1) {
172
- MessagePlugin.warning('系统配置不允许删除');
179
+ MessagePlugin.warning("系统配置不允许删除");
173
180
  return;
174
181
  }
175
182
 
176
- DialogPlugin.confirm({
177
- header: '确认删除',
178
- body: `确定要删除配置"${row.name}"吗?`,
179
- status: 'warning'
180
- }).then(async () => {
181
- try {
182
- const res = await $Http('/addon/admin/sysConfig/del', { id: row.id });
183
- if (res.code === 0) {
184
- MessagePlugin.success('删除成功');
185
- $Method.apiConfigList();
186
- } else {
187
- MessagePlugin.error(res.msg || '删除失败');
183
+ let dialog = null;
184
+ let destroyed = false;
185
+
186
+ const destroy = () => {
187
+ if (destroyed) return;
188
+ destroyed = true;
189
+ if (dialog && typeof dialog.destroy === "function") {
190
+ dialog.destroy();
191
+ }
192
+ };
193
+
194
+ dialog = DialogPlugin.confirm({
195
+ header: "确认删除",
196
+ body: `确认删除配置“${row.name}”吗?`,
197
+ status: "warning",
198
+ confirmBtn: "删除",
199
+ cancelBtn: "取消",
200
+ onConfirm: async () => {
201
+ if (dialog && typeof dialog.setConfirmLoading === "function") {
202
+ dialog.setConfirmLoading(true);
203
+ }
204
+
205
+ try {
206
+ await $Http("/addon/admin/sysConfig/del", { id: row.id });
207
+ MessagePlugin.success("删除成功");
208
+ destroy();
209
+ await $Method.apiConfigList();
210
+ } catch (error) {
211
+ MessagePlugin.error("删除失败");
212
+ } finally {
213
+ if (dialog && typeof dialog.setConfirmLoading === "function") {
214
+ dialog.setConfirmLoading(false);
215
+ }
188
216
  }
189
- } catch (error) {
190
- MessagePlugin.error('删除失败');
217
+ },
218
+ onClose: () => {
219
+ destroy();
191
220
  }
192
221
  });
193
222
  },
@@ -231,9 +260,9 @@ const $Method = {
231
260
  onAction(command, rowData) {
232
261
  $Data.actionType = command;
233
262
  $Data.rowData = rowData;
234
- if (command === 'add' || command === 'upd') {
263
+ if (command === "add" || command === "upd") {
235
264
  $Data.editVisible = true;
236
- } else if (command === 'del') {
265
+ } else if (command === "del") {
237
266
  $Method.apiConfigDel(rowData);
238
267
  }
239
268
  }