Browse Source

角色管理优化调整

master
李磊 3 years ago
parent
commit
16bd3f5b39
  1. 65
      src/api/permission.js
  2. 6
      src/api/role.js
  3. 16
      src/views/bggl/banjie_list.vue
  4. 655
      src/views/user/role.vue
  5. 109
      src/views/ysjl/3000/common/index.vue

65
src/api/permission.js

@ -0,0 +1,65 @@
import api from '@/utils/api'
import qs from 'qs'
export function add(data) {
return api({
url: '/permission',
method: 'post',
data
})
}
export function edit(data) {
return api({
url: '/permission',
method: 'put',
data
})
}
export function del(params) {
return api({
url: '/permission',
method: 'delete',
params,
paramsSerializer: function(params) {
return qs.stringify(params, { indices: false })
}
})
}
export function getList(params) {
return api({
url: '/permission/list',
method: 'get',
params
})
}
export function getPermissionsByRoleId(roleId) {
return api({
url: '/permission/getPermissionsByRoleId',
method: 'get',
params: {
roleId: roleId
}
})
}
export function getPermissionTypesById(permissionId) {
return api({
url: '/permission/getPermissionTypesById',
method: 'get',
params: {
permissionId: permissionId
}
})
}
export function getTree() {
return api({
url: '/permission/tree',
method: 'get'
})
}
export default { add, edit, del }

6
src/api/role.js

@ -27,9 +27,9 @@ export function del(params) {
}) })
} }
export function getRoleList(params) { export function getList(params) {
return api({ return api({
url: '/role', url: '/role/list',
method: 'get', method: 'get',
params params
}) })
@ -49,4 +49,4 @@ export function getAllRole() {
}) })
} }
export default { add, edit, del, getRoleMenuList } export default { add, edit, del, getList }

16
src/views/bggl/banjie_list.vue

@ -3,35 +3,23 @@
<div class="filter-container"> <div class="filter-container">
<div v-show="hasPerm('bggl:update') || hasPerm('bggl:regenerate')" class="sub-navbar"> <div v-show="hasPerm('bggl:update') || hasPerm('bggl:regenerate')" class="sub-navbar">
<sticky> <sticky>
<el-button v-if="showResetFlowApply" v-show="hasPerm('bggl:update') && notHasDepartmentId(74)" type="danger" icon="el-icon-refresh" @click="resetFlowApply">
重启流程发送申请
</el-button>
<el-button v-if="hasPerm('bggl:update')" type="danger" icon="el-icon-refresh" @click="resetFlow"> <el-button v-if="hasPerm('bggl:update')" type="danger" icon="el-icon-refresh" @click="resetFlow">
重启流程 重启流程
</el-button> </el-button>
<el-button v-if="$store.getters.departmentId === 68 || $store.getters.username === 'admin'" type="success" icon="el-icon-download" @click="batchDownloadWord">
下载报告
</el-button>
<template v-if="hasPerm('bggl:regenerate')"> <template v-if="hasPerm('bggl:regenerate')">
<el-button v-if="notHasDepartmentId(74)" type="danger" icon="el-icon-refresh" @click="beforeResetRecord">
重启申请
</el-button>
<el-button type="warning" icon="el-icon-refresh" @click="generatePdf('YSJL')"> <el-button type="warning" icon="el-icon-refresh" @click="generatePdf('YSJL')">
生成记录 生成记录
</el-button> </el-button>
<el-button type="warning" icon="el-icon-refresh" @click="generatePdf('OTHER')">
生成附件压力容器制造
</el-button>
<el-button type="warning" icon="el-icon-refresh" @click="generatePdf('JYBG')"> <el-button type="warning" icon="el-icon-refresh" @click="generatePdf('JYBG')">
生成报告 生成报告
</el-button> </el-button>
<el-button v-if="notHasDepartmentId(74)" type="warning" icon="el-icon-refresh" @click="generatePdf('HGZ')"> <el-button type="warning" icon="el-icon-refresh" @click="generatePdf('HGZ')">
生成合格证 生成合格证
</el-button> </el-button>
<el-button type="success" icon="el-icon-refresh" @click="createQrcode"> <el-button type="success" icon="el-icon-refresh" @click="createQrcode">
重新生成一/二维码 重新生成一/二维码
</el-button> </el-button>
<el-button v-if="notHasDepartmentId(74)" type="warning" @click="cleanRed"> <el-button type="warning" @click="cleanRed">
<svg-icon icon-class="clear" /> 消红 <svg-icon icon-class="clear" /> 消红
</el-button> </el-button>
</template> </template>

655
src/views/user/role.vue

@ -1,130 +1,60 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<div class="filter-container"> <!--头部选项-->
<el-form> <div class="head-container">
<el-form-item> <div v-if="crud.props.searchToggle">
<el-input v-model="listQuery.roleName" placeholder="请输入角色名称" style="width: 260px" clearable @keyup.enter.native="handleFilter" /> <el-input v-model="query.roleName" placeholder="角色名称" style="width: 200px;" class="filter-item" clearable @keyup.enter.native="crud.toQuery" />
<el-button type="primary" icon="el-icon-search" @click="handleFilter"> <query :crud="crud" />
查询 </div>
</el-button> <crud :permission="permission" />
<el-button type="primary" icon="el-icon-edit" @click="showCreate">
添加
</el-button>
<el-button type="danger" icon="el-icon-delete" @click="deleteRole">
删除
</el-button>
</el-form-item>
</el-form>
</div> </div>
<el-table ref="list" :data="list" border fit highlight-current-row @row-click="onRowClick" @selection-change="handleSelectionChange"> <!--表格内容-->
<el-table-column type="selection" width="40" /> <CustomTable ref="customTable" :col-configs="colConfigs" :columns="columns" :crud="crud">
<el-table-column type="index" align="center" label="序号" width="80" /> <el-table-column v-if="checkPermission(permission.edit)" slot="operation" align="center" width="100" label="操作">
<el-table-column align="center" label="角色名称" prop="roleName" style="width: 60px;" />
<el-table-column align="center" label="创建时间" prop="createTime" style="width: 60px;" />
<el-table-column align="center" label="最近修改时间" prop="updateTime" style="width: 60px;" />
<el-table-column align="center" label="管理" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button :disabled="scope.row.id === 1" type="primary" icon="edit" @click="showUpdate(scope.$index)"> <Edit :permission="permission" :data="scope.row" :disabled-edit="false" />
修改
</el-button>
<el-button type="warning" icon="edit" @click="showUserAuth(scope.$index)">
授权
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </CustomTable>
<pagination v-show="totalCount>0" :total="totalCount" :page-num.sync="listQuery.pageNum" :page-row.sync="listQuery.pageSize" @pagination="getList" /> <pagination />
<el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" width="1100px"> <!--弹出框内容-->
<el-form ref="tempRole" :model="tempRole" class="small-space" label-position="left" label-width="80px" style="margin-left:50px;height: 600px;overflow: auto;"> <el-dialog
<el-form-item label="角色名称" required> width="80%"
<el-input v-model="tempRole.roleName" type="text" style="width: 200px;" /> :before-close="crud.cancelCU"
</el-form-item> :visible="crud.status.editor > 0"
<el-form-item label="角色代码" required> :title="crud.status.title"
<el-input v-model="tempRole.roleCode" type="text" style="width: 200px;" /> >
</el-form-item> <el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="所属资源" required> <el-form-item label="角色名称:" prop="roleName">
<div> <el-input v-model="form.roleName" placeholder="填写角色名称" type="text" />
<el-row>
<el-col :span="4">
<div v-for="(menu, _index) in allPermission" :key="menu.permission.name">
<span style="display: inline-block;">
<el-button
:type="isMenuNone(menu.permission.id)?'':(isMenuAll(menu.permission.id)?'success':'primary')"
size="mini"
style="width:100px;"
@click="checkOneList(_index)"
>{{ menu.permission.title }}</el-button>
</span>
</div>
</el-col>
<hr style="float: left;height: 780px;margin-top:10px;margin-bottom:10px;margin-right: 30px;border: 1px solid #00ffff;">
<el-col :span="18">
<div v-for="(menu2) in allPermissionVOList" :key="menu2.permission.name">
<span style="display: inline-block;">
<el-button
:type="isMenuNone(menu2.permission.pid,menu2.permission.id)?'':(isMenuAll(menu2.permission.pid,menu2.permission.id)?'success':'primary')"
size="mini"
@click="checkAll(menu2.permission.pid,menu2.permission.id)"
>{{ menu2.permission.title }}</el-button>
</span>
<div style="display: inline-block;margin-left:20px;">
<el-checkbox-group v-model="permissionList">
<el-checkbox v-for="perm in menu2.resourcePermissionList" :key="perm.id" :label="perm.id">
<span>{{ perm.permissionType }}</span>
</el-checkbox>
</el-checkbox-group>
</div>
</div>
</el-col>
</el-row>
</div>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false">
</el-button>
<el-button v-if="dialogStatus==='create'" type="success" @click="createRole">
</el-button>
<el-button v-else type="primary" @click="updateRole">
</el-button>
</div>
</el-dialog>
<el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" width="1100px">
<el-form ref="tempRole" :model="tempRole" class="small-space" label-position="left" label-width="100px" style="margin-left:50px;height: 600px;overflow: auto;">
<el-form-item label="角色名称" required>
<el-input v-model="tempRole.roleName" type="text" style="width: 200px;" />
</el-form-item> </el-form-item>
<el-form-item label="角色代码" required> <el-form-item label="角色代码:" prop="roleCode">
<el-input v-model="tempRole.roleCode" type="text" style="width: 200px;" /> <el-input v-model="form.roleCode" placeholder="填写角色代码" type="text" />
</el-form-item> </el-form-item>
<el-form-item label="功能权限:"> <el-form-item label="功能权限:">
<el-table <el-table
ref="menuList" ref="menuList"
:data="allPermission" :data="menuList"
border border
fit fit
highlight-current-row highlight-current-row
row-key="permission.id" row-key="permission.id"
:default-expand-all="true" :default-expand-all="true"
:tree-props="{children: 'allPermissionVOList', hasChildren: 'hasChildren'}" :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
> >
<el-table-column label="菜单名称" width="180"> <el-table-column label="菜单名称" width="400">
<template slot-scope="scope"> <template slot-scope="scope">
<el-checkbox v-model="scope.row.checked" @change="handleCheckAllChange(scope.row, $event)"> <el-checkbox v-model="scope.row.checked" :indeterminate="scope.row.indeterminate" @change="handleCheckAllChange(scope.row, $event)">
{{ scope.row.permission.title }} {{ scope.row.permission.title }}
</el-checkbox> </el-checkbox>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="功能选项"> <el-table-column label="功能选项">
<template slot-scope="scope"> <template v-if="scope.row.children.length === 0" slot-scope="scope">
<el-checkbox <el-checkbox
v-for="options in scope.row.resourcePermissionList" v-for="options in scope.row.resourcePermissionList"
:key="options.id" :key="options.id"
v-model="options.permissionId" v-model="options.checked"
:label="options.permissionType" :label="options.permissionType"
@change="handleCheckChange(scope.row)" @change="handleCheckChange(scope.row)"
/> />
@ -134,455 +64,114 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false"> <el-button @click="crud.cancelCU">
</el-button> </el-button>
<el-button v-if="dialogStatus==='create'" type="success" @click="createRole"> <el-button type="primary" @click="crud.submitCU">
</el-button>
<el-button v-else type="primary" @click="updateRole">
</el-button> </el-button>
</div> </div>
</el-dialog> </el-dialog>
<!-- 用户授权窗口 -->
<el-dialog :title="'角色授权'" :visible.sync="authDialogFormVisible">
<el-container>
<el-header>
<el-form>
<el-form-item>
<el-input v-model="userListQuery.nickname" placeholder="昵称" clearable style="width: 200px" @keyup.enter.native="userHandleFilter" />
<el-input v-model="userListQuery.username" placeholder="用户名" clearable style="width: 100px" @keyup.enter.native="userHandleFilter" />
<el-select v-model="userListQuery.departmentId" placeholder="请选择科室" clearable @keyup.enter.native="userHandleFilter">
<el-option v-for="dept in depts" :key="dept.id" :label="dept.name" :value="dept.id" />
</el-select>
<el-switch v-model="userListQuery.isHasRole" active-color="#13ce66" inactive-color="#ff4949" active-text="已授权" inactive-text="全部" @change="userHandleFilter" />
<el-button type="primary" icon="el-icon-search" @click="userHandleFilter">
查询
</el-button>
</el-form-item>
</el-form>
</el-header>
<el-main style="margin-top: -30px">
<el-table :data="userList" height="500" border fit highlight-current-row>
<el-table-column type="index" align="center" label="序号" width="80" />
<el-table-column align="center" label="昵称" prop="nickname" style="width: 60px;" />
<el-table-column align="center" label="用户名" prop="username" style="width: 60px;" />
<el-table-column align="center" label="授权状态" prop="roleId" style="width: 60px;">
<template slot-scope="scope">
<span v-if="scope.row.roleIds.split(',').find(roleId => Number(roleId) === tempRole.id)" style="color: #333">已授权</span>
<span v-else style="color: #FF6347">未授权</span>
</template>
</el-table-column>
<el-table-column align="center" label="管理" width="220">
<template slot-scope="scope">
<el-button :disabled="!!scope.row.roleIds.split(',').filter(roleId => Number(roleId) === tempRole.id)[0] || scope.row.username === 'admin'" type="success" icon="el-icon-check" circle @click="authRole(scope.$index)" />
<el-button :disabled="!scope.row.roleIds.split(',').filter(roleId => Number(roleId) === tempRole.id)[0] || scope.row.username === 'admin'" type="danger" icon="el-icon-close" circle @click="unAuthRole(scope.$index)" />
</template>
</el-table-column>
</el-table>
<pagination v-show="userTotalCount>0" :total="userTotalCount" :page-num.sync="userListQuery.pageNum" :page-row.sync="userListQuery.pageSize" @pagination="getUserList" />
</el-main>
</el-container>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import qs from 'qs' import CRUD, { form, header, presenter } from '@/components/Crud/crud'
import Pagination from '@/components/Pagination' import Crud from '@/components/Crud'
import Query from '@/components/Crud/Query'
import Edit from '@/components/Crud/Edit'
import CustomTable from '@/components/Crud/Table'
import Pagination from '@/components/Crud/Pagination'
import CrudRole from '@/api/role'
import { getPermissionsByRoleId, getTree } from '@/api/permission'
// crudpresenter
const defaultCrud = presenter(CRUD({
title: '角色',
url: '/role/list',
orderBy: ['id asc'],
crudMethod: { ...CrudRole }
}))
// form
const defaultForm = form({
id: null,
roleName: '',
roleCode: '',
menuOptionIds: {}
})
export default { export default {
name: 'RoleList', name: 'RoleList',
components: { Pagination }, components: { Pagination, Query, Crud, CustomTable, Edit },
mixins: [defaultCrud, defaultForm, header()],
data() { data() {
return { return {
list: [], menuList: [],
totalCount: 0, colConfigs: [
dialogStatus: 'create', { prop: 'roleName', label: '角色名称', align: 'center' },
dialogFormVisible: false, { prop: 'roleCode', label: '角色代码', align: 'center' },
userList: [], { slot: 'operation' }
userTotalCount: 0, ],
authDialogFormVisible: false, permission: {
userListQuery: { add: ['role:add'],
pageNum: 1, edit: ['role:update'],
pageSize: 20 del: ['role:delete']
},
listQuery: {
pageNum: 1,
pageSize: 20
}, },
textMap: { rules: {
update: '编辑', roleName: [
create: '新建角色' { required: true, message: '请输入角色名称', trigger: 'blur' }
],
roleCode: [
{ required: true, message: '请输入角色代码', trigger: 'blur' }
]
}, },
tempRole: {},
allPermission: [],
menuNameList: [],
permissionList: [],
depts: [],
allPermissionVOList: [],
checkedIds: new Set() checkedIds: new Set()
} }
}, },
created() { mounted() {
this.getList() this.getAllMenu()
this.getAllPermission()
this.getDepartment()
}, },
methods: { methods: {
getList() { //
// [CRUD.HOOK.afterToCU]() {
this.api({ this.clearChecked(this.menuList)
url: '/role/list', this.checkedIds.clear()
method: 'get', },
params: this.listQuery //
}).then(data => { [CRUD.HOOK.afterToEdit](crud, form) {
this.list = data.list this.getRoleMenuList(form.id)
this.totalCount = data.total },
}) //
}, [CRUD.HOOK.afterValidateCU]() {
getUserList() { this.form.menuOptionIds = Array.from(this.checkedIds)
// },
this.api({ //
url: '/user/list', getAllMenu() {
method: 'get', getTree().then(data => {
params: this.userListQuery, this.menuList = data
paramsSerializer: function(params) {
return qs.stringify(params, { indices: false })
}
}).then(data => {
this.userList = data.list
this.userTotalCount = data.total
})
},
//
getDepartment() {
this.api({
url: '/department/all',
method: 'get'
}).then(data => {
this.depts = data
})
},
getAllPermission() {
this.api({
url: '/permission/getAllPermissionList',
method: 'get'
}).then(data => {
this.allPermission = data
if (this.allPermission.length > 0) {
this.allPermissionVOList = this.allPermission[0].resourcePermissionList
}
})
},
onRowClick(row) {
this.$refs.list.toggleRowSelection(row)
},
handleSelectionChange: function(val) {
this.multipleSelection = val
},
showCreate() {
this.tempRole = {}
this.permissionList = []
if (this.allPermission.length > 0) {
this.allPermissionVOList = this.allPermission[0].allPermissionVOList
}
this.dialogStatus = 'create'
this.dialogFormVisible = true
},
handleFilter() {
//
this.listQuery.pageNum = 1
this.getList()
},
userHandleFilter() {
this.userListQuery.pageNum = 1
if (this.userListQuery.isHasRole) {
this.userListQuery.roleIds = [this.tempRole.id]
} else {
delete this.userListQuery.roleIds
}
this.getUserList()
},
createRole() {
if (!this.checkRoleNameUnique()) {
return
}
if (!this.checkPermissionNum()) {
return
}
this.tempRole.resourcePermissionIds = this.permissionList
//
this.api({
url: '/role',
method: 'post',
data: this.tempRole
}).then(() => {
this.$message.success('添加成功。')
this.getList()
this.dialogFormVisible = false
})
},
showUpdate($index) {
this.tempRole = this.list[$index]
this.getPermissionsByRoleId(this.tempRole.id)
if (this.allPermission.length > 0) {
this.allPermissionVOList = this.allPermission[0].allPermissionVOList
}
this.dialogStatus = 'update'
this.dialogFormVisible = true
},
updateRole() {
if (!this.tempRole.roleName) {
this.$message.error('请填写角色名称')
return false
}
if (!this.checkPermissionNum()) {
return
}
this.tempRole.resourcePermissionIds = this.permissionList
//
this.api({
url: '/role',
method: 'put',
data: this.tempRole
}).then(() => {
this.$message.success('更新成功。')
this.getList()
this.dialogFormVisible = false
})
},
getPermissionsByRoleId(id) {
this.api({
url: '/permission/getPermissionsByRoleId',
method: 'get',
params: {
roleId: id
}
}).then(data => {
if (data !== null && data.length > 0) {
const checkedArray = []
data.forEach(rolePermission => {
checkedArray.push(rolePermission.resourcePermissionId)
})
this.permissionList = checkedArray
} else {
this.permissionList = []
}
})
},
showUserAuth($index) {
this.authDialogFormVisible = true
const role = this.list[$index]
this.tempRole.id = role.id
this.tempRole.roleName = role.roleName
this.userListQuery = {}
this.getUserList()
},
authRole($index) {
const user = this.userList[$index]
user.password = null
user.signPassword = null
const roleIds = []
user.roleIds.split(',').forEach(roleId => roleIds.push(Number(roleId)))
roleIds.push(this.tempRole.id)
this.api({
url: '/user',
method: 'put',
data: {
user: user,
roleIds: roleIds
}
}).then(() => {
this.getUserList()
})
},
unAuthRole($index) {
const user = this.userList[$index]
user.roleId = null
const roleIds = []
user.roleIds.split(',').forEach(roleIdStr => {
const roleId = Number(roleIdStr)
if (roleId !== this.tempRole.id) {
roleIds.push(roleId)
}
})
this.api({
url: '/user',
method: 'put',
data: {
user: user,
roleIds: roleIds
}
}).then(() => {
this.getUserList()
})
},
deleteRole() {
if (this.multipleSelection.length <= 0) {
this.$message.warning('请选择要删除的数据。')
return
}
const pks = []
const qs = require('qs')
this.multipleSelection.forEach(role => {
pks.push(role.id)
})
this.$confirm('删除角色会清空该角色下用户的权限,确定要删除吗?', '提示', {
confirmButtonText: '确定',
showCancelButton: '取消',
type: 'warning'
}).then(() => {
this.api({
url: '/role',
method: 'delete',
params: {
pks: pks
},
paramsSerializer: function(params) {
return qs.stringify(params, { indices: false })
}
}).then(() => {
this.$message.success('删除成功。')
this.getList()
})
}) })
}, },
getMenu(id, _index2) { getRoleMenuList(roleId) {
const menu = [] getPermissionsByRoleId(roleId).then(data => {
let allVoList = [] this.menuList.forEach(permission => {
if (id) { if (permission.children.length > 0) {
this.allPermission.forEach(data => { this.echoChildren(permission.children, data)
if (id === data.permission.id) {
allVoList = data.allPermissionVOList
}
})
}
if (allVoList) {
allVoList.forEach(data => {
if (_index2) {
if (_index2 === data.permission.id && data.resourcePermissionList.length > 0) {
data.resourcePermissionList.forEach(ad => {
menu.push(ad)
})
}
} else { } else {
data.resourcePermissionList.forEach(ad => { this.settingChecked(permission, data)
menu.push(ad)
})
} }
}) })
} })
return menu
},
//
isMenuNone(id, _index2) {
const menu = this.getMenu(id, _index2)
let result = true
for (let j = 0; j < menu.length; j++) {
if (this.permissionList.indexOf(menu[j].id) > -1) {
result = false
break
}
}
return result
},
checkOneList(_index) {
this.allPermissionVOList = this.allPermission[_index].allPermissionVOList
},
//
isMenuAll(id, _index2) {
const menu = this.getMenu(id, _index2)
let result = true
for (let j = 0; j < menu.length; j++) {
if (this.permissionList.indexOf(menu[j].id) < 0) {
result = false
break
}
}
return result
},
checkAll(id, _index2) {
//
const v = this
if (v.isMenuAll(id, _index2)) {
// ,
v.noPerm(_index2)
} else {
// ,
v.allPerm(_index2)
}
},
getPerm(_index) {
let menu = []
if (_index) {
this.allPermissionVOList.forEach(da => {
if (_index === da.permission.id) {
menu = da.resourcePermissionList
}
})
}
return menu
},
allPerm(_index) {
const menu = this.getPerm(_index)
//
for (let j = 0; j < menu.length; j++) {
this.addUnique(menu[j].id, this.permissionList)
}
},
noPerm(_index) {
const menu = this.getPerm(_index)
//
for (let j = 0; j < menu.length; j++) {
const idIndex = this.permissionList.indexOf(menu[j].id)
if (idIndex > -1) {
this.permissionList.splice(idIndex, 1)
}
}
},
addUnique(val, arr) {
//
const _index = arr.indexOf(val)
if (_index < 0) {
arr.push(val)
}
},
checkPermissionNum() {
//
if (this.permissionList.length === 0) {
this.$message.error('请至少选择一种权限')
return false
}
return true
},
checkRoleNameUnique(roleId) {
//
const roleName = this.tempRole.roleName
if (!roleName) {
this.$message.error('请填写角色名称')
return false
}
const roles = this.list
let result = true
for (let j = 0; j < roles.length; j++) {
if (roles[j].roleName === roleName && (!roleId || roles[j].roleId !== roleId)) {
this.$message.error('角色名称已存在')
result = false
break
}
}
return result
}, },
handleCheckAllChange(val, checked) { handleCheckAllChange(val, checked) {
console.log(val, '是啥')
// //
if (val.allPermissionVOList.length > 0) { if (val.children.length > 0) {
if (checked) { if (checked) {
this.checkedIds.add(val.resourcePermissionList[0].id) this.checkedIds.add(val.resourcePermissionList[0].id)
} else { } else {
this.checkedIds.delete(val.resourcePermissionList[0].id) this.checkedIds.delete(val.resourcePermissionList[0].id)
} }
this.findChildren(val.allPermissionVOList, checked) this.findChildren(val.children, checked)
} else { } else {
// //
val.resourcePermissionList.forEach(options => { val.resourcePermissionList.forEach(options => {
@ -595,8 +184,8 @@ export default {
}) })
} }
// //
if (val.permission.id !== 0) { if (val.permission.pid !== 0) {
this.findParent(this.allPermission, val.permission.parentId) this.findParent(this.menuList, val.permission.pid)
} }
val.indeterminate = false val.indeterminate = false
}, },
@ -614,8 +203,8 @@ export default {
val.checked = checkedLength === length val.checked = checkedLength === length
val.indeterminate = checkedLength > 0 && checkedLength < length val.indeterminate = checkedLength > 0 && checkedLength < length
// //
if (val.menu.parentId !== 0) { if (val.permission.pid !== 0) {
this.findParent(this.menuList, val.menu.parentId) this.findParent(this.menuList, val.permission.pid)
} }
}, },
findChildren(list, checked) { findChildren(list, checked) {
@ -635,12 +224,12 @@ export default {
}) })
}) })
}, },
findParent(list, parentId) { findParent(list, pid) {
list.forEach(result => { list.forEach(result => {
let parentCheckedLength = 0 let parentCheckedLength = 0
let parentIndeterminateLength = 0 let parentIndeterminateLength = 0
// //
if (result.menu.id === parentId) { if (result.permission.id === pid) {
// //
result.children.forEach(children => { result.children.forEach(children => {
if (children.indeterminate) { if (children.indeterminate) {
@ -657,11 +246,11 @@ export default {
this.checkedIds.delete(result.resourcePermissionList[0].id) this.checkedIds.delete(result.resourcePermissionList[0].id)
} }
// //
if (result.menu.parentId !== 0) { if (result.permission.pid !== 0) {
this.findParent(this.menuList, result.menu.parentId) this.findParent(this.menuList, result.permission.pid)
} }
} else if (result.children.length > 0) { } else if (result.children.length > 0) {
this.findParent(result.children, parentId) this.findParent(result.children, pid)
} }
}) })
}, },
@ -690,14 +279,14 @@ export default {
}, },
// //
clearChecked(menuList) { clearChecked(menuList) {
menuList.forEach(menu => { menuList.forEach(permission => {
menu.checked = false permission.checked = false
menu.indeterminate = false permission.indeterminate = false
menu.resourcePermissionList.forEach(options => { permission.resourcePermissionList.forEach(options => {
options.checked = false options.checked = false
}) })
if (menu.children.length > 0) { if (permission.children.length > 0) {
this.clearChecked(menu.children) this.clearChecked(permission.children)
} }
}) })
} }

109
src/views/ysjl/3000/common/index.vue

@ -776,7 +776,6 @@ export default {
defaultRlr: [], defaultRlr: [],
renlingren: [], renlingren: [],
xinghaoList: [], xinghaoList: [],
dicGzjz: [],
cols: [ cols: [
{ {
name: 'jianyanxiang', // el-table-column prop='' name: 'jianyanxiang', // el-table-column prop=''
@ -956,15 +955,6 @@ export default {
}) })
} }
}, },
getDicJyxm(sort) {
this.jyxmService
.getCyJyxm(this.$route.query.templateId, sort)
.then((data) => {
this.dicGzjz = data.map((row) => {
return { value: row.gongzuojianzheng }
})
})
},
/** /**
* 查询最大记录编号 * 查询最大记录编号
*/ */
@ -1165,102 +1155,6 @@ export default {
} }
}) })
}, },
/**
* 格式化监检员
*/
formatterJianjianyuan(row) {
if (row.jianjianyuan) {
if (typeof row.jianjianyuan === 'number') {
row.jianjianyuan = row.jianjianyuan.toString()
return this.common.convertCnName(row.jianjianyuan)
}
return row.jianjianyuan
}
},
/**
* 检验项目批量签名
*/
Signjyxm() {
if (this.$refs.bgfyData.selection.length === 0) {
this.$message('请在列表选择要签名的数据。')
return
}
this.signShow = true
this.$refs.qmButton.dialogFormVisible = true
},
/**
* 检验项目清除签名
*/
signClear: function() {
if (this.$refs.bgfyData.selection.length === 0) {
this.$message('请在列表选择要清除签名的数据。')
return
}
this.$refs.bgfyData.selection.forEach((row) => {
row.jianjianyuan = null
})
},
batchUpdDate() {
if (this.$refs.bgfyData.selection.length === 0) {
this.$message('请在列表选择要修改日期的数据。')
return false
}
this.jyxmrqShow = true
},
batchUpd() {
for (let i = 0; i < this.$refs.bgfyData.selection.length; i++) {
this.$refs.bgfyData.selection[i].querenriqi = this.querenriqi
}
this.jyxmrqShow = false
},
changeJsl(val) {
if (val === '无此项.') {
this.$set(this.param, 'qita', val)
} else {
this.$set(
this.param,
'qita',
val ? (this.param.qita ? this.param.qita + '\n' : '') + val : ''
)
}
},
/**
* 核价
*/
beforeHejia: function() {
//
this.ysjl.jianyanheding = Math.round(
!this.param.zaojia || !this.param.bili
? 0
: this.common.accMul(this.param.zaojia, this.param.bili / 100)
)
},
showDialogRoleVisible: function() {
//
this.renlingren.length = 0
this.defaultRlr = this.ysjl.renlingren.split(',')
//
this.defaultRlr.forEach((userId) => {
for (let i = 0; i < this.userList.length; i++) {
if (String(this.userList[i].id) === userId) {
this.userList.splice(i, 1)
break
}
}
})
this.dialogRoleVisible = true
},
/**
* 追加认领人
* 将默认认领人拼接新加的认领人
*/
updateRenlingren: function() {
const rlr = this.defaultRlr.concat(this.renlingren)
this.ysjl.renlingren = rlr.join(',')
this.saveYsjl('upd')
},
changXh: function(val) { changXh: function(val) {
const xinghao = this.xinghaoList.filter((xh) => xh.xinghao === val)[0] const xinghao = this.xinghaoList.filter((xh) => xh.xinghao === val)[0]
this.$set( this.$set(
@ -1269,9 +1163,6 @@ export default {
(xinghao && xinghao.jiandingbaogaobianhao) || '' (xinghao && xinghao.jiandingbaogaobianhao) || ''
) )
}, },
querySearchGzjz: function(queryString, cb, $index) {
cb([this.dicGzjz[$index]])
},
loadPhxsImage(data) { loadPhxsImage(data) {
this.pic = data this.pic = data
} }

Loading…
Cancel
Save