@befly-addon/admin 1.0.55 → 1.0.56

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 (61) hide show
  1. package/apis/admin/ins.ts +11 -15
  2. package/apis/admin/upd.ts +1 -13
  3. package/apis/auth/login.ts +49 -5
  4. package/apis/email/config.ts +16 -0
  5. package/apis/email/logList.ts +13 -0
  6. package/apis/email/send.ts +42 -0
  7. package/apis/email/verify.ts +12 -0
  8. package/apis/loginLog/list.ts +13 -0
  9. package/apis/operateLog/list.ts +13 -0
  10. package/apis/sysConfig/all.ts +12 -0
  11. package/apis/sysConfig/del.ts +30 -0
  12. package/apis/sysConfig/get.ts +31 -0
  13. package/apis/sysConfig/ins.ts +38 -0
  14. package/apis/sysConfig/list.ts +14 -0
  15. package/apis/sysConfig/upd.ts +50 -0
  16. package/package.json +14 -3
  17. package/plugins/email.ts +206 -0
  18. package/styles/variables.scss +121 -60
  19. package/tables/admin.json +0 -15
  20. package/tables/emailLog.json +69 -0
  21. package/tables/loginLog.json +96 -0
  22. package/tables/operateLog.json +82 -0
  23. package/tables/role.json +1 -1
  24. package/tables/sysConfig.json +53 -0
  25. package/views/403_1/meta.json +4 -0
  26. package/views/{dict → config/dict}/index.vue +27 -38
  27. package/views/config/dict/meta.json +4 -0
  28. package/views/config/meta.json +4 -0
  29. package/views/config/system/components/edit.vue +179 -0
  30. package/views/config/system/index.vue +256 -0
  31. package/views/config/system/meta.json +4 -0
  32. package/views/index/index.vue +46 -9
  33. package/views/index/meta.json +4 -0
  34. package/views/log/email/index.vue +285 -0
  35. package/views/log/email/meta.json +4 -0
  36. package/views/log/login/index.vue +180 -0
  37. package/views/log/login/meta.json +4 -0
  38. package/views/log/meta.json +4 -0
  39. package/views/log/operate/index.vue +242 -0
  40. package/views/log/operate/meta.json +4 -0
  41. package/views/login_1/meta.json +4 -0
  42. package/views/{admin → people/admin}/components/edit.vue +22 -24
  43. package/views/{admin → people/admin}/index.vue +21 -61
  44. package/views/people/admin/meta.json +4 -0
  45. package/views/people/meta.json +4 -0
  46. package/views/{api → permission/api}/index.vue +17 -55
  47. package/views/permission/api/meta.json +4 -0
  48. package/views/{menu → permission/menu}/index.vue +17 -56
  49. package/views/permission/menu/meta.json +4 -0
  50. package/views/permission/meta.json +4 -0
  51. package/views/{role → permission/role}/components/api.vue +13 -38
  52. package/views/{role → permission/role}/components/edit.vue +9 -8
  53. package/views/{role → permission/role}/components/menu.vue +2 -25
  54. package/views/{role → permission/role}/index.vue +27 -36
  55. package/views/permission/role/meta.json +4 -0
  56. /package/views/{403 → 403_1}/index.vue +0 -0
  57. /package/views/{dict → config/dict}/components/edit.vue +0 -0
  58. /package/views/{login → login_1}/components/emailLoginForm.vue +0 -0
  59. /package/views/{login → login_1}/components/registerForm.vue +0 -0
  60. /package/views/{login → login_1}/components/welcomePanel.vue +0 -0
  61. /package/views/{login/index_1.vue → login_1/index.vue} +0 -0
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": {
3
+ "name": "配置名称",
4
+ "type": "string",
5
+ "min": 2,
6
+ "max": 50
7
+ },
8
+ "code": {
9
+ "name": "配置代码",
10
+ "type": "string",
11
+ "min": 2,
12
+ "max": 100,
13
+ "unique": true,
14
+ "regexp": "@alphanumeric_"
15
+ },
16
+ "value": {
17
+ "name": "配置值",
18
+ "type": "text"
19
+ },
20
+ "valueType": {
21
+ "name": "值类型",
22
+ "type": "string",
23
+ "max": 20,
24
+ "default": "string",
25
+ "comment": "string number boolean json"
26
+ },
27
+ "group": {
28
+ "name": "配置分组",
29
+ "type": "string",
30
+ "max": 50,
31
+ "index": true
32
+ },
33
+ "sort": {
34
+ "name": "排序",
35
+ "type": "number",
36
+ "min": 0,
37
+ "max": 9999,
38
+ "default": 0
39
+ },
40
+ "isSystem": {
41
+ "name": "是否系统配置",
42
+ "type": "number",
43
+ "min": 0,
44
+ "max": 1,
45
+ "default": 0,
46
+ "comment": "1是 0否"
47
+ },
48
+ "description": {
49
+ "name": "描述说明",
50
+ "type": "string",
51
+ "max": 500
52
+ }
53
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "name": "403",
3
+ "order": 101
4
+ }
@@ -9,7 +9,7 @@
9
9
  </TButton>
10
10
  </div>
11
11
  <div class="right">
12
- <TButton @click="$Method.handleRefresh">
12
+ <TButton shape="circle" @click="$Method.handleRefresh">
13
13
  <template #icon>
14
14
  <ILucideRotateCw />
15
15
  </template>
@@ -18,15 +18,18 @@
18
18
  </div>
19
19
  <div class="main-content">
20
20
  <div class="main-table">
21
- <TTable v-bind="withTableProps()" :data="$Data.dictList" :columns="$Data.columns" :loading="$Data.loading" :active-row-keys="$Data.activeRowKeys" @active-change="$Method.onActiveChange">
21
+ <TTable :data="$Data.dictList" :columns="$Data.columns" :loading="$Data.loading" :active-row-keys="$Data.activeRowKeys" row-key="id" height="calc(100vh - 94px)" active-row-type="single" @active-change="$Method.onActiveChange">
22
22
  <template #state="{ row }">
23
- <TTag v-if="row.state === 1" theme="success">正常</TTag>
24
- <TTag v-else-if="row.state === 2" theme="warning">禁用</TTag>
25
- <TTag v-else theme="danger">已删除</TTag>
23
+ <TTag v-if="row.state === 1" shape="round" theme="success" variant="light-outline">正常</TTag>
24
+ <TTag v-else-if="row.state === 2" shape="round" theme="warning" variant="light-outline">禁用</TTag>
25
+ <TTag v-else shape="round" theme="danger" variant="light-outline">已删除</TTag>
26
26
  </template>
27
27
  <template #operation="{ row }">
28
- <TDropdown trigger="click" min-column-width="120" @click="(data) => $Method.onAction(data.value, row)">
29
- <TButton variant="text" size="small">操作</TButton>
28
+ <TDropdown trigger="click" placement="bottom-right" @click="(data) => $Method.onAction(data.value, row)">
29
+ <TButton theme="primary" size="small">
30
+ 操作
31
+ <template #suffix> <t-icon name="chevron-down" size="16" /></template>
32
+ </TButton>
30
33
  <TDropdownMenu slot="dropdown">
31
34
  <TDropdownItem value="upd">
32
35
  <ILucidePencil />
@@ -43,19 +46,7 @@
43
46
  </div>
44
47
 
45
48
  <div class="main-detail">
46
- <DetailPanel
47
- :data="$Data.currentRow"
48
- :fields="[
49
- { key: 'id', label: 'ID' },
50
- { key: 'name', label: '字典名称' },
51
- { key: 'code', label: '字典代码' },
52
- { key: 'value', label: '字典值' },
53
- { key: 'pid', label: '父级ID', default: '顶级' },
54
- { key: 'sort', label: '排序' },
55
- { key: 'description', label: '描述' },
56
- { key: 'state', label: '状态' }
57
- ]"
58
- />
49
+ <DetailPanel :data="$Data.currentRow" :fields="$Data.columns" />
59
50
  </div>
60
51
  </div>
61
52
 
@@ -77,7 +68,7 @@ import ILucideTrash2 from '~icons/lucide/trash-2';
77
68
  import EditDialog from './components/edit.vue';
78
69
  import DetailPanel from '@/components/DetailPanel.vue';
79
70
  import { $Http } from '@/plugins/http';
80
- import { withDefaultColumns, withTableProps } from '@/utils';
71
+ import { withDefaultColumns } from '@/utils';
81
72
 
82
73
  // 响应式数据
83
74
  const $Data = $ref({
@@ -86,15 +77,15 @@ const $Data = $ref({
86
77
  activeRowKeys: [],
87
78
  currentRow: null,
88
79
  columns: withDefaultColumns([
89
- { colKey: 'index', title: '序号', width: 60, align: 'center' },
80
+ { colKey: 'index', title: '序号' },
90
81
  { colKey: 'name', title: '字典名称' },
91
- { colKey: 'code', title: '字典代码', width: 150 },
92
- { colKey: 'value', title: '字典值', width: 200 },
93
- { colKey: 'pid', title: '父级ID', width: 100 },
94
- { colKey: 'sort', title: '排序', width: 80 },
82
+ { colKey: 'code', title: '字典代码' },
83
+ { colKey: 'value', title: '字典值' },
84
+ { colKey: 'pid', title: '父级ID' },
85
+ { colKey: 'sort', title: '排序' },
95
86
  { colKey: 'description', title: '描述' },
96
- { colKey: 'state', title: '状态', width: 100, ellipsis: false },
97
- { colKey: 'operation', title: '操作', width: 120, align: 'right', ellipsis: false }
87
+ { colKey: 'state', title: '状态' },
88
+ { colKey: 'operation', title: '操作' }
98
89
  ]),
99
90
  pagerConfig: {
100
91
  currentPage: 1,
@@ -181,18 +172,16 @@ const $Method = {
181
172
  $Method.apiDictList();
182
173
  },
183
174
 
184
- // 高亮行变化(点击行选中)
185
- onActiveChange(value, { activeRowData }) {
175
+ // 高亮行变化
176
+ onActiveChange(value, context) {
177
+ // 禁止取消高亮:如果新值为空,保持当前选中
178
+ if (value.length === 0 && $Data.activeRowKeys.length > 0) {
179
+ return;
180
+ }
186
181
  $Data.activeRowKeys = value;
187
182
  // 更新当前高亮的行数据
188
- if (activeRowData && activeRowData.length > 0) {
189
- $Data.currentRow = activeRowData[0];
190
- } else if ($Data.dictList.length > 0) {
191
- // 如果取消高亮,默认显示第一行
192
- $Data.currentRow = $Data.dictList[0];
193
- $Data.activeRowKeys = [$Data.dictList[0].id];
194
- } else {
195
- $Data.currentRow = null;
183
+ if (context.activeRowList && context.activeRowList.length > 0) {
184
+ $Data.currentRow = context.activeRowList[0].row;
196
185
  }
197
186
  },
198
187
 
@@ -0,0 +1,4 @@
1
+ {
2
+ "name": "字典配置",
3
+ "order": 1
4
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "name": "配置管理",
3
+ "order": 30
4
+ }
@@ -0,0 +1,179 @@
1
+ <template>
2
+ <TDialog v-model:visible="$Data.visible" :title="$Prop.actionType === 'upd' ? '编辑配置' : '添加配置'" width="600px" :append-to-body="true" :show-footer="true" :esc-closable="false" top="10vh" @close="$Method.onClose">
3
+ <TForm :model="$Data.formData" label-width="120px" label-position="left" :rules="$Data2.formRules" :ref="(el) => ($Form.form = el)">
4
+ <TFormItem label="配置名称" prop="name">
5
+ <TInput v-model="$Data.formData.name" placeholder="请输入配置名称" :disabled="$Data.isSystem" />
6
+ </TFormItem>
7
+ <TFormItem label="配置代码" prop="code">
8
+ <TInput v-model="$Data.formData.code" placeholder="请输入配置代码,如:site_name" :disabled="$Prop.actionType === 'upd'" />
9
+ </TFormItem>
10
+ <TFormItem label="配置值" prop="value">
11
+ <TTextarea v-if="$Data.formData.valueType === 'json' || $Data.formData.valueType === 'text'" v-model="$Data.formData.value" placeholder="请输入配置值" :autosize="{ minRows: 3, maxRows: 8 }" />
12
+ <TInput v-else v-model="$Data.formData.value" placeholder="请输入配置值" />
13
+ </TFormItem>
14
+ <TFormItem label="值类型" prop="valueType">
15
+ <TSelect v-model="$Data.formData.valueType" :disabled="$Data.isSystem">
16
+ <TOption label="字符串" value="string" />
17
+ <TOption label="数字" value="number" />
18
+ <TOption label="布尔" value="boolean" />
19
+ <TOption label="JSON" value="json" />
20
+ </TSelect>
21
+ </TFormItem>
22
+ <TFormItem label="配置分组" prop="group">
23
+ <TSelect v-model="$Data.formData.group" placeholder="请选择分组" clearable :disabled="$Data.isSystem">
24
+ <TOption v-for="item in $Data2.groupOptions" :key="item" :label="item" :value="item" />
25
+ </TSelect>
26
+ </TFormItem>
27
+ <TFormItem label="排序" prop="sort">
28
+ <TInputNumber v-model="$Data.formData.sort" :min="0" :max="9999" :disabled="$Data.isSystem" />
29
+ </TFormItem>
30
+ <TFormItem label="描述说明" prop="description">
31
+ <TTextarea v-model="$Data.formData.description" placeholder="请输入描述说明" :autosize="{ minRows: 2, maxRows: 4 }" :disabled="$Data.isSystem" />
32
+ </TFormItem>
33
+ <TFormItem v-if="$Prop.actionType === 'upd' && !$Data.isSystem" label="状态" prop="state">
34
+ <TRadioGroup v-model="$Data.formData.state">
35
+ <TRadio :value="1">正常</TRadio>
36
+ <TRadio :value="2">禁用</TRadio>
37
+ </TRadioGroup>
38
+ </TFormItem>
39
+ </TForm>
40
+ <template #footer>
41
+ <TButton @click="$Method.onClose">取消</TButton>
42
+ <TButton theme="primary" :loading="$Data.submitting" @click="$Method.onSubmit">确定</TButton>
43
+ </template>
44
+ </TDialog>
45
+ </template>
46
+
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';
51
+
52
+ const $Prop = defineProps({
53
+ modelValue: {
54
+ type: Boolean,
55
+ default: false
56
+ },
57
+ actionType: {
58
+ type: String,
59
+ default: 'add'
60
+ },
61
+ rowData: {
62
+ type: Object,
63
+ default: () => ({})
64
+ }
65
+ });
66
+
67
+ const $Emit = defineEmits(['update:modelValue', 'success']);
68
+
69
+ // 表单引用
70
+ const $Form = $shallowRef({
71
+ form: null
72
+ });
73
+
74
+ const $Data = $ref({
75
+ visible: false,
76
+ submitting: false,
77
+ isSystem: false,
78
+ formData: {
79
+ id: 0,
80
+ name: '',
81
+ code: '',
82
+ value: '',
83
+ valueType: 'string',
84
+ group: '',
85
+ sort: 0,
86
+ description: '',
87
+ state: 1
88
+ }
89
+ });
90
+
91
+ const $Data2 = $shallowRef({
92
+ formRules: {
93
+ name: [{ required: true, message: '请输入配置名称', trigger: 'blur' }],
94
+ code: [
95
+ { required: true, message: '请输入配置代码', trigger: 'blur' },
96
+ { pattern: /^[a-zA-Z0-9_]+$/, message: '配置代码只能包含字母、数字和下划线', trigger: 'blur' }
97
+ ],
98
+ value: [{ required: true, message: '请输入配置值', trigger: 'blur' }],
99
+ valueType: [{ required: true, message: '请选择值类型', trigger: 'change' }]
100
+ },
101
+ groupOptions: ['基础配置', '邮件配置', '存储配置', '安全配置', '其他']
102
+ });
103
+
104
+ // 方法集合
105
+ const $Method = {
106
+ async initData() {
107
+ $Method.onShow();
108
+ },
109
+
110
+ onShow() {
111
+ $Data.visible = true;
112
+ if ($Prop.actionType === 'upd' && $Prop.rowData) {
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 || '';
119
+ $Data.formData.sort = $Prop.rowData.sort || 0;
120
+ $Data.formData.description = $Prop.rowData.description || '';
121
+ $Data.formData.state = $Prop.rowData.state || 1;
122
+ $Data.isSystem = $Prop.rowData.isSystem === 1;
123
+ } else {
124
+ $Data.formData = {
125
+ id: 0,
126
+ name: '',
127
+ code: '',
128
+ value: '',
129
+ valueType: 'string',
130
+ group: '',
131
+ sort: 0,
132
+ description: '',
133
+ state: 1
134
+ };
135
+ $Data.isSystem = false;
136
+ }
137
+ },
138
+
139
+ onClose() {
140
+ $Data.visible = false;
141
+ $Emit('update:modelValue', false);
142
+ },
143
+
144
+ async onSubmit() {
145
+ const valid = await $Form.form?.validate();
146
+ if (valid !== true) return;
147
+
148
+ $Data.submitting = true;
149
+ try {
150
+ const api = $Prop.actionType === 'upd' ? '/addon/admin/sysConfig/upd' : '/addon/admin/sysConfig/ins';
151
+ const res = await $Http(api, $Data.formData);
152
+
153
+ if (res.code === 0) {
154
+ MessagePlugin.success($Prop.actionType === 'upd' ? '编辑成功' : '添加成功');
155
+ $Emit('success');
156
+ $Method.onClose();
157
+ } else {
158
+ MessagePlugin.error(res.msg || '操作失败');
159
+ }
160
+ } catch (error) {
161
+ MessagePlugin.error('操作失败');
162
+ } finally {
163
+ $Data.submitting = false;
164
+ }
165
+ }
166
+ };
167
+
168
+ watch(
169
+ () => $Prop.modelValue,
170
+ (val) => {
171
+ if (val) {
172
+ $Method.initData();
173
+ }
174
+ },
175
+ { immediate: true }
176
+ );
177
+ </script>
178
+
179
+ <style scoped lang="scss"></style>
@@ -0,0 +1,256 @@
1
+ <template>
2
+ <div class="page-sys-config page-table">
3
+ <div class="main-tool">
4
+ <div class="left">
5
+ <TButton theme="primary" @click="$Method.onAction('add', {})">
6
+ <template #icon>
7
+ <ILucidePlus />
8
+ </template>
9
+ 新增配置
10
+ </TButton>
11
+ <TSelect v-model="$Data.filter.group" placeholder="配置分组" clearable style="width: 150px" @change="$Method.handleFilter">
12
+ <TOption v-for="item in $Data.groupOptions" :key="item" :label="item" :value="item" />
13
+ </TSelect>
14
+ </div>
15
+ <div class="right">
16
+ <TButton shape="circle" @click="$Method.handleRefresh">
17
+ <template #icon>
18
+ <ILucideRotateCw />
19
+ </template>
20
+ </TButton>
21
+ </div>
22
+ </div>
23
+
24
+ <div class="main-content">
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="100%" active-row-type="single" @active-change="$Method.onActiveChange">
27
+ <template #isSystem="{ row }">
28
+ <TTag v-if="row.isSystem === 1" shape="round" theme="warning" variant="light-outline">系统</TTag>
29
+ <TTag v-else shape="round" variant="light-outline">自定义</TTag>
30
+ </template>
31
+ <template #valueType="{ row }">
32
+ <TTag shape="round" variant="light-outline">{{ row.valueType }}</TTag>
33
+ </template>
34
+ <template #state="{ row }">
35
+ <TTag v-if="row.state === 1" shape="round" theme="success" variant="light-outline">正常</TTag>
36
+ <TTag v-else-if="row.state === 2" shape="round" theme="warning" variant="light-outline">禁用</TTag>
37
+ </template>
38
+ <template #operation="{ row }">
39
+ <TDropdown trigger="click" placement="bottom-right" @click="(data) => $Method.onAction(data.value, row)">
40
+ <TButton theme="primary" size="small">
41
+ 操作
42
+ <template #suffix><t-icon name="chevron-down" size="16" /></template>
43
+ </TButton>
44
+ <TDropdownMenu slot="dropdown">
45
+ <TDropdownItem value="upd">
46
+ <ILucidePencil />
47
+ 编辑
48
+ </TDropdownItem>
49
+ <TDropdownItem v-if="row.isSystem !== 1" value="del" :divider="true">
50
+ <ILucideTrash2 style="width: 14px; height: 14px; margin-right: 6px" />
51
+ 删除
52
+ </TDropdownItem>
53
+ </TDropdownMenu>
54
+ </TDropdown>
55
+ </template>
56
+ </TTable>
57
+ </div>
58
+
59
+ <div class="main-detail">
60
+ <DetailPanel :data="$Data.currentRow" :fields="$Data.detailFields">
61
+ <template #isSystem="{ value }">
62
+ <TTag v-if="value === 1" shape="round" theme="warning" variant="light-outline">系统配置</TTag>
63
+ <TTag v-else shape="round" variant="light-outline">自定义配置</TTag>
64
+ </template>
65
+ <template #valueType="{ value }">
66
+ <TTag shape="round" variant="light-outline">{{ value }}</TTag>
67
+ </template>
68
+ <template #value="{ value }">
69
+ <pre class="config-value">{{ value }}</pre>
70
+ </template>
71
+ </DetailPanel>
72
+ </div>
73
+ </div>
74
+
75
+ <div class="main-page">
76
+ <TPagination :current-page="$Data.pagerConfig.currentPage" :page-size="$Data.pagerConfig.limit" :total="$Data.pagerConfig.total" @current-change="$Method.onPageChange" @page-size-change="$Method.handleSizeChange" />
77
+ </div>
78
+
79
+ <!-- 编辑对话框 -->
80
+ <EditDialog v-if="$Data.editVisible" v-model="$Data.editVisible" :action-type="$Data.actionType" :row-data="$Data.rowData" @success="$Method.apiConfigList" />
81
+ </div>
82
+ </template>
83
+
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 EditDialog from './components/edit.vue';
91
+ import DetailPanel from '@/components/DetailPanel.vue';
92
+ import { $Http } from '@/plugins/http';
93
+ import { withDefaultColumns } from '@/utils';
94
+
95
+ // 响应式数据
96
+ const $Data = $ref({
97
+ tableData: [],
98
+ loading: false,
99
+ columns: withDefaultColumns([
100
+ { colKey: 'name', title: '配置名称', fixed: 'left', width: 150 },
101
+ { colKey: 'id', title: '序号', width: 80 },
102
+ { colKey: 'code', title: '配置代码', ellipsis: true },
103
+ { colKey: 'value', title: '配置值', ellipsis: true, width: 200 },
104
+ { colKey: 'valueType', title: '值类型', width: 100 },
105
+ { colKey: 'group', title: '分组', width: 100 },
106
+ { colKey: 'sort', title: '排序', width: 80 },
107
+ { colKey: 'isSystem', title: '类型', width: 80 },
108
+ { colKey: 'state', title: '状态', width: 80 },
109
+ { colKey: 'operation', title: '操作', width: 100 }
110
+ ]),
111
+ detailFields: [
112
+ { colKey: 'name', title: '配置名称' },
113
+ { colKey: 'code', title: '配置代码' },
114
+ { colKey: 'value', title: '配置值' },
115
+ { colKey: 'valueType', title: '值类型' },
116
+ { colKey: 'group', title: '配置分组' },
117
+ { colKey: 'sort', title: '排序' },
118
+ { colKey: 'isSystem', title: '配置类型' },
119
+ { colKey: 'description', title: '描述说明' }
120
+ ],
121
+ pagerConfig: {
122
+ currentPage: 1,
123
+ limit: 30,
124
+ total: 0
125
+ },
126
+ currentRow: null,
127
+ activeRowKeys: [],
128
+ editVisible: false,
129
+ actionType: 'add',
130
+ rowData: {},
131
+ filter: {
132
+ group: ''
133
+ },
134
+ groupOptions: ['基础配置', '邮件配置', '存储配置', '安全配置', '其他']
135
+ });
136
+
137
+ // 方法
138
+ const $Method = {
139
+ async initData() {
140
+ await $Method.apiConfigList();
141
+ },
142
+
143
+ // 加载配置列表
144
+ async apiConfigList() {
145
+ $Data.loading = true;
146
+ try {
147
+ const res = await $Http('/addon/admin/sysConfig/list', {
148
+ page: $Data.pagerConfig.currentPage,
149
+ limit: $Data.pagerConfig.limit
150
+ });
151
+ $Data.tableData = res.data.lists || [];
152
+ $Data.pagerConfig.total = res.data.total || 0;
153
+
154
+ if ($Data.tableData.length > 0) {
155
+ $Data.currentRow = $Data.tableData[0];
156
+ $Data.activeRowKeys = [$Data.tableData[0].id];
157
+ } else {
158
+ $Data.currentRow = null;
159
+ $Data.activeRowKeys = [];
160
+ }
161
+ } catch (error) {
162
+ MessagePlugin.error('加载数据失败');
163
+ } finally {
164
+ $Data.loading = false;
165
+ }
166
+ },
167
+
168
+ // 删除配置
169
+ async apiConfigDel(row) {
170
+ if (row.isSystem === 1) {
171
+ MessagePlugin.warning('系统配置不允许删除');
172
+ return;
173
+ }
174
+
175
+ DialogPlugin.confirm({
176
+ header: '确认删除',
177
+ body: `确定要删除配置"${row.name}"吗?`,
178
+ status: 'warning'
179
+ }).then(async () => {
180
+ try {
181
+ const res = await $Http('/addon/admin/sysConfig/del', { id: row.id });
182
+ if (res.code === 0) {
183
+ MessagePlugin.success('删除成功');
184
+ $Method.apiConfigList();
185
+ } else {
186
+ MessagePlugin.error(res.msg || '删除失败');
187
+ }
188
+ } catch (error) {
189
+ MessagePlugin.error('删除失败');
190
+ }
191
+ });
192
+ },
193
+
194
+ // 筛选
195
+ handleFilter() {
196
+ $Data.pagerConfig.currentPage = 1;
197
+ $Method.apiConfigList();
198
+ },
199
+
200
+ // 刷新
201
+ handleRefresh() {
202
+ $Method.apiConfigList();
203
+ },
204
+
205
+ // 分页改变
206
+ onPageChange(currentPage) {
207
+ $Data.pagerConfig.currentPage = currentPage;
208
+ $Method.apiConfigList();
209
+ },
210
+
211
+ // 每页条数改变
212
+ handleSizeChange(pageSize) {
213
+ $Data.pagerConfig.limit = pageSize;
214
+ $Data.pagerConfig.currentPage = 1;
215
+ $Method.apiConfigList();
216
+ },
217
+
218
+ // 高亮行变化
219
+ onActiveChange(value, context) {
220
+ if (value.length === 0 && $Data.activeRowKeys.length > 0) {
221
+ return;
222
+ }
223
+ $Data.activeRowKeys = value;
224
+ if (context.activeRowList && context.activeRowList.length > 0) {
225
+ $Data.currentRow = context.activeRowList[0].row;
226
+ }
227
+ },
228
+
229
+ // 操作菜单点击
230
+ onAction(command, rowData) {
231
+ $Data.actionType = command;
232
+ $Data.rowData = rowData;
233
+ if (command === 'add' || command === 'upd') {
234
+ $Data.editVisible = true;
235
+ } else if (command === 'del') {
236
+ $Method.apiConfigDel(rowData);
237
+ }
238
+ }
239
+ };
240
+
241
+ $Method.initData();
242
+ </script>
243
+
244
+ <style scoped lang="scss">
245
+ .config-value {
246
+ margin: 0;
247
+ padding: 8px;
248
+ background: var(--td-bg-color-container);
249
+ border-radius: 4px;
250
+ font-size: 12px;
251
+ max-height: 150px;
252
+ overflow: auto;
253
+ white-space: pre-wrap;
254
+ word-break: break-all;
255
+ }
256
+ </style>
@@ -0,0 +1,4 @@
1
+ {
2
+ "name": "系统配置",
3
+ "order": 2
4
+ }