From 1ed203eafe41ee25a8bbac1387b60ae34ae2687c Mon Sep 17 00:00:00 2001
From: yuyu <1981343953@qq.com>
Date: 星期二, 22 八月 2023 10:04:12 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.110.209:9001/r/lims-before

---
 src/views/experiment/passRateStatistics/index.vue |  240 +++++++++++++++++++++++++++++++++++++----------------------
 1 files changed, 150 insertions(+), 90 deletions(-)

diff --git a/src/views/experiment/passRateStatistics/index.vue b/src/views/experiment/passRateStatistics/index.vue
index 8783d00..e59f783 100644
--- a/src/views/experiment/passRateStatistics/index.vue
+++ b/src/views/experiment/passRateStatistics/index.vue
@@ -2,52 +2,48 @@
   <div class="content-main">
     <div class="top-bar">
       <el-form ref="form" :inline="true" :rules="rules" :model="searchData" label-position="top">
-              <el-form-item label="妫�娴嬫棩鏈�:" class="sermargin" prop="date">
-                <el-date-picker
-                  v-model="searchData.date"
-                  type="daterange"
-                  range-separator="鑷�"
-                  start-placeholder="寮�濮嬫棩鏈�"
-                  end-placeholder="缁撴潫鏃ユ湡">
-                </el-date-picker>
-              </el-form-item>
-              <el-form-item label="妫�楠岀被鍨�:" class="sermargin" prop="type">
-                <el-select v-model="searchData.type" placeholder="鍏ㄩ儴">
-                  <el-option
-                    v-for="item in options"
-                    :key="item.value"
-                    :label="item.label"
-                    :value="item.value">
-                  </el-option>
-                </el-select>
-              </el-form-item>
-              <el-form-item label="鐗╂枡鍒嗙粍:">
-                <el-button type="primary" icon="el-icon-plus" class="chooseMaterialBtn" >閫夋嫨鐗╂枡鍒嗙粍</el-button>
-              </el-form-item>
-              <div class="rightBtn">
-                <el-form-item>
-                  <el-button type="primary" plain size="mini">娓呯┖</el-button>
-                  <el-button type="primary" @click="search" size="mini">鏌ヨ</el-button>
-                </el-form-item>
-              </div>
-              </el-form>
+        <el-form-item label="妫�娴嬫棩鏈�:" class="sermargin" prop="date">
+          <el-date-picker v-model="searchData.date" type="daterange" range-separator="鑷�" start-placeholder="寮�濮嬫棩鏈�"
+            end-placeholder="缁撴潫鏃ユ湡">
+          </el-date-picker>
+        </el-form-item>
+        <el-form-item label="妫�楠岀被鍨�:" class="sermargin" prop="type">
+          <el-select v-model="searchData.type" placeholder="鍏ㄩ儴">
+            <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
+            </el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="渚涘簲鍟�:">
+          <el-select v-model="searchData.supplier" placeholder="鍏ㄩ儴">
+            <el-option v-for="item in supplier" :key="item.value" :label="item.label" :value="item.value">
+            </el-option>
+          </el-select>
+        </el-form-item>
+        <div class="rightBtn">
+          <el-form-item>
+            <el-button type="primary" plain size="mini">娓呯┖</el-button>
+            <el-button type="primary" @click="search" size="mini">鏌ヨ</el-button>
+          </el-form-item>
+        </div>
+      </el-form>
     </div>
     <div class="top-bar-copy"></div>
     <div class="chart-content">
       <div class="qualified-wrapper">
-        <div style="margin-left: 20px;padding:20px 0px;font-size:18px">妫�娴嬫壒娆″悎鏍肩巼缁熻</div>
+        <div style="margin-left: 20px;padding:20px 0px;font-size:18px">妫�娴嬫牱鍝佸悎鏍肩巼缁熻</div>
         <div class="qualified" ref="qualified"></div>
       </div>
       <div class="unqualified">
-          <div class="firstBox-wrapper" >
-            <div style="margin-left: 20px;padding:20px 0px;font-size:18px">渚涘簲鍟嗕笉鍚堟牸娆℃暟缁熻</div>
-            <div class="firstBox" ref="unqualified_provider"></div>
-          </div>
-        <div class="secondBox-wrapper" >
+        <div class="firstBox-wrapper">
+          <div style="margin-left: 20px;padding:20px 0px;font-size:18px">渚涘簲鍟嗕笉鍚堟牸娆℃暟缁熻</div>
+          <div class="firstBox" ref="unqualified_provider"></div>
+        </div>
+        <div class="secondBox-wrapper">
           <div class="secondBox_header">
             <div style="font-size:18px">涓嶅悎鏍奸」鐩粺璁�</div>
             <el-radio-group v-model="type">
-              <el-radio-button v-for="item in radiooptions" :key="item.value" :label="item.value" >{{ item.label }}</el-radio-button>
+              <el-radio-button v-for="item in radiooptions" :key="item.value" :label="item.value">{{ item.label
+              }}</el-radio-button>
             </el-radio-group>
           </div>
           <div class="secondBox" ref="unqualified_project"></div>
@@ -55,14 +51,14 @@
       </div>
     </div>
     <div class="bottom">
-      <el-button type="primary" size="mini" >鏁版嵁瀵煎嚭</el-button>
+      <el-button type="primary" size="mini">鏁版嵁瀵煎嚭</el-button>
     </div>
   </div>
 </template>
 
 <script>
 // 娣诲姞婊氬姩鐩戝惉浜嬩欢
-window.addEventListener('scroll', function() {
+window.addEventListener('scroll', function () {
   var topBar = document.querySelector('.top-bar');
   var scrollTop = window.pageYOffset || document.documentElement.scrollTop;
 
@@ -74,25 +70,32 @@
 })
 
 import * as echarts from 'echarts'
+import { getSupplierList,getTestSampleStatistics,getSupplierNoPassStatistics,getNoPassProjectStatistics } from '@/api/experiment/passRateStatistics';
+import { dateFormat } from '../../../utils/dateUtil'
 export default {
-  data(){
+  data() {
     return {
-      searchData:{
+      supplier: [],
+      searchData: {
         date: [],
-        type: 0,
-        group: ''
+        type: null,
+        supplier: null
       },
-      options:[
+      options: [
         {
-          label: '閲囪喘鍏ュ簱',
+          label: '鍘熸潗鏂�',
           value: 0
         },
         {
-          label: 'xxxx',
+          label: '鎴愬搧',
           value: 1
+        },
+        {
+          label: '濮旀墭鍝�',
+          value: 2
         }
       ],
-      radiooptions:[
+      radiooptions: [
         {
           label: '鐜舰楗煎浘',
           value: 0
@@ -104,12 +107,15 @@
       ],
       type: 0,
       rules: {
-        date: [{required: true, message: '璇疯緭鍏ヨ处鍙�', trigger: 'blur'}],
-        type: [{required: true, message: '璇疯緭鍏ュ悕瀛�', trigger: 'blur'}]
+        // date: [{ required: true, message: '璇疯緭鍏ヨ处鍙�', trigger: 'blur' }],
+        // type: [{ required: true, message: '璇疯緭鍏ュ悕瀛�', trigger: 'blur' }]
       }
     }
   },
   mounted() {
+    this.getSupplierList()
+    this.getTestSampleStatistics()
+    this.getSupplierNoPassStatistics()
     const chartDom_qualified = this.$refs.qualified;
     const chartDom_unqualified_provider = this.$refs.unqualified_provider;
     const chartDom_unqualified_project = this.$refs.unqualified_project;
@@ -118,6 +124,9 @@
     const myChart2 = echarts.init(chartDom_unqualified_provider);
     const myChart3 = echarts.init(chartDom_unqualified_project);
 
+    /**
+     * 妫�娴嬪悎鏍肩巼缁熻
+     */
     const option_qualified = {
       tooltip: {
         trigger: 'axis',
@@ -164,15 +173,18 @@
         }
       ]
     };
-    const option_unqualified1 ={
+    /**
+     * 渚涘簲鍟�
+     */
+    const option_unqualified1 = {
       tooltip: {
         trigger: 'axis',
         axisPointer: { // 鍧愭爣杞存寚绀哄櫒锛屽潗鏍囪酱瑙﹀彂鏈夋晥
           type: 'shadow' // 榛樿涓虹洿绾匡紝鍙�変负锛�'line' | 'shadow'
         },
-        formatter: function(params) {
+        formatter: function (params) {
           let tooltip = params[0].name + '<br/>';
-          params.forEach(function(item) {
+          params.forEach(function (item) {
             tooltip += item.marker + ' ' + item.seriesName + ': ' + item.value.toFixed(2) + '%<br/>'; // 灏嗘暟鎹繚鐣欎袱浣嶅皬鏁板苟杞负鐧惧垎姣斿舰寮�
           });
           return tooltip;
@@ -185,13 +197,13 @@
         data: ['渚涘簲鍟�1', '渚涘簲鍟�2', '渚涘簲鍟�3', '渚涘簲鍟�4']
       },
       yAxis: [
-          {
-            type: 'value',
-            axisLabel: {
-              formatter: '{value}%'
-            }
+        {
+          type: 'value',
+          axisLabel: {
+            formatter: '{value}%'
           }
-        ],
+        }
+      ],
       series: [
         {
           name: '鍚堟牸鏁伴噺',
@@ -207,6 +219,9 @@
         }
       ]
     };
+    /**
+     * 涓嶅悎鏍奸」鐩�
+     */
     const option_unqualified2 = {
       legend: {
         orient: 'vertical',
@@ -246,25 +261,54 @@
 
     myChart1.setOption(option_qualified);
     myChart2.setOption(option_unqualified1);
-    if(this.type === 0){
+    if (this.type === 0) {
       myChart3.setOption(option_unqualified2);
     }
-    if(this.type === 1){
+    if (this.type === 1) {
       myChart3.setOption(option_unqualified2);
+    }
+  },
+  methods: {
+    search() {
+      this.getTestSampleStatistics()
+    },
+    dateHandle(){
+      let data=JSON.parse(JSON.stringify(this.searchData))
+      if(this.searchData.date.length!=0&&this.searchData.date !=[]){
+        data.beginDate=dateFormat(this.searchData.date[0])
+        data.endDate=dateFormat(this.searchData.date[1])
+      }
+      data.date=null
+      return data
+    },
+    async getSupplierList() {
+      let res = await getSupplierList()
+      res.data.forEach(item => {
+        this.supplier.push({ label: item.supplier, value: item.supplier })
+      })
+    },
+    getTestSampleStatistics(){
+     let param= this.dateHandle()
+     let res =getTestSampleStatistics(param)
+    },
+    getSupplierNoPassStatistics(){
+      let param= this.dateHandle()
+      getSupplierNoPassStatistics(param)
     }
   }
 }
 </script>
 
 <style lang="scss" scoped>
-.content-main{
-  height:100%;
+.content-main {
+  height: 100%;
   width: 100%;
-  .top-bar{
+
+  .top-bar {
     position: absolute;
     width: 99%;
     top: 0;
-    left:0;
+    left: 0;
     z-index: 999;
     margin-top: 5px;
     margin-left: 9.5px;
@@ -272,79 +316,95 @@
     display: flex;
     justify-content: space-between;
     padding: 5px 24px 0px 24px;
-    transition: position 0.3s ease; 
-    .el-form{
+    transition: position 0.3s ease;
+
+    .el-form {
       width: 100%;
-      .chooseMaterialBtn{
+
+      .chooseMaterialBtn {
         background-color: #fff;
-        border-color: rgba(192,196,204,0.5);
+        border-color: rgba(192, 196, 204, 0.5);
         color: gray;
         width: 220px;
       }
     }
-    .sermargin{
+
+    .sermargin {
       margin-right: 60px;
     }
-    .rightBtn{
-      display:flex;
-      justify-content:end;
+
+    .rightBtn {
+      display: flex;
+      justify-content: end;
       margin-right: 20px;
       margin-top: -40px;
       margin-bottom: -10px;
     }
   }
+
   .top-bar.fixed {
     position: fixed;
     top: 0.45rem;
     left: 0.52rem;
-    width:93.8%;
+    width: 93.8%;
   }
-  .top-bar-copy{
+
+  .top-bar-copy {
     width: 100%;
     height: 12vh;
   }
-  .chart-content{
+
+  .chart-content {
     margin: 0px -15px;
     margin-bottom: 60px;
-    .qualified-wrapper{
+
+    .qualified-wrapper {
       // margin-top: 14vh;
       background-color: #fff;
       width: 100%;
-      height:50vh;
+      height: 50vh;
     }
-    .qualified{
+
+    .qualified {
       width: 100%;
       height: 400px;
     }
-    .unqualified{
+
+    .unqualified {
       margin-top: 10px;
       height: 50vh;
-      display:flex;
+      display: flex;
       justify-content: space-between;
-      .firstBox-wrapper{
+
+      .firstBox-wrapper {
         background-color: #fff;
-        width:49%;
-        .firstBox{
+        width: 49%;
+
+        .firstBox {
           width: 100%;
           height: 40vh;
         }
       }
-      .secondBox-wrapper{
-        background-color:#fff;
-        width:49%;
-        .secondBox_header{
-          display:flex;
+
+      .secondBox-wrapper {
+        background-color: #fff;
+        width: 49%;
+
+        .secondBox_header {
+          display: flex;
           justify-content: space-between;
           margin: 20px 20px;
         }
-        .secondBox{
+
+        .secondBox {
           width: 100%;
           height: 40vh;
         }
       }
     }
   }
-  .bottom{
+
+  .bottom {
     position: fixed;
     width: 95%;
     bottom: 0rem !important;
@@ -352,7 +412,7 @@
     margin: 0px -15px;
     padding: 20px 40px;
     z-index: 999;
-    display:flex;
+    display: flex;
     justify-content: end;
     background-color: #fff;
   }

--
Gitblit v1.9.3