“dzb”
2022-10-09 2bb0e066fdc522beb51dd13f6a72cd67bd5d6a58
src/views/systemSetting/baseSetting/user/components/main/index.vue
@@ -18,6 +18,9 @@
                <el-table-column prop="mobile" label="联系方式" min-width="7">
                </el-table-column>
                <el-table-column prop="note" label="所属角色" min-width="8">
                    <template slot-scope="scope">
                        <span>{{filterRole(scope.row.roles)}}</span>
                    </template>
                </el-table-column>
                <el-table-column prop="departName" label="所属部门" min-width="8">
                </el-table-column>
@@ -147,9 +150,9 @@
                if (list === 3) {
                    await this.mulDelte(this.tempList);
                } else if (list === 2) {
                    await this.mulUpdateStatus(this.tempList,0);
                    await this.mulUpdateStatus(this.tempList, 0);
                } else {
                    await this.mulUpdateStatus(this.tempList,1);
                    await this.mulUpdateStatus(this.tempList, 1);
                }
                this.myIdx = 0;
            } else {
@@ -199,13 +202,13 @@
                .catch(err => { console.log(err) })
        },
        // 批量修改账号
        mulUpdateStatus(idArr,flag) {
        mulUpdateStatus(idArr, flag) {
            console.log(flag);
            this.$confirm( flag === 1 ? "您确定要进行批量启用用户吗?" :'您确定要进行批量禁用用户吗?' )
            this.$confirm(flag === 1 ? "您确定要进行批量启用用户吗?" : '您确定要进行批量禁用用户吗?')
                .then(_ => {
                    this.$axios({
                        method: 'post',
                        url: 'sccg/admin/updateStatusBatch?ids=' + idArr + '&status='+flag,
                        url: 'sccg/admin/updateStatusBatch?ids=' + idArr + '&status=' + flag,
                    })
                        .then(res => {
                            if (res.code === 200) {
@@ -230,11 +233,8 @@
        },
        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)
            })
@@ -260,12 +260,17 @@
            this.getUserList();
        },
        handleClose(done) {
            this.$confirm('确认关闭?')
                .then(_ => {
                    this.dialogUpdate = false
                    done();
                })
                .catch(_ => { });
            if (this.updateFlag) {
                this.$confirm('确认关闭?')
                    .then(_ => {
                        this.dialogUpdate = false;
                        this.updateFlag = false;
                        done();
                    })
                    .catch(_ => { });
            }else{
                done();
            }
        },
        // 当前页改变触发事件
        changeCurrentPage(page) {
@@ -311,10 +316,9 @@
            this.$axios.get(`sccg/admin/list?keyword=${search}&current=${currentPage}&pageSize=${pageSize}`).then(res => {
                if (res.code === 200) {
                    res.data.records.forEach(item => {
                        // item.createTime = helper(item.createTime);
                        item.status == 1 ? item.status = true : item.status = false;
                    })
                    that.totalNum = res.data.pages * pageSize;
                    that.totalNum = res.data.total;
                    that.tableData = res.data.records;
                    this.renderFlag = true;
                }
@@ -339,6 +343,23 @@
            }
            return '';
        },
        // 处理用户所属角色
        filterRole(arr){
            let str = '';
            if(arr.length === 0){
                return;
            }
            arr.forEach((item,index)=>{
                if(item!==null){
                    if(index<arr.length-1){
                        str+=item.name +',';
                    }else{
                        str+=item.name;
                    }
                }
            })
            return str;
        }
    },
    props: ['refresh', 'keyword', 'resetFresh'],
    watch: {