zouyu
2023-08-26 c81bf2132d6d3b7246075c6faa1382365d5f17e2
	modified:   package.json
modified: src/api/standardLibrary.js
new file: src/components/experiment/checkTheReport/index.vue
modified: src/layout/components/Navbar.vue
modified: src/main.js
modified: src/router/index.js
modified: src/views/chart/work/index.vue
modified: src/views/experiment/checkTheReport/index.vue
modified: src/views/standardLibrary/index.vue
已修改8个文件
已添加1个文件
364 ■■■■ 文件已修改
package.json 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/standardLibrary.js 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/experiment/checkTheReport/index.vue 126 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/layout/components/Navbar.vue 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main.js 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/router/index.js 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/chart/work/index.vue 82 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/experiment/checkTheReport/index.vue 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/standardLibrary/index.vue 70 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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",
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({
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>
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>
@@ -65,7 +65,11 @@
        confirmPwd: ''
      },
      dialogFormVisible: false,
      formLabelWidth: '120px'
      formLabelWidth: '120px',
            user: {
                id: null,
                name: 'value'
            }
    }
  },
  components: {
@@ -78,14 +82,7 @@
      'avatar'
    ])
  },
    data() {
        return {
            user: {
                id: null,
                name: 'value'
            }
        }
    },
    mounted() {
        this.getUser()
    },
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
src/router/index.js
@@ -432,7 +432,6 @@
      {
        path: 'message',
        name: 'Message',
        // hidden: true,
        component: () => import('@/views/message/message/index'),
        // meta: { title: '我的消息', icon: 'table' }
      },
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'
              }
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>
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;