From 2e77330d87341624c88301562fd137b58f9a101a Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期四, 25 十二月 2025 10:57:35 +0800
Subject: [PATCH] 1.海川开心-录入日期都默认当天,封装公用组件和方法

---
 src/views/basicData/supplierManage/index.vue |   52 +++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 35 insertions(+), 17 deletions(-)

diff --git a/src/views/basicData/supplierManage/index.vue b/src/views/basicData/supplierManage/index.vue
index e2a71ee..081fd9b 100644
--- a/src/views/basicData/supplierManage/index.vue
+++ b/src/views/basicData/supplierManage/index.vue
@@ -141,7 +141,9 @@
                 v-model="form.maintainUserId"
                 placeholder="璇烽�夋嫨"
                 clearable
-                disabled
+                filterable
+                default-first-option
+                :reserve-keyword="false"
               >
                 <el-option
                   v-for="item in userList"
@@ -162,7 +164,6 @@
                 type="date"
                 placeholder="璇烽�夋嫨"
                 clearable
-                disabled
               />
             </el-form-item>
           </el-col>
@@ -192,6 +193,7 @@
         :disabled="upload.isUploading"
         :on-progress="handleFileUploadProgress"
         :on-success="handleFileSuccess"
+        :on-error="handleFileError"
         :auto-upload="false"
         drag
       >
@@ -200,13 +202,13 @@
         <template #tip>
           <div class="el-upload__tip text-center">
             <span>浠呭厑璁稿鍏ls銆亁lsx鏍煎紡鏂囦欢銆�</span>
-            <!-- <el-link
+            <el-link
               type="primary"
               :underline="false"
               style="font-size: 12px; vertical-align: baseline"
               @click="importTemplate"
               >涓嬭浇妯℃澘</el-link
-            > -->
+            >
           </div>
         </template>
       </el-upload>
@@ -221,7 +223,7 @@
 </template>
 
 <script setup>
-import { ref } from "vue";
+import { onMounted, ref } from "vue";
 import { Search } from "@element-plus/icons-vue";
 import { delSupplier } from "@/api/basicData/supplierManageFile.js";
 import { ElMessageBox } from "element-plus";
@@ -234,6 +236,7 @@
 } from "@/api/basicData/supplierManageFile.js";
 import useUserStore from "@/store/modules/user";
 import { getToken } from "@/utils/auth.js";
+import { getCurrentDate } from "@/utils/index.js";
 const { proxy } = getCurrentInstance();
 const userStore = useUserStore();
 
@@ -242,6 +245,11 @@
     label: "渚涘簲鍟嗗悕绉�",
     prop: "supplierName",
     width: 250,
+  },
+  {
+    label: "绾崇◣浜鸿瘑鍒彿",
+    prop: "taxpayerIdentificationNum",
+    width: 230,
   },
   {
     label: "鍏徃鍦板潃",
@@ -286,6 +294,7 @@
     dataType: "action",
     label: "鎿嶄綔",
     align: "center",
+		fixed: 'right',
     operation: [
       {
         name: "缂栬緫",
@@ -356,7 +365,7 @@
 };
 /** 鎻愪氦涓婁紶鏂囦欢 */
 function submitFileForm() {
-  console.log(upload.url + '?updateSupport=' + upload.updateSupport)
+  upload.isUploading = true;
   proxy.$refs["uploadRef"].submit();
 }
 const getList = () => {
@@ -386,6 +395,10 @@
   upload.title = "渚涘簲鍟嗗鍏�";
   upload.open = true;
 }
+/** 涓嬭浇妯℃澘 */
+function importTemplate() {
+  proxy.download("/system/supplier/downloadTemplate", {}, "渚涘簲鍟嗗鍏ユā鏉�.xlsx");
+}
 
 /**鏂囦欢涓婁紶涓鐞� */
 const handleFileUploadProgress = (event, file, fileList) => {
@@ -394,10 +407,23 @@
 
 /** 鏂囦欢涓婁紶鎴愬姛澶勭悊 */
 const handleFileSuccess = (response, file, fileList) => {
-  upload.open = false;
   upload.isUploading = false;
-  proxy.$refs["uploadRef"].handleRemove(file);
-  getList();
+  if(response.code === 200){
+    proxy.$modal.msgSuccess("鏂囦欢涓婁紶鎴愬姛");
+    upload.open = false;
+    proxy.$refs["uploadRef"].clearFiles();
+    getList();
+  }else if(response.code === 500){
+    proxy.$modal.msgError(response.msg);
+  }else{
+    proxy.$modal.msgWarning(response.msg);
+  }
+};
+
+/** 鏂囦欢涓婁紶澶辫触澶勭悊 */
+const handleFileError = (error, file, fileList) => {
+  upload.isUploading = false;
+  proxy.$modal.msgError("鏂囦欢涓婁紶澶辫触");
 };
 // 琛ㄦ牸閫夋嫨鏁版嵁
 const handleSelectionChange = (selection) => {
@@ -496,14 +522,6 @@
     });
 };
 
-// 鑾峰彇褰撳墠鏃ユ湡骞舵牸寮忓寲涓� YYYY-MM-DD
-function getCurrentDate() {
-  const today = new Date();
-  const year = today.getFullYear();
-  const month = String(today.getMonth() + 1).padStart(2, "0"); // 鏈堜唤浠�0寮�濮�
-  const day = String(today.getDate()).padStart(2, "0");
-  return `${year}-${month}-${day}`;
-}
 
 onMounted(() => {
   getList();

--
Gitblit v1.9.3