复查结果
This commit is contained in:
parent
72dcbd0ff6
commit
1603aee96c
@ -1,7 +1,8 @@
|
||||
<!--仪器组件的封装-->
|
||||
<template>
|
||||
<SelectTable v-model:data="modelValue" :fields="props.fields" :tableData="instrOptions" label="yqmc" size="small"
|
||||
value="yq" objKey="yq" :border="true" :width="props.width" placeholder="请选择仪器" :clearable="false" @getDataValue="getDataValue" />
|
||||
<SelectTable v-model:data="modelValue" :fields="fields" :tableData="instrOptions" label="yqmc" :size="props.size"
|
||||
value="yq" objKey="yq" :border="true" :width="props.width" placeholder="请选择仪器" :clearable="props.clearable"
|
||||
@getDataValue="getDataValue" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
@ -10,38 +11,37 @@ import { getGroupInstrdList } from '@/api/liswork/work/LisWork';
|
||||
import { Emits, Props, Field } from '@/types';
|
||||
import { ref, watch, onMounted } from 'vue';
|
||||
|
||||
|
||||
const modelValue = ref<string | null>('');
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
placeholder: "请选择",
|
||||
size: "default",
|
||||
isHighlight: true,
|
||||
value: undefined,
|
||||
label: undefined,
|
||||
border: false,
|
||||
width: "100%",
|
||||
dictType: '',
|
||||
clearable: true,
|
||||
fields: () => [
|
||||
{ prop: 'yq', label: '代号', width: 80, enablePinyinSearch: true },
|
||||
{ prop: 'yqmc', label: '名称', width: 150, enablePinyinSearch: true },
|
||||
] as Field[]
|
||||
});
|
||||
const props = withDefaults(defineProps<{
|
||||
width?: string | number,
|
||||
size?: string,
|
||||
clearable?: boolean,
|
||||
instrGroup?: string | number, //部门组代号
|
||||
data: string
|
||||
}>(), {
|
||||
width: '100%',
|
||||
size: 'default',
|
||||
clearable: false
|
||||
})
|
||||
|
||||
const instrOptions = ref<Array<{ yq: string; yqmc: string }>>([]);
|
||||
|
||||
const fields = ref(
|
||||
[
|
||||
{ prop: 'yq', label: '代号', width: 80, enablePinyinSearch: true },
|
||||
{ prop: 'yqmc', label: '名称', width: 150, enablePinyinSearch: true },
|
||||
]
|
||||
)
|
||||
const emits = defineEmits<Emits>();
|
||||
|
||||
// 当父组件使用 v-model:data 绑定时,props.data 代表父传入的值。
|
||||
// 需要将其同步到内部的 modelValue,以便 SelectTable 的 v-model:data 能正确反向绑定。
|
||||
watch(() => props.data, (newVal) => {
|
||||
// 仅当内部值与外部值不一致时进行同步,避免不必要覆盖用户交互时的临时值。
|
||||
if (newVal !== modelValue.value) {
|
||||
modelValue.value = newVal ?? '';
|
||||
}
|
||||
});
|
||||
|
||||
const getYqConfig = () => {
|
||||
getGroupInstrdList()
|
||||
const data = {
|
||||
lisgroup: props.instrGroup
|
||||
}
|
||||
getGroupInstrdList(data)
|
||||
.then((res: any) => {
|
||||
if (res.code == 0) {
|
||||
instrOptions.value = res.data.map((item: any) => ({
|
||||
@ -53,48 +53,16 @@ const getYqConfig = () => {
|
||||
}
|
||||
|
||||
const getDataValue = (val: any) => {
|
||||
emits('update:data', val.yq);
|
||||
emits('getDataValue', val);
|
||||
};
|
||||
|
||||
const handleDataEcho = (val: any) => {
|
||||
// if (modelValue.value === null || modelValue.value === undefined) {
|
||||
// modelValue.value = '';
|
||||
// emits('update:data', null);
|
||||
// return;
|
||||
// }
|
||||
// const matchedInstr = instrOptions.value.find(item => item.yq === modelValue.value);
|
||||
// if (matchedInstr) {
|
||||
// emits('update:data', matchedInstr.yq);
|
||||
// } else {
|
||||
// emits('update:data', '');
|
||||
// }
|
||||
emits('update:data', val);
|
||||
|
||||
};
|
||||
|
||||
// 监听表格数据和字典类型变化
|
||||
watch(() => instrOptions, (newVal) => {
|
||||
if (newVal) {
|
||||
handleDataEcho(newVal);
|
||||
}
|
||||
}, { deep: true });
|
||||
|
||||
// 监听绑定值数据变化,重新处理
|
||||
watch(() => modelValue, (newVal) => {
|
||||
if (newVal) {
|
||||
// 数据回显
|
||||
handleDataEcho(newVal);
|
||||
}
|
||||
|
||||
}, { deep: true });
|
||||
|
||||
|
||||
onMounted(() => {
|
||||
getYqConfig();
|
||||
// 初始化时同步一次父级值(如果有)到内部 modelValue
|
||||
if (props.data !== undefined && props.data !== null) {
|
||||
modelValue.value = props.data as any;
|
||||
}
|
||||
getYqConfig();
|
||||
});
|
||||
|
||||
|
||||
|
||||
@ -58,15 +58,17 @@
|
||||
</ContextMenu>
|
||||
|
||||
|
||||
<el-dialog v-model="show" title="标准结果作为某标本复查结果" width="300" :close-on-click-modal="false" :draggable="true"
|
||||
<el-dialog v-model="show" title="操作" width="300" :close-on-click-modal="false" :draggable="true"
|
||||
@close="closeHandle">
|
||||
<div>
|
||||
仪器:
|
||||
<yqSelectTable v-model:data="tableKey.yq" width="200px" />
|
||||
<div>请输入复查的样本号:</div>
|
||||
<div class="form-box">
|
||||
<div class="item">
|
||||
<span>仪器:</span>
|
||||
<yqSelectTable v-model:data="tableKey.yq" :instrGroup="tableKey.instrGroup" />
|
||||
</div>
|
||||
<div class="mt10">请输入复查的样本号:</div>
|
||||
<el-input v-model="fcYbh" />
|
||||
</div>
|
||||
<div style="text-align: center; width: 100%;">
|
||||
<div class="mt10" style="text-align: center; width: 100%;">
|
||||
<el-button type="primary" @click="subHandle()"> 确认 </el-button>
|
||||
<el-button @click="closeHandle">取消</el-button>
|
||||
</div>
|
||||
@ -80,6 +82,7 @@ import CommonTable from '@/components/vxeTable/index.vue'
|
||||
import ContextMenu from "@/components/contextMenu/index.vue";
|
||||
import { ContextMenuItem } from '@/types/index'
|
||||
import yqSelectTable from '@/components/SelectTable/YQSelectTable/index.vue'
|
||||
import { ElMessage } from 'element-plus';
|
||||
const props = defineProps({
|
||||
labPatList: {
|
||||
type: Array,
|
||||
@ -104,8 +107,15 @@ const show = ref(false)
|
||||
|
||||
const fcYbh = ref('')
|
||||
const subHandle = () => {
|
||||
if (!fcYbh.value.trim()) return ElMessage.warning('请输入复查的样本号')
|
||||
const data = {
|
||||
fcYbh: fcYbh.value,
|
||||
...props.tableKey
|
||||
}
|
||||
console.log('data==>', data);
|
||||
}
|
||||
const closeHandle = () => {
|
||||
fcYbh.value = ''
|
||||
show.value = false
|
||||
}
|
||||
|
||||
@ -113,7 +123,6 @@ const contextMenuItems = computed<ContextMenuItem[]>(() => [
|
||||
{ label: '标准结果作为某标本复查结果', action: 'view' }
|
||||
]);
|
||||
const handleMenuSelect = ((item: ContextMenuItem) => {
|
||||
console.log('item==>', item);
|
||||
show.value = true
|
||||
})
|
||||
// 表格列配置
|
||||
@ -214,5 +223,21 @@ defineExpose({
|
||||
<style lang="scss" scoped>
|
||||
.table-container {
|
||||
height: 76vh;
|
||||
|
||||
.form-box {
|
||||
font-family: SourceHanSansCN, SourceHanSansCN;
|
||||
|
||||
.item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
span {
|
||||
display: inline-block;
|
||||
width: 3.75rem;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</style>
|
||||
Loading…
x
Reference in New Issue
Block a user