From 8ef314c5ae48c2046a93bbae35099fe1636805b7 Mon Sep 17 00:00:00 2001
From: value <z1292839451@163.com>
Date: 星期六, 26 八月 2023 15:37:37 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 src/views/chart/work/index.vue                     |   82 ++++++++-----
 src/views/standardLibrary/index.vue                |   70 ++++++++++
 src/api/standardLibrary.js                         |   18 +++
 src/main.js                                        |    1 
 src/components/experiment/checkTheReport/index.vue |  126 +++++++++++++++++++++
 src/layout/components/Navbar.vue                   |    2 
 package.json                                       |    1 
 src/views/experiment/checkTheReport/index.vue      |   48 +++++++
 src/router/index.js                                |    1 
 9 files changed, 310 insertions(+), 39 deletions(-)

diff --git a/package.json b/package.json
index 048f7b0..0b19172 100644
--- a/package.json
+++ b/package.json
@@ -25,6 +25,7 @@
     "nprogress": "0.2.0",
     "path-to-regexp": "2.4.0",
     "postcss-pxtorem": "^5.1.1",
+    "print-js": "^1.6.0",
     "vue": "2.6.10",
     "vue-clipboard2": "^0.3.3",
     "vue-router": "3.0.6",
diff --git a/src/api/standardLibrary.js b/src/api/standardLibrary.js
index 09b57f9..2eb0e96 100644
--- a/src/api/standardLibrary.js
+++ b/src/api/standardLibrary.js
@@ -7,6 +7,24 @@
   })
 }
 
+//鑾峰彇鎵�鏈夌増鏈�
+export function getVersion(params){
+  return request({
+    url: '/product/chooseVersion',
+    method: 'get',
+    params
+  })
+}
+
+//娣诲姞鍚屼竴涓瀷鍙风殑鍏朵粬鐗堟湰
+export function addVersion(params){
+  return request({
+    url: '/product/addVersion',
+    method: 'post',
+    params
+  })
+}
+
 // 鑾峰彇鎵�鏈夐」鐩�
 export function getProductList(params) {
   return request({
diff --git a/src/components/experiment/checkTheReport/index.vue b/src/components/experiment/checkTheReport/index.vue
new file mode 100644
index 0000000..72f4c28
--- /dev/null
+++ b/src/components/experiment/checkTheReport/index.vue
@@ -0,0 +1,126 @@
+<template>
+    <div class="preview-main">
+        <div class="logo">
+            <img :src="logoSrc" />
+        </div>
+        <div class="center">
+            <h1>鍘熸潗鏂欐娴嬫姤鍛�</h1>
+            <table>
+                <tr>
+                    <td>鏉愭枡鍚嶇О</td>
+                    <td colspan="5"></td>
+                </tr>
+                <tr>
+                    <td>瑙勬牸鍨嬪彿</td>
+                    <td colspan="2"></td>
+                    <td>鏉愭枡鍘傚</td>
+                    <td colspan="2"></td>
+                </tr>
+                <tr>
+                    <td>鏉愭枡鎵瑰彿</td>
+                    <td colspan="2"></td>
+                    <td>妫�娴嬬紪鍙�</td>
+                    <td colspan="2"></td>
+                </tr>
+                <tr>
+                    <td>妫�娴嬩緷鎹�</td>
+                    <td colspan="2"></td>
+                    <td>妫�娴嬬被鍒�</td>
+                    <td colspan="2"></td>
+                </tr>
+                <tr>
+                    <td>搴忓彿</td>
+                    <td>妫�楠岄」鐩�</td>
+                    <td>鍗曚綅</td>
+                    <td>鏍囧噯瑕佹眰</td>
+                    <td>妫�娴嬬粨鏋�</td>
+                    <td>鍗曢」鍒ゆ柇</td>
+                </tr>
+                <tr v-for="item in 15" :key="item">
+                    <td>{{item}}</td>
+                    <td></td>
+                    <td></td>
+                    <td></td>
+                    <td></td>
+                    <td></td>
+                </tr>
+                <tr>
+                    <td colspan="6">妫�楠岀粨璁猴細</td>
+                </tr>
+                <tr>
+                    <td colspan="6">
+                        娉細鈥溾垰鈥濊〃绀鸿椤圭洰鍚堟牸锛屸�溍椻�濊〃绀鸿椤圭洰涓嶅悎鏍尖�溾�斺�濊〃绀鸿椤圭洰涓嶈姹傛娴嬨��
+                    </td>
+                </tr>
+            </table>
+            <el-row class="date-group" :gutter="20">
+                <el-col :span="8">妫�娴嬨�佹棩鏈燂細<span>2023-08-25</span></el-col>
+                <el-col :span="8">瀹℃牳銆佹棩鏈燂細<span>2023-08-25</span></el-col>
+                <el-col :span="8">鎵瑰噯銆佹棩鏈燂細<span>2023-08-25</span></el-col>
+            </el-row>
+            <p class="footer">
+                <span>缂栧彿:</span><span>ZTT/ICSRCP18-003</span>
+                <span> 鍙戣鏃ユ湡:</span><span>2023-08-25</span>
+                <span> 鍙戣閮ㄩ棬:</span><span>璐ㄩ噺閮�</span>
+                <span> 淇濆瓨鏈熼檺:</span><span>闀挎湡</span>
+            </p>
+        </div>
+    </div>
+</template>
+<script>
+export default({
+    data() {
+        return {
+            logoSrc : require("@/assets/404_images/logo.png"),    
+        }
+    }
+})
+</script>
+<style scoped lang="scss">
+     .preview-main{
+        margin: 0;
+        padding: 0;
+        width:90%;
+        margin-left: 5%;
+        .logo{
+            img{
+                width: 150px;
+                height: 60px;
+            }
+        }
+        .center{
+            width: 100%;
+            h1{
+                width:100%;
+                font-family: "寰蒋闆呴粦" !important;
+                text-align: center;
+            }
+            table{
+                width:100%;
+                height:100vh;
+                border-collapse: collapse;
+                font-size: 18px;
+            }
+            table,tr,th,td{
+                border: 2px solid black;
+            }
+            tr,td,th{
+                padding: 15px 20px;
+            }
+            .date-group .el-col{
+                text-align: center;
+                padding: 50px 0px;
+                font-size: 18px;
+            }
+            .footer{
+                margin: 0;
+                padding: 0;
+                width:90%;
+                margin-left: 5%;
+                color: gray; 
+                text-align: center;
+                margin-top: 250px;
+            }
+        }
+     }
+</style>
diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue
index 3876bf3..dd146bb 100644
--- a/src/layout/components/Navbar.vue
+++ b/src/layout/components/Navbar.vue
@@ -24,7 +24,7 @@
           </el-dropdown-item>
         </el-dropdown-menu>
       </el-dropdown>
-      <el-dialog title="淇敼瀵嗙爜" :visible.sync="dialogFormVisible" :append-to-body="true">
+      <el-dialog title="淇敼瀵嗙爜" :visible.sync="dialogFormVisible" :append-to-body="true" width="40%">
         <el-form :model="form">
           <el-form-item label="鏃у瘑鐮�" :label-width="formLabelWidth">
             <el-input v-model="form.oldPwd" autocomplete="off"></el-input>
diff --git a/src/main.js b/src/main.js
index 1eda87c..d578a57 100644
--- a/src/main.js
+++ b/src/main.js
@@ -20,6 +20,7 @@
 import echarts from 'echarts'
 Vue.prototype.$echarts = echarts
 
+import print from 'print-js'
 
 import '@/icons' // icon
 import '@/permission' // permission control
diff --git a/src/router/index.js b/src/router/index.js
index 25cd92c..6e2fc1e 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -437,7 +437,6 @@
       {
         path: 'message',
         name: 'Message',
-        // hidden: true,
         component: () => import('@/views/message/message/index'),
         // meta: { title: '鎴戠殑娑堟伅', icon: 'table' }
       },
diff --git a/src/views/chart/work/index.vue b/src/views/chart/work/index.vue
index e04f144..46e1da2 100644
--- a/src/views/chart/work/index.vue
+++ b/src/views/chart/work/index.vue
@@ -90,12 +90,7 @@
         },
       }
     },
-    mounted(){
-      // this.initLeaderStatiChart("");
-      this.initLeaderTimelyChart("leaderTimely");
-      this.initTesterStatiChart("testerStati");
-      this.initTesterTimelyChart("testerTimely");
-    },
+    mounted(){},
     methods: {
       async queryData(){
         let date = this.formInline.date;
@@ -182,7 +177,7 @@
           series: [
             {
               name: '宸插畬鎴�',
-              barWidth: '20%',
+              barWidth: '30%',
               type: 'bar',
               stack: 'one',
               emphasis: emphasisStyle,
@@ -207,22 +202,25 @@
         option && myChart.setOption(option);
       },
       initTesterStatiChart(id,executeMater){
-        console.log("qqq----",executeMater);
         var chartDom = document.getElementById(id);
         var myChart = echarts.init(chartDom);
           window.addEventListener('resize', function() {
           myChart.resize();
         });
         var option;
-
+        let max = 0;
         let xAxisData = [];
         let data1 = [];
         let data2 = [];
-        // for(let i=0;i<executeMater.length;i++){
-        //   xAxisData.push(executeMater[i].name);
-        //   data1.push(executeMater[i].finsh);
-        //   data2.push(executeMater[i].unfinsh);
-        // }
+        for(let i=0;i<executeMater.length;i++){
+          xAxisData.push(executeMater[i].name);
+          data1.push(executeMater[i].finsh);
+          data2.push(executeMater[i].unfinsh);
+          let sum = executeMater[i].finsh + executeMater[i].unfinsh;
+          if(sum > max){
+            max = sum;
+          }
+        }
         var emphasisStyle = {
           itemStyle: {
             shadowBlur: 10,
@@ -244,8 +242,8 @@
           },
           yAxis: {
             min: 0,
-            max: 60,
-            interval: 10,
+            max: max,
+            interval: 1,
           },
           grid: {
             bottom: 100
@@ -255,6 +253,7 @@
               name: '鏁版嵁1',
               type: 'bar',
               stack: 'one',
+              barWidth: '30%',
               emphasis: emphasisStyle,
               data: data1,
               itemStyle:{
@@ -265,6 +264,7 @@
               name: '鏁版嵁2',
               type: 'bar',
               stack: 'one',
+              barWidth: '30%',
               emphasis: emphasisStyle,
               data: data2,
               itemStyle:{
@@ -282,6 +282,18 @@
           myChart.resize();
         });
         var option;
+        let xAxisData = [];
+        let data1 = [];
+        let data2 = [];
+        let yAxisData1 = 0;
+        for(let i=0;i<dutyTimely.length;i++){
+          xAxisData.push(dutyTimely[i].name);
+          data1.push(dutyTimely[i].total);
+          data2.push(dutyTimely[i].timely);
+          if(dutyTimely[i].total > yAxisData1){
+            yAxisData1 = dutyTimely[i].total;
+          }
+        }
         option = {
           tooltip: {
             trigger: 'axis',
@@ -299,13 +311,10 @@
             {
               name: '濮撳悕',
               type: 'category',
-              data: ['娌愮',],
+              data: xAxisData,
               axisPointer: {
                 type: 'shadow'
               },
-              itemStyle: {
-                top: '20px'
-              }
             }
           ],
           yAxis: [
@@ -313,7 +322,7 @@
               type: 'value',
               name: '鏁伴噺',
               min: 0,
-              max: 10,
+              max: yAxisData1,
               interval: 1,
               axisLabel: {
                 formatter: '{value}'
@@ -334,13 +343,13 @@
             {
               name: '鏍峰搧鏁�',
               type: 'bar',
-              barWidth: '20%',
+              barWidth: '30%',
               tooltip: {
                 valueFormatter: function (value) {
                   return value;
                 }
               },
-              data: [4.0],
+              data: data1,
               itemStyle: {
                 color: '#9fceff'
               }
@@ -348,19 +357,19 @@
             {
               name: '瀹屾垚鍙婃椂鐜�',
               type: 'line',
+              yAxisIndex: 1,
               tooltip: {
                 valueFormatter: function (value) {
                   return value + ' %';
                 }
               },
-              data: [7.5],
+              data: [{value:20},{value:40}],
               itemStyle: {
                 color: '#d2eec5'
               }
             },
           ]
         };
-
         option && myChart.setOption(option);
       },
       initTesterTimelyChart(id,executeTimely){
@@ -370,6 +379,18 @@
           myChart.resize();
         });
         var option;
+        let xAxisData = [];
+        let data1 = [];
+        let data2 = [];
+        let yAxisData1 = 0;
+        for(let i=0;i<executeTimely.length;i++){
+          xAxisData.push(executeTimely[i].name);
+          data1.push(executeTimely[i].total);
+          data2.push(executeTimely[i].timely);
+          if(executeTimely[i].total > yAxisData1){
+            yAxisData1 = executeTimely[i].total;
+          }
+        }
         option = {
           tooltip: {
             trigger: 'axis',
@@ -387,7 +408,7 @@
           xAxis: [
             {
               type: 'category',
-              data: ["","",""],
+              data: xAxisData,
               axisPointer: {
                 type: 'shadow'
               }
@@ -398,8 +419,8 @@
               type: 'value',
               name: '',
               min: 0,
-              max: 50,
-              interval: 5,
+              max: yAxisData1,
+              interval: 1,
               axisLabel: {
                 formatter: '{value}'
               }
@@ -419,12 +440,13 @@
             {
               name: '椤圭洰鏁�',
               type: 'bar',
+              barWidth: '30%',
               tooltip: {
                 valueFormatter: function (value) {
                   return value ;
                 }
               },
-              data: [2.0, 4.9, 7.0],
+              data: data1,
               itemStyle: {
                 color: '#5087ec'
               }
@@ -438,7 +460,7 @@
                   return value + ' %';
                 }
               },
-              data: [2.0, 2.2, 3.3],
+              data: data2,
               itemStyle: {
                 color: '#68bbc4'
               }
diff --git a/src/views/experiment/checkTheReport/index.vue b/src/views/experiment/checkTheReport/index.vue
index a127c10..9fad471 100644
--- a/src/views/experiment/checkTheReport/index.vue
+++ b/src/views/experiment/checkTheReport/index.vue
@@ -51,6 +51,18 @@
           >
         </div>
       </div>
+      <el-dialog
+        top="10vh"
+        title="鎶ュ憡棰勮"
+        :visible.sync="dialogVisible"
+        width="60%">
+        <span slot="footer" class="dialog-footer">
+          <el-button type="primary" size="small" @click="printFun()">鎵撳嵃</el-button>
+        </span>
+        <div class="printStyle">
+          <preview id="printDiv"></preview>
+        </div>
+      </el-dialog>
       <div class="table-box">
         <el-table
           ref="reportTable"
@@ -143,10 +155,9 @@
               <el-button
                 type="text"
                 size="small"
-                @click="handleClick(scope.row)"
+                @click="previewFun(scope.row)"
                 >棰勮</el-button
               >
-              <el-button type="text" size="small">鎵撳嵃</el-button>
             </template>
           </el-table-column>
         </el-table>
@@ -169,6 +180,8 @@
 
 <script>
 import { selectAllReport } from "@/api/experiment/checkTheReport";
+import Preview from "@/components/experiment/checkTheReport/index.vue";
+import PrintJS from 'print-js'
 export default {
   data() {
     return {
@@ -183,12 +196,33 @@
       total: 0,
       pageSize: 10,
       checked: true,
+      dialogVisible: false,
     };
   },
   created() {
     this.getData();
   },
+  mounted(){
+    // this.dialogVisible = true;
+  },
+  components:{
+    Preview
+  },
   methods: {
+    //棰勮鎸夐挳
+    previewFun(){
+      this.dialogVisible = true;
+    },
+    //鎵撳嵃鎸夐挳
+    printFun(){
+        PrintJS({
+          printable: "printDiv",
+          type: "html",
+          // header: "鍘熸潗鏂欐娴嬫姤鍛�",
+          targetStyles: ["*"],
+          ignoreElements: ["no-ignore"],
+        });
+    },
     // 鐘舵�佹寜閽�
     handleRadioChange() {
       this.getData();
@@ -227,6 +261,7 @@
       };
       const { data } = await selectAllReport(params);
       this.reportTable = data.row;
+      console.log(data.row);
       this.total = data.total;
     },
   },
@@ -280,5 +315,14 @@
       margin: 10px 0;
     }
   }
+  .printStyle{
+    overflow: scroll;
+    height:600px;
+    .el-button{
+      position: absolute;
+      top: 10vh;
+      left: 90%;
+    }
+  }
 }
 </style>
diff --git a/src/views/standardLibrary/index.vue b/src/views/standardLibrary/index.vue
index 6070828..61d3565 100644
--- a/src/views/standardLibrary/index.vue
+++ b/src/views/standardLibrary/index.vue
@@ -25,6 +25,16 @@
         <div class="table-header">
           <div class="serve-btn">
             <span class="tipMsg">{{ msg !== "" ? msg : "" }}</span>
+            <el-select v-model="versionValue" @change="changeSelect" clearable placeholder="璇烽�夋嫨鐗堟湰鍙�">
+              <el-option
+                v-for="item in options"
+                :key="item.value"
+                :label="item.label"
+                :value="item.value"
+                >
+              </el-option>
+            </el-select>
+            <el-button type="primary" @click="addVersionFun">鏂板鐗堟湰鍙�</el-button>
             <el-button
               type="primary"
               icon="el-icon-plus"
@@ -160,12 +170,16 @@
   addSpecifications,
   deleteListApi,
   blurUpdateApi,
+  getVersion,
+  addVersion
 } from "@/api/standardLibrary";
 
 import { selectproductModelApi } from "@/api/basicData/index";
 export default {
   data() {
     return {
+      options:[],
+      versionValue: '',
       deleteList: [],
       msg: "",
       isAllSelect: false,
@@ -198,7 +212,48 @@
   created() {
     this.getStandardTree();
   },
+  mounted(){
+    
+  },
   methods: {
+    async initSelect(){
+        this.options = [];
+        this.versionValue = "";
+        const response = await getVersion({"specificationsId":this.selectData.id});
+        if(response.code===200 && response.data.length>0){
+          this.getTableByClick(this.selectData,response.data[0])
+          for(let i=0;i<response.data.length;i++){
+            this.options.push({
+              value: response.data[i],
+              label: "V" + response.data[i]
+            })
+            this.versionValue = response.data[0];
+          }
+        }
+    },
+    changeSelect(){
+      this.tableData = [];
+      this.getTableByClick(this.selectData,this.versionValue);
+    },
+    async insertVersion(){
+      const resp = await addVersion({"specificationsId":this.selectData.id});
+      if(resp.code===200){
+        this.initSelect();
+        this.$message({
+            type: 'success',
+            message: resp.message
+          });
+      }
+    },
+     addVersionFun() {
+        this.$confirm('纭娣诲姞鏂扮殑鐗堟湰鍙峰悧?', '鎻愮ず', {
+          confirmButtonText: '纭畾',
+          cancelButtonText: '鍙栨秷',
+          type: 'warning'
+        }).then(() => {
+          this.insertVersion();
+        }).catch(() => {});
+    },
     filterNode(value, data) {
       if (!value) return true;
       return data.name.indexOf(value) !== -1;
@@ -252,7 +307,8 @@
         this.getParentData(node.parent, node.data.name);
         // 瀛樹笅閫変腑鑺傜偣
         this.selectData = data;
-        this.getTableByClick(data);
+        this.getTableByClick(data,this.versionValue);
+        this.initSelect();
       }
       if (!("children" in data)) {
         return;
@@ -267,9 +323,10 @@
         this.getParentData(node.parent, this.msg);
       }
     },
-    async getTableByClick(data) {
+    async getTableByClick(data,versionVal) {
       await getProductList({
         specificationsId: data.id,
+        version: versionVal
       }).then((res) => {
         res.data.forEach((i) => {
           if (i.name === undefined) {
@@ -351,7 +408,7 @@
         addTypeArr: [],
       };
       this.getStandardTree();
-      this.getTableByClick(this.selectData);
+      this.getTableByClick(this.selectData,this.versionValue);
     },
     changeCascader(data) {
       this.addTreeForm.addTypeArr = data;
@@ -489,7 +546,7 @@
           message: res.message,
           type: "success",
         });
-        this.getTableByClick(this.selectData);
+        this.getTableByClick(this.selectData,this.versionValue);
       });
     },
     async requiredOnfocus(scope) {
@@ -504,7 +561,7 @@
           message: res.message,
           type: "success",
         });
-        this.getTableByClick(this.selectData);
+        this.getTableByClick(this.selectData,this.versionValue);
       });
     },
   },
@@ -640,6 +697,9 @@
   width: 100%;
   padding-bottom: 6px;
   text-align: right;
+  .el-select{
+    margin-right:20px;
+  }
 }
 .tipMsg {
   float: left;

--
Gitblit v1.9.3