diff --git a/src/api/liswork/labItem/LabItemApi.ts b/src/api/liswork/labItem/LabItemApi.ts index be53699..eface31 100644 --- a/src/api/liswork/labItem/LabItemApi.ts +++ b/src/api/liswork/labItem/LabItemApi.ts @@ -85,3 +85,22 @@ export function delXmValNewService(query:any){ }) } + +//删除常见描述 +export function delXmTextresultNew(query:any){ + return request({ + url: '/xminfo/delXmTextresultNew', + method: 'get', + params: query + }) +} + + +//删除仪器对照 +export function deleteXmInfoVs(query:any){ + return request({ + url: '/xminfo/delvs', + method: 'delete', + params: query + }) +} \ No newline at end of file diff --git a/src/types/Object.d.ts b/src/types/Object.d.ts index 1e89e83..fa27f22 100644 --- a/src/types/Object.d.ts +++ b/src/types/Object.d.ts @@ -120,6 +120,7 @@ export class XmValNew { } export class XmInfoVs { + vsid?: number; yq: string; xmid: number; xs?: number; diff --git a/src/views/liswork/labItem/index.vue b/src/views/liswork/labItem/index.vue index 1e33f27..cd1f8b3 100644 --- a/src/views/liswork/labItem/index.vue +++ b/src/views/liswork/labItem/index.vue @@ -101,6 +101,7 @@ import tabView from '@/components/tabViews/index.vue'; import { LabInstr,XmInfoNew } from '@/types'; import { formatDict,getDictData,dictData } from '@/hooks'; import { ElMessage } from 'element-plus'; +import { datalink } from '../../../api/liswork/work/LisWork'; const xmlbList = ref>([ { label: '数值型', value: '1' }, @@ -209,6 +210,7 @@ const modelParam = ref({ commonDescriptionsData: [], referenceValueDetailsData: [] }) +const basic = ref(false) @@ -256,6 +258,25 @@ const handleDelCorr = () => { //保存 const handleSave = async () => { + + switch(activeTab.value){ + case 'Basic': + basic.value = true + modelParam.value.basicData = tableTabRef.value.basicData; + break; + case 'CommonlyValues': + modelParam.value.commonlyValuesData = tableTabRef.value.commonlyValuesData; + break; + case 'UseInstr': + modelParam.value.userInstrData = tableTabRef.value.userInstrData; + break; + case 'CommonDescriptions': + modelParam.value.commonDescriptionsData = tableTabRef.value.commonDescriptionsData; + break; + case 'ReferenceValueDetails': + modelParam.value.referenceValueDetailsData = tableTabRef.value.referenceValueDetailsData; + break; + } await saveDataService({ xmInfoNew: modelParam.value.basicData, xmDoubleRows: [], @@ -268,7 +289,14 @@ const handleSave = async () => { xmInfoVsRows: modelParam.value.userInstrData, xmTextresultNewRows: modelParam.value.commonDescriptionsData }) + rowChange(selectRow.value) + if(basic.value){ + await getList(); + basic.value = false + } + ElMessage.success('保存成功!') + } //退拽属性 const handleColumnDragEnd = (data: any) => { @@ -289,59 +317,22 @@ const rowChange = async (row: any) => { selectRow.value = row; const res = await queryXmInfoNewDetailService(row.xmid,row.yq,row.xmdh) selectDetailRow.value = res.data - console.log('明细数据:', res); + console.log('选中行明细数据:',selectDetailRow.value) changeActiveTab() } //tab变化 const updateActive = () => { - changeActiveTab() + changeActiveTab() } const changeActiveTab = () => { - switch(activeTab.value){ - case 'Basic': - if(selectDetailRow.value.xmInfoNew){ - modelParam.value = toRaw(selectDetailRow.value.xmInfoNew || {}); - // basicData.value = tableTabRef.value.basicData || [] - }else{ - //basicData.value = [] - } - break; - case 'CommonlyValues': - if(selectDetailRow.value.xmValNewRows){ - console.log('selectDetailRow.value.xmValNewRows',selectDetailRow.value.xmValNewRows) - modelParam.value.commonlyValuesData = toRaw(selectDetailRow.value.xmValNewRows || []); - }else{ - modelParam.value.commonlyValuesData = [] - } - break; - case 'UseInstr': - if(selectDetailRow.value.xmInfoVsRows.length){ - tabDataList.value = selectDetailRow.value.xmInfoVsRows[0] || []; - }else{ - tabDataList.value = [] - } - break; - case 'Knowledge': - //tabDataList.value = res.data.xmInfoVsRows[0]; - case 'Sort': - case 'CommonDescriptions': - if(selectDetailRow.value.xmTextresultNewRows.length){ - tabDataList.value = selectDetailRow.value.xmTextresultNewRows[0] || []; - }else{ - tabDataList.value = [] - } - break; - case 'ReferenceValueDetails': - if(selectDetailRow.value.xmRefNewRows.length){ - tabDataList.value = selectDetailRow.value.xmRefNewRows[0] || []; - }else{ - tabDataList.value = [] - } - break; - } + modelParam.value.basicData = toRaw(selectDetailRow.value.xmInfoNew || {}); + modelParam.value.commonlyValuesData = toRaw(selectDetailRow.value.xmValNewRows || []); + modelParam.value.userInstrData = toRaw(selectDetailRow.value.xmInfoVsRows || []); + modelParam.value.commonDescriptionsData = toRaw(selectDetailRow.value.xmTextresultNewRows || []); + modelParam.value.referenceValueDetailsData = toRaw(selectDetailRow.value.xmRefNewRows || []); } diff --git a/src/views/liswork/labItem/tab/CommonlyValues.vue b/src/views/liswork/labItem/tab/CommonlyValues.vue index 02a8f65..661c6c7 100644 --- a/src/views/liswork/labItem/tab/CommonlyValues.vue +++ b/src/views/liswork/labItem/tab/CommonlyValues.vue @@ -30,12 +30,12 @@ import { dictData,getDictData } from '@/hooks'; import { ElMessageBox } from 'element-plus'; import {delXmValNewService} from '@/api/liswork/labItem/labItemApi' -const props = defineProps({ - formData: { - type: Object, - default: {} - } -}); +// const props = defineProps({ +// formData: { +// type: Object, +// default: {} +// } +// }); const modelParam = defineModel() const emit = defineEmits(['refreshTabData']) @@ -78,7 +78,7 @@ const maxXh = computed(() => { const bClickAdd = () => { const newData = { - xmid: props.formData.xmid, + xmid: modelParam.value.basicData.xmid, qz: '', srm: '', jgbz: '', @@ -94,8 +94,8 @@ const bClickDel = async () => { {confirmButtonText: '确定',cancelButtonText: '取消',type: 'warning'}); //删掉界面上面的数据 //tableList.value = tableList.value?.filter((item:any) => item.xh != selectRow.value.xh ); - await delXmValNewService({xmid:props.formData.xmid,xh:selectRow.value.xh}) - emit('refreshTabData',props.formData) + await delXmValNewService({xmid:modelParam.value.basicData.xmid,xh:selectRow.value.xh}) + emit('refreshTabData',modelParam.value.basicData) } @@ -114,6 +114,10 @@ onActivated(async ()=>{ tableList.value = modelParam.value.commonlyValuesData || [] }) +defineExpose({ + commonlyValuesData: tableList +}) + diff --git a/src/views/liswork/labItem/tab/base/Basic.vue b/src/views/liswork/labItem/tab/base/Basic.vue index 4a5047d..22f79ed 100644 --- a/src/views/liswork/labItem/tab/base/Basic.vue +++ b/src/views/liswork/labItem/tab/base/Basic.vue @@ -164,12 +164,12 @@ import CalcGuilde from './child/CalcGuilde.vue'; import SelectTable from '@/components/SelectTable/index.vue' import Condition from './child/Condition.vue'; -const props = defineProps({ - dataList: { - type: Object , //Object as PropType - required: false - } -}); +// const props = defineProps({ +// dataList: { +// type: Object , //Object as PropType +// required: false +// } +// }); const modelParam = defineModel() @@ -251,7 +251,7 @@ const ygxbCheck = computed({ watch( () => modelParam.value, (newVal:any) => { - formData.value = {...newVal }; + formData.value = {...newVal.basicData}; }, { immediate: true,deep: true } ); @@ -292,6 +292,11 @@ onActivated(async () => { await getDictData('XMGL'); }) + +defineExpose({ + basicData: formData +}) + diff --git a/src/views/liswork/labItem/tab/commonDescriptions.vue b/src/views/liswork/labItem/tab/commonDescriptions.vue index d564e37..49943eb 100644 --- a/src/views/liswork/labItem/tab/commonDescriptions.vue +++ b/src/views/liswork/labItem/tab/commonDescriptions.vue @@ -20,18 +20,17 @@ import CustomTable from '@/components/elTable/index.vue' import { XmTextresultNew } from '@/types'; import { ElMessageBox } from 'element-plus'; import { ref } from 'vue'; +import { delXmTextresultNew } from '@/api/liswork/labItem/labItemApi'; -const props = defineProps({ - dataList: { - type: Array, - default: () => [] - }, - formData: { - type: Object, - default: {} - } -}); +// const props = defineProps({ +// formData: { +// type: Object, +// default: {} +// } +// }); + +const modelParam = defineModel() const tableRef = ref(); const tableList = ref>([]) @@ -53,12 +52,21 @@ const handleColumnDragEnd = (data: any) => { } const selectRow = ref() +const emit = defineEmits(['refreshTabData']) //序号最大值 const maxXh = computed(() => { return tableList.value.length > 0 ? Math.max(...tableList.value.map((item:any) => item.xh || 0)) : 0; }); +watch( + () => modelParam.value, + (newVal:any) => { + tableList.value = [...newVal.commonDescriptionsData]; + }, + { immediate: true, deep: true } +); + const rowClick = (row:any) => { selectRow.value = row } @@ -66,8 +74,8 @@ const rowClick = (row:any) => { const onAddClick = () => { const newData: XmTextresultNew = { - xmid: props.formData.xmid, - xmdh: props.formData.xmdh, + xmid: modelParam.value.basicData.xmid, + xmdh: modelParam.value.basicData.xmdh, xh: maxXh.value + 1 } tableList.value.push(newData) @@ -77,19 +85,13 @@ 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) + //tableList.value = tableList.value.filter((item:any) => item.xh != selectRow.value.xh) + await delXmTextresultNew({xmid:modelParam.value.basicData.xmid,xh:selectRow.value.xh}) + emit('refreshTabData',modelParam.value.basicData) } } - -watch( - () => props.dataList, - (newVal:any) => { - tableList.value = newVal; - } -); - defineExpose({ commonDescriptionsData: tableList }) diff --git a/src/views/liswork/labItem/tab/referenceValueDetails.vue b/src/views/liswork/labItem/tab/referenceValueDetails.vue index 4218a4a..3340571 100644 --- a/src/views/liswork/labItem/tab/referenceValueDetails.vue +++ b/src/views/liswork/labItem/tab/referenceValueDetails.vue @@ -73,7 +73,7 @@ @@ -95,12 +95,14 @@ import {getDictData,dictData} from '@/hooks' import SelectTable from '@/components/SelectTable/index.vue' import { ElMessageBox } from 'element-plus'; -const props = defineProps({ - dataList: { - type: Array, - default: [] - } -}); +// const props = defineProps({ +// dataList: { +// type: Array, +// default: [] +// } +// }); + +const modelParam = defineModel() const optionsXb = [ {value: '1' ,label: '男'}, @@ -126,14 +128,15 @@ const bblxOptions = ref>([]); const tableRefUp = ref(); const tableRefDown = ref(); -const dataListUp = ref(props.dataList); +const dataListUp = ref(); const dataListDown = ref(); const columnsUp = ref([ - { prop: 'xh', label: '序号', visible: false, align: 'center', width: 70 }, + { prop: 'xmid', label: 'xmid', visible: false, align: 'center'}, + { prop: 'xh', label: '序号', visible: false, align: 'center' }, { prop: 'xb', label: '性别', visible: true, align: 'center',slot: 'xb', width: 70 }, - { prop: 'cp_nl1', label: '年龄下限', visible: true, align: 'center',slot:'cp_nl1', width: 100 }, + { prop: 'nl1', label: '年龄下限', visible: true, align: 'center',slot:'cp_nl1', width: 100 }, { prop: 'cp_nldw1', label: '年龄单位', visible: true, align: 'center',slot:'cp_nldw1', width: 70 }, - { prop: 'cp_nl2', label: '年龄上限', visible: true, align: 'center',slot: 'cp_nl2', width: 100 }, + { prop: 'nl2', label: '年龄上限', visible: true, align: 'center',slot: 'cp_nl2', width: 100 }, { prop: 'cp_nldw2', label: '年龄单位', visible: true, align: 'center',slot: 'cp_nldw2', width: 100 }, { prop: 'bblx', label: '标本类型', visible: true, align: 'center',slot: 'bblx', width: 100 }, { prop: 'slzq', label: '生理周期', visible: true, align: 'center',slot: 'slzq', width: 100 }, @@ -180,9 +183,18 @@ const maxXh = computed(() => { return dataListUp.value.length > 0 ? Math.max(...dataListUp.value.map((item:any) => item.xh || 0)) : 0; }); +watch( + () => modelParam.value, + (newVal:any) => { + dataListUp.value = [...newVal.referenceValueDetailsData]; + }, + { immediate: true, deep: true } +); const onAddClick = () => { const newData = { + xmid: modelParam.value.basicData.xmid, + yq: '0', xh: maxXh.value + 1 } dataListUp.value.push(newData) diff --git a/src/views/liswork/labItem/tab/useInstr.vue b/src/views/liswork/labItem/tab/useInstr.vue index 99862d3..e339d71 100644 --- a/src/views/liswork/labItem/tab/useInstr.vue +++ b/src/views/liswork/labItem/tab/useInstr.vue @@ -14,16 +14,16 @@ - + @@ -35,32 +35,28 @@ import CustomTable from '@/components/elTable/index.vue' import { XmInfoVs } from '@/types'; import YQSelectTable from '@/components/SelectTable/YQSelectTable/index.vue' import {ElMessageBox} from 'element-plus' +import { deleteXmInfoVs } from '@/api/liswork/labItem/labItemApi'; -const props = defineProps({ - // 显示数据 - dataList: { - type: Array, - required: true, - default: () => [] - }, - formData: { - type: Object, - required: false, - default: {} - } -}); - +// const props = defineProps({ +// formData: { +// type: Object, +// required: false, +// default: {} +// } +// }); +const modelParam = defineModel() //const yq = ref(''); const tableRef = ref(); const yqList = ref>([]); const columns = ref([ + { prop: 'vsid', label: '对照编码', visible: false, align: 'center' }, { prop: 'yq', label: '仪器代号', visible: true, align: 'center', slot: 'yq', width: 150 }, { prop: 'xs', label: '调整系数', visible: true, align: 'center', slot: 'xs', width: 100 }, { prop: 'zkxm', label: '质控', visible: true, align: 'center', slot: 'zkxm', width: 40 }, - { prop: 'cksx', label: '参考上限', visible: true, align: 'center',slot: 'cksx', width: 100 }, { prop: 'ckxx', label: '参考下限', visible: true, align: 'center',slot: 'ckxx', width: 100 }, + { prop: 'cksx', label: '参考上限', visible: true, align: 'center',slot: 'cksx', width: 100 }, { prop: 'dyckz', label: '打印参考值', visible: true, align: 'center',slot: 'dyckz', width: 100 }, ]); const tableConfig = ref({ @@ -74,6 +70,15 @@ const selectRow = ref({ xmid: 0 }) +watch( + () => modelParam.value, + (newVal:any) => { + yqList.value = [...newVal.userInstrData]; + }, + { immediate: true, deep: true } +); + +const emit = defineEmits(['refreshTabData']) //退拽属性 const handleColumnDragEnd = (data: any) => { @@ -93,7 +98,7 @@ const handInputChange = () => { const onClickAdd = () => { const newData: XmInfoVs = { yq: '', - xmid: props.formData.xmid, + xmid: modelParam.value.basicData.xmid, } yqList.value.push(newData) } @@ -106,7 +111,8 @@ const onClickDel = async () => { cancelButtonText: '取消', type: 'warning', }); - yqList.value = yqList.value.filter(item => item.yq != selectRow.value.yq); + await deleteXmInfoVs({vsid:selectRow.value.vsid || 0}) + emit('refreshTabData',modelParam.value.basicData) } } @@ -114,8 +120,17 @@ const onRowClick = (row: any) => { selectRow.value = row } +const getDyckz = (row: XmInfoVs) => { + if(!row.cksx && !row.ckxx){ + return ''; + }else{ + return `${row.ckxx || ''}--${row.cksx || ''}`; + } + +} + onActivated(() =>{ - yqList.value = Array.isArray(props.dataList) ? props.dataList : []; + }) defineExpose({