管道基础大数据平台系统开发-【前端】-新系統界面
Surpriseplus
2023-02-09 731d894cf232d98b547df2bd006795de74fb16a7
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,8 @@
            <!-- 数据专业 -->
            <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 +132,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')"
@@ -946,6 +971,25 @@
      </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>
  </div>
</template>
@@ -1129,6 +1173,9 @@
        download: false,
      },
      jindutiao: 0,
      jindudialogVisible: false,
      jindutiaoname: []
    }
  },
@@ -1753,6 +1800,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 +1824,7 @@
            return this.$message.error('数据上传失败');
          }
          this.getFileLength();
          this.$set(this, 'jindutiao', 100)
          this.$message({
            message: '上传成功',
            type: 'success'
@@ -1776,8 +1834,25 @@
        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() {
@@ -2161,12 +2236,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 +2250,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 +2278,4 @@
  }
};
</script>