@@ -1,36 +0,0 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 初始化
|
||||
export function getItemList(query) {
|
||||
return request({
|
||||
url: '/inspection/lisConfig/init-page',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function getItemDetailList(id) {
|
||||
return request({
|
||||
url: '/inspection/lisConfig/info-detail',
|
||||
method: 'get',
|
||||
params: {id}
|
||||
})
|
||||
}
|
||||
export function getInfoList(query) {
|
||||
return request({
|
||||
url: '/inspection/lisConfig/init-list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
export function saveAllConfig(data) {
|
||||
return request({
|
||||
url: '/inspection/lisConfig/saveAll',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,503 +0,0 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-row :gutter="20">
|
||||
<!--诊疗目录-->
|
||||
<el-col :span="7" :xs="24">
|
||||
<div class="head-title">检验项目</div>
|
||||
<el-input
|
||||
v-model="queryParams.searchKey"
|
||||
placeholder="名称/编码"
|
||||
clearable
|
||||
style="width: 220px"
|
||||
@keyup.enter="getItemList"
|
||||
/>
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="Search"
|
||||
@click="getItemPageList()"
|
||||
>查询</el-button>
|
||||
<div>
|
||||
<el-table
|
||||
ref="freTableRef"
|
||||
v-loading="loading"
|
||||
:data="itemList"
|
||||
row-key="id"
|
||||
@row-click="handleRowClick"
|
||||
>
|
||||
<el-table-column label="项目名称" align="left" prop="name" />
|
||||
</el-table>
|
||||
<pagination
|
||||
v-show="itemListTotal > 0"
|
||||
:total="itemListTotal"
|
||||
v-model:page="queryParams.pageNo"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getItemPageList()"
|
||||
/>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="17" :xs="24">
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="Plus"
|
||||
@click="handleFormSubmit"
|
||||
v-hasPermi="['system:user:add']"
|
||||
>保存配置详情</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-popover
|
||||
:popper-style="{ padding: '0' }"
|
||||
placement="bottom-start"
|
||||
:visible="deviceShowPopover"
|
||||
trigger="manual"
|
||||
:width="800"
|
||||
>
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
height="400"
|
||||
:data="deviceDefs"
|
||||
@row-click = "addMaterialsRow"
|
||||
row-key="id"
|
||||
class="mb8"
|
||||
>
|
||||
<el-table-column label="项目名称" align="left" prop="name" />
|
||||
</el-table>
|
||||
<template #reference>
|
||||
<div style="display: flex; align-items: center;">
|
||||
<el-input
|
||||
@focus="handleFocus('materials')"
|
||||
@blur="handleBlur('materials')"
|
||||
@input="handleSearch('materials')"
|
||||
v-model="query.deviceSearchKey"
|
||||
placeholder="请输入耗材名称"
|
||||
style="flex-grow: 1;"
|
||||
/>
|
||||
<el-button type="text"
|
||||
icon="Plus"
|
||||
style="margin-left: 8px; cursor: pointer;"
|
||||
:disabled="true">
|
||||
新增
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-popover>
|
||||
<!-- 耗材 -->
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="materialsList"
|
||||
row-key="id"
|
||||
class="mb8"
|
||||
>
|
||||
<el-table-column
|
||||
prop="deviceDefinitionName"
|
||||
label="耗材名称"
|
||||
width="200"
|
||||
>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="操作" align="center" width="400">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
type="danger"
|
||||
link
|
||||
icon="Delete"
|
||||
:disabled="scope.row.id == ''"
|
||||
@click="deleteMaterial(scope.row)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 样本定义表格 -->
|
||||
<el-popover
|
||||
:popper-style="{ padding: '0' }"
|
||||
placement="bottom-start"
|
||||
:visible="speShowPopover"
|
||||
trigger="manual"
|
||||
:width="800"
|
||||
>
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="specimenDefs"
|
||||
row-key="id"
|
||||
@row-click="addSamplesRow"
|
||||
class="mb8"
|
||||
>
|
||||
<el-table-column label="项目名称" align="left" prop="specimenName" />
|
||||
</el-table>
|
||||
<template #reference>
|
||||
<div style="display: flex; align-items: center;">
|
||||
<el-input
|
||||
@focus="handleFocus('samples')"
|
||||
@blur="handleBlur('samples')"
|
||||
@input="handleSearch('samples')"
|
||||
v-model="query.specimenSearchKey"
|
||||
placeholder="请输入样本名称"
|
||||
style="flex-grow: 1;"
|
||||
/>
|
||||
<el-button type="text"
|
||||
icon="Plus"
|
||||
style="margin-left: 8px; cursor: pointer;"
|
||||
:disabled="true">
|
||||
新增
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-popover>
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="sampleList"
|
||||
:key="sample => sample.id"
|
||||
class="mb8"
|
||||
>
|
||||
<el-table-column
|
||||
prop="specimenName"
|
||||
label="样本名称"
|
||||
width="200"
|
||||
>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="specimenVolume"
|
||||
label="数量"
|
||||
width="200"
|
||||
>
|
||||
<template #default="scope">
|
||||
<el-input v-model="scope.row.specimenVolume" placeholder="请输入数量"></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
prop="specimenUnit"
|
||||
label="单位"
|
||||
width="200"
|
||||
>
|
||||
<template #default="scope">
|
||||
<el-input v-model="scope.row.specimenUnit" placeholder="请输入单位"></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="操作" align="center" width="400">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
type="danger"
|
||||
link
|
||||
icon="Delete"
|
||||
:disabled="scope.row.id == ''"
|
||||
@click="deleteSample(scope.row)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-popover
|
||||
:popper-style="{ padding: '0' }"
|
||||
placement="bottom-start"
|
||||
:visible="obserShowPopover"
|
||||
trigger="manual"
|
||||
:width="800"
|
||||
>
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="observationDefs"
|
||||
row-key="id"
|
||||
@row-click="addObservationsRow"
|
||||
class="mb8"
|
||||
>
|
||||
<el-table-column label="项目名称" align="left" prop="name" />
|
||||
</el-table>
|
||||
<template #reference>
|
||||
<div style="display: flex; align-items: center;">
|
||||
<el-input
|
||||
@focus="handleFocus('observations')"
|
||||
@blur="handleBlur('observations')"
|
||||
@input="handleSearch('observations')"
|
||||
v-model="query.observationSearchKey"
|
||||
placeholder="请输入观测名称"
|
||||
style="flex-grow: 1;"
|
||||
/>
|
||||
<el-button type="text"
|
||||
icon="Plus"
|
||||
style="margin-left: 8px; cursor: pointer;"
|
||||
:disabled="true">
|
||||
新增
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-popover>
|
||||
<!-- 观测定义表格 -->
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="observationList"
|
||||
:key="observation => observation.id"
|
||||
class="mb8"
|
||||
>
|
||||
<el-table-column
|
||||
prop="observationName"
|
||||
label="观测名称"
|
||||
width="200"
|
||||
>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="observationCode"
|
||||
label="观测代码"
|
||||
width="200"
|
||||
/>
|
||||
<el-table-column label="操作" align="center" width="400">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
type="danger"
|
||||
link
|
||||
icon="Delete"
|
||||
:disabled="scope.row.id == ''"
|
||||
@click="deleteObservation(scope.row)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="itemList">
|
||||
import {
|
||||
getItemList, getItemDetailList, getInfoList, saveAllConfig
|
||||
} from './components/lisConfig.js';
|
||||
import { ElMessage } from "element-plus";
|
||||
import {saveAll} from "@/views/basicmanage/medicalOrderSet/components/api.js";
|
||||
const itemList = ref([]);
|
||||
const loading = ref(true);
|
||||
const itemListTotal = ref(0);
|
||||
const deviceDefs = ref([]);
|
||||
const specimenDefs = ref([]);
|
||||
const observationDefs = ref([]);
|
||||
const materialsList = ref([]);
|
||||
const sampleList = ref([]);
|
||||
const observationList = ref([]);
|
||||
const currentLeftRow = ref(null);
|
||||
let deviceShowPopover = ref(false);
|
||||
let speShowPopover = ref(false);
|
||||
let obserShowPopover = ref(false);
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
searchKey:'',
|
||||
status : 0,
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
categoryCode:22,
|
||||
},
|
||||
query :{
|
||||
searchKey:'',
|
||||
deviceSearchKey:'',
|
||||
specimenSearchKey:'',
|
||||
observationSearchKey:'',
|
||||
type: 'all'
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
const { queryParams, form, tableRules, query} = toRefs(data);
|
||||
|
||||
/** 获取字典列表 */
|
||||
function getItemPageList() {
|
||||
getItemList(queryParams.value).then((res) => {
|
||||
if (res.code === 200) {
|
||||
itemList.value =
|
||||
res.data.records.length > 0
|
||||
? res.data.records.map((res) => {
|
||||
return {
|
||||
...res,
|
||||
isEditing: false, // 标记当前行是否正在编辑
|
||||
error: false, // 新增 error 字段
|
||||
};
|
||||
})
|
||||
: [];
|
||||
}
|
||||
itemListTotal.value = res.data.total;
|
||||
});
|
||||
getInfoLists(query);
|
||||
loading.value = false
|
||||
}
|
||||
function getDetailList(id) {
|
||||
getItemDetailList(id).then((res) => {
|
||||
if (res.code === 200) {
|
||||
materialsList.value = res.data.activityDefDeviceDefs;
|
||||
sampleList.value = res.data.activityDefSpecimenDefs;
|
||||
observationList.value = res.data.activityDefObservationDefs;
|
||||
}
|
||||
});
|
||||
loading.value = false
|
||||
}
|
||||
/** 节点单击事件 */
|
||||
function handleRowClick(row) {
|
||||
currentLeftRow.value = row; // 记录当前行
|
||||
getDetailList(row.id);
|
||||
|
||||
}
|
||||
|
||||
function getInfoLists(query) {
|
||||
switch (query.value.type) {
|
||||
case 'all':
|
||||
getInfoList( query.value).then((res) => {
|
||||
deviceDefs.value = res.data.deviceDefs;
|
||||
specimenDefs.value = res.data.specimenDefs;
|
||||
observationDefs.value = res.data.observationDefs;
|
||||
})
|
||||
break;
|
||||
case 'device':
|
||||
getInfoList( query.value).then((res) => {
|
||||
deviceDefs.value = res.data;
|
||||
})
|
||||
break;
|
||||
case 'specimen':
|
||||
getInfoList( query.value).then((res) => {
|
||||
specimenDefs.value = res.data;
|
||||
})
|
||||
break;
|
||||
case 'observation':
|
||||
getInfoList( query.value).then((res) => {
|
||||
observationDefs.value = res.data;
|
||||
})
|
||||
}
|
||||
}
|
||||
// 处理表单提交
|
||||
/* 保存/新增 */
|
||||
function handleFormSubmit() {
|
||||
saveAllConfig({
|
||||
id: currentLeftRow.value.id,
|
||||
activityDefDeviceDefs: materialsList.value,
|
||||
activityDefSpecimenDefs: sampleList.value,
|
||||
activityDefObservationDefs: observationList.value,
|
||||
}).then((res) => {
|
||||
if (res.code === 200) {
|
||||
ElMessage.success("保存成功");
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
//添加行
|
||||
function isDuplicate(id, list,e) {
|
||||
switch (e) {
|
||||
case 'materials':
|
||||
return list.some(item => item.deviceDefinitionId === id);
|
||||
case 'samples':
|
||||
return list.some(item => item.specimenDefinitionId === id);
|
||||
case 'observations':
|
||||
return list.some(item => item.
|
||||
observationDefinitionId === id);
|
||||
}
|
||||
|
||||
}
|
||||
function addMaterialsRow(row) {
|
||||
if (isDuplicate(row.id, materialsList.value,'materials')) {
|
||||
ElMessage.warning("请勿重复添加此材料!");
|
||||
return;
|
||||
}
|
||||
let newRow = { deviceDefinitionName: row.name, deviceDefinitionId
|
||||
: row.id };
|
||||
materialsList.value.push(newRow);
|
||||
}
|
||||
|
||||
function addSamplesRow(row) {
|
||||
if (isDuplicate(row.id, sampleList.value,'samples')) {
|
||||
ElMessage.warning("请勿重复添加此样本!");
|
||||
return;
|
||||
}
|
||||
let newRow = { specimenName: row.specimenName, specimenDefinitionId: row.id };
|
||||
sampleList.value.push(newRow);
|
||||
}
|
||||
function addObservationsRow(row) {
|
||||
if (isDuplicate(row.id, observationList.value,'observations')) {
|
||||
ElMessage.warning("请勿重复添加此观察项!");
|
||||
return;
|
||||
}
|
||||
let newRow = { observationName: row.name, observationDefinitionId: row.id };
|
||||
observationList.value.push(newRow);
|
||||
}
|
||||
|
||||
function handleBlur(e) {
|
||||
switch (e) {
|
||||
case 'materials':
|
||||
deviceShowPopover.value = false;
|
||||
break;
|
||||
case 'samples':
|
||||
speShowPopover.value = false;
|
||||
break;
|
||||
case 'observations':
|
||||
obserShowPopover.value = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
function handleSearch(e) {
|
||||
switch (e) {
|
||||
case 'materials':
|
||||
query.value.searchKey = query.value.deviceSearchKey;
|
||||
query.value.type = 'device';
|
||||
getInfoLists(query);
|
||||
break;
|
||||
case 'samples':
|
||||
speShowPopover.value = false;
|
||||
break;
|
||||
case 'observations':
|
||||
obserShowPopover.value = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function handleFocus(e) {
|
||||
switch (e) {
|
||||
case 'materials':
|
||||
deviceShowPopover.value = true;
|
||||
break;
|
||||
case 'samples':
|
||||
speShowPopover.value = true;
|
||||
break;
|
||||
case 'observations':
|
||||
obserShowPopover.value = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 删除数据
|
||||
function deleteMaterial(row) {
|
||||
const index = materialsList.value.indexOf(row);
|
||||
if (index > -1) {
|
||||
materialsList.value.splice(index, 1);
|
||||
}
|
||||
}
|
||||
function deleteSample(row) {
|
||||
const index = sampleList.value.indexOf(row);
|
||||
if (index > -1) {
|
||||
sampleList.value.splice(index, 1);
|
||||
}
|
||||
}
|
||||
|
||||
function deleteObservation(row) {
|
||||
const index = observationList.value.indexOf(row);
|
||||
if (index > -1) {
|
||||
observationList.value.splice(index, 1);
|
||||
}
|
||||
}
|
||||
|
||||
getItemPageList();
|
||||
|
||||
</script>
|
||||
<style scoped>
|
||||
.el-form--inline .el-form-item {
|
||||
display: inline-flex;
|
||||
vertical-align: middle;
|
||||
margin-right: 10px !important;
|
||||
}
|
||||
.error-border {
|
||||
border: 1px solid red;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user