src/views/securityUnitChild/manager.vue
@@ -1,8 +1,12 @@
<template>
  <basic-container
    :class="[$store.state.control.windowWidth >= 1024 ? 'oneRowSearch' : '']"
    :class="[
      $store.state.control.screenSize == 1366 ? 'smallSize' : 'normalSize',
      $store.state.control.windowWidth >= 1024 ? 'tooRowSearch1' : ''
    ]"
  >
    <avue-crud
      class="tablesss"
      :option="option"
      :table-loading="loading"
      :data="data"
@@ -69,12 +73,12 @@
  getDetail2,
  adddata2,
  update2,
  remove2,
} from  "@/api/securityUnit/securityUnit";
  remove2
} from "@/api/securityUnit/securityUnit";
import { mapGetters } from "vuex";
import { getToken } from "@/util/auth";
export default {
  props: ["deptid","stats"],
  props: ["deptid", "stats"],
  data() {
    var deptid = this.deptid;
    if (deptid == undefined) {
@@ -91,7 +95,7 @@
        pageSize: 10,
        currentPage: 1,
        total: 0,
        ...this.$store.state.control.changePageSize,
        ...this.$store.state.control.changePageSize
      },
      selectionList: [],
      option: {
@@ -99,9 +103,9 @@
        searchSize: "mini",
        searchMenuSpan: 8,
        height: "auto",
        editBtn:true,
        delBtn:true,
        viewBtn:true,
        editBtn: true,
        delBtn: true,
        viewBtn: true,
        menuWidth: 200,
        menuAlign: "center",
        align: "center",
@@ -113,80 +117,88 @@
            prop: "creditcode",
            hide: true,
            addDisplay: false,
            editDisplay: false,
            editDisplay: false
          },
          {
            label: "id",
            prop: "id",
            hide: true,
            addDisplay: false,
            editDisplay: false,
            editDisplay: false
          },
          {
            label: "姓名",
            prop: "name",
            search: true,
            rules: [{
            searchLabelWidth: 55,
            searchSpan: 4,
            rules: [
              {
                required: true,
                message: "请输入姓名",
                trigger: "blur"
            }],
              }
            ]
          },
          {
            label: "职务",
            prop: "post",
            search: true,
            rules: [{
            rules: [
              {
                required: true,
                message: "请输入职务",
                trigger: "blur"
            }],
              }
            ]
          },
          {
            label: "身份证",
            prop: "cardid",
            prop: "cardid"
          },
          {
            label: "联系电话",
            prop: "cell",
            prop: "cell"
          },
          {
            label: "学历",
            prop: "education",
            display:false,
            row:true,
            hide:true,
            rules: [{
            display: false,
            row: true,
            hide: true,
            rules: [
              {
                required: true,
                message: "请选择学历",
                trigger: "blur"
            }],
              }
            ],
            dicUrl: "/api/blade-system/dict-biz/dictionary?code=educationTypes",
            search: false,
            searchSpan: 4,
            type: "select",
            props: {
                label: "dictValue",
                value: "dictKey"
              label: "dictValue",
              value: "dictKey"
            },
            dataType: "number",
            dataType: "number"
          },
          {
            label: "证书",
            prop: "paper",
            type: "upload",
            dataType:"string",
            dataType: "string",
            listType: "picture-card",
            span: 24,
            propsHttp: {
              res: "data",
              res: "data"
            },
            tip: "只能上传jpg/png格式图片,且不超过2Mb",
            action: "/api/blade-resource/oss/endpoint/put-files",
            display:false,
            hide:true,
          },
        ],
            display: false,
            hide: true
          }
        ]
      },
      data: [],
      excelForm: {},
@@ -202,40 +214,34 @@
            loadText: "模板上传中,请稍等",
            span: 24,
            propsHttp: {
              res: "data",
              res: "data"
            },
            tip: "请上传 .xls,.xlsx 标准格式文件",
            action: "/api/member/import-member",
            action: "/api/member/import-member"
          },
          {
            label: "模板下载",
            prop: "excelTemplate",
            formslot: true,
            span: 24,
          },
        ],
      },
            span: 24
          }
        ]
      }
    };
  },
  created() {
    this.option.height = this.windowHeight - 320;
    if (this.stats == "1") {
        //学校
        const educationcolumn = this.findObject(
            this.option.column,
            "education"
          );
          const papercolumn = this.findObject(
            this.option.column,
            "paper"
          );
          //学历证书
          educationcolumn.display = true;
          educationcolumn.hide = false;
          educationcolumn.search = true;
          papercolumn.display = true;
          papercolumn.hide = false;
      }
      //学校
      const educationcolumn = this.findObject(this.option.column, "education");
      const papercolumn = this.findObject(this.option.column, "paper");
      //学历证书
      educationcolumn.display = true;
      educationcolumn.hide = false;
      educationcolumn.search = true;
      papercolumn.display = true;
      papercolumn.hide = false;
    }
  },
  computed: {
    ...mapGetters(["permission", "userInfo", "windowHeight"]),
@@ -249,16 +255,19 @@
    // },
    ids() {
      let ids = [];
      this.selectionList.forEach((ele) => {
      this.selectionList.forEach(ele => {
        ids.push(ele.id);
      });
      return ids.join(",");
    },
    }
  },
  mounted() {
    this.$store.commit("setWindowSizeHeightAdd");
  },
  methods: {
    rowSave(row, done, loading) {
      row['deptId'] = this.deptid;
      if(this.stats != "1"){
      row["deptId"] = this.deptid;
      if (this.stats != "1") {
        delete row.paper;
      }
      adddata2(row).then(
@@ -266,19 +275,19 @@
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
            message: "操作成功!"
          });
          done();
        },
        (error) => {
        error => {
          loading();
          window.console.log(error);
        }
      );
    },
    rowUpdate(row, index, done, loading) {
      row['deptId'] = this.deptid;
      if(this.stats != "1"){
      row["deptId"] = this.deptid;
      if (this.stats != "1") {
        delete row.paper;
      }
      update2(row).then(
@@ -286,11 +295,11 @@
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
            message: "操作成功!"
          });
          done();
        },
        (error) => {
        error => {
          loading();
          console.log(error);
        }
@@ -300,7 +309,7 @@
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
        type: "warning"
      })
        .then(() => {
          return remove2(row.id);
@@ -309,7 +318,7 @@
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
            message: "操作成功!"
          });
        });
    },
@@ -335,7 +344,7 @@
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
        type: "warning"
      })
        .then(() => {
          return remove2(this.ids);
@@ -344,14 +353,14 @@
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
            message: "操作成功!"
          });
          this.$refs.crud.toggleSelection();
        });
    },
    beforeOpen(done, type) {
      if (["edit", "view"].includes(type)) {
        getDetail2(this.form.id).then((res) => {
        getDetail2(this.form.id).then(res => {
          this.form = res.data.data;
        });
      }
@@ -390,17 +399,17 @@
        page.currentPage,
        page.pageSize,
        Object.assign(params, this.query)
      ).then((res) => {
      ).then(res => {
        const data = res.data.data;
        this.page.total = data.total;
        this.data = data.records;
        this.loading = false;
        this.$store.commit("setWindowSizeHeightAdd");
        this.selectionClear();
      });
    },
  },
    }
  }
};
</script>
<style>
</style>
<style></style>