| | |
| | | @row-del="rowDeleteHandler" |
| | | > |
| | | <template slot="menuLeft" slot-scope="scope"> |
| | | <el-button icon="el-icon-delete" plain size="small" type="danger" @click="allDelHandler">删除</el-button> |
| | | <el-button icon="el-icon-school" plain size="small" type="primary" @click="assignMembersHandler">分配成员 |
| | | <el-button v-if="permissionList.delBtn" icon="el-icon-delete" plain size="small" type="danger" |
| | | @click="allDelHandler">删除 |
| | | </el-button> |
| | | <el-button icon="el-icon-user" plain size="small" type="primary" @click="statisticsHandler">统计</el-button> |
| | | <el-button icon="el-icon-upload2" plain size="small" type="primary" @click="upLoadRole">导入角色</el-button> |
| | | <el-button icon="el-icon-download" plain size="small" type="primary">导出</el-button> |
| | | <el-button v-if="permissionList.assignMembersBtn" icon="el-icon-school" plain size="small" type="primary" |
| | | @click="assignMembersHandler">分配成员 |
| | | </el-button> |
| | | <el-button v-if="permissionList.statisticsBtn" icon="el-icon-user" plain size="small" type="primary" |
| | | @click="statisticsHandler">统计 |
| | | </el-button> |
| | | <el-button v-if="permissionList.importRoleBtn" icon="el-icon-upload2" plain size="small" type="primary" |
| | | @click="upLoadRole">导入角色 |
| | | </el-button> |
| | | <el-button v-if="permissionList.exportBtn" icon="el-icon-download" plain size="small" type="primary">导出 |
| | | </el-button> |
| | | </template> |
| | | |
| | | <template slot="roleClassifyText" slot-scope="{row}"> |
| | |
| | | </template> |
| | | </avue-crud> |
| | | |
| | | <!-- 分配角色穿梭框 --> |
| | | <!-- 分配成员穿梭框 --> |
| | | <transfer ref="transfer" :left-role-data="leftRoleData" :right-role-data="rightRoleData" |
| | | :transferTitle="transferTitle" title="角色添加成员" |
| | | @transferSend="roleSendHandler"> |
| | |
| | | <el-dialog |
| | | v-dialogDrag |
| | | v-loading="statisticsLoading" |
| | | :destroy-on-close="true" |
| | | :visible.sync="statisticsVisible" |
| | | append-to-body="true" |
| | | class="avue-dialog" |
| | |
| | | </avue-crud> |
| | | <div slot="footer" class="dialog-footer" style="display: flex;gap: 20px;justify-content: center"> |
| | | <div> |
| | | <el-tag>当前角色总人数: {{this.countData.length}}</el-tag> |
| | | <el-tag>当前角色总人数: {{ this.countData.length }}</el-tag> |
| | | </div> |
| | | <el-button size="small" @click="statisticsVisible = false" icon="el-icon-close" type="danger">关 闭</el-button> |
| | | <el-button icon="el-icon-close" size="small" type="danger" @click="statisticsVisible = false">关 闭</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | |
| | | <!-- 导入角色 --> |
| | | <upload-file ref="upload" :fileType="upFileType" :fileUrl="fileUrl" @updata="getTableList" title="导入角色"></upload-file> |
| | | <upload-file ref="upload" :fileType="upFileType" :fileUrl="fileUrl" :tipList="tipList" title="导入角色" |
| | | @updata="getTableList"></upload-file> |
| | | |
| | | </basic-container> |
| | | </template> |
| | |
| | | } from '@/api/system/role/api' |
| | | import basicOption from "@/util/basic-option"; |
| | | import {column} from "@/views/system/role/option"; |
| | | import func from "@/util/func"; |
| | | import {mapGetters} from "vuex"; |
| | | |
| | | export default { |
| | | name: "index", |
| | | data() { |
| | | return { |
| | | tableData: [], |
| | | option: { |
| | | ...basicOption, |
| | | dialogTop: 0, |
| | | dialogWidth: '30%', |
| | | calcHeight: -60, |
| | | column: column |
| | | }, |
| | | page: { |
| | | currentPage: 1, |
| | | pageSize: 10, |
| | |
| | | countData: [], |
| | | countOption: { |
| | | ...basicOption, |
| | | selection:false, |
| | | selection: false, |
| | | refreshBtn: false, |
| | | addBtn:false, |
| | | menu:false, |
| | | addBtn: false, |
| | | menu: false, |
| | | header: false, |
| | | column: [ |
| | | { |
| | | label: '部门', |
| | |
| | | label: '角色', |
| | | prop: 'pkPersonName', |
| | | sortable: true, |
| | | overHidden: true, |
| | | }, |
| | | ] |
| | | }, |
| | | upFileType: ['xls', 'xlsx'], |
| | | fileUrl: 'api/roleQueryController/importRole', |
| | | tipList: ["角色导入只有 名称 和 描述 两列,且名称为必输项不能为空"] |
| | | } |
| | | }, |
| | | computed: { |
| | | ...mapGetters(["permission"]), |
| | | permissionList() { |
| | | return { |
| | | addBtn: this.vaildData(this.permission[this.$route.query.id].ADD, false), |
| | | delBtn: this.vaildData(this.permission[this.$route.query.id].DELETE, false), |
| | | editBtn: this.vaildData(this.permission[this.$route.query.id].EDIT, false), |
| | | exportBtn: this.vaildData(this.permission[this.$route.query.id].EXPORT, false), |
| | | assignMembersBtn: this.vaildData(this.permission[this.$route.query.id].assignMembers, false), |
| | | importRoleBtn: this.vaildData(this.permission[this.$route.query.id].importRole, false), |
| | | statisticsBtn: this.vaildData(this.permission[this.$route.query.id].statistics, false), |
| | | }; |
| | | }, |
| | | option() { |
| | | return { |
| | | ...basicOption, |
| | | addBtn: this.permissionList.addBtn, |
| | | delBtn: this.permissionList.delBtn, |
| | | editBtn: this.permissionList.editBtn, |
| | | dialogTop: 0, |
| | | dialogWidth: '30%', |
| | | column: column, |
| | | calcHeight: -60, |
| | | } |
| | | } |
| | | }, |
| | | methods: { |
| | |
| | | |
| | | // 行单选 |
| | | rowClickHandler(row) { |
| | | this.$refs.roleCrud.toggleRowSelection(row); |
| | | func.rowClickHandler( |
| | | row, |
| | | this.$refs.roleCrud, |
| | | this.lastIndex, |
| | | (newIndex) => { |
| | | this.lastIndex = newIndex; |
| | | }, |
| | | () => { |
| | | this.selectList = [row]; |
| | | } |
| | | ); |
| | | }, |
| | | |
| | | // 添加 |
| | | rowSaveHandler(row, done) { |
| | | rowSaveHandler(row, done, loading) { |
| | | delete row.roleClassifyText; |
| | | addRole(row).then(res => { |
| | | console.log(res) |
| | | if (res.data.code === 200) { |
| | | this.$message.success(res.data.obj); |
| | | this.getTableList(); |
| | | done(); |
| | | } |
| | | }).catch(err => { |
| | | console.log(err); |
| | | loading(); |
| | | }) |
| | | done(); |
| | | }, |
| | | |
| | | // 编辑 |
| | | rowUpdateHandler(row, index, done) { |
| | | rowUpdateHandler(row, index, done, loading) { |
| | | delete row.roleClassifyText; |
| | | updateRole(row).then(res => { |
| | | if (res.data.code === 200) { |
| | | this.$message.success(res.data.obj); |
| | | this.getTableList(); |
| | | done(); |
| | | } |
| | | }).catch(err => { |
| | | console.log(err); |
| | | loading(); |
| | | }); |
| | | done() |
| | | }, |
| | | |
| | | // 删除 |
| | |
| | | let params = { |
| | | ids: row.oid |
| | | } |
| | | deleteRole(params).then(res => { |
| | | if (res.data.code === 200) { |
| | | this.$message.success(res.data.obj); |
| | | this.getTableList(); |
| | | } |
| | | }).catch(err => { |
| | | console.log(err); |
| | | }) |
| | | |
| | | this.$confirm('您确定要删除当前角色吗?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | deleteRole(params).then(res => { |
| | | if (res.data.code === 200) { |
| | | this.$message.success(res.data.obj); |
| | | this.getTableList(); |
| | | } |
| | | }); |
| | | }).catch(() => { |
| | | this.$message({ |
| | | type: 'info', |
| | | message: '已取消删除' |
| | | }); |
| | | }); |
| | | }, |
| | | |
| | | // 多选删除 |
| | |
| | | listUserUnInRoleOid({pkRole: this.selectList[0].oid}), |
| | | listUserByRoleOid({pkRole: this.selectList[0].oid}) |
| | | ]).then(([unInRoleRes, byRoleRes]) => { |
| | | this.leftRoleData = []; |
| | | this.rightRoleData = []; |
| | | if (unInRoleRes.data.code === 200 && byRoleRes.data.code === 200) { |
| | | const leftData = [...unInRoleRes.data.data, ...byRoleRes.data.data]; |
| | | // 组装好穿梭框可用数据 |
| | |
| | | this.rightRoleData = byRoleRes.data.data.map(item => item.oid); |
| | | this.$refs.transfer.visible = true; |
| | | } |
| | | }).catch(err => { |
| | | console.error(err); |
| | | }); |
| | | |
| | | }, |
| | |
| | | saveRight(params).then(res => { |
| | | this.$message.success(res.data.obj); |
| | | this.getTableList(); |
| | | }).catch(err => { |
| | | this.$message.error(err) |
| | | }) |
| | | }, |
| | | |
| | |
| | | return; |
| | | } |
| | | listUserByRoleOid({pkRole: this.selectList[0].oid}).then(res => { |
| | | console.log(res) |
| | | if (res.data.code === 200) { |
| | | const data = res.data.data; |
| | | this.countData = data.map(item => { |
| | | return { |
| | | pkDepartmentName: item.pkDepartmentName, |
| | | name:item.name, |
| | | id:item.id, |
| | | pkPersonName:this.selectList[0].name |
| | | name: item.name, |
| | | id: item.id, |
| | | pkPersonName: this.selectList[0].name |
| | | } |
| | | }); |
| | | this.statisticsVisible = true; |
| | | } |
| | | }).catch(err => { |
| | | console.log(err) |
| | | }) |
| | | }, |
| | | |
| | | // 导入角色 |
| | | upLoadRole(){ |
| | | upLoadRole() { |
| | | this.$refs.upload.visible = true; |
| | | } |
| | | } |