| | |
| | | <!--文仓管理页面--> |
| | | <basic-container> |
| | | <avue-crud |
| | | ref="logCrud" |
| | | ref="crud" |
| | | v-model="form" |
| | | :data="tableData" |
| | | :option="option" |
| | |
| | | @on-load="getTableList" |
| | | @row-save="rowSaveHandler" |
| | | @row-update="rowUpdateHandler" |
| | | @row-del="rowDeleteHandler" |
| | | @row-click="rowClickHandler" |
| | | @selection-change="selectionChange" |
| | | > |
| | | <template slot="menuLeft" slot-scope="scope"> |
| | | <el-button icon="el-icon-download" plain size="small" type="primary" @click="exportClickHandler">导出</el-button> |
| | | <el-button v-if="permissionList.addBtn" class="button-custom-icon" size="small" type="primary" |
| | | @click="$refs.crud.rowAdd()"> |
| | | <icon-show :name="permissionList.addBtn.source"></icon-show> |
| | | 新 增 |
| | | </el-button> |
| | | <el-button v-if="permissionList.exportBtn" class="button-custom-icon" plain size="small" type="primary" @click="exportClickHandler"> |
| | | <icon-show :name="permissionList.exportBtn.source"></icon-show> |
| | | 导出 |
| | | </el-button> |
| | | </template> |
| | | <!--<template #menu="{row,index,size}"> |
| | | <el-button icon="el-icon-user" type="text" size="small" @click="userHandler(row,index)">分配成员</el-button> |
| | | </template>--> |
| | | <template slot="menu" slot-scope="{ row, index }"> |
| | | <el-button |
| | | v-if="permissionList.editBtn" |
| | | size="small" |
| | | type="text" |
| | | @click="handleEdit(row, index)" |
| | | > |
| | | <icon-show :name="permissionList.editBtn.source"></icon-show> |
| | | 编辑 |
| | | </el-button> |
| | | <el-button |
| | | v-if="permissionList.delBtn" |
| | | size="small" |
| | | type="text" |
| | | @click="handleDel(row, index)" |
| | | > |
| | | <icon-show :name="permissionList.delBtn.source"></icon-show> |
| | | 删除 |
| | | </el-button> |
| | | </template> |
| | | </avue-crud> |
| | | <!-- 分配成员穿梭框 --> |
| | | <transfer ref="transfer" :left-role-data="leftRoleData" :right-role-data="rightRoleData" |
| | |
| | | import func from "@/util/func"; |
| | | import basicOption from "@/util/basic-option"; |
| | | import {listUserByRoleOid, listUserUnInRoleOid, saveRight} from "@/api/system/role/api"; |
| | | import {mapGetters} from "vuex"; |
| | | |
| | | export default { |
| | | name: "index", |
| | |
| | | form:{}, |
| | | tableLoading: false, |
| | | tableData: [], |
| | | option: { |
| | | currentRow:null, |
| | | leftRoleData: [], // 分配成员穿梭框左侧初始数据 |
| | | rightRoleData: [], // 分配成员穿梭框右侧初始数据 |
| | | transferTitle: ['文件柜外成员', '文件柜内成员'], |
| | | selectionList: [], |
| | | } |
| | | }, |
| | | computed: { |
| | | ids() { |
| | | let ids = []; |
| | | this.selectionList.forEach(ele => { |
| | | ids.push(ele.id); |
| | | }); |
| | | return ids.join(","); |
| | | }, |
| | | ...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), |
| | | }; |
| | | }, |
| | | option(){ |
| | | return { |
| | | ...basicOption, |
| | | addBtn:false, |
| | | editBtn:false, |
| | | delBtn:false, |
| | | calcHeight: -60, |
| | | align:'left', |
| | | headerAlign:'center', |
| | |
| | | }); |
| | | }, |
| | | }] |
| | | }, |
| | | currentRow:null, |
| | | leftRoleData: [], // 分配成员穿梭框左侧初始数据 |
| | | rightRoleData: [], // 分配成员穿梭框右侧初始数据 |
| | | transferTitle: ['文件柜外成员', '文件柜内成员'], |
| | | selectionList: [], |
| | | } |
| | | }, |
| | | computed: { |
| | | ids() { |
| | | let ids = []; |
| | | this.selectionList.forEach(ele => { |
| | | ids.push(ele.id); |
| | | }); |
| | | return ids.join(","); |
| | | } |
| | | } |
| | | }, |
| | | methods: { |
| | |
| | | }, |
| | | |
| | | // 新增 |
| | | rowSaveHandler(row, done,loading) { |
| | | rowSaveHandler(row, done, loading) { |
| | | savePvolume(row).then(res => { |
| | | if (res.data.code === 200) { |
| | | this.$message.success(res.data.obj); |
| | |
| | | }); |
| | | }, |
| | | |
| | | handleEdit(row,index){ |
| | | this.$refs.crud.rowEdit(row, index); |
| | | }, |
| | | |
| | | // 编辑 |
| | | rowUpdateHandler(row, index, done,loading) { |
| | | rowUpdateHandler(row, index, done, loading) { |
| | | updatePvolume(row).then(res => { |
| | | if (res.data.code === 200) { |
| | | this.$message.success(res.data.obj); |
| | |
| | | }, |
| | | |
| | | // 删除 |
| | | rowDeleteHandler(row) { |
| | | handleDel(row,index) { |
| | | let params = { |
| | | ids: row.id |
| | | } |
| | |
| | | }, |
| | | // 导出 |
| | | exportClickHandler() { |
| | | if(this.ids == null || this.ids == ""){ |
| | | if (this.ids == null || this.ids == "") { |
| | | this.$message({ |
| | | type: 'warning', |
| | | message: '请勾选要导出的数据!' |
| | |
| | | }, |
| | | |
| | | //分配成员 |
| | | userHandler(row,index){ |
| | | this.currentRow=row; |
| | | userHandler(row, index) { |
| | | this.currentRow = row; |
| | | Promise.all([ |
| | | listUserUnInRoleOid({pkRole: row.id}), |
| | | listUserByRoleOid({pkRole: row.id}) |
| | |
| | | selectionChange(list) { |
| | | this.selectionList = list; |
| | | }, |
| | | |
| | | // 行单选 |
| | | rowClickHandler(row) { |
| | | func.rowClickHandler( |
| | | row, |
| | | this.$refs.crud, |
| | | this.lastIndex, |
| | | (newIndex) => { |
| | | this.lastIndex = newIndex; |
| | | }, |
| | | () => { |
| | | this.selectionList = [row]; |
| | | } |
| | | ); |
| | | }, |
| | | } |
| | | } |
| | | </script> |