“dzb”
2022-10-08 ce87e7746d6399c5a38a7f4fe10447d911b06051
src/views/systemSetting/baseSetting/role/index.vue
@@ -57,7 +57,7 @@
                                <span class="line">|</span>
                                <span @click="handleStop(scope.row)">停用</span>
                                <span class="line">|</span>
                                <span @click="handleDelete(scope.row)">删除</span>
                                <span @click="handleDelete([scope.row.id])">删除</span>
                            </div>
                        </template>
                    </el-table-column>
@@ -118,6 +118,7 @@
            all: false,
            unsame: false,
            myIdx: 0,
            preMyIdx: 0,
            options: [
                {
                    value: 0,
@@ -144,12 +145,56 @@
        this.getUserList();
    },
    methods: {
        selectChange(list) {
            console.log(list);
        async selectChange(list) {
            console.log(this.tempList);
            if (this.tempList.length !== 0) {
                this.preMyIdx = list;
                if (list === 3) {
                    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({
                    type: 'warning',
                    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 = list;
            this.tempList = [];
            list.forEach(item => {
                this.tempList.push(item.id);
            })
            if (list.length === this.tableData.length) {
                this.all = true;
            } else {
@@ -160,27 +205,26 @@
            return helper(createTime);
        },
        selectAll() {
            this.$refs.multipleTable.toggleAllSelection();
        },
        disSame(list) {
            // console.log(this.$refs.multipleTable);
            // const row = this.$refs.table.data
            list.forEach(row => {
                this.$refs.multipleTable.toggleRowSelection(row)
            })
        },
        handleDelete({ id }) {
        handleDelete(id) {
            const that = this;
            let arr = [];
            arr.push(id);
            // let arr = [];
            // arr.push(id);
            this.$confirm('确认删除?')
                .then(_ => {
                    that.$axios({
                        method: 'post',
                        url: 'sccg/role/delete?ids=' + arr,
                        url: 'sccg/role/delete?ids=' + id,
                    })
                        .then(res => {
                            this.myIdx = 0;
                            this.preMyIdx = 0;
                            console.log(res);
                            this.$message({
                                type: 'success',
@@ -295,7 +339,6 @@
        },
        changeDialog(val) {
            this.dialogUpdate = val.dialogUpdate;
            console.log(val);
        },
        handleClose(done) {
            this.$confirm('确认关闭?')