维护系统->检查方法、部位条件搜索前后端实现
This commit is contained in:
@@ -3,6 +3,7 @@ package com.openhis.web.check.appservice;
|
|||||||
|
|
||||||
import com.core.common.core.domain.R;
|
import com.core.common.core.domain.R;
|
||||||
import com.openhis.check.domain.CheckMethod;
|
import com.openhis.check.domain.CheckMethod;
|
||||||
|
import io.swagger.models.auth.In;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -21,5 +22,5 @@ public interface ICheckMethodAppService{
|
|||||||
|
|
||||||
R<?> removeCheckMethod(Integer checkMethodId);
|
R<?> removeCheckMethod(Integer checkMethodId);
|
||||||
|
|
||||||
|
R<?> searchCheckMethodList(Integer pageNo, Integer pageSize, String checkTpye, String name, String packageName);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,4 +11,6 @@ public interface ICheckPartAppService {
|
|||||||
R<?> removeCheckPart(Integer checkPartId);
|
R<?> removeCheckPart(Integer checkPartId);
|
||||||
|
|
||||||
R<?> updateCheckPart(CheckPart checkPart);
|
R<?> updateCheckPart(CheckPart checkPart);
|
||||||
|
|
||||||
|
R<?> searchCheckPartList(Integer pageNo, Integer pageSize, String checkTpye, String name, String packageName);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,10 @@ package com.openhis.web.check.appservice.impl;
|
|||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.core.common.core.domain.R;
|
import com.core.common.core.domain.R;
|
||||||
import com.openhis.check.domain.CheckMethod;
|
import com.openhis.check.domain.CheckMethod;
|
||||||
import com.openhis.check.service.ICheckMethodService;
|
import com.openhis.check.service.ICheckMethodService;
|
||||||
import com.openhis.web.check.appservice.ICheckMethodAppService;
|
import com.openhis.web.check.appservice.ICheckMethodAppService;
|
||||||
import com.openhis.web.check.dto.CheckMethodDto;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@@ -27,6 +25,22 @@ public class CheckMethodAppServiceImpl implements ICheckMethodAppService {
|
|||||||
return R.ok(list);
|
return R.ok(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public R<?> searchCheckMethodList(Integer pageNo, Integer pageSize, String checkTpye, String name, String packageName) {
|
||||||
|
LambdaQueryWrapper<CheckMethod> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
if (checkTpye != null && ObjectUtil.isNotEmpty(checkTpye)) {
|
||||||
|
wrapper.eq(CheckMethod::getCheckType, checkTpye);
|
||||||
|
}
|
||||||
|
if (name != null && ObjectUtil.isNotEmpty(name)) {
|
||||||
|
wrapper.like(CheckMethod::getName, name);
|
||||||
|
}
|
||||||
|
if (packageName != null && ObjectUtil.isNotEmpty(packageName)) {
|
||||||
|
wrapper.eq(CheckMethod::getPackageName, packageName);
|
||||||
|
}
|
||||||
|
List<CheckMethod> list = checkMethodService.list(wrapper);
|
||||||
|
return R.ok(list);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public R<?> addCheckMethod(CheckMethod checkMethod) {
|
public R<?> addCheckMethod(CheckMethod checkMethod) {
|
||||||
//1.数据校验
|
//1.数据校验
|
||||||
@@ -66,6 +80,4 @@ public class CheckMethodAppServiceImpl implements ICheckMethodAppService {
|
|||||||
boolean remove = checkMethodService.removeById(checkMethodId);
|
boolean remove = checkMethodService.removeById(checkMethodId);
|
||||||
return R.ok(remove);
|
return R.ok(remove);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ package com.openhis.web.check.appservice.impl;
|
|||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.core.common.core.domain.R;
|
import com.core.common.core.domain.R;
|
||||||
|
import com.openhis.check.domain.CheckMethod;
|
||||||
import com.openhis.check.domain.CheckPart;
|
import com.openhis.check.domain.CheckPart;
|
||||||
import com.openhis.check.service.ICheckPartService;
|
import com.openhis.check.service.ICheckPartService;
|
||||||
import com.openhis.web.check.appservice.ICheckPartAppService;
|
import com.openhis.web.check.appservice.ICheckPartAppService;
|
||||||
import com.openhis.web.check.dto.CheckPartDto;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@@ -23,6 +23,22 @@ public class CheckPartAppServiceImpl implements ICheckPartAppService {
|
|||||||
return R.ok(list);
|
return R.ok(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public R<?> searchCheckPartList(Integer pageNo, Integer pageSize, String checkTpye, String name, String packageName) {
|
||||||
|
LambdaQueryWrapper<CheckPart> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
if (checkTpye != null && ObjectUtil.isNotEmpty(checkTpye)) {
|
||||||
|
wrapper.eq(CheckPart::getCheckType, checkTpye);
|
||||||
|
}
|
||||||
|
if (name != null && ObjectUtil.isNotEmpty(name)) {
|
||||||
|
wrapper.like(CheckPart::getName, name);
|
||||||
|
}
|
||||||
|
if (packageName != null && ObjectUtil.isNotEmpty(packageName)) {
|
||||||
|
wrapper.eq(CheckPart::getPackageName, packageName);
|
||||||
|
}
|
||||||
|
List<CheckPart> list = checkPartService.list(wrapper);
|
||||||
|
return R.ok(list);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public R<?> addCheckPart(CheckPart checkPart) {
|
public R<?> addCheckPart(CheckPart checkPart) {
|
||||||
//数据检验
|
//数据检验
|
||||||
|
|||||||
@@ -18,13 +18,27 @@ public class CheckMethodController {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* 获取检查方法
|
* 获取检查方法
|
||||||
* @Param检查方法 此处参数注释有问题,完全是按照需求给的图来注释的
|
* @Param 此处参数注释有问题,完全是按照需求给的图来注释的
|
||||||
*/
|
*/
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public R<?> getCheckMethodList(){
|
public R<?> getCheckMethodList(){
|
||||||
return R.ok(checkMethodAppService.getCheckMethodList());
|
return R.ok(checkMethodAppService.getCheckMethodList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 条件查询检查方法
|
||||||
|
* @Para
|
||||||
|
* */
|
||||||
|
@GetMapping("/search")
|
||||||
|
public R<?> searchCheckMethodList(
|
||||||
|
@RequestParam(required = false) Integer pageNo,
|
||||||
|
@RequestParam(required = false) Integer pageSize,
|
||||||
|
@RequestParam(required = false) String checkTpye,
|
||||||
|
@RequestParam(required = false) String name,
|
||||||
|
@RequestParam(required = false) String packageName) {
|
||||||
|
return R.ok(checkMethodAppService.searchCheckMethodList(pageNo,pageSize,checkTpye,name,packageName));
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 新增检查方法
|
* 新增检查方法
|
||||||
* @Param
|
* @Param
|
||||||
|
|||||||
@@ -24,6 +24,19 @@ public class CheckPartController {
|
|||||||
return R.ok(checkPartAppService.getCheckPartList());
|
return R.ok(checkPartAppService.getCheckPartList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 条件搜索检查部位
|
||||||
|
* @Param
|
||||||
|
* */
|
||||||
|
@GetMapping("/search")
|
||||||
|
public R<?> searchCheckPartList(@RequestParam(required = false) Integer pageNo,
|
||||||
|
@RequestParam(required = false) Integer pageSize,
|
||||||
|
@RequestParam(required = false) String checkTpye,
|
||||||
|
@RequestParam(required = false) String name,
|
||||||
|
@RequestParam(required = false) String packageName){
|
||||||
|
return R.ok(checkPartAppService.searchCheckPartList(pageNo,pageSize,checkTpye,name,packageName));
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 新增检查部位
|
* 新增检查部位
|
||||||
* @Param
|
* @Param
|
||||||
|
|||||||
@@ -52,6 +52,15 @@ export function listCheckMethod(query) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 搜索检查方法列表
|
||||||
|
export function searchCheckMethod(query) {
|
||||||
|
return request({
|
||||||
|
url: '/check/method/search',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 新增检查方法
|
// 新增检查方法
|
||||||
export function addCheckMethod(data) {
|
export function addCheckMethod(data) {
|
||||||
return request({
|
return request({
|
||||||
@@ -87,6 +96,15 @@ export function listCheckPart(query) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 搜索检查部位列表
|
||||||
|
export function searchCheckPart(query) {
|
||||||
|
return request({
|
||||||
|
url: '/check/part/search',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 新增检查部位
|
// 新增检查部位
|
||||||
export function addCheckPart(data) {
|
export function addCheckPart(data) {
|
||||||
|
|||||||
@@ -202,8 +202,8 @@
|
|||||||
<div class="search-bar search-bar-method">
|
<div class="search-bar search-bar-method">
|
||||||
<div class="search-filters">
|
<div class="search-filters">
|
||||||
<div class="search-item">
|
<div class="search-item">
|
||||||
<label>检查方法</label>
|
<label>检查类型</label>
|
||||||
<el-select v-model="searchParams.checkMethod" placeholder="选择检查方法" style="width: 150px">
|
<el-select v-model="searchParamsMethod.checkType" placeholder="选择检查类型" style="width: 150px">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="type in checkTypes"
|
v-for="type in checkTypes"
|
||||||
:key="type"
|
:key="type"
|
||||||
@@ -215,16 +215,16 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="search-item">
|
<div class="search-item">
|
||||||
<label>名称</label>
|
<label>名称</label>
|
||||||
<el-input placeholder="名称/编码" v-model="searchParams.name" />
|
<el-input placeholder="名称/编码" v-model="searchParamsMethod.name" />
|
||||||
</div>
|
</div>
|
||||||
<div class="search-item">
|
<div class="search-item">
|
||||||
<label>费用套餐</label>
|
<label>费用套餐</label>
|
||||||
<el-select v-model="searchParams.packageId" placeholder="选择使用套餐" style="width: 150px">
|
<el-select v-model="searchParamsMethod.packageName" placeholder="选择使用套餐" style="width: 150px">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="pkg in checkPackages"
|
v-for="pkg in checkPackages"
|
||||||
:key="pkg.id"
|
:key="pkg.id"
|
||||||
:label="pkg.name"
|
:label="pkg.name"
|
||||||
:value="pkg.id"
|
:value="pkg.name"
|
||||||
>
|
>
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
@@ -255,7 +255,7 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr
|
<tr
|
||||||
v-for="(item, index) in tableData"
|
v-for="(item, index) in checkMethodData"
|
||||||
:key="index"
|
:key="index"
|
||||||
:class="{ 'editing-row': item.editing }"
|
:class="{ 'editing-row': item.editing }"
|
||||||
@click=""
|
@click=""
|
||||||
@@ -343,7 +343,7 @@
|
|||||||
<div class="search-bar search-bar-part">
|
<div class="search-bar search-bar-part">
|
||||||
<div class="search-item">
|
<div class="search-item">
|
||||||
<label>检查类型</label>
|
<label>检查类型</label>
|
||||||
<el-select v-model="searchParams.checkType" placeholder="选择检查类型" style="width: 150px">
|
<el-select v-model="searchParamsPart.checkType" placeholder="选择检查类型" style="width: 150px">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="type in checkTypes"
|
v-for="type in checkTypes"
|
||||||
:key="type"
|
:key="type"
|
||||||
@@ -355,11 +355,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="search-item">
|
<div class="search-item">
|
||||||
<label>名称</label>
|
<label>名称</label>
|
||||||
<el-input placeholder="名称/编码" v-model="searchParams.name" />
|
<el-input placeholder="名称/编码" v-model="searchParamsPart.name" />
|
||||||
</div>
|
</div>
|
||||||
<div class="search-item">
|
<div class="search-item">
|
||||||
<label>费用套餐</label>
|
<label>费用套餐</label>
|
||||||
<el-input placeholder="费用套餐" v-model="searchParams.packageName" />
|
<el-input placeholder="费用套餐" v-model="searchParamsPart.packageName" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="search-actions">
|
<div class="search-actions">
|
||||||
@@ -390,7 +390,7 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr
|
<tr
|
||||||
v-for="(item, index) in tableData"
|
v-for="(item, index) in checkPartData"
|
||||||
:key="index"
|
:key="index"
|
||||||
:class="{ 'editing-row': item.editing }"
|
:class="{ 'editing-row': item.editing }"
|
||||||
@click=""
|
@click=""
|
||||||
@@ -503,10 +503,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, reactive, onMounted } from 'vue';
|
import { ref, reactive, onMounted, computed } from 'vue';
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus';
|
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||||
import { getDicts } from '@/api/system/dict/data';
|
import { getDicts } from '@/api/system/dict/data';
|
||||||
import { listCheckType, listCheckMethod, listCheckPart, listCheckPackage, addCheckType, updateCheckType, delCheckType, addCheckMethod, updateCheckMethod, delCheckMethod,addCheckPart, updateCheckPart, delCheckPart } from '@/api/system/checkType';
|
import { listCheckType, listCheckMethod, listCheckPart, listCheckPackage, searchCheckMethod, searchCheckPart, addCheckType, updateCheckType, delCheckType, addCheckMethod, updateCheckMethod, delCheckMethod, addCheckPart, updateCheckPart, delCheckPart } from '@/api/system/checkType';
|
||||||
import PackageSettings from './components/PackageSettings.vue';
|
import PackageSettings from './components/PackageSettings.vue';
|
||||||
import PackageManagement from './components/PackageManagement.vue';
|
import PackageManagement from './components/PackageManagement.vue';
|
||||||
|
|
||||||
@@ -528,19 +528,55 @@ const checkParts = ref([]);
|
|||||||
const checkPackages = ref([]);
|
const checkPackages = ref([]);
|
||||||
const departments = ref([]);
|
const departments = ref([]);
|
||||||
|
|
||||||
// 表格数据
|
// 表格数据 - 为每个菜单创建独立的数据存储
|
||||||
const tableData = reactive([]);
|
const checkTypeData = reactive([]);
|
||||||
|
const checkMethodData = reactive([]);
|
||||||
|
const checkPartData = reactive([]);
|
||||||
|
const packageData = reactive([]);
|
||||||
|
|
||||||
// 搜索条件
|
// 当前显示的表格数据
|
||||||
const searchParams = reactive({
|
const tableData = computed(() => {
|
||||||
checkMethod: '',
|
switch(activeMenu.value) {
|
||||||
name: '',
|
case '检查类型':
|
||||||
packageId: '',
|
return checkTypeData;
|
||||||
packageName: '',
|
case '检查方法':
|
||||||
|
return checkMethodData;
|
||||||
|
case '检查部位':
|
||||||
|
return checkPartData;
|
||||||
|
case '套餐设置':
|
||||||
|
return packageData;
|
||||||
|
default:
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 搜索条件 - 为每个菜单创建独立的搜索参数
|
||||||
|
const searchParamsType = reactive({});
|
||||||
|
const searchParamsMethod = reactive({
|
||||||
checkType: '',
|
checkType: '',
|
||||||
checkPartCode: '',
|
name: '',
|
||||||
checkPartName: '',
|
packageName: ''
|
||||||
visible: ''
|
});
|
||||||
|
const searchParamsPart = reactive({
|
||||||
|
checkType: '',
|
||||||
|
name: '',
|
||||||
|
packageName: ''
|
||||||
|
});
|
||||||
|
|
||||||
|
// 获取当前菜单对应的搜索参数
|
||||||
|
const currentSearchParams = computed(() => {
|
||||||
|
switch(activeMenu.value) {
|
||||||
|
case '检查类型':
|
||||||
|
return searchParamsType;
|
||||||
|
case '检查方法':
|
||||||
|
return searchParamsMethod;
|
||||||
|
case '检查部位':
|
||||||
|
return searchParamsPart;
|
||||||
|
case '套餐设置':
|
||||||
|
return searchParamsMethod; // 套餐设置可能共享检查方法的搜索参数
|
||||||
|
default:
|
||||||
|
return {};
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// 按钮悬停状态
|
// 按钮悬停状态
|
||||||
@@ -564,10 +600,10 @@ onMounted(async () => {
|
|||||||
// 获取所有不重复的检查类型值
|
// 获取所有不重复的检查类型值
|
||||||
checkTypes.value = [...new Set(types.map(item => item.type))];
|
checkTypes.value = [...new Set(types.map(item => item.type))];
|
||||||
|
|
||||||
// 构建表格数据
|
// 构建检查类型表格数据
|
||||||
tableData.splice(0, tableData.length);
|
checkTypeData.splice(0, checkTypeData.length);
|
||||||
types.forEach((item, index) => {
|
types.forEach((item, index) => {
|
||||||
tableData.push({
|
checkTypeData.push({
|
||||||
id: item.id, // 保存id字段,用于判断是新增还是修改
|
id: item.id, // 保存id字段,用于判断是新增还是修改
|
||||||
row: (index + 1).toString(),
|
row: (index + 1).toString(),
|
||||||
code: item.code,
|
code: item.code,
|
||||||
@@ -669,10 +705,11 @@ function handleSaveSuccess() {
|
|||||||
// 根据菜单加载对应数据
|
// 根据菜单加载对应数据
|
||||||
async function loadMenuData(menu) {
|
async function loadMenuData(menu) {
|
||||||
try {
|
try {
|
||||||
tableData.splice(0, tableData.length);
|
|
||||||
|
|
||||||
switch(menu) {
|
switch(menu) {
|
||||||
case '检查类型':
|
case '检查类型':
|
||||||
|
// 清空检查类型数据
|
||||||
|
checkTypeData.splice(0, checkTypeData.length);
|
||||||
|
|
||||||
const typeResponse = await listCheckType();
|
const typeResponse = await listCheckType();
|
||||||
if (typeResponse && typeResponse.data) {
|
if (typeResponse && typeResponse.data) {
|
||||||
// 确保data是数组类型
|
// 确保data是数组类型
|
||||||
@@ -683,7 +720,7 @@ async function loadMenuData(menu) {
|
|||||||
|
|
||||||
typeData.forEach((item, index) => {
|
typeData.forEach((item, index) => {
|
||||||
// 直接使用数据库中的department值,不进行转换
|
// 直接使用数据库中的department值,不进行转换
|
||||||
tableData.push({
|
checkTypeData.push({
|
||||||
id: item.id, // 保存id字段,用于判断是新增还是修改
|
id: item.id, // 保存id字段,用于判断是新增还是修改
|
||||||
row: (index + 1).toString(),
|
row: (index + 1).toString(),
|
||||||
code: item.code,
|
code: item.code,
|
||||||
@@ -700,28 +737,38 @@ async function loadMenuData(menu) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case '检查方法':
|
case '检查方法':
|
||||||
|
// 清空检查方法数据
|
||||||
|
checkMethodData.splice(0, checkMethodData.length);
|
||||||
|
|
||||||
|
// 构建检查方法的搜索参数
|
||||||
|
const methodParams = {
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 100, // 默认获取100条数据,可以根据需要调整
|
||||||
|
checkType: searchParamsMethod.checkType,
|
||||||
|
name: searchParamsMethod.name,
|
||||||
|
packageName: searchParamsMethod.packageName
|
||||||
|
};
|
||||||
try {
|
try {
|
||||||
const methodResponse = await listCheckMethod();
|
const methodResponse = await searchCheckMethod(methodParams);
|
||||||
|
|
||||||
// 确保data是数组
|
// 确保data是数组,适配不同的后端返回格式
|
||||||
let dataArray = [];
|
let methodData = [];
|
||||||
if (methodResponse) {
|
if (methodResponse) {
|
||||||
if (Array.isArray(methodResponse)) {
|
if (Array.isArray(methodResponse)) {
|
||||||
// 如果整个响应就是数组
|
methodData = methodResponse;
|
||||||
dataArray = methodResponse;
|
|
||||||
} else if (methodResponse.data && Array.isArray(methodResponse.data)) {
|
} else if (methodResponse.data && Array.isArray(methodResponse.data)) {
|
||||||
// 如果响应对象的data属性是数组
|
methodData = methodResponse.data;
|
||||||
dataArray = methodResponse.data;
|
|
||||||
} else if (methodResponse.data && methodResponse.data.data && Array.isArray(methodResponse.data.data)) {
|
} else if (methodResponse.data && methodResponse.data.data && Array.isArray(methodResponse.data.data)) {
|
||||||
// 如果响应对象的data.data属性是数组(可能是后端包装了两层)
|
methodData = methodResponse.data.data;
|
||||||
dataArray = methodResponse.data.data;
|
} else if (methodResponse.data && methodResponse.data.records) {
|
||||||
|
methodData = methodResponse.data.records;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理数组数据
|
// 处理数组数据
|
||||||
if (dataArray.length > 0) {
|
if (methodData.length > 0) {
|
||||||
dataArray.forEach((item, index) => {
|
methodData.forEach((item, index) => {
|
||||||
tableData.push({
|
checkMethodData.push({
|
||||||
id: item.id, // 保存id字段,用于判断是新增还是修改
|
id: item.id, // 保存id字段,用于判断是新增还是修改
|
||||||
row: (index + 1).toString(),
|
row: (index + 1).toString(),
|
||||||
code: item.code,
|
code: item.code,
|
||||||
@@ -743,36 +790,38 @@ async function loadMenuData(menu) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case '检查部位':
|
case '检查部位':
|
||||||
|
// 清空检查部位数据
|
||||||
|
checkPartData.splice(0, checkPartData.length);
|
||||||
|
|
||||||
// 构建检查部位的搜索参数
|
// 构建检查部位的搜索参数
|
||||||
const partSearchParams = {
|
const partParams = {
|
||||||
code: searchParams.checkPartCode,
|
pageNo: 1,
|
||||||
name: searchParams.name,
|
pageSize: 100, // 默认获取100条数据,可以根据需要调整
|
||||||
checkType: searchParams.checkType,
|
checkType: searchParamsPart.checkType,
|
||||||
packageName: searchParams.packageName,
|
name: searchParamsPart.name,
|
||||||
visible: searchParams.visible
|
packageName: searchParamsPart.packageName
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
const partResponse = await listCheckPart(partSearchParams);
|
const partResponse = await searchCheckPart(partParams);
|
||||||
|
|
||||||
// 确保data是数组,适配不同的后端返回格式
|
// 确保data是数组,适配不同的后端返回格式
|
||||||
let partData = [];
|
let partData = [];
|
||||||
if (partResponse) {
|
if (partResponse) {
|
||||||
if (Array.isArray(partResponse)) {
|
if (Array.isArray(partResponse)) {
|
||||||
// 如果整个响应就是数组
|
|
||||||
partData = partResponse;
|
partData = partResponse;
|
||||||
} else if (partResponse.data && Array.isArray(partResponse.data)) {
|
} else if (partResponse.data && Array.isArray(partResponse.data)) {
|
||||||
// 如果响应对象的data属性是数组
|
|
||||||
partData = partResponse.data;
|
partData = partResponse.data;
|
||||||
} else if (partResponse.data && partResponse.data.data && Array.isArray(partResponse.data.data)) {
|
} else if (partResponse.data && partResponse.data.data && Array.isArray(partResponse.data.data)) {
|
||||||
// 如果响应对象的data.data属性是数组(可能是后端包装了两层)
|
|
||||||
partData = partResponse.data.data;
|
partData = partResponse.data.data;
|
||||||
|
} else if (partResponse.data && partResponse.data.records) {
|
||||||
|
partData = partResponse.data.records;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理数组数据
|
// 处理数组数据
|
||||||
if (partData.length > 0) {
|
if (partData.length > 0) {
|
||||||
partData.forEach((item, index) => {
|
partData.forEach((item, index) => {
|
||||||
tableData.push({
|
checkPartData.push({
|
||||||
id: item.id, // 保存id字段,用于判断是新增还是修改
|
id: item.id, // 保存id字段,用于判断是新增还是修改
|
||||||
row: (index + 1).toString(),
|
row: (index + 1).toString(),
|
||||||
code: item.code,
|
code: item.code,
|
||||||
@@ -1066,29 +1115,153 @@ function handleAdd(index) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 处理搜索功能
|
// 处理搜索功能
|
||||||
function handleSearch() {
|
async function handleSearch() {
|
||||||
console.log('搜索条件:', searchParams);
|
try {
|
||||||
// 这里可以根据activeMenu和searchParams实现不同的搜索逻辑
|
console.log('搜索条件:', currentSearchParams.value);
|
||||||
ElMessage.info(`正在搜索${activeMenu.value}数据...`);
|
// ElMessage.info(`正在搜索${activeMenu.value}数据...`);
|
||||||
|
|
||||||
// 模拟搜索延迟
|
switch(activeMenu.value) {
|
||||||
setTimeout(() => {
|
case '检查方法':
|
||||||
// 根据activeMenu执行相应的搜索逻辑
|
// 清空检查方法数据
|
||||||
loadMenuData(activeMenu.value);
|
checkMethodData.splice(0, checkMethodData.length);
|
||||||
}, 300);
|
|
||||||
|
// 构建检查方法的搜索参数
|
||||||
|
const methodParams = {
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 100, // 默认获取100条数据,可以根据需要调整
|
||||||
|
checkType: searchParamsMethod.checkType,
|
||||||
|
name: searchParamsMethod.name,
|
||||||
|
packageName: searchParamsMethod.packageName
|
||||||
|
};
|
||||||
|
|
||||||
|
const methodResponse = await searchCheckMethod(methodParams);
|
||||||
|
|
||||||
|
// 确保data是数组,适配不同的后端返回格式
|
||||||
|
let methodData = [];
|
||||||
|
if (methodResponse) {
|
||||||
|
if (Array.isArray(methodResponse)) {
|
||||||
|
methodData = methodResponse;
|
||||||
|
} else if (methodResponse.data && Array.isArray(methodResponse.data)) {
|
||||||
|
methodData = methodResponse.data;
|
||||||
|
} else if (methodResponse.data && methodResponse.data.data && Array.isArray(methodResponse.data.data)) {
|
||||||
|
methodData = methodResponse.data.data;
|
||||||
|
} else if (methodResponse.data && methodResponse.data.records) {
|
||||||
|
methodData = methodResponse.data.records;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理数组数据
|
||||||
|
if (methodData.length > 0) {
|
||||||
|
methodData.forEach((item, index) => {
|
||||||
|
checkMethodData.push({
|
||||||
|
id: item.id, // 保存id字段,用于判断是新增还是修改
|
||||||
|
row: (index + 1).toString(),
|
||||||
|
code: item.code,
|
||||||
|
name: item.name,
|
||||||
|
checkType: item.checkType || '',
|
||||||
|
packageName: item.packageName || '',
|
||||||
|
exposureNum: item.exposureNum || 0,
|
||||||
|
orderNum: item.orderNum || 0,
|
||||||
|
remark: item.remark || '',
|
||||||
|
actions: true
|
||||||
|
});
|
||||||
|
});
|
||||||
|
ElMessage.success(`搜索到${methodData.length}条检查方法数据`);
|
||||||
|
} else {
|
||||||
|
ElMessage.warning('未搜索到检查方法数据');
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '检查部位':
|
||||||
|
// 清空检查部位数据
|
||||||
|
checkPartData.splice(0, checkPartData.length);
|
||||||
|
|
||||||
|
// 构建检查部位的搜索参数
|
||||||
|
const partParams = {
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 100, // 默认获取100条数据,可以根据需要调整
|
||||||
|
checkType: searchParamsPart.checkType,
|
||||||
|
name: searchParamsPart.name,
|
||||||
|
packageName: searchParamsPart.packageName
|
||||||
|
};
|
||||||
|
|
||||||
|
const partResponse = await searchCheckPart(partParams);
|
||||||
|
|
||||||
|
// 确保data是数组,适配不同的后端返回格式
|
||||||
|
let partData = [];
|
||||||
|
if (partResponse) {
|
||||||
|
if (Array.isArray(partResponse)) {
|
||||||
|
partData = partResponse;
|
||||||
|
} else if (partResponse.data && Array.isArray(partResponse.data)) {
|
||||||
|
partData = partResponse.data;
|
||||||
|
} else if (partResponse.data && partResponse.data.data && Array.isArray(partResponse.data.data)) {
|
||||||
|
partData = partResponse.data.data;
|
||||||
|
} else if (partResponse.data && partResponse.data.records) {
|
||||||
|
partData = partResponse.data.records;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理数组数据
|
||||||
|
if (partData.length > 0) {
|
||||||
|
partData.forEach((item, index) => {
|
||||||
|
checkPartData.push({
|
||||||
|
id: item.id, // 保存id字段,用于判断是新增还是修改
|
||||||
|
row: (index + 1).toString(),
|
||||||
|
code: item.code,
|
||||||
|
name: item.name,
|
||||||
|
checkType: item.checkType || '',
|
||||||
|
exposureNum: item.exposureNum || 0,
|
||||||
|
packageName: item.packageName || '',
|
||||||
|
price: item.price || 0,
|
||||||
|
number: item.number || '999999',
|
||||||
|
serviceScope: item.serviceScope || '',
|
||||||
|
subType: item.subType || '',
|
||||||
|
remark: item.remark || '',
|
||||||
|
actions: true
|
||||||
|
});
|
||||||
|
});
|
||||||
|
ElMessage.success(`搜索到${partData.length}条检查部位数据`);
|
||||||
|
} else {
|
||||||
|
ElMessage.warning('未搜索到检查部位数据');
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// 其他菜单使用原有的加载逻辑
|
||||||
|
await loadMenuData(activeMenu.value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('搜索失败:', error);
|
||||||
|
ElMessage.error(`搜索${activeMenu.value}数据失败: ${error.message || '未知错误'}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理重置功能
|
// 处理重置功能
|
||||||
function handleReset() {
|
function handleReset() {
|
||||||
// 重置所有搜索条件
|
// 根据当前活动菜单重置对应的搜索条件
|
||||||
searchParams.checkMethod = '';
|
switch(activeMenu.value) {
|
||||||
searchParams.name = '';
|
case '检查类型':
|
||||||
searchParams.packageId = '';
|
for (const key in searchParamsType) {
|
||||||
searchParams.packageName = '';
|
searchParamsType[key] = '';
|
||||||
searchParams.checkType = '';
|
}
|
||||||
searchParams.checkPartCode = '';
|
break;
|
||||||
searchParams.checkPartName = '';
|
|
||||||
searchParams.visible = '';
|
case '检查方法':
|
||||||
|
searchParamsMethod.checkType = '';
|
||||||
|
searchParamsMethod.name = '';
|
||||||
|
searchParamsMethod.packageName = '';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '检查部位':
|
||||||
|
searchParamsPart.checkType = '';
|
||||||
|
searchParamsPart.name = '';
|
||||||
|
searchParamsPart.packageName = '';
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
ElMessage.info('搜索条件已重置');
|
ElMessage.info('搜索条件已重置');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user