diff --git a/src/components/SelectByDict/index.vue b/src/components/SelectByDict/index.vue index 20a7e0c..83fc909 100644 --- a/src/components/SelectByDict/index.vue +++ b/src/components/SelectByDict/index.vue @@ -24,7 +24,7 @@ required: true, }, }) -const emit = defineEmits(['update:modelValue', 'getDictValue']) +const emit = defineEmits(['update:modelValue', 'getDictValue', 'changeValue']) const checkItem = ref({}) // 选中的选项 const input = ref() // 输入框组件 // -------------------------定义数据-------------------- @@ -91,6 +91,7 @@ const data = dictList.value.filter(item => item.name === inputValue).length if (!data) { console.log(inputValue, '该值不存在添加字典') + emit('changeValue', inputValue) // 在字典中添加该值 getDictAllList().then((res) => { const currentDict = res.data.filter(item => item.code === props.dictCode)[0] @@ -124,6 +125,7 @@ } else { console.log(inputValue, '该值存在') + emit('changeValue', inputValue) // 发送 绑定的value (可用可不用) emit('getDictValue', dictList.value.filter(item => item.name === inputValue)[0].value1) // setTimeout(() => { diff --git a/src/components/SelectByDict/index.vue b/src/components/SelectByDict/index.vue index 20a7e0c..83fc909 100644 --- a/src/components/SelectByDict/index.vue +++ b/src/components/SelectByDict/index.vue @@ -24,7 +24,7 @@ required: true, }, }) -const emit = defineEmits(['update:modelValue', 'getDictValue']) +const emit = defineEmits(['update:modelValue', 'getDictValue', 'changeValue']) const checkItem = ref({}) // 选中的选项 const input = ref() // 输入框组件 // -------------------------定义数据-------------------- @@ -91,6 +91,7 @@ const data = dictList.value.filter(item => item.name === inputValue).length if (!data) { console.log(inputValue, '该值不存在添加字典') + emit('changeValue', inputValue) // 在字典中添加该值 getDictAllList().then((res) => { const currentDict = res.data.filter(item => item.code === props.dictCode)[0] @@ -124,6 +125,7 @@ } else { console.log(inputValue, '该值存在') + emit('changeValue', inputValue) // 发送 绑定的value (可用可不用) emit('getDictValue', dictList.value.filter(item => item.name === inputValue)[0].value1) // setTimeout(() => { diff --git a/src/views/business/measure/item/components/thirteenth/templateDetail-interface.ts b/src/views/business/measure/item/components/thirteenth/templateDetail-interface.ts index 7662387..708ffd9 100644 --- a/src/views/business/measure/item/components/thirteenth/templateDetail-interface.ts +++ b/src/views/business/measure/item/components/thirteenth/templateDetail-interface.ts @@ -34,6 +34,8 @@ amplitude?: string // 幅度 amplitudeUnit?: string // 幅度单位 + verticalDeflectionGear?: string // 低电平测量时垂直偏转档位 + verticalDeflectionGearUnit?: string // 低电平测量时垂直偏转档位单位 frequency?: string // 频率(模拟示波器) frequencyUnit?: string // 频率单位(模拟示波器) @@ -54,8 +56,6 @@ signalType?: string // 信号类型(模拟示波器)(字典value) stepFrequency?: string // 步进频率(模拟示波器) stepFrequencyUnit?: string // 步进频率单位(模拟示波器) - verticalDeflectionGear?: string // 低电平测量时垂直偏转档位 - verticalDeflectionGearUnit?: string // 低电平测量时垂直偏转档位单位 verticalGearStep?: string // 垂直档位步进(模拟示波器) verticalScaleGear?: string // 垂直刻度档位(模拟示波器) verticalScaleGearUnit?: string // 垂直刻度档位单位(模拟示波器) diff --git a/src/components/SelectByDict/index.vue b/src/components/SelectByDict/index.vue index 20a7e0c..83fc909 100644 --- a/src/components/SelectByDict/index.vue +++ b/src/components/SelectByDict/index.vue @@ -24,7 +24,7 @@ required: true, }, }) -const emit = defineEmits(['update:modelValue', 'getDictValue']) +const emit = defineEmits(['update:modelValue', 'getDictValue', 'changeValue']) const checkItem = ref({}) // 选中的选项 const input = ref() // 输入框组件 // -------------------------定义数据-------------------- @@ -91,6 +91,7 @@ const data = dictList.value.filter(item => item.name === inputValue).length if (!data) { console.log(inputValue, '该值不存在添加字典') + emit('changeValue', inputValue) // 在字典中添加该值 getDictAllList().then((res) => { const currentDict = res.data.filter(item => item.code === props.dictCode)[0] @@ -124,6 +125,7 @@ } else { console.log(inputValue, '该值存在') + emit('changeValue', inputValue) // 发送 绑定的value (可用可不用) emit('getDictValue', dictList.value.filter(item => item.name === inputValue)[0].value1) // setTimeout(() => { diff --git a/src/views/business/measure/item/components/thirteenth/templateDetail-interface.ts b/src/views/business/measure/item/components/thirteenth/templateDetail-interface.ts index 7662387..708ffd9 100644 --- a/src/views/business/measure/item/components/thirteenth/templateDetail-interface.ts +++ b/src/views/business/measure/item/components/thirteenth/templateDetail-interface.ts @@ -34,6 +34,8 @@ amplitude?: string // 幅度 amplitudeUnit?: string // 幅度单位 + verticalDeflectionGear?: string // 低电平测量时垂直偏转档位 + verticalDeflectionGearUnit?: string // 低电平测量时垂直偏转档位单位 frequency?: string // 频率(模拟示波器) frequencyUnit?: string // 频率单位(模拟示波器) @@ -54,8 +56,6 @@ signalType?: string // 信号类型(模拟示波器)(字典value) stepFrequency?: string // 步进频率(模拟示波器) stepFrequencyUnit?: string // 步进频率单位(模拟示波器) - verticalDeflectionGear?: string // 低电平测量时垂直偏转档位 - verticalDeflectionGearUnit?: string // 低电平测量时垂直偏转档位单位 verticalGearStep?: string // 垂直档位步进(模拟示波器) verticalScaleGear?: string // 垂直刻度档位(模拟示波器) verticalScaleGearUnit?: string // 垂直刻度档位单位(模拟示波器) diff --git a/src/views/business/measure/item/components/thirteenth/templateDetail.vue b/src/views/business/measure/item/components/thirteenth/templateDetail.vue index cb67fcf..b43e364 100644 --- a/src/views/business/measure/item/components/thirteenth/templateDetail.vue +++ b/src/views/business/measure/item/components/thirteenth/templateDetail.vue @@ -9,6 +9,8 @@ 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: { @@ -37,6 +39,18 @@ 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) @@ -144,8 +158,8 @@ const columns_input_resistance = ref([ // 输入电阻(数字示波器) { text: '检定项目', value: 'params', align: 'center', required: true }, { text: '通道', value: 'thoroughfare', 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: '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: true, width: 300 }, @@ -153,87 +167,106 @@ const columns_calibrating_signal = ref([ // 校准信号(数字示波器) { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '项目', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值单位', value: 'nominalValue', 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([ // 扫描时间系数及扩展 { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '扫描方式', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗单位', value: 'nominalValue', align: 'center', required: true }, - { text: '步进', value: 'nominalValue', align: 'center', required: true }, - { text: '水平刻度档位', value: 'nominalValue', align: 'center', required: true }, - { text: '水平刻度档位单位', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值单位', value: 'nominalValue', align: 'center', required: true }, - { text: '技术指标', value: 'nominalValue', 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: true, width: '300' }, ]) const columns_vertical_size = ref([ // 垂直幅度 { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '通道', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗单位', value: 'nominalValue', align: 'center', required: true }, - { text: '频率', value: 'nominalValue', align: 'center', required: true }, - { text: '频率单位', value: 'nominalValue', align: 'center', required: true }, - { text: '步进', value: 'nominalValue', align: 'center', required: true }, - { text: '垂直刻度档位', value: 'nominalValue', align: 'center', required: true }, - { text: '垂直刻度档位单位', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值单位', value: 'nominalValue', align: 'center', required: true }, - { text: '技术指标', value: 'nominalValue', 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: true, width: '300' }, +]) + +const columns_frequency_bandwidth_simulate = ref([ // 频带宽度(模拟示波器) + { 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: true, width: 340 }, ]) const columns_trigger_characteristic = ref([ // 触发特性 { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '扫描方式', value: 'nominalValue', align: 'center', required: true }, - { text: '通道', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗单位', value: 'nominalValue', align: 'center', required: true }, - { text: '触发类型', value: 'nominalValue', align: 'center', required: true }, - { text: '频率', value: 'nominalValue', align: 'center', required: true }, - { text: '频率单位', value: 'nominalValue', align: 'center', required: true }, - { text: '频率上限', value: 'nominalValue', align: 'center', required: true }, - { text: '频率上限单位', value: 'nominalValue', align: 'center', required: true }, - { text: '幅度', value: 'nominalValue', align: 'center', required: true }, - { text: '幅度单位', value: 'nominalValue', 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: true, width: 340 }, ]) const columns_input_resistance_simulate = ref([ // 输入电阻(模拟示波器) { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '通道', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗单位', value: 'nominalValue', align: 'center', required: true }, - { text: '技术指标', value: 'nominalValue', 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: true, width: 300 }, ]) const columns_risetime_simulate = ref([ // 上升时间(模拟示波器) { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '通道', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗单位', value: 'nominalValue', align: 'center', required: true }, - { text: '触发类型', value: 'nominalValue', align: 'center', required: true }, - { text: '垂直刻度档位', value: 'nominalValue', align: 'center', required: true }, - { text: '垂直刻度档位单位', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值单位', value: 'nominalValue', align: 'center', required: true }, - { text: '扫描上升时间档位', value: 'nominalValue', align: 'center', required: true }, - { text: '扫描上升时间档位单位', value: 'nominalValue', align: 'center', required: true }, - { text: '技术指标', value: 'nominalValue', 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: true, width: '340' }, ]) const columns_calibrating_signal_simulate = ref([ // 校准信号(模拟示波器) { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '信号类型', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗单位', value: 'nominalValue', align: 'center', required: true }, - { text: '幅度标称值', value: 'nominalValue', align: 'center', required: true }, - { text: '幅度标称值单位', value: 'nominalValue', align: 'center', required: true }, - { text: '频率标称值', value: 'nominalValue', align: 'center', required: true }, - { text: '频率标称值单位', value: 'nominalValue', align: 'center', required: true }, - { text: '技术指标', value: 'nominalValue', 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: true, width: '340' }, ]) // --------------------------------表格操作--------------------------------------------------- @@ -294,200 +327,763 @@ * @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: '', // 周期时标信号 - cycleSignalUnit: '', // 周期时标信号单位 - technicalIndex: '', // 技术指标 - 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: '', // 标准值 - standardValueUnit: 'V', // 标准值单位 - technicalIndex: '', // 技术指标 - 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: '', // 标准值 - standardValueUnit: 'V', // 标准值单位 - technicalIndex: '', // 技术指标 - technicalIndexSymbol: '±', // 技术指标前符号 - technicalIndexUnit: '%', // 技术指标单位 - }) - break - case '频带宽度': - list.push({ - id: '', // id,更新/删除使用参数 - dataType: '4', // 检定项数据类型(一个检定项中区分两个表格)(字典code) - itemId: props.itemId, // 检定项id - params: title, // 检定项目 - impedance: '', // 阻抗 - impedanceUnit: 'Ω', // 阻抗单位 - thoroughfare: 'CH1', // 通道 - verticalDeflectCoefficient: '', // 垂直偏转系数 - verticalDeflectCoefficientUnit: 'V', // 垂直偏转系数单位 - horizontalDeflectCoefficient: '', // 水平偏转系数 - horizontalDeflectCoefficientUnit: 'ns', // 水平偏转系数单位 - referencePointFrequency: '', // 参考点频率 - referencePointFrequencyUnit: 'Hz', // 参考点频率单位 - bandWidth: '', // 频带宽度 - bandWidthUnit: 'Hz', // 频带宽度单位 - technicalIndex: '', // 技术指标 - technicalIndexSymbol: '±', // 技术指标前符号 - technicalIndexUnit: 'dB', // 技术指标单位 - }) - break - case '触发灵敏度': - list.push({ - id: '', // id,更新/删除使用参数 - dataType: '5', // 检定项数据类型(一个检定项中区分两个表格)(字典code) - itemId: props.itemId, // 检定项id - params: title, // 检定项目 - thoroughfare: 'CH1', // 通道 - triggerType: '内触发', // 触发类型 - signalFrequency: '', // 信号频率 - signalFrequencyUnit: 'V', // 信号频率单位 - verticalDeflectCoefficient: '', // 垂直偏转系数 - verticalDeflectCoefficientUnit: 'V', // 垂直偏转系数单位 - nominalValue: '', // 标称值 - nominalValueUnit: 'div', // 标称值单位 - technicalIndex: '', // 技术指标 - technicalIndexSymbol: '±', // 技术指标前符号 - technicalIndexUnit: 'dB', // 技术指标单位 - }) - break - case '上升时间': - list.push({ - id: '', // id,更新/删除使用参数 - dataType: '5', // 检定项数据类型(一个检定项中区分两个表格)(字典code) - itemId: props.itemId, // 检定项id - params: title, // 检定项目 - impedance: '', // 阻抗, - impedanceUnit: 'Ω', // 阻抗单位 - thoroughfare: 'CH1', // 通道 - verticalDeflectCoefficient: '', // 垂直偏转系数 - verticalDeflectCoefficientUnit: 'V', // 垂直偏转系数单位 - amplitude: '', // 幅度 - amplitudeUnit: 'V', // 幅度单位 - horizontalDeflectCoefficient: '', // 水平偏转系数单位 - horizontalDeflectCoefficientUnit: 'ns', // 水平偏转系数单位 - technicalIndex: '', // 技术指标 - technicalIndexSymbol: '±', // 技术指标前符号 - technicalIndexUnit: 'ns', // 技术指标单位 - }) - break - case '输入电阻': - list.push({ - id: '', // id,更新/删除使用参数 - dataType: '5', // 检定项数据类型(一个检定项中区分两个表格)(字典code) - itemId: props.itemId, // 检定项id - params: title, // 检定项目 - thoroughfare: 'CH1', // 通道 - verticalDeflectCoefficient: '', // 垂直偏转系数 - verticalDeflectCoefficientUnit: 'V', // 垂直偏转系数单位 - standardValue: '', // 标准值 - technicalIndex: '', // 技术指标 - technicalIndexSymbol: '±', // 技术指标前符号 - technicalIndexUnit: '%', // 技术指标单位 - }) - break - case '校准信号': - - break + 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: '', // 周期时标信号 + cycleSignalUnit: '', // 周期时标信号单位 + technicalIndex: '', // 技术指标 + 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: '', // 标准值 + standardValueUnit: 'V', // 标准值单位 + technicalIndex: '', // 技术指标 + 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: '', // 标准值 + standardValueUnit: 'V', // 标准值单位 + technicalIndex: '', // 技术指标 + 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: '', // 水平偏转系数 + horizontalDeflectCoefficientUnit: 'ns', // 水平偏转系数单位 + referencePointFrequency: '', // 参考点频率 + referencePointFrequencyUnit: 'Hz', // 参考点频率单位 + bandWidth: '', // 频带宽度 + bandWidthUnit: 'Hz', // 频带宽度单位 + technicalIndex: '', // 技术指标 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: 'dB', // 技术指标单位 + }) + break + case '触发灵敏度': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '5', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + thoroughfare: 'CH1', // 通道 + triggerType: '内触发', // 触发类型 + signalFrequency: '', // 信号频率 + signalFrequencyUnit: 'MHz', // 信号频率单位 + verticalDeflectCoefficient: '', // 垂直偏转系数 + verticalDeflectCoefficientUnit: 'V', // 垂直偏转系数单位 + nominalValue: '', // 标称值 + 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: '', // 幅度 + amplitudeUnit: 'V', // 幅度单位 + horizontalDeflectCoefficient: '', // 水平偏转系数单位 + horizontalDeflectCoefficientUnit: 'ns', // 水平偏转系数单位 + technicalIndex: '', // 技术指标 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: 'ns', // 技术指标单位 + }) + break + case '输入电阻': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '7', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + thoroughfare: 'CH1', // 通道 + verticalDeflectCoefficient: '', // 垂直偏转系数 + verticalDeflectCoefficientUnit: 'V', // 垂直偏转系数单位 + standardValue: '', // 标准值 + technicalIndex: '', // 技术指标 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: '%', // 技术指标单位 + }) + break + case '校准信号': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '8', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + itemType: '幅度', // 项目 + nominalValue: '', // 标称值 + nominalValueUnit: 'V', // 垂直标称值单位偏转系数单位 + verticalDeflectionGear: '', // 低电平测量时垂直偏转档位 + 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: '', // 水平刻度档位 + horizontalScaleGearUnit: 'ns', // 水平刻度档位单位 + nominalValue: '', // 标称值 + nominalValueUnit: 'ms', // 标称值单位 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: '%', // 技术指标单位 + technicalIndex: '', // 技术指标单位 + }) + 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: '', // 垂直刻度档位 + verticalScaleGearUnit: 'mV', // 垂直刻度档位单位 + nominalValue: '', // 标称值 + nominalValueUnit: 'mV', // 标称值单位 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: '%', // 技术指标单位 + technicalIndex: '', // 技术指标 + }) + break + case '频带宽度': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '3', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + thoroughfare: 'CH1', // 通道 + impedance: '50', // 阻抗 + impedanceUnit: 'Ω', // 阻抗单位 + referenceFrequency: '', // 基准频率 + referenceFrequencyUnit: 'Hz', // 基准频率单位 + stepFrequency: '', // 步进频率 + stepFrequencyUnit: 'kHz', // 步进频率单位 + verticalScaleGear: '', // 垂直刻度档位 + verticalScaleGearUnit: 'mV', // 垂直刻度档位单位 + verticalGearStep: '1-2-5', // 垂直档位步进 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: 'MHz', // 技术指标单位 + technicalIndex: '', // 技术指标 + }) + break + case '触发特性': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '4', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + scanType: 'A扫描', // 扫描类型 + thoroughfare: 'CH1', // 通道 + impedance: '50', // 阻抗 + impedanceUnit: 'Ω', // 阻抗单位 + triggerType: '内触发', // 触发类型 + frequency: '', // 频率 + frequencyUnit: 'Hz', // 频率单位 + frequencyUpper: '', // 频率上限 + frequencyUpperUnit: 'Hz', // 频率上限单位 + amplitude: '', // 幅度 + amplitudeUnit: 'mV', // 幅度单位 + referenceAmplitude: '100', // 基准幅度 + referenceAmplitudeUnit: 'mV', // 基准幅度单位 + technicalIndexSymbol: '≤', // 技术指标前符号 + technicalIndexUnit: 'mV', // 技术指标单位 + technicalIndex: '', // 技术指标 + }) + break + case '输入电阻': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '5', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + thoroughfare: 'CH1', // 通道 + impedance: '50', // 阻抗 + impedanceUnit: 'Ω', // 阻抗单位 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: '%', // 技术指标单位 + technicalIndex: '', // 技术指标 + }) + break + case '上升时间': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '6', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + thoroughfare: 'CH1', // 通道 + impedance: '50', // 阻抗 + impedanceUnit: 'Ω', // 阻抗单位 + verticalScaleGear: '', // 垂直刻度档位 + verticalScaleGearUnit: 'mV', // 垂直刻度档位单位 + amplitude: '', // 幅度 + amplitudeUnit: 'mV', // 幅度单位 + horizontalScaleGear: '', // 水平刻度档位 + horizontalScaleGearUnit: 'ns', // 水平刻度档位单位 + technicalIndexSymbol: '<', // 技术指标前符号 + technicalIndexUnit: 'ns', // 技术指标单位 + technicalIndex: '', // 技术指标 + }) + break + case '校准信号': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '7', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + signalType: '校准信号1', // 信号类型 + impedance: '50', // 阻抗 + impedanceUnit: 'Ω', // 阻抗单位 + nominalAmplitudeValue: '', // 幅度标称值 + nominalAmplitudeValueUnit: 'mV', // 幅度标称值单位 + nominalFrequencyValue: '', // 频率标称值 + nominalFrequencyValueUnit: 'kHz', // 频率标称值单位 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: '%', // 技术指标单位 + technicalIndex: '', // 技术指标 + }) + break + } } } - // } } /** * 删除行公共方法 * @param checkoutList 选中的数组 * @param list 操作的数组 */ -const delRow = (checkoutList: IList[], list: IList[]) => { +const delRow = (checkoutList: IList[], list: IList[], title: string) => { if (!checkoutList.length) { ElMessage.warning('请选中要删除的行') } else { - list = list.filter((item: any) => { - return !checkoutList.includes(item) - }) + 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 + } + } } } -// ---------------------------------------------校验--------------------------------------------------- -// 校验表格(点击保存的时候用、生成标准器示值) -const checkList = () => { - // return useCheckList(list.value, columns.value, '检定项表格') +// ------------------------------------------校验\保存之前处理数据--------------------------------------------------- +// 增加行校验表格 +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 calculateDataTop = () => { +// 保存之前校验 +const checkListBeforeSave = () => { + // 验空 + if (props.itemCategoryName === '数字示波器' && form.value.timeBase && !timeBaseList.value.length) { // 时基(示波器-数字) + ElMessage.warning('时基 不能为空') + return false + } + else if (props.itemCategoryName === '数字示波器' && form.value.currentGain && !zeroFrequencyGainList.value.length) { // 直流增益(示波器-数字) + ElMessage.warning('直流增益 不能为空') + return false + } + else if (props.itemCategoryName === '数字示波器' && form.value.currentBias && !DCBiasList.value.length) { // 直流偏置(示波器-数字) + ElMessage.warning('直流偏置 不能为空') + return false + } + else if (props.itemCategoryName === '模拟示波器' && form.value.scanTimeCoefficient && !scanningTimeList.value.length) { // 扫描时间系数及扩展(示波器-模拟) + ElMessage.warning('扫描时间系数及扩展 不能为空') + return false + } + else if (props.itemCategoryName === '模拟示波器' && form.value.verticalAmplitude && !verticalSizeList.value.length) { // 垂直幅度 + ElMessage.warning('垂直幅度 不能为空') + return false + } + else if (form.value.bandWidth) { // 频带宽度(示波器-数字/模拟) + if ((props.itemCategoryName === '数字示波器' && !frequencyBandwidthList.value.length) || (props.itemCategoryName === '模拟示波器' && !frequencyBandwidthSimulateList.value.length)) { + ElMessage.warning('频带宽度 不能为空') + return false + } + } + else if (props.itemCategoryName === '模拟示波器' && form.value.triggerCharacter && !triggerCharacteristicList.value.length) { // 触发特性 + ElMessage.warning('触发特性 不能为空') + return false + } + else if (props.itemCategoryName === '数字示波器' && form.value.triggerSensitivity && !triggerSensitivityList.value.length) { // 触发灵敏度 + ElMessage.warning('触发灵敏度 不能为空') + return false + } + else if (form.value.riseTime) { // 上升时间(数字示波器) + if ((props.itemCategoryName === '数字示波器' && !risetimeList.value.length) || (props.itemCategoryName === '模拟示波器' && !risetimeSimulateList.value.length)) { + ElMessage.warning('上升时间 不能为空') + return false + } + } + else if (form.value.inputResistance) { // 输入电阻(数字示波器) + if ((props.itemCategoryName === '数字示波器' && !inputResistanceList.value.length) && (props.itemCategoryName === '模拟示波器' && !inputResistanceSimulateList.value.length)) { + ElMessage.warning('输入电阻 不能为空') + return false + } + } + else if (form.value.calibratingSignal) { // 校准信号(示波器-数字/模拟) + if ((props.itemCategoryName === '数字示波器' && !calibratingSignalList.value.length) && (props.itemCategoryName === '模拟示波器' && !calibratingSignalSimulateList.value.length)) { + ElMessage.warning('校准信号 不能为空') + return false + } + } + console.log('--------1111111') + // 验数据 + 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, '时基') + } + else if (form.value.currentGain) { + currentGainResult = checkList(zeroFrequencyGainList.value, '直流增益') + } + else if (form.value.currentBias) { + currentBiasResult = checkList(DCBiasList.value, '直流偏置') + } + else if (form.value.bandWidth) { + bandWidthResult = checkList(frequencyBandwidthList.value, '频带宽度') + } + else if (form.value.triggerSensitivity) { + triggerSensitivityResult = checkList(triggerSensitivityList.value, '触发灵敏度') + } + else if (form.value.riseTime) { + riseTimeResult = checkList(risetimeList.value, '上升时间') + } + else if (form.value.inputResistance) { + inputResistanceResult = checkList(inputResistanceList.value, '输入电阻') + } + else 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, '扫描时间系数及扩展') + } + else if (form.value.verticalAmplitude) { + verticalAmplitudeResult = checkList(verticalSizeList.value, '垂直幅度') + } + else if (form.value.bandWidth) { + bandWidthResult = checkList(frequencyBandwidthSimulateList.value, '频带宽度') + } + else if (form.value.triggerCharacter) { + triggerCharacterResult = checkList(triggerCharacteristicList.value, '触发特性') + } + else if (form.value.inputResistance) { + inputResistanceResult = checkList(inputResistanceSimulateList.value, '输入电阻') + } + else if (form.value.riseTime) { + riseTimeResult = checkList(risetimeSimulateList.value, '上升时间') + } + else if (form.value.calibratingSignal) { + calibratingSignalResult = checkList(calibratingSignalSimulateList.value, '校准信号') + } + if (scanTimeCoefficientResult && verticalAmplitudeResult && bandWidthResult && triggerCharacterResult && inputResistanceResult && riseTimeResult && calibratingSignalResult + ) { + return true + } + else { + return false + } + } } -// 点击生成辅助接地电阻--下面表格计算 -const calculateDataBottom = () => { +// 保存之前处理数据 +const solveDataBeforeSave = () => { + // 数据处理 + let tempList = [] + 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) => { + return { + ...item, + id: '', + } + }) + return tempList } // ----------------------------------------------------------------------------------------------------- +// 校准信号项目变化 +const changeItemType = (value: string, index: number) => { + if (value === '频率') { + calibratingSignalList.value[index].verticalDeflectionGear = '/' + calibratingSignalList.value[index].verticalDeflectionGearUnit = '/' + } + else { // 幅度 + calibratingSignalList.value[index].verticalDeflectionGear = '' + calibratingSignalList.value[index].verticalDeflectionGearUnit = 'V' + } +} +// 垂直偏转系数变化 +const changeVerticalDeflectCoefficient = (param: { value: string }, type: string) => { + 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) => { + return { + ...item, + standardValue: Number(calc(Number(num), 6, '*')), // 标准值默认为垂直偏转系数*6 + } + }) as any + } + else if (type === '上升时间(数字示波器)') { + risetimeList.value = risetimeList.value.map((item) => { + return { + ...item, + amplitude: Number(calc(Number(num), 5, '*')), // 幅度默认为垂直偏转系数*6 + } + }) 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 => `${item.dataType}` === '1').map((item) => { item.params = '时基'; return item }) // 时基 + zeroFrequencyGainList.value = newVal.filter(item => `${item.dataType}` === '2').map((item) => { item.params = '直流增益'; return item }) // 直流增益 + DCBiasList.value = newVal.filter(item => `${item.dataType}` === '3').map((item) => { item.params = '直流偏置'; return item }) // 直流偏置 + frequencyBandwidthList.value = newVal.filter(item => `${item.dataType}` === '4').map((item) => { item.params = '频带宽度'; return item }) // 频带宽度(数字示波器) + triggerSensitivityList.value = newVal.filter(item => `${item.dataType}` === '5').map((item) => { item.params = '触发灵敏度'; return item })// 触发灵敏度 + risetimeList.value = newVal.filter(item => `${item.dataType}` === '6').map((item) => { item.params = '上升时间'; return item })// 上升时间(数字示波器) + inputResistanceList.value = newVal.filter(item => `${item.dataType}` === '7').map((item) => { item.params = '输入电阻'; return item })// 输入电阻(数字示波器) + calibratingSignalList.value = newVal.filter(item => `${item.dataType}` === '8').map((item) => { item.params = '校准信号'; return item })// 校准信号(数字示波器) + if (timeBaseList.value.length) { + form.value.methodType = timeBaseList.value[0].methodType // 时基方法 + } + } + else if (props.itemCategoryName === '模拟示波器') { + scanningTimeList.value = newVal.filter(item => `${item.dataType}` === '1').map((item) => { item.params = '扫描时间系数及扩展'; return item }) // 扫描时间系数及扩展 + verticalSizeList.value = newVal.filter(item => `${item.dataType}` === '2').map((item) => { item.params = '垂直幅度'; return item }) // 垂直幅度 + frequencyBandwidthSimulateList.value = newVal.filter(item => `${item.dataType}` === '3').map((item) => { item.params = '频带宽度'; return item }) // 频带宽度(模拟示波器 + triggerCharacteristicList.value = newVal.filter(item => `${item.dataType}` === '4').map((item) => { item.params = '触发特性'; return item }) // 触发特性 + inputResistanceSimulateList.value = newVal.filter(item => `${item.dataType}` === '5').map((item) => { item.params = '输入电阻'; return item })// 输入电阻 + risetimeSimulateList.value = newVal.filter(item => `${item.dataType}` === '6').map((item) => { item.params = '上升时间'; return item })// 上升时间(数字示波器) + calibratingSignalSimulateList.value = newVal.filter(item => `${item.dataType}` === '7').map((item) => { item.params = '校准信号'; return item })// 校准信号(数字示波器) + } + } +}) -// watch(() => props.list, (newVal) => { // 检定项表格 -// if (newVal) { -// list.value = [...newVal] -// } -// }) +watch(() => props.form, (newValue) => { + 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({ list }) +defineExpose({ checkListBeforeSave, solveDataBeforeSave, form }) diff --git a/src/components/SelectByDict/index.vue b/src/components/SelectByDict/index.vue index 20a7e0c..83fc909 100644 --- a/src/components/SelectByDict/index.vue +++ b/src/components/SelectByDict/index.vue @@ -24,7 +24,7 @@ required: true, }, }) -const emit = defineEmits(['update:modelValue', 'getDictValue']) +const emit = defineEmits(['update:modelValue', 'getDictValue', 'changeValue']) const checkItem = ref({}) // 选中的选项 const input = ref() // 输入框组件 // -------------------------定义数据-------------------- @@ -91,6 +91,7 @@ const data = dictList.value.filter(item => item.name === inputValue).length if (!data) { console.log(inputValue, '该值不存在添加字典') + emit('changeValue', inputValue) // 在字典中添加该值 getDictAllList().then((res) => { const currentDict = res.data.filter(item => item.code === props.dictCode)[0] @@ -124,6 +125,7 @@ } else { console.log(inputValue, '该值存在') + emit('changeValue', inputValue) // 发送 绑定的value (可用可不用) emit('getDictValue', dictList.value.filter(item => item.name === inputValue)[0].value1) // setTimeout(() => { diff --git a/src/views/business/measure/item/components/thirteenth/templateDetail-interface.ts b/src/views/business/measure/item/components/thirteenth/templateDetail-interface.ts index 7662387..708ffd9 100644 --- a/src/views/business/measure/item/components/thirteenth/templateDetail-interface.ts +++ b/src/views/business/measure/item/components/thirteenth/templateDetail-interface.ts @@ -34,6 +34,8 @@ amplitude?: string // 幅度 amplitudeUnit?: string // 幅度单位 + verticalDeflectionGear?: string // 低电平测量时垂直偏转档位 + verticalDeflectionGearUnit?: string // 低电平测量时垂直偏转档位单位 frequency?: string // 频率(模拟示波器) frequencyUnit?: string // 频率单位(模拟示波器) @@ -54,8 +56,6 @@ signalType?: string // 信号类型(模拟示波器)(字典value) stepFrequency?: string // 步进频率(模拟示波器) stepFrequencyUnit?: string // 步进频率单位(模拟示波器) - verticalDeflectionGear?: string // 低电平测量时垂直偏转档位 - verticalDeflectionGearUnit?: string // 低电平测量时垂直偏转档位单位 verticalGearStep?: string // 垂直档位步进(模拟示波器) verticalScaleGear?: string // 垂直刻度档位(模拟示波器) verticalScaleGearUnit?: string // 垂直刻度档位单位(模拟示波器) diff --git a/src/views/business/measure/item/components/thirteenth/templateDetail.vue b/src/views/business/measure/item/components/thirteenth/templateDetail.vue index cb67fcf..b43e364 100644 --- a/src/views/business/measure/item/components/thirteenth/templateDetail.vue +++ b/src/views/business/measure/item/components/thirteenth/templateDetail.vue @@ -9,6 +9,8 @@ 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: { @@ -37,6 +39,18 @@ 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) @@ -144,8 +158,8 @@ const columns_input_resistance = ref([ // 输入电阻(数字示波器) { text: '检定项目', value: 'params', align: 'center', required: true }, { text: '通道', value: 'thoroughfare', 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: '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: true, width: 300 }, @@ -153,87 +167,106 @@ const columns_calibrating_signal = ref([ // 校准信号(数字示波器) { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '项目', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值单位', value: 'nominalValue', 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([ // 扫描时间系数及扩展 { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '扫描方式', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗单位', value: 'nominalValue', align: 'center', required: true }, - { text: '步进', value: 'nominalValue', align: 'center', required: true }, - { text: '水平刻度档位', value: 'nominalValue', align: 'center', required: true }, - { text: '水平刻度档位单位', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值单位', value: 'nominalValue', align: 'center', required: true }, - { text: '技术指标', value: 'nominalValue', 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: true, width: '300' }, ]) const columns_vertical_size = ref([ // 垂直幅度 { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '通道', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗单位', value: 'nominalValue', align: 'center', required: true }, - { text: '频率', value: 'nominalValue', align: 'center', required: true }, - { text: '频率单位', value: 'nominalValue', align: 'center', required: true }, - { text: '步进', value: 'nominalValue', align: 'center', required: true }, - { text: '垂直刻度档位', value: 'nominalValue', align: 'center', required: true }, - { text: '垂直刻度档位单位', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值单位', value: 'nominalValue', align: 'center', required: true }, - { text: '技术指标', value: 'nominalValue', 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: true, width: '300' }, +]) + +const columns_frequency_bandwidth_simulate = ref([ // 频带宽度(模拟示波器) + { 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: true, width: 340 }, ]) const columns_trigger_characteristic = ref([ // 触发特性 { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '扫描方式', value: 'nominalValue', align: 'center', required: true }, - { text: '通道', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗单位', value: 'nominalValue', align: 'center', required: true }, - { text: '触发类型', value: 'nominalValue', align: 'center', required: true }, - { text: '频率', value: 'nominalValue', align: 'center', required: true }, - { text: '频率单位', value: 'nominalValue', align: 'center', required: true }, - { text: '频率上限', value: 'nominalValue', align: 'center', required: true }, - { text: '频率上限单位', value: 'nominalValue', align: 'center', required: true }, - { text: '幅度', value: 'nominalValue', align: 'center', required: true }, - { text: '幅度单位', value: 'nominalValue', 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: true, width: 340 }, ]) const columns_input_resistance_simulate = ref([ // 输入电阻(模拟示波器) { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '通道', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗单位', value: 'nominalValue', align: 'center', required: true }, - { text: '技术指标', value: 'nominalValue', 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: true, width: 300 }, ]) const columns_risetime_simulate = ref([ // 上升时间(模拟示波器) { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '通道', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗单位', value: 'nominalValue', align: 'center', required: true }, - { text: '触发类型', value: 'nominalValue', align: 'center', required: true }, - { text: '垂直刻度档位', value: 'nominalValue', align: 'center', required: true }, - { text: '垂直刻度档位单位', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值单位', value: 'nominalValue', align: 'center', required: true }, - { text: '扫描上升时间档位', value: 'nominalValue', align: 'center', required: true }, - { text: '扫描上升时间档位单位', value: 'nominalValue', align: 'center', required: true }, - { text: '技术指标', value: 'nominalValue', 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: true, width: '340' }, ]) const columns_calibrating_signal_simulate = ref([ // 校准信号(模拟示波器) { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '信号类型', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗单位', value: 'nominalValue', align: 'center', required: true }, - { text: '幅度标称值', value: 'nominalValue', align: 'center', required: true }, - { text: '幅度标称值单位', value: 'nominalValue', align: 'center', required: true }, - { text: '频率标称值', value: 'nominalValue', align: 'center', required: true }, - { text: '频率标称值单位', value: 'nominalValue', align: 'center', required: true }, - { text: '技术指标', value: 'nominalValue', 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: true, width: '340' }, ]) // --------------------------------表格操作--------------------------------------------------- @@ -294,200 +327,763 @@ * @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: '', // 周期时标信号 - cycleSignalUnit: '', // 周期时标信号单位 - technicalIndex: '', // 技术指标 - 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: '', // 标准值 - standardValueUnit: 'V', // 标准值单位 - technicalIndex: '', // 技术指标 - 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: '', // 标准值 - standardValueUnit: 'V', // 标准值单位 - technicalIndex: '', // 技术指标 - technicalIndexSymbol: '±', // 技术指标前符号 - technicalIndexUnit: '%', // 技术指标单位 - }) - break - case '频带宽度': - list.push({ - id: '', // id,更新/删除使用参数 - dataType: '4', // 检定项数据类型(一个检定项中区分两个表格)(字典code) - itemId: props.itemId, // 检定项id - params: title, // 检定项目 - impedance: '', // 阻抗 - impedanceUnit: 'Ω', // 阻抗单位 - thoroughfare: 'CH1', // 通道 - verticalDeflectCoefficient: '', // 垂直偏转系数 - verticalDeflectCoefficientUnit: 'V', // 垂直偏转系数单位 - horizontalDeflectCoefficient: '', // 水平偏转系数 - horizontalDeflectCoefficientUnit: 'ns', // 水平偏转系数单位 - referencePointFrequency: '', // 参考点频率 - referencePointFrequencyUnit: 'Hz', // 参考点频率单位 - bandWidth: '', // 频带宽度 - bandWidthUnit: 'Hz', // 频带宽度单位 - technicalIndex: '', // 技术指标 - technicalIndexSymbol: '±', // 技术指标前符号 - technicalIndexUnit: 'dB', // 技术指标单位 - }) - break - case '触发灵敏度': - list.push({ - id: '', // id,更新/删除使用参数 - dataType: '5', // 检定项数据类型(一个检定项中区分两个表格)(字典code) - itemId: props.itemId, // 检定项id - params: title, // 检定项目 - thoroughfare: 'CH1', // 通道 - triggerType: '内触发', // 触发类型 - signalFrequency: '', // 信号频率 - signalFrequencyUnit: 'V', // 信号频率单位 - verticalDeflectCoefficient: '', // 垂直偏转系数 - verticalDeflectCoefficientUnit: 'V', // 垂直偏转系数单位 - nominalValue: '', // 标称值 - nominalValueUnit: 'div', // 标称值单位 - technicalIndex: '', // 技术指标 - technicalIndexSymbol: '±', // 技术指标前符号 - technicalIndexUnit: 'dB', // 技术指标单位 - }) - break - case '上升时间': - list.push({ - id: '', // id,更新/删除使用参数 - dataType: '5', // 检定项数据类型(一个检定项中区分两个表格)(字典code) - itemId: props.itemId, // 检定项id - params: title, // 检定项目 - impedance: '', // 阻抗, - impedanceUnit: 'Ω', // 阻抗单位 - thoroughfare: 'CH1', // 通道 - verticalDeflectCoefficient: '', // 垂直偏转系数 - verticalDeflectCoefficientUnit: 'V', // 垂直偏转系数单位 - amplitude: '', // 幅度 - amplitudeUnit: 'V', // 幅度单位 - horizontalDeflectCoefficient: '', // 水平偏转系数单位 - horizontalDeflectCoefficientUnit: 'ns', // 水平偏转系数单位 - technicalIndex: '', // 技术指标 - technicalIndexSymbol: '±', // 技术指标前符号 - technicalIndexUnit: 'ns', // 技术指标单位 - }) - break - case '输入电阻': - list.push({ - id: '', // id,更新/删除使用参数 - dataType: '5', // 检定项数据类型(一个检定项中区分两个表格)(字典code) - itemId: props.itemId, // 检定项id - params: title, // 检定项目 - thoroughfare: 'CH1', // 通道 - verticalDeflectCoefficient: '', // 垂直偏转系数 - verticalDeflectCoefficientUnit: 'V', // 垂直偏转系数单位 - standardValue: '', // 标准值 - technicalIndex: '', // 技术指标 - technicalIndexSymbol: '±', // 技术指标前符号 - technicalIndexUnit: '%', // 技术指标单位 - }) - break - case '校准信号': - - break + 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: '', // 周期时标信号 + cycleSignalUnit: '', // 周期时标信号单位 + technicalIndex: '', // 技术指标 + 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: '', // 标准值 + standardValueUnit: 'V', // 标准值单位 + technicalIndex: '', // 技术指标 + 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: '', // 标准值 + standardValueUnit: 'V', // 标准值单位 + technicalIndex: '', // 技术指标 + 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: '', // 水平偏转系数 + horizontalDeflectCoefficientUnit: 'ns', // 水平偏转系数单位 + referencePointFrequency: '', // 参考点频率 + referencePointFrequencyUnit: 'Hz', // 参考点频率单位 + bandWidth: '', // 频带宽度 + bandWidthUnit: 'Hz', // 频带宽度单位 + technicalIndex: '', // 技术指标 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: 'dB', // 技术指标单位 + }) + break + case '触发灵敏度': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '5', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + thoroughfare: 'CH1', // 通道 + triggerType: '内触发', // 触发类型 + signalFrequency: '', // 信号频率 + signalFrequencyUnit: 'MHz', // 信号频率单位 + verticalDeflectCoefficient: '', // 垂直偏转系数 + verticalDeflectCoefficientUnit: 'V', // 垂直偏转系数单位 + nominalValue: '', // 标称值 + 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: '', // 幅度 + amplitudeUnit: 'V', // 幅度单位 + horizontalDeflectCoefficient: '', // 水平偏转系数单位 + horizontalDeflectCoefficientUnit: 'ns', // 水平偏转系数单位 + technicalIndex: '', // 技术指标 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: 'ns', // 技术指标单位 + }) + break + case '输入电阻': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '7', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + thoroughfare: 'CH1', // 通道 + verticalDeflectCoefficient: '', // 垂直偏转系数 + verticalDeflectCoefficientUnit: 'V', // 垂直偏转系数单位 + standardValue: '', // 标准值 + technicalIndex: '', // 技术指标 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: '%', // 技术指标单位 + }) + break + case '校准信号': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '8', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + itemType: '幅度', // 项目 + nominalValue: '', // 标称值 + nominalValueUnit: 'V', // 垂直标称值单位偏转系数单位 + verticalDeflectionGear: '', // 低电平测量时垂直偏转档位 + 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: '', // 水平刻度档位 + horizontalScaleGearUnit: 'ns', // 水平刻度档位单位 + nominalValue: '', // 标称值 + nominalValueUnit: 'ms', // 标称值单位 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: '%', // 技术指标单位 + technicalIndex: '', // 技术指标单位 + }) + 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: '', // 垂直刻度档位 + verticalScaleGearUnit: 'mV', // 垂直刻度档位单位 + nominalValue: '', // 标称值 + nominalValueUnit: 'mV', // 标称值单位 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: '%', // 技术指标单位 + technicalIndex: '', // 技术指标 + }) + break + case '频带宽度': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '3', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + thoroughfare: 'CH1', // 通道 + impedance: '50', // 阻抗 + impedanceUnit: 'Ω', // 阻抗单位 + referenceFrequency: '', // 基准频率 + referenceFrequencyUnit: 'Hz', // 基准频率单位 + stepFrequency: '', // 步进频率 + stepFrequencyUnit: 'kHz', // 步进频率单位 + verticalScaleGear: '', // 垂直刻度档位 + verticalScaleGearUnit: 'mV', // 垂直刻度档位单位 + verticalGearStep: '1-2-5', // 垂直档位步进 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: 'MHz', // 技术指标单位 + technicalIndex: '', // 技术指标 + }) + break + case '触发特性': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '4', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + scanType: 'A扫描', // 扫描类型 + thoroughfare: 'CH1', // 通道 + impedance: '50', // 阻抗 + impedanceUnit: 'Ω', // 阻抗单位 + triggerType: '内触发', // 触发类型 + frequency: '', // 频率 + frequencyUnit: 'Hz', // 频率单位 + frequencyUpper: '', // 频率上限 + frequencyUpperUnit: 'Hz', // 频率上限单位 + amplitude: '', // 幅度 + amplitudeUnit: 'mV', // 幅度单位 + referenceAmplitude: '100', // 基准幅度 + referenceAmplitudeUnit: 'mV', // 基准幅度单位 + technicalIndexSymbol: '≤', // 技术指标前符号 + technicalIndexUnit: 'mV', // 技术指标单位 + technicalIndex: '', // 技术指标 + }) + break + case '输入电阻': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '5', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + thoroughfare: 'CH1', // 通道 + impedance: '50', // 阻抗 + impedanceUnit: 'Ω', // 阻抗单位 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: '%', // 技术指标单位 + technicalIndex: '', // 技术指标 + }) + break + case '上升时间': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '6', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + thoroughfare: 'CH1', // 通道 + impedance: '50', // 阻抗 + impedanceUnit: 'Ω', // 阻抗单位 + verticalScaleGear: '', // 垂直刻度档位 + verticalScaleGearUnit: 'mV', // 垂直刻度档位单位 + amplitude: '', // 幅度 + amplitudeUnit: 'mV', // 幅度单位 + horizontalScaleGear: '', // 水平刻度档位 + horizontalScaleGearUnit: 'ns', // 水平刻度档位单位 + technicalIndexSymbol: '<', // 技术指标前符号 + technicalIndexUnit: 'ns', // 技术指标单位 + technicalIndex: '', // 技术指标 + }) + break + case '校准信号': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '7', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + signalType: '校准信号1', // 信号类型 + impedance: '50', // 阻抗 + impedanceUnit: 'Ω', // 阻抗单位 + nominalAmplitudeValue: '', // 幅度标称值 + nominalAmplitudeValueUnit: 'mV', // 幅度标称值单位 + nominalFrequencyValue: '', // 频率标称值 + nominalFrequencyValueUnit: 'kHz', // 频率标称值单位 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: '%', // 技术指标单位 + technicalIndex: '', // 技术指标 + }) + break + } } } - // } } /** * 删除行公共方法 * @param checkoutList 选中的数组 * @param list 操作的数组 */ -const delRow = (checkoutList: IList[], list: IList[]) => { +const delRow = (checkoutList: IList[], list: IList[], title: string) => { if (!checkoutList.length) { ElMessage.warning('请选中要删除的行') } else { - list = list.filter((item: any) => { - return !checkoutList.includes(item) - }) + 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 + } + } } } -// ---------------------------------------------校验--------------------------------------------------- -// 校验表格(点击保存的时候用、生成标准器示值) -const checkList = () => { - // return useCheckList(list.value, columns.value, '检定项表格') +// ------------------------------------------校验\保存之前处理数据--------------------------------------------------- +// 增加行校验表格 +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 calculateDataTop = () => { +// 保存之前校验 +const checkListBeforeSave = () => { + // 验空 + if (props.itemCategoryName === '数字示波器' && form.value.timeBase && !timeBaseList.value.length) { // 时基(示波器-数字) + ElMessage.warning('时基 不能为空') + return false + } + else if (props.itemCategoryName === '数字示波器' && form.value.currentGain && !zeroFrequencyGainList.value.length) { // 直流增益(示波器-数字) + ElMessage.warning('直流增益 不能为空') + return false + } + else if (props.itemCategoryName === '数字示波器' && form.value.currentBias && !DCBiasList.value.length) { // 直流偏置(示波器-数字) + ElMessage.warning('直流偏置 不能为空') + return false + } + else if (props.itemCategoryName === '模拟示波器' && form.value.scanTimeCoefficient && !scanningTimeList.value.length) { // 扫描时间系数及扩展(示波器-模拟) + ElMessage.warning('扫描时间系数及扩展 不能为空') + return false + } + else if (props.itemCategoryName === '模拟示波器' && form.value.verticalAmplitude && !verticalSizeList.value.length) { // 垂直幅度 + ElMessage.warning('垂直幅度 不能为空') + return false + } + else if (form.value.bandWidth) { // 频带宽度(示波器-数字/模拟) + if ((props.itemCategoryName === '数字示波器' && !frequencyBandwidthList.value.length) || (props.itemCategoryName === '模拟示波器' && !frequencyBandwidthSimulateList.value.length)) { + ElMessage.warning('频带宽度 不能为空') + return false + } + } + else if (props.itemCategoryName === '模拟示波器' && form.value.triggerCharacter && !triggerCharacteristicList.value.length) { // 触发特性 + ElMessage.warning('触发特性 不能为空') + return false + } + else if (props.itemCategoryName === '数字示波器' && form.value.triggerSensitivity && !triggerSensitivityList.value.length) { // 触发灵敏度 + ElMessage.warning('触发灵敏度 不能为空') + return false + } + else if (form.value.riseTime) { // 上升时间(数字示波器) + if ((props.itemCategoryName === '数字示波器' && !risetimeList.value.length) || (props.itemCategoryName === '模拟示波器' && !risetimeSimulateList.value.length)) { + ElMessage.warning('上升时间 不能为空') + return false + } + } + else if (form.value.inputResistance) { // 输入电阻(数字示波器) + if ((props.itemCategoryName === '数字示波器' && !inputResistanceList.value.length) && (props.itemCategoryName === '模拟示波器' && !inputResistanceSimulateList.value.length)) { + ElMessage.warning('输入电阻 不能为空') + return false + } + } + else if (form.value.calibratingSignal) { // 校准信号(示波器-数字/模拟) + if ((props.itemCategoryName === '数字示波器' && !calibratingSignalList.value.length) && (props.itemCategoryName === '模拟示波器' && !calibratingSignalSimulateList.value.length)) { + ElMessage.warning('校准信号 不能为空') + return false + } + } + console.log('--------1111111') + // 验数据 + 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, '时基') + } + else if (form.value.currentGain) { + currentGainResult = checkList(zeroFrequencyGainList.value, '直流增益') + } + else if (form.value.currentBias) { + currentBiasResult = checkList(DCBiasList.value, '直流偏置') + } + else if (form.value.bandWidth) { + bandWidthResult = checkList(frequencyBandwidthList.value, '频带宽度') + } + else if (form.value.triggerSensitivity) { + triggerSensitivityResult = checkList(triggerSensitivityList.value, '触发灵敏度') + } + else if (form.value.riseTime) { + riseTimeResult = checkList(risetimeList.value, '上升时间') + } + else if (form.value.inputResistance) { + inputResistanceResult = checkList(inputResistanceList.value, '输入电阻') + } + else 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, '扫描时间系数及扩展') + } + else if (form.value.verticalAmplitude) { + verticalAmplitudeResult = checkList(verticalSizeList.value, '垂直幅度') + } + else if (form.value.bandWidth) { + bandWidthResult = checkList(frequencyBandwidthSimulateList.value, '频带宽度') + } + else if (form.value.triggerCharacter) { + triggerCharacterResult = checkList(triggerCharacteristicList.value, '触发特性') + } + else if (form.value.inputResistance) { + inputResistanceResult = checkList(inputResistanceSimulateList.value, '输入电阻') + } + else if (form.value.riseTime) { + riseTimeResult = checkList(risetimeSimulateList.value, '上升时间') + } + else if (form.value.calibratingSignal) { + calibratingSignalResult = checkList(calibratingSignalSimulateList.value, '校准信号') + } + if (scanTimeCoefficientResult && verticalAmplitudeResult && bandWidthResult && triggerCharacterResult && inputResistanceResult && riseTimeResult && calibratingSignalResult + ) { + return true + } + else { + return false + } + } } -// 点击生成辅助接地电阻--下面表格计算 -const calculateDataBottom = () => { +// 保存之前处理数据 +const solveDataBeforeSave = () => { + // 数据处理 + let tempList = [] + 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) => { + return { + ...item, + id: '', + } + }) + return tempList } // ----------------------------------------------------------------------------------------------------- +// 校准信号项目变化 +const changeItemType = (value: string, index: number) => { + if (value === '频率') { + calibratingSignalList.value[index].verticalDeflectionGear = '/' + calibratingSignalList.value[index].verticalDeflectionGearUnit = '/' + } + else { // 幅度 + calibratingSignalList.value[index].verticalDeflectionGear = '' + calibratingSignalList.value[index].verticalDeflectionGearUnit = 'V' + } +} +// 垂直偏转系数变化 +const changeVerticalDeflectCoefficient = (param: { value: string }, type: string) => { + 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) => { + return { + ...item, + standardValue: Number(calc(Number(num), 6, '*')), // 标准值默认为垂直偏转系数*6 + } + }) as any + } + else if (type === '上升时间(数字示波器)') { + risetimeList.value = risetimeList.value.map((item) => { + return { + ...item, + amplitude: Number(calc(Number(num), 5, '*')), // 幅度默认为垂直偏转系数*6 + } + }) 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 => `${item.dataType}` === '1').map((item) => { item.params = '时基'; return item }) // 时基 + zeroFrequencyGainList.value = newVal.filter(item => `${item.dataType}` === '2').map((item) => { item.params = '直流增益'; return item }) // 直流增益 + DCBiasList.value = newVal.filter(item => `${item.dataType}` === '3').map((item) => { item.params = '直流偏置'; return item }) // 直流偏置 + frequencyBandwidthList.value = newVal.filter(item => `${item.dataType}` === '4').map((item) => { item.params = '频带宽度'; return item }) // 频带宽度(数字示波器) + triggerSensitivityList.value = newVal.filter(item => `${item.dataType}` === '5').map((item) => { item.params = '触发灵敏度'; return item })// 触发灵敏度 + risetimeList.value = newVal.filter(item => `${item.dataType}` === '6').map((item) => { item.params = '上升时间'; return item })// 上升时间(数字示波器) + inputResistanceList.value = newVal.filter(item => `${item.dataType}` === '7').map((item) => { item.params = '输入电阻'; return item })// 输入电阻(数字示波器) + calibratingSignalList.value = newVal.filter(item => `${item.dataType}` === '8').map((item) => { item.params = '校准信号'; return item })// 校准信号(数字示波器) + if (timeBaseList.value.length) { + form.value.methodType = timeBaseList.value[0].methodType // 时基方法 + } + } + else if (props.itemCategoryName === '模拟示波器') { + scanningTimeList.value = newVal.filter(item => `${item.dataType}` === '1').map((item) => { item.params = '扫描时间系数及扩展'; return item }) // 扫描时间系数及扩展 + verticalSizeList.value = newVal.filter(item => `${item.dataType}` === '2').map((item) => { item.params = '垂直幅度'; return item }) // 垂直幅度 + frequencyBandwidthSimulateList.value = newVal.filter(item => `${item.dataType}` === '3').map((item) => { item.params = '频带宽度'; return item }) // 频带宽度(模拟示波器 + triggerCharacteristicList.value = newVal.filter(item => `${item.dataType}` === '4').map((item) => { item.params = '触发特性'; return item }) // 触发特性 + inputResistanceSimulateList.value = newVal.filter(item => `${item.dataType}` === '5').map((item) => { item.params = '输入电阻'; return item })// 输入电阻 + risetimeSimulateList.value = newVal.filter(item => `${item.dataType}` === '6').map((item) => { item.params = '上升时间'; return item })// 上升时间(数字示波器) + calibratingSignalSimulateList.value = newVal.filter(item => `${item.dataType}` === '7').map((item) => { item.params = '校准信号'; return item })// 校准信号(数字示波器) + } + } +}) -// watch(() => props.list, (newVal) => { // 检定项表格 -// if (newVal) { -// list.value = [...newVal] -// } -// }) +watch(() => props.form, (newValue) => { + 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({ list }) +defineExpose({ checkListBeforeSave, solveDataBeforeSave, form }) diff --git a/src/views/business/measure/item/components/thirteenth/templateTable.vue b/src/views/business/measure/item/components/thirteenth/templateTable.vue index a210821..b645ba7 100644 --- a/src/views/business/measure/item/components/thirteenth/templateTable.vue +++ b/src/views/business/measure/item/components/thirteenth/templateTable.vue @@ -6,7 +6,7 @@ import { getDictByCode } from '@/api/system/dict' import type { dictType } from '@/global' -// ------------------定义props、 emit------------------- +// ------------------定义props、 emits------------------- const props = defineProps({ pageType: { type: String, @@ -40,7 +40,17 @@ }, // 表格大小,默认,small,mini等,与el-table条件相同 type: String, // 表格类型,表格title }) -const emit = defineEmits(['change', 'selectionChange', 'rowClick', 'rowDbClick', 'multiSelect', 'filterChange']) +const emits = defineEmits([ + 'change', + 'selectionChange', + 'rowClick', + 'rowDbClick', + 'multiSelect', + 'filterChange', + 'changeItemType', + 'changeVerticalDeflectCoefficient', + 'changeInputNumber', +]) // ------------------------------------------字典---------------------------------------------- const standardTechnicalIndexSymbolList = ref([]) // 技术指标规则 const standard13ThoroughfareList = ref([]) // 通道 @@ -51,7 +61,12 @@ const standard13TriggerTypeList = ref([]) // 触发特性 const standard13NominalValueUnitList = ref([]) // 标称值单位 const standardAmplitudeUnitList = ref([]) // 幅度单位 - +const standard13ItemList = ref([]) // 校准信号--项目 +const standard13ScanTypeList = ref([]) // 扫描方式 +const standard13VerticalGearStepList = ref([]) // 垂直档位步进 +const standardFrequencyUnitList = ref([]) // 频率单位-公用 +const characteristicAmplitudeUnitList = ref([]) // 触发特性-公用 +const standard13SignalTypeList = ref([]) // 信号类型 /** * 获取字典 */ @@ -72,7 +87,7 @@ getDictByCode('standard13VerticalDeflectCoefficient').then((response) => { standard13VerticalDeflectCoefficientList.value = response.data }) - // 垂直偏转系数(/div)单位\电压单位--公用 + // 电压单位--公用/垂直偏转系数(/div)单位 getDictByCode('standardVoltage').then((response) => { standardVoltageList.value = response.data }) @@ -96,7 +111,30 @@ getDictByCode('standardAmplitudeUnit').then((response) => { standardAmplitudeUnitList.value = response.data }) - // standard13Item + // 校准信号--项目 + getDictByCode('standard13Item').then((response) => { + standard13ItemList.value = response.data + }) + // 扫描方式 + getDictByCode('standard13ScanType').then((response) => { + standard13ScanTypeList.value = response.data + }) + // 垂直档位步进 + getDictByCode('standard13VerticalGearStep').then((response) => { + standard13VerticalGearStepList.value = response.data + }) + // 频率单位公用 + getDictByCode('standardFrequencyUnit').then((response) => { + standardFrequencyUnitList.value = response.data + }) + // 触发特性幅度单位 + getDictByCode('characteristicAmplitudeUnit').then((response) => { + characteristicAmplitudeUnitList.value = response.data + }) + // 信号类型 + getDictByCode('standard13SignalType').then((response) => { + standard13SignalTypeList.value = response.data + }) } getDict() @@ -129,16 +167,16 @@ } // 刷新 function refresh() { - emit('change') + emits('change') } // 点击行 function rowClick(row: object, column?: any, event?: any) { - emit('rowClick', row) + emits('rowClick', row) } // 双击行 function rowDbClick(row: object, column?: any, event?: any) { - emit('rowDbClick', row) + emits('rowDbClick', row) } // 监听columns watch(props.columns, (val) => { @@ -147,7 +185,7 @@ }) // 多选 const handleSelectionChange = (val: any) => { - emit('selectionChange', val) + emits('selectionChange', val) } // 清除多选选中 const clearMulti = () => { @@ -155,6 +193,20 @@ table.value!.clearSelection() singleChecked.value = '' } + +// 项目选择变化 +const changeItemType = (value: string, index: number) => { + emits('changeItemType', value, index) +} +// 垂直偏转系数变化 +const changeVerticalDeflectCoefficient = (value: string) => { + emits('changeVerticalDeflectCoefficient', value) +} + +const changeInputNumber = (value: number) => { + emits('changeInputNumber', value) +} + defineExpose({ clearMulti, initColumnsState, }) @@ -210,11 +262,13 @@ />
{{ scope.row.technicalIndexUnit }}
+ + + + + + + + + + + + @@ -240,16 +315,22 @@ v-if="item.value === 'cycleSignal' || item.value === 'standardValue' || item.value === 'referencePointFrequency' || item.value === 'bandWidth' || item.value === 'horizontalDeflectCoefficient' || item.value === 'referencePointFrequency' || item.value === 'bandWidth' - || item.value === 'nominalValue' || item.value === 'signalFrequency' || item.value === 'amplitude'" + || item.value === 'nominalValue' || item.value === 'signalFrequency' || item.value === 'amplitude' + || (item.value === 'verticalDeflectionGear' && scope.row.itemType === '幅度') || item.value === 'horizontalScaleGear' + || item.value === 'verticalScaleGear' || item.value === 'frequency' || item.value === 'referenceFrequency' + || item.value === 'stepFrequency' || item.value === 'frequencyUpper' || item.value === 'referenceAmplitude' + || item.value === 'nominalAmplitudeValue' || item.value === 'nominalFrequencyValue'" v-model="scope.row[item.value]" :placeholder="`${item.text}`" class="full-width-input" :disabled="props.pageType === 'detail'" + @change="changeInputNumber" /> - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/components/SelectByDict/index.vue b/src/components/SelectByDict/index.vue index 20a7e0c..83fc909 100644 --- a/src/components/SelectByDict/index.vue +++ b/src/components/SelectByDict/index.vue @@ -24,7 +24,7 @@ required: true, }, }) -const emit = defineEmits(['update:modelValue', 'getDictValue']) +const emit = defineEmits(['update:modelValue', 'getDictValue', 'changeValue']) const checkItem = ref({}) // 选中的选项 const input = ref() // 输入框组件 // -------------------------定义数据-------------------- @@ -91,6 +91,7 @@ const data = dictList.value.filter(item => item.name === inputValue).length if (!data) { console.log(inputValue, '该值不存在添加字典') + emit('changeValue', inputValue) // 在字典中添加该值 getDictAllList().then((res) => { const currentDict = res.data.filter(item => item.code === props.dictCode)[0] @@ -124,6 +125,7 @@ } else { console.log(inputValue, '该值存在') + emit('changeValue', inputValue) // 发送 绑定的value (可用可不用) emit('getDictValue', dictList.value.filter(item => item.name === inputValue)[0].value1) // setTimeout(() => { diff --git a/src/views/business/measure/item/components/thirteenth/templateDetail-interface.ts b/src/views/business/measure/item/components/thirteenth/templateDetail-interface.ts index 7662387..708ffd9 100644 --- a/src/views/business/measure/item/components/thirteenth/templateDetail-interface.ts +++ b/src/views/business/measure/item/components/thirteenth/templateDetail-interface.ts @@ -34,6 +34,8 @@ amplitude?: string // 幅度 amplitudeUnit?: string // 幅度单位 + verticalDeflectionGear?: string // 低电平测量时垂直偏转档位 + verticalDeflectionGearUnit?: string // 低电平测量时垂直偏转档位单位 frequency?: string // 频率(模拟示波器) frequencyUnit?: string // 频率单位(模拟示波器) @@ -54,8 +56,6 @@ signalType?: string // 信号类型(模拟示波器)(字典value) stepFrequency?: string // 步进频率(模拟示波器) stepFrequencyUnit?: string // 步进频率单位(模拟示波器) - verticalDeflectionGear?: string // 低电平测量时垂直偏转档位 - verticalDeflectionGearUnit?: string // 低电平测量时垂直偏转档位单位 verticalGearStep?: string // 垂直档位步进(模拟示波器) verticalScaleGear?: string // 垂直刻度档位(模拟示波器) verticalScaleGearUnit?: string // 垂直刻度档位单位(模拟示波器) diff --git a/src/views/business/measure/item/components/thirteenth/templateDetail.vue b/src/views/business/measure/item/components/thirteenth/templateDetail.vue index cb67fcf..b43e364 100644 --- a/src/views/business/measure/item/components/thirteenth/templateDetail.vue +++ b/src/views/business/measure/item/components/thirteenth/templateDetail.vue @@ -9,6 +9,8 @@ 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: { @@ -37,6 +39,18 @@ 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) @@ -144,8 +158,8 @@ const columns_input_resistance = ref([ // 输入电阻(数字示波器) { text: '检定项目', value: 'params', align: 'center', required: true }, { text: '通道', value: 'thoroughfare', 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: '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: true, width: 300 }, @@ -153,87 +167,106 @@ const columns_calibrating_signal = ref([ // 校准信号(数字示波器) { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '项目', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值单位', value: 'nominalValue', 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([ // 扫描时间系数及扩展 { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '扫描方式', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗单位', value: 'nominalValue', align: 'center', required: true }, - { text: '步进', value: 'nominalValue', align: 'center', required: true }, - { text: '水平刻度档位', value: 'nominalValue', align: 'center', required: true }, - { text: '水平刻度档位单位', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值单位', value: 'nominalValue', align: 'center', required: true }, - { text: '技术指标', value: 'nominalValue', 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: true, width: '300' }, ]) const columns_vertical_size = ref([ // 垂直幅度 { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '通道', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗单位', value: 'nominalValue', align: 'center', required: true }, - { text: '频率', value: 'nominalValue', align: 'center', required: true }, - { text: '频率单位', value: 'nominalValue', align: 'center', required: true }, - { text: '步进', value: 'nominalValue', align: 'center', required: true }, - { text: '垂直刻度档位', value: 'nominalValue', align: 'center', required: true }, - { text: '垂直刻度档位单位', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值单位', value: 'nominalValue', align: 'center', required: true }, - { text: '技术指标', value: 'nominalValue', 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: true, width: '300' }, +]) + +const columns_frequency_bandwidth_simulate = ref([ // 频带宽度(模拟示波器) + { 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: true, width: 340 }, ]) const columns_trigger_characteristic = ref([ // 触发特性 { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '扫描方式', value: 'nominalValue', align: 'center', required: true }, - { text: '通道', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗单位', value: 'nominalValue', align: 'center', required: true }, - { text: '触发类型', value: 'nominalValue', align: 'center', required: true }, - { text: '频率', value: 'nominalValue', align: 'center', required: true }, - { text: '频率单位', value: 'nominalValue', align: 'center', required: true }, - { text: '频率上限', value: 'nominalValue', align: 'center', required: true }, - { text: '频率上限单位', value: 'nominalValue', align: 'center', required: true }, - { text: '幅度', value: 'nominalValue', align: 'center', required: true }, - { text: '幅度单位', value: 'nominalValue', 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: true, width: 340 }, ]) const columns_input_resistance_simulate = ref([ // 输入电阻(模拟示波器) { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '通道', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗单位', value: 'nominalValue', align: 'center', required: true }, - { text: '技术指标', value: 'nominalValue', 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: true, width: 300 }, ]) const columns_risetime_simulate = ref([ // 上升时间(模拟示波器) { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '通道', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗单位', value: 'nominalValue', align: 'center', required: true }, - { text: '触发类型', value: 'nominalValue', align: 'center', required: true }, - { text: '垂直刻度档位', value: 'nominalValue', align: 'center', required: true }, - { text: '垂直刻度档位单位', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值单位', value: 'nominalValue', align: 'center', required: true }, - { text: '扫描上升时间档位', value: 'nominalValue', align: 'center', required: true }, - { text: '扫描上升时间档位单位', value: 'nominalValue', align: 'center', required: true }, - { text: '技术指标', value: 'nominalValue', 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: true, width: '340' }, ]) const columns_calibrating_signal_simulate = ref([ // 校准信号(模拟示波器) { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '信号类型', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗单位', value: 'nominalValue', align: 'center', required: true }, - { text: '幅度标称值', value: 'nominalValue', align: 'center', required: true }, - { text: '幅度标称值单位', value: 'nominalValue', align: 'center', required: true }, - { text: '频率标称值', value: 'nominalValue', align: 'center', required: true }, - { text: '频率标称值单位', value: 'nominalValue', align: 'center', required: true }, - { text: '技术指标', value: 'nominalValue', 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: true, width: '340' }, ]) // --------------------------------表格操作--------------------------------------------------- @@ -294,200 +327,763 @@ * @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: '', // 周期时标信号 - cycleSignalUnit: '', // 周期时标信号单位 - technicalIndex: '', // 技术指标 - 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: '', // 标准值 - standardValueUnit: 'V', // 标准值单位 - technicalIndex: '', // 技术指标 - 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: '', // 标准值 - standardValueUnit: 'V', // 标准值单位 - technicalIndex: '', // 技术指标 - technicalIndexSymbol: '±', // 技术指标前符号 - technicalIndexUnit: '%', // 技术指标单位 - }) - break - case '频带宽度': - list.push({ - id: '', // id,更新/删除使用参数 - dataType: '4', // 检定项数据类型(一个检定项中区分两个表格)(字典code) - itemId: props.itemId, // 检定项id - params: title, // 检定项目 - impedance: '', // 阻抗 - impedanceUnit: 'Ω', // 阻抗单位 - thoroughfare: 'CH1', // 通道 - verticalDeflectCoefficient: '', // 垂直偏转系数 - verticalDeflectCoefficientUnit: 'V', // 垂直偏转系数单位 - horizontalDeflectCoefficient: '', // 水平偏转系数 - horizontalDeflectCoefficientUnit: 'ns', // 水平偏转系数单位 - referencePointFrequency: '', // 参考点频率 - referencePointFrequencyUnit: 'Hz', // 参考点频率单位 - bandWidth: '', // 频带宽度 - bandWidthUnit: 'Hz', // 频带宽度单位 - technicalIndex: '', // 技术指标 - technicalIndexSymbol: '±', // 技术指标前符号 - technicalIndexUnit: 'dB', // 技术指标单位 - }) - break - case '触发灵敏度': - list.push({ - id: '', // id,更新/删除使用参数 - dataType: '5', // 检定项数据类型(一个检定项中区分两个表格)(字典code) - itemId: props.itemId, // 检定项id - params: title, // 检定项目 - thoroughfare: 'CH1', // 通道 - triggerType: '内触发', // 触发类型 - signalFrequency: '', // 信号频率 - signalFrequencyUnit: 'V', // 信号频率单位 - verticalDeflectCoefficient: '', // 垂直偏转系数 - verticalDeflectCoefficientUnit: 'V', // 垂直偏转系数单位 - nominalValue: '', // 标称值 - nominalValueUnit: 'div', // 标称值单位 - technicalIndex: '', // 技术指标 - technicalIndexSymbol: '±', // 技术指标前符号 - technicalIndexUnit: 'dB', // 技术指标单位 - }) - break - case '上升时间': - list.push({ - id: '', // id,更新/删除使用参数 - dataType: '5', // 检定项数据类型(一个检定项中区分两个表格)(字典code) - itemId: props.itemId, // 检定项id - params: title, // 检定项目 - impedance: '', // 阻抗, - impedanceUnit: 'Ω', // 阻抗单位 - thoroughfare: 'CH1', // 通道 - verticalDeflectCoefficient: '', // 垂直偏转系数 - verticalDeflectCoefficientUnit: 'V', // 垂直偏转系数单位 - amplitude: '', // 幅度 - amplitudeUnit: 'V', // 幅度单位 - horizontalDeflectCoefficient: '', // 水平偏转系数单位 - horizontalDeflectCoefficientUnit: 'ns', // 水平偏转系数单位 - technicalIndex: '', // 技术指标 - technicalIndexSymbol: '±', // 技术指标前符号 - technicalIndexUnit: 'ns', // 技术指标单位 - }) - break - case '输入电阻': - list.push({ - id: '', // id,更新/删除使用参数 - dataType: '5', // 检定项数据类型(一个检定项中区分两个表格)(字典code) - itemId: props.itemId, // 检定项id - params: title, // 检定项目 - thoroughfare: 'CH1', // 通道 - verticalDeflectCoefficient: '', // 垂直偏转系数 - verticalDeflectCoefficientUnit: 'V', // 垂直偏转系数单位 - standardValue: '', // 标准值 - technicalIndex: '', // 技术指标 - technicalIndexSymbol: '±', // 技术指标前符号 - technicalIndexUnit: '%', // 技术指标单位 - }) - break - case '校准信号': - - break + 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: '', // 周期时标信号 + cycleSignalUnit: '', // 周期时标信号单位 + technicalIndex: '', // 技术指标 + 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: '', // 标准值 + standardValueUnit: 'V', // 标准值单位 + technicalIndex: '', // 技术指标 + 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: '', // 标准值 + standardValueUnit: 'V', // 标准值单位 + technicalIndex: '', // 技术指标 + 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: '', // 水平偏转系数 + horizontalDeflectCoefficientUnit: 'ns', // 水平偏转系数单位 + referencePointFrequency: '', // 参考点频率 + referencePointFrequencyUnit: 'Hz', // 参考点频率单位 + bandWidth: '', // 频带宽度 + bandWidthUnit: 'Hz', // 频带宽度单位 + technicalIndex: '', // 技术指标 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: 'dB', // 技术指标单位 + }) + break + case '触发灵敏度': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '5', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + thoroughfare: 'CH1', // 通道 + triggerType: '内触发', // 触发类型 + signalFrequency: '', // 信号频率 + signalFrequencyUnit: 'MHz', // 信号频率单位 + verticalDeflectCoefficient: '', // 垂直偏转系数 + verticalDeflectCoefficientUnit: 'V', // 垂直偏转系数单位 + nominalValue: '', // 标称值 + 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: '', // 幅度 + amplitudeUnit: 'V', // 幅度单位 + horizontalDeflectCoefficient: '', // 水平偏转系数单位 + horizontalDeflectCoefficientUnit: 'ns', // 水平偏转系数单位 + technicalIndex: '', // 技术指标 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: 'ns', // 技术指标单位 + }) + break + case '输入电阻': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '7', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + thoroughfare: 'CH1', // 通道 + verticalDeflectCoefficient: '', // 垂直偏转系数 + verticalDeflectCoefficientUnit: 'V', // 垂直偏转系数单位 + standardValue: '', // 标准值 + technicalIndex: '', // 技术指标 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: '%', // 技术指标单位 + }) + break + case '校准信号': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '8', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + itemType: '幅度', // 项目 + nominalValue: '', // 标称值 + nominalValueUnit: 'V', // 垂直标称值单位偏转系数单位 + verticalDeflectionGear: '', // 低电平测量时垂直偏转档位 + 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: '', // 水平刻度档位 + horizontalScaleGearUnit: 'ns', // 水平刻度档位单位 + nominalValue: '', // 标称值 + nominalValueUnit: 'ms', // 标称值单位 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: '%', // 技术指标单位 + technicalIndex: '', // 技术指标单位 + }) + 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: '', // 垂直刻度档位 + verticalScaleGearUnit: 'mV', // 垂直刻度档位单位 + nominalValue: '', // 标称值 + nominalValueUnit: 'mV', // 标称值单位 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: '%', // 技术指标单位 + technicalIndex: '', // 技术指标 + }) + break + case '频带宽度': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '3', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + thoroughfare: 'CH1', // 通道 + impedance: '50', // 阻抗 + impedanceUnit: 'Ω', // 阻抗单位 + referenceFrequency: '', // 基准频率 + referenceFrequencyUnit: 'Hz', // 基准频率单位 + stepFrequency: '', // 步进频率 + stepFrequencyUnit: 'kHz', // 步进频率单位 + verticalScaleGear: '', // 垂直刻度档位 + verticalScaleGearUnit: 'mV', // 垂直刻度档位单位 + verticalGearStep: '1-2-5', // 垂直档位步进 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: 'MHz', // 技术指标单位 + technicalIndex: '', // 技术指标 + }) + break + case '触发特性': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '4', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + scanType: 'A扫描', // 扫描类型 + thoroughfare: 'CH1', // 通道 + impedance: '50', // 阻抗 + impedanceUnit: 'Ω', // 阻抗单位 + triggerType: '内触发', // 触发类型 + frequency: '', // 频率 + frequencyUnit: 'Hz', // 频率单位 + frequencyUpper: '', // 频率上限 + frequencyUpperUnit: 'Hz', // 频率上限单位 + amplitude: '', // 幅度 + amplitudeUnit: 'mV', // 幅度单位 + referenceAmplitude: '100', // 基准幅度 + referenceAmplitudeUnit: 'mV', // 基准幅度单位 + technicalIndexSymbol: '≤', // 技术指标前符号 + technicalIndexUnit: 'mV', // 技术指标单位 + technicalIndex: '', // 技术指标 + }) + break + case '输入电阻': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '5', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + thoroughfare: 'CH1', // 通道 + impedance: '50', // 阻抗 + impedanceUnit: 'Ω', // 阻抗单位 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: '%', // 技术指标单位 + technicalIndex: '', // 技术指标 + }) + break + case '上升时间': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '6', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + thoroughfare: 'CH1', // 通道 + impedance: '50', // 阻抗 + impedanceUnit: 'Ω', // 阻抗单位 + verticalScaleGear: '', // 垂直刻度档位 + verticalScaleGearUnit: 'mV', // 垂直刻度档位单位 + amplitude: '', // 幅度 + amplitudeUnit: 'mV', // 幅度单位 + horizontalScaleGear: '', // 水平刻度档位 + horizontalScaleGearUnit: 'ns', // 水平刻度档位单位 + technicalIndexSymbol: '<', // 技术指标前符号 + technicalIndexUnit: 'ns', // 技术指标单位 + technicalIndex: '', // 技术指标 + }) + break + case '校准信号': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '7', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + signalType: '校准信号1', // 信号类型 + impedance: '50', // 阻抗 + impedanceUnit: 'Ω', // 阻抗单位 + nominalAmplitudeValue: '', // 幅度标称值 + nominalAmplitudeValueUnit: 'mV', // 幅度标称值单位 + nominalFrequencyValue: '', // 频率标称值 + nominalFrequencyValueUnit: 'kHz', // 频率标称值单位 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: '%', // 技术指标单位 + technicalIndex: '', // 技术指标 + }) + break + } } } - // } } /** * 删除行公共方法 * @param checkoutList 选中的数组 * @param list 操作的数组 */ -const delRow = (checkoutList: IList[], list: IList[]) => { +const delRow = (checkoutList: IList[], list: IList[], title: string) => { if (!checkoutList.length) { ElMessage.warning('请选中要删除的行') } else { - list = list.filter((item: any) => { - return !checkoutList.includes(item) - }) + 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 + } + } } } -// ---------------------------------------------校验--------------------------------------------------- -// 校验表格(点击保存的时候用、生成标准器示值) -const checkList = () => { - // return useCheckList(list.value, columns.value, '检定项表格') +// ------------------------------------------校验\保存之前处理数据--------------------------------------------------- +// 增加行校验表格 +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 calculateDataTop = () => { +// 保存之前校验 +const checkListBeforeSave = () => { + // 验空 + if (props.itemCategoryName === '数字示波器' && form.value.timeBase && !timeBaseList.value.length) { // 时基(示波器-数字) + ElMessage.warning('时基 不能为空') + return false + } + else if (props.itemCategoryName === '数字示波器' && form.value.currentGain && !zeroFrequencyGainList.value.length) { // 直流增益(示波器-数字) + ElMessage.warning('直流增益 不能为空') + return false + } + else if (props.itemCategoryName === '数字示波器' && form.value.currentBias && !DCBiasList.value.length) { // 直流偏置(示波器-数字) + ElMessage.warning('直流偏置 不能为空') + return false + } + else if (props.itemCategoryName === '模拟示波器' && form.value.scanTimeCoefficient && !scanningTimeList.value.length) { // 扫描时间系数及扩展(示波器-模拟) + ElMessage.warning('扫描时间系数及扩展 不能为空') + return false + } + else if (props.itemCategoryName === '模拟示波器' && form.value.verticalAmplitude && !verticalSizeList.value.length) { // 垂直幅度 + ElMessage.warning('垂直幅度 不能为空') + return false + } + else if (form.value.bandWidth) { // 频带宽度(示波器-数字/模拟) + if ((props.itemCategoryName === '数字示波器' && !frequencyBandwidthList.value.length) || (props.itemCategoryName === '模拟示波器' && !frequencyBandwidthSimulateList.value.length)) { + ElMessage.warning('频带宽度 不能为空') + return false + } + } + else if (props.itemCategoryName === '模拟示波器' && form.value.triggerCharacter && !triggerCharacteristicList.value.length) { // 触发特性 + ElMessage.warning('触发特性 不能为空') + return false + } + else if (props.itemCategoryName === '数字示波器' && form.value.triggerSensitivity && !triggerSensitivityList.value.length) { // 触发灵敏度 + ElMessage.warning('触发灵敏度 不能为空') + return false + } + else if (form.value.riseTime) { // 上升时间(数字示波器) + if ((props.itemCategoryName === '数字示波器' && !risetimeList.value.length) || (props.itemCategoryName === '模拟示波器' && !risetimeSimulateList.value.length)) { + ElMessage.warning('上升时间 不能为空') + return false + } + } + else if (form.value.inputResistance) { // 输入电阻(数字示波器) + if ((props.itemCategoryName === '数字示波器' && !inputResistanceList.value.length) && (props.itemCategoryName === '模拟示波器' && !inputResistanceSimulateList.value.length)) { + ElMessage.warning('输入电阻 不能为空') + return false + } + } + else if (form.value.calibratingSignal) { // 校准信号(示波器-数字/模拟) + if ((props.itemCategoryName === '数字示波器' && !calibratingSignalList.value.length) && (props.itemCategoryName === '模拟示波器' && !calibratingSignalSimulateList.value.length)) { + ElMessage.warning('校准信号 不能为空') + return false + } + } + console.log('--------1111111') + // 验数据 + 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, '时基') + } + else if (form.value.currentGain) { + currentGainResult = checkList(zeroFrequencyGainList.value, '直流增益') + } + else if (form.value.currentBias) { + currentBiasResult = checkList(DCBiasList.value, '直流偏置') + } + else if (form.value.bandWidth) { + bandWidthResult = checkList(frequencyBandwidthList.value, '频带宽度') + } + else if (form.value.triggerSensitivity) { + triggerSensitivityResult = checkList(triggerSensitivityList.value, '触发灵敏度') + } + else if (form.value.riseTime) { + riseTimeResult = checkList(risetimeList.value, '上升时间') + } + else if (form.value.inputResistance) { + inputResistanceResult = checkList(inputResistanceList.value, '输入电阻') + } + else 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, '扫描时间系数及扩展') + } + else if (form.value.verticalAmplitude) { + verticalAmplitudeResult = checkList(verticalSizeList.value, '垂直幅度') + } + else if (form.value.bandWidth) { + bandWidthResult = checkList(frequencyBandwidthSimulateList.value, '频带宽度') + } + else if (form.value.triggerCharacter) { + triggerCharacterResult = checkList(triggerCharacteristicList.value, '触发特性') + } + else if (form.value.inputResistance) { + inputResistanceResult = checkList(inputResistanceSimulateList.value, '输入电阻') + } + else if (form.value.riseTime) { + riseTimeResult = checkList(risetimeSimulateList.value, '上升时间') + } + else if (form.value.calibratingSignal) { + calibratingSignalResult = checkList(calibratingSignalSimulateList.value, '校准信号') + } + if (scanTimeCoefficientResult && verticalAmplitudeResult && bandWidthResult && triggerCharacterResult && inputResistanceResult && riseTimeResult && calibratingSignalResult + ) { + return true + } + else { + return false + } + } } -// 点击生成辅助接地电阻--下面表格计算 -const calculateDataBottom = () => { +// 保存之前处理数据 +const solveDataBeforeSave = () => { + // 数据处理 + let tempList = [] + 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) => { + return { + ...item, + id: '', + } + }) + return tempList } // ----------------------------------------------------------------------------------------------------- +// 校准信号项目变化 +const changeItemType = (value: string, index: number) => { + if (value === '频率') { + calibratingSignalList.value[index].verticalDeflectionGear = '/' + calibratingSignalList.value[index].verticalDeflectionGearUnit = '/' + } + else { // 幅度 + calibratingSignalList.value[index].verticalDeflectionGear = '' + calibratingSignalList.value[index].verticalDeflectionGearUnit = 'V' + } +} +// 垂直偏转系数变化 +const changeVerticalDeflectCoefficient = (param: { value: string }, type: string) => { + 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) => { + return { + ...item, + standardValue: Number(calc(Number(num), 6, '*')), // 标准值默认为垂直偏转系数*6 + } + }) as any + } + else if (type === '上升时间(数字示波器)') { + risetimeList.value = risetimeList.value.map((item) => { + return { + ...item, + amplitude: Number(calc(Number(num), 5, '*')), // 幅度默认为垂直偏转系数*6 + } + }) 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 => `${item.dataType}` === '1').map((item) => { item.params = '时基'; return item }) // 时基 + zeroFrequencyGainList.value = newVal.filter(item => `${item.dataType}` === '2').map((item) => { item.params = '直流增益'; return item }) // 直流增益 + DCBiasList.value = newVal.filter(item => `${item.dataType}` === '3').map((item) => { item.params = '直流偏置'; return item }) // 直流偏置 + frequencyBandwidthList.value = newVal.filter(item => `${item.dataType}` === '4').map((item) => { item.params = '频带宽度'; return item }) // 频带宽度(数字示波器) + triggerSensitivityList.value = newVal.filter(item => `${item.dataType}` === '5').map((item) => { item.params = '触发灵敏度'; return item })// 触发灵敏度 + risetimeList.value = newVal.filter(item => `${item.dataType}` === '6').map((item) => { item.params = '上升时间'; return item })// 上升时间(数字示波器) + inputResistanceList.value = newVal.filter(item => `${item.dataType}` === '7').map((item) => { item.params = '输入电阻'; return item })// 输入电阻(数字示波器) + calibratingSignalList.value = newVal.filter(item => `${item.dataType}` === '8').map((item) => { item.params = '校准信号'; return item })// 校准信号(数字示波器) + if (timeBaseList.value.length) { + form.value.methodType = timeBaseList.value[0].methodType // 时基方法 + } + } + else if (props.itemCategoryName === '模拟示波器') { + scanningTimeList.value = newVal.filter(item => `${item.dataType}` === '1').map((item) => { item.params = '扫描时间系数及扩展'; return item }) // 扫描时间系数及扩展 + verticalSizeList.value = newVal.filter(item => `${item.dataType}` === '2').map((item) => { item.params = '垂直幅度'; return item }) // 垂直幅度 + frequencyBandwidthSimulateList.value = newVal.filter(item => `${item.dataType}` === '3').map((item) => { item.params = '频带宽度'; return item }) // 频带宽度(模拟示波器 + triggerCharacteristicList.value = newVal.filter(item => `${item.dataType}` === '4').map((item) => { item.params = '触发特性'; return item }) // 触发特性 + inputResistanceSimulateList.value = newVal.filter(item => `${item.dataType}` === '5').map((item) => { item.params = '输入电阻'; return item })// 输入电阻 + risetimeSimulateList.value = newVal.filter(item => `${item.dataType}` === '6').map((item) => { item.params = '上升时间'; return item })// 上升时间(数字示波器) + calibratingSignalSimulateList.value = newVal.filter(item => `${item.dataType}` === '7').map((item) => { item.params = '校准信号'; return item })// 校准信号(数字示波器) + } + } +}) -// watch(() => props.list, (newVal) => { // 检定项表格 -// if (newVal) { -// list.value = [...newVal] -// } -// }) +watch(() => props.form, (newValue) => { + 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({ list }) +defineExpose({ checkListBeforeSave, solveDataBeforeSave, form }) diff --git a/src/views/business/measure/item/components/thirteenth/templateTable.vue b/src/views/business/measure/item/components/thirteenth/templateTable.vue index a210821..b645ba7 100644 --- a/src/views/business/measure/item/components/thirteenth/templateTable.vue +++ b/src/views/business/measure/item/components/thirteenth/templateTable.vue @@ -6,7 +6,7 @@ import { getDictByCode } from '@/api/system/dict' import type { dictType } from '@/global' -// ------------------定义props、 emit------------------- +// ------------------定义props、 emits------------------- const props = defineProps({ pageType: { type: String, @@ -40,7 +40,17 @@ }, // 表格大小,默认,small,mini等,与el-table条件相同 type: String, // 表格类型,表格title }) -const emit = defineEmits(['change', 'selectionChange', 'rowClick', 'rowDbClick', 'multiSelect', 'filterChange']) +const emits = defineEmits([ + 'change', + 'selectionChange', + 'rowClick', + 'rowDbClick', + 'multiSelect', + 'filterChange', + 'changeItemType', + 'changeVerticalDeflectCoefficient', + 'changeInputNumber', +]) // ------------------------------------------字典---------------------------------------------- const standardTechnicalIndexSymbolList = ref([]) // 技术指标规则 const standard13ThoroughfareList = ref([]) // 通道 @@ -51,7 +61,12 @@ const standard13TriggerTypeList = ref([]) // 触发特性 const standard13NominalValueUnitList = ref([]) // 标称值单位 const standardAmplitudeUnitList = ref([]) // 幅度单位 - +const standard13ItemList = ref([]) // 校准信号--项目 +const standard13ScanTypeList = ref([]) // 扫描方式 +const standard13VerticalGearStepList = ref([]) // 垂直档位步进 +const standardFrequencyUnitList = ref([]) // 频率单位-公用 +const characteristicAmplitudeUnitList = ref([]) // 触发特性-公用 +const standard13SignalTypeList = ref([]) // 信号类型 /** * 获取字典 */ @@ -72,7 +87,7 @@ getDictByCode('standard13VerticalDeflectCoefficient').then((response) => { standard13VerticalDeflectCoefficientList.value = response.data }) - // 垂直偏转系数(/div)单位\电压单位--公用 + // 电压单位--公用/垂直偏转系数(/div)单位 getDictByCode('standardVoltage').then((response) => { standardVoltageList.value = response.data }) @@ -96,7 +111,30 @@ getDictByCode('standardAmplitudeUnit').then((response) => { standardAmplitudeUnitList.value = response.data }) - // standard13Item + // 校准信号--项目 + getDictByCode('standard13Item').then((response) => { + standard13ItemList.value = response.data + }) + // 扫描方式 + getDictByCode('standard13ScanType').then((response) => { + standard13ScanTypeList.value = response.data + }) + // 垂直档位步进 + getDictByCode('standard13VerticalGearStep').then((response) => { + standard13VerticalGearStepList.value = response.data + }) + // 频率单位公用 + getDictByCode('standardFrequencyUnit').then((response) => { + standardFrequencyUnitList.value = response.data + }) + // 触发特性幅度单位 + getDictByCode('characteristicAmplitudeUnit').then((response) => { + characteristicAmplitudeUnitList.value = response.data + }) + // 信号类型 + getDictByCode('standard13SignalType').then((response) => { + standard13SignalTypeList.value = response.data + }) } getDict() @@ -129,16 +167,16 @@ } // 刷新 function refresh() { - emit('change') + emits('change') } // 点击行 function rowClick(row: object, column?: any, event?: any) { - emit('rowClick', row) + emits('rowClick', row) } // 双击行 function rowDbClick(row: object, column?: any, event?: any) { - emit('rowDbClick', row) + emits('rowDbClick', row) } // 监听columns watch(props.columns, (val) => { @@ -147,7 +185,7 @@ }) // 多选 const handleSelectionChange = (val: any) => { - emit('selectionChange', val) + emits('selectionChange', val) } // 清除多选选中 const clearMulti = () => { @@ -155,6 +193,20 @@ table.value!.clearSelection() singleChecked.value = '' } + +// 项目选择变化 +const changeItemType = (value: string, index: number) => { + emits('changeItemType', value, index) +} +// 垂直偏转系数变化 +const changeVerticalDeflectCoefficient = (value: string) => { + emits('changeVerticalDeflectCoefficient', value) +} + +const changeInputNumber = (value: number) => { + emits('changeInputNumber', value) +} + defineExpose({ clearMulti, initColumnsState, }) @@ -210,11 +262,13 @@ />
{{ scope.row.technicalIndexUnit }}
+ + + + + + + + + + + + @@ -240,16 +315,22 @@ v-if="item.value === 'cycleSignal' || item.value === 'standardValue' || item.value === 'referencePointFrequency' || item.value === 'bandWidth' || item.value === 'horizontalDeflectCoefficient' || item.value === 'referencePointFrequency' || item.value === 'bandWidth' - || item.value === 'nominalValue' || item.value === 'signalFrequency' || item.value === 'amplitude'" + || item.value === 'nominalValue' || item.value === 'signalFrequency' || item.value === 'amplitude' + || (item.value === 'verticalDeflectionGear' && scope.row.itemType === '幅度') || item.value === 'horizontalScaleGear' + || item.value === 'verticalScaleGear' || item.value === 'frequency' || item.value === 'referenceFrequency' + || item.value === 'stepFrequency' || item.value === 'frequencyUpper' || item.value === 'referenceAmplitude' + || item.value === 'nominalAmplitudeValue' || item.value === 'nominalFrequencyValue'" v-model="scope.row[item.value]" :placeholder="`${item.text}`" class="full-width-input" :disabled="props.pageType === 'detail'" + @change="changeInputNumber" /> - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/views/business/measure/item/detail.vue b/src/views/business/measure/item/detail.vue index 42dfc1d..efcd623 100644 --- a/src/views/business/measure/item/detail.vue +++ b/src/views/business/measure/item/detail.vue @@ -351,6 +351,17 @@ })), // 鉴定项列表 } } + else if (form.value.belongStandardEquipment === '13') { // 第13套:示波器 + if (!standardRef.value.checkListBeforeSave()) { params = '未通过校验'; return params } + const list = standardRef.value.solveDataBeforeSave() // 处理数据 + params = { + helpFieldInstruction: form.value.helpFieldInstruction, // 辅助字段说明 + itemRemark: form.value.itemRemark, // 检定项备注 + itemId: infoId.value, // 检定项id + measureItemDataOscilloscopeList: list, + ...standardRef.value.form, + } + } return params } @@ -498,6 +509,10 @@ getList.value = response.measureItemDataSpectrumAnalyzerList // 检定项表格 getObject.value = response // 检定项表单 } + else if (form.value.belongStandardEquipment === '13') { // 第13套:示波器 + getList.value = response.measureItemDataOscilloscopeList // 检定项表格 + getObject.value = response // 检定项表单 + } } function fetchInfo() { diff --git a/src/components/SelectByDict/index.vue b/src/components/SelectByDict/index.vue index 20a7e0c..83fc909 100644 --- a/src/components/SelectByDict/index.vue +++ b/src/components/SelectByDict/index.vue @@ -24,7 +24,7 @@ required: true, }, }) -const emit = defineEmits(['update:modelValue', 'getDictValue']) +const emit = defineEmits(['update:modelValue', 'getDictValue', 'changeValue']) const checkItem = ref({}) // 选中的选项 const input = ref() // 输入框组件 // -------------------------定义数据-------------------- @@ -91,6 +91,7 @@ const data = dictList.value.filter(item => item.name === inputValue).length if (!data) { console.log(inputValue, '该值不存在添加字典') + emit('changeValue', inputValue) // 在字典中添加该值 getDictAllList().then((res) => { const currentDict = res.data.filter(item => item.code === props.dictCode)[0] @@ -124,6 +125,7 @@ } else { console.log(inputValue, '该值存在') + emit('changeValue', inputValue) // 发送 绑定的value (可用可不用) emit('getDictValue', dictList.value.filter(item => item.name === inputValue)[0].value1) // setTimeout(() => { diff --git a/src/views/business/measure/item/components/thirteenth/templateDetail-interface.ts b/src/views/business/measure/item/components/thirteenth/templateDetail-interface.ts index 7662387..708ffd9 100644 --- a/src/views/business/measure/item/components/thirteenth/templateDetail-interface.ts +++ b/src/views/business/measure/item/components/thirteenth/templateDetail-interface.ts @@ -34,6 +34,8 @@ amplitude?: string // 幅度 amplitudeUnit?: string // 幅度单位 + verticalDeflectionGear?: string // 低电平测量时垂直偏转档位 + verticalDeflectionGearUnit?: string // 低电平测量时垂直偏转档位单位 frequency?: string // 频率(模拟示波器) frequencyUnit?: string // 频率单位(模拟示波器) @@ -54,8 +56,6 @@ signalType?: string // 信号类型(模拟示波器)(字典value) stepFrequency?: string // 步进频率(模拟示波器) stepFrequencyUnit?: string // 步进频率单位(模拟示波器) - verticalDeflectionGear?: string // 低电平测量时垂直偏转档位 - verticalDeflectionGearUnit?: string // 低电平测量时垂直偏转档位单位 verticalGearStep?: string // 垂直档位步进(模拟示波器) verticalScaleGear?: string // 垂直刻度档位(模拟示波器) verticalScaleGearUnit?: string // 垂直刻度档位单位(模拟示波器) diff --git a/src/views/business/measure/item/components/thirteenth/templateDetail.vue b/src/views/business/measure/item/components/thirteenth/templateDetail.vue index cb67fcf..b43e364 100644 --- a/src/views/business/measure/item/components/thirteenth/templateDetail.vue +++ b/src/views/business/measure/item/components/thirteenth/templateDetail.vue @@ -9,6 +9,8 @@ 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: { @@ -37,6 +39,18 @@ 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) @@ -144,8 +158,8 @@ const columns_input_resistance = ref([ // 输入电阻(数字示波器) { text: '检定项目', value: 'params', align: 'center', required: true }, { text: '通道', value: 'thoroughfare', 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: '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: true, width: 300 }, @@ -153,87 +167,106 @@ const columns_calibrating_signal = ref([ // 校准信号(数字示波器) { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '项目', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值单位', value: 'nominalValue', 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([ // 扫描时间系数及扩展 { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '扫描方式', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗单位', value: 'nominalValue', align: 'center', required: true }, - { text: '步进', value: 'nominalValue', align: 'center', required: true }, - { text: '水平刻度档位', value: 'nominalValue', align: 'center', required: true }, - { text: '水平刻度档位单位', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值单位', value: 'nominalValue', align: 'center', required: true }, - { text: '技术指标', value: 'nominalValue', 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: true, width: '300' }, ]) const columns_vertical_size = ref([ // 垂直幅度 { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '通道', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗单位', value: 'nominalValue', align: 'center', required: true }, - { text: '频率', value: 'nominalValue', align: 'center', required: true }, - { text: '频率单位', value: 'nominalValue', align: 'center', required: true }, - { text: '步进', value: 'nominalValue', align: 'center', required: true }, - { text: '垂直刻度档位', value: 'nominalValue', align: 'center', required: true }, - { text: '垂直刻度档位单位', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值单位', value: 'nominalValue', align: 'center', required: true }, - { text: '技术指标', value: 'nominalValue', 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: true, width: '300' }, +]) + +const columns_frequency_bandwidth_simulate = ref([ // 频带宽度(模拟示波器) + { 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: true, width: 340 }, ]) const columns_trigger_characteristic = ref([ // 触发特性 { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '扫描方式', value: 'nominalValue', align: 'center', required: true }, - { text: '通道', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗单位', value: 'nominalValue', align: 'center', required: true }, - { text: '触发类型', value: 'nominalValue', align: 'center', required: true }, - { text: '频率', value: 'nominalValue', align: 'center', required: true }, - { text: '频率单位', value: 'nominalValue', align: 'center', required: true }, - { text: '频率上限', value: 'nominalValue', align: 'center', required: true }, - { text: '频率上限单位', value: 'nominalValue', align: 'center', required: true }, - { text: '幅度', value: 'nominalValue', align: 'center', required: true }, - { text: '幅度单位', value: 'nominalValue', 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: true, width: 340 }, ]) const columns_input_resistance_simulate = ref([ // 输入电阻(模拟示波器) { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '通道', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗单位', value: 'nominalValue', align: 'center', required: true }, - { text: '技术指标', value: 'nominalValue', 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: true, width: 300 }, ]) const columns_risetime_simulate = ref([ // 上升时间(模拟示波器) { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '通道', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗单位', value: 'nominalValue', align: 'center', required: true }, - { text: '触发类型', value: 'nominalValue', align: 'center', required: true }, - { text: '垂直刻度档位', value: 'nominalValue', align: 'center', required: true }, - { text: '垂直刻度档位单位', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值单位', value: 'nominalValue', align: 'center', required: true }, - { text: '扫描上升时间档位', value: 'nominalValue', align: 'center', required: true }, - { text: '扫描上升时间档位单位', value: 'nominalValue', align: 'center', required: true }, - { text: '技术指标', value: 'nominalValue', 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: true, width: '340' }, ]) const columns_calibrating_signal_simulate = ref([ // 校准信号(模拟示波器) { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '信号类型', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗单位', value: 'nominalValue', align: 'center', required: true }, - { text: '幅度标称值', value: 'nominalValue', align: 'center', required: true }, - { text: '幅度标称值单位', value: 'nominalValue', align: 'center', required: true }, - { text: '频率标称值', value: 'nominalValue', align: 'center', required: true }, - { text: '频率标称值单位', value: 'nominalValue', align: 'center', required: true }, - { text: '技术指标', value: 'nominalValue', 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: true, width: '340' }, ]) // --------------------------------表格操作--------------------------------------------------- @@ -294,200 +327,763 @@ * @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: '', // 周期时标信号 - cycleSignalUnit: '', // 周期时标信号单位 - technicalIndex: '', // 技术指标 - 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: '', // 标准值 - standardValueUnit: 'V', // 标准值单位 - technicalIndex: '', // 技术指标 - 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: '', // 标准值 - standardValueUnit: 'V', // 标准值单位 - technicalIndex: '', // 技术指标 - technicalIndexSymbol: '±', // 技术指标前符号 - technicalIndexUnit: '%', // 技术指标单位 - }) - break - case '频带宽度': - list.push({ - id: '', // id,更新/删除使用参数 - dataType: '4', // 检定项数据类型(一个检定项中区分两个表格)(字典code) - itemId: props.itemId, // 检定项id - params: title, // 检定项目 - impedance: '', // 阻抗 - impedanceUnit: 'Ω', // 阻抗单位 - thoroughfare: 'CH1', // 通道 - verticalDeflectCoefficient: '', // 垂直偏转系数 - verticalDeflectCoefficientUnit: 'V', // 垂直偏转系数单位 - horizontalDeflectCoefficient: '', // 水平偏转系数 - horizontalDeflectCoefficientUnit: 'ns', // 水平偏转系数单位 - referencePointFrequency: '', // 参考点频率 - referencePointFrequencyUnit: 'Hz', // 参考点频率单位 - bandWidth: '', // 频带宽度 - bandWidthUnit: 'Hz', // 频带宽度单位 - technicalIndex: '', // 技术指标 - technicalIndexSymbol: '±', // 技术指标前符号 - technicalIndexUnit: 'dB', // 技术指标单位 - }) - break - case '触发灵敏度': - list.push({ - id: '', // id,更新/删除使用参数 - dataType: '5', // 检定项数据类型(一个检定项中区分两个表格)(字典code) - itemId: props.itemId, // 检定项id - params: title, // 检定项目 - thoroughfare: 'CH1', // 通道 - triggerType: '内触发', // 触发类型 - signalFrequency: '', // 信号频率 - signalFrequencyUnit: 'V', // 信号频率单位 - verticalDeflectCoefficient: '', // 垂直偏转系数 - verticalDeflectCoefficientUnit: 'V', // 垂直偏转系数单位 - nominalValue: '', // 标称值 - nominalValueUnit: 'div', // 标称值单位 - technicalIndex: '', // 技术指标 - technicalIndexSymbol: '±', // 技术指标前符号 - technicalIndexUnit: 'dB', // 技术指标单位 - }) - break - case '上升时间': - list.push({ - id: '', // id,更新/删除使用参数 - dataType: '5', // 检定项数据类型(一个检定项中区分两个表格)(字典code) - itemId: props.itemId, // 检定项id - params: title, // 检定项目 - impedance: '', // 阻抗, - impedanceUnit: 'Ω', // 阻抗单位 - thoroughfare: 'CH1', // 通道 - verticalDeflectCoefficient: '', // 垂直偏转系数 - verticalDeflectCoefficientUnit: 'V', // 垂直偏转系数单位 - amplitude: '', // 幅度 - amplitudeUnit: 'V', // 幅度单位 - horizontalDeflectCoefficient: '', // 水平偏转系数单位 - horizontalDeflectCoefficientUnit: 'ns', // 水平偏转系数单位 - technicalIndex: '', // 技术指标 - technicalIndexSymbol: '±', // 技术指标前符号 - technicalIndexUnit: 'ns', // 技术指标单位 - }) - break - case '输入电阻': - list.push({ - id: '', // id,更新/删除使用参数 - dataType: '5', // 检定项数据类型(一个检定项中区分两个表格)(字典code) - itemId: props.itemId, // 检定项id - params: title, // 检定项目 - thoroughfare: 'CH1', // 通道 - verticalDeflectCoefficient: '', // 垂直偏转系数 - verticalDeflectCoefficientUnit: 'V', // 垂直偏转系数单位 - standardValue: '', // 标准值 - technicalIndex: '', // 技术指标 - technicalIndexSymbol: '±', // 技术指标前符号 - technicalIndexUnit: '%', // 技术指标单位 - }) - break - case '校准信号': - - break + 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: '', // 周期时标信号 + cycleSignalUnit: '', // 周期时标信号单位 + technicalIndex: '', // 技术指标 + 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: '', // 标准值 + standardValueUnit: 'V', // 标准值单位 + technicalIndex: '', // 技术指标 + 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: '', // 标准值 + standardValueUnit: 'V', // 标准值单位 + technicalIndex: '', // 技术指标 + 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: '', // 水平偏转系数 + horizontalDeflectCoefficientUnit: 'ns', // 水平偏转系数单位 + referencePointFrequency: '', // 参考点频率 + referencePointFrequencyUnit: 'Hz', // 参考点频率单位 + bandWidth: '', // 频带宽度 + bandWidthUnit: 'Hz', // 频带宽度单位 + technicalIndex: '', // 技术指标 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: 'dB', // 技术指标单位 + }) + break + case '触发灵敏度': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '5', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + thoroughfare: 'CH1', // 通道 + triggerType: '内触发', // 触发类型 + signalFrequency: '', // 信号频率 + signalFrequencyUnit: 'MHz', // 信号频率单位 + verticalDeflectCoefficient: '', // 垂直偏转系数 + verticalDeflectCoefficientUnit: 'V', // 垂直偏转系数单位 + nominalValue: '', // 标称值 + 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: '', // 幅度 + amplitudeUnit: 'V', // 幅度单位 + horizontalDeflectCoefficient: '', // 水平偏转系数单位 + horizontalDeflectCoefficientUnit: 'ns', // 水平偏转系数单位 + technicalIndex: '', // 技术指标 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: 'ns', // 技术指标单位 + }) + break + case '输入电阻': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '7', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + thoroughfare: 'CH1', // 通道 + verticalDeflectCoefficient: '', // 垂直偏转系数 + verticalDeflectCoefficientUnit: 'V', // 垂直偏转系数单位 + standardValue: '', // 标准值 + technicalIndex: '', // 技术指标 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: '%', // 技术指标单位 + }) + break + case '校准信号': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '8', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + itemType: '幅度', // 项目 + nominalValue: '', // 标称值 + nominalValueUnit: 'V', // 垂直标称值单位偏转系数单位 + verticalDeflectionGear: '', // 低电平测量时垂直偏转档位 + 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: '', // 水平刻度档位 + horizontalScaleGearUnit: 'ns', // 水平刻度档位单位 + nominalValue: '', // 标称值 + nominalValueUnit: 'ms', // 标称值单位 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: '%', // 技术指标单位 + technicalIndex: '', // 技术指标单位 + }) + 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: '', // 垂直刻度档位 + verticalScaleGearUnit: 'mV', // 垂直刻度档位单位 + nominalValue: '', // 标称值 + nominalValueUnit: 'mV', // 标称值单位 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: '%', // 技术指标单位 + technicalIndex: '', // 技术指标 + }) + break + case '频带宽度': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '3', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + thoroughfare: 'CH1', // 通道 + impedance: '50', // 阻抗 + impedanceUnit: 'Ω', // 阻抗单位 + referenceFrequency: '', // 基准频率 + referenceFrequencyUnit: 'Hz', // 基准频率单位 + stepFrequency: '', // 步进频率 + stepFrequencyUnit: 'kHz', // 步进频率单位 + verticalScaleGear: '', // 垂直刻度档位 + verticalScaleGearUnit: 'mV', // 垂直刻度档位单位 + verticalGearStep: '1-2-5', // 垂直档位步进 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: 'MHz', // 技术指标单位 + technicalIndex: '', // 技术指标 + }) + break + case '触发特性': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '4', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + scanType: 'A扫描', // 扫描类型 + thoroughfare: 'CH1', // 通道 + impedance: '50', // 阻抗 + impedanceUnit: 'Ω', // 阻抗单位 + triggerType: '内触发', // 触发类型 + frequency: '', // 频率 + frequencyUnit: 'Hz', // 频率单位 + frequencyUpper: '', // 频率上限 + frequencyUpperUnit: 'Hz', // 频率上限单位 + amplitude: '', // 幅度 + amplitudeUnit: 'mV', // 幅度单位 + referenceAmplitude: '100', // 基准幅度 + referenceAmplitudeUnit: 'mV', // 基准幅度单位 + technicalIndexSymbol: '≤', // 技术指标前符号 + technicalIndexUnit: 'mV', // 技术指标单位 + technicalIndex: '', // 技术指标 + }) + break + case '输入电阻': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '5', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + thoroughfare: 'CH1', // 通道 + impedance: '50', // 阻抗 + impedanceUnit: 'Ω', // 阻抗单位 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: '%', // 技术指标单位 + technicalIndex: '', // 技术指标 + }) + break + case '上升时间': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '6', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + thoroughfare: 'CH1', // 通道 + impedance: '50', // 阻抗 + impedanceUnit: 'Ω', // 阻抗单位 + verticalScaleGear: '', // 垂直刻度档位 + verticalScaleGearUnit: 'mV', // 垂直刻度档位单位 + amplitude: '', // 幅度 + amplitudeUnit: 'mV', // 幅度单位 + horizontalScaleGear: '', // 水平刻度档位 + horizontalScaleGearUnit: 'ns', // 水平刻度档位单位 + technicalIndexSymbol: '<', // 技术指标前符号 + technicalIndexUnit: 'ns', // 技术指标单位 + technicalIndex: '', // 技术指标 + }) + break + case '校准信号': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '7', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + signalType: '校准信号1', // 信号类型 + impedance: '50', // 阻抗 + impedanceUnit: 'Ω', // 阻抗单位 + nominalAmplitudeValue: '', // 幅度标称值 + nominalAmplitudeValueUnit: 'mV', // 幅度标称值单位 + nominalFrequencyValue: '', // 频率标称值 + nominalFrequencyValueUnit: 'kHz', // 频率标称值单位 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: '%', // 技术指标单位 + technicalIndex: '', // 技术指标 + }) + break + } } } - // } } /** * 删除行公共方法 * @param checkoutList 选中的数组 * @param list 操作的数组 */ -const delRow = (checkoutList: IList[], list: IList[]) => { +const delRow = (checkoutList: IList[], list: IList[], title: string) => { if (!checkoutList.length) { ElMessage.warning('请选中要删除的行') } else { - list = list.filter((item: any) => { - return !checkoutList.includes(item) - }) + 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 + } + } } } -// ---------------------------------------------校验--------------------------------------------------- -// 校验表格(点击保存的时候用、生成标准器示值) -const checkList = () => { - // return useCheckList(list.value, columns.value, '检定项表格') +// ------------------------------------------校验\保存之前处理数据--------------------------------------------------- +// 增加行校验表格 +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 calculateDataTop = () => { +// 保存之前校验 +const checkListBeforeSave = () => { + // 验空 + if (props.itemCategoryName === '数字示波器' && form.value.timeBase && !timeBaseList.value.length) { // 时基(示波器-数字) + ElMessage.warning('时基 不能为空') + return false + } + else if (props.itemCategoryName === '数字示波器' && form.value.currentGain && !zeroFrequencyGainList.value.length) { // 直流增益(示波器-数字) + ElMessage.warning('直流增益 不能为空') + return false + } + else if (props.itemCategoryName === '数字示波器' && form.value.currentBias && !DCBiasList.value.length) { // 直流偏置(示波器-数字) + ElMessage.warning('直流偏置 不能为空') + return false + } + else if (props.itemCategoryName === '模拟示波器' && form.value.scanTimeCoefficient && !scanningTimeList.value.length) { // 扫描时间系数及扩展(示波器-模拟) + ElMessage.warning('扫描时间系数及扩展 不能为空') + return false + } + else if (props.itemCategoryName === '模拟示波器' && form.value.verticalAmplitude && !verticalSizeList.value.length) { // 垂直幅度 + ElMessage.warning('垂直幅度 不能为空') + return false + } + else if (form.value.bandWidth) { // 频带宽度(示波器-数字/模拟) + if ((props.itemCategoryName === '数字示波器' && !frequencyBandwidthList.value.length) || (props.itemCategoryName === '模拟示波器' && !frequencyBandwidthSimulateList.value.length)) { + ElMessage.warning('频带宽度 不能为空') + return false + } + } + else if (props.itemCategoryName === '模拟示波器' && form.value.triggerCharacter && !triggerCharacteristicList.value.length) { // 触发特性 + ElMessage.warning('触发特性 不能为空') + return false + } + else if (props.itemCategoryName === '数字示波器' && form.value.triggerSensitivity && !triggerSensitivityList.value.length) { // 触发灵敏度 + ElMessage.warning('触发灵敏度 不能为空') + return false + } + else if (form.value.riseTime) { // 上升时间(数字示波器) + if ((props.itemCategoryName === '数字示波器' && !risetimeList.value.length) || (props.itemCategoryName === '模拟示波器' && !risetimeSimulateList.value.length)) { + ElMessage.warning('上升时间 不能为空') + return false + } + } + else if (form.value.inputResistance) { // 输入电阻(数字示波器) + if ((props.itemCategoryName === '数字示波器' && !inputResistanceList.value.length) && (props.itemCategoryName === '模拟示波器' && !inputResistanceSimulateList.value.length)) { + ElMessage.warning('输入电阻 不能为空') + return false + } + } + else if (form.value.calibratingSignal) { // 校准信号(示波器-数字/模拟) + if ((props.itemCategoryName === '数字示波器' && !calibratingSignalList.value.length) && (props.itemCategoryName === '模拟示波器' && !calibratingSignalSimulateList.value.length)) { + ElMessage.warning('校准信号 不能为空') + return false + } + } + console.log('--------1111111') + // 验数据 + 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, '时基') + } + else if (form.value.currentGain) { + currentGainResult = checkList(zeroFrequencyGainList.value, '直流增益') + } + else if (form.value.currentBias) { + currentBiasResult = checkList(DCBiasList.value, '直流偏置') + } + else if (form.value.bandWidth) { + bandWidthResult = checkList(frequencyBandwidthList.value, '频带宽度') + } + else if (form.value.triggerSensitivity) { + triggerSensitivityResult = checkList(triggerSensitivityList.value, '触发灵敏度') + } + else if (form.value.riseTime) { + riseTimeResult = checkList(risetimeList.value, '上升时间') + } + else if (form.value.inputResistance) { + inputResistanceResult = checkList(inputResistanceList.value, '输入电阻') + } + else 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, '扫描时间系数及扩展') + } + else if (form.value.verticalAmplitude) { + verticalAmplitudeResult = checkList(verticalSizeList.value, '垂直幅度') + } + else if (form.value.bandWidth) { + bandWidthResult = checkList(frequencyBandwidthSimulateList.value, '频带宽度') + } + else if (form.value.triggerCharacter) { + triggerCharacterResult = checkList(triggerCharacteristicList.value, '触发特性') + } + else if (form.value.inputResistance) { + inputResistanceResult = checkList(inputResistanceSimulateList.value, '输入电阻') + } + else if (form.value.riseTime) { + riseTimeResult = checkList(risetimeSimulateList.value, '上升时间') + } + else if (form.value.calibratingSignal) { + calibratingSignalResult = checkList(calibratingSignalSimulateList.value, '校准信号') + } + if (scanTimeCoefficientResult && verticalAmplitudeResult && bandWidthResult && triggerCharacterResult && inputResistanceResult && riseTimeResult && calibratingSignalResult + ) { + return true + } + else { + return false + } + } } -// 点击生成辅助接地电阻--下面表格计算 -const calculateDataBottom = () => { +// 保存之前处理数据 +const solveDataBeforeSave = () => { + // 数据处理 + let tempList = [] + 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) => { + return { + ...item, + id: '', + } + }) + return tempList } // ----------------------------------------------------------------------------------------------------- +// 校准信号项目变化 +const changeItemType = (value: string, index: number) => { + if (value === '频率') { + calibratingSignalList.value[index].verticalDeflectionGear = '/' + calibratingSignalList.value[index].verticalDeflectionGearUnit = '/' + } + else { // 幅度 + calibratingSignalList.value[index].verticalDeflectionGear = '' + calibratingSignalList.value[index].verticalDeflectionGearUnit = 'V' + } +} +// 垂直偏转系数变化 +const changeVerticalDeflectCoefficient = (param: { value: string }, type: string) => { + 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) => { + return { + ...item, + standardValue: Number(calc(Number(num), 6, '*')), // 标准值默认为垂直偏转系数*6 + } + }) as any + } + else if (type === '上升时间(数字示波器)') { + risetimeList.value = risetimeList.value.map((item) => { + return { + ...item, + amplitude: Number(calc(Number(num), 5, '*')), // 幅度默认为垂直偏转系数*6 + } + }) 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 => `${item.dataType}` === '1').map((item) => { item.params = '时基'; return item }) // 时基 + zeroFrequencyGainList.value = newVal.filter(item => `${item.dataType}` === '2').map((item) => { item.params = '直流增益'; return item }) // 直流增益 + DCBiasList.value = newVal.filter(item => `${item.dataType}` === '3').map((item) => { item.params = '直流偏置'; return item }) // 直流偏置 + frequencyBandwidthList.value = newVal.filter(item => `${item.dataType}` === '4').map((item) => { item.params = '频带宽度'; return item }) // 频带宽度(数字示波器) + triggerSensitivityList.value = newVal.filter(item => `${item.dataType}` === '5').map((item) => { item.params = '触发灵敏度'; return item })// 触发灵敏度 + risetimeList.value = newVal.filter(item => `${item.dataType}` === '6').map((item) => { item.params = '上升时间'; return item })// 上升时间(数字示波器) + inputResistanceList.value = newVal.filter(item => `${item.dataType}` === '7').map((item) => { item.params = '输入电阻'; return item })// 输入电阻(数字示波器) + calibratingSignalList.value = newVal.filter(item => `${item.dataType}` === '8').map((item) => { item.params = '校准信号'; return item })// 校准信号(数字示波器) + if (timeBaseList.value.length) { + form.value.methodType = timeBaseList.value[0].methodType // 时基方法 + } + } + else if (props.itemCategoryName === '模拟示波器') { + scanningTimeList.value = newVal.filter(item => `${item.dataType}` === '1').map((item) => { item.params = '扫描时间系数及扩展'; return item }) // 扫描时间系数及扩展 + verticalSizeList.value = newVal.filter(item => `${item.dataType}` === '2').map((item) => { item.params = '垂直幅度'; return item }) // 垂直幅度 + frequencyBandwidthSimulateList.value = newVal.filter(item => `${item.dataType}` === '3').map((item) => { item.params = '频带宽度'; return item }) // 频带宽度(模拟示波器 + triggerCharacteristicList.value = newVal.filter(item => `${item.dataType}` === '4').map((item) => { item.params = '触发特性'; return item }) // 触发特性 + inputResistanceSimulateList.value = newVal.filter(item => `${item.dataType}` === '5').map((item) => { item.params = '输入电阻'; return item })// 输入电阻 + risetimeSimulateList.value = newVal.filter(item => `${item.dataType}` === '6').map((item) => { item.params = '上升时间'; return item })// 上升时间(数字示波器) + calibratingSignalSimulateList.value = newVal.filter(item => `${item.dataType}` === '7').map((item) => { item.params = '校准信号'; return item })// 校准信号(数字示波器) + } + } +}) -// watch(() => props.list, (newVal) => { // 检定项表格 -// if (newVal) { -// list.value = [...newVal] -// } -// }) +watch(() => props.form, (newValue) => { + 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({ list }) +defineExpose({ checkListBeforeSave, solveDataBeforeSave, form }) diff --git a/src/views/business/measure/item/components/thirteenth/templateTable.vue b/src/views/business/measure/item/components/thirteenth/templateTable.vue index a210821..b645ba7 100644 --- a/src/views/business/measure/item/components/thirteenth/templateTable.vue +++ b/src/views/business/measure/item/components/thirteenth/templateTable.vue @@ -6,7 +6,7 @@ import { getDictByCode } from '@/api/system/dict' import type { dictType } from '@/global' -// ------------------定义props、 emit------------------- +// ------------------定义props、 emits------------------- const props = defineProps({ pageType: { type: String, @@ -40,7 +40,17 @@ }, // 表格大小,默认,small,mini等,与el-table条件相同 type: String, // 表格类型,表格title }) -const emit = defineEmits(['change', 'selectionChange', 'rowClick', 'rowDbClick', 'multiSelect', 'filterChange']) +const emits = defineEmits([ + 'change', + 'selectionChange', + 'rowClick', + 'rowDbClick', + 'multiSelect', + 'filterChange', + 'changeItemType', + 'changeVerticalDeflectCoefficient', + 'changeInputNumber', +]) // ------------------------------------------字典---------------------------------------------- const standardTechnicalIndexSymbolList = ref([]) // 技术指标规则 const standard13ThoroughfareList = ref([]) // 通道 @@ -51,7 +61,12 @@ const standard13TriggerTypeList = ref([]) // 触发特性 const standard13NominalValueUnitList = ref([]) // 标称值单位 const standardAmplitudeUnitList = ref([]) // 幅度单位 - +const standard13ItemList = ref([]) // 校准信号--项目 +const standard13ScanTypeList = ref([]) // 扫描方式 +const standard13VerticalGearStepList = ref([]) // 垂直档位步进 +const standardFrequencyUnitList = ref([]) // 频率单位-公用 +const characteristicAmplitudeUnitList = ref([]) // 触发特性-公用 +const standard13SignalTypeList = ref([]) // 信号类型 /** * 获取字典 */ @@ -72,7 +87,7 @@ getDictByCode('standard13VerticalDeflectCoefficient').then((response) => { standard13VerticalDeflectCoefficientList.value = response.data }) - // 垂直偏转系数(/div)单位\电压单位--公用 + // 电压单位--公用/垂直偏转系数(/div)单位 getDictByCode('standardVoltage').then((response) => { standardVoltageList.value = response.data }) @@ -96,7 +111,30 @@ getDictByCode('standardAmplitudeUnit').then((response) => { standardAmplitudeUnitList.value = response.data }) - // standard13Item + // 校准信号--项目 + getDictByCode('standard13Item').then((response) => { + standard13ItemList.value = response.data + }) + // 扫描方式 + getDictByCode('standard13ScanType').then((response) => { + standard13ScanTypeList.value = response.data + }) + // 垂直档位步进 + getDictByCode('standard13VerticalGearStep').then((response) => { + standard13VerticalGearStepList.value = response.data + }) + // 频率单位公用 + getDictByCode('standardFrequencyUnit').then((response) => { + standardFrequencyUnitList.value = response.data + }) + // 触发特性幅度单位 + getDictByCode('characteristicAmplitudeUnit').then((response) => { + characteristicAmplitudeUnitList.value = response.data + }) + // 信号类型 + getDictByCode('standard13SignalType').then((response) => { + standard13SignalTypeList.value = response.data + }) } getDict() @@ -129,16 +167,16 @@ } // 刷新 function refresh() { - emit('change') + emits('change') } // 点击行 function rowClick(row: object, column?: any, event?: any) { - emit('rowClick', row) + emits('rowClick', row) } // 双击行 function rowDbClick(row: object, column?: any, event?: any) { - emit('rowDbClick', row) + emits('rowDbClick', row) } // 监听columns watch(props.columns, (val) => { @@ -147,7 +185,7 @@ }) // 多选 const handleSelectionChange = (val: any) => { - emit('selectionChange', val) + emits('selectionChange', val) } // 清除多选选中 const clearMulti = () => { @@ -155,6 +193,20 @@ table.value!.clearSelection() singleChecked.value = '' } + +// 项目选择变化 +const changeItemType = (value: string, index: number) => { + emits('changeItemType', value, index) +} +// 垂直偏转系数变化 +const changeVerticalDeflectCoefficient = (value: string) => { + emits('changeVerticalDeflectCoefficient', value) +} + +const changeInputNumber = (value: number) => { + emits('changeInputNumber', value) +} + defineExpose({ clearMulti, initColumnsState, }) @@ -210,11 +262,13 @@ />
{{ scope.row.technicalIndexUnit }}
+ + + + + + + + + + + + @@ -240,16 +315,22 @@ v-if="item.value === 'cycleSignal' || item.value === 'standardValue' || item.value === 'referencePointFrequency' || item.value === 'bandWidth' || item.value === 'horizontalDeflectCoefficient' || item.value === 'referencePointFrequency' || item.value === 'bandWidth' - || item.value === 'nominalValue' || item.value === 'signalFrequency' || item.value === 'amplitude'" + || item.value === 'nominalValue' || item.value === 'signalFrequency' || item.value === 'amplitude' + || (item.value === 'verticalDeflectionGear' && scope.row.itemType === '幅度') || item.value === 'horizontalScaleGear' + || item.value === 'verticalScaleGear' || item.value === 'frequency' || item.value === 'referenceFrequency' + || item.value === 'stepFrequency' || item.value === 'frequencyUpper' || item.value === 'referenceAmplitude' + || item.value === 'nominalAmplitudeValue' || item.value === 'nominalFrequencyValue'" v-model="scope.row[item.value]" :placeholder="`${item.text}`" class="full-width-input" :disabled="props.pageType === 'detail'" + @change="changeInputNumber" /> - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/views/business/measure/item/detail.vue b/src/views/business/measure/item/detail.vue index 42dfc1d..efcd623 100644 --- a/src/views/business/measure/item/detail.vue +++ b/src/views/business/measure/item/detail.vue @@ -351,6 +351,17 @@ })), // 鉴定项列表 } } + else if (form.value.belongStandardEquipment === '13') { // 第13套:示波器 + if (!standardRef.value.checkListBeforeSave()) { params = '未通过校验'; return params } + const list = standardRef.value.solveDataBeforeSave() // 处理数据 + params = { + helpFieldInstruction: form.value.helpFieldInstruction, // 辅助字段说明 + itemRemark: form.value.itemRemark, // 检定项备注 + itemId: infoId.value, // 检定项id + measureItemDataOscilloscopeList: list, + ...standardRef.value.form, + } + } return params } @@ -498,6 +509,10 @@ getList.value = response.measureItemDataSpectrumAnalyzerList // 检定项表格 getObject.value = response // 检定项表单 } + else if (form.value.belongStandardEquipment === '13') { // 第13套:示波器 + getList.value = response.measureItemDataOscilloscopeList // 检定项表格 + getObject.value = response // 检定项表单 + } } function fetchInfo() { diff --git a/src/views/business/taskMeasure/measureData/components/thirteenth/templateDetail.vue b/src/views/business/taskMeasure/measureData/components/thirteenth/templateDetail.vue index cc27596..8de9c99 100644 --- a/src/views/business/taskMeasure/measureData/components/thirteenth/templateDetail.vue +++ b/src/views/business/taskMeasure/measureData/components/thirteenth/templateDetail.vue @@ -36,6 +36,8 @@ belongStandardEquipment: '', // 标准装置code belongStandardEquipmentName: '', // 标准装置名称 + methodType: '', // 时基方法 + appearance: '正常', // 外观及功能性检查 appearanceFunctionCheck: 1, // 外观及功能性检查 timeBase: 1, // 时基(示波器-数字) currentGain: 1, // 直流增益(示波器-数字) @@ -84,28 +86,50 @@ const risetimeSimulateList = ref([]) // 上升时间(模拟示波器) const calibratingSignalSimulateList = ref([]) // 校准信号(模拟示波器) -const columns_time_base = ref([ // 时基 - { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '周期时标信号', value: 'nominalValue', align: 'center', required: true }, - { text: '周期时标信号△T/ns', value: 'nominalValue', align: 'center', required: true }, - { text: '时基相对误差△δ', value: 'nominalValue', align: 'center', required: true }, - { text: '技术指标', value: 'nominalValue', align: 'center', required: true }, - { text: '结论', value: 'nominalValue', align: 'center', required: true }, +const timeBaseLoading = ref(false) // 时基 +const zeroFrequencyGainLoading = ref(false) // 直流增益 +const DCBiasLoading = ref(false) // 直流偏置 +const frequencyBandwidthLoading = ref(false) // 频带宽度(数字示波器) +const triggerSensitivityLoading = ref(false) // 触发灵敏度 +const risetimeLoading = ref(false) // 上升时间(数字示波器) +const inputResistanceLoading = ref(false) // 输入电阻(数字示波器) +const calibratingSignalLoading = ref(false) // 校准信号(数字示波器) +const scanningTimeLoading = ref(false) // 扫描时间系数及扩展 +const verticalSizeLoading = ref(false) // 垂直幅度 +const frequencyBandwidthSimulateLoading = ref(false) // 频带宽度(模拟示波器) +const triggerCharacteristicLoading = ref(false) // 触发特性 +const inputResistanceSimulateLoading = ref(false) // 输入电阻(模拟示波器) +const risetimeSimulateLoading = ref(false) // 上升时间(模拟示波器) +const calibratingSignalSimulateLoading = ref(false) // 校准信号(模拟示波器) + +const columns_time_base_method1 = ref([ // 时基--方法一 + { text: '检定项目', value: 'params', align: 'center', required: true, width: '90' }, + { text: '周期时标信号', value: 'cycleSignalDefineFront', align: 'center', required: true }, + { text: '时基绝对误差△T/ns', value: 'timeBaseAbsoluteError', align: 'center', required: true, width: '180' }, + { text: '时基相对误差△δ', value: 'timeBaseRelativeError', align: 'center', required: false }, + { text: '技术指标', value: 'technicalIndexDefineFront', align: 'center', required: true }, + { text: '结论', value: 'conclusion', align: 'center', required: false }, +]) + +const columns_time_base_method2 = ref([ // 时基--方法二 + { text: '检定项目', value: 'params', align: 'center', required: true, width: '90' }, + { text: '参考输出', value: 'cycleSignal', align: 'center', required: true }, + { text: '差拍波形频率测量值(Hz)', value: 'timeBaseAbsoluteError', align: 'center', required: true, width: '180' }, + { text: '时基相对误差△δ', value: 'timeBaseRelativeError', align: 'center', required: false }, + { text: '技术指标', value: 'technicalIndexDefineFront', align: 'center', required: true }, + { text: '结论', value: 'conclusion', align: 'center', required: false }, ]) const columns_zero_frequency_gain = ref([ // 直流增益 - { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '阻抗', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗单位', value: 'nominalValue', align: 'center', required: true }, - { text: '通道', value: 'nominalValue', align: 'center', required: true }, - { text: '垂直偏转系数(/div)', value: 'nominalValue', align: 'center', required: true }, - { text: '垂直偏转系数(/div)单位', value: 'nominalValue', align: 'center', required: true }, - { text: '标准值', value: 'nominalValue', align: 'center', required: true }, - { text: '标准值单位', value: 'nominalValue', align: 'center', required: true }, - { text: '测量值', value: 'nominalValue', align: 'center', required: true }, - { text: '相对误差', value: 'nominalValue', align: 'center', required: true }, - { text: '技术指标', value: 'nominalValue', align: 'center', required: true }, - { text: '结论', value: 'nominalValue', align: 'center', required: true }, + { text: '检定项目', value: 'params', align: 'center', required: true, width: '90' }, + { text: '阻抗', value: 'impedanceDefineFront', align: 'center', required: true }, + { text: '通道', value: 'thoroughfare', align: 'center', required: true }, + { text: '垂直偏转系数(/div)', value: 'verticalDeflectCoefficientDefineFront', align: 'center', required: true }, + { text: '标准值', value: 'standardValueDefineFront', align: 'center', required: true }, + { text: '测量值', value: 'measureValue', align: 'center', required: true, width: '180' }, + { text: '相对误差', value: 'relativeError', align: 'center', required: false }, + { text: '技术指标', value: 'technicalIndexDefineFront', align: 'center', required: true }, + { text: '结论', value: 'conclusion', align: 'center', required: false }, ]) const columns_DC_bias = ref([ // 直流偏置 @@ -322,7 +346,40 @@ // 初始化输入数据 const initInputData = (data: any) => { - + if (itemFormData.value.itemCategoryName === '数字示波器') { + // 时基 + timeBaseList.value = data.filter(item => `${item.dataType}` === '1') + timeBaseList.value = timeBaseList.value.map((item) => { + return { + ...item, + params: '时基', + cycleSignalDefineFront: item.cycleSignal + item.cycleSignalUnit, // 周期时标信号 + timeBaseAbsoluteError: '', // 时基绝对误差△T/ns + timeBaseRelativeError: '', // 时基相对误差△δ + technicalIndexDefineFront: item.technicalIndexSymbol + item.technicalIndex + item.technicalIndexUnit, // 技术指标 + conclusion: '', // 结论 + } + }) + // 直流增益 + zeroFrequencyGainList.value = data.filter(item => `${item.dataType}` === '2') + zeroFrequencyGainList.value = zeroFrequencyGainList.value.map((item) => { + return { + ...item, + params: '直流增益', + impedanceDefineFront: item.impedance + item.impedanceUnit, // 阻抗 + verticalDeflectCoefficientDefineFront: item.verticalDeflectCoefficient + item.verticalDeflectCoefficientUnit, // 垂直偏转系数 + standardValueDefineFront: item.standardValue + item.standardValueUnit, // 标准值 + measureValue: '', // 测量值 + measureValueUnit: item.standardValueUnit, // 测量值单位 + relativeError: '', // 相对误差 + technicalIndexDefineFront: item.technicalIndexSymbol + item.technicalIndex + item.technicalIndexUnit, // 技术指标 + conclusion: '', // 结论 + } + }) + } + else if (itemFormData.value.itemCategoryName === '模拟示波器') { + console.log('模拟示波器') + } } /** @@ -338,44 +395,115 @@ belongStandardEquipment, // 检校标准装置字典code } getItemInfo(params).then((res) => { - itemFormData.value.appearance = res.data.measureItemConfigPistonGauge.appearance ? '1' : '' // 外观及功能检查 1有外观,2没有外观 - initInputData(res.data.measureItemDataPistonGaugeList) + itemFormData.value.appearance = res.data.appearanceFunctionCheck ? '1' : '' // 外观及功能检查 1有外观,2没有外观 + itemFormData.value.appearanceFunctionCheck = res.data.appearanceFunctionCheck // 外观及功能检查 1有外观,2没有外观 + itemFormData.value.timeBase = res.data.timeBase // 时基 + itemFormData.value.currentGain = res.data.currentGain // 直流增益 + itemFormData.value.currentBias = res.data.currentBias // 直流偏置 + itemFormData.value.bandWidth = res.data.bandWidth // 频带宽度 + itemFormData.value.triggerSensitivity = res.data.triggerSensitivity // 触发灵敏度 + itemFormData.value.riseTime = res.data.riseTime // 上升时间 + itemFormData.value.inputResistance = res.data.inputResistance // 输入电阻 + itemFormData.value.calibratingSignal = res.data.calibratingSignal // 校准信号 + itemFormData.value.scanTimeCoefficient = res.data.scanTimeCoefficient // 扫描时间系数及扩展 + itemFormData.value.triggerCharacter = res.data.triggerCharacter // 触发特性 + itemFormData.value.verticalAmplitude = res.data.verticalAmplitude // 垂直幅度 + + const tempTimeBaseList = res.data.measureItemDataOscilloscopeList.filter(item => `${item.dataType}` === '1') + if (tempTimeBaseList && tempTimeBaseList.length) { + itemFormData.value.methodType = tempTimeBaseList[0].methodType + } + initInputData(res.data.measureItemDataOscilloscopeList) }) } // ----------------------------------------点击保存时校验--------------------------------------- -// 校验 -const checkout = () => { +// 点击计算结果校验 +const checkout = (type: string) => { + let result = true + switch (type) { + case '时基': { + const columns = itemFormData.value.methodType === '方法一' ? columns_time_base_method1.value : columns_time_base_method2.value + result = useCheckList(timeBaseList.value, columns, type) + break + } + case '直流增益': + result = useCheckList(zeroFrequencyGainList.value, columns_zero_frequency_gain.value, type) + break + default: + break + } + return result +} + +// 计算之前参数处理 +const solveParamsBeforeCalculate = (type: string) => { + let list = [] + switch (type) { + case '时基': + list = timeBaseList.value + break + case '直流增益': + list = zeroFrequencyGainList.value + break + default: + break + } + return list +} + +// 计算之后参数处理 +const solveParamsAfterCalculate = (type: string, list) => { + switch (type) { + case '时基': + timeBaseList.value = timeBaseList.value.map((item, index) => { + return { + ...item, + timeBaseRelativeError: list[index].timeBaseRelativeError, + conclusion: list[index].conclusion, + exceedMark: list[index].exceedMark, + } + }) + break + case '直流增益': + zeroFrequencyGainList.value = zeroFrequencyGainList.value.map((item, index) => { + return { + ...item, + relativeError: list[index].relativeError, + conclusion: list[index].conclusion, + exceedMark: list[index].exceedMark, + } + }) + break + default: + break + } + return list } // -----------------------------------------生成结果处理---------------------------------------- // 点击计算结果 -const calculate = () => { - // ElMessage.info('敬请期待') - return false - // if (!list.value.length) { - // ElMessage.warning('没有检定项数据,无法生成结果') - // return false - // } - // if (!useCheckList(list.value, measureColumns.value, '检定数据')) { - // return false - // } - // const params = { - // belongStandardEquipment: itemFormData.value.belongStandardEquipment, // 检校标准装置 - // itemCategoryName: itemFormData.value.itemCategoryName, // 检定项分类名称 - // measureDataCalibratorList: list.value, - // } - // calculateHandle(params).then((res) => { - // if (res.data && res.data.length) { - // resultList.value = res.data.map((item: IDetailMeasureList) => { - // return { - // ...item, - // } - // }) // 检定数据 - // } - // else { - // list.value = res.data - // } - // }) +const calculate = (type: string) => { + if (!checkout(type)) { + return false + } + const list = solveParamsBeforeCalculate(type) + timeBaseLoading.value = type === '时基' + zeroFrequencyGainLoading.value = type === '直流增益' + const params = { + belongStandardEquipment: itemFormData.value.belongStandardEquipment, // 检校标准装置 + itemCategoryName: itemFormData.value.itemCategoryName, // 检定项分类名称 + measureDataOscilloscopeList: list, + } + calculateHandle(params).then((res) => { + if (res.data && res.data.length) { + solveParamsAfterCalculate(type, res.data) + } + timeBaseLoading.value = false + zeroFrequencyGainLoading.value = false + }).catch(() => { + timeBaseLoading.value = false + zeroFrequencyGainLoading.value = false + }) } // ------------------------------------------钩子---------------------------------------------- @@ -394,7 +522,7 @@ itemFormData.value.belongStandardEquipment = $route.query.belongStandardEquipment as string// 标准装置code itemFormData.value.belongStandardEquipmentName = $route.query.belongStandardEquipmentName as string// 标准装置名称 // 查输入值(查检定项管理的详情) - // fetchItemInfo($route.query.itemId! as string, $route.query.itemCategoryName! as string, $route.query.belongStandardEquipment as string) + fetchItemInfo($route.query.itemId! as string, $route.query.itemCategoryName! as string, $route.query.belongStandardEquipment as string) } else { itemFormData.value.itemCategoryName = $route.query.itemCategoryName as string // 设备检定项分类名称 @@ -446,26 +574,27 @@ - + + - + @@ -475,11 +604,11 @@ - + diff --git a/src/components/SelectByDict/index.vue b/src/components/SelectByDict/index.vue index 20a7e0c..83fc909 100644 --- a/src/components/SelectByDict/index.vue +++ b/src/components/SelectByDict/index.vue @@ -24,7 +24,7 @@ required: true, }, }) -const emit = defineEmits(['update:modelValue', 'getDictValue']) +const emit = defineEmits(['update:modelValue', 'getDictValue', 'changeValue']) const checkItem = ref({}) // 选中的选项 const input = ref() // 输入框组件 // -------------------------定义数据-------------------- @@ -91,6 +91,7 @@ const data = dictList.value.filter(item => item.name === inputValue).length if (!data) { console.log(inputValue, '该值不存在添加字典') + emit('changeValue', inputValue) // 在字典中添加该值 getDictAllList().then((res) => { const currentDict = res.data.filter(item => item.code === props.dictCode)[0] @@ -124,6 +125,7 @@ } else { console.log(inputValue, '该值存在') + emit('changeValue', inputValue) // 发送 绑定的value (可用可不用) emit('getDictValue', dictList.value.filter(item => item.name === inputValue)[0].value1) // setTimeout(() => { diff --git a/src/views/business/measure/item/components/thirteenth/templateDetail-interface.ts b/src/views/business/measure/item/components/thirteenth/templateDetail-interface.ts index 7662387..708ffd9 100644 --- a/src/views/business/measure/item/components/thirteenth/templateDetail-interface.ts +++ b/src/views/business/measure/item/components/thirteenth/templateDetail-interface.ts @@ -34,6 +34,8 @@ amplitude?: string // 幅度 amplitudeUnit?: string // 幅度单位 + verticalDeflectionGear?: string // 低电平测量时垂直偏转档位 + verticalDeflectionGearUnit?: string // 低电平测量时垂直偏转档位单位 frequency?: string // 频率(模拟示波器) frequencyUnit?: string // 频率单位(模拟示波器) @@ -54,8 +56,6 @@ signalType?: string // 信号类型(模拟示波器)(字典value) stepFrequency?: string // 步进频率(模拟示波器) stepFrequencyUnit?: string // 步进频率单位(模拟示波器) - verticalDeflectionGear?: string // 低电平测量时垂直偏转档位 - verticalDeflectionGearUnit?: string // 低电平测量时垂直偏转档位单位 verticalGearStep?: string // 垂直档位步进(模拟示波器) verticalScaleGear?: string // 垂直刻度档位(模拟示波器) verticalScaleGearUnit?: string // 垂直刻度档位单位(模拟示波器) diff --git a/src/views/business/measure/item/components/thirteenth/templateDetail.vue b/src/views/business/measure/item/components/thirteenth/templateDetail.vue index cb67fcf..b43e364 100644 --- a/src/views/business/measure/item/components/thirteenth/templateDetail.vue +++ b/src/views/business/measure/item/components/thirteenth/templateDetail.vue @@ -9,6 +9,8 @@ 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: { @@ -37,6 +39,18 @@ 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) @@ -144,8 +158,8 @@ const columns_input_resistance = ref([ // 输入电阻(数字示波器) { text: '检定项目', value: 'params', align: 'center', required: true }, { text: '通道', value: 'thoroughfare', 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: '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: true, width: 300 }, @@ -153,87 +167,106 @@ const columns_calibrating_signal = ref([ // 校准信号(数字示波器) { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '项目', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值单位', value: 'nominalValue', 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([ // 扫描时间系数及扩展 { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '扫描方式', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗单位', value: 'nominalValue', align: 'center', required: true }, - { text: '步进', value: 'nominalValue', align: 'center', required: true }, - { text: '水平刻度档位', value: 'nominalValue', align: 'center', required: true }, - { text: '水平刻度档位单位', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值单位', value: 'nominalValue', align: 'center', required: true }, - { text: '技术指标', value: 'nominalValue', 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: true, width: '300' }, ]) const columns_vertical_size = ref([ // 垂直幅度 { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '通道', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗单位', value: 'nominalValue', align: 'center', required: true }, - { text: '频率', value: 'nominalValue', align: 'center', required: true }, - { text: '频率单位', value: 'nominalValue', align: 'center', required: true }, - { text: '步进', value: 'nominalValue', align: 'center', required: true }, - { text: '垂直刻度档位', value: 'nominalValue', align: 'center', required: true }, - { text: '垂直刻度档位单位', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值单位', value: 'nominalValue', align: 'center', required: true }, - { text: '技术指标', value: 'nominalValue', 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: true, width: '300' }, +]) + +const columns_frequency_bandwidth_simulate = ref([ // 频带宽度(模拟示波器) + { 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: true, width: 340 }, ]) const columns_trigger_characteristic = ref([ // 触发特性 { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '扫描方式', value: 'nominalValue', align: 'center', required: true }, - { text: '通道', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗单位', value: 'nominalValue', align: 'center', required: true }, - { text: '触发类型', value: 'nominalValue', align: 'center', required: true }, - { text: '频率', value: 'nominalValue', align: 'center', required: true }, - { text: '频率单位', value: 'nominalValue', align: 'center', required: true }, - { text: '频率上限', value: 'nominalValue', align: 'center', required: true }, - { text: '频率上限单位', value: 'nominalValue', align: 'center', required: true }, - { text: '幅度', value: 'nominalValue', align: 'center', required: true }, - { text: '幅度单位', value: 'nominalValue', 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: true, width: 340 }, ]) const columns_input_resistance_simulate = ref([ // 输入电阻(模拟示波器) { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '通道', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗单位', value: 'nominalValue', align: 'center', required: true }, - { text: '技术指标', value: 'nominalValue', 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: true, width: 300 }, ]) const columns_risetime_simulate = ref([ // 上升时间(模拟示波器) { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '通道', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗单位', value: 'nominalValue', align: 'center', required: true }, - { text: '触发类型', value: 'nominalValue', align: 'center', required: true }, - { text: '垂直刻度档位', value: 'nominalValue', align: 'center', required: true }, - { text: '垂直刻度档位单位', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值单位', value: 'nominalValue', align: 'center', required: true }, - { text: '扫描上升时间档位', value: 'nominalValue', align: 'center', required: true }, - { text: '扫描上升时间档位单位', value: 'nominalValue', align: 'center', required: true }, - { text: '技术指标', value: 'nominalValue', 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: true, width: '340' }, ]) const columns_calibrating_signal_simulate = ref([ // 校准信号(模拟示波器) { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '信号类型', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗单位', value: 'nominalValue', align: 'center', required: true }, - { text: '幅度标称值', value: 'nominalValue', align: 'center', required: true }, - { text: '幅度标称值单位', value: 'nominalValue', align: 'center', required: true }, - { text: '频率标称值', value: 'nominalValue', align: 'center', required: true }, - { text: '频率标称值单位', value: 'nominalValue', align: 'center', required: true }, - { text: '技术指标', value: 'nominalValue', 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: true, width: '340' }, ]) // --------------------------------表格操作--------------------------------------------------- @@ -294,200 +327,763 @@ * @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: '', // 周期时标信号 - cycleSignalUnit: '', // 周期时标信号单位 - technicalIndex: '', // 技术指标 - 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: '', // 标准值 - standardValueUnit: 'V', // 标准值单位 - technicalIndex: '', // 技术指标 - 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: '', // 标准值 - standardValueUnit: 'V', // 标准值单位 - technicalIndex: '', // 技术指标 - technicalIndexSymbol: '±', // 技术指标前符号 - technicalIndexUnit: '%', // 技术指标单位 - }) - break - case '频带宽度': - list.push({ - id: '', // id,更新/删除使用参数 - dataType: '4', // 检定项数据类型(一个检定项中区分两个表格)(字典code) - itemId: props.itemId, // 检定项id - params: title, // 检定项目 - impedance: '', // 阻抗 - impedanceUnit: 'Ω', // 阻抗单位 - thoroughfare: 'CH1', // 通道 - verticalDeflectCoefficient: '', // 垂直偏转系数 - verticalDeflectCoefficientUnit: 'V', // 垂直偏转系数单位 - horizontalDeflectCoefficient: '', // 水平偏转系数 - horizontalDeflectCoefficientUnit: 'ns', // 水平偏转系数单位 - referencePointFrequency: '', // 参考点频率 - referencePointFrequencyUnit: 'Hz', // 参考点频率单位 - bandWidth: '', // 频带宽度 - bandWidthUnit: 'Hz', // 频带宽度单位 - technicalIndex: '', // 技术指标 - technicalIndexSymbol: '±', // 技术指标前符号 - technicalIndexUnit: 'dB', // 技术指标单位 - }) - break - case '触发灵敏度': - list.push({ - id: '', // id,更新/删除使用参数 - dataType: '5', // 检定项数据类型(一个检定项中区分两个表格)(字典code) - itemId: props.itemId, // 检定项id - params: title, // 检定项目 - thoroughfare: 'CH1', // 通道 - triggerType: '内触发', // 触发类型 - signalFrequency: '', // 信号频率 - signalFrequencyUnit: 'V', // 信号频率单位 - verticalDeflectCoefficient: '', // 垂直偏转系数 - verticalDeflectCoefficientUnit: 'V', // 垂直偏转系数单位 - nominalValue: '', // 标称值 - nominalValueUnit: 'div', // 标称值单位 - technicalIndex: '', // 技术指标 - technicalIndexSymbol: '±', // 技术指标前符号 - technicalIndexUnit: 'dB', // 技术指标单位 - }) - break - case '上升时间': - list.push({ - id: '', // id,更新/删除使用参数 - dataType: '5', // 检定项数据类型(一个检定项中区分两个表格)(字典code) - itemId: props.itemId, // 检定项id - params: title, // 检定项目 - impedance: '', // 阻抗, - impedanceUnit: 'Ω', // 阻抗单位 - thoroughfare: 'CH1', // 通道 - verticalDeflectCoefficient: '', // 垂直偏转系数 - verticalDeflectCoefficientUnit: 'V', // 垂直偏转系数单位 - amplitude: '', // 幅度 - amplitudeUnit: 'V', // 幅度单位 - horizontalDeflectCoefficient: '', // 水平偏转系数单位 - horizontalDeflectCoefficientUnit: 'ns', // 水平偏转系数单位 - technicalIndex: '', // 技术指标 - technicalIndexSymbol: '±', // 技术指标前符号 - technicalIndexUnit: 'ns', // 技术指标单位 - }) - break - case '输入电阻': - list.push({ - id: '', // id,更新/删除使用参数 - dataType: '5', // 检定项数据类型(一个检定项中区分两个表格)(字典code) - itemId: props.itemId, // 检定项id - params: title, // 检定项目 - thoroughfare: 'CH1', // 通道 - verticalDeflectCoefficient: '', // 垂直偏转系数 - verticalDeflectCoefficientUnit: 'V', // 垂直偏转系数单位 - standardValue: '', // 标准值 - technicalIndex: '', // 技术指标 - technicalIndexSymbol: '±', // 技术指标前符号 - technicalIndexUnit: '%', // 技术指标单位 - }) - break - case '校准信号': - - break + 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: '', // 周期时标信号 + cycleSignalUnit: '', // 周期时标信号单位 + technicalIndex: '', // 技术指标 + 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: '', // 标准值 + standardValueUnit: 'V', // 标准值单位 + technicalIndex: '', // 技术指标 + 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: '', // 标准值 + standardValueUnit: 'V', // 标准值单位 + technicalIndex: '', // 技术指标 + 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: '', // 水平偏转系数 + horizontalDeflectCoefficientUnit: 'ns', // 水平偏转系数单位 + referencePointFrequency: '', // 参考点频率 + referencePointFrequencyUnit: 'Hz', // 参考点频率单位 + bandWidth: '', // 频带宽度 + bandWidthUnit: 'Hz', // 频带宽度单位 + technicalIndex: '', // 技术指标 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: 'dB', // 技术指标单位 + }) + break + case '触发灵敏度': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '5', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + thoroughfare: 'CH1', // 通道 + triggerType: '内触发', // 触发类型 + signalFrequency: '', // 信号频率 + signalFrequencyUnit: 'MHz', // 信号频率单位 + verticalDeflectCoefficient: '', // 垂直偏转系数 + verticalDeflectCoefficientUnit: 'V', // 垂直偏转系数单位 + nominalValue: '', // 标称值 + 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: '', // 幅度 + amplitudeUnit: 'V', // 幅度单位 + horizontalDeflectCoefficient: '', // 水平偏转系数单位 + horizontalDeflectCoefficientUnit: 'ns', // 水平偏转系数单位 + technicalIndex: '', // 技术指标 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: 'ns', // 技术指标单位 + }) + break + case '输入电阻': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '7', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + thoroughfare: 'CH1', // 通道 + verticalDeflectCoefficient: '', // 垂直偏转系数 + verticalDeflectCoefficientUnit: 'V', // 垂直偏转系数单位 + standardValue: '', // 标准值 + technicalIndex: '', // 技术指标 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: '%', // 技术指标单位 + }) + break + case '校准信号': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '8', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + itemType: '幅度', // 项目 + nominalValue: '', // 标称值 + nominalValueUnit: 'V', // 垂直标称值单位偏转系数单位 + verticalDeflectionGear: '', // 低电平测量时垂直偏转档位 + 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: '', // 水平刻度档位 + horizontalScaleGearUnit: 'ns', // 水平刻度档位单位 + nominalValue: '', // 标称值 + nominalValueUnit: 'ms', // 标称值单位 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: '%', // 技术指标单位 + technicalIndex: '', // 技术指标单位 + }) + 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: '', // 垂直刻度档位 + verticalScaleGearUnit: 'mV', // 垂直刻度档位单位 + nominalValue: '', // 标称值 + nominalValueUnit: 'mV', // 标称值单位 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: '%', // 技术指标单位 + technicalIndex: '', // 技术指标 + }) + break + case '频带宽度': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '3', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + thoroughfare: 'CH1', // 通道 + impedance: '50', // 阻抗 + impedanceUnit: 'Ω', // 阻抗单位 + referenceFrequency: '', // 基准频率 + referenceFrequencyUnit: 'Hz', // 基准频率单位 + stepFrequency: '', // 步进频率 + stepFrequencyUnit: 'kHz', // 步进频率单位 + verticalScaleGear: '', // 垂直刻度档位 + verticalScaleGearUnit: 'mV', // 垂直刻度档位单位 + verticalGearStep: '1-2-5', // 垂直档位步进 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: 'MHz', // 技术指标单位 + technicalIndex: '', // 技术指标 + }) + break + case '触发特性': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '4', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + scanType: 'A扫描', // 扫描类型 + thoroughfare: 'CH1', // 通道 + impedance: '50', // 阻抗 + impedanceUnit: 'Ω', // 阻抗单位 + triggerType: '内触发', // 触发类型 + frequency: '', // 频率 + frequencyUnit: 'Hz', // 频率单位 + frequencyUpper: '', // 频率上限 + frequencyUpperUnit: 'Hz', // 频率上限单位 + amplitude: '', // 幅度 + amplitudeUnit: 'mV', // 幅度单位 + referenceAmplitude: '100', // 基准幅度 + referenceAmplitudeUnit: 'mV', // 基准幅度单位 + technicalIndexSymbol: '≤', // 技术指标前符号 + technicalIndexUnit: 'mV', // 技术指标单位 + technicalIndex: '', // 技术指标 + }) + break + case '输入电阻': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '5', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + thoroughfare: 'CH1', // 通道 + impedance: '50', // 阻抗 + impedanceUnit: 'Ω', // 阻抗单位 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: '%', // 技术指标单位 + technicalIndex: '', // 技术指标 + }) + break + case '上升时间': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '6', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + thoroughfare: 'CH1', // 通道 + impedance: '50', // 阻抗 + impedanceUnit: 'Ω', // 阻抗单位 + verticalScaleGear: '', // 垂直刻度档位 + verticalScaleGearUnit: 'mV', // 垂直刻度档位单位 + amplitude: '', // 幅度 + amplitudeUnit: 'mV', // 幅度单位 + horizontalScaleGear: '', // 水平刻度档位 + horizontalScaleGearUnit: 'ns', // 水平刻度档位单位 + technicalIndexSymbol: '<', // 技术指标前符号 + technicalIndexUnit: 'ns', // 技术指标单位 + technicalIndex: '', // 技术指标 + }) + break + case '校准信号': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '7', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + signalType: '校准信号1', // 信号类型 + impedance: '50', // 阻抗 + impedanceUnit: 'Ω', // 阻抗单位 + nominalAmplitudeValue: '', // 幅度标称值 + nominalAmplitudeValueUnit: 'mV', // 幅度标称值单位 + nominalFrequencyValue: '', // 频率标称值 + nominalFrequencyValueUnit: 'kHz', // 频率标称值单位 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: '%', // 技术指标单位 + technicalIndex: '', // 技术指标 + }) + break + } } } - // } } /** * 删除行公共方法 * @param checkoutList 选中的数组 * @param list 操作的数组 */ -const delRow = (checkoutList: IList[], list: IList[]) => { +const delRow = (checkoutList: IList[], list: IList[], title: string) => { if (!checkoutList.length) { ElMessage.warning('请选中要删除的行') } else { - list = list.filter((item: any) => { - return !checkoutList.includes(item) - }) + 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 + } + } } } -// ---------------------------------------------校验--------------------------------------------------- -// 校验表格(点击保存的时候用、生成标准器示值) -const checkList = () => { - // return useCheckList(list.value, columns.value, '检定项表格') +// ------------------------------------------校验\保存之前处理数据--------------------------------------------------- +// 增加行校验表格 +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 calculateDataTop = () => { +// 保存之前校验 +const checkListBeforeSave = () => { + // 验空 + if (props.itemCategoryName === '数字示波器' && form.value.timeBase && !timeBaseList.value.length) { // 时基(示波器-数字) + ElMessage.warning('时基 不能为空') + return false + } + else if (props.itemCategoryName === '数字示波器' && form.value.currentGain && !zeroFrequencyGainList.value.length) { // 直流增益(示波器-数字) + ElMessage.warning('直流增益 不能为空') + return false + } + else if (props.itemCategoryName === '数字示波器' && form.value.currentBias && !DCBiasList.value.length) { // 直流偏置(示波器-数字) + ElMessage.warning('直流偏置 不能为空') + return false + } + else if (props.itemCategoryName === '模拟示波器' && form.value.scanTimeCoefficient && !scanningTimeList.value.length) { // 扫描时间系数及扩展(示波器-模拟) + ElMessage.warning('扫描时间系数及扩展 不能为空') + return false + } + else if (props.itemCategoryName === '模拟示波器' && form.value.verticalAmplitude && !verticalSizeList.value.length) { // 垂直幅度 + ElMessage.warning('垂直幅度 不能为空') + return false + } + else if (form.value.bandWidth) { // 频带宽度(示波器-数字/模拟) + if ((props.itemCategoryName === '数字示波器' && !frequencyBandwidthList.value.length) || (props.itemCategoryName === '模拟示波器' && !frequencyBandwidthSimulateList.value.length)) { + ElMessage.warning('频带宽度 不能为空') + return false + } + } + else if (props.itemCategoryName === '模拟示波器' && form.value.triggerCharacter && !triggerCharacteristicList.value.length) { // 触发特性 + ElMessage.warning('触发特性 不能为空') + return false + } + else if (props.itemCategoryName === '数字示波器' && form.value.triggerSensitivity && !triggerSensitivityList.value.length) { // 触发灵敏度 + ElMessage.warning('触发灵敏度 不能为空') + return false + } + else if (form.value.riseTime) { // 上升时间(数字示波器) + if ((props.itemCategoryName === '数字示波器' && !risetimeList.value.length) || (props.itemCategoryName === '模拟示波器' && !risetimeSimulateList.value.length)) { + ElMessage.warning('上升时间 不能为空') + return false + } + } + else if (form.value.inputResistance) { // 输入电阻(数字示波器) + if ((props.itemCategoryName === '数字示波器' && !inputResistanceList.value.length) && (props.itemCategoryName === '模拟示波器' && !inputResistanceSimulateList.value.length)) { + ElMessage.warning('输入电阻 不能为空') + return false + } + } + else if (form.value.calibratingSignal) { // 校准信号(示波器-数字/模拟) + if ((props.itemCategoryName === '数字示波器' && !calibratingSignalList.value.length) && (props.itemCategoryName === '模拟示波器' && !calibratingSignalSimulateList.value.length)) { + ElMessage.warning('校准信号 不能为空') + return false + } + } + console.log('--------1111111') + // 验数据 + 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, '时基') + } + else if (form.value.currentGain) { + currentGainResult = checkList(zeroFrequencyGainList.value, '直流增益') + } + else if (form.value.currentBias) { + currentBiasResult = checkList(DCBiasList.value, '直流偏置') + } + else if (form.value.bandWidth) { + bandWidthResult = checkList(frequencyBandwidthList.value, '频带宽度') + } + else if (form.value.triggerSensitivity) { + triggerSensitivityResult = checkList(triggerSensitivityList.value, '触发灵敏度') + } + else if (form.value.riseTime) { + riseTimeResult = checkList(risetimeList.value, '上升时间') + } + else if (form.value.inputResistance) { + inputResistanceResult = checkList(inputResistanceList.value, '输入电阻') + } + else 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, '扫描时间系数及扩展') + } + else if (form.value.verticalAmplitude) { + verticalAmplitudeResult = checkList(verticalSizeList.value, '垂直幅度') + } + else if (form.value.bandWidth) { + bandWidthResult = checkList(frequencyBandwidthSimulateList.value, '频带宽度') + } + else if (form.value.triggerCharacter) { + triggerCharacterResult = checkList(triggerCharacteristicList.value, '触发特性') + } + else if (form.value.inputResistance) { + inputResistanceResult = checkList(inputResistanceSimulateList.value, '输入电阻') + } + else if (form.value.riseTime) { + riseTimeResult = checkList(risetimeSimulateList.value, '上升时间') + } + else if (form.value.calibratingSignal) { + calibratingSignalResult = checkList(calibratingSignalSimulateList.value, '校准信号') + } + if (scanTimeCoefficientResult && verticalAmplitudeResult && bandWidthResult && triggerCharacterResult && inputResistanceResult && riseTimeResult && calibratingSignalResult + ) { + return true + } + else { + return false + } + } } -// 点击生成辅助接地电阻--下面表格计算 -const calculateDataBottom = () => { +// 保存之前处理数据 +const solveDataBeforeSave = () => { + // 数据处理 + let tempList = [] + 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) => { + return { + ...item, + id: '', + } + }) + return tempList } // ----------------------------------------------------------------------------------------------------- +// 校准信号项目变化 +const changeItemType = (value: string, index: number) => { + if (value === '频率') { + calibratingSignalList.value[index].verticalDeflectionGear = '/' + calibratingSignalList.value[index].verticalDeflectionGearUnit = '/' + } + else { // 幅度 + calibratingSignalList.value[index].verticalDeflectionGear = '' + calibratingSignalList.value[index].verticalDeflectionGearUnit = 'V' + } +} +// 垂直偏转系数变化 +const changeVerticalDeflectCoefficient = (param: { value: string }, type: string) => { + 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) => { + return { + ...item, + standardValue: Number(calc(Number(num), 6, '*')), // 标准值默认为垂直偏转系数*6 + } + }) as any + } + else if (type === '上升时间(数字示波器)') { + risetimeList.value = risetimeList.value.map((item) => { + return { + ...item, + amplitude: Number(calc(Number(num), 5, '*')), // 幅度默认为垂直偏转系数*6 + } + }) 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 => `${item.dataType}` === '1').map((item) => { item.params = '时基'; return item }) // 时基 + zeroFrequencyGainList.value = newVal.filter(item => `${item.dataType}` === '2').map((item) => { item.params = '直流增益'; return item }) // 直流增益 + DCBiasList.value = newVal.filter(item => `${item.dataType}` === '3').map((item) => { item.params = '直流偏置'; return item }) // 直流偏置 + frequencyBandwidthList.value = newVal.filter(item => `${item.dataType}` === '4').map((item) => { item.params = '频带宽度'; return item }) // 频带宽度(数字示波器) + triggerSensitivityList.value = newVal.filter(item => `${item.dataType}` === '5').map((item) => { item.params = '触发灵敏度'; return item })// 触发灵敏度 + risetimeList.value = newVal.filter(item => `${item.dataType}` === '6').map((item) => { item.params = '上升时间'; return item })// 上升时间(数字示波器) + inputResistanceList.value = newVal.filter(item => `${item.dataType}` === '7').map((item) => { item.params = '输入电阻'; return item })// 输入电阻(数字示波器) + calibratingSignalList.value = newVal.filter(item => `${item.dataType}` === '8').map((item) => { item.params = '校准信号'; return item })// 校准信号(数字示波器) + if (timeBaseList.value.length) { + form.value.methodType = timeBaseList.value[0].methodType // 时基方法 + } + } + else if (props.itemCategoryName === '模拟示波器') { + scanningTimeList.value = newVal.filter(item => `${item.dataType}` === '1').map((item) => { item.params = '扫描时间系数及扩展'; return item }) // 扫描时间系数及扩展 + verticalSizeList.value = newVal.filter(item => `${item.dataType}` === '2').map((item) => { item.params = '垂直幅度'; return item }) // 垂直幅度 + frequencyBandwidthSimulateList.value = newVal.filter(item => `${item.dataType}` === '3').map((item) => { item.params = '频带宽度'; return item }) // 频带宽度(模拟示波器 + triggerCharacteristicList.value = newVal.filter(item => `${item.dataType}` === '4').map((item) => { item.params = '触发特性'; return item }) // 触发特性 + inputResistanceSimulateList.value = newVal.filter(item => `${item.dataType}` === '5').map((item) => { item.params = '输入电阻'; return item })// 输入电阻 + risetimeSimulateList.value = newVal.filter(item => `${item.dataType}` === '6').map((item) => { item.params = '上升时间'; return item })// 上升时间(数字示波器) + calibratingSignalSimulateList.value = newVal.filter(item => `${item.dataType}` === '7').map((item) => { item.params = '校准信号'; return item })// 校准信号(数字示波器) + } + } +}) -// watch(() => props.list, (newVal) => { // 检定项表格 -// if (newVal) { -// list.value = [...newVal] -// } -// }) +watch(() => props.form, (newValue) => { + 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({ list }) +defineExpose({ checkListBeforeSave, solveDataBeforeSave, form }) diff --git a/src/views/business/measure/item/components/thirteenth/templateTable.vue b/src/views/business/measure/item/components/thirteenth/templateTable.vue index a210821..b645ba7 100644 --- a/src/views/business/measure/item/components/thirteenth/templateTable.vue +++ b/src/views/business/measure/item/components/thirteenth/templateTable.vue @@ -6,7 +6,7 @@ import { getDictByCode } from '@/api/system/dict' import type { dictType } from '@/global' -// ------------------定义props、 emit------------------- +// ------------------定义props、 emits------------------- const props = defineProps({ pageType: { type: String, @@ -40,7 +40,17 @@ }, // 表格大小,默认,small,mini等,与el-table条件相同 type: String, // 表格类型,表格title }) -const emit = defineEmits(['change', 'selectionChange', 'rowClick', 'rowDbClick', 'multiSelect', 'filterChange']) +const emits = defineEmits([ + 'change', + 'selectionChange', + 'rowClick', + 'rowDbClick', + 'multiSelect', + 'filterChange', + 'changeItemType', + 'changeVerticalDeflectCoefficient', + 'changeInputNumber', +]) // ------------------------------------------字典---------------------------------------------- const standardTechnicalIndexSymbolList = ref([]) // 技术指标规则 const standard13ThoroughfareList = ref([]) // 通道 @@ -51,7 +61,12 @@ const standard13TriggerTypeList = ref([]) // 触发特性 const standard13NominalValueUnitList = ref([]) // 标称值单位 const standardAmplitudeUnitList = ref([]) // 幅度单位 - +const standard13ItemList = ref([]) // 校准信号--项目 +const standard13ScanTypeList = ref([]) // 扫描方式 +const standard13VerticalGearStepList = ref([]) // 垂直档位步进 +const standardFrequencyUnitList = ref([]) // 频率单位-公用 +const characteristicAmplitudeUnitList = ref([]) // 触发特性-公用 +const standard13SignalTypeList = ref([]) // 信号类型 /** * 获取字典 */ @@ -72,7 +87,7 @@ getDictByCode('standard13VerticalDeflectCoefficient').then((response) => { standard13VerticalDeflectCoefficientList.value = response.data }) - // 垂直偏转系数(/div)单位\电压单位--公用 + // 电压单位--公用/垂直偏转系数(/div)单位 getDictByCode('standardVoltage').then((response) => { standardVoltageList.value = response.data }) @@ -96,7 +111,30 @@ getDictByCode('standardAmplitudeUnit').then((response) => { standardAmplitudeUnitList.value = response.data }) - // standard13Item + // 校准信号--项目 + getDictByCode('standard13Item').then((response) => { + standard13ItemList.value = response.data + }) + // 扫描方式 + getDictByCode('standard13ScanType').then((response) => { + standard13ScanTypeList.value = response.data + }) + // 垂直档位步进 + getDictByCode('standard13VerticalGearStep').then((response) => { + standard13VerticalGearStepList.value = response.data + }) + // 频率单位公用 + getDictByCode('standardFrequencyUnit').then((response) => { + standardFrequencyUnitList.value = response.data + }) + // 触发特性幅度单位 + getDictByCode('characteristicAmplitudeUnit').then((response) => { + characteristicAmplitudeUnitList.value = response.data + }) + // 信号类型 + getDictByCode('standard13SignalType').then((response) => { + standard13SignalTypeList.value = response.data + }) } getDict() @@ -129,16 +167,16 @@ } // 刷新 function refresh() { - emit('change') + emits('change') } // 点击行 function rowClick(row: object, column?: any, event?: any) { - emit('rowClick', row) + emits('rowClick', row) } // 双击行 function rowDbClick(row: object, column?: any, event?: any) { - emit('rowDbClick', row) + emits('rowDbClick', row) } // 监听columns watch(props.columns, (val) => { @@ -147,7 +185,7 @@ }) // 多选 const handleSelectionChange = (val: any) => { - emit('selectionChange', val) + emits('selectionChange', val) } // 清除多选选中 const clearMulti = () => { @@ -155,6 +193,20 @@ table.value!.clearSelection() singleChecked.value = '' } + +// 项目选择变化 +const changeItemType = (value: string, index: number) => { + emits('changeItemType', value, index) +} +// 垂直偏转系数变化 +const changeVerticalDeflectCoefficient = (value: string) => { + emits('changeVerticalDeflectCoefficient', value) +} + +const changeInputNumber = (value: number) => { + emits('changeInputNumber', value) +} + defineExpose({ clearMulti, initColumnsState, }) @@ -210,11 +262,13 @@ />
{{ scope.row.technicalIndexUnit }}
+ + + + + + + + + + + + @@ -240,16 +315,22 @@ v-if="item.value === 'cycleSignal' || item.value === 'standardValue' || item.value === 'referencePointFrequency' || item.value === 'bandWidth' || item.value === 'horizontalDeflectCoefficient' || item.value === 'referencePointFrequency' || item.value === 'bandWidth' - || item.value === 'nominalValue' || item.value === 'signalFrequency' || item.value === 'amplitude'" + || item.value === 'nominalValue' || item.value === 'signalFrequency' || item.value === 'amplitude' + || (item.value === 'verticalDeflectionGear' && scope.row.itemType === '幅度') || item.value === 'horizontalScaleGear' + || item.value === 'verticalScaleGear' || item.value === 'frequency' || item.value === 'referenceFrequency' + || item.value === 'stepFrequency' || item.value === 'frequencyUpper' || item.value === 'referenceAmplitude' + || item.value === 'nominalAmplitudeValue' || item.value === 'nominalFrequencyValue'" v-model="scope.row[item.value]" :placeholder="`${item.text}`" class="full-width-input" :disabled="props.pageType === 'detail'" + @change="changeInputNumber" /> - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/views/business/measure/item/detail.vue b/src/views/business/measure/item/detail.vue index 42dfc1d..efcd623 100644 --- a/src/views/business/measure/item/detail.vue +++ b/src/views/business/measure/item/detail.vue @@ -351,6 +351,17 @@ })), // 鉴定项列表 } } + else if (form.value.belongStandardEquipment === '13') { // 第13套:示波器 + if (!standardRef.value.checkListBeforeSave()) { params = '未通过校验'; return params } + const list = standardRef.value.solveDataBeforeSave() // 处理数据 + params = { + helpFieldInstruction: form.value.helpFieldInstruction, // 辅助字段说明 + itemRemark: form.value.itemRemark, // 检定项备注 + itemId: infoId.value, // 检定项id + measureItemDataOscilloscopeList: list, + ...standardRef.value.form, + } + } return params } @@ -498,6 +509,10 @@ getList.value = response.measureItemDataSpectrumAnalyzerList // 检定项表格 getObject.value = response // 检定项表单 } + else if (form.value.belongStandardEquipment === '13') { // 第13套:示波器 + getList.value = response.measureItemDataOscilloscopeList // 检定项表格 + getObject.value = response // 检定项表单 + } } function fetchInfo() { diff --git a/src/views/business/taskMeasure/measureData/components/thirteenth/templateDetail.vue b/src/views/business/taskMeasure/measureData/components/thirteenth/templateDetail.vue index cc27596..8de9c99 100644 --- a/src/views/business/taskMeasure/measureData/components/thirteenth/templateDetail.vue +++ b/src/views/business/taskMeasure/measureData/components/thirteenth/templateDetail.vue @@ -36,6 +36,8 @@ belongStandardEquipment: '', // 标准装置code belongStandardEquipmentName: '', // 标准装置名称 + methodType: '', // 时基方法 + appearance: '正常', // 外观及功能性检查 appearanceFunctionCheck: 1, // 外观及功能性检查 timeBase: 1, // 时基(示波器-数字) currentGain: 1, // 直流增益(示波器-数字) @@ -84,28 +86,50 @@ const risetimeSimulateList = ref([]) // 上升时间(模拟示波器) const calibratingSignalSimulateList = ref([]) // 校准信号(模拟示波器) -const columns_time_base = ref([ // 时基 - { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '周期时标信号', value: 'nominalValue', align: 'center', required: true }, - { text: '周期时标信号△T/ns', value: 'nominalValue', align: 'center', required: true }, - { text: '时基相对误差△δ', value: 'nominalValue', align: 'center', required: true }, - { text: '技术指标', value: 'nominalValue', align: 'center', required: true }, - { text: '结论', value: 'nominalValue', align: 'center', required: true }, +const timeBaseLoading = ref(false) // 时基 +const zeroFrequencyGainLoading = ref(false) // 直流增益 +const DCBiasLoading = ref(false) // 直流偏置 +const frequencyBandwidthLoading = ref(false) // 频带宽度(数字示波器) +const triggerSensitivityLoading = ref(false) // 触发灵敏度 +const risetimeLoading = ref(false) // 上升时间(数字示波器) +const inputResistanceLoading = ref(false) // 输入电阻(数字示波器) +const calibratingSignalLoading = ref(false) // 校准信号(数字示波器) +const scanningTimeLoading = ref(false) // 扫描时间系数及扩展 +const verticalSizeLoading = ref(false) // 垂直幅度 +const frequencyBandwidthSimulateLoading = ref(false) // 频带宽度(模拟示波器) +const triggerCharacteristicLoading = ref(false) // 触发特性 +const inputResistanceSimulateLoading = ref(false) // 输入电阻(模拟示波器) +const risetimeSimulateLoading = ref(false) // 上升时间(模拟示波器) +const calibratingSignalSimulateLoading = ref(false) // 校准信号(模拟示波器) + +const columns_time_base_method1 = ref([ // 时基--方法一 + { text: '检定项目', value: 'params', align: 'center', required: true, width: '90' }, + { text: '周期时标信号', value: 'cycleSignalDefineFront', align: 'center', required: true }, + { text: '时基绝对误差△T/ns', value: 'timeBaseAbsoluteError', align: 'center', required: true, width: '180' }, + { text: '时基相对误差△δ', value: 'timeBaseRelativeError', align: 'center', required: false }, + { text: '技术指标', value: 'technicalIndexDefineFront', align: 'center', required: true }, + { text: '结论', value: 'conclusion', align: 'center', required: false }, +]) + +const columns_time_base_method2 = ref([ // 时基--方法二 + { text: '检定项目', value: 'params', align: 'center', required: true, width: '90' }, + { text: '参考输出', value: 'cycleSignal', align: 'center', required: true }, + { text: '差拍波形频率测量值(Hz)', value: 'timeBaseAbsoluteError', align: 'center', required: true, width: '180' }, + { text: '时基相对误差△δ', value: 'timeBaseRelativeError', align: 'center', required: false }, + { text: '技术指标', value: 'technicalIndexDefineFront', align: 'center', required: true }, + { text: '结论', value: 'conclusion', align: 'center', required: false }, ]) const columns_zero_frequency_gain = ref([ // 直流增益 - { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '阻抗', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗单位', value: 'nominalValue', align: 'center', required: true }, - { text: '通道', value: 'nominalValue', align: 'center', required: true }, - { text: '垂直偏转系数(/div)', value: 'nominalValue', align: 'center', required: true }, - { text: '垂直偏转系数(/div)单位', value: 'nominalValue', align: 'center', required: true }, - { text: '标准值', value: 'nominalValue', align: 'center', required: true }, - { text: '标准值单位', value: 'nominalValue', align: 'center', required: true }, - { text: '测量值', value: 'nominalValue', align: 'center', required: true }, - { text: '相对误差', value: 'nominalValue', align: 'center', required: true }, - { text: '技术指标', value: 'nominalValue', align: 'center', required: true }, - { text: '结论', value: 'nominalValue', align: 'center', required: true }, + { text: '检定项目', value: 'params', align: 'center', required: true, width: '90' }, + { text: '阻抗', value: 'impedanceDefineFront', align: 'center', required: true }, + { text: '通道', value: 'thoroughfare', align: 'center', required: true }, + { text: '垂直偏转系数(/div)', value: 'verticalDeflectCoefficientDefineFront', align: 'center', required: true }, + { text: '标准值', value: 'standardValueDefineFront', align: 'center', required: true }, + { text: '测量值', value: 'measureValue', align: 'center', required: true, width: '180' }, + { text: '相对误差', value: 'relativeError', align: 'center', required: false }, + { text: '技术指标', value: 'technicalIndexDefineFront', align: 'center', required: true }, + { text: '结论', value: 'conclusion', align: 'center', required: false }, ]) const columns_DC_bias = ref([ // 直流偏置 @@ -322,7 +346,40 @@ // 初始化输入数据 const initInputData = (data: any) => { - + if (itemFormData.value.itemCategoryName === '数字示波器') { + // 时基 + timeBaseList.value = data.filter(item => `${item.dataType}` === '1') + timeBaseList.value = timeBaseList.value.map((item) => { + return { + ...item, + params: '时基', + cycleSignalDefineFront: item.cycleSignal + item.cycleSignalUnit, // 周期时标信号 + timeBaseAbsoluteError: '', // 时基绝对误差△T/ns + timeBaseRelativeError: '', // 时基相对误差△δ + technicalIndexDefineFront: item.technicalIndexSymbol + item.technicalIndex + item.technicalIndexUnit, // 技术指标 + conclusion: '', // 结论 + } + }) + // 直流增益 + zeroFrequencyGainList.value = data.filter(item => `${item.dataType}` === '2') + zeroFrequencyGainList.value = zeroFrequencyGainList.value.map((item) => { + return { + ...item, + params: '直流增益', + impedanceDefineFront: item.impedance + item.impedanceUnit, // 阻抗 + verticalDeflectCoefficientDefineFront: item.verticalDeflectCoefficient + item.verticalDeflectCoefficientUnit, // 垂直偏转系数 + standardValueDefineFront: item.standardValue + item.standardValueUnit, // 标准值 + measureValue: '', // 测量值 + measureValueUnit: item.standardValueUnit, // 测量值单位 + relativeError: '', // 相对误差 + technicalIndexDefineFront: item.technicalIndexSymbol + item.technicalIndex + item.technicalIndexUnit, // 技术指标 + conclusion: '', // 结论 + } + }) + } + else if (itemFormData.value.itemCategoryName === '模拟示波器') { + console.log('模拟示波器') + } } /** @@ -338,44 +395,115 @@ belongStandardEquipment, // 检校标准装置字典code } getItemInfo(params).then((res) => { - itemFormData.value.appearance = res.data.measureItemConfigPistonGauge.appearance ? '1' : '' // 外观及功能检查 1有外观,2没有外观 - initInputData(res.data.measureItemDataPistonGaugeList) + itemFormData.value.appearance = res.data.appearanceFunctionCheck ? '1' : '' // 外观及功能检查 1有外观,2没有外观 + itemFormData.value.appearanceFunctionCheck = res.data.appearanceFunctionCheck // 外观及功能检查 1有外观,2没有外观 + itemFormData.value.timeBase = res.data.timeBase // 时基 + itemFormData.value.currentGain = res.data.currentGain // 直流增益 + itemFormData.value.currentBias = res.data.currentBias // 直流偏置 + itemFormData.value.bandWidth = res.data.bandWidth // 频带宽度 + itemFormData.value.triggerSensitivity = res.data.triggerSensitivity // 触发灵敏度 + itemFormData.value.riseTime = res.data.riseTime // 上升时间 + itemFormData.value.inputResistance = res.data.inputResistance // 输入电阻 + itemFormData.value.calibratingSignal = res.data.calibratingSignal // 校准信号 + itemFormData.value.scanTimeCoefficient = res.data.scanTimeCoefficient // 扫描时间系数及扩展 + itemFormData.value.triggerCharacter = res.data.triggerCharacter // 触发特性 + itemFormData.value.verticalAmplitude = res.data.verticalAmplitude // 垂直幅度 + + const tempTimeBaseList = res.data.measureItemDataOscilloscopeList.filter(item => `${item.dataType}` === '1') + if (tempTimeBaseList && tempTimeBaseList.length) { + itemFormData.value.methodType = tempTimeBaseList[0].methodType + } + initInputData(res.data.measureItemDataOscilloscopeList) }) } // ----------------------------------------点击保存时校验--------------------------------------- -// 校验 -const checkout = () => { +// 点击计算结果校验 +const checkout = (type: string) => { + let result = true + switch (type) { + case '时基': { + const columns = itemFormData.value.methodType === '方法一' ? columns_time_base_method1.value : columns_time_base_method2.value + result = useCheckList(timeBaseList.value, columns, type) + break + } + case '直流增益': + result = useCheckList(zeroFrequencyGainList.value, columns_zero_frequency_gain.value, type) + break + default: + break + } + return result +} + +// 计算之前参数处理 +const solveParamsBeforeCalculate = (type: string) => { + let list = [] + switch (type) { + case '时基': + list = timeBaseList.value + break + case '直流增益': + list = zeroFrequencyGainList.value + break + default: + break + } + return list +} + +// 计算之后参数处理 +const solveParamsAfterCalculate = (type: string, list) => { + switch (type) { + case '时基': + timeBaseList.value = timeBaseList.value.map((item, index) => { + return { + ...item, + timeBaseRelativeError: list[index].timeBaseRelativeError, + conclusion: list[index].conclusion, + exceedMark: list[index].exceedMark, + } + }) + break + case '直流增益': + zeroFrequencyGainList.value = zeroFrequencyGainList.value.map((item, index) => { + return { + ...item, + relativeError: list[index].relativeError, + conclusion: list[index].conclusion, + exceedMark: list[index].exceedMark, + } + }) + break + default: + break + } + return list } // -----------------------------------------生成结果处理---------------------------------------- // 点击计算结果 -const calculate = () => { - // ElMessage.info('敬请期待') - return false - // if (!list.value.length) { - // ElMessage.warning('没有检定项数据,无法生成结果') - // return false - // } - // if (!useCheckList(list.value, measureColumns.value, '检定数据')) { - // return false - // } - // const params = { - // belongStandardEquipment: itemFormData.value.belongStandardEquipment, // 检校标准装置 - // itemCategoryName: itemFormData.value.itemCategoryName, // 检定项分类名称 - // measureDataCalibratorList: list.value, - // } - // calculateHandle(params).then((res) => { - // if (res.data && res.data.length) { - // resultList.value = res.data.map((item: IDetailMeasureList) => { - // return { - // ...item, - // } - // }) // 检定数据 - // } - // else { - // list.value = res.data - // } - // }) +const calculate = (type: string) => { + if (!checkout(type)) { + return false + } + const list = solveParamsBeforeCalculate(type) + timeBaseLoading.value = type === '时基' + zeroFrequencyGainLoading.value = type === '直流增益' + const params = { + belongStandardEquipment: itemFormData.value.belongStandardEquipment, // 检校标准装置 + itemCategoryName: itemFormData.value.itemCategoryName, // 检定项分类名称 + measureDataOscilloscopeList: list, + } + calculateHandle(params).then((res) => { + if (res.data && res.data.length) { + solveParamsAfterCalculate(type, res.data) + } + timeBaseLoading.value = false + zeroFrequencyGainLoading.value = false + }).catch(() => { + timeBaseLoading.value = false + zeroFrequencyGainLoading.value = false + }) } // ------------------------------------------钩子---------------------------------------------- @@ -394,7 +522,7 @@ itemFormData.value.belongStandardEquipment = $route.query.belongStandardEquipment as string// 标准装置code itemFormData.value.belongStandardEquipmentName = $route.query.belongStandardEquipmentName as string// 标准装置名称 // 查输入值(查检定项管理的详情) - // fetchItemInfo($route.query.itemId! as string, $route.query.itemCategoryName! as string, $route.query.belongStandardEquipment as string) + fetchItemInfo($route.query.itemId! as string, $route.query.itemCategoryName! as string, $route.query.belongStandardEquipment as string) } else { itemFormData.value.itemCategoryName = $route.query.itemCategoryName as string // 设备检定项分类名称 @@ -446,26 +574,27 @@ - + + - + @@ -475,11 +604,11 @@ - + diff --git a/src/views/business/taskMeasure/measureData/components/thirteenth/templateTable.vue b/src/views/business/taskMeasure/measureData/components/thirteenth/templateTable.vue index 7cf8109..cf900a1 100644 --- a/src/views/business/taskMeasure/measureData/components/thirteenth/templateTable.vue +++ b/src/views/business/taskMeasure/measureData/components/thirteenth/templateTable.vue @@ -149,20 +149,34 @@ - diff --git a/src/components/SelectByDict/index.vue b/src/components/SelectByDict/index.vue index 20a7e0c..83fc909 100644 --- a/src/components/SelectByDict/index.vue +++ b/src/components/SelectByDict/index.vue @@ -24,7 +24,7 @@ required: true, }, }) -const emit = defineEmits(['update:modelValue', 'getDictValue']) +const emit = defineEmits(['update:modelValue', 'getDictValue', 'changeValue']) const checkItem = ref({}) // 选中的选项 const input = ref() // 输入框组件 // -------------------------定义数据-------------------- @@ -91,6 +91,7 @@ const data = dictList.value.filter(item => item.name === inputValue).length if (!data) { console.log(inputValue, '该值不存在添加字典') + emit('changeValue', inputValue) // 在字典中添加该值 getDictAllList().then((res) => { const currentDict = res.data.filter(item => item.code === props.dictCode)[0] @@ -124,6 +125,7 @@ } else { console.log(inputValue, '该值存在') + emit('changeValue', inputValue) // 发送 绑定的value (可用可不用) emit('getDictValue', dictList.value.filter(item => item.name === inputValue)[0].value1) // setTimeout(() => { diff --git a/src/views/business/measure/item/components/thirteenth/templateDetail-interface.ts b/src/views/business/measure/item/components/thirteenth/templateDetail-interface.ts index 7662387..708ffd9 100644 --- a/src/views/business/measure/item/components/thirteenth/templateDetail-interface.ts +++ b/src/views/business/measure/item/components/thirteenth/templateDetail-interface.ts @@ -34,6 +34,8 @@ amplitude?: string // 幅度 amplitudeUnit?: string // 幅度单位 + verticalDeflectionGear?: string // 低电平测量时垂直偏转档位 + verticalDeflectionGearUnit?: string // 低电平测量时垂直偏转档位单位 frequency?: string // 频率(模拟示波器) frequencyUnit?: string // 频率单位(模拟示波器) @@ -54,8 +56,6 @@ signalType?: string // 信号类型(模拟示波器)(字典value) stepFrequency?: string // 步进频率(模拟示波器) stepFrequencyUnit?: string // 步进频率单位(模拟示波器) - verticalDeflectionGear?: string // 低电平测量时垂直偏转档位 - verticalDeflectionGearUnit?: string // 低电平测量时垂直偏转档位单位 verticalGearStep?: string // 垂直档位步进(模拟示波器) verticalScaleGear?: string // 垂直刻度档位(模拟示波器) verticalScaleGearUnit?: string // 垂直刻度档位单位(模拟示波器) diff --git a/src/views/business/measure/item/components/thirteenth/templateDetail.vue b/src/views/business/measure/item/components/thirteenth/templateDetail.vue index cb67fcf..b43e364 100644 --- a/src/views/business/measure/item/components/thirteenth/templateDetail.vue +++ b/src/views/business/measure/item/components/thirteenth/templateDetail.vue @@ -9,6 +9,8 @@ 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: { @@ -37,6 +39,18 @@ 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) @@ -144,8 +158,8 @@ const columns_input_resistance = ref([ // 输入电阻(数字示波器) { text: '检定项目', value: 'params', align: 'center', required: true }, { text: '通道', value: 'thoroughfare', 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: '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: true, width: 300 }, @@ -153,87 +167,106 @@ const columns_calibrating_signal = ref([ // 校准信号(数字示波器) { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '项目', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值单位', value: 'nominalValue', 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([ // 扫描时间系数及扩展 { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '扫描方式', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗单位', value: 'nominalValue', align: 'center', required: true }, - { text: '步进', value: 'nominalValue', align: 'center', required: true }, - { text: '水平刻度档位', value: 'nominalValue', align: 'center', required: true }, - { text: '水平刻度档位单位', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值单位', value: 'nominalValue', align: 'center', required: true }, - { text: '技术指标', value: 'nominalValue', 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: true, width: '300' }, ]) const columns_vertical_size = ref([ // 垂直幅度 { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '通道', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗单位', value: 'nominalValue', align: 'center', required: true }, - { text: '频率', value: 'nominalValue', align: 'center', required: true }, - { text: '频率单位', value: 'nominalValue', align: 'center', required: true }, - { text: '步进', value: 'nominalValue', align: 'center', required: true }, - { text: '垂直刻度档位', value: 'nominalValue', align: 'center', required: true }, - { text: '垂直刻度档位单位', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值单位', value: 'nominalValue', align: 'center', required: true }, - { text: '技术指标', value: 'nominalValue', 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: true, width: '300' }, +]) + +const columns_frequency_bandwidth_simulate = ref([ // 频带宽度(模拟示波器) + { 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: true, width: 340 }, ]) const columns_trigger_characteristic = ref([ // 触发特性 { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '扫描方式', value: 'nominalValue', align: 'center', required: true }, - { text: '通道', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗单位', value: 'nominalValue', align: 'center', required: true }, - { text: '触发类型', value: 'nominalValue', align: 'center', required: true }, - { text: '频率', value: 'nominalValue', align: 'center', required: true }, - { text: '频率单位', value: 'nominalValue', align: 'center', required: true }, - { text: '频率上限', value: 'nominalValue', align: 'center', required: true }, - { text: '频率上限单位', value: 'nominalValue', align: 'center', required: true }, - { text: '幅度', value: 'nominalValue', align: 'center', required: true }, - { text: '幅度单位', value: 'nominalValue', 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: true, width: 340 }, ]) const columns_input_resistance_simulate = ref([ // 输入电阻(模拟示波器) { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '通道', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗单位', value: 'nominalValue', align: 'center', required: true }, - { text: '技术指标', value: 'nominalValue', 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: true, width: 300 }, ]) const columns_risetime_simulate = ref([ // 上升时间(模拟示波器) { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '通道', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗单位', value: 'nominalValue', align: 'center', required: true }, - { text: '触发类型', value: 'nominalValue', align: 'center', required: true }, - { text: '垂直刻度档位', value: 'nominalValue', align: 'center', required: true }, - { text: '垂直刻度档位单位', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值单位', value: 'nominalValue', align: 'center', required: true }, - { text: '扫描上升时间档位', value: 'nominalValue', align: 'center', required: true }, - { text: '扫描上升时间档位单位', value: 'nominalValue', align: 'center', required: true }, - { text: '技术指标', value: 'nominalValue', 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: true, width: '340' }, ]) const columns_calibrating_signal_simulate = ref([ // 校准信号(模拟示波器) { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '信号类型', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗单位', value: 'nominalValue', align: 'center', required: true }, - { text: '幅度标称值', value: 'nominalValue', align: 'center', required: true }, - { text: '幅度标称值单位', value: 'nominalValue', align: 'center', required: true }, - { text: '频率标称值', value: 'nominalValue', align: 'center', required: true }, - { text: '频率标称值单位', value: 'nominalValue', align: 'center', required: true }, - { text: '技术指标', value: 'nominalValue', 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: true, width: '340' }, ]) // --------------------------------表格操作--------------------------------------------------- @@ -294,200 +327,763 @@ * @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: '', // 周期时标信号 - cycleSignalUnit: '', // 周期时标信号单位 - technicalIndex: '', // 技术指标 - 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: '', // 标准值 - standardValueUnit: 'V', // 标准值单位 - technicalIndex: '', // 技术指标 - 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: '', // 标准值 - standardValueUnit: 'V', // 标准值单位 - technicalIndex: '', // 技术指标 - technicalIndexSymbol: '±', // 技术指标前符号 - technicalIndexUnit: '%', // 技术指标单位 - }) - break - case '频带宽度': - list.push({ - id: '', // id,更新/删除使用参数 - dataType: '4', // 检定项数据类型(一个检定项中区分两个表格)(字典code) - itemId: props.itemId, // 检定项id - params: title, // 检定项目 - impedance: '', // 阻抗 - impedanceUnit: 'Ω', // 阻抗单位 - thoroughfare: 'CH1', // 通道 - verticalDeflectCoefficient: '', // 垂直偏转系数 - verticalDeflectCoefficientUnit: 'V', // 垂直偏转系数单位 - horizontalDeflectCoefficient: '', // 水平偏转系数 - horizontalDeflectCoefficientUnit: 'ns', // 水平偏转系数单位 - referencePointFrequency: '', // 参考点频率 - referencePointFrequencyUnit: 'Hz', // 参考点频率单位 - bandWidth: '', // 频带宽度 - bandWidthUnit: 'Hz', // 频带宽度单位 - technicalIndex: '', // 技术指标 - technicalIndexSymbol: '±', // 技术指标前符号 - technicalIndexUnit: 'dB', // 技术指标单位 - }) - break - case '触发灵敏度': - list.push({ - id: '', // id,更新/删除使用参数 - dataType: '5', // 检定项数据类型(一个检定项中区分两个表格)(字典code) - itemId: props.itemId, // 检定项id - params: title, // 检定项目 - thoroughfare: 'CH1', // 通道 - triggerType: '内触发', // 触发类型 - signalFrequency: '', // 信号频率 - signalFrequencyUnit: 'V', // 信号频率单位 - verticalDeflectCoefficient: '', // 垂直偏转系数 - verticalDeflectCoefficientUnit: 'V', // 垂直偏转系数单位 - nominalValue: '', // 标称值 - nominalValueUnit: 'div', // 标称值单位 - technicalIndex: '', // 技术指标 - technicalIndexSymbol: '±', // 技术指标前符号 - technicalIndexUnit: 'dB', // 技术指标单位 - }) - break - case '上升时间': - list.push({ - id: '', // id,更新/删除使用参数 - dataType: '5', // 检定项数据类型(一个检定项中区分两个表格)(字典code) - itemId: props.itemId, // 检定项id - params: title, // 检定项目 - impedance: '', // 阻抗, - impedanceUnit: 'Ω', // 阻抗单位 - thoroughfare: 'CH1', // 通道 - verticalDeflectCoefficient: '', // 垂直偏转系数 - verticalDeflectCoefficientUnit: 'V', // 垂直偏转系数单位 - amplitude: '', // 幅度 - amplitudeUnit: 'V', // 幅度单位 - horizontalDeflectCoefficient: '', // 水平偏转系数单位 - horizontalDeflectCoefficientUnit: 'ns', // 水平偏转系数单位 - technicalIndex: '', // 技术指标 - technicalIndexSymbol: '±', // 技术指标前符号 - technicalIndexUnit: 'ns', // 技术指标单位 - }) - break - case '输入电阻': - list.push({ - id: '', // id,更新/删除使用参数 - dataType: '5', // 检定项数据类型(一个检定项中区分两个表格)(字典code) - itemId: props.itemId, // 检定项id - params: title, // 检定项目 - thoroughfare: 'CH1', // 通道 - verticalDeflectCoefficient: '', // 垂直偏转系数 - verticalDeflectCoefficientUnit: 'V', // 垂直偏转系数单位 - standardValue: '', // 标准值 - technicalIndex: '', // 技术指标 - technicalIndexSymbol: '±', // 技术指标前符号 - technicalIndexUnit: '%', // 技术指标单位 - }) - break - case '校准信号': - - break + 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: '', // 周期时标信号 + cycleSignalUnit: '', // 周期时标信号单位 + technicalIndex: '', // 技术指标 + 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: '', // 标准值 + standardValueUnit: 'V', // 标准值单位 + technicalIndex: '', // 技术指标 + 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: '', // 标准值 + standardValueUnit: 'V', // 标准值单位 + technicalIndex: '', // 技术指标 + 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: '', // 水平偏转系数 + horizontalDeflectCoefficientUnit: 'ns', // 水平偏转系数单位 + referencePointFrequency: '', // 参考点频率 + referencePointFrequencyUnit: 'Hz', // 参考点频率单位 + bandWidth: '', // 频带宽度 + bandWidthUnit: 'Hz', // 频带宽度单位 + technicalIndex: '', // 技术指标 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: 'dB', // 技术指标单位 + }) + break + case '触发灵敏度': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '5', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + thoroughfare: 'CH1', // 通道 + triggerType: '内触发', // 触发类型 + signalFrequency: '', // 信号频率 + signalFrequencyUnit: 'MHz', // 信号频率单位 + verticalDeflectCoefficient: '', // 垂直偏转系数 + verticalDeflectCoefficientUnit: 'V', // 垂直偏转系数单位 + nominalValue: '', // 标称值 + 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: '', // 幅度 + amplitudeUnit: 'V', // 幅度单位 + horizontalDeflectCoefficient: '', // 水平偏转系数单位 + horizontalDeflectCoefficientUnit: 'ns', // 水平偏转系数单位 + technicalIndex: '', // 技术指标 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: 'ns', // 技术指标单位 + }) + break + case '输入电阻': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '7', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + thoroughfare: 'CH1', // 通道 + verticalDeflectCoefficient: '', // 垂直偏转系数 + verticalDeflectCoefficientUnit: 'V', // 垂直偏转系数单位 + standardValue: '', // 标准值 + technicalIndex: '', // 技术指标 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: '%', // 技术指标单位 + }) + break + case '校准信号': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '8', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + itemType: '幅度', // 项目 + nominalValue: '', // 标称值 + nominalValueUnit: 'V', // 垂直标称值单位偏转系数单位 + verticalDeflectionGear: '', // 低电平测量时垂直偏转档位 + 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: '', // 水平刻度档位 + horizontalScaleGearUnit: 'ns', // 水平刻度档位单位 + nominalValue: '', // 标称值 + nominalValueUnit: 'ms', // 标称值单位 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: '%', // 技术指标单位 + technicalIndex: '', // 技术指标单位 + }) + 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: '', // 垂直刻度档位 + verticalScaleGearUnit: 'mV', // 垂直刻度档位单位 + nominalValue: '', // 标称值 + nominalValueUnit: 'mV', // 标称值单位 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: '%', // 技术指标单位 + technicalIndex: '', // 技术指标 + }) + break + case '频带宽度': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '3', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + thoroughfare: 'CH1', // 通道 + impedance: '50', // 阻抗 + impedanceUnit: 'Ω', // 阻抗单位 + referenceFrequency: '', // 基准频率 + referenceFrequencyUnit: 'Hz', // 基准频率单位 + stepFrequency: '', // 步进频率 + stepFrequencyUnit: 'kHz', // 步进频率单位 + verticalScaleGear: '', // 垂直刻度档位 + verticalScaleGearUnit: 'mV', // 垂直刻度档位单位 + verticalGearStep: '1-2-5', // 垂直档位步进 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: 'MHz', // 技术指标单位 + technicalIndex: '', // 技术指标 + }) + break + case '触发特性': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '4', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + scanType: 'A扫描', // 扫描类型 + thoroughfare: 'CH1', // 通道 + impedance: '50', // 阻抗 + impedanceUnit: 'Ω', // 阻抗单位 + triggerType: '内触发', // 触发类型 + frequency: '', // 频率 + frequencyUnit: 'Hz', // 频率单位 + frequencyUpper: '', // 频率上限 + frequencyUpperUnit: 'Hz', // 频率上限单位 + amplitude: '', // 幅度 + amplitudeUnit: 'mV', // 幅度单位 + referenceAmplitude: '100', // 基准幅度 + referenceAmplitudeUnit: 'mV', // 基准幅度单位 + technicalIndexSymbol: '≤', // 技术指标前符号 + technicalIndexUnit: 'mV', // 技术指标单位 + technicalIndex: '', // 技术指标 + }) + break + case '输入电阻': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '5', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + thoroughfare: 'CH1', // 通道 + impedance: '50', // 阻抗 + impedanceUnit: 'Ω', // 阻抗单位 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: '%', // 技术指标单位 + technicalIndex: '', // 技术指标 + }) + break + case '上升时间': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '6', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + thoroughfare: 'CH1', // 通道 + impedance: '50', // 阻抗 + impedanceUnit: 'Ω', // 阻抗单位 + verticalScaleGear: '', // 垂直刻度档位 + verticalScaleGearUnit: 'mV', // 垂直刻度档位单位 + amplitude: '', // 幅度 + amplitudeUnit: 'mV', // 幅度单位 + horizontalScaleGear: '', // 水平刻度档位 + horizontalScaleGearUnit: 'ns', // 水平刻度档位单位 + technicalIndexSymbol: '<', // 技术指标前符号 + technicalIndexUnit: 'ns', // 技术指标单位 + technicalIndex: '', // 技术指标 + }) + break + case '校准信号': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '7', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + signalType: '校准信号1', // 信号类型 + impedance: '50', // 阻抗 + impedanceUnit: 'Ω', // 阻抗单位 + nominalAmplitudeValue: '', // 幅度标称值 + nominalAmplitudeValueUnit: 'mV', // 幅度标称值单位 + nominalFrequencyValue: '', // 频率标称值 + nominalFrequencyValueUnit: 'kHz', // 频率标称值单位 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: '%', // 技术指标单位 + technicalIndex: '', // 技术指标 + }) + break + } } } - // } } /** * 删除行公共方法 * @param checkoutList 选中的数组 * @param list 操作的数组 */ -const delRow = (checkoutList: IList[], list: IList[]) => { +const delRow = (checkoutList: IList[], list: IList[], title: string) => { if (!checkoutList.length) { ElMessage.warning('请选中要删除的行') } else { - list = list.filter((item: any) => { - return !checkoutList.includes(item) - }) + 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 + } + } } } -// ---------------------------------------------校验--------------------------------------------------- -// 校验表格(点击保存的时候用、生成标准器示值) -const checkList = () => { - // return useCheckList(list.value, columns.value, '检定项表格') +// ------------------------------------------校验\保存之前处理数据--------------------------------------------------- +// 增加行校验表格 +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 calculateDataTop = () => { +// 保存之前校验 +const checkListBeforeSave = () => { + // 验空 + if (props.itemCategoryName === '数字示波器' && form.value.timeBase && !timeBaseList.value.length) { // 时基(示波器-数字) + ElMessage.warning('时基 不能为空') + return false + } + else if (props.itemCategoryName === '数字示波器' && form.value.currentGain && !zeroFrequencyGainList.value.length) { // 直流增益(示波器-数字) + ElMessage.warning('直流增益 不能为空') + return false + } + else if (props.itemCategoryName === '数字示波器' && form.value.currentBias && !DCBiasList.value.length) { // 直流偏置(示波器-数字) + ElMessage.warning('直流偏置 不能为空') + return false + } + else if (props.itemCategoryName === '模拟示波器' && form.value.scanTimeCoefficient && !scanningTimeList.value.length) { // 扫描时间系数及扩展(示波器-模拟) + ElMessage.warning('扫描时间系数及扩展 不能为空') + return false + } + else if (props.itemCategoryName === '模拟示波器' && form.value.verticalAmplitude && !verticalSizeList.value.length) { // 垂直幅度 + ElMessage.warning('垂直幅度 不能为空') + return false + } + else if (form.value.bandWidth) { // 频带宽度(示波器-数字/模拟) + if ((props.itemCategoryName === '数字示波器' && !frequencyBandwidthList.value.length) || (props.itemCategoryName === '模拟示波器' && !frequencyBandwidthSimulateList.value.length)) { + ElMessage.warning('频带宽度 不能为空') + return false + } + } + else if (props.itemCategoryName === '模拟示波器' && form.value.triggerCharacter && !triggerCharacteristicList.value.length) { // 触发特性 + ElMessage.warning('触发特性 不能为空') + return false + } + else if (props.itemCategoryName === '数字示波器' && form.value.triggerSensitivity && !triggerSensitivityList.value.length) { // 触发灵敏度 + ElMessage.warning('触发灵敏度 不能为空') + return false + } + else if (form.value.riseTime) { // 上升时间(数字示波器) + if ((props.itemCategoryName === '数字示波器' && !risetimeList.value.length) || (props.itemCategoryName === '模拟示波器' && !risetimeSimulateList.value.length)) { + ElMessage.warning('上升时间 不能为空') + return false + } + } + else if (form.value.inputResistance) { // 输入电阻(数字示波器) + if ((props.itemCategoryName === '数字示波器' && !inputResistanceList.value.length) && (props.itemCategoryName === '模拟示波器' && !inputResistanceSimulateList.value.length)) { + ElMessage.warning('输入电阻 不能为空') + return false + } + } + else if (form.value.calibratingSignal) { // 校准信号(示波器-数字/模拟) + if ((props.itemCategoryName === '数字示波器' && !calibratingSignalList.value.length) && (props.itemCategoryName === '模拟示波器' && !calibratingSignalSimulateList.value.length)) { + ElMessage.warning('校准信号 不能为空') + return false + } + } + console.log('--------1111111') + // 验数据 + 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, '时基') + } + else if (form.value.currentGain) { + currentGainResult = checkList(zeroFrequencyGainList.value, '直流增益') + } + else if (form.value.currentBias) { + currentBiasResult = checkList(DCBiasList.value, '直流偏置') + } + else if (form.value.bandWidth) { + bandWidthResult = checkList(frequencyBandwidthList.value, '频带宽度') + } + else if (form.value.triggerSensitivity) { + triggerSensitivityResult = checkList(triggerSensitivityList.value, '触发灵敏度') + } + else if (form.value.riseTime) { + riseTimeResult = checkList(risetimeList.value, '上升时间') + } + else if (form.value.inputResistance) { + inputResistanceResult = checkList(inputResistanceList.value, '输入电阻') + } + else 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, '扫描时间系数及扩展') + } + else if (form.value.verticalAmplitude) { + verticalAmplitudeResult = checkList(verticalSizeList.value, '垂直幅度') + } + else if (form.value.bandWidth) { + bandWidthResult = checkList(frequencyBandwidthSimulateList.value, '频带宽度') + } + else if (form.value.triggerCharacter) { + triggerCharacterResult = checkList(triggerCharacteristicList.value, '触发特性') + } + else if (form.value.inputResistance) { + inputResistanceResult = checkList(inputResistanceSimulateList.value, '输入电阻') + } + else if (form.value.riseTime) { + riseTimeResult = checkList(risetimeSimulateList.value, '上升时间') + } + else if (form.value.calibratingSignal) { + calibratingSignalResult = checkList(calibratingSignalSimulateList.value, '校准信号') + } + if (scanTimeCoefficientResult && verticalAmplitudeResult && bandWidthResult && triggerCharacterResult && inputResistanceResult && riseTimeResult && calibratingSignalResult + ) { + return true + } + else { + return false + } + } } -// 点击生成辅助接地电阻--下面表格计算 -const calculateDataBottom = () => { +// 保存之前处理数据 +const solveDataBeforeSave = () => { + // 数据处理 + let tempList = [] + 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) => { + return { + ...item, + id: '', + } + }) + return tempList } // ----------------------------------------------------------------------------------------------------- +// 校准信号项目变化 +const changeItemType = (value: string, index: number) => { + if (value === '频率') { + calibratingSignalList.value[index].verticalDeflectionGear = '/' + calibratingSignalList.value[index].verticalDeflectionGearUnit = '/' + } + else { // 幅度 + calibratingSignalList.value[index].verticalDeflectionGear = '' + calibratingSignalList.value[index].verticalDeflectionGearUnit = 'V' + } +} +// 垂直偏转系数变化 +const changeVerticalDeflectCoefficient = (param: { value: string }, type: string) => { + 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) => { + return { + ...item, + standardValue: Number(calc(Number(num), 6, '*')), // 标准值默认为垂直偏转系数*6 + } + }) as any + } + else if (type === '上升时间(数字示波器)') { + risetimeList.value = risetimeList.value.map((item) => { + return { + ...item, + amplitude: Number(calc(Number(num), 5, '*')), // 幅度默认为垂直偏转系数*6 + } + }) 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 => `${item.dataType}` === '1').map((item) => { item.params = '时基'; return item }) // 时基 + zeroFrequencyGainList.value = newVal.filter(item => `${item.dataType}` === '2').map((item) => { item.params = '直流增益'; return item }) // 直流增益 + DCBiasList.value = newVal.filter(item => `${item.dataType}` === '3').map((item) => { item.params = '直流偏置'; return item }) // 直流偏置 + frequencyBandwidthList.value = newVal.filter(item => `${item.dataType}` === '4').map((item) => { item.params = '频带宽度'; return item }) // 频带宽度(数字示波器) + triggerSensitivityList.value = newVal.filter(item => `${item.dataType}` === '5').map((item) => { item.params = '触发灵敏度'; return item })// 触发灵敏度 + risetimeList.value = newVal.filter(item => `${item.dataType}` === '6').map((item) => { item.params = '上升时间'; return item })// 上升时间(数字示波器) + inputResistanceList.value = newVal.filter(item => `${item.dataType}` === '7').map((item) => { item.params = '输入电阻'; return item })// 输入电阻(数字示波器) + calibratingSignalList.value = newVal.filter(item => `${item.dataType}` === '8').map((item) => { item.params = '校准信号'; return item })// 校准信号(数字示波器) + if (timeBaseList.value.length) { + form.value.methodType = timeBaseList.value[0].methodType // 时基方法 + } + } + else if (props.itemCategoryName === '模拟示波器') { + scanningTimeList.value = newVal.filter(item => `${item.dataType}` === '1').map((item) => { item.params = '扫描时间系数及扩展'; return item }) // 扫描时间系数及扩展 + verticalSizeList.value = newVal.filter(item => `${item.dataType}` === '2').map((item) => { item.params = '垂直幅度'; return item }) // 垂直幅度 + frequencyBandwidthSimulateList.value = newVal.filter(item => `${item.dataType}` === '3').map((item) => { item.params = '频带宽度'; return item }) // 频带宽度(模拟示波器 + triggerCharacteristicList.value = newVal.filter(item => `${item.dataType}` === '4').map((item) => { item.params = '触发特性'; return item }) // 触发特性 + inputResistanceSimulateList.value = newVal.filter(item => `${item.dataType}` === '5').map((item) => { item.params = '输入电阻'; return item })// 输入电阻 + risetimeSimulateList.value = newVal.filter(item => `${item.dataType}` === '6').map((item) => { item.params = '上升时间'; return item })// 上升时间(数字示波器) + calibratingSignalSimulateList.value = newVal.filter(item => `${item.dataType}` === '7').map((item) => { item.params = '校准信号'; return item })// 校准信号(数字示波器) + } + } +}) -// watch(() => props.list, (newVal) => { // 检定项表格 -// if (newVal) { -// list.value = [...newVal] -// } -// }) +watch(() => props.form, (newValue) => { + 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({ list }) +defineExpose({ checkListBeforeSave, solveDataBeforeSave, form }) diff --git a/src/views/business/measure/item/components/thirteenth/templateTable.vue b/src/views/business/measure/item/components/thirteenth/templateTable.vue index a210821..b645ba7 100644 --- a/src/views/business/measure/item/components/thirteenth/templateTable.vue +++ b/src/views/business/measure/item/components/thirteenth/templateTable.vue @@ -6,7 +6,7 @@ import { getDictByCode } from '@/api/system/dict' import type { dictType } from '@/global' -// ------------------定义props、 emit------------------- +// ------------------定义props、 emits------------------- const props = defineProps({ pageType: { type: String, @@ -40,7 +40,17 @@ }, // 表格大小,默认,small,mini等,与el-table条件相同 type: String, // 表格类型,表格title }) -const emit = defineEmits(['change', 'selectionChange', 'rowClick', 'rowDbClick', 'multiSelect', 'filterChange']) +const emits = defineEmits([ + 'change', + 'selectionChange', + 'rowClick', + 'rowDbClick', + 'multiSelect', + 'filterChange', + 'changeItemType', + 'changeVerticalDeflectCoefficient', + 'changeInputNumber', +]) // ------------------------------------------字典---------------------------------------------- const standardTechnicalIndexSymbolList = ref([]) // 技术指标规则 const standard13ThoroughfareList = ref([]) // 通道 @@ -51,7 +61,12 @@ const standard13TriggerTypeList = ref([]) // 触发特性 const standard13NominalValueUnitList = ref([]) // 标称值单位 const standardAmplitudeUnitList = ref([]) // 幅度单位 - +const standard13ItemList = ref([]) // 校准信号--项目 +const standard13ScanTypeList = ref([]) // 扫描方式 +const standard13VerticalGearStepList = ref([]) // 垂直档位步进 +const standardFrequencyUnitList = ref([]) // 频率单位-公用 +const characteristicAmplitudeUnitList = ref([]) // 触发特性-公用 +const standard13SignalTypeList = ref([]) // 信号类型 /** * 获取字典 */ @@ -72,7 +87,7 @@ getDictByCode('standard13VerticalDeflectCoefficient').then((response) => { standard13VerticalDeflectCoefficientList.value = response.data }) - // 垂直偏转系数(/div)单位\电压单位--公用 + // 电压单位--公用/垂直偏转系数(/div)单位 getDictByCode('standardVoltage').then((response) => { standardVoltageList.value = response.data }) @@ -96,7 +111,30 @@ getDictByCode('standardAmplitudeUnit').then((response) => { standardAmplitudeUnitList.value = response.data }) - // standard13Item + // 校准信号--项目 + getDictByCode('standard13Item').then((response) => { + standard13ItemList.value = response.data + }) + // 扫描方式 + getDictByCode('standard13ScanType').then((response) => { + standard13ScanTypeList.value = response.data + }) + // 垂直档位步进 + getDictByCode('standard13VerticalGearStep').then((response) => { + standard13VerticalGearStepList.value = response.data + }) + // 频率单位公用 + getDictByCode('standardFrequencyUnit').then((response) => { + standardFrequencyUnitList.value = response.data + }) + // 触发特性幅度单位 + getDictByCode('characteristicAmplitudeUnit').then((response) => { + characteristicAmplitudeUnitList.value = response.data + }) + // 信号类型 + getDictByCode('standard13SignalType').then((response) => { + standard13SignalTypeList.value = response.data + }) } getDict() @@ -129,16 +167,16 @@ } // 刷新 function refresh() { - emit('change') + emits('change') } // 点击行 function rowClick(row: object, column?: any, event?: any) { - emit('rowClick', row) + emits('rowClick', row) } // 双击行 function rowDbClick(row: object, column?: any, event?: any) { - emit('rowDbClick', row) + emits('rowDbClick', row) } // 监听columns watch(props.columns, (val) => { @@ -147,7 +185,7 @@ }) // 多选 const handleSelectionChange = (val: any) => { - emit('selectionChange', val) + emits('selectionChange', val) } // 清除多选选中 const clearMulti = () => { @@ -155,6 +193,20 @@ table.value!.clearSelection() singleChecked.value = '' } + +// 项目选择变化 +const changeItemType = (value: string, index: number) => { + emits('changeItemType', value, index) +} +// 垂直偏转系数变化 +const changeVerticalDeflectCoefficient = (value: string) => { + emits('changeVerticalDeflectCoefficient', value) +} + +const changeInputNumber = (value: number) => { + emits('changeInputNumber', value) +} + defineExpose({ clearMulti, initColumnsState, }) @@ -210,11 +262,13 @@ />
{{ scope.row.technicalIndexUnit }}
+ + + + + + + + + + + + @@ -240,16 +315,22 @@ v-if="item.value === 'cycleSignal' || item.value === 'standardValue' || item.value === 'referencePointFrequency' || item.value === 'bandWidth' || item.value === 'horizontalDeflectCoefficient' || item.value === 'referencePointFrequency' || item.value === 'bandWidth' - || item.value === 'nominalValue' || item.value === 'signalFrequency' || item.value === 'amplitude'" + || item.value === 'nominalValue' || item.value === 'signalFrequency' || item.value === 'amplitude' + || (item.value === 'verticalDeflectionGear' && scope.row.itemType === '幅度') || item.value === 'horizontalScaleGear' + || item.value === 'verticalScaleGear' || item.value === 'frequency' || item.value === 'referenceFrequency' + || item.value === 'stepFrequency' || item.value === 'frequencyUpper' || item.value === 'referenceAmplitude' + || item.value === 'nominalAmplitudeValue' || item.value === 'nominalFrequencyValue'" v-model="scope.row[item.value]" :placeholder="`${item.text}`" class="full-width-input" :disabled="props.pageType === 'detail'" + @change="changeInputNumber" /> - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/views/business/measure/item/detail.vue b/src/views/business/measure/item/detail.vue index 42dfc1d..efcd623 100644 --- a/src/views/business/measure/item/detail.vue +++ b/src/views/business/measure/item/detail.vue @@ -351,6 +351,17 @@ })), // 鉴定项列表 } } + else if (form.value.belongStandardEquipment === '13') { // 第13套:示波器 + if (!standardRef.value.checkListBeforeSave()) { params = '未通过校验'; return params } + const list = standardRef.value.solveDataBeforeSave() // 处理数据 + params = { + helpFieldInstruction: form.value.helpFieldInstruction, // 辅助字段说明 + itemRemark: form.value.itemRemark, // 检定项备注 + itemId: infoId.value, // 检定项id + measureItemDataOscilloscopeList: list, + ...standardRef.value.form, + } + } return params } @@ -498,6 +509,10 @@ getList.value = response.measureItemDataSpectrumAnalyzerList // 检定项表格 getObject.value = response // 检定项表单 } + else if (form.value.belongStandardEquipment === '13') { // 第13套:示波器 + getList.value = response.measureItemDataOscilloscopeList // 检定项表格 + getObject.value = response // 检定项表单 + } } function fetchInfo() { diff --git a/src/views/business/taskMeasure/measureData/components/thirteenth/templateDetail.vue b/src/views/business/taskMeasure/measureData/components/thirteenth/templateDetail.vue index cc27596..8de9c99 100644 --- a/src/views/business/taskMeasure/measureData/components/thirteenth/templateDetail.vue +++ b/src/views/business/taskMeasure/measureData/components/thirteenth/templateDetail.vue @@ -36,6 +36,8 @@ belongStandardEquipment: '', // 标准装置code belongStandardEquipmentName: '', // 标准装置名称 + methodType: '', // 时基方法 + appearance: '正常', // 外观及功能性检查 appearanceFunctionCheck: 1, // 外观及功能性检查 timeBase: 1, // 时基(示波器-数字) currentGain: 1, // 直流增益(示波器-数字) @@ -84,28 +86,50 @@ const risetimeSimulateList = ref([]) // 上升时间(模拟示波器) const calibratingSignalSimulateList = ref([]) // 校准信号(模拟示波器) -const columns_time_base = ref([ // 时基 - { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '周期时标信号', value: 'nominalValue', align: 'center', required: true }, - { text: '周期时标信号△T/ns', value: 'nominalValue', align: 'center', required: true }, - { text: '时基相对误差△δ', value: 'nominalValue', align: 'center', required: true }, - { text: '技术指标', value: 'nominalValue', align: 'center', required: true }, - { text: '结论', value: 'nominalValue', align: 'center', required: true }, +const timeBaseLoading = ref(false) // 时基 +const zeroFrequencyGainLoading = ref(false) // 直流增益 +const DCBiasLoading = ref(false) // 直流偏置 +const frequencyBandwidthLoading = ref(false) // 频带宽度(数字示波器) +const triggerSensitivityLoading = ref(false) // 触发灵敏度 +const risetimeLoading = ref(false) // 上升时间(数字示波器) +const inputResistanceLoading = ref(false) // 输入电阻(数字示波器) +const calibratingSignalLoading = ref(false) // 校准信号(数字示波器) +const scanningTimeLoading = ref(false) // 扫描时间系数及扩展 +const verticalSizeLoading = ref(false) // 垂直幅度 +const frequencyBandwidthSimulateLoading = ref(false) // 频带宽度(模拟示波器) +const triggerCharacteristicLoading = ref(false) // 触发特性 +const inputResistanceSimulateLoading = ref(false) // 输入电阻(模拟示波器) +const risetimeSimulateLoading = ref(false) // 上升时间(模拟示波器) +const calibratingSignalSimulateLoading = ref(false) // 校准信号(模拟示波器) + +const columns_time_base_method1 = ref([ // 时基--方法一 + { text: '检定项目', value: 'params', align: 'center', required: true, width: '90' }, + { text: '周期时标信号', value: 'cycleSignalDefineFront', align: 'center', required: true }, + { text: '时基绝对误差△T/ns', value: 'timeBaseAbsoluteError', align: 'center', required: true, width: '180' }, + { text: '时基相对误差△δ', value: 'timeBaseRelativeError', align: 'center', required: false }, + { text: '技术指标', value: 'technicalIndexDefineFront', align: 'center', required: true }, + { text: '结论', value: 'conclusion', align: 'center', required: false }, +]) + +const columns_time_base_method2 = ref([ // 时基--方法二 + { text: '检定项目', value: 'params', align: 'center', required: true, width: '90' }, + { text: '参考输出', value: 'cycleSignal', align: 'center', required: true }, + { text: '差拍波形频率测量值(Hz)', value: 'timeBaseAbsoluteError', align: 'center', required: true, width: '180' }, + { text: '时基相对误差△δ', value: 'timeBaseRelativeError', align: 'center', required: false }, + { text: '技术指标', value: 'technicalIndexDefineFront', align: 'center', required: true }, + { text: '结论', value: 'conclusion', align: 'center', required: false }, ]) const columns_zero_frequency_gain = ref([ // 直流增益 - { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '阻抗', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗单位', value: 'nominalValue', align: 'center', required: true }, - { text: '通道', value: 'nominalValue', align: 'center', required: true }, - { text: '垂直偏转系数(/div)', value: 'nominalValue', align: 'center', required: true }, - { text: '垂直偏转系数(/div)单位', value: 'nominalValue', align: 'center', required: true }, - { text: '标准值', value: 'nominalValue', align: 'center', required: true }, - { text: '标准值单位', value: 'nominalValue', align: 'center', required: true }, - { text: '测量值', value: 'nominalValue', align: 'center', required: true }, - { text: '相对误差', value: 'nominalValue', align: 'center', required: true }, - { text: '技术指标', value: 'nominalValue', align: 'center', required: true }, - { text: '结论', value: 'nominalValue', align: 'center', required: true }, + { text: '检定项目', value: 'params', align: 'center', required: true, width: '90' }, + { text: '阻抗', value: 'impedanceDefineFront', align: 'center', required: true }, + { text: '通道', value: 'thoroughfare', align: 'center', required: true }, + { text: '垂直偏转系数(/div)', value: 'verticalDeflectCoefficientDefineFront', align: 'center', required: true }, + { text: '标准值', value: 'standardValueDefineFront', align: 'center', required: true }, + { text: '测量值', value: 'measureValue', align: 'center', required: true, width: '180' }, + { text: '相对误差', value: 'relativeError', align: 'center', required: false }, + { text: '技术指标', value: 'technicalIndexDefineFront', align: 'center', required: true }, + { text: '结论', value: 'conclusion', align: 'center', required: false }, ]) const columns_DC_bias = ref([ // 直流偏置 @@ -322,7 +346,40 @@ // 初始化输入数据 const initInputData = (data: any) => { - + if (itemFormData.value.itemCategoryName === '数字示波器') { + // 时基 + timeBaseList.value = data.filter(item => `${item.dataType}` === '1') + timeBaseList.value = timeBaseList.value.map((item) => { + return { + ...item, + params: '时基', + cycleSignalDefineFront: item.cycleSignal + item.cycleSignalUnit, // 周期时标信号 + timeBaseAbsoluteError: '', // 时基绝对误差△T/ns + timeBaseRelativeError: '', // 时基相对误差△δ + technicalIndexDefineFront: item.technicalIndexSymbol + item.technicalIndex + item.technicalIndexUnit, // 技术指标 + conclusion: '', // 结论 + } + }) + // 直流增益 + zeroFrequencyGainList.value = data.filter(item => `${item.dataType}` === '2') + zeroFrequencyGainList.value = zeroFrequencyGainList.value.map((item) => { + return { + ...item, + params: '直流增益', + impedanceDefineFront: item.impedance + item.impedanceUnit, // 阻抗 + verticalDeflectCoefficientDefineFront: item.verticalDeflectCoefficient + item.verticalDeflectCoefficientUnit, // 垂直偏转系数 + standardValueDefineFront: item.standardValue + item.standardValueUnit, // 标准值 + measureValue: '', // 测量值 + measureValueUnit: item.standardValueUnit, // 测量值单位 + relativeError: '', // 相对误差 + technicalIndexDefineFront: item.technicalIndexSymbol + item.technicalIndex + item.technicalIndexUnit, // 技术指标 + conclusion: '', // 结论 + } + }) + } + else if (itemFormData.value.itemCategoryName === '模拟示波器') { + console.log('模拟示波器') + } } /** @@ -338,44 +395,115 @@ belongStandardEquipment, // 检校标准装置字典code } getItemInfo(params).then((res) => { - itemFormData.value.appearance = res.data.measureItemConfigPistonGauge.appearance ? '1' : '' // 外观及功能检查 1有外观,2没有外观 - initInputData(res.data.measureItemDataPistonGaugeList) + itemFormData.value.appearance = res.data.appearanceFunctionCheck ? '1' : '' // 外观及功能检查 1有外观,2没有外观 + itemFormData.value.appearanceFunctionCheck = res.data.appearanceFunctionCheck // 外观及功能检查 1有外观,2没有外观 + itemFormData.value.timeBase = res.data.timeBase // 时基 + itemFormData.value.currentGain = res.data.currentGain // 直流增益 + itemFormData.value.currentBias = res.data.currentBias // 直流偏置 + itemFormData.value.bandWidth = res.data.bandWidth // 频带宽度 + itemFormData.value.triggerSensitivity = res.data.triggerSensitivity // 触发灵敏度 + itemFormData.value.riseTime = res.data.riseTime // 上升时间 + itemFormData.value.inputResistance = res.data.inputResistance // 输入电阻 + itemFormData.value.calibratingSignal = res.data.calibratingSignal // 校准信号 + itemFormData.value.scanTimeCoefficient = res.data.scanTimeCoefficient // 扫描时间系数及扩展 + itemFormData.value.triggerCharacter = res.data.triggerCharacter // 触发特性 + itemFormData.value.verticalAmplitude = res.data.verticalAmplitude // 垂直幅度 + + const tempTimeBaseList = res.data.measureItemDataOscilloscopeList.filter(item => `${item.dataType}` === '1') + if (tempTimeBaseList && tempTimeBaseList.length) { + itemFormData.value.methodType = tempTimeBaseList[0].methodType + } + initInputData(res.data.measureItemDataOscilloscopeList) }) } // ----------------------------------------点击保存时校验--------------------------------------- -// 校验 -const checkout = () => { +// 点击计算结果校验 +const checkout = (type: string) => { + let result = true + switch (type) { + case '时基': { + const columns = itemFormData.value.methodType === '方法一' ? columns_time_base_method1.value : columns_time_base_method2.value + result = useCheckList(timeBaseList.value, columns, type) + break + } + case '直流增益': + result = useCheckList(zeroFrequencyGainList.value, columns_zero_frequency_gain.value, type) + break + default: + break + } + return result +} + +// 计算之前参数处理 +const solveParamsBeforeCalculate = (type: string) => { + let list = [] + switch (type) { + case '时基': + list = timeBaseList.value + break + case '直流增益': + list = zeroFrequencyGainList.value + break + default: + break + } + return list +} + +// 计算之后参数处理 +const solveParamsAfterCalculate = (type: string, list) => { + switch (type) { + case '时基': + timeBaseList.value = timeBaseList.value.map((item, index) => { + return { + ...item, + timeBaseRelativeError: list[index].timeBaseRelativeError, + conclusion: list[index].conclusion, + exceedMark: list[index].exceedMark, + } + }) + break + case '直流增益': + zeroFrequencyGainList.value = zeroFrequencyGainList.value.map((item, index) => { + return { + ...item, + relativeError: list[index].relativeError, + conclusion: list[index].conclusion, + exceedMark: list[index].exceedMark, + } + }) + break + default: + break + } + return list } // -----------------------------------------生成结果处理---------------------------------------- // 点击计算结果 -const calculate = () => { - // ElMessage.info('敬请期待') - return false - // if (!list.value.length) { - // ElMessage.warning('没有检定项数据,无法生成结果') - // return false - // } - // if (!useCheckList(list.value, measureColumns.value, '检定数据')) { - // return false - // } - // const params = { - // belongStandardEquipment: itemFormData.value.belongStandardEquipment, // 检校标准装置 - // itemCategoryName: itemFormData.value.itemCategoryName, // 检定项分类名称 - // measureDataCalibratorList: list.value, - // } - // calculateHandle(params).then((res) => { - // if (res.data && res.data.length) { - // resultList.value = res.data.map((item: IDetailMeasureList) => { - // return { - // ...item, - // } - // }) // 检定数据 - // } - // else { - // list.value = res.data - // } - // }) +const calculate = (type: string) => { + if (!checkout(type)) { + return false + } + const list = solveParamsBeforeCalculate(type) + timeBaseLoading.value = type === '时基' + zeroFrequencyGainLoading.value = type === '直流增益' + const params = { + belongStandardEquipment: itemFormData.value.belongStandardEquipment, // 检校标准装置 + itemCategoryName: itemFormData.value.itemCategoryName, // 检定项分类名称 + measureDataOscilloscopeList: list, + } + calculateHandle(params).then((res) => { + if (res.data && res.data.length) { + solveParamsAfterCalculate(type, res.data) + } + timeBaseLoading.value = false + zeroFrequencyGainLoading.value = false + }).catch(() => { + timeBaseLoading.value = false + zeroFrequencyGainLoading.value = false + }) } // ------------------------------------------钩子---------------------------------------------- @@ -394,7 +522,7 @@ itemFormData.value.belongStandardEquipment = $route.query.belongStandardEquipment as string// 标准装置code itemFormData.value.belongStandardEquipmentName = $route.query.belongStandardEquipmentName as string// 标准装置名称 // 查输入值(查检定项管理的详情) - // fetchItemInfo($route.query.itemId! as string, $route.query.itemCategoryName! as string, $route.query.belongStandardEquipment as string) + fetchItemInfo($route.query.itemId! as string, $route.query.itemCategoryName! as string, $route.query.belongStandardEquipment as string) } else { itemFormData.value.itemCategoryName = $route.query.itemCategoryName as string // 设备检定项分类名称 @@ -446,26 +574,27 @@ - + + - + @@ -475,11 +604,11 @@ - + diff --git a/src/views/business/taskMeasure/measureData/components/thirteenth/templateTable.vue b/src/views/business/taskMeasure/measureData/components/thirteenth/templateTable.vue index 7cf8109..cf900a1 100644 --- a/src/views/business/taskMeasure/measureData/components/thirteenth/templateTable.vue +++ b/src/views/business/taskMeasure/measureData/components/thirteenth/templateTable.vue @@ -149,20 +149,34 @@ - diff --git a/src/views/business/taskMeasure/measureData/components/thirteenth/thirteenth-interface.ts b/src/views/business/taskMeasure/measureData/components/thirteenth/thirteenth-interface.ts index 39f9c69..deba24a 100644 --- a/src/views/business/taskMeasure/measureData/components/thirteenth/thirteenth-interface.ts +++ b/src/views/business/taskMeasure/measureData/components/thirteenth/thirteenth-interface.ts @@ -1,60 +1,71 @@ // 检定项数据表格 export interface IDetailMeasureList { id: string // id,更新/删除使用参数 - dataType: string // 检定项数据类型(一个检定项中区分两个表格)(字典code) - itemId: string // 检定项id - params: string // 检定项目 + dataId: string // 检定数据管理基础信息表id(新增不用传) + dataType: string // 检定数据类型(一个检定数据中区分多个表格)(字典code) - methodType?: string // 方法类型(时基选择方法一/方法二)(字典value) - cycleSignal?: string // 周期时标信号 - cycleSignalUnit?: string // 周期时标信号单位 + cycleSignal?: string // 周期时标信号(方法一)/ 参考输出(方法二) + cycleSignalUnit?: string // 周期时标信号单位(方法一)/ 参考输出单位(方法二) + timeBaseAbsoluteError?: string // 时基绝对误差(方法一)/ 差拍波形频率测量值(方法二) + timeBaseAbsoluteErrorUnit?: string // 时基绝对误差单位(方法一)/ 差拍波形频率测量值单位(方法二) + timeBaseRelativeError?: string // 时基相对误差 + timeBaseRelativeErrorUnit?: string // 时基相对误差单位 technicalIndex?: string // 技术指标 technicalIndexSymbol?: string // 技术指标前符号 technicalIndexUnit?: string // 技术指标单位 + conclusion?: string // 结论 - amplitude?: string // 幅度 - amplitudeUnit?: string // 幅度单位 - bandWidth?: string // 频带宽度 - bandWidthUnit?: string // 频带宽度单位 - frequency?: string // 频率(模拟示波器) - frequencyUnit?: string // 频率单位(模拟示波器) - frequencyUpper?: string // 频率上限(模拟示波器) - frequencyUpperUnit?: string // 频率上限单位(模拟示波器) - horizontalDeflectCoefficient?: string // 水平偏转系数 - horizontalDeflectCoefficientUnit?: string // 水平偏转系数单位 - horizontalScaleGear?: string // 水平刻度档位(模拟示波器) - horizontalScaleGearUnit?: string // 水平刻度档位单位(模拟示波器) impedance?: string // 阻抗 impedanceUnit?: string // 阻抗单位 + thoroughfare?: string // 通道 + verticalDeflectCoefficient?: string // 垂直偏转系数 + verticalDeflectCoefficientUnit?: string // 垂直偏转系数单位 + standardValue?: string // 标准值 + standardValueUnit?: string // 标准值单位 + measureValue?: string // 测量值 + measureValueUnit?: string // 测量值单位 + relativeError?: string // 相对误差 + + amplitudeDeviation?: string // 幅度偏差(模拟示波器) + bandWidth?: string // 频带宽度 + bandWidthUnit?: string // 频带宽度单位 + bottomMeasureValue?: string // 底部测量值 + bottomMeasureValueUnit?: string // 底部测量值单位 + correctRiseTime?: string // 修正上升时间 + decibelNumber?: string // 分贝数 + errorValue?: string // 误差 + frequencyDeviation?: string // 频率偏差(模拟示波器) + frequencyUpper?: string // 频率上限(模拟示波器) + frequencyUpperUnit?: string // 频率上限单位(模拟示波器) + horizontalScaleGear?: string // 水平刻度档位(模拟示波器) + horizontalScaleGearUnit?: string // 水平刻度档位单位(模拟示波器) itemType?: string // 项目(字典value) + measureAmplitude?: string // 测量幅度 + measureAmplitudeUnit?: string // 测量幅度单位 + measureAmplitudeValue?: string // 幅度测量值(模拟示波器) + measureAmplitudeValueUnit?: string // 幅度测量值单位(模拟示波器) + measureFrequencyValue?: string // 频率测量值(模拟示波器) + measureFrequencyValueUnit?: string // 频率测量值单位(模拟示波器) nominalAmplitudeValue?: string // 幅度标称值(模拟示波器) nominalAmplitudeValueUnit?: string // 幅度标称值单位(模拟示波器) nominalFrequencyValue?: string // 频率标称值(模拟示波器) - nominalFrequencyValueUnit?: string // 频率标称值单位(模拟示波器) + nominalFrequencyValueUnit?: string // 频率标称值单位(模拟示波器) nominalValue?: string // 标称值 nominalValueUnit?: string // 标称值单位 - referenceAmplitude?: string // 基准幅度(模拟示波器) - referenceAmplitudeUnit?: string // 基准幅度单位(模拟示波器) - referenceFrequency?: string // 基准频率(模拟示波器) - referenceFrequencyUnit?: string // 基准频率单位(模拟示波器) - referencePointFrequency?: string // 参考点频率 - referencePointFrequencyUnit?: string // 参考点频率单位 + outputSignalAmplitude?: string // 输出信号幅度 + referenceAmplitude?: string // 参考幅度 + referenceAmplitudeUnit?: string // 参考幅度单位 + riseTime?: string // 上升时间 scanType?: string // 扫描方式(模拟示波器)(字典value) signalFrequency?: string // 信号频率 signalFrequencyUnit?: string // 信号频率单位 signalType?: string // 信号类型(模拟示波器)(字典value) - standardValue?: string // 标准值 - standardValueUnit?: string // 标准值单位 - stepFrequency?: string // 步进频率(模拟示波器) - stepFrequencyUnit?: string // 步进频率单位(模拟示波器) - thoroughfare?: string // 通道 + topMeasureValue?: string // 顶部测量值 + topMeasureValueUnit?: string // 顶部测量值单位 triggerType?: string // 触发类型(字典value) - verticalDeflectCoefficient?: string // 垂直偏转系数 - verticalDeflectCoefficientUnit?: string // 垂直偏转系数单位 - verticalDeflectionGear?: string // 低电平测量时垂直偏转档位 - verticalDeflectionGearUnit?: string // 低电平测量时垂直偏转档位单位 - verticalGearStep?: string // 垂直档位步进(模拟示波器) + twoRelativeError?: string // 第二项检定项【扫描时间系数及扩展】中A扫描的水平刻度档位相同数值的相对误差数值(模拟示波器-上升时间中计算修正上升时间使用) verticalScaleGear?: string // 垂直刻度档位(模拟示波器) verticalScaleGearUnit?: string // 垂直刻度档位单位(模拟示波器) + exceedMark?: number // 超出范围标*(1/0) } diff --git a/src/components/SelectByDict/index.vue b/src/components/SelectByDict/index.vue index 20a7e0c..83fc909 100644 --- a/src/components/SelectByDict/index.vue +++ b/src/components/SelectByDict/index.vue @@ -24,7 +24,7 @@ required: true, }, }) -const emit = defineEmits(['update:modelValue', 'getDictValue']) +const emit = defineEmits(['update:modelValue', 'getDictValue', 'changeValue']) const checkItem = ref({}) // 选中的选项 const input = ref() // 输入框组件 // -------------------------定义数据-------------------- @@ -91,6 +91,7 @@ const data = dictList.value.filter(item => item.name === inputValue).length if (!data) { console.log(inputValue, '该值不存在添加字典') + emit('changeValue', inputValue) // 在字典中添加该值 getDictAllList().then((res) => { const currentDict = res.data.filter(item => item.code === props.dictCode)[0] @@ -124,6 +125,7 @@ } else { console.log(inputValue, '该值存在') + emit('changeValue', inputValue) // 发送 绑定的value (可用可不用) emit('getDictValue', dictList.value.filter(item => item.name === inputValue)[0].value1) // setTimeout(() => { diff --git a/src/views/business/measure/item/components/thirteenth/templateDetail-interface.ts b/src/views/business/measure/item/components/thirteenth/templateDetail-interface.ts index 7662387..708ffd9 100644 --- a/src/views/business/measure/item/components/thirteenth/templateDetail-interface.ts +++ b/src/views/business/measure/item/components/thirteenth/templateDetail-interface.ts @@ -34,6 +34,8 @@ amplitude?: string // 幅度 amplitudeUnit?: string // 幅度单位 + verticalDeflectionGear?: string // 低电平测量时垂直偏转档位 + verticalDeflectionGearUnit?: string // 低电平测量时垂直偏转档位单位 frequency?: string // 频率(模拟示波器) frequencyUnit?: string // 频率单位(模拟示波器) @@ -54,8 +56,6 @@ signalType?: string // 信号类型(模拟示波器)(字典value) stepFrequency?: string // 步进频率(模拟示波器) stepFrequencyUnit?: string // 步进频率单位(模拟示波器) - verticalDeflectionGear?: string // 低电平测量时垂直偏转档位 - verticalDeflectionGearUnit?: string // 低电平测量时垂直偏转档位单位 verticalGearStep?: string // 垂直档位步进(模拟示波器) verticalScaleGear?: string // 垂直刻度档位(模拟示波器) verticalScaleGearUnit?: string // 垂直刻度档位单位(模拟示波器) diff --git a/src/views/business/measure/item/components/thirteenth/templateDetail.vue b/src/views/business/measure/item/components/thirteenth/templateDetail.vue index cb67fcf..b43e364 100644 --- a/src/views/business/measure/item/components/thirteenth/templateDetail.vue +++ b/src/views/business/measure/item/components/thirteenth/templateDetail.vue @@ -9,6 +9,8 @@ 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: { @@ -37,6 +39,18 @@ 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) @@ -144,8 +158,8 @@ const columns_input_resistance = ref([ // 输入电阻(数字示波器) { text: '检定项目', value: 'params', align: 'center', required: true }, { text: '通道', value: 'thoroughfare', 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: '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: true, width: 300 }, @@ -153,87 +167,106 @@ const columns_calibrating_signal = ref([ // 校准信号(数字示波器) { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '项目', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值单位', value: 'nominalValue', 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([ // 扫描时间系数及扩展 { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '扫描方式', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗单位', value: 'nominalValue', align: 'center', required: true }, - { text: '步进', value: 'nominalValue', align: 'center', required: true }, - { text: '水平刻度档位', value: 'nominalValue', align: 'center', required: true }, - { text: '水平刻度档位单位', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值单位', value: 'nominalValue', align: 'center', required: true }, - { text: '技术指标', value: 'nominalValue', 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: true, width: '300' }, ]) const columns_vertical_size = ref([ // 垂直幅度 { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '通道', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗单位', value: 'nominalValue', align: 'center', required: true }, - { text: '频率', value: 'nominalValue', align: 'center', required: true }, - { text: '频率单位', value: 'nominalValue', align: 'center', required: true }, - { text: '步进', value: 'nominalValue', align: 'center', required: true }, - { text: '垂直刻度档位', value: 'nominalValue', align: 'center', required: true }, - { text: '垂直刻度档位单位', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值单位', value: 'nominalValue', align: 'center', required: true }, - { text: '技术指标', value: 'nominalValue', 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: true, width: '300' }, +]) + +const columns_frequency_bandwidth_simulate = ref([ // 频带宽度(模拟示波器) + { 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: true, width: 340 }, ]) const columns_trigger_characteristic = ref([ // 触发特性 { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '扫描方式', value: 'nominalValue', align: 'center', required: true }, - { text: '通道', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗单位', value: 'nominalValue', align: 'center', required: true }, - { text: '触发类型', value: 'nominalValue', align: 'center', required: true }, - { text: '频率', value: 'nominalValue', align: 'center', required: true }, - { text: '频率单位', value: 'nominalValue', align: 'center', required: true }, - { text: '频率上限', value: 'nominalValue', align: 'center', required: true }, - { text: '频率上限单位', value: 'nominalValue', align: 'center', required: true }, - { text: '幅度', value: 'nominalValue', align: 'center', required: true }, - { text: '幅度单位', value: 'nominalValue', 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: true, width: 340 }, ]) const columns_input_resistance_simulate = ref([ // 输入电阻(模拟示波器) { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '通道', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗单位', value: 'nominalValue', align: 'center', required: true }, - { text: '技术指标', value: 'nominalValue', 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: true, width: 300 }, ]) const columns_risetime_simulate = ref([ // 上升时间(模拟示波器) { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '通道', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗单位', value: 'nominalValue', align: 'center', required: true }, - { text: '触发类型', value: 'nominalValue', align: 'center', required: true }, - { text: '垂直刻度档位', value: 'nominalValue', align: 'center', required: true }, - { text: '垂直刻度档位单位', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值', value: 'nominalValue', align: 'center', required: true }, - { text: '标称值单位', value: 'nominalValue', align: 'center', required: true }, - { text: '扫描上升时间档位', value: 'nominalValue', align: 'center', required: true }, - { text: '扫描上升时间档位单位', value: 'nominalValue', align: 'center', required: true }, - { text: '技术指标', value: 'nominalValue', 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: true, width: '340' }, ]) const columns_calibrating_signal_simulate = ref([ // 校准信号(模拟示波器) { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '信号类型', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗单位', value: 'nominalValue', align: 'center', required: true }, - { text: '幅度标称值', value: 'nominalValue', align: 'center', required: true }, - { text: '幅度标称值单位', value: 'nominalValue', align: 'center', required: true }, - { text: '频率标称值', value: 'nominalValue', align: 'center', required: true }, - { text: '频率标称值单位', value: 'nominalValue', align: 'center', required: true }, - { text: '技术指标', value: 'nominalValue', 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: true, width: '340' }, ]) // --------------------------------表格操作--------------------------------------------------- @@ -294,200 +327,763 @@ * @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: '', // 周期时标信号 - cycleSignalUnit: '', // 周期时标信号单位 - technicalIndex: '', // 技术指标 - 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: '', // 标准值 - standardValueUnit: 'V', // 标准值单位 - technicalIndex: '', // 技术指标 - 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: '', // 标准值 - standardValueUnit: 'V', // 标准值单位 - technicalIndex: '', // 技术指标 - technicalIndexSymbol: '±', // 技术指标前符号 - technicalIndexUnit: '%', // 技术指标单位 - }) - break - case '频带宽度': - list.push({ - id: '', // id,更新/删除使用参数 - dataType: '4', // 检定项数据类型(一个检定项中区分两个表格)(字典code) - itemId: props.itemId, // 检定项id - params: title, // 检定项目 - impedance: '', // 阻抗 - impedanceUnit: 'Ω', // 阻抗单位 - thoroughfare: 'CH1', // 通道 - verticalDeflectCoefficient: '', // 垂直偏转系数 - verticalDeflectCoefficientUnit: 'V', // 垂直偏转系数单位 - horizontalDeflectCoefficient: '', // 水平偏转系数 - horizontalDeflectCoefficientUnit: 'ns', // 水平偏转系数单位 - referencePointFrequency: '', // 参考点频率 - referencePointFrequencyUnit: 'Hz', // 参考点频率单位 - bandWidth: '', // 频带宽度 - bandWidthUnit: 'Hz', // 频带宽度单位 - technicalIndex: '', // 技术指标 - technicalIndexSymbol: '±', // 技术指标前符号 - technicalIndexUnit: 'dB', // 技术指标单位 - }) - break - case '触发灵敏度': - list.push({ - id: '', // id,更新/删除使用参数 - dataType: '5', // 检定项数据类型(一个检定项中区分两个表格)(字典code) - itemId: props.itemId, // 检定项id - params: title, // 检定项目 - thoroughfare: 'CH1', // 通道 - triggerType: '内触发', // 触发类型 - signalFrequency: '', // 信号频率 - signalFrequencyUnit: 'V', // 信号频率单位 - verticalDeflectCoefficient: '', // 垂直偏转系数 - verticalDeflectCoefficientUnit: 'V', // 垂直偏转系数单位 - nominalValue: '', // 标称值 - nominalValueUnit: 'div', // 标称值单位 - technicalIndex: '', // 技术指标 - technicalIndexSymbol: '±', // 技术指标前符号 - technicalIndexUnit: 'dB', // 技术指标单位 - }) - break - case '上升时间': - list.push({ - id: '', // id,更新/删除使用参数 - dataType: '5', // 检定项数据类型(一个检定项中区分两个表格)(字典code) - itemId: props.itemId, // 检定项id - params: title, // 检定项目 - impedance: '', // 阻抗, - impedanceUnit: 'Ω', // 阻抗单位 - thoroughfare: 'CH1', // 通道 - verticalDeflectCoefficient: '', // 垂直偏转系数 - verticalDeflectCoefficientUnit: 'V', // 垂直偏转系数单位 - amplitude: '', // 幅度 - amplitudeUnit: 'V', // 幅度单位 - horizontalDeflectCoefficient: '', // 水平偏转系数单位 - horizontalDeflectCoefficientUnit: 'ns', // 水平偏转系数单位 - technicalIndex: '', // 技术指标 - technicalIndexSymbol: '±', // 技术指标前符号 - technicalIndexUnit: 'ns', // 技术指标单位 - }) - break - case '输入电阻': - list.push({ - id: '', // id,更新/删除使用参数 - dataType: '5', // 检定项数据类型(一个检定项中区分两个表格)(字典code) - itemId: props.itemId, // 检定项id - params: title, // 检定项目 - thoroughfare: 'CH1', // 通道 - verticalDeflectCoefficient: '', // 垂直偏转系数 - verticalDeflectCoefficientUnit: 'V', // 垂直偏转系数单位 - standardValue: '', // 标准值 - technicalIndex: '', // 技术指标 - technicalIndexSymbol: '±', // 技术指标前符号 - technicalIndexUnit: '%', // 技术指标单位 - }) - break - case '校准信号': - - break + 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: '', // 周期时标信号 + cycleSignalUnit: '', // 周期时标信号单位 + technicalIndex: '', // 技术指标 + 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: '', // 标准值 + standardValueUnit: 'V', // 标准值单位 + technicalIndex: '', // 技术指标 + 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: '', // 标准值 + standardValueUnit: 'V', // 标准值单位 + technicalIndex: '', // 技术指标 + 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: '', // 水平偏转系数 + horizontalDeflectCoefficientUnit: 'ns', // 水平偏转系数单位 + referencePointFrequency: '', // 参考点频率 + referencePointFrequencyUnit: 'Hz', // 参考点频率单位 + bandWidth: '', // 频带宽度 + bandWidthUnit: 'Hz', // 频带宽度单位 + technicalIndex: '', // 技术指标 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: 'dB', // 技术指标单位 + }) + break + case '触发灵敏度': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '5', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + thoroughfare: 'CH1', // 通道 + triggerType: '内触发', // 触发类型 + signalFrequency: '', // 信号频率 + signalFrequencyUnit: 'MHz', // 信号频率单位 + verticalDeflectCoefficient: '', // 垂直偏转系数 + verticalDeflectCoefficientUnit: 'V', // 垂直偏转系数单位 + nominalValue: '', // 标称值 + 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: '', // 幅度 + amplitudeUnit: 'V', // 幅度单位 + horizontalDeflectCoefficient: '', // 水平偏转系数单位 + horizontalDeflectCoefficientUnit: 'ns', // 水平偏转系数单位 + technicalIndex: '', // 技术指标 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: 'ns', // 技术指标单位 + }) + break + case '输入电阻': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '7', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + thoroughfare: 'CH1', // 通道 + verticalDeflectCoefficient: '', // 垂直偏转系数 + verticalDeflectCoefficientUnit: 'V', // 垂直偏转系数单位 + standardValue: '', // 标准值 + technicalIndex: '', // 技术指标 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: '%', // 技术指标单位 + }) + break + case '校准信号': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '8', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + itemType: '幅度', // 项目 + nominalValue: '', // 标称值 + nominalValueUnit: 'V', // 垂直标称值单位偏转系数单位 + verticalDeflectionGear: '', // 低电平测量时垂直偏转档位 + 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: '', // 水平刻度档位 + horizontalScaleGearUnit: 'ns', // 水平刻度档位单位 + nominalValue: '', // 标称值 + nominalValueUnit: 'ms', // 标称值单位 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: '%', // 技术指标单位 + technicalIndex: '', // 技术指标单位 + }) + 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: '', // 垂直刻度档位 + verticalScaleGearUnit: 'mV', // 垂直刻度档位单位 + nominalValue: '', // 标称值 + nominalValueUnit: 'mV', // 标称值单位 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: '%', // 技术指标单位 + technicalIndex: '', // 技术指标 + }) + break + case '频带宽度': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '3', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + thoroughfare: 'CH1', // 通道 + impedance: '50', // 阻抗 + impedanceUnit: 'Ω', // 阻抗单位 + referenceFrequency: '', // 基准频率 + referenceFrequencyUnit: 'Hz', // 基准频率单位 + stepFrequency: '', // 步进频率 + stepFrequencyUnit: 'kHz', // 步进频率单位 + verticalScaleGear: '', // 垂直刻度档位 + verticalScaleGearUnit: 'mV', // 垂直刻度档位单位 + verticalGearStep: '1-2-5', // 垂直档位步进 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: 'MHz', // 技术指标单位 + technicalIndex: '', // 技术指标 + }) + break + case '触发特性': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '4', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + scanType: 'A扫描', // 扫描类型 + thoroughfare: 'CH1', // 通道 + impedance: '50', // 阻抗 + impedanceUnit: 'Ω', // 阻抗单位 + triggerType: '内触发', // 触发类型 + frequency: '', // 频率 + frequencyUnit: 'Hz', // 频率单位 + frequencyUpper: '', // 频率上限 + frequencyUpperUnit: 'Hz', // 频率上限单位 + amplitude: '', // 幅度 + amplitudeUnit: 'mV', // 幅度单位 + referenceAmplitude: '100', // 基准幅度 + referenceAmplitudeUnit: 'mV', // 基准幅度单位 + technicalIndexSymbol: '≤', // 技术指标前符号 + technicalIndexUnit: 'mV', // 技术指标单位 + technicalIndex: '', // 技术指标 + }) + break + case '输入电阻': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '5', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + thoroughfare: 'CH1', // 通道 + impedance: '50', // 阻抗 + impedanceUnit: 'Ω', // 阻抗单位 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: '%', // 技术指标单位 + technicalIndex: '', // 技术指标 + }) + break + case '上升时间': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '6', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + thoroughfare: 'CH1', // 通道 + impedance: '50', // 阻抗 + impedanceUnit: 'Ω', // 阻抗单位 + verticalScaleGear: '', // 垂直刻度档位 + verticalScaleGearUnit: 'mV', // 垂直刻度档位单位 + amplitude: '', // 幅度 + amplitudeUnit: 'mV', // 幅度单位 + horizontalScaleGear: '', // 水平刻度档位 + horizontalScaleGearUnit: 'ns', // 水平刻度档位单位 + technicalIndexSymbol: '<', // 技术指标前符号 + technicalIndexUnit: 'ns', // 技术指标单位 + technicalIndex: '', // 技术指标 + }) + break + case '校准信号': + list.push({ + id: '', // id,更新/删除使用参数 + dataType: '7', // 检定项数据类型(一个检定项中区分两个表格)(字典code) + itemId: props.itemId, // 检定项id + params: title, // 检定项目 + signalType: '校准信号1', // 信号类型 + impedance: '50', // 阻抗 + impedanceUnit: 'Ω', // 阻抗单位 + nominalAmplitudeValue: '', // 幅度标称值 + nominalAmplitudeValueUnit: 'mV', // 幅度标称值单位 + nominalFrequencyValue: '', // 频率标称值 + nominalFrequencyValueUnit: 'kHz', // 频率标称值单位 + technicalIndexSymbol: '±', // 技术指标前符号 + technicalIndexUnit: '%', // 技术指标单位 + technicalIndex: '', // 技术指标 + }) + break + } } } - // } } /** * 删除行公共方法 * @param checkoutList 选中的数组 * @param list 操作的数组 */ -const delRow = (checkoutList: IList[], list: IList[]) => { +const delRow = (checkoutList: IList[], list: IList[], title: string) => { if (!checkoutList.length) { ElMessage.warning('请选中要删除的行') } else { - list = list.filter((item: any) => { - return !checkoutList.includes(item) - }) + 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 + } + } } } -// ---------------------------------------------校验--------------------------------------------------- -// 校验表格(点击保存的时候用、生成标准器示值) -const checkList = () => { - // return useCheckList(list.value, columns.value, '检定项表格') +// ------------------------------------------校验\保存之前处理数据--------------------------------------------------- +// 增加行校验表格 +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 calculateDataTop = () => { +// 保存之前校验 +const checkListBeforeSave = () => { + // 验空 + if (props.itemCategoryName === '数字示波器' && form.value.timeBase && !timeBaseList.value.length) { // 时基(示波器-数字) + ElMessage.warning('时基 不能为空') + return false + } + else if (props.itemCategoryName === '数字示波器' && form.value.currentGain && !zeroFrequencyGainList.value.length) { // 直流增益(示波器-数字) + ElMessage.warning('直流增益 不能为空') + return false + } + else if (props.itemCategoryName === '数字示波器' && form.value.currentBias && !DCBiasList.value.length) { // 直流偏置(示波器-数字) + ElMessage.warning('直流偏置 不能为空') + return false + } + else if (props.itemCategoryName === '模拟示波器' && form.value.scanTimeCoefficient && !scanningTimeList.value.length) { // 扫描时间系数及扩展(示波器-模拟) + ElMessage.warning('扫描时间系数及扩展 不能为空') + return false + } + else if (props.itemCategoryName === '模拟示波器' && form.value.verticalAmplitude && !verticalSizeList.value.length) { // 垂直幅度 + ElMessage.warning('垂直幅度 不能为空') + return false + } + else if (form.value.bandWidth) { // 频带宽度(示波器-数字/模拟) + if ((props.itemCategoryName === '数字示波器' && !frequencyBandwidthList.value.length) || (props.itemCategoryName === '模拟示波器' && !frequencyBandwidthSimulateList.value.length)) { + ElMessage.warning('频带宽度 不能为空') + return false + } + } + else if (props.itemCategoryName === '模拟示波器' && form.value.triggerCharacter && !triggerCharacteristicList.value.length) { // 触发特性 + ElMessage.warning('触发特性 不能为空') + return false + } + else if (props.itemCategoryName === '数字示波器' && form.value.triggerSensitivity && !triggerSensitivityList.value.length) { // 触发灵敏度 + ElMessage.warning('触发灵敏度 不能为空') + return false + } + else if (form.value.riseTime) { // 上升时间(数字示波器) + if ((props.itemCategoryName === '数字示波器' && !risetimeList.value.length) || (props.itemCategoryName === '模拟示波器' && !risetimeSimulateList.value.length)) { + ElMessage.warning('上升时间 不能为空') + return false + } + } + else if (form.value.inputResistance) { // 输入电阻(数字示波器) + if ((props.itemCategoryName === '数字示波器' && !inputResistanceList.value.length) && (props.itemCategoryName === '模拟示波器' && !inputResistanceSimulateList.value.length)) { + ElMessage.warning('输入电阻 不能为空') + return false + } + } + else if (form.value.calibratingSignal) { // 校准信号(示波器-数字/模拟) + if ((props.itemCategoryName === '数字示波器' && !calibratingSignalList.value.length) && (props.itemCategoryName === '模拟示波器' && !calibratingSignalSimulateList.value.length)) { + ElMessage.warning('校准信号 不能为空') + return false + } + } + console.log('--------1111111') + // 验数据 + 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, '时基') + } + else if (form.value.currentGain) { + currentGainResult = checkList(zeroFrequencyGainList.value, '直流增益') + } + else if (form.value.currentBias) { + currentBiasResult = checkList(DCBiasList.value, '直流偏置') + } + else if (form.value.bandWidth) { + bandWidthResult = checkList(frequencyBandwidthList.value, '频带宽度') + } + else if (form.value.triggerSensitivity) { + triggerSensitivityResult = checkList(triggerSensitivityList.value, '触发灵敏度') + } + else if (form.value.riseTime) { + riseTimeResult = checkList(risetimeList.value, '上升时间') + } + else if (form.value.inputResistance) { + inputResistanceResult = checkList(inputResistanceList.value, '输入电阻') + } + else 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, '扫描时间系数及扩展') + } + else if (form.value.verticalAmplitude) { + verticalAmplitudeResult = checkList(verticalSizeList.value, '垂直幅度') + } + else if (form.value.bandWidth) { + bandWidthResult = checkList(frequencyBandwidthSimulateList.value, '频带宽度') + } + else if (form.value.triggerCharacter) { + triggerCharacterResult = checkList(triggerCharacteristicList.value, '触发特性') + } + else if (form.value.inputResistance) { + inputResistanceResult = checkList(inputResistanceSimulateList.value, '输入电阻') + } + else if (form.value.riseTime) { + riseTimeResult = checkList(risetimeSimulateList.value, '上升时间') + } + else if (form.value.calibratingSignal) { + calibratingSignalResult = checkList(calibratingSignalSimulateList.value, '校准信号') + } + if (scanTimeCoefficientResult && verticalAmplitudeResult && bandWidthResult && triggerCharacterResult && inputResistanceResult && riseTimeResult && calibratingSignalResult + ) { + return true + } + else { + return false + } + } } -// 点击生成辅助接地电阻--下面表格计算 -const calculateDataBottom = () => { +// 保存之前处理数据 +const solveDataBeforeSave = () => { + // 数据处理 + let tempList = [] + 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) => { + return { + ...item, + id: '', + } + }) + return tempList } // ----------------------------------------------------------------------------------------------------- +// 校准信号项目变化 +const changeItemType = (value: string, index: number) => { + if (value === '频率') { + calibratingSignalList.value[index].verticalDeflectionGear = '/' + calibratingSignalList.value[index].verticalDeflectionGearUnit = '/' + } + else { // 幅度 + calibratingSignalList.value[index].verticalDeflectionGear = '' + calibratingSignalList.value[index].verticalDeflectionGearUnit = 'V' + } +} +// 垂直偏转系数变化 +const changeVerticalDeflectCoefficient = (param: { value: string }, type: string) => { + 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) => { + return { + ...item, + standardValue: Number(calc(Number(num), 6, '*')), // 标准值默认为垂直偏转系数*6 + } + }) as any + } + else if (type === '上升时间(数字示波器)') { + risetimeList.value = risetimeList.value.map((item) => { + return { + ...item, + amplitude: Number(calc(Number(num), 5, '*')), // 幅度默认为垂直偏转系数*6 + } + }) 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 => `${item.dataType}` === '1').map((item) => { item.params = '时基'; return item }) // 时基 + zeroFrequencyGainList.value = newVal.filter(item => `${item.dataType}` === '2').map((item) => { item.params = '直流增益'; return item }) // 直流增益 + DCBiasList.value = newVal.filter(item => `${item.dataType}` === '3').map((item) => { item.params = '直流偏置'; return item }) // 直流偏置 + frequencyBandwidthList.value = newVal.filter(item => `${item.dataType}` === '4').map((item) => { item.params = '频带宽度'; return item }) // 频带宽度(数字示波器) + triggerSensitivityList.value = newVal.filter(item => `${item.dataType}` === '5').map((item) => { item.params = '触发灵敏度'; return item })// 触发灵敏度 + risetimeList.value = newVal.filter(item => `${item.dataType}` === '6').map((item) => { item.params = '上升时间'; return item })// 上升时间(数字示波器) + inputResistanceList.value = newVal.filter(item => `${item.dataType}` === '7').map((item) => { item.params = '输入电阻'; return item })// 输入电阻(数字示波器) + calibratingSignalList.value = newVal.filter(item => `${item.dataType}` === '8').map((item) => { item.params = '校准信号'; return item })// 校准信号(数字示波器) + if (timeBaseList.value.length) { + form.value.methodType = timeBaseList.value[0].methodType // 时基方法 + } + } + else if (props.itemCategoryName === '模拟示波器') { + scanningTimeList.value = newVal.filter(item => `${item.dataType}` === '1').map((item) => { item.params = '扫描时间系数及扩展'; return item }) // 扫描时间系数及扩展 + verticalSizeList.value = newVal.filter(item => `${item.dataType}` === '2').map((item) => { item.params = '垂直幅度'; return item }) // 垂直幅度 + frequencyBandwidthSimulateList.value = newVal.filter(item => `${item.dataType}` === '3').map((item) => { item.params = '频带宽度'; return item }) // 频带宽度(模拟示波器 + triggerCharacteristicList.value = newVal.filter(item => `${item.dataType}` === '4').map((item) => { item.params = '触发特性'; return item }) // 触发特性 + inputResistanceSimulateList.value = newVal.filter(item => `${item.dataType}` === '5').map((item) => { item.params = '输入电阻'; return item })// 输入电阻 + risetimeSimulateList.value = newVal.filter(item => `${item.dataType}` === '6').map((item) => { item.params = '上升时间'; return item })// 上升时间(数字示波器) + calibratingSignalSimulateList.value = newVal.filter(item => `${item.dataType}` === '7').map((item) => { item.params = '校准信号'; return item })// 校准信号(数字示波器) + } + } +}) -// watch(() => props.list, (newVal) => { // 检定项表格 -// if (newVal) { -// list.value = [...newVal] -// } -// }) +watch(() => props.form, (newValue) => { + 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({ list }) +defineExpose({ checkListBeforeSave, solveDataBeforeSave, form }) diff --git a/src/views/business/measure/item/components/thirteenth/templateTable.vue b/src/views/business/measure/item/components/thirteenth/templateTable.vue index a210821..b645ba7 100644 --- a/src/views/business/measure/item/components/thirteenth/templateTable.vue +++ b/src/views/business/measure/item/components/thirteenth/templateTable.vue @@ -6,7 +6,7 @@ import { getDictByCode } from '@/api/system/dict' import type { dictType } from '@/global' -// ------------------定义props、 emit------------------- +// ------------------定义props、 emits------------------- const props = defineProps({ pageType: { type: String, @@ -40,7 +40,17 @@ }, // 表格大小,默认,small,mini等,与el-table条件相同 type: String, // 表格类型,表格title }) -const emit = defineEmits(['change', 'selectionChange', 'rowClick', 'rowDbClick', 'multiSelect', 'filterChange']) +const emits = defineEmits([ + 'change', + 'selectionChange', + 'rowClick', + 'rowDbClick', + 'multiSelect', + 'filterChange', + 'changeItemType', + 'changeVerticalDeflectCoefficient', + 'changeInputNumber', +]) // ------------------------------------------字典---------------------------------------------- const standardTechnicalIndexSymbolList = ref([]) // 技术指标规则 const standard13ThoroughfareList = ref([]) // 通道 @@ -51,7 +61,12 @@ const standard13TriggerTypeList = ref([]) // 触发特性 const standard13NominalValueUnitList = ref([]) // 标称值单位 const standardAmplitudeUnitList = ref([]) // 幅度单位 - +const standard13ItemList = ref([]) // 校准信号--项目 +const standard13ScanTypeList = ref([]) // 扫描方式 +const standard13VerticalGearStepList = ref([]) // 垂直档位步进 +const standardFrequencyUnitList = ref([]) // 频率单位-公用 +const characteristicAmplitudeUnitList = ref([]) // 触发特性-公用 +const standard13SignalTypeList = ref([]) // 信号类型 /** * 获取字典 */ @@ -72,7 +87,7 @@ getDictByCode('standard13VerticalDeflectCoefficient').then((response) => { standard13VerticalDeflectCoefficientList.value = response.data }) - // 垂直偏转系数(/div)单位\电压单位--公用 + // 电压单位--公用/垂直偏转系数(/div)单位 getDictByCode('standardVoltage').then((response) => { standardVoltageList.value = response.data }) @@ -96,7 +111,30 @@ getDictByCode('standardAmplitudeUnit').then((response) => { standardAmplitudeUnitList.value = response.data }) - // standard13Item + // 校准信号--项目 + getDictByCode('standard13Item').then((response) => { + standard13ItemList.value = response.data + }) + // 扫描方式 + getDictByCode('standard13ScanType').then((response) => { + standard13ScanTypeList.value = response.data + }) + // 垂直档位步进 + getDictByCode('standard13VerticalGearStep').then((response) => { + standard13VerticalGearStepList.value = response.data + }) + // 频率单位公用 + getDictByCode('standardFrequencyUnit').then((response) => { + standardFrequencyUnitList.value = response.data + }) + // 触发特性幅度单位 + getDictByCode('characteristicAmplitudeUnit').then((response) => { + characteristicAmplitudeUnitList.value = response.data + }) + // 信号类型 + getDictByCode('standard13SignalType').then((response) => { + standard13SignalTypeList.value = response.data + }) } getDict() @@ -129,16 +167,16 @@ } // 刷新 function refresh() { - emit('change') + emits('change') } // 点击行 function rowClick(row: object, column?: any, event?: any) { - emit('rowClick', row) + emits('rowClick', row) } // 双击行 function rowDbClick(row: object, column?: any, event?: any) { - emit('rowDbClick', row) + emits('rowDbClick', row) } // 监听columns watch(props.columns, (val) => { @@ -147,7 +185,7 @@ }) // 多选 const handleSelectionChange = (val: any) => { - emit('selectionChange', val) + emits('selectionChange', val) } // 清除多选选中 const clearMulti = () => { @@ -155,6 +193,20 @@ table.value!.clearSelection() singleChecked.value = '' } + +// 项目选择变化 +const changeItemType = (value: string, index: number) => { + emits('changeItemType', value, index) +} +// 垂直偏转系数变化 +const changeVerticalDeflectCoefficient = (value: string) => { + emits('changeVerticalDeflectCoefficient', value) +} + +const changeInputNumber = (value: number) => { + emits('changeInputNumber', value) +} + defineExpose({ clearMulti, initColumnsState, }) @@ -210,11 +262,13 @@ />
{{ scope.row.technicalIndexUnit }}
+ + + + + + + + + + + + @@ -240,16 +315,22 @@ v-if="item.value === 'cycleSignal' || item.value === 'standardValue' || item.value === 'referencePointFrequency' || item.value === 'bandWidth' || item.value === 'horizontalDeflectCoefficient' || item.value === 'referencePointFrequency' || item.value === 'bandWidth' - || item.value === 'nominalValue' || item.value === 'signalFrequency' || item.value === 'amplitude'" + || item.value === 'nominalValue' || item.value === 'signalFrequency' || item.value === 'amplitude' + || (item.value === 'verticalDeflectionGear' && scope.row.itemType === '幅度') || item.value === 'horizontalScaleGear' + || item.value === 'verticalScaleGear' || item.value === 'frequency' || item.value === 'referenceFrequency' + || item.value === 'stepFrequency' || item.value === 'frequencyUpper' || item.value === 'referenceAmplitude' + || item.value === 'nominalAmplitudeValue' || item.value === 'nominalFrequencyValue'" v-model="scope.row[item.value]" :placeholder="`${item.text}`" class="full-width-input" :disabled="props.pageType === 'detail'" + @change="changeInputNumber" /> - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/views/business/measure/item/detail.vue b/src/views/business/measure/item/detail.vue index 42dfc1d..efcd623 100644 --- a/src/views/business/measure/item/detail.vue +++ b/src/views/business/measure/item/detail.vue @@ -351,6 +351,17 @@ })), // 鉴定项列表 } } + else if (form.value.belongStandardEquipment === '13') { // 第13套:示波器 + if (!standardRef.value.checkListBeforeSave()) { params = '未通过校验'; return params } + const list = standardRef.value.solveDataBeforeSave() // 处理数据 + params = { + helpFieldInstruction: form.value.helpFieldInstruction, // 辅助字段说明 + itemRemark: form.value.itemRemark, // 检定项备注 + itemId: infoId.value, // 检定项id + measureItemDataOscilloscopeList: list, + ...standardRef.value.form, + } + } return params } @@ -498,6 +509,10 @@ getList.value = response.measureItemDataSpectrumAnalyzerList // 检定项表格 getObject.value = response // 检定项表单 } + else if (form.value.belongStandardEquipment === '13') { // 第13套:示波器 + getList.value = response.measureItemDataOscilloscopeList // 检定项表格 + getObject.value = response // 检定项表单 + } } function fetchInfo() { diff --git a/src/views/business/taskMeasure/measureData/components/thirteenth/templateDetail.vue b/src/views/business/taskMeasure/measureData/components/thirteenth/templateDetail.vue index cc27596..8de9c99 100644 --- a/src/views/business/taskMeasure/measureData/components/thirteenth/templateDetail.vue +++ b/src/views/business/taskMeasure/measureData/components/thirteenth/templateDetail.vue @@ -36,6 +36,8 @@ belongStandardEquipment: '', // 标准装置code belongStandardEquipmentName: '', // 标准装置名称 + methodType: '', // 时基方法 + appearance: '正常', // 外观及功能性检查 appearanceFunctionCheck: 1, // 外观及功能性检查 timeBase: 1, // 时基(示波器-数字) currentGain: 1, // 直流增益(示波器-数字) @@ -84,28 +86,50 @@ const risetimeSimulateList = ref([]) // 上升时间(模拟示波器) const calibratingSignalSimulateList = ref([]) // 校准信号(模拟示波器) -const columns_time_base = ref([ // 时基 - { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '周期时标信号', value: 'nominalValue', align: 'center', required: true }, - { text: '周期时标信号△T/ns', value: 'nominalValue', align: 'center', required: true }, - { text: '时基相对误差△δ', value: 'nominalValue', align: 'center', required: true }, - { text: '技术指标', value: 'nominalValue', align: 'center', required: true }, - { text: '结论', value: 'nominalValue', align: 'center', required: true }, +const timeBaseLoading = ref(false) // 时基 +const zeroFrequencyGainLoading = ref(false) // 直流增益 +const DCBiasLoading = ref(false) // 直流偏置 +const frequencyBandwidthLoading = ref(false) // 频带宽度(数字示波器) +const triggerSensitivityLoading = ref(false) // 触发灵敏度 +const risetimeLoading = ref(false) // 上升时间(数字示波器) +const inputResistanceLoading = ref(false) // 输入电阻(数字示波器) +const calibratingSignalLoading = ref(false) // 校准信号(数字示波器) +const scanningTimeLoading = ref(false) // 扫描时间系数及扩展 +const verticalSizeLoading = ref(false) // 垂直幅度 +const frequencyBandwidthSimulateLoading = ref(false) // 频带宽度(模拟示波器) +const triggerCharacteristicLoading = ref(false) // 触发特性 +const inputResistanceSimulateLoading = ref(false) // 输入电阻(模拟示波器) +const risetimeSimulateLoading = ref(false) // 上升时间(模拟示波器) +const calibratingSignalSimulateLoading = ref(false) // 校准信号(模拟示波器) + +const columns_time_base_method1 = ref([ // 时基--方法一 + { text: '检定项目', value: 'params', align: 'center', required: true, width: '90' }, + { text: '周期时标信号', value: 'cycleSignalDefineFront', align: 'center', required: true }, + { text: '时基绝对误差△T/ns', value: 'timeBaseAbsoluteError', align: 'center', required: true, width: '180' }, + { text: '时基相对误差△δ', value: 'timeBaseRelativeError', align: 'center', required: false }, + { text: '技术指标', value: 'technicalIndexDefineFront', align: 'center', required: true }, + { text: '结论', value: 'conclusion', align: 'center', required: false }, +]) + +const columns_time_base_method2 = ref([ // 时基--方法二 + { text: '检定项目', value: 'params', align: 'center', required: true, width: '90' }, + { text: '参考输出', value: 'cycleSignal', align: 'center', required: true }, + { text: '差拍波形频率测量值(Hz)', value: 'timeBaseAbsoluteError', align: 'center', required: true, width: '180' }, + { text: '时基相对误差△δ', value: 'timeBaseRelativeError', align: 'center', required: false }, + { text: '技术指标', value: 'technicalIndexDefineFront', align: 'center', required: true }, + { text: '结论', value: 'conclusion', align: 'center', required: false }, ]) const columns_zero_frequency_gain = ref([ // 直流增益 - { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '阻抗', value: 'nominalValue', align: 'center', required: true }, - { text: '阻抗单位', value: 'nominalValue', align: 'center', required: true }, - { text: '通道', value: 'nominalValue', align: 'center', required: true }, - { text: '垂直偏转系数(/div)', value: 'nominalValue', align: 'center', required: true }, - { text: '垂直偏转系数(/div)单位', value: 'nominalValue', align: 'center', required: true }, - { text: '标准值', value: 'nominalValue', align: 'center', required: true }, - { text: '标准值单位', value: 'nominalValue', align: 'center', required: true }, - { text: '测量值', value: 'nominalValue', align: 'center', required: true }, - { text: '相对误差', value: 'nominalValue', align: 'center', required: true }, - { text: '技术指标', value: 'nominalValue', align: 'center', required: true }, - { text: '结论', value: 'nominalValue', align: 'center', required: true }, + { text: '检定项目', value: 'params', align: 'center', required: true, width: '90' }, + { text: '阻抗', value: 'impedanceDefineFront', align: 'center', required: true }, + { text: '通道', value: 'thoroughfare', align: 'center', required: true }, + { text: '垂直偏转系数(/div)', value: 'verticalDeflectCoefficientDefineFront', align: 'center', required: true }, + { text: '标准值', value: 'standardValueDefineFront', align: 'center', required: true }, + { text: '测量值', value: 'measureValue', align: 'center', required: true, width: '180' }, + { text: '相对误差', value: 'relativeError', align: 'center', required: false }, + { text: '技术指标', value: 'technicalIndexDefineFront', align: 'center', required: true }, + { text: '结论', value: 'conclusion', align: 'center', required: false }, ]) const columns_DC_bias = ref([ // 直流偏置 @@ -322,7 +346,40 @@ // 初始化输入数据 const initInputData = (data: any) => { - + if (itemFormData.value.itemCategoryName === '数字示波器') { + // 时基 + timeBaseList.value = data.filter(item => `${item.dataType}` === '1') + timeBaseList.value = timeBaseList.value.map((item) => { + return { + ...item, + params: '时基', + cycleSignalDefineFront: item.cycleSignal + item.cycleSignalUnit, // 周期时标信号 + timeBaseAbsoluteError: '', // 时基绝对误差△T/ns + timeBaseRelativeError: '', // 时基相对误差△δ + technicalIndexDefineFront: item.technicalIndexSymbol + item.technicalIndex + item.technicalIndexUnit, // 技术指标 + conclusion: '', // 结论 + } + }) + // 直流增益 + zeroFrequencyGainList.value = data.filter(item => `${item.dataType}` === '2') + zeroFrequencyGainList.value = zeroFrequencyGainList.value.map((item) => { + return { + ...item, + params: '直流增益', + impedanceDefineFront: item.impedance + item.impedanceUnit, // 阻抗 + verticalDeflectCoefficientDefineFront: item.verticalDeflectCoefficient + item.verticalDeflectCoefficientUnit, // 垂直偏转系数 + standardValueDefineFront: item.standardValue + item.standardValueUnit, // 标准值 + measureValue: '', // 测量值 + measureValueUnit: item.standardValueUnit, // 测量值单位 + relativeError: '', // 相对误差 + technicalIndexDefineFront: item.technicalIndexSymbol + item.technicalIndex + item.technicalIndexUnit, // 技术指标 + conclusion: '', // 结论 + } + }) + } + else if (itemFormData.value.itemCategoryName === '模拟示波器') { + console.log('模拟示波器') + } } /** @@ -338,44 +395,115 @@ belongStandardEquipment, // 检校标准装置字典code } getItemInfo(params).then((res) => { - itemFormData.value.appearance = res.data.measureItemConfigPistonGauge.appearance ? '1' : '' // 外观及功能检查 1有外观,2没有外观 - initInputData(res.data.measureItemDataPistonGaugeList) + itemFormData.value.appearance = res.data.appearanceFunctionCheck ? '1' : '' // 外观及功能检查 1有外观,2没有外观 + itemFormData.value.appearanceFunctionCheck = res.data.appearanceFunctionCheck // 外观及功能检查 1有外观,2没有外观 + itemFormData.value.timeBase = res.data.timeBase // 时基 + itemFormData.value.currentGain = res.data.currentGain // 直流增益 + itemFormData.value.currentBias = res.data.currentBias // 直流偏置 + itemFormData.value.bandWidth = res.data.bandWidth // 频带宽度 + itemFormData.value.triggerSensitivity = res.data.triggerSensitivity // 触发灵敏度 + itemFormData.value.riseTime = res.data.riseTime // 上升时间 + itemFormData.value.inputResistance = res.data.inputResistance // 输入电阻 + itemFormData.value.calibratingSignal = res.data.calibratingSignal // 校准信号 + itemFormData.value.scanTimeCoefficient = res.data.scanTimeCoefficient // 扫描时间系数及扩展 + itemFormData.value.triggerCharacter = res.data.triggerCharacter // 触发特性 + itemFormData.value.verticalAmplitude = res.data.verticalAmplitude // 垂直幅度 + + const tempTimeBaseList = res.data.measureItemDataOscilloscopeList.filter(item => `${item.dataType}` === '1') + if (tempTimeBaseList && tempTimeBaseList.length) { + itemFormData.value.methodType = tempTimeBaseList[0].methodType + } + initInputData(res.data.measureItemDataOscilloscopeList) }) } // ----------------------------------------点击保存时校验--------------------------------------- -// 校验 -const checkout = () => { +// 点击计算结果校验 +const checkout = (type: string) => { + let result = true + switch (type) { + case '时基': { + const columns = itemFormData.value.methodType === '方法一' ? columns_time_base_method1.value : columns_time_base_method2.value + result = useCheckList(timeBaseList.value, columns, type) + break + } + case '直流增益': + result = useCheckList(zeroFrequencyGainList.value, columns_zero_frequency_gain.value, type) + break + default: + break + } + return result +} + +// 计算之前参数处理 +const solveParamsBeforeCalculate = (type: string) => { + let list = [] + switch (type) { + case '时基': + list = timeBaseList.value + break + case '直流增益': + list = zeroFrequencyGainList.value + break + default: + break + } + return list +} + +// 计算之后参数处理 +const solveParamsAfterCalculate = (type: string, list) => { + switch (type) { + case '时基': + timeBaseList.value = timeBaseList.value.map((item, index) => { + return { + ...item, + timeBaseRelativeError: list[index].timeBaseRelativeError, + conclusion: list[index].conclusion, + exceedMark: list[index].exceedMark, + } + }) + break + case '直流增益': + zeroFrequencyGainList.value = zeroFrequencyGainList.value.map((item, index) => { + return { + ...item, + relativeError: list[index].relativeError, + conclusion: list[index].conclusion, + exceedMark: list[index].exceedMark, + } + }) + break + default: + break + } + return list } // -----------------------------------------生成结果处理---------------------------------------- // 点击计算结果 -const calculate = () => { - // ElMessage.info('敬请期待') - return false - // if (!list.value.length) { - // ElMessage.warning('没有检定项数据,无法生成结果') - // return false - // } - // if (!useCheckList(list.value, measureColumns.value, '检定数据')) { - // return false - // } - // const params = { - // belongStandardEquipment: itemFormData.value.belongStandardEquipment, // 检校标准装置 - // itemCategoryName: itemFormData.value.itemCategoryName, // 检定项分类名称 - // measureDataCalibratorList: list.value, - // } - // calculateHandle(params).then((res) => { - // if (res.data && res.data.length) { - // resultList.value = res.data.map((item: IDetailMeasureList) => { - // return { - // ...item, - // } - // }) // 检定数据 - // } - // else { - // list.value = res.data - // } - // }) +const calculate = (type: string) => { + if (!checkout(type)) { + return false + } + const list = solveParamsBeforeCalculate(type) + timeBaseLoading.value = type === '时基' + zeroFrequencyGainLoading.value = type === '直流增益' + const params = { + belongStandardEquipment: itemFormData.value.belongStandardEquipment, // 检校标准装置 + itemCategoryName: itemFormData.value.itemCategoryName, // 检定项分类名称 + measureDataOscilloscopeList: list, + } + calculateHandle(params).then((res) => { + if (res.data && res.data.length) { + solveParamsAfterCalculate(type, res.data) + } + timeBaseLoading.value = false + zeroFrequencyGainLoading.value = false + }).catch(() => { + timeBaseLoading.value = false + zeroFrequencyGainLoading.value = false + }) } // ------------------------------------------钩子---------------------------------------------- @@ -394,7 +522,7 @@ itemFormData.value.belongStandardEquipment = $route.query.belongStandardEquipment as string// 标准装置code itemFormData.value.belongStandardEquipmentName = $route.query.belongStandardEquipmentName as string// 标准装置名称 // 查输入值(查检定项管理的详情) - // fetchItemInfo($route.query.itemId! as string, $route.query.itemCategoryName! as string, $route.query.belongStandardEquipment as string) + fetchItemInfo($route.query.itemId! as string, $route.query.itemCategoryName! as string, $route.query.belongStandardEquipment as string) } else { itemFormData.value.itemCategoryName = $route.query.itemCategoryName as string // 设备检定项分类名称 @@ -446,26 +574,27 @@ - + + - + @@ -475,11 +604,11 @@ - + diff --git a/src/views/business/taskMeasure/measureData/components/thirteenth/templateTable.vue b/src/views/business/taskMeasure/measureData/components/thirteenth/templateTable.vue index 7cf8109..cf900a1 100644 --- a/src/views/business/taskMeasure/measureData/components/thirteenth/templateTable.vue +++ b/src/views/business/taskMeasure/measureData/components/thirteenth/templateTable.vue @@ -149,20 +149,34 @@ - diff --git a/src/views/business/taskMeasure/measureData/components/thirteenth/thirteenth-interface.ts b/src/views/business/taskMeasure/measureData/components/thirteenth/thirteenth-interface.ts index 39f9c69..deba24a 100644 --- a/src/views/business/taskMeasure/measureData/components/thirteenth/thirteenth-interface.ts +++ b/src/views/business/taskMeasure/measureData/components/thirteenth/thirteenth-interface.ts @@ -1,60 +1,71 @@ // 检定项数据表格 export interface IDetailMeasureList { id: string // id,更新/删除使用参数 - dataType: string // 检定项数据类型(一个检定项中区分两个表格)(字典code) - itemId: string // 检定项id - params: string // 检定项目 + dataId: string // 检定数据管理基础信息表id(新增不用传) + dataType: string // 检定数据类型(一个检定数据中区分多个表格)(字典code) - methodType?: string // 方法类型(时基选择方法一/方法二)(字典value) - cycleSignal?: string // 周期时标信号 - cycleSignalUnit?: string // 周期时标信号单位 + cycleSignal?: string // 周期时标信号(方法一)/ 参考输出(方法二) + cycleSignalUnit?: string // 周期时标信号单位(方法一)/ 参考输出单位(方法二) + timeBaseAbsoluteError?: string // 时基绝对误差(方法一)/ 差拍波形频率测量值(方法二) + timeBaseAbsoluteErrorUnit?: string // 时基绝对误差单位(方法一)/ 差拍波形频率测量值单位(方法二) + timeBaseRelativeError?: string // 时基相对误差 + timeBaseRelativeErrorUnit?: string // 时基相对误差单位 technicalIndex?: string // 技术指标 technicalIndexSymbol?: string // 技术指标前符号 technicalIndexUnit?: string // 技术指标单位 + conclusion?: string // 结论 - amplitude?: string // 幅度 - amplitudeUnit?: string // 幅度单位 - bandWidth?: string // 频带宽度 - bandWidthUnit?: string // 频带宽度单位 - frequency?: string // 频率(模拟示波器) - frequencyUnit?: string // 频率单位(模拟示波器) - frequencyUpper?: string // 频率上限(模拟示波器) - frequencyUpperUnit?: string // 频率上限单位(模拟示波器) - horizontalDeflectCoefficient?: string // 水平偏转系数 - horizontalDeflectCoefficientUnit?: string // 水平偏转系数单位 - horizontalScaleGear?: string // 水平刻度档位(模拟示波器) - horizontalScaleGearUnit?: string // 水平刻度档位单位(模拟示波器) impedance?: string // 阻抗 impedanceUnit?: string // 阻抗单位 + thoroughfare?: string // 通道 + verticalDeflectCoefficient?: string // 垂直偏转系数 + verticalDeflectCoefficientUnit?: string // 垂直偏转系数单位 + standardValue?: string // 标准值 + standardValueUnit?: string // 标准值单位 + measureValue?: string // 测量值 + measureValueUnit?: string // 测量值单位 + relativeError?: string // 相对误差 + + amplitudeDeviation?: string // 幅度偏差(模拟示波器) + bandWidth?: string // 频带宽度 + bandWidthUnit?: string // 频带宽度单位 + bottomMeasureValue?: string // 底部测量值 + bottomMeasureValueUnit?: string // 底部测量值单位 + correctRiseTime?: string // 修正上升时间 + decibelNumber?: string // 分贝数 + errorValue?: string // 误差 + frequencyDeviation?: string // 频率偏差(模拟示波器) + frequencyUpper?: string // 频率上限(模拟示波器) + frequencyUpperUnit?: string // 频率上限单位(模拟示波器) + horizontalScaleGear?: string // 水平刻度档位(模拟示波器) + horizontalScaleGearUnit?: string // 水平刻度档位单位(模拟示波器) itemType?: string // 项目(字典value) + measureAmplitude?: string // 测量幅度 + measureAmplitudeUnit?: string // 测量幅度单位 + measureAmplitudeValue?: string // 幅度测量值(模拟示波器) + measureAmplitudeValueUnit?: string // 幅度测量值单位(模拟示波器) + measureFrequencyValue?: string // 频率测量值(模拟示波器) + measureFrequencyValueUnit?: string // 频率测量值单位(模拟示波器) nominalAmplitudeValue?: string // 幅度标称值(模拟示波器) nominalAmplitudeValueUnit?: string // 幅度标称值单位(模拟示波器) nominalFrequencyValue?: string // 频率标称值(模拟示波器) - nominalFrequencyValueUnit?: string // 频率标称值单位(模拟示波器) + nominalFrequencyValueUnit?: string // 频率标称值单位(模拟示波器) nominalValue?: string // 标称值 nominalValueUnit?: string // 标称值单位 - referenceAmplitude?: string // 基准幅度(模拟示波器) - referenceAmplitudeUnit?: string // 基准幅度单位(模拟示波器) - referenceFrequency?: string // 基准频率(模拟示波器) - referenceFrequencyUnit?: string // 基准频率单位(模拟示波器) - referencePointFrequency?: string // 参考点频率 - referencePointFrequencyUnit?: string // 参考点频率单位 + outputSignalAmplitude?: string // 输出信号幅度 + referenceAmplitude?: string // 参考幅度 + referenceAmplitudeUnit?: string // 参考幅度单位 + riseTime?: string // 上升时间 scanType?: string // 扫描方式(模拟示波器)(字典value) signalFrequency?: string // 信号频率 signalFrequencyUnit?: string // 信号频率单位 signalType?: string // 信号类型(模拟示波器)(字典value) - standardValue?: string // 标准值 - standardValueUnit?: string // 标准值单位 - stepFrequency?: string // 步进频率(模拟示波器) - stepFrequencyUnit?: string // 步进频率单位(模拟示波器) - thoroughfare?: string // 通道 + topMeasureValue?: string // 顶部测量值 + topMeasureValueUnit?: string // 顶部测量值单位 triggerType?: string // 触发类型(字典value) - verticalDeflectCoefficient?: string // 垂直偏转系数 - verticalDeflectCoefficientUnit?: string // 垂直偏转系数单位 - verticalDeflectionGear?: string // 低电平测量时垂直偏转档位 - verticalDeflectionGearUnit?: string // 低电平测量时垂直偏转档位单位 - verticalGearStep?: string // 垂直档位步进(模拟示波器) + twoRelativeError?: string // 第二项检定项【扫描时间系数及扩展】中A扫描的水平刻度档位相同数值的相对误差数值(模拟示波器-上升时间中计算修正上升时间使用) verticalScaleGear?: string // 垂直刻度档位(模拟示波器) verticalScaleGearUnit?: string // 垂直刻度档位单位(模拟示波器) + exceedMark?: number // 超出范围标*(1/0) } diff --git a/src/views/business/taskMeasure/measureData/detail.vue b/src/views/business/taskMeasure/measureData/detail.vue index c13a907..4ac0c4a 100644 --- a/src/views/business/taskMeasure/measureData/detail.vue +++ b/src/views/business/taskMeasure/measureData/detail.vue @@ -352,7 +352,7 @@ certificateName: `${solvedParams.sampleName}-${solvedParams.traceDate}`, // 检定审批报告名称 dataId: solvedParams.dataId, // 检定数据管理基础信息表id id: '', - equipmentList: templateDetailRef.value.templateFormAndTableRef.measureEquipmentList, + equipmentList: belongStandardEquipment.value !== '1' ? templateDetailRef.value.templateFormAndTableRef.measureEquipmentList : [], } } if (belongStandardEquipment.value === '6') {