“dzb”
2022-10-09 2bb0e066fdc522beb51dd13f6a72cd67bd5d6a58
src/views/systemSetting/baseSetting/department/index.vue
@@ -12,8 +12,8 @@
                <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">
                        <createUser :refresh="context==='' ? getUserList : search " />
                        :before-close="handleClose2">
                        <createUser :refresh="context==='' ? getUserList : search " @changMyDialog="changMyDialog" />
                    </el-dialog>
                </div>
            </div>
@@ -36,8 +36,8 @@
                    </el-table-column>
                    <el-table-column prop="departDes" label="部门描述" min-width="10">
                    </el-table-column>
                    <el-table-column prop="createTime" label="创建时间" min-width="10">
                    </el-table-column>
                    <!-- <el-table-column prop="createTime" label="创建时间" min-width="10">
                    </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="关"
@@ -48,11 +48,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="handleDelete(scope.row)">删除</span>
@@ -116,6 +113,7 @@
            all: false,
            unsame: false,
            myIdx: 0,
            preMyIdx: 0,
            options: [
                {
                    value: 0,
@@ -143,11 +141,50 @@
    },
    methods: {
        selectChange(list) {
            console.log(list);
            console.log(this.tempList);
            if (this.tempList.length !== 0) {
                if (list === 3) {
                    this.preMyIdx = list;
                    this.mulDelete(this.tempList);
                }
            } else {
                this.myIdx = this.preMyIdx;
                this.$message({
                    type: 'warning',
                    message: '您还没选中任何数据',
                })
            }
        },
        // 多条数据删除
        mulDelete(idArr) {
            this.$confirm('您确定要批量删除部门吗?')
                .then(_ => {
                    this.$axios({
                        method: 'post',
                        url: 'sccg/depart/batch_deletion?ids=' + idArr,
                    })
                        .then(res => {
                            if (res.code === 200) {
                                this.$message({
                                    type: 'success',
                                    message: '批量删除部门成功',
                                })
                                this.getUserList();
                            } else {
                                this.$message({
                                    type: 'error',
                                    message: res.message
                                })
                            }
                        })
                })
                .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 {
@@ -168,6 +205,7 @@
                this.$refs.multipleTable.toggleRowSelection(row)
            })
        },
        // 单条数据删除
        handleDelete({ id }) {
            this.$confirm('确认删除?')
                .then(_ => {
@@ -190,19 +228,15 @@
                })
                .catch(_ => { });
        },
        // 修改角色
        handleChangeRole(obj) {
            this.dialogUpdate = true
            this.user = obj;
            // console.log(obj)
        },
        // 修改用户状态
        handleChangeStatus(obj) {
            let { id, status } = obj;
            status == true ? status = 1 : status = 0;
            console.log(id, status);
            this.$axios.post(`sccg/depart/status`, { id: id, status: status }).then(res => {
                console.log(res);
                if (res.code == 200) {
                    this.getUserList();
                }
            })
        },
        // 获取用户列表
@@ -273,14 +307,26 @@
            this.search();
        },
        // 关闭dialog
        changMyDialog(val) {
            this.dialogUpdate = val.dialogFlag;
        changMyDialog({ flag }) {
            this.dialogUpdate = flag;
            this.dialogCreate = flag;
        },
        handleClose(done) {
            if (this.updateFlag) {
                this.$confirm('确认关闭?')
                    .then(_ => {
                        this.dialogUpdate = false;
                        this.dialogCreate = false;
                        done();
                    })
                    .catch(_ => { });
            } else {
                done();
            }
        },
        handleClose2(done) {
            this.$confirm('确认关闭?')
                .then(_ => {
                    this.dialogUpdate = false;
                    this.dialogCreate = false;
                    done();
                })
                .catch(_ => { });