Horace | cc75859 | 2018-08-23 17:40:39 +0800 | [diff] [blame] | 1 | <template> |
| 2 | <div class="app-container"> |
| 3 | <div class="filter-container"> |
| 4 | <el-row :gutter="20"> |
| 5 | <el-col :span="5"> |
| 6 | <el-input @keyup.enter.native="handleFilter" style="width: 200px;" class="filter-item" placeholder="审核环节名称" v-model="listQuery.name"> |
| 7 | </el-input> |
| 8 | </el-col> |
| 9 | <el-col :span="5"> |
| 10 | <el-select class="filter-item" v-model="listQuery.auditType" placeholder="审核方式"> |
| 11 | <el-option v-for="item in auditTypeList" :key="item.id" :label="item.name" :value="item.id"> |
| 12 | </el-option> |
| 13 | </el-select> |
| 14 | </el-col> |
| 15 | <el-col :span="9"> |
| 16 | <el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">查询</el-button> |
| 17 | <el-button class="filter-item" style="margin-left: 10px;" @click="handleCreate(null, 'create')" type="primary" icon="el-icon-edit">添加</el-button> |
| 18 | <el-button class="filter-item" style="margin-left: 10px;" @click="handleReset" type="primary" icon="el-icon-edit">重置</el-button> |
| 19 | </el-col> |
| 20 | </el-row> |
| 21 | </div> |
| 22 | <el-table :height="height" :data="items" v-loading="listLoading" element-loading-text="Loading" border fit highlight-current-row> |
| 23 | <el-table-column align="center" type="index" label='序号' width="95"> |
| 24 | </el-table-column> |
| 25 | <el-table-column label="审核环节名称" align="center"> |
| 26 | <template slot-scope="scope"> |
| 27 | {{scope.row.name}} |
| 28 | </template> |
| 29 | </el-table-column> |
| 30 | <el-table-column label="所属部门" align="center"> |
| 31 | <template slot-scope="scope"> |
| 32 | <span>{{scope.row.department.dwmc}}</span> |
| 33 | </template> |
| 34 | </el-table-column> |
| 35 | <el-table-column label="联系人" align="center"> |
| 36 | <template slot-scope="scope"> |
| 37 | {{scope.row.contact}} |
| 38 | </template> |
| 39 | </el-table-column> |
| 40 | <el-table-column label="联系电话" align="center"> |
| 41 | <template slot-scope="scope"> |
| 42 | {{scope.row.phoneNumber}} |
| 43 | </template> |
| 44 | </el-table-column> |
| 45 | <el-table-column label="审核环节地址" align="center"> |
| 46 | <template slot-scope="scope"> |
| 47 | {{scope.row.auditNodeAddress}} |
| 48 | </template> |
| 49 | </el-table-column> |
| 50 | <el-table-column label="审核环节职责" align="center"> |
| 51 | <template slot-scope="scope"> |
| 52 | {{scope.row.auditNodeDuty}} |
| 53 | </template> |
| 54 | </el-table-column> |
| 55 | <el-table-column label="审核方式" align="center"> |
| 56 | <template slot-scope="scope"> |
| 57 | {{scope.row.auditType.name}} |
| 58 | </template> |
| 59 | </el-table-column> |
| 60 | <el-table-column label="范围控制" align="center"> |
| 61 | <template slot-scope="scope"> |
| 62 | {{scope.row.scope.name}} |
| 63 | </template> |
| 64 | </el-table-column> |
| 65 | <el-table-column label="默认审核状态" align="center"> |
| 66 | <template slot-scope="scope"> |
| 67 | {{scope.row.defaultAuditStatus.name}} |
| 68 | </template> |
| 69 | </el-table-column> |
| 70 | <el-table-column |
| 71 | fixed="right" |
| 72 | header-align="center" |
| 73 | align="center" |
| 74 | width="150" |
| 75 | label="操作"> |
| 76 | <template slot-scope="scope"> |
| 77 | <el-button type="text" size="small" @click="handleCreate(scope.row.id, 'update')">修改</el-button> |
| 78 | <el-button type="text" size="small" @click="handleDelete(scope.row.id)">删除</el-button> |
Horace | b39866e | 2018-08-28 21:31:53 +0800 | [diff] [blame^] | 79 | <el-button type="text" size="small" @click="handleAuditor(scope.row.id)">编辑审核人</el-button> |
| 80 | <el-button type="text" size="small" @click="handlePrincipal(scope.row.id)">编辑负责人</el-button> |
Horace | cc75859 | 2018-08-23 17:40:39 +0800 | [diff] [blame] | 81 | </template> |
| 82 | </el-table-column> |
| 83 | </el-table> |
| 84 | <div class="pagination-container"> |
| 85 | <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="listQuery.pageIndex" :page-sizes="[10,20,30, 50]" :page-size="listQuery.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="recordCount"> |
| 86 | </el-pagination> |
| 87 | </div> |
| 88 | |
Horace | b39866e | 2018-08-28 21:31:53 +0800 | [diff] [blame^] | 89 | <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" width="60%" top="10vh"> |
Horace | cc75859 | 2018-08-23 17:40:39 +0800 | [diff] [blame] | 90 | <el-form :rules="rules" ref="dataForm" :model="temp" label-position="left" label-width="150px" style='margin-left:50px;'> |
| 91 | <el-form-item label="审核环节名称" prop="name"> |
| 92 | <el-input v-model="temp.name"></el-input> |
| 93 | <input type="hidden" v-model="temp.id" /> |
| 94 | </el-form-item> |
| 95 | <el-form-item label="所属部门" prop="department"> |
| 96 | <el-select class="filter-item" v-model="temp.department" placeholder="所属部门"> |
| 97 | <el-option v-for="item in departmentList" :key="item.id" :label="item.dwmc" :value="item.id"> |
| 98 | </el-option> |
| 99 | </el-select> |
| 100 | </el-form-item> |
| 101 | <el-form-item label="联系人" prop="contact"> |
| 102 | <el-input v-model="temp.contact"></el-input> |
| 103 | </el-form-item> |
| 104 | <el-form-item label="联系电话" prop="phoneNumber"> |
| 105 | <el-input v-model="temp.phoneNumber"></el-input> |
| 106 | </el-form-item> |
| 107 | <el-form-item label="审核方式" prop="auditType"> |
| 108 | <el-select class="filter-item" v-model="temp.auditType" placeholder="请选择"> |
| 109 | <el-option v-for="item in auditTypeList" :key="item.id" :label="item.name" :value="item.id"> |
| 110 | </el-option> |
| 111 | </el-select> |
| 112 | </el-form-item> |
| 113 | <el-form-item label="控制范围" prop="scope"> |
| 114 | <el-select class="filter-item" v-model="temp.scope" placeholder="请选择"> |
| 115 | <el-option v-for="item in scopeList" :key="item.id" :label="item.name" :value="item.id"> |
| 116 | </el-option> |
| 117 | </el-select> |
| 118 | </el-form-item> |
| 119 | <el-form-item label="默认审核状态" prop="defaultAuditStatus"> |
| 120 | <el-select class="filter-item" v-model="temp.defaultAuditStatus" placeholder="请选择"> |
| 121 | <el-option v-for="item in statusList" :key="item.id" :label="item.name" :value="item.id"> |
| 122 | </el-option> |
| 123 | </el-select> |
| 124 | </el-form-item> |
| 125 | <el-form-item label="审核环节职责" prop="auditNodeDuty"> |
| 126 | <el-input type="textarea" :rows="4" v-model="temp.auditNodeDuty"></el-input> |
| 127 | </el-form-item> |
| 128 | <el-form-item label="审核环节地址" prop="auditNodeAddress"> |
| 129 | <el-input type="textarea" :rows="4" v-model="temp.auditNodeAddress"></el-input> |
| 130 | </el-form-item> |
| 131 | </el-form> |
| 132 | <div slot="footer" class="dialog-footer"> |
| 133 | <el-button @click="dialogFormVisible = false">返回</el-button> |
| 134 | <el-button type="primary" @click="createData">提交</el-button> |
| 135 | </div> |
| 136 | </el-dialog> |
Horace | b39866e | 2018-08-28 21:31:53 +0800 | [diff] [blame^] | 137 | <el-dialog title="编辑审核人" :visible.sync="dialogAuditorVisible" width="70%" top="10vh"> |
| 138 | <el-form :inline="true" class="demo-form-inline" :model="auditor" style='margin-left:50px;' > |
| 139 | <el-form-item label="工号" prop="ghxh"> |
| 140 | <el-input v-model="auditor.ghxh" @blur="handleGetAuditor"></el-input> |
| 141 | <input type="hidden" v-model="auditor.id" /> |
| 142 | <input type="hidden" v-model="nodeId" /> |
| 143 | </el-form-item> |
| 144 | <el-form-item label="姓名" prop="xm"> |
| 145 | <el-input v-model="auditor.xm" disabled="true"></el-input> |
| 146 | </el-form-item> |
| 147 | <el-form-item label="性别" prop="xb"> |
| 148 | <el-input v-model="auditor.xb" disabled="true"></el-input> |
| 149 | </el-form-item> |
| 150 | <el-form-item> |
| 151 | <el-button type="primary" @click="handleSaveAuditor">保存</el-button> |
| 152 | </el-form-item> |
| 153 | </el-form> |
| 154 | <el-table :data="auditorList" v-loading="listLoading" element-loading-text="Loading" border fit highlight-current-row> |
| 155 | <el-table-column align="center" type="index" label='序号' width="95"> |
| 156 | </el-table-column> |
| 157 | <el-table-column label="工号" align="center"> |
| 158 | <template slot-scope="scope"> |
| 159 | {{scope.row.user.ghxh}} |
| 160 | </template> |
| 161 | </el-table-column> |
| 162 | <el-table-column label="姓名" align="center"> |
| 163 | <template slot-scope="scope"> |
| 164 | <span>{{scope.row.user.xm}}</span> |
| 165 | </template> |
| 166 | </el-table-column> |
| 167 | <el-table-column label="性别" align="center"> |
| 168 | <template slot-scope="scope"> |
| 169 | {{scope.row.user.xb.label}} |
| 170 | </template> |
| 171 | </el-table-column> |
| 172 | <el-table-column |
| 173 | fixed="right" |
| 174 | header-align="center" |
| 175 | align="center" |
| 176 | width="150" |
| 177 | label="操作"> |
| 178 | <template slot-scope="scope"> |
| 179 | <el-button type="text" size="small" @click="handleDeleteAuditor(scope.row.id)">删除</el-button> |
| 180 | </template> |
| 181 | </el-table-column> |
| 182 | </el-table> |
| 183 | <div slot="footer" class="dialog-footer"> |
| 184 | <el-button @click="dialogAuditorVisible = false">返回</el-button> |
| 185 | </div> |
| 186 | </el-dialog> |
| 187 | <el-dialog title="编辑负责人" :visible.sync="dialogPrincipalVisible" width="70%" top="10vh"> |
| 188 | <el-form :inline="true" class="demo-form-inline" :model="principal" style='margin-left:50px;' > |
| 189 | <el-form-item label="工号" prop="ghxh"> |
| 190 | <el-input v-model="principal.ghxh" @blur="handleGetPrincipal"></el-input> |
| 191 | <input type="hidden" v-model="principal.id" /> |
| 192 | <input type="hidden" v-model="nodeId" /> |
| 193 | </el-form-item> |
| 194 | <el-form-item label="姓名" prop="xm"> |
| 195 | <el-input v-model="principal.xm" disabled="true"></el-input> |
| 196 | </el-form-item> |
| 197 | <el-form-item label="性别" prop="xb"> |
| 198 | <el-input v-model="principal.xb" disabled="true"></el-input> |
| 199 | </el-form-item> |
| 200 | <el-form-item> |
| 201 | <el-button type="primary" @click="handleSavePrincipal">保存</el-button> |
| 202 | </el-form-item> |
| 203 | </el-form> |
| 204 | <el-table :data="principalList" v-loading="listLoading" element-loading-text="Loading" border fit highlight-current-row> |
| 205 | <el-table-column align="center" type="index" label='序号' width="95"> |
| 206 | </el-table-column> |
| 207 | <el-table-column label="工号" align="center"> |
| 208 | <template slot-scope="scope"> |
| 209 | {{scope.row.user.ghxh}} |
| 210 | </template> |
| 211 | </el-table-column> |
| 212 | <el-table-column label="姓名" align="center"> |
| 213 | <template slot-scope="scope"> |
| 214 | <span>{{scope.row.user.xm}}</span> |
| 215 | </template> |
| 216 | </el-table-column> |
| 217 | <el-table-column label="性别" align="center"> |
| 218 | <template slot-scope="scope"> |
| 219 | {{scope.row.user.xb.label}} |
| 220 | </template> |
| 221 | </el-table-column> |
| 222 | <el-table-column |
| 223 | fixed="right" |
| 224 | header-align="center" |
| 225 | align="center" |
| 226 | width="150" |
| 227 | label="操作"> |
| 228 | <template slot-scope="scope"> |
| 229 | <el-button type="text" size="small" @click="handleDeletePrincipal(scope.row.id)">删除</el-button> |
| 230 | </template> |
| 231 | </el-table-column> |
| 232 | </el-table> |
| 233 | <div slot="footer" class="dialog-footer"> |
| 234 | <el-button @click="dialogPrincipalVisible = false">返回</el-button> |
| 235 | </div> |
| 236 | </el-dialog> |
Horace | cc75859 | 2018-08-23 17:40:39 +0800 | [diff] [blame] | 237 | </div> |
| 238 | </template> |
| 239 | |
| 240 | <script> |
Horace | b39866e | 2018-08-28 21:31:53 +0800 | [diff] [blame^] | 241 | import { getList, getItem, createNode, deleteNode, getUser, getAuditorList, createNodeAuditor, deleteNodeAuditor, getPrincipalList, createNodePrincipal, deleteNodePrincipal } from '@/api/leaveschoolnode-api' |
Horace | cc75859 | 2018-08-23 17:40:39 +0800 | [diff] [blame] | 242 | import { getDicList } from '@/api/dictionary-api' |
huibing.xie | b87f03b | 2018-08-27 11:18:30 +0800 | [diff] [blame] | 243 | import { getDeptList } from '@/api/department-api' |
Horace | cc75859 | 2018-08-23 17:40:39 +0800 | [diff] [blame] | 244 | import waves from '@/directive/waves' // 水波纹指令 |
| 245 | import { resetForm } from '@/utils' |
| 246 | import { crudPageList, crudGetItem, crudCreate, crudDelete } from '@/utils/crud' |
| 247 | import mixindata from '@/utils/crud' |
Horace | b39866e | 2018-08-28 21:31:53 +0800 | [diff] [blame^] | 248 | import { MessageBox } from 'element-ui' |
Horace | cc75859 | 2018-08-23 17:40:39 +0800 | [diff] [blame] | 249 | |
| 250 | const initData = { auditType: '25', defaultAuditStatus: '22' } |
| 251 | export default { |
| 252 | name: 'node', |
| 253 | directives: { |
| 254 | waves |
| 255 | }, |
| 256 | mixins: [mixindata], |
| 257 | data() { |
| 258 | return { |
| 259 | config: { |
| 260 | initialFrameWidth: null, |
| 261 | initialFrameHeight: 350 |
| 262 | }, |
| 263 | departmentList: [], |
| 264 | auditTypeList: [], |
| 265 | scopeList: [], |
| 266 | statusList: [], |
Horace | b39866e | 2018-08-28 21:31:53 +0800 | [diff] [blame^] | 267 | nodeId: '', |
| 268 | dialogAuditorVisible: false, |
| 269 | dialogPrincipalVisible: false, |
| 270 | auditor: {}, |
| 271 | nodeAuditor: {}, |
| 272 | auditorList: [], |
| 273 | principal: {}, |
| 274 | nodePrincipal: {}, |
| 275 | principalList: [], |
Horace | cc75859 | 2018-08-23 17:40:39 +0800 | [diff] [blame] | 276 | rules: { |
| 277 | name: [{ required: true, message: '环节名称', trigger: 'blur' }], |
| 278 | scope: [{ required: true, message: '范围控制', trigger: 'change' }], |
| 279 | department: [{ required: true, message: '所属部门', trigger: 'change' }] |
| 280 | } |
| 281 | } |
| 282 | }, |
| 283 | created() { |
huibing.xie | b87f03b | 2018-08-27 11:18:30 +0800 | [diff] [blame] | 284 | this.getDepartmentList() |
| 285 | this.getAuditTypeList() |
| 286 | this.getStatusList() |
| 287 | this.getScopeList() |
| 288 | this.handlePageList() |
Horace | cc75859 | 2018-08-23 17:40:39 +0800 | [diff] [blame] | 289 | this.height = window.innerHeight - 266 |
| 290 | }, |
| 291 | methods: { |
| 292 | getDepartmentList() { |
huibing.xie | b87f03b | 2018-08-27 11:18:30 +0800 | [diff] [blame] | 293 | getDeptList().then(response => { |
Horace | cc75859 | 2018-08-23 17:40:39 +0800 | [diff] [blame] | 294 | this.departmentList = response.items |
| 295 | }) |
| 296 | }, |
| 297 | getAuditTypeList() { |
| 298 | getDicList({ type: 'auditType' }).then(response => { |
| 299 | this.auditTypeList = response.items |
| 300 | }) |
| 301 | }, |
huibing.xie | b87f03b | 2018-08-27 11:18:30 +0800 | [diff] [blame] | 302 | getScopeList() { |
Horace | cc75859 | 2018-08-23 17:40:39 +0800 | [diff] [blame] | 303 | getDicList({ type: 'scope' }).then(response => { |
| 304 | this.scopeList = response.items |
| 305 | }) |
| 306 | }, |
| 307 | getStatusList() { |
| 308 | getDicList({ type: 'defaultAuditStatus' }).then(response => { |
| 309 | this.statusList = response.items |
| 310 | }) |
| 311 | }, |
| 312 | handlePageList() { |
| 313 | crudPageList(this, getList) |
| 314 | }, |
| 315 | handleCreate(rowid, dialogStatus) { |
| 316 | this.dialogStatus = dialogStatus |
| 317 | crudGetItem(this, getItem, rowid, initData) |
| 318 | }, |
| 319 | handleReset() { |
| 320 | resetForm(this.listQuery) |
| 321 | }, |
| 322 | handleFilter() { |
| 323 | this.listQuery.pageIndex = 1 |
| 324 | this.handlePageList() |
| 325 | }, |
| 326 | handleSizeChange(val) { |
| 327 | this.listQuery.pageSize = val |
| 328 | this.handlePageList() |
| 329 | }, |
| 330 | handleCurrentChange(val) { |
| 331 | this.listQuery.pageIndex = val |
| 332 | this.handlePageList() |
| 333 | }, |
| 334 | createData() { |
huibing.xie | b87f03b | 2018-08-27 11:18:30 +0800 | [diff] [blame] | 335 | // this.temp.ggnr = this.$refs.ue.getUEContent() |
Horace | cc75859 | 2018-08-23 17:40:39 +0800 | [diff] [blame] | 336 | crudCreate(this, createNode, this.handlePageList) |
| 337 | }, |
| 338 | handleDelete(rowid) { |
| 339 | crudDelete(this, deleteNode, rowid, this.handlePageList) |
Horace | b39866e | 2018-08-28 21:31:53 +0800 | [diff] [blame^] | 340 | }, |
| 341 | handleAuditor(rowid) { |
| 342 | this.auditor = {} |
| 343 | this.nodeId = rowid |
| 344 | this.handleAuditorList() |
| 345 | this.dialogAuditorVisible = true |
| 346 | }, |
| 347 | handleAuditorList() { |
| 348 | getAuditorList({ nodeId: this.nodeId }).then(response => { |
| 349 | this.auditorList = response.items |
| 350 | }) |
| 351 | }, |
| 352 | handleGetAuditor(event) { |
| 353 | const ghxh = event.target.value |
| 354 | if (ghxh) { |
| 355 | getUser({ ghxh: ghxh }).then(response => { |
| 356 | if (response.data) { |
| 357 | this.auditor = { 'id': response.data.id, 'ghxh': response.data.ghxh, 'xm': response.data.xm, 'xb': response.data.xb.label } |
| 358 | } else { |
| 359 | MessageBox.alert('用户不存在,请重新重新输入工号!', '消息', { |
| 360 | confirmButtonText: '确定' |
| 361 | }) |
| 362 | this.auditor = {} |
| 363 | } |
| 364 | }) |
| 365 | } else { |
| 366 | MessageBox.alert('请填写工号!', '消息', { |
| 367 | confirmButtonText: '确定' |
| 368 | }) |
| 369 | this.auditor = {} |
| 370 | } |
| 371 | }, |
| 372 | handleSaveAuditor() { |
| 373 | if (!this.auditor.id) { |
| 374 | MessageBox.alert('请填写正确的工号!', '消息', { |
| 375 | confirmButtonText: '确定' |
| 376 | }) |
| 377 | return |
| 378 | } |
| 379 | this.nodeAuditor = { 'auditNode': { 'id': this.nodeId }, 'user': { 'id': this.auditor.id }} |
| 380 | createNodeAuditor(this.nodeAuditor).then(response => { |
| 381 | this.handleAuditorList() |
| 382 | this.$notify({ |
| 383 | title: '成功', |
| 384 | message: '创建成功', |
| 385 | type: 'success', |
| 386 | duration: 2000 |
| 387 | }) |
| 388 | }) |
| 389 | }, |
| 390 | handleDeleteAuditor(rowid) { |
| 391 | crudDelete(this, deleteNodeAuditor, rowid, this.handleAuditorList) |
| 392 | }, |
| 393 | handlePrincipal(rowid) { |
| 394 | this.principal = {} |
| 395 | this.nodeId = rowid |
| 396 | this.handlePrincipalList() |
| 397 | this.dialogPrincipalVisible = true |
| 398 | }, |
| 399 | handlePrincipalList() { |
| 400 | getPrincipalList({ nodeId: this.nodeId }).then(response => { |
| 401 | this.principalList = response.items |
| 402 | }) |
| 403 | }, |
| 404 | handleGetPrincipal(event) { |
| 405 | const ghxh = event.target.value |
| 406 | if (ghxh) { |
| 407 | getUser({ ghxh: ghxh }).then(response => { |
| 408 | if (response.data) { |
| 409 | this.principal = { 'id': response.data.id, 'ghxh': response.data.ghxh, 'xm': response.data.xm, 'xb': response.data.xb.label } |
| 410 | } else { |
| 411 | MessageBox.alert('用户不存在,请重新重新输入工号!', '消息', { |
| 412 | confirmButtonText: '确定' |
| 413 | }) |
| 414 | this.principal = {} |
| 415 | } |
| 416 | }) |
| 417 | } else { |
| 418 | MessageBox.alert('请填写工号!', '消息', { |
| 419 | confirmButtonText: '确定' |
| 420 | }) |
| 421 | this.principal = {} |
| 422 | } |
| 423 | }, |
| 424 | handleSavePrincipal() { |
| 425 | if (!this.principal.id) { |
| 426 | MessageBox.alert('请填写正确的工号!', '消息', { |
| 427 | confirmButtonText: '确定' |
| 428 | }) |
| 429 | return |
| 430 | } |
| 431 | this.nodePrincipal = { 'auditNode': { 'id': this.nodeId }, 'user': { 'id': this.principal.id }} |
| 432 | createNodePrincipal(this.nodePrincipal).then(response => { |
| 433 | this.handlePrincipalList() |
| 434 | this.$notify({ |
| 435 | title: '成功', |
| 436 | message: '创建成功', |
| 437 | type: 'success', |
| 438 | duration: 2000 |
| 439 | }) |
| 440 | }) |
| 441 | }, |
| 442 | handleDeletePrincipal(rowid) { |
| 443 | crudDelete(this, deleteNodePrincipal, rowid, this.handlePrincipalList) |
Horace | cc75859 | 2018-08-23 17:40:39 +0800 | [diff] [blame] | 444 | } |
| 445 | } |
| 446 | } |
| 447 | </script> |