“dzb”
2022-10-09 2bb0e066fdc522beb51dd13f6a72cd67bd5d6a58
src/views/systemSetting/baseSetting/role/index.vue
@@ -12,7 +12,7 @@
                <div class="addUser">
                    <el-button class="addBtn" type="primary" @click="dialogCreate = true">新建角色</el-button>
                    <el-dialog :visible.sync="dialogCreate" title="新增角色" width="45%" v-if="dialogCreate"
                        :before-close="handleClose">
                        :before-close="handleClose2">
                        <createUser :refresh="context==='' ? getUserList : search" />
                    </el-dialog>
                </div>
@@ -62,16 +62,21 @@
                        </template>
                    </el-table-column>
                </el-table>
                <!-- 查看修改页面 -->
                <!-- 修改页面 -->
                <el-dialog :visible.sync="dialogUpdate" width="45%" :title="updateFlag ? '权限设置' :'查看角色信息'"
                    v-if="dialogUpdate" :before-close="handleClose">
                    <updateUser :updateFlag="updateFlag" :userInfo=userInfo
                        :getUserList=" context ? getUserList : getUserList" @changeDialog="changeDialog" />
                </el-dialog>
                <!-- 查看页面 -->
                <el-dialog :visible.sync="dialogView" width="45%" title="查看角色信息"
                    v-if="dialogView" :before-close="handleClose">
                    <MyView :userInfo=userInfo @changeDialog="changeDialog" />
                </el-dialog>
                <!-- tools -->
                <div class="tools">
                    <div class="funs">
                        <div class="funsItem">
                        <!-- <div class="funsItem">
                            <el-checkbox v-model="all" @change="selectAll()">全选</el-checkbox>
                        </div>
                        <div class="funsItem">
@@ -83,7 +88,7 @@
                                    :value="item.value" :disabled="item.disabled">
                                </el-option>
                            </el-select>
                        </div>
                        </div> -->
                    </div>
                    <div class="pagination">
                        <el-pagination background :current-page="currentPage" layout="prev, pager, next"
@@ -100,9 +105,10 @@
import createUser from "./createUser"
import updateUser from "./updateUser"
import helper from "@/utils/mydate.js"
import MyView from './viewRole'
export default {
    components: {
        createUser, updateUser
        createUser, updateUser,MyView
    },
    data() {
        return {
@@ -110,6 +116,7 @@
            context: "",
            dialogCreate: false,
            dialogUpdate: false,
            dialogView:false,
            updateFlag: false,
            userInfo: '',
            totalNum: null,
@@ -145,13 +152,18 @@
        this.getUserList();
    },
    methods: {
        selectChange(list) {
        async selectChange(list) {
            console.log(this.tempList);
            if (this.tempList.length !== 0) {
                this.preMyIdx = list;
                if (list === 3) {
                    this.preMyIdx = list;
                    this.handleDelete(this.tempList);
                    await this.handleDelete(this.tempList);
                } else if (list === 2) {
                    await this.mulUpdateStatus(this.tempList, 0);
                } else {
                    await this.mulUpdateStatus(this.tempList, 1);
                }
                this.myIdx = 0;
            } else {
                this.myIdx = this.preMyIdx;
                this.$message({
@@ -159,6 +171,31 @@
                    message: '您还没选中任何数据',
                })
            }
        },
        mulUpdateStatus(idArr, flag) {
            this.$confirm(flag === 1 ? "您确定要进行批量启用角色吗?" : '您确定要进行批量禁用角色吗?')
                .then(_ => {
                    this.$axios({
                        method: 'post',
                        url: 'sccg/role/updateStatusBatch?ids=' + idArr + '&status=' + flag,
                    })
                        .then(res => {
                            if (res.code === 200) {
                                this.$message({
                                    type: 'success',
                                    message: '更改用户状态成功',
                                })
                                this.getUserList();
                            } else {
                                this.$message({
                                    type: 'error',
                                    message: res.message
                                })
                            }
                            console.log(res);
                        })
                })
                .catch(err => { console.log(err) })
        },
        tableChange(list) {
            this.tempList = [];
@@ -282,8 +319,7 @@
        },
        // 查看用户信息(不可修改)
        handleFind(rowData) {
            this.dialogUpdate = true;
            this.updateFlag = false;
            this.dialogView = true;
            this.userInfo = rowData;
        },
        // 修改用户部门信息
@@ -307,21 +343,30 @@
            this.currentPage = page;
            this.search();
        },
        changeDialog(val) {
            this.dialogUpdate = val.dialogUpdate;
            this.$message({
                type:'success',
                message:'更改成功',
            })
        changeDialog({flag}) {
            this.dialogUpdate = flag;
            this.dialogCreate = flag;
            this.dialogView = flag;
        },
        handleClose(done) {
            this.$confirm('确认关闭?')
            if(this.updateFlag){
                this.$confirm('确认关闭?')
                .then(_ => {
                    this.dialogUpdate = false;
                    this.dialogCreate = false;
                    done();
                })
                .catch(_ => { });
            }else{
                done();
            }
        },
        handleClose2(done){
            this.$confirm('确认关闭?')
                .then(_ => {
                    done();
                })
                .catch(_ => { });
        }
    }
}