diff --git a/src/commonMethods/useArrayDataUnique.ts b/src/commonMethods/useArrayDataUnique.ts index f6ae9d6..b8ff292 100644 --- a/src/commonMethods/useArrayDataUnique.ts +++ b/src/commonMethods/useArrayDataUnique.ts @@ -14,9 +14,11 @@ } else { ElMessage.warning(`表格第${i}与第${j}行的两个属性不能完全一样`) + return false } } } + return true } // export function useArrayDataUnique(list: any, property: string[]) { diff --git a/src/commonMethods/useArrayDataUnique.ts b/src/commonMethods/useArrayDataUnique.ts index f6ae9d6..b8ff292 100644 --- a/src/commonMethods/useArrayDataUnique.ts +++ b/src/commonMethods/useArrayDataUnique.ts @@ -14,9 +14,11 @@ } else { ElMessage.warning(`表格第${i}与第${j}行的两个属性不能完全一样`) + return false } } } + return true } // export function useArrayDataUnique(list: any, property: string[]) { diff --git a/src/views/business/measure/item/components/thirteenth/templateTable.vue b/src/views/business/measure/item/components/thirteenth/templateTable.vue index ca0ce12..7dbaee8 100644 --- a/src/views/business/measure/item/components/thirteenth/templateTable.vue +++ b/src/views/business/measure/item/components/thirteenth/templateTable.vue @@ -437,6 +437,7 @@ > + + ([]) // 方波电压(50Ω) const listSquareWaveVoltage1MΩ = ref([]) // 方波电压(1MΩ) const listDirectVoltage50Ω = ref([]) // 直流电压(50Ω) -const listDirectVoltage1Ω = ref([]) // 直流电压(1MΩ) +const listDirectVoltage1MΩ = ref([]) // 直流电压(1MΩ) const listInputImpedance = ref([]) // 输入阻抗 const listVoltageFlatness = ref([]) // 稳幅正弦信号电压平坦度 const listRisetime = ref([]) // 上升时间 const checkoutTimeMarkList = ref([]) // 时标选中数据 -const checkoutSquareWaveVoltage50ΩList = ref([]) // 方波电压(50Ω) -const checkoutSquareWaveVoltage1MΩList = ref([]) // 方波电压(1MΩ) -const checkoutDirectVoltage50ΩList = ref([]) // 直流电压(50Ω) -const checkoutDirectVoltage1ΩList = ref([]) // 直流电压(1MΩ) -const checkoutInputImpedanceList = ref([]) // 输入阻抗 -const checkoutVoltageFlatnessList = ref([]) // 稳幅正弦信号电压平坦度 -const checkoutRisetimeList = ref([]) // 上升时间 +const checkoutSquareWaveVoltage50ΩList = ref([]) // 方波电压(50Ω)选中 +const checkoutSquareWaveVoltage1MΩList = ref([]) // 方波电压(1MΩ)选中 +const checkoutDirectVoltage50ΩList = ref([]) // 直流电压(50Ω)选中 +const checkoutDirectVoltage1MΩList = ref([]) // 直流电压(1MΩ)选中 +const checkoutInputImpedanceList = ref([]) // 输入阻抗选中 +const checkoutVoltageFlatnessList = ref([]) // 稳幅正弦信号电压平坦度选中 +const checkoutRisetimeList = ref([]) // 上升时间选中 const timeMark = ref(true) // 是否显示时标 const squareWaveVoltage50Ω = ref(true) // 方波电压(50Ω) -const squareWaveVoltage1Ω = ref(true) // 方波电压(1MΩ) +const squareWaveVoltage1MΩ = ref(true) // 方波电压(1MΩ) const directVoltage50Ω = ref(true) // 直流电压(50Ω) -const directVoltage1Ω = ref(true) // 直流电压(1MΩ) +const directVoltage1MΩ = ref(true) // 直流电压(1MΩ) const inputImpedance = ref(true) // 输入阻抗 const voltageFlatness = ref(true) // 稳幅正弦信号电压平坦度 const risetime = ref(true) // 上升时间 @@ -74,27 +76,30 @@ { text: '核查项目', value: 'params', align: 'center', required: true }, { text: '核查点', value: 'checkPoint', align: 'center', required: true }, { text: '核查点单位', value: 'unit', align: 'center', required: true }, - { text: '扩展不确定度U', value: 'resolution', align: 'center', required: true }, - { text: '核查类型', value: 'checkType', align: 'center', required: true }, + { text: '循环次数', value: 'cycleNumber', align: 'center', required: true, width: '90' }, + { text: '核查类型', value: 'checkType', align: 'center', required: true, width: '120' }, + { text: '最大允许误差的绝对值', value: 'maximumErrorAbsolute', align: 'center', required: true, width: '340' }, ]) const columns_voltageFlatness = ref([ // 稳幅正弦信号电压平坦度 { text: '核查项目', value: 'params', align: 'center', required: true }, - { text: '类型', value: 'params', align: 'center', required: true }, - { text: '核查点', value: 'checkPoint', align: 'center', required: true }, - { text: '扩展不确定度U', value: 'unit', align: 'center', required: true }, - { text: '是否为参考点', value: 'resolution', align: 'center', required: true }, - { text: '核查类型', value: 'resolution', align: 'center', required: true }, + { text: '类型', value: 'typeValue', align: 'center', required: true, width: '180' }, + { text: '核查点', value: 'checkPoint', align: 'center', required: true, width: '180' }, + { text: '核查点单位', value: 'unit', align: 'center', required: true, width: '100' }, + { text: '是否为参考点', value: 'referencePoint', align: 'center', required: true, width: '180' }, + { text: '循环次数', value: 'cycleNumber', align: 'center', required: true, width: '90' }, + { text: '核查类型', value: 'checkType', align: 'center', required: true, width: '120' }, + { text: '最大允许误差的绝对值', value: 'maximumErrorAbsolute', align: 'center', required: true, width: '340' }, ]) const columns_risetime = ref([ // 上升时间 - { text: '核查项目', value: 'params', align: 'center', required: true }, - { text: '快沿', value: 'checkPoint', align: 'center', required: true }, - { text: '快沿单位', value: 'unit', align: 'center', required: true }, - { text: '探头编号', value: 'resolution', align: 'center', required: true }, - { text: '探头设备名称', value: 'resolution', align: 'center', required: true }, - { text: '探头规格型号', value: 'cycleNumber', align: 'center', required: true }, - { text: '技术指标', value: 'urel', align: 'center', required: true }, + { text: '核查项目', value: 'params', align: 'center', required: true, width: '90' }, + { text: '快沿', value: 'checkPoint', align: 'center', required: true, width: '180' }, + { text: '快沿单位', value: 'unit', align: 'center', required: true, width: '100' }, + { text: '探头出厂编号', value: 'manufactureNo', align: 'center', required: true, width: '220' }, + { text: '探头设备名称', value: 'equipmentName', align: 'center', required: false }, + { text: '探头规格型号', value: 'model', align: 'center', required: false }, + { text: '技术指标', value: 'technicalIndex', align: 'center', required: true, width: '340' }, ]) // 多选 @@ -113,7 +118,7 @@ checkoutDirectVoltage50ΩList.value = e break case '直流电压(1Ω)': - checkoutDirectVoltage1ΩList.value = e + checkoutDirectVoltage1MΩList.value = e break case '输入阻抗': checkoutInputImpedanceList.value = e @@ -128,8 +133,42 @@ } // 校验表格(点击保存的时候、增加行用) -const checkList = (list: any, title: string) => { - // return useCheckList(list, columns.value, title) +const checkList = (list: any, getTitle: string) => { + let title = '' + if (getTitle.slice(getTitle.length - 2) === '表格') { + title = getTitle.slice(0, getTitle.length - 2) + } + else { + title = getTitle + } + let columns + switch (title) { + case '时标': + columns = columns_timeMark.value + break + case '方波电压(50Ω)': + columns = columns_timeMark.value + break + case '方波电压(1MΩ)': + columns = columns_timeMark.value + break + case '直流电压(50Ω)': + columns = columns_timeMark.value + break + case '直流电压(1MΩ)': + columns = columns_timeMark.value + break + case '输入阻抗': + columns = columns_timeMark.value + break + case '稳幅正弦信号电压平坦度': + columns = columns_voltageFlatness.value + break + case '上升时间': + columns = columns_risetime.value + break + } + return useCheckList(list, columns, `${title}表格`) } /** @@ -138,56 +177,192 @@ * @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 - // }) - // } - // } + if (checkList(list, `${title}表格`)) { + if (list.length) { // 增加行时默认上一行数据 + list.push({ ...list[list.length - 1], referencePoint: 0 }) + } + else { + switch (title) { + case '时标': + list.push({ + id: '', + params: title, // 核查项目 + checkPoint: '', // 核查点 + unit: 's', // 核查点单位 + cycleNumber: 10, // 循环次数 + checkType: '重复性, 稳定性', // 核查类型(直接存字典value,多个逗号分隔) + itemCategoryId: form.value.itemCategoryId, // 核查项分类id(能够确定是哪个标准装置) + remark: '', // 核查项备注 + maximumErrorAbsolute: '', // 最大允许误差的绝对值 + maximumErrorAbsoluteUnit: 's', // 最大允许误差的绝对值单位 + }) + break + case '方波电压(50Ω)': + list.push({ + id: '', + params: title, // 核查项目 + checkPoint: '', // 核查点 + unit: 'mV', // 核查点单位 + cycleNumber: 10, // 循环次数 + checkType: '重复性, 稳定性', // 核查类型(直接存字典value,多个逗号分隔) + itemCategoryId: form.value.itemCategoryId, // 核查项分类id(能够确定是哪个标准装置) + remark: '', // 核查项备注 + maximumErrorAbsolute: '', // 最大允许误差的绝对值 + maximumErrorAbsoluteUnit: 'mV', // 最大允许误差的绝对值单位 + }) + break + case '方波电压(1MΩ)': + list.push({ + id: '', + params: title, // 核查项目 + checkPoint: '', // 核查点 + unit: 'mV', // 核查点单位 + cycleNumber: 10, // 循环次数 + checkType: '重复性, 稳定性', // 核查类型(直接存字典value,多个逗号分隔) + itemCategoryId: form.value.itemCategoryId, // 核查项分类id(能够确定是哪个标准装置) + remark: '', // 核查项备注 + maximumErrorAbsolute: '', // 最大允许误差的绝对值 + maximumErrorAbsoluteUnit: 'mV', // 最大允许误差的绝对值单位 + }) + break + case '直流电压(50Ω)': + list.push({ + id: '', + params: title, // 核查项目 + checkPoint: '', // 核查点 + unit: 'mV', // 核查点单位 + cycleNumber: 10, // 循环次数 + checkType: '重复性, 稳定性', // 核查类型(直接存字典value,多个逗号分隔) + itemCategoryId: form.value.itemCategoryId, // 核查项分类id(能够确定是哪个标准装置) + remark: '', // 核查项备注 + maximumErrorAbsolute: '', // 最大允许误差的绝对值 + maximumErrorAbsoluteUnit: 'mV', // 最大允许误差的绝对值单位 + }) + break + case '直流电压(1MΩ)': + list.push({ + id: '', + params: title, // 核查项目 + checkPoint: '', // 核查点 + unit: 'mV', // 核查点单位 + cycleNumber: 10, // 循环次数 + checkType: '重复性, 稳定性', // 核查类型(直接存字典value,多个逗号分隔) + itemCategoryId: form.value.itemCategoryId, // 核查项分类id(能够确定是哪个标准装置) + remark: '', // 核查项备注 + maximumErrorAbsolute: '', // 最大允许误差的绝对值 + maximumErrorAbsoluteUnit: 'mV', // 最大允许误差的绝对值单位 + }) + break + case '输入阻抗': + list.push({ + id: '', + params: title, // 核查项目 + checkPoint: '', // 核查点 + unit: 'Ω', // 核查点单位 + cycleNumber: 10, // 循环次数 + checkType: '重复性, 稳定性', // 核查类型(直接存字典value,多个逗号分隔) + itemCategoryId: form.value.itemCategoryId, // 核查项分类id(能够确定是哪个标准装置) + remark: '', // 核查项备注 + maximumErrorAbsolute: '', // 最大允许误差的绝对值 + maximumErrorAbsoluteUnit: 'Ω', // 最大允许误差的绝对值单位 + }) + break + case '稳幅正弦信号电压平坦度': + list.push({ + id: '', + params: title, // 核查项目 + typeValue: '5Vp-p', // 类型 + checkPoint: '', // 核查点 + unit: 'kHz', // 核查点单位 + referencePoint: 1, // 是否为参考点 + cycleNumber: 10, // 循环次数 + checkType: '重复性, 稳定性', // 核查类型(直接存字典value,多个逗号分隔) + itemCategoryId: form.value.itemCategoryId, // 核查项分类id(能够确定是哪个标准装置) + remark: '', // 核查项备注 + maximumErrorAbsolute: '', // 最大允许误差的绝对值 + maximumErrorAbsoluteUnit: '%', // 最大允许误差的绝对值单位 + }) + break + case '上升时间': + list.push({ + id: '', + params: title, // 核查项目 + checkPoint: '', // 快沿 + unit: 'ps', // 快沿单位 + manufactureNo: '', // 探头出厂编号 + equipmentName: '', // 探头设备名称 + model: '', // 探头规格型号 + technicalIndex: '', // 技术指标 + technicalIndexSymbol: '≤', // 技术指标前符号 + technicalIndexUnit: 'ps', // 技术指标单位 + itemCategoryId: form.value.itemCategoryId, // 核查项分类id(能够确定是哪个标准装置) + remark: '', // 核查项备注 + }) + break + default: + 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) + switch (title) { + case '时标': + listTimeMark.value = data + break + case '方波电压(50Ω)': + listSquareWaveVoltage50Ω.value = data + break + case '方波电压(1MΩ)': + listSquareWaveVoltage1MΩ.value = data + break + case '直流电压(50Ω)': + listDirectVoltage50Ω.value = data + break + case '直流电压(1MΩ)': + listDirectVoltage1MΩ.value = data + break + case '输入阻抗': + listInputImpedance.value = data + break + case '稳幅正弦信号电压平坦度': + listVoltageFlatness.value = data + break + case '上升时间': + listRisetime.value = data + break + } } } +// 上升时间选好设备 +const confirmSelectedEquipment = (equipmentInfo: any, index: number) => { + listRisetime.value[index].equipmentId = equipmentInfo.equipmentId // 配套设备id + listRisetime.value[index].equipmentName = equipmentInfo.equipmentName // 探头设备名称 + listRisetime.value[index].manufactureNo = equipmentInfo.manufactureNo // 探头出厂编号 + listRisetime.value[index].model = equipmentInfo.model // 探头规格型号 +} + +// 参考点改变 +const selectReferencePoint = (val: number, row: any) => { + +} + +// 类型改变 +const changeSelectTypeValue = (val: number, row: any) => { + console.log(val, row) +} // ---------------------------------------按钮----------------------------------------------------- // 点击关闭 const close = () => { @@ -209,56 +384,178 @@ listSquareWaveVoltage50Ω.value = [] // 方波电压(50Ω) listSquareWaveVoltage1MΩ.value = [] // 方波电压(1MΩ) listDirectVoltage50Ω.value = [] // 直流电压(50Ω) - listDirectVoltage1Ω.value = [] // 直流电压(1MΩ) + listDirectVoltage1MΩ.value = [] // 直流电压(1MΩ) listInputImpedance.value = [] // 输入阻抗 listVoltageFlatness.value = [] // 稳幅正弦信号电压平坦度 listRisetime.value = [] // 上升时间 form.value.remark = '' }) } +// 保存之前校验 +const checkListBeforeSave = () => { + // 验空 + if (timeMark.value && !listTimeMark.value.length) { // 时标 + ElMessage.warning('时标 不能为空') + return false + } + else if (squareWaveVoltage50Ω.value && !listSquareWaveVoltage50Ω.value.length) { // 方波电压(50Ω) + ElMessage.warning('方波电压(50Ω) 不能为空') + return false + } + else if (squareWaveVoltage1MΩ.value && !listSquareWaveVoltage1MΩ.value.length) { // 方波电压(1MΩ) + ElMessage.warning('方波电压(1MΩ) 不能为空') + return false + } + else if (directVoltage50Ω.value && !listDirectVoltage50Ω.value.length) { // 直流电压(50Ω) + ElMessage.warning('直流电压(50Ω) 不能为空') + return false + } + else if (directVoltage1MΩ.value && !listDirectVoltage1MΩ.value.length) { // 直流电压(1MΩ) + ElMessage.warning('直流电压(1MΩ) 不能为空') + return false + } + else if (inputImpedance.value && !listInputImpedance.value.length) { // 输入阻抗 + ElMessage.warning('输入阻抗 不能为空') + return false + } + else if (voltageFlatness.value && !listVoltageFlatness.value.length) { // 稳幅正弦信号电压平坦度 + ElMessage.warning('稳幅正弦信号电压平坦度 不能为空') + return false + } + else if (risetime.value && !listRisetime.value.length) { // 上升时间 + ElMessage.warning('上升时间 不能为空') + return false + } + let timeMarkResult = true // 时标 + let squareWaveVoltage50ΩResult = true // 方波电压(50Ω) + let squareWaveVoltage1MΩResult = true // 方波电压(1MΩ) + let directVoltage50ΩResult = true // 直流电压(50Ω) + let directVoltage1MΩResult = true // 直流电压(1MΩ) + let inputImpedanceResult = true // 输入阻抗 + let voltageFlatnessResult = true // 稳幅正弦信号电压平坦度 + let risetimeResult = true // 上升时间 + if (timeMark.value) { + timeMarkResult = checkList(listTimeMark.value, '时标') + } + else if (squareWaveVoltage50Ω.value) { + squareWaveVoltage50ΩResult = checkList(listSquareWaveVoltage50Ω.value, '方波电压(50Ω)') + } + else if (squareWaveVoltage1MΩ.value) { + squareWaveVoltage1MΩResult = checkList(listSquareWaveVoltage1MΩ.value, '方波电压(1MΩ)') + } + else if (directVoltage50Ω.value) { + directVoltage50ΩResult = checkList(listDirectVoltage50Ω.value, '直流电压(50Ω)') + } + else if (directVoltage1MΩ.value) { + directVoltage1MΩResult = checkList(listDirectVoltage1MΩ.value, '直流电压(1MΩ)') + } + else if (inputImpedance.value) { + inputImpedanceResult = checkList(listInputImpedance.value, '输入阻抗') + } + else if (voltageFlatness.value) { + voltageFlatnessResult = checkList(listVoltageFlatness.value, '稳幅正弦信号电压平坦度') + } + else if (risetime.value) { + risetimeResult = checkList(listRisetime.value, '上升时间') + } + if (timeMarkResult && squareWaveVoltage50ΩResult && squareWaveVoltage1MΩResult && directVoltage50ΩResult && directVoltage1MΩResult && inputImpedanceResult && voltageFlatnessResult && risetimeResult) { + // return true + console.log('---') + } + else { + return false + } + + // console.log(useArrayDataUnique(listTimeMark.value), ['checkPoint', 'unit']); +} + +// 保存之前处理数据 +const solveDataBeforeSave = () => { + // 数据处理 + let tempList = [] as any + if (timeMark.value) { // 时标 + tempList = tempList.concat(listTimeMark.value) + } + if (squareWaveVoltage50Ω.value) { // 方波电压(50Ω) + tempList = tempList.concat(listSquareWaveVoltage50Ω.value) + } + if (squareWaveVoltage1MΩ.value) { // 方波电压(1MΩ) + tempList = tempList.concat(listSquareWaveVoltage1MΩ.value) + } + if (directVoltage50Ω.value) { // 直流电压(50Ω) + tempList = tempList.concat(listDirectVoltage50Ω.value) + } + if (directVoltage1MΩ.value) { // 直流电压(1MΩ) + tempList = tempList.concat(listDirectVoltage1MΩ.value) + } + if (inputImpedance.value) { // 输入阻抗 + tempList = tempList.concat(listInputImpedance.value) + } + if (voltageFlatness.value) { // 稳幅正弦信号电压平坦度 + tempList = tempList.concat(listVoltageFlatness.value) + } + if (risetime.value) { // 上升时间 + tempList = tempList.concat(listRisetime.value) + } + + tempList = tempList.map((item: { id: string }) => { + return { + ...item, + id: '', + remark: form.value.remark, + } + }) + return tempList +} // 点击保存 const save = () => { - // if (!list.value.length) { ElMessage.warning('核查项不能为空'); return false } - // if (!checkList(list.value, '核查项表格')) { return false } - // const params = { - // itemCategoryId: form.value.itemCategoryId, // 核查项分类id - // checkItemDataPistonGaugeList: list.value, - // } - // const loading = ElLoading.service({ - // lock: true, - // text: '加载中', - // background: 'rgba(255, 255, 255, 0.6)', - // }) - // config(params).then((res) => { - // ElMessage.success('已保存') - // pageType.value = 'detail' - // loading.close() - // }) + if (!checkListBeforeSave) { return false } + const list = solveDataBeforeSave() + const params = { + itemCategoryId: form.value.itemCategoryId, // 核查项分类id + checkItemDataOscilloscopeList: list, + equipmentId: equipmentId.value, + } + const loading = ElLoading.service({ + lock: true, + text: '加载中', + background: 'rgba(255, 255, 255, 0.6)', + }) + config(params).then((res) => { + ElMessage.success('已保存') + pageType.value = 'detail' + loading.close() + }) } // 获取详情 const getInfo = () => { - // const loading = ElLoading.service({ - // lock: true, - // text: '加载中', - // background: 'rgba(255, 255, 255, 0.6)', - // }) + const loading = ElLoading.service({ + lock: true, + text: '加载中', + background: 'rgba(255, 255, 255, 0.6)', + }) const params = { equipmentId: equipmentId.value, // 设备id belongStandardEquipment: form.value.belongStandardEquipment, // 检校标准装置code itemCategoryId: form.value.itemCategoryId, // 核查项分类id itemCategoryName: form.value.itemCategoryName, // 核查项分类名称 } - // getCheckItemDetail(params).then((res) => { - // list.value = res.data.checkItemDataPistonGaugeList.map((item: any) => { - // return { - // ...item, - // resolution: Number(item.resolution), - // } - // }) - // loading.close() - // }) + getCheckItemDetail(params).then((res) => { + if (res.data && res.data.checkItemDataOscilloscopeList && res.data.checkItemDataOscilloscopeList.length) { + console.log('0000') + } + listTimeMark.value = res.data.checkItemDataOscilloscopeList.filter((item: { params: string }) => item.params === '时标') + listSquareWaveVoltage50Ω.value = res.data.checkItemDataOscilloscopeList.filter((item: { params: string }) => item.params === '方波电压(50Ω)') + listSquareWaveVoltage1MΩ.value = res.data.checkItemDataOscilloscopeList.filter((item: { params: string }) => item.params === '方波电压(1MΩ)') + listDirectVoltage50Ω.value = res.data.checkItemDataOscilloscopeList.filter((item: { params: string }) => item.params === '直流电压(50Ω)') + listDirectVoltage1MΩ.value = res.data.checkItemDataOscilloscopeList.filter((item: { params: string }) => item.params === '直流电压(1MΩ)') + listInputImpedance.value = res.data.checkItemDataOscilloscopeList.filter((item: { params: string }) => item.params === '输入阻抗') + listVoltageFlatness.value = res.data.checkItemDataOscilloscopeList.filter((item: { params: string }) => item.params === '稳幅正弦信号电压平坦度') + listRisetime.value = res.data.checkItemDataOscilloscopeList.filter((item: { params: string }) => item.params === '上升时间') + loading.close() + }) } // ------------------------------------------钩子-------------------------------------------------- @@ -275,12 +572,12 @@ form.value.belongStandardEquipment = $route.query.belongStandardEquipment as string // 核查项标准装置id form.value.belongStandardEquipmentName = $route.query.belongStandardEquipmentName as string // 核查项标准装置id equipmentId.value = $route.query.equipmentId as string // 设备id - // getInfo() + getInfo() }) - + @@ -381,12 +678,12 @@ 增加行 - + 删除行 - handleSelectionChange(e, '时标')" /> + handleSelectionChange(e, '时标')" /> @@ -399,30 +696,30 @@ 增加行 - + 删除行 - handleSelectionChange(e, '方波电压(50Ω)')" /> + handleSelectionChange(e, '方波电压(50Ω)')" /> - + 方波电压(1MΩ) - + 增加行 - + 删除行 - handleSelectionChange(e, '方波电压(1MΩ)')" /> + handleSelectionChange(e, '方波电压(1MΩ)')" /> @@ -435,30 +732,30 @@ 增加行 - + 删除行 - handleSelectionChange(e, '直流电压(50Ω)')" /> + handleSelectionChange(e, '直流电压(50Ω)')" /> - + - - 直流电压(1Ω) + + 直流电压(1MΩ) - - + + 增加行 - + 删除行 - handleSelectionChange(e, '直流电压(1Ω)')" /> + handleSelectionChange(e, '直流电压(1MΩ)')" /> @@ -471,12 +768,12 @@ 增加行 - + 删除行 - handleSelectionChange(e, '输入阻抗')" /> + handleSelectionChange(e, '输入阻抗')" /> @@ -489,12 +786,21 @@ 增加行 - + 删除行 - handleSelectionChange(e, '稳幅正弦信号电压平坦度')" /> + handleSelectionChange(e, '稳幅正弦信号电压平坦度')" + @selectReferencePoint="selectReferencePoint" + @changeSelectTypeValue="changeSelectTypeValue" + /> @@ -507,12 +813,12 @@ 增加行 - + 删除行 - handleSelectionChange(e, '上升时间')" /> + handleSelectionChange(e, '上升时间')" @confirmSelectedEquipment="confirmSelectedEquipment" /> @@ -540,3 +846,10 @@ + diff --git a/src/commonMethods/useArrayDataUnique.ts b/src/commonMethods/useArrayDataUnique.ts index f6ae9d6..b8ff292 100644 --- a/src/commonMethods/useArrayDataUnique.ts +++ b/src/commonMethods/useArrayDataUnique.ts @@ -14,9 +14,11 @@ } else { ElMessage.warning(`表格第${i}与第${j}行的两个属性不能完全一样`) + return false } } } + return true } // export function useArrayDataUnique(list: any, property: string[]) { diff --git a/src/views/business/measure/item/components/thirteenth/templateTable.vue b/src/views/business/measure/item/components/thirteenth/templateTable.vue index ca0ce12..7dbaee8 100644 --- a/src/views/business/measure/item/components/thirteenth/templateTable.vue +++ b/src/views/business/measure/item/components/thirteenth/templateTable.vue @@ -437,6 +437,7 @@ > + ([]) // 方波电压(50Ω) const listSquareWaveVoltage1MΩ = ref([]) // 方波电压(1MΩ) const listDirectVoltage50Ω = ref([]) // 直流电压(50Ω) -const listDirectVoltage1Ω = ref([]) // 直流电压(1MΩ) +const listDirectVoltage1MΩ = ref([]) // 直流电压(1MΩ) const listInputImpedance = ref([]) // 输入阻抗 const listVoltageFlatness = ref([]) // 稳幅正弦信号电压平坦度 const listRisetime = ref([]) // 上升时间 const checkoutTimeMarkList = ref([]) // 时标选中数据 -const checkoutSquareWaveVoltage50ΩList = ref([]) // 方波电压(50Ω) -const checkoutSquareWaveVoltage1MΩList = ref([]) // 方波电压(1MΩ) -const checkoutDirectVoltage50ΩList = ref([]) // 直流电压(50Ω) -const checkoutDirectVoltage1ΩList = ref([]) // 直流电压(1MΩ) -const checkoutInputImpedanceList = ref([]) // 输入阻抗 -const checkoutVoltageFlatnessList = ref([]) // 稳幅正弦信号电压平坦度 -const checkoutRisetimeList = ref([]) // 上升时间 +const checkoutSquareWaveVoltage50ΩList = ref([]) // 方波电压(50Ω)选中 +const checkoutSquareWaveVoltage1MΩList = ref([]) // 方波电压(1MΩ)选中 +const checkoutDirectVoltage50ΩList = ref([]) // 直流电压(50Ω)选中 +const checkoutDirectVoltage1MΩList = ref([]) // 直流电压(1MΩ)选中 +const checkoutInputImpedanceList = ref([]) // 输入阻抗选中 +const checkoutVoltageFlatnessList = ref([]) // 稳幅正弦信号电压平坦度选中 +const checkoutRisetimeList = ref([]) // 上升时间选中 const timeMark = ref(true) // 是否显示时标 const squareWaveVoltage50Ω = ref(true) // 方波电压(50Ω) -const squareWaveVoltage1Ω = ref(true) // 方波电压(1MΩ) +const squareWaveVoltage1MΩ = ref(true) // 方波电压(1MΩ) const directVoltage50Ω = ref(true) // 直流电压(50Ω) -const directVoltage1Ω = ref(true) // 直流电压(1MΩ) +const directVoltage1MΩ = ref(true) // 直流电压(1MΩ) const inputImpedance = ref(true) // 输入阻抗 const voltageFlatness = ref(true) // 稳幅正弦信号电压平坦度 const risetime = ref(true) // 上升时间 @@ -74,27 +76,30 @@ { text: '核查项目', value: 'params', align: 'center', required: true }, { text: '核查点', value: 'checkPoint', align: 'center', required: true }, { text: '核查点单位', value: 'unit', align: 'center', required: true }, - { text: '扩展不确定度U', value: 'resolution', align: 'center', required: true }, - { text: '核查类型', value: 'checkType', align: 'center', required: true }, + { text: '循环次数', value: 'cycleNumber', align: 'center', required: true, width: '90' }, + { text: '核查类型', value: 'checkType', align: 'center', required: true, width: '120' }, + { text: '最大允许误差的绝对值', value: 'maximumErrorAbsolute', align: 'center', required: true, width: '340' }, ]) const columns_voltageFlatness = ref([ // 稳幅正弦信号电压平坦度 { text: '核查项目', value: 'params', align: 'center', required: true }, - { text: '类型', value: 'params', align: 'center', required: true }, - { text: '核查点', value: 'checkPoint', align: 'center', required: true }, - { text: '扩展不确定度U', value: 'unit', align: 'center', required: true }, - { text: '是否为参考点', value: 'resolution', align: 'center', required: true }, - { text: '核查类型', value: 'resolution', align: 'center', required: true }, + { text: '类型', value: 'typeValue', align: 'center', required: true, width: '180' }, + { text: '核查点', value: 'checkPoint', align: 'center', required: true, width: '180' }, + { text: '核查点单位', value: 'unit', align: 'center', required: true, width: '100' }, + { text: '是否为参考点', value: 'referencePoint', align: 'center', required: true, width: '180' }, + { text: '循环次数', value: 'cycleNumber', align: 'center', required: true, width: '90' }, + { text: '核查类型', value: 'checkType', align: 'center', required: true, width: '120' }, + { text: '最大允许误差的绝对值', value: 'maximumErrorAbsolute', align: 'center', required: true, width: '340' }, ]) const columns_risetime = ref([ // 上升时间 - { text: '核查项目', value: 'params', align: 'center', required: true }, - { text: '快沿', value: 'checkPoint', align: 'center', required: true }, - { text: '快沿单位', value: 'unit', align: 'center', required: true }, - { text: '探头编号', value: 'resolution', align: 'center', required: true }, - { text: '探头设备名称', value: 'resolution', align: 'center', required: true }, - { text: '探头规格型号', value: 'cycleNumber', align: 'center', required: true }, - { text: '技术指标', value: 'urel', align: 'center', required: true }, + { text: '核查项目', value: 'params', align: 'center', required: true, width: '90' }, + { text: '快沿', value: 'checkPoint', align: 'center', required: true, width: '180' }, + { text: '快沿单位', value: 'unit', align: 'center', required: true, width: '100' }, + { text: '探头出厂编号', value: 'manufactureNo', align: 'center', required: true, width: '220' }, + { text: '探头设备名称', value: 'equipmentName', align: 'center', required: false }, + { text: '探头规格型号', value: 'model', align: 'center', required: false }, + { text: '技术指标', value: 'technicalIndex', align: 'center', required: true, width: '340' }, ]) // 多选 @@ -113,7 +118,7 @@ checkoutDirectVoltage50ΩList.value = e break case '直流电压(1Ω)': - checkoutDirectVoltage1ΩList.value = e + checkoutDirectVoltage1MΩList.value = e break case '输入阻抗': checkoutInputImpedanceList.value = e @@ -128,8 +133,42 @@ } // 校验表格(点击保存的时候、增加行用) -const checkList = (list: any, title: string) => { - // return useCheckList(list, columns.value, title) +const checkList = (list: any, getTitle: string) => { + let title = '' + if (getTitle.slice(getTitle.length - 2) === '表格') { + title = getTitle.slice(0, getTitle.length - 2) + } + else { + title = getTitle + } + let columns + switch (title) { + case '时标': + columns = columns_timeMark.value + break + case '方波电压(50Ω)': + columns = columns_timeMark.value + break + case '方波电压(1MΩ)': + columns = columns_timeMark.value + break + case '直流电压(50Ω)': + columns = columns_timeMark.value + break + case '直流电压(1MΩ)': + columns = columns_timeMark.value + break + case '输入阻抗': + columns = columns_timeMark.value + break + case '稳幅正弦信号电压平坦度': + columns = columns_voltageFlatness.value + break + case '上升时间': + columns = columns_risetime.value + break + } + return useCheckList(list, columns, `${title}表格`) } /** @@ -138,56 +177,192 @@ * @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 - // }) - // } - // } + if (checkList(list, `${title}表格`)) { + if (list.length) { // 增加行时默认上一行数据 + list.push({ ...list[list.length - 1], referencePoint: 0 }) + } + else { + switch (title) { + case '时标': + list.push({ + id: '', + params: title, // 核查项目 + checkPoint: '', // 核查点 + unit: 's', // 核查点单位 + cycleNumber: 10, // 循环次数 + checkType: '重复性, 稳定性', // 核查类型(直接存字典value,多个逗号分隔) + itemCategoryId: form.value.itemCategoryId, // 核查项分类id(能够确定是哪个标准装置) + remark: '', // 核查项备注 + maximumErrorAbsolute: '', // 最大允许误差的绝对值 + maximumErrorAbsoluteUnit: 's', // 最大允许误差的绝对值单位 + }) + break + case '方波电压(50Ω)': + list.push({ + id: '', + params: title, // 核查项目 + checkPoint: '', // 核查点 + unit: 'mV', // 核查点单位 + cycleNumber: 10, // 循环次数 + checkType: '重复性, 稳定性', // 核查类型(直接存字典value,多个逗号分隔) + itemCategoryId: form.value.itemCategoryId, // 核查项分类id(能够确定是哪个标准装置) + remark: '', // 核查项备注 + maximumErrorAbsolute: '', // 最大允许误差的绝对值 + maximumErrorAbsoluteUnit: 'mV', // 最大允许误差的绝对值单位 + }) + break + case '方波电压(1MΩ)': + list.push({ + id: '', + params: title, // 核查项目 + checkPoint: '', // 核查点 + unit: 'mV', // 核查点单位 + cycleNumber: 10, // 循环次数 + checkType: '重复性, 稳定性', // 核查类型(直接存字典value,多个逗号分隔) + itemCategoryId: form.value.itemCategoryId, // 核查项分类id(能够确定是哪个标准装置) + remark: '', // 核查项备注 + maximumErrorAbsolute: '', // 最大允许误差的绝对值 + maximumErrorAbsoluteUnit: 'mV', // 最大允许误差的绝对值单位 + }) + break + case '直流电压(50Ω)': + list.push({ + id: '', + params: title, // 核查项目 + checkPoint: '', // 核查点 + unit: 'mV', // 核查点单位 + cycleNumber: 10, // 循环次数 + checkType: '重复性, 稳定性', // 核查类型(直接存字典value,多个逗号分隔) + itemCategoryId: form.value.itemCategoryId, // 核查项分类id(能够确定是哪个标准装置) + remark: '', // 核查项备注 + maximumErrorAbsolute: '', // 最大允许误差的绝对值 + maximumErrorAbsoluteUnit: 'mV', // 最大允许误差的绝对值单位 + }) + break + case '直流电压(1MΩ)': + list.push({ + id: '', + params: title, // 核查项目 + checkPoint: '', // 核查点 + unit: 'mV', // 核查点单位 + cycleNumber: 10, // 循环次数 + checkType: '重复性, 稳定性', // 核查类型(直接存字典value,多个逗号分隔) + itemCategoryId: form.value.itemCategoryId, // 核查项分类id(能够确定是哪个标准装置) + remark: '', // 核查项备注 + maximumErrorAbsolute: '', // 最大允许误差的绝对值 + maximumErrorAbsoluteUnit: 'mV', // 最大允许误差的绝对值单位 + }) + break + case '输入阻抗': + list.push({ + id: '', + params: title, // 核查项目 + checkPoint: '', // 核查点 + unit: 'Ω', // 核查点单位 + cycleNumber: 10, // 循环次数 + checkType: '重复性, 稳定性', // 核查类型(直接存字典value,多个逗号分隔) + itemCategoryId: form.value.itemCategoryId, // 核查项分类id(能够确定是哪个标准装置) + remark: '', // 核查项备注 + maximumErrorAbsolute: '', // 最大允许误差的绝对值 + maximumErrorAbsoluteUnit: 'Ω', // 最大允许误差的绝对值单位 + }) + break + case '稳幅正弦信号电压平坦度': + list.push({ + id: '', + params: title, // 核查项目 + typeValue: '5Vp-p', // 类型 + checkPoint: '', // 核查点 + unit: 'kHz', // 核查点单位 + referencePoint: 1, // 是否为参考点 + cycleNumber: 10, // 循环次数 + checkType: '重复性, 稳定性', // 核查类型(直接存字典value,多个逗号分隔) + itemCategoryId: form.value.itemCategoryId, // 核查项分类id(能够确定是哪个标准装置) + remark: '', // 核查项备注 + maximumErrorAbsolute: '', // 最大允许误差的绝对值 + maximumErrorAbsoluteUnit: '%', // 最大允许误差的绝对值单位 + }) + break + case '上升时间': + list.push({ + id: '', + params: title, // 核查项目 + checkPoint: '', // 快沿 + unit: 'ps', // 快沿单位 + manufactureNo: '', // 探头出厂编号 + equipmentName: '', // 探头设备名称 + model: '', // 探头规格型号 + technicalIndex: '', // 技术指标 + technicalIndexSymbol: '≤', // 技术指标前符号 + technicalIndexUnit: 'ps', // 技术指标单位 + itemCategoryId: form.value.itemCategoryId, // 核查项分类id(能够确定是哪个标准装置) + remark: '', // 核查项备注 + }) + break + default: + 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) + switch (title) { + case '时标': + listTimeMark.value = data + break + case '方波电压(50Ω)': + listSquareWaveVoltage50Ω.value = data + break + case '方波电压(1MΩ)': + listSquareWaveVoltage1MΩ.value = data + break + case '直流电压(50Ω)': + listDirectVoltage50Ω.value = data + break + case '直流电压(1MΩ)': + listDirectVoltage1MΩ.value = data + break + case '输入阻抗': + listInputImpedance.value = data + break + case '稳幅正弦信号电压平坦度': + listVoltageFlatness.value = data + break + case '上升时间': + listRisetime.value = data + break + } } } +// 上升时间选好设备 +const confirmSelectedEquipment = (equipmentInfo: any, index: number) => { + listRisetime.value[index].equipmentId = equipmentInfo.equipmentId // 配套设备id + listRisetime.value[index].equipmentName = equipmentInfo.equipmentName // 探头设备名称 + listRisetime.value[index].manufactureNo = equipmentInfo.manufactureNo // 探头出厂编号 + listRisetime.value[index].model = equipmentInfo.model // 探头规格型号 +} + +// 参考点改变 +const selectReferencePoint = (val: number, row: any) => { + +} + +// 类型改变 +const changeSelectTypeValue = (val: number, row: any) => { + console.log(val, row) +} // ---------------------------------------按钮----------------------------------------------------- // 点击关闭 const close = () => { @@ -209,56 +384,178 @@ listSquareWaveVoltage50Ω.value = [] // 方波电压(50Ω) listSquareWaveVoltage1MΩ.value = [] // 方波电压(1MΩ) listDirectVoltage50Ω.value = [] // 直流电压(50Ω) - listDirectVoltage1Ω.value = [] // 直流电压(1MΩ) + listDirectVoltage1MΩ.value = [] // 直流电压(1MΩ) listInputImpedance.value = [] // 输入阻抗 listVoltageFlatness.value = [] // 稳幅正弦信号电压平坦度 listRisetime.value = [] // 上升时间 form.value.remark = '' }) } +// 保存之前校验 +const checkListBeforeSave = () => { + // 验空 + if (timeMark.value && !listTimeMark.value.length) { // 时标 + ElMessage.warning('时标 不能为空') + return false + } + else if (squareWaveVoltage50Ω.value && !listSquareWaveVoltage50Ω.value.length) { // 方波电压(50Ω) + ElMessage.warning('方波电压(50Ω) 不能为空') + return false + } + else if (squareWaveVoltage1MΩ.value && !listSquareWaveVoltage1MΩ.value.length) { // 方波电压(1MΩ) + ElMessage.warning('方波电压(1MΩ) 不能为空') + return false + } + else if (directVoltage50Ω.value && !listDirectVoltage50Ω.value.length) { // 直流电压(50Ω) + ElMessage.warning('直流电压(50Ω) 不能为空') + return false + } + else if (directVoltage1MΩ.value && !listDirectVoltage1MΩ.value.length) { // 直流电压(1MΩ) + ElMessage.warning('直流电压(1MΩ) 不能为空') + return false + } + else if (inputImpedance.value && !listInputImpedance.value.length) { // 输入阻抗 + ElMessage.warning('输入阻抗 不能为空') + return false + } + else if (voltageFlatness.value && !listVoltageFlatness.value.length) { // 稳幅正弦信号电压平坦度 + ElMessage.warning('稳幅正弦信号电压平坦度 不能为空') + return false + } + else if (risetime.value && !listRisetime.value.length) { // 上升时间 + ElMessage.warning('上升时间 不能为空') + return false + } + let timeMarkResult = true // 时标 + let squareWaveVoltage50ΩResult = true // 方波电压(50Ω) + let squareWaveVoltage1MΩResult = true // 方波电压(1MΩ) + let directVoltage50ΩResult = true // 直流电压(50Ω) + let directVoltage1MΩResult = true // 直流电压(1MΩ) + let inputImpedanceResult = true // 输入阻抗 + let voltageFlatnessResult = true // 稳幅正弦信号电压平坦度 + let risetimeResult = true // 上升时间 + if (timeMark.value) { + timeMarkResult = checkList(listTimeMark.value, '时标') + } + else if (squareWaveVoltage50Ω.value) { + squareWaveVoltage50ΩResult = checkList(listSquareWaveVoltage50Ω.value, '方波电压(50Ω)') + } + else if (squareWaveVoltage1MΩ.value) { + squareWaveVoltage1MΩResult = checkList(listSquareWaveVoltage1MΩ.value, '方波电压(1MΩ)') + } + else if (directVoltage50Ω.value) { + directVoltage50ΩResult = checkList(listDirectVoltage50Ω.value, '直流电压(50Ω)') + } + else if (directVoltage1MΩ.value) { + directVoltage1MΩResult = checkList(listDirectVoltage1MΩ.value, '直流电压(1MΩ)') + } + else if (inputImpedance.value) { + inputImpedanceResult = checkList(listInputImpedance.value, '输入阻抗') + } + else if (voltageFlatness.value) { + voltageFlatnessResult = checkList(listVoltageFlatness.value, '稳幅正弦信号电压平坦度') + } + else if (risetime.value) { + risetimeResult = checkList(listRisetime.value, '上升时间') + } + if (timeMarkResult && squareWaveVoltage50ΩResult && squareWaveVoltage1MΩResult && directVoltage50ΩResult && directVoltage1MΩResult && inputImpedanceResult && voltageFlatnessResult && risetimeResult) { + // return true + console.log('---') + } + else { + return false + } + + // console.log(useArrayDataUnique(listTimeMark.value), ['checkPoint', 'unit']); +} + +// 保存之前处理数据 +const solveDataBeforeSave = () => { + // 数据处理 + let tempList = [] as any + if (timeMark.value) { // 时标 + tempList = tempList.concat(listTimeMark.value) + } + if (squareWaveVoltage50Ω.value) { // 方波电压(50Ω) + tempList = tempList.concat(listSquareWaveVoltage50Ω.value) + } + if (squareWaveVoltage1MΩ.value) { // 方波电压(1MΩ) + tempList = tempList.concat(listSquareWaveVoltage1MΩ.value) + } + if (directVoltage50Ω.value) { // 直流电压(50Ω) + tempList = tempList.concat(listDirectVoltage50Ω.value) + } + if (directVoltage1MΩ.value) { // 直流电压(1MΩ) + tempList = tempList.concat(listDirectVoltage1MΩ.value) + } + if (inputImpedance.value) { // 输入阻抗 + tempList = tempList.concat(listInputImpedance.value) + } + if (voltageFlatness.value) { // 稳幅正弦信号电压平坦度 + tempList = tempList.concat(listVoltageFlatness.value) + } + if (risetime.value) { // 上升时间 + tempList = tempList.concat(listRisetime.value) + } + + tempList = tempList.map((item: { id: string }) => { + return { + ...item, + id: '', + remark: form.value.remark, + } + }) + return tempList +} // 点击保存 const save = () => { - // if (!list.value.length) { ElMessage.warning('核查项不能为空'); return false } - // if (!checkList(list.value, '核查项表格')) { return false } - // const params = { - // itemCategoryId: form.value.itemCategoryId, // 核查项分类id - // checkItemDataPistonGaugeList: list.value, - // } - // const loading = ElLoading.service({ - // lock: true, - // text: '加载中', - // background: 'rgba(255, 255, 255, 0.6)', - // }) - // config(params).then((res) => { - // ElMessage.success('已保存') - // pageType.value = 'detail' - // loading.close() - // }) + if (!checkListBeforeSave) { return false } + const list = solveDataBeforeSave() + const params = { + itemCategoryId: form.value.itemCategoryId, // 核查项分类id + checkItemDataOscilloscopeList: list, + equipmentId: equipmentId.value, + } + const loading = ElLoading.service({ + lock: true, + text: '加载中', + background: 'rgba(255, 255, 255, 0.6)', + }) + config(params).then((res) => { + ElMessage.success('已保存') + pageType.value = 'detail' + loading.close() + }) } // 获取详情 const getInfo = () => { - // const loading = ElLoading.service({ - // lock: true, - // text: '加载中', - // background: 'rgba(255, 255, 255, 0.6)', - // }) + const loading = ElLoading.service({ + lock: true, + text: '加载中', + background: 'rgba(255, 255, 255, 0.6)', + }) const params = { equipmentId: equipmentId.value, // 设备id belongStandardEquipment: form.value.belongStandardEquipment, // 检校标准装置code itemCategoryId: form.value.itemCategoryId, // 核查项分类id itemCategoryName: form.value.itemCategoryName, // 核查项分类名称 } - // getCheckItemDetail(params).then((res) => { - // list.value = res.data.checkItemDataPistonGaugeList.map((item: any) => { - // return { - // ...item, - // resolution: Number(item.resolution), - // } - // }) - // loading.close() - // }) + getCheckItemDetail(params).then((res) => { + if (res.data && res.data.checkItemDataOscilloscopeList && res.data.checkItemDataOscilloscopeList.length) { + console.log('0000') + } + listTimeMark.value = res.data.checkItemDataOscilloscopeList.filter((item: { params: string }) => item.params === '时标') + listSquareWaveVoltage50Ω.value = res.data.checkItemDataOscilloscopeList.filter((item: { params: string }) => item.params === '方波电压(50Ω)') + listSquareWaveVoltage1MΩ.value = res.data.checkItemDataOscilloscopeList.filter((item: { params: string }) => item.params === '方波电压(1MΩ)') + listDirectVoltage50Ω.value = res.data.checkItemDataOscilloscopeList.filter((item: { params: string }) => item.params === '直流电压(50Ω)') + listDirectVoltage1MΩ.value = res.data.checkItemDataOscilloscopeList.filter((item: { params: string }) => item.params === '直流电压(1MΩ)') + listInputImpedance.value = res.data.checkItemDataOscilloscopeList.filter((item: { params: string }) => item.params === '输入阻抗') + listVoltageFlatness.value = res.data.checkItemDataOscilloscopeList.filter((item: { params: string }) => item.params === '稳幅正弦信号电压平坦度') + listRisetime.value = res.data.checkItemDataOscilloscopeList.filter((item: { params: string }) => item.params === '上升时间') + loading.close() + }) } // ------------------------------------------钩子-------------------------------------------------- @@ -275,12 +572,12 @@ form.value.belongStandardEquipment = $route.query.belongStandardEquipment as string // 核查项标准装置id form.value.belongStandardEquipmentName = $route.query.belongStandardEquipmentName as string // 核查项标准装置id equipmentId.value = $route.query.equipmentId as string // 设备id - // getInfo() + getInfo() }) - + @@ -381,12 +678,12 @@ 增加行 - + 删除行 - handleSelectionChange(e, '时标')" /> + handleSelectionChange(e, '时标')" /> @@ -399,30 +696,30 @@ 增加行 - + 删除行 - handleSelectionChange(e, '方波电压(50Ω)')" /> + handleSelectionChange(e, '方波电压(50Ω)')" /> - + 方波电压(1MΩ) - + 增加行 - + 删除行 - handleSelectionChange(e, '方波电压(1MΩ)')" /> + handleSelectionChange(e, '方波电压(1MΩ)')" /> @@ -435,30 +732,30 @@ 增加行 - + 删除行 - handleSelectionChange(e, '直流电压(50Ω)')" /> + handleSelectionChange(e, '直流电压(50Ω)')" /> - + - - 直流电压(1Ω) + + 直流电压(1MΩ) - - + + 增加行 - + 删除行 - handleSelectionChange(e, '直流电压(1Ω)')" /> + handleSelectionChange(e, '直流电压(1MΩ)')" /> @@ -471,12 +768,12 @@ 增加行 - + 删除行 - handleSelectionChange(e, '输入阻抗')" /> + handleSelectionChange(e, '输入阻抗')" /> @@ -489,12 +786,21 @@ 增加行 - + 删除行 - handleSelectionChange(e, '稳幅正弦信号电压平坦度')" /> + handleSelectionChange(e, '稳幅正弦信号电压平坦度')" + @selectReferencePoint="selectReferencePoint" + @changeSelectTypeValue="changeSelectTypeValue" + /> @@ -507,12 +813,12 @@ 增加行 - + 删除行 - handleSelectionChange(e, '上升时间')" /> + handleSelectionChange(e, '上升时间')" @confirmSelectedEquipment="confirmSelectedEquipment" /> @@ -540,3 +846,10 @@ + diff --git a/src/views/equipement/standard/book/components/config/thirteenth/templateTable.vue b/src/views/equipement/standard/book/components/config/thirteenth/templateTable.vue index fff0cf7..fd6e12c 100644 --- a/src/views/equipement/standard/book/components/config/thirteenth/templateTable.vue +++ b/src/views/equipement/standard/book/components/config/thirteenth/templateTable.vue @@ -5,6 +5,7 @@ import type { TableColumn } from '@/components/NormalTable/table_interface' import { getDictByCode } from '@/api/system/dict' import type { dictType } from '@/global' +import SelectEquipmentDialog from '@/views/business/fieldTest/approve/dialog/selectEquipmentDialog.vue' // ------------------定义props、 emit------------------- const props = defineProps({ @@ -38,22 +39,53 @@ type: String, default: 'default', }, // 表格大小,默认,small,mini等,与el-table条件相同 + type: String, // 表格类型 }) -const emit = defineEmits(['change', 'selectionChange', 'rowClick', 'rowDbClick', 'multiSelect', 'filterChange']) +const emit = defineEmits(['change', 'selectionChange', 'rowClick', 'rowDbClick', 'filterChange', 'confirmSelectedEquipment', 'selectReferencePoint', 'changeSelectTypeValue']) // ------------------------------------------字典---------------------------------------------- -const paramsList = ref([]) // 参数 +const checkTypeList = ref([]) // 核查类型 +const typeValueList = ref([]) // 类型 +const standardTimeUnitList = ref([]) // 时间单位 +const standardVoltageList = ref([]) // 电压单位 +const standardResistanceList = ref([]) // 电阻单位公用 +const standardFrequencyUnitList = ref([]) // 频率单位公用 +const standardTechnicalIndexSymbolList = ref([]) // 技术指标规则 /** * 获取字典 */ function getDict() { - // 参数 - getDictByCode('bizFirstStandardParams').then((response) => { - paramsList.value = response.data + // 核查类型 + // getDictByCode('bizFirstStandardCheckType').then((response) => { + // checkTypeList.value = response.data + // }) + // 技术指标规则 + getDictByCode('standardTechnicalIndexSymbol').then((response) => { + standardTechnicalIndexSymbolList.value = response.data + }) + // 类型 + getDictByCode('standard13TypeValue').then((response) => { + typeValueList.value = response.data + }) + // 电压单位--公用/垂直偏转系数(/div)单位 + getDictByCode('standardVoltage').then((response) => { + standardVoltageList.value = response.data + }) + // 时间单位 + getDictByCode('standardTimeUnit').then((response) => { + standardTimeUnitList.value = response.data + }) + // 电阻单位公用 + getDictByCode('standardResistance').then((response) => { + standardResistanceList.value = response.data + }) + // 频率单位公用 + getDictByCode('standardFrequencyUnit').then((response) => { + standardFrequencyUnitList.value = response.data }) } -// getDict() +getDict() // -------定义数据-------------- interface columnsCheckInfo { text: string @@ -86,10 +118,6 @@ emit('change') } -// 多选选中结果 -function selectionChange(selection: []) { - emit('selectionChange', selection) -} // 点击行 function rowClick(row: object, column?: any, event?: any) { emit('rowClick', row) @@ -105,7 +133,7 @@ }) // 多选 const handleSelectionChange = (val: any) => { - emit('multiSelect', val) + emit('selectionChange', val) } // 清除多选选中 const clearMulti = () => { @@ -113,6 +141,37 @@ table.value!.clearSelection() singleChecked.value = '' } + +// --------------------------------选择设备------------------------------------------- +const selectEquipmentDialogRef = ref() // 选择设备组件ref +const selectIndex = ref() +// 添加 +const selectEquipment = (index: number) => { + selectEquipmentDialogRef.value.initDialog() + selectIndex.value = index +} + +// 确定选择设备 +const confirmSelectEquipment = (list: any) => { + if (list && list.length) { + const equipmentInfo = { + equipmentId: list[0].equipmentId, // 配套设备id + equipmentName: list[0].equipmentName, // 探头设备名称 + manufactureNo: list[0].manufactureNo, // 探头出厂编号 + model: list[0].model, // 探头规格型号 + } + emit('confirmSelectedEquipment', equipmentInfo, selectIndex.value) + } +} + +// -------------------------------------参考点相关-------------------------------------------- +const selectReferencePoint = (val: number, row: any) => { + emit('selectReferencePoint', val, row) +} +const changeSelectTypeValue = (val: string, row: any) => { + emit('changeSelectTypeValue', val, row) +} +// -------------------------------------------------------------------------------------- defineExpose({ clearMulti, initColumnsState, }) @@ -149,8 +208,243 @@ *{{ item.text }} + + + + + + + + + + + + + + + + + + + + + + + + {{ scope.row.maximumErrorAbsoluteUnit }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + changeSelectTypeValue(val, scope.row)"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + selectReferencePoint(val, scope.row)"> + + 是 + + + 否 + + + + + + + + + 选择 + + + + + + diff --git a/src/views/equipement/standard/book/components/config/thirteenth/templateTable.vue b/src/views/equipement/standard/book/components/config/thirteenth/templateTable.vue index fff0cf7..fd6e12c 100644 --- a/src/views/equipement/standard/book/components/config/thirteenth/templateTable.vue +++ b/src/views/equipement/standard/book/components/config/thirteenth/templateTable.vue @@ -5,6 +5,7 @@ import type { TableColumn } from '@/components/NormalTable/table_interface' import { getDictByCode } from '@/api/system/dict' import type { dictType } from '@/global' +import SelectEquipmentDialog from '@/views/business/fieldTest/approve/dialog/selectEquipmentDialog.vue' // ------------------定义props、 emit------------------- const props = defineProps({ @@ -38,22 +39,53 @@ type: String, default: 'default', }, // 表格大小,默认,small,mini等,与el-table条件相同 + type: String, // 表格类型 }) -const emit = defineEmits(['change', 'selectionChange', 'rowClick', 'rowDbClick', 'multiSelect', 'filterChange']) +const emit = defineEmits(['change', 'selectionChange', 'rowClick', 'rowDbClick', 'filterChange', 'confirmSelectedEquipment', 'selectReferencePoint', 'changeSelectTypeValue']) // ------------------------------------------字典---------------------------------------------- -const paramsList = ref([]) // 参数 +const checkTypeList = ref([]) // 核查类型 +const typeValueList = ref([]) // 类型 +const standardTimeUnitList = ref([]) // 时间单位 +const standardVoltageList = ref([]) // 电压单位 +const standardResistanceList = ref([]) // 电阻单位公用 +const standardFrequencyUnitList = ref([]) // 频率单位公用 +const standardTechnicalIndexSymbolList = ref([]) // 技术指标规则 /** * 获取字典 */ function getDict() { - // 参数 - getDictByCode('bizFirstStandardParams').then((response) => { - paramsList.value = response.data + // 核查类型 + // getDictByCode('bizFirstStandardCheckType').then((response) => { + // checkTypeList.value = response.data + // }) + // 技术指标规则 + getDictByCode('standardTechnicalIndexSymbol').then((response) => { + standardTechnicalIndexSymbolList.value = response.data + }) + // 类型 + getDictByCode('standard13TypeValue').then((response) => { + typeValueList.value = response.data + }) + // 电压单位--公用/垂直偏转系数(/div)单位 + getDictByCode('standardVoltage').then((response) => { + standardVoltageList.value = response.data + }) + // 时间单位 + getDictByCode('standardTimeUnit').then((response) => { + standardTimeUnitList.value = response.data + }) + // 电阻单位公用 + getDictByCode('standardResistance').then((response) => { + standardResistanceList.value = response.data + }) + // 频率单位公用 + getDictByCode('standardFrequencyUnit').then((response) => { + standardFrequencyUnitList.value = response.data }) } -// getDict() +getDict() // -------定义数据-------------- interface columnsCheckInfo { text: string @@ -86,10 +118,6 @@ emit('change') } -// 多选选中结果 -function selectionChange(selection: []) { - emit('selectionChange', selection) -} // 点击行 function rowClick(row: object, column?: any, event?: any) { emit('rowClick', row) @@ -105,7 +133,7 @@ }) // 多选 const handleSelectionChange = (val: any) => { - emit('multiSelect', val) + emit('selectionChange', val) } // 清除多选选中 const clearMulti = () => { @@ -113,6 +141,37 @@ table.value!.clearSelection() singleChecked.value = '' } + +// --------------------------------选择设备------------------------------------------- +const selectEquipmentDialogRef = ref() // 选择设备组件ref +const selectIndex = ref() +// 添加 +const selectEquipment = (index: number) => { + selectEquipmentDialogRef.value.initDialog() + selectIndex.value = index +} + +// 确定选择设备 +const confirmSelectEquipment = (list: any) => { + if (list && list.length) { + const equipmentInfo = { + equipmentId: list[0].equipmentId, // 配套设备id + equipmentName: list[0].equipmentName, // 探头设备名称 + manufactureNo: list[0].manufactureNo, // 探头出厂编号 + model: list[0].model, // 探头规格型号 + } + emit('confirmSelectedEquipment', equipmentInfo, selectIndex.value) + } +} + +// -------------------------------------参考点相关-------------------------------------------- +const selectReferencePoint = (val: number, row: any) => { + emit('selectReferencePoint', val, row) +} +const changeSelectTypeValue = (val: string, row: any) => { + emit('changeSelectTypeValue', val, row) +} +// -------------------------------------------------------------------------------------- defineExpose({ clearMulti, initColumnsState, }) @@ -149,8 +208,243 @@ *{{ item.text }} + + + + + + + + + + + + + + + + + + + + + + + + {{ scope.row.maximumErrorAbsoluteUnit }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + changeSelectTypeValue(val, scope.row)"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + selectReferencePoint(val, scope.row)"> + + 是 + + + 否 + + + + + + + + + 选择 + + + + + +