<!-- 核查数据管理详情--核查项---第9套:频谱分析仪 -->
<script lang="ts" setup name="checkDataDetail">
import { ref, watch } from 'vue'
import { ElLoading, ElMessage } from 'element-plus'
import saveCheckRecord from '../../dialog/saveCheckRecord.vue'
import { clearDateValue, handleDetailTableTableHead, handleSaveDateParams, solveHistoryIndicationTableData } from '../useStabilityCaculate'
import type { IList } from './ninth-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, getHistoryIndication, getInfo, updateCheckData } from '@/api/equipment/standard/checkData'
import { uniqueMultiArray } from '@/utils/Array'
import { useCheckList } from '@/commonMethods/useCheckList'
import { useScientificNotation } from '@/commonMethods/useScientificNotation'
// 表单ref
const props = defineProps({
selectStandardId: {
type: String,
},
pageType: { // 页面类型
type: String,
},
checkDate: { // 核查日期
type: String,
},
})
const emits = defineEmits(['isConfigCheck'])
const user = useUserStore() // 用户信息
const $router = useRouter() // 关闭页面使用
const $route = useRoute() // 路由参数
const pageType = ref('add') // 页面类型: add, edit, detail
const equipmentId = ref('')
const currentDate = ref('') // 要查询历史稳定性的日期
const dateArrStability = ref<string[]>([]) // 稳定性日期数组
const infoId = ref('')
const ruleFormRef = ref()
const form = ref({
'1-flit': '',
'2-flit': '',
'3-flit': '',
'remark1': '',
'remark2': '',
'remark3': '',
})
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 conclusionList = ref<dictType[]>([]) // 结论
function getDict() {
// 结论
getDictByCode('conclusion').then((response) => {
conclusionList.value = response.data
})
}
// getDict()
// ----------------------------------------核查数据----------------------------------------------
const radioMenus = ref([ // 标签内容
{ name: '频率', value: 'frequency', params: '频率' },
{ name: '功率', value: 'power', params: '功率' },
{ name: '相对电平', value: 'relative-level', params: '相对电平' },
])
const current = ref('frequency') // 选择的tab 默认基本信息
const repeatabilityColumns = ref<TableColumn[]>([]) // 重复性表头
const stabilityColumns = ref<TableColumn[]>([]) // 稳定性表头
const repeatabilityColumnsCheckData = ref<TableColumn[]>([]) // 重复性表头
const stabilityColumnsCheckData = ref<TableColumn[]>([]) // 稳定性表头
const columns_repeatability_frequency = ref<TableColumn[]>([ // 重复性表头--频率
{ text: '核查项目', value: 'params', align: 'center', required: false, type: 'text' },
{ text: '频率点', value: 'checkPoint', align: 'center', required: false, type: 'text', unit: 'unit' },
{
text: '测量值',
value: 'indicatingValue',
align: 'center',
required: false,
width: '160',
children: [
{ text: '第1次', value: 'testValueOne', align: 'center', required: true, width: '180', type: 'inputNumber', unit: 'unit', precision: 3 },
{ text: '第2次', value: 'testValueTwo', align: 'center', required: true, width: '180', type: 'inputNumber', unit: 'unit', precision: 3 },
{ text: '第3次', value: 'testValueThree', align: 'center', required: true, width: '180', type: 'inputNumber', unit: 'unit', precision: 3 },
{ text: '第4次', value: 'testValueFour', align: 'center', required: true, width: '180', type: 'inputNumber', unit: 'unit', precision: 3 },
{ text: '第5次', value: 'testValueFive', align: 'center', required: true, width: '180', type: 'inputNumber', unit: 'unit', precision: 3 },
{ text: '第6次', value: 'testValueSix', align: 'center', required: true, width: '180', type: 'inputNumber', unit: 'unit', precision: 3 },
{ text: '第7次', value: 'testValueSeven', align: 'center', required: true, width: '180', type: 'inputNumber', unit: 'unit', precision: 3 },
{ text: '第8次', value: 'testValueEight', align: 'center', required: true, width: '180', type: 'inputNumber', unit: 'unit', precision: 3 },
{ text: '第9次', value: 'testValueNine', align: 'center', required: true, width: '180', type: 'inputNumber', unit: 'unit', precision: 3 },
{ text: '第10次', value: 'testValueTen', align: 'center', required: true, width: '180', type: 'inputNumber', unit: 'unit', precision: 3 },
],
},
{ text: '平均值x', value: 'averageValue', align: 'center', required: false, type: 'text', unit: 'unit' },
{ text: '重复性S(x)/x', value: 'standardDeviation', align: 'center', required: false, type: 'text' },
])
const columns_repeatability_frequency_check_data = ref<TableColumn[]>([ // 重复性表头--频率 -- 日期选择
{ text: '核查项目', value: 'params', align: 'center', required: true, type: 'text' },
{ text: '频率点', value: 'checkPoint', align: 'center', required: true, type: 'text', unit: 'unit' },
{
text: '测量值',
value: 'indicatingValue',
align: 'center',
required: true,
width: '160',
children: [
{ text: '第1次', value: 'testValueOne', align: 'center', required: true, width: '180', type: 'inputNumber', unit: 'unit', precision: 3 },
{ text: '第2次', value: 'testValueTwo', align: 'center', required: true, width: '180', type: 'inputNumber', unit: 'unit', precision: 3 },
{ text: '第3次', value: 'testValueThree', align: 'center', required: true, width: '180', type: 'inputNumber', unit: 'unit', precision: 3 },
{ text: '第4次', value: 'testValueFour', align: 'center', required: true, width: '180', type: 'inputNumber', unit: 'unit', precision: 3 },
{ text: '第5次', value: 'testValueFive', align: 'center', required: true, width: '180', type: 'inputNumber', unit: 'unit', precision: 3 },
{ text: '第6次', value: 'testValueSix', align: 'center', required: true, width: '180', type: 'inputNumber', unit: 'unit', precision: 3 },
],
},
{ text: '平均值x', value: 'averageValue', align: 'center', required: true, type: 'text', unit: 'unit' },
{ text: '重复性S(x)/x', value: 'standardDeviation', align: 'center', required: true, type: 'text' },
])
const columns_repeatability_power = ref<TableColumn[]>([ // 重复性表头--功率
{ text: '核查项目', value: 'params', align: 'center', required: false, type: 'text' },
{ text: '频率点', value: 'checkPoint', align: 'center', required: false, type: 'text', unit: 'unit' },
{ text: '功率', value: 'power', align: 'center', required: false, type: 'text', unit: 'powerUnit' },
{
text: '测量值',
value: 'indicatingValue',
align: 'center',
required: false,
width: '160',
children: [
{ text: '第1次', value: 'testValueOne', align: 'center', required: true, width: '180', type: 'inputNumber', unit: 'powerUnit', precision: 3 },
{ text: '第2次', value: 'testValueTwo', align: 'center', required: true, width: '180', type: 'inputNumber', unit: 'powerUnit', precision: 3 },
{ text: '第3次', value: 'testValueThree', align: 'center', required: true, width: '180', type: 'inputNumber', unit: 'powerUnit', precision: 3 },
{ text: '第4次', value: 'testValueFour', align: 'center', required: true, width: '180', type: 'inputNumber', unit: 'powerUnit', precision: 3 },
{ text: '第5次', value: 'testValueFive', align: 'center', required: true, width: '180', type: 'inputNumber', unit: 'powerUnit', precision: 3 },
{ text: '第6次', value: 'testValueSix', align: 'center', required: true, width: '180', type: 'inputNumber', unit: 'powerUnit', precision: 3 },
{ text: '第7次', value: 'testValueSeven', align: 'center', required: true, width: '180', type: 'inputNumber', unit: 'powerUnit', precision: 3 },
{ text: '第8次', value: 'testValueEight', align: 'center', required: true, width: '180', type: 'inputNumber', unit: 'powerUnit', precision: 3 },
{ text: '第9次', value: 'testValueNine', align: 'center', required: true, width: '180', type: 'inputNumber', unit: 'powerUnit', precision: 3 },
{ text: '第10次', value: 'testValueTen', align: 'center', required: true, width: '180', type: 'inputNumber', unit: 'powerUnit', precision: 3 },
],
},
{ text: '平均值x', value: 'averageValue', align: 'center', required: false, type: 'text', unit: 'powerUnit' },
{ text: '重复性S(x)/x', value: 'standardDeviation', align: 'center', required: false, type: 'text' },
])
const columns_repeatability_power_check_data = ref<TableColumn[]>([ // 重复性表头--功率 -- 日期选择
{ text: '核查项目', value: 'params', align: 'center', required: true, type: 'text' },
{ text: '频率点', value: 'checkPoint', align: 'center', required: true, type: 'text', unit: 'unit' },
{ text: '功率', value: 'power', align: 'center', required: true, type: 'text', unit: 'powerUnit' },
{
text: '测量值',
value: 'indicatingValue',
align: 'center',
required: true,
width: '160',
children: [
{ text: '第1次', value: 'testValueOne', align: 'center', required: true, width: '180', type: 'inputNumber', unit: 'powerUnit', precision: 3 },
{ text: '第2次', value: 'testValueTwo', align: 'center', required: true, width: '180', type: 'inputNumber', unit: 'powerUnit', precision: 3 },
{ text: '第3次', value: 'testValueThree', align: 'center', required: true, width: '180', type: 'inputNumber', unit: 'powerUnit', precision: 3 },
{ text: '第4次', value: 'testValueFour', align: 'center', required: true, width: '180', type: 'inputNumber', unit: 'powerUnit', precision: 3 },
{ text: '第5次', value: 'testValueFive', align: 'center', required: true, width: '180', type: 'inputNumber', unit: 'powerUnit', precision: 3 },
{ text: '第6次', value: 'testValueSix', align: 'center', required: true, width: '180', type: 'inputNumber', unit: 'powerUnit', precision: 3 },
],
},
{ text: '平均值x', value: 'averageValue', align: 'center', required: true, type: 'text', unit: 'powerUnit' },
{ text: '重复性S(x)/x', value: 'standardDeviation', align: 'center', required: true, type: 'text' },
])
const columns_repeatability_relative_level = ref<TableColumn[]>([ // 重复性表头--相对电平
{ text: '核查项目', value: 'params', align: 'center', required: false, type: 'text' },
{ text: '频率点', value: 'checkPoint', align: 'center', required: false, type: 'text', unit: 'unit' },
{ text: '相对电平', value: 'relativeLevel', align: 'center', required: false, type: 'text', unit: 'relativeLevelUnit' },
{
text: '测量值',
value: 'indicatingValue',
align: 'center',
required: false,
width: '160',
children: [
{ text: '第1次', value: 'testValueOne', align: 'center', required: true, width: '180', type: 'inputNumber', unit: 'relativeLevelUnit', precision: 3 },
{ text: '第2次', value: 'testValueTwo', align: 'center', required: true, width: '180', type: 'inputNumber', unit: 'relativeLevelUnit', precision: 3 },
{ text: '第3次', value: 'testValueThree', align: 'center', required: true, width: '180', type: 'inputNumber', unit: 'relativeLevelUnit', precision: 3 },
{ text: '第4次', value: 'testValueFour', align: 'center', required: true, width: '180', type: 'inputNumber', unit: 'relativeLevelUnit', precision: 3 },
{ text: '第5次', value: 'testValueFive', align: 'center', required: true, width: '180', type: 'inputNumber', unit: 'relativeLevelUnit', precision: 3 },
{ text: '第6次', value: 'testValueSix', align: 'center', required: true, width: '180', type: 'inputNumber', unit: 'relativeLevelUnit', precision: 3 },
{ text: '第7次', value: 'testValueSeven', align: 'center', required: true, width: '180', type: 'inputNumber', unit: 'relativeLevelUnit', precision: 3 },
{ text: '第8次', value: 'testValueEight', align: 'center', required: true, width: '180', type: 'inputNumber', unit: 'relativeLevelUnit', precision: 3 },
{ text: '第9次', value: 'testValueNine', align: 'center', required: true, width: '180', type: 'inputNumber', unit: 'relativeLevelUnit', precision: 3 },
{ text: '第10次', value: 'testValueTen', align: 'center', required: true, width: '180', type: 'inputNumber', unit: 'relativeLevelUnit', precision: 3 },
],
},
{ text: '平均值x', value: 'averageValue', align: 'center', required: false, type: 'text', unit: 'relativeLevelUnit' },
{ text: '重复性S(x)/x', value: 'standardDeviation', align: 'center', required: false, type: 'text' },
])
const columns_repeatability_relative_level_check_data = ref<TableColumn[]>([ // 重复性表头--相对电平 -- 日期选择
{ text: '核查项目', value: 'params', align: 'center', required: true, type: 'text' },
{ text: '频率点', value: 'checkPoint', align: 'center', required: true, type: 'text', unit: 'unit' },
{ text: '相对电平', value: 'relativeLevel', align: 'center', required: true, type: 'text', unit: 'relativeLevelUnit' },
{
text: '测量值',
value: 'indicatingValue',
align: 'center',
required: true,
width: '160',
children: [
{ text: '第1次', value: 'testValueOne', align: 'center', required: true, width: '180', type: 'inputNumber', unit: 'relativeLevelUnit', precision: 3 },
{ text: '第2次', value: 'testValueTwo', align: 'center', required: true, width: '180', type: 'inputNumber', unit: 'relativeLevelUnit', precision: 3 },
{ text: '第3次', value: 'testValueThree', align: 'center', required: true, width: '180', type: 'inputNumber', unit: 'relativeLevelUnit', precision: 3 },
{ text: '第4次', value: 'testValueFour', align: 'center', required: true, width: '180', type: 'inputNumber', unit: 'relativeLevelUnit', precision: 3 },
{ text: '第5次', value: 'testValueFive', align: 'center', required: true, width: '180', type: 'inputNumber', unit: 'relativeLevelUnit', precision: 3 },
{ text: '第6次', value: 'testValueSix', align: 'center', required: true, width: '180', type: 'inputNumber', unit: 'relativeLevelUnit', precision: 3 },
],
},
{ text: '平均值x', value: 'averageValue', align: 'center', required: true, type: 'text', unit: 'relativeLevelUnit' },
{ text: '重复性S(x)/x', value: 'standardDeviation', align: 'center', required: true, type: 'text' },
])
// 稳定性表头--频率
const columns_stability_frequency = ref<TableColumn[]>([
{ text: '核查项目', value: 'params', align: 'center', required: true, type: 'text' },
{ text: '频率点', value: 'checkPoint', align: 'center', required: true, type: 'text', unit: 'unit' },
{
text: '测量值',
value: 'indicatingValue',
align: 'center',
required: true,
width: '110',
children: [
{ text: '-', value: 'testValueOneDate', align: 'center', required: true, type: 'text' },
{ text: '-', value: 'testValueTwoDate', align: 'center', required: true, type: 'text' },
{ text: '-', value: 'testValueThreeDate', align: 'center', required: true, type: 'text' },
{ text: '-', value: 'testValueFourDate', align: 'center', required: true, type: 'text' },
{ text: '-', value: 'testValueFiveDate', align: 'center', required: true, type: 'text' },
{ text: '-', value: 'testValueSixDate', align: 'center', required: true, type: 'text' },
],
},
{ text: '平均值', value: 'averageValue', align: 'center', required: true, type: 'text' },
{ text: '稳定性', value: 'stability', align: 'center', required: true, type: 'text' },
{ text: 'U(k=2)', value: 'urel', align: 'center', type: 'text' },
{ text: '结论', value: 'lessThanValue', align: 'center', type: 'text' },
])
// 稳定性表头--频率 -- 日期选择
const columns_stability_frequency_check_data = ref<TableColumn[]>([
{ text: '核查项目', value: 'params', align: 'center', required: true, type: 'text' },
{ text: '频率点', value: 'checkPoint', align: 'center', required: true, type: 'text', unit: 'unit' },
{
text: '测量值',
value: 'indicatingValue',
align: 'center',
required: true,
width: '110',
children: [
{ text: '-', value: 'testValueOneDate', align: 'center', required: true, type: 'text' },
{ text: '-', value: 'testValueTwoDate', align: 'center', required: true, type: 'text' },
{ text: '-', value: 'testValueThreeDate', align: 'center', required: true, type: 'text' },
{ text: '-', value: 'testValueFourDate', align: 'center', required: true, type: 'text' },
{ text: '-', value: 'testValueFiveDate', align: 'center', required: true, type: 'text' },
{ text: '-', value: 'testValueSixDate', align: 'center', required: true, type: 'text' },
],
},
{ text: '平均值', value: 'averageValue', align: 'center', required: true, type: 'text' },
{ text: '稳定性', value: 'stability', align: 'center', required: true, type: 'text' },
{ text: 'U(k=2)', value: 'urel', align: 'center', type: 'text' },
{ text: '结论', value: 'lessThanValue', align: 'center', type: 'text' },
])
// 稳定性表头--功率
const columns_stability_power = ref<TableColumn[]>([
{ text: '核查项目', value: 'params', align: 'center', required: true, type: 'text' },
{ text: '频率点', value: 'checkPoint', align: 'center', required: true, type: 'text', unit: 'unit' },
{ text: '功率', value: 'power', align: 'center', required: true, type: 'text', unit: 'powerUnit' },
{
text: '测量值',
value: 'indicatingValue',
align: 'center',
required: true,
width: '110',
children: [
{ text: '-', value: 'testValueOneDate', align: 'center', required: true, type: 'text' },
{ text: '-', value: 'testValueTwoDate', align: 'center', required: true, type: 'text' },
{ text: '-', value: 'testValueThreeDate', align: 'center', required: true, type: 'text' },
{ text: '-', value: 'testValueFourDate', align: 'center', required: true, type: 'text' },
{ text: '-', value: 'testValueFiveDate', align: 'center', required: true, type: 'text' },
{ text: '-', value: 'testValueSixDate', align: 'center', required: true, type: 'text' },
],
},
{ text: '平均值', value: 'averageValue', align: 'center', required: true, type: 'text' },
{ text: '稳定性', value: 'stability', align: 'center', required: true, type: 'text' },
{ text: 'U(k=2)', value: 'urel', align: 'center', type: 'text' },
{ text: '结论', value: 'lessThanValue', align: 'center', type: 'text' },
])
// 稳定性表头--功率 -- 日期选择
const columns_stability_power_check_data = ref<TableColumn[]>([
{ text: '核查项目', value: 'params', align: 'center', required: true, type: 'text' },
{ text: '频率点', value: 'checkPoint', align: 'center', required: true, type: 'text', unit: 'unit' },
{ text: '功率', value: 'power', align: 'center', required: true, type: 'text', unit: 'powerUnit' },
{
text: '测量值',
value: 'indicatingValue',
align: 'center',
required: true,
width: '110',
children: [
{ text: '-', value: 'testValueOneDate', align: 'center', required: true, type: 'text' },
{ text: '-', value: 'testValueTwoDate', align: 'center', required: true, type: 'text' },
{ text: '-', value: 'testValueThreeDate', align: 'center', required: true, type: 'text' },
{ text: '-', value: 'testValueFourDate', align: 'center', required: true, type: 'text' },
{ text: '-', value: 'testValueFiveDate', align: 'center', required: true, type: 'text' },
{ text: '-', value: 'testValueSixDate', align: 'center', required: true, type: 'text' },
],
},
{ text: '平均值', value: 'averageValue', align: 'center', required: true, type: 'text' },
{ text: '稳定性', value: 'stability', align: 'center', required: true, type: 'text' },
{ text: 'U(k=2)', value: 'urel', align: 'center', type: 'text' },
{ text: '结论', value: 'lessThanValue', align: 'center', type: 'text' },
])
// 稳定性表头--相对电平
const columns_stability_relative_level = ref<TableColumn[]>([
{ text: '核查项目', value: 'params', align: 'center', required: true, type: 'text' },
{ text: '频率点', value: 'checkPoint', align: 'center', required: true, type: 'text', unit: 'unit' },
{ text: '相对电平', value: 'relativeLevel', align: 'center', required: true, type: 'text', unit: 'relativeLevelUnit' },
{
text: '测量值',
value: 'indicatingValue',
align: 'center',
required: true,
width: '110',
children: [
{ text: '-', value: 'testValueOneDate', align: 'center', required: true, type: 'text' },
{ text: '-', value: 'testValueTwoDate', align: 'center', required: true, type: 'text' },
{ text: '-', value: 'testValueThreeDate', align: 'center', required: true, type: 'text' },
{ text: '-', value: 'testValueFourDate', align: 'center', required: true, type: 'text' },
{ text: '-', value: 'testValueFiveDate', align: 'center', required: true, type: 'text' },
{ text: '-', value: 'testValueSixDate', align: 'center', required: true, type: 'text' },
],
},
{ text: '平均值', value: 'averageValue', align: 'center', required: true, type: 'text' },
{ text: '稳定性', value: 'stability', align: 'center', required: true, type: 'text' },
{ text: 'U(k=2)', value: 'urel', align: 'center', type: 'text' },
{ text: '结论', value: 'lessThanValue', align: 'center', type: 'text' },
])
// 稳定性表头--相对电平 -- 日期选择
const columns_stability_relative_level_check_data = ref<TableColumn[]>([
{ text: '核查项目', value: 'params', align: 'center', required: true, type: 'text' },
{ text: '频率点', value: 'checkPoint', align: 'center', required: true, type: 'text', unit: 'unit' },
{ text: '相对电平', value: 'relativeLevel', align: 'center', required: true, type: 'text', unit: 'relativeLevelUnit' },
{
text: '测量值',
value: 'indicatingValue',
align: 'center',
required: true,
width: '110',
children: [
{ text: '-', value: 'testValueOneDate', align: 'center', required: true, type: 'text' },
{ text: '-', value: 'testValueTwoDate', align: 'center', required: true, type: 'text' },
{ text: '-', value: 'testValueThreeDate', align: 'center', required: true, type: 'text' },
{ text: '-', value: 'testValueFourDate', align: 'center', required: true, type: 'text' },
{ text: '-', value: 'testValueFiveDate', align: 'center', required: true, type: 'text' },
{ text: '-', value: 'testValueSixDate', align: 'center', required: true, type: 'text' },
],
},
{ text: '平均值', value: 'averageValue', align: 'center', required: true, type: 'text' },
{ text: '稳定性', value: 'stability', align: 'center', required: true, type: 'text' },
{ text: 'U(k=2)', value: 'urel', align: 'center', type: 'text' },
{ text: '结论', value: 'lessThanValue', align: 'center', type: 'text' },
])
const listRepeatability = ref<any[]>([]) // 重复性数据
const listStability = ref<any[]>([]) // 稳定性数据
const listRepeatabilityCheckData = ref<any[]>([]) // 重复性数据
const listStabilityCheckData = ref<any[]>([]) // 稳定性数据
const frequencyListRepeatability = ref<any[]>([]) // 频率重复性
const frequencyListRepeatabilityCheckData = ref<any[]>([]) // 频率重复性 -- 日期选择
const frequencyListStability = ref<any[]>([]) // 频率稳定性
const frequencyListStabilityCheckData = ref<any[]>([]) // 频率稳定性 -- 日期选择
const powerListRepeatability = ref<any[]>([]) // 功率重复性
const powerListRepeatabilityCheckData = ref<any[]>([]) // 功率重复性 -- 日期选择
const powerListStability = ref<any[]>([]) // 功率稳定性
const powerListStabilityCheckData = ref<any[]>([]) // 功率稳定性 -- 日期选择
const relativeLevelListRepeatability = ref<any[]>([]) // 相对电平重复性
const relativeLevelListRepeatabilityCheckData = ref<any[]>([]) // 相对电平重复性 -- 日期选择
const relativeLevelListStability = ref<any[]>([]) // 相对电平稳定性
const relativeLevelListStabilityCheckData = ref<any[]>([]) // 相对电平稳定性 -- 日期选择
// 获取配置详情
function fetchCheckItemDetail(cequipmentId: string, belongStandardEquipmentParam: string, itemCategoryIdParam: string, itemCategoryNameParam: string) {
belongStandardEquipment.value = belongStandardEquipmentParam // 检校标准装置
itemCategoryId.value = itemCategoryIdParam // 核查分类id
itemCategoryName.value = itemCategoryNameParam // 核查分类名称
equipmentId.value = cequipmentId
const loading = ElLoading.service({
lock: true,
background: 'rgba(255, 255, 255, 0.8)',
})
const params = {
equipmentId: cequipmentId, // 设备id
belongStandardEquipment: belongStandardEquipment.value, // 检校标准装置code
itemCategoryId: itemCategoryId.value, // 核查项分类id
itemCategoryName: itemCategoryName.value, // 核查项分类名称
}
getCheckItemDetail(params).then((res) => {
loading.close()
handleData(res.data.checkItemDataSpectrumAnalyzerList || [])
fetchHistoryIndication() // 获取稳定性
})
}
// 处理数据
function handleData(data: any) {
if (!data) { return }
// 控制tab
const dict = {
1: '频率',
2: '功率',
3: '相对电平',
} as { [key: string]: string }
const needShowTab = uniqueMultiArray(data.map((item: any) => ({ ...item, params: Number(item.params) ? dict[item.params] : item.params })), 'params').map((item: any) => item.params)
radioMenus.value = radioMenus.value.filter((item: any) => needShowTab.includes(Number(item.params) ? dict[item.params] : item.params))
current.value = ''
setTimeout(() => {
current.value = radioMenus.value[0]?.value
})
const handlerData = (type: string, paramsNum: string, paramsName: string, data: any) => {
let result = []
if (type === '重复性') {
const params = props.pageType !== 'add'
? {}
: {
testValueOne: '',
testValueTwo: '',
testValueThree: '',
testValueFour: '',
testValueFive: '',
testValueSix: '',
testValueSeven: '',
testValueEight: '',
testValueNine: '',
testValueTen: '',
averageValue: '',
standardDeviation: '',
}
result = data.filter((item: any) => (Number(item.params) ? dict[item.params] : item.params) === paramsName).map((item: any) => ({
...item,
checkType: '重复性',
...params,
editable: props.pageType !== 'detail',
params: paramsName,
}))
}
else {
const params = props.pageType !== 'add'
? {}
: {
testValueOne: '',
testValueTwo: '',
testValueThree: '',
testValueFour: '',
testValueFive: '',
testValueSix: '',
testValueSeven: '',
testValueEight: '',
testValueNine: '',
testValueTen: '',
testValueOneDate: '',
testValueTwoDate: '',
testValueThreeDate: '',
testValueFourDate: '',
testValueFiveDate: '',
testValueSixDate: '',
averageValue: '',
stability: '',
lessThan: '',
lessThanValue: '',
// urel: item.urel,
}
result = data.filter((item: any) => (Number(item.params) ? dict[item.params] : item.params) === paramsName).map((item: any) => ({
...item,
checkType: '稳定性',
...params,
lessThan: item.lessThan,
lessThanValue: item.lessThanValue,
editable: props.pageType !== 'detail',
params: paramsName,
}))
}
return result
}
// 频率重复性
frequencyListRepeatability.value = handlerData('重复性', '1', '频率', data)
// 频率稳定性
frequencyListStability.value = handlerData('稳定性', '1', '频率', data)
// 功率重复性
powerListRepeatability.value = handlerData('重复性', '2', '功率', data)
// 功率稳定性
powerListStability.value = handlerData('稳定性', '2', '功率', data)
// 相对电平重复性
relativeLevelListRepeatability.value = handlerData('重复性', '3', '相对电平', data)
// 相对电平稳定性
relativeLevelListStability.value = handlerData('稳定性', '3', '相对电平', data)
}
// 点击生成结果处理
const createResult = (params: string, type: string) => {
// 公共请求函数
const handleResult = (list: any, fun: any) => {
const data = {
belongStandardEquipment: belongStandardEquipment.value, // 检校标准装置
checkDataSpectrumAnalyzerList: [],
itemCategoryId: itemCategoryId.value, // 核查项分类id
itemCategoryName: itemCategoryName.value, // 核查项分类id
}
data.checkDataSpectrumAnalyzerList = list
calculateHandle(data).then((res) => {
fun(res.data)
})
}
// 公共处理结果函数
const handeData = (initData: any, handleData: any) => {
return handleData.map((item: any, index: number) => {
return {
...item,
averageValue: initData[index].averageValue || item.averageValue, // 核查读数6(本次重复性示值算术平均值)
standardDeviation: useScientificNotation(initData[index].standardDeviation) || useScientificNotation(item.standardDeviation), // 标准偏差S(X)
stability: useScientificNotation(initData[index].stability) || useScientificNotation(item.stability), // 稳定性
testValueSixDate: props.checkDate, // 核查读数6日期(本次核查日期)
testValueSix: initData[index].testValueSix || item.testValueSix, // 核查读数6日期(本次核查日期)
}
})
}
// 重复性处理结果
const repeatabilityResult = (params: string) => {
handleResult(
listRepeatability.value, (data: any) => {
listRepeatability.value = handeData(data, listRepeatability.value)
switch (params) {
case '1':
frequencyListRepeatability.value = handeData(data, listRepeatability.value)
break
case '2':
powerListRepeatability.value = handeData(data, listRepeatability.value)
break
case '3':
relativeLevelListRepeatability.value = handeData(data, listRepeatability.value)
break
}
})
}
// 稳定性处理结果
const stabilityResult = (params: string) => {
handleResult(
listStability.value.map((item: any, index: number) => ({
...item,
testValueSix: listRepeatability.value[index].averageValue,
testValueSixDate: props.checkDate,
})), (data: any) => {
listStability.value = handeData(data, listStability.value)
switch (params) {
case '1':
frequencyListStability.value = handeData(data, listStability.value)
break
case '2':
powerListStability.value = handeData(data, listStability.value)
break
case '3':
relativeLevelListStability.value = handeData(data, listStability.value)
break
}
})
}
switch (params) {
case 'frequency':
// 频率
if (!frequencyListRepeatability.value.length) {
ElMessage.warning('频率未配置重复性,请检查')
break
}
switch (type) {
case '重复性':
if (useCheckList(frequencyListRepeatability.value, columns_repeatability_frequency.value, '频率重复性')) {
repeatabilityResult('1')
}
break
case '稳定性':
if (!frequencyListRepeatability.value[0].averageValue) {
ElMessage.warning('请先计算频率重复性')
break
}
stabilityResult('1')
break
}
break
case 'power':
// 功率
if (!powerListRepeatability.value.length) {
ElMessage.warning('功率未配置重复性,请检查')
break
}
switch (type) {
case '重复性':
if (useCheckList(powerListRepeatability.value, columns_repeatability_power.value, '功率重复性')) {
repeatabilityResult('2')
}
break
case '稳定性':
if (!powerListRepeatability.value[0].averageValue) {
ElMessage.warning('请先计算功率重复性')
break
}
stabilityResult('2')
break
}
break
case 'relative-level':
// 相对电平
if (!relativeLevelListRepeatability.value.length) {
ElMessage.warning('相对电平未配置重复性,请检查')
break
}
switch (type) {
case '重复性':
if (useCheckList(relativeLevelListRepeatability.value, columns_repeatability_relative_level.value, '相对电平重复性')) {
repeatabilityResult('3')
}
break
case '稳定性':
if (!relativeLevelListRepeatability.value[0].averageValue) {
ElMessage.warning('请先计算相对电平重复性')
break
}
stabilityResult('3')
break
}
break
}
}
// ------------------------------------------------------------------------------------------
// 处理详情数据
const solveGetDetailData = (responseList: any) => {
const dep = JSON.parse(JSON.stringify(responseList))
// 控制tab
const dict = {
1: '频率',
2: '功率',
3: '相对电平',
} as { [key: string]: string }
const needShowTab = uniqueMultiArray(dep.map((item: any) => ({ ...item, params: Number(item.params) ? dict[item.params] : item.params })), 'params').map((item: any) => item.params)
radioMenus.value = radioMenus.value.filter((item: any) => needShowTab.includes(Number(item.params) ? dict[item.params] : item.params))
current.value = ''
setTimeout(() => {
current.value = radioMenus.value[0]?.value
})
const handlerData = (data: any[]) => {
return data.map((item: any) => ({
...item,
editable: props.pageType !== 'detail',
// checkParam: item.params === '1' ? '频率' : item.params === '2' ? '功率' : '相对电平',
}))
}
// 频率 重复性
const frequencyListRepeatabilityList = handlerData(dep.filter((item: { params: string; checkType: string }) => (item.params === '1' || item.params === '频率') && item.checkType === '重复性'))
// 频率 稳定性
const frequencyListStabilityList = handlerData(dep.filter((item: { params: string; checkType: string }) => (item.params === '1' || item.params === '频率') && item.checkType === '稳定性'))
// 功率 重复性
const powerListRepeatabilityList = handlerData(dep.filter((item: { params: string; checkType: string }) => (item.params === '2' || item.params === '功率') && item.checkType === '重复性'))
// 功率 稳定性
const powerListStabilityList = handlerData(dep.filter((item: { params: string; checkType: string }) => (item.params === '2' || item.params === '功率') && item.checkType === '稳定性'))
// 相对电平 重复性
const relativeLevelListRepeatabilityList = handlerData(dep.filter((item: { params: string; checkType: string }) => (item.params === '3' || item.params === '相对电平') && item.checkType === '重复性'))
// 相对电平 稳定性
const relativeLevelListStabilityList = handlerData(dep.filter((item: { params: string; checkType: string }) => (item.params === '3' || item.params === '相对电平') && item.checkType === '稳定性'))
return {
frequencyListRepeatabilityList,
frequencyListStabilityList,
powerListRepeatabilityList,
powerListStabilityList,
relativeLevelListRepeatabilityList,
relativeLevelListStabilityList,
}
}
// ------------------------------------------------------------------------------------------
// 获取详情
function fetchInfo(id = '') {
const loading = ElLoading.service({
lock: true,
background: 'rgba(255, 255, 255, 0.8)',
})
getInfo({ id: infoId.value }).then((res) => {
form.value = { ...res.data }
equipmentId.value = res.data.equipmentId
const { frequencyListRepeatabilityList, frequencyListStabilityList, powerListRepeatabilityList, powerListStabilityList, relativeLevelListRepeatabilityList, relativeLevelListStabilityList } = solveGetDetailData(res.data.checkDataSpectrumAnalyzerList)
if (id !== '') { // 查询的日期获得的数据
frequencyListRepeatabilityCheckData.value = frequencyListRepeatabilityList
frequencyListStabilityCheckData.value = frequencyListStabilityList
powerListRepeatabilityCheckData.value = powerListRepeatabilityList
powerListStabilityCheckData.value = powerListStabilityList
relativeLevelListRepeatabilityCheckData.value = relativeLevelListRepeatabilityList
relativeLevelListStabilityCheckData.value = relativeLevelListStabilityList
}
else {
frequencyListRepeatability.value = frequencyListRepeatabilityList
frequencyListStability.value = frequencyListStabilityList
powerListRepeatability.value = powerListRepeatabilityList
powerListStability.value = powerListStabilityList
relativeLevelListRepeatability.value = relativeLevelListRepeatabilityList
relativeLevelListStability.value = relativeLevelListStabilityList
}
nextTick(() => {
if (id !== '') { // 稳定性表头---查询历史的稳定性日期数据
const data = [
{ text: '-', value: 'testValueOneDate', align: 'center', required: false, type: 'text', customHeader: true },
{ text: '-', value: 'testValueTwoDate', align: 'center', required: false, type: 'text', customHeader: true },
{ text: '-', value: 'testValueThreeDate', align: 'center', required: false, type: 'text', customHeader: true },
{ text: '-', value: 'testValueFourDate', align: 'center', required: false, type: 'text', customHeader: true },
{ text: '-', value: 'testValueFiveDate', align: 'center', required: false, type: 'text', customHeader: true },
{ text: '-', value: 'testValueSixDate', align: 'center', required: false, type: 'text', customHeader: true },
] as any[]
columns_stability_frequency.value[2].children = data
columns_stability_power.value[3].children = data
columns_stability_relative_level.value[3].children = data
fetchHistoryIndication(currentDate.value) // 获取稳定性
}
else { // 详情制作表头
columns_stability_frequency.value = handleDetailTableTableHead(columns_stability_frequency.value, frequencyListStability.value, 2)
columns_stability_power.value = handleDetailTableTableHead(columns_stability_power.value, powerListStability.value, 3)
columns_stability_relative_level.value = handleDetailTableTableHead(columns_stability_relative_level.value, relativeLevelListStability.value, 3)
}
// resetCurrent()
})
form.value['1-flit'] = `${frequencyListStability.value.every(item => item.lessThan === 1 || item.lessThan === '1') ? '合格' : '不合格'}`
form.value['2-flit'] = `${powerListStability.value.every(item => item.lessThan === 1 || item.lessThan === '1') ? '合格' : '不合格'}`
form.value['3-flit'] = `${relativeLevelListStability.value.every(item => item.lessThan === 1 || item.lessThan === '1') ? '合格' : '不合格'}`
form.value.remark1 = `${frequencyListStability.value[0].remark}` || ''
form.value.remark2 = `${powerListStability.value[0].remark}` || ''
form.value.remark3 = `${relativeLevelListStability.value[0].remark}` || ''
if (props.pageType === 'edit' || props.pageType === 'detail') {
fetchHistoryIndication() // 重新拉取稳定性日期
}
loading.close()
})
}
watch(() => form.value, (newVal) => {
if (newVal) {
(frequencyListStability.value || []).map((item: any) => ({ ...item, remark: form.value.remark1 }));
(powerListStability.value || []).map((item: any) => ({ ...item, remark: form.value.remark2 }));
(relativeLevelListStability.value || []).map((item: any) => ({ ...item, remark: form.value.remark3 }))
}
}, {
deep: true,
})
function resetCurrent() {
const currentBak = current.value
current.value = ''
setTimeout(() => {
current.value = currentBak
})
}
/**
* 获取稳定性示值
* @param date 查询日期
*/
function fetchHistoryIndication(date = '') {
const params = {
belongStandardEquipment: belongStandardEquipment.value, // 检校标准装置(字典code)
checkDate: date || props.checkDate!, // 核查日期
checkParam: '', // 核查参数((直流稳压电源-直接电流(间接测量))
conclusion: '合格', // 结论
equipmentId: equipmentId.value, // 被核查设备id
params: radioMenus.value[0]?.params, // 核查项目
stabilityExamine: '1', // 是否用于稳定性考核(1/0)
standardEquipmentId: props.selectStandardId!, // 被核查标准装置id
}
if (props.selectStandardId && equipmentId.value) {
getHistoryIndication(params).then((res) => {
if (date === '') { // 正常核查数据
const num = (props.pageType === 'edit' || props.pageType === 'detail') ? 5 : 4
// 频率
if (radioMenus.value.filter((item: { name: string }) => item.name === '频率').length) {
frequencyListStability.value = (frequencyListStability.value || []).map((item) => {
// clearDateValue(item)
const { itemData, columnsData } = solveHistoryIndicationTableData(res.data.data, item, columns_stability_frequency.value, num, 2, '9')
columns_stability_frequency.value = columnsData
return item = itemData
})
frequencyListStability.value = handleSaveDateParams(columns_stability_frequency.value, frequencyListStability.value, 2)
}
// 功率
if (radioMenus.value.filter((item: { name: string }) => item.name === '功率').length) {
powerListStability.value = (powerListStability.value || []).map((item) => {
// clearDateValue(item)
const { itemData, columnsData } = solveHistoryIndicationTableData(res.data.data, item, columns_stability_power.value, num, 3, '9')
columns_stability_power.value = columnsData
return item = itemData
})
powerListStability.value = handleSaveDateParams(columns_stability_power.value, powerListStability.value, 3)
}
// 相对电平
if (radioMenus.value.filter((item: { name: string }) => item.name === '相对电平').length) {
relativeLevelListStability.value = (relativeLevelListStability.value || []).map((item) => {
// clearDateValue(item)
const { itemData, columnsData } = solveHistoryIndicationTableData(res.data.data, item, columns_stability_relative_level.value, num, 3, '9')
columns_stability_relative_level.value = columnsData
return item = itemData
})
relativeLevelListStability.value = handleSaveDateParams(columns_stability_relative_level.value, relativeLevelListStability.value, 3)
}
}
else {
initColumnsCheckDate()
// 频率
if (radioMenus.value.filter((item: { name: string }) => item.name === '频率').length) {
frequencyListStabilityCheckData.value = (frequencyListStabilityCheckData.value || []).map((item) => {
clearDateValue(item)
const { itemData, columnsData } = solveHistoryIndicationTableData(res.data, item, columns_stability_frequency_check_data.value, 5, 2, '9')
columns_stability_frequency_check_data.value = columnsData
return item = itemData
})
frequencyListStabilityCheckData.value = handleSaveDateParams(columns_stability_frequency_check_data.value, frequencyListStabilityCheckData.value, 2)
}
// 功率
if (radioMenus.value.filter((item: { name: string }) => item.name === '功率').length) {
powerListStabilityCheckData.value = (powerListStabilityCheckData.value || []).map((item) => {
clearDateValue(item)
const { itemData, columnsData } = solveHistoryIndicationTableData(res.data, item, columns_stability_power_check_data.value, 5, 3, '9')
columns_stability_power_check_data.value = columnsData
return item = itemData
})
powerListStabilityCheckData.value = handleSaveDateParams(columns_stability_power_check_data.value, powerListStabilityCheckData.value, 3)
}
// 相对电平
if (radioMenus.value.filter((item: { name: string }) => item.name === '相对电平').length) {
relativeLevelListStabilityCheckData.value = (relativeLevelListStabilityCheckData.value || []).map((item) => {
clearDateValue(item)
const { itemData, columnsData } = solveHistoryIndicationTableData(res.data, item, columns_stability_relative_level_check_data.value, 5, 3, '9')
columns_stability_relative_level_check_data.value = columnsData
return item = itemData
})
relativeLevelListStabilityCheckData.value = handleSaveDateParams(columns_stability_relative_level_check_data.value, relativeLevelListStabilityCheckData.value, 3)
}
}
})
}
}
// =======================点击表头日期查询历史稳定性数据===================
// 点击表头
const handleClickHeader = (val: any, checkDateDetailId: string) => {
dateArrStability.value = ['核查数据', val.label]
fetchInfo(checkDateDetailId) // 获取此次历史日期的详情
}
// 日期变化
const handleChangeRadio = (date: string) => {
currentDate.value = date
}
// 监听核查日期变化
watch(() => props.checkDate, (newValue) => {
initColumns()
nextTick(() => {
fetchHistoryIndication() // 重新拉取稳定性日期
})
}, { immediate: true })
/**
* 初始化表头
* @param soveLastColumnDate 是否处理最后一列
*/
function initColumns() {
(columns_stability_frequency.value[2] || {}).children = [
{ width: '180', text: '-', value: 'testValueOne', align: 'center', required: false, type: 'text', customHeader: true },
{ width: '180', text: '-', value: 'testValueTwo', align: 'center', required: false, type: 'text', customHeader: true },
{ width: '180', text: '-', value: 'testValueThree', align: 'center', required: false, type: 'text', customHeader: true },
{ width: '180', text: '-', value: 'testValueFour', align: 'center', required: false, type: 'text', customHeader: true },
{ width: '180', text: '-', value: 'testValueFive', align: 'center', required: false, type: 'text', customHeader: true },
{ width: '180', text: '-', value: 'testValueSix', align: 'center', required: false, type: 'text', customHeader: true },
];
(columns_stability_power.value[3] || {}).children = [
{ width: '180', text: '-', value: 'testValueOne', align: 'center', required: false, type: 'text', customHeader: true },
{ width: '180', text: '-', value: 'testValueTwo', align: 'center', required: false, type: 'text', customHeader: true },
{ width: '180', text: '-', value: 'testValueThree', align: 'center', required: false, type: 'text', customHeader: true },
{ width: '180', text: '-', value: 'testValueFour', align: 'center', required: false, type: 'text', customHeader: true },
{ width: '180', text: '-', value: 'testValueFive', align: 'center', required: false, type: 'text', customHeader: true },
{ width: '180', text: '-', value: 'testValueSix', align: 'center', required: false, type: 'text', customHeader: true },
];
(columns_stability_relative_level.value[3] || {}).children = [
{ width: '180', text: '-', value: 'testValueOne', align: 'center', required: false, type: 'text', customHeader: true },
{ width: '180', text: '-', value: 'testValueTwo', align: 'center', required: false, type: 'text', customHeader: true },
{ width: '180', text: '-', value: 'testValueThree', align: 'center', required: false, type: 'text', customHeader: true },
{ width: '180', text: '-', value: 'testValueFour', align: 'center', required: false, type: 'text', customHeader: true },
{ width: '180', text: '-', value: 'testValueFive', align: 'center', required: false, type: 'text', customHeader: true },
{ width: '180', text: '-', value: 'testValueSix', align: 'center', required: false, type: 'text', customHeader: true },
]
const index = columns_stability_frequency.value.findIndex(item => item.text === '测量值')
if (index !== -1) {
columns_stability_frequency.value[index].children![5].text = props.checkDate! // 最后一列的表头日期
}
const indexWorst = columns_stability_power.value.findIndex(item => item.text === '测量值')
if (index !== -1) {
columns_stability_power.value[indexWorst].children![5].text = props.checkDate! // 最后一列的表头日期
}
const indexModel = columns_stability_relative_level.value.findIndex(item => item.text === '测量值')
if (index !== -1) {
columns_stability_relative_level.value[indexModel].children![5].text = props.checkDate! // 最后一列的表头日期
}
}
/**
* 初始化CheckDate表头
* @param soveLastColumnDate 是否处理最后一列
*/
function initColumnsCheckDate() {
columns_stability_frequency_check_data.value[2].children = [
{ width: '180', text: '-', value: 'testValueOne', align: 'center', required: false, type: 'text', customHeader: true },
{ width: '180', text: '-', value: 'testValueTwo', align: 'center', required: false, type: 'text', customHeader: true },
{ width: '180', text: '-', value: 'testValueThree', align: 'center', required: false, type: 'text', customHeader: true },
{ width: '180', text: '-', value: 'testValueFour', align: 'center', required: false, type: 'text', customHeader: true },
{ width: '180', text: '-', value: 'testValueFive', align: 'center', required: false, type: 'text', customHeader: true },
{ width: '180', text: '-', value: 'testValueSix', align: 'center', required: false, type: 'text', customHeader: true },
]
columns_stability_power_check_data.value[3].children = [
{ width: '180', text: '-', value: 'testValueOne', align: 'center', required: false, type: 'text', customHeader: true },
{ width: '180', text: '-', value: 'testValueTwo', align: 'center', required: false, type: 'text', customHeader: true },
{ width: '180', text: '-', value: 'testValueThree', align: 'center', required: false, type: 'text', customHeader: true },
{ width: '180', text: '-', value: 'testValueFour', align: 'center', required: false, type: 'text', customHeader: true },
{ width: '180', text: '-', value: 'testValueFive', align: 'center', required: false, type: 'text', customHeader: true },
{ width: '180', text: '-', value: 'testValueSix', align: 'center', required: false, type: 'text', customHeader: true },
]
columns_stability_relative_level_check_data.value[4].children = [
{ width: '180', text: '-', value: 'testValueOne', align: 'center', required: false, type: 'text', customHeader: true },
{ width: '180', text: '-', value: 'testValueTwo', align: 'center', required: false, type: 'text', customHeader: true },
{ width: '180', text: '-', value: 'testValueThree', align: 'center', required: false, type: 'text', customHeader: true },
{ width: '180', text: '-', value: 'testValueFour', align: 'center', required: false, type: 'text', customHeader: true },
{ width: '180', text: '-', value: 'testValueFive', align: 'center', required: false, type: 'text', customHeader: true },
{ width: '180', text: '-', value: 'testValueSix', align: 'center', required: false, type: 'text', customHeader: true },
]
}
// / 保存之前的校验
function checkList() {
// 新建核查数据的时候,在保存之前要先校验一下本次核查日期有没有数据,没有不允许保存
if (`${frequencyListRepeatability.value[0].averageValue}` === '') {
ElMessage.warning('请计算频率重复性')
return false
}
if (`${powerListRepeatability.value[0].averageValue}` === '') {
ElMessage.warning('请计算功率重复性')
return false
}
if (`${relativeLevelListRepeatability.value[0].averageValue}` === '') {
ElMessage.warning('请计算相对电平重复性')
return false
}
return true
}
// -------------------------------------钩子-----------------------------------------------------
// 统计日期
const dateCount = (columns: TableColumn[], index: number) => {
let dateNum = 0 // 稳定性表格有几个日期
// 统计有几个日期
columns[index]?.children?.forEach((item) => {
if (item.text !== '-' && item.text !== '') {
dateNum += 1
}
})
return dateNum
}
watch(() => [frequencyListStability.value, powerListStability.value, relativeLevelListStability.value], (newVal) => {
const dateNum1 = dateCount(columns_stability_frequency.value, 2)
const dateNum2 = dateCount(columns_stability_power.value, 3)
const dateNum3 = dateCount(columns_stability_relative_level.value, 3)
form.value['1-flit'] = dateNum1 < 4 ? '合格' : newVal[0]?.every(item => item.lessThan === 1 || item.lessThan === '1') ? '合格' : '不合格'
form.value['2-flit'] = dateNum2 < 4 ? '合格' : newVal[1]?.every(item => item.lessThan === 1 || item.lessThan === '1') ? '合格' : '不合格'
form.value['3-flit'] = dateNum3 < 4 ? '合格' : newVal[2]?.every(item => item.lessThan === 1 || item.lessThan === '1') ? '合格' : '不合格'
}, { deep: true })
watch(() => current.value, (newValue) => {
if (currentDate.value.includes('-')) { return }
switch (newValue) {
case 'frequency': // 频率
repeatabilityColumns.value = columns_repeatability_frequency.value // 重复性表头
stabilityColumns.value = columns_stability_frequency.value // 稳定性表头
listRepeatability.value = frequencyListRepeatability.value // 重复性数据
listStability.value = frequencyListStability.value // 稳定性数据
break
case 'power': // 功率
repeatabilityColumns.value = columns_repeatability_power.value // 重复性表头
stabilityColumns.value = columns_stability_power.value // 稳定性表头
listRepeatability.value = powerListRepeatability.value // 重复性数据
listStability.value = powerListStability.value // 稳定性数据
break
case 'relative-level': // 相对电平
repeatabilityColumns.value = columns_repeatability_relative_level.value // 重复性表头
stabilityColumns.value = columns_stability_relative_level.value // 稳定性表头
listRepeatability.value = relativeLevelListRepeatability.value // 重复性数据
listStability.value = relativeLevelListStability.value // 稳定性数据
break
}
}, { immediate: true })
watch(() => [currentDate.value, current.value], (newValue) => {
console.log(newValue[0])
if (newValue[0] === '核查数据') { return }
switch (newValue[1]) {
case 'frequency': // 频率
listRepeatabilityCheckData.value = frequencyListRepeatabilityCheckData.value
repeatabilityColumnsCheckData.value = columns_repeatability_frequency.value
listStabilityCheckData.value = frequencyListStabilityCheckData.value
stabilityColumnsCheckData.value = columns_stability_frequency_check_data.value
break
case 'power': // 功率
listRepeatabilityCheckData.value = powerListRepeatabilityCheckData.value
repeatabilityColumnsCheckData.value = columns_repeatability_power.value
listStabilityCheckData.value = powerListStabilityCheckData.value
stabilityColumnsCheckData.value = columns_stability_power_check_data.value
break
case 'relative-level': // 相对电平
listRepeatabilityCheckData.value = relativeLevelListRepeatabilityCheckData.value
repeatabilityColumnsCheckData.value = columns_repeatability_relative_level.value
listStabilityCheckData.value = relativeLevelListStabilityCheckData.value
stabilityColumnsCheckData.value = columns_stability_relative_level_check_data.value
break
}
})
watch(() => props.pageType, (newVal) => {
if (newVal) {
frequencyListRepeatability.value = (frequencyListRepeatability.value || []).map((item: any) => ({ ...item, editable: newVal !== 'detail' }))
powerListRepeatability.value = (powerListRepeatability.value || []).map((item: any) => ({ ...item, editable: newVal !== 'detail' }))
relativeLevelListRepeatability.value = (powerListRepeatability.value || []).map((item: any) => ({ ...item, editable: newVal !== 'detail' }))
current.value = ''
setTimeout(() => {
current.value = 'frequency'
})
}
})
onMounted(async () => {
belongStandardEquipment.value = $route.query.belongStandardEquipment as string // 检校标准装置
itemCategoryId.value = $route.query.itemCategoryId as string // 核查项分类id
itemCategoryName.value = $route.query.itemCategoryName as string // 核查项分类名称
if (pageType.value !== 'add') {
fetchInfo()
}
})
const getList = () => {
const arr = [...frequencyListRepeatability.value || [], ...frequencyListStability.value || [], ...powerListRepeatability.value || [], ...powerListStability.value || [], ...relativeLevelListRepeatability.value || [], ...relativeLevelListStability.value || []] as any[]
return arr
}
defineExpose({ fetchCheckItemDetail, form, checkList, getList })
</script>
<template>
<!-- 核查数据 -->
<detail-block
:title="dateArrStability.length > 1 ? ' ' : '核查数据'" :title-menus="dateArrStability"
@handle-change-radio="handleChangeRadio"
>
<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(current, '重复性')">
生成结果处理
</el-button>
</div>
<multi-table
v-show="currentDate === '核查数据' || currentDate === ''" :table-data="listRepeatability"
:table-header="repeatabilityColumns" :merge-rows="[]" :need-index="true"
/>
<!-- 历史日期重复性数据 -->
<multi-table
v-show="currentDate !== '核查数据' && currentDate !== ''" :table-data="listRepeatabilityCheckData"
:table-header="repeatabilityColumnsCheckData" :merge-rows="[]" :need-index="true" max-height="300"
/>
<div style="display: flex;justify-content: space-between;align-items: center;">
<h5>核查类型--稳定性</h5>
<el-button v-if="pageType !== 'detail'" type="primary" @click="createResult(current, '稳定性')">
生成结果处理
</el-button>
</div>
<multi-table
v-show="currentDate === '核查数据' || currentDate === ''" :table-data="listStability"
:table-header="stabilityColumns" :merge-rows="[]" :need-index="true" max-height="500"
@handle-click-header="handleClickHeader"
/>
<multi-table
v-show="currentDate !== '核查数据' && currentDate !== ''" :table-data="listStabilityCheckData"
:table-header="stabilityColumnsCheckData" :merge-rows="[]" :need-index="true" max-height="500"
@handle-click-header="handleClickHeader"
/>
<!-- 稳定性考核是否合格 -->
<el-form style="margin-top: 20px;" :model="form" label-width="160" label-position="right">
<el-row :gutter="24">
<el-col :span="12">
<el-form-item v-if="current === 'frequency'" label="稳定性考核是否合格:" prop="flit">
<el-input
v-model="form['1-flit']" class="full-width-input" disabled
:placeholder="pageType === 'detail' ? ' ' : '稳定性考核是否合格'"
/>
</el-form-item>
<!-- <el-form-item v-if="current === 'frequency'" label="备注:" prop="flit">
<el-input v-model="form.remark1" class="full-width-input" :placeholder="pageType === 'detail' ? ' ' : '备注'" />
</el-form-item> -->
<el-form-item v-if="current === 'power'" label="稳定性考核是否合格:" prop="flit">
<el-input
v-model="form['2-flit']" class="full-width-input" disabled
:placeholder="pageType === 'detail' ? ' ' : '稳定性考核是否合格'"
/>
</el-form-item>
<!-- <el-form-item v-if="current === 'power'" label="稳定性考核是否合格:" prop="flit">
<el-input v-model="form.remark2" class="full-width-input" :placeholder="pageType === 'detail' ? ' ' : '备注'" />
</el-form-item> -->
<el-form-item v-if="current === 'relative-level'" label="稳定性考核是否合格:" prop="flit">
<el-input
v-model="form['3-flit']" class="full-width-input" disabled
:placeholder="pageType === 'detail' ? ' ' : '稳定性考核是否合格'"
/>
</el-form-item>
<!-- <el-form-item v-if="current === 'relative-level'" label="稳定性考核是否合格:" prop="flit">
<el-input v-model="form.remark3" class="full-width-input" :placeholder="pageType === 'detail' ? ' ' : '备注'" />
</el-form-item> -->
</el-col>
</el-row>
</el-form>
</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>