根因: - Bug #请修复 Bug #591 存在的问题 修复: - ### 变更摘要 - 全链路数据流分析**:录取(弹窗输入)→ 保存(API传入)→ 查询(Mapper返回)→ 修改(Service记录)→ 删除/停止(状态变更)→ 关联(列表展示) - ### 后端变更(4个文件) - 1. `AdviceBatchOpParam.java`** — 停嘱参数添加 `stopTime` 字段 - 新增 `@JsonFormat Date stopTime`,支持前端传入停嘱时间 - 2. `RequestBaseDto.java`** — 查询DTO添加 `stopUserName`、`stopTime` 字段 - 新增 `String stopUserName`(停嘱医生姓名) - 新增 `Date stopTime`(停嘱时间) - 3. `AdviceManageAppServiceImpl.java`** — 停嘱Service增强 - 优先使用前端传入的 `stopTime`,兜底用当前时间 - 通过 `SecurityUtils.getNickName()` 获取当前操作用户昵称,记录到 `updateBy` - 药品和诊疗两个更新入口均已同步修改 - 4. `AdviceManageAppMapper.xml`** — 三个UNION ALL子查询添加字段 - 药品子查询:`T1.effective_dose_end AS stop_time` + `T1.update_by AS stop_user_name` - 耗材子查询:`NULL AS stop_time` + `'' AS stop_user_name` - 诊疗子查询:`T1.occurrence_end_time AS stop_time` + `T1.update_by AS stop_user_name` - ### 前端变更(1个文件) - `order/index.vue`**: - 1. **停嘱时间弹窗** — 点击「停嘱」后弹出 `el-dialog`,内含 `el-date-picker`(datetime类型,默认当前时间),确定后才调用API - 2. **表格列** — 在「皮试」列后面、「诊断」列前面新增两列: - 「停嘱医生」`prop="stopUserName"`,宽度120px - 「停嘱时间」`prop="stopTime"`,宽度170px - 3. **`handleStopAdvice`** — 保留原有校验(未保存/未签发/已停止检查),校验通过后弹出时间选择弹窗而非直接调API - 4. **`confirmStopAdvice`** — 新增确认函数,将 `stopTime` 拼入请求参数后调用 `stopAdvice` API - ### 验证结果 - ✅ 前端 Lint 检查通过(仅1个预存的 `vue/no-dupe-keys` 警告) - ✅ 后端 Maven 编译通过(BUILD SUCCESS)
213 lines
4.6 KiB
Vue
Executable File
213 lines
4.6 KiB
Vue
Executable File
<template>
|
|
<div
|
|
:class="{ show: show }"
|
|
class="header-search"
|
|
>
|
|
<svg-icon
|
|
v-if="!show"
|
|
class-name="search-icon"
|
|
icon-class="search"
|
|
@click.stop="click"
|
|
/>
|
|
<el-select
|
|
v-else
|
|
ref="headerSearchSelectRef"
|
|
v-model="search"
|
|
:remote-method="querySearch"
|
|
filterable
|
|
default-first-option
|
|
remote
|
|
placeholder="搜索菜单"
|
|
class="header-search-select"
|
|
@change="change"
|
|
>
|
|
<el-option
|
|
v-for="option in options"
|
|
:key="option.item.path"
|
|
:value="option.item"
|
|
:label="option.item.title.join(' > ')"
|
|
/>
|
|
</el-select>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup>
|
|
import Fuse from 'fuse.js';
|
|
import {getNormalPath} from '@/utils/openhis';
|
|
import {isHttp} from '@/utils/validate';
|
|
import usePermissionStore from '@/store/modules/permission';
|
|
|
|
const search = ref('');
|
|
const options = ref([]);
|
|
const searchPool = ref([]);
|
|
const show = ref(false);
|
|
const fuse = ref(undefined);
|
|
const headerSearchSelectRef = ref(null);
|
|
const router = useRouter();
|
|
const routes = computed(() => usePermissionStore().routes);
|
|
|
|
function click() {
|
|
show.value = !show.value;
|
|
if (show.value) {
|
|
headerSearchSelectRef.value && headerSearchSelectRef.value.focus();
|
|
}
|
|
}
|
|
function close(e) {
|
|
// 如果点击的是搜索框内部,不关闭
|
|
if (e && e.target) {
|
|
const searchEl = document.querySelector('.header-search');
|
|
if (searchEl && searchEl.contains(e.target)) {
|
|
return;
|
|
}
|
|
}
|
|
headerSearchSelectRef.value && headerSearchSelectRef.value.blur();
|
|
options.value = [];
|
|
show.value = false;
|
|
}
|
|
function change(val) {
|
|
const path = val.path;
|
|
const query = val.query;
|
|
if (isHttp(path)) {
|
|
// http(s):// 路径新窗口打开
|
|
const pindex = path.indexOf('http');
|
|
window.open(path.substr(pindex, path.length), '_blank');
|
|
} else {
|
|
if (query) {
|
|
router.push({ path: path, query: JSON.parse(query) });
|
|
} else {
|
|
router.push(path);
|
|
}
|
|
}
|
|
|
|
search.value = '';
|
|
options.value = [];
|
|
nextTick(() => {
|
|
show.value = false;
|
|
});
|
|
}
|
|
function initFuse(list) {
|
|
fuse.value = new Fuse(list, {
|
|
shouldSort: true,
|
|
threshold: 0.4,
|
|
location: 0,
|
|
distance: 100,
|
|
minMatchCharLength: 1,
|
|
keys: [
|
|
{
|
|
name: 'title',
|
|
weight: 0.7,
|
|
},
|
|
{
|
|
name: 'path',
|
|
weight: 0.3,
|
|
},
|
|
],
|
|
});
|
|
}
|
|
// Filter out the routes that can be displayed in the sidebar
|
|
// And generate the internationalized title
|
|
function generateRoutes(routes, basePath = '', prefixTitle = []) {
|
|
let res = [];
|
|
|
|
for (const r of routes) {
|
|
// skip hidden router
|
|
if (r.hidden) {
|
|
continue;
|
|
}
|
|
const p = r.path.length > 0 && r.path[0] === '/' ? r.path : '/' + r.path;
|
|
const data = {
|
|
path: !isHttp(r.path) ? getNormalPath(basePath + p) : r.path,
|
|
title: [...prefixTitle],
|
|
};
|
|
|
|
if (r.meta && r.meta.title) {
|
|
data.title = [...data.title, r.meta.title];
|
|
|
|
if (r.redirect !== 'noRedirect') {
|
|
// only push the routes with title
|
|
// special case: need to exclude parent router without redirect
|
|
res.push(data);
|
|
}
|
|
}
|
|
if (r.query) {
|
|
data.query = r.query;
|
|
}
|
|
|
|
// recursive child routes
|
|
if (r.children) {
|
|
const tempRoutes = generateRoutes(r.children, data.path, data.title);
|
|
if (tempRoutes.length >= 1) {
|
|
res = [...res, ...tempRoutes];
|
|
}
|
|
}
|
|
}
|
|
return res;
|
|
}
|
|
function querySearch(query) {
|
|
if (query !== '') {
|
|
options.value = fuse.value.search(query);
|
|
} else {
|
|
options.value = [];
|
|
}
|
|
}
|
|
|
|
onMounted(() => {
|
|
searchPool.value = generateRoutes(routes.value);
|
|
});
|
|
|
|
watchEffect(() => {
|
|
searchPool.value = generateRoutes(routes.value);
|
|
});
|
|
|
|
watch(show, (value) => {
|
|
if (value) {
|
|
document.body.addEventListener('click', close);
|
|
} else {
|
|
document.body.removeEventListener('click', close);
|
|
}
|
|
});
|
|
|
|
watch(searchPool, (list) => {
|
|
initFuse(list);
|
|
});
|
|
</script>
|
|
|
|
<style lang='scss' scoped>
|
|
.header-search {
|
|
font-size: 0 !important;
|
|
|
|
.search-icon {
|
|
cursor: pointer;
|
|
font-size: 18px;
|
|
vertical-align: middle;
|
|
}
|
|
|
|
.header-search-select {
|
|
font-size: 18px;
|
|
transition: width 0.2s;
|
|
width: 0;
|
|
overflow: hidden;
|
|
background: transparent;
|
|
border-radius: 0;
|
|
display: inline-block;
|
|
vertical-align: middle;
|
|
|
|
:deep(.el-input__inner) {
|
|
border-radius: 0;
|
|
border: 0;
|
|
padding-left: 0;
|
|
padding-right: 0;
|
|
box-shadow: none !important;
|
|
border-bottom: 1px solid #d9d9d9;
|
|
vertical-align: middle;
|
|
}
|
|
}
|
|
|
|
&.show {
|
|
.header-search-select {
|
|
width: 180px;
|
|
margin-left: 10px;
|
|
}
|
|
}
|
|
}
|
|
</style> |