haiwei-module-personnelfiles 1.0.0
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/.browserslistrc +2 -0
- package/.eslintrc.js +19 -0
- package/.prettierrc +6 -0
- package/.vscode/settings.json +9 -0
- package/babel.config.js +10 -0
- package/package.json +42 -0
- package/postcss.config.js +5 -0
- package/script/npm_install.bat +4 -0
- package/script/npm_install.ps1 +10 -0
- package/script/npm_publish.bat +4 -0
- package/script/npm_publish.ps1 +10 -0
- package/script/npm_update.bat +4 -0
- package/script/npm_update.ps1 +10 -0
- package/src/api/components/company.js +16 -0
- package/src/api/components/department.js +22 -0
- package/src/api/components/employee.js +179 -0
- package/src/api/components/position.js +18 -0
- package/src/api/components/post.js +18 -0
- package/src/api/index.js +11 -0
- package/src/components/config-personnelfiles/index.vue +69 -0
- package/src/components/department-select/index.vue +27 -0
- package/src/components/employee-select/components/department-box.vue +150 -0
- package/src/components/employee-select/components/employee-list.vue +113 -0
- package/src/components/employee-select/components/latest-box.vue +89 -0
- package/src/components/employee-select/components/samedep-box.vue +89 -0
- package/src/components/employee-select/components/selection-box.vue +75 -0
- package/src/components/employee-select/index.vue +376 -0
- package/src/components/index.js +10 -0
- package/src/components/post-select/index.vue +11 -0
- package/src/config/index.js +17 -0
- package/src/index.js +12 -0
- package/src/main.js +13 -0
- package/src/module.js +10 -0
- package/src/routes/index.js +3 -0
- package/src/store/index.js +3 -0
- package/src/views/department/components/list/cols.js +37 -0
- package/src/views/department/components/list/index.vue +80 -0
- package/src/views/department/components/save/index.vue +68 -0
- package/src/views/department/components/tree/index.vue +162 -0
- package/src/views/department/index/index.vue +53 -0
- package/src/views/department/index/page.js +43 -0
- package/src/views/employee/components/add/index.vue +161 -0
- package/src/views/employee/components/edit/components/account/index.vue +74 -0
- package/src/views/employee/components/edit/components/base/index.vue +83 -0
- package/src/views/employee/components/edit/components/contact/index.vue +102 -0
- package/src/views/employee/components/edit/components/education/index.vue +90 -0
- package/src/views/employee/components/edit/components/education/save.vue +73 -0
- package/src/views/employee/components/edit/components/family/index.vue +85 -0
- package/src/views/employee/components/edit/components/family/save.vue +75 -0
- package/src/views/employee/components/edit/components/mixins.js +58 -0
- package/src/views/employee/components/edit/components/personal/index.vue +114 -0
- package/src/views/employee/components/edit/components/work/index.vue +94 -0
- package/src/views/employee/components/edit/components/work/save.vue +76 -0
- package/src/views/employee/components/edit/index.vue +95 -0
- package/src/views/employee/components/leave/index.vue +87 -0
- package/src/views/employee/components/leave-info/index.vue +56 -0
- package/src/views/employee/components/picture-upload/index.vue +48 -0
- package/src/views/employee/demo/index.vue +49 -0
- package/src/views/employee/demo/page.js +21 -0
- package/src/views/employee/index/cols.js +63 -0
- package/src/views/employee/index/index.vue +155 -0
- package/src/views/employee/index/page.js +90 -0
- package/src/views/position/components/save/index.vue +44 -0
- package/src/views/position/components/select/index.vue +94 -0
- package/src/views/position/index/cols.js +32 -0
- package/src/views/position/index/index.vue +59 -0
- package/src/views/position/index/page.js +43 -0
- package/src/views/post/components/save/index.vue +59 -0
- package/src/views/post/index/cols.js +40 -0
- package/src/views/post/index/index.vue +53 -0
- package/src/views/post/index/page.js +43 -0
- package/vue.config.js +116 -0
package/.browserslistrc
ADDED
package/.eslintrc.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
root: true,
|
|
3
|
+
env: {
|
|
4
|
+
node: true
|
|
5
|
+
},
|
|
6
|
+
extends: ['plugin:vue/essential', '@vue/prettier'],
|
|
7
|
+
rules: {
|
|
8
|
+
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
|
|
9
|
+
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
|
|
10
|
+
},
|
|
11
|
+
parserOptions: {
|
|
12
|
+
parser: 'babel-eslint'
|
|
13
|
+
},
|
|
14
|
+
globals: {
|
|
15
|
+
$http: 'readonly',
|
|
16
|
+
$api: 'readonly',
|
|
17
|
+
$const: 'readonly'
|
|
18
|
+
}
|
|
19
|
+
}
|
package/.prettierrc
ADDED
package/babel.config.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": 4,
|
|
3
|
+
"name": "haiwei-module-personnelfiles",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"code": "personnelFiles",
|
|
6
|
+
"title": "人事档案",
|
|
7
|
+
"description": "人事档案",
|
|
8
|
+
"main": "src/index.js",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"serve": "vue-cli-service serve",
|
|
11
|
+
"build": "vue-cli-service build",
|
|
12
|
+
"lint": "vue-cli-service lint",
|
|
13
|
+
"dev": "cd ../../WebHost && dotnet watch run",
|
|
14
|
+
"cm": "rimraf node_modules",
|
|
15
|
+
"cc": "rimraf node_modules/.cache",
|
|
16
|
+
"i": "cd ./script && npm_install.bat",
|
|
17
|
+
"up": "cd ./script && npm_update.bat",
|
|
18
|
+
"pub": "cd ./script && npm_publish.bat"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"haiwei-module-admin": "^1.2.0",
|
|
22
|
+
"haiwei-module-common": "^1.0.1",
|
|
23
|
+
"haiwei-ui": "^1.4.4"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@vue/cli-plugin-babel": "^4.3.1",
|
|
27
|
+
"@vue/cli-plugin-eslint": "^4.3.1",
|
|
28
|
+
"@vue/cli-plugin-router": "^4.3.1",
|
|
29
|
+
"@vue/cli-plugin-vuex": "^4.3.1",
|
|
30
|
+
"@vue/cli-service": "^4.3.1",
|
|
31
|
+
"@vue/eslint-config-prettier": "^5.0.0",
|
|
32
|
+
"babel-eslint": "^10.1.0",
|
|
33
|
+
"eslint": "^5.16.0",
|
|
34
|
+
"eslint-plugin-prettier": "^3.1.3",
|
|
35
|
+
"eslint-plugin-vue": "^5.0.0",
|
|
36
|
+
"prettier": "^1.18.2",
|
|
37
|
+
"rimraf": "^3.0.2",
|
|
38
|
+
"sass": "^1.26.5",
|
|
39
|
+
"sass-loader": "^8.0.2",
|
|
40
|
+
"vue-template-compiler": "^2.6.11"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# 切换到项目根目录
|
|
2
|
+
Set-Location ..
|
|
3
|
+
|
|
4
|
+
# 使用淘宝镜像安装依赖(加速下载)
|
|
5
|
+
Write-Host "Installing dependencies using Taobao mirror..." -ForegroundColor Green
|
|
6
|
+
npm --registry https://registry.npmmirror.com/ install
|
|
7
|
+
|
|
8
|
+
# 等待用户按键
|
|
9
|
+
Write-Host "Dependencies installation completed. Press any key to continue..." -ForegroundColor Green
|
|
10
|
+
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# 切换到项目根目录
|
|
2
|
+
Set-Location ..
|
|
3
|
+
|
|
4
|
+
# 发布到 npm 官方仓库
|
|
5
|
+
Write-Host "Publishing to npm official registry..." -ForegroundColor Green
|
|
6
|
+
npm --registry https://registry.npmjs.org/ publish
|
|
7
|
+
|
|
8
|
+
# 等待用户按键
|
|
9
|
+
Write-Host "Publishing completed. Press any key to continue..." -ForegroundColor Green
|
|
10
|
+
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# 切换到项目根目录
|
|
2
|
+
Set-Location ..
|
|
3
|
+
|
|
4
|
+
# 使用淘宝镜像更新依赖(加速下载)
|
|
5
|
+
Write-Host "Updating dependencies using Taobao mirror..." -ForegroundColor Green
|
|
6
|
+
npm --registry https://registry.npmmirror.com/ update
|
|
7
|
+
|
|
8
|
+
# 等待用户按键
|
|
9
|
+
Write-Host "Dependencies update completed. Press any key to continue..." -ForegroundColor Green
|
|
10
|
+
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import module from '../../module'
|
|
2
|
+
|
|
3
|
+
export default name => {
|
|
4
|
+
const root = `${module.code}/${name}/`
|
|
5
|
+
const crud = $http.crud(root)
|
|
6
|
+
const urls = {
|
|
7
|
+
tree: root + 'Tree'
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* 获取部门树
|
|
12
|
+
* @param {公司编号} companyId
|
|
13
|
+
*/
|
|
14
|
+
const getTree = () => {
|
|
15
|
+
return $http.get(urls.tree)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return {
|
|
19
|
+
...crud,
|
|
20
|
+
getTree
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import module from '../../module'
|
|
2
|
+
|
|
3
|
+
export default name => {
|
|
4
|
+
const root = `${module.code}/${name}/`
|
|
5
|
+
const crud = $http.crud(root)
|
|
6
|
+
const urls = {
|
|
7
|
+
leave: root + 'Leave',
|
|
8
|
+
leaveInfo: root + 'LeaveInfo',
|
|
9
|
+
editContact: root + 'EditContact',
|
|
10
|
+
updateContact: root + 'updateContact',
|
|
11
|
+
editPersonal: root + 'EditPersonal',
|
|
12
|
+
updatePersonal: root + 'updatePersonal',
|
|
13
|
+
familyQuery: root + 'familyQuery',
|
|
14
|
+
familyAdd: root + 'familyAdd',
|
|
15
|
+
familyEdit: root + 'familyEdit',
|
|
16
|
+
familyUpdate: root + 'familyUpdate',
|
|
17
|
+
familyDelete: root + 'familyDelete',
|
|
18
|
+
educationQuery: root + 'educationQuery',
|
|
19
|
+
educationAdd: root + 'educationAdd',
|
|
20
|
+
educationEdit: root + 'educationEdit',
|
|
21
|
+
educationUpdate: root + 'educationUpdate',
|
|
22
|
+
educationDelete: root + 'educationDelete',
|
|
23
|
+
workQuery: root + 'workQuery',
|
|
24
|
+
workAdd: root + 'workAdd',
|
|
25
|
+
workEdit: root + 'workEdit',
|
|
26
|
+
workUpdate: root + 'workUpdate',
|
|
27
|
+
workDelete: root + 'workDelete',
|
|
28
|
+
editAccount: root + 'EditAccount',
|
|
29
|
+
updateAccount: root + 'updateAccount',
|
|
30
|
+
queryWithSameDepartment: root + 'QueryWithSameDepartment',
|
|
31
|
+
queryLatestSelect: root + 'QueryLatestSelect',
|
|
32
|
+
saveLatestSelect: root + 'SaveLatestSelect',
|
|
33
|
+
getTree: root + 'Tree',
|
|
34
|
+
getBaseInfoList: root + 'BaseInfoList'
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const leave = params => {
|
|
38
|
+
return $http.post(urls.leave, params)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const getLeaveInfo = id => {
|
|
42
|
+
return $http.get(urls.leaveInfo, { id })
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const editContact = id => {
|
|
46
|
+
return $http.get(urls.editContact, { id })
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const updateContact = params => {
|
|
50
|
+
return $http.post(urls.updateContact, params)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const editPersonal = id => {
|
|
54
|
+
return $http.get(urls.editPersonal, { id })
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const updatePersonal = params => {
|
|
58
|
+
return $http.post(urls.updatePersonal, params)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const familyQuery = employeeId => {
|
|
62
|
+
return $http.get(urls.familyQuery, { employeeId })
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const familyAdd = params => {
|
|
66
|
+
return $http.post(urls.familyAdd, params)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const familyDelete = id => {
|
|
70
|
+
return $http.delete(urls.familyDelete, { id })
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const familyEdit = id => {
|
|
74
|
+
return $http.get(urls.familyEdit, { id })
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const familyUpdate = params => {
|
|
78
|
+
return $http.post(urls.familyUpdate, params)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const educationQuery = employeeId => {
|
|
82
|
+
return $http.get(urls.educationQuery, { employeeId })
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const educationAdd = params => {
|
|
86
|
+
return $http.post(urls.educationAdd, params)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const educationDelete = id => {
|
|
90
|
+
return $http.delete(urls.educationDelete, { id })
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const educationEdit = id => {
|
|
94
|
+
return $http.get(urls.educationEdit, { id })
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const educationUpdate = params => {
|
|
98
|
+
return $http.post(urls.educationUpdate, params)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const workQuery = employeeId => {
|
|
102
|
+
return $http.get(urls.workQuery, { employeeId })
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const workAdd = params => {
|
|
106
|
+
return $http.post(urls.workAdd, params)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const workDelete = id => {
|
|
110
|
+
return $http.delete(urls.workDelete, { id })
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const workEdit = id => {
|
|
114
|
+
return $http.get(urls.workEdit, { id })
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const workUpdate = params => {
|
|
118
|
+
return $http.post(urls.workUpdate, params)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const editAccount = id => {
|
|
122
|
+
return $http.get(urls.editAccount, { id })
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const updateAccount = params => {
|
|
126
|
+
return $http.post(urls.updateAccount, params)
|
|
127
|
+
}
|
|
128
|
+
const queryWithSameDepartment = params => {
|
|
129
|
+
return $http.get(urls.queryWithSameDepartment, params)
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const queryLatestSelect = params => {
|
|
133
|
+
return $http.get(urls.queryLatestSelect, params)
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const saveLatestSelect = ids => {
|
|
137
|
+
return $http.post(urls.saveLatestSelect, ids)
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const getTree = () => {
|
|
141
|
+
return $http.get(urls.getTree)
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const getBaseInfoList = ids => {
|
|
145
|
+
return $http.get(urls.getBaseInfoList, { ids })
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return {
|
|
149
|
+
...crud,
|
|
150
|
+
leave,
|
|
151
|
+
getLeaveInfo,
|
|
152
|
+
editContact,
|
|
153
|
+
updateContact,
|
|
154
|
+
editPersonal,
|
|
155
|
+
updatePersonal,
|
|
156
|
+
familyQuery,
|
|
157
|
+
familyAdd,
|
|
158
|
+
familyDelete,
|
|
159
|
+
familyEdit,
|
|
160
|
+
familyUpdate,
|
|
161
|
+
educationQuery,
|
|
162
|
+
educationAdd,
|
|
163
|
+
educationDelete,
|
|
164
|
+
educationEdit,
|
|
165
|
+
educationUpdate,
|
|
166
|
+
workQuery,
|
|
167
|
+
workAdd,
|
|
168
|
+
workDelete,
|
|
169
|
+
workEdit,
|
|
170
|
+
workUpdate,
|
|
171
|
+
editAccount,
|
|
172
|
+
updateAccount,
|
|
173
|
+
queryWithSameDepartment,
|
|
174
|
+
queryLatestSelect,
|
|
175
|
+
saveLatestSelect,
|
|
176
|
+
getTree,
|
|
177
|
+
getBaseInfoList
|
|
178
|
+
}
|
|
179
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import module from '../../module'
|
|
2
|
+
|
|
3
|
+
export default name => {
|
|
4
|
+
const root = `${module.code}/${name}/`
|
|
5
|
+
const crud = $http.crud(root)
|
|
6
|
+
const urls = {
|
|
7
|
+
get: root + 'Get'
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const get = id => {
|
|
11
|
+
return $http.get(urls.get, { id })
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return {
|
|
15
|
+
...crud,
|
|
16
|
+
get
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import module from '../../module'
|
|
2
|
+
|
|
3
|
+
export default name => {
|
|
4
|
+
const root = `${module.code}/${name}/`
|
|
5
|
+
const crud = $http.crud(root)
|
|
6
|
+
const urls = {
|
|
7
|
+
select: root + 'Select'
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const select = () => {
|
|
11
|
+
return $http.get(urls.select)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return {
|
|
15
|
+
...crud,
|
|
16
|
+
select
|
|
17
|
+
}
|
|
18
|
+
}
|
package/src/api/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import module from '../module'
|
|
2
|
+
|
|
3
|
+
let apis = {}
|
|
4
|
+
const requireComponent = require.context('./components', true, /\.*\.js$/)
|
|
5
|
+
requireComponent.keys().map(fileName => {
|
|
6
|
+
const name = fileName.replace('./', '').replace('.js', '')
|
|
7
|
+
const func = requireComponent(fileName).default
|
|
8
|
+
apis[name] = func(name)
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
$api[module.code] = apis
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<nm-form-page v-bind="form">
|
|
3
|
+
<el-row>
|
|
4
|
+
<el-col :span="10" :offset="1">
|
|
5
|
+
<el-form-item label="公司单位名称:" prop="companyName">
|
|
6
|
+
<el-input v-model="form.model.companyName" />
|
|
7
|
+
</el-form-item>
|
|
8
|
+
</el-col>
|
|
9
|
+
<el-col :span="10">
|
|
10
|
+
<el-form-item label="公司单位地址:" prop="companyAddress">
|
|
11
|
+
<el-input v-model="form.model.companyAddress" />
|
|
12
|
+
</el-form-item>
|
|
13
|
+
</el-col>
|
|
14
|
+
</el-row>
|
|
15
|
+
<el-row>
|
|
16
|
+
<el-col :span="10" :offset="1">
|
|
17
|
+
<el-form-item label="公司单位联系人:" prop="companyContact">
|
|
18
|
+
<el-input v-model="form.model.companyContact" />
|
|
19
|
+
</el-form-item>
|
|
20
|
+
</el-col>
|
|
21
|
+
<el-col :span="10">
|
|
22
|
+
<el-form-item label="公司单位电话:" prop="companyPhone">
|
|
23
|
+
<el-input v-model="form.model.companyPhone" />
|
|
24
|
+
</el-form-item>
|
|
25
|
+
</el-col>
|
|
26
|
+
</el-row>
|
|
27
|
+
<el-row>
|
|
28
|
+
<el-col :span="10" :offset="1">
|
|
29
|
+
<el-form-item label="公司单位传真:" prop="companyFax">
|
|
30
|
+
<el-input v-model="form.model.companyFax" />
|
|
31
|
+
</el-form-item>
|
|
32
|
+
</el-col>
|
|
33
|
+
</el-row>
|
|
34
|
+
</nm-form-page>
|
|
35
|
+
</template>
|
|
36
|
+
<script>
|
|
37
|
+
import module from '../../module'
|
|
38
|
+
const { edit, update } = $api.admin.config
|
|
39
|
+
export default {
|
|
40
|
+
data() {
|
|
41
|
+
return {
|
|
42
|
+
code: module.code,
|
|
43
|
+
type: 1,
|
|
44
|
+
form: {
|
|
45
|
+
header: false,
|
|
46
|
+
action: this.update,
|
|
47
|
+
labelWidth: '200px',
|
|
48
|
+
model: {
|
|
49
|
+
companyName: '',
|
|
50
|
+
companyAddress: '',
|
|
51
|
+
companyContact: '',
|
|
52
|
+
companyPhone: '',
|
|
53
|
+
companyFax: ''
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
methods: {
|
|
59
|
+
update() {
|
|
60
|
+
return update({ type: this.type, code: this.code, json: JSON.stringify(this.form.model) })
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
created() {
|
|
64
|
+
edit({ type: this.type, code: this.code }).then(data => {
|
|
65
|
+
this.form.model = data
|
|
66
|
+
})
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
</script>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { mixins } from 'haiwei-ui'
|
|
3
|
+
const { getTree } = $api.personnelFiles.department
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
mixins: [mixins.treeSelect],
|
|
7
|
+
data() {
|
|
8
|
+
return {
|
|
9
|
+
action: getTree
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
props: {
|
|
13
|
+
title: {
|
|
14
|
+
type: String,
|
|
15
|
+
default: '部门选择'
|
|
16
|
+
},
|
|
17
|
+
icon: {
|
|
18
|
+
type: String,
|
|
19
|
+
default: 'department'
|
|
20
|
+
},
|
|
21
|
+
collapseAll: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
default: true
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
</script>
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<nm-box class="nm-mpest-department" page header :loading="loading">
|
|
3
|
+
<template v-slot:title>
|
|
4
|
+
<el-input v-model="keyword" placeholder="请输入关键字" clearable suffix-icon="el-icon-search"> </el-input>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<el-tree ref="tree" v-bind="tree" @check="onCheck">
|
|
8
|
+
<span slot-scope="{ data }">
|
|
9
|
+
<nm-icon v-if="data.item.type === 0" name="attachment" />
|
|
10
|
+
<nm-icon v-else-if="data.item.type === 1 && data.item.sex === 0" name="boy" class="nm-mpest-department-icon boy" />
|
|
11
|
+
<nm-icon v-else-if="data.item.type === 1 && data.item.sex === 1" name="girl" class="nm-mpest-department-icon girl" />
|
|
12
|
+
<span :class="data.item.type === 1 ? 'nm-mpest-department-name' : ''"
|
|
13
|
+
>{{ data.label }}<span class="nm-size-10 nm-text-info" v-if="showPost && data.item.type === 1 && data.item.postName"> {{ data.item.postName }}</span></span
|
|
14
|
+
>
|
|
15
|
+
</span>
|
|
16
|
+
</el-tree>
|
|
17
|
+
</nm-box>
|
|
18
|
+
</template>
|
|
19
|
+
<script>
|
|
20
|
+
const { getTree } = $api.personnelFiles.employee
|
|
21
|
+
|
|
22
|
+
export default {
|
|
23
|
+
data() {
|
|
24
|
+
return {
|
|
25
|
+
tree: {
|
|
26
|
+
data: [],
|
|
27
|
+
nodeKey: 'id',
|
|
28
|
+
highlightCurrent: true,
|
|
29
|
+
showCheckbox: true,
|
|
30
|
+
props: { children: 'children', label: 'label' },
|
|
31
|
+
currentNodeKey: 0,
|
|
32
|
+
defaultExpandedKeys: [0],
|
|
33
|
+
defaultCheckedKeys: [],
|
|
34
|
+
filterNodeMethod: this.filter
|
|
35
|
+
},
|
|
36
|
+
keyword: '',
|
|
37
|
+
loading: false
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
props: {
|
|
41
|
+
options: Object,
|
|
42
|
+
//已选择的人员列表
|
|
43
|
+
selection: Array,
|
|
44
|
+
//显示岗位
|
|
45
|
+
showPost: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: true
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
methods: {
|
|
51
|
+
query() {
|
|
52
|
+
this.loading = true
|
|
53
|
+
getTree().then(data => {
|
|
54
|
+
this.tree.data = [data]
|
|
55
|
+
this.options.selection = []
|
|
56
|
+
this.refresh()
|
|
57
|
+
this.loading = false
|
|
58
|
+
})
|
|
59
|
+
},
|
|
60
|
+
search() {
|
|
61
|
+
this.query()
|
|
62
|
+
},
|
|
63
|
+
refresh() {
|
|
64
|
+
let root = this.tree.data[0]
|
|
65
|
+
if (!root) return
|
|
66
|
+
|
|
67
|
+
let checkedKeys = []
|
|
68
|
+
this.refreshChildren(root.children, checkedKeys)
|
|
69
|
+
this.$refs.tree.setCheckedKeys(checkedKeys)
|
|
70
|
+
},
|
|
71
|
+
refreshChildren(children, checkedKeys) {
|
|
72
|
+
if (!children) return
|
|
73
|
+
|
|
74
|
+
children.forEach(m => {
|
|
75
|
+
let item = m.item
|
|
76
|
+
if (item.type === 1) {
|
|
77
|
+
if (this.selection.findIndex(n => n.id == item.sourceId) > -1) {
|
|
78
|
+
m.disabled = true
|
|
79
|
+
checkedKeys.push(m.id)
|
|
80
|
+
} else {
|
|
81
|
+
m.disabled = false
|
|
82
|
+
}
|
|
83
|
+
} else {
|
|
84
|
+
this.refreshChildren(m.children, checkedKeys)
|
|
85
|
+
}
|
|
86
|
+
})
|
|
87
|
+
},
|
|
88
|
+
onCheck(data, { checkedNodes }) {
|
|
89
|
+
this.options.selection = []
|
|
90
|
+
checkedNodes.forEach(m => {
|
|
91
|
+
if (m.item.type === 1 && !m.disabled) {
|
|
92
|
+
const { sourceId, name, sex, postName, departmentPath } = m.item
|
|
93
|
+
this.options.selection.push({
|
|
94
|
+
id: parseInt(sourceId),
|
|
95
|
+
name,
|
|
96
|
+
sex,
|
|
97
|
+
postName,
|
|
98
|
+
departmentPath
|
|
99
|
+
})
|
|
100
|
+
}
|
|
101
|
+
})
|
|
102
|
+
},
|
|
103
|
+
filter(value, data) {
|
|
104
|
+
if (!value) return true
|
|
105
|
+
return data.label.indexOf(value) !== -1
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
watch: {
|
|
109
|
+
selection() {
|
|
110
|
+
this.refresh()
|
|
111
|
+
},
|
|
112
|
+
keyword(val) {
|
|
113
|
+
this.$refs.tree.filter(val)
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
</script>
|
|
118
|
+
<style lang="scss">
|
|
119
|
+
.nm-mpest-department {
|
|
120
|
+
.nm-box-header-title {
|
|
121
|
+
.el-input {
|
|
122
|
+
top: -2px;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.el-tree-node__content {
|
|
127
|
+
font-size: 12px;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.nm-icon {
|
|
131
|
+
margin-right: 5px;
|
|
132
|
+
}
|
|
133
|
+
&-icon {
|
|
134
|
+
margin-left: -6px;
|
|
135
|
+
font-size: 30px;
|
|
136
|
+
|
|
137
|
+
&.boy {
|
|
138
|
+
color: #409eff;
|
|
139
|
+
}
|
|
140
|
+
&.girl {
|
|
141
|
+
color: #e6a23c;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
&-name {
|
|
146
|
+
position: relative;
|
|
147
|
+
top: -6px;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
</style>
|