管道基础大数据平台系统开发-【前端】-新系統界面
surprise
2024-03-29 98a2b24c89e81a5aacdcbd6b739fef422adf17dd
src/views/datamanage/dataUpdata.vue
@@ -1972,559 +1972,559 @@
      var fs2 = null;
      if (this.formInline.uploadType == "v1") {
        //单文件项目上传
        fs2 = document.getElementById("metaDataFile");
        if (this.pathBak != null && this.pathBak.indexOf("checkMain") > -1) {
          if (fs2.files.length == 0) {
            return this.$message.error("请选择需要上传的元数据文件");
          }
        }
      } else if (this.formInline.uploadType == "v2") {
        //整体项目上传
        fs2 = document.getElementById("wbsDataFile");
        if (fs2.files.length == 0) {
          return this.$message.error("请选择需要上传的WBS数据文件");
        }
      } else if (this.formInline.uploadType == "v3") {
        //     fs2 = document.getElementById("metaDataFile");
        //   if (this.pathBak != null && this.pathBak.indexOf("checkMain") > -1) {
        //   if (fs2.files.length == 0) {
        //   return this.$message.error("请选择需要上传的元数据文件");
      // }
    // }
  } else if(this.formInline.uploadType == "v2") {
  //整体项目上传
  fs2 = document.getElementById("wbsDataFile");
  if (fs2.files.length == 0) {
    return this.$message.error("请选择需要上传的WBS数据文件");
  }
} else if (this.formInline.uploadType == "v3") {
}
for (var i = 0, c = fs1.files.length; i < c; i++) {
  formData.append(fs1.files[i].name, fs1.files[i]);
  this.fileType.push({ name: fs1.files[i].name, type: "selectData" });
}
if (fs2 != null) {
  for (var i = 0, c = fs2.files.length; i < c; i++) {
    formData.append(fs2.files[i].name, fs2.files[i]);
    if (this.formInline.uploadType == "v1") {
      this.fileType.push({ name: fs2.files[i].name, type: "metaData" });
    } else if (this.formInline.uploadType == "v2") {
      this.fileType.push({ name: fs2.files[i].name, type: "wbsData" });
    }
  }
}
const that = this;
that.jindudialogVisible = true;
let listval = [];
formData.forEach((key, val) => {
  listval.push({
    name: val,
  });
});
that.$set(this, "jindutiaoname", listval);
that.$set(this, "jindutiao", 0);
// this.loading = true;
$.ajax(
  BASE_URL +
  "/dataUpload/uploadFiles?token=" +
  token +
  "&path=" +
  this.formInline.path,
  {
    type: "post",
    data: formData,
    async: true,
    cache: false,
    processData: false,
    contentType: false,
    success: (rs) => {
      this.loading = false;
      if (rs.code != 200) {
        return this.$message.error("数据上传失败");
      }
      for (var i = 0, c = fs1.files.length; i < c; i++) {
        formData.append(fs1.files[i].name, fs1.files[i]);
        this.fileType.push({ name: fs1.files[i].name, type: "selectData" });
      }
      if (fs2 != null) {
        for (var i = 0, c = fs2.files.length; i < c; i++) {
          formData.append(fs2.files[i].name, fs2.files[i]);
          if (this.formInline.uploadType == "v1") {
            this.fileType.push({ name: fs2.files[i].name, type: "metaData" });
          } else if (this.formInline.uploadType == "v2") {
            this.fileType.push({ name: fs2.files[i].name, type: "wbsData" });
          }
        }
      }
      const that = this;
      that.jindudialogVisible = true;
      let listval = [];
      formData.forEach((key, val) => {
        listval.push({
          name: val,
        });
      this.getFileLength();
      this.$set(this, "jindutiao", 100);
      this.$message({
        message: "上传成功",
        type: "success",
      });
      that.$set(this, "jindutiaoname", listval);
      that.$set(this, "jindutiao", 0);
      // this.loading = true;
      $.ajax(
        BASE_URL +
        "/dataUpload/uploadFiles?token=" +
        token +
        "&path=" +
        this.formInline.path,
        {
          type: "post",
          data: formData,
          async: true,
          cache: false,
          processData: false,
          contentType: false,
          success: (rs) => {
            this.loading = false;
            if (rs.code != 200) {
              return this.$message.error("数据上传失败");
            }
            this.getFileLength();
            this.$set(this, "jindutiao", 100);
            this.$message({
              message: "上传成功",
              type: "success",
            });
            this.clearFileSelect();
          },
          error: (rs) => {
            this.loading = false;
            this.$message.error("数据上传失败");
          },
          xhr: function () {
            var myXhr = $.ajaxSettings.xhr();
            if (myXhr.upload) {
              //检查upload属性是否存在
              myXhr.upload.addEventListener(
                "progress",
                that.progressHandlingFunction,
                false
              ); //绑定progress事件的回调函数
            }
            return myXhr; //xhr对象返回给jQuery使用
          },
        }
      );
      this.clearFileSelect();
    },
    progressHandlingFunction(event) {
      var loaded = event.loaded; //已上传
      var loaded = Math.floor(100 * (event.loaded / event.total) - 1); //计算已经上传的百分比
      $("#prog").html(loaded + "%"); //应用到显示UI,可根据自己需要修改
      this.jindutiao = loaded;
      this.$set(this, "jindutiao", loaded);
    error: (rs) => {
      this.loading = false;
      this.$message.error("数据上传失败");
    },
    format(percentage) {
    xhr: function () {
      var myXhr = $.ajaxSettings.xhr();
      // return percentage === 100 ? "上传完毕" : `${percentage}%`;
      var label;
      if (this.sc.label1 == "上传") {
        label = "上传完毕"
      } else {
        label = `${percentage}%`
      if (myXhr.upload) {
        //检查upload属性是否存在
        myXhr.upload.addEventListener(
          "progress",
          that.progressHandlingFunction,
          false
        ); //绑定progress事件的回调函数
      }
      return percentage === 100 ? label : `${percentage}%`;
      return myXhr; //xhr对象返回给jQuery使用
    },
  }
);
    },
progressHandlingFunction(event) {
  var loaded = event.loaded; //已上传
  var loaded = Math.floor(100 * (event.loaded / event.total) - 1); //计算已经上传的百分比
  $("#prog").html(loaded + "%"); //应用到显示UI,可根据自己需要修改
  this.jindutiao = loaded;
  this.$set(this, "jindutiao", loaded);
},
format(percentage) {
  // return percentage === 100 ? "上传完毕" : `${percentage}%`;
  var label;
  if (this.sc.label1 == "上传") {
    label = "上传完毕"
  } else {
    label = `${percentage}%`
  }
  return percentage === 100 ? label : `${percentage}%`;
},
    //获取文件上传路径
    async getFilePath() {
      const res = await dataUploadSelectPath();
      if (res.code != 200) {
        this.$message.error("文件上传路径获取失败");
        return;
      }
      this.formInline.path = res.result;
    },
    //项目名称切换
    entryNameChange(res) {
      var val = this.entryOption.filter((rs) => {
        if (rs.name == res) {
          return rs;
        }
      });
      this.pathBak = val[0].checks;
      this.formInline.dirid = val[0].id;
      this.getselectVerByDirid();
    },
  const res = await dataUploadSelectPath();
  if (res.code != 200) {
    this.$message.error("文件上传路径获取失败");
    return;
  }
  this.formInline.path = res.result;
},
//项目名称切换
entryNameChange(res) {
  var val = this.entryOption.filter((rs) => {
    if (rs.name == res) {
      return rs;
    }
  });
  this.pathBak = val[0].checks;
  this.formInline.dirid = val[0].id;
  this.getselectVerByDirid();
},
    //获取项目名称
    async setProjectName() {
      const data = await dataUpload_selectProject();
      if (data.code != 200) {
        this.$message.error("项目列表获取失败");
        return;
      }
      this.entryOption = data.result;
      this.formInline.entryId = this.entryOption[0].name;
      this.formInline.dirid = this.entryOption[0].id;
  const data = await dataUpload_selectProject();
  if (data.code != 200) {
    this.$message.error("项目列表获取失败");
    return;
  }
  this.entryOption = data.result;
  this.formInline.entryId = this.entryOption[0].name;
  this.formInline.dirid = this.entryOption[0].id;
      this.getselectVerByDirid();
    },
  this.getselectVerByDirid();
},
    //获取所有坐标系
    async setCoordinateSystem() {
      const data = await dataUpload_selectCoords();
      if (data.code != 200) {
        this.$message.error("坐标系列表获取失败");
        return;
      }
      this.coordinateOption = data.result;
      this.formInline.coordinateId = this.coordinateOption[0].epsgcode;
    },
    //WBS数据选择
    setWBSFile() {
      $("#wbsDataFile").click();
    },
    //重置WPS选择
    restWBSFile() {
      this.formInline.wbsData = "请选择WBS数据";
      document.getElementById("wbsDataFile").value = "";
    },
    //WBS数据Change事件
    handleWBSFileChange(event) {
      var std = [];
      var len = event.currentTarget.files.length;
      for (var i = 0; i < len; i++) {
        var f = event.currentTarget.files[i];
        std.push(f.name);
      }
      this.formInline.wbsData = std.toString();
    },
    //数据质检弹窗关闭--项目整体
    handleTestQuayCloseDown() {
      this.$confirm("确认关闭?")
        .then((_) => {
          this.closeTestQuayCloseDialog();
        })
        .catch((_) => {
        });
    },
    closeTestQuayCloseDialog() {
      this.testQuayVisible = false;
    },
    //数据质检弹窗关闭--单文件
    handleQuayTestCloseDown() {
      this.$confirm("确认关闭?")
        .then((_) => {
          this.closeQuayTestCloseDialog();
        })
        .catch((_) => {
        });
    },
    closeQuayTestCloseDialog() {
      this.quayTestVisible = false;
    },
    //数据质检点击事件
    handleQuayTestClick() {
      if (this.pathBak == null) {
        return this.$message("无质检方案");
      }
      if (this.multipleSelection.length == 0) {
        return this.$message("请选择需要质检的文件");
      }
      if (this.formInline.uploadType == "v1") {
  const data = await dataUpload_selectCoords();
  if (data.code != 200) {
    this.$message.error("坐标系列表获取失败");
    return;
  }
  this.coordinateOption = data.result;
  this.formInline.coordinateId = this.coordinateOption[0].epsgcode;
},
//WBS数据选择
setWBSFile() {
  $("#wbsDataFile").click();
},
//重置WPS选择
restWBSFile() {
  this.formInline.wbsData = "请选择WBS数据";
  document.getElementById("wbsDataFile").value = "";
},
//WBS数据Change事件
handleWBSFileChange(event) {
  var std = [];
  var len = event.currentTarget.files.length;
  for (var i = 0; i < len; i++) {
    var f = event.currentTarget.files[i];
    std.push(f.name);
  }
  this.formInline.wbsData = std.toString();
},
//数据质检弹窗关闭--项目整体
handleTestQuayCloseDown() {
  this.$confirm("确认关闭?")
    .then((_) => {
      this.closeTestQuayCloseDialog();
    })
    .catch((_) => {
    });
},
closeTestQuayCloseDialog() {
  this.testQuayVisible = false;
},
//数据质检弹窗关闭--单文件
handleQuayTestCloseDown() {
  this.$confirm("确认关闭?")
    .then((_) => {
      this.closeQuayTestCloseDialog();
    })
    .catch((_) => {
    });
},
closeQuayTestCloseDialog() {
  this.quayTestVisible = false;
},
//数据质检点击事件
handleQuayTestClick() {
  if (this.pathBak == null) {
    return this.$message("无质检方案");
  }
  if (this.multipleSelection.length == 0) {
    return this.$message("请选择需要质检的文件");
  }
  if (this.formInline.uploadType == "v1") {
        var value = this.getCheckedKeys
        var fileType = value.data.fullName;
        this.quayTestForms.names = fileType;
        this.quayTestForms.sjzy = this.formInline.specialtyId;
        this.quayTestVisible = true;
      } else if (this.formInline.uploadType == "v2") {
        var fileZip = [];
        var fileExcel = [];
        for (var i in this.multipleSelection) {
          if (this.multipleSelection[i].name.indexOf(".zip") != -1) {
            fileZip.push(this.multipleSelection[i].name);
          } else if (this.multipleSelection[i].name.indexOf(".xls") != -1) {
            fileExcel.push(this.multipleSelection[i].name);
          } else if (this.multipleSelection[i].name.indexOf(".xlsx") != -1) {
            fileExcel.push(this.multipleSelection[i].name);
          }
        }
        if (fileZip.length != 1) {
          return this.$message("请选择一个整体项目文件");
        }
        if (fileExcel.length != 1) {
          return this.$message("请选择一个WBS文件");
        }
        this.formCheckAll.names = JSON.parse(this.pathBak).toString();
        var val = this.entryOption.filter((res) => {
          if (res.id == this.formInline.dirid) {
            return res;
          }
        });
        this.formCheckAll.xmmc = val[0].name;
        this.formCheckAll.sjzy = this.formInline.specialtyId;
        if (this.formCheckAll.sjzy.indexOf("地灾") != -1) {
          this.formCheckAll.isDiZai = "YES";
          this.formCheckAll.diZaiType = this.disOptions[0].value;
        } else {
          this.formCheckAll.isDiZai = "NO";
          this.formCheckAll.diZaiType = "NO";
        }
        this.testQuayVisible = true;
    var value = this.getCheckedKeys
    var fileType = value.data.fullName;
    this.quayTestForms.names = fileType;
    this.quayTestForms.sjzy = this.formInline.specialtyId;
    this.quayTestVisible = true;
  } else if (this.formInline.uploadType == "v2") {
    var fileZip = [];
    var fileExcel = [];
    for (var i in this.multipleSelection) {
      if (this.multipleSelection[i].name.indexOf(".zip") != -1) {
        fileZip.push(this.multipleSelection[i].name);
      } else if (this.multipleSelection[i].name.indexOf(".xls") != -1) {
        fileExcel.push(this.multipleSelection[i].name);
      } else if (this.multipleSelection[i].name.indexOf(".xlsx") != -1) {
        fileExcel.push(this.multipleSelection[i].name);
      }
    },
    }
    if (fileZip.length != 1) {
      return this.$message("请选择一个整体项目文件");
    }
    if (fileExcel.length != 1) {
      return this.$message("请选择一个WBS文件");
    }
    this.formCheckAll.names = JSON.parse(this.pathBak).toString();
    var val = this.entryOption.filter((res) => {
      if (res.id == this.formInline.dirid) {
        return res;
      }
    });
    this.formCheckAll.xmmc = val[0].name;
    this.formCheckAll.sjzy = this.formInline.specialtyId;
    if (this.formCheckAll.sjzy.indexOf("地灾") != -1) {
      this.formCheckAll.isDiZai = "YES";
      this.formCheckAll.diZaiType = this.disOptions[0].value;
    } else {
      this.formCheckAll.isDiZai = "NO";
      this.formCheckAll.diZaiType = "NO";
    }
    this.testQuayVisible = true;
  }
},
    //上传数据列表清单删除
    async setWarehouseDel() {
      this.loading = true;
      var std = [];
      for (var i in this.multipleDelete) {
        std.push(this.multipleDelete[i].id);
      }
  this.loading = true;
  var std = [];
  for (var i in this.multipleDelete) {
    std.push(this.multipleDelete[i].id);
  }
      const res = await dataUpload_deleteMetas({ ids: std.toString() });
      this.loading = false;
      if (res.code != 200) {
        this.$message.error("删除失败");
      } else {
        this.$message({
          message: "删除成功",
          type: "success",
        });
        this.setStartWareTable();
      }
    },
    //上传数据列表清单查询
    setWarehouseSearch() {
      this.listData = {
        pageIndex: 1,
        pageSize: 10,
        name: this.formWarehousing.name,
      };
      this.getAllWareTable();
    },
    //上传数据列表重置
    setWarehouseReset() {
      this.formWarehousing.name = "";
      this.listData = {
        pageIndex: 1,
        pageSize: 10,
        name: null,
      };
      this.getAllWareTable();
    },
    //格式化时间
    changetimeFile(res) {
      var time = new Date(res.createTime);
      var y = time.getFullYear();
      var m = time.getMonth() + 1;
      var d = time.getDate();
      var h = time.getHours();
      var mm = time.getMinutes();
      var s = time.getSeconds();
      return (
        y +
        "-" +
        this.add0(m) +
        "-" +
        this.add0(d) +
        " " +
        h +
        ":" +
        mm +
        ":" +
        s
      );
    },
    //格式化时间
    add0(m) {
      return m < 10 ? "0" + m : m;
    },
    //大小值改变
    changeSizeFile(row, column, cellValue, index) {
      if (cellValue >= 1024) {
        return parseFloat(cellValue / 1204).toFixed(3) + "GB";
      } else {
        return cellValue + "MB";
      }
    },
    //上传数据列表清单选择
    handleDelteChange(val) {
      this.multipleDelete = val;
    },
    //上传数据列表清单初始化
    setStartWareTable() {
      // this.listData = {
      //   pageIndex: 1,
      //   pageSize: 10,
      //   name: null,
      // };
      this.listData.pageIndex = 1;
      this.listData.name = null;
      this.getAllWareTable();
    },
  const res = await dataUpload_deleteMetas({ ids: std.toString() });
  this.loading = false;
  if (res.code != 200) {
    this.$message.error("删除失败");
  } else {
    this.$message({
      message: "删除成功",
      type: "success",
    });
    this.setStartWareTable();
  }
},
//上传数据列表清单查询
setWarehouseSearch() {
  this.listData = {
    pageIndex: 1,
    pageSize: 10,
    name: this.formWarehousing.name,
  };
  this.getAllWareTable();
},
//上传数据列表重置
setWarehouseReset() {
  this.formWarehousing.name = "";
  this.listData = {
    pageIndex: 1,
    pageSize: 10,
    name: null,
  };
  this.getAllWareTable();
},
//格式化时间
changetimeFile(res) {
  var time = new Date(res.createTime);
  var y = time.getFullYear();
  var m = time.getMonth() + 1;
  var d = time.getDate();
  var h = time.getHours();
  var mm = time.getMinutes();
  var s = time.getSeconds();
  return (
    y +
    "-" +
    this.add0(m) +
    "-" +
    this.add0(d) +
    " " +
    h +
    ":" +
    mm +
    ":" +
    s
  );
},
//格式化时间
add0(m) {
  return m < 10 ? "0" + m : m;
},
//大小值改变
changeSizeFile(row, column, cellValue, index) {
  if (cellValue >= 1024) {
    return parseFloat(cellValue / 1204).toFixed(3) + "GB";
  } else {
    return cellValue + "MB";
  }
},
//上传数据列表清单选择
handleDelteChange(val) {
  this.multipleDelete = val;
},
//上传数据列表清单初始化
setStartWareTable() {
  // this.listData = {
  //   pageIndex: 1,
  //   pageSize: 10,
  //   name: null,
  // };
  this.listData.pageIndex = 1;
  this.listData.name = null;
  this.getAllWareTable();
},
    //获取数据上传列表清单
    async getAllWareTable() {
      const res = await dataUpload_selectByPageForUpload(this.listData);
      if (res.code != 200) {
        this.$message.error("列表数据获取失败");
        return;
      }
      this.count = res.count;
      this.waretableData = res.result;
    },
    //数据上传列表清单page Count 切换
    handleSizeChange(val) {
      this.listData.pageIndex = 1;
      this.listData.pageSize = val;
      this.getAllWareTable();
    },
  const res = await dataUpload_selectByPageForUpload(this.listData);
  if (res.code != 200) {
    this.$message.error("列表数据获取失败");
    return;
  }
  this.count = res.count;
  this.waretableData = res.result;
},
//数据上传列表清单page Count 切换
handleSizeChange(val) {
  this.listData.pageIndex = 1;
  this.listData.pageSize = val;
  this.getAllWareTable();
},
    //数据上传列表清单page切换
    handleCurrentChange(val) {
      this.listData.pageIndex = val;
      this.getAllWareTable();
    },
    //上传数据表格选择
    handleSelectionChange(res) {
      this.multipleSelection = res;
    },
//数据上传列表清单page切换
handleCurrentChange(val) {
  this.listData.pageIndex = val;
  this.getAllWareTable();
},
//上传数据表格选择
handleSelectionChange(res) {
  this.multipleSelection = res;
},
    //选择数据文件切换
    handleSelectFileChange(event) {
      var std = [];
      var len = event.currentTarget.files.length;
      for (var i = 0; i < len; i++) {
        var f = event.currentTarget.files[i];
        std.push(f.name);
      }
      this.formInline.specialtyData = std.toString();
    },
    //选择元数据
    setMetaFile() {
      $("#metaDataFile").click();
    },
    //重置元数据
    restMetaFile() {
      this.formInline.metaData = "请选择元数据";
      document.getElementById("metaDataFile").value = "";
    },
    //选择元数据文件切换
    handleMetaFileChange(event) {
      var std = [];
      var len = event.currentTarget.files.length;
      for (var i = 0; i < len; i++) {
        var f = event.currentTarget.files[i];
        std.push(f.name);
      }
      this.formInline.metaData = std.toString();
      this.metaFileData = std;
    },
//选择数据文件切换
handleSelectFileChange(event) {
  var std = [];
  var len = event.currentTarget.files.length;
  for (var i = 0; i < len; i++) {
    var f = event.currentTarget.files[i];
    std.push(f.name);
  }
  this.formInline.specialtyData = std.toString();
},
//选择元数据
setMetaFile() {
  $("#metaDataFile").click();
},
//重置元数据
restMetaFile() {
  this.formInline.metaData = "请选择元数据";
  document.getElementById("metaDataFile").value = "";
},
//选择元数据文件切换
handleMetaFileChange(event) {
  var std = [];
  var len = event.currentTarget.files.length;
  for (var i = 0; i < len; i++) {
    var f = event.currentTarget.files[i];
    std.push(f.name);
  }
  this.formInline.metaData = std.toString();
  this.metaFileData = std;
},
    //From表单初始化
    setFromStart() {
      this.formInline.verid = null;
      this.formInline.specialtyId = "测量专业";
      this.formInline.specialtyData = "请选择数据";
      this.formInline.metaData = "请选择元数据";
      this.formInline.entryId = null;
      this.formInline.selectFileType = "*.*";
      this.formInline.coordinateId = this.coordinateOption[0].epsgcode;
      this.formInline.medium = "";
      this.formInline.tab = "";
    },
    //选择数据
    setSelectFile() {
      $("#selectDataFile").click();
    },
    //重置数据
    restSelectFile() {
      this.formInline.specialtyData = "请选择数据";
      document.getElementById("selectDataFile").value = "";
    },
    //入库类型切换
    uploadTypeChange(res) {
      this.setFromStart();
      if (res == "v2") {
        this.uploadFlag = false;
        this.formInline.selectFileType = ".zip";
        this.formInline.entryId = this.entryOption[0].name;
        this.formInline.dirid = this.entryOption[0].id;
        this.getselectVerByDirid();
        this.pathBak = this.entryOption[0].checks;
      } else if (res == "v3") {
        this.formInline.selectFileType = ".kml";
        this.getSelectdirTab();
        this.getselectVerByDirid();
        this.formInline.specialtyId = "线路专业";
        this.uploadFlag = true;
        this.formInline.tab = this.lineOptions[0].value;
        this.formInline.medium = this.mediumOptions[0].value
      } else {
        this.getSelectdirTab();
        this.getselectVerByDirid();
        this.uploadFlag = true;
      }
      this.formInline.uploadType = res;
    },
//From表单初始化
setFromStart() {
  this.formInline.verid = null;
  this.formInline.specialtyId = "测量专业";
  this.formInline.specialtyData = "请选择数据";
  this.formInline.metaData = "请选择元数据";
  this.formInline.entryId = null;
  this.formInline.selectFileType = "*.*";
  this.formInline.coordinateId = this.coordinateOption[0].epsgcode;
  this.formInline.medium = "";
  this.formInline.tab = "";
},
//选择数据
setSelectFile() {
  $("#selectDataFile").click();
},
//重置数据
restSelectFile() {
  this.formInline.specialtyData = "请选择数据";
  document.getElementById("selectDataFile").value = "";
},
//入库类型切换
uploadTypeChange(res) {
  this.setFromStart();
  if (res == "v2") {
    this.uploadFlag = false;
    this.formInline.selectFileType = ".zip";
    this.formInline.entryId = this.entryOption[0].name;
    this.formInline.dirid = this.entryOption[0].id;
    this.getselectVerByDirid();
    this.pathBak = this.entryOption[0].checks;
  } else if (res == "v3") {
    this.formInline.selectFileType = ".kml";
    this.getSelectdirTab();
    this.getselectVerByDirid();
    this.formInline.specialtyId = "线路专业";
    this.uploadFlag = true;
    this.formInline.tab = this.lineOptions[0].value;
    this.formInline.medium = this.mediumOptions[0].value
  } else {
    this.getSelectdirTab();
    this.getselectVerByDirid();
    this.uploadFlag = true;
  }
  this.formInline.uploadType = res;
},
    //版本号获取
    async getselectVerByDirid() {
      this.verOption = [];
  this.verOption = [];
      const res = await dataUploadSelectVerByDirid({
        dirid: this.formInline.dirid,
      });
  const res = await dataUploadSelectVerByDirid({
    dirid: this.formInline.dirid,
  });
      if (res.code != 200) {
        this.$message.error("版本列表获取失败");
        return;
      }
      this.verOption = res.result;
      this.formInline.verid = res.result[0].id;
    },
  if (res.code != 200) {
    this.$message.error("版本列表获取失败");
    return;
  }
  this.verOption = res.result;
  this.formInline.verid = res.result[0].id;
},
    //目录列表获取
    async getSelectdirTab() {
      const res = await selectdirTab();
      if (res.code != 200) {
        this.$message.error("目录列表获取失败");
        return;
      }
  const res = await selectdirTab();
  if (res.code != 200) {
    this.$message.error("目录列表获取失败");
    return;
  }
      this.catalogOption = this.treeData(res.result);
      this.formInline.dirName = this.catalogOption[0].name;
      this.formInline.dirid = this.catalogOption[0].id;
      // this.getStartDirChecked(this.catalogOption);
      this.getselectVerByDirid();
    },
  this.catalogOption = this.treeData(res.result);
  this.formInline.dirName = this.catalogOption[0].name;
  this.formInline.dirid = this.catalogOption[0].id;
  // this.getStartDirChecked(this.catalogOption);
  this.getselectVerByDirid();
},
    getStartDirChecked(res) {
      if (res.length != 0) {
        if (res[0].children == null || res[0].children == undefined) {
          this.formInline.dirid = res[0].id;
        } else {
          this.getStartDirChecked(res[0].children);
        }
      }
    },
    //单文件质检弹窗初始化
    startQuayTestForms() {
      (this.quayTestForms = {
        tolerance: "0.001",
        gcdOffset: "20",
        rangeOffset: "200",
        kzdOffset: "100",
        xgMax: "0.005",
        coordinateSystem: "CGCS2000/degree",
        imgResolution: "0.2",
        demTolerance: "5",
        demChangeRate: "200",
        lazDensity: "1",
        imgResolution: "0.2",
      }),
        (this.quayTestShow = {
          checkOsgb: false,
          checkXls: false,
          checkLaz: false,
          checkDem: false,
          checkAttrs: false,
          checkTopology: false,
          checkDecorate: false,
          checkOrigin: false,
          checkDom: false,
          checkMath: false,
          checkMeta: false,
          checkMain: false,
        });
    },
    //目录切换
    catalogChange(data, node, nodeData) {
      this.startQuayTestForms();
      // this.$refs['selectcascader'].dropDownVisible = false
      // var value = this.$refs['selectcascader'].getCheckedNodes();
getStartDirChecked(res) {
  if (res.length != 0) {
    if (res[0].children == null || res[0].children == undefined) {
      this.formInline.dirid = res[0].id;
    } else {
      this.getStartDirChecked(res[0].children);
    }
  }
},
//单文件质检弹窗初始化
startQuayTestForms() {
  (this.quayTestForms = {
    tolerance: "0.001",
    gcdOffset: "20",
    rangeOffset: "200",
    kzdOffset: "100",
    xgMax: "0.005",
    coordinateSystem: "CGCS2000/degree",
    imgResolution: "0.2",
    demTolerance: "5",
    demChangeRate: "200",
    lazDensity: "1",
    imgResolution: "0.2",
  }),
    (this.quayTestShow = {
      checkOsgb: false,
      checkXls: false,
      checkLaz: false,
      checkDem: false,
      checkAttrs: false,
      checkTopology: false,
      checkDecorate: false,
      checkOrigin: false,
      checkDom: false,
      checkMath: false,
      checkMeta: false,
      checkMain: false,
    });
},
//目录切换
catalogChange(data, node, nodeData) {
  this.startQuayTestForms();
  // this.$refs['selectcascader'].dropDownVisible = false
  // var value = this.$refs['selectcascader'].getCheckedNodes();
      var bak = node.data.checks;
      this.getCheckedKeys = node
      this.pathBak = bak;
      if (bak != null) {
        for (var key in this.quayTestShow) {
          if (bak.indexOf(key) != -1) {
            this.quayTestShow[key] = true;
          }
        }
  var bak = node.data.checks;
  this.getCheckedKeys = node
  this.pathBak = bak;
  if (bak != null) {
    for (var key in this.quayTestShow) {
      if (bak.indexOf(key) != -1) {
        this.quayTestShow[key] = true;
      }
      var fileType = node.data.exts;
      if (fileType == null) {
        fileType = "*.*";
      }
      this.formInline.selectFileType = fileType;
      this.formInline.dirid = node.data.id;
      this.formInline.dirName = node.data.name;
      this.getselectVerByDirid();
      setTimeout(() => {
        this.$refs.multiSelect.blur()
      }, 100)
    },
    //Tabsq切换
    handleTabClick(tab, event) {
      if (tab.name == "second") {
        this.setStartWareTable();
      } else {
        this.noteVisible = true
      }
      this.calHeight();
    },
    //树列表生成
    treeData(source) {
      let cloneData = JSON.parse(JSON.stringify(source)); // 对源数据深度克隆
      return cloneData.filter((father) => {
        // 循环所有项
        let branchArr = cloneData.filter((child) => father.id == child.pid); // 对比ID,分别上下级菜单,并返回数据
        branchArr.length > 0 ? (father.children = branchArr) : ""; // 给父级添加一个children属性,并赋值
        return father.pid == 0; // 返回一级菜单
      });
    },
    }
  }
  var fileType = node.data.exts;
  if (fileType == null) {
    fileType = "*.*";
  }
  this.formInline.selectFileType = fileType;
  this.formInline.dirid = node.data.id;
  this.formInline.dirName = node.data.name;
  this.getselectVerByDirid();
  setTimeout(() => {
    this.$refs.multiSelect.blur()
  }, 100)
},
//Tabsq切换
handleTabClick(tab, event) {
  if (tab.name == "second") {
    this.setStartWareTable();
  } else {
    this.noteVisible = true
  }
  this.calHeight();
},
//树列表生成
treeData(source) {
  let cloneData = JSON.parse(JSON.stringify(source)); // 对源数据深度克隆
  return cloneData.filter((father) => {
    // 循环所有项
    let branchArr = cloneData.filter((child) => father.id == child.pid); // 对比ID,分别上下级菜单,并返回数据
    branchArr.length > 0 ? (father.children = branchArr) : ""; // 给父级添加一个children属性,并赋值
    return father.pid == 0; // 返回一级菜单
  });
},
  },
};
</script>