<!-- 第2套:直流稳压电源标准装置 --> <script lang="ts" setup name="TemplateDetailSecond"> import { ElMessage } from 'element-plus' import type { IList } from './templateDetail-interface' import templateTable from './templateTable.vue' import type { dictType } from '@/global' import { getDictByCode } from '@/api/system/dict' import { calc } from '@/utils/useCalc' import { useCheckList } from '@/commonMethods/useCheckList' import { calculate, recalculate } from '@/api/business/measure/caculate' import type { TableColumn } from '@/components/NormalTable/table_interface' const props = defineProps({ pageType: { type: String, default: 'add', }, itemCategoryName: { type: String, require: true, }, // 设备检定项分类名称 belongStandardEquipment: { // 检校标准装置code type: String, require: true, }, list: { type: Array as any, }, form: { // 检定项表单 type: Object as any, }, itemId: { // 检定项id type: String, default: '', }, }) const typeList = [{ value: '1', name: '数字式', }, { value: '2', name: '指针式', }] const form = ref({ voltageRepresentationValueErrorType: '1', // 电压表示值误差类型:1数字式、2指针式 ammeterDirectType: '1', // 电流表示值误差(直接测量)类型:1数字式、2指针式 ammeterIndirectType: '1', // 电流表示值误差(间接测量)类型:1数字式、2指针式 }) const tableLoading = ref(false) const lineVoltageRegulationList = ref<IList[]>([]) // 电源电压调整率 const loadRegulationList = ref<IList[]>([]) // 负载调整率 const voltageRepresentationValueErrorList = ref<IList[]>([]) // 电压表示值误差 const ammeterDirectList = ref<IList[]>([]) // 电流表示值误差(直接测量) const ammeterIndirectList = ref<IList[]>([]) // 电流表示值误差(间接测量) const rippleVoltageList = ref<IList[]>([]) // 纹波电压 const outputVoltageStabilityList = ref<IList[]>([]) // 输出电压短期稳定性 const lineVoltageRegulationCheckoutList = ref<IList[]>([]) // 电源电压调整率多选 const loadRegulationCheckoutList = ref<IList[]>([]) // 负载调整率多选 const voltageRepresentationValueErrorCheckoutList = ref<IList[]>([]) // 电压表示值误差多选 const ammeterDirectCheckoutList = ref<IList[]>([]) // 电流表示值误差(直接测量)多选 const ammeterIndirectCheckoutList = ref<IList[]>([]) // 电流表示值误差(间接测量)多选 const rippleVoltageCheckoutList = ref<IList[]>([]) // 纹波电压多选 const outputVoltageStabilityCheckoutList = ref<IList[]>([]) // 输出电压短期稳定性多选 // ----------------------------------------表头------------------------------------------------ const columns_line_voltage_regulation = ref<TableColumn[]>([ // 电源电压调整率 { 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 }, ]) const columns_load_regulation = ref<TableColumn[]>([ // 负载调整率 { 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 }, ]) // 电压表示值误差(数字式)、电流表示值误差(直接测量)--(数字式) const columns_voltage_representation_value_error_number = ref<TableColumn[]>([ { 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 }, ]) // 电压表示值误差(数字式) 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<TableColumn[]>([ { 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 }, ]) // 电流表示值误差(间接测量)--数字式 const columns_ammeter_indirect_number = ref<TableColumn[]>([ { 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 }, ]) // 电流表示值误差(间接测量) const columns_ammeter_indirect = ref(columns_ammeter_indirect_number.value) // 电流表示值误差(间接测量)--指针式 const columns_ammeter_indirect_pointer = ref<TableColumn[]>([ { 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 }, ]) // 纹波电压 const columns_ripple_voltage = ref<TableColumn[]>([ { 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 }, ]) // 输出电压短期稳定性 const columns_output_voltage_stability = ref<TableColumn[]>([ { 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 }, ]) // --------------------------------表格操作--------------------------------------------------- // 多选 const handleSelectionChange = (e: any, type: string) => { switch (type) { case '电源电压调整率': // 电源电压调整率 lineVoltageRegulationCheckoutList.value = e break case '负载调整率': // 负载调整率 loadRegulationCheckoutList.value = e break case '电压表示值误差': // 电压表示值误差 voltageRepresentationValueErrorCheckoutList.value = e break case '电流表示值误差(直接测量)': // 电流表示值误差(直接测量) ammeterDirectCheckoutList.value = e break case '电流表示值误差(间接测量)': // 电流表示值误差(间接测量) ammeterIndirectCheckoutList.value = e break case '纹波电压': // 纹波电压 rippleVoltageCheckoutList.value = e break case '输出电压短期稳定性': // 输出电压短期稳定性 outputVoltageStabilityCheckoutList.value = e break } } /** * 增加行公共方法 * @param list 要操作的数组 * @param title 操作的表格 */ const addRow = (list: IList[], title: string) => { // if (checkList(list, `${title}表格`)) { // 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 // }) // } // } } /** * 删除行公共方法 * @param checkoutList 选中的数组 * @param list 操作的数组 */ const delRow = (checkoutList: IList[], list: IList[]) => { if (!checkoutList.length) { ElMessage.warning('请选中要删除的行') } else { list = list.filter((item: any) => { return !checkoutList.includes(item) }) } } // ---------------------------------------------校验--------------------------------------------------- // 校验表格(点击保存的时候用、生成标准器示值) const checkList = () => { // return useCheckList(list.value, columns.value, '检定项表格') } // ------------------------------------------------------------------------------------------------ // 点击计算结果--上方表格计算 const calculateDataTop = () => { } // 点击生成辅助接地电阻--下面表格计算 const calculateDataBottom = () => { } // ----------------------------------------------------------------------------------------------------- // watch(() => props.list, (newVal) => { // 检定项表格 // if (newVal) { // list.value = [...newVal] // } // }) // 电压表示值误差、监听电流表示值误差(直接测量) watch(() => [form.value.voltageRepresentationValueErrorType, form.value.ammeterDirectType], (newValue) => { switch (newValue[0]) { // 电压表示值误差 case '2': // 指针式 columns_voltage_representation.value = columns_voltage_representation_value_error_pointer.value break default:// 数字式 columns_voltage_representation.value = columns_voltage_representation_value_error_number.value } switch (newValue[1]) { // 监听电流表示值误差(直接测量) case '2': // 指针式 columns_ammeter_direct.value = columns_voltage_representation_value_error_pointer.value break default:// 数字式 columns_ammeter_direct.value = columns_voltage_representation_value_error_number.value } }) // 监听电流表示值误差(间接测量) watch(() => form.value.ammeterIndirectType, (newValue) => { if (newValue === '2') { // 指针式 columns_ammeter_indirect.value = columns_ammeter_indirect_pointer.value } else { // 数字式 columns_ammeter_indirect.value = columns_ammeter_indirect_number.value } }) // defineExpose({ list }) </script> <template> <div style="padding: 0 10px;"> <el-checkbox v-model="form.appearance" :checked="true" :disabled="pageType === 'detail'"> 外观及功能性检查 </el-checkbox> </div> <!-- 电源电压调整率 --> <detail-block title=""> <div style="display: flex;justify-content: space-between;"> <el-checkbox v-model="form.plxs" :checked="true" :disabled="pageType === 'detail'"> 电源电压调整率 </el-checkbox> <div v-if="pageType !== 'detail'" style="padding: 0 10px;padding-bottom: 10px;"> <el-button type="primary" @click="addRow(lineVoltageRegulationList, '电源电压调整率')"> 增加行 </el-button> <el-button type="info" @click="delRow(lineVoltageRegulationCheckoutList, lineVoltageRegulationList)"> 删除行 </el-button> </div> </div> <template-table :data="lineVoltageRegulationList" :columns="columns_line_voltage_regulation" :page-type="pageType" @selection-change="(e) => handleSelectionChange(e, '电源电压调整率')" /> </detail-block> <!-- 负载调整率 --> <detail-block title=""> <div style="display: flex;justify-content: space-between;"> <el-checkbox v-model="form.spkd" :checked="true" :disabled="pageType === 'detail'"> 负载调整率 </el-checkbox> <div v-if="pageType !== 'detail'" style="padding: 0 10px;padding-bottom: 10px;"> <el-button type="primary" @click="addRow(loadRegulationList, '负载调整率')"> 增加行 </el-button> <el-button type="info" @click="delRow(loadRegulationCheckoutList, loadRegulationList)"> 删除行 </el-button> </div> </div> <template-table :data="loadRegulationList" :columns="columns_load_regulation" :page-type="pageType" @selection-change="(e) => handleSelectionChange(e, '负载调整率')" /> </detail-block> <!-- 电压表示值误差 --> <detail-block title=""> <div style="display: flex;justify-content: space-between;"> <el-checkbox v-model="form.zpdk" :checked="true" :disabled="pageType === 'detail'"> 电压表示值误差 </el-checkbox> <div v-if="pageType !== 'detail'" style="display: flex;padding: 0 10px;padding-bottom: 10px;"> <!-- 选择类型:1数字式、2指针式 --> <el-select v-model="form.voltageRepresentationValueErrorType" placeholder="请选择" :disabled="pageType === 'detail'" class="full-width-input" style="margin-right: 10px;" > <el-option v-for="item of typeList" :key="item.value" :label="item.name" :value="item.value" /> </el-select> <el-button type="primary" @click="addRow(voltageRepresentationValueErrorList, '电压表示值误差')"> 增加行 </el-button> <el-button type="info" @click="delRow(voltageRepresentationValueErrorCheckoutList, voltageRepresentationValueErrorList)"> 删除行 </el-button> </div> </div> <template-table :data="voltageRepresentationValueErrorList" :columns="columns_voltage_representation" :page-type="pageType" @selection-change="(e) => handleSelectionChange(e, '电压表示值误差')" /> </detail-block> <!-- 电流表示值误差(直接测量) --> <detail-block title=""> <div style="display: flex;justify-content: space-between;"> <el-checkbox v-model="form.zpdk" :checked="true" :disabled="pageType === 'detail'"> 电流表示值误差(直接测量) </el-checkbox> <div v-if="pageType !== 'detail'" style="display: flex;padding: 0 10px;padding-bottom: 10px;"> <!-- 选择类型:1数字式、2指针式 --> <el-select v-model="form.ammeterDirectType" placeholder="请选择" :disabled="pageType === 'detail'" class="full-width-input" style="margin-right: 10px;" > <el-option v-for="item of typeList" :key="item.value" :label="item.name" :value="item.value" /> </el-select> <el-button type="primary" @click="addRow(ammeterDirectList, '电流表示值误差(直接测量)')"> 增加行 </el-button> <el-button type="info" @click="delRow(ammeterDirectCheckoutList, ammeterDirectList)"> 删除行 </el-button> </div> </div> <template-table :data="ammeterDirectList" :columns="columns_ammeter_direct" :page-type="pageType" @selection-change="(e) => handleSelectionChange(e, '电流表示值误差(直接测量)')" /> </detail-block> <!-- 电流表示值误差(间接测量) --> <detail-block title=""> <div style="display: flex;justify-content: space-between;"> <el-checkbox v-model="form.zpdk" :checked="true" :disabled="pageType === 'detail'"> 电流表示值误差(间接测量) </el-checkbox> <div v-if="pageType !== 'detail'" style="display: flex;padding: 0 10px;padding-bottom: 10px;"> <!-- 选择类型:1数字式、2指针式 --> <el-select v-model="form.ammeterIndirectType" placeholder="请选择" :disabled="pageType === 'detail'" class="full-width-input" style="margin-right: 10px;" > <el-option v-for="item of typeList" :key="item.value" :label="item.name" :value="item.value" /> </el-select> <el-button type="primary" @click="addRow(ammeterIndirectList, '电流表示值误差(间接测量)')"> 增加行 </el-button> <el-button type="info" @click="delRow(ammeterIndirectCheckoutList, ammeterIndirectList)"> 删除行 </el-button> </div> </div> <template-table :data="ammeterIndirectList" :columns="columns_ammeter_indirect" :page-type="pageType" @selection-change="(e) => handleSelectionChange(e, '电流表示值误差(间接测量)')" /> </detail-block> <!-- 纹波电压 --> <detail-block title=""> <div style="display: flex;justify-content: space-between;"> <el-checkbox v-model="form.zpdkzhpc" :checked="true" :disabled="pageType === 'detail'"> 纹波电压 </el-checkbox> <div v-if="pageType !== 'detail'" style="padding: 0 10px;padding-bottom: 10px;"> <el-button type="primary" @click="addRow(rippleVoltageList, '纹波电压')"> 增加行 </el-button> <el-button type="info" @click="delRow(rippleVoltageCheckoutList, rippleVoltageList)"> 删除行 </el-button> </div> </div> <template-table :data="rippleVoltageList" :columns="columns_ripple_voltage" :page-type="pageType" @selection-change="(e) => handleSelectionChange(e, '纹波电压')" /> </detail-block> <!-- 输出电压短期稳定性 --> <detail-block title=""> <div style="display: flex;justify-content: space-between;"> <el-checkbox v-model="form.ckdp" :checked="true" :disabled="pageType === 'detail'"> 参考电平 </el-checkbox> <div v-if="pageType !== 'detail'" style="padding: 0 10px;padding-bottom: 10px;"> <el-button type="primary" @click="addRow(outputVoltageStabilityList, '输出电压短期稳定性')"> 增加行 </el-button> <el-button type="info" @click="delRow(outputVoltageStabilityCheckoutList, outputVoltageStabilityList)"> 删除行 </el-button> </div> </div> <template-table :data="outputVoltageStabilityList" :columns="columns_output_voltage_stability" :page-type="pageType" @selection-change="(e) => handleSelectionChange(e, '输出电压短期稳定性')" /> </detail-block> </template>