From 40fee153f5c427c23b7191e8116c342b51ac6009 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期二, 27 一月 2026 17:10:41 +0800
Subject: [PATCH] 业务管理:问题修复

---
 src/views/statisticalCharts/qualificationRateStatistics/index.vue |  143 ++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 115 insertions(+), 28 deletions(-)

diff --git a/src/views/statisticalCharts/qualificationRateStatistics/index.vue b/src/views/statisticalCharts/qualificationRateStatistics/index.vue
index 3456973..b009415 100644
--- a/src/views/statisticalCharts/qualificationRateStatistics/index.vue
+++ b/src/views/statisticalCharts/qualificationRateStatistics/index.vue
@@ -1,19 +1,19 @@
 <template>
   <div class="app-container">
     <el-row>
-      <el-col :span="4">
-        <el-radio-group v-model="dateType" @change="changeDateType">
-          <el-radio-button label="1">鏈懆</el-radio-button>
-          <el-radio-button label="2">鏈湀</el-radio-button>
-          <el-radio-button label="3">浠婂勾</el-radio-button>
-        </el-radio-group>
-      </el-col>
+<!--      <el-col :span="4">-->
+<!--        <el-radio-group v-model="dateType" @change="changeDateType">-->
+<!--          <el-radio-button label="1">鏈懆</el-radio-button>-->
+<!--          <el-radio-button label="2">鏈湀</el-radio-button>-->
+<!--          <el-radio-button label="3">浠婂勾</el-radio-button>-->
+<!--        </el-radio-group>-->
+<!--      </el-col>-->
       <el-col :span="20">
         <el-form ref="entity" size="small" :inline="true">
           <el-form-item style="width: 20%;">
-            <el-date-picker v-model="datePicker" end-placeholder="缁撴潫鏃ユ湡" format="yyyy-MM-dd" placeholder="閫夋嫨鏃ユ湡"
+            <el-date-picker :picker-options="pickerOptions" v-model="datePicker" end-placeholder="缁撴潫鏃ユ湡" format="yyyy-MM-dd" placeholder="閫夋嫨鏃ユ湡"
               range-separator="鑷�" size="small" start-placeholder="寮�濮嬫棩鏈�" type="daterange" style="width: 100%;"
-              value-format="yyyy-MM-dd" @change="changeDatePicker">
+              value-format="yyyy-MM-dd" clearable @change="changeDatePicker">
             </el-date-picker>
           </el-form-item>
           <el-form-item label="鏍峰搧鍚嶇О" prop="sampleName">
@@ -25,6 +25,13 @@
           <el-form-item label="渚涘簲鍟嗗悕绉�" prop="supplierName">
             <el-input v-model="supplierName" clearable placeholder="璇疯緭鍏ヤ緵搴斿晢鍚嶇О" size="small"
               @change="changeDate"></el-input>
+          </el-form-item>
+          <el-form-item label="IFS鍩�" prop="contract">
+            <el-select v-model="contract" clearable placeholder="璇烽�夋嫨IFS鍩�" size="small"
+                        @change="changeDate">
+              <el-option label="ZTNS" value="ZTNS"/>
+              <el-option label="KJNS" value="KJNS"/>
+            </el-select>
           </el-form-item>
         </el-form>
       </el-col>
@@ -108,11 +115,39 @@
   data() {
     // 杩欓噷瀛樻斁鏁版嵁
     return {
+      pickerOptions: {
+        shortcuts: [{
+          text: '鏈�杩戜竴鍛�',
+          onClick(picker) {
+            const end = new Date();
+            const start = new Date();
+            start.setTime(start.getTime() - 3600 * 1000 * 24 * 6);
+            picker.$emit('pick', [start, end]);
+          }
+        }, {
+          text: '鏈�杩戜竴涓湀',
+          onClick(picker) {
+            const end = new Date();
+            const start = new Date();
+            start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
+            picker.$emit('pick', [start, end]);
+          }
+        }, {
+          text: '鏈�杩戜竴骞�',
+          onClick(picker) {
+            const end = new Date();
+            const start = new Date();
+            start.setTime(start.getTime() - 3600 * 1000 * 24 * 365);
+            picker.$emit('pick', [start, end]);
+          }
+        }]
+      },
       dateType: '1',
       datePicker: [],
       beginDate: '',
       endDate: '',
       sampleName: '',
+      contract: '',
       modelName: '',
       supplierName: '',
       inspectionTitle: '鍘熸潗鏂�',
@@ -180,7 +215,7 @@
           data: [],
           label: {
             show: true,
-            formatter: (v) => v.value + '%'
+            formatter: (v) =>  v.value + '%'
           }
         }
       ],
@@ -203,7 +238,7 @@
         }
       },
       lineColors: ['#91A0FC'],
-      barColors: ['#13ce66', '#F56C6C'], // 鍚堟牸缁� / 涓嶅悎鏍肩孩
+      barColors: ['#9fe080', '#ff994d'], // 鍚堟牸缁� / 涓嶅悎鏍肩孩
       barColors2: ['#A4EEDA'],
       pieTooltip: {
         trigger: 'item'
@@ -214,7 +249,7 @@
       },
       rawPieSeries: [
         {
-          name: 'Access From',
+          name: '',
           type: 'pie',
           radius: '70%',
           center: ['50%', '50%'],
@@ -224,7 +259,7 @@
             borderWidth: 2
           },
           label: {
-            alignTo: 'edge',
+            alignTo: 'labelLine',
             formatter: '{name|{b}}\n{time|{c}}',
             edgeDistance: 10,
             lineHeight: 15,
@@ -240,14 +275,14 @@
             length2: 40
           },
           data: [
-            { value: 0, name: '涓嶅悎鏍兼暟閲�', itemStyle: { color: '#F56C6C' } },
-            { value: 0, name: '鍚堟牸鏁伴噺', itemStyle: { color: '#67C23A' } }
+            { value: 0, name: '涓嶅悎鏍兼暟閲�', itemStyle: {color: '#ff994d'} },
+            { value: 0, name: '鍚堟牸鏁伴噺', itemStyle: { color: '#9fe080' } }
           ]
         }
       ],
       conductorPieSeries: [
         {
-          name: 'Access From',
+          name: '',
           type: 'pie',
           radius: '70%',
           center: ['50%', '50%'],
@@ -257,7 +292,7 @@
             borderWidth: 2
           },
           label: {
-            alignTo: 'edge',
+            alignTo: 'labelLine',
             formatter: '{name|{b}}\n{time|{c}}',
             edgeDistance: 10,
             lineHeight: 15,
@@ -273,14 +308,14 @@
             length2: 40,
           },
           data: [
-            { value: 0, name: '涓嶅悎鏍兼暟閲�', itemStyle: { color: '#F56C6C' } },
-            { value: 0, name: '鍚堟牸鏁伴噺', itemStyle: { color: '#67C23A' } },
+            { value: 0, name: '涓嶅悎鏍兼暟閲�', itemStyle: { color: '#ff994d' } },
+            { value: 0, name: '鍚堟牸鏁伴噺', itemStyle: { color: '#9fe080' } },
           ]
         }
       ],
       dlanPieSeries: [
         {
-          name: 'Access From',
+          name: '',
           type: 'pie',
           radius: '70%',
           center: ['50%', '50%'],
@@ -290,7 +325,7 @@
             borderWidth: 2
           },
           label: {
-            alignTo: 'edge',
+            alignTo: 'labelLine',
             formatter: '{name|{b}}\n{time|{c}}',
             edgeDistance: 10,
             lineHeight: 15,
@@ -306,8 +341,8 @@
             length2: 40,
           },
           data: [
-            { value: 0, name: '涓嶅悎鏍兼暟閲�', itemStyle: { color: '#F56C6C' } },
-            { value: 0, name: '鍚堟牸鏁伴噺', itemStyle: { color: '#67C23A' } },
+            { value: 0, name: '涓嶅悎鏍兼暟閲�', itemStyle: { color: '#ff994d' } },
+            { value: 0, name: '鍚堟牸鏁伴噺', itemStyle: { color: '#9fe080' } },
           ]
         }
       ],
@@ -405,7 +440,6 @@
       sum: '',
     }
   },
-
   mounted() {
     this.setBarChartTitle();
     this.getBar();
@@ -414,15 +448,34 @@
     this.getPassRateCom();
     this.getTableData();
   },
-
+watch:{
+  datePicker:{
+    handler(newVal){
+      //璁$畻寮�濮嬫椂闂翠笌缁撴潫鏃堕棿鐨勫ぉ鏁板樊
+      if (newVal && newVal.length === 2) {
+        const startDate = new Date(newVal[0]);
+        const endDate = new Date(newVal[1]);
+        const timeDiff = endDate - startDate;
+        const dayDiff = timeDiff / (1000 * 3600 * 24);
+        if (dayDiff <= 7) {
+          this.dateType = '1';
+        } else if (dayDiff > 7 && dayDiff <= 31) {
+          this.dateType = '2';
+        } else if (dayDiff > 31) {
+          this.dateType = '3';
+        }
+      }else{
+        this.dateType = '1';
+      }
+    },  immediate:true
+  }
+},
   // 鏂规硶闆嗗悎
   methods: {
     // 鑾峰彇鍚堟牸鐜囧浘琛ㄦ暟鎹�
-
     setBarChartTitle() {
       this.echartsOptions.title.text = `${this.inspectionTitle}鍚堟牸鐜囪秼鍔縛;
     },
-
     getBar() {
       const types = this.currentMaterialProp.split(',');
       const requests = types.map(t => {
@@ -433,6 +486,7 @@
           sampleName: this.sampleName,
           modelName: this.modelName,
           supplierName: this.supplierName,
+          contract:this.contract,
           materialProp: t,
         };
         return getRawPassRateByBarChart(params);
@@ -454,7 +508,38 @@
           }
         });
 
-        const sortedDates = Object.keys(dateMap).sort();
+        const weekOrderMap = {
+          "鏄熸湡涓�": 0,
+          "鏄熸湡浜�": 1,
+          "鏄熸湡涓�": 2,
+          "鏄熸湡鍥�": 3,
+          "鏄熸湡浜�": 4,
+          "鏄熸湡鍏�": 5,
+          "鏄熸湡鏃�": 6
+        };
+        const yearOrderMap = {
+          "1鏈�": 0,
+          "2鏈�": 1,
+          "3鏈�": 2,
+          "4鏈�": 3,
+          "5鏈�": 4,
+          "6鏈�": 5,
+          "7鏈�": 6,
+          "8鏈�": 7,
+          "9鏈�": 8,
+          "10鏈�": 9,
+          "11鏈�": 10,
+          "12鏈�": 11
+        };
+        const sortedDates = Object.keys(dateMap).sort((a, b) => {
+          if(a.includes("鏄熸湡") && b.includes("鏄熸湡")) {
+            return weekOrderMap[a] - weekOrderMap[b];
+          } else if(a.includes("鏈�") && b.includes("鏈�")) {
+            return yearOrderMap[a] - yearOrderMap[b];
+          } else {
+            return new Date(a) - new Date(b);
+          }
+        });
         let qualifiedData = [];
         let unQualifiedData = [];
         let lineData = [];
@@ -496,6 +581,7 @@
             sampleName: this.sampleName,
             modelName: this.modelName,
             supplierName: this.supplierName,
+            contract:this.contract,
             materialProp: t
           };
           return getRawPassRateByCake(params);
@@ -604,6 +690,7 @@
           sampleName: this.sampleName,
           modelName: this.modelName,
           supplierName: this.supplierName,
+          contract:this.contract,
           materialProp: t,
         };
         return getMaterialPropTable(params);

--
Gitblit v1.9.3