Oliver
2022-12-12 9736af164d1aae76b3388944d675cb21b61c755b
src/views/systemSetting/baseSetting/department/index.vue
@@ -11,7 +11,8 @@
        </div>
        <div class="addUser">
          <el-button class="addBtn" type="primary" @click="dialogCreate = true"
            >新增部门</el-button
          >新增部门
          </el-button
          >
          <el-dialog
            :visible.sync="dialogCreate"
@@ -101,12 +102,14 @@
          <div class="funs">
            <div class="funsItem funs-sp">
              <el-checkbox v-model="all" @change="selectAll()"
                >全选</el-checkbox
              >全选
              </el-checkbox
              >
            </div>
            <div class="funsItem funs-sp">
              <el-checkbox v-model="unsame" @change="disSame(tableData)"
                >反选</el-checkbox
              >反选
              </el-checkbox
              >
            </div>
            <div class="funsItem">
@@ -147,6 +150,7 @@
<script>
import createUser from "./createUser";
import updateUser from "./updateUser";
export default {
  components: {
    createUser,
@@ -196,9 +200,17 @@
    selectChange(list) {
      console.log(this.tempList);
      if (this.tempList.length !== 0) {
        if (list === 1) {
          this.preMyIdx = list;
          this.mulPut(this.tempList, list);
        }
        if (list === 2) {
          this.preMyIdx = list;
          this.mulPut(this.tempList);
        }
        if (list === 3) {
          this.preMyIdx = list;
          this.mulDelete(this.tempList);
          this.mulDelete(this.tempList, list);
        }
      } else {
        this.myIdx = this.preMyIdx;
@@ -207,6 +219,36 @@
          message: "您还没选中任何数据",
        });
      }
    },
    mulPut(idArr, option) {
      const status = option === 1 ? 1 : 0
      const tag = option === 1 ? "启用" : "禁用"
      let list = JSON.parse(JSON.stringify(this.tableData))
      list = list.filter(x => idArr.indexOf(x.id) > -1)
      list.forEach(x => x.status = status)
      console.log(list)
      this.$confirm(`您确定要批量${tag}部门吗?`)
          .then((_) => {
            this.$axios({
              method: "PUT",
              url: "sccg/depart/batch_status",
              data: list
            }).then(res => {
              console.log(res)
              if (res.code === 200) {
                this.$message({
                  type: "success",
                  message: `批量${tag}部门成功`
                })
                this.getUserList()
              } else {
                this.$message({
                  type: "error",
                  message: res.message,
                })
              }
            })
          })
    },
    // 多条数据删除
    mulDelete(idArr) {
@@ -272,7 +314,8 @@
            this.getUserList();
          });
        })
        .catch((_) => {});
          .catch((_) => {
          });
    },
    // 修改状态
    handleChangeStatus(obj) {
@@ -380,7 +423,8 @@
            this.dialogCreate = false;
            done();
          })
          .catch((_) => {});
            .catch((_) => {
            });
      } else {
        done();
      }
@@ -390,7 +434,8 @@
        .then((_) => {
          done();
        })
        .catch((_) => {});
          .catch((_) => {
          });
    },
  },
};
@@ -468,9 +513,11 @@
      justify-content: space-between;
      align-items: center;
      padding: 0 20px;
      .funs-sp {
        border: 1px solid #17324c;
      }
      .funs {
        display: flex;
@@ -531,6 +578,7 @@
    .el-table {
      color: #4b9bb7;
      font-size: 10px;
      .operation {
        display: flex;
@@ -543,6 +591,7 @@
        }
      }
    }
    // &::v-deep .switchStyle .el-switch__label {
    //     position: absolute;
    //     display: none;