diff --git a/src/views/business/measure/item/components/second/templateTable.vue b/src/views/business/measure/item/components/second/templateTable.vue index 2d8b585..b549286 100644 --- a/src/views/business/measure/item/components/second/templateTable.vue +++ b/src/views/business/measure/item/components/second/templateTable.vue @@ -84,8 +84,13 @@ type: Array, default: () => ([]), }, + // 自定义下拉框内容 + customSelect: { + type: Boolean, + default: false, + }, }) -const emit = defineEmits(['change', 'selectionChange', 'rowClick', 'rowDbClick', 'multiSelect', 'filterChange', 'addRow', 'delRow', 'changeLoadSituationa', 'calculateResult', 'disabled', 'disabledItem']) +const emit = defineEmits(['change', 'selectionChange', 'rowClick', 'rowDbClick', 'multiSelect', 'filterChange', 'addRow', 'delRow', 'changeLoadSituationa', 'calculateResult', 'disabled', 'disabledItem', 'customSelect']) // ------------------------------------------字典---------------------------------------------- // -------定义数据-------------- interface columnsCheckInfo { @@ -158,7 +163,14 @@ emit('addRow', list, title, index) } // 下拉框 -const getAnySelect = (text: string, title: string) => { +const getAnySelect = (text: string, title: string, scope: any, column: any) => { + let result = [] as any + if (props.customSelect) { + emit('customSelect', { text, title, scope, column }, (value: any) => { + result = value + }) + return result + } return props.selectAllList[text] } // 下拉框禁用情况 @@ -296,7 +308,7 @@ @focus="(value) => changeLoadSituationa(value, scope.$index, item.text, 'focus', props.data, props.title)" > ([]), }, + // 自定义下拉框内容 + customSelect: { + type: Boolean, + default: false, + }, }) -const emit = defineEmits(['change', 'selectionChange', 'rowClick', 'rowDbClick', 'multiSelect', 'filterChange', 'addRow', 'delRow', 'changeLoadSituationa', 'calculateResult', 'disabled', 'disabledItem']) +const emit = defineEmits(['change', 'selectionChange', 'rowClick', 'rowDbClick', 'multiSelect', 'filterChange', 'addRow', 'delRow', 'changeLoadSituationa', 'calculateResult', 'disabled', 'disabledItem', 'customSelect']) // ------------------------------------------字典---------------------------------------------- // -------定义数据-------------- interface columnsCheckInfo { @@ -158,7 +163,14 @@ emit('addRow', list, title, index) } // 下拉框 -const getAnySelect = (text: string, title: string) => { +const getAnySelect = (text: string, title: string, scope: any, column: any) => { + let result = [] as any + if (props.customSelect) { + emit('customSelect', { text, title, scope, column }, (value: any) => { + result = value + }) + return result + } return props.selectAllList[text] } // 下拉框禁用情况 @@ -296,7 +308,7 @@ @focus="(value) => changeLoadSituationa(value, scope.$index, item.text, 'focus', props.data, props.title)" > ({}) // 单位 const unitList = ref<{ value: string;name: string;id: string }[]>([]) // 单位 +const unitList1 = ref<{ value: string;name: string;id: string }[]>([]) // 单位A +// 电阻值单位 +const resistanceUnit = ref<{ value: string;name: string;id: string }[]>([]) +// 频率单位 +const frequencyUnit = ref<{ value: string;name: string;id: string }[]>([]) // 核查类型 const checkTypeList = ref<{ value: string;name: string;id: string }[]>([]) // 获取字典 @@ -357,13 +369,34 @@ // 核查类型 const res2 = await getDictByCode('bizFirstStandardCheckType') checkTypeList.value = res2.data + // 单位A + const res3 = await getDictByCode('unitElectricalSignalA') + unitList1.value = res3.data + // 电阻值单位 + const res4 = await getDictByCode('standardResistance') + resistanceUnit.value = res4.data + // 频率单位 + const res5 = await getDictByCode('bizFirstStandardFrequencyUnit') + frequencyUnit.value = res5.data // table字典 tableDict.value = { 单位: unitList.value, 核查类型: checkTypeList.value, + 电流单位: unitList1.value, + 电阻值单位: resistanceUnit.value, + 频率单位: frequencyUnit.value, } } fecthDict() +// 自定义下拉框内容 +const customSelect = (data: any, fun: any) => { + if (data.column.text === '单位') { + fun(unitList1.value) + } + else { + fun(tableDict.value[data.text]) + } +} // ------------------------------------------钩子-------------------------------------------------- onMounted(() => { @@ -489,7 +522,6 @@ -