From 5af665569d0cc093184f99b70ac38745ef53b911 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期一, 21 九月 2026 20:39:04 +0800
Subject: [PATCH] 新疆-融邦环保 1.油品出库表单改「多台账分摊绑定」:各台账数量之和必须等于出库吨位,产品取各台账明细交集,代储不锁行可自由增删 2.新增到货记录模块:销售台账页入口,车辆随出库单联动,到货上限=该台账分摊量,附件走永久链接 3.发货台账改层级父行:油品出库为父行,children 为到货记录,来源列区分发货单/油品出库/到货 4.开票/收款候选按「出库单×客户」拆行,bindingId 与出库单 id 分两串回传,防重复开票/收款 5.销售台账下拉补产品/规格型号 6.代储入库绑定销售订单:油品入库表单加销售订单下拉,入库台账列表加「销售订单」列 7.采购申请补齐台账字段(油库、采购合同号、提货方式、物流方式、最佳到站日期、采购类别、付款方式、预警数量、附件等) 8.修复采购申请「转订单后跳转无反应」 9.采购台账删掉「销售合同号」的搜索条件、列表列和表单字段 10.公海客户新增「信托基金(元)」,代储金额合计超限标红提示

---
 src/views/basicData/customerFileOpenSea/index.vue |  177 +++++++++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 149 insertions(+), 28 deletions(-)

diff --git a/src/views/basicData/customerFileOpenSea/index.vue b/src/views/basicData/customerFileOpenSea/index.vue
index 31e5795..860c6b2 100644
--- a/src/views/basicData/customerFileOpenSea/index.vue
+++ b/src/views/basicData/customerFileOpenSea/index.vue
@@ -9,17 +9,6 @@
                   @change="handleQuery"
                   clearable
                   :prefix-icon="Search" />
-        <span class="search_title">瀹㈡埛鍒嗙被锛�</span>
-        <el-select v-model="searchForm.customerType"
-                   placeholder="璇烽�夋嫨"
-                   style="width: 240px"
-                   clearable
-                   @change="handleQuery">
-          <el-option label="闆跺敭瀹㈡埛"
-                     value="闆跺敭瀹㈡埛" />
-          <el-option label="杩涢攢鍟嗗鎴�"
-                     value="杩涢攢鍟嗗鎴�" />
-        </el-select>
         <el-button type="primary"
                    @click="handleQuery"
                    style="margin-left: 10px">鎼滅储</el-button>
@@ -37,6 +26,17 @@
                    @click="handleDelete">鍒犻櫎</el-button>
       </div>
     </div>
+    <!-- 鎸夈�屽鎴峰垎绫汇�嶆媶椤电锛涖�屽叏閮ㄣ�嶄笉甯﹀垎绫绘煡璇紝淇濊瘉杩樻病琛ュ垎绫荤殑鑰佹暟鎹篃鑳界湅鍒� -->
+    <el-tabs v-model="activeTab"
+             @tab-change="handleTabChange"
+             class="customer-tabs">
+      <el-tab-pane label="鍏ㄩ儴"
+                   name="鍏ㄩ儴" />
+      <el-tab-pane label="閿�鍞鎴�"
+                   name="閿�鍞鎴�" />
+      <el-tab-pane label="浠e偍瀹㈡埛"
+                   name="浠e偍瀹㈡埛" />
+    </el-tabs>
     <div class="table_list">
       <PIMTable rowKey="id"
                 :column="tableColumn"
@@ -45,7 +45,16 @@
                 :isSelection="true"
                 @selection-change="handleSelectionChange"
                 :tableLoading="tableLoading"
-                @pagination="pagination"></PIMTable>
+                @pagination="pagination">
+        <template #depositAmountSlot="{ row }">
+          <el-tooltip v-if="row.exceedsTrustFund"
+                      :content="`浠e偍閲戦鍚堣宸茶秴鍑鸿瀹㈡埛淇℃墭鍩洪噾锛堜俊鎵樺熀閲戯細${row.trustFund}锛塦"
+                      placement="top">
+            <el-text type="danger">{{ formatAmount(row.depositTotalAmount) }}</el-text>
+          </el-tooltip>
+          <span v-else>{{ formatAmount(row.depositTotalAmount) }}</span>
+        </template>
+      </PIMTable>
     </div>
     <el-dialog v-model="dialogFormVisible"
                :title="operationType === 'add' ? '鏂板瀹㈡埛淇℃伅' : '缂栬緫瀹㈡埛淇℃伅'"
@@ -125,10 +134,10 @@
               <el-select v-model="form.customerType"
                          placeholder="璇烽�夋嫨"
                          clearable>
-                <el-option label="闆跺敭瀹㈡埛"
-                           value="闆跺敭瀹㈡埛" />
-                <el-option label="杩涢攢鍟嗗鎴�"
-                           value="杩涢攢鍟嗗鎴�" />
+                <el-option v-for="dict in customer_type"
+                           :key="dict.value"
+                           :label="dict.label"
+                           :value="dict.value" />
               </el-select>
             </el-form-item>
           </el-col>
@@ -190,6 +199,19 @@
                               type="date"
                               placeholder="璇烽�夋嫨"
                               clearable />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row :gutter="30">
+          <el-col :span="12">
+            <el-form-item label="淇℃墭鍩洪噾(鍏�)锛�"
+                          prop="trustFund">
+              <el-input-number v-model="form.trustFund"
+                               :min="0"
+                               :precision="2"
+                               :controls="false"
+                               placeholder="璇疯緭鍏ワ紝鍙负绌�"
+                               style="width: 100%" />
             </el-form-item>
           </el-col>
         </el-row>
@@ -280,7 +302,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"
@@ -678,10 +701,16 @@
 </template>
 
 <script setup>
-  import { onMounted, ref, reactive, getCurrentInstance, toRefs } from "vue";
+  import {
+    onMounted,
+    ref,
+    reactive,
+    getCurrentInstance,
+    toRefs,
+    watch,
+  } from "vue";
   import { Search, Paperclip, Upload } from "@element-plus/icons-vue";
   import {
-    shareCustomer,
     addCustomerFollow,
     updateCustomerFollow,
     delCustomerFollow,
@@ -695,7 +724,8 @@
     updateCustomer,
     getCustomer,
     assignCustomer,
-    recycleCustomer
+    recycleCustomer,
+    shareCustomer,
   } from "@/api/basicData/customer.js";
 
   import { ElMessageBox } from "element-plus";
@@ -704,6 +734,7 @@
   import { getToken } from "@/utils/auth.js";
   const { proxy } = getCurrentInstance();
   const userStore = useUserStore();
+  const { customer_type } = proxy.useDict("customer_type");
   const assignDialogVisible = ref(false);
   const assignFormRef = ref();
   const assignForm = reactive({
@@ -808,6 +839,7 @@
       label: "瀹㈡埛鍒嗙被",
       prop: "customerType",
       width: 120,
+      formatData: value => proxy.selectDictLabel(customer_type.value, value),
     },
     {
       label: "瀹㈡埛鍚嶇О",
@@ -852,6 +884,22 @@
       label: "閾惰璐﹀彿",
       prop: "bankAccount",
       width: 220,
+    },
+    {
+      label: "淇℃墭鍩洪噾(鍏�)",
+      prop: "trustFund",
+      width: 140,
+      formatData: value =>
+        value === null || value === undefined || value === ""
+          ? "-"
+          : Number(value).toFixed(2),
+    },
+    {
+      label: "浠e偍閲戦(鍏�)",
+      prop: "depositTotalAmount",
+      dataType: "slot",
+      slot: "depositAmountSlot",
+      width: 150,
     },
     {
       label: "寮�鎴疯鍙�",
@@ -916,8 +964,13 @@
         {
           name: "鍥炴敹",
           type: "text",
+          disabled: row => isCustomerRecoveryLocked(row),
           showHide: row => row.usageStatus == 1,
           clickFun: row => {
+            if (isCustomerRecoveryLocked(row)) {
+              proxy.$modal.msgWarning("宸查鐢ㄥ苟涓旇閿�鍞ā鍧楀紩鐢ㄧ殑鍏捣瀹㈡埛涓嶈兘鍥炴敹");
+              return;
+            }
             recycle(row);
           },
         },
@@ -932,7 +985,12 @@
 				{
 					name: "缂栬緫",
 					type: "text",
-					clickFun: row => {
+          disabled: row => isCustomerEditLocked(row),
+          clickFun: row => {
+            if (isCustomerEditLocked(row)) {
+              proxy.$modal.msgWarning("宸查鐢ㄥ苟涓旇閿�鍞ā鍧楀紩鐢ㄧ殑鍏捣瀹㈡埛涓嶈兘缂栬緫");
+              return;
+            }
 						openForm("edit", row);
 					},
 				},
@@ -972,7 +1030,6 @@
   const data = reactive({
     searchForm: {
       customerName: "",
-      customerType: "",
       type: 1
     },
     form: {
@@ -988,6 +1045,8 @@
       bankAccount: "",
       bankCode: "",
       customerType: "",
+      // 閲戦瀛楁缁� null 鑰岄潪 ""锛岄伩鍏� el-input-number 鎶婄┖涓叉姌绠楁垚 0
+      trustFund: null,
       type: 1
     },
     rules: {
@@ -1020,6 +1079,9 @@
     headers: { Authorization: "Bearer " + getToken() },
     // 涓婁紶鐨勫湴鍧�
     url: import.meta.env.VITE_APP_BASE_API + "/basic/customer/importData",
+    data: {
+      type: 1
+    },
     // 鏂囦欢涓婁紶鍓嶇殑鍥炶皟
     beforeUpload: file => {
       console.log("鏂囦欢鍗冲皢涓婁紶", file);
@@ -1088,15 +1150,38 @@
     page.size = obj.limit;
     getList();
   };
+  // 鍏ㄩ儴 / 閿�鍞鎴� / 浠e偍瀹㈡埛涓変釜椤电锛屽悇鑷甫瀹㈡埛鍒嗙被鏌ュ悓涓�涓垪琛ㄦ帴鍙�
+  const activeTab = ref("鍏ㄩ儴");
+  // 銆屽叏閮ㄣ�嶄笉浼犲垎绫伙紙undefined 浼氳 axios 涓㈡帀锛夛紝閿�鍞�/浠e偍鎸夊瓧鍏稿�肩瓫锛�
+  // 瀛楀吀鐨� value 鏈繀灏辨槸涓枃鏍囩锛屾寜 label 鍙嶆煡鐪熷疄鍙栧�煎啀浼犳帴鍙�
+  const activeCustomerType = () => {
+    if (activeTab.value === "鍏ㄩ儴") {
+      return undefined;
+    }
+    const list = customer_type.value || [];
+    const hit = list.find(item => item.label === activeTab.value);
+    return hit ? hit.value : activeTab.value;
+  };
+  // 椤电鍒囨崲锛氭崲瀹㈡埛鍒嗙被閲嶆柊鏌ュ垪琛�
+  const handleTabChange = () => {
+    page.current = 1;
+    getList();
+  };
   const getList = () => {
     tableLoading.value = true;
     const { total, ...queryPage } = page;
-    listCustomer({ ...searchForm.value, ...queryPage }).then(res => {
+    listCustomer({
+      ...searchForm.value,
+      ...queryPage,
+      customerType: activeCustomerType(),
+    }).then(res => {
       tableLoading.value = false;
       tableData.value = res.data.records;
       page.total = res.data.total;
     });
   };
+  // 瀛楀吀鏄紓姝ユ媺鐨勶紝鍒拌揪鍚庢寜鐪熷疄瀛楀吀鍊奸噸鏌ヤ竴娆★紝閬垮厤棣栧睆鐢ㄤ腑鏂囨爣绛剧瓫涓嶅埌鏁版嵁
+  watch(customer_type, () => getList());
   // 琛ㄦ牸閫夋嫨鏁版嵁
   const handleSelectionChange = selection => {
     selectedRows.value = selection;
@@ -1117,6 +1202,10 @@
   }
   // 鎵撳紑寮规
   const openForm = (type, row) => {
+    if (type === "edit" && isCustomerEditLocked(row)) {
+      proxy.$modal.msgWarning("宸查鐢ㄥ苟涓旇閿�鍞ā鍧楀紩鐢ㄧ殑鍏捣瀹㈡埛涓嶈兘缂栬緫");
+      return;
+    }
     operationType.value = type;
     form.value = {};
     form.value.maintainer = userStore.nickName;
@@ -1128,6 +1217,8 @@
     ];
     form.value.maintenanceTime = getCurrentDate();
     form.value.type = 1;
+    // 瀹㈡埛鍒嗙被榛樿璺熼殢褰撳墠椤电
+    form.value.customerType = activeCustomerType();
     userListNoPage().then(res => {
       userList.value = res.data;
     });
@@ -1146,6 +1237,11 @@
     }
     dialogFormVisible.value = true;
   };
+  const isCustomerSalesReferenced = row => Number(row?.salesReferenceFlag || 0) === 1;
+  const isCustomerRecoveryLocked = row => Number(row?.usageStatus || 0) === 1 && isCustomerSalesReferenced(row);
+  const isCustomerEditLocked = row => isCustomerSalesReferenced(row) && (
+    Number(row?.type) === 0 || (Number(row?.type) === 1 && Number(row?.usageStatus || 0) === 1)
+  );
   // 鎻愪氦琛ㄥ崟
   const submitForm = () => {
     proxy.$refs["formRef"].validate(valid => {
@@ -1220,7 +1316,7 @@
   const openShareDialog = row => {
     shareForm.id = row.id;
     shareForm.customerName = row.customerName;
-    shareForm.boundIds = [];
+    shareForm.boundIds = row.userIds || [];
     ensureUserList().then(() => {
       shareDialogVisible.value = true;
     });
@@ -1253,8 +1349,8 @@
         return;
       }
       shareCustomer({
-        customerId: shareForm.id,
-        boundIds: shareForm.boundIds,
+        id: shareForm.id,
+        userIds: shareForm.boundIds,
       }).then(() => {
         proxy.$modal.msgSuccess("鍏变韩鎴愬姛");
         closeShareDialog();
@@ -1288,7 +1384,12 @@
       type: "warning",
     })
       .then(() => {
-        proxy.download("/basic/customer/export", {}, "瀹㈡埛妗f.xlsx");
+        // 瀵煎嚭璺熼殢褰撳墠椤电鐨勫鎴峰垎绫�
+        proxy.download(
+          "/basic/customer/export",
+          { type: 1, customerType: activeCustomerType() },
+          "瀹㈡埛妗f.xlsx"
+        );
       })
       .catch(() => {
         proxy.$modal.msg("宸插彇娑�");
@@ -1632,6 +1733,13 @@
     return true;
   };
 
+  // 閲戦灞曠ず锛氱┖鍊兼樉绀� -锛屽惁鍒欎繚鐣欎袱浣嶅皬鏁�
+  const formatAmount = value => {
+    return value === null || value === undefined || value === ""
+      ? "-"
+      : Number(value).toFixed(2);
+  };
+
   // 鏍煎紡鍖栨枃浠跺ぇ灏�
   const formatFileSize = size => {
     if (size < 1024) {
@@ -1647,7 +1755,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("涓嬭浇閾炬帴涓嶅瓨鍦�");
     }
@@ -1714,6 +1822,19 @@
 </script>
 
 <style scoped lang="scss">
+  /* 閿�鍞鎴� / 浠e偍瀹㈡埛椤电锛氬彧瑕佹爣绛炬爮锛屽唴瀹圭敱涓嬫柟鍒楄〃灞曠ず */
+  .customer-tabs {
+    margin-bottom: 8px;
+
+    :deep(.el-tabs__header) {
+      margin-bottom: 0;
+    }
+
+    :deep(.el-tabs__content) {
+      display: none;
+    }
+  }
+
   .detail-section {
     margin-bottom: 20px;
     padding: 15px;

--
Gitblit v1.9.3