<!--
 * @Author: zhp
 * @Date: 2023-02-14 15:02:26
 * @LastEditTime: 2023-06-27 15:38:27
 * @LastEditors: zhp
 * @Description: 
-->
<template>
  <el-dialog :title="$t('gage.report')" :visible.sync="dialogTableVisible">
    <table align="center" width="800" height="249" style="text-align: center;" border="1" cellspacing="0">
      <tbody>
        <tr>
          <td>{{ $t('gage.partName')}}</td>
          <td>{{ this.dataForm.partName }}</td>
          <td>{{ $t('gage.gageName') }}</td>
          <td>{{ this.dataForm.gageName }}</td>
          <td>{{ $t('gage.measurementTime') }}</td>
          <td>{{ this.dataForm.measurementTime }}</td>
        </tr>
        <tr>
          <td>{{ $t('gage.itemNo') }}</td>
          <td>{{ this.dataForm.itemNo }}</td>
          <td>{{ $t('gage.model') }}</td>
          <td>{{ this.dataForm.model }}</td>
          <td>{{ $t('gage.measurementTime') }}</td>
          <td>{{ this.dataForm.measurementTime }}</td>
        </tr>
        <tr>
          <td>{{ $t('gage.measuringToolSpecification') }}</td>
          <td>{{ this.dataForm.measuringToolSpecification }}</td>
          <td>{{ $t('gage.measuringToolAccuracy') }}</td>
          <td>{{ this.dataForm.measuringToolAccuracy }}</td>
          <td>{{ $t('gage.process') }}</td>
          <td>{{ this.dataForm.process }}</td>
        </tr>
        <tr>
          <td>{{ $t('gage.meanRange') }}</td>
          <td>{{ this.grrReportData.meanRange }}</td>
          <td>{{ $t('gage.meanDifference') }}</td>
          <td>{{ this.grrReportData.meanDifference }}</td>
          <td>{{ $t('gage.partAverageMean') }}</td>
          <td>{{ this.grrReportData.partAverageMean }}</td>
        </tr>
        <tr>
          <td colspan="5">{{ $t('gage.measuringUnit') }}</td>
          <td>{{ $t('gage.totalVariation') }}</td>
        </tr>
        <tr>
          <td colspan="6">{{ $t('gage.repeatability') }}</td>
        </tr>
        <tr>
          <td rowspan="3" colspan="3">{{ this.grrReportData.ev }}</td>
          <td>r</td>
          <td>k1</td>
          <td rowspan="3">{{ this.grrReportData.evpercent }}</td>
        </tr>
        <tr>
          <td>2</td>
          <td>{{ this.grrReportData.k1[0] }}</td>
        </tr>
        <tr>
          <td>3</td>
          <td>{{ this.grrReportData.k1[1] }}</td>
        </tr>
        <tr>
          <td colspan="6">{{ $t('gage.reproducibility') }}</td>
        </tr>
        <tr>
          <td rowspan="3" colspan="3">{{ this.grrReportData.av }}</td>
          <td>测试人员</td>
          <td>k2</td>
          <td rowspan="3">{{ this.grrReportData.avpercent }}</td>
        </tr>
        <tr>
          <td>2</td>
          <td>{{ this.grrReportData.k2[0] }}</td>
        </tr>
        <tr>
          <td>3</td>
          <td>{{ this.grrReportData.k2[1] }}</td>
        </tr>
        <tr>
          <td colspan="6">{{ $t('gage.repeatabilityAndReproducibility') }}</td>
        </tr>
        <tr>
          <td rowspan="3" colspan="3">{{ this.grrReportData.grr }}</td>
          <td>n</td>
          <td>k3</td>
          <td rowspan="3">{{ this.grrReportData.grrpercent }}</td>
        </tr>
        <tr>
          <td>2</td>
          <td>{{ this.grrReportData.k3[0] }}</td>
        </tr>
        <tr>
          <td>3</td>
          <td>{{ this.grrReportData.k3[1] }}</td>
        </tr>
        <tr>
          <td colspan="3">{{ $t('gage.partVariation') }}</td>
          <td>4</td>
          <td>{{ this.grrReportData.k3[2] }}</td>
          <td rowspan="4">{{ this.grrReportData.pvpercent }}</td>
        </tr>
        <tr>
          <td rowspan="3" colspan="3">{{ this.grrReportData.pv }}</td>
          <td>5</td>
          <td>{{ this.grrReportData.k3[3] }}</td>
        </tr>
        <tr>
          <td>6</td>
          <td>{{ this.grrReportData.k3[4] }}</td>
        </tr>
        <tr>
          <td>7</td>
          <td>{{ this.grrReportData.k3[5] }}</td>
        </tr>
        <tr>
          <td colspan="3">{{ $t('gage.totalVariation') }}</td>
          <td>8</td>
          <td>{{ this.grrReportData.k3[6] }}</td>
          <td rowspan="4">{{ this.grrReportData.ndc }}</td>
        </tr>
        <tr>
          <td rowspan="3" colspan="3">{{ this.grrReportData.tv }}</td>
          <td>9</td>
          <td>{{ this.grrReportData.k3[7] }}</td>
        </tr>
        <tr>
          <td>10</td>
          <td>{{ this.grrReportData.k3[8] }}</td>
        </tr>
        <tr>
          <td colspan="2">{{ $t('gage.decide') }}</td>
          <td>%GRR</td>
          <td rowspan="4">{{ this.grrReportData.isAccept }}</td>
          <td>reason</td>
          <td rowspan="4">{{ this.grrReportData.reason }}</td>
        </tr>
      </tbody>
    </table>
  </el-dialog>
</template>

<script>
import debounce from "lodash/debounce";
import basicAdd from "@/mixins/basic-add";
export default {
  mixins: [basicAdd],
  data() {
    return {
      urlOptions: {
        submitURL: "/gage/qmsGage",
        infoURL: "/gage/qmsGage/{ id }",
        dictionaryDetailList: '/mutual/qmsDataDictionaryDetail/page',
        getUserList: '/sys/user/page',
        getGageTypeList: '/gage/qmsGageType/page',
        reportURL: '/gage/qmsGageGrrTester/reprot'
      },
      grrReportData: {},
      dataForm: {},
      k1:[],
      dialogTableVisible:false,
    };
  },
  computed: {
    dataRule() {
      return {
        // dictLabel: [
        //   {
        //     required: true,
        //     message: this.$t("validate.required"),
        //     trigger: "blur",
        //   },
        // ],
        // dictValue: [
        //   {
        //     required: true,
        //     message: this.$t("validate.required"),
        //     trigger: "blur",
        //   },
        // ],
        // sort: [
        //   {
        //     required: true,
        //     message: this.$t("validate.required"),
        //     trigger: "blur",
        //   },
        // ],
      };
    },
  },
  mounted () {
  },
  methods: {
    init(data) {
      this.dataForm = data
      // console.log(11111)
      // this.dataForm.dictTypeId = dictTypeId || "";
      this.$nextTick(() => {
        this.$http.get(this.urlOptions.reportURL, {
          params: {
            gageGrrId:data.id
          }
        }).then(({ data: res }) => {
          console.log(res)
          if (res && res.code === 0) {
            this.grrReportData = res.data
            // console.log(this.k1)
            this.dialogTableVisible = true
            
          }
        })
      })
    },
  },
};
</script>
