zhanghua
2022-10-18 5b2dd794ec680d47e907ff43a264a7f82c30a130
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>
@@ -40,8 +40,9 @@
                    </el-table-column>
                    <el-table-column prop="status" label="启用" min-width="5">
                        <template slot-scope="scope">
                            <el-switch class="switchStyle" v-model="scope.row.status" active-text="开" inactive-text="关"
                                active-color="#3fef9a" inactive-color="#000212" @change="handleChangeStatus(scope.row)">
                            <!-- active-text="开" inactive-text="关" -->
                            <el-switch class="switchStyle" v-model="scope.row.status"
                                active-color="#3fef9a" inactive-color="#000212" disabled>
                            </el-switch>
                        </template>
                    </el-table-column>
@@ -55,7 +56,7 @@
                                <!-- <span>删除</span> -->
                                <span @click="handleUpdate(scope.row)">权限设置</span>
                                <span class="line">|</span>
                                <span @click="handleStop(scope.row)">停用</span>
                                <span @click="handleChangeStatus(scope.row)">{{scope.row.status === true ?'停用':'启用' }}</span>
                                <span class="line">|</span>
                                <span @click="handleDelete([scope.row.id])">删除</span>
                            </div>
@@ -76,7 +77,7 @@
                <!-- 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">
@@ -88,7 +89,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"
@@ -252,19 +253,12 @@
        // 修改用户状态
        handleChangeStatus(obj) {
            let { id, status } = obj;
            status == true ? status = 1 : status = 0;
            console.log(id, status);
            status == true ? status = 0 : status = 1;
            this.$axios.post(`/sccg/role/updateStatus/` + id + '?status=' + status).then(res => {
                console.log(res);
                if(res.code ===200){
                    this.search();
                }
            })
        },
        handleStop(obj) {
            // let { id, status } = obj;
            // status == true ? status = 1 : status = 0;
            // console.log(id, status);
            // this.$axios.post(`/sccg/role/updateStatus/` + id + '?status=' + status).then(res => {
            //     this.getUserList();
            // })
        },
        // 获取用户列表
        getUserList() {
@@ -349,10 +343,22 @@
            this.dialogView = flag;
        },
        handleClose(done) {
            this.$confirm('确认关闭?')
            if(this.updateFlag){
                this.$confirm('确认关闭?')
                .then(_ => {
                    this.dialogUpdate = false;
                    this.dialogCreate = false;
                    this.updateFlag = false;
                    done();
                })
                .catch(_ => { });
            }else{
                done();
            }
        },
        handleClose2(done){
            this.$confirm('确认关闭?')
                .then(_ => {
                    done();
                })
                .catch(_ => { });
@@ -498,15 +504,6 @@
        .el-table {
            color: #4b9bb7;
            font-size: 10px;
            &::v-deep .el-table__empty-block {
                background-color: #09152f;
            }
            &::v-deep .el-table__empty-block {
                color: #4b9bb7;
            }
            .operation {
                display: flex;
@@ -519,70 +516,34 @@
                }
            }
        }
        // &::v-deep .switchStyle .el-switch__label {
        //     position: absolute;
        //     display: none;
        //     color: #fff;
        // }
        .el-table::v-deep .warning-row {
            background: #06122c;
        }
        // &::v-deep .el-switch__core {
        //     background-color: rgba(166, 166, 166, 1);
        // }
        .el-table::v-deep .success-row {
            background: #071f39;
        }
        // &::v-deep .switchStyle .el-switch__label--left {
        //     z-index: 9;
        //     left: 20px;
        // }
        &::v-deep .switchStyle .el-switch__label {
            position: absolute;
            display: none;
            color: #fff;
        }
        // &::v-deep .switchStyle .el-switch__label--right {
        //     z-index: 9;
        //     left: 4px;
        // }
        &::v-deep .el-switch__core {
            background-color: rgba(166, 166, 166, 1);
        }
        // &::v-deep .switchStyle .el-switch__label.is-active {
        //     display: block;
        // }
        &::v-deep .switchStyle .el-switch__label--left {
            z-index: 9;
            left: 20px;
        }
        &::v-deep .switchStyle .el-switch__label--right {
            z-index: 9;
            left: 4px;
        }
        &::v-deep .switchStyle .el-switch__label.is-active {
            display: block;
        }
        &::v-deep .switchStyle.el-switch .el-switch__core,
        &::v-deep .el-switch .el-switch__label {
            width: 50px !important;
        }
    }
    &::v-deep .el-dialog__header,
    &::v-deep .el-dialog__body {
        background-color: #06122c;
    }
    &::v-deep .el-dialog__header {
        display: flex;
        align-items: center;
        background-color: #fff;
        padding: 20px;
        line-height: 60px;
    }
    &::v-deep .el-dialog__title {
        color: #4b9bb7;
    }
    &::v-deep .el-dialog__close {
        width: 20px;
        height: 20px;
        // color: #fff;
    }
    &::v-deep .el-dialog__body {
        padding: 0;
        // &::v-deep .switchStyle.el-switch .el-switch__core,
        // &::v-deep .el-switch .el-switch__label {
        //     width: 50px !important;
        // }
    }
}
</style>