zengh
2021-07-17 f28d877141bf406ba7a3773d1b6733525ff48d35
Merge remote-tracking branch 'origin/master'
3 files modified
155 ■■■■■ changed files
src/styles/element-ui.scss 2 ●●● patch | view | raw | blame | history
src/styles/ourBackgroundColor.scss 4 ●●●● patch | view | raw | blame | history
src/views/system/dept.vue 149 ●●●●● patch | view | raw | blame | history
src/styles/element-ui.scss
@@ -202,7 +202,7 @@
//表格等待
.el-loading-mask {
  background-color: $inputB1 !important;
  background-color: $mainB !important;
}
//附件上传弹窗中心
src/styles/ourBackgroundColor.scss
@@ -6,7 +6,7 @@
$fontColor: #fff;
$mainB2: #0048e5;
$mainB2: #205de2;
$mainB: #004ca7;
$mainBx1: #013e8a;
$mainBx2: #03277c;
@@ -20,4 +20,4 @@
$buttonB: #7cbdff;
$inputB1: rgb(25, 88, 233);
$inputB1: #2d5cc8;
src/views/system/dept.vue
@@ -1,6 +1,7 @@
<template>
  <basic-container>
    <avue-crud :option="option"
    <avue-crud
      :option="option"
               :table-loading="loading"
               :data="data"
               ref="crud"
@@ -18,14 +19,17 @@
               @size-change="sizeChange"
               @refresh-change="refreshChange"
               @on-load="onLoad"
               @tree-load="treeLoad">
      @tree-load="treeLoad"
    >
      <template slot="menuLeft">
        <el-button type="danger"
        <el-button
          type="danger"
                   size="small"
                   icon="el-icon-delete"
                   v-if="permission.dept_delete"
                   plain
                   @click="handleDelete">删 除
          @click="handleDelete"
          >删 除
        </el-button>
      </template>
      <template slot-scope="scope" slot="menu">
@@ -38,8 +42,7 @@
        >新增子项
        </el-button>
      </template>
      <template slot-scope="{row}"
                slot="deptCategory">
      <template slot-scope="{ row }" slot="deptCategory">
        <el-tag>{{row.deptCategoryName}}</el-tag>
      </template>
    </avue-crud>
@@ -53,10 +56,10 @@
    update,
    add,
    getDept,
    getDeptTree
  getDeptTree,
  } from "@/api/system/dept";
  import {mapGetters} from "vuex";
  import website from '@/config/website';
import website from "@/config/website";
  export default {
    data() {
@@ -82,18 +85,20 @@
          index: true,
          selection: true,
          viewBtn: true,
          menuWidth: 300,
        menuWidth: 380,
          dialogClickModal: false,
          column: [
            {
              label: "机构名称",
              prop: "deptName",
              search: true,
              rules: [{
            rules: [
              {
                required: true,
                message: "请输入机构名称",
                trigger: "blur"
              }]
                trigger: "blur",
              },
            ],
            },
            {
              label: "所属客户",
@@ -106,25 +111,29 @@
              span: 24,
              props: {
                label: "tenantName",
                value: "tenantId"
              value: "tenantId",
              },
              hide: !website.tenantMode,
              search: website.tenantMode,
              rules: [{
            rules: [
              {
                required: true,
                message: "请输入所属客户",
                trigger: "click"
              }]
                trigger: "click",
              },
            ],
            },
            {
              label: "机构全称",
              prop: "fullName",
              search: true,
              rules: [{
            rules: [
              {
                required: true,
                message: "请输入机构全称",
                trigger: "blur"
              }]
                trigger: "blur",
              },
            ],
            },
            {
              label: "上级机构",
@@ -133,13 +142,15 @@
              type: "tree",
              hide: true,
              props: {
                label: "title"
              label: "title",
              },
              rules: [{
            rules: [
              {
                required: false,
                message: "请选择上级机构",
                trigger: "click"
              }]
                trigger: "click",
              },
            ],
            },
            {
              label: "机构类型",
@@ -147,17 +158,19 @@
              dicUrl: "/api/blade-system/dict/dictionary?code=org_category",
              props: {
                label: "dictValue",
                value: "dictKey"
              value: "dictKey",
              },
              dataType: "number",
              width: 120,
              prop: "deptCategory",
              slot: true,
              rules: [{
            rules: [
              {
                required: true,
                message: "请输入机构类型",
                trigger: "blur"
              }]
                trigger: "blur",
              },
            ],
            },
            {
              label: "排序",
@@ -165,25 +178,29 @@
              type: "number",
              align: "right",
              width: 80,
              rules: [{
            rules: [
              {
                required: true,
                message: "请输入排序",
                trigger: "blur"
              }]
                trigger: "blur",
              },
            ],
            },
            {
              label: "备注",
              prop: "remark",
              rules: [{
            rules: [
              {
                required: false,
                message: "请输入备注",
                trigger: "blur"
              }],
              hide: true
            }
          ]
                trigger: "blur",
        },
        data: []
            ],
            hide: true,
          },
        ],
      },
      data: [],
      };
    },
    computed: {
@@ -193,27 +210,27 @@
          addBtn: this.vaildData(this.permission.dept_add, false),
          viewBtn: this.vaildData(this.permission.dept_view, false),
          delBtn: this.vaildData(this.permission.dept_delete, false),
          editBtn: this.vaildData(this.permission.dept_edit, false)
        editBtn: this.vaildData(this.permission.dept_edit, false),
        };
      },
      ids() {
        let ids = [];
        this.selectionList.forEach(ele => {
      this.selectionList.forEach((ele) => {
          ids.push(ele.id);
        });
        return ids.join(",");
      }
    },
    },
    methods: {
      initData() {
        getDeptTree().then(res => {
      getDeptTree().then((res) => {
          const column = this.findObject(this.option.column, "parentId");
          column.dicData = res.data.data;
        });
      },
      handleAdd(row) {
        this.$refs.crud.value.parentId = row.id;
        this.$refs.crud.option.column.filter(item => {
      this.$refs.crud.option.column.filter((item) => {
          if (item.prop === "parentId") {
            item.value = row.id;
            item.addDisabled = true;
@@ -222,7 +239,8 @@
        this.$refs.crud.rowAdd();
      },
      rowSave(row, done, loading) {
        add(row).then((res) => {
      add(row).then(
        (res) => {
          // 获取新增数据的相关字段
          const data = res.data.data;
          row.id = data.id;
@@ -230,33 +248,38 @@
          row.tenantId = data.tenantId;
          this.$message({
            type: "success",
            message: "操作成功!"
            message: "操作成功!",
          });
          // 数据回调进行刷新
          done(row);
        }, error => {
        },
        (error) => {
          window.console.log(error);
          loading();
        });
        }
      );
      },
      rowUpdate(row, index, done, loading) {
        update(row).then(() => {
      update(row).then(
        () => {
          this.$message({
            type: "success",
            message: "操作成功!"
            message: "操作成功!",
          });
          // 数据回调进行刷新
          done(row);
        }, error => {
        },
        (error) => {
          window.console.log(error);
          loading();
        });
        }
      );
      },
      rowDel(row, index, done) {
        this.$confirm("确定将选择数据删除?", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        type: "warning",
        })
          .then(() => {
            return remove(row.id);
@@ -264,7 +287,7 @@
          .then(() => {
            this.$message({
              type: "success",
              message: "操作成功!"
            message: "操作成功!",
            });
            // 数据回调进行刷新
            done(row);
@@ -278,7 +301,7 @@
        this.$confirm("确定将选择数据删除?", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        type: "warning",
        })
          .then(() => {
            return remove(this.ids);
@@ -293,7 +316,7 @@
            this.onLoad(this.page);
            this.$message({
              type: "success",
              message: "操作成功!"
            message: "操作成功!",
            });
          });
      },
@@ -304,7 +327,7 @@
      },
      searchChange(params, done) {
        this.query = params;
        this.parentId = '';
      this.parentId = "";
        this.page.currentPage = 1;
        this.onLoad(this.page, params);
        done();
@@ -321,7 +344,7 @@
          this.initData();
        }
        if (["edit", "view"].includes(type)) {
          getDept(this.form.id).then(res => {
        getDept(this.form.id).then((res) => {
            this.form = res.data.data;
          });
        }
@@ -331,7 +354,7 @@
        this.$refs.crud.tableForm = {};
        this.$refs.crud.value.parentId = "";
        this.$refs.crud.value.addDisabled = false;
        this.$refs.crud.option.column.filter(item => {
      this.$refs.crud.option.column.filter((item) => {
          if (item.prop === "parentId") {
            item.value = "";
            item.addDisabled = false;
@@ -350,19 +373,21 @@
      },
      onLoad(page, params = {}) {
        this.loading = true;
        getLazyList(this.parentId, Object.assign(params, this.query)).then(res => {
      getLazyList(this.parentId, Object.assign(params, this.query)).then(
        (res) => {
          this.data = res.data.data;
          this.loading = false;
          this.selectionClear();
        });
        }
      );
      },
      treeLoad(tree, treeNode, resolve) {
        const parentId = tree.id;
        getLazyList(parentId).then(res => {
      getLazyList(parentId).then((res) => {
          resolve(res.data.data);
        });
      }
    }
    },
  },
  };
</script>