From f8331485341314c3d0613079d4981887a111568c Mon Sep 17 00:00:00 2001
From: fuliqi <fuliqi@qq.com>
Date: 星期四, 24 十月 2024 17:20:03 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 src/api/platform/threshold.js                   |   13 +++++++++++++
 src/views/system/work-order/threshold/index.vue |   47 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 60 insertions(+), 0 deletions(-)

diff --git a/src/api/platform/threshold.js b/src/api/platform/threshold.js
index 45d254e..ef0f6b5 100644
--- a/src/api/platform/threshold.js
+++ b/src/api/platform/threshold.js
@@ -85,3 +85,16 @@
     data: data
   })
 }
+
+// 瀵煎叆
+export function importData(data) {
+  return request({
+    url: '/threshold/import',
+    method: 'post',
+    data: data,
+    headers: {
+      'Content-Type': 'multipart/form-data'
+    },
+    timeout: 150000
+  })
+}
diff --git a/src/views/system/work-order/threshold/index.vue b/src/views/system/work-order/threshold/index.vue
index 3649c30..6e2d5af 100644
--- a/src/views/system/work-order/threshold/index.vue
+++ b/src/views/system/work-order/threshold/index.vue
@@ -312,6 +312,30 @@
     <el-row class="content-warp">
       <el-button size="small" type="success" @click="addOpen" plain>鏂板</el-button>
       <el-button size="small" type="danger" @click="bathDelete" plain>鍒犻櫎</el-button>
+      <el-popover style="margin-left: 10px" placement="bottom" trigger="hover" content="瀵煎叆鐐逛綅">
+        <div class="bottom_">
+          <p>瀵煎叆鐐逛綅鍙仛鏂板鎿嶄綔</p>
+        </div>
+        <div class="bottom_">
+          <el-upload
+            ref="upload"
+            class="upload-demo"
+            drag
+            :action="importUrl"
+            :file-list="fileList"
+            :before-upload="beforeUpload"
+          >
+            <i class="el-icon-upload"></i>
+            <div class="el-upload__text">灏嗘枃浠舵嫋鍒版澶勶紝鎴�<em>鐐瑰嚮涓婁紶</em></div>
+            <div class="el-upload__tip" slot="tip">鍙兘涓婁紶xls/xlsx鏂囦欢</div>
+          </el-upload>
+        </div>
+        <div>
+          <el-button class="bottom_" type="primary" size="small" v-loading="upload" @click="handleImport"
+                     v-hasPermi="['point:import']">瀵煎叆</el-button>
+        </div>
+        <el-button type="primary" size="small" plain icon="el-icon-bottom" slot="reference" v-hasPermi="['point:import']">瀵煎叆鐧藉悕鍗�</el-button>
+      </el-popover>
     </el-row>
     <el-row class="content-warp">
       <el-col :span="24">
@@ -363,6 +387,7 @@
   listThreshold,
   getThreshold,
   updateThreshold,
+  importData,
 } from "@/api/platform/threshold";
 import {
   editCar,
@@ -501,6 +526,11 @@
           {required: true, message: "璁惧缂栫爜涓嶈兘涓虹┖", trigger: "blur"},
         ],
       },
+      // 瀵煎叆鏂囦欢璺緞
+      importUrl: '',
+      fileList: [],
+      importFile: null,
+      upload: false,
     };
   },
   created() {
@@ -895,6 +925,23 @@
         this.$modal.msgSuccess("鎵归噺鍒犻櫎鎴愬姛");
         this.ids = [];
       })
+    },
+    beforeUpload(file) {
+      this.importFile = file
+      this.fileList = [file]
+      return false
+    },
+    // 瀵煎叆鐧藉悕鍗�
+    handleImport() {
+      this.upload = true;
+      let formData = new FormData()
+      formData.append("file", this.importFile)
+      importData(formData).then(res => {
+        this.$message.success("瀵煎叆鎴愬姛")
+        this.upload = false
+        this.fileList = []
+        this.getWhiteList()
+      })
     }
   }
 };

--
Gitblit v1.8.0