<!-- 第10套:信号发生器标准装置 -->
<script lang="ts" setup name="TemplateDetailTenth">
import { ElMessage } from 'element-plus'
import type { IList } from './templateDetail-interface'
import templateTable from './templateTable.vue'
import type { dictType } from '@/global'
import { getDictByCode } from '@/api/system/dict'
import { calc } from '@/utils/useCalc'
import { useCheckList } from '@/commonMethods/useCheckList'
import { calculate, recalculate } from '@/api/business/measure/caculate'
import type { TableColumn } from '@/components/NormalTable/table_interface'
import { differenceArray } from '@/utils/Array'
const props = defineProps({
pageType: {
type: String,
default: 'add',
},
itemCategoryName: {
type: String,
require: true,
}, // 智能模型检定项分类名称
belongStandardEquipment: { // 检校标准装置code
type: String,
require: true,
},
list: {
type: Array as any,
},
form: { // 检定项表单
type: Object as any,
},
itemId: { // 检定项id
type: String,
default: '',
},
})
const form = ref({
appearanceFunctionCheck: 1, // 外观及功能性检查
frequency: 1, // 频率
power: 1, // 功率
amplitudeModulationDepth: 1, // 调幅深度
frequencyModulationDeviation: 1, // 调频频偏
remainAmplitudeModulation: 1, // 剩余调幅
remainFrequencyModulation: 1, // 剩余调频
harmonic: 1, // 谐波
phaseModulationPhaseDeviation: 1, // 调相相偏
noHarmonic: 1, // 非谐波
})
const tableLoading = ref(false)
const frequencyList = ref<IList[]>([]) // 频率
const powerList = ref<IList[]>([]) // 功率
const amplitudeModulationDepthList = ref<IList[]>([]) // 调幅深度
const frequencyModulationDeviationList = ref<IList[]>([]) // 调频频偏
const residentialAmplitudeModulationList = ref<IList[]>([]) // 剩余调幅
const residentialFrequencyModulationList = ref<IList[]>([]) // 剩余调频
const harmonicList = ref<IList[]>([]) // 谐波
const phaseList = ref<IList[]>([]) // 调相相偏
const noHarmonicList = ref<IList[]>([]) // 非谐波
const frequencyCheckoutList = ref<IList[]>([]) // 频率
const powerCheckoutList = ref<IList[]>([]) // 功率
const amplitudeModulationDepthCheckoutList = ref<IList[]>([]) // 调幅深度
const frequencyModulationDeviationCheckoutList = ref<IList[]>([]) // 调频频偏
const residentialAmplitudeModulationCheckoutList = ref<IList[]>([]) // 剩余调幅
const residentialFrequencyModulationCheckoutList = ref<IList[]>([]) // 剩余调频
const harmonicCheckoutList = ref<IList[]>([]) // 谐波
const phaseCheckoutList = ref<IList[]>([]) // 调相相偏
const noHarmonicheckoutList = ref<IList[]>([]) // 谐波
// ----------------------------------------表头------------------------------------------------
const columns_frequency = ref<TableColumn[]>([ // 频率
{ text: '检定项目', value: 'params', align: 'center', required: true },
{ text: '标称值', value: 'nominalValue', align: 'center', required: true, width: '180' },
{ text: '标称值单位', value: 'unit', align: 'center', required: true, width: '100' },
{ text: '幅度', value: 'amplitude', align: 'center', required: true, width: '180' },
{ text: '幅度单位', value: 'amplitudeUnit', align: 'center', required: true, width: '100' },
{ text: 'U(k=2)', value: 'urel', align: 'center', required: false, width: '180' },
{ text: '技术指标', value: 'technicalIndex', align: 'center', required: false, width: '340' },
])
const columns_power = ref<TableColumn[]>([ // 功率
{ text: '检定项目', value: 'params', align: 'center', required: true },
{ text: '频率', value: 'frequency', align: 'center', required: true, width: '180' },
{ text: '频率单位', value: 'frequencyUnit', align: 'center', required: true, width: '100' },
{ text: '标称值', value: 'nominalValue', align: 'center', required: true, width: '180' },
{ text: '标称值单位', value: 'unit', align: 'center', required: true, width: '100' },
{ text: '技术指标', value: 'technicalIndex', align: 'center', required: false, width: '340' },
{ text: 'U(k=2)', value: 'urel', align: 'center', required: false, width: '180' },
])
const columns_amplitude_modulation_depth = ref<TableColumn[]>([ // 调幅深度\调频频偏\调相相偏
{ text: '检定项目', value: 'params', align: 'center', required: true },
{ text: '频率', value: 'frequency', align: 'center', required: true, width: '180' },
{ text: '频率单位', value: 'frequencyUnit', align: 'center', required: true, width: '100' },
{ text: '标称值', value: 'nominalValue', align: 'center', required: true, width: '180' },
{ text: '标称值单位', value: 'unit', align: 'center', required: true, width: '100' },
{ text: '幅度', value: 'amplitude', align: 'center', required: true, width: '180' },
{ text: '幅度单位', value: 'amplitudeUnit', align: 'center', required: true, width: '100' },
{ text: '高通滤波', value: 'highPassFilter', align: 'center', required: true, width: '180' },
{ text: '高通滤波单位', value: 'highPassFilterUnit', align: 'center', required: true, width: '100' },
{ text: '低通滤波', value: 'lowerPassFilter', align: 'center', required: true, width: '180' },
{ text: '低通滤波单位', value: 'lowerPassFilterUnit', align: 'center', required: true, width: '100' },
{ text: '调制速率', value: 'modulationRate', align: 'center', required: true, width: '180' },
{ text: '调制速率单位', value: 'modulationRateUnit', align: 'center', required: true, width: '100' },
{ text: '技术指标', value: 'technicalIndex', align: 'center', required: false, width: '340' },
{ text: 'U(k=2)', value: 'urel', align: 'center', required: false, width: '180' },
{ text: 'THD上限', value: 'upperIndex', align: 'center', required: false, width: '340' },
])
const columns_residential_amplitude_modulation = ref<TableColumn[]>([ // 剩余调幅\剩余调频
{ text: '检定项目', value: 'params', align: 'center', required: true },
{ text: '频率', value: 'frequency', align: 'center', required: true, width: '180' },
{ text: '频率单位', value: 'frequencyUnit', align: 'center', required: true, width: '100' },
{ text: '幅度', value: 'amplitude', align: 'center', required: true, width: '180' },
{ text: '幅度单位', value: 'amplitudeUnit', align: 'center', required: true, width: '100' },
{ text: '高通滤波', value: 'highPassFilter', align: 'center', required: true, width: '180' },
{ text: '高通滤波单位', value: 'highPassFilterUnit', align: 'center', required: true, width: '100' },
{ text: '低通滤波', value: 'lowerPassFilter', align: 'center', required: true, width: '180' },
{ text: '低通滤波单位', value: 'lowerPassFilterUnit', align: 'center', required: true, width: '100' },
{ text: '指标上限', value: 'upperIndex', align: 'center', required: false, width: '340' },
{ text: 'U(k=2)', value: 'urel', align: 'center', required: false, width: '180' },
])
const columns_harmonic = ref<TableColumn[]>([ // 谐波
{ text: '检定项目', value: 'params', align: 'center', required: true },
{ text: '频率', value: 'frequency', align: 'center', required: true, width: '180' },
{ text: '频率单位', value: 'frequencyUnit', align: 'center', required: true, width: '100' },
{ text: '幅度', value: 'amplitude', align: 'center', required: true, width: '180' },
{ text: '幅度单位', value: 'amplitudeUnit', align: 'center', required: true, width: '100' },
{ text: '谐波次数', value: 'harmonicNumber', align: 'center', required: true, width: '180' },
{ text: 'RBW', value: 'rbwValue', align: 'center', required: false, width: '180' },
{ text: 'RBW单位', value: 'rbwValueUnit', align: 'center', required: false, width: '100' },
{ text: 'VBW', value: 'vbwValue', align: 'center', required: false, width: '180' },
{ text: 'VBW单位', value: 'vbwValueUnit', align: 'center', required: false, width: '100' },
{ text: '指标上限', value: 'upperIndex', align: 'center', required: false, width: '340' },
{ text: 'U(k=2)', value: 'urel', align: 'center', required: false, width: '180' },
])
const columns_noHarmonic = ref<TableColumn[]>([ // 非谐波
{ text: '检定项目', value: 'params', align: 'center', required: true },
{ text: '频率', value: 'frequency', align: 'center', required: true, width: '180' },
{ text: '频率单位', value: 'frequencyUnit', align: 'center', required: true, width: '100' },
{ text: '功率', value: 'power', align: 'center', required: true, width: '180' },
{ text: '功率单位', value: 'powerUnit', align: 'center', required: true, width: '100' },
{ text: '偏移频率', value: 'offsetFrequency', align: 'center', required: true, width: '180' },
{ text: '偏移频率单位', value: 'offsetFrequencyUnit', align: 'center', required: true, width: '100' },
{ text: 'RBW', value: 'rbwValue', align: 'center', required: false, width: '180' },
{ text: 'RBW单位', value: 'rbwValueUnit', align: 'center', required: false, width: '100' },
{ text: 'VBW', value: 'vbwValue', align: 'center', required: false, width: '180' },
{ text: 'VBW单位', value: 'vbwValueUnit', align: 'center', required: false, width: '100' },
{ text: '指标上限', value: 'upperIndex', align: 'center', required: false, width: '340' },
{ text: 'U(k=2)', value: 'urel', align: 'center', required: false, width: '180' },
])
// --------------------------------表格操作---------------------------------------------------
// 多选
const handleSelectionChange = (e: any, type: string) => {
switch (type) {
case '频率':
frequencyCheckoutList.value = e
break
case '功率':
powerCheckoutList.value = e
break
case '调幅深度':
amplitudeModulationDepthCheckoutList.value = e
break
case '调频频偏':
frequencyModulationDeviationCheckoutList.value = e
break
case '剩余调幅':
residentialAmplitudeModulationCheckoutList.value = e
break
case '剩余调频':
residentialFrequencyModulationCheckoutList.value = e
break
case '谐波':
harmonicCheckoutList.value = e
break
case '调相相偏':
phaseCheckoutList.value = e
break
case '非谐波':
noHarmonicheckoutList.value = e
break
}
}
/**
* 增加行公共方法
* @param list 要操作的数组
* @param title 操作的表格
*/
const addRow = (list: IList[], title: string) => {
if (checkList(list, `${title}表格`)) {
if (list.length) { // 增加行时默认上一行数据
list.push({ ...list[list.length - 1], id: `custom-${new Date().getTime()}` })
}
else {
switch (title) {
case '频率':
list.push({
id: `custom-${new Date().getTime()}`, // id,更新/删除使用参数
dataType: '1', // 检定项数据类型(一个检定项中区分两个表格)(字典code)
itemId: props.itemId, // 检定项id
params: title, // 检定项目
nominalValue: undefined, // 标称值
unit: 'Hz', // 标称值单位
amplitude: undefined, // 幅度
amplitudeUnit: 'dBm', // 幅度单位
urel: undefined, // U(k=2)
technicalIndex: undefined, // 技术指标
technicalIndexSymbol: '±', // 技术指标前符号
technicalIndexUnit: 'Hz', // 技术指标单位
})
break
case '功率':
list.push({
id: `custom-${new Date().getTime()}`, // id,更新/删除使用参数
dataType: '2', // 检定项数据类型(一个检定项中区分两个表格)(字典code)
itemId: props.itemId, // 检定项id
params: title, // 检定项目
frequency: '', // 频率
frequencyUnit: 'Hz', // 频率单位
nominalValue: '', // 标称值
unit: 'dBm', // 标称值单位
urel: undefined, // U(k=2)
technicalIndex: undefined, // 技术指标
technicalIndexSymbol: '±', // 技术指标前符号
technicalIndexUnit: 'dB', // 技术指标单位
})
break
case '调幅深度':
list.push({
id: `custom-${new Date().getTime()}`, // id,更新/删除使用参数
dataType: '3', // 检定项数据类型(一个检定项中区分两个表格)(字典code)
itemId: props.itemId, // 检定项id
params: title, // 检定项目
frequency: '', // 频率
frequencyUnit: '', // 频率单位
nominalValue: '', // 标称值
unit: '%', // 标称值单位
amplitude: undefined, // 幅度
amplitudeUnit: 'dBm', // 幅度单位
highPassFilter: '50', // 高通滤波
highPassFilterUnit: 'Hz', // 高通滤波单位
lowerPassFilter: '3', // 低通滤波
lowerPassFilterUnit: 'kHz', // 低通滤波单位
modulationRate: undefined, // 调制速率
modulationRateUnit: 'Hz', // 调制速率单位
technicalIndex: undefined, // 技术指标
technicalIndexSymbol: '±', // 技术指标前符号
technicalIndexUnit: '%', // 技术指标单位
urel: undefined, // U(k=2)
upperIndex: undefined, // 指标上限/THD上限
upperIndexSymbol: '≤', // 指标上限符号/THD上限符号
upperIndexUnit: '%', // 指标上限单位/THD上限单位
})
break
case '调频频偏':
list.push({
id: `custom-${new Date().getTime()}`, // id,更新/删除使用参数
dataType: '4', // 检定项数据类型(一个检定项中区分两个表格)(字典code)
itemId: props.itemId, // 检定项id
params: title, // 检定项目
frequency: '', // 频率
frequencyUnit: '', // 频率单位
nominalValue: '', // 标称值
unit: 'Hz', // 标称值单位
amplitude: undefined, // 幅度
amplitudeUnit: 'dBm', // 幅度单位
highPassFilter: '50', // 高通滤波
highPassFilterUnit: 'Hz', // 高通滤波单位
lowerPassFilter: '3', // 低通滤波
lowerPassFilterUnit: 'kHz', // 低通滤波单位
modulationRate: undefined, // 调制速率
modulationRateUnit: 'Hz', // 调制速率单位
technicalIndex: undefined, // 技术指标
technicalIndexSymbol: '±', // 技术指标前符号
technicalIndexUnit: 'Hz', // 技术指标单位
urel: undefined, // U(k=2)
upperIndex: undefined, // 指标上限/THD上限
upperIndexSymbol: '≤', // 指标上限符号/THD上限符号
upperIndexUnit: '%', // 指标上限单位/THD上限单位
})
break
case '剩余调幅':
list.push({
id: `custom-${new Date().getTime()}`, // id,更新/删除使用参数
dataType: '5', // 检定项数据类型(一个检定项中区分两个表格)(字典code)
itemId: props.itemId, // 检定项id
params: title, // 检定项目
frequency: '', // 频率
frequencyUnit: '', // 频率单位
amplitude: undefined, // 幅度
amplitudeUnit: 'dBm', // 幅度单位
highPassFilter: '50', // 高通滤波
highPassFilterUnit: 'Hz', // 高通滤波单位
lowerPassFilter: '3', // 低通滤波
lowerPassFilterUnit: 'kHz', // 低通滤波单位
urel: undefined, // U(k=2)
upperIndex: undefined, // 指标上限/THD上限
upperIndexSymbol: '≤', // 指标上限符号/THD上限符号
upperIndexUnit: '%', // 指标上限单位/THD上限单位
})
break
case '剩余调频':
list.push({
id: `custom-${new Date().getTime()}`, // id,更新/删除使用参数
dataType: '6', // 检定项数据类型(一个检定项中区分两个表格)(字典code)
itemId: props.itemId, // 检定项id
params: title, // 检定项目
frequency: '', // 频率
frequencyUnit: '', // 频率单位
amplitude: undefined, // 幅度
amplitudeUnit: 'dBm', // 幅度单位
highPassFilter: '50', // 高通滤波
highPassFilterUnit: 'Hz', // 高通滤波单位
lowerPassFilter: '3', // 低通滤波
lowerPassFilterUnit: 'kHz', // 低通滤波单位
urel: undefined, // U(k=2)
upperIndex: undefined, // 指标上限/THD上限
upperIndexSymbol: '≤', // 指标上限符号/THD上限符号
upperIndexUnit: 'Hz', // 指标上限单位/THD上限单位
})
break
case '谐波':
list.push({
id: `custom-${new Date().getTime()}`, // id,更新/删除使用参数
dataType: '7', // 检定项数据类型(一个检定项中区分两个表格)(字典code)
itemId: props.itemId, // 检定项id
params: title, // 检定项目
frequency: undefined, // 频率
frequencyUnit: '', // 频率单位
amplitude: undefined, // 幅度
amplitudeUnit: 'dBm', // 幅度单位
harmonicNumber: '', // 谐波次数
rbwValue: '1', // RBW
rbwValueUnit: 'kHz', // RBW单位
vbwValue: '1', // VBW
vbwValueUnit: 'kHz', // VBW单位
urel: undefined, // U(k=2)
upperIndex: undefined, // 指标上限/THD上限
upperIndexSymbol: '≤', // 指标上限符号/THD上限符号
upperIndexUnit: 'dBc', // 指标上限单位/THD上限单位
})
break
case '调相相偏':
list.push({
id: `custom-${new Date().getTime()}`, // id,更新/删除使用参数
dataType: '8', // 检定项数据类型(一个检定项中区分两个表格)(字典code)
itemId: props.itemId, // 检定项id
params: title, // 检定项目
frequency: '', // 频率
frequencyUnit: 'MHz', // 频率单位
nominalValue: undefined, // 标称值
unit: 'rad', // 标称值单位
amplitude: undefined, // 幅度
amplitudeUnit: 'dBm', // 幅度单位
highPassFilter: '50', // 高通滤波
highPassFilterUnit: 'Hz', // 高通滤波单位
lowerPassFilter: '3', // 低通滤波
lowerPassFilterUnit: 'kHz', // 低通滤波单位
modulationRate: undefined, // 调制速率
modulationRateUnit: 'Hz', // 调制速率单位
technicalIndex: undefined, // 技术指标
technicalIndexSymbol: '±', // 技术指标前符号
technicalIndexUnit: 'rad', // 技术指标单位
urel: undefined, // U(k=2)
upperIndex: undefined, // 指标上限/THD上限
upperIndexSymbol: '≤', // 指标上限符号/THD上限符号
upperIndexUnit: '%', // 指标上限单位/THD上限单位
})
break
case '非谐波':
list.push({
id: `custom-${new Date().getTime()}`, // id,更新/删除使用参数
dataType: '9', // 检定项数据类型(一个检定项中区分两个表格)(字典code)
itemId: props.itemId, // 检定项id
params: title, // 检定项目
frequency: undefined, // 频率
frequencyUnit: 'Hz', // 频率单位
power: undefined, // 功率
powerUnit: 'dBm', // 功率单位
offsetFrequency: undefined, // 偏移频率
offsetFrequencyUnit: 'Hz', // 偏移频率单位
rbwValue: '1', // RBW
rbwValueUnit: 'kHz', // RBW单位
vbwValue: '1', // VBW
vbwValueUnit: 'kHz', // VBW单位
urel: undefined, // U(k=2)
upperIndex: undefined, // 指标上限/THD上限
upperIndexSymbol: '≤', // 指标上限符号/THD上限符号
upperIndexUnit: 'dBc', // 指标上限单位/THD上限单位
})
break
}
}
}
}
/**
* 删除行公共方法
* @param checkoutList 选中的数组
* @param list 操作的数组
*/
const delRow = (checkoutList: IList[], list: IList[], title: string) => {
if (!checkoutList.length) {
ElMessage.warning('请选中要删除的行')
}
else {
let data = [] as any[]
data = differenceArray(list, checkoutList)
switch (title) {
case '频率':
frequencyList.value = data
break
case '功率':
powerList.value = data
break
case '调幅深度':
amplitudeModulationDepthList.value = data
break
case '调频频偏':
frequencyModulationDeviationList.value = data
break
case '剩余调幅':
residentialAmplitudeModulationList.value = data
break
case '剩余调频':
residentialFrequencyModulationList.value = data
break
case '谐波':
harmonicList.value = data
break
case '调相相偏':
phaseList.value = data
break
case '非谐波':
noHarmonicList.value = data
break
}
}
}
// ---------------------------------------------校验---------------------------------------------------
// 增加行校验表格
function checkList(list: any, getTitle: string) {
let title = ''
if (getTitle.slice(getTitle.length - 2) === '表格') {
title = getTitle.slice(0, getTitle.length - 2)
}
else {
title = getTitle
}
let columns
switch (title) {
case '频率':
columns = columns_frequency.value
break
case '功率':
columns = columns_power.value
break
case '调幅深度':
columns = columns_amplitude_modulation_depth.value
break
case '调频频偏':
columns = columns_amplitude_modulation_depth.value
break
case '剩余调幅':
columns = columns_residential_amplitude_modulation.value
break
case '剩余调频':
columns = columns_residential_amplitude_modulation.value
break
case '谐波':
columns = columns_harmonic.value
break
case '调相相偏':
columns = columns_amplitude_modulation_depth.value
break
case '非谐波':
columns = columns_noHarmonic.value
break
}
return useCheckList(list, columns, `${title}表格`)
}
// 保存之前校验
const checkListBeforeSave = () => {
// 验空
if (form.value.frequency && !frequencyList.value.length) { // 频率
ElMessage.warning('频率 不能为空')
return false
}
else if (form.value.power && !powerList.value.length) { // 功率
ElMessage.warning('功率 不能为空')
return false
}
else if (form.value.amplitudeModulationDepth && !amplitudeModulationDepthList.value.length) { // 调幅深度
ElMessage.warning('调幅深度 不能为空')
return false
}
else if (form.value.frequencyModulationDeviation && !frequencyModulationDeviationList.value.length) { // 调频频偏
ElMessage.warning('调频频偏 不能为空')
return false
}
else if (form.value.remainAmplitudeModulation && !residentialAmplitudeModulationList.value.length) { // 剩余调幅
ElMessage.warning('剩余调幅 不能为空')
return false
}
else if (form.value.remainFrequencyModulation && !residentialFrequencyModulationList.value.length) { // 剩余调频
ElMessage.warning('剩余调频 不能为空')
return false
}
else if (form.value.harmonic && !harmonicList.value.length) { // 谐波
ElMessage.warning('谐波 不能为空')
return false
}
else if (form.value.phaseModulationPhaseDeviation && !phaseList.value.length) { // 调相相偏
ElMessage.warning('调相相偏 不能为空')
return false
}
else if (form.value.noHarmonic && !noHarmonicList.value.length) { // 非谐波
ElMessage.warning('非谐波 不能为空')
return false
}
// 验数据
let frequencyResult = true // 频率
let powerResult = true // 功率
let amplitudeModulationDepthResult = true // 调幅深度
let frequencyModulationDeviationResult = true // 调频频偏
let residentialAmplitudeModulationResult = true // 剩余调幅
let residentialFrequencyModulationResult = true // 剩余调频
let harmonicResult = true // 谐波
let phaseResult = true // 调相相偏
let noHarmonicResult = true // 非谐波
if (form.value.frequency) {
frequencyResult = checkList(frequencyList.value, '频率')
}
if (form.value.power) {
powerResult = checkList(powerList.value, '功率')
}
if (form.value.amplitudeModulationDepth) {
amplitudeModulationDepthResult = checkList(amplitudeModulationDepthList.value, '调幅深度')
}
if (form.value.frequencyModulationDeviation) {
frequencyModulationDeviationResult = checkList(frequencyModulationDeviationList.value, '调频频偏')
}
if (form.value.remainAmplitudeModulation) {
residentialAmplitudeModulationResult = checkList(residentialAmplitudeModulationList.value, '剩余调幅')
}
if (form.value.remainFrequencyModulation) {
residentialFrequencyModulationResult = checkList(residentialFrequencyModulationList.value, '剩余调频')
}
if (form.value.harmonic) {
harmonicResult = checkList(harmonicList.value, '谐波')
}
if (form.value.phaseModulationPhaseDeviation) {
phaseResult = checkList(phaseList.value, '调相相偏')
}
if (form.value.noHarmonic) {
noHarmonicResult = checkList(noHarmonicList.value, '非谐波')
}
if (frequencyResult
&& powerResult
&& amplitudeModulationDepthResult
&& frequencyModulationDeviationResult
&& residentialAmplitudeModulationResult
&& residentialFrequencyModulationResult
&& harmonicResult
&& phaseResult && noHarmonicResult
) {
return true
}
else {
return false
}
}
// 保存之前处理数据
const solveDataBeforeSave = () => {
// 数据处理
let tempList = [] as any
if (form.value.frequency) { // 频率
tempList = tempList.concat(frequencyList.value)
}
if (form.value.power) { // 功率
tempList = tempList.concat(powerList.value)
}
if (form.value.amplitudeModulationDepth) { // 调幅深度
tempList = tempList.concat(amplitudeModulationDepthList.value)
}
if (form.value.frequencyModulationDeviation) { // 调频频偏
tempList = tempList.concat(frequencyModulationDeviationList.value)
}
if (form.value.remainAmplitudeModulation) { // 剩余调幅
tempList = tempList.concat(residentialAmplitudeModulationList.value)
}
if (form.value.remainFrequencyModulation) { // 剩余调频
tempList = tempList.concat(residentialFrequencyModulationList.value)
}
if (form.value.harmonic) { // 谐波
tempList = tempList.concat(harmonicList.value)
}
if (form.value.phaseModulationPhaseDeviation) { // 调相相偏
tempList = tempList.concat(phaseList.value)
}
if (form.value.noHarmonic) { // 非谐波
tempList = tempList.concat(noHarmonicList.value)
}
tempList = tempList.map((item: { id: string }) => {
return {
...item,
id: '',
}
})
return tempList
}
// ------------------------------------------------------------------------------------------------
watch(() => props.list, (newVal) => { // 检定项表格
if (newVal && newVal.length) {
const data = newVal.map((item: IList) => {
return {
...item,
technicalIndex: item.technicalIndex === '' ? undefined : item.technicalIndex,
// technicalIndexSymbol: (item.technicalIndex === '' && props.pageType === 'detail') ? '' : item.technicalIndexSymbol, // 技术指标符号
// technicalIndexUnit: (item.technicalIndex === '' && props.pageType === 'detail') ? '' : item.technicalIndexUnit, // 技术指标单位
urel: item.urel === '' ? undefined : item.urel,
upperIndex: item.upperIndex === '' ? undefined : item.upperIndex,
// upperIndexSymbol: (item.upperIndex === '' && props.pageType === 'detail') ? '' : item.upperIndexSymbol, // 指标上限符号/THD上限符号
// upperIndexUnit: (item.upperIndex === '' && props.pageType === 'detail') ? '' : item.upperIndexUnit, // 指标上限单位/THD上限单位
}
})
frequencyList.value = data.filter((item: any) => `${item.dataType}` === '1').map((item: any) => { item.params = '频率'; return item })
powerList.value = data.filter((item: any) => `${item.dataType}` === '2').map((item: any) => { item.params = '功率'; return item })
amplitudeModulationDepthList.value = data.filter((item: any) => `${item.dataType}` === '3').map((item: any) => { item.params = '调幅深度'; return item })
frequencyModulationDeviationList.value = data.filter((item: any) => `${item.dataType}` === '4').map((item: any) => { item.params = '调频频偏'; return item })
residentialAmplitudeModulationList.value = data.filter((item: any) => `${item.dataType}` === '5').map((item: any) => { item.params = '剩余调幅'; return item })
residentialFrequencyModulationList.value = data.filter((item: any) => `${item.dataType}` === '6').map((item: any) => { item.params = '剩余调频'; return item })
harmonicList.value = data.filter((item: any) => `${item.dataType}` === '7').map((item: any) => { item.params = '谐波'; return item })
phaseList.value = data.filter((item: any) => `${item.dataType}` === '8').map((item: any) => { item.params = '调相相偏'; return item })
noHarmonicList.value = data.filter((item: any) => `${item.dataType}` === '9').map((item: any) => { item.params = '非谐波'; return item })
}
})
const $route = useRoute()
watch(() => props.form, (newValue) => {
const updataOld = $route.query.updataOld as string
const isFirstConfig = $route.query.isFirstConfig as string
if (newValue && Object.keys(newValue).length && updataOld !== 'true' && isFirstConfig !== 'true') {
form.value.appearanceFunctionCheck = `${newValue.appearanceFunctionCheck}` === '' ? 1 : newValue.appearanceFunctionCheck // 外观及功能性检查
form.value.frequency = `${newValue.frequency}` === '' ? 1 : newValue.frequency // 频率
form.value.power = `${newValue.power}` === '' ? 1 : newValue.power // 功率
form.value.amplitudeModulationDepth = `${newValue.amplitudeModulationDepth}` === '' ? 1 : newValue.amplitudeModulationDepth // 调幅深度
form.value.frequencyModulationDeviation = `${newValue.frequencyModulationDeviation}` === '' ? 1 : newValue.frequencyModulationDeviation // 调频频偏
form.value.remainAmplitudeModulation = `${newValue.remainAmplitudeModulation}` === '' ? 1 : newValue.remainAmplitudeModulation // 剩余调幅
form.value.remainFrequencyModulation = `${newValue.remainFrequencyModulation}` === '' ? 1 : newValue.remainFrequencyModulation // 剩余调频
form.value.harmonic = `${newValue.harmonic}` === '' ? 1 : newValue.harmonic // 谐波
form.value.phaseModulationPhaseDeviation = `${newValue.phaseModulationPhaseDeviation}` === '' ? 1 : newValue.phaseModulationPhaseDeviation // 调相相偏
form.value.noHarmonic = `${newValue.noHarmonic}` === '' ? 1 : newValue.noHarmonic // 非谐波
}
}, { deep: true, immediate: true })
defineExpose({ checkListBeforeSave, solveDataBeforeSave, form })
</script>
<template>
<div style="padding: 0 10px;">
<el-checkbox v-model="form.appearanceFunctionCheck" :true-label="1" :false-label="0" :disabled="pageType === 'detail'">
外观及功能性检查
</el-checkbox>
</div>
<!-- 频率 -->
<detail-block title="">
<div style="display: flex;justify-content: space-between;">
<el-checkbox v-model="form.frequency" :true-label="1" :false-label="0" :disabled="pageType === 'detail'">
频率
</el-checkbox>
<div v-if="pageType !== 'detail' && form.frequency" style="padding: 0 10px;padding-bottom: 10px;">
<el-button type="primary" @click="addRow(frequencyList, '频率')">
增加行
</el-button>
<el-button type="info" @click="delRow(frequencyCheckoutList, frequencyList, '频率')">
删除行
</el-button>
</div>
</div>
<template-table v-if="form.frequency" type="频率" :data="frequencyList" :columns="columns_frequency" :page-type="pageType" @selection-change="(e: any) => handleSelectionChange(e, '频率')" />
</detail-block>
<!-- 功率 -->
<detail-block title="">
<div style="display: flex;justify-content: space-between;">
<el-checkbox v-model="form.power" :true-label="1" :false-label="0" :disabled="pageType === 'detail'">
功率
</el-checkbox>
<div v-if="pageType !== 'detail' && form.power" style="padding: 0 10px;padding-bottom: 10px;">
<el-button type="primary" @click="addRow(powerList, '功率')">
增加行
</el-button>
<el-button type="info" @click="delRow(powerCheckoutList, powerList, '功率')">
删除行
</el-button>
</div>
</div>
<template-table v-if="form.power" type="功率" :data="powerList" :columns="columns_power" :page-type="pageType" @selection-change="(e: any) => handleSelectionChange(e, '功率')" />
</detail-block>
<!-- 调幅深度 -->
<detail-block title="">
<div style="display: flex;justify-content: space-between;">
<el-checkbox v-model="form.amplitudeModulationDepth" :true-label="1" :false-label="0" :disabled="pageType === 'detail'">
调幅深度
</el-checkbox>
<div v-if="pageType !== 'detail' && form.amplitudeModulationDepth" style="padding: 0 10px;padding-bottom: 10px;">
<el-button type="primary" @click="addRow(amplitudeModulationDepthList, '调幅深度')">
增加行
</el-button>
<el-button type="info" @click="delRow(amplitudeModulationDepthCheckoutList, amplitudeModulationDepthList, '调幅深度')">
删除行
</el-button>
</div>
</div>
<template-table v-if="form.amplitudeModulationDepth" type="调幅深度" :data="amplitudeModulationDepthList" :columns="columns_amplitude_modulation_depth" :page-type="pageType" @selection-change="(e: any) => handleSelectionChange(e, '调幅深度')" />
</detail-block>
<!-- 调频频偏 -->
<detail-block title="">
<div style="display: flex;justify-content: space-between;">
<el-checkbox v-model="form.frequencyModulationDeviation" :true-label="1" :false-label="0" :disabled="pageType === 'detail'">
调频频偏
</el-checkbox>
<div v-if="pageType !== 'detail' && form.frequencyModulationDeviation" style="padding: 0 10px;padding-bottom: 10px;">
<el-button type="primary" @click="addRow(frequencyModulationDeviationList, '调频频偏')">
增加行
</el-button>
<el-button type="info" @click="delRow(frequencyModulationDeviationCheckoutList, frequencyModulationDeviationList, '调频频偏')">
删除行
</el-button>
</div>
</div>
<template-table v-if="form.frequencyModulationDeviation" type="调频频偏" :data="frequencyModulationDeviationList" :columns="columns_amplitude_modulation_depth" :page-type="pageType" @selection-change="(e: any) => handleSelectionChange(e, '调频频偏')" />
</detail-block>
<!-- 剩余调幅 -->
<detail-block title="">
<div style="display: flex;justify-content: space-between;">
<el-checkbox v-model="form.remainAmplitudeModulation" :true-label="1" :false-label="0" :disabled="pageType === 'detail'">
剩余调幅
</el-checkbox>
<div v-if="pageType !== 'detail' && form.remainAmplitudeModulation" style="padding: 0 10px;padding-bottom: 10px;">
<el-button type="primary" @click="addRow(residentialAmplitudeModulationList, '剩余调幅')">
增加行
</el-button>
<el-button type="info" @click="delRow(residentialAmplitudeModulationCheckoutList, residentialAmplitudeModulationList, '剩余调幅')">
删除行
</el-button>
</div>
</div>
<template-table v-if="form.remainAmplitudeModulation" type="剩余调幅" :data="residentialAmplitudeModulationList" :columns="columns_residential_amplitude_modulation" :page-type="pageType" @selection-change="(e: any) => handleSelectionChange(e, '剩余调幅')" />
</detail-block>
<!-- 剩余调频 -->
<detail-block title="">
<div style="display: flex;justify-content: space-between;">
<el-checkbox v-model="form.remainFrequencyModulation" :true-label="1" :false-label="0" :disabled="pageType === 'detail'">
剩余调频
</el-checkbox>
<div v-if="pageType !== 'detail' && form.remainFrequencyModulation" style="padding: 0 10px;padding-bottom: 10px;">
<el-button type="primary" @click="addRow(residentialFrequencyModulationList, '剩余调频')">
增加行
</el-button>
<el-button type="info" @click="delRow(residentialFrequencyModulationCheckoutList, residentialFrequencyModulationList, '剩余调频')">
删除行
</el-button>
</div>
</div>
<template-table v-if="form.remainFrequencyModulation" type="剩余调频" :data="residentialFrequencyModulationList" :columns="columns_residential_amplitude_modulation" :page-type="pageType" @selection-change="(e: any) => handleSelectionChange(e, '剩余调频')" />
</detail-block>
<!-- 谐波 -->
<detail-block title="">
<div style="display: flex;justify-content: space-between;">
<el-checkbox v-model="form.harmonic" :true-label="1" :false-label="0" :disabled="pageType === 'detail'">
谐波
</el-checkbox>
<div v-if="pageType !== 'detail' && form.harmonic" style="padding: 0 10px;padding-bottom: 10px;">
<el-button type="primary" @click="addRow(harmonicList, '谐波')">
增加行
</el-button>
<el-button type="info" @click="delRow(harmonicCheckoutList, harmonicList, '谐波')">
删除行
</el-button>
</div>
</div>
<template-table v-if="form.harmonic" type="谐波" :data="harmonicList" :columns="columns_harmonic" :page-type="pageType" @selection-change="(e: any) => handleSelectionChange(e, '谐波')" />
</detail-block>
<!-- 调相相偏 -->
<detail-block title="">
<div style="display: flex;justify-content: space-between;">
<el-checkbox v-model="form.phaseModulationPhaseDeviation" :true-label="1" :false-label="0" :disabled="pageType === 'detail'">
调相相偏
</el-checkbox>
<div v-if="pageType !== 'detail' && form.phaseModulationPhaseDeviation" style="padding: 0 10px;padding-bottom: 10px;">
<el-button type="primary" @click="addRow(phaseList, '调相相偏')">
增加行
</el-button>
<el-button type="info" @click="delRow(phaseCheckoutList, phaseList, '调相相偏')">
删除行
</el-button>
</div>
</div>
<template-table v-if="form.phaseModulationPhaseDeviation" type="调相相偏" :data="phaseList" :columns="columns_amplitude_modulation_depth" :page-type="pageType" @selection-change="(e: any) => handleSelectionChange(e, '调相相偏')" />
</detail-block>
<!-- 非谐波 -->
<detail-block title="">
<div style="display: flex;justify-content: space-between;">
<el-checkbox v-model="form.noHarmonic" :true-label="1" :false-label="0" :disabled="pageType === 'detail'">
非谐波
</el-checkbox>
<div v-if="pageType !== 'detail' && form.noHarmonic" style="padding: 0 10px;padding-bottom: 10px;">
<el-button type="primary" @click="addRow(noHarmonicList, '非谐波')">
增加行
</el-button>
<el-button type="info" @click="delRow(noHarmonicheckoutList, noHarmonicList, '非谐波')">
删除行
</el-button>
</div>
</div>
<template-table v-if="form.noHarmonic" type="非谐波" :data="noHarmonicList" :columns="columns_noHarmonic" :page-type="pageType" @selection-change="(e: any) => handleSelectionChange(e, '非谐波')" />
</detail-block>
</template>