<!-- 第13套:示波器检定装置装置 -->
<script lang="ts" setup name="TemplateDetailNinth">
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 { deepCopy } from '@/utils/deepCopy'
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({
methodType: '方法一', // 时基的方法
appearanceFunctionCheck: 1, // 外观及功能性检查
timeBase: 1, // 时基(示波器-数字)
scanTimeCoefficient: 1, // 扫描时间系数及扩展(示波器-模拟)
bandWidth: 1, // 频带宽度(示波器-数字/模拟)
calibratingSignal: 1, // 校准信号(示波器-数字/模拟)
currentBias: 1, // 直流偏置(示波器-数字)
currentGain: 1, // 直流增益(示波器-数字)
inputResistance: 1, // 输入电阻(示波器-数字/模拟)
riseTime: 1, // 上升时间(示波器-数字/模拟)
triggerCharacter: 1, // 触发特性(示波器-模拟)
triggerSensitivity: 1, // 触发灵敏度(示波器-数字)
verticalAmplitude: 1, // 垂直幅度(示波器-模拟)
})
const tableLoading = ref(false)
const timeBaseList = ref<IList[]>([]) // 时基
const zeroFrequencyGainList = ref<IList[]>([]) // 直流增益
const DCBiasList = ref<IList[]>([]) // 直流偏置
const frequencyBandwidthList = ref<IList[]>([]) // 频带宽度(数字示波器)
const triggerSensitivityList = ref<IList[]>([]) // 触发灵敏度
const risetimeList = ref<IList[]>([]) // 上升时间(数字示波器)
const inputResistanceList = ref<IList[]>([]) // 输入电阻(数字示波器)
const calibratingSignalList = ref<IList[]>([]) // 校准信号(数字示波器)
const scanningTimeList = ref<IList[]>([]) // 扫描时间系数及扩展
const verticalSizeList = ref<IList[]>([]) // 垂直幅度
const frequencyBandwidthSimulateList = ref<IList[]>([]) // 频带宽度(模拟示波器)
const triggerCharacteristicList = ref<IList[]>([]) // 触发特性
const inputResistanceSimulateList = ref<IList[]>([]) // 输入电阻(模拟示波器)
const risetimeSimulateList = ref<IList[]>([]) // 上升时间(模拟示波器)
const calibratingSignalSimulateList = ref<IList[]>([]) // 校准信号(模拟示波器)
const timeBaseCheckoutList = ref<IList[]>([]) // 时基多选
const zeroFrequencyGainCheckoutList = ref<IList[]>([]) // 直流增益多选
const DCBiasCheckoutList = ref<IList[]>([]) // 直流偏置多选
const frequencyBandwidthCheckoutList = ref<IList[]>([]) // 频带宽度(数字示波器)多选
const triggerSensitivityCheckoutList = ref<IList[]>([]) // 触发灵敏度多选
const risetimeCheckoutList = ref<IList[]>([]) // 上升时间(数字示波器)多选
const inputResistanceCheckoutList = ref<IList[]>([]) // 输入电阻(数字示波器)多选
const calibratingSignalCheckoutList = ref<IList[]>([]) // 校准信号(数字示波器)多选
const scanningTimeCheckoutList = ref<IList[]>([]) // 扫描时间系数及扩展多选
const verticalSizeCheckoutList = ref<IList[]>([]) // 垂直幅度多选
const frequencyBandwidthSimulateCheckoutList = ref<IList[]>([]) // 频带宽度(模拟示波器)多选
const triggerCharacteristicCheckoutList = ref<IList[]>([]) // 触发特性多选
const inputResistanceSimulateCheckoutList = ref<IList[]>([]) // 输入电阻(模拟示波器)
const risetimeSimulateCheckoutList = ref<IList[]>([]) // 上升时间(模拟示波器)
const calibratingSignalSimulateCheckoutList = ref<IList[]>([]) // 校准信号(模拟示波器)
// ----------------------------------------表头------------------------------------------------
const columns_time_base_method1 = ref<TableColumn[]>([ // 时基 --方法一
{ text: '检定项目', value: 'params', align: 'center', required: true, width: 90 },
{ text: '周期时标信号', value: 'cycleSignal', align: 'center', required: true },
{ text: '周期时标信号单位', value: 'cycleSignalUnit', align: 'center', required: true },
{ text: '技术指标', value: 'technicalIndex', align: 'center', required: false, width: 300 },
])
const columns_time_base_method2 = ref<TableColumn[]>([ // 时基 --方法二
{ text: '检定项目', value: 'params', align: 'center', required: true, width: 90 },
{ text: '参考输出', value: 'cycleSignal', align: 'center', required: true },
{ text: '参考输出单位', value: 'cycleSignalUnit', align: 'center', required: true },
{ text: '技术指标', value: 'technicalIndex', align: 'center', required: false, width: 300 },
])
const columns_zero_frequency_gain = ref<TableColumn[]>([ // 直流增益
{ text: '检定项目', value: 'params', align: 'center', required: true, width: 90 },
{ text: '阻抗', value: 'impedance', align: 'center', required: true, width: 180 },
{ text: '阻抗单位', value: 'impedanceUnit', align: 'center', required: true, width: 90 },
{ text: '通道', value: 'thoroughfare', align: 'center', required: true, width: 100 },
{ text: '垂直偏转系数(/div)', value: 'verticalDeflectCoefficient', align: 'center', required: true, width: 180 },
{ text: '垂直偏转系数(/div)单位', value: 'verticalDeflectCoefficientUnit', align: 'center', required: true, width: 100 },
{ text: '标准值', value: 'standardValue', align: 'center', required: true, width: 180 },
{ text: '标准值单位', value: 'standardValueUnit', align: 'center', required: true, width: 100 },
{ text: '技术指标', value: 'technicalIndex', align: 'center', required: false, width: 340 },
])
const columns_frequency_bandwidth = ref<TableColumn[]>([ // 频带宽度
{ text: '检定项目', value: 'params', align: 'center', required: true, width: 90 },
{ text: '阻抗', value: 'impedance', align: 'center', required: true, width: 180 },
{ text: '阻抗单位', value: 'impedanceUnit', align: 'center', required: true, width: 90 },
{ text: '通道', value: 'thoroughfare', align: 'center', required: true, width: 100 },
{ text: '垂直偏转系数(/div)', value: 'verticalDeflectCoefficient', align: 'center', required: true, width: 180 },
{ text: '垂直偏转系数(/div)单位', value: 'verticalDeflectCoefficientUnit', align: 'center', required: true, width: 100 },
{ text: '水平偏转系数', value: 'horizontalDeflectCoefficient', align: 'center', required: true, width: 180 },
{ text: '水平偏转系数单位', value: 'horizontalDeflectCoefficientUnit', align: 'center', required: true, width: 100 },
{ text: '参考点频率', value: 'referencePointFrequency', align: 'center', required: true, width: 180 },
{ text: '参考点频率单位', value: 'referencePointFrequencyUnit', align: 'center', required: true, width: 100 },
{ text: '频带宽度', value: 'bandWidth', align: 'center', required: true, width: 180 },
{ text: '频带宽度单位', value: 'bandWidthUnit', align: 'center', required: true, width: 100 },
{ text: '技术指标', value: 'technicalIndex', align: 'center', required: false, width: 300 },
])
const columns_trigger_sensitivity = ref<TableColumn[]>([ // 触发灵敏度
{ text: '检定项目', value: 'params', align: 'center', required: true, width: 110 },
{ text: '通道', value: 'thoroughfare', align: 'center', required: true, width: 100 },
{ text: '触发类型', value: 'triggerType', align: 'center', required: true, width: 120 },
{ text: '信号频率', value: 'signalFrequency', align: 'center', required: true, width: 180 },
{ text: '信号频率单位', value: 'signalFrequencyUnit', align: 'center', required: true, width: 100 },
{ text: '垂直偏转系数(/div)', value: 'verticalDeflectCoefficient', align: 'center', required: true, width: 180 },
{ text: '垂直偏转系数(/div)单位', value: 'verticalDeflectCoefficientUnit', align: 'center', required: true, width: 100 },
{ text: '标称值', value: 'nominalValue', align: 'center', required: true, width: 180 },
{ text: '标称值单位', value: 'nominalValueUnit', align: 'center', required: true, width: 100 },
])
const columns_risetime = ref<TableColumn[]>([ // 上升时间(数字示波器)
{ text: '检定项目', value: 'params', align: 'center', required: true, width: 90 },
{ text: '阻抗', value: 'impedance', align: 'center', required: true, width: 180 },
{ text: '阻抗单位', value: 'impedanceUnit', align: 'center', required: true, width: 100 },
{ text: '通道', value: 'thoroughfare', align: 'center', required: true, width: 100 },
{ text: '垂直偏转系数(/div)', value: 'verticalDeflectCoefficient', align: 'center', required: true, width: 180 },
{ text: '垂直偏转系数(/div)单位', value: 'verticalDeflectCoefficientUnit', 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: 'horizontalDeflectCoefficient', align: 'center', required: true, width: 180 },
{ text: '水平偏转系数单位', value: 'horizontalDeflectCoefficientUnit', align: 'center', required: true, width: 100 },
{ text: '技术指标', value: 'technicalIndex', align: 'center', required: false, width: 340 },
])
const columns_input_resistance = ref<TableColumn[]>([ // 输入电阻(数字示波器)
{ text: '检定项目', value: 'params', align: 'center', required: true },
{ text: '通道', value: 'thoroughfare', align: 'center', required: true, width: 100 },
{ text: '标称值', value: 'nominalValue', align: 'center', required: true, width: 180 },
{ text: '标称值单位', value: 'nominalValueUnit', align: 'center', required: true, width: 100 },
{ text: '垂直偏转系数(/div)', value: 'verticalDeflectCoefficient', align: 'center', required: true, width: 180 },
{ text: '垂直偏转系数(/div)单位', value: 'verticalDeflectCoefficientUnit', align: 'center', required: true, width: 100 },
{ text: '技术指标', value: 'technicalIndex', align: 'center', required: false, width: 300 },
])
const columns_calibrating_signal = ref<TableColumn[]>([ // 校准信号(数字示波器)
{ text: '检定项目', value: 'params', align: 'center', required: true },
{ text: '项目', value: 'itemType', align: 'center', required: true, width: 100 },
{ text: '标称值', value: 'nominalValue', align: 'center', required: true, width: 180 },
{ text: '标称值单位', value: 'nominalValueUnit', align: 'center', required: true, width: 100 },
{ text: '低电平测量时垂直偏转档位', value: 'verticalDeflectionGear', align: 'center', required: true, width: 180 },
{ text: '低电平测量时垂直偏转档位单位', value: 'verticalDeflectionGearUnit', align: 'center', required: true, width: 100 },
])
const columns_scan_time = ref<TableColumn[]>([ // 扫描时间系数及扩展
{ text: '检定项目', value: 'params', align: 'center', required: true },
{ text: '扫描方式', value: 'scanType', align: 'center', required: true, width: '110' },
{ text: '阻抗', value: 'impedance', align: 'center', required: true, width: '180' },
{ text: '阻抗单位', value: 'impedanceUnit', align: 'center', required: true, width: '100' },
{ text: '垂直档位步进', value: 'verticalGearStep', align: 'center', required: true, width: '150' },
{ text: '水平刻度档位', value: 'horizontalScaleGear', align: 'center', required: true, width: '180' },
{ text: '水平刻度档位单位', value: 'horizontalScaleGearUnit', align: 'center', required: true, width: '100' },
{ text: '标称值', value: 'nominalValue', align: 'center', required: true, width: '180' },
{ text: '标称值单位', value: 'nominalValueUnit', align: 'center', required: true, width: '100' },
{ text: '技术指标', value: 'technicalIndex', align: 'center', required: false, width: '300' },
])
const columns_vertical_size = ref<TableColumn[]>([ // 垂直幅度
{ text: '检定项目', value: 'params', align: 'center', required: true },
{ text: '通道', value: 'thoroughfare', align: 'center', required: true, width: '100' },
{ text: '阻抗', value: 'impedance', align: 'center', required: true, width: '180' },
{ text: '阻抗单位', value: 'impedanceUnit', align: 'center', required: true, width: '100' },
{ text: '频率', value: 'frequency', align: 'center', required: true, width: '180' },
{ text: '频率单位', value: 'frequencyUnit', align: 'center', required: true, width: '100' },
{ text: '垂直档位步进', value: 'verticalGearStep', align: 'center', required: true, width: '150' },
{ text: '垂直刻度档位', value: 'verticalScaleGear', align: 'center', required: true, width: '180' },
{ text: '垂直刻度档位单位', value: 'verticalScaleGearUnit', align: 'center', required: true, width: '100' },
{ text: '标称值', value: 'nominalValue', align: 'center', required: true, width: '180' },
{ text: '标称值单位', value: 'nominalValueUnit', align: 'center', required: true, width: '100' },
{ text: '技术指标', value: 'technicalIndex', align: 'center', required: false, width: '300' },
])
const columns_frequency_bandwidth_simulate = ref<TableColumn[]>([ // 频带宽度(模拟示波器)
{ text: '检定项目', value: 'params', align: 'center', required: true },
{ text: '通道', value: 'thoroughfare', align: 'center', required: true, width: 100 },
{ text: '阻抗', value: 'impedance', align: 'center', required: true, width: 180 },
{ text: '阻抗单位', value: 'impedanceUnit', align: 'center', required: true, width: 100 },
{ text: '基准频率', value: 'referenceFrequency', align: 'center', required: true, width: 180 },
{ text: '基准频率单位', value: 'referenceFrequencyUnit', align: 'center', required: true, width: 100 },
{ text: '步进频率', value: 'stepFrequency', align: 'center', required: true, width: 180 },
{ text: '步进频率单位', value: 'stepFrequencyUnit', align: 'center', required: true, width: 100 },
{ text: '垂直档位步进', value: 'verticalGearStep', align: 'center', required: true, width: 150 },
{ text: '垂直刻度档位', value: 'verticalScaleGear', align: 'center', required: true, width: 180 },
{ text: '垂直刻度档位单位', value: 'verticalScaleGearUnit', align: 'center', required: true, width: 100 },
{ text: '技术指标', value: 'technicalIndex', align: 'center', required: false, width: 340 },
])
const columns_trigger_characteristic = ref<TableColumn[]>([ // 触发特性
{ text: '检定项目', value: 'params', align: 'center', required: true },
{ text: '扫描方式', value: 'scanType', align: 'center', required: true, width: 120 },
{ text: '通道', value: 'thoroughfare', align: 'center', required: true, width: 100 },
{ text: '阻抗', value: 'impedance', align: 'center', required: true, width: 180 },
{ text: '阻抗单位', value: 'impedanceUnit', align: 'center', required: true, width: 100 },
{ text: '触发类型', value: 'triggerType', align: 'center', required: true, width: 120 },
{ text: '频率', value: 'frequency', align: 'center', required: true, width: 180 },
{ text: '频率单位', value: 'frequencyUnit', align: 'center', required: true, width: 100 },
{ text: '频率上限', value: 'frequencyUpper', align: 'center', required: true, width: 180 },
{ text: '频率上限单位', value: 'frequencyUpperUnit', 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: 'referenceAmplitude', align: 'center', required: true, width: 180 },
{ text: '基准幅度单位', value: 'referenceAmplitudeUnit', align: 'center', required: true, width: 100 },
{ text: '技术指标', value: 'technicalIndex', align: 'center', required: false, width: 340 },
])
const columns_input_resistance_simulate = ref<TableColumn[]>([ // 输入电阻(模拟示波器)
{ text: '检定项目', value: 'params', align: 'center', required: true },
{ text: '通道', value: 'thoroughfare', align: 'center', required: true },
{ text: '阻抗', value: 'impedance', align: 'center', required: true },
{ text: '阻抗单位', value: 'impedanceUnit', align: 'center', required: true },
{ text: '技术指标', value: 'technicalIndex', align: 'center', required: false, width: 300 },
])
const columns_risetime_simulate = ref<TableColumn[]>([ // 上升时间(模拟示波器)
{ text: '检定项目', value: 'params', align: 'center', required: true },
{ text: '通道', value: 'thoroughfare', align: 'center', required: true, width: '120' },
{ text: '阻抗', value: 'impedance', align: 'center', required: true, width: '180' },
{ text: '阻抗单位', value: 'impedanceUnit', align: 'center', required: true, width: '100' },
{ text: '垂直刻度档位', value: 'verticalScaleGear', align: 'center', required: true, width: '180' },
{ text: '垂直刻度档位单位', value: 'verticalScaleGearUnit', 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: 'horizontalScaleGear', align: 'center', required: true, width: '180' },
{ text: '水平刻度档位单位', value: 'horizontalScaleGearUnit', align: 'center', required: true, width: '100' },
{ text: '技术指标', value: 'technicalIndex', align: 'center', required: false, width: '340' },
])
const columns_calibrating_signal_simulate = ref<TableColumn[]>([ // 校准信号(模拟示波器)
{ text: '检定项目', value: 'params', align: 'center', required: true },
{ text: '信号类型', value: 'signalType', align: 'center', required: true, width: '140' },
{ text: '阻抗', value: 'impedance', align: 'center', required: true, width: '180' },
{ text: '阻抗单位', value: 'impedanceUnit', align: 'center', required: true, width: '100' },
{ text: '幅度标称值', value: 'nominalAmplitudeValue', align: 'center', required: true, width: '180' },
{ text: '幅度标称值单位', value: 'nominalAmplitudeValueUnit', align: 'center', required: true, width: '100' },
{ text: '频率标称值', value: 'nominalFrequencyValue', align: 'center', required: true, width: '180' },
{ text: '频率标称值单位', value: 'nominalFrequencyValueUnit', align: 'center', required: true, width: '100' },
{ text: '技术指标', value: 'technicalIndex', align: 'center', required: false, width: '340' },
])
// --------------------------------表格操作---------------------------------------------------
// 多选
const handleSelectionChange = (e: any, type: string) => {
switch (type) {
case '时基':
timeBaseCheckoutList.value = e
break
case '直流增益':
zeroFrequencyGainCheckoutList.value = e
break
case '直流偏置':
DCBiasCheckoutList.value = e
break
case '频带宽度(数字示波器)':
frequencyBandwidthCheckoutList.value = e
break
case '触发灵敏度':
triggerSensitivityCheckoutList.value = e
break
case '上升时间(数字示波器)':
risetimeCheckoutList.value = e
break
case '输入电阻(数字示波器)':
inputResistanceCheckoutList.value = e
break
case '校准信号(数字示波器)':
calibratingSignalCheckoutList.value = e
break
case '扫描时间系数及扩展':
scanningTimeCheckoutList.value = e
break
case '垂直幅度':
verticalSizeCheckoutList.value = e
break
case '频带宽度(模拟示波器)':
frequencyBandwidthSimulateCheckoutList.value = e
break
case '触发特性':
triggerCharacteristicCheckoutList.value = e
break
case '输入电阻(模拟示波器)':
inputResistanceSimulateCheckoutList.value = e
break
case '上升时间(模拟示波器)':
risetimeSimulateCheckoutList.value = e
break
case '校准信号(模拟示波器)':
calibratingSignalSimulateCheckoutList.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] })
}
// 数字示波器
else if (props.itemCategoryName === '数字示波器') {
switch (title) {
case '时基':
list.push({
id: '', // id,更新/删除使用参数
dataType: '1', // 检定项数据类型(一个检定项中区分两个表格)(字典code)
itemId: props.itemId, // 检定项id
params: title, // 检定项目
cycleSignal: undefined, // 周期时标信号
cycleSignalUnit: '', // 周期时标信号单位
technicalIndex: undefined, // 技术指标
technicalIndexSymbol: '±', // 技术指标前符号
technicalIndexUnit: 'ppm', // 技术指标单位
})
break
case '直流增益':
list.push({
id: '', // id,更新/删除使用参数
dataType: '2', // 检定项数据类型(一个检定项中区分两个表格)(字典code)
itemId: props.itemId, // 检定项id
params: title, // 检定项目
impedance: '', // 阻抗
impedanceUnit: 'Ω', // 阻抗单位
thoroughfare: 'CH1', // 通道
verticalDeflectCoefficient: '', // 垂直偏转系数
verticalDeflectCoefficientUnit: 'V', // 垂直偏转系数单位
standardValue: undefined, // 标准值
standardValueUnit: 'V', // 标准值单位
technicalIndex: undefined, // 技术指标
technicalIndexSymbol: '±', // 技术指标前符号
technicalIndexUnit: '%', // 技术指标单位
})
break
case '直流偏置':
list.push({
id: '', // id,更新/删除使用参数
dataType: '3', // 检定项数据类型(一个检定项中区分两个表格)(字典code)
itemId: props.itemId, // 检定项id
params: title, // 检定项目
impedance: '', // 阻抗
impedanceUnit: 'Ω', // 阻抗单位
thoroughfare: 'CH1', // 通道
verticalDeflectCoefficient: '', // 垂直偏转系数
verticalDeflectCoefficientUnit: 'V', // 垂直偏转系数单位
standardValue: undefined, // 标准值
standardValueUnit: 'V', // 标准值单位
technicalIndex: undefined, // 技术指标
technicalIndexSymbol: '±', // 技术指标前符号
technicalIndexUnit: 'V', // 技术指标单位
})
break
case '频带宽度':
list.push({
id: '', // id,更新/删除使用参数
dataType: '4', // 检定项数据类型(一个检定项中区分两个表格)(字典code)
itemId: props.itemId, // 检定项id
params: title, // 检定项目
impedance: '', // 阻抗
impedanceUnit: 'Ω', // 阻抗单位
thoroughfare: 'CH1', // 通道
verticalDeflectCoefficient: '', // 垂直偏转系数
verticalDeflectCoefficientUnit: 'V', // 垂直偏转系数单位
horizontalDeflectCoefficient: undefined, // 水平偏转系数
horizontalDeflectCoefficientUnit: 'ns', // 水平偏转系数单位
referencePointFrequency: undefined, // 参考点频率
referencePointFrequencyUnit: 'Hz', // 参考点频率单位
bandWidth: undefined, // 频带宽度
bandWidthUnit: 'Hz', // 频带宽度单位
technicalIndex: undefined, // 技术指标
technicalIndexSymbol: '<', // 技术指标前符号
technicalIndexUnit: 'dB', // 技术指标单位
})
break
case '触发灵敏度':
list.push({
id: '', // id,更新/删除使用参数
dataType: '5', // 检定项数据类型(一个检定项中区分两个表格)(字典code)
itemId: props.itemId, // 检定项id
params: title, // 检定项目
thoroughfare: 'CH1', // 通道
triggerType: '内触发', // 触发类型
signalFrequency: undefined, // 信号频率
signalFrequencyUnit: 'MHz', // 信号频率单位
verticalDeflectCoefficient: '', // 垂直偏转系数
verticalDeflectCoefficientUnit: 'V', // 垂直偏转系数单位
nominalValue: undefined, // 标称值
nominalValueUnit: 'div', // 标称值单位
technicalIndex: '', // 技术指标
technicalIndexSymbol: '±', // 技术指标前符号
technicalIndexUnit: 'dB', // 技术指标单位
})
break
case '上升时间':
list.push({
id: '', // id,更新/删除使用参数
dataType: '6', // 检定项数据类型(一个检定项中区分两个表格)(字典code)
itemId: props.itemId, // 检定项id
params: title, // 检定项目
impedance: '', // 阻抗,
impedanceUnit: 'Ω', // 阻抗单位
thoroughfare: 'CH1', // 通道
verticalDeflectCoefficient: '', // 垂直偏转系数
verticalDeflectCoefficientUnit: 'V', // 垂直偏转系数单位
amplitude: undefined, // 幅度
amplitudeUnit: 'V', // 幅度单位
horizontalDeflectCoefficient: undefined, // 水平偏转系数
horizontalDeflectCoefficientUnit: 'ns', // 水平偏转系数单位
technicalIndex: undefined, // 技术指标
technicalIndexSymbol: '<', // 技术指标前符号
technicalIndexUnit: 'ns', // 技术指标单位
})
break
case '输入电阻':
list.push({
id: '', // id,更新/删除使用参数
dataType: '7', // 检定项数据类型(一个检定项中区分两个表格)(字典code)
itemId: props.itemId, // 检定项id
params: title, // 检定项目
thoroughfare: 'CH1', // 通道
verticalDeflectCoefficient: '', // 垂直偏转系数
verticalDeflectCoefficientUnit: 'V', // 垂直偏转系数单位
standardValue: '', // 标准值
nominalValueUnit: 'Ω', // 标称值单位
technicalIndex: undefined, // 技术指标
technicalIndexSymbol: '±', // 技术指标前符号
technicalIndexUnit: '%', // 技术指标单位
})
break
case '校准信号':
list.push({
id: '', // id,更新/删除使用参数
dataType: '8', // 检定项数据类型(一个检定项中区分两个表格)(字典code)
itemId: props.itemId, // 检定项id
params: title, // 检定项目
itemType: '幅度', // 项目
nominalValue: undefined, // 标称值
nominalValueUnit: 'V', // 垂直标称值单位偏转系数单位
verticalDeflectionGear: undefined, // 低电平测量时垂直偏转档位
verticalDeflectionGearUnit: 'V', // 低电平测量时垂直偏转档位单位
})
break
}
}
else if (props.itemCategoryName === '模拟示波器') {
switch (title) {
case '扫描时间系数及扩展':
list.push({
id: '', // id,更新/删除使用参数
dataType: '1', // 检定项数据类型(一个检定项中区分两个表格)(字典code)
itemId: props.itemId, // 检定项id
params: title, // 检定项目
scanType: 'A扫描', // 扫描方式
impedance: '50', // 阻抗
impedanceUnit: 'Ω', // 阻抗单位
verticalGearStep: '1-2-5', // 垂直档位步进
horizontalScaleGear: undefined, // 水平刻度档位
horizontalScaleGearUnit: 'ns', // 水平刻度档位单位
nominalValue: undefined, // 标称值
nominalValueUnit: 'ms', // 标称值单位
technicalIndexSymbol: '±', // 技术指标前符号
technicalIndexUnit: '%', // 技术指标单位
technicalIndex: undefined, // 技术指标
})
break
case '垂直幅度':
list.push({
id: '', // id,更新/删除使用参数
dataType: '2', // 检定项数据类型(一个检定项中区分两个表格)(字典code)
itemId: props.itemId, // 检定项id
params: title, // 检定项目
thoroughfare: 'CH1', // 通道
impedance: '75', // 阻抗
impedanceUnit: 'Ω', // 阻抗单位
frequency: '1', // 频率
frequencyUnit: 'kHz', // 频率单位
verticalGearStep: '1-2-5', // 垂直档位步进
verticalScaleGear: undefined, // 垂直刻度档位
verticalScaleGearUnit: 'mV', // 垂直刻度档位单位
nominalValue: undefined, // 标称值
nominalValueUnit: 'mV', // 标称值单位
technicalIndexSymbol: '±', // 技术指标前符号
technicalIndexUnit: '%', // 技术指标单位
technicalIndex: undefined, // 技术指标
})
break
case '频带宽度':
list.push({
id: '', // id,更新/删除使用参数
dataType: '3', // 检定项数据类型(一个检定项中区分两个表格)(字典code)
itemId: props.itemId, // 检定项id
params: title, // 检定项目
thoroughfare: 'CH1', // 通道
impedance: '50', // 阻抗
impedanceUnit: 'Ω', // 阻抗单位
referenceFrequency: undefined, // 基准频率
referenceFrequencyUnit: 'Hz', // 基准频率单位
stepFrequency: undefined, // 步进频率
stepFrequencyUnit: 'kHz', // 步进频率单位
verticalScaleGear: undefined, // 垂直刻度档位
verticalScaleGearUnit: 'mV', // 垂直刻度档位单位
verticalGearStep: '1-2-5', // 垂直档位步进
technicalIndexSymbol: '±', // 技术指标前符号
technicalIndexUnit: 'MHz', // 技术指标单位
technicalIndex: undefined, // 技术指标
})
break
case '触发特性':
list.push({
id: '', // id,更新/删除使用参数
dataType: '4', // 检定项数据类型(一个检定项中区分两个表格)(字典code)
itemId: props.itemId, // 检定项id
params: title, // 检定项目
scanType: 'A扫描', // 扫描类型
thoroughfare: 'CH1', // 通道
impedance: '50', // 阻抗
impedanceUnit: 'Ω', // 阻抗单位
triggerType: '内触发', // 触发类型
frequency: undefined, // 频率
frequencyUnit: 'Hz', // 频率单位
frequencyUpper: undefined, // 频率上限
frequencyUpperUnit: 'Hz', // 频率上限单位
amplitude: undefined, // 幅度
amplitudeUnit: 'mV', // 幅度单位
referenceAmplitude: '100', // 基准幅度
referenceAmplitudeUnit: 'mV', // 基准幅度单位
technicalIndexSymbol: '≤', // 技术指标前符号
technicalIndexUnit: 'mV', // 技术指标单位
technicalIndex: undefined, // 技术指标
})
break
case '输入电阻':
list.push({
id: '', // id,更新/删除使用参数
dataType: '5', // 检定项数据类型(一个检定项中区分两个表格)(字典code)
itemId: props.itemId, // 检定项id
params: title, // 检定项目
thoroughfare: 'CH1', // 通道
impedance: '50', // 阻抗
impedanceUnit: 'Ω', // 阻抗单位
technicalIndexSymbol: '±', // 技术指标前符号
technicalIndexUnit: '%', // 技术指标单位
technicalIndex: undefined, // 技术指标
})
break
case '上升时间':
list.push({
id: '', // id,更新/删除使用参数
dataType: '6', // 检定项数据类型(一个检定项中区分两个表格)(字典code)
itemId: props.itemId, // 检定项id
params: title, // 检定项目
thoroughfare: 'CH1', // 通道
impedance: '50', // 阻抗
impedanceUnit: 'Ω', // 阻抗单位
verticalScaleGear: undefined, // 垂直刻度档位
verticalScaleGearUnit: 'mV', // 垂直刻度档位单位
amplitude: undefined, // 幅度
amplitudeUnit: 'mV', // 幅度单位
horizontalScaleGear: undefined, // 水平刻度档位
horizontalScaleGearUnit: 'ns', // 水平刻度档位单位
technicalIndexSymbol: '<', // 技术指标前符号
technicalIndexUnit: 'ns', // 技术指标单位
technicalIndex: undefined, // 技术指标
})
break
case '校准信号':
list.push({
id: '', // id,更新/删除使用参数
dataType: '7', // 检定项数据类型(一个检定项中区分两个表格)(字典code)
itemId: props.itemId, // 检定项id
params: title, // 检定项目
signalType: '校准信号1', // 信号类型
impedance: '50', // 阻抗
impedanceUnit: 'Ω', // 阻抗单位
nominalAmplitudeValue: undefined, // 幅度标称值
nominalAmplitudeValueUnit: 'mV', // 幅度标称值单位
nominalFrequencyValue: undefined, // 频率标称值
nominalFrequencyValueUnit: 'kHz', // 频率标称值单位
technicalIndexSymbol: '±', // 技术指标前符号
technicalIndexUnit: '%', // 技术指标单位
technicalIndex: undefined, // 技术指标
})
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)
if (props.itemCategoryName === '数字示波器') {
switch (title) {
case '时基':
timeBaseList.value = data
break
case '直流增益':
zeroFrequencyGainList.value = data
break
case '直流偏置':
DCBiasList.value = data
break
case '频带宽度':
frequencyBandwidthList.value = data
break
case '触发灵敏度':
triggerSensitivityList.value = data
break
case '上升时间':
risetimeList.value = data
break
case '输入电阻':
inputResistanceList.value = data
break
case '校准信号':
calibratingSignalList.value = data
break
}
}
else if (props.itemCategoryName === '模拟示波器') {
switch (title) {
case '扫描时间系数及扩展':
scanningTimeList.value = data
break
case '垂直幅度':
verticalSizeList.value = data
break
case '频带宽度':
frequencyBandwidthSimulateList.value = data
break
case '触发特性':
triggerCharacteristicList.value = data
break
case '输入电阻':
inputResistanceSimulateList.value = data
break
case '上升时间':
risetimeSimulateList.value = data
break
case '校准信号':
calibratingSignalSimulateList.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
if (props.itemCategoryName === '数字示波器') {
switch (title) {
case '时基':
columns = form.value.methodType === '方法一' ? columns_time_base_method1.value : columns_time_base_method2.value
break
case '直流增益':
columns = columns_zero_frequency_gain.value
break
case '直流偏置':
columns = columns_zero_frequency_gain.value
break
case '频带宽度':
columns = columns_frequency_bandwidth.value
break
case '触发灵敏度':
columns = columns_trigger_sensitivity.value
break
case '上升时间':
columns = columns_risetime.value
break
case '输入电阻':
columns = columns_input_resistance.value
break
case '校准信号':
columns = columns_calibrating_signal.value
break
}
}
else if (props.itemCategoryName === '模拟示波器') {
switch (title) {
case '扫描时间系数及扩展':
columns = columns_scan_time.value
break
case '垂直幅度':
columns = columns_vertical_size.value
break
case '频带宽度':
columns = columns_frequency_bandwidth_simulate.value
break
case '触发特性':
columns = columns_trigger_characteristic.value
break
case '输入电阻':
columns = columns_input_resistance_simulate.value
break
case '上升时间':
columns = columns_risetime_simulate.value
break
case '校准信号':
columns = columns_calibrating_signal_simulate.value
break
}
}
return useCheckList(list, columns, `${title}表格`)
}
// 保存之前校验
const checkListBeforeSave = () => {
// 验空
if (props.itemCategoryName === '数字示波器' && form.value.timeBase && !timeBaseList.value.length) { // 时基(示波器-数字)
ElMessage.warning('时基 不能为空')
return false
}
if (props.itemCategoryName === '数字示波器' && form.value.currentGain && !zeroFrequencyGainList.value.length) { // 直流增益(示波器-数字)
ElMessage.warning('直流增益 不能为空')
return false
}
if (props.itemCategoryName === '数字示波器' && form.value.currentBias && !DCBiasList.value.length) { // 直流偏置(示波器-数字)
ElMessage.warning('直流偏置 不能为空')
return false
}
if (props.itemCategoryName === '模拟示波器' && form.value.scanTimeCoefficient && !scanningTimeList.value.length) { // 扫描时间系数及扩展(示波器-模拟)
ElMessage.warning('扫描时间系数及扩展 不能为空')
return false
}
if (props.itemCategoryName === '模拟示波器' && form.value.verticalAmplitude && !verticalSizeList.value.length) { // 垂直幅度
ElMessage.warning('垂直幅度 不能为空')
return false
}
if (form.value.bandWidth) { // 频带宽度(示波器-数字/模拟)
if ((props.itemCategoryName === '数字示波器' && !frequencyBandwidthList.value.length) || (props.itemCategoryName === '模拟示波器' && !frequencyBandwidthSimulateList.value.length)) {
ElMessage.warning('频带宽度 不能为空')
return false
}
}
if (props.itemCategoryName === '模拟示波器' && form.value.triggerCharacter && !triggerCharacteristicList.value.length) { // 触发特性
ElMessage.warning('触发特性 不能为空')
return false
}
if (props.itemCategoryName === '数字示波器' && form.value.triggerSensitivity && !triggerSensitivityList.value.length) { // 触发灵敏度
ElMessage.warning('触发灵敏度 不能为空')
return false
}
if (form.value.riseTime) { // 上升时间(数字示波器)
if ((props.itemCategoryName === '数字示波器' && !risetimeList.value.length) || (props.itemCategoryName === '模拟示波器' && !risetimeSimulateList.value.length)) {
ElMessage.warning('上升时间 不能为空')
return false
}
}
if (form.value.inputResistance) { // 输入电阻(数字示波器)
if ((props.itemCategoryName === '数字示波器' && !inputResistanceList.value.length) || (props.itemCategoryName === '模拟示波器' && !inputResistanceSimulateList.value.length)) {
ElMessage.warning('输入电阻 不能为空')
return false
}
}
if (form.value.calibratingSignal) { // 校准信号(示波器-数字/模拟)
if ((props.itemCategoryName === '数字示波器' && !calibratingSignalList.value.length) || (props.itemCategoryName === '模拟示波器' && !calibratingSignalSimulateList.value.length)) {
ElMessage.warning('校准信号 不能为空')
return false
}
}
// 验数据
let timeBaseResult = true // 时基
let currentGainResult = true // 直流增益
let currentBiasResult = true // 直流偏置
let bandWidthResult = true // 频带宽度(示波器-数字/模拟)
let triggerSensitivityResult = true // 触发灵敏度(示波器-数字)
let riseTimeResult = true // 上升时间(示波器-数字/模拟)
let inputResistanceResult = true // 输入电阻(示波器-数字/模拟)
let calibratingSignalResult = true // 校准信号(示波器-数字/模拟)
let scanTimeCoefficientResult = true // 扫描时间系数及扩展(示波器-模拟)
let triggerCharacterResult = true // 触发特性(示波器-模拟)
let verticalAmplitudeResult = true // 垂直幅度(示波器-模拟)
if (props.itemCategoryName === '数字示波器') {
if (form.value.timeBase) {
timeBaseResult = checkList(timeBaseList.value, '时基')
}
if (form.value.currentGain) {
currentGainResult = checkList(zeroFrequencyGainList.value, '直流增益')
}
if (form.value.currentBias) {
currentBiasResult = checkList(DCBiasList.value, '直流偏置')
}
if (form.value.bandWidth) {
bandWidthResult = checkList(frequencyBandwidthList.value, '频带宽度')
}
if (form.value.triggerSensitivity) {
triggerSensitivityResult = checkList(triggerSensitivityList.value, '触发灵敏度')
}
if (form.value.riseTime) {
riseTimeResult = checkList(risetimeList.value, '上升时间')
}
if (form.value.inputResistance) {
inputResistanceResult = checkList(inputResistanceList.value, '输入电阻')
}
if (form.value.calibratingSignal) {
calibratingSignalResult = checkList(calibratingSignalList.value, '校准信号')
}
if (timeBaseResult && currentGainResult && currentBiasResult && bandWidthResult && triggerSensitivityResult && riseTimeResult && inputResistanceResult && calibratingSignalResult) {
return true
}
else {
return false
}
}
if (props.itemCategoryName === '模拟示波器') {
if (form.value.scanTimeCoefficient) {
scanTimeCoefficientResult = checkList(scanningTimeList.value, '扫描时间系数及扩展')
}
if (form.value.verticalAmplitude) {
verticalAmplitudeResult = checkList(verticalSizeList.value, '垂直幅度')
}
if (form.value.bandWidth) {
bandWidthResult = checkList(frequencyBandwidthSimulateList.value, '频带宽度')
}
if (form.value.triggerCharacter) {
triggerCharacterResult = checkList(triggerCharacteristicList.value, '触发特性')
}
if (form.value.inputResistance) {
inputResistanceResult = checkList(inputResistanceSimulateList.value, '输入电阻')
}
if (form.value.riseTime) {
riseTimeResult = checkList(risetimeSimulateList.value, '上升时间')
}
if (form.value.calibratingSignal) {
calibratingSignalResult = checkList(calibratingSignalSimulateList.value, '校准信号')
}
if (scanTimeCoefficientResult && verticalAmplitudeResult && bandWidthResult && triggerCharacterResult && inputResistanceResult && riseTimeResult && calibratingSignalResult
) {
return true
}
else {
return false
}
}
}
// 保存之前处理数据
const solveDataBeforeSave = () => {
// 数据处理
let tempList = [] as any
timeBaseList.value = timeBaseList.value.map((item) => {
return {
...item,
methodType: form.value.methodType, // 方法
}
})
if (form.value.timeBase) { // 时基(示波器-数字)
tempList = tempList.concat(timeBaseList.value)
}
if (form.value.scanTimeCoefficient) { // 扫描时间系数及扩展(示波器-模拟)
tempList = tempList.concat(scanningTimeList.value)
}
if (form.value.bandWidth) { // 频带宽度(示波器-数字/模拟)
if (props.itemCategoryName === '数字示波器') {
tempList = tempList.concat(frequencyBandwidthList.value)
}
if (props.itemCategoryName === '模拟示波器') {
tempList = tempList.concat(frequencyBandwidthSimulateList.value)
}
}
if (form.value.calibratingSignal) { // 校准信号(示波器-数字/模拟)
if (props.itemCategoryName === '数字示波器') {
tempList = tempList.concat(calibratingSignalList.value)
}
if (props.itemCategoryName === '模拟示波器') {
tempList = tempList.concat(calibratingSignalSimulateList.value)
}
}
if (form.value.currentBias) { // 直流偏置(示波器-数字)
tempList = tempList.concat(DCBiasList.value)
}
if (form.value.currentGain) { // 直流增益(示波器-数字)
tempList = tempList.concat(zeroFrequencyGainList.value)
}
if (form.value.triggerSensitivity) { // 触发灵敏度
tempList = tempList.concat(triggerSensitivityList.value)
}
if (form.value.riseTime) { // 上升时间(数字示波器)
if (props.itemCategoryName === '数字示波器') {
tempList = tempList.concat(risetimeList.value)
}
if (props.itemCategoryName === '模拟示波器') {
tempList = tempList.concat(risetimeSimulateList.value)
}
}
if (form.value.inputResistance) { // 输入电阻(数字示波器)
if (props.itemCategoryName === '数字示波器') {
tempList = tempList.concat(inputResistanceList.value)
}
if (props.itemCategoryName === '模拟示波器') {
tempList = tempList.concat(inputResistanceSimulateList.value)
}
}
if (form.value.verticalAmplitude) { // 垂直幅度
tempList = tempList.concat(verticalSizeList.value)
}
if (form.value.triggerCharacter) { // 触发特性
tempList = tempList.concat(triggerCharacteristicList.value)
}
tempList = tempList.map((item: { id: string }) => {
return {
...item,
id: '',
}
})
return tempList
}
// -----------------------------------------------------------------------------------------------------
// 校准信号项目变化
const changeItemType = (value: string, index: number) => {
if (value === '频率') {
calibratingSignalList.value[index].nominalValueUnit = '' // 标称值单位
calibratingSignalList.value[index].verticalDeflectionGear = '/'
calibratingSignalList.value[index].verticalDeflectionGearUnit = '/'
}
else { // 幅度
calibratingSignalList.value[index].nominalValueUnit = '' // 标称值单位
calibratingSignalList.value[index].verticalDeflectionGear = ''
calibratingSignalList.value[index].verticalDeflectionGearUnit = 'V'
}
}
// 垂直偏转系数变化
const changeVerticalDeflectCoefficient = (param: { value: string }, type: string, index: number) => {
let num: any
if (Object.prototype.toString.call(param) === '[object Object]') { // 对象
num = param.value
}
else {
num = param
}
console.log('垂直偏转系数变化值:', num, Number(calc(Number(num), 6, '*')))
if (type === '直流增益(数字示波器)') {
zeroFrequencyGainList.value = zeroFrequencyGainList.value.map((item, indexIn) => {
if (indexIn === index) {
return {
...item,
standardValue: Number(calc(Number(num), 6, '*')), // 标准值默认为垂直偏转系数*6
}
}
else {
return item
}
}) as any
}
else if (type === '上升时间(数字示波器)') {
risetimeList.value = risetimeList.value.map((item, indexIn) => {
if (indexIn === index) {
return {
...item,
amplitude: Number(calc(Number(num), 5, '*')), // 幅度默认为垂直偏转系数*5
}
}
else {
return item
}
}) as any
}
}
// el-input-number值变化
const changeInputNumber = (value: number, type: string) => {
switch (type) {
case '扫描时间系数及扩展':
scanningTimeList.value = scanningTimeList.value.map((item) => {
return {
...item,
nominalValue: Number(item.horizontalScaleGear), // 标称值默认与水平刻度档位相同
}
}) as any
break
case '垂直幅度':
verticalSizeList.value = verticalSizeList.value.map((item) => {
return {
...item,
nominalValue: calc(Number(item.verticalScaleGear), 6, '*'), // 标称值默认与水平刻度档位*6
}
}) as any
break
case '上升时间(模拟示波器)':
risetimeSimulateList.value = risetimeSimulateList.value.map((item) => {
return {
...item,
amplitude: calc(Number(item.verticalScaleGear), 5, '*'), // 幅度默认与垂直刻度档位*5
}
}) as any
break
}
}
// -----------------------------------------------------------------------------------------------------
watch(() => props.list, (newVal) => { // 检定项表格
if (newVal && newVal.length) {
if (props.itemCategoryName === '数字示波器') {
timeBaseList.value = newVal.filter((item: any) => `${item.dataType}` === '1').map((item: any) => { item.params = '时基'; item.technicalIndex = item.technicalIndex === '' ? undefined : item.technicalIndex; return item }) // 时基
zeroFrequencyGainList.value = newVal.filter((item: any) => `${item.dataType}` === '2').map((item: any) => { item.params = '直流增益'; item.technicalIndex = item.technicalIndex === '' ? undefined : item.technicalIndex; return item }) // 直流增益
DCBiasList.value = newVal.filter((item: any) => `${item.dataType}` === '3').map((item: any) => { item.params = '直流偏置'; item.technicalIndex = item.technicalIndex === '' ? undefined : item.technicalIndex; return item }) // 直流偏置
frequencyBandwidthList.value = newVal.filter((item: any) => `${item.dataType}` === '4').map((item: any) => { item.params = '频带宽度'; item.technicalIndex = item.technicalIndex === '' ? undefined : item.technicalIndex; return item }) // 频带宽度(数字示波器)
triggerSensitivityList.value = newVal.filter((item: any) => `${item.dataType}` === '5').map((item: any) => { item.params = '触发灵敏度'; item.technicalIndex = item.technicalIndex === '' ? undefined : item.technicalIndex; return item })// 触发灵敏度
risetimeList.value = newVal.filter((item: any) => `${item.dataType}` === '6').map((item: any) => { item.params = '上升时间'; item.technicalIndex = item.technicalIndex === '' ? undefined : item.technicalIndex; return item })// 上升时间(数字示波器)
inputResistanceList.value = newVal.filter((item: any) => `${item.dataType}` === '7').map((item: any) => { item.params = '输入电阻'; item.technicalIndex = item.technicalIndex === '' ? undefined : item.technicalIndex; return item })// 输入电阻(数字示波器)
calibratingSignalList.value = newVal.filter((item: any) => `${item.dataType}` === '8').map((item: any) => { item.params = '校准信号'; item.technicalIndex = item.technicalIndex === '' ? undefined : item.technicalIndex; return item })// 校准信号(数字示波器)
if (timeBaseList.value.length) {
form.value.methodType = timeBaseList.value[0].methodType! // 时基方法
}
}
else if (props.itemCategoryName === '模拟示波器') {
scanningTimeList.value = newVal.filter((item: any) => `${item.dataType}` === '1').map((item: any) => { item.params = '扫描时间系数及扩展'; item.technicalIndex = item.technicalIndex === '' ? undefined : item.technicalIndex; return item }) // 扫描时间系数及扩展
verticalSizeList.value = newVal.filter((item: any) => `${item.dataType}` === '2').map((item: any) => { item.params = '垂直幅度'; item.technicalIndex = item.technicalIndex === '' ? undefined : item.technicalIndex; return item }) // 垂直幅度
frequencyBandwidthSimulateList.value = newVal.filter((item: any) => `${item.dataType}` === '3').map((item: any) => { item.params = '频带宽度'; item.technicalIndex = item.technicalIndex === '' ? undefined : item.technicalIndex; return item }) // 频带宽度(模拟示波器
triggerCharacteristicList.value = newVal.filter((item: any) => `${item.dataType}` === '4').map((item: any) => { item.params = '触发特性'; item.technicalIndex = item.technicalIndex === '' ? undefined : item.technicalIndex; return item }) // 触发特性
inputResistanceSimulateList.value = newVal.filter((item: any) => `${item.dataType}` === '5').map((item: any) => { item.params = '输入电阻'; item.technicalIndex = item.technicalIndex === '' ? undefined : item.technicalIndex; return item })// 输入电阻
risetimeSimulateList.value = newVal.filter((item: any) => `${item.dataType}` === '6').map((item: any) => { item.params = '上升时间'; item.technicalIndex = item.technicalIndex === '' ? undefined : item.technicalIndex; return item })// 上升时间(数字示波器)
calibratingSignalSimulateList.value = newVal.filter((item: any) => `${item.dataType}` === '7').map((item: any) => { item.params = '校准信号'; item.technicalIndex = item.technicalIndex === '' ? undefined : item.technicalIndex; return item })// 校准信号(数字示波器)
}
}
})
const $route = useRoute()
watch(() => props.form, (newValue) => {
const updataOld = $route.query.updataOld as string
const isFirstConfig = $route.query.isFirstConfig as string
console.log('updataOld', updataOld)
console.log('isFirstConfig', isFirstConfig)
if (newValue && Object.keys(newValue).length && updataOld !== 'true' && isFirstConfig !== 'true') {
form.value.appearanceFunctionCheck = newValue.appearanceFunctionCheck // 外观及功能性检查
form.value.timeBase = newValue.timeBase // 时基(示波器-数字)
form.value.scanTimeCoefficient = newValue.scanTimeCoefficient // 扫描时间系数及扩展(示波器-模拟)
form.value.bandWidth = newValue.bandWidth // 频带宽度(示波器-数字/模拟)
form.value.calibratingSignal = newValue.calibratingSignal // 校准信号(示波器-数字/模拟)
form.value.currentBias = newValue.currentBias // 直流偏置(示波器-数字)
form.value.currentGain = newValue.currentGain // 直流增益(示波器-数字)
form.value.inputResistance = newValue.inputResistance // 输入电阻(示波器-数字/模拟)
form.value.riseTime = newValue.riseTime // 上升时间(示波器-数字/模拟)
form.value.triggerCharacter = newValue.triggerCharacter // 触发特性(示波器-模拟)
form.value.triggerSensitivity = newValue.triggerSensitivity // 触发灵敏度(示波器-数字)
form.value.verticalAmplitude = newValue.verticalAmplitude // 垂直幅度(示波器-模拟)
}
}, { 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 v-if="props.itemCategoryName === '数字示波器'" title="">
<div style="display: flex;justify-content: space-between;">
<el-checkbox v-model="form.timeBase" :true-label="1" :false-label="0" :disabled="pageType === 'detail'">
时基
</el-checkbox>
<div v-if="pageType !== 'detail' && form.timeBase" style="display: flex; padding: 0 10px;padding-bottom: 10px;">
<el-select
v-model="form.methodType"
placeholder="请选择方法"
:disabled="pageType === 'detail'"
class="short-input"
style="margin-right: 10px;"
>
<el-option v-for="item of ['方法一', '方法二']" :key="item" :label="item" :value="item" />
</el-select>
<el-button type="primary" @click="addRow(timeBaseList, '时基')">
增加行
</el-button>
<el-button type="info" @click="delRow(timeBaseCheckoutList, timeBaseList, '时基')">
删除行
</el-button>
</div>
</div>
<template-table v-if="form.timeBase" type="时基" :data="timeBaseList" :columns="form.methodType === '方法一' ? columns_time_base_method1 : columns_time_base_method2" :page-type="pageType" @selection-change="(e: any) => handleSelectionChange(e, '时基')" />
</detail-block>
<!-- 直流增益 -->
<detail-block v-if="props.itemCategoryName === '数字示波器'" title="">
<div style="display: flex;justify-content: space-between;">
<el-checkbox v-model="form.currentGain" :true-label="1" :false-label="0" :disabled="pageType === 'detail'">
直流增益
</el-checkbox>
<div v-if="pageType !== 'detail' && form.currentGain" style="padding: 0 10px;padding-bottom: 10px;">
<el-button type="primary" @click="addRow(zeroFrequencyGainList, '直流增益')">
增加行
</el-button>
<el-button type="info" @click="delRow(zeroFrequencyGainCheckoutList, zeroFrequencyGainList, '直流增益')">
删除行
</el-button>
</div>
</div>
<template-table v-if="form.currentGain" type="直流增益" :data="zeroFrequencyGainList" :columns="columns_zero_frequency_gain" :page-type="pageType" @selection-change="(e: any) => handleSelectionChange(e, '直流增益')" @changeVerticalDeflectCoefficient="(value: any, index: number) => changeVerticalDeflectCoefficient(value, '直流增益(数字示波器)', index)" />
</detail-block>
<!-- 直流偏置 -->
<detail-block v-if="props.itemCategoryName === '数字示波器'" title="">
<div style="display: flex;justify-content: space-between;">
<el-checkbox v-model="form.currentBias" :true-label="1" :false-label="0" :disabled="pageType === 'detail'">
直流偏置
</el-checkbox>
<div v-if="pageType !== 'detail' && form.currentBias" style="padding: 0 10px;padding-bottom: 10px;">
<el-button type="primary" @click="addRow(DCBiasList, '直流偏置')">
增加行
</el-button>
<el-button type="info" @click="delRow(DCBiasCheckoutList, DCBiasList, '直流偏置')">
删除行
</el-button>
</div>
</div>
<template-table v-if="form.currentBias" type="直流偏置" :data="DCBiasList" :columns="columns_zero_frequency_gain" :page-type="pageType" @selection-change="(e: any) => handleSelectionChange(e, '直流偏置')" />
</detail-block>
<!-- 频带宽度(数字示波器) -->
<detail-block v-if="props.itemCategoryName === '数字示波器'" title="">
<div style="display: flex;justify-content: space-between;">
<el-checkbox v-model="form.bandWidth" :true-label="1" :false-label="0" :disabled="pageType === 'detail'">
频带宽度
</el-checkbox>
<div v-if="pageType !== 'detail' && form.bandWidth" style="padding: 0 10px;padding-bottom: 10px;">
<el-button type="primary" @click="addRow(frequencyBandwidthList, '频带宽度')">
增加行
</el-button>
<el-button type="info" @click="delRow(frequencyBandwidthCheckoutList, frequencyBandwidthList, '频带宽度')">
删除行
</el-button>
</div>
</div>
<template-table v-if="form.bandWidth" type="频带宽度(数字示波器)" :data="frequencyBandwidthList" :columns="columns_frequency_bandwidth" :page-type="pageType" @selection-change="(e: any) => handleSelectionChange(e, '频带宽度(数字示波器)')" />
</detail-block>
<!-- 触发灵敏度 -->
<detail-block v-if="props.itemCategoryName === '数字示波器'" title="">
<div style="display: flex;justify-content: space-between;">
<el-checkbox v-model="form.triggerSensitivity" :true-label="1" :false-label="0" :disabled="pageType === 'detail'">
触发灵敏度
</el-checkbox>
<div v-if="pageType !== 'detail' && form.triggerSensitivity" style="padding: 0 10px;padding-bottom: 10px;">
<el-button type="primary" @click="addRow(triggerSensitivityList, '触发灵敏度')">
增加行
</el-button>
<el-button type="info" @click="delRow(triggerSensitivityCheckoutList, triggerSensitivityList, '触发灵敏度')">
删除行
</el-button>
</div>
</div>
<template-table v-if="form.triggerSensitivity" type="触发灵敏度" :data="triggerSensitivityList" :columns="columns_trigger_sensitivity" :page-type="pageType" @selection-change="(e: any) => handleSelectionChange(e, '触发灵敏度')" />
</detail-block>
<!-- 上升时间(数字示波器) -->
<detail-block v-if="props.itemCategoryName === '数字示波器'" title="">
<div style="display: flex;justify-content: space-between;">
<el-checkbox v-model="form.riseTime" :true-label="1" :false-label="0" :disabled="pageType === 'detail'">
上升时间
</el-checkbox>
<div v-if="pageType !== 'detail' && form.riseTime" style="padding: 0 10px;padding-bottom: 10px;">
<el-button type="primary" @click="addRow(risetimeList, '上升时间')">
增加行
</el-button>
<el-button type="info" @click="delRow(risetimeCheckoutList, risetimeList, '上升时间')">
删除行
</el-button>
</div>
</div>
<template-table v-if="form.riseTime" type="上升时间(数字示波器)" :data="risetimeList" :columns="columns_risetime" :page-type="pageType" @selection-change="(e: any) => handleSelectionChange(e, '上升时间(数字示波器)')" @changeVerticalDeflectCoefficient="(value: any, index: number) => changeVerticalDeflectCoefficient(value, '上升时间(数字示波器)', index)" />
</detail-block>
<!-- 输入电阻(数字示波器) -->
<detail-block v-if="props.itemCategoryName === '数字示波器'" title="">
<div style="display: flex;justify-content: space-between;">
<el-checkbox v-model="form.inputResistance" :true-label="1" :false-label="0" :disabled="pageType === 'detail'">
输入电阻
</el-checkbox>
<div v-if="pageType !== 'detail' && form.inputResistance" style="padding: 0 10px;padding-bottom: 10px;">
<el-button type="primary" @click="addRow(inputResistanceList, '输入电阻')">
增加行
</el-button>
<el-button type="info" @click="delRow(inputResistanceCheckoutList, inputResistanceList, '输入电阻')">
删除行
</el-button>
</div>
</div>
<template-table v-if="form.inputResistance" type="输入电阻(数字示波器)" :data="inputResistanceList" :columns="columns_input_resistance" :page-type="pageType" @selection-change="(e: any) => handleSelectionChange(e, '输入电阻(数字示波器)')" />
</detail-block>
<!-- 校准信号(数字示波器) -->
<detail-block v-if="props.itemCategoryName === '数字示波器'" title="">
<div style="display: flex;justify-content: space-between;">
<el-checkbox v-model="form.calibratingSignal" :true-label="1" :false-label="0" :disabled="pageType === 'detail'">
校准信号
</el-checkbox>
<div v-if="pageType !== 'detail' && form.calibratingSignal" style="padding: 0 10px;padding-bottom: 10px;">
<el-button type="primary" @click="addRow(calibratingSignalList, '校准信号')">
增加行
</el-button>
<el-button type="info" @click="delRow(calibratingSignalCheckoutList, calibratingSignalList, '校准信号')">
删除行
</el-button>
</div>
</div>
<template-table
v-if="form.calibratingSignal"
type="校准信号(数字示波器)"
:data="calibratingSignalList"
:columns="columns_calibrating_signal"
:page-type="pageType"
@selection-change="(e: any) => handleSelectionChange(e, '校准信号(数字示波器)')"
@changeItemType="changeItemType"
/>
</detail-block>
<!-- 扫描时间系数及扩展 -->
<detail-block v-if="props.itemCategoryName === '模拟示波器'" title="">
<div style="display: flex;justify-content: space-between;">
<el-checkbox v-model="form.scanTimeCoefficient" :true-label="1" :false-label="0" :disabled="pageType === 'detail'">
扫描时间系数及扩展
</el-checkbox>
<div v-if="pageType !== 'detail' && form.scanTimeCoefficient" style="padding: 0 10px;padding-bottom: 10px;">
<el-button type="primary" @click="addRow(scanningTimeList, '扫描时间系数及扩展')">
增加行
</el-button>
<el-button type="info" @click="delRow(scanningTimeCheckoutList, scanningTimeList, '扫描时间系数及扩展')">
删除行
</el-button>
</div>
</div>
<template-table v-if="form.scanTimeCoefficient" type="扫描时间系数及扩展" :data="scanningTimeList" :columns="columns_scan_time" :page-type="pageType" @selection-change="(e: any) => handleSelectionChange(e, '扫描时间系数及扩展')" @changeInputNumber="(value: any) => changeInputNumber(value, '扫描时间系数及扩展')" />
</detail-block>
<!-- 垂直幅度 -->
<detail-block v-if="props.itemCategoryName === '模拟示波器'" title="">
<div style="display: flex;justify-content: space-between;">
<el-checkbox v-model="form.verticalAmplitude" :true-label="1" :false-label="0" :disabled="pageType === 'detail'">
垂直幅度
</el-checkbox>
<div v-if="pageType !== 'detail' && form.verticalAmplitude" style="padding: 0 10px;padding-bottom: 10px;">
<el-button type="primary" @click="addRow(verticalSizeList, '垂直幅度')">
增加行
</el-button>
<el-button type="info" @click="delRow(verticalSizeCheckoutList, verticalSizeList, '垂直幅度')">
删除行
</el-button>
</div>
</div>
<template-table v-if="form.verticalAmplitude" type="垂直幅度" :data="verticalSizeList" :columns="columns_vertical_size" :page-type="pageType" @selection-change="(e: any) => handleSelectionChange(e, '垂直幅度')" @changeInputNumber="(value: any) => changeInputNumber(value, '垂直幅度')" />
</detail-block>
<!-- 频带宽度(模拟示波器) -->
<detail-block v-if="props.itemCategoryName === '模拟示波器'" title="">
<div style="display: flex;justify-content: space-between;">
<el-checkbox v-model="form.bandWidth" :true-label="1" :false-label="0" :disabled="pageType === 'detail'">
频带宽度
</el-checkbox>
<div v-if="pageType !== 'detail' && form.bandWidth" style="padding: 0 10px;padding-bottom: 10px;">
<el-button type="primary" @click="addRow(frequencyBandwidthSimulateList, '频带宽度')">
增加行
</el-button>
<el-button type="info" @click="delRow(frequencyBandwidthSimulateCheckoutList, frequencyBandwidthSimulateList, '频带宽度')">
删除行
</el-button>
</div>
</div>
<template-table v-if="form.bandWidth" type="频带宽度(模拟示波器)" :data="frequencyBandwidthSimulateList" :columns="columns_frequency_bandwidth_simulate" :page-type="pageType" @selection-change="(e: any) => handleSelectionChange(e, '频带宽度(模拟示波器)')" />
</detail-block>
<!-- 触发特性 -->
<detail-block v-if="props.itemCategoryName === '模拟示波器'" title="">
<div style="display: flex;justify-content: space-between;">
<el-checkbox v-model="form.triggerCharacter" :true-label="1" :false-label="0" :disabled="pageType === 'detail'">
触发特性
</el-checkbox>
<div v-if="pageType !== 'detail' && form.triggerCharacter" style="padding: 0 10px;padding-bottom: 10px;">
<el-button type="primary" @click="addRow(triggerCharacteristicList, '触发特性')">
增加行
</el-button>
<el-button type="info" @click="delRow(triggerCharacteristicCheckoutList, triggerCharacteristicList, '触发特性')">
删除行
</el-button>
</div>
</div>
<template-table v-if="form.triggerCharacter" type="触发特性" :data="triggerCharacteristicList" :columns="columns_trigger_characteristic" :page-type="pageType" @selection-change="(e: any) => handleSelectionChange(e, '触发特性')" />
</detail-block>
<!-- 输入电阻(模拟示波器) -->
<detail-block v-if="props.itemCategoryName === '模拟示波器'" title="">
<div style="display: flex;justify-content: space-between;">
<el-checkbox v-model="form.inputResistance" :true-label="1" :false-label="0" :disabled="pageType === 'detail'">
输入电阻
</el-checkbox>
<div v-if="pageType !== 'detail' && form.inputResistance" style="padding: 0 10px;padding-bottom: 10px;">
<el-button type="primary" @click="addRow(inputResistanceSimulateList, '输入电阻')">
增加行
</el-button>
<el-button type="info" @click="delRow(inputResistanceSimulateCheckoutList, inputResistanceSimulateList, '输入电阻')">
删除行
</el-button>
</div>
</div>
<template-table v-if="form.inputResistance" type="输入电阻(模拟示波器)" :data="inputResistanceSimulateList" :columns="columns_input_resistance_simulate" :page-type="pageType" @selection-change="(e: any) => handleSelectionChange(e, '输入电阻(模拟示波器)')" />
</detail-block>
<!-- 上升时间(模拟示波器) -->
<detail-block v-if="props.itemCategoryName === '模拟示波器'" title="">
<div style="display: flex;justify-content: space-between;">
<el-checkbox v-model="form.riseTime" :true-label="1" :false-label="0" :disabled="pageType === 'detail'">
上升时间
</el-checkbox>
<div v-if="pageType !== 'detail' && form.riseTime" style="padding: 0 10px;padding-bottom: 10px;">
<el-button type="primary" @click="addRow(risetimeSimulateList, '上升时间')">
增加行
</el-button>
<el-button type="info" @click="delRow(risetimeSimulateCheckoutList, risetimeSimulateList, '上升时间')">
删除行
</el-button>
</div>
</div>
<template-table v-if="form.riseTime" type="上升时间(模拟示波器)" :data="risetimeSimulateList" :columns="columns_risetime_simulate" :page-type="pageType" @selection-change="(e: any) => handleSelectionChange(e, '上升时间(模拟示波器)')" @changeInputNumber="(value: any) => changeInputNumber(value, '上升时间(模拟示波器)')" />
</detail-block>
<!-- 校准信号(模拟示波器) -->
<detail-block v-if="props.itemCategoryName === '模拟示波器'" title="">
<div style="display: flex;justify-content: space-between;">
<el-checkbox v-model="form.calibratingSignal" :true-label="1" :false-label="0" :disabled="pageType === 'detail'">
校准信号
</el-checkbox>
<div v-if="pageType !== 'detail' && form.calibratingSignal" style="padding: 0 10px;padding-bottom: 10px;">
<el-button type="primary" @click="addRow(calibratingSignalSimulateList, '校准信号')">
增加行
</el-button>
<el-button type="info" @click="delRow(calibratingSignalSimulateCheckoutList, calibratingSignalSimulateList, '校准信号')">
删除行
</el-button>
</div>
</div>
<template-table v-if="form.calibratingSignal" type="校准信号(模拟示波器)" :data="calibratingSignalSimulateList" :columns="columns_calibrating_signal_simulate" :page-type="pageType" @selection-change="(e: any) => handleSelectionChange(e, '校准信号(模拟示波器)')" />
</detail-block>
</template>