Newer
Older
xc-business-system / src / views / equipement / standard / checkData / components / thirteenth / checkDataCom.vue
dutingting on 22 Jan 2024 18 KB bug修复
<!-- 核查数据管理详情--核查项---第13套:示波器 -->
<script lang="ts" setup name="checkDataDetail">
import { ref, watch } from 'vue'
import { ElLoading, ElMessage } from 'element-plus'
import saveCheckRecord from '../../dialog/saveCheckRecord.vue'
import type { IList } from './thirteenth-interface'
import type { TableColumn } from '@/components/NormalTable/table_interface'
import useUserStore from '@/store/modules/user'
import type { dictType } from '@/global'
import { getDictByCode } from '@/api/system/dict'
import multiTable from '@/components/MultiHeaderTable/index.vue'
// import { getCheckItemDetail, getJobInstructionList } from '@/api/equipment/standard/book'
// import { addCheckData, calculateHandle, getInfo, updateCheckData } from '@/api/equipment/standard/checkData'
const user = useUserStore() // 用户信息
const $router = useRouter() // 关闭页面使用
const $route = useRoute() // 路由参数
const pageType = ref('add') // 页面类型: add, edit, detail
const infoId = ref('')
const belongStandardEquipment = ref('9')
const itemCategoryId = ref('') // 核查项分类id
const itemCategoryName = ref('') // 核查项分类名称

// ----------------------------------路由参数------------------------------------------------
if ($route.params && $route.params.type) {
  pageType.value = $route.params.type as string
  console.log(pageType.value)

  if ($route.params.id) {
    infoId.value = $route.params.id as string
  }
}
// ----------------------------------------核查数据----------------------------------------------
const radioMenus = ref([ // 标签内容
  { name: '重复性', value: 'repeatability' },
  { name: '稳定性', value: 'stability' },
])
const current = ref('repeatability') // 选择的tab 默认基本信息
const columns_repeatability_timeMark = ref<TableColumn[]>([ // 重复性表头--时标、方波电压(50Ω)、方波电压(1Ω)、直流电压(50Ω)、直流电压(1Ω)、输入阻抗
  { text: '核查项目', value: 'params', align: 'center', required: true, type: 'text' },
  { text: '核查点', value: 'checkPoint', align: 'center', required: true, type: 'text' },
  {
    text: '测量值',
    value: 'indicatingValue',
    align: 'center',
    required: true,
    width: '160',
    children: [
      { text: 'X1', value: 'X1', align: 'center', required: true, width: '180', type: 'inputNumber' },
      { text: 'X2', value: 'X2', align: 'center', required: true, width: '180', type: 'inputNumber' },
      { text: 'X3', value: 'X3', align: 'center', required: true, width: '180', type: 'inputNumber' },
      { text: 'X4', value: 'X4', align: 'center', required: true, width: '180', type: 'inputNumber' },
      { text: 'X5', value: 'X5', align: 'center', required: true, width: '180', type: 'inputNumber' },
      { text: 'X6', value: 'X6', align: 'center', required: true, width: '180', type: 'inputNumber' },
      { text: 'X7', value: 'X7', align: 'center', required: true, width: '180', type: 'inputNumber' },
      { text: 'X8', value: 'X8', align: 'center', required: true, width: '180', type: 'inputNumber' },
      { text: 'X9', value: 'X9', align: 'center', required: true, width: '180', type: 'inputNumber' },
      { text: 'X10', value: 'X10', align: 'center', required: true, width: '180', type: 'inputNumber' },
    ],
  },
  { text: '平均值', value: 'averageValue', align: 'center', required: true, type: 'text' },
  { text: '重复性', value: 'averageValue', align: 'center', required: true, type: 'text' },
])
const columns_repeatability_voltage_flatness = ref<TableColumn[]>([ // 重复性表头--稳幅正弦信号电压平坦度
  { text: '核查项目', value: 'params', align: 'center', required: true, type: 'text' },
  { text: '类型', value: 'params', align: 'center', required: true, type: 'text' },
  { text: '核查点', value: 'checkPoint', align: 'center', required: true, type: 'text' },
  {
    text: '测量值',
    value: 'indicatingValue',
    align: 'center',
    required: true,
    width: '160',
    children: [
      { text: 'X1', value: 'X1', align: 'center', required: true, width: '180', type: 'inputNumber' },
      { text: 'X2', value: 'X2', align: 'center', required: true, width: '180', type: 'inputNumber' },
      { text: 'X3', value: 'X3', align: 'center', required: true, width: '180', type: 'inputNumber' },
      { text: 'X4', value: 'X4', align: 'center', required: true, width: '180', type: 'inputNumber' },
      { text: 'X5', value: 'X5', align: 'center', required: true, width: '180', type: 'inputNumber' },
      { text: 'X6', value: 'X6', align: 'center', required: true, width: '180', type: 'inputNumber' },
      { text: 'X7', value: 'X7', align: 'center', required: true, width: '180', type: 'inputNumber' },
      { text: 'X8', value: 'X8', align: 'center', required: true, width: '180', type: 'inputNumber' },
      { text: 'X9', value: 'X9', align: 'center', required: true, width: '180', type: 'inputNumber' },
      { text: 'X10', value: 'X10', align: 'center', required: true, width: '180', type: 'inputNumber' },
    ],
  },
  { text: '平均值', value: 'averageValue', align: 'center', required: true, type: 'text' },
  { text: '重复性', value: 'averageValue', align: 'center', required: true, type: 'text' },
])
const columns_repeatability_risetime = ref<TableColumn[]>([ // 重复性表头--上升时间
  { text: '核查项目', value: 'params', align: 'center', required: true, type: 'text' },
  { text: '快沿', value: 'checkPoint', align: 'center', required: true, type: 'text' },
  { text: '探头编号', value: 'checkPoint', align: 'center', required: true, type: 'text' },
  { text: '探头设备名称', value: 'checkPoint', align: 'center', required: true, type: 'text' },
  { text: '探头规格型号', value: 'checkPoint', align: 'center', required: true, type: 'text' },
  { text: '测量值', value: 'checkPoint', align: 'center', required: true, type: 'text' },
])

const columns_stability_timeMark = ref<TableColumn[]>([ // 稳定性表头--时标、方波电压(50Ω)、方波电压(1Ω)、直流电压(50Ω)、直流电压(1Ω)、输入阻抗
  { text: '核查项目', value: 'params', align: 'center', required: true, type: 'text' },
  { text: '核查点', value: 'checkPoint', align: 'center', required: true, type: 'text' },
  {
    text: '核查点均值',
    value: 'indicatingValue',
    align: 'center',
    required: true,
    width: '160',
    children: [
      { text: '2022-12-12', value: '2022-12-12', align: 'center', required: true, type: 'text' },
      { text: '2022-12-13', value: '2022-12-13', align: 'center', required: true, type: 'text' },
      { text: '2022-12-14', value: '2022-12-14', align: 'center', required: true, type: 'text' },
      { text: '2022-12-15', value: '2022-12-15', align: 'center', required: true, type: 'text' },
      { text: '2022-12-16', value: '2022-12-16', align: 'center', required: true, type: 'text' },
      { text: '本次核查时间', value: '2022-12-17', align: 'center', required: true, type: 'text' },
    ],
  },
  { text: '平均值', value: 'averageValue', align: 'center', required: true, type: 'text' },
  { text: '稳定性', value: 'averageValue', align: 'center', required: true, type: 'text' },
  { text: '扩展不确定度U', value: 'averageValue', align: 'center', required: true, type: 'text' },
  { text: '结论', value: 'averageValue', align: 'center', required: true, type: 'text' },
])

const columns_stability_voltage_flatness = ref<TableColumn[]>([ // 稳定性表头--稳幅正弦信号电压平坦度
  { text: '核查项目', value: 'params', align: 'center', required: true, type: 'text' },
  { text: '类型', value: 'params', align: 'center', required: true, type: 'text' },
  { text: '核查点', value: 'checkPoint', align: 'center', required: true, type: 'text' },
  {
    text: '核查点均值',
    value: 'indicatingValue',
    align: 'center',
    required: true,
    width: '160',
    children: [
      { text: '2022-12-12', value: '2022-12-12', align: 'center', required: true, type: 'text' },
      { text: '2022-12-13', value: '2022-12-13', align: 'center', required: true, type: 'text' },
      { text: '2022-12-14', value: '2022-12-14', align: 'center', required: true, type: 'text' },
      { text: '2022-12-15', value: '2022-12-15', align: 'center', required: true, type: 'text' },
      { text: '2022-12-16', value: '2022-12-16', align: 'center', required: true, type: 'text' },
      { text: '本次核查时间', value: '2022-12-17', align: 'center', required: true, type: 'text' },
    ],
  },
  { text: '平均值', value: 'averageValue', align: 'center', required: true, type: 'text' },
  { text: '稳定性', value: 'averageValue', align: 'center', required: true, type: 'text' },
  { text: '扩展不确定度U', value: 'averageValue', align: 'center', required: true, type: 'text' },
  { text: '结论', value: 'averageValue', align: 'center', required: true, type: 'text' },
])

const columns_stability_risetime = ref<TableColumn[]>([ // 稳定性表头--上升时间
  { text: '核查项目', value: 'params', align: 'center', required: true, type: 'text' },
  { text: '快沿', value: 'params', align: 'center', required: true, type: 'text' },
  { text: '探头编号', value: 'checkPoint', align: 'center', required: true, type: 'text' },
  { text: '探头设备名称', value: 'averageValue', align: 'center', required: true, type: 'text' },
  { text: '探头规格型号', value: 'averageValue', align: 'center', required: true, type: 'text' },
  { text: '测量值', value: 'averageValue', align: 'center', required: true, type: 'text' },
  { text: '技术指标', value: 'averageValue', align: 'center', required: true, type: 'text' },
  { text: '结论', value: 'averageValue', align: 'center', required: true, type: 'text' },
])

const listTimeMarkRepeatability = ref<IList[]>([]) // 时标-重复性
const listSquareWaveVoltage50ΩRepeatability = ref<IList[]>([]) // 方波电压(50Ω)-重复性
const listSquareWaveVoltage1MΩRepeatability = ref<IList[]>([]) // 方波电压(1MΩ)-重复性
const listDirectVoltage50ΩRepeatability = ref<IList[]>([]) // 直流电压(50Ω)-重复性
const listDirectVoltage1MΩRepeatability = ref<IList[]>([]) // 直流电压(1MΩ)-重复性
const listInputImpedanceRepeatability = ref<IList[]>([]) // 输入阻抗-重复性
const listVoltageFlatnessRepeatability = ref<IList[]>([]) // 稳幅正弦信号电压平坦度-重复性
const listRisetimeRepeatability = ref<IList[]>([]) // 上升时间-重复性

const listTimeMarkStability = ref<IList[]>([]) // 时标-稳定性
const listSquareWaveVoltage50ΩStability = ref<IList[]>([]) // 方波电压(50Ω)-稳定性
const listSquareWaveVoltage1MΩStability = ref<IList[]>([]) // 方波电压(1MΩ)-稳定性
const listDirectVoltage50ΩStability = ref<IList[]>([]) // 直流电压(50Ω)-稳定性
const listDirectVoltage1MΩStability = ref<IList[]>([]) // 直流电压(1MΩ)-稳定性
const listInputImpedanceStability = ref<IList[]>([]) // 输入阻抗-稳定性
const listVoltageFlatnessStability = ref<IList[]>([]) // 稳幅正弦信号电压平坦度-稳定性
const listRisetimeStability = ref<IList[]>([]) // 上升时间-稳定性

// 获取配置详情
function fetchCheckItemDetail(equipmentId: string, belongStandardEquipmentParam: string, itemCategoryIdParam: string, itemCategoryNameParam: string) {
  belongStandardEquipment.value = belongStandardEquipmentParam // 检校标准装置
  itemCategoryId.value = itemCategoryIdParam // 核查分类id
  itemCategoryName.value = itemCategoryNameParam // 核查分类名称
  const loading = ElLoading.service({
    lock: true,
    background: 'rgba(255, 255, 255, 0.8)',
  })
  const params = {
    equipmentId, // 设备id
    belongStandardEquipment: belongStandardEquipment.value, // 检校标准装置code
    itemCategoryId: itemCategoryId.value, // 核查项分类id
    itemCategoryName: itemCategoryName.value, // 核查项分类名称
  }
  // getCheckItemDetail(params).then((res) => {
  //   loading.close()
  //   handleData(res.data.checkItemDataCalibratorList)
  // })
}

// 点击生成结果处理
const createResult = () => {
  //
}
// ------------------------------------------------------------------------------------------

// 获取详情
function fetchInfo() {
  // const loading = ElLoading.service({
  //   lock: true,
  //   background: 'rgba(255, 255, 255, 0.8)',
  // })
  // getInfo({ id: infoId.value }).then((res) => {
  //   form.value = { ...res.data }
  //   list.value = res.data.checkDataPistonGaugeList.map((item: any) => {
  //     return {
  //       ...item,
  //       editable: pageType.value !== 'detail',
  //     }
  //   })
  //   loading.close()
  // })
}

// -------------------------------------钩子-----------------------------------------------------

onMounted(async () => {
  if (pageType.value !== 'add') {
    // fetchInfo()
  }
})

defineExpose({ fetchCheckItemDetail })
</script>

<template>
  <!-- 核查数据 -->
  <detail-block title="核查数据">
    <div style="display: flex;justify-content: space-between;">
      <el-radio-group v-model="current" style="margin-bottom: 20px;">
        <el-radio-button v-for="item in radioMenus" :key="item.value" :label="item.value">
          {{ item.name }}
        </el-radio-button>
      </el-radio-group>
    </div>
    <!-- 时标 -->
    <div style="display: flex;justify-content: space-between;align-items: center;">
      <h5>时标</h5>
      <el-button v-if="pageType !== 'detail'" type="primary" @click="createResult">
        计算结果
      </el-button>
    </div>
    <multi-table
      :table-data="current === 'repeatability' ? listTimeMarkRepeatability : listTimeMarkStability"
      :table-header="current === 'repeatability' ? columns_repeatability_timeMark : columns_stability_timeMark"
      :merge-rows="[]"
      :need-index="true"
    />

    <!-- 方波电压(50Ω) -->
    <div style="display: flex;justify-content: space-between;align-items: center;">
      <h5>方波电压(50Ω)</h5>
      <el-button v-if="pageType !== 'detail'" type="primary" @click="createResult">
        计算结果
      </el-button>
    </div>
    <multi-table
      :table-data="current === 'repeatability' ? listSquareWaveVoltage50ΩRepeatability : listSquareWaveVoltage50ΩStability"
      :table-header="current === 'repeatability' ? columns_repeatability_timeMark : columns_stability_timeMark"
      :merge-rows="[]"
      :need-index="true"
    />

    <!-- 方波电压(10Ω) -->
    <div style="display: flex;justify-content: space-between;align-items: center;">
      <h5>方波电压(10Ω)</h5>
      <el-button v-if="pageType !== 'detail'" type="primary" @click="createResult">
        计算结果
      </el-button>
    </div>
    <multi-table
      :table-data="current === 'repeatability' ? listSquareWaveVoltage1MΩRepeatability : listSquareWaveVoltage1MΩStability"
      :table-header="current === 'repeatability' ? columns_repeatability_timeMark : columns_stability_timeMark"
      :merge-rows="[]"
      :need-index="true"
    />

    <!-- 方波电压(1MΩ) -->
    <div style="display: flex;justify-content: space-between;align-items: center;">
      <h5>方波电压(1MΩ)</h5>
      <el-button v-if="pageType !== 'detail'" type="primary" @click="createResult">
        计算结果
      </el-button>
    </div>
    <multi-table
      :table-data="current === 'repeatability' ? listSquareWaveVoltage1MΩRepeatability : listSquareWaveVoltage1MΩStability"
      :table-header="current === 'repeatability' ? columns_repeatability_timeMark : columns_stability_timeMark"
      :merge-rows="[]"
      :need-index="true"
    />

    <!-- 直流电压(50Ω) -->
    <div style="display: flex;justify-content: space-between;align-items: center;">
      <h5>直流电压(50Ω)</h5>
      <el-button v-if="pageType !== 'detail'" type="primary" @click="createResult">
        计算结果
      </el-button>
    </div>
    <multi-table
      :table-data="current === 'repeatability' ? listDirectVoltage50ΩRepeatability : listDirectVoltage50ΩStability"
      :table-header="current === 'repeatability' ? columns_repeatability_timeMark : columns_stability_timeMark"
      :merge-rows="[]"
      :need-index="true"
    />

    <!-- 直流电压(1MΩ) -->
    <div style="display: flex;justify-content: space-between;align-items: center;">
      <h5>直流电压(1MΩ)</h5>
      <el-button v-if="pageType !== 'detail'" type="primary" @click="createResult">
        计算结果
      </el-button>
    </div>
    <multi-table
      :table-data="current === 'repeatability' ? listDirectVoltage1MΩRepeatability : listDirectVoltage1MΩStability"
      :table-header="current === 'repeatability' ? columns_repeatability_timeMark : columns_stability_timeMark"
      :merge-rows="[]"
      :need-index="true"
    />

    <!-- 输入阻抗 -->
    <div style="display: flex;justify-content: space-between;align-items: center;">
      <h5>输入阻抗</h5>
      <el-button v-if="pageType !== 'detail'" type="primary" @click="createResult">
        计算结果
      </el-button>
    </div>
    <multi-table
      :table-data="current === 'repeatability' ? listInputImpedanceRepeatability : listInputImpedanceStability"
      :table-header="current === 'repeatability' ? columns_repeatability_timeMark : columns_stability_timeMark"
      :merge-rows="[]"
      :need-index="true"
    />

    <!-- 稳幅正弦信号电压平坦度 -->
    <div style="display: flex;justify-content: space-between;align-items: center;">
      <h5>稳幅正弦信号电压平坦度</h5>
      <el-button v-if="pageType !== 'detail'" type="primary" @click="createResult">
        计算结果
      </el-button>
    </div>
    <multi-table
      :table-data="current === 'repeatability' ? listVoltageFlatnessRepeatability : listVoltageFlatnessStability"
      :table-header="current === 'repeatability' ? columns_repeatability_voltage_flatness : columns_stability_voltage_flatness"
      :merge-rows="[]"
      :need-index="true"
    />

    <!-- 上升时间 -->
    <div style="display: flex;justify-content: space-between;align-items: center;">
      <h5>上升时间</h5>
      <el-button v-if="pageType !== 'detail'" type="primary" @click="createResult">
        计算结果
      </el-button>
    </div>
    <multi-table
      :table-data="current === 'repeatability' ? listRisetimeRepeatability : listRisetimeStability"
      :table-header="current === 'repeatability' ? columns_repeatability_risetime : columns_stability_risetime"
      :merge-rows="[]"
      :need-index="true"
    />
  </detail-block>

  <!-- 保存核查记录  -->
  <save-check-record ref="saveCheckRecordRef" />
</template>

<style lang="scss" scoped>
.link {
  text-decoration: underline;
  color: #3d7eff;
  cursor: pointer;
}

.file-area {
  display: flex;
  align-items: center;
  font-size: 14px;
  color: #60627f;
  margin-bottom: 10px;
  margin-left: 40px;
  white-space: nowrap;

  .tech-file {
    display: flex;
    align-items: center;
    margin-left: 20px;

    .file-text {
      margin-right: 10px;
    }
  }
}
</style>