liuyg
2021-07-10 2d6dd9c84ccf3ab8f0595301433fc238c3661291
src/views/dispatchChild/index.vue
@@ -102,10 +102,7 @@
        ],
      },
      cardid: "", //获取派遣记录参数
      name: "", //获取派遣记录参数
      dispatcherCompany: "", //获取派遣记录参数
      id: "",
      id: "", //记录归属id
      //基本信息
      //保安单位信息表单
      obj0: {
@@ -329,20 +326,25 @@
      // var form = this.data1[0];
      // delete form.id;
      // for (var k = 0; k < 13; k++) {
        adddata1(form).then(
          (res) => {
            this.onLoad1(this.page1);
            this.$message({
              type: "success",
              message: "操作成功!",
            });
            done();
          },
          (error) => {
            window.console.log(error);
            loading();
          }
        );
      // form["deptId"] = form.tenantName;
      // form["tenantName"] = form.$tenantName;
      form["dispatcherUnitId"] = this.id;
      console.log(form);
      adddata1(form).then(
        (res) => {
          this.onLoad1(this.page1);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
          done();
        },
        (error) => {
          window.console.log(error);
          loading();
        }
      );
      // }
    },
    searchChange1(params, done) {
@@ -356,7 +358,10 @@
      this.onLoad1(this.page1);
    },
    rowUpdate1(row, index, done, loading) {
      console.log(row);
      // row["deptId"] = row.tenantName;
      // row["tenantName"] = row.$tenantName;
      row["dispatcherUnitId"] = this.id;
      console.log(row, "row");
      update1(row).then(
        () => {
          this.onLoad1(this.page1);
@@ -428,7 +433,7 @@
      // params["name"] = this.name;
      // params["dispatcherCompany"] = this.dispatcherCompany;
      params["dispatcherUnitId"] = this.id;
      console.log(params, "get");
      // console.log(params, "get");
      getdata1(
        page.currentPage,
        page.pageSize,
@@ -443,21 +448,64 @@
      });
    },
    //派遣记录
    saveLock(name, val) {
      localStorage.setItem(name, val);
    },
    readLock(name) {
      return localStorage.getItem(name);
    },
  },
  mounted() {
    // this.typeTABS = this.optionTABS.column[0];
    // // console.log(typeof this.$route.query.row, 15315);
    // if (typeof this.$route.query.row == "object") {
    //   var row = this.$route.query.row;
    //   for (var k in row) {
    //     this.obj0[k] = row[k];
    //   }
    //   this.obj0.title = row.name + "基本信息";
    //   // console.log(row);
    //   this.id = row.id;
    //   this.saveLock("paqiandata", JSON.stringify(row));
    // } else {
    //   var row = JSON.parse(this.readLock("paqiandata"));
    //   // console.log(row);
    //   this.obj0.title = row.name + "基本信息";
    //   for (var k in row) {
    //     this.obj0[k] = row[k];
    //   }
    // }
    this.typeTABS = this.optionTABS.column[0];
    if (this.$route.query.row) {
      var row = this.$route.query.row;
    var row = {};
    if (this.readLock("paqiandata") != null) {
      row = JSON.parse(this.readLock("paqiandata"));
      this.obj0.title = row.name + " 基本信息";
      for (var k in row) {
        this.obj0[k] = row[k];
      }
      this.obj0.title = row.name + "基本信息";
      console.log(row);
      this.cardid = row.cardid;
      this.name = row.name;
      this.dispatcherCompany = row.dispatcherCompany;
      this.id = row.id;
      if (this.readLock("paqiandataS") != null) {
        var b = JSON.parse(this.readLock("paqiandataS"));
        var i = 0;
        for (var k in b) {
          if (b[k].name == row.name) {
            i = 1;
          }
        }
        if (i == 1) {
          // console.log("存在");
        } else {
          // console.log("已删除");
          this.obj0 = {};
          this.obj0.title = row.name + " 该派遣单位已删除";
          window.localStorage.removeItem("paqiandata");
          this.id = 1244241;
        }
      }
    } else {
      // console.log("no");
      this.obj0.title = " 未选择派遣单位";
    }
  },
};