src/views/securityUnitChild/index.vue
@@ -156,6 +156,7 @@
<script>
import { column, column1, column2 } from "./data";
import {
  getOncedata,
  // getdata,
  // adddata,
  // update,
@@ -423,130 +424,6 @@
        this.onLoad2(this.page2); //第二个表格不会自动执行
      }
    },
    // //保安单位基本信息  改成表单
    // sizeChange(val) {
    //   this.page1.currentPage = 1;
    //   this.page1.pageSize = val;
    //   // this.getData();
    //   this.onLoad(this.page, this.query);
    //   //   this.$message.success("行数" + val);
    // },
    // currentChange(val) {
    //   this.page1.currentPage = val;
    //   // this.getData();
    //   this.onLoad(this.page, this.query);
    //   //   this.$message.success("页码" + val);
    // },
    // rowSave(form, done, loading) {
    //   // var that = this;
    //   //   var form = this.data[0];
    //   //   delete form.id;
    //   //   for (var k = 0; k < 13; k++) {
    //   adddata(form).then(
    //     () => {
    //       this.onLoad(this.page);
    //       this.$message({
    //         type: "success",
    //         message: "操作成功!",
    //       });
    //       done();
    //     },
    //     (error) => {
    //       window.console.log(error);
    //       loading();
    //     }
    //   );
    //   //   }
    // },
    // searchChange(params, done) {
    //   this.query = params;
    //   this.page.currentPage = 1;
    //   this.onLoad(this.page, params);
    //   done();
    // },
    // searchReset() {
    //   this.query = {};
    //   this.onLoad(this.page);
    // },
    // rowUpdate(row, index, done, loading) {
    //   delete row.tenantid;
    //   console.log(row, 0);
    //   update(row).then(
    //     () => {
    //       this.onLoad(this.page);
    //       this.$message({
    //         type: "success",
    //         message: "操作成功!",
    //       });
    //       done();
    //     },
    //     (error) => {
    //       window.console.log(error);
    //       loading();
    //     }
    //   );
    // },
    // rowDel(row) {
    //   this.$confirm("确定将选择数据删除?", {
    //     confirmButtonText: "确定",
    //     cancelButtonText: "取消",
    //     type: "warning",
    //   })
    //     .then(() => {
    //       return remove(row.id);
    //     })
    //     .then(() => {
    //       this.onLoad(this.page);
    //       this.$message({
    //         type: "success",
    //         message: "操作成功!",
    //       });
    //     });
    // },
    // selectionChange(list) {
    //   this.selectionList = list;
    // },
    // handleDelete() {
    //   if (this.selectionList.length === 0) {
    //     this.$message.warning("请选择至少一条数据");
    //     return;
    //   }
    //   this.$confirm("确定将选择数据删除?", {
    //     confirmButtonText: "确定",
    //     cancelButtonText: "取消",
    //     type: "warning",
    //   })
    //     .then(() => {
    //       return remove(this.ids);
    //     })
    //     .then(() => {
    //       this.onLoad(this.page);
    //       this.$message({
    //         type: "success",
    //         message: "操作成功!",
    //       });
    //       this.$refs.crudrec.toggleSelection();
    //     });
    // },
    // refreshChange() {
    //   this.onLoad(this.page, this.query);
    // },
    // onLoad(page, params = {}) {
    //   this.loading = true;
    //   getdata(
    //     page.currentPage,
    //     page.pageSize,
    //     Object.assign(params, this.query)
    //   ).then((res) => {
    //     // console.log(res);
    //     const data = res.data.data;
    //     this.page.total = data.total;
    //     this.data = data.records;
    //     console.log(this.data);
    //     this.loading = false;
    //   });
    // },
    //保安单位基本信息
    //派遣记录
    sizeChange1(val) {
@@ -832,43 +709,81 @@
    },
  },
  mounted() {
    this.typeTABS = this.optionTABS.column[0];
    var row = {};
    if (this.readLock("danweidata") != null) {
      row = JSON.parse(this.readLock("danweidata"));
      // this.obj0.title = row.enterprisename;
      for (var k in row) {
        this.obj0[k] = row[k];
      }
      this.creditcode = row.creditcode;
      if (this.readLock("danweidataS") != null) {
        var b = JSON.parse(this.readLock("danweidataS"));
        var i = 0;
        for (var k in b) {
          if (b[k].enterprisename == row.enterprisename) {
            i = 1;
    var that = this;
    var doit = (a) => {
      that.typeTABS = that.optionTABS.column[0];
      var row = {};
      if (that.readLock("danweidata") != null) {
        row = JSON.parse(that.readLock("danweidata"));
        // that.obj0.title = row.enterprisename;
        // console.log(row, "row");
        for (var k in row) {
          that.obj0[k] = row[k];
        }
        that.creditcode = row.creditcode;
        if (that.readLock("danweidataS") != null && a == 1) {
          var b = JSON.parse(that.readLock("danweidataS"));
          var i = 0;
          for (var k in b) {
            if (b[k].enterprisename == row.enterprisename) {
              i = 1;
            }
          }
          if (i == 1) {
            // console.log("存在");
          } else {
            // console.log("已删除");
            that.obj0 = {};
            that.obj0.enterprisename = row.enterprisename + "该公司已删除";
            window.localStorage.removeItem("danweidata");
            that.creditcode = "";
          }
        }
        if (i == 1) {
          // console.log("存在");
        } else {
          // console.log("已删除");
          this.obj0 = {};
          this.obj0.enterprisename = row.enterprisename + "该公司已删除";
          window.localStorage.removeItem("danweidata");
          this.creditcode = "";
        }
      } else {
        // console.log("no");
        that.obj0.enterprisename = "未选择查询单位";
      }
    };
    var flag = false,
      i = 0,
      ind = null;
    this.$store.state.tags.tagList.forEach((item, index) => {
      if (item.label == "保安单位详情") {
        if (flag == false) {
          ind = index;
          flag = true;
        }
        i++;
      }
    });
    if (i > 1) {
      this.$store.state.tags.tagList.splice(ind, 1);
    }
    var fromSecunityGuardId = this.$route.query.fromSecunityGuardId;
    // var fromSecunityGuardId = this.$route.query;
    if (fromSecunityGuardId != undefined) {
      var value = {
        departmentid: fromSecunityGuardId,
      };
      getOncedata(value).then((res) => {
        // console.log(res.data.data, "get");
        window.localStorage.setItem(
          "danweidata",
          JSON.stringify(res.data.data)
        );
        doit();
      });
      // return;
    } else {
      // console.log("no");
      this.obj0.enterprisename = "未选择查询单位";
      doit(1);
    }
  },
  watch: {
    chuzitime() {
      // console.log(this.chuzitime, "chuzitime");
    },
    // chuzitime() {
    // console.log(this.chuzitime, "chuzitime");
    // },
  },
};
</script>