src/views/traincompany/index.vue
@@ -1,15 +1,14 @@
/*
 * @Author: Morpheus
 * @Date: 2021-07-07 17:30:05
 * @Last Modified by: liu
 * @Last Modified time: 2021-12-10 09:56:51
 * menu-name 保安培训报名
 */
/* * @Author: Morpheus * @Date: 2021-07-07 17:30:05 * @Last Modified by: liu *
@Last Modified time: 2021-12-10 09:56:51 * menu-name 保安培训报名 */
<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"
@@ -73,11 +72,11 @@
  getDetail,
  add,
  update,
  remove,
  remove
} from "@/api/securityCompany/train";
import {
  adddata,
  batchTrain,
  batchTrain
} from "@/api/trainingRegistration/trainingRegistration";
import { mapGetters } from "vuex";
import { mapState } from "vuex";
@@ -88,7 +87,7 @@
      form: {},
      auditStatus: false,
      formTrainApply: {
        num: 0,
        num: 0
      },
      query: {},
      deptId: null,
@@ -98,7 +97,7 @@
        pageSize: 10,
        currentPage: 1,
        total: 0,
        ...this.$store.state.control.changePageSize,
        ...this.$store.state.control.changePageSize
      },
      selectionList: [],
      option: {
@@ -128,7 +127,7 @@
            search: true,
            searchSpan: 5,
            searchLabelWidth: 60,
            display: false,
            display: false
          },
          {
            label: "校长",
@@ -137,26 +136,26 @@
            search: true,
            searchSpan: 4,
            searchLabelWidth: 60,
            width: 120,
            width: 120
          },
          {
            label: "负责人",
            prop: "contacts",
            display: false,
            display: false
          },
          {
            label: "联系方式",
            prop: "contactscell",
            display: false,
            width: 130,
            width: 130
          },
          {
            label: "联系地址",
            prop: "address",
            display: false,
            width: 280,
          },
        ],
            width: 280
          }
        ]
      },
      optionTrainApply: {
        align: "center",
@@ -179,7 +178,7 @@
            cascaderItem: ["trainExamId"],
            props: {
              label: "title",
              value: "id",
              value: "id"
            },
            type: "select",
            disabled: true,
@@ -187,14 +186,14 @@
              {
                required: true,
                message: "请输入学校",
                trigger: "blur",
              },
                trigger: "blur"
              }
            ],
            hide: true,
            searchSpan: 6,
            searchLabelWidth: 110,
            search: true,
            span: 24,
            span: 24
          },
          // {
          //     label: "企业名称",
@@ -224,7 +223,7 @@
            // dicUrl: "/api/blade-user/page-security-unit?deptId="+this.deptId,
            props: {
              label: "name",
              value: "id",
              value: "id"
            },
            //不包含父节点值
            leafOnly: true,
@@ -234,27 +233,27 @@
              {
                required: true,
                message: "请输入姓名",
                trigger: "blur",
              },
                trigger: "blur"
              }
            ],
            span: 24,
            span: 24
          },
          {
            label: "总数",
            prop: "num",
            disabled: true,
            span: 12,
          },
        ],
            span: 12
          }
        ]
      },
      data: [],
      data: []
    };
  },
  watch: {
    "formTrainApply.userId"() {
      //  console.log(this.formTrainApply.userId.length,456);
      this.formTrainApply.num = this.formTrainApply.userId.length;
    },
    }
  },
  computed: {
    ...mapGetters(["permission"]),
@@ -263,19 +262,19 @@
        addBtn: this.vaildData(null, false),
        viewBtn: this.vaildData(null, false),
        delBtn: this.vaildData(null, false),
        editBtn: this.vaildData(null, false),
        editBtn: this.vaildData(null, false)
      };
    },
    ids() {
      let ids = [];
      this.selectionList.forEach((ele) => {
      this.selectionList.forEach(ele => {
        ids.push(ele.id);
      });
      return ids.join(",");
    },
    ...mapState({
      userInfo: (state) => state.user.userInfo,
    }),
      userInfo: state => state.user.userInfo
    })
  },
  created() {
    this.optionTrainApply.column[1].dicUrl =
@@ -284,11 +283,14 @@
    this.getUserDetail();
  },
  mounted() {
    this.$store.commit("setWindowSizeHeightAdd");
  },
  methods: {
    //获取用户信息
    getUserDetail() {
      var that = this;
      getUser(this.userInfo.Id).then((res) => {
      getUser(this.userInfo.Id).then(res => {
        var status = res.data.data.examinationType;
        if (status == "1") {
          that.auditStatus = true;
@@ -302,37 +304,37 @@
      this.optionTrainApply.column.trainingUnitId = row.departmentid;
      // this.deptId= this.userInfo.dept_id;
      this.formTrainApply = {
        trainingUnitId: row.departmentid,
        trainingUnitId: row.departmentid
      };
    },
    //批量报名提交
    submit() {
      batchTrain({
        userIds: this.formTrainApply.userId.join(","),
        trainingUnitId: this.formTrainApply.trainingUnitId,
        trainingUnitId: this.formTrainApply.trainingUnitId
      }).then(
        (res) => {
        res => {
          this.onLoad(this.page);
          if (res.data.data == 201) {
            this.$message({
              type: "warning",
              message: "已报名,不能重复报名",
              message: "已报名,不能重复报名"
            });
          } else if (res.data.data == 201) {
            this.$message({
              type: "warning",
              message: "报名失败",
              message: "报名失败"
            });
          } else {
            this.$message({
              type: "success",
              message: "报名成功",
              message: "报名成功"
            });
            this.$refs.formTrainApply.resetFields();
            this.dialogDisable = false;
          }
        },
        (error) => {
        error => {
          window.console.log(error);
          this.$refs.formTrainApply.resetFields();
          this.dialogDisable = false;
@@ -344,32 +346,32 @@
      this.$confirm("是否确定报名?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
        type: "warning"
      }).then(() => {
        row["userId"] = this.userInfo.user_id;
        row["trainingUnitId"] = row.departmentid;
        adddata(row).then(
          (res) => {
          res => {
            // this.onLoad(this.page);
            if (res.data.data == 201) {
              this.$message({
                type: "warning",
                message: "已报名,不能重复报名",
                message: "已报名,不能重复报名"
              });
            } else if (res.data.data == 201) {
              this.$message({
                type: "warning",
                message: "报名失败",
                message: "报名失败"
              });
            } else {
              this.$message({
                type: "success",
                message: "报名成功",
                message: "报名成功"
              });
            }
            done();
          },
          (error) => {
          error => {
            window.console.log(error);
            loading();
          }
@@ -386,11 +388,11 @@
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
            message: "操作成功!"
          });
          done();
        },
        (error) => {
        error => {
          window.console.log(error);
          loading();
        }
@@ -402,11 +404,11 @@
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
            message: "操作成功!"
          });
          done();
        },
        (error) => {
        error => {
          window.console.log(error);
          loading();
        }
@@ -416,7 +418,7 @@
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
        type: "warning"
      })
        .then(() => {
          return remove(row.id);
@@ -425,13 +427,13 @@
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
            message: "操作成功!"
          });
        });
    },
    beforeOpen(done, type) {
      if (["edit", "view"].includes(type)) {
        getDetail(this.form.id).then((res) => {
        getDetail(this.form.id).then(res => {
          this.form = res.data.data;
        });
      }
@@ -469,14 +471,15 @@
        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();
      });
    },
    }
    // // 行单击
    // handleRowClick(row) {
@@ -488,9 +491,8 @@
    //     query: obj,
    //   });
    // },
  },
  }
};
</script>
<style>
</style>
<style></style>