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,194 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<a-row :gutter="16">
|
|
3
|
+
<a-col :span="4">
|
|
4
|
+
<div class="left-container">
|
|
5
|
+
<a-tree
|
|
6
|
+
v-if="treeData.length > 0"
|
|
7
|
+
:tree-data="treeData"
|
|
8
|
+
:defaultExpandAll="true"
|
|
9
|
+
v-model:selectedKeys="selectedKeys"
|
|
10
|
+
@select="onSelect"
|
|
11
|
+
>
|
|
12
|
+
</a-tree>
|
|
13
|
+
</div>
|
|
14
|
+
</a-col>
|
|
15
|
+
<a-col :span="20">
|
|
16
|
+
|
|
17
|
+
<form-table
|
|
18
|
+
:formState="formState"
|
|
19
|
+
:columns="columns"
|
|
20
|
+
modulePath="department"
|
|
21
|
+
:permissionModulePath="permissionModulePath"
|
|
22
|
+
:where="recordwhere"
|
|
23
|
+
method="get"
|
|
24
|
+
:page="false"
|
|
25
|
+
@update="edit"
|
|
26
|
+
@edit="edit"
|
|
27
|
+
@delete="getdepartmentTree"
|
|
28
|
+
ref="childRef"
|
|
29
|
+
>
|
|
30
|
+
<!-- 可以通过插槽自定义单元格 -->
|
|
31
|
+
<template #custom-orgType="{ record }">
|
|
32
|
+
<span
|
|
33
|
+
v-html="dictTemplate.tabletempInt('organization_orgtype', record.orgType)"
|
|
34
|
+
></span>
|
|
35
|
+
</template>
|
|
36
|
+
<template #custom-isEnable="{ record }">
|
|
37
|
+
<a-switch
|
|
38
|
+
v-model:checked="record.isEnable"
|
|
39
|
+
checked-children="是"
|
|
40
|
+
un-checked-children="否"
|
|
41
|
+
@change="handleSwitchIsEnableChange(record)"
|
|
42
|
+
/>
|
|
43
|
+
</template>
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
<template #custom-operation="{ record }">
|
|
47
|
+
<a-divider type="vertical" />
|
|
48
|
+
<a @click="addSubOrg(record)">新增下级</a>
|
|
49
|
+
</template>
|
|
50
|
+
</form-table>
|
|
51
|
+
</a-col>
|
|
52
|
+
</a-row>
|
|
53
|
+
|
|
54
|
+
<!-- 新增修改 -->
|
|
55
|
+
<DepartmentEdit
|
|
56
|
+
:open="editopen"
|
|
57
|
+
@close="editopen = false"
|
|
58
|
+
@updateData="refreshData"
|
|
59
|
+
ref="editRef"
|
|
60
|
+
>
|
|
61
|
+
</DepartmentEdit>
|
|
62
|
+
</template>
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
<script setup>
|
|
66
|
+
import { ref, onMounted } from 'vue'
|
|
67
|
+
import FormTable from '@/components/FormTable.vue'
|
|
68
|
+
import DepartmentEdit from '@/components/edit/organizationalStructure/DepartmentEdit.vue'
|
|
69
|
+
import dictTemplate from '@/utils/dictTemplate'
|
|
70
|
+
import department from '@/api/methods/department'
|
|
71
|
+
|
|
72
|
+
// 权限模块路径
|
|
73
|
+
const permissionModulePath = ref('organizationalStructure:department')
|
|
74
|
+
const treeData = ref([])
|
|
75
|
+
const selectedKeys = ref([])
|
|
76
|
+
const formState = ref({
|
|
77
|
+
name: { label: '名称', value: '', type: 'text' },
|
|
78
|
+
})
|
|
79
|
+
const recordwhere = ref(
|
|
80
|
+
{ id: 0 },
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
const columns = ref([
|
|
84
|
+
{
|
|
85
|
+
title: '组织名称',
|
|
86
|
+
dataIndex: 'name',
|
|
87
|
+
resizable: true,
|
|
88
|
+
width: 200,
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
title: '分类',
|
|
92
|
+
key: 'orgType',
|
|
93
|
+
resizable: true,
|
|
94
|
+
width: 120,
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
title: '排序',
|
|
98
|
+
dataIndex: 'sort',
|
|
99
|
+
resizable: true,
|
|
100
|
+
width: 100,
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
title: '是否启用',
|
|
104
|
+
key: 'isEnable',
|
|
105
|
+
resizable: true,
|
|
106
|
+
width: 100,
|
|
107
|
+
},
|
|
108
|
+
|
|
109
|
+
{
|
|
110
|
+
title: '创建时间',
|
|
111
|
+
dataIndex: 'createTime',
|
|
112
|
+
resizable: true,
|
|
113
|
+
width: 120,
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
title: '操作',
|
|
117
|
+
key: 'operation',
|
|
118
|
+
fixed: 'right',
|
|
119
|
+
width: 120,
|
|
120
|
+
},
|
|
121
|
+
])
|
|
122
|
+
const childRef = ref(null)
|
|
123
|
+
const getdepartmentTree = () => {
|
|
124
|
+
department.getdepartmentTree().then(res => {
|
|
125
|
+
treeData.value = res.data
|
|
126
|
+
})
|
|
127
|
+
}
|
|
128
|
+
onMounted(() => {
|
|
129
|
+
getdepartmentTree()
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
const onSelect = (keys, info) => {
|
|
133
|
+
if (keys.length > 0) {
|
|
134
|
+
recordwhere.value.id = keys[0]
|
|
135
|
+
childRef.value.tableLoad()
|
|
136
|
+
} else {
|
|
137
|
+
recordwhere.value.id = 0
|
|
138
|
+
childRef.value.tableLoad()
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
//编辑
|
|
143
|
+
const editopen = ref(false)
|
|
144
|
+
const editRef = ref(null)
|
|
145
|
+
const edit = record => {
|
|
146
|
+
editRef.value.getOrgTree()
|
|
147
|
+
editRef.value.init(record.id)
|
|
148
|
+
editopen.value = true
|
|
149
|
+
}
|
|
150
|
+
//新增子菜单
|
|
151
|
+
const addSubOrg = record => {
|
|
152
|
+
editRef.value.getOrgTree()
|
|
153
|
+
editRef.value.addSubOrg(record)
|
|
154
|
+
editopen.value = true
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
const refreshData = () => {
|
|
159
|
+
getdepartmentTree()
|
|
160
|
+
childRef.value.tableLoad()
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
//修改是否启用
|
|
164
|
+
const handleSwitchIsEnableChange = record => {
|
|
165
|
+
var data = {
|
|
166
|
+
id: record.id,
|
|
167
|
+
isEnable: record.isEnable,
|
|
168
|
+
}
|
|
169
|
+
department.updateIsEnable(data).then(() => {
|
|
170
|
+
childRef.value.tableLoad()
|
|
171
|
+
})
|
|
172
|
+
}
|
|
173
|
+
</script>
|
|
174
|
+
|
|
175
|
+
<style scoped>
|
|
176
|
+
.left-container {
|
|
177
|
+
margin-bottom: 8px;
|
|
178
|
+
padding: 24px 24px 0px;
|
|
179
|
+
background-color: white;
|
|
180
|
+
border-radius: 3px;
|
|
181
|
+
height: calc(100vh - 136px);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.slide-enter-active,
|
|
185
|
+
.slide-leave-active {
|
|
186
|
+
transition: transform 0.5s;
|
|
187
|
+
}
|
|
188
|
+
.slide-enter {
|
|
189
|
+
transform: translateX(-100%);
|
|
190
|
+
}
|
|
191
|
+
.slide-leave-to {
|
|
192
|
+
transform: translateX(-100%);
|
|
193
|
+
}
|
|
194
|
+
</style>
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<a-row :gutter="16">
|
|
3
|
+
<a-col :span="4">
|
|
4
|
+
<div class="left-container">
|
|
5
|
+
<a-tree
|
|
6
|
+
v-if="treeData.length > 0"
|
|
7
|
+
:tree-data="treeData"
|
|
8
|
+
:defaultExpandAll="true"
|
|
9
|
+
v-model:selectedKeys="selectedKeys"
|
|
10
|
+
@select="onSelect"
|
|
11
|
+
>
|
|
12
|
+
</a-tree>
|
|
13
|
+
</div>
|
|
14
|
+
</a-col>
|
|
15
|
+
<a-col :span="20">
|
|
16
|
+
<form-table
|
|
17
|
+
:formState="formState"
|
|
18
|
+
:columns="columns"
|
|
19
|
+
modulePath="employee"
|
|
20
|
+
:permissionModulePath="permissionModulePath"
|
|
21
|
+
:where="recordwhere"
|
|
22
|
+
@update="edit"
|
|
23
|
+
@edit="edit"
|
|
24
|
+
@delete="getdepartmentTree"
|
|
25
|
+
ref="childRef"
|
|
26
|
+
>
|
|
27
|
+
<!-- 可以通过插槽自定义单元格 -->
|
|
28
|
+
<template #custom-gender="{ record }">
|
|
29
|
+
<span>{{ { 0: '未知', 1: '男', 2: '女' }[record.gender] || record.gender }}</span>
|
|
30
|
+
</template>
|
|
31
|
+
<template #custom-status="{ record }">
|
|
32
|
+
<a-tag :color="statusColorMap[record.status]">
|
|
33
|
+
{{ { 0: '试用期', 1: '正式', 2: '离职', 3: '待入职' }[record.status] || record.status }}
|
|
34
|
+
</a-tag>
|
|
35
|
+
</template>
|
|
36
|
+
<template #custom-employeeType="{ record }">
|
|
37
|
+
<span>{{ { 0: '正式员工', 1: '实习生', 2: '外包', 3: '兼职' }[record.employeeType] || record.employeeType }}</span>
|
|
38
|
+
</template>
|
|
39
|
+
<template #custom-isEnable="{ record }">
|
|
40
|
+
<a-switch
|
|
41
|
+
v-model:checked="record.isEnable"
|
|
42
|
+
checked-children="是"
|
|
43
|
+
un-checked-children="否"
|
|
44
|
+
@change="handleSwitchIsEnableChange(record)"
|
|
45
|
+
/>
|
|
46
|
+
</template>
|
|
47
|
+
</form-table>
|
|
48
|
+
</a-col>
|
|
49
|
+
</a-row>
|
|
50
|
+
|
|
51
|
+
<!-- 新增修改 -->
|
|
52
|
+
<EmployeeEdit
|
|
53
|
+
:open="editopen"
|
|
54
|
+
@close="editopen = false"
|
|
55
|
+
@updateData="refreshData"
|
|
56
|
+
ref="editRef"
|
|
57
|
+
>
|
|
58
|
+
</EmployeeEdit>
|
|
59
|
+
</template>
|
|
60
|
+
|
|
61
|
+
<script setup>
|
|
62
|
+
import { ref, onMounted } from 'vue'
|
|
63
|
+
import FormTable from '@/components/FormTable.vue'
|
|
64
|
+
import EmployeeEdit from '@/components/edit/organizationalStructure/EmployeeEdit.vue'
|
|
65
|
+
import department from '@/api/methods/department'
|
|
66
|
+
import employee from '@/api/methods/employee'
|
|
67
|
+
|
|
68
|
+
// 权限模块路径
|
|
69
|
+
const permissionModulePath = ref('organizationalStructure:employee')
|
|
70
|
+
const treeData = ref([])
|
|
71
|
+
const selectedKeys = ref([])
|
|
72
|
+
|
|
73
|
+
// 状态颜色映射
|
|
74
|
+
const statusColorMap = {
|
|
75
|
+
0: 'orange', // 试用期
|
|
76
|
+
1: 'green', // 正式
|
|
77
|
+
2: 'red', // 离职
|
|
78
|
+
3: 'blue', // 待入职
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const formState = ref({
|
|
82
|
+
name: { label: '姓名', value: '', type: 'text' },
|
|
83
|
+
employeeNo: { label: '工号', value: '', type: 'text' },
|
|
84
|
+
mobile: { label: '手机号', value: '', type: 'text' },
|
|
85
|
+
status: {
|
|
86
|
+
label: '状态',
|
|
87
|
+
value: null,
|
|
88
|
+
type: 'select',
|
|
89
|
+
data: [
|
|
90
|
+
{ label: '试用期', value: 0 },
|
|
91
|
+
{ label: '正式', value: 1 },
|
|
92
|
+
{ label: '离职', value: 2 },
|
|
93
|
+
{ label: '待入职', value: 3 },
|
|
94
|
+
],
|
|
95
|
+
},
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
const recordwhere = ref({ departmentId: '' })
|
|
99
|
+
|
|
100
|
+
const columns = ref([
|
|
101
|
+
{
|
|
102
|
+
title: '工号',
|
|
103
|
+
dataIndex: 'employeeNo',
|
|
104
|
+
resizable: true,
|
|
105
|
+
width: 90,
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
title: '姓名',
|
|
109
|
+
dataIndex: 'name',
|
|
110
|
+
resizable: true,
|
|
111
|
+
width: 100,
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
title: '性别',
|
|
115
|
+
key: 'gender',
|
|
116
|
+
resizable: true,
|
|
117
|
+
width: 80,
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
title: '手机号',
|
|
121
|
+
dataIndex: 'mobile',
|
|
122
|
+
resizable: true,
|
|
123
|
+
width: 100,
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
title: '状态',
|
|
127
|
+
key: 'status',
|
|
128
|
+
resizable: true,
|
|
129
|
+
width: 100,
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
title: '员工类型',
|
|
133
|
+
key: 'employeeType',
|
|
134
|
+
resizable: true,
|
|
135
|
+
width: 100,
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
title: '组织',
|
|
139
|
+
dataIndex: 'departmentName',
|
|
140
|
+
resizable: true,
|
|
141
|
+
width: 100,
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
title: '职位',
|
|
145
|
+
dataIndex: 'positionName',
|
|
146
|
+
resizable: true,
|
|
147
|
+
width: 100,
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
title: '是否启用',
|
|
151
|
+
key: 'isEnable',
|
|
152
|
+
resizable: true,
|
|
153
|
+
width: 100,
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
title: '操作',
|
|
157
|
+
key: 'operation',
|
|
158
|
+
fixed: 'right',
|
|
159
|
+
width: 120,
|
|
160
|
+
},
|
|
161
|
+
])
|
|
162
|
+
|
|
163
|
+
const childRef = ref(null)
|
|
164
|
+
|
|
165
|
+
const getdepartmentTree = () => {
|
|
166
|
+
department.getdepartmentTree().then(res => {
|
|
167
|
+
treeData.value = res.data
|
|
168
|
+
})
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
onMounted(() => {
|
|
172
|
+
getdepartmentTree()
|
|
173
|
+
})
|
|
174
|
+
|
|
175
|
+
const onSelect = (keys, info) => {
|
|
176
|
+
if (keys.length > 0) {
|
|
177
|
+
recordwhere.value.departmentId = keys[0]
|
|
178
|
+
childRef.value.tableLoad()
|
|
179
|
+
} else {
|
|
180
|
+
recordwhere.value.departmentId = ''
|
|
181
|
+
childRef.value.tableLoad()
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// 编辑
|
|
186
|
+
const editopen = ref(false)
|
|
187
|
+
const editRef = ref(null)
|
|
188
|
+
const edit = record => {
|
|
189
|
+
editRef.value.getOrgTree()
|
|
190
|
+
editRef.value.init(record.id)
|
|
191
|
+
// 如果当前选中了组织,传递给编辑组件
|
|
192
|
+
if (recordwhere.value.departmentId && !record.id) {
|
|
193
|
+
editRef.value.setDepartmentId(recordwhere.value.departmentId)
|
|
194
|
+
}
|
|
195
|
+
editopen.value = true
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
const refreshData = () => {
|
|
199
|
+
getdepartmentTree()
|
|
200
|
+
childRef.value.tableLoad()
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// 修改是否启用
|
|
204
|
+
const handleSwitchIsEnableChange = record => {
|
|
205
|
+
const data = {
|
|
206
|
+
id: record.id,
|
|
207
|
+
isEnable: record.isEnable,
|
|
208
|
+
}
|
|
209
|
+
employee.updateIsEnable(data).then(() => {
|
|
210
|
+
childRef.value.tableLoad()
|
|
211
|
+
})
|
|
212
|
+
}
|
|
213
|
+
</script>
|
|
214
|
+
|
|
215
|
+
<style scoped>
|
|
216
|
+
.left-container {
|
|
217
|
+
margin-bottom: 8px;
|
|
218
|
+
padding: 24px 24px 0px;
|
|
219
|
+
background-color: white;
|
|
220
|
+
border-radius: 3px;
|
|
221
|
+
height: calc(100vh - 136px);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.slide-enter-active,
|
|
225
|
+
.slide-leave-active {
|
|
226
|
+
transition: transform 0.5s;
|
|
227
|
+
}
|
|
228
|
+
.slide-enter {
|
|
229
|
+
transform: translateX(-100%);
|
|
230
|
+
}
|
|
231
|
+
.slide-leave-to {
|
|
232
|
+
transform: translateX(-100%);
|
|
233
|
+
}
|
|
234
|
+
</style>
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<a-row :gutter="16">
|
|
3
|
+
<a-col :span="4">
|
|
4
|
+
<div class="left-container">
|
|
5
|
+
<a-tree
|
|
6
|
+
v-if="treeData.length > 0"
|
|
7
|
+
:tree-data="treeData"
|
|
8
|
+
:defaultExpandAll="true"
|
|
9
|
+
v-model:selectedKeys="selectedKeys"
|
|
10
|
+
@select="onSelect"
|
|
11
|
+
>
|
|
12
|
+
</a-tree>
|
|
13
|
+
</div>
|
|
14
|
+
</a-col>
|
|
15
|
+
<a-col :span="20">
|
|
16
|
+
|
|
17
|
+
<form-table
|
|
18
|
+
:formState="formState"
|
|
19
|
+
:columns="columns"
|
|
20
|
+
modulePath="position"
|
|
21
|
+
:permissionModulePath="permissionModulePath"
|
|
22
|
+
:where="recordwhere"
|
|
23
|
+
@update="edit"
|
|
24
|
+
@edit="edit"
|
|
25
|
+
@delete="getdepartmentTree"
|
|
26
|
+
ref="childRef"
|
|
27
|
+
>
|
|
28
|
+
<!-- 可以通过插槽自定义单元格 -->
|
|
29
|
+
<template #custom-type="{ record }">
|
|
30
|
+
<span>{{ { 0: '高层', 1: '中层', 2: '基层' }[record.type] || record.type }}</span>
|
|
31
|
+
</template>
|
|
32
|
+
<template #custom-isEnable="{ record }">
|
|
33
|
+
<a-switch
|
|
34
|
+
v-model:checked="record.isEnable"
|
|
35
|
+
checked-children="是"
|
|
36
|
+
un-checked-children="否"
|
|
37
|
+
@change="handleSwitchIsEnableChange(record)"
|
|
38
|
+
/>
|
|
39
|
+
</template>
|
|
40
|
+
|
|
41
|
+
</form-table>
|
|
42
|
+
</a-col>
|
|
43
|
+
</a-row>
|
|
44
|
+
|
|
45
|
+
<!-- 新增修改 -->
|
|
46
|
+
<PositionEdit
|
|
47
|
+
:open="editopen"
|
|
48
|
+
@close="editopen = false"
|
|
49
|
+
@updateData="refreshData"
|
|
50
|
+
ref="editRef"
|
|
51
|
+
>
|
|
52
|
+
</PositionEdit>
|
|
53
|
+
</template>
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
<script setup>
|
|
57
|
+
import { ref, onMounted } from 'vue'
|
|
58
|
+
import FormTable from '@/components/FormTable.vue'
|
|
59
|
+
import PositionEdit from '@/components/edit/organizationalStructure/PositionEdit.vue'
|
|
60
|
+
import department from '@/api/methods/department'
|
|
61
|
+
import position from '@/api/methods/position'
|
|
62
|
+
|
|
63
|
+
// 权限模块路径
|
|
64
|
+
const permissionModulePath = ref('organizationalStructure:position')
|
|
65
|
+
const treeData = ref([])
|
|
66
|
+
const selectedKeys = ref([])
|
|
67
|
+
const formState = ref({
|
|
68
|
+
name: { label: '名称', value: '', type: 'text' },
|
|
69
|
+
createTime: {
|
|
70
|
+
label: '日期范围',
|
|
71
|
+
value: null,
|
|
72
|
+
defaultvalue: null,
|
|
73
|
+
type: 'time',
|
|
74
|
+
},
|
|
75
|
+
})
|
|
76
|
+
const recordwhere = ref(
|
|
77
|
+
{ departmentId: '' },
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
const columns = ref([
|
|
81
|
+
{
|
|
82
|
+
title: '职位名称',
|
|
83
|
+
dataIndex: 'name',
|
|
84
|
+
resizable: true,
|
|
85
|
+
width: 200,
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
title: '分类',
|
|
89
|
+
key: 'type',
|
|
90
|
+
resizable: true,
|
|
91
|
+
width: 120,
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
title: '级别',
|
|
95
|
+
dataIndex: 'level',
|
|
96
|
+
resizable: true,
|
|
97
|
+
width: 120,
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
title: '排序',
|
|
101
|
+
dataIndex: 'sort',
|
|
102
|
+
resizable: true,
|
|
103
|
+
width: 100,
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
title: '是否启用',
|
|
107
|
+
key: 'isEnable',
|
|
108
|
+
resizable: true,
|
|
109
|
+
width: 100,
|
|
110
|
+
},
|
|
111
|
+
|
|
112
|
+
{
|
|
113
|
+
title: '创建时间',
|
|
114
|
+
dataIndex: 'createTime',
|
|
115
|
+
resizable: true,
|
|
116
|
+
width: 120,
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
title: '操作',
|
|
120
|
+
key: 'operation',
|
|
121
|
+
fixed: 'right',
|
|
122
|
+
width: 120,
|
|
123
|
+
},
|
|
124
|
+
])
|
|
125
|
+
const childRef = ref(null)
|
|
126
|
+
const getdepartmentTree = () => {
|
|
127
|
+
department.getdepartmentTree().then(res => {
|
|
128
|
+
treeData.value = res.data
|
|
129
|
+
})
|
|
130
|
+
}
|
|
131
|
+
onMounted(() => {
|
|
132
|
+
getdepartmentTree()
|
|
133
|
+
})
|
|
134
|
+
|
|
135
|
+
const onSelect = (keys, info) => {
|
|
136
|
+
if (keys.length > 0) {
|
|
137
|
+
recordwhere.value.departmentId = keys[0]
|
|
138
|
+
childRef.value.tableLoad()
|
|
139
|
+
} else {
|
|
140
|
+
recordwhere.value.departmentId = ''
|
|
141
|
+
childRef.value.tableLoad()
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
//编辑
|
|
146
|
+
const editopen = ref(false)
|
|
147
|
+
const editRef = ref(null)
|
|
148
|
+
const edit = record => {
|
|
149
|
+
editRef.value.getOrgTree()
|
|
150
|
+
editRef.value.init(record.id)
|
|
151
|
+
// 如果当前选中了组织,传递给编辑组件
|
|
152
|
+
if (recordwhere.value.departmentId && !record.id) {
|
|
153
|
+
editRef.value.setDepartmentId(recordwhere.value.departmentId)
|
|
154
|
+
}
|
|
155
|
+
editopen.value = true
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
const refreshData = () => {
|
|
161
|
+
getdepartmentTree()
|
|
162
|
+
childRef.value.tableLoad()
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
//修改是否启用
|
|
166
|
+
const handleSwitchIsEnableChange = record => {
|
|
167
|
+
const data = {
|
|
168
|
+
id: record.id,
|
|
169
|
+
isEnable: record.isEnable,
|
|
170
|
+
}
|
|
171
|
+
position.updateIsEnable(data).then(() => {
|
|
172
|
+
childRef.value.tableLoad()
|
|
173
|
+
})
|
|
174
|
+
}
|
|
175
|
+
</script>
|
|
176
|
+
|
|
177
|
+
<style scoped>
|
|
178
|
+
.left-container {
|
|
179
|
+
margin-bottom: 8px;
|
|
180
|
+
padding: 24px 24px 0px;
|
|
181
|
+
background-color: white;
|
|
182
|
+
border-radius: 3px;
|
|
183
|
+
height: calc(100vh - 136px);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.slide-enter-active,
|
|
187
|
+
.slide-leave-active {
|
|
188
|
+
transition: transform 0.5s;
|
|
189
|
+
}
|
|
190
|
+
.slide-enter {
|
|
191
|
+
transform: translateX(-100%);
|
|
192
|
+
}
|
|
193
|
+
.slide-leave-to {
|
|
194
|
+
transform: translateX(-100%);
|
|
195
|
+
}
|
|
196
|
+
</style>
|