管道基础大数据平台系统开发-【前端】-新系統界面
1
Surpriseplus
2022-11-20 55f462d25f87c4002a98fd14911df7b406225553
1
已修改4个文件
175 ■■■■ 文件已修改
src/api/api.js 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/lang/en.js 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/lang/zh.js 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/datamanage/dataUpdata.vue 159 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/api.js
@@ -480,6 +480,19 @@
  return request.get('/user/selectByPageAndCount', { params: params });
}
//数据上传=>获取版本Id
export function dataUploadSelectVerByDirid(params) {
  return request.get('/dataUpload/selectVerByDirid', { params: params });
}
//数据上传=>获取文件上传路径
export function dataUploadSelectPath(params) {
  return request.get('/dataUpload/selectPath', { params: params });
}
// //数据上传=>文件上传
// export function dataUploadinsertFiles(params) {
//   return request.post('/dataUpload/insertFiles', params);
// }
//请求站场点内容
export function querySitePoint(size, index, name) {
  return service.get(
src/assets/lang/en.js
@@ -54,6 +54,7 @@
      catalogDescription: 'Catalog Description',
      catalogRemarks: 'Catalog Remarks',
      newDirectory: 'New Directory',
      versionNo: 'Version No',
    },
    metadataManage: 'metadataManage',
src/assets/lang/zh.js
@@ -58,6 +58,8 @@
      catalogRemarks: '目录备注',
      newDirectory: '新增目录',
      versionNo: '版本号',
    },
    metadataManage: '元数据管理',
    dataLoading: '数据入库',
src/views/datamanage/dataUpdata.vue
@@ -14,7 +14,7 @@
        <el-form :inline="true" :model="formInline" class="demo-form-inline">
          <el-form-item :label="$t('dataManage.dataUpObj.catalogue')">
            <el-cascader
              v-model="formInline.catalog"
              v-model="formInline.dirid"
              :options="catalogOption"
              @change="catalogChange"
              :props="cascader"
@@ -22,15 +22,25 @@
          </el-form-item>
          <el-form-item :label="$t('dataManage.dataUpObj.company')">
            <el-cascader
              v-model="formInline.company"
              v-model="formInline.depid"
              :options="companyOption"
              @change="companyChange"
              :props="cascader"
            ></el-cascader>
          </el-form-item>
          <el-form-item :label="$t('dataManage.dataUpObj.versionNo')">
              <el-select v-model="formInline.verid" :placeholder="$t('common.choose')">
              <el-option
                v-for="item in verOption"
                :key="item.id"
                :label="item.name"
                :value="item.id">
              </el-option>
              </el-select>
          </el-form-item>
          <el-form-item :label="$t('dataManage.dataUpObj.entryTime')">
            <el-date-picker
              v-model.trim="formInline.monitorTime"
              v-model.trim="formInline.gather"
              :picker-options="pickerOptions"
              type="datetime"
              placeholder="请选择"
@@ -47,7 +57,7 @@
          <el-form-item :label="$t('dataManage.dataUpObj.describe')">
            <el-input
              type="textarea"
              v-model="formInline.desc"
              v-model="formInline.descr"
              maxlength="50"
              class="nm-skin-pretty"
              show-word-limit
@@ -124,7 +134,8 @@
<script>
import $ from 'jquery';
import MyBread from '../../components/MyBread.vue';
import { selectdirTab, queryDepTree } from '../../api/api';
import { removeToken, getToken } from '@/utils/auth';
import { selectdirTab, queryDepTree,dataUploadSelectVerByDirid,dataUploadSelectPath } from '../../api/api';
export default {
  name: 'dataUpdata',
  components: {
@@ -135,7 +146,8 @@
      btnStatus: 0,
      count: 0,
      formInline: {
        monitorTime: '',
        verid:'',
        gather: '',
      },
      catalogOption: [],
      companyOption: [],
@@ -153,6 +165,7 @@
        },
        selectableRange: '00:00:00 - 23:59:59',
      },
      verOption: [],
      cascader: {
        label: 'name',
        value: 'id',
@@ -168,9 +181,10 @@
    this.getQueryDepTree();
    this.timeDefault();
    this.getFilePath();
  },
  watch: {
    'detailData.monitorTime': {
    'detailData.gather': {
      handler(newValue, oldValue) {
        if (newValue) {
          let date = new Date();
@@ -184,7 +198,7 @@
          ) {
            let hh1 = moment(newValue).format('HH:mm:ss');
            if (hh1 > nowDate) {
              this.detailData.monitorTime = new Date();
              this.detailData.gather = new Date();
            }
            st = nowDate;
          } else {
@@ -200,15 +214,7 @@
  },
  methods: {
    //文件上传
    setFileUpload() {
      this.handlerLoading(true);
      setTimeout(() => {
        this.handlerLoading(false);
      }, 2000);
      this.getFileLength();
    },
    //数据删除
    setFileDelete() {
      this.handlerLoading(true);
@@ -224,7 +230,7 @@
        });
      });
      this.listData.pageIndex= 1;
      this.listData.pageIndex = 1;
      this.listData.pageSize = 10;
      this.count = this.listTable.length;
      this.setViewTable();
@@ -239,19 +245,7 @@
      }, 2000);
      this.getFilePath();
    },
    //获取文件上传路径
    getFilePath() {
      for (var i = 0; i < 20; i++) {
        this.listTable.push({
          id: i,
          name: 'value' + i
        })
      }
      this.count = this.listTable.length;
      this.listData.pageIndex = 1;
      this.listData.pageSize = 10;
      this.setViewTable();
    },
    //显示表格数据
    setViewTable() {
      var index = this.listData.pageIndex - 1;
@@ -262,11 +256,58 @@
        if (this.listTable[i] != null) {
          std.push(this.listTable[i])
        }
      }
      this.tableData = std;
    },
    //文件上传
    setFileUpload() {
      var token = getToken();
 var formData = new FormData();
 var val = document.getElementById("uploadfile").files;
      if (!val || !val.length) return;
      for (var i = 0; i < val.length; i++) {
        formData.append(val[i].name, val[i]);
      }
      formData.append("dirid",  this.formInline.dirid);
      formData.append("depid", this.formInline.depid);
      formData.append("verid",this.formInline.verid);
      formData.append("gather", this.formInline.gather);
      formData.append("descr", this.formInline.descr);
 $.ajax(BASE_URL+"dataUpload/uploadFiles?token="+token + "&path=" + this.formInline.path, {
        type: "post",
        data: formData,
        async: true,
        cache: false,
        processData: false,
        contentType: false,
        success: function (rs) {
          // document.getElementById("file1").value = "";
          // console.log(rs);
          alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result);
        },
        error: function (e) {
          // document.getElementById("file1").value = "";
          // console.error(e);
          alert("上传文件失败!");
        }
      });
    // const res = await dataUploadinsertFiles(formData);
   // debugger
      // this.handlerLoading(true);
      // setTimeout(() => {
      //   this.handlerLoading(false);
      // }, 2000);
      // this.getFileLength();
    },
    //获取文件上传数据
    getFileLength() {
@@ -276,6 +317,8 @@
      this.tableData = [];
      this.listTable = [];
    },
    //分页控制
    handleSizeChange(res) {
      this.listData.pageIndex = 1;
@@ -295,13 +338,8 @@
      $("#uploadfile").click();
    },
    handleFileChange() {
      var val = document.getElementById("uploadfile").files;
      if (!val || !val.length) return;
      var formData = new FormData();
      for (var i = 0; i < val.length; i++) {
        formData.append(val[i].name, val[i]);
      }
      console.log(formData)
    },
    //当前时间获取
    timeDefault() {
@@ -322,7 +360,7 @@
        minutes +
        sign2 +
        seconds;
      this.formInline.monitorTime = s1;
      this.formInline.gather = s1;
    },
    //Loading显隐
@@ -331,13 +369,22 @@
    },
    //目录切换
    catalogChange(value) {
      this.formInline.catalog = value;
      this.formInline.dirid = value;
      this.getselectVerByDirid();
    },
    //单位切换
    companyChange(value) {
      this.formInline.company = value;
      this.formInline.depid = value;
    },
 //获取文件上传路径
   async getFilePath() {
      const res = await dataUploadSelectPath();
    if (res.code != 200) {
        this.$message.error('单位列表获取失败');
        return;
      }
      this.formInline.path = res.result;
    },
    //单位列表获取
    async getQueryDepTree() {
      const res = await queryDepTree();
@@ -345,9 +392,24 @@
        this.$message.error('单位列表获取失败');
        return;
      }
      this.formInline.company = 1;
      this.formInline.depid = 1;
      this.companyOption = this.treeData(res.result);
    },
    //版本号获取
    async getselectVerByDirid() {
      this.verOption=[];
      this.formInline.verid ="";
      const res =  await dataUploadSelectVerByDirid(this.formInline.dirid);
      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();
@@ -355,8 +417,9 @@
        this.$message.error('目录列表获取失败');
        return;
      }
      this.formInline.catalog = 1;
      this.formInline.dirid = 1;
      this.catalogOption = this.treeData(res.result);
      this.getselectVerByDirid()
    },
    //树列表生成
    treeData(source) {
@@ -485,11 +548,11 @@
        /deep/.btn-next {
          background: transparent;
        }
         /deep/.btn-next i {
          color:white;
        /deep/.btn-next i {
          color: white;
        }
        /deep/.btn-prev i {
          color:white;
          color: white;
        }
      }
    }