Merge branch 'main' of http://47.97.125.165:8902/jiangs/lis8.0-vue3
This commit is contained in:
commit
d99aa6377d
52
src/App.vue
52
src/App.vue
@ -1,9 +1,5 @@
|
||||
<template>
|
||||
<!-- <div class="app-container" ref="appContainer">
|
||||
<div class="app-content"> -->
|
||||
<router-view />
|
||||
<!-- </div>
|
||||
</div> -->
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
@ -11,59 +7,15 @@ import useSettingsStore from '@/store/modules/settings'
|
||||
import { handleThemeStyle } from '@/utils/theme'
|
||||
import { ref, onMounted, onUnmounted, nextTick } from 'vue';
|
||||
|
||||
const appContainer = ref(null);
|
||||
const appContent = ref(null);
|
||||
|
||||
// 设计稿基准尺寸
|
||||
const baseWidth = 1620;
|
||||
const baseHeight = 680;
|
||||
|
||||
// 计算缩放比例并应用
|
||||
const calcScale = () => {
|
||||
if (!appContent.value) return;
|
||||
|
||||
// 当前窗口尺寸
|
||||
const clientWidth = window.innerWidth;
|
||||
const clientHeight = window.innerHeight;
|
||||
|
||||
// 计算宽高方向的缩放比例(取最小值,避免内容溢出)
|
||||
const scaleX = clientWidth / baseWidth;
|
||||
const scaleY = clientHeight / baseHeight;
|
||||
const scale = Math.min(scaleX, scaleY);
|
||||
|
||||
// 应用缩放
|
||||
appContent.value.style.transform = `scale(${scale})`;
|
||||
};
|
||||
onMounted(() => {
|
||||
calcScale(); // 初始化
|
||||
window.addEventListener('resize', calcScale);
|
||||
nextTick(() => {
|
||||
// 初始化主题样式
|
||||
handleThemeStyle(useSettingsStore().theme)
|
||||
})
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
window.removeEventListener('resize', calcScale);
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.app-container {
|
||||
/* 占满整个窗口 */
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
/* 避免缩放后出现滚动条 */
|
||||
}
|
||||
|
||||
.app-content {
|
||||
/* 设计稿基准尺寸 */
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
margin: 0 auto;
|
||||
/* 水平居中 */
|
||||
transform-origin: top center;
|
||||
/* 缩放原点(避免偏移) */
|
||||
}
|
||||
</style>
|
||||
<style lang="scss" scoped></style>
|
||||
|
||||
@ -282,6 +282,30 @@ export function redoResult(query?: Object) {
|
||||
params: query
|
||||
})
|
||||
}
|
||||
// 保存复查结果
|
||||
export function saveRedo(query?: Object) {
|
||||
return request({
|
||||
url: '/lisworkpageinfo/saveredo',
|
||||
method: 'post',
|
||||
data: query
|
||||
})
|
||||
}
|
||||
// 交换复查结果
|
||||
export function swapRedo(query?: Object) {
|
||||
return request({
|
||||
url: '/lisworkpageinfo/swapredo',
|
||||
method: 'post',
|
||||
data: query
|
||||
})
|
||||
}
|
||||
// 删除复查结果
|
||||
export function delRedo(query?: Object) {
|
||||
return request({
|
||||
url: '/lisworkpageinfo/deleteRedo',
|
||||
method: 'post',
|
||||
data: query
|
||||
})
|
||||
}
|
||||
// 仪器组可操作仪器查询
|
||||
export function getGroupInstrdList(query?: Object) {
|
||||
return request({
|
||||
@ -298,5 +322,13 @@ export function getresultchangelog(query?: Object) {
|
||||
params: query
|
||||
})
|
||||
}
|
||||
// 获取临床意义
|
||||
export function clinicInfo(query?: Object) {
|
||||
return request({
|
||||
url: '/lisworkpageinfo/clinicref',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -12,6 +12,11 @@ import 'vxe-pc-ui/lib/style.css'
|
||||
import VXETable from 'vxe-table'
|
||||
import 'vxe-table/lib/style.css'
|
||||
import '@/assets/styles/index.scss' // global css
|
||||
|
||||
import {
|
||||
setupRem
|
||||
} from './utils/rem';
|
||||
setupRem(); // 初始化rem适配
|
||||
// 先导入 jQuery 并设置全局变量
|
||||
|
||||
// import * as $ from 'jquery';
|
||||
|
||||
@ -106,7 +106,50 @@ function base64ToBlob(base64: string) {
|
||||
|
||||
|
||||
|
||||
import { ref, onMounted, onUnmounted, Ref } from 'vue';
|
||||
|
||||
/**
|
||||
* 自动根据屏幕分辨率切换按钮尺寸(small/default)
|
||||
* @returns 按钮尺寸的响应式ref
|
||||
*/
|
||||
function useAutoSize() {
|
||||
const autoSize = ref<'small' | 'default'>('default');
|
||||
console.log('333==>', 333);
|
||||
// 防抖函数,避免频繁触发
|
||||
const debounce = (fn: Function, delay: number) => {
|
||||
let timer: number;
|
||||
return (...args: any[]) => {
|
||||
clearTimeout(timer);
|
||||
timer = setTimeout(() => fn.apply(null, args), delay);
|
||||
};
|
||||
};
|
||||
|
||||
export const classCom = { decimalToHexColor, convertHexToNumber, getContrastTextColor, printBase64PDF, printPDF }
|
||||
const calculateSize = () => {
|
||||
const screenWidth = window.innerWidth || document.documentElement.clientWidth;
|
||||
console.log('screenWidth==>', screenWidth);
|
||||
autoSize.value = screenWidth < 1600 ? 'small' : 'default';
|
||||
};
|
||||
|
||||
// 防抖版本的计算函数
|
||||
const debouncedCalculateSize = debounce(calculateSize, 100);
|
||||
|
||||
onMounted(() => {
|
||||
calculateSize();
|
||||
// 添加防抖的resize监听
|
||||
window.addEventListener('resize', debouncedCalculateSize);
|
||||
|
||||
// 在组件实例上存储清理函数
|
||||
(autoSize as any)._cleanup = () => {
|
||||
window.removeEventListener('resize', debouncedCalculateSize);
|
||||
};
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
const cleanup = (autoSize as any)._cleanup;
|
||||
if (cleanup) cleanup();
|
||||
});
|
||||
|
||||
return autoSize;
|
||||
}
|
||||
|
||||
export const classCom = { decimalToHexColor, convertHexToNumber, getContrastTextColor, printBase64PDF, printPDF, useAutoSize }
|
||||
|
||||
@ -1,5 +1,30 @@
|
||||
// utils/mitt.ts
|
||||
import mitt from "mitt"
|
||||
const emitter = mitt()
|
||||
|
||||
import mitt, { Emitter, EventType } from "mitt"
|
||||
|
||||
// 扩展原始Emitter类型,添加自定义方法
|
||||
interface CustomEmitter extends Emitter<Record<EventType, unknown>> {
|
||||
emitWithCache?: (eventName: string, data: any) => void
|
||||
getCache?: (eventName: string) => any
|
||||
}
|
||||
|
||||
const emitter = mitt() as CustomEmitter
|
||||
|
||||
// 全局缓存:key为事件名,value为最新的事件数据
|
||||
const eventCache = new Map<string, any>()
|
||||
|
||||
// 触发事件时自动缓存数据
|
||||
emitter.emitWithCache = (eventName: string, data: any) => {
|
||||
// 缓存数据(覆盖旧数据,只保留最新一次)
|
||||
eventCache.set(eventName, data)
|
||||
// 正常触发事件(供已挂载的组件监听)
|
||||
emitter.emit(eventName, data)
|
||||
}
|
||||
|
||||
// 获取并清除缓存(避免重复处理)
|
||||
emitter.getCache = (eventName: string) => {
|
||||
const data = eventCache.get(eventName)
|
||||
eventCache.delete(eventName) // 取出后删除,确保只处理一次
|
||||
return data
|
||||
}
|
||||
|
||||
export default emitter
|
||||
22
src/utils/rem.ts
Normal file
22
src/utils/rem.ts
Normal file
@ -0,0 +1,22 @@
|
||||
// src/utils/rem.ts
|
||||
export const setupRem = () => {
|
||||
const baseDesignWidth = 1920; // 设计稿宽度
|
||||
const baseFontSize = 16; // 设计稿对应根字体大小(1rem = 16px)
|
||||
const minWidth = 1280; // 最小支持宽度(避免过小屏幕错乱)
|
||||
|
||||
const updateRem = () => {
|
||||
// 获取当前屏幕宽度(取可视区域宽度)
|
||||
const clientWidth = document.documentElement.clientWidth || window.innerWidth;
|
||||
// 限制最小宽度
|
||||
const actualWidth = Math.max(clientWidth, minWidth);
|
||||
// 计算当前根字体大小(按比例缩放)
|
||||
const currentFontSize = (actualWidth / baseDesignWidth) * baseFontSize;
|
||||
// 设置到 html 元素
|
||||
document.documentElement.style.fontSize = `${currentFontSize.toFixed(2)}px`;
|
||||
};
|
||||
|
||||
// 初始化计算
|
||||
updateRem();
|
||||
// 监听窗口尺寸变化,实时更新
|
||||
window.addEventListener('resize', updateRem);
|
||||
};
|
||||
@ -1,10 +1,38 @@
|
||||
<template>
|
||||
<div class="clinical_box">
|
||||
<!-- 临床意义 -->
|
||||
<div class="info-text" v-html="info"></div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, watch, toRaw, onUnmounted, onMounted } from 'vue'
|
||||
import { clinicInfo } from '@/api/liswork/work/LisWork';
|
||||
import emitter from '@/utils/mitt';
|
||||
const info = ref('')
|
||||
const getClinicalInfo = (data: any) => {
|
||||
clinicInfo(data).then((res: any) => {
|
||||
if (res.code == 0) {
|
||||
console.log('临床意义==>', res.data);
|
||||
info.value = res.data
|
||||
}
|
||||
})
|
||||
}
|
||||
onMounted(() => {
|
||||
// 1. 组件挂载后,先检查缓存中是否有数据
|
||||
const cachedData = emitter.getCache?.('refreshClinical');
|
||||
if (cachedData) {
|
||||
getClinicalInfo(cachedData); // 补触发缓存的数据
|
||||
}
|
||||
|
||||
emitter.on('refreshClinical', (data) => {
|
||||
getClinicalInfo(data)
|
||||
})
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
emitter.off('refreshClinical'); // 移除监听
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
@ -13,4 +41,13 @@
|
||||
height: 82vh;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.info-text {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
padding: 10px;
|
||||
text-indent: 2rem;
|
||||
color: #2b2a2a;
|
||||
font-family: SourceHanSansCN, SourceHanSansCN;
|
||||
}
|
||||
</style>
|
||||
@ -1,9 +1,9 @@
|
||||
<template>
|
||||
<div class="labpat_box">
|
||||
<div class="flex-between mb5">
|
||||
<el-input v-model="sqhValue" placeholder="条码号" ref="sqhRef" class="mr10" style="width:100%"
|
||||
<el-input v-model="sqhValue" placeholder="条码号" ref="sqhRef" :size="aotuSize" class="mr10" style="width:100%"
|
||||
@keyup.enter="handleInputFocus" />
|
||||
<el-button type="primary">打印条码</el-button>
|
||||
<el-button type="primary" :size="aotuSize">打印条码</el-button>
|
||||
</div>
|
||||
<el-form :model="labPat" label-width="70px" class="compact-form" label-position="right">
|
||||
<div :class="['sh_box', getColor(lastJgbz)]" v-if="lastJgbz != null && lastJgbz != 0 && lastJgbz != 'C'">
|
||||
@ -116,7 +116,8 @@ import SelectTable from '@/components/SelectTable/index.vue';
|
||||
import { listUser } from '@/api/system/user.js'
|
||||
import { PropType } from 'vue';
|
||||
import emitter from '@/utils/mitt';
|
||||
|
||||
import { classCom } from '@/utils/classCom';
|
||||
const aotuSize = classCom.useAutoSize();
|
||||
interface LabSysItem {
|
||||
kj: string;
|
||||
dict: string;
|
||||
@ -501,11 +502,6 @@ onMounted(() => {
|
||||
|
||||
|
||||
|
||||
.flex-between {
|
||||
height: 32px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.sh_box {
|
||||
position: absolute;
|
||||
|
||||
@ -2,17 +2,17 @@
|
||||
<div class="result-container">
|
||||
<div class="flex-between mb10">
|
||||
<div>
|
||||
<el-button class="btn_green" @click="handleCheck(1)">初审</el-button>
|
||||
<el-button class="btn_green" v-if="labPat.jgbz != 2" @click="handleCheck(2)">审核</el-button>
|
||||
<el-button class="btn_green" v-if="labPat.jgbz == 2" @click="handleCheck(3)">取消审核</el-button>
|
||||
<el-button type="primary" plain :disabled="labPat.jgbz != null && labPat.jgbz != 0"
|
||||
<el-button class="btn_green" :size="aotuSize" @click="handleCheck(1)">初审</el-button>
|
||||
<el-button class="btn_green" :size="aotuSize" v-if="labPat.jgbz != 2" @click="handleCheck(2)">审核</el-button>
|
||||
<el-button class="btn_green" :size="aotuSize" v-if="labPat.jgbz == 2" @click="handleCheck(3)">取消审核</el-button>
|
||||
<el-button type="primary" :size="aotuSize" plain :disabled="labPat.jgbz != null && labPat.jgbz != 0"
|
||||
@click="openItemDictDialog">新增</el-button>
|
||||
<el-button type="primary" :disabled="labPat.jgbz != null && labPat.jgbz != 0" plain
|
||||
<el-button type="primary" :size="aotuSize" :disabled="labPat.jgbz != null && labPat.jgbz != 0" plain
|
||||
@click="handleBatchDelete">删除</el-button>
|
||||
</div>
|
||||
<div>
|
||||
<el-button type="primary" plain icon="Files" @click="printHandle">打印</el-button>
|
||||
<el-button type="primary" plain icon="View" @click="previewHandle">预览</el-button>
|
||||
<el-button type="primary" plain icon="Files" :size="aotuSize" @click="printHandle">打印</el-button>
|
||||
<el-button type="primary" plain icon="View" :size="aotuSize" @click="previewHandle">预览</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -173,7 +173,6 @@ import dayjs from 'dayjs';
|
||||
import { listUser } from '@/api/system/user.js'
|
||||
import emitter from "@/utils/mitt";
|
||||
import { useCommonStore } from "@/store/modules/commonStore";
|
||||
import { set } from "@vueuse/core";
|
||||
|
||||
// 组件属性定义
|
||||
const props = defineProps({
|
||||
@ -190,6 +189,7 @@ const { tableData, tableKey, } = toRefs(props);
|
||||
const selectedRows = ref([]);
|
||||
const lastjyrq = ref('');
|
||||
const mbStore = useCommonStore();
|
||||
const aotuSize = classCom.useAutoSize();
|
||||
|
||||
watch(() => props.tableData, (newVal) => {
|
||||
selectedRows.value = [];
|
||||
@ -380,63 +380,31 @@ const selectedItemLabel = ref(""); // 选择的项目名称xmmc
|
||||
const labResuts = ref([])
|
||||
const tableRef = ref();
|
||||
const fetchLabItemDict = async (dictType) => {
|
||||
// 日志1:确认方法被调用
|
||||
try {
|
||||
// 1. 验证必要参数(如当前仪器yq)
|
||||
if (!tableKey.value.yq) {
|
||||
console.error("[fetchLabItemDict] 缺少必要参数:yq(仪器)");
|
||||
ElMessage.error("请先选择仪器");
|
||||
return [];
|
||||
}
|
||||
|
||||
// 日志2:打印请求参数
|
||||
const requestParams = {
|
||||
pageNum: 1,
|
||||
pageSize: 1000, // 加载足够多的项目
|
||||
yq: tableKey.value.yq, // 当前选中的仪器
|
||||
};
|
||||
|
||||
// 2. 调用API(确保queryXmInfo是正确的API方法)
|
||||
const response = await queryXmInfo(requestParams);
|
||||
|
||||
// 日志3:打印原始响应
|
||||
|
||||
// 3. 验证响应格式
|
||||
if (!response) {
|
||||
throw new Error("API返回为空");
|
||||
}
|
||||
if (response.code !== "0") { // 假设0为成功状态码
|
||||
throw new Error(`API返回错误:${response.msg || "未知错误"}`);
|
||||
}
|
||||
if (!Array.isArray(response.data)) {
|
||||
throw new Error(`API返回data不是数组,实际为:${typeof response.data}`);
|
||||
}
|
||||
|
||||
// 4. 格式化数据(适配DictInput的{value, label}结构)
|
||||
const formattedData = response.data.map((item, index) => {
|
||||
// 验证项目数据完整性
|
||||
if (!item.xmdh) {
|
||||
console.warn(`[fetchLabItemDict] 第${index}条数据缺少xmdh(项目编码):`, item);
|
||||
}
|
||||
if (!item.xmmc) {
|
||||
console.warn(`[fetchLabItemDict] 第${index}条数据缺少xmmc(项目名称):`, item);
|
||||
}
|
||||
|
||||
return {
|
||||
value: item.xmdh || `未知编码_${index}`, // 确保value存在
|
||||
label: item.xmmc || `未知名称_${index}`, // 确保label存在
|
||||
dw: item.dw || "", // 单位(可选)
|
||||
refs: item.refs || "", // 参考值(可选)
|
||||
dw: item.dw || "",
|
||||
refs: item.refs || "",
|
||||
};
|
||||
});
|
||||
|
||||
// 日志4:打印格式化后的数据量
|
||||
return formattedData;
|
||||
|
||||
} catch (error) {
|
||||
// 日志5:捕获并显示错误
|
||||
console.error(`[fetchLabItemDict] 加载失败:`, error.message);
|
||||
ElMessage.error(`项目字典加载失败:${error.message}`);
|
||||
return []; // 失败时返回空数组,避免弹窗报错
|
||||
}
|
||||
};
|
||||
@ -671,6 +639,7 @@ const handleCsjgEnter = async (row) => {
|
||||
*/
|
||||
const handleRowClick = (row) => {
|
||||
selectedRows.value = [row];
|
||||
emitter.emitWithCache('refreshClinical', row);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -875,7 +844,8 @@ const formatYs = (v) => {
|
||||
}
|
||||
|
||||
.flex-between {
|
||||
height: 32px;
|
||||
// height: 32px;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.custom-table-container {
|
||||
|
||||
@ -3,25 +3,39 @@
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="13">
|
||||
<div class="box-shadow">
|
||||
<el-form :model="queryParams" ref="queryRef" :inline="true" :rules="rules" class="compact-form">
|
||||
<el-form-item label="样本号:" prop="ybh">
|
||||
<el-input v-model="queryParams.ybh" placeholder="样本编号" @keyup.enter="handleQuery" style="width:160px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="日期:" prop="jyrq">
|
||||
<el-date-picker v-model="queryParams.jyrq" type="date" label-width="20px" placeholder="检验日期"
|
||||
value-format="YYYY-MM-DD" :clearable="false" @change="fetchlabPatList"
|
||||
style="width:140px"></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="部门:" prop="instrGroup">
|
||||
<SelectTable v-model:data="queryParams.instrGroup" :fields="instrGroupFields"
|
||||
:tableData="instrGroupOptions" label="zdmc" value="zddh" objKey="zddh" :border="true" width="140px"
|
||||
placeholder="请选择部门" @getDataValue="handleinstrGroupChange" :clearable="false" />
|
||||
</el-form-item>
|
||||
<el-form-item label="仪器:" prop="yq">
|
||||
<SelectTable v-model:data="queryParams.yq" :fields="yqFields" :tableData="instrOptions" label="yqmc"
|
||||
value="yq" objKey="yq" :border="true" width="140px" placeholder="请选择仪器" :clearable="false"
|
||||
@getDataValue="yqHandleChange" />
|
||||
</el-form-item>
|
||||
<el-form :model="queryParams" ref="queryRef" :inline="true" :size="aotuSize" :rules="rules"
|
||||
class="compact-form">
|
||||
<el-row :gutter="5">
|
||||
<el-col :span="6">
|
||||
<el-form-item label="样本号:" prop="ybh">
|
||||
<el-input v-model="queryParams.ybh" placeholder="样本编号" @keyup.enter="handleQuery"
|
||||
style="width:100%" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="日期:" prop="jyrq">
|
||||
<el-date-picker v-model="queryParams.jyrq" type="date" label-width="20px" placeholder="检验日期"
|
||||
value-format="YYYY-MM-DD" :clearable="false" @change="fetchlabPatList"
|
||||
style="width:100%"></el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="部门:" prop="instrGroup">
|
||||
<SelectTable v-model:data="queryParams.instrGroup" :fields="instrGroupFields"
|
||||
:tableData="instrGroupOptions" label="zdmc" value="zddh" objKey="zddh" :border="true" width="9rem"
|
||||
placeholder="请选择部门" @getDataValue="handleinstrGroupChange" :clearable="false" :size="aotuSize" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="仪器:" prop="yq">
|
||||
<SelectTable v-model:data="queryParams.yq" :fields="yqFields" :tableData="instrOptions" label="yqmc"
|
||||
value="yq" objKey="yq" :border="true" width="9rem" placeholder="请选择仪器" :clearable="false"
|
||||
:size="aotuSize" @getDataValue="yqHandleChange" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
|
||||
<!-- <el-form-item>
|
||||
<el-icon color="#3c80d9" size="20" style="margin-right: 10px;" class="cp">
|
||||
<Search @click="fetchlabPatList" />
|
||||
@ -52,17 +66,18 @@
|
||||
<template v-if="activeTab == 1">
|
||||
<div class="flex-between mb10">
|
||||
<div>
|
||||
<el-button type="primary" icon="RefreshRight" @click="fetchlabPatList">刷新</el-button>
|
||||
<el-button type="danger" icon="delete" @click="delSampleHd">删除</el-button>
|
||||
<el-button class="btn_green" icon="top" @click="handlePrev">上一个</el-button>
|
||||
<el-button class="btn_green" icon="bottom" @click="handleNext">下一个</el-button>
|
||||
<el-select placeholder="所有" style="width: 150px" class="ml10">
|
||||
<el-button type="primary" :size="aotuSize" icon="RefreshRight" @click="fetchlabPatList">刷新</el-button>
|
||||
<el-button type="danger" :size="aotuSize" @click="delSampleHd">删除</el-button>
|
||||
<el-button class="btn_green" :size="aotuSize" icon="top" @click="handlePrev">上一个</el-button>
|
||||
<el-button class="btn_green" :size="aotuSize" icon="bottom" @click="handleNext">下一个</el-button>
|
||||
<el-select placeholder="所有" :size="aotuSize" style="width: 8rem" class="ml5">
|
||||
<el-option label="option" value="item.value" />
|
||||
</el-select>
|
||||
<el-input clearable @keyup.enter="handleQuery" @clear="handleQuery" style="width:100px" />
|
||||
<el-input clearable :size="aotuSize" @keyup.enter="handleQuery" @clear="handleQuery"
|
||||
style="width: 6rem" />
|
||||
</div>
|
||||
<div>
|
||||
<el-checkbox v-model="lbFlag"> 列表翻页 </el-checkbox>
|
||||
<el-checkbox v-model="lbFlag" :size="aotuSize"> 列表翻页 </el-checkbox>
|
||||
</div>
|
||||
</div>
|
||||
<LabPatList ref="labPatListRef" :labPatList="labPatList" :loading="loading" @select="selectJob"
|
||||
@ -85,7 +100,7 @@
|
||||
</template>
|
||||
<!-- 结果复查 -->
|
||||
<template v-if="activeTab == 4">
|
||||
<Reexamination :queryParams="queryParams" />
|
||||
<Reexamination :queryParams="queryParams" @fetchResults="fetchLabResults" />
|
||||
</template>
|
||||
<!-- 收费信息 -->
|
||||
<template v-if="activeTab == 5">
|
||||
@ -143,6 +158,8 @@ import Sample from './sample/index.vue'
|
||||
import ResultGraph from './resultGraph/index.vue'
|
||||
import { getNextNumber, getPreviousNumber } from "@/utils/getNextNumber";
|
||||
import { useCommonStore } from '@/store/modules/commonStore';
|
||||
import { classCom } from '@/utils/classCom';
|
||||
const aotuSize = classCom.useAutoSize();
|
||||
|
||||
|
||||
const previewShow = ref(false);
|
||||
@ -527,6 +544,7 @@ const getSysList = () => {
|
||||
mbStore.setLxsrList([]);
|
||||
}
|
||||
getSysList()
|
||||
|
||||
onMounted(async () => {
|
||||
// 加载病人来源字典
|
||||
const dictRefs = await comDict('PT', 'AU', 'SX', 'DP', 'BT', 'SRD', 'HOS', 'ST');
|
||||
@ -542,14 +560,12 @@ onMounted(async () => {
|
||||
HOS: toRaw(dictRefs.HOS.value) || [],
|
||||
ST: toRaw(dictRefs.ST.value) || [],
|
||||
};
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.app-container {
|
||||
background: #F0F3F8;
|
||||
|
||||
}
|
||||
|
||||
.box-shadow {
|
||||
@ -561,11 +577,15 @@ onMounted(async () => {
|
||||
|
||||
.compact-form {
|
||||
border-bottom: 1px solid #E1E9F7;
|
||||
margin-bottom: 10px;
|
||||
margin-bottom: 0.5rem;
|
||||
|
||||
.el-form-item--default {
|
||||
margin-bottom: 5px !important;
|
||||
}
|
||||
|
||||
.el-form-item--small {
|
||||
margin-bottom: 5px !important;
|
||||
}
|
||||
}
|
||||
|
||||
.card-content {
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
<template>
|
||||
<div class="reex_box">
|
||||
<div class="mb10">
|
||||
<el-button type="primary" plain>新增</el-button>
|
||||
<el-button type="primary" plain>保存</el-button>
|
||||
<el-button type="primary" plain @click="openItemDictDialog">新增</el-button>
|
||||
</div>
|
||||
<!-- 结果复查 -->
|
||||
<el-table ref="tableRef" :data="tableData" style="width: 100%" border height="77vh" show-overflow-tooltip>
|
||||
@ -13,19 +12,26 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="150">
|
||||
<template #default>
|
||||
<el-button type="primary" link size="small"> 删除 </el-button>
|
||||
<el-button type="primary" link size="small">交换</el-button>
|
||||
<template #default="{ row }">
|
||||
<el-button type="primary" link size="small" @click="deleteRedo(row)"> 删除 </el-button>
|
||||
<el-button type="primary" link size="small" @click="jhRedo(row)">交换</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 新增明细 -->
|
||||
<ItemInput ref="itemDictRef" v-model="selectedItemValue" :label-value.sync="selectedItemLabel"
|
||||
:dict-type="'LAB_ITEM'" :fetch-dict="fetchLabItemDict" :dialog-title="'选择检验项目'" :disabled="false"
|
||||
:load-on-mount="false" :table-data.sync="labResuts" class="hidden-dict-input" @select="handleItemSelect" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, watch, toRefs, onMounted, computed } from 'vue'
|
||||
import { redoResult } from "@/api/liswork/work/LisWork";
|
||||
|
||||
import { ref, watch, toRefs, onMounted, nextTick } from 'vue'
|
||||
import { redoResult, queryXmInfo, saveRedo, swapRedo, delRedo } from "@/api/liswork/work/LisWork";
|
||||
import { ElMessage } from 'element-plus'
|
||||
// @ts-ignore
|
||||
import ItemInput from '../components/ItemInput.vue'
|
||||
|
||||
const props = defineProps({
|
||||
// 主键
|
||||
@ -33,13 +39,11 @@ const props = defineProps({
|
||||
type: Object,
|
||||
default: {}
|
||||
},
|
||||
|
||||
|
||||
})
|
||||
|
||||
// 解构 props
|
||||
const { queryParams } = toRefs(props);
|
||||
const tableData = ref([]);
|
||||
const tableData: any = ref([]);
|
||||
const getReexamination = () => {
|
||||
redoResult(queryParams.value).then((res: any) => {
|
||||
if (res.code == 0) {
|
||||
@ -52,8 +56,138 @@ watch(() => queryParams.value, () => {
|
||||
getReexamination();
|
||||
}, { immediate: true })
|
||||
|
||||
const tableRef = ref();
|
||||
const itemDictRef = ref(); // DictInput组件引用
|
||||
const selectedItemValue = ref(""); // 选择的项目编码xmdh
|
||||
const labResuts = ref([])
|
||||
const selectedItemLabel = ref(""); // 选择的项目名称xmmc
|
||||
|
||||
|
||||
// 事件定义
|
||||
const emits = defineEmits(['fetchResults',]);
|
||||
|
||||
const openItemDictDialog = () => {
|
||||
if (itemDictRef.value && typeof itemDictRef.value.openDictSelector === 'function') {
|
||||
itemDictRef.value.openDictSelector(); // 确保方法存在再调用
|
||||
} else {
|
||||
console.warn("DictInput组件未加载完成或方法未暴露");
|
||||
}
|
||||
};
|
||||
|
||||
const fetchLabItemDict = async (dictType: string) => {
|
||||
try {
|
||||
// 1. 验证必要参数(如当前仪器yq)
|
||||
if (!queryParams.value.yq) {
|
||||
ElMessage.error("请先选择仪器");
|
||||
return [];
|
||||
}
|
||||
|
||||
const requestParams = {
|
||||
pageNum: 1,
|
||||
pageSize: 1000, // 加载足够多的项目
|
||||
yq: queryParams.value.yq, // 当前选中的仪器
|
||||
};
|
||||
const response = await queryXmInfo(requestParams);
|
||||
|
||||
const formattedData = response.data.map((item: any, index: number) => {
|
||||
return {
|
||||
value: item.xmdh || `未知编码_${index}`, // 确保value存在
|
||||
label: item.xmmc || `未知名称_${index}`, // 确保label存在
|
||||
dw: item.dw || "",
|
||||
refs: item.refs || "",
|
||||
};
|
||||
});
|
||||
return formattedData;
|
||||
} catch (error: any) {
|
||||
console.error(`[fetchLabItemDict] 加载失败:`, error.message);
|
||||
return []; // 失败时返回空数组,避免弹窗报错
|
||||
}
|
||||
};
|
||||
|
||||
const handleItemSelect = async (selectedItem: any) => {
|
||||
// 1. 构造新增行数据
|
||||
const newRow = {
|
||||
id: `temp_${Date.now()}_${Math.random().toString(36).substr(2, 8)}`,
|
||||
xmdh: selectedItem.value,
|
||||
xmmc: selectedItem.label,
|
||||
dw: selectedItem.dw || "",
|
||||
refs: selectedItem.refs || "",
|
||||
jyrq: queryParams.value.jyrq,
|
||||
yq: queryParams.value.yq,
|
||||
ybh: queryParams.value.ybh,
|
||||
};
|
||||
|
||||
|
||||
addRowFromDict(newRow);
|
||||
// ElMessage.success(`已新增项目:${newRow.xmmc}`);
|
||||
};
|
||||
|
||||
const addRowFromDict = async (rowData: any) => {
|
||||
if (!rowData?.xmdh) {
|
||||
ElMessage.error("项目编码不能为空");
|
||||
return;
|
||||
}
|
||||
// 1. 校验输入数据有效性
|
||||
if (!rowData || !rowData.xmdh) {
|
||||
ElMessage.error("新增失败:项目编码不能为空");
|
||||
return false;
|
||||
}
|
||||
|
||||
// 2. 检查是否重复添加同一项目(根据xmdh判断)
|
||||
const isDuplicate = tableData.value.some((item: any) => item.xmdh === rowData.xmdh);
|
||||
if (isDuplicate) {
|
||||
ElMessage.warning(`项目【${rowData.xmmc}】已存在`);
|
||||
return;
|
||||
}
|
||||
|
||||
// 3. 补全新增行的必要字段(如无则初始化)
|
||||
const newRow = { ...rowData, csjg: "" };
|
||||
|
||||
// 4. 添加到表格数据
|
||||
tableData.value.push(newRow);
|
||||
|
||||
// 5. 自动聚焦
|
||||
nextTick(() => {
|
||||
tableRef.value.setCurrentRow(newRow);
|
||||
nextTick(() => {
|
||||
tableRef.value.setScrollTop(23 * tableRef.value.length)
|
||||
})
|
||||
nextTick(() => {
|
||||
const tableBody = document.querySelector('.el-table__body-wrapper');
|
||||
if (tableBody) {
|
||||
tableBody.scrollTop = tableBody.scrollHeight;
|
||||
}
|
||||
|
||||
// 聚焦到新行的输入框
|
||||
const inputs = document.querySelectorAll('.full-width-input .el-input__inner') as NodeListOf<HTMLInputElement>;
|
||||
if (inputs.length > 0) {
|
||||
inputs[inputs.length - 1]?.focus();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
const handleCsjgEnter = (row: any) => {
|
||||
console.log('复查结果修改', row);
|
||||
saveRedo(row)
|
||||
}
|
||||
|
||||
const deleteRedo = (row: any) => {
|
||||
delRedo(row).then((res: any) => {
|
||||
if (res.code == 0) {
|
||||
getReexamination();
|
||||
}
|
||||
})
|
||||
}
|
||||
const jhRedo = (row: any) => {
|
||||
swapRedo(row).then((res: any) => {
|
||||
if (res.code == 0) {
|
||||
getReexamination();
|
||||
emits('fetchResults')
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user