From 7830892e2769b805f7a4683512ac1db52ab6c6e7 Mon Sep 17 00:00:00 2001
From: haoxuan <haoxuan>
Date: 星期三, 27 三月 2024 19:26:38 +0800
Subject: [PATCH] 增加2个部分表头配置的问题

---
 src/views/sales/salesDetails/index.vue |   49 ++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 44 insertions(+), 5 deletions(-)

diff --git a/src/views/sales/salesDetails/index.vue b/src/views/sales/salesDetails/index.vue
index 928d62b..37e76fb 100644
--- a/src/views/sales/salesDetails/index.vue
+++ b/src/views/sales/salesDetails/index.vue
@@ -221,11 +221,26 @@
       { label: "浜у搧瑙勬牸", prop: "specs" },
       { label: "鍗曚綅", prop: "unit" },
       { label: "璁㈠崟鏁伴噺", prop: "amount" },
-      { label: "宸插畬鎴愭暟閲�", prop: "finishAmount" },
-      { label: "宸插彂璐ф暟閲�", prop: "deliveryAmount" },
-      { label: "閲囪喘鏁伴噺", prop: "purchaseAmount" },
-      { label: "鐢熶骇鏁伴噺", prop: "makeAmount" },
-      { label: "濮斿鏁伴噺", prop: "outsourcingAmount" },
+      { 
+        label: "宸插畬鎴愭暟閲�", 
+        prop: "finishAmount",
+        isClass: true,
+        getClassName: this.getAmountClassName, 
+      },
+      { label: "宸插彂璐ф暟閲�", prop: "deliveryAmount", 
+        isClass: true,
+        getClassName: this.getAmountClassName,  },
+      { label: "閲囪喘鏁伴噺", 
+        isClass: true,
+        getClassName: this.getFinishAmountClassName, 
+        prop: "purchaseAmount",
+      },
+      { label: "鐢熶骇鏁伴噺", prop: "makeAmount" ,
+        isClass: true,
+        getClassName: this.getFinishAmountClassName, },
+      { label: "濮斿鏁伴噺", prop: "outsourcingAmount",
+        isClass: true,
+        getClassName: this.getFinishAmountClassName,  },
       { label: "閿�鍞崟浠�", prop: "price", price: true },
       { label: "鎴愭湰鍗曚环", prop: "cost" },
       { label: "姣涘埄", prop: "profit" },
@@ -483,6 +498,29 @@
     this.getProjectList()
   },
   methods: {
+    getFinishAmountClassName(val, row) {
+      let parts = val.split("/"); 
+      let numerator = parseInt(parts[0], 10); // 鍒嗗瓙  
+      let denominator = parseInt(parts[1], 10); // 鍒嗘瘝 
+      let classname = "";
+      if (numerator / denominator === 0||numerator===0) {
+        classname = "error";
+      }else if(numerator / denominator === 1){
+        classname = "success";
+      }else if((numerator / denominator) > 0&&(numerator / denominator) <1){
+        classname = "warning-radio";
+      }
+      console.log(classname, numerator,denominator,"鐪嬩笅")
+      return classname;
+    },
+    getAmountClassName(val){
+      console.log(val,"val11")
+      let classname = "";
+      if(val===0){
+        classname = "error";
+      }
+      return classname;
+    },
     getpurchaseStatus(val) {
       if (val) {
         for (let i in this.purchaseStatusList) {
@@ -728,6 +766,7 @@
     shipmentsClick(row){
       this.editShipmentsConfig.visible=true
       this.editShipmentsConfig.infomation.saleDetailID=row.id
+      this.editShipmentsConfig.infomation.deliverType=row.deliverType?row.deliverType:1
       this.editShipmentsConfig.infomation.saleDetailNumber=row.number
       this.editShipmentsConfig.infomation.projectId=row.projectId
     },

--
Gitblit v1.8.0