“dzb”
2022-10-21 b9b2d3d63335fa9c72078e64f1ac1b365cf2d8dd
src/views/systemSetting/baseSetting/role/index.vue
@@ -13,7 +13,7 @@
                    <el-button class="addBtn" type="primary" @click="dialogCreate = true">新建角色</el-button>
                    <el-dialog :visible.sync="dialogCreate" title="新增角色" width="45%" v-if="dialogCreate"
                        :before-close="handleClose2">
                        <createUser :refresh="context==='' ? getUserList : search" />
                        <createUser :refresh="context==='' ? getRoleList : search" />
                    </el-dialog>
                </div>
            </div>
@@ -27,20 +27,14 @@
                    @selection-change="tableChange">
                    <el-table-column type="selection" min-width="5">
                    </el-table-column>
                    <!-- <el-table-column label="用户ID" min-width="5">
                        <template slot-scope="scope">{{ scope.row.id }}</template>
                    </el-table-column> -->
                    <el-table-column prop="name" label="角色名称" min-width="10">
                    </el-table-column>
                    <el-table-column prop="typeText" label="角色类型" min-width="10">
                    </el-table-column>
                    <!-- <el-table-column prop="adminCount" label="默认角色" min-width="10">
                    </el-table-column> -->
                    <el-table-column prop="description" label="备注" min-width="10">
                    </el-table-column>
                    <el-table-column prop="status" label="启用" min-width="5">
                        <template slot-scope="scope">
                            <!-- active-text="开" inactive-text="关" -->
                            <el-switch class="switchStyle" v-model="scope.row.status" 
                                active-color="#3fef9a" inactive-color="#000212" disabled>
                            </el-switch>
@@ -49,11 +43,8 @@
                    <el-table-column prop="operation" label="操作" min-width="15">
                        <template slot-scope="scope">
                            <div class="operation">
                                <!-- <span @click="handleChangeRole(scope.row)">修改角色</span> -->
                                <span @click="handleFind(scope.row)">查看</span>
                                <span class="line">|</span>
                                <!-- <span>修改密码</span> -->
                                <!-- <span>删除</span> -->
                                <span @click="handleUpdate(scope.row)">权限设置</span>
                                <span class="line">|</span>
                                <span @click="handleChangeStatus(scope.row)">{{scope.row.status === true ?'停用':'启用' }}</span>
@@ -62,25 +53,25 @@
                            </div>
                        </template>
                    </el-table-column>
                </el-table>
                </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" />
                        :getRoleList=" context ? getRoleList : getRoleList" @changeDialog="changeDialog" />
                </el-dialog>
                <!-- 查看页面 -->
                <el-dialog :visible.sync="dialogView" width="45%" title="查看角色信息"
                    v-if="dialogView" :before-close="handleClose">
                <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 funs-sp">
                            <el-checkbox v-model="all" @change="selectAll()">全选</el-checkbox>
                        </div>
                        <div class="funsItem">
                        <div class="funsItem funs-sp">
                            <el-checkbox v-model="unsame" @change="disSame(tableData)">反选</el-checkbox>
                        </div>
                        <div class="funsItem">
@@ -89,7 +80,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"
@@ -107,9 +98,10 @@
import updateUser from "./updateUser"
import helper from "@/utils/mydate.js"
import MyView from './viewRole'
import MyTable from '@/components/Table'
export default {
    components: {
        createUser, updateUser,MyView
        createUser, updateUser, MyView, MyTable
    },
    data() {
        return {
@@ -117,7 +109,7 @@
            context: "",
            dialogCreate: false,
            dialogUpdate: false,
            dialogView:false,
            dialogView: false,
            updateFlag: false,
            userInfo: '',
            totalNum: null,
@@ -146,11 +138,11 @@
                    label: '批量删除',
                }
            ],
            tempList: []
            tempList: [],
        }
    },
    created() {
        this.getUserList();
        this.getRoleList();
    },
    methods: {
        async selectChange(list) {
@@ -186,7 +178,7 @@
                                    type: 'success',
                                    message: '更改用户状态成功',
                                })
                                this.getUserList();
                                this.getRoleList();
                            } else {
                                this.$message({
                                    type: 'error',
@@ -239,7 +231,7 @@
                                message: res.message
                            })
                            this.getUserList();
                            this.getRoleList();
                        })
                })
                .catch(_ => { });
@@ -255,14 +247,13 @@
            let { id, status } = obj;
            status == true ? status = 0 : status = 1;
            this.$axios.post(`/sccg/role/updateStatus/` + id + '?status=' + status).then(res => {
                if(res.code ===200){
                if (res.code === 200) {
                    this.search();
                }
            })
        },
        // 获取用户列表
        getUserList() {
            const that = this;
        getRoleList() {
            this.dialogCreate = false;
            // 获取所有用户信息
            this.$axios.get('sccg/role/listAll').then(res => {
@@ -337,26 +328,26 @@
            this.currentPage = page;
            this.search();
        },
        changeDialog({flag}) {
        changeDialog({ flag }) {
            this.dialogUpdate = flag;
            this.dialogCreate = flag;
            this.dialogView = flag;
        },
        handleClose(done) {
            if(this.updateFlag){
            if (this.updateFlag) {
                this.$confirm('确认关闭?')
                .then(_ => {
                    this.dialogUpdate = false;
                    this.dialogCreate = false;
                    this.updateFlag = false;
                    done();
                })
                .catch(_ => { });
            }else{
                    .then(_ => {
                        this.dialogUpdate = false;
                        this.dialogCreate = false;
                        this.updateFlag = false;
                        done();
                    })
                    .catch(_ => { });
            } else {
                done();
            }
        },
        handleClose2(done){
        handleClose2(done) {
            this.$confirm('确认关闭?')
                .then(_ => {
                    done();
@@ -440,7 +431,9 @@
            justify-content: space-between;
            align-items: center;
            padding: 0 20px;
            .funs-sp{
                border: 1px solid #17324c;
            }
            .funs {
                display: flex;
@@ -448,7 +441,6 @@
                    line-height: 28px;
                    display: flex;
                    align-items: center;
                    border: 1px solid #17324c;
                    border-radius: 4px;
                    font-size: 12px;
                    margin-left: 10px;
@@ -504,6 +496,7 @@
        .el-table {
            color: #4b9bb7;
            font-size: 10px;
            .operation {
                display: flex;
@@ -516,6 +509,7 @@
                }
            }
        }
        // &::v-deep .switchStyle .el-switch__label {
        //     position: absolute;
        //     display: none;