@@ -1,66 +0,0 @@
|
||||
import request from '@/utils/request.js'
|
||||
|
||||
// 查询器材目录列表
|
||||
export function getObservationList(query) {
|
||||
return request({
|
||||
url: '/inspection/observation/information-page',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询器材目录详细
|
||||
export function getObservationOne(id) {
|
||||
return request({
|
||||
url: '/inspection/observation/information-one',
|
||||
method: 'get',
|
||||
params: { id } // 确保参数正确传递
|
||||
})
|
||||
}
|
||||
|
||||
// 新增器材目录
|
||||
export function addObservation(data) {
|
||||
return request({
|
||||
url: '/inspection/observation/information',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改器材目录
|
||||
export function editObservation(data) {
|
||||
return request({
|
||||
url: '/inspection/observation/information',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// // 删除器材目录
|
||||
// export function delUser(userId) {
|
||||
// return request({
|
||||
// url: '/system/user/' + userId,
|
||||
// method: 'delete'
|
||||
// })
|
||||
// }
|
||||
|
||||
// 器材目录分类查询
|
||||
export function getObservationInit() {
|
||||
return request({
|
||||
url: '/inspection/observation/init',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function editObservationStatus(ids,type) {
|
||||
return request({
|
||||
url: '/inspection/observation/information-status',
|
||||
method: 'post',
|
||||
data: {
|
||||
ids: ids,
|
||||
type: type
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -1,231 +0,0 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- 添加或修改用户配置对话框 -->
|
||||
<el-dialog :title="title" v-model="visible" width="955px" append-to-body>
|
||||
<el-form
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
ref="observationDialogRef"
|
||||
label-width="110px"
|
||||
label-position="left"
|
||||
>
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="观测类型" prop="observationTypeEnum">
|
||||
<el-tree-select
|
||||
v-model="form.observationTypeEnum"
|
||||
:data="observationTypeEnum"
|
||||
:props="{ value: 'value', label: 'info', children: 'children' }"
|
||||
:disabled="false"
|
||||
value-key="value"
|
||||
placeholder="请选择观测类型"
|
||||
check-strictly
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
|
||||
<el-col :span="8">
|
||||
<el-form-item label="观测名称" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入观测名称" clearable></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="8">
|
||||
<el-form-item label="观测代码" prop="code">
|
||||
<el-input v-model="form.code" placeholder="请输入观测代码" clearable></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
|
||||
<el-col :span="8">
|
||||
<el-form-item label="参考范围" prop="referenceRange">
|
||||
<el-input v-model="form.referenceRange" placeholder="请输入参考范围" clearable></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="8">
|
||||
<el-form-item label="仪器信息" prop="instrumentId">
|
||||
<el-select
|
||||
v-model="form.instrumentId"
|
||||
placeholder="请选择"
|
||||
clearable
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in instrumentIdOption"
|
||||
:key="dict.value"
|
||||
:label="dict.info"
|
||||
:value="dict.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="8">
|
||||
<el-form-item label="状态" prop="statusEnum">
|
||||
<el-select
|
||||
v-model="form.statusEnum"
|
||||
placeholder="请选择"
|
||||
clearable
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in statusFlagOptions"
|
||||
:key="dict.value"
|
||||
:label="dict.info"
|
||||
:value="dict.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item >
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer v-if="title != '查看'">
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="ObservationDialog">
|
||||
import { editObservation, addObservation } from './observation.js';
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
const title = ref('');
|
||||
const visible = ref(false);
|
||||
const emits = defineEmits(['submit']); // 声明自定义事件
|
||||
const observationTypeEnum = ref([]); // 仪器分类
|
||||
const statusFlagOptions = ref([]); // 状态标记
|
||||
const instrumentIdOption = ref([]);
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
rules: {
|
||||
|
||||
},
|
||||
});
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
const props = defineProps({
|
||||
item: {
|
||||
type: Object,
|
||||
required: false,
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
required: false,
|
||||
},
|
||||
observationTypeEnum: {
|
||||
type: Object,
|
||||
required: false,
|
||||
},
|
||||
statusFlagOptions: {
|
||||
type: Object,
|
||||
required: false,
|
||||
},
|
||||
instrumentIdOption:{
|
||||
type: Object,
|
||||
required: false,
|
||||
},
|
||||
});
|
||||
|
||||
// 显示弹框
|
||||
function show() {
|
||||
reset();
|
||||
title.value = '';
|
||||
title.value = props.title;
|
||||
observationTypeEnum.value = props.observationTypeEnum;
|
||||
statusFlagOptions.value = props.statusFlagOptions;
|
||||
instrumentIdOption.value = props.instrumentIdOption;
|
||||
visible.value = true;
|
||||
|
||||
}
|
||||
|
||||
// 显示弹框
|
||||
function edit() {
|
||||
reset();
|
||||
title.value = '';
|
||||
title.value = props.title;
|
||||
form.value = props.item;
|
||||
observationTypeEnum.value = props.observationTypeEnum;
|
||||
statusFlagOptions.value = props.statusFlagOptions;
|
||||
instrumentIdOption.value = props.instrumentIdOption;
|
||||
visible.value = true;
|
||||
}
|
||||
/** 重置操作表单 */
|
||||
function reset() {
|
||||
form.value = {
|
||||
id: undefined,
|
||||
name : undefined,
|
||||
code : undefined,
|
||||
observationType: undefined,
|
||||
observationTypeEnum: undefined,
|
||||
referenceRange: undefined,
|
||||
instrumentId: undefined,
|
||||
statusEnum: 2, // 替换为 1
|
||||
|
||||
};
|
||||
proxy.resetForm('observationDialogRef');
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
proxy.$refs['observationDialogRef'].validate((valid) => {
|
||||
if (valid) {
|
||||
console.log(form.value, 'form.value');
|
||||
if (form.value.id != undefined) {
|
||||
editObservation(form.value).then((response) => {
|
||||
// 触发自定义事件,并传递数据给父组件
|
||||
emits('submit');
|
||||
proxy.$modal.msgSuccess('修改成功');
|
||||
visible.value = false;
|
||||
reset(); // 重置表单数据
|
||||
});
|
||||
} else {
|
||||
addObservation(form.value).then((response) => {
|
||||
// 触发自定义事件,并传递数据给父组件
|
||||
emits('submit');
|
||||
proxy.$modal.msgSuccess('新增成功');
|
||||
visible.value = false;
|
||||
reset(); // 重置表单数据
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function formatValue(str) {
|
||||
if (str === null || str === undefined || str === '' || str === 'null') {
|
||||
return undefined;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
/** 取消按钮 */
|
||||
function cancel() {
|
||||
visible.value = false;
|
||||
reset();
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
show,
|
||||
edit,
|
||||
});
|
||||
</script>
|
||||
<style scoped>
|
||||
.el-form--inline .el-form-item {
|
||||
display: inline-flex;
|
||||
vertical-align: middle;
|
||||
margin-right: 10px !important;
|
||||
}
|
||||
|
||||
/* 使用深度选择器 */
|
||||
.custom-label-spacing :deep(.el-form-item__label) {
|
||||
line-height: 1.2; /* 调整行间距 */
|
||||
margin-bottom: 4px; /* 调整 label 和输入框之间的间距 */
|
||||
}
|
||||
</style>
|
||||
@@ -1,370 +0,0 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-row :gutter="20">
|
||||
<!--器材目录-->
|
||||
<el-col :span="4" :xs="24">
|
||||
<div class="head-title">观测类型</div>
|
||||
<div class="head-container">
|
||||
<el-tree
|
||||
:data="observationType"
|
||||
:props="{ label: 'info', children: 'children' }"
|
||||
:expand-on-click-node="false"
|
||||
:filter-node-method="filterNode"
|
||||
ref="treeRef"
|
||||
node-key="id"
|
||||
highlight-current
|
||||
default-expand-all
|
||||
@node-click="handleNodeClick"
|
||||
/>
|
||||
</div>
|
||||
</el-col>
|
||||
<!--器材目录-->
|
||||
<el-col :span="20" :xs="24">
|
||||
<el-form
|
||||
:model="queryParams"
|
||||
ref="queryRef"
|
||||
:inline="true"
|
||||
v-show="showSearch"
|
||||
label-width="68px"
|
||||
>
|
||||
<el-row :gutter="24">
|
||||
<!-- <el-col :span="6"> -->
|
||||
<el-form-item label="定义名" prop="searchKey" label-width="55">
|
||||
<el-input
|
||||
v-model="queryParams.searchKey"
|
||||
placeholder="名称/编码"
|
||||
clearable
|
||||
style="width: 220px"
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<!-- </el-col> -->
|
||||
<!-- <el-col :span="5"> -->
|
||||
<el-form-item label="状态" prop="statusEnum" label-width="50">
|
||||
<el-select v-model="queryParams.statusEnum" clearable>
|
||||
<el-option
|
||||
v-for="status in statusFlagOptions"
|
||||
:key="status.value"
|
||||
:label="status.info"
|
||||
:value="status.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="Plus"
|
||||
@click="openAddObservation()"
|
||||
>添加</el-button
|
||||
>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="Remove"
|
||||
:disabled="multiple"
|
||||
@click="handleClose"
|
||||
>停用</el-button
|
||||
>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="CirclePlus"
|
||||
:disabled="multiple"
|
||||
@click="handleStart"
|
||||
>启用</el-button
|
||||
>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="Search"
|
||||
@click="getList"
|
||||
>查询</el-button
|
||||
>
|
||||
</el-col>
|
||||
<!-- <el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="Download"
|
||||
@click="handleExport"
|
||||
>导出Excel</el-button
|
||||
>
|
||||
</el-col> -->
|
||||
</el-row>
|
||||
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="observationList"
|
||||
@selection-change="handleSelectionChange"
|
||||
width="90%"
|
||||
>
|
||||
<el-table-column type="selection" width="50" align="center" />
|
||||
|
||||
<el-table-column
|
||||
label="观测名称"
|
||||
align="center"
|
||||
key="name"
|
||||
prop="name"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
|
||||
<el-table-column
|
||||
label="观测代码"
|
||||
align="center"
|
||||
key="code"
|
||||
prop="code"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
|
||||
<el-table-column
|
||||
label="观测类型"
|
||||
align="center"
|
||||
key="observationTypeEnumText"
|
||||
prop="observationTypeEnumText"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
|
||||
<el-table-column
|
||||
label="参考范围"
|
||||
align="center"
|
||||
key="referenceRange"
|
||||
prop="referenceRange"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
|
||||
<el-table-column
|
||||
label="仪器"
|
||||
align="center"
|
||||
key="instrumentId_dictText"
|
||||
prop="instrumentId_dictText"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
|
||||
<el-table-column
|
||||
label="状态"
|
||||
align="center"
|
||||
key="statusEnumText"
|
||||
prop="statusEnumText"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
align="center"
|
||||
width="150"
|
||||
class-name="small-padding fixed-width"
|
||||
fixed="right"
|
||||
>
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
icon="Edit"
|
||||
@click="openEditObservation(scope.row)"
|
||||
>编辑</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNo"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<observation-dialog
|
||||
ref="observationRef"
|
||||
:title="title"
|
||||
:item="currentData"
|
||||
:observation-type-enum="observationTypeList"
|
||||
:statusFlagOptions="statusFlagOptions"
|
||||
:instrument-id-option="instrumentIdOption"
|
||||
@submit="getList()"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="observation">
|
||||
import {
|
||||
getObservationList,
|
||||
getObservationOne, getObservationInit, editObservationStatus,
|
||||
} from "./components/observation.js";
|
||||
import observationDialog from "./components/observationDialog.vue";
|
||||
import { nextTick } from "vue";
|
||||
import {parseTime} from "../../../utils/his.js";
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
|
||||
const observationList = ref([]);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref([]); // 存储选择的行数据
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
const title = ref("");
|
||||
const observationType = ref(undefined);
|
||||
const observationTypeList = ref(undefined);
|
||||
const statusFlagOptions = ref(undefined);
|
||||
const instrumentIdOption = ref(undefined);
|
||||
// 使用 ref 定义当前器材数据
|
||||
const currentData = ref({});
|
||||
// 使用 ref 定义当前查看器材数据
|
||||
const viewData = ref({});
|
||||
const currentCategoryEnum = ref("");
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
searchKey: undefined, // 品名/商品名/英文品名/编码/拼音
|
||||
typeEnum: undefined, // 类型
|
||||
statusEnum: undefined, // 状态(
|
||||
},
|
||||
rules: {},
|
||||
});
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
/** 通过条件过滤节点 */
|
||||
const filterNode = (value, data) => {
|
||||
if (!value) return true;
|
||||
return data.label.indexOf(value) !== -1;
|
||||
};
|
||||
|
||||
/** 样本分类查询下拉树结构 */
|
||||
function getTreatmentList() {
|
||||
getObservationInit().then((response) => {
|
||||
console.log(response, "response器材目录分类查询下拉树结构");
|
||||
observationType.value = JSON.parse(JSON.stringify(response.data.observationTypeList)).sort((a, b) => {
|
||||
return parseInt(a.value) - parseInt(b.value);
|
||||
});
|
||||
observationType.value.push({ info: "全部", value: "" });
|
||||
observationTypeList.value = response.data.observationTypeList.sort((a, b) => {
|
||||
return parseInt(a.value) - parseInt(b.value);
|
||||
});
|
||||
statusFlagOptions.value = response.data.statusFlagOptions;
|
||||
instrumentIdOption.value = response.data.instrumentEnumOptionList;
|
||||
});
|
||||
}
|
||||
/** 查询器材目录列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
getObservationList(queryParams.value).then((res) => {
|
||||
loading.value = false;
|
||||
observationList.value = res.data.records;
|
||||
total.value = res.data.total;
|
||||
});
|
||||
}
|
||||
/** 节点单击事件 */
|
||||
function handleNodeClick(data) {
|
||||
queryParams.value.observationTypeEnum = data.value;
|
||||
currentCategoryEnum.value = data.value;
|
||||
handleQuery();
|
||||
}
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNo = 1;
|
||||
getList();
|
||||
}
|
||||
|
||||
/** 启用按钮操作 */
|
||||
function handleStart() {
|
||||
const startIds = ids.value;
|
||||
// selectedData
|
||||
proxy.$modal
|
||||
.confirm("是否确定启用数据!")
|
||||
.then(function () {
|
||||
return editObservationStatus(startIds,'启用');
|
||||
})
|
||||
.then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("启用成功");
|
||||
})
|
||||
.catch(() => {});
|
||||
}
|
||||
/** 停用按钮操作 */
|
||||
function handleClose() {
|
||||
const stopIds = ids.value;
|
||||
proxy.$modal
|
||||
.confirm("是否确认停用数据!")
|
||||
.then(function () {
|
||||
return editObservationStatus(stopIds,'停用');
|
||||
})
|
||||
.then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("停用成功");
|
||||
})
|
||||
.catch(() => {});
|
||||
}
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download(
|
||||
"system/user/export",
|
||||
{
|
||||
...queryParams.value,
|
||||
},
|
||||
`user_${new Date().getTime()}.xlsx`
|
||||
);
|
||||
}
|
||||
|
||||
/** 选择条数 */
|
||||
function handleSelectionChange(selection) {
|
||||
console.log(selection, "selection");
|
||||
// selectedData.value = selection.map((item) => ({ ...item })); // 存储选择的行数据
|
||||
ids.value = selection.map((item) => item.id);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
}
|
||||
|
||||
/** 打开新增弹窗 */
|
||||
function openAddObservation() {
|
||||
// if (!currentCategoryEnum.value) {
|
||||
// return proxy.$modal.msgError("请选择器材目录分类");
|
||||
// }
|
||||
title.value = "新增";
|
||||
nextTick(() => {
|
||||
proxy.$refs.observationRef.show();
|
||||
});
|
||||
}
|
||||
/** 打开编辑弹窗 */
|
||||
function openEditObservation(row) {
|
||||
currentData.value = {};
|
||||
console.log("打开编辑弹窗");
|
||||
getObservationOne(row.id).then((response) => {
|
||||
console.log(response, "currentDataform");
|
||||
currentData.value = response.data;
|
||||
title.value = "编辑";
|
||||
nextTick(() => {
|
||||
proxy.$refs["observationRef"].edit();
|
||||
});
|
||||
getList();
|
||||
});
|
||||
}
|
||||
getTreatmentList();
|
||||
getList();
|
||||
</script>
|
||||
<style scoped>
|
||||
.el-form--inline .el-form-item {
|
||||
display: inline-flex;
|
||||
vertical-align: middle;
|
||||
margin-right: 10px !important;
|
||||
}
|
||||
.el-select{
|
||||
width: 150px!important;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user