From 33246bb56e05b273944ec1cc03a58dc112e48848 Mon Sep 17 00:00:00 2001
From: xyc <jc_xiong@hotmail.com>
Date: 星期五, 16 八月 2024 09:42:50 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 web/src/views/modules/taskReliability/SchemeCompar.vue |  144 +++++++++++++++++++++++++-----------------------
 1 files changed, 75 insertions(+), 69 deletions(-)

diff --git a/web/src/views/modules/taskReliability/SchemeCompar.vue b/web/src/views/modules/taskReliability/SchemeCompar.vue
index 0a75993..b317412 100644
--- a/web/src/views/modules/taskReliability/SchemeCompar.vue
+++ b/web/src/views/modules/taskReliability/SchemeCompar.vue
@@ -7,8 +7,8 @@
             <zt-select v-model="dataForm.productId" :datas="productList" @change="onProductSelected"/>
           </zt-form-item>
           <zt-form-item label="鍙潬鎬ф柟妗�" prop="taskModelId" width="500px">
-            <zt-select style="width: 400px" v-model="dataForm.name" :datas="schemeList"
-                       @change="onSchemeSelected" :multiple="true"/>
+            <zt-select style="width: 400px" v-model="dataForm.taskModelId" :datas="schemeList"
+                       @change="onTaskSelected" :multiple="true"/>
           </zt-form-item>
           <zt-form-item>
             <zt-button @click="compair()">鏂规瀵规瘮</zt-button>
@@ -29,29 +29,38 @@
                 <el-button v-if="!isZk" type="info" size="small" icon="el-icon-caret-right"
                            style="position: absolute;right: 10%;top: 10%;z-index: 1" @click="zk()"></el-button>
                 <div v-if="isZk" style="position: absolute;right: 10%;top: 15%">
-                  <el-table :data="tableData" border style="width: 400px">
+                  <el-table :data="tableData" border style="width: 500px">
                     <el-table-column
                       prop="name"
                       label="鏂规鍚嶇О"
                     >
                     </el-table-column>
                     <el-table-column
-                      prop="MTBF"
+                      prop="mtbf"
                       label="MTBF"
-                      width="80px"
+                      width="100px"
                       align="right">
+                      <template slot-scope="scope">
+                        <span>{{  keepNumber(scope.row.mtbf) }}</span>
+                      </template>
                     </el-table-column>
                     <el-table-column
-                      prop="MTTR"
+                      prop="mttr"
                       label="MTTR"
-                      width="80px"
+                      width="100px"
                       align="right">
+                      <template slot-scope="scope">
+                        <span>{{  keepNumber(scope.row.mttr) }}</span>
+                      </template>
                     </el-table-column>
                     <el-table-column
-                      prop="MSR"
+                      prop="msr"
                       label="MSR"
-                      width="80px"
+                      width="100px"
                       align="right">
+                      <template slot-scope="scope">
+                        <span>{{  keepNumber(scope.row.mttr) }}</span>
+                      </template>
                     </el-table-column>
                   </el-table>
                 </div>
@@ -80,59 +89,51 @@
         isShow: false,
         isZk: true,
         productList: [],
-        schemeList: [
-          {
-            id: 1,
-            name: '鏂规涓�'
-          }, {
-            id: 2,
-            name: '鏂规浜�'
-          }, {
-            id: 3,
-            name: '鏂规涓�'
-          }
-        ],
+        schemeList: [],
         dataForm: {
           id: '',
-          name: [],
+          taskModelId: [],
           productId: '',
           showProductId: '',
-          taskModelId: '',
           dataType: 'fz',
         },
-        tableData: [
-          {
-            name: '鏂规涓�',
-            MTBF: '68.74',
-            MTTR: '0.43',
-            MSR: '0.85'
-          }, {
-            name: '鏂规浜�',
-            MTBF: '78.74',
-            MTTR: '0.52',
-            MSR: '0.86'
-          }, {
-            name: '鏂规涓�',
-            MTBF: '69.84',
-            MTTR: '0.62',
-            MSR: '0.88'
-          }
-        ],
+        xDataList: [],
+        seriesList: [],
+        tableData: [],
+        taskList: [],
       }
     },
     mounted() {
       this.getProductList()
+    },
+    computed: {
+      keepNumber() { //杩囨护鍣ㄤ繚鐣�4涓哄皬鏁�
+        return function (val) {		// 瀵硅绠楀睘鎬ц繘琛屼紶鍙�
+          const numM = Number(val).toFixed(5);
+          return numM.substring(0, numM.length - 1);
+        }
+      },
     },
     components: {
       ProductModelTree,
     },
 
     methods: {
-      onTreeSelected(data) {
-        if (this.dataForm.id) {
+      async onTreeSelected(data) {
+        if (this.dataForm.taskModelId) {
           console.log(data, 'onProductSelected')
           this.dataForm.showProductId = data.id
-          this.$refs.SimulatCurve.getProductEcharts(this.dataForm);
+          let params = {
+            taskList: this.dataForm.taskModelId,
+            showProductId: this.dataForm.showProductId
+          }
+          console.log(this.dataForm.taskModelId, 'this.dataForm.taskModelId')
+          let res = await this.$http.get('/taskReliability/SimulatAssess/SchemeCompar', {params: params})
+          console.log(res.data, "res")
+          this.xDataList = res.data.xdataList
+          this.seriesList = res.data.curveList
+          this.tableData = res.data.dataList
+
         }
       },
       // 鑾峰彇淇℃伅
@@ -140,12 +141,16 @@
         this.isSelect = true
         console.log(data, ' onProductSelected(data)')
         this.dataForm.productId = data.id
+        this.getTaskList()
         this.$nextTick(() => {
           this.$refs.ProductModelTree.getProductList()
         })
       },
-      onSchemeSelected() {
-        console.log(this.dataForm.name)
+      onTaskSelected(data) {
+        console.log(data, 'onTaskSelected(data)')
+        for (let item of data) {
+          this.taskList.push(item.name)
+        }
       },
       zk() {
         this.isZk = !this.isZk;
@@ -155,11 +160,31 @@
         this.productList = res.data
         this.onProductSelected(this.productList[0])
       },
-      compair() {
+      async getTaskList() {
+        let params = {
+          productId: this.dataForm.productId
+        }
+        let res = await this.$http.get('/taskReliability/Task/getTaskList', {params: params})
+        console.log(res.data)
+        this.schemeList = res.data
+      },
+      async compair() {
+        let params = {
+          taskList: this.dataForm.taskModelId,
+          showProductId: null
+        }
+        console.log(this.dataForm.taskModelId, 'this.dataForm.taskModelId')
+        let res = await this.$http.get('/taskReliability/SimulatAssess/SchemeCompar', {params: params})
+        console.log(res.data, "res")
+        this.xDataList = res.data.xdataList
+        this.seriesList = res.data.curveList
+        this.tableData = res.data.dataList
+
+
         this.isShow = true
         this.option = {
           xAxis: {
-            data: [0.0, 50.0, 100.0, 150.0, 200.0, 250.0, 300.0, 350.0, 400.0, 450.0, 500.0, 550.0],
+            data: this.xDataList,
             name: '浠跨湡鎬绘椂闀�'
           },
           yAxis: {
@@ -167,28 +192,9 @@
             name: '鍙潬搴�',
           },
           legend: {
-            data: ['鏂规涓�', '鏂规浜�', '鏂规涓�']
+            data: this.taskList
           },
-          series: [
-            {
-              name: '鏂规涓�',
-              type: 'line',
-              smooth: true,
-              data: [1.0, 0.6, 0.39, 0.39, 0.24, 0.14, 0.08, 0.06, 0.06, 0.04, 0.02, 0.01, 0.01, 0.0, 0.0]
-            },
-            {
-              name: '鏂规浜�',
-              type: 'line',
-              smooth: true,
-              data: [1.0, 0.8, 0.59, 0.58, 0.34, 0.35, 0.18, 0.16, 0.16, 0.04, 0.04, 0.02, 0.01, 0.1, 0.0]
-            },
-            {
-              name: '鏂规涓�',
-              type: 'line',
-              smooth: true,
-              data: [1.0, 0.7, 0.45, 0.44, 0.38, 0.38, 0.15, 0.08, 0.08, 0.02, 0.02, 0.01, 0.01, 0.1, 0.0]
-            }
-          ]
+          series: this.seriesList
         };
         this.myChart = echart.init(document.getElementById("myChart"));
         console.log(this.option, ' this.option ')

--
Gitblit v1.9.1