diff --git a/src/hooks/lisData/dictData.ts b/src/hooks/lisData/dictData.ts index b27c1d4..79890d6 100644 --- a/src/hooks/lisData/dictData.ts +++ b/src/hooks/lisData/dictData.ts @@ -26,6 +26,8 @@ export const getDictData = async (...args: string[]) => { if(dictRefs.YQDL != undefined) dictData.value.YQDL = toRaw(dictRefs.YQDL.value) || [] if(dictRefs.VA != undefined) dictData.value.VA = toRaw(dictRefs.VA.value) || [] if(dictRefs.LF != undefined) dictData.value.LF = toRaw(dictRefs.LF.value) || [] + if(dictRefs.BT != undefined) dictData.value.BT = toRaw(dictRefs.BT.value) || [] + if(dictRefs.SLZQ != undefined) dictData.value.SLZQ = toRaw(dictRefs.SLZQ.value) || [] } //字典数据格式化方法 diff --git a/src/types/Object.d.ts b/src/types/Object.d.ts index f026efd..1e89e83 100644 --- a/src/types/Object.d.ts +++ b/src/types/Object.d.ts @@ -17,6 +17,8 @@ export interface DictData { YQ?: Array; VA?: Array; LF?: Array; + BT?: Array; + SLZQ?: Array; [key: string]: any[] | undefined; // 添加索引签名以支持动态访问 } @@ -128,6 +130,12 @@ export class XmInfoVs { } +export class XmTextresultNew { + xmid?: string; + xmdh?: string; + xh?: number; + textresult?: string; +} export class LabResultItem { xmdh: string; diff --git a/src/views/liswork/labItem/index.vue b/src/views/liswork/labItem/index.vue index b18447f..be200f9 100644 --- a/src/views/liswork/labItem/index.vue +++ b/src/views/liswork/labItem/index.vue @@ -73,7 +73,7 @@ - + @@ -134,7 +134,7 @@ const tabList = ref([ { label: '常用取值', value: 'CommonlyValues' }, { label: '使用仪器', value: 'UseInstr' }, { label: '知识库', value: 'Knowledge' }, - { label: '整体排序', value: 'Sort' }, + //{ label: '整体排序', value: 'Sort' }, { label: '常见描述', value: 'CommonDescriptions' }, // { label: '参数', value: 7 }, // { label: '通道号', value: 8 }, @@ -198,6 +198,8 @@ const yqdlFields = ref([ const tabDataList = ref([]); //选中行数据 const selectRow = ref(); +//明细数据 +const selectDetailRow = ref() // 仪器 const getYqConfig = () => { @@ -260,33 +262,41 @@ const changeStauts = () => { } // 选择行变化 -const rowChange = (row: any) => { +const rowChange = async (row: any) => { selectRow.value = row; - queryXmInfoNewDetailService(row.xmid,row.yq,row.xmdh).then((res: any) => { - switch(activeTab.value){ - case 'Basic': - tabDataList.value = res.data.xmInfoNewRows[0] || []; - break; - case 'CommonlyValues': - if(res.data.xmValNewRows){ - tabDataList.value = res.data.xmValNewRows[0] || []; - } - break; - case 'UseInstr': - if(res.data.xmInfoVsRows){ - tabDataList.value = res.data.xmInfoVsRows[0] || []; - } - break; - case 'Knowledge': - //tabDataList.value = res.data.xmInfoVsRows[0]; - case 'Sort': + const res = await queryXmInfoNewDetailService(row.xmid,row.yq,row.xmdh) + selectDetailRow.value = res.data + console.log('明细数据:', res); + changeActiveTab() +} - case 'CommonDescriptions': - case 'ReferenceValueDetails': +//tab变化 +const updateActive = () => { + changeActiveTab() +} - } - console.log('明细数据:', res); - }) + +const changeActiveTab = () => { + switch(activeTab.value){ + case 'Basic': + tabDataList.value = selectDetailRow.value.xmInfoNewRows[0] || []; + break; + case 'CommonlyValues': + tabDataList.value = selectDetailRow.value.xmValNewRows[0] || []; + break; + case 'UseInstr': + tabDataList.value = selectDetailRow.value.xmInfoVsRows[0] || []; + break; + case 'Knowledge': + //tabDataList.value = res.data.xmInfoVsRows[0]; + case 'Sort': + case 'CommonDescriptions': + tabDataList.value = selectDetailRow.value.xmTextresultNewRows[0] || []; + break; + case 'ReferenceValueDetails': + tabDataList.value = selectDetailRow.value.xmRefNewRows[0] || []; + break; + } } diff --git a/src/views/liswork/labItem/tab/commonDescriptions.vue b/src/views/liswork/labItem/tab/commonDescriptions.vue index ce92020..cefb99a 100644 --- a/src/views/liswork/labItem/tab/commonDescriptions.vue +++ b/src/views/liswork/labItem/tab/commonDescriptions.vue @@ -1,34 +1,42 @@ \ No newline at end of file + +const selectRow = ref() + +//序号最大值 +const maxXh = computed(() => { + return tableList.value.length > 0 ? Math.max(...tableList.value.map((item:any) => item.xh || 0)) : 0; +}); + +const rowClick = (row:any) => { + selectRow.value = row +} + + +const onAddClick = () => { + const newData: XmTextresultNew = { + xmid: props.formData.xmid, + xmdh: props.formData.xmdh, + xh: maxXh.value + 1 + } + tableList.value.push(newData) +} + +const onDelClick = async ()=> { + if(selectRow.value){ + await ElMessageBox.confirm('是否要删除选中的数据?','警告', + { confirmButtonText: 'OK',cancelButtonText: 'Cancel',type: 'warning',}); + tableList.value = tableList.value.filter((item:any) => item.xh != selectRow.value.xh) + } + +} + + +watch( + () => props.dataList, + (newVal:any) => { + tableList.value = newVal; + } +); + + + + + + \ No newline at end of file diff --git a/src/views/liswork/labItem/tab/referenceValueDetails.vue b/src/views/liswork/labItem/tab/referenceValueDetails.vue index 8f5023d..72a0102 100644 --- a/src/views/liswork/labItem/tab/referenceValueDetails.vue +++ b/src/views/liswork/labItem/tab/referenceValueDetails.vue @@ -2,11 +2,80 @@
- 增加 - 删除 + 增加 + 删除
- + + + + + + + + + + + + + + + 仪器特定参考值: @@ -14,7 +83,7 @@ 增加 删除
- @@ -22,23 +91,61 @@ \ No newline at end of file + +const onAddClick = () => { + const newData = { + xh: maxXh.value + 1 + } + dataListUp.value.push(newData) +} + +const onDelClick = async () => { + console.log('删除',selectRow.value) + if(selectRow.value){ + await ElMessageBox.confirm('是否要删除选中的数据?','警告', + { confirmButtonText: 'OK',cancelButtonText: 'Cancel',type: 'warning',}); + dataListUp.value = dataListUp.value.filter((item:any) => item.xh !== selectRow.value.xh) + } +} + +const rowClick = (row:any) => { + selectRow.value = row +} + +onActivated( async ()=>{ + //加载字典数据 + await getDictData('BT','SLZQ') + bblxOptions.value = dictData.value.BT || [] + optionsSLZQ.value = dictData.value.SLZQ || [] +}) + + + + + \ No newline at end of file diff --git a/src/views/liswork/labItem/tab/sort.vue b/src/views/liswork/labItem/tab/sort.vue index e519b7b..7d55d1d 100644 --- a/src/views/liswork/labItem/tab/sort.vue +++ b/src/views/liswork/labItem/tab/sort.vue @@ -18,12 +18,10 @@ import CustomTable from '@/components/elTable/index.vue' import { ref } from 'vue'; const props = defineProps({ - // 是否显示 - // visible: { - // type: Boolean, - // required: true, - // default: false - // } + dataList: { + type: Array, + default: [] + } });