maxiaoxiao 8 mesi fa
parent
commit
ae6cb2210f
2 ha cambiato i file con 57 aggiunte e 6 eliminazioni
  1. 12 0
      src/api/supervise/pcsj.js
  2. 45 6
      src/views/remote/satellite/index.vue

+ 12 - 0
src/api/supervise/pcsj.js

@@ -1,5 +1,17 @@
 import request from '@/utils/request'
 
+
+export function tiffUpload(parameter) {
+  return request({
+    url: '/file/uploadSpotZip',
+    method: 'post',
+    data: parameter,
+    headers: {
+      'Content-Type': 'application/json;charset=UTF-8'
+    }
+  })
+}
+
 // 查询监管批次数据列表
 export function listPcsj(query) {
   return request({

+ 45 - 6
src/views/remote/satellite/index.vue

@@ -60,8 +60,32 @@
       </el-form-item>
     </el-form>
 
-    <!-- <el-row :gutter="10" class="mb8">
+    <el-row :gutter="10" class="mb8">
       <el-col :span="1.5">
+        <el-upload
+          class="upload-demo"
+          :on-change="handleChange"
+          :auto-upload="false"
+          :show-file-list="false"
+          :file-list="fileList"
+          :limit="1"
+          accept=".zip"
+        >
+          <el-button class="upload-btn" icon="Upload" size="mini"
+            >上传</el-button
+          >
+        </el-upload>
+        <el-tooltip
+          v-if="fileList.length > 0"
+          :content="fileList[0].name"
+          placement="bottom-start"
+        >
+          <span class="title-item" style="display: inline-block; width: 100%">{{
+            fileList[0].name
+          }}</span>
+        </el-tooltip>
+      </el-col>
+      <!-- <el-col :span="1.5">
         <el-button
           type="primary"
           plain
@@ -110,8 +134,8 @@
       <right-toolbar
         :showSearch.sync="showSearch"
         @queryTable="getList"
-      ></right-toolbar>
-    </el-row> -->
+      ></right-toolbar> -->
+    </el-row>
 
     <el-table
       v-loading="loading"
@@ -237,8 +261,8 @@ import {
   delPcsj,
   addPcsj,
   updatePcsj,
+  tiffUpload,
 } from "@/api/supervise/pcsj";
-
 export default {
   name: "Pcsj",
   data() {
@@ -298,14 +322,29 @@ export default {
       },
       // 表单校验
       rules: {},
+      fileList: [],
     };
   },
   created() {
     this.getList();
   },
   methods: {
+    //上传文件
+    handleChange(file, fileList) {
+      if (fileList.length > 0) {
+        this.fileList = [fileList[fileList.length - 1]]; //这一步,是展示最后一次选择文件
+        this.reset();
+      }
+      const formdata = new FormData();
+      formdata.append("file", file.raw);
+      tiffUpload(formdata).then((res) => {
+        if (res.success) {
+          this.$message(res.message)
+        }
+      });
+    },
     handleDownload(row) {
-      const zipfile =  row.proxypath+".zip";
+      const zipfile = row.proxypath + ".zip";
       window.open(`${zipfile}`);
     },
     /** 查询监管批次数据列表 */
@@ -368,7 +407,7 @@ export default {
     },
     // 浏览按钮
     handleBrowse(row) {
-      this.$router.push({ path: "/remote/gdjc" ,query: { id: row.id}});
+      this.$router.push({ path: "/remote/gdjc", query: { id: row.id } });
     },
 
     /** 修改按钮操作 */