<template>
  <el-dialog
    v-dialogDrag
    title="查看二次元"
    :visible.sync="open"
    width="1200px"
    append-to-body
    @open="dialogOpen"
    @close="dialogClose"
  >
    <!-- 列表 -->
    <el-table
      ref="table"
      v-loading="loading"
      :data="list"
      border
      size="mini"
      max-height="700px"
    >
      <el-table-column
        label="点位"
        align="center"
        prop="itemName"
      />
      <el-table-column
        label="值"
        align="center"
        prop="value"
      />
    </el-table>

  </el-dialog>
</template>

<script>
import { getElementMeasure } from '@/api/wms/quality/iqcInspectionExecute'

export default {
  name: 'AddInspectionItems',
  components: {
  },
  props: {
    inspectionType: {
      type: Number,
      default: 0
    },
    caselist: {
      type: Array,
      default: () => []
    }
  },
  data() {
    return {
      // 遮罩层
      loading: true,
      // 导出遮罩层
      exportLoading: false,
      // 显示搜索条件
      showSearch: true,
      ensureLoading: false,
      selectDisabled: false,
      // 是否是第一次加载
      isFirst: true,
      // 总条数
      total: 0,
      // WMS 品质管理-检验项管理列表
      list: [],
      currentRows: [],
      // 选中的
      selectList: [],
      // 弹出层标题
      title: '',
      caseTitle: '',
      // 物料编码，modify时传
      materialNo: '',
      // 是否显示弹出层
      open: false,
      dom: '',
      // 查询参数
      queryParams: {
        pageNo: 1,
        pageSize: 10,
        materialItemResultId: null,
        index: null
      },
      sn: null,
      //
      modifyParams: {},
      // 表单参数
      form: {},
      isLoading: false,
      // 表单校验
      rules: {
      }
    }
  },
  methods: {
    /** 查询列表 */
    getList() {
      this.loading = true
      // 执行查询
      getElementMeasure(this.queryParams).then(response => {
        this.list = response.data.quadraticElementMeasureRespVOList
      }).finally(() => {
        this.loading = false
      })
    },
    /** 取消按钮 */
    cancel() {
      this.open = false
      this.reset()
    },
    /** 表单重置 */
    reset() {
      this.form = {
        id: undefined,
        inspectionNo: undefined,
        inspectionName: undefined,
        inspectionModel: undefined,
        inspectionType: undefined,
        minValue: undefined,
        standValue: undefined,
        maxValue: undefined,
        code: undefined
      }
      this.resetForm('form')
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNo = 1
      this.getList()
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm('queryForm')
      this.handleQuery()
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset()
      this.open = true
      this.title = '添加检验项管理'
    },
    dialogOpen() {
      this.$nextTick(() => {
        this.getList()
      })
    },
    dialogClose() {
      const { queryParams } = this
      queryParams.pageNo = 1
      queryParams.pageSize = 10
      this.selectList = []
      this.getList()
    },
    getOnlyRowKey(row) {
      return row.id
    },
    // 数据转换
    formatScientific(row, column, cellValue) {
      const scientificNotation = /\d(?:\.(\d*))?e([+-]\d+)/
      if (scientificNotation.test(cellValue) === true) {
        return parseFloat(cellValue).toFixed(7)
      } else {
        return cellValue
      }
    }

  }
}
</script>

