管道基础大数据平台系统开发-【前端】-新系統界面
1
Surpriseplus
2023-02-13 6d5f52522f19ff17991e2ffe90a52e42ace416b9
src/views/datamanage/dataUpdata.vue
@@ -30,6 +30,7 @@
                :disabled="tableData.length == 0 ? false : true"
                v-model="formInline.uploadType"
                @change="uploadTypeChange"
                :popper-append-to-body="false"
                placeholder="请选择"
              >
                <el-option
@@ -45,14 +46,33 @@
              v-show="uploadFlag"
              :label="$t('dataManage.dataUpObj.storageDirectory')"
            >
              <el-cascader
              <el-select
                :popper-append-to-body="false"
                v-model="formInline.dirName"
                :disabled="tableData.length == 0 ? false : true"
              >
                <el-option
                  :value="formInline.dirid"
                  :label="formInline.dirName"
                  style=" height:auto"
                >
                  <el-tree
                    ref="tree"
                    :data="catalogOption"
                    node-key="id"
                    :props="cascader"
                    @node-click="catalogChange"
                  />
                </el-option>
              </el-select>
              <!-- <el-cascader
                :disabled="tableData.length == 0 ? false : true"
                v-model="formInline.dirid"
                :options="catalogOption"
                @change="catalogChange"
                ref="selectcascader"
                :props="cascader"
              ></el-cascader>
              ></el-cascader>  -->
            </el-form-item>
            <!-- 项目名称 -->
            <el-form-item
@@ -60,6 +80,7 @@
              :label="$t('dataManage.dataUpObj.entryName')"
            >
              <el-select
                :popper-append-to-body="false"
                :disabled="tableData.length == 0 ? false : true"
                v-model="formInline.entryId"
                @change="entryNameChange"
@@ -76,6 +97,7 @@
            <!-- 数据版本 -->
            <el-form-item :label="$t('dataManage.dataUpObj.dataVersion')">
              <el-select
                :popper-append-to-body="false"
                :disabled="tableData.length == 0 ? false : true"
                v-model="formInline.verid"
                :placeholder="$t('common.choose')"
@@ -92,6 +114,7 @@
            <!-- 数据专业 -->
            <el-form-item :label="$t('dataManage.dataUpObj.dataSpecialty')">
              <el-select
                :popper-append-to-body="false"
                :disabled="tableData.length == 0 ? false : true"
                v-model="formInline.specialtyId"
                :placeholder="$t('common.choose')"
@@ -108,6 +131,7 @@
            <!-- 坐标系 -->
            <el-form-item :label="$t('dataManage.dataUpObj.coordinateSystem')">
              <el-select
                :popper-append-to-body="false"
                :disabled="tableData.length == 0 ? false : true"
                v-model="formInline.coordinateId"
                :placeholder="$t('common.choose')"
@@ -368,6 +392,16 @@
                size="small"
              >{{ $t('common.delete') }}</el-button>
            </el-form-item>
            <el-form-item>
              <el-button
                v-if="menuStatus.upload"
                :disabled="multipleDelete.length == 0 ? true : false"
                @click="setEnclosure"
                icon="el-icon-folder-opened"
                type="warning"
                size="small"
              >{{ $t('common.enclosure') }}</el-button>
            </el-form-item>
          </el-form>
        </div>
        <div
@@ -432,7 +466,10 @@
                :label="$t('dataManage.dataUpObj.tableName')"
              >
                <template slot-scope="scope">
                  <a @click="detail(scope.row)">{{ scope.row.tab }}</a>
                  <a
                    class="scopeRowColor"
                    @click="detail(scope.row)"
                  >{{ scope.row.tab }}</a>
                </template>
              </el-table-column>
              <el-table-column
@@ -946,6 +983,54 @@
      </div>
    </el-dialog>
    <el-dialog
      :close-on-click-modal="false"
      title="上传进度"
      :visible.sync="jindudialogVisible"
      width="30%"
    >
      <div>
        <div>
          文件传输进度:
        </div>
        <div>
          <el-progress
            :percentage="jindutiao"
            :format="format"
          ></el-progress>
        </div>
      </div>
    </el-dialog>
    <el-dialog
      :title="$t('common.details')"
      :visible.sync="enclosureVisible"
      :show-close="false"
    >
      <span
        style="font-size:20px"
        class="scopeRowColor"
      >{{enclosureTitle}}不能上传附件是否继续</span>
      <span
        slot="footer"
        class="dialog-footer"
      >
        <el-button @click="enclosureVisible = false">取 消</el-button>
        <el-button
          type="primary"
          @click="uploadAnFiles"
        >继续</el-button>
      </span>
    </el-dialog>
    <input
      name="file1"
      :accept="'.zip'"
      type="file"
      id="editimageFile"
      multiple="multiple"
      style="display: none"
      @change="uploadAnFilesChange"
    />
  </div>
</template>
@@ -978,6 +1063,7 @@
  },
  data() {
    return {
      coordinateOption: [],
      disOptions: [{
        name: '崩塌治理',
@@ -1129,6 +1215,12 @@
        download: false,
      },
      jindutiao: 0,
      jindudialogVisible: false,
      jindutiaoname: [],
      enclosureData: [],
      enclosureVisible: false,
      enclosureTitle: '',
    }
  },
@@ -1148,6 +1240,109 @@
  },
  methods: {
    //附件变化
    uploadAnFilesChange() {
      var formData = new FormData();
      var fs = document.getElementById("editimageFile");
      if (fs.files.length == 0) {
        this.$message.error('请选择要上传的文件');
        return;
      }
      for (var i = 0, c = fs.files.length; i < c; i++) {
        formData.append("file", fs.files[i]); // fs.files[i].name,file
      }
      for (var i in this.enclosureData) {
        formData.append('ids', this.enclosureData[i])
      }
    const that = this
      that.jindudialogVisible = true
      that.$set(this, 'jindutiaoname', "附件上传")
      that.$set(this, 'jindutiao', 0)
      this.loading = true;
      $.ajax(BASE_URL + "/dataUpload/uploadXlsAnnex?token=" + getToken() + "&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.$set(this, 'jindutiao', 100)
          this.$message({
            message: '附件上传成功',
            type: 'success'
          });
        },
        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使用
        }
      });
    },
    //选择上传附件的文件
    uploadAnFiles() {
      $('#editimageFile').click();
    },
    //上传附件
    uploadAnnex() {
    },
    //附件上传
    setEnclosure() {
      var enclosureData = [
        'bd.b_pac_hydrogeology',
        'bd.b_pac_frozensoil',
        'bd.b_pac_geologic_hazard',
        'bd.b_pac_marine_meteorological',
        'bd.b_pac_meteorological',
        'bs.m_equipment_nameplate',
        'bs.m_hydraulic_protection',
        'bs.m_marker',
        'bs.s_borehole'
      ];
      var std = [];
      this.enclosureData = [];
      this.enclosureTitle = "";
      for (var i in this.multipleDelete) {
        var row = this.multipleDelete[i];
        if (row.tab && row.rows && enclosureData.indexOf(row.tab) > -1) {
          this.enclosureData.push(row.id)
        } else {
          std.push(row.name)
        }
      }
      if (std.length != 0) {
        this.enclosureTitle = std.toString()
        this.enclosureVisible = true;
      } else {
        this.uploadAnFiles();
      }
    },
    //权限配置
    showPermsMenu(res) {
      switch (res.tag) {
@@ -1753,6 +1948,16 @@
          }
        }
      }
      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",
@@ -1767,6 +1972,7 @@
            return this.$message.error('数据上传失败');
          }
          this.getFileLength();
          this.$set(this, 'jindutiao', 100)
          this.$message({
            message: '上传成功',
            type: 'success'
@@ -1776,8 +1982,26 @@
        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使用
        }
      });
    },
    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}%`;
    },
    //获取文件上传路径
    async getFilePath() {
@@ -1809,6 +2033,7 @@
      this.entryOption = data.result;
      this.formInline.entryId = this.entryOption[0].name;
      this.formInline.dirid = this.entryOption[0].id;
      this.getselectVerByDirid();
    },
    //获取所有坐标系
@@ -2117,6 +2342,7 @@
        return;
      }
      this.catalogOption = this.treeData(res.result);
      this.formInline.dirName = this.catalogOption[0].name
      this.getStartDirChecked(this.catalogOption);
      this.getselectVerByDirid()
    },
@@ -2161,12 +2387,12 @@
        }
    },
    //目录切换
    catalogChange(res) {
    catalogChange(data, node, nodeData) {
      this.startQuayTestForms();
      this.$refs['selectcascader'].dropDownVisible = false
      var value = this.$refs['selectcascader'].getCheckedNodes();
      // this.$refs['selectcascader'].dropDownVisible = false
      // var value = this.$refs['selectcascader'].getCheckedNodes();
      var bak = value[0].data.bak;
      var bak = node.data.bak;
      this.pathBak = bak;
      if (bak != null) {
        for (var key in this.quayTestShow) {
@@ -2175,12 +2401,13 @@
          }
        }
      }
      var fileType = value[0].data.code;
      var fileType = node.data.code;
      if (fileType == null) {
        fileType = "*.*"
      }
      this.formInline.selectFileType = fileType;
      this.formInline.dirid = res;
      this.formInline.dirid = node.data.id;
      this.formInline.dirName = node.data.name
      this.getselectVerByDirid();
    },
    //Tabsq切换
@@ -2202,3 +2429,4 @@
  }
};
</script>