From 94fc7aa616090838d703e3bc1576bb68f5c230c8 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期六, 12 七月 2025 17:08:43 +0800
Subject: [PATCH] 1.来票台账附件上传接口中未传文件ID

---
 src/views/basicData/customerFile/index.vue |   95 +++++++++++++++++++++++++++++++++++++----------
 1 files changed, 74 insertions(+), 21 deletions(-)

diff --git a/src/views/basicData/customerFile/index.vue b/src/views/basicData/customerFile/index.vue
index d9b6a3e..7abc80a 100644
--- a/src/views/basicData/customerFile/index.vue
+++ b/src/views/basicData/customerFile/index.vue
@@ -92,26 +92,25 @@
             </el-form-item>
           </el-col>
         </el-row>
-        <el-row :gutter="30">
+        <el-row :gutter="30" v-for="(contact, index) in formYYs.contactList" :key="index">
           <el-col :span="12">
             <el-form-item label="鑱旂郴浜猴細" prop="contactPerson">
-              <el-input
-                v-model="form.contactPerson"
-                placeholder="璇疯緭鍏�"
-                clearable
-              />
+              <el-input v-model="contact.contactPerson" placeholder="璇疯緭鍏�" clearable  />
             </el-form-item>
           </el-col>
           <el-col :span="12">
             <el-form-item label="鑱旂郴鐢佃瘽锛�" prop="contactPhone">
-              <el-input
-                v-model="form.contactPhone"
-                placeholder="璇疯緭鍏�"
-                clearable
-              />
+              <div style="display: flex; align-items: center;width: 100%;">
+                <el-input v-model="contact.contactPhone" placeholder="璇疯緭鍏�" clearable />
+                <el-button   @click="removeContact(index)" type="danger" circle style="margin-left: 5px;">
+                  <el-icon><Close /></el-icon>
+                </el-button>
+              </div>
             </el-form-item>
           </el-col>
         </el-row>
+        <el-button @click="addNewContact" style="margin-bottom: 10px;">+ 鏂板鑱旂郴浜�</el-button>
+
         <el-row :gutter="30">
           <el-col :span="12">
             <el-form-item label="閾惰鍩烘湰鎴凤細" prop="basicBankAccount">
@@ -208,13 +207,13 @@
         <template #tip>
           <div class="el-upload__tip text-center">
             <span>浠呭厑璁稿鍏ls銆亁lsx鏍煎紡鏂囦欢銆�</span>
-            <el-link
-              type="primary"
-              :underline="false"
-              style="font-size: 12px; vertical-align: baseline"
-              @click="importTemplate"
-              >涓嬭浇妯℃澘</el-link
-            >
+<!--            <el-link-->
+<!--              type="primary"-->
+<!--              :underline="false"-->
+<!--              style="font-size: 12px; vertical-align: baseline"-->
+<!--              @click="importTemplate"-->
+<!--              >涓嬭浇妯℃澘</el-link-->
+<!--            >-->
           </div>
         </template>
       </el-upload>
@@ -259,7 +258,7 @@
   {
     label: "鍦板潃鍙婅仈绯绘柟寮�",
     prop: "addressPhone",
-    width: 220,
+    width: 250,
   },
   {
     label: "鑱旂郴浜�",
@@ -268,18 +267,22 @@
   {
     label: "鑱旂郴鐢佃瘽",
     prop: "contactPhone",
+    width:150
   },
   {
     label: "閾惰鍩烘湰鎴�",
     prop: "basicBankAccount",
+    width: 220,
   },
   {
     label: "閾惰璐﹀彿",
     prop: "bankAccount",
+    width: 220,
   },
   {
     label: "寮�鎴疯鍙�",
     prop: "bankCode",
+    width:220
   },
   {
     label: "缁存姢浜�",
@@ -288,11 +291,13 @@
   {
     label: "缁存姢鏃堕棿",
     prop: "maintenanceTime",
+    width: 100,
   },
   {
     dataType: "action",
     label: "鎿嶄綔",
     align: "center",
+		fixed: 'right',
     operation: [
       {
         name: "缂栬緫",
@@ -300,6 +305,9 @@
         clickFun: (row) => {
           openForm("edit", row);
         },
+				disabled: (row) => {
+					return row.maintainer !== userStore.nickName
+				}
       },
     ],
   },
@@ -318,6 +326,14 @@
 // 鐢ㄦ埛淇℃伅琛ㄥ崟寮规鏁版嵁
 const operationType = ref("");
 const dialogFormVisible = ref(false);
+const formYYs = ref({    // 鍏朵粬瀛楁...
+  contactList: [
+    {
+      contactPerson: "",
+      contactPhone: ""
+    }
+  ]
+});
 const data = reactive({
   searchForm: {
     customerName: "",
@@ -342,8 +358,8 @@
     ],
     companyAddress: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
     companyPhone: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
-    contactPerson: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
-    contactPhone: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+    // contactPerson: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+    // contactPhone: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
     maintainer: [{ required: false, message: "璇烽�夋嫨", trigger: "change" }],
     maintenanceTime: [
       { required: false, message: "璇烽�夋嫨", trigger: "change" },
@@ -366,7 +382,18 @@
   url: import.meta.env.VITE_APP_BASE_API + "/basic/customer/importData",
 });
 const { searchForm, form, rules } = toRefs(data);
+const addNewContact = () => {
+  formYYs.value.contactList.push({
+    contactPerson: "",
+    contactPhone: ""
+  });
+};
 
+const removeContact = (index) => {
+  if (formYYs.value.contactList.length > 1) {
+    formYYs.value.contactList.splice(index, 1);
+  }
+};
 // 鏌ヨ鍒楄〃
 /** 鎼滅储鎸夐挳鎿嶄綔 */
 const handleQuery = () => {
@@ -404,6 +431,12 @@
   operationType.value = type;
   form.value = {};
   form.value.maintainer = userStore.nickName;
+  formYYs.value.contactList = [
+    {
+      contactPerson: "",
+      contactPhone: ""
+    }
+  ];
   form.value.maintenanceTime = getCurrentDate();
   userListNoPage().then((res) => {
     userList.value = res.data;
@@ -411,6 +444,13 @@
   if (type === "edit") {
     getCustomer(row.id).then((res) => {
       form.value = { ...res.data };
+      formYYs.value.contactList = res.data.contactPerson.split(",").map((item, index) => {
+        return {
+          contactPerson: item,
+          contactPhone: res.data.contactPhone.split(",")[index]
+        }
+      });
+
     });
   }
   dialogFormVisible.value = true;
@@ -429,6 +469,11 @@
 };
 // 鎻愪氦鏂板
 const submitAdd = () => {
+  if(formYYs.value.contactList.length < 1){
+    return proxy.$modal.msgWarning("璇疯嚦灏戞坊鍔犱竴涓仈绯讳汉");
+  }
+  form.value.contactPerson = formYYs.value.contactList.map(item => item.contactPerson).join(",");
+  form.value.contactPhone = formYYs.value.contactList.map(item => item.contactPhone).join(",");
   addCustomer(form.value).then((res) => {
     proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
     closeDia();
@@ -437,6 +482,8 @@
 };
 // 鎻愪氦淇敼
 const submitEdit = () => {
+	form.value.contactPerson = formYYs.value.contactList.map(item => item.contactPerson).join(",");
+	form.value.contactPhone = formYYs.value.contactList.map(item => item.contactPhone).join(",");
   updateCustomer(form.value).then((res) => {
     proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
     closeDia();
@@ -466,6 +513,12 @@
 const handleDelete = () => {
   let ids = [];
   if (selectedRows.value.length > 0) {
+    // 妫�鏌ユ槸鍚︽湁浠栦汉缁存姢鐨勬暟鎹�
+    const unauthorizedData = selectedRows.value.filter(item => item.maintainer !== userStore.nickName);
+    if (unauthorizedData.length > 0) {
+      proxy.$modal.msgWarning("涓嶅彲鍒犻櫎浠栦汉缁存姢鐨勬暟鎹�");
+      return;
+    }
     ids = selectedRows.value.map((item) => item.id);
   } else {
     proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");

--
Gitblit v1.9.3