审核组模块开发

This commit is contained in:
a0049873 2022-12-14 15:56:43 +08:00
parent 4605fce6b7
commit 6b143f2f75
2 changed files with 435 additions and 3 deletions

View File

@ -0,0 +1,432 @@
<!--
* @Author: Light
* @Date: 2022-12-13 15:36:38
* @LastEditors: Light
* @LastEditTime: 2022-12-14 11:52:27
* @Description: 审核组管理
-->
<template>
<el-card shadow="never" class="aui-card--fill">
<div class="mod-sys__role">
<el-form :inline="true" @keyup.enter.native="getDataList()">
<el-form-item>
<el-input v-model="name" :placeholder="$t('role.name')" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()" type="primary">{{ $t('query') }}</el-button>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="addDialog()">{{ $t('add') }}</el-button>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="deleteTeam()">{{ $t('deleteBatch') }}</el-button>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="resetHandle()">{{ $t('reset') }}</el-button>
</el-form-item>
</el-form>
<el-table
v-loading="dataListLoading"
:data="dataList"
border
@selection-change="dataListSelectionChangeHandle"
@sort-change="dataListSortChangeHandle"
style="width: 100%;">
<el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
<el-table-column prop="name" :label="$t('role.name')" header-align="center" align="center"></el-table-column>
<el-table-column prop="description" label="备注" header-align="center" align="center"></el-table-column>
<el-table-column prop="createDate" :label="$t('role.createDate')" header-align="center" align="center" width="180"></el-table-column>
<el-table-column :label="$t('handle')" fixed="right" header-align="center" align="center" width="150">
<template slot-scope="scope">
<el-button type="text" size="small" @click="updateTeam(scope.row)">{{ $t('update') }}</el-button>
<el-button type="text" size="small" @click="auditorDialogVisible(scope.row)">审核员管理</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
:current-page="page"
:page-sizes="[10, 20, 50, 100]"
:page-size="limit"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="pageSizeChangeHandle"
@current-change="pageCurrentChangeHandle">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<el-dialog
:title="(submitData.id?'修改':'新增')+'审核组'"
:visible.sync="addDialogVisible"
width="30%"
:before-close="handleClose"
:close-on-click-modal="false">
<el-form ref="submitData" :model="submitData" label-width="100px" :rules="rules">
<el-form-item label="审核组名称" prop="name">
<el-input placeholder="请输入审核组名称" v-model="submitData.name"></el-input>
</el-form-item >
<el-form-item label="备注" prop="description">
<el-input placeholder="请输入备注" v-model="submitData.description"></el-input>
</el-form-item >
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="handleClose()"> </el-button>
<el-button type="primary" @click="addAuditTeam()"> </el-button>
</span>
</el-dialog>
<el-dialog
title="审核员管理"
:visible.sync="addAuditorDialogVisible"
width="70%"
:before-close="handleClose"
:close-on-click-modal="false">
<div class="box">
<div class="left">
<div style="position: relative;">审核人员列表<el-checkbox style="position: absolute;right: 0;" v-model="checked" @change="changeFilter()">仅展示未分配审核员</el-checkbox></div>
<el-table
:height="400"
:data="auditorList"
tooltip-effect="dark"
style="width: 100%"
@selection-change="handleSelectAuditorLeft">
<el-table-column type="selection" header-align="center" align="center" width="50" :selectable="selectable"></el-table-column>
<el-table-column prop="real_name" label="姓名" header-align="center" align="center"></el-table-column>
<el-table-column prop="name" label="所属部门" header-align="center" align="center"></el-table-column>
<el-table-column prop="auditTeamName" label="当前审核组" header-align="center" align="center" v-if="!checked"></el-table-column>
</el-table>
<el-pagination
background
layout="prev, pager, next"
:page-size="pageOptionLeft.limit"
:total="pageOptionLeft.total"
@current-change="currentChangeLeft">
</el-pagination>
</div>
<div class="main">
<el-button type="primary" icon="el-icon-arrow-left" @click="delAudiTeam()"></el-button>
<el-button type="primary" @click="addAudiTeam()"><i class="el-icon-arrow-right el-icon--right"></i></el-button>
</div>
<div class="right">
<div>已添加审核人员</div>
<el-table
:height="400"
:data="submitData.member"
tooltip-effect="dark"
style="width: 100%"
@selection-change="handleSelectAuditorRight">
<el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
<el-table-column prop="name" label="姓名" header-align="center" align="center"></el-table-column>
<el-table-column prop="dept_name" label="所属部门" header-align="center" align="center"></el-table-column>
</el-table>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="handleClose()"> </el-button>
<el-button type="primary" @click="handleClose()"> </el-button>
</span>
</el-dialog>
</div>
</el-card>
</template>
<script>
import mixinViewModule from '@/mixins/view-module'
import qs from 'qs'
export default {
mixins: [mixinViewModule],
data () {
return {
mixinViewModuleOptions: {
getDataListURL: 'audit_team/sysauditteam/page',
getDataListIsPage: true,
deleteIsBatch: true
},
name: '',
dataForm: {
name: ''
},
submitData: {
name: '',
description: '',
member: []
},
submitFlag: true,
deleteFlag: true,
rules: {
name: [
{ required: true, message: '请输入审核组名称', trigger: 'blur' }
]
},
addDialogVisible: false,
addAuditorDialogVisible: false,
auditorList: [],
selectAuditorListLeft: [],
selectAuditorListRight: [],
pageOptionLeft: {
page: 1,
limit: 5,
total: 0
},
checked: true
}
},
components: {
},
methods: {
addDialog () {
this.addDialogVisible = true
},
handleClose () {
this.addDialogVisible = false
this.addAuditorDialogVisible = false
this.selectAuditorListLeft = []
this.selectAuditorListRight = []
this.submitData = {
name: '',
description: '',
member: []
}
this.pageOptionLeft = {
page: 1,
limit: 5,
total: 0
}
this.checked = true
this.getAuditList()
this.resetHandle()
},
auditorDialogVisible (row) {
this.submitData = {
id: row.id,
name: row.name,
description: row.description,
member: row.member
}
this.addAuditorDialogVisible = true
},
//
addAuditTeam () {
this.$refs.submitData.validate((valid) => {
if (valid) {
this.submitFrom()
} else {
return false
}
})
},
submitFrom (flag) {
if (this.submitFlag) {
this.submitFlag = false
if (this.submitData.id) {
this.$http.put('audit_team/sysauditteam', this.submitData).then(res => {
if (res.data.msg !== 'success') {
this.$message({
type: 'warning',
message: '修改失败'
})
} else {
this.$message.success('修改成功!')
}
if (!flag || res.data.msg !== 'success') {
this.handleClose()
this.resetHandle()
}
if (flag) {
this.getAuditList()
}
this.submitFlag = true
})
} else {
this.$http.post('audit_team/sysauditteam', this.submitData).then(res => {
if (res.data.msg !== 'success') {
this.$message({
type: 'warning',
message: '修改失败'
})
} else {
this.$message.success('修改成功!')
}
this.handleClose()
this.resetHandle()
this.submitFlag = true
})
}
} else {
this.$message({
type: 'warning',
message: '请勿重复操作!'
})
}
},
//
deleteTeam () {
if (this.dataListSelections.length === 0) {
this.$message({
type: 'warning',
message: '请先选择需要删除的审批组!'
})
return
}
if (this.deleteFlag) {
this.deleteFlag = false
const ids = []
this.dataListSelections.map(val => {
ids.push(val.id)
})
this.$http.delete('audit_team/sysauditteam', { data: ids }).then(res => {
if (res.data.msg !== 'success') {
this.$message({
type: 'warning',
message: '删除失败'
})
} else {
this.$message.success('删除成功!')
}
this.resetHandle()
this.deleteFlag = true
})
} else {
this.$message({
type: 'warning',
message: '请勿重复操作!'
})
}
},
//
updateTeam (row) {
this.submitData = {
id: row.id,
name: row.name,
description: row.description,
member: row.member
}
this.addDialogVisible = true
},
//
handleSelectAuditorLeft (val) {
this.selectAuditorListLeft = val
},
handleSelectAuditorRight (val) {
this.selectAuditorListRight = val
},
resetHandle () {
this.dataForm.name = ''
this.$nextTick(() => {
this.getDataList()
})
},
getAuditList () {
this.$http.get('/sys/user/auditingUserPage?' + qs.stringify({
page: this.pageOptionLeft.page,
limit: this.pageOptionLeft.limit,
filter: this.checked
})).then(res => {
this.auditorList = res.data.data.list
this.pageOptionLeft.total = res.data.data.total
})
},
currentChangeLeft (val) {
this.pageOptionLeft.page = val
this.getAuditList()
},
//
addAudiTeam () {
if (this.selectAuditorListLeft.length === 0) {
this.$message({
type: 'warning',
message: '请选择审核人员!'
})
return
}
// const arr = []
// const str = ''
// const addArr = []
this.selectAuditorListLeft.map(val => {
// if (val.auditTeamName) {
// arr.push({
// name: val.real_name,
// auditor: val.auditTeamName
// })
// str += val.real_name + ';'
// }
// addArr.push({
// id: val.id,
// name: val.real_name,
// dept_name: val.name
// })
this.submitData.member.push({
id: val.id,
name: val.real_name,
dept_name: val.name
})
})
// if (arr.length > 0) {
// this.$message({
// type: 'warning',
// message: str.substring(0, str.length - 1) + ''
// })
// return
// }
// this.submitData.member.push(...addArr)
this.submitFrom(true)
},
//
delAudiTeam () {
if (this.selectAuditorListRight.length === 0) {
this.$message({
type: 'warning',
message: '请选择审核人员!'
})
return
}
this.selectAuditorListRight.map(val => {
this.submitData.member = this.submitData.member.filter(member => member.id !== val.id)
})
this.submitFrom(true)
},
selectable (row) {
return !row.inAuditTeam
},
changeFilter () {
this.pageOptionLeft.page = 1
this.getAuditList()
}
},
created () {
this.getAuditList()
}
}
</script>
<style lang="scss" scoped>
// :deep(.el-form-item__label::before){
// line-height: 40px;
// }
.box{
display: flex;
justify-content: center;
align-items: flex-start;
.left{
width: 600px;
div:nth-of-type(1){
text-align: center;
font-size: 20px;
font-weight: 600;
margin-bottom: 10px;
}
}
.main{
margin: 200px 30px 0;
}
.right{
width: 500px;
div:nth-of-type(1){
text-align: center;
font-size: 20px;
font-weight: 600;
margin-bottom: 10px;
}
}
}
:deep(.el-pagination){
display: flex;
justify-content: center;
}
</style>

View File

@ -74,11 +74,11 @@ export default {
},
methods: {
resetHandle () {
this.dataForm.name = '';
this.dataForm.name = ''
this.$nextTick(() => {
this.getDataList()
})
},
}
}
}
</script>