Compare commits

...

2 Commits

Author SHA1 Message Date
jiangs
fe03afe569 Merge branch 'main' of http://47.97.125.165:8902/jiangs/lis8.0-vue3 2025-11-28 18:02:09 +08:00
jiangs
6ef8b88107 检验项目保存 2025-11-28 18:02:07 +08:00
8 changed files with 136 additions and 34 deletions

View File

@ -2,6 +2,8 @@
import request from '@/utils/request'
//检验项目界面
//获取列表数据
export function queryXmInfoNewService(query: any){
return request({
@ -65,3 +67,21 @@ export function delXmAlarmdetailNew(xmid:number,seq:number){
})
}
//保存数据
export function saveDataService(query:any){
return request({
url: '/xminfo/update',
method: 'post',
data: query
})
}
//删除常用取值
export function delXmValNewService(query:any){
return request({
url: '/xminfo/delXmValNew',
method: 'get',
params: query
})
}

View File

@ -0,0 +1,5 @@
// export function getArrayMaxXh(tableList: Array<any>) {
// return tableList.length > 0 ? Math.max(...tableList.map((item:any) => item.xh || 0)) : 0;
// }

View File

@ -75,7 +75,7 @@
<el-col :span="10" :xs="24">
<tabView :tabList="tabList" v-model:activeTab="activeTab" @update:active-tab="updateActive" />
<KeepAlive>
<component class="tabDiv" :is="activeTabN" :dataList="tabDataList" :formData="selectRow"></component>
<component class="tabDiv" ref="tableTabRef" :is="activeTabN" :dataList="tabDataList" :formData="selectRow" v-model="modelParam" @refreshTabData="rowChange"></component>
</KeepAlive>
</el-col>
</el-row>
@ -94,12 +94,13 @@ import Sort from './tab/Sort.vue'
import Parameter from './tab/Parameter.vue';
import ChannelNumber from './tab/ChannelNumber.vue';
import ReferenceValueDetails from './tab/ReferenceValueDetails.vue';
import { queryXmInfoNewService,queryXmInfoNewDetailService } from '@/api/liswork/labItem/labItemApi';
import { queryXmInfoNewService,queryXmInfoNewDetailService,saveDataService} from '@/api/liswork/labItem/labItemApi';
import SelectTable from '@/components/SelectTable/index.vue'
import { getGroupInstrdList } from '@/api/liswork/work/LisWork';
import tabView from '@/components/tabViews/index.vue';
import { LabInstr,XmInfoNew } from '@/types';
import { formatDict,getDictData,dictData } from '@/hooks';
import { ElMessage } from 'element-plus';
const xmlbList = ref<Array<any>>([
{ label: '数值型', value: '1' },
@ -200,6 +201,16 @@ const tabDataList = ref<any>([]);
const selectRow = ref();
//明细数据
const selectDetailRow = ref()
const tableTabRef = ref()
const modelParam = ref<any>({
basicData: {},
commonlyValuesData: [],
userInstrData: [],
commonDescriptionsData: [],
referenceValueDetailsData: []
})
// 仪器
const getYqConfig = () => {
@ -244,8 +255,20 @@ const handleDelCorr = () => {
}
//保存
const handleSave = () => {
console.log('保存')
const handleSave = async () => {
await saveDataService({
xmInfoNew: modelParam.value.basicData,
xmDoubleRows: [],
xmValRows: [],
xmInterRows: [],
xmRefRows: [],
xmTextResultRows: [],
xmValNewRows: modelParam.value.commonlyValuesData,
xmRefNewRows: modelParam.value.referenceValueDetailsData,
xmInfoVsRows: modelParam.value.userInstrData,
xmTextresultNewRows: modelParam.value.commonDescriptionsData
})
ElMessage.success('保存成功!')
}
//退拽属性
const handleColumnDragEnd = (data: any) => {
@ -279,22 +302,44 @@ const updateActive = () => {
const changeActiveTab = () => {
switch(activeTab.value){
case 'Basic':
tabDataList.value = selectDetailRow.value.xmInfoNewRows[0] || [];
if(selectDetailRow.value.xmInfoNew){
modelParam.value = toRaw(selectDetailRow.value.xmInfoNew || {});
// basicData.value = tableTabRef.value.basicData || []
}else{
//basicData.value = []
}
break;
case 'CommonlyValues':
tabDataList.value = selectDetailRow.value.xmValNewRows[0] || [];
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':
tabDataList.value = selectDetailRow.value.xmInfoVsRows[0] || [];
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':
tabDataList.value = selectDetailRow.value.xmTextresultNewRows[0] || [];
if(selectDetailRow.value.xmTextresultNewRows.length){
tabDataList.value = selectDetailRow.value.xmTextresultNewRows[0] || [];
}else{
tabDataList.value = []
}
break;
case 'ReferenceValueDetails':
tabDataList.value = selectDetailRow.value.xmRefNewRows[0] || [];
if(selectDetailRow.value.xmRefNewRows.length){
tabDataList.value = selectDetailRow.value.xmRefNewRows[0] || [];
}else{
tabDataList.value = []
}
break;
}
}

View File

@ -5,7 +5,7 @@
<el-button type="primary" @click="bClickAdd">增加</el-button>
<el-button type="primary" @click="bClickDel">删除</el-button>
</div>
<CustomTable ref="tableRef" :data="dataList" :columns="columns" :enable-column-drag="true" @column-drag-end="handleColumnDragEnd"
<CustomTable ref="tableRef" :data="tableList" :columns="columns" :enable-column-drag="true" @column-drag-end="handleColumnDragEnd"
:config="tableConfig" @row-click="handRowClick">
<template #qz = {row}>
<el-select v-model="row.qz" clearable allow-create filterable default-first-option>
@ -27,22 +27,21 @@
<script setup lang="ts">
import CustomTable from '@/components/elTable/index.vue'
import { dictData,getDictData } from '@/hooks';
import { DictData, XmValNew } from '@/types';
import { ElMessageBox } from 'element-plus';
import {delXmValNewService} from '@/api/liswork/labItem/labItemApi'
const props = defineProps({
dataList: {
type: Object,
default: []
},
formData: {
type: Object,
default: {}
}
});
const tableRef = ref<any>(null);
const dataList = ref<Array<XmValNew>>([]);
const modelParam = defineModel<any>()
const emit = defineEmits(['refreshTabData'])
const tableRef = ref<any>();
const tableList = ref<any>();
const columns = ref([
{ prop: 'qz', label: '取值', visible: true, align: 'center', slot:'qz', width: 200 },
{ prop: 'srm', label: '快速输入码', visible: true, align: 'center',slot: 'srm', width: 100 },
@ -64,27 +63,42 @@ const handleColumnDragEnd = (data: any) => {
columns.value = data.columns;
}
watch(
() => modelParam.value,
(newVal:any) => {
tableList.value = [...newVal.commonlyValuesData];
},
{ immediate: true, deep: true }
);
//序号最大值
const maxXh = computed(() => {
return tableList.value.length > 0 ? Math.max(...tableList.value.map((item:any) => item.xh || 0)) : 0;
});
const bClickAdd = () => {
const newData: XmValNew = {
const newData = {
xmid: props.formData.xmid,
qz: '',
srm: '',
jgbz: ''
jgbz: '',
xh: maxXh.value + 1
}
dataList.value?.push(newData);
tableList.value.push(newData);
}
const bClickDel = async () => {
await ElMessageBox.confirm('是否要删除选中的数据?','Warning',
{
confirmButtonText: 'OK',
cancelButtonText: 'Cancel',
type: 'warning',
}
);
if(selectRow.value){
await ElMessageBox.confirm('是否要删除选中的数据?','警告',
{confirmButtonText: '确定',cancelButtonText: '取消',type: 'warning'});
//删掉界面上面的数据
dataList.value = dataList.value?.filter(item => item.xh != selectRow.value.xh );
//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)
}
}
@ -97,6 +111,11 @@ onActivated(async ()=>{
await getDictData('VA','LF')
qzOptions.value = dictData.value.VA
jgbzOptions.value = dictData.value.LF
tableList.value = modelParam.value.commonlyValuesData || []
})
</script>
<style lang="scss" scoped>
</style>

View File

@ -45,7 +45,7 @@
<el-input placeholder="英文名称" v-model="formData.yymc"></el-input>
</el-form-item>
<el-form-item label="项目ID" prop="xmid">
<el-input placeholder="项目ID" v-model="formData.xmid"></el-input>
<el-input placeholder="项目ID" disabled v-model="formData.xmid"></el-input>
</el-form-item>
<el-form-item prop="uflag">
<el-checkbox value="uflag">停用</el-checkbox>
@ -171,6 +171,7 @@ const props = defineProps({
}
});
const modelParam = defineModel<any>()
const formRef = ref();
const formData = ref<any>({});
@ -248,10 +249,11 @@ const ygxbCheck = computed({
})
watch(
() => props.dataList,
() => modelParam.value,
(newVal:any) => {
formData.value = newVal;
}
formData.value = {...newVal };
},
{ immediate: true,deep: true }
);
//多行参考值
@ -290,7 +292,6 @@ onActivated(async () => {
await getDictData('XMGL');
})
</script>

View File

@ -90,6 +90,9 @@ watch(
}
);
defineExpose({
commonDescriptionsData: tableList
})
</script>

View File

@ -208,6 +208,10 @@ onActivated( async ()=>{
optionsSLZQ.value = dictData.value.SLZQ || []
})
defineExpose({
referenceValueDetailsData: dataListUp
})
</script>

View File

@ -117,4 +117,9 @@ const onRowClick = (row: any) => {
onActivated(() =>{
yqList.value = Array.isArray(props.dataList) ? props.dataList : [];
})
defineExpose({
userInstrData: yqList
})
</script>