| <template> |
| <div class="app-container"> |
| <div class="filter-container"> |
| <el-row :gutter="20"> |
| <el-col :span="5"> |
| <el-input @keyup.enter.native="handleFilter" style="width: 200px;" class="filter-item" placeholder="审核环节名称" v-model="listQuery.name"> |
| </el-input> |
| </el-col> |
| <el-col :span="5"> |
| <el-select class="filter-item" v-model="listQuery.auditType" placeholder="审核方式"> |
| <el-option v-for="item in auditTypeList" :key="item.id" :label="item.name" :value="item.id"> |
| </el-option> |
| </el-select> |
| </el-col> |
| <el-col :span="9"> |
| <el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">查询</el-button> |
| <el-button class="filter-item" style="margin-left: 10px;" @click="handleCreate(null, 'create')" type="primary" icon="el-icon-edit">添加</el-button> |
| <el-button class="filter-item" style="margin-left: 10px;" @click="handleReset" type="primary" icon="el-icon-edit">重置</el-button> |
| </el-col> |
| </el-row> |
| </div> |
| <el-table :height="height" :data="items" v-loading="listLoading" element-loading-text="Loading" border fit highlight-current-row> |
| <el-table-column align="center" type="index" label='序号' width="95"> |
| </el-table-column> |
| <el-table-column label="审核环节名称" align="center"> |
| <template slot-scope="scope"> |
| {{scope.row.name}} |
| </template> |
| </el-table-column> |
| <el-table-column label="所属部门" align="center"> |
| <template slot-scope="scope"> |
| <span>{{scope.row.department.name}}</span> |
| </template> |
| </el-table-column> |
| <el-table-column label="联系人" align="center"> |
| <template slot-scope="scope"> |
| {{scope.row.contact}} |
| </template> |
| </el-table-column> |
| <el-table-column label="联系电话" align="center"> |
| <template slot-scope="scope"> |
| {{scope.row.phoneNumber}} |
| </template> |
| </el-table-column> |
| <el-table-column label="审核环节地址" align="center"> |
| <template slot-scope="scope"> |
| {{scope.row.auditNodeAddress}} |
| </template> |
| </el-table-column> |
| <el-table-column label="审核环节职责" align="center"> |
| <template slot-scope="scope"> |
| {{scope.row.auditNodeDuty}} |
| </template> |
| </el-table-column> |
| <el-table-column label="审核方式" align="center"> |
| <template slot-scope="scope"> |
| {{scope.row.auditType.name}} |
| </template> |
| </el-table-column> |
| <el-table-column label="范围控制" align="center"> |
| <template slot-scope="scope"> |
| {{scope.row.scope.name}} |
| </template> |
| </el-table-column> |
| <el-table-column label="默认审核状态" align="center"> |
| <template slot-scope="scope"> |
| {{scope.row.defaultAuditStatus.name}} |
| </template> |
| </el-table-column> |
| <el-table-column |
| fixed="right" |
| header-align="center" |
| align="center" |
| width="150" |
| label="操作"> |
| <template slot-scope="scope"> |
| <el-button type="text" size="small" @click="handleCreate(scope.row.id, 'update')">修改</el-button> |
| <el-button type="text" size="small" @click="handleDelete(scope.row.id)">删除</el-button> |
| <el-button type="text" size="small" @click="handleAuditor(scope.row.id)">编辑审核人</el-button> |
| <el-button type="text" size="small" @click="handlePrincipal(scope.row.id)">编辑负责人</el-button> |
| </template> |
| </el-table-column> |
| </el-table> |
| <div class="pagination-container"> |
| <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"> |
| </el-pagination> |
| </div> |
| |
| <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" width="60%" top="10vh"> |
| <el-form :rules="rules" ref="dataForm" :model="temp" label-position="left" label-width="150px" style='margin-left:50px;'> |
| <el-form-item label="审核环节名称" prop="name"> |
| <el-input v-model="temp.name"></el-input> |
| <input type="hidden" v-model="temp.id" /> |
| </el-form-item> |
| <el-form-item label="所属部门" prop="department"> |
| <el-select class="filter-item" v-model="temp.department" placeholder="所属部门"> |
| <el-option v-for="item in departmentList" :key="item.id" :label="item.name" :value="item.id"> |
| </el-option> |
| </el-select> |
| </el-form-item> |
| <el-form-item label="联系人" prop="contact"> |
| <el-input v-model="temp.contact"></el-input> |
| </el-form-item> |
| <el-form-item label="联系电话" prop="phoneNumber"> |
| <el-input v-model="temp.phoneNumber"></el-input> |
| </el-form-item> |
| <el-form-item label="审核方式" prop="auditType"> |
| <el-select class="filter-item" v-model="temp.auditType" placeholder="请选择"> |
| <el-option v-for="item in auditTypeList" :key="item.id" :label="item.name" :value="item.id"> |
| </el-option> |
| </el-select> |
| </el-form-item> |
| <el-form-item label="控制范围" prop="scope"> |
| <el-select class="filter-item" v-model="temp.scope" placeholder="请选择"> |
| <el-option v-for="item in scopeList" :key="item.id" :label="item.name" :value="item.id"> |
| </el-option> |
| </el-select> |
| </el-form-item> |
| <el-form-item label="默认审核状态" prop="defaultAuditStatus"> |
| <el-select class="filter-item" v-model="temp.defaultAuditStatus" placeholder="请选择"> |
| <el-option v-for="item in statusList" :key="item.id" :label="item.name" :value="item.id"> |
| </el-option> |
| </el-select> |
| </el-form-item> |
| <el-form-item label="审核环节职责" prop="auditNodeDuty"> |
| <el-input type="textarea" :rows="4" v-model="temp.auditNodeDuty"></el-input> |
| </el-form-item> |
| <el-form-item label="审核环节地址" prop="auditNodeAddress"> |
| <el-input type="textarea" :rows="4" v-model="temp.auditNodeAddress"></el-input> |
| </el-form-item> |
| </el-form> |
| <div slot="footer" class="dialog-footer"> |
| <el-button @click="dialogFormVisible = false">返回</el-button> |
| <el-button type="primary" @click="createData">提交</el-button> |
| </div> |
| </el-dialog> |
| <el-dialog title="编辑审核人" :visible.sync="dialogAuditorVisible" width="70%" top="10vh"> |
| <el-form :inline="true" class="demo-form-inline" :model="auditor" style='margin-left:50px;' > |
| <el-form-item label="工号" prop="ghxh"> |
| <el-input v-model="auditor.ghxh" @blur="handleGetAuditor"></el-input> |
| <input type="hidden" v-model="auditor.id" /> |
| <input type="hidden" v-model="nodeId" /> |
| </el-form-item> |
| <el-form-item label="姓名" prop="xm"> |
| <el-input v-model="auditor.xm" disabled="true"></el-input> |
| </el-form-item> |
| <el-form-item label="性别" prop="xb"> |
| <el-input v-model="auditor.xb" disabled="true"></el-input> |
| </el-form-item> |
| <el-form-item> |
| <el-button type="primary" @click="handleSaveAuditor">保存</el-button> |
| </el-form-item> |
| </el-form> |
| <el-table :data="auditorList" v-loading="listLoading" element-loading-text="Loading" border fit highlight-current-row> |
| <el-table-column align="center" type="index" label='序号' width="95"> |
| </el-table-column> |
| <el-table-column label="工号" align="center"> |
| <template slot-scope="scope"> |
| {{scope.row.user.ghxh}} |
| </template> |
| </el-table-column> |
| <el-table-column label="姓名" align="center"> |
| <template slot-scope="scope"> |
| <span>{{scope.row.user.xm}}</span> |
| </template> |
| </el-table-column> |
| <el-table-column label="性别" align="center"> |
| <template slot-scope="scope"> |
| {{scope.row.user.xb.label}} |
| </template> |
| </el-table-column> |
| <el-table-column |
| fixed="right" |
| header-align="center" |
| align="center" |
| width="150" |
| label="操作"> |
| <template slot-scope="scope"> |
| <el-button type="text" size="small" @click="handleDeleteAuditor(scope.row.id)">删除</el-button> |
| </template> |
| </el-table-column> |
| </el-table> |
| <div slot="footer" class="dialog-footer"> |
| <el-button @click="dialogAuditorVisible = false">返回</el-button> |
| </div> |
| </el-dialog> |
| <el-dialog title="编辑负责人" :visible.sync="dialogPrincipalVisible" width="70%" top="10vh"> |
| <el-form :inline="true" class="demo-form-inline" :model="principal" style='margin-left:50px;' > |
| <el-form-item label="工号" prop="ghxh"> |
| <el-input v-model="principal.ghxh" @blur="handleGetPrincipal"></el-input> |
| <input type="hidden" v-model="principal.id" /> |
| <input type="hidden" v-model="nodeId" /> |
| </el-form-item> |
| <el-form-item label="姓名" prop="xm"> |
| <el-input v-model="principal.xm" disabled="true"></el-input> |
| </el-form-item> |
| <el-form-item label="性别" prop="xb"> |
| <el-input v-model="principal.xb" disabled="true"></el-input> |
| </el-form-item> |
| <el-form-item> |
| <el-button type="primary" @click="handleSavePrincipal">保存</el-button> |
| </el-form-item> |
| </el-form> |
| <el-table :data="principalList" v-loading="listLoading" element-loading-text="Loading" border fit highlight-current-row> |
| <el-table-column align="center" type="index" label='序号' width="95"> |
| </el-table-column> |
| <el-table-column label="工号" align="center"> |
| <template slot-scope="scope"> |
| {{scope.row.user.ghxh}} |
| </template> |
| </el-table-column> |
| <el-table-column label="姓名" align="center"> |
| <template slot-scope="scope"> |
| <span>{{scope.row.user.xm}}</span> |
| </template> |
| </el-table-column> |
| <el-table-column label="性别" align="center"> |
| <template slot-scope="scope"> |
| {{scope.row.user.xb.label}} |
| </template> |
| </el-table-column> |
| <el-table-column |
| fixed="right" |
| header-align="center" |
| align="center" |
| width="150" |
| label="操作"> |
| <template slot-scope="scope"> |
| <el-button type="text" size="small" @click="handleDeletePrincipal(scope.row.id)">删除</el-button> |
| </template> |
| </el-table-column> |
| </el-table> |
| <div slot="footer" class="dialog-footer"> |
| <el-button @click="dialogPrincipalVisible = false">返回</el-button> |
| </div> |
| </el-dialog> |
| </div> |
| </template> |
| |
| <script> |
| import { getList, getItem, createNode, deleteNode, getUser, getAuditorList, createNodeAuditor, deleteNodeAuditor, getPrincipalList, createNodePrincipal, deleteNodePrincipal } from '@/api/leaveschoolnode-api' |
| import { getDicList } from '@/api/dictionary-api' |
| import { getDeptList } from '@/api/department-api' |
| import waves from '@/directive/waves' // 水波纹指令 |
| import { resetForm } from '@/utils' |
| import { crudPageList, crudGetItem, crudCreate, crudDelete } from '@/utils/crud' |
| import mixindata from '@/utils/crud' |
| import { MessageBox } from 'element-ui' |
| |
| const initData = { auditType: '25', defaultAuditStatus: '22' } |
| export default { |
| name: 'node', |
| directives: { |
| waves |
| }, |
| mixins: [mixindata], |
| data() { |
| return { |
| config: { |
| initialFrameWidth: null, |
| initialFrameHeight: 350 |
| }, |
| departmentList: [], |
| auditTypeList: [], |
| scopeList: [], |
| statusList: [], |
| nodeId: '', |
| dialogAuditorVisible: false, |
| dialogPrincipalVisible: false, |
| auditor: {}, |
| nodeAuditor: {}, |
| auditorList: [], |
| principal: {}, |
| nodePrincipal: {}, |
| principalList: [], |
| rules: { |
| name: [{ required: true, message: '环节名称', trigger: 'blur' }], |
| scope: [{ required: true, message: '范围控制', trigger: 'change' }], |
| department: [{ required: true, message: '所属部门', trigger: 'change' }] |
| } |
| } |
| }, |
| created() { |
| this.getDepartmentList() |
| this.getAuditTypeList() |
| this.getStatusList() |
| this.getScopeList() |
| this.handlePageList() |
| this.height = window.innerHeight - 266 |
| }, |
| methods: { |
| getDepartmentList() { |
| getDeptList().then(response => { |
| this.departmentList = response.items |
| }) |
| }, |
| getAuditTypeList() { |
| getDicList({ dicType: 'auditType' }).then(response => { |
| this.auditTypeList = response.items |
| }) |
| }, |
| getScopeList() { |
| getDicList({ dicType: 'scope' }).then(response => { |
| this.scopeList = response.items |
| }) |
| }, |
| getStatusList() { |
| getDicList({ dicType: 'defaultAuditStatus' }).then(response => { |
| this.statusList = response.items |
| }) |
| }, |
| handlePageList() { |
| crudPageList(this, getList) |
| }, |
| handleCreate(rowid, dialogStatus) { |
| this.dialogStatus = dialogStatus |
| crudGetItem(this, getItem, rowid, initData) |
| }, |
| handleReset() { |
| resetForm(this.listQuery) |
| }, |
| handleFilter() { |
| this.listQuery.pageIndex = 1 |
| this.handlePageList() |
| }, |
| handleSizeChange(val) { |
| this.listQuery.pageSize = val |
| this.handlePageList() |
| }, |
| handleCurrentChange(val) { |
| this.listQuery.pageIndex = val |
| this.handlePageList() |
| }, |
| createData() { |
| // this.temp.ggnr = this.$refs.ue.getUEContent() |
| crudCreate(this, createNode, this.handlePageList) |
| }, |
| handleDelete(rowid) { |
| crudDelete(this, deleteNode, rowid, this.handlePageList) |
| }, |
| handleAuditor(rowid) { |
| this.auditor = {} |
| this.nodeId = rowid |
| this.handleAuditorList() |
| this.dialogAuditorVisible = true |
| }, |
| handleAuditorList() { |
| getAuditorList({ nodeId: this.nodeId }).then(response => { |
| this.auditorList = response.items |
| }) |
| }, |
| handleGetAuditor(event) { |
| const ghxh = event.target.value |
| if (ghxh) { |
| getUser({ ghxh: ghxh }).then(response => { |
| if (response.data) { |
| this.auditor = { 'id': response.data.id, 'ghxh': response.data.ghxh, 'xm': response.data.xm, 'xb': response.data.xb.label } |
| } else { |
| MessageBox.alert('用户不存在,请重新重新输入工号!', '消息', { |
| confirmButtonText: '确定' |
| }) |
| this.auditor = {} |
| } |
| }) |
| } else { |
| MessageBox.alert('请填写工号!', '消息', { |
| confirmButtonText: '确定' |
| }) |
| this.auditor = {} |
| } |
| }, |
| handleSaveAuditor() { |
| if (!this.auditor.id) { |
| MessageBox.alert('请填写正确的工号!', '消息', { |
| confirmButtonText: '确定' |
| }) |
| return |
| } |
| this.nodeAuditor = { 'auditNode': { 'id': this.nodeId }, 'user': { 'id': this.auditor.id }} |
| createNodeAuditor(this.nodeAuditor).then(response => { |
| this.handleAuditorList() |
| this.$notify({ |
| title: '成功', |
| message: '创建成功', |
| type: 'success', |
| duration: 2000 |
| }) |
| }) |
| }, |
| handleDeleteAuditor(rowid) { |
| crudDelete(this, deleteNodeAuditor, rowid, this.handleAuditorList) |
| }, |
| handlePrincipal(rowid) { |
| this.principal = {} |
| this.nodeId = rowid |
| this.handlePrincipalList() |
| this.dialogPrincipalVisible = true |
| }, |
| handlePrincipalList() { |
| getPrincipalList({ nodeId: this.nodeId }).then(response => { |
| this.principalList = response.items |
| }) |
| }, |
| handleGetPrincipal(event) { |
| const ghxh = event.target.value |
| if (ghxh) { |
| getUser({ ghxh: ghxh }).then(response => { |
| if (response.data) { |
| this.principal = { 'id': response.data.id, 'ghxh': response.data.ghxh, 'xm': response.data.xm, 'xb': response.data.xb.label } |
| } else { |
| MessageBox.alert('用户不存在,请重新重新输入工号!', '消息', { |
| confirmButtonText: '确定' |
| }) |
| this.principal = {} |
| } |
| }) |
| } else { |
| MessageBox.alert('请填写工号!', '消息', { |
| confirmButtonText: '确定' |
| }) |
| this.principal = {} |
| } |
| }, |
| handleSavePrincipal() { |
| if (!this.principal.id) { |
| MessageBox.alert('请填写正确的工号!', '消息', { |
| confirmButtonText: '确定' |
| }) |
| return |
| } |
| this.nodePrincipal = { 'auditNode': { 'id': this.nodeId }, 'user': { 'id': this.principal.id }} |
| createNodePrincipal(this.nodePrincipal).then(response => { |
| this.handlePrincipalList() |
| this.$notify({ |
| title: '成功', |
| message: '创建成功', |
| type: 'success', |
| duration: 2000 |
| }) |
| }) |
| }, |
| handleDeletePrincipal(rowid) { |
| crudDelete(this, deleteNodePrincipal, rowid, this.handlePrincipalList) |
| } |
| } |
| } |
| </script> |