zant-admin 1.0.4 → 2.0.1
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/README.en.md +414 -25
- package/README.md +460 -285
- package/bin/cli.js +3 -3
- package/bin/generator.js +502 -502
- package/bin/prompts.js +158 -158
- package/bin/utils.js +133 -133
- package/package.json +2 -2
- package/public/logo.png +0 -0
- package/src/App.vue +16 -16
- package/src/api/methods/department.js +36 -0
- package/src/api/methods/employee.js +22 -0
- package/src/api/methods/logError.js +8 -8
- package/src/api/methods/logOperation.js +8 -8
- package/src/api/methods/login.js +6 -6
- package/src/api/methods/position.js +26 -0
- package/src/api/methods/quartz.js +36 -36
- package/src/api/methods/region.js +16 -16
- package/src/api/methods/sysAccount.js +29 -29
- package/src/api/methods/sysDict.js +29 -29
- package/src/api/methods/sysDictItem.js +26 -26
- package/src/api/methods/sysMenu.js +42 -42
- package/src/api/methods/sysRole.js +35 -35
- package/src/api/methods/sysUser.js +25 -25
- package/src/api/methods/system.js +15 -15
- package/src/api/request.js +225 -225
- package/src/assets/css/style.css +2 -2
- package/src/assets/css/zcui.css +1023 -1023
- package/src/assets/imgs/logo.png +0 -0
- package/src/assets/imgs/md/console.png +0 -0
- package/src/assets/imgs/md/login.png +0 -0
- package/src/assets/imgs/md/menu.png +0 -0
- package/src/assets/imgs/md/serviceMonitoring.png +0 -0
- package/src/assets/imgs/md/statistics.png +0 -0
- package/src/components/FormTable.vue +5 -19
- package/src/components/IconPicker.vue +351 -351
- package/src/components/MainPage.vue +838 -838
- package/src/components/details/logErrorDetails.vue +58 -58
- package/src/components/details/logOperationDetails.vue +76 -76
- package/src/components/edit/QuartzEdit.vue +221 -221
- package/src/components/edit/SysAccountEdit.vue +185 -185
- package/src/components/edit/SysDictEdit.vue +116 -116
- package/src/components/edit/SysDictItemEdit.vue +136 -136
- package/src/components/edit/SysRoleEdit.vue +111 -111
- package/src/components/edit/organizationalStructure/DepartmentEdit.vue +162 -0
- package/src/components/edit/organizationalStructure/EmployeeEdit.vue +295 -0
- package/src/components/edit/organizationalStructure/PositionEdit.vue +166 -0
- package/src/components/edit/sysMenuEdit.vue +2 -1
- package/src/config/index.js +74 -74
- package/src/directives/permission.js +49 -49
- package/src/main.js +37 -37
- package/src/router/index.js +4 -6
- package/src/stores/config.js +43 -43
- package/src/stores/dict.js +33 -33
- package/src/stores/menu.js +81 -81
- package/src/stores/user.js +21 -21
- package/src/utils/baseEcharts.js +661 -661
- package/src/utils/dictTemplate.js +26 -26
- package/src/utils/regionUtils.js +173 -173
- package/src/utils/useFormCRUD.js +59 -59
- package/src/views/baiscstatis/center.vue +474 -474
- package/src/views/baiscstatis/iframePage.vue +29 -29
- package/src/views/baiscstatis/notFound.vue +192 -192
- package/src/views/console.vue +821 -821
- package/src/views/demo/button.vue +269 -269
- package/src/views/demo/importexport.vue +119 -119
- package/src/views/demo/region.vue +322 -322
- package/src/views/demo/statistics.vue +214 -214
- package/src/views/home.vue +6 -6
- package/src/views/login.vue +264 -149
- package/src/views/operations/log/logError.vue +78 -78
- package/src/views/operations/log/logLogin.vue +66 -66
- package/src/views/operations/log/logOperation.vue +103 -103
- package/src/views/operations/log/logQuartz.vue +56 -56
- package/src/views/operations/quartz.vue +179 -179
- package/src/views/operations/serviceMonitoring.vue +134 -134
- package/src/views/organizationalStructure/department.vue +194 -0
- package/src/views/organizationalStructure/employee.vue +234 -0
- package/src/views/organizationalStructure/position.vue +196 -0
- package/src/views/system/sysAccount.vue +128 -128
- package/src/views/system/sysDict.vue +159 -159
- package/src/views/system/sysDictItem.vue +118 -118
- package/src/views/system/sysMenu.vue +225 -225
- package/src/views/system/sysRole.vue +207 -207
- package/src/assets/imgs/md/1.png +0 -0
- package/src/assets/imgs/md/10.png +0 -0
- package/src/assets/imgs/md/11.png +0 -0
- package/src/assets/imgs/md/2.png +0 -0
- package/src/assets/imgs/md/3.png +0 -0
- package/src/assets/imgs/md/4.png +0 -0
- package/src/assets/imgs/md/5.png +0 -0
- package/src/assets/imgs/md/6.png +0 -0
- package/src/assets/imgs/md/7.png +0 -0
- package/src/assets/imgs/md/8.png +0 -0
- package/src/assets/imgs/md/9.png +0 -0
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<a-drawer
|
|
3
|
+
:title="editTitle"
|
|
4
|
+
:width="540"
|
|
5
|
+
:open="open"
|
|
6
|
+
:body-style="{ paddingBottom: '80px' }"
|
|
7
|
+
:footer-style="{ textAlign: 'right' }"
|
|
8
|
+
@close="onClose"
|
|
9
|
+
:destroyOnClose="true"
|
|
10
|
+
>
|
|
11
|
+
<a-skeleton :loading="initloading" active>
|
|
12
|
+
<a-form :model="formInfo" ref="formRef" layout="vertical">
|
|
13
|
+
<a-row :gutter="16">
|
|
14
|
+
<a-col :span="12">
|
|
15
|
+
<a-form-item label="工号" name="employeeNo" :rules="[{ required: true, message: '请输入工号' }]">
|
|
16
|
+
<a-input v-model:value="formInfo.employeeNo" placeholder="请输入" />
|
|
17
|
+
</a-form-item>
|
|
18
|
+
</a-col>
|
|
19
|
+
<a-col :span="12">
|
|
20
|
+
<a-form-item label="姓名" name="name" :rules="[{ required: true, message: '请输入姓名' }]">
|
|
21
|
+
<a-input v-model:value="formInfo.name" placeholder="请输入" />
|
|
22
|
+
</a-form-item>
|
|
23
|
+
</a-col>
|
|
24
|
+
</a-row>
|
|
25
|
+
<a-row :gutter="16">
|
|
26
|
+
<a-col :span="12">
|
|
27
|
+
<a-form-item label="性别" name="gender">
|
|
28
|
+
<a-select
|
|
29
|
+
v-model:value="formInfo.gender"
|
|
30
|
+
placeholder="请选择"
|
|
31
|
+
:options="genderOptions"
|
|
32
|
+
/>
|
|
33
|
+
</a-form-item>
|
|
34
|
+
</a-col>
|
|
35
|
+
<a-col :span="12">
|
|
36
|
+
<a-form-item label="手机号" name="mobile" :rules="[{ required: true, message: '请输入手机号' }]">
|
|
37
|
+
<a-input v-model:value="formInfo.mobile" placeholder="请输入" />
|
|
38
|
+
</a-form-item>
|
|
39
|
+
</a-col>
|
|
40
|
+
</a-row>
|
|
41
|
+
<a-row :gutter="16">
|
|
42
|
+
<a-col :span="12">
|
|
43
|
+
<a-form-item label="邮箱" name="email">
|
|
44
|
+
<a-input v-model:value="formInfo.email" placeholder="请输入" />
|
|
45
|
+
</a-form-item>
|
|
46
|
+
</a-col>
|
|
47
|
+
<a-col :span="12">
|
|
48
|
+
<a-form-item label="身份证号" name="idCard">
|
|
49
|
+
<a-input v-model:value="formInfo.idCard" placeholder="请输入" />
|
|
50
|
+
</a-form-item>
|
|
51
|
+
</a-col>
|
|
52
|
+
</a-row>
|
|
53
|
+
<a-form-item label="所属组织" name="departmentId" :rules="[{ required: true, message: '请选择所属组织' }]">
|
|
54
|
+
<a-tree-select
|
|
55
|
+
v-model:value="formInfo.departmentId"
|
|
56
|
+
show-search
|
|
57
|
+
style="width: 100%"
|
|
58
|
+
:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
|
|
59
|
+
placeholder="请选择"
|
|
60
|
+
allow-clear
|
|
61
|
+
tree-default-expand-all
|
|
62
|
+
:tree-data="orgTree"
|
|
63
|
+
tree-node-filter-prop="label"
|
|
64
|
+
/>
|
|
65
|
+
</a-form-item>
|
|
66
|
+
<a-row :gutter="16">
|
|
67
|
+
<a-col :span="12">
|
|
68
|
+
<a-form-item label="主职位" name="positionId">
|
|
69
|
+
<a-select
|
|
70
|
+
v-model:value="formInfo.positionId"
|
|
71
|
+
placeholder="请选择"
|
|
72
|
+
:options="positionOptions"
|
|
73
|
+
show-search
|
|
74
|
+
:filter-option="filterOption"
|
|
75
|
+
/>
|
|
76
|
+
</a-form-item>
|
|
77
|
+
</a-col>
|
|
78
|
+
<a-col :span="12">
|
|
79
|
+
<a-form-item label="直属上级" name="managerId">
|
|
80
|
+
<a-select
|
|
81
|
+
v-model:value="formInfo.managerId"
|
|
82
|
+
placeholder="请选择"
|
|
83
|
+
:options="managerOptions"
|
|
84
|
+
show-search
|
|
85
|
+
allow-clear
|
|
86
|
+
:filter-option="filterOption"
|
|
87
|
+
/>
|
|
88
|
+
</a-form-item>
|
|
89
|
+
</a-col>
|
|
90
|
+
</a-row>
|
|
91
|
+
<a-row :gutter="16">
|
|
92
|
+
<a-col :span="12">
|
|
93
|
+
<a-form-item label="员工状态" name="status" :rules="[{ required: true, message: '请选择员工状态' }]">
|
|
94
|
+
<a-select
|
|
95
|
+
v-model:value="formInfo.status"
|
|
96
|
+
placeholder="请选择"
|
|
97
|
+
:options="statusOptions"
|
|
98
|
+
/>
|
|
99
|
+
</a-form-item>
|
|
100
|
+
</a-col>
|
|
101
|
+
<a-col :span="12">
|
|
102
|
+
<a-form-item label="员工类型" name="employeeType" :rules="[{ required: true, message: '请选择员工类型' }]">
|
|
103
|
+
<a-select
|
|
104
|
+
v-model:value="formInfo.employeeType"
|
|
105
|
+
placeholder="请选择"
|
|
106
|
+
:options="employeeTypeOptions"
|
|
107
|
+
/>
|
|
108
|
+
</a-form-item>
|
|
109
|
+
</a-col>
|
|
110
|
+
</a-row>
|
|
111
|
+
<a-row :gutter="16">
|
|
112
|
+
<a-col :span="12">
|
|
113
|
+
<a-form-item label="入职日期" name="entryDate">
|
|
114
|
+
<a-date-picker
|
|
115
|
+
v-model:value="formInfo.entryDate"
|
|
116
|
+
style="width: 100%"
|
|
117
|
+
value-format="YYYY-MM-DD"
|
|
118
|
+
placeholder="请选择"
|
|
119
|
+
/>
|
|
120
|
+
</a-form-item>
|
|
121
|
+
</a-col>
|
|
122
|
+
<a-col :span="12">
|
|
123
|
+
<a-form-item label="离职日期" name="leaveDate">
|
|
124
|
+
<a-date-picker
|
|
125
|
+
v-model:value="formInfo.leaveDate"
|
|
126
|
+
style="width: 100%"
|
|
127
|
+
value-format="YYYY-MM-DD"
|
|
128
|
+
placeholder="请选择"
|
|
129
|
+
/>
|
|
130
|
+
</a-form-item>
|
|
131
|
+
</a-col>
|
|
132
|
+
</a-row>
|
|
133
|
+
<a-form-item label="是否启用" name="isEnable">
|
|
134
|
+
<a-switch v-model:checked="formInfo.isEnable" />
|
|
135
|
+
</a-form-item>
|
|
136
|
+
</a-form>
|
|
137
|
+
</a-skeleton>
|
|
138
|
+
<template #extra>
|
|
139
|
+
<a-space>
|
|
140
|
+
<a-button type="primary" @click="onSave" :loading="loading">保存</a-button>
|
|
141
|
+
<a-button @click="resetForm">重置</a-button>
|
|
142
|
+
</a-space>
|
|
143
|
+
</template>
|
|
144
|
+
</a-drawer>
|
|
145
|
+
</template>
|
|
146
|
+
|
|
147
|
+
<script setup>
|
|
148
|
+
import { defineProps, defineEmits, ref, reactive, watch } from 'vue'
|
|
149
|
+
import { message } from 'ant-design-vue'
|
|
150
|
+
import employee from '@/api/methods/employee'
|
|
151
|
+
import department from '@/api/methods/department'
|
|
152
|
+
import position from '@/api/methods/position'
|
|
153
|
+
import useFormCRUD from '@/utils/useFormCRUD'
|
|
154
|
+
|
|
155
|
+
const props = defineProps({
|
|
156
|
+
open: {
|
|
157
|
+
type: Boolean,
|
|
158
|
+
required: true,
|
|
159
|
+
},
|
|
160
|
+
})
|
|
161
|
+
|
|
162
|
+
const genderOptions = [
|
|
163
|
+
{ label: '未知', value: 0 },
|
|
164
|
+
{ label: '男', value: 1 },
|
|
165
|
+
{ label: '女', value: 2 },
|
|
166
|
+
]
|
|
167
|
+
|
|
168
|
+
const statusOptions = [
|
|
169
|
+
{ label: '试用期', value: 0 },
|
|
170
|
+
{ label: '正式', value: 1 },
|
|
171
|
+
{ label: '离职', value: 2 },
|
|
172
|
+
{ label: '待入职', value: 3 },
|
|
173
|
+
]
|
|
174
|
+
|
|
175
|
+
const employeeTypeOptions = [
|
|
176
|
+
{ label: '正式员工', value: 0 },
|
|
177
|
+
{ label: '实习生', value: 1 },
|
|
178
|
+
{ label: '外包', value: 2 },
|
|
179
|
+
{ label: '兼职', value: 3 },
|
|
180
|
+
]
|
|
181
|
+
|
|
182
|
+
const defaultformInfo = {
|
|
183
|
+
id: null,
|
|
184
|
+
employeeNo: '',
|
|
185
|
+
name: '',
|
|
186
|
+
gender: 0,
|
|
187
|
+
mobile: '',
|
|
188
|
+
email: '',
|
|
189
|
+
idCard: '',
|
|
190
|
+
departmentId: null,
|
|
191
|
+
positionId: null,
|
|
192
|
+
managerId: null,
|
|
193
|
+
entryDate: null,
|
|
194
|
+
leaveDate: null,
|
|
195
|
+
status: 0,
|
|
196
|
+
employeeType: 0,
|
|
197
|
+
isEnable: true,
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
const formInfo = reactive({ ...defaultformInfo })
|
|
201
|
+
const editTitle = ref('新增')
|
|
202
|
+
const formRef = ref(null)
|
|
203
|
+
const orgTree = ref([])
|
|
204
|
+
const positionOptions = ref([])
|
|
205
|
+
const managerOptions = ref([])
|
|
206
|
+
const emit = defineEmits(['close', 'updateData'])
|
|
207
|
+
const { loading, save } = useFormCRUD(employee)
|
|
208
|
+
|
|
209
|
+
const filterOption = (input, option) => {
|
|
210
|
+
return option.label.toLowerCase().includes(input.toLowerCase())
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
const resetForm = () => {
|
|
214
|
+
Object.assign(formInfo, defaultformInfo)
|
|
215
|
+
formRef.value?.resetFields()
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
const initloading = ref(false)
|
|
219
|
+
|
|
220
|
+
const init = async id => {
|
|
221
|
+
initloading.value = true
|
|
222
|
+
const isEdit = !!id
|
|
223
|
+
editTitle.value = isEdit ? '修改' : '新增'
|
|
224
|
+
|
|
225
|
+
if (isEdit) {
|
|
226
|
+
try {
|
|
227
|
+
const res = await employee.get({ id })
|
|
228
|
+
initloading.value = false
|
|
229
|
+
Object.assign(formInfo, res.data)
|
|
230
|
+
} catch (error) {
|
|
231
|
+
message.error('获取信息失败,请重试')
|
|
232
|
+
initloading.value = false
|
|
233
|
+
}
|
|
234
|
+
} else {
|
|
235
|
+
initloading.value = false
|
|
236
|
+
resetForm()
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
const onSave = async () => {
|
|
241
|
+
await save(formRef.value, formInfo, {
|
|
242
|
+
onSuccess: () => {
|
|
243
|
+
emit('updateData')
|
|
244
|
+
onClose()
|
|
245
|
+
},
|
|
246
|
+
})
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
const onClose = () => {
|
|
250
|
+
resetForm()
|
|
251
|
+
emit('close')
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// 根据部门Id获取职位列表
|
|
255
|
+
const getPositionByDept = async (departmentId) => {
|
|
256
|
+
if (!departmentId) {
|
|
257
|
+
positionOptions.value = []
|
|
258
|
+
return
|
|
259
|
+
}
|
|
260
|
+
try {
|
|
261
|
+
const res = await position.getpositionByDepartmentId({ departmentId })
|
|
262
|
+
positionOptions.value = res.data || []
|
|
263
|
+
} catch (error) {}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// 监听部门变化,重新获取职位列表
|
|
267
|
+
watch(
|
|
268
|
+
() => formInfo.departmentId,
|
|
269
|
+
(newVal, oldVal) => {
|
|
270
|
+
if (oldVal !== undefined && oldVal !== null) {
|
|
271
|
+
formInfo.positionId = null
|
|
272
|
+
}
|
|
273
|
+
getPositionByDept(newVal)
|
|
274
|
+
},
|
|
275
|
+
)
|
|
276
|
+
|
|
277
|
+
// 获取组织树
|
|
278
|
+
const getOrgTree = async () => {
|
|
279
|
+
try {
|
|
280
|
+
const res = await department.getTreeSelectNotopdepartment()
|
|
281
|
+
orgTree.value = res.data
|
|
282
|
+
} catch (error) {}
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
// 设置所属组织(从列表页传入)
|
|
286
|
+
const setDepartmentId = departmentId => {
|
|
287
|
+
formInfo.departmentId = departmentId
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
defineExpose({
|
|
291
|
+
init,
|
|
292
|
+
getOrgTree,
|
|
293
|
+
setDepartmentId,
|
|
294
|
+
})
|
|
295
|
+
</script>
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<a-drawer
|
|
3
|
+
:title="editTitle"
|
|
4
|
+
:width="540"
|
|
5
|
+
:open="open"
|
|
6
|
+
:body-style="{ paddingBottom: '80px' }"
|
|
7
|
+
:footer-style="{ textAlign: 'right' }"
|
|
8
|
+
@close="onClose"
|
|
9
|
+
:destroyOnClose="true"
|
|
10
|
+
>
|
|
11
|
+
<a-skeleton :loading="initloading" active>
|
|
12
|
+
<a-form :model="formInfo" ref="formRef" layout="vertical">
|
|
13
|
+
<a-form-item label="所属组织" name="departmentId">
|
|
14
|
+
<a-tree-select
|
|
15
|
+
v-model:value="formInfo.departmentId"
|
|
16
|
+
show-search
|
|
17
|
+
style="width: 100%"
|
|
18
|
+
:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
|
|
19
|
+
placeholder="请选择(留空表示全局共享职位)"
|
|
20
|
+
allow-clear
|
|
21
|
+
tree-default-expand-all
|
|
22
|
+
:tree-data="orgTree"
|
|
23
|
+
tree-node-filter-prop="label"
|
|
24
|
+
/>
|
|
25
|
+
</a-form-item>
|
|
26
|
+
<a-form-item label="职位名称" name="name" :rules="[{ required: true, message: '请输入职位名称' }]">
|
|
27
|
+
<a-input v-model:value="formInfo.name" placeholder="请输入" />
|
|
28
|
+
</a-form-item>
|
|
29
|
+
<a-form-item label="职位编码" name="code">
|
|
30
|
+
<a-input v-model:value="formInfo.code" placeholder="请输入" />
|
|
31
|
+
</a-form-item>
|
|
32
|
+
<a-form-item label="分类" name="type" :rules="[{ required: true, message: '请选择分类' }]">
|
|
33
|
+
<a-select
|
|
34
|
+
v-model:value="formInfo.type"
|
|
35
|
+
placeholder="请选择"
|
|
36
|
+
:options="typeOptions"
|
|
37
|
+
/>
|
|
38
|
+
</a-form-item>
|
|
39
|
+
<a-form-item label="职位级别" name="level" :rules="[{ required: true, message: '请输入职位级别' }]">
|
|
40
|
+
<a-input-number
|
|
41
|
+
v-model:value="formInfo.level"
|
|
42
|
+
:min="0"
|
|
43
|
+
style="width: 100%"
|
|
44
|
+
placeholder="请输入"
|
|
45
|
+
/>
|
|
46
|
+
</a-form-item>
|
|
47
|
+
<a-form-item label="排序序号" name="sort">
|
|
48
|
+
<a-input-number
|
|
49
|
+
v-model:value="formInfo.sort"
|
|
50
|
+
:min="0"
|
|
51
|
+
style="width: 100%"
|
|
52
|
+
placeholder="请输入"
|
|
53
|
+
/>
|
|
54
|
+
</a-form-item>
|
|
55
|
+
<a-form-item label="是否启用" name="isEnable">
|
|
56
|
+
<a-switch v-model:checked="formInfo.isEnable" />
|
|
57
|
+
</a-form-item>
|
|
58
|
+
</a-form>
|
|
59
|
+
</a-skeleton>
|
|
60
|
+
<template #extra>
|
|
61
|
+
<a-space>
|
|
62
|
+
<a-button type="primary" @click="onSave" :loading="loading">保存</a-button>
|
|
63
|
+
<a-button @click="resetForm">重置</a-button>
|
|
64
|
+
</a-space>
|
|
65
|
+
</template>
|
|
66
|
+
</a-drawer>
|
|
67
|
+
</template>
|
|
68
|
+
|
|
69
|
+
<script setup>
|
|
70
|
+
import { defineProps, defineEmits, ref, reactive } from 'vue'
|
|
71
|
+
import { message } from 'ant-design-vue'
|
|
72
|
+
import position from '@/api/methods/position'
|
|
73
|
+
import department from '@/api/methods/department'
|
|
74
|
+
import useFormCRUD from '@/utils/useFormCRUD'
|
|
75
|
+
|
|
76
|
+
const props = defineProps({
|
|
77
|
+
open: {
|
|
78
|
+
type: Boolean,
|
|
79
|
+
required: true,
|
|
80
|
+
},
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
const typeOptions = [
|
|
84
|
+
{ label: '高层', value: 0 },
|
|
85
|
+
{ label: '中层', value: 1 },
|
|
86
|
+
{ label: '基层', value: 2 },
|
|
87
|
+
]
|
|
88
|
+
|
|
89
|
+
const defaultformInfo = {
|
|
90
|
+
id: null,
|
|
91
|
+
departmentId: null,
|
|
92
|
+
name: '',
|
|
93
|
+
code: '',
|
|
94
|
+
type: 0,
|
|
95
|
+
level: 0,
|
|
96
|
+
sort: 0,
|
|
97
|
+
isEnable: true,
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const formInfo = reactive({ ...defaultformInfo })
|
|
101
|
+
const editTitle = ref('新增')
|
|
102
|
+
const formRef = ref(null)
|
|
103
|
+
const orgTree = ref([])
|
|
104
|
+
const emit = defineEmits(['close', 'updateData'])
|
|
105
|
+
const { loading, save } = useFormCRUD(position)
|
|
106
|
+
|
|
107
|
+
const resetForm = () => {
|
|
108
|
+
Object.assign(formInfo, defaultformInfo)
|
|
109
|
+
formRef.value?.resetFields()
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const initloading = ref(false)
|
|
113
|
+
|
|
114
|
+
const init = async id => {
|
|
115
|
+
initloading.value = true
|
|
116
|
+
const isEdit = !!id
|
|
117
|
+
editTitle.value = isEdit ? '修改' : '新增'
|
|
118
|
+
|
|
119
|
+
if (isEdit) {
|
|
120
|
+
try {
|
|
121
|
+
const res = await position.get({ id })
|
|
122
|
+
initloading.value = false
|
|
123
|
+
Object.assign(formInfo, res.data)
|
|
124
|
+
} catch (error) {
|
|
125
|
+
message.error('获取信息失败,请重试')
|
|
126
|
+
initloading.value = false
|
|
127
|
+
}
|
|
128
|
+
} else {
|
|
129
|
+
initloading.value = false
|
|
130
|
+
resetForm()
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const onSave = async () => {
|
|
135
|
+
await save(formRef.value, formInfo, {
|
|
136
|
+
onSuccess: () => {
|
|
137
|
+
emit('updateData')
|
|
138
|
+
onClose()
|
|
139
|
+
},
|
|
140
|
+
})
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const onClose = () => {
|
|
144
|
+
resetForm()
|
|
145
|
+
emit('close')
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// 获取组织树
|
|
149
|
+
const getOrgTree = async () => {
|
|
150
|
+
try {
|
|
151
|
+
const res = await department.getTreeSelectNotopdepartment()
|
|
152
|
+
orgTree.value = res.data
|
|
153
|
+
} catch (error) {}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// 设置所属组织(从列表页传入)
|
|
157
|
+
const setDepartmentId = departmentId => {
|
|
158
|
+
formInfo.departmentId = departmentId
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
defineExpose({
|
|
162
|
+
init,
|
|
163
|
+
getOrgTree,
|
|
164
|
+
setDepartmentId,
|
|
165
|
+
})
|
|
166
|
+
</script>
|
|
@@ -263,9 +263,10 @@ const addSubmenu = record => {
|
|
|
263
263
|
formInfo.parentId = record.id
|
|
264
264
|
formInfo.path = record.path + '/'
|
|
265
265
|
formInfo.sort = record.sort
|
|
266
|
+
formInfo.type = 2
|
|
266
267
|
}
|
|
267
268
|
const addSubtn = record => {
|
|
268
|
-
editTitle.value = '
|
|
269
|
+
editTitle.value = '新增按钮'
|
|
269
270
|
resetForm()
|
|
270
271
|
formInfo.id = null
|
|
271
272
|
formInfo.parentId = record.id
|
package/src/config/index.js
CHANGED
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 全局配置文件
|
|
3
|
-
* 用于定义项目的全局配置信息
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
// 项目基本信息
|
|
7
|
-
export const projectConfig = {
|
|
8
|
-
// 项目名称
|
|
9
|
-
name: 'ZAntAdmin',
|
|
10
|
-
// 项目版本
|
|
11
|
-
version: '1.0.0',
|
|
12
|
-
// 项目描述
|
|
13
|
-
description: '基于 Vue 3.5 + Ant Design Vue 的管理系统',
|
|
14
|
-
// 项目作者
|
|
15
|
-
author: 'ZC',
|
|
16
|
-
// 项目主页
|
|
17
|
-
homepage: '',
|
|
18
|
-
// 项目仓库
|
|
19
|
-
repository: '',
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// API 配置
|
|
23
|
-
export const apiConfig = {
|
|
24
|
-
// API 基础路径
|
|
25
|
-
baseURL: import.meta.env.VITE_API_BASE_URL || '/api',
|
|
26
|
-
// 请求超时时间
|
|
27
|
-
timeout: 10000,
|
|
28
|
-
// 请求头
|
|
29
|
-
headers: {
|
|
30
|
-
'Content-Type': 'application/json',
|
|
31
|
-
},
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// 应用配置
|
|
35
|
-
export const appConfig = {
|
|
36
|
-
// 应用标题
|
|
37
|
-
title: projectConfig.name,
|
|
38
|
-
// 应用图标
|
|
39
|
-
icon: '/logo.png',
|
|
40
|
-
// 默认语言
|
|
41
|
-
defaultLanguage: 'zh-cn',
|
|
42
|
-
// 默认主题
|
|
43
|
-
defaultTheme: 'dark',
|
|
44
|
-
// 默认导航模式
|
|
45
|
-
defaultNavigationMode: 'side',
|
|
46
|
-
// 默认表格大小
|
|
47
|
-
defaultTableSize: 'middle',
|
|
48
|
-
// 默认表格边框
|
|
49
|
-
defaultTableBordered: true,
|
|
50
|
-
// 是否显示页脚
|
|
51
|
-
showFooter: true,
|
|
52
|
-
// 页脚文本
|
|
53
|
-
footerText: `© ${new Date().getFullYear()} ${projectConfig.name}`,
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// 路由配置
|
|
57
|
-
export const routerConfig = {
|
|
58
|
-
// 首页路径
|
|
59
|
-
homePath: '/console',
|
|
60
|
-
// 登录页路径
|
|
61
|
-
loginPath: '/login',
|
|
62
|
-
// 404 页面路径
|
|
63
|
-
notFoundPath: '/404',
|
|
64
|
-
// 是否开启路由守卫
|
|
65
|
-
guard: true,
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// 默认导出所有配置
|
|
69
|
-
export default {
|
|
70
|
-
project: projectConfig,
|
|
71
|
-
api: apiConfig,
|
|
72
|
-
app: appConfig,
|
|
73
|
-
router: routerConfig,
|
|
74
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* 全局配置文件
|
|
3
|
+
* 用于定义项目的全局配置信息
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// 项目基本信息
|
|
7
|
+
export const projectConfig = {
|
|
8
|
+
// 项目名称
|
|
9
|
+
name: 'ZAntAdmin',
|
|
10
|
+
// 项目版本
|
|
11
|
+
version: '1.0.0',
|
|
12
|
+
// 项目描述
|
|
13
|
+
description: '基于 Vue 3.5 + Ant Design Vue 的管理系统',
|
|
14
|
+
// 项目作者
|
|
15
|
+
author: 'ZC',
|
|
16
|
+
// 项目主页
|
|
17
|
+
homepage: '',
|
|
18
|
+
// 项目仓库
|
|
19
|
+
repository: '',
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// API 配置
|
|
23
|
+
export const apiConfig = {
|
|
24
|
+
// API 基础路径
|
|
25
|
+
baseURL: import.meta.env.VITE_API_BASE_URL || '/api',
|
|
26
|
+
// 请求超时时间
|
|
27
|
+
timeout: 10000,
|
|
28
|
+
// 请求头
|
|
29
|
+
headers: {
|
|
30
|
+
'Content-Type': 'application/json',
|
|
31
|
+
},
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// 应用配置
|
|
35
|
+
export const appConfig = {
|
|
36
|
+
// 应用标题
|
|
37
|
+
title: projectConfig.name,
|
|
38
|
+
// 应用图标
|
|
39
|
+
icon: '/logo.png',
|
|
40
|
+
// 默认语言
|
|
41
|
+
defaultLanguage: 'zh-cn',
|
|
42
|
+
// 默认主题
|
|
43
|
+
defaultTheme: 'dark',
|
|
44
|
+
// 默认导航模式
|
|
45
|
+
defaultNavigationMode: 'side',
|
|
46
|
+
// 默认表格大小
|
|
47
|
+
defaultTableSize: 'middle',
|
|
48
|
+
// 默认表格边框
|
|
49
|
+
defaultTableBordered: true,
|
|
50
|
+
// 是否显示页脚
|
|
51
|
+
showFooter: true,
|
|
52
|
+
// 页脚文本
|
|
53
|
+
footerText: `© ${new Date().getFullYear()} ${projectConfig.name}`,
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// 路由配置
|
|
57
|
+
export const routerConfig = {
|
|
58
|
+
// 首页路径
|
|
59
|
+
homePath: '/console',
|
|
60
|
+
// 登录页路径
|
|
61
|
+
loginPath: '/login',
|
|
62
|
+
// 404 页面路径
|
|
63
|
+
notFoundPath: '/404',
|
|
64
|
+
// 是否开启路由守卫
|
|
65
|
+
guard: true,
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// 默认导出所有配置
|
|
69
|
+
export default {
|
|
70
|
+
project: projectConfig,
|
|
71
|
+
api: apiConfig,
|
|
72
|
+
app: appConfig,
|
|
73
|
+
router: routerConfig,
|
|
74
|
+
}
|