From 00700eed3d955a504dbb26e02044daa1c7cd741e Mon Sep 17 00:00:00 2001
From: sen <sen@qq.com>
Date: 星期五, 15 八月 2025 18:45:28 +0800
Subject: [PATCH] 是否如

---
 ui/admin-ui3/src/views/cwgl/pendingSettlementBusiness/index.vue |   47 ++++++++---
 ui/admin-ui3/src/views/cwgl/estimatedReceivable/index.vue       |   76 +++++++++++++++----
 ui/admin-ui3/src/views/cwgl/estimatedReceivableBill/index.vue   |   66 ++++++++++++----
 3 files changed, 143 insertions(+), 46 deletions(-)

diff --git a/ui/admin-ui3/src/views/cwgl/estimatedReceivable/index.vue b/ui/admin-ui3/src/views/cwgl/estimatedReceivable/index.vue
index e2b46db..02cc9eb 100644
--- a/ui/admin-ui3/src/views/cwgl/estimatedReceivable/index.vue
+++ b/ui/admin-ui3/src/views/cwgl/estimatedReceivable/index.vue
@@ -19,10 +19,10 @@
 
 
       <template #menu-left>
-        <el-button type="success" icon="Edit" :disabled="pageF.single" v-hasPermi="['cwgl:estimatedReceivable:edit']"
+        <el-button type="success" icon="Edit" :disabled="editIshow" v-hasPermi="['cwgl:estimatedReceivable:edit']"
           @click="handleUpdate">淇敼
         </el-button>
-        <el-button type="danger" icon="Delete" :disabled="pageF.multiple" @click="handleDelete"
+        <el-button type="danger" icon="Delete" :disabled="removeIshow" @click="handleDelete"
           v-hasPermi="['cwgl:estimatedReceivable:remove']">鍒犻櫎
         </el-button>
         <el-button type="warning" plain icon="Download" @click="handleExport"
@@ -34,16 +34,15 @@
 
 
       <template #menu="{ size, row, index }">
-        <el-link class="link-btn"  type="primary" :underline="false" plain :size="size"
+        <el-link class="link-btn" type="primary" :underline="false" plain :size="size"
           @click="handleEditBtn(row, index)" v-if="[0, 1].includes(row.relatedBillStatus) && row.isConfirmed != 2"
           v-hasPermi="['cwgl:estimatedReceivable:cancel']"> 缂栬緫
         </el-link>
-        <el-link class="link-btn"  type="primary" v-if="row.isConfirmed == 1"
-          :underline="false" plain :size="size" @click="handleCancel(row)"
-          v-hasPermi="['cwgl:estimatedReceivable:cancel']"> 鍙栨秷纭
+        <el-link class="link-btn" type="primary" v-if="row.isConfirmed == 1" :underline="false" plain :size="size"
+          @click="handleCancel(row)" v-hasPermi="['cwgl:estimatedReceivable:cancel']"> 鍙栨秷纭
         </el-link>
-        <el-link class="link-btn" type="primary" v-if="row.isConfirmed == 0" :underline="false" plain
-          @click="handleAffirm(row)" v-hasPermi="['cwgl:estimatedReceivable:confirm']"> 纭
+        <el-link class="link-btn" type="primary" v-if="row.isConfirmed == 0 && ![2, 3].includes(row.relatedBillStatus)"
+          :underline="false" plain @click="handleAffirm(row)" v-hasPermi="['cwgl:estimatedReceivable:confirm']"> 纭
         </el-link>
         <el-link class="link-btn" type="primary" v-if="row.isConfirmed == 1" :underline="false" plain
           @click="handleInvalid(row)" v-hasPermi="['cwgl:estimatedReceivable:invalid']"> 浣滃簾
@@ -125,6 +124,9 @@
 import { listEstimatedReceivableLog } from "@/api/cwgl/estimatedReceivableLog";
 import { listEstimatedReceivableBillLog } from "@/api/cwgl/estimatedReceivableBillLog";
 import {
+  getSelectCustomNam,
+} from "@/api/cwgl/pendingSettlementBusiness";
+import {
   listPendingSettlementBusiness,
 } from "@/api/cwgl/pendingSettlementBusiness";
 import useCurrentInstance from "@/utils/useCurrentInstance";
@@ -149,6 +151,8 @@
 const data = reactive({
   form: <EstimatedReceivableI>{},
   newTableData: [],
+  removeIshow: true,
+  editIshow: true,
   newForm: <EstimatedReceivableI>{
     pageNum: 1,
     pageSize: 10
@@ -166,7 +170,7 @@
   itemTableLoading1: false,
   itemTableLoading2: false,
 })
-const { queryParams, form, page, selectionList, newForm, newTableData, newSelectionList, itemTableLoading1, itemTableLoading2 } = toRefs(data);
+const { queryParams, form, page, selectionList, newForm, newTableData, newSelectionList, itemTableLoading1, itemTableLoading2, removeIshow, editIshow } = toRefs(data);
 const option = ref({
   pageKey: 'EstimatedReceivable',
   rowKey: 'id',
@@ -208,16 +212,25 @@
       ],
       search: true,
     },
+    // customerName: {
+    //   label: '瀹㈡埛鍚嶇О',
+    //   rules: [
+    //     {
+    //       required: true,
+    //       message: "瀹㈡埛鍚嶇О涓嶈兘涓虹┖", trigger: "blur"
+    //     }
+    //   ],
+    //   search: true,
+    //   disabled: true,
+    // },
     customerName: {
       label: '瀹㈡埛鍚嶇О',
-      rules: [
-        {
-          required: true,
-          message: "瀹㈡埛鍚嶇О涓嶈兘涓虹┖", trigger: "blur"
-        }
-      ],
       search: true,
-      disabled: true,
+      minWidth: 220,
+
+      type: 'select',           // 璁剧疆涓轰笅鎷夋绫诲瀷
+      dicData: [], // 浣跨敤 selectCustomName 浣滀负鏁版嵁婧�
+      disabled: false  // 鏍规嵁闇�瑕佽缃槸鍚︾鐢�
     },
     projectName: {
       label: '椤圭洰鍚嶇О',
@@ -369,6 +382,21 @@
     },
     handleSelectionChangeFunc: (selection: any) => {
       selectionList.value = selection;
+      console.log(selection);
+
+      // 鏍规嵁閫変腑椤规暟閲忓拰鐘舵�佽缃紪杈戞寜閽槸鍚﹀彲鐢�
+      if (selection.length === 1 && [0, 1].includes(selection[0].relatedBillStatus)) {
+        editIshow.value = false;
+      } else {
+        editIshow.value = true;
+      }
+
+      if (selection.length === 1 && [0].includes(selection[0].isConfirmed)) {
+        removeIshow.value = false;
+      } else {
+        removeIshow.value = true;
+      }
+
     },
     getBeginListFunc: (params = {}) => {
       params.feeType = 0;
@@ -573,4 +601,20 @@
   crudRef.value.rowEdit(row, index)
   // option.value.editBtn = true;
 }
+
+/*  */
+const selectCustomName = ref([]);
+const getSelectCustomName = () => {
+  getSelectCustomNam().then((res) => {
+    if (res.code === 200) {
+      // selectCustomName.value = res.data;
+      selectCustomName.value = res.data.map(item => ({
+        dictLabel: item,
+        dictValue: item
+      }));
+      option.value.column.customerName.dicData = selectCustomName.value || [];
+    }
+  })
+}
+getSelectCustomName()
 </script>
diff --git a/ui/admin-ui3/src/views/cwgl/estimatedReceivableBill/index.vue b/ui/admin-ui3/src/views/cwgl/estimatedReceivableBill/index.vue
index 4bd13f5..4cb5738 100644
--- a/ui/admin-ui3/src/views/cwgl/estimatedReceivableBill/index.vue
+++ b/ui/admin-ui3/src/views/cwgl/estimatedReceivableBill/index.vue
@@ -148,6 +148,9 @@
 } from "@/api/cwgl/estimatedReceivableBill";
 import useCurrentInstance from "@/utils/useCurrentInstance";
 import { computed, reactive, ref, toRefs } from "vue";
+import {
+  getSelectCustomNam,
+} from "@/api/cwgl/pendingSettlementBusiness";
 import { PagesInterface, PageQueryInterface } from "@/utils/globalInterface";
 import { usePagePlus } from "@/hooks/usePagePlus";
 import { hasPermission } from "@/utils/permissionUtils";
@@ -232,15 +235,15 @@
         }
       ],
     },
+
     customerName: {
       label: '瀹㈡埛鍚嶇О',
-      rules: [
-        {
-          required: true,
-          message: "瀹㈡埛鍚嶇О涓嶈兘涓虹┖", trigger: "blur"
-        }
-      ],
       search: true,
+      minWidth: 220,
+      search: true,
+      type: 'select',           // 璁剧疆涓轰笅鎷夋绫诲瀷
+      dicData: [], // 浣跨敤 selectCustomName 浣滀负鏁版嵁婧�
+      disabled: false  // 鏍规嵁闇�瑕佽缃槸鍚︾鐢�
     },
 
     dispatchCount: {
@@ -350,9 +353,9 @@
     },
     handleSelectionChangeFunc: (selection: any) => {
       selectionList.value = selection;
-    }, 
-    
-    
+    },
+
+
   })
 const dialog = reactive({
   visible: false,
@@ -424,11 +427,27 @@
 }
 const newFormRef = ref();
 const submitForm = () => {
-  if(newTableData.value.length == 0) {
+  if (newTableData.value.length == 0) {
     proxy.$message.error('鏃犲叧鑱旀槑缁嗭紝鏃犳硶缁撶畻');
-  }else {
+    return; // 娣诲姞 return 涓柇鎵ц
+  } else {
     newFormRef.value!.validate(valid => {
       if (valid) {
+        // 娣诲姞鏍¢獙閫昏緫锛氭湰娆$粨绠楅噾棰濅笉鑳藉ぇ浜庡簲缁撶畻閲戦
+        const settlementAmount = parseFloat(newForm.value.settlementAmount);
+        const totalAmount = parseFloat(importForm.value.totalAmount);
+
+        // 妫�鏌ヨ緭鍏ユ槸鍚︿负鏈夋晥鏁板瓧
+        if (isNaN(settlementAmount) || isNaN(totalAmount)) {
+          proxy.$message.error('閲戦鏍煎紡涓嶆纭�');
+          return;
+        }
+
+        if (settlementAmount > totalAmount) {
+          proxy.$message.error('鏈缁撶畻閲戦涓嶈兘澶т簬搴旂粨绠楅噾棰�');
+          return; // 鍏抽敭锛氬湪杩欓噷娣诲姞 return 涓柇鍚庣画鎵ц
+        }
+
         let data = {
           billId: newForm.value.id,
           fileName: newForm.value.attachment
@@ -441,24 +460,22 @@
                 proxy.$message.success('鎿嶄綔鎴愬姛');
                 dialog.visible = false;
                 newForm.value = {};
-  
               }
             })
           }
         })
+      } else {
+        // 琛ㄥ崟楠岃瘉澶辫触
+        return false;
       }
     });
   }
-
-
-
 }
-
 const submitFormTow = () => {
   proxy.$modal.confirm(`鏄惁纭淇敼璐﹀崟鍚嶇О?`).then(function () {
     return updateEstimatedReceivableBillNmae(importForm.value);
   }).then((res) => {
-     onLoad(page.value);
+    onLoad(page.value);
     proxy.$modal.msgSuccess(res.msg);
   })
 
@@ -540,6 +557,21 @@
 
   })
 }
+
+const selectCustomName = ref([]);
+const getSelectCustomName = () => {
+  getSelectCustomNam().then((res) => {
+    if (res.code === 200) {
+      // selectCustomName.value = res.data;
+      selectCustomName.value = res.data.map(item => ({
+        dictLabel: item,
+        dictValue: item
+      }));
+      option.value.column.customerName.dicData = selectCustomName.value || [];
+    }
+  })
+}
+getSelectCustomName()
 </script>
 <style scoped>
 ::v-deep .el-descriptions__body .el-descriptions__table.is-bordered .el-descriptions__cell {
diff --git a/ui/admin-ui3/src/views/cwgl/pendingSettlementBusiness/index.vue b/ui/admin-ui3/src/views/cwgl/pendingSettlementBusiness/index.vue
index af35f3f..782a52a 100644
--- a/ui/admin-ui3/src/views/cwgl/pendingSettlementBusiness/index.vue
+++ b/ui/admin-ui3/src/views/cwgl/pendingSettlementBusiness/index.vue
@@ -257,12 +257,7 @@
       minWidth: 200,
 
     },
-    isCreate: {
-      label: '鏄惁宸插叆璐�', dataType: 'string',
-      type: 'select',
-      minWidth: 120,
-      dicUrl: '/system/dict/data/type/sys_whether_type',
-    },
+
     // vehicleId: {
     //   label: '杩愯緭宸ュ叿ID',hide: true,
     // },
@@ -285,47 +280,73 @@
     },
     businessContact: {
       label: '涓氬姟鑱旂郴浜�',
-       minWidth: 120,
+      minWidth: 120,
     },
     estimatedTotalIncome: {
       label: '棰勪及鎬绘敹鍏�',
-       minWidth: 120,
+      minWidth: 120,
 
     },
     estimatedTotalCost: {
       label: '棰勪及鎬绘垚鏈�',
-       minWidth: 120,
+      minWidth: 120,
 
     },
     estimatedProfit: {
       label: '棰勪及鍒╂鼎',
-       minWidth: 120,
+      minWidth: 120,
 
     },
 
     confirmedTotalIncome: {
       label: '纭鎬绘敹鍏�',
-       minWidth: 120,
+      minWidth: 120,
 
     },
     confirmedTotalCost: {
       label: '纭鎬绘垚鏈�',
-       minWidth: 120,
+      minWidth: 120,
+
+    },
+      relatedBillName: {
+      label: '鍏宠仈鑱旇处鍗曞悕绉�',
+      fixed: 'right',
+      minWidth: 120,
 
     },
     isIncomeMatched: {
       label: '鏄惁鍖归厤鏀跺叆',
-
       type: 'select',
+      dataType: 'string',
       minWidth: 120,
       dicUrl: '/system/dict/data/type/sys_matching_status',
     },
     isCostMatched: {
       label: '鏄惁鍖归厤鎴愭湰',
       type: 'select',
+      dataType: 'string',
       minWidth: 120,
       dicUrl: '/system/dict/data/type/sys_matching_status',
     },
+    
+    isCreate: {
+      label: '鏄惁宸插叆璐�', dataType: 'string',
+      type: 'select',
+      fixed: 'right',
+      minWidth: 120,
+      dicUrl: '/system/dict/data/type/sys_whether_type',
+    },
+    relatedBillStatus: {
+      minWidth: 120,
+      label: '鍏宠仈璐﹀崟鐘舵��',
+      dataType: 'string',
+      type: 'select',
+      dicUrl: '/system/dict/data/type/sys_related_status',
+      //    formatter: (row, value) => {
+      // // 鑷畾涔夋牸寮忓寲閫昏緫锛堝鏋滈渶瑕侊級
+      //   return value;
+      //  }
+    },
     // electronicLock: {
     //   label: '鐢靛瓙閿�',
     // },

--
Gitblit v1.8.0