diff --git a/src/views/business/measure/item/components/second/templateDetail-interface.ts b/src/views/business/measure/item/components/second/templateDetail-interface.ts index 704aa90..1cf11f8 100644 --- a/src/views/business/measure/item/components/second/templateDetail-interface.ts +++ b/src/views/business/measure/item/components/second/templateDetail-interface.ts @@ -1,3 +1,37 @@ export interface IList { - + params: string + dataType: string + absoluteError?: string + createTime?: string + dataId?: string | number + dataTypeType?: string + exceedMark?: string | number + id?: string | number + loadRegulation?: string + loadSituation?: string + maximumError?: string + maximumErrorUnit?: string + measureIndicationValue?: string + outputChannel?: string + outputVoltageMaxChange?: string + resolution?: string | number + resolutionDigit?: string | number + rippleVoltage?: string + shortTermStability?: string + standardResistanceValue?: string + standardResistanceValueUnit?: string + standardValue?: string + standardVoltageValue?: string + standardVoltageValueUnit?: string + technicalIndex?: string + technicalIndexDigit?: string | number + technicalIndexSymbol?: string + unit?: string + updateTime?: string + voltageDifference?: string + voltageOutputValue?: string + voltageMaxDifference?: string + voltageRegulatorOutputValue?: string + voltageRegulation?: string + editable?: boolean } diff --git a/src/views/business/measure/item/components/second/templateDetail-interface.ts b/src/views/business/measure/item/components/second/templateDetail-interface.ts index 704aa90..1cf11f8 100644 --- a/src/views/business/measure/item/components/second/templateDetail-interface.ts +++ b/src/views/business/measure/item/components/second/templateDetail-interface.ts @@ -1,3 +1,37 @@ export interface IList { - + params: string + dataType: string + absoluteError?: string + createTime?: string + dataId?: string | number + dataTypeType?: string + exceedMark?: string | number + id?: string | number + loadRegulation?: string + loadSituation?: string + maximumError?: string + maximumErrorUnit?: string + measureIndicationValue?: string + outputChannel?: string + outputVoltageMaxChange?: string + resolution?: string | number + resolutionDigit?: string | number + rippleVoltage?: string + shortTermStability?: string + standardResistanceValue?: string + standardResistanceValueUnit?: string + standardValue?: string + standardVoltageValue?: string + standardVoltageValueUnit?: string + technicalIndex?: string + technicalIndexDigit?: string | number + technicalIndexSymbol?: string + unit?: string + updateTime?: string + voltageDifference?: string + voltageOutputValue?: string + voltageMaxDifference?: string + voltageRegulatorOutputValue?: string + voltageRegulation?: string + editable?: boolean } diff --git a/src/views/business/measure/item/components/second/templateDetail.vue b/src/views/business/measure/item/components/second/templateDetail.vue index 46b98a5..6c93fce 100644 --- a/src/views/business/measure/item/components/second/templateDetail.vue +++ b/src/views/business/measure/item/components/second/templateDetail.vue @@ -9,7 +9,6 @@ import { useCheckList } from '@/commonMethods/useCheckList' import { calculate, recalculate } from '@/api/business/measure/caculate' import type { TableColumn } from '@/components/NormalTable/table_interface' - const props = defineProps({ pageType: { type: String, @@ -35,37 +34,36 @@ }, }) -const typeList = [{ - value: '1', - name: '数字式', -}, -{ - value: '2', - name: '指针式', -}] const form = ref({ voltageRepresentationValueErrorType: '1', // 电压表示值误差类型:1数字式、2指针式 - ammeterDirectType: '1', // 电流表示值误差(直接测量)类型:1数字式、2指针式 - ammeterIndirectType: '1', // 电流表示值误差(间接测量)类型:1数字式、2指针式 + ammeterDirectType: '1', // 电流表示值误差(直接测量)类型:1数字式、2指针式 + ammeterIndirectType: '1', // 电流表示值误差(间接测量)类型:1数字式、2指针式 technicalIndexSymbol: '3', // 通用规则 + appearanceFunctionCheck: 1, // 外观及功能性检查 + voltageRegulation: 1, // 电源电压调整率 + loadRegulation: 1, // 负载调整率 + voltageRepresentError: 1, // 电压表示值误差 + currentRepresentErrorDirect: 1, // 电流表示值误差(直接测量) + currentRepresentErrorIndirect: 1, // 电流表示值误差(间接测量) + rippleVoltage: 1, // 纹波电压 + voltageOutputStability: 1, // 输出电压短期稳定性 }) const tableLoading = ref(false) const lineVoltageRegulationList = ref([]) // 电源电压调整率 const loadRegulationList = ref([]) // 负载调整率 const voltageRepresentationValueErrorList = ref([]) // 电压表示值误差 -const ammeterDirectList = ref([]) // 电流表示值误差(直接测量) -const ammeterIndirectList = ref([]) // 电流表示值误差(间接测量) +const ammeterDirectList = ref([]) // 电流表示值误差(直接测量) +const ammeterIndirectList = ref([]) // 电流表示值误差(间接测量) const rippleVoltageList = ref([]) // 纹波电压 const outputVoltageStabilityList = ref([]) // 输出电压短期稳定性 const lineVoltageRegulationCheckoutList = ref([]) // 电源电压调整率多选 const loadRegulationCheckoutList = ref([]) // 负载调整率多选 const voltageRepresentationValueErrorCheckoutList = ref([]) // 电压表示值误差多选 -const ammeterDirectCheckoutList = ref([]) // 电流表示值误差(直接测量)多选 -const ammeterIndirectCheckoutList = ref([]) // 电流表示值误差(间接测量)多选 +const ammeterDirectCheckoutList = ref([]) // 电流表示值误差(直接测量)多选 +const ammeterIndirectCheckoutList = ref([]) // 电流表示值误差(间接测量)多选 const rippleVoltageCheckoutList = ref([]) // 纹波电压多选 const outputVoltageStabilityCheckoutList = ref([]) // 输出电压短期稳定性多选 - // ----------------------------------------表头------------------------------------------------ const columns_line_voltage_regulation = ref([ // 电源电压调整率 { text: '检定项目', value: 'params', align: 'center', required: true, type: 'text' }, @@ -74,80 +72,78 @@ { text: '调压器输出值', value: 'voltageRegulatorOutputValue', align: 'center', required: true, type: 'select' }, { text: '被检电源技术指标', value: 'technicalIndex', align: 'center', required: true, type: 'input' }, ]) - const columns_load_regulation = 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: 'params', align: 'center', required: true, type: 'text' }, + { text: '输出通道', value: 'outputChannel', align: 'center', required: true, type: 'select' }, + { text: '单位', value: 'unit', align: 'center', required: true, type: 'select' }, + { text: '负载情况', value: 'loadSituation', align: 'center', required: true, type: 'select' }, + { text: '被检电源技术指标', value: 'technicalIndex', align: 'center', required: true, type: 'input' }, ]) - -// 电压表示值误差(数字式)、电流表示值误差(直接测量)--(数字式) +// 电压表示值误差(数字式)、电流表示值误差(直接测量)--(数字式) const columns_voltage_representation_value_error_number = 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: '误差参数a', value: 'nominalValue', align: 'center', required: true }, - { text: '误差参数b', 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, type: 'text' }, + { text: '输出通道', value: 'outputChannel', align: 'center', required: true, type: 'select' }, + { text: '单位', value: 'unit', align: 'center', required: true, type: 'select' }, + { text: '被检表示值', value: 'measureIndicationValue', align: 'center', required: true, type: 'input' }, + { text: '误差参数a', value: 'paramsa', align: 'center', required: true, type: 'input' }, + { text: '误差参数b', value: 'paramsb', align: 'center', required: true, type: 'input' }, + { text: '最大允许误差', value: 'maximumError', align: 'center', required: true, type: 'select' }, + { text: '分辨力', value: 'resolution', align: 'center', required: true, type: 'input' }, ]) // 电压表示值误差(数字式) const columns_voltage_representation = ref(columns_voltage_representation_value_error_number.value) -// 电流表示值误差(直接测量) +// 电流表示值误差(直接测量) const columns_ammeter_direct = ref(columns_voltage_representation_value_error_number.value) -// 电压表示值误差(指针式)、电流表示值误差(直接测量)--(指针式) +// 电压表示值误差(指针式)、电流表示值误差(直接测量)--(指针式) const columns_voltage_representation_value_error_pointer = 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: '准确度a', 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, type: 'text' }, + { text: '输出通道', value: 'outputChannel', align: 'center', required: true, type: 'select' }, + { text: '单位', value: 'unit', align: 'center', required: true, type: 'select' }, + { text: '被检表示值', value: 'measureIndicationValue', align: 'center', required: true, type: 'input' }, + { text: '准确度a', value: 'paramsa', align: 'center', required: true, type: 'input' }, + { text: '指针式仪表满量程值', value: 'paramsb', align: 'center', required: true, type: 'input' }, + { text: '最大允许误差', value: 'maximumError', align: 'center', required: true, type: 'select' }, ]) -// 电流表示值误差(间接测量)--数字式 +// 电流表示值误差(间接测量)--数字式 const columns_ammeter_indirect_number = 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: '误差参数a', value: 'nominalValue', align: 'center', required: true }, - { text: '误差参数b', 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, type: 'text' }, + { text: '输出通道', value: 'outputChannel', align: 'center', required: true, type: 'select' }, + { text: '单位', value: 'unit', align: 'center', required: true, type: 'select' }, + { text: '被检表示值', value: 'measureIndicationValue', align: 'center', required: true, type: 'input' }, + { text: '标准电阻值', value: 'standardResistanceValue', align: 'center', required: true, type: 'input' }, + { text: '标准电阻值单位', value: 'standardResistanceValueUnit', align: 'center', required: true, type: 'select' }, + { text: '误差参数a', value: 'paramsa', align: 'center', required: true, type: 'input' }, + { text: '误差参数b', value: 'paramsb', align: 'center', required: true, type: 'input' }, + { text: '最大允许误差', value: 'maximumError', align: 'center', required: true, type: 'select' }, + { text: '分辨力', value: 'resolution', align: 'center', required: true, type: 'input' }, ]) -// 电流表示值误差(间接测量) +// 电流表示值误差(间接测量) const columns_ammeter_indirect = ref(columns_ammeter_indirect_number.value) -// 电流表示值误差(间接测量)--指针式 +// 电流表示值误差(间接测量)--指针式 const columns_ammeter_indirect_pointer = 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: '准确度a', 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, type: 'text' }, + { text: '输出通道', value: 'outputChannel', align: 'center', required: true, type: 'select' }, + { text: '单位', value: 'unit', align: 'center', required: true, type: 'select' }, + { text: '被检表示值', value: 'measureIndicationValue', align: 'center', required: true, type: 'input' }, + { text: '标准电阻值', value: 'standardResistanceValue', align: 'center', required: true, type: 'input' }, + { text: '标准电阻值单位', value: 'standardResistanceValueUnit', align: 'center', required: true, type: 'select' }, + { text: '准确度a', value: 'paramsa', align: 'center', required: true, type: 'input' }, + { text: '指针式仪表满量程值', value: 'paramsb', align: 'center', required: true, type: 'input' }, + { text: '最大允许误差', value: 'maximumError', align: 'center', required: true, type: 'select' }, ]) - // 纹波电压 const columns_ripple_voltage = 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: 'params', align: 'center', required: true, type: 'text' }, + { text: '输出通道', value: 'outputChannel', align: 'center', required: true, type: 'select' }, + { text: '单位', value: 'unit', align: 'center', required: true, type: 'select' }, + { text: '被检电源技术指标', value: 'technicalIndex', align: 'center', required: true, type: 'number' }, ]) - // 输出电压短期稳定性 const columns_output_voltage_stability = 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: 'params', align: 'center', required: true, type: 'text' }, + { text: '输出通道', value: 'outputChannel', align: 'center', required: true, type: 'select' }, + { text: '单位', value: 'unit', align: 'center', required: true, type: 'select' }, + { text: '仪器技术指标', value: 'technicalIndex', align: 'center', required: true, type: 'input' }, ]) // --------------------------------表格操作--------------------------------------------------- // 多选 @@ -176,67 +172,208 @@ break } } -// 表格对应 columns字典 +// 表格对应 columns字典 1数字式、2指针式 const columnsDict = { '输出电压短期稳定性': columns_output_voltage_stability.value, // 7 '纹波电压': columns_ripple_voltage.value, // 6 - '电流表示值误差(间接测量)': columns_ammeter_indirect_pointer.value, // 5 - '电流表示值误差(直接测量)': '', // 4 + '电流表示值误差(间接测量)': columns_ammeter_indirect.value, // 5 + '电流表示值误差(直接测量)': columns_ammeter_direct.value, // 4 '电源电压调整率': columns_line_voltage_regulation.value, // 1 '负载调整率': columns_load_regulation.value, // 2 - '电压表示值误差': columns_voltage_representation_value_error_number.value, // 3 + '电压表示值误差': columns_voltage_representation.value, // 3 +} as { [key: string]: any } +const listDict = { + '输出电压短期稳定性': lineVoltageRegulationList.value, // 7 + '纹波电压': rippleVoltageList.value, // 6 + '电流表示值误差(间接测量)': ammeterIndirectList.value, // 5 + '电流表示值误差(直接测量)': ammeterDirectList.value, // 4 + '电源电压调整率': columns_line_voltage_regulation.value, // 1 + '负载调整率': loadRegulationList.value, // 2 + '电压表示值误差': voltageRepresentationValueErrorList.value, // 3 } as { [key: string]: any } /** * 增加行公共方法 * @param list 要操作的数组 * @param title 操作的表格 */ -const addRow = (list: IList[], title: string, type = '') => { - if (checkList(list, columnsDict[`${title}${type}`], `${title}表格`)) { - // listDict[title].push({}) - if (title === '电源电压调整率') { - lineVoltageRegulationList.value.push({ - params: '电源电压调整率', - dataType: '1', - technicalIndexSymbol: form.value.technicalIndexSymbol, // 技术指标前符号 - technicalIndex: '', // 技术指标 - outputChannel: '', // 输出通道 - unit: '', // 单位 - voltageRegulatorOutputValue: '', // 调压器输出值 - editable: true, - }) +const addRow = (list: IList[], title: string) => { + if (checkList(list, columnsDict[`${title}`], `${title}表格`)) { + switch (title) { + case '电源电压调整率': // 电源电压调整率 + lineVoltageRegulationList.value.push({ + params: '电源电压调整率', + dataType: '1', + technicalIndexSymbol: form.value.technicalIndexSymbol, // 技术指标前符号 + technicalIndex: '', // 技术指标 + outputChannel: '', // 输出通道 + unit: '', // 单位 + voltageRegulatorOutputValue: '', // 调压器输出值 + editable: true, + }) + break + case '负载调整率': // 负载调整率 + if (loadRegulationList.value.length === 8) { + ElMessage.warning('最多添加四项') + return + } + loadRegulationList.value.push({ + params: '负载调整率', + dataType: '2', + technicalIndexSymbol: form.value.technicalIndexSymbol, // 技术指标前符号 + technicalIndex: '', // 技术指标 + outputChannel: '', // 输出通道 + unit: '', // 单位 + editable: true, + loadSituation: '1', // 负载情况 1 空载 2 满载 + }, + { + params: '负载调整率', + dataType: '2', + technicalIndexSymbol: form.value.technicalIndexSymbol, // 技术指标前符号 + technicalIndex: '', // 技术指标 + outputChannel: '', // 输出通道 + unit: '', // 单位 + editable: true, + loadSituation: '2', // 负载情况 1 空载 2 满载 + }) + break + case '电压表示值误差': // 电压表示值误差 + // voltageRepresentationValueErrorList 1数字式、2指针式 + if (form.value.ammeterDirectType === '1') { + // 数字式 + voltageRepresentationValueErrorList.value.push({ + params: '电压表示值误差', + dataType: '3', + dataTypeType: '1', + outputChannel: '', // 输出通道 + technicalIndexSymbol: form.value.technicalIndexSymbol, // 技术指标前符号 + unit: '', // 单位 + measureIndicationValue: '', // 被检表示值 + paramsa: '', // 误差参数a **目前缺少该参数 + paramsb: '', // 误差参数b **目前缺少该参数 + maximumError: '', // 最大允许误差 + resolution: '0.0001', // 分辨力 + editable: true, + }) + } + else { + // 指针式 + voltageRepresentationValueErrorList.value.push({ + params: '电压表示值误差', + dataType: '3', + dataTypeType: '2', + outputChannel: '', // 输出通道 + technicalIndexSymbol: form.value.technicalIndexSymbol, // 技术指标前符号 + unit: '', // 单位 + measureIndicationValue: '', // 被检表示值 + paramsa: '', // 准确度a **目前缺少该参数 + paramsb: '', // 指针式仪表满量程值 **目前缺少该参数 + maximumError: '1', // 最大允许误差 + resolution: '0.0001', // 分辨力 + editable: true, + }) + } + break + case '电流表示值误差(直接测量)': // 电流表示值误差(直接测量) + // 1数字式、2指针式 + if (form.value.ammeterDirectType === '1') { + // 数字式 + ammeterDirectList.value.push({ + params: '电流表示值误差(直接测量)', + dataType: '4', + dataTypeType: '1', + outputChannel: '', // 输出通道 + technicalIndexSymbol: form.value.technicalIndexSymbol, // 技术指标前符号 + unit: '', // 单位 + measureIndicationValue: '', // 被检表示值 + paramsa: '', // 误差参数a **目前缺少该参数 + paramsb: '', // 误差参数b **目前缺少该参数 + maximumError: '', // 最大允许误差 + resolution: '0.0001', // 分辨力 + editable: true, + }) + } + else { + // 指针式 + ammeterDirectList.value.push({ + params: '电流表示值误差(直接测量)', + dataType: '4', + dataTypeType: '2', + outputChannel: '', // 输出通道 + technicalIndexSymbol: form.value.technicalIndexSymbol, // 技术指标前符号 + unit: '', // 单位 + measureIndicationValue: '', // 被检表示值 + paramsa: '', // 准确度a **目前缺少该参数 + paramsb: '', // 指针式仪表满量程值 **目前缺少该参数 + maximumError: '1', // 最大允许误差 + resolution: '0.0001', // 分辨力 + editable: true, + }) + } + break + case '电流表示值误差(间接测量)': // 电流表示值误差(间接测量) + // 1数字式、2指针式 + if (form.value.ammeterIndirectType === '1') { + // 数字式 + ammeterIndirectList.value.push({ + params: '电流表示值误差(间接测量)', + dataType: '5', + dataTypeType: '1', + outputChannel: '', // 输出通道 + technicalIndexSymbol: form.value.technicalIndexSymbol, // 技术指标前符号 + unit: '', // 单位 + measureIndicationValue: '', // 被检表示值 + paramsa: '', // 误差参数a **目前缺少该参数 + paramsb: '', // 误差参数b **目前缺少该参数 + maximumError: '', // 最大允许误差 + resolution: '0.0001', // 分辨力 + standardResistanceValue: '', // 标准电阻值 + standardResistanceValueUnit: '', // 标准电阻值单位 + editable: true, + }) + } + else { + // 指针式 + ammeterIndirectList.value.push({ + params: '电流表示值误差(间接测量)', + dataType: '5', + dataTypeType: '2', + outputChannel: '', // 输出通道 + technicalIndexSymbol: form.value.technicalIndexSymbol, // 技术指标前符号 + unit: '', // 单位 + measureIndicationValue: '', // 被检表示值 + paramsa: '', // 准确度a **目前缺少该参数 + paramsb: '', // 指针式仪表满量程值 **目前缺少该参数 + maximumError: '1', // 最大允许误差 + standardResistanceValue: '', // 标准电阻值 + standardResistanceValueUnit: '', // 标准电阻值单位 + editable: true, + }) + } + break + case '纹波电压': // 纹波电压 + rippleVoltageList.value.push({ + params: '纹波电压', + dataType: '6', + technicalIndexSymbol: form.value.technicalIndexSymbol, // 技术指标前符号 + technicalIndex: 0, // 技术指标 + outputChannel: '', // 输出通道 + unit: '', // 单位 + editable: true, + }) + break + case '输出电压短期稳定性': // 输出电压短期稳定性 + outputVoltageStabilityList.value.push({ + params: '输出电压短期稳定性', + dataType: '7', + technicalIndexSymbol: form.value.technicalIndexSymbol, // 技术指标前符号 + technicalIndex: '', // 技术指标 + outputChannel: '', // 输出通道 + unit: '', // 单位 + editable: true, + }) + break } - // if (list.length) { // 增加行时默认上一行数据 - // list.push({ - // id: '', - // checkPoint: list[list.length - 1].checkPoint, // 核查点(直接存字典value) - // checkType: list[list.length - 1].checkType, // 核查类型 - // cycleNumber: list[list.length - 1].cycleNumber, // 循环次数 - // equipmentId: list[list.length - 1].equipmentId, // 配套设备id - // itemCategoryId: list[list.length - 1].itemCategoryId, // 核查项分类id(能够确定是哪个标准装置) - // params: list[list.length - 1].params, // 核查项目(直接存字典value) - // remark: list[list.length - 1].remark, // 核查项备注(每个数据存储的核查项备注相同,前端取列表中一个即可) - // resolution: list[list.length - 1].resolution, // 分辨力 - // testType: list[list.length - 1].testType, // 核查点类型(直接存字典value) - // unit: list[list.length - 1].unit, // 单位(直接存字典value) - // urel: list[list.length - 1].urel, // 测量标准相对扩展不确定度urel - // }) - // } - // else { - // list.push({ - // checkPoint: '', // 核查点 - // checkType: '', // 核查类型(直接存字典value,多个逗号分隔) - // cycleNumber: 6, // 循环次数 - // equipmentId: infoId.value, // 配套设备id - // itemCategoryId: form.value.itemCategoryId, // 核查项分类id(能够确定是哪个标准装置) - // params: '', // 核查项目(直接存字典value) - // remark: '', // 核查项备注 - // resolution: 0.0001, // 分辨力 - // testType: title, // 核查点类型(直接存字典value) - // unit: '', // 单位(直接存字典value) - // urel: 0, // 测量标准相对扩展不确定度urel - // }) - // } } } /** @@ -258,7 +395,10 @@ lineVoltageRegulationList.value = data break case '负载调整率': // 负载调整率 - loadRegulationList.value = data + loadRegulationList.value = loadRegulationList.value.filter((item: any) => { + const needDelte = [...new Set(checkoutList.map(item => item.outputChannel))] + return !needDelte.includes(item.outputChannel) + }) break case '电压表示值误差': // 电压表示值误差 voltageRepresentationValueErrorList.value = data @@ -278,13 +418,23 @@ } } } - // ---------------------------------------------校验--------------------------------------------------- -// 校验表格(点击保存的时候用、生成标准器示值) +// 校验表格(点击保存的时候用、生成标准器示值) function checkList(list: any[], columns: any[], title: string) { return useCheckList(list, columns, title) } +// 校验所有表格 +function checkAllList() { + const reultArr = [] + for (const i in columnsDict) { + reultArr.push(useCheckList(listDict[i], columnsDict[i], i)) + } + return reultArr.map((item: boolean) => item) +} // ------------------------------------------------------------------------------------------------ +const calculateResult = (title: string) => { + +} // 点击计算结果--上方表格计算 const calculateDataTop = () => { @@ -294,30 +444,35 @@ } // ----------------------------------------------------------------------------------------------------- - // watch(() => props.list, (newVal) => { // 检定项表格 // if (newVal) { // list.value = [...newVal] // } // }) -// 电压表示值误差、监听电流表示值误差(直接测量) +// 电压表示值误差、监听电流表示值误差(直接测量) watch(() => [form.value.voltageRepresentationValueErrorType, form.value.ammeterDirectType], (newValue) => { + console.log(newValue, 'newValue') switch (newValue[0]) { // 电压表示值误差 case '2': // 指针式 columns_voltage_representation.value = columns_voltage_representation_value_error_pointer.value + voltageRepresentationValueErrorList.value = [] break default:// 数字式 columns_voltage_representation.value = columns_voltage_representation_value_error_number.value + voltageRepresentationValueErrorList.value = [] } - switch (newValue[1]) { // 监听电流表示值误差(直接测量) + switch (newValue[1]) { // 监听电流表示值误差(直接测量) case '2': // 指针式 columns_ammeter_direct.value = columns_voltage_representation_value_error_pointer.value + ammeterDirectList.value = [] break default:// 数字式 columns_ammeter_direct.value = columns_voltage_representation_value_error_number.value + ammeterDirectList.value = [] } + console.log(columns_ammeter_direct.value, 'columns_ammeter_direct.value') }) -// 监听电流表示值误差(间接测量) +// 监听电流表示值误差(间接测量) watch(() => form.value.ammeterIndirectType, (newValue) => { if (newValue === '2') { // 指针式 columns_ammeter_indirect.value = columns_ammeter_indirect_pointer.value @@ -325,16 +480,62 @@ else { // 数字式 columns_ammeter_indirect.value = columns_ammeter_indirect_number.value } + ammeterIndirectList.value = [] }) -// defineExpose({ list }) +// 监听 输出通道 修改下拉框内容 +const changeLoadSituationa = (value: any, index: number, title: string, type: string, list: IList[], item: string) => { + if (title !== '输出通道') { return } + if (type === 'change' && item === '负载调整率') { + // 1.判断奇偶修改对应的 输出通道 + if (Number(index) % 2 === 0) { + loadRegulationList.value[index + 1].outputChannel = value + } + else { + loadRegulationList.value[index - 1].outputChannel = value + } + } + // 2.限制下拉框内容 + setLoadSituation(typeof value === 'string' ? value : list[index].outputChannel as string, list) +} // ---------------------------------------------获取字典--------------------------------------------------- const TechnicalIndexSymbolList = ref<{ value: string;name: string;id: string }[]>([]) // 技术指标前符号 const OutputChannelList = ref<{ value: string;name: string;id: string }[]>([]) // 输出通道 const unitList = ref<{ value: string;name: string;id: string }[]>([]) // 单位 +const unitList1 = ref<{ value: string;name: string;id: string }[]>([]) // 单位 (直接测量/间接测量) const RegulatorOutputValue = ref<{ value: string;name: string;id: string }[]>([]) // 调压器输出值 +const loadSituationList = ref<{ value: string;name: string;id: string }[]>([ + { + name: '空载', + value: '1', + id: '1', + }, + { + name: '满载', + value: '2', + id: '2', + }, +]) // 负载情况 +const OutputChannelAllList = ref<{ value: string;name: string;id: string }[]>([]) // 所有输出通道 +const standardMaximumError = ref<{ value: string;name: string;id: string }[]>([]) // 最大允许误差公式 +const typeList = [{ + value: '1', + name: '数字式', +}, +{ + value: '2', + name: '指针式', +}] // 每个table对应的下拉框内容 字典 const tableDict = ref<{ [key: string]: { value: string;name: string;id: string }[] }>({}) +// 修改输出通道 +function setLoadSituation(current: string, list: IList[]) { + // 1. 已经选择的输出通道 + const selectLoadSituation = [...new Set(list.map((item: any) => item.outputChannel))].filter((item: string) => item !== current) + // 2. 修改下拉框内容 + tableDict.value['输出通道'] = OutputChannelAllList.value.filter((item) => { return !selectLoadSituation.includes(item.value) }) +} + const fecthDict = async () => { // 技术指标前符号 const res1 = await getDictByCode('standardTechnicalIndexSymbol') @@ -342,17 +543,26 @@ // 输出通道 const res2 = await getDictByCode('standardOutputChannel') OutputChannelList.value = res2.data + OutputChannelAllList.value = JSON.parse(JSON.stringify(res2.data)) // 单位 const res3 = await getDictByCode('unitElectricalSignalV') unitList.value = res3.data // 调压器输出值 const res4 = await getDictByCode('voltageRegulatorOutputValue') RegulatorOutputValue.value = res4.data + // 最大允许误差公式 + const res5 = await getDictByCode('standardMaximumError') + standardMaximumError.value = res5.data + // 单位 (直接测量/间接测量) + const res6 = await getDictByCode('unitElectricalSignalA') + unitList1.value = res6.data // table字典 tableDict.value = { 输出通道: OutputChannelList.value, 单位: unitList.value, 调压器输出值: RegulatorOutputValue.value, + 负载情况: loadSituationList.value, + 最大允许误差: standardMaximumError.value, } } fecthDict() @@ -360,6 +570,14 @@ const getSymbolName = (value: string) => { return TechnicalIndexSymbolList.value.filter(item => item.value === value)[0].name || '' } +// 获取任意下拉框 +const getAnySelect = (text: string, title: string) => { + if (text === '单位' && title.includes('测量')) { + return unitList1.value + } + return tableDict.value[text] +} +// defineExpose({ list })