维护系统->检查方法前端页面优化、接口功能完善(搜索栏和导出表格未处理),后端接口优化。
This commit is contained in:
@@ -2,7 +2,8 @@ package com.openhis.web.check.appservice;
|
|||||||
|
|
||||||
|
|
||||||
import com.core.common.core.domain.R;
|
import com.core.common.core.domain.R;
|
||||||
import com.openhis.web.check.dto.CheckMethodDto;
|
import com.openhis.check.domain.CheckMethod;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检查方法Service接口
|
* 检查方法Service接口
|
||||||
@@ -14,11 +15,11 @@ public interface ICheckMethodAppService{
|
|||||||
|
|
||||||
R<?> getCheckMethodList();
|
R<?> getCheckMethodList();
|
||||||
|
|
||||||
R<?> addCheckMethod(CheckMethodDto checkMethodDto);
|
R<?> addCheckMethod(CheckMethod checkMethod);
|
||||||
|
|
||||||
R<?> updateCheckMethod(CheckMethodDto checkPartDto);
|
R<?> updateCheckMethod(CheckMethod checkPart);
|
||||||
|
|
||||||
R<?> removeCheckMethod(Long code);
|
R<?> removeCheckMethod(Integer checkMethodId);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,63 +28,48 @@ public class CheckMethodAppServiceImpl implements ICheckMethodAppService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public R<?> addCheckMethod(CheckMethodDto checkMethodDto) {
|
public R<?> addCheckMethod(CheckMethod checkMethod) {
|
||||||
//1.参数校验
|
//1.数据校验
|
||||||
if(ObjectUtil.isEmpty(checkMethodDto.getName())){
|
if (ObjectUtil.isEmpty(checkMethod.getId())) {
|
||||||
return R.fail("检查方法名称不能为空");
|
return R.fail("检查方法id不能为空!");
|
||||||
}
|
}
|
||||||
if(ObjectUtil.isEmpty(checkMethodDto.getCheckType())){
|
if (ObjectUtil.isEmpty(checkMethod.getName())) {
|
||||||
return R.fail("检查类型不能为空");
|
return R.fail("检查方法名称不能为空!");
|
||||||
}
|
}
|
||||||
if(ObjectUtil.isEmpty(checkMethodDto.getCode())){
|
if (ObjectUtil.isEmpty(checkMethod.getCode())) {
|
||||||
return R.fail("代码不能为空");
|
return R.fail("检查方法代码不能为空!");
|
||||||
}
|
}
|
||||||
//2.判断是否有重复
|
if (ObjectUtil.isEmpty(checkMethod.getCheckType())) {
|
||||||
LambdaQueryWrapper<CheckMethod> wrapper = new LambdaQueryWrapper<CheckMethod>()
|
return R.fail("检查方法的检查类型不能为空!");
|
||||||
.eq(CheckMethod::getName, checkMethodDto.getName())
|
|
||||||
.eq(CheckMethod::getCheckType, checkMethodDto.getCheckType())
|
|
||||||
.eq(CheckMethod::getCode, checkMethodDto.getCode());
|
|
||||||
if (checkMethodService.getOne(wrapper) != null){
|
|
||||||
return R.fail("检查方法已存在");
|
|
||||||
}
|
}
|
||||||
|
//2.保存
|
||||||
//3.封装实体检查方法
|
|
||||||
CheckMethod checkMethod = new CheckMethod();
|
|
||||||
checkMethod.setName(checkMethodDto.getName());
|
|
||||||
checkMethod.setCheckType(checkMethodDto.getCheckType());
|
|
||||||
checkMethod.setCode(checkMethodDto.getCode());
|
|
||||||
checkMethod.setPackageName(checkMethodDto.getPackageName());
|
|
||||||
checkMethod.setExposureNum(checkMethodDto.getExposureNum());
|
|
||||||
checkMethod.setOrderNum(checkMethodDto.getOrderNum());
|
|
||||||
checkMethod.setRemark(checkMethodDto.getRemark());
|
|
||||||
//4.保存添加
|
|
||||||
boolean save = checkMethodService.save(checkMethod);
|
boolean save = checkMethodService.save(checkMethod);
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public R<?> updateCheckMethod(CheckMethodDto checkMethodDto) {
|
public R<?> updateCheckMethod(CheckMethod checkMethod) {
|
||||||
//1.参数校验
|
//1.数据校验
|
||||||
if(ObjectUtil.isEmpty(checkMethodDto.getName())){
|
if (ObjectUtil.isEmpty(checkMethod.getId())) {
|
||||||
return R.fail("检查方法名称不能为空");
|
return R.fail("检查方法id不能为空!");
|
||||||
}
|
}
|
||||||
if(ObjectUtil.isEmpty(checkMethodDto.getCheckType())){
|
if (ObjectUtil.isEmpty(checkMethod.getName())) {
|
||||||
return R.fail("检查类型不能为空");
|
return R.fail("检查方法名称不能为空!");
|
||||||
}
|
}
|
||||||
if(ObjectUtil.isEmpty(checkMethodDto.getCode())){
|
if (ObjectUtil.isEmpty(checkMethod.getCode())) {
|
||||||
return R.fail("代码不能为空");
|
return R.fail("检查方法代码不能为空!");
|
||||||
}
|
}
|
||||||
//2.
|
if (ObjectUtil.isEmpty(checkMethod.getCheckType())) {
|
||||||
return R.ok();
|
return R.fail("检查方法的检查类型不能为空!");
|
||||||
|
}
|
||||||
|
//2.更新
|
||||||
|
boolean b = checkMethodService.updateById(checkMethod);
|
||||||
|
return R.ok(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public R<?> removeCheckMethod(Long code) {
|
public R<?> removeCheckMethod(Integer checkMethodId) {
|
||||||
if (ObjectUtil.isEmpty(code)){
|
boolean remove = checkMethodService.removeById(checkMethodId);
|
||||||
return R.fail("检查方法代码不能为空");
|
|
||||||
}
|
|
||||||
LambdaQueryWrapper<CheckMethod> wrapper = new LambdaQueryWrapper<CheckMethod>().eq(CheckMethod::getCode, code);
|
|
||||||
boolean remove = checkMethodService.remove(wrapper);
|
|
||||||
return R.ok(remove);
|
return R.ok(remove);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.openhis.web.check.controller;
|
package com.openhis.web.check.controller;
|
||||||
|
|
||||||
import com.core.common.core.domain.R;
|
import com.core.common.core.domain.R;
|
||||||
|
import com.openhis.check.domain.CheckMethod;
|
||||||
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.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@@ -30,17 +30,17 @@ public class CheckMethodController {
|
|||||||
* @Param
|
* @Param
|
||||||
*/
|
*/
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
public R<?> addCheckMethod(@RequestBody CheckMethodDto checkMethodDto){
|
public R<?> addCheckMethod(@RequestBody CheckMethod checkMethod){
|
||||||
return R.ok(checkMethodAppService.addCheckMethod(checkMethodDto));
|
return R.ok(checkMethodAppService.addCheckMethod(checkMethod));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 删除检查方法
|
* 删除检查方法
|
||||||
* @Param code代码
|
* @Param code代码
|
||||||
*/
|
*/
|
||||||
@DeleteMapping("/delete/{code}")
|
@DeleteMapping("/delete/{checkMethodId}")
|
||||||
public R<?> deleteCheckMethod(@PathVariable Long code){
|
public R<?> deleteCheckMethod(@PathVariable Integer checkMethodId){
|
||||||
return R.ok(checkMethodAppService.removeCheckMethod(code));
|
return R.ok(checkMethodAppService.removeCheckMethod(checkMethodId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -48,7 +48,7 @@ public class CheckMethodController {
|
|||||||
* @Param
|
* @Param
|
||||||
*/
|
*/
|
||||||
@PutMapping("/update")
|
@PutMapping("/update")
|
||||||
public R<?> updateCheckMethod(@RequestBody CheckMethodDto checkMethodDto){
|
public R<?> updateCheckMethod(@RequestBody CheckMethod checkMethod){
|
||||||
return R.ok(checkMethodAppService.updateCheckMethod(checkMethodDto));
|
return R.ok(checkMethodAppService.updateCheckMethod(checkMethod));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public class CheckMethod {
|
|||||||
* 检查方法ID
|
* 检查方法ID
|
||||||
*/
|
*/
|
||||||
@TableId(type = IdType.AUTO)
|
@TableId(type = IdType.AUTO)
|
||||||
private Long id;
|
private Integer id;
|
||||||
|
|
||||||
/* 检查类型 */
|
/* 检查类型 */
|
||||||
private String checkType;
|
private String checkType;
|
||||||
|
|||||||
@@ -46,12 +46,38 @@ export function delCheckType(checkTypeId) {
|
|||||||
// 查询检查方法列表
|
// 查询检查方法列表
|
||||||
export function listCheckMethod(query) {
|
export function listCheckMethod(query) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/check-method/list',
|
url: '/check/method/list',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: query
|
params: query
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 新增检查方法
|
||||||
|
export function addCheckMethod(data) {
|
||||||
|
return request({
|
||||||
|
url: '/check/method/add',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改检查方法
|
||||||
|
export function updateCheckMethod(data) {
|
||||||
|
return request({
|
||||||
|
url: '/check/method/update',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除检查方法
|
||||||
|
export function delCheckMethod(checkMethodId) {
|
||||||
|
return request({
|
||||||
|
url: '/check/method/delete/' + checkMethodId,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 查询检查部位列表
|
// 查询检查部位列表
|
||||||
export function listCheckPart(query) {
|
export function listCheckPart(query) {
|
||||||
return request({
|
return request({
|
||||||
|
|||||||
@@ -83,7 +83,7 @@
|
|||||||
v-for="(item, index) in tableData"
|
v-for="(item, index) in tableData"
|
||||||
:key="index"
|
:key="index"
|
||||||
:class="{ 'editing-row': item.editing, 'child-row': item.row.includes('.') }"
|
:class="{ 'editing-row': item.editing, 'child-row': item.row.includes('.') }"
|
||||||
@click="handleRowClick(item)"
|
@click="handleEdit(index)"
|
||||||
>
|
>
|
||||||
<td>{{ item.row }}</td>
|
<td>{{ item.row }}</td>
|
||||||
<td>
|
<td>
|
||||||
@@ -198,15 +198,12 @@
|
|||||||
<template v-else-if="activeMenu === '检查方法'">
|
<template v-else-if="activeMenu === '检查方法'">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<h1>{{ activeMenu }}管理</h1>
|
<h1>{{ activeMenu }}管理</h1>
|
||||||
<div class="header-actions">
|
|
||||||
<button class="btn btn-add-new" @click="handleAddNewRow">+
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="search-bar search-bar-method">
|
||||||
<div class="search-bar">
|
<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="searchParams.checkMethod" placeholder="选择检查方法" style="width: 150px">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="type in checkTypes"
|
v-for="type in checkTypes"
|
||||||
:key="type"
|
:key="type"
|
||||||
@@ -232,6 +229,7 @@
|
|||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<div class="search-actions">
|
<div class="search-actions">
|
||||||
<el-button type="primary" :style="{ backgroundColor: hoverAddButton ? '#8a49e0' : '#722ED1', borderColor: hoverAddButton ? '#8a49e0' : '#722ED1' }" @mouseenter="hoverAddButton = true" @mouseleave="hoverAddButton = false" @click="handleAddNewRow">新增</el-button>
|
<el-button type="primary" :style="{ backgroundColor: hoverAddButton ? '#8a49e0' : '#722ED1', borderColor: hoverAddButton ? '#8a49e0' : '#722ED1' }" @mouseenter="hoverAddButton = true" @mouseleave="hoverAddButton = false" @click="handleAddNewRow">新增</el-button>
|
||||||
<el-button type="primary" @click="handleSearch">查询</el-button>
|
<el-button type="primary" @click="handleSearch">查询</el-button>
|
||||||
@@ -260,7 +258,7 @@
|
|||||||
v-for="(item, index) in tableData"
|
v-for="(item, index) in tableData"
|
||||||
:key="index"
|
:key="index"
|
||||||
:class="{ 'editing-row': item.editing }"
|
:class="{ 'editing-row': item.editing }"
|
||||||
@click="handleRowClick(item)"
|
@click=""
|
||||||
>
|
>
|
||||||
<td>{{ item.row }}</td>
|
<td>{{ item.row }}</td>
|
||||||
<td>
|
<td>
|
||||||
@@ -321,6 +319,9 @@
|
|||||||
</template>
|
</template>
|
||||||
</td>
|
</td>
|
||||||
<td class="actions">
|
<td class="actions">
|
||||||
|
<button class="btn btn-edit" @click.stop="handleEdit(index)">
|
||||||
|
✏️
|
||||||
|
</button>
|
||||||
<button class="btn btn-confirm" @click.stop="handleConfirm(index)">
|
<button class="btn btn-confirm" @click.stop="handleConfirm(index)">
|
||||||
✓
|
✓
|
||||||
</button>
|
</button>
|
||||||
@@ -338,12 +339,8 @@
|
|||||||
<template v-else-if="activeMenu === '检查部位'">
|
<template v-else-if="activeMenu === '检查部位'">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<h1>{{ activeMenu }}管理</h1>
|
<h1>{{ activeMenu }}管理</h1>
|
||||||
<div class="header-actions">
|
|
||||||
<button class="btn btn-add-new" @click="handleAddNewRow">+
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="search-bar search-bar-part">
|
||||||
<div class="search-bar">
|
|
||||||
<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="searchParams.checkType" placeholder="选择检查类型" style="width: 150px">
|
||||||
@@ -379,12 +376,12 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th style="width: 50px;">行</th>
|
<th style="width: 50px;">行</th>
|
||||||
<th style="width: 100px;">*编码</th>
|
<th style="width: 100px;">*编码</th>
|
||||||
<th style="width: 150px;">*名称</th>
|
<th style="width: 100px;">*名称</th>
|
||||||
<th style="width: 120px;">检查类型</th>
|
<th style="width: 120px;">检查类型</th>
|
||||||
<th style="width: 100px;">曝光次数</th>
|
<th style="width: 80px;">曝光次数</th>
|
||||||
<th style="width: 120px;">费用套餐</th>
|
<th style="width: 120px;">费用套餐</th>
|
||||||
<th style="width: 100px;">金额</th>
|
<th style="width: 80px;">金额</th>
|
||||||
<th style="width: 80px;">序号</th>
|
<th style="width: 50px;">序号</th>
|
||||||
<th style="width: 120px;">服务范围</th>
|
<th style="width: 120px;">服务范围</th>
|
||||||
<th style="width: 120px;">下级医技类型</th>
|
<th style="width: 120px;">下级医技类型</th>
|
||||||
<th style="width: 150px;">备注</th>
|
<th style="width: 150px;">备注</th>
|
||||||
@@ -396,7 +393,7 @@
|
|||||||
v-for="(item, index) in tableData"
|
v-for="(item, index) in tableData"
|
||||||
:key="index"
|
:key="index"
|
||||||
:class="{ 'editing-row': item.editing }"
|
:class="{ 'editing-row': item.editing }"
|
||||||
@click="handleRowClick(item)"
|
@click=""
|
||||||
>
|
>
|
||||||
<td>{{ item.row }}</td>
|
<td>{{ item.row }}</td>
|
||||||
<td>
|
<td>
|
||||||
@@ -480,6 +477,9 @@
|
|||||||
</template>
|
</template>
|
||||||
</td>
|
</td>
|
||||||
<td class="actions">
|
<td class="actions">
|
||||||
|
<button class="btn btn-edit" @click.stop="handleEdit(index)">
|
||||||
|
✏️
|
||||||
|
</button>
|
||||||
<button class="btn btn-confirm" @click.stop="handleConfirm(index)">
|
<button class="btn btn-confirm" @click.stop="handleConfirm(index)">
|
||||||
✓
|
✓
|
||||||
</button>
|
</button>
|
||||||
@@ -504,9 +504,9 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, reactive, onMounted } from 'vue';
|
import { ref, reactive, onMounted } from 'vue';
|
||||||
import { ElMessage } 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 } from '@/api/system/checkType';
|
import { listCheckType, listCheckMethod, listCheckPart, listCheckPackage, addCheckType, updateCheckType, delCheckType, addCheckMethod, updateCheckMethod, delCheckMethod } 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';
|
||||||
|
|
||||||
@@ -688,9 +688,27 @@ async function loadMenuData(menu) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case '检查方法':
|
case '检查方法':
|
||||||
|
try {
|
||||||
const methodResponse = await listCheckMethod();
|
const methodResponse = await listCheckMethod();
|
||||||
if (methodResponse && methodResponse.data) {
|
|
||||||
methodResponse.data.forEach((item, index) => {
|
// 确保data是数组
|
||||||
|
let dataArray = [];
|
||||||
|
if (methodResponse) {
|
||||||
|
if (Array.isArray(methodResponse)) {
|
||||||
|
// 如果整个响应就是数组
|
||||||
|
dataArray = methodResponse;
|
||||||
|
} else if (methodResponse.data && Array.isArray(methodResponse.data)) {
|
||||||
|
// 如果响应对象的data属性是数组
|
||||||
|
dataArray = methodResponse.data;
|
||||||
|
} else if (methodResponse.data && methodResponse.data.data && Array.isArray(methodResponse.data.data)) {
|
||||||
|
// 如果响应对象的data.data属性是数组(可能是后端包装了两层)
|
||||||
|
dataArray = methodResponse.data.data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理数组数据
|
||||||
|
if (dataArray.length > 0) {
|
||||||
|
dataArray.forEach((item, index) => {
|
||||||
tableData.push({
|
tableData.push({
|
||||||
id: item.id, // 保存id字段,用于判断是新增还是修改
|
id: item.id, // 保存id字段,用于判断是新增还是修改
|
||||||
row: (index + 1).toString(),
|
row: (index + 1).toString(),
|
||||||
@@ -704,6 +722,11 @@ async function loadMenuData(menu) {
|
|||||||
actions: true
|
actions: true
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
ElMessage.warning('未获取到检查方法数据');
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
ElMessage.error(`加载检查方法数据失败: ${error.message || '未知错误'}`);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -750,18 +773,30 @@ async function loadMenuData(menu) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理行点击,进入编辑状态
|
// 处理编辑按钮点击
|
||||||
function handleRowClick(item) {
|
function handleEdit(index) {
|
||||||
if (!item.editing) {
|
const item = tableData[index];
|
||||||
item.editing = true;
|
item.editing = true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// 处理确认按钮点击
|
// 处理确认按钮点击
|
||||||
async function handleConfirm(index) {
|
async function handleConfirm(index) {
|
||||||
const item = tableData[index];
|
const item = tableData[index];
|
||||||
try {
|
try {
|
||||||
// 根据是否有id判断是新增还是修改
|
// 根据当前激活的菜单调用不同的API
|
||||||
|
if (activeMenu.value === '检查方法') {
|
||||||
|
// 检查方法的保存逻辑
|
||||||
|
if (item.id) {
|
||||||
|
// 修改操作
|
||||||
|
await updateCheckMethod(item);
|
||||||
|
} else {
|
||||||
|
// 新增操作
|
||||||
|
const newItem = await addCheckMethod(item);
|
||||||
|
// 将新增的id赋值给本地数据
|
||||||
|
item.id = newItem.id;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 检查类型的保存逻辑
|
||||||
if (item.id) {
|
if (item.id) {
|
||||||
// 修改操作
|
// 修改操作
|
||||||
await updateCheckType(item);
|
await updateCheckType(item);
|
||||||
@@ -771,33 +806,42 @@ async function handleConfirm(index) {
|
|||||||
// 将新增的id赋值给本地数据
|
// 将新增的id赋值给本地数据
|
||||||
item.id = newItem.id;
|
item.id = newItem.id;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// 退出编辑状态
|
// 退出编辑状态
|
||||||
tableData[index].editing = false;
|
tableData[index].editing = false;
|
||||||
// 显示保存成功提示
|
// 显示保存成功提示
|
||||||
alert(`第 ${item.row} 行数据已保存`);
|
ElMessage.success(`第 ${item.row} 行数据已保存`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('保存失败:', error);
|
ElMessage.error('保存失败,请稍后重试');
|
||||||
alert('保存失败,请稍后重试');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理删除按钮点击
|
// 处理删除按钮点击
|
||||||
async function handleDelete(index) {
|
async function handleDelete(index) {
|
||||||
if (confirm('确定要删除这一行吗?')) {
|
ElMessageBox.confirm('确定要删除这一行吗?', '系统提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(async () => {
|
||||||
const item = tableData[index];
|
const item = tableData[index];
|
||||||
try {
|
try {
|
||||||
// 如果有id,调用API删除数据库中的数据
|
// 如果有id,调用API删除数据库中的数据
|
||||||
if (item.id) {
|
if (item.id) {
|
||||||
|
if (activeMenu.value === '检查方法') {
|
||||||
|
await delCheckMethod(item.id);
|
||||||
|
} else {
|
||||||
await delCheckType(item.id);
|
await delCheckType(item.id);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// 从数组中删除该行数据
|
// 从数组中删除该行数据
|
||||||
tableData.splice(index, 1);
|
tableData.splice(index, 1);
|
||||||
alert('删除成功!');
|
ElMessage.success('删除成功!');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('删除失败:', error);
|
ElMessage.error('删除失败,请稍后重试');
|
||||||
alert('删除失败,请稍后重试');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
// 用户取消删除操作
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理添加新行按钮点击
|
// 处理添加新行按钮点击
|
||||||
@@ -834,10 +878,10 @@ function handleAddNewRow() {
|
|||||||
row: String(maxRowNum + 1),
|
row: String(maxRowNum + 1),
|
||||||
code: '',
|
code: '',
|
||||||
name: '',
|
name: '',
|
||||||
type: '',
|
checkType: '',
|
||||||
department: '',
|
packageName: '',
|
||||||
amount: '0.00',
|
exposureNum: 0,
|
||||||
number: '999999',
|
orderNum: 0,
|
||||||
remark: '',
|
remark: '',
|
||||||
editing: true, // 新行默认进入编辑状态
|
editing: true, // 新行默认进入编辑状态
|
||||||
isNew: true, // 标记为新增行
|
isNew: true, // 标记为新增行
|
||||||
@@ -1039,6 +1083,26 @@ select {
|
|||||||
gap: 16px;
|
gap: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 检查方法搜索栏特定样式 */
|
||||||
|
.search-bar-method {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-bar-method .search-filters {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 16px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-bar-method .search-actions {
|
||||||
|
margin-left: auto;
|
||||||
|
display: flex;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
.search-item {
|
.search-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -1148,7 +1212,7 @@ th {
|
|||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
line-height: 24px;
|
line-height: 24px;
|
||||||
text-align: left;
|
text-align: center;
|
||||||
border-bottom: 1px solid #D9D9D9;
|
border-bottom: 1px solid #D9D9D9;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1159,13 +1223,16 @@ td {
|
|||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
line-height: 24px;
|
line-height: 24px;
|
||||||
border-bottom: 1px solid #e8e8e8;
|
border-bottom: 1px solid #e8e8e8;
|
||||||
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 操作按钮样式 */
|
/* 操作按钮样式 */
|
||||||
.actions {
|
.actions {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-end;
|
justify-content: center;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
|
position: relative;
|
||||||
|
z-index: 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn {
|
.btn {
|
||||||
@@ -1180,6 +1247,18 @@ td {
|
|||||||
transition: all 0.2s ease;
|
transition: all 0.2s ease;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
position: relative;
|
||||||
|
z-index: 10;
|
||||||
|
background-color: #66b1ff;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-delete {
|
||||||
|
background-color: #FF4D4F;
|
||||||
|
color: white;
|
||||||
|
font-size: 14px;
|
||||||
|
z-index: 20;
|
||||||
|
pointer-events: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-confirm {
|
.btn-confirm {
|
||||||
@@ -1187,6 +1266,12 @@ td {
|
|||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.btn-edit {
|
||||||
|
background-color: #FFC107;
|
||||||
|
color: white;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
.btn-add {
|
.btn-add {
|
||||||
background-color: #1890FF;
|
background-color: #1890FF;
|
||||||
color: white;
|
color: white;
|
||||||
|
|||||||
Reference in New Issue
Block a user