diff --git a/src/api/system/dict.ts b/src/api/system/dict.ts index 49749b1..ddd6ebc 100644 --- a/src/api/system/dict.ts +++ b/src/api/system/dict.ts @@ -7,6 +7,13 @@ params, }) } +export function getDictAllList(params: object) { + return request({ + url: 'sys/dict/list', + method: 'get', + params, + }) +} // 添加字典 export function addDict(data: object) { return request({ diff --git a/src/api/system/dict.ts b/src/api/system/dict.ts index 49749b1..ddd6ebc 100644 --- a/src/api/system/dict.ts +++ b/src/api/system/dict.ts @@ -7,6 +7,13 @@ params, }) } +export function getDictAllList(params: object) { + return request({ + url: 'sys/dict/list', + method: 'get', + params, + }) +} // 添加字典 export function addDict(data: object) { return request({ diff --git a/src/components.d.ts b/src/components.d.ts index 3e6e918..d03a8d7 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -64,6 +64,7 @@ SearchArea: typeof import('./components/SearchArea/index.vue')['default'] SearchBar: typeof import('./components/SearchBar/index.vue')['default'] SearchItem: typeof import('./components/SearchArea/SearchItem.vue')['default'] + SelectByDict: typeof import('./components/SelectByDict/index.vue')['default'] SelectDeptDialog: typeof import('./components/dialog/selectDeptDialog.vue')['default'] SelectEmployeesDialog: typeof import('./components/dialog/selectEmployeesDialog.vue')['default'] SelectRoleDialog: typeof import('./components/dialog/selectRoleDialog.vue')['default'] diff --git a/src/api/system/dict.ts b/src/api/system/dict.ts index 49749b1..ddd6ebc 100644 --- a/src/api/system/dict.ts +++ b/src/api/system/dict.ts @@ -7,6 +7,13 @@ params, }) } +export function getDictAllList(params: object) { + return request({ + url: 'sys/dict/list', + method: 'get', + params, + }) +} // 添加字典 export function addDict(data: object) { return request({ diff --git a/src/components.d.ts b/src/components.d.ts index 3e6e918..d03a8d7 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -64,6 +64,7 @@ SearchArea: typeof import('./components/SearchArea/index.vue')['default'] SearchBar: typeof import('./components/SearchBar/index.vue')['default'] SearchItem: typeof import('./components/SearchArea/SearchItem.vue')['default'] + SelectByDict: typeof import('./components/SelectByDict/index.vue')['default'] SelectDeptDialog: typeof import('./components/dialog/selectDeptDialog.vue')['default'] SelectEmployeesDialog: typeof import('./components/dialog/selectEmployeesDialog.vue')['default'] SelectRoleDialog: typeof import('./components/dialog/selectRoleDialog.vue')['default'] diff --git a/src/components/SelectByDict/index.vue b/src/components/SelectByDict/index.vue new file mode 100644 index 0000000..9302e9c --- /dev/null +++ b/src/components/SelectByDict/index.vue @@ -0,0 +1,169 @@ + + + + + + diff --git a/src/api/system/dict.ts b/src/api/system/dict.ts index 49749b1..ddd6ebc 100644 --- a/src/api/system/dict.ts +++ b/src/api/system/dict.ts @@ -7,6 +7,13 @@ params, }) } +export function getDictAllList(params: object) { + return request({ + url: 'sys/dict/list', + method: 'get', + params, + }) +} // 添加字典 export function addDict(data: object) { return request({ diff --git a/src/components.d.ts b/src/components.d.ts index 3e6e918..d03a8d7 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -64,6 +64,7 @@ SearchArea: typeof import('./components/SearchArea/index.vue')['default'] SearchBar: typeof import('./components/SearchBar/index.vue')['default'] SearchItem: typeof import('./components/SearchArea/SearchItem.vue')['default'] + SelectByDict: typeof import('./components/SelectByDict/index.vue')['default'] SelectDeptDialog: typeof import('./components/dialog/selectDeptDialog.vue')['default'] SelectEmployeesDialog: typeof import('./components/dialog/selectEmployeesDialog.vue')['default'] SelectRoleDialog: typeof import('./components/dialog/selectRoleDialog.vue')['default'] diff --git a/src/components/SelectByDict/index.vue b/src/components/SelectByDict/index.vue new file mode 100644 index 0000000..9302e9c --- /dev/null +++ b/src/components/SelectByDict/index.vue @@ -0,0 +1,169 @@ + + + + + + diff --git a/src/utils/Array.ts b/src/utils/Array.ts index 74d9300..b632e21 100644 --- a/src/utils/Array.ts +++ b/src/utils/Array.ts @@ -37,7 +37,7 @@ * @param current 当前数据 可为空 * @param attribute 属性(即绑定在 list1哪个属性上) */ -export const setSelectList = (list: any[], list1: any[], current: string, attribute: string) => { +export const setSelectList = (list: any[], list1: any[], current: string, attribute: string, attribute2 = 'value') => { const select = [...new Set(list1.map((item: any) => item[attribute]))].filter((item: string) => item !== current) - return list.filter((item) => { return !select.includes(item.value) }) + return list.filter((item) => { return !select.includes(item[attribute2]) }) } diff --git a/src/api/system/dict.ts b/src/api/system/dict.ts index 49749b1..ddd6ebc 100644 --- a/src/api/system/dict.ts +++ b/src/api/system/dict.ts @@ -7,6 +7,13 @@ params, }) } +export function getDictAllList(params: object) { + return request({ + url: 'sys/dict/list', + method: 'get', + params, + }) +} // 添加字典 export function addDict(data: object) { return request({ diff --git a/src/components.d.ts b/src/components.d.ts index 3e6e918..d03a8d7 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -64,6 +64,7 @@ SearchArea: typeof import('./components/SearchArea/index.vue')['default'] SearchBar: typeof import('./components/SearchBar/index.vue')['default'] SearchItem: typeof import('./components/SearchArea/SearchItem.vue')['default'] + SelectByDict: typeof import('./components/SelectByDict/index.vue')['default'] SelectDeptDialog: typeof import('./components/dialog/selectDeptDialog.vue')['default'] SelectEmployeesDialog: typeof import('./components/dialog/selectEmployeesDialog.vue')['default'] SelectRoleDialog: typeof import('./components/dialog/selectRoleDialog.vue')['default'] diff --git a/src/components/SelectByDict/index.vue b/src/components/SelectByDict/index.vue new file mode 100644 index 0000000..9302e9c --- /dev/null +++ b/src/components/SelectByDict/index.vue @@ -0,0 +1,169 @@ + + + + + + diff --git a/src/utils/Array.ts b/src/utils/Array.ts index 74d9300..b632e21 100644 --- a/src/utils/Array.ts +++ b/src/utils/Array.ts @@ -37,7 +37,7 @@ * @param current 当前数据 可为空 * @param attribute 属性(即绑定在 list1哪个属性上) */ -export const setSelectList = (list: any[], list1: any[], current: string, attribute: string) => { +export const setSelectList = (list: any[], list1: any[], current: string, attribute: string, attribute2 = 'value') => { const select = [...new Set(list1.map((item: any) => item[attribute]))].filter((item: string) => item !== current) - return list.filter((item) => { return !select.includes(item.value) }) + return list.filter((item) => { return !select.includes(item[attribute2]) }) } diff --git a/src/views/business/measure/item/components/second/templateDetail.vue b/src/views/business/measure/item/components/second/templateDetail.vue index 140815d..64ba38d 100644 --- a/src/views/business/measure/item/components/second/templateDetail.vue +++ b/src/views/business/measure/item/components/second/templateDetail.vue @@ -111,7 +111,7 @@ // ----------------------------------------表头------------------------------------------------ const columns_line_voltage_regulation = ref([ // 电源电压调整率 { text: '检定项目', value: 'params', align: 'center', required: true, type: 'text' }, - { text: '输出通道', value: 'outputChannel', align: 'center', required: true, type: 'select' }, + { text: '输出通道', value: 'outputChannel', align: 'center', required: true, type: 'select-dict', code: 'test-dict' }, { text: '单位', value: 'unit', align: 'center', required: true, type: 'select' }, { text: '调压器输出值', value: 'voltageRegulatorOutputValue', align: 'center', required: true, type: 'select' }, { text: '被检电源技术指标', value: 'technicalIndex', align: 'center', required: true, type: 'input' }, @@ -281,7 +281,7 @@ editable: true, } for (let i = 1; i < 3; i++) { - loadRegulationList.value.push({ ...data, loadSituation: i.toString() }) + loadRegulationList.value.push({ ...data, loadSituation: i === 1 ? '满载' : '空载' }) } break case '电压表示值误差': // 电压表示值误差 @@ -324,7 +324,7 @@ technicalIndexSymbol: form.value.technicalIndexSymbol, // 技术指标前符号 unit: '', // 单位 measureIndicationValue: '', // 被检表示值 - maximumError: '1', // 最大允许误差 + maximumError: '', // 最大允许误差 resolution: '0.0001', // 分辨力 editable: true, } @@ -580,8 +580,8 @@ }) // 监听 输出通道 修改下拉框内容 -const changeLoadSituationa = (value: any, index: number, title: string, type: string, list: IList[], item: string) => { - if (title !== '输出通道') { return } +const changeLoadSituationa = (value: any, index: number, text: string, type: string, list: IList[], item: string) => { + if (text !== '输出通道') { return } if (type === 'change' && item === '负载调整率') { // 1.判断奇偶修改对应的 输出通道 if (Number(index) % 2 === 0) { @@ -592,7 +592,7 @@ } } // 2.限制下拉框内容 - setLoadSituation(typeof value === 'string' ? value : list[index].outputChannel as string, list) + setLoadSituation(typeof value === 'string' ? value : list[index].outputChannel as string, list, item) } // 表格下拉框等内容是否禁用 const disabled = ({ scope, column }, fun) => { @@ -635,12 +635,12 @@ // 每个table对应的下拉框内容 字典 const tableDict = ref<{ [key: string]: { value: string;name: string;id: string }[] }>({}) // 修改输出通道 -function setLoadSituation(current: string, list: IList[]) { - if (props.pageType === 'detail') { +function setLoadSituation(current: string, list: IList[], title: string) { + if (props.pageType === 'detail' || title !== '负载调整率') { tableDict.value['输出通道'] = OutputChannelAllList.value } else { - tableDict.value['输出通道'] = setSelectList(OutputChannelAllList.value, list, current, 'outputChannel') + tableDict.value['输出通道'] = setSelectList(OutputChannelAllList.value, list, current, 'outputChannel', 'name') } } diff --git a/src/api/system/dict.ts b/src/api/system/dict.ts index 49749b1..ddd6ebc 100644 --- a/src/api/system/dict.ts +++ b/src/api/system/dict.ts @@ -7,6 +7,13 @@ params, }) } +export function getDictAllList(params: object) { + return request({ + url: 'sys/dict/list', + method: 'get', + params, + }) +} // 添加字典 export function addDict(data: object) { return request({ diff --git a/src/components.d.ts b/src/components.d.ts index 3e6e918..d03a8d7 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -64,6 +64,7 @@ SearchArea: typeof import('./components/SearchArea/index.vue')['default'] SearchBar: typeof import('./components/SearchBar/index.vue')['default'] SearchItem: typeof import('./components/SearchArea/SearchItem.vue')['default'] + SelectByDict: typeof import('./components/SelectByDict/index.vue')['default'] SelectDeptDialog: typeof import('./components/dialog/selectDeptDialog.vue')['default'] SelectEmployeesDialog: typeof import('./components/dialog/selectEmployeesDialog.vue')['default'] SelectRoleDialog: typeof import('./components/dialog/selectRoleDialog.vue')['default'] diff --git a/src/components/SelectByDict/index.vue b/src/components/SelectByDict/index.vue new file mode 100644 index 0000000..9302e9c --- /dev/null +++ b/src/components/SelectByDict/index.vue @@ -0,0 +1,169 @@ + + + + + + diff --git a/src/utils/Array.ts b/src/utils/Array.ts index 74d9300..b632e21 100644 --- a/src/utils/Array.ts +++ b/src/utils/Array.ts @@ -37,7 +37,7 @@ * @param current 当前数据 可为空 * @param attribute 属性(即绑定在 list1哪个属性上) */ -export const setSelectList = (list: any[], list1: any[], current: string, attribute: string) => { +export const setSelectList = (list: any[], list1: any[], current: string, attribute: string, attribute2 = 'value') => { const select = [...new Set(list1.map((item: any) => item[attribute]))].filter((item: string) => item !== current) - return list.filter((item) => { return !select.includes(item.value) }) + return list.filter((item) => { return !select.includes(item[attribute2]) }) } diff --git a/src/views/business/measure/item/components/second/templateDetail.vue b/src/views/business/measure/item/components/second/templateDetail.vue index 140815d..64ba38d 100644 --- a/src/views/business/measure/item/components/second/templateDetail.vue +++ b/src/views/business/measure/item/components/second/templateDetail.vue @@ -111,7 +111,7 @@ // ----------------------------------------表头------------------------------------------------ const columns_line_voltage_regulation = ref([ // 电源电压调整率 { text: '检定项目', value: 'params', align: 'center', required: true, type: 'text' }, - { text: '输出通道', value: 'outputChannel', align: 'center', required: true, type: 'select' }, + { text: '输出通道', value: 'outputChannel', align: 'center', required: true, type: 'select-dict', code: 'test-dict' }, { text: '单位', value: 'unit', align: 'center', required: true, type: 'select' }, { text: '调压器输出值', value: 'voltageRegulatorOutputValue', align: 'center', required: true, type: 'select' }, { text: '被检电源技术指标', value: 'technicalIndex', align: 'center', required: true, type: 'input' }, @@ -281,7 +281,7 @@ editable: true, } for (let i = 1; i < 3; i++) { - loadRegulationList.value.push({ ...data, loadSituation: i.toString() }) + loadRegulationList.value.push({ ...data, loadSituation: i === 1 ? '满载' : '空载' }) } break case '电压表示值误差': // 电压表示值误差 @@ -324,7 +324,7 @@ technicalIndexSymbol: form.value.technicalIndexSymbol, // 技术指标前符号 unit: '', // 单位 measureIndicationValue: '', // 被检表示值 - maximumError: '1', // 最大允许误差 + maximumError: '', // 最大允许误差 resolution: '0.0001', // 分辨力 editable: true, } @@ -580,8 +580,8 @@ }) // 监听 输出通道 修改下拉框内容 -const changeLoadSituationa = (value: any, index: number, title: string, type: string, list: IList[], item: string) => { - if (title !== '输出通道') { return } +const changeLoadSituationa = (value: any, index: number, text: string, type: string, list: IList[], item: string) => { + if (text !== '输出通道') { return } if (type === 'change' && item === '负载调整率') { // 1.判断奇偶修改对应的 输出通道 if (Number(index) % 2 === 0) { @@ -592,7 +592,7 @@ } } // 2.限制下拉框内容 - setLoadSituation(typeof value === 'string' ? value : list[index].outputChannel as string, list) + setLoadSituation(typeof value === 'string' ? value : list[index].outputChannel as string, list, item) } // 表格下拉框等内容是否禁用 const disabled = ({ scope, column }, fun) => { @@ -635,12 +635,12 @@ // 每个table对应的下拉框内容 字典 const tableDict = ref<{ [key: string]: { value: string;name: string;id: string }[] }>({}) // 修改输出通道 -function setLoadSituation(current: string, list: IList[]) { - if (props.pageType === 'detail') { +function setLoadSituation(current: string, list: IList[], title: string) { + if (props.pageType === 'detail' || title !== '负载调整率') { tableDict.value['输出通道'] = OutputChannelAllList.value } else { - tableDict.value['输出通道'] = setSelectList(OutputChannelAllList.value, list, current, 'outputChannel') + tableDict.value['输出通道'] = setSelectList(OutputChannelAllList.value, list, current, 'outputChannel', 'name') } } diff --git a/src/views/business/measure/item/components/second/templateTable.vue b/src/views/business/measure/item/components/second/templateTable.vue index 677a6ff..2010136 100644 --- a/src/views/business/measure/item/components/second/templateTable.vue +++ b/src/views/business/measure/item/components/second/templateTable.vue @@ -68,6 +68,16 @@ type: Object, default: () => ({}), }, + // 是否展示多选列 + isMulti: { + type: Boolean, + default: true, + }, + // 标题 + showTitle: { + type: Boolean, + default: false, + }, }) const emit = defineEmits(['change', 'selectionChange', 'rowClick', 'rowDbClick', 'multiSelect', 'filterChange', 'addRow', 'delRow', 'changeLoadSituationa', 'calculateResult', 'disabled']) // ------------------------------------------字典---------------------------------------------- @@ -161,6 +171,10 @@ const calculateResult = (title) => { emit('calculateResult', title) } +// 获取字典value +const getDictValue = (value: string) => { + console.log(value, 'value') +} defineExpose({ clearMulti, initColumnsState, }) @@ -173,22 +187,21 @@ diff --git a/src/api/system/dict.ts b/src/api/system/dict.ts index 49749b1..ddd6ebc 100644 --- a/src/api/system/dict.ts +++ b/src/api/system/dict.ts @@ -7,6 +7,13 @@ params, }) } +export function getDictAllList(params: object) { + return request({ + url: 'sys/dict/list', + method: 'get', + params, + }) +} // 添加字典 export function addDict(data: object) { return request({ diff --git a/src/components.d.ts b/src/components.d.ts index 3e6e918..d03a8d7 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -64,6 +64,7 @@ SearchArea: typeof import('./components/SearchArea/index.vue')['default'] SearchBar: typeof import('./components/SearchBar/index.vue')['default'] SearchItem: typeof import('./components/SearchArea/SearchItem.vue')['default'] + SelectByDict: typeof import('./components/SelectByDict/index.vue')['default'] SelectDeptDialog: typeof import('./components/dialog/selectDeptDialog.vue')['default'] SelectEmployeesDialog: typeof import('./components/dialog/selectEmployeesDialog.vue')['default'] SelectRoleDialog: typeof import('./components/dialog/selectRoleDialog.vue')['default'] diff --git a/src/components/SelectByDict/index.vue b/src/components/SelectByDict/index.vue new file mode 100644 index 0000000..9302e9c --- /dev/null +++ b/src/components/SelectByDict/index.vue @@ -0,0 +1,169 @@ + + + + + + diff --git a/src/utils/Array.ts b/src/utils/Array.ts index 74d9300..b632e21 100644 --- a/src/utils/Array.ts +++ b/src/utils/Array.ts @@ -37,7 +37,7 @@ * @param current 当前数据 可为空 * @param attribute 属性(即绑定在 list1哪个属性上) */ -export const setSelectList = (list: any[], list1: any[], current: string, attribute: string) => { +export const setSelectList = (list: any[], list1: any[], current: string, attribute: string, attribute2 = 'value') => { const select = [...new Set(list1.map((item: any) => item[attribute]))].filter((item: string) => item !== current) - return list.filter((item) => { return !select.includes(item.value) }) + return list.filter((item) => { return !select.includes(item[attribute2]) }) } diff --git a/src/views/business/measure/item/components/second/templateDetail.vue b/src/views/business/measure/item/components/second/templateDetail.vue index 140815d..64ba38d 100644 --- a/src/views/business/measure/item/components/second/templateDetail.vue +++ b/src/views/business/measure/item/components/second/templateDetail.vue @@ -111,7 +111,7 @@ // ----------------------------------------表头------------------------------------------------ const columns_line_voltage_regulation = ref([ // 电源电压调整率 { text: '检定项目', value: 'params', align: 'center', required: true, type: 'text' }, - { text: '输出通道', value: 'outputChannel', align: 'center', required: true, type: 'select' }, + { text: '输出通道', value: 'outputChannel', align: 'center', required: true, type: 'select-dict', code: 'test-dict' }, { text: '单位', value: 'unit', align: 'center', required: true, type: 'select' }, { text: '调压器输出值', value: 'voltageRegulatorOutputValue', align: 'center', required: true, type: 'select' }, { text: '被检电源技术指标', value: 'technicalIndex', align: 'center', required: true, type: 'input' }, @@ -281,7 +281,7 @@ editable: true, } for (let i = 1; i < 3; i++) { - loadRegulationList.value.push({ ...data, loadSituation: i.toString() }) + loadRegulationList.value.push({ ...data, loadSituation: i === 1 ? '满载' : '空载' }) } break case '电压表示值误差': // 电压表示值误差 @@ -324,7 +324,7 @@ technicalIndexSymbol: form.value.technicalIndexSymbol, // 技术指标前符号 unit: '', // 单位 measureIndicationValue: '', // 被检表示值 - maximumError: '1', // 最大允许误差 + maximumError: '', // 最大允许误差 resolution: '0.0001', // 分辨力 editable: true, } @@ -580,8 +580,8 @@ }) // 监听 输出通道 修改下拉框内容 -const changeLoadSituationa = (value: any, index: number, title: string, type: string, list: IList[], item: string) => { - if (title !== '输出通道') { return } +const changeLoadSituationa = (value: any, index: number, text: string, type: string, list: IList[], item: string) => { + if (text !== '输出通道') { return } if (type === 'change' && item === '负载调整率') { // 1.判断奇偶修改对应的 输出通道 if (Number(index) % 2 === 0) { @@ -592,7 +592,7 @@ } } // 2.限制下拉框内容 - setLoadSituation(typeof value === 'string' ? value : list[index].outputChannel as string, list) + setLoadSituation(typeof value === 'string' ? value : list[index].outputChannel as string, list, item) } // 表格下拉框等内容是否禁用 const disabled = ({ scope, column }, fun) => { @@ -635,12 +635,12 @@ // 每个table对应的下拉框内容 字典 const tableDict = ref<{ [key: string]: { value: string;name: string;id: string }[] }>({}) // 修改输出通道 -function setLoadSituation(current: string, list: IList[]) { - if (props.pageType === 'detail') { +function setLoadSituation(current: string, list: IList[], title: string) { + if (props.pageType === 'detail' || title !== '负载调整率') { tableDict.value['输出通道'] = OutputChannelAllList.value } else { - tableDict.value['输出通道'] = setSelectList(OutputChannelAllList.value, list, current, 'outputChannel') + tableDict.value['输出通道'] = setSelectList(OutputChannelAllList.value, list, current, 'outputChannel', 'name') } } diff --git a/src/views/business/measure/item/components/second/templateTable.vue b/src/views/business/measure/item/components/second/templateTable.vue index 677a6ff..2010136 100644 --- a/src/views/business/measure/item/components/second/templateTable.vue +++ b/src/views/business/measure/item/components/second/templateTable.vue @@ -68,6 +68,16 @@ type: Object, default: () => ({}), }, + // 是否展示多选列 + isMulti: { + type: Boolean, + default: true, + }, + // 标题 + showTitle: { + type: Boolean, + default: false, + }, }) const emit = defineEmits(['change', 'selectionChange', 'rowClick', 'rowDbClick', 'multiSelect', 'filterChange', 'addRow', 'delRow', 'changeLoadSituationa', 'calculateResult', 'disabled']) // ------------------------------------------字典---------------------------------------------- @@ -161,6 +171,10 @@ const calculateResult = (title) => { emit('calculateResult', title) } +// 获取字典value +const getDictValue = (value: string) => { + console.log(value, 'value') +} defineExpose({ clearMulti, initColumnsState, }) @@ -173,22 +187,21 @@ diff --git a/src/views/business/taskMeasure/measureData/components/second/templateDetail.vue b/src/views/business/taskMeasure/measureData/components/second/templateDetail.vue index 7fdf6b0..d68c6eb 100644 --- a/src/views/business/taskMeasure/measureData/components/second/templateDetail.vue +++ b/src/views/business/taskMeasure/measureData/components/second/templateDetail.vue @@ -9,7 +9,7 @@ import TemplateFormAndTable from '../templateFormAndTable.vue' import { useSolveFormData } from '../useSolveFormData' import type { IDetailMeasureList } from './second-interface' -import templateTable from './templateTable.vue' +import templateTable1 from './templateTable.vue' import useUserStore from '@/store/modules/user' import type { dictType } from '@/global' import { getDictByCode } from '@/api/system/dict' @@ -18,7 +18,7 @@ import { getInfo as getItemInfo } from '@/api/business/measure/item' import { useCheckList } from '@/commonMethods/useCheckList' import { calc } from '@/utils/useCalc' - +import templateTable from '@/views/business/measure/item/components/second/templateTable.vue' const props = defineProps({ infoId: String, // id dataNo: String, // 检定数据编号 @@ -75,68 +75,68 @@ const outputVoltageStabilityList = ref([]) // 输出电压短期稳定性 const columns_line_voltage_regulation = ref([ // 电源电压调整率 - { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '输出通道', value: 'outputChannel', align: 'center', required: true }, - { text: '单位', value: 'nominalValue', align: 'center', required: true }, - { text: '调压器输出值', value: 'nominalValue', align: 'center', required: true }, - { text: '被检电源输出电压值', value: 'nominalValue', align: 'center', required: 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: 'text' }, + { text: '单位', value: 'unit', align: 'center', required: true, type: 'text' }, + { text: '调压器输出值', value: 'voltageRegulatorOutputValue', align: 'center', required: true, type: 'text' }, + { text: '被检电源输出电压值', value: 'voltageOutputValue', align: 'center', required: true, type: 'input' }, + { text: '被检电源输出电压最大差值', value: 'voltageMaxDifference', align: 'center', required: false, type: 'text' }, + { text: '被检电源技术指标', value: 'technicalIndex', align: 'center', required: true, type: 'text' }, + { text: '电源电压调整率', value: 'voltageRegulation', align: 'center', required: false, type: 'text' }, ]) 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: '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: 'text' }, + { text: '单位', value: 'unit', align: 'center', required: true, type: 'text' }, + { text: '负载情况', value: 'loadSituation', align: 'center', required: true, type: 'text' }, + { text: '被检电源输出电压值', value: 'voltageOutputValue', align: 'center', required: true, type: 'input' }, + { text: '电压差值', value: 'voltageDifference', align: 'center', required: true, type: 'text' }, + { text: '被检电源技术指标', value: 'technicalIndex', align: 'center', required: true, type: 'text' }, + { text: '负载调整率', value: 'loadRegulation', align: 'center', required: true, type: 'text' }, ]) // 电压表示值误差 const columns_voltage_representation_value_error = ref([ - { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '输出通道', value: 'nominalValue', align: 'center', required: true }, - { text: '单位', value: 'nominalValue', align: 'center', required: true }, - { text: '被检表示值', value: 'nominalValue', align: 'center', required: true }, - { text: '标准值', value: 'nominalValue', align: 'center', required: true }, - { text: '最大允许误差', value: 'nominalValue', align: 'center', required: true }, - { text: '绝对误差', value: 'nominalValue', align: 'center', required: true }, + { text: '检定项目', value: 'params', align: 'center', required: true, type: 'text' }, + { text: '输出通道', value: 'outputChannel', align: 'center', required: true, type: 'text' }, + { text: '单位', value: 'unit', align: 'center', required: true, type: 'text' }, + { text: '被检表示值', value: 'measureIndicationValue', align: 'center', required: true, type: 'input' }, + { text: '标准值', value: 'standardValue', align: 'center', required: true, type: 'input' }, + { text: '最大允许误差', value: 'maximumError', align: 'center', required: true, type: 'text' }, + { text: '绝对误差', value: 'absoluteError', align: 'center', required: true, type: 'text' }, ]) // 电流表示值误差(间接测量) const columns_ammeter_indirect = ref([ - { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '输出通道', value: 'nominalValue', align: 'center', required: true }, - { text: '单位', value: 'nominalValue', align: 'center', required: true }, - { text: '被检表示值', value: 'nominalValue', align: 'center', required: true }, - { text: '标准电压值', value: 'nominalValue', align: 'center', required: true }, - { text: '标准值', value: 'nominalValue', align: 'center', required: true }, - { text: '最大允许误差', value: 'nominalValue', align: 'center', required: true }, - { text: '绝对误差', value: 'nominalValue', align: 'center', required: true }, + { text: '检定项目', value: 'params', align: 'center', required: true, type: 'text' }, + { text: '输出通道', value: 'outputChannel', align: 'center', required: true, type: 'text' }, + { text: '单位', value: 'unit', align: 'center', required: true, type: 'text' }, + { text: '被检表示值', value: 'measureIndicationValue', align: 'center', required: true, type: 'input' }, + { text: '标准电压值', value: 'standardVoltageValue', align: 'center', required: true, type: 'input' }, + { text: '标准值', value: 'standardValue', align: 'center', required: true, type: 'text' }, + { text: '最大允许误差', value: 'maximumError', align: 'center', required: true, type: 'text' }, + { text: '绝对误差', value: 'absoluteError', align: 'center', required: true, type: 'text' }, ]) // 纹波电压 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: 'nominalValue', align: 'center', required: true }, + { text: '检定项目', value: 'params', align: 'center', required: true, type: 'text' }, + { text: '输出通道', value: 'outputChannel', align: 'center', required: true, type: 'text' }, + { text: '单位', value: 'unit', align: 'center', required: true, type: 'text' }, + { text: '被检电源技术指标', value: 'technicalIndex', align: 'center', required: true, type: 'text' }, + { text: '纹波电压', value: 'rippleVoltage', align: 'center', required: true, type: 'input' }, ]) // 输出电压短期稳定性 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: '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: 'text' }, + { text: '单位', value: 'unit', align: 'center', required: true, type: 'text' }, + { text: '被测电源输出电压', value: 'voltageOutputValue', align: 'center', required: true, type: 'input' }, + { text: '输出电压最大变化值', value: 'outputVoltageMaxChange', align: 'center', required: true, type: 'text' }, + { text: '仪器技术指标', value: 'technicalIndex', align: 'center', required: true, type: 'text' }, + { text: '短期稳定性', value: 'shortTermStability', align: 'center', required: true, type: 'text' }, ]) // -------------------------------------------获取详情信息-------------------------------------------------- // 获取页面详情信息 @@ -178,7 +178,40 @@ // 初始化输入数据 const initInputData = (data: any) => { - + console.log(data, 'data') + data.forEach((item: any) => { + console.log(item, 'item') + switch (item.dataType) { + case '1': + // 电源电压调整率 + lineVoltageRegulationList.value.push({ ...item, params: '电源电压调整率' }) + break + case '2': + // 负载调整率 + loadRegulationList.value.push({ ...item, params: '负载调整率' }) + break + case '3': + // 电压表示值误差 + voltageRepresentationValueErrorList.value.push({ ...item, params: '电压表示值误差' }) + break + case '4': + // 电流表示值误差(直接测量) + ammeterDirectList.value.push({ ...item, params: '电流表示值误差(直接测量)' }) + break + case '5': + // 电流表示值误差(间接测量) + ammeterIndirectList.value.push({ ...item, params: '电流表示值误差(间接测量)' }) + break + case '6': + // 纹波电压 + rippleVoltageList.value.push({ ...item, params: '纹波电压' }) + break + case '7': + // 纹波电压 + outputVoltageStabilityList.value.push({ ...item, params: '输出电压短期稳定性' }) + break + } + }) } /** @@ -203,19 +236,38 @@ itemFormData.value.currentRepresentErrorIndirect = res.data.currentRepresentErrorIndirect // 电流表示值误差(间接测量) itemFormData.value.rippleVoltage = res.data.rippleVoltage // 纹波电压 itemFormData.value.voltageOutputStability = res.data.voltageOutputStability // 输出电压短期稳定性 - initInputData(res.data.measureItemDataPistonGaugeList) + initInputData(res.data.measureItemDataDcPowerList) }) } - +// -----------------------------------------字典---------------------------------------- +const RegulatorOutputValue = ref<{ value: string;name: string;id: string }[]>([]) // 调压器输出值 +const fetchDict = async () => { + const res1 = await getDictByCode('voltageRegulatorOutputValue') + RegulatorOutputValue.value = res1.data +} +fetchDict() +// 调压器输出值 // ----------------------------------------点击保存时校验--------------------------------------- // 校验 const checkout = () => { } // -----------------------------------------生成结果处理---------------------------------------- // 点击计算结果 -const calculate = () => { +const calculate = (title: string) => { + console.log(title, 'title') + switch (title) { + case '电源电压调整率': + // lineVoltageRegulationList.value.forEach((item: any) => { + // // 计算 被检电源输出电压最大差值 调压器输出值的最大值与最小值的被检电源输出电压值差的绝对值 + // const voltageRegulatorOutputValue = RegulatorOutputValue.value.map(item => Number(item.name)) + // // console.log(Math.max(...voltageRegulatorOutputValue)) + // console.log(Math.max(...voltageRegulatorOutputValue), Math.min(...voltageRegulatorOutputValue)) + // item.voltageMaxDifference = Math.abs(Math.max(...voltageRegulatorOutputValue) - Number(item.voltageOutputValue)) - Math.abs(Math.min(...voltageRegulatorOutputValue) - Number(item.voltageOutputValue)) + // }) + break + } // ElMessage.info('敬请期待') - return false + // return false // if (!list.value.length) { // ElMessage.warning('没有检定项数据,无法生成结果') // return false @@ -308,73 +360,45 @@ - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + diff --git a/src/api/system/dict.ts b/src/api/system/dict.ts index 49749b1..ddd6ebc 100644 --- a/src/api/system/dict.ts +++ b/src/api/system/dict.ts @@ -7,6 +7,13 @@ params, }) } +export function getDictAllList(params: object) { + return request({ + url: 'sys/dict/list', + method: 'get', + params, + }) +} // 添加字典 export function addDict(data: object) { return request({ diff --git a/src/components.d.ts b/src/components.d.ts index 3e6e918..d03a8d7 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -64,6 +64,7 @@ SearchArea: typeof import('./components/SearchArea/index.vue')['default'] SearchBar: typeof import('./components/SearchBar/index.vue')['default'] SearchItem: typeof import('./components/SearchArea/SearchItem.vue')['default'] + SelectByDict: typeof import('./components/SelectByDict/index.vue')['default'] SelectDeptDialog: typeof import('./components/dialog/selectDeptDialog.vue')['default'] SelectEmployeesDialog: typeof import('./components/dialog/selectEmployeesDialog.vue')['default'] SelectRoleDialog: typeof import('./components/dialog/selectRoleDialog.vue')['default'] diff --git a/src/components/SelectByDict/index.vue b/src/components/SelectByDict/index.vue new file mode 100644 index 0000000..9302e9c --- /dev/null +++ b/src/components/SelectByDict/index.vue @@ -0,0 +1,169 @@ + + + + + + diff --git a/src/utils/Array.ts b/src/utils/Array.ts index 74d9300..b632e21 100644 --- a/src/utils/Array.ts +++ b/src/utils/Array.ts @@ -37,7 +37,7 @@ * @param current 当前数据 可为空 * @param attribute 属性(即绑定在 list1哪个属性上) */ -export const setSelectList = (list: any[], list1: any[], current: string, attribute: string) => { +export const setSelectList = (list: any[], list1: any[], current: string, attribute: string, attribute2 = 'value') => { const select = [...new Set(list1.map((item: any) => item[attribute]))].filter((item: string) => item !== current) - return list.filter((item) => { return !select.includes(item.value) }) + return list.filter((item) => { return !select.includes(item[attribute2]) }) } diff --git a/src/views/business/measure/item/components/second/templateDetail.vue b/src/views/business/measure/item/components/second/templateDetail.vue index 140815d..64ba38d 100644 --- a/src/views/business/measure/item/components/second/templateDetail.vue +++ b/src/views/business/measure/item/components/second/templateDetail.vue @@ -111,7 +111,7 @@ // ----------------------------------------表头------------------------------------------------ const columns_line_voltage_regulation = ref([ // 电源电压调整率 { text: '检定项目', value: 'params', align: 'center', required: true, type: 'text' }, - { text: '输出通道', value: 'outputChannel', align: 'center', required: true, type: 'select' }, + { text: '输出通道', value: 'outputChannel', align: 'center', required: true, type: 'select-dict', code: 'test-dict' }, { text: '单位', value: 'unit', align: 'center', required: true, type: 'select' }, { text: '调压器输出值', value: 'voltageRegulatorOutputValue', align: 'center', required: true, type: 'select' }, { text: '被检电源技术指标', value: 'technicalIndex', align: 'center', required: true, type: 'input' }, @@ -281,7 +281,7 @@ editable: true, } for (let i = 1; i < 3; i++) { - loadRegulationList.value.push({ ...data, loadSituation: i.toString() }) + loadRegulationList.value.push({ ...data, loadSituation: i === 1 ? '满载' : '空载' }) } break case '电压表示值误差': // 电压表示值误差 @@ -324,7 +324,7 @@ technicalIndexSymbol: form.value.technicalIndexSymbol, // 技术指标前符号 unit: '', // 单位 measureIndicationValue: '', // 被检表示值 - maximumError: '1', // 最大允许误差 + maximumError: '', // 最大允许误差 resolution: '0.0001', // 分辨力 editable: true, } @@ -580,8 +580,8 @@ }) // 监听 输出通道 修改下拉框内容 -const changeLoadSituationa = (value: any, index: number, title: string, type: string, list: IList[], item: string) => { - if (title !== '输出通道') { return } +const changeLoadSituationa = (value: any, index: number, text: string, type: string, list: IList[], item: string) => { + if (text !== '输出通道') { return } if (type === 'change' && item === '负载调整率') { // 1.判断奇偶修改对应的 输出通道 if (Number(index) % 2 === 0) { @@ -592,7 +592,7 @@ } } // 2.限制下拉框内容 - setLoadSituation(typeof value === 'string' ? value : list[index].outputChannel as string, list) + setLoadSituation(typeof value === 'string' ? value : list[index].outputChannel as string, list, item) } // 表格下拉框等内容是否禁用 const disabled = ({ scope, column }, fun) => { @@ -635,12 +635,12 @@ // 每个table对应的下拉框内容 字典 const tableDict = ref<{ [key: string]: { value: string;name: string;id: string }[] }>({}) // 修改输出通道 -function setLoadSituation(current: string, list: IList[]) { - if (props.pageType === 'detail') { +function setLoadSituation(current: string, list: IList[], title: string) { + if (props.pageType === 'detail' || title !== '负载调整率') { tableDict.value['输出通道'] = OutputChannelAllList.value } else { - tableDict.value['输出通道'] = setSelectList(OutputChannelAllList.value, list, current, 'outputChannel') + tableDict.value['输出通道'] = setSelectList(OutputChannelAllList.value, list, current, 'outputChannel', 'name') } } diff --git a/src/views/business/measure/item/components/second/templateTable.vue b/src/views/business/measure/item/components/second/templateTable.vue index 677a6ff..2010136 100644 --- a/src/views/business/measure/item/components/second/templateTable.vue +++ b/src/views/business/measure/item/components/second/templateTable.vue @@ -68,6 +68,16 @@ type: Object, default: () => ({}), }, + // 是否展示多选列 + isMulti: { + type: Boolean, + default: true, + }, + // 标题 + showTitle: { + type: Boolean, + default: false, + }, }) const emit = defineEmits(['change', 'selectionChange', 'rowClick', 'rowDbClick', 'multiSelect', 'filterChange', 'addRow', 'delRow', 'changeLoadSituationa', 'calculateResult', 'disabled']) // ------------------------------------------字典---------------------------------------------- @@ -161,6 +171,10 @@ const calculateResult = (title) => { emit('calculateResult', title) } +// 获取字典value +const getDictValue = (value: string) => { + console.log(value, 'value') +} defineExpose({ clearMulti, initColumnsState, }) @@ -173,22 +187,21 @@ diff --git a/src/views/business/taskMeasure/measureData/components/second/templateDetail.vue b/src/views/business/taskMeasure/measureData/components/second/templateDetail.vue index 7fdf6b0..d68c6eb 100644 --- a/src/views/business/taskMeasure/measureData/components/second/templateDetail.vue +++ b/src/views/business/taskMeasure/measureData/components/second/templateDetail.vue @@ -9,7 +9,7 @@ import TemplateFormAndTable from '../templateFormAndTable.vue' import { useSolveFormData } from '../useSolveFormData' import type { IDetailMeasureList } from './second-interface' -import templateTable from './templateTable.vue' +import templateTable1 from './templateTable.vue' import useUserStore from '@/store/modules/user' import type { dictType } from '@/global' import { getDictByCode } from '@/api/system/dict' @@ -18,7 +18,7 @@ import { getInfo as getItemInfo } from '@/api/business/measure/item' import { useCheckList } from '@/commonMethods/useCheckList' import { calc } from '@/utils/useCalc' - +import templateTable from '@/views/business/measure/item/components/second/templateTable.vue' const props = defineProps({ infoId: String, // id dataNo: String, // 检定数据编号 @@ -75,68 +75,68 @@ const outputVoltageStabilityList = ref([]) // 输出电压短期稳定性 const columns_line_voltage_regulation = ref([ // 电源电压调整率 - { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '输出通道', value: 'outputChannel', align: 'center', required: true }, - { text: '单位', value: 'nominalValue', align: 'center', required: true }, - { text: '调压器输出值', value: 'nominalValue', align: 'center', required: true }, - { text: '被检电源输出电压值', value: 'nominalValue', align: 'center', required: 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: 'text' }, + { text: '单位', value: 'unit', align: 'center', required: true, type: 'text' }, + { text: '调压器输出值', value: 'voltageRegulatorOutputValue', align: 'center', required: true, type: 'text' }, + { text: '被检电源输出电压值', value: 'voltageOutputValue', align: 'center', required: true, type: 'input' }, + { text: '被检电源输出电压最大差值', value: 'voltageMaxDifference', align: 'center', required: false, type: 'text' }, + { text: '被检电源技术指标', value: 'technicalIndex', align: 'center', required: true, type: 'text' }, + { text: '电源电压调整率', value: 'voltageRegulation', align: 'center', required: false, type: 'text' }, ]) 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: '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: 'text' }, + { text: '单位', value: 'unit', align: 'center', required: true, type: 'text' }, + { text: '负载情况', value: 'loadSituation', align: 'center', required: true, type: 'text' }, + { text: '被检电源输出电压值', value: 'voltageOutputValue', align: 'center', required: true, type: 'input' }, + { text: '电压差值', value: 'voltageDifference', align: 'center', required: true, type: 'text' }, + { text: '被检电源技术指标', value: 'technicalIndex', align: 'center', required: true, type: 'text' }, + { text: '负载调整率', value: 'loadRegulation', align: 'center', required: true, type: 'text' }, ]) // 电压表示值误差 const columns_voltage_representation_value_error = ref([ - { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '输出通道', value: 'nominalValue', align: 'center', required: true }, - { text: '单位', value: 'nominalValue', align: 'center', required: true }, - { text: '被检表示值', value: 'nominalValue', align: 'center', required: true }, - { text: '标准值', value: 'nominalValue', align: 'center', required: true }, - { text: '最大允许误差', value: 'nominalValue', align: 'center', required: true }, - { text: '绝对误差', value: 'nominalValue', align: 'center', required: true }, + { text: '检定项目', value: 'params', align: 'center', required: true, type: 'text' }, + { text: '输出通道', value: 'outputChannel', align: 'center', required: true, type: 'text' }, + { text: '单位', value: 'unit', align: 'center', required: true, type: 'text' }, + { text: '被检表示值', value: 'measureIndicationValue', align: 'center', required: true, type: 'input' }, + { text: '标准值', value: 'standardValue', align: 'center', required: true, type: 'input' }, + { text: '最大允许误差', value: 'maximumError', align: 'center', required: true, type: 'text' }, + { text: '绝对误差', value: 'absoluteError', align: 'center', required: true, type: 'text' }, ]) // 电流表示值误差(间接测量) const columns_ammeter_indirect = ref([ - { text: '检定项目', value: 'params', align: 'center', required: true }, - { text: '输出通道', value: 'nominalValue', align: 'center', required: true }, - { text: '单位', value: 'nominalValue', align: 'center', required: true }, - { text: '被检表示值', value: 'nominalValue', align: 'center', required: true }, - { text: '标准电压值', value: 'nominalValue', align: 'center', required: true }, - { text: '标准值', value: 'nominalValue', align: 'center', required: true }, - { text: '最大允许误差', value: 'nominalValue', align: 'center', required: true }, - { text: '绝对误差', value: 'nominalValue', align: 'center', required: true }, + { text: '检定项目', value: 'params', align: 'center', required: true, type: 'text' }, + { text: '输出通道', value: 'outputChannel', align: 'center', required: true, type: 'text' }, + { text: '单位', value: 'unit', align: 'center', required: true, type: 'text' }, + { text: '被检表示值', value: 'measureIndicationValue', align: 'center', required: true, type: 'input' }, + { text: '标准电压值', value: 'standardVoltageValue', align: 'center', required: true, type: 'input' }, + { text: '标准值', value: 'standardValue', align: 'center', required: true, type: 'text' }, + { text: '最大允许误差', value: 'maximumError', align: 'center', required: true, type: 'text' }, + { text: '绝对误差', value: 'absoluteError', align: 'center', required: true, type: 'text' }, ]) // 纹波电压 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: 'nominalValue', align: 'center', required: true }, + { text: '检定项目', value: 'params', align: 'center', required: true, type: 'text' }, + { text: '输出通道', value: 'outputChannel', align: 'center', required: true, type: 'text' }, + { text: '单位', value: 'unit', align: 'center', required: true, type: 'text' }, + { text: '被检电源技术指标', value: 'technicalIndex', align: 'center', required: true, type: 'text' }, + { text: '纹波电压', value: 'rippleVoltage', align: 'center', required: true, type: 'input' }, ]) // 输出电压短期稳定性 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: '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: 'text' }, + { text: '单位', value: 'unit', align: 'center', required: true, type: 'text' }, + { text: '被测电源输出电压', value: 'voltageOutputValue', align: 'center', required: true, type: 'input' }, + { text: '输出电压最大变化值', value: 'outputVoltageMaxChange', align: 'center', required: true, type: 'text' }, + { text: '仪器技术指标', value: 'technicalIndex', align: 'center', required: true, type: 'text' }, + { text: '短期稳定性', value: 'shortTermStability', align: 'center', required: true, type: 'text' }, ]) // -------------------------------------------获取详情信息-------------------------------------------------- // 获取页面详情信息 @@ -178,7 +178,40 @@ // 初始化输入数据 const initInputData = (data: any) => { - + console.log(data, 'data') + data.forEach((item: any) => { + console.log(item, 'item') + switch (item.dataType) { + case '1': + // 电源电压调整率 + lineVoltageRegulationList.value.push({ ...item, params: '电源电压调整率' }) + break + case '2': + // 负载调整率 + loadRegulationList.value.push({ ...item, params: '负载调整率' }) + break + case '3': + // 电压表示值误差 + voltageRepresentationValueErrorList.value.push({ ...item, params: '电压表示值误差' }) + break + case '4': + // 电流表示值误差(直接测量) + ammeterDirectList.value.push({ ...item, params: '电流表示值误差(直接测量)' }) + break + case '5': + // 电流表示值误差(间接测量) + ammeterIndirectList.value.push({ ...item, params: '电流表示值误差(间接测量)' }) + break + case '6': + // 纹波电压 + rippleVoltageList.value.push({ ...item, params: '纹波电压' }) + break + case '7': + // 纹波电压 + outputVoltageStabilityList.value.push({ ...item, params: '输出电压短期稳定性' }) + break + } + }) } /** @@ -203,19 +236,38 @@ itemFormData.value.currentRepresentErrorIndirect = res.data.currentRepresentErrorIndirect // 电流表示值误差(间接测量) itemFormData.value.rippleVoltage = res.data.rippleVoltage // 纹波电压 itemFormData.value.voltageOutputStability = res.data.voltageOutputStability // 输出电压短期稳定性 - initInputData(res.data.measureItemDataPistonGaugeList) + initInputData(res.data.measureItemDataDcPowerList) }) } - +// -----------------------------------------字典---------------------------------------- +const RegulatorOutputValue = ref<{ value: string;name: string;id: string }[]>([]) // 调压器输出值 +const fetchDict = async () => { + const res1 = await getDictByCode('voltageRegulatorOutputValue') + RegulatorOutputValue.value = res1.data +} +fetchDict() +// 调压器输出值 // ----------------------------------------点击保存时校验--------------------------------------- // 校验 const checkout = () => { } // -----------------------------------------生成结果处理---------------------------------------- // 点击计算结果 -const calculate = () => { +const calculate = (title: string) => { + console.log(title, 'title') + switch (title) { + case '电源电压调整率': + // lineVoltageRegulationList.value.forEach((item: any) => { + // // 计算 被检电源输出电压最大差值 调压器输出值的最大值与最小值的被检电源输出电压值差的绝对值 + // const voltageRegulatorOutputValue = RegulatorOutputValue.value.map(item => Number(item.name)) + // // console.log(Math.max(...voltageRegulatorOutputValue)) + // console.log(Math.max(...voltageRegulatorOutputValue), Math.min(...voltageRegulatorOutputValue)) + // item.voltageMaxDifference = Math.abs(Math.max(...voltageRegulatorOutputValue) - Number(item.voltageOutputValue)) - Math.abs(Math.min(...voltageRegulatorOutputValue) - Number(item.voltageOutputValue)) + // }) + break + } // ElMessage.info('敬请期待') - return false + // return false // if (!list.value.length) { // ElMessage.warning('没有检定项数据,无法生成结果') // return false @@ -308,73 +360,45 @@ - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + diff --git a/src/views/quality/supervise/report/components/edit.vue b/src/views/quality/supervise/report/components/edit.vue index e36153f..5f2928a 100644 --- a/src/views/quality/supervise/report/components/edit.vue +++ b/src/views/quality/supervise/report/components/edit.vue @@ -143,7 +143,7 @@ const checkoutList = ref([]) // 多选发生改变时 function handleSelectionChange(e: any) { - checkoutList.value = e.map((item: { id: string }) => item.id) + checkoutList.value = e } // 删除质量监督记录 const delRecord = () => {