From e1869c67a48da088650b0a1238ff718e5fc4138c Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期二, 29 九月 2026 09:15:21 +0800
Subject: [PATCH] refactor(data): 优化参数维护和报表数据显示格式

---
 src/views/basicData/customerFile/index.vue |   82 +++++++++++++++++++++++++++++++++-------
 1 files changed, 67 insertions(+), 15 deletions(-)

diff --git a/src/views/basicData/customerFile/index.vue b/src/views/basicData/customerFile/index.vue
index 66ef08d..df2edd2 100644
--- a/src/views/basicData/customerFile/index.vue
+++ b/src/views/basicData/customerFile/index.vue
@@ -27,6 +27,9 @@
       <div>
         <el-button type="primary"
                    @click="openForm('add')">鏂板瀹㈡埛</el-button>
+        <el-button type="primary"
+                   plain
+                   @click="back">娴佸叆鍏捣</el-button>
         <el-button @click="handleOut">瀵煎嚭</el-button>
         <el-button type="info"
                    plain
@@ -211,7 +214,8 @@
                  :limit="1"
                  accept=".xlsx, .xls"
                  :headers="upload.headers"
-                 :action="upload.url + '?updateSupport=' + upload.updateSupport"
+                 :action="upload.url"
+                 :data="upload.data"
                  :disabled="upload.isUploading"
                  :before-upload="upload.beforeUpload"
                  :on-progress="upload.onProgress"
@@ -267,9 +271,9 @@
         <el-form-item label="鎻愰啋鏃堕棿锛�"
                       prop="reminderTime">
           <el-date-picker v-model="reminderForm.reminderTime"
-                          type="datetime"
-                          value-format="YYYY-MM-DD HH:mm:ss"
-                          format="YYYY-MM-DD HH:mm:ss"
+                          type="date"
+                          value-format="YYYY-MM-DD"
+                          format="YYYY-MM-DD"
                           placeholder="璇烽�夋嫨鎻愰啋鏃堕棿"
                           style="width: 100%" />
         </el-form-item>
@@ -335,9 +339,9 @@
             <el-form-item label="璺熻繘鏃堕棿锛�"
                           prop="followUpTime">
               <el-date-picker v-model="negotiationForm.followUpTime"
-                              type="datetime"
-                              value-format="YYYY-MM-DD HH:mm:ss"
-                              format="YYYY-MM-DD HH:mm:ss"
+                              type="date"
+                              value-format="YYYY-MM-DD"
+                              format="YYYY-MM-DD"
                               placeholder="璇烽�夋嫨"
                               style="width: 100%" />
             </el-form-item>
@@ -453,7 +457,7 @@
             <el-col :span="12">
               <div class="info-item">
                 <span class="info-label">缁存姢鏃堕棿锛�</span>
-                <span class="info-value">{{ detailForm.maintenanceTime }}</span>
+                <span class="info-value">{{ dateOnly(detailForm.maintenanceTime) }}</span>
               </div>
             </el-col>
           </el-row>
@@ -474,7 +478,8 @@
                   style="width: 100%">
           <el-table-column prop="followUpTime"
                            label="璺熻繘鏃堕棿"
-                           width="160" />
+                           width="160"
+                           :formatter="formatDateColumn" />
           <el-table-column prop="followUpMethod"
                            label="璺熻繘鏂瑰紡"
                            width="100" />
@@ -612,14 +617,13 @@
   import { onMounted, ref, reactive, getCurrentInstance, toRefs } from "vue";
   import { Search, Paperclip, Upload } from "@element-plus/icons-vue";
   import {
-    delCustomerPrivate,
     addCustomerFollow,
     updateCustomerFollow,
     delCustomerFollow,
     addReturnVisit,
     getReturnVisit,
   } from "@/api/basicData/customerFile.js";
-  import {listCustomer, getCustomer, addCustomer, updateCustomer, delCustomer} from "@/api/basicData/customer.js";
+  import {listCustomer, getCustomer, addCustomer, updateCustomer, delCustomer, backCustomer} from "@/api/basicData/customer.js";
   import { ElMessageBox } from "element-plus";
   import { userListNoPage } from "@/api/system/user.js";
   import useUserStore from "@/store/modules/user";
@@ -797,7 +801,12 @@
         {
           name: "缂栬緫",
           type: "text",
+          showHide: row => !isCustomerEditLocked(row),
           clickFun: row => {
+            if (isCustomerEditLocked(row)) {
+              proxy.$modal.msgWarning("宸茶閿�鍞ā鍧楀紩鐢ㄧ殑绉佹捣瀹㈡埛涓嶈兘缂栬緫");
+              return;
+            }
             openForm("edit", row);
           },
         },
@@ -898,7 +907,10 @@
     // 璁剧疆涓婁紶鐨勮姹傚ご閮�
     headers: { Authorization: "Bearer " + getToken() },
     // 涓婁紶鐨勫湴鍧�
-    url: import.meta.env.VITE_APP_BASE_API + "/customerPrivate/importData",
+    url: import.meta.env.VITE_APP_BASE_API + "/basic/customer/importData",
+    data: {
+      type: 0
+    },
     // 鏂囦欢涓婁紶鍓嶇殑鍥炶皟
     beforeUpload: file => {
       console.log("鏂囦欢鍗冲皢涓婁紶", file);
@@ -991,10 +1003,14 @@
   }
   /** 涓嬭浇妯℃澘 */
   function importTemplate() {
-    proxy.download("/customerPrivate/downloadTemplate", {}, "瀹㈡埛瀵煎叆妯℃澘.xlsx");
+    proxy.download("/basic/customer/downloadTemplate", {}, "瀹㈡埛瀵煎叆妯℃澘.xlsx");
   }
   // 鎵撳紑寮规
   const openForm = (type, row) => {
+    if (type === "edit" && isCustomerEditLocked(row)) {
+      proxy.$modal.msgWarning("宸茶閿�鍞ā鍧楀紩鐢ㄧ殑绉佹捣瀹㈡埛涓嶈兘缂栬緫");
+      return;
+    }
     operationType.value = type;
     form.value = {};
     form.value.maintainer = userStore.nickName;
@@ -1023,6 +1039,12 @@
       });
     }
     dialogFormVisible.value = true;
+  };
+  const isCustomerEditLocked = row => {
+    const salesReferenced = Number(row?.salesReferenceFlag || 0) === 1;
+    const customerType = Number(row?.type);
+    const usageStatus = Number(row?.usageStatus || 0);
+    return salesReferenced && (customerType === 0 || (customerType === 1 && usageStatus === 1));
   };
   // 鎻愪氦琛ㄥ崟
   const submitForm = () => {
@@ -1080,7 +1102,7 @@
       type: "warning",
     })
       .then(() => {
-        proxy.download("/customerPrivate/export", {}, "瀹㈡埛妗f.xlsx");
+        proxy.download("/basic/customer/export", {type: 0}, "瀹㈡埛妗f.xlsx");
       })
       .catch(() => {
         proxy.$modal.msg("宸插彇娑�");
@@ -1120,6 +1142,36 @@
       })
       .catch(() => {
         proxy.$modal.msg("宸插彇娑�");
+      });
+  };
+
+  const back = () => {
+    if (selectedRows.value.length === 0) {
+      proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
+      return;
+    }
+    const ids = selectedRows.value.map(item => item.id);
+    ElMessageBox.confirm("閫変腑鐨勫鎴峰皢娴佸叆鍏捣锛屾槸鍚︾‘璁わ紵", "娴佸叆鍏捣鎻愮ず", {
+      confirmButtonText: "纭",
+      cancelButtonText: "鍙栨秷",
+      type: "warning",
+    })
+      .then(() => {
+        tableLoading.value = true;
+        return Promise.all(ids.map(id => backCustomer(id)))
+          .then(() => {
+            proxy.$modal.msgSuccess("娴佸叆鍏捣鎴愬姛");
+            selectedRows.value = [];
+            getList();
+          })
+          .finally(() => {
+            tableLoading.value = false;
+          });
+      })
+      .catch(error => {
+        if (error === "cancel" || error === "close") {
+          proxy.$modal.msg("宸插彇娑�");
+        }
       });
   };
 
@@ -1410,7 +1462,7 @@
   const downloadAttachment = row => {
     if (row.url) {
       // proxy.download(row.url, {}, row.name);
-      proxy.$download.name(row.url);
+			proxy.$download.byUrl(row.url, row.originalFilename);
     } else {
       proxy.$modal.msgError("涓嬭浇閾炬帴涓嶅瓨鍦�");
     }

--
Gitblit v1.9.3