From 6e7acd5062824d5aae2ed345898d761a93879de0 Mon Sep 17 00:00:00 2001
From: heimawl <1785969728@qq.com>
Date: 星期五, 02 六月 2023 17:16:31 +0800
Subject: [PATCH] 组件库整理,依赖安装、excel导入导入方法整理

---
 src/components/FileUpload/index.vue |   57 +++++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 39 insertions(+), 18 deletions(-)

diff --git a/src/components/FileUpload/index.vue b/src/components/FileUpload/index.vue
index 6c583cf..cfc8070 100644
--- a/src/components/FileUpload/index.vue
+++ b/src/components/FileUpload/index.vue
@@ -1,3 +1,4 @@
+<!-- 涓婁紶鏂囦欢 -->
 <template>
   <div class="upload-file">
     <el-upload
@@ -19,20 +20,38 @@
       <!-- 涓婁紶鎻愮ず -->
       <div class="el-upload__tip" slot="tip" v-if="showTip">
         璇蜂笂浼�
-        <template v-if="fileSize"> 澶у皬涓嶈秴杩� <b style="color: #f56c6c">{{ fileSize }}MB</b> </template>
-        <template v-if="fileType"> 鏍煎紡涓� <b style="color: #f56c6c">{{ fileType.join("/") }}</b> </template>
+        <template v-if="fileSize">
+          澶у皬涓嶈秴杩� <b style="color: #f56c6c">{{ fileSize }}MB</b>
+        </template>
+        <template v-if="fileType">
+          鏍煎紡涓� <b style="color: #f56c6c">{{ fileType.join("/") }}</b>
+        </template>
         鐨勬枃浠�
       </div>
     </el-upload>
 
     <!-- 鏂囦欢鍒楄〃 -->
-    <transition-group class="upload-file-list el-upload-list el-upload-list--text" name="el-fade-in-linear" tag="ul">
-      <li :key="file.url" class="el-upload-list__item ele-upload-list__item-content" v-for="(file, index) in fileList">
-        <el-link :href="`${baseUrl}${file.url}`" :underline="false" target="_blank">
+    <transition-group
+      class="upload-file-list el-upload-list el-upload-list--text"
+      name="el-fade-in-linear"
+      tag="ul"
+    >
+      <li
+        :key="file.url"
+        class="el-upload-list__item ele-upload-list__item-content"
+        v-for="(file, index) in fileList"
+      >
+        <el-link
+          :href="`${baseUrl}${file.url}`"
+          :underline="false"
+          target="_blank"
+        >
           <span class="el-icon-document"> {{ getFileName(file.name) }} </span>
         </el-link>
         <div class="ele-upload-list__item-content-action">
-          <el-link :underline="false" @click="handleDelete(index)" type="danger">鍒犻櫎</el-link>
+          <el-link :underline="false" @click="handleDelete(index)" type="danger"
+            >鍒犻櫎</el-link
+          >
         </div>
       </li>
     </transition-group>
@@ -65,8 +84,8 @@
     // 鏄惁鏄剧ず鎻愮ず
     isShowTip: {
       type: Boolean,
-      default: true
-    }
+      default: true,
+    },
   },
   data() {
     return {
@@ -86,9 +105,9 @@
         if (val) {
           let temp = 1;
           // 棣栧厛灏嗗�艰浆涓烘暟缁�
-          const list = Array.isArray(val) ? val : this.value.split(',');
+          const list = Array.isArray(val) ? val : this.value.split(",");
           // 鐒跺悗灏嗘暟缁勮浆涓哄璞℃暟缁�
-          this.fileList = list.map(item => {
+          this.fileList = list.map((item) => {
             if (typeof item === "string") {
               item = { name: item, url: item };
             }
@@ -101,8 +120,8 @@
         }
       },
       deep: true,
-      immediate: true
-    }
+      immediate: true,
+    },
   },
   computed: {
     // 鏄惁鏄剧ず鎻愮ず
@@ -115,11 +134,13 @@
     handleBeforeUpload(file) {
       // 鏍℃鏂囦欢绫诲瀷
       if (this.fileType) {
-        const fileName = file.name.split('.');
+        const fileName = file.name.split(".");
         const fileExt = fileName[fileName.length - 1];
         const isTypeOk = this.fileType.indexOf(fileExt) >= 0;
         if (!isTypeOk) {
-          this.$modal.msgError(`鏂囦欢鏍煎紡涓嶆纭�, 璇蜂笂浼�${this.fileType.join("/")}鏍煎紡鏂囦欢!`);
+          this.$modal.msgError(
+            `鏂囦欢鏍煎紡涓嶆纭�, 璇蜂笂浼�${this.fileType.join("/")}鏍煎紡鏂囦欢!`
+          );
           return false;
         }
       }
@@ -142,7 +163,7 @@
     // 涓婁紶澶辫触
     handleUploadError(err) {
       this.$modal.msgError("涓婁紶鏂囦欢澶辫触锛岃閲嶈瘯");
-      this.$modal.closeLoading()
+      this.$modal.closeLoading();
     },
     // 涓婁紶鎴愬姛鍥炶皟
     handleUploadSuccess(res, file) {
@@ -187,9 +208,9 @@
       for (let i in list) {
         strs += list[i].url + separator;
       }
-      return strs != '' ? strs.substr(0, strs.length - 1) : '';
-    }
-  }
+      return strs != "" ? strs.substr(0, strs.length - 1) : "";
+    },
+  },
 };
 </script>
 

--
Gitblit v1.9.3