检查方法、检查部位前端页面、完善后端接口逻辑
This commit is contained in:
@@ -2,6 +2,7 @@ package com.openhis.web.check.appservice.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
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.openhis.check.domain.CheckMethod;
|
||||
import com.openhis.check.service.ICheckMethodService;
|
||||
@@ -46,9 +47,16 @@ public class CheckMethodAppServiceImpl implements ICheckMethodAppService {
|
||||
if (checkMethodService.getOne(wrapper) != null){
|
||||
return R.fail("检查方法已存在");
|
||||
}
|
||||
|
||||
//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);
|
||||
return R.ok();
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.openhis.web.check.appservice.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.check.domain.CheckPart;
|
||||
import com.openhis.check.service.ICheckPartService;
|
||||
@@ -23,12 +25,49 @@ public class CheckPartAppServiceImpl implements ICheckPartAppService {
|
||||
|
||||
@Override
|
||||
public R<?> addCheckPart(CheckPartDto checkPartDto) {
|
||||
//数据检验
|
||||
if(ObjectUtil.isEmpty(checkPartDto.getName())){
|
||||
return R.fail("检查项目名称不能为空");
|
||||
}
|
||||
if(ObjectUtil.isEmpty(checkPartDto.getCode())){
|
||||
return R.fail("检查项目代码不能为空");
|
||||
}
|
||||
if(ObjectUtil.isEmpty(checkPartDto.getCheckType())){
|
||||
return R.fail("检查项目类型不能为空");
|
||||
}
|
||||
//唯一性检验
|
||||
LambdaQueryWrapper<CheckPart> wrapper = new LambdaQueryWrapper<CheckPart>()
|
||||
.eq(CheckPart::getName, checkPartDto.getName())
|
||||
.eq(CheckPart::getCode, checkPartDto.getCode())
|
||||
.eq(CheckPart::getCheckType, checkPartDto.getCheckType());
|
||||
if (checkPartService.getOne(wrapper) != null){
|
||||
return R.fail("检查部位已存在");
|
||||
}
|
||||
//封装数据
|
||||
CheckPart checkPart = new CheckPart();
|
||||
checkPart.setName(checkPartDto.getName());
|
||||
checkPart.setCode(checkPartDto.getCode());
|
||||
checkPart.setCheckType(checkPartDto.getCheckType());
|
||||
checkPart.setExposureNum(checkPartDto.getExposureNum());
|
||||
checkPart.setPackageName(checkPartDto.getPackageName());
|
||||
checkPart.setPrice(checkPartDto.getPrice());
|
||||
checkPart.setNumber(checkPartDto.getNumber());
|
||||
checkPart.setServiceScope(checkPartDto.getServiceScope());
|
||||
checkPart.setSubType(checkPartDto.getSubType());
|
||||
checkPart.setRemark(checkPartDto.getRemark());
|
||||
//保存
|
||||
checkPartService.save(checkPart);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> removeCheckPart(Long code) {
|
||||
return R.ok();
|
||||
if (ObjectUtil.isEmpty(code)){
|
||||
return R.fail("检查项目代码不能为空");
|
||||
}
|
||||
LambdaQueryWrapper<CheckPart> wrapper = new LambdaQueryWrapper<CheckPart>().eq(CheckPart::getCode, code);
|
||||
boolean remove = checkPartService.remove(wrapper);
|
||||
return R.ok(remove);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,10 +2,7 @@ package com.openhis.web.check.dto;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@@ -6,5 +6,36 @@ import lombok.experimental.Accessors;
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class CheckPartDto {
|
||||
/** 检查部位id */
|
||||
private Long id;
|
||||
|
||||
/** 检查部位名称 */
|
||||
private String name;
|
||||
|
||||
/** 检查部位编码 */
|
||||
private String code;
|
||||
|
||||
/** 检查部位检查类型 */
|
||||
private String checkType;
|
||||
|
||||
/** 曝光次数 */
|
||||
private Integer exposureNum;
|
||||
|
||||
/** 费用套餐 */
|
||||
private String packageName;
|
||||
|
||||
/** 金额 */
|
||||
private Double price;
|
||||
|
||||
/** 序号 */
|
||||
private Integer number;
|
||||
|
||||
/** 服务范围 */
|
||||
private String serviceScope;
|
||||
|
||||
/** 下级医技类型 */
|
||||
private String subType;
|
||||
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
}
|
||||
|
||||
@@ -52,157 +52,444 @@
|
||||
@switch-to-settings="handleSwitchToSettings"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<!-- 检查类型/方法/部位的表格视图 -->
|
||||
<template v-else>
|
||||
<div class="header">
|
||||
<!-- 检查类型的表格视图 -->
|
||||
<template v-if="activeMenu === '检查类型'">
|
||||
<div class="header">
|
||||
<h1>{{ activeMenu }}管理</h1>
|
||||
<div class="header-actions">
|
||||
<button class="btn btn-add-new" @click="handleAddNewRow">
|
||||
+
|
||||
</button>
|
||||
<div class="header-actions">
|
||||
<button class="btn btn-add-new" @click="handleAddNewRow">+
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="table-container">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 50px;">行</th>
|
||||
<th style="width: 100px;">*编码</th>
|
||||
<th style="width: 150px;">*名称</th>
|
||||
<th style="width: 150px;">*检查类型</th>
|
||||
<th style="width: 120px;">选择部位</th>
|
||||
<th style="width: 150px;">*执行科室</th>
|
||||
<th style="width: 100px;">序号</th>
|
||||
<th style="width: 150px;">备注</th>
|
||||
<th style="width: 120px;">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr
|
||||
v-for="(item, index) in tableData"
|
||||
:key="index"
|
||||
:class="{ 'editing-row': item.editing, 'child-row': item.row.includes('.') }"
|
||||
@click="handleRowClick(item)"
|
||||
>
|
||||
<td>{{ item.row }}</td>
|
||||
<td>
|
||||
<template v-if="item.editing">
|
||||
<input type="text" placeholder="请输入编码" v-model="item.code">
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ item.code }}
|
||||
</template>
|
||||
</td>
|
||||
<td>
|
||||
<template v-if="item.editing">
|
||||
<input type="text" placeholder="请输入名称" v-model="item.name">
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ item.name }}
|
||||
</template>
|
||||
</td>
|
||||
<td>
|
||||
<template v-if="item.editing">
|
||||
<select v-model="item.type" :class="{ 'placeholder-text': !item.type }">
|
||||
<option value="">选择检查类型</option>
|
||||
<option
|
||||
v-for="type in checkTypes"
|
||||
:key="type"
|
||||
:value="type"
|
||||
|
||||
|
||||
<div class="table-container">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 50px;">行</th>
|
||||
<th style="width: 100px;">*编码</th>
|
||||
<th style="width: 150px;">*名称</th>
|
||||
<th style="width: 150px;">*检查类型</th>
|
||||
<th style="width: 120px;">选择部位</th>
|
||||
<th style="width: 150px;">*执行科室</th>
|
||||
<th style="width: 100px;">序号</th>
|
||||
<th style="width: 150px;">备注</th>
|
||||
<th style="width: 120px;">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr
|
||||
v-for="(item, index) in tableData"
|
||||
:key="index"
|
||||
:class="{ 'editing-row': item.editing, 'child-row': item.row.includes('.') }"
|
||||
@click="handleRowClick(item)"
|
||||
>
|
||||
<td>{{ item.row }}</td>
|
||||
<td>
|
||||
<template v-if="item.editing">
|
||||
<input type="text" placeholder="请输入编码" v-model="item.code">
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ item.code }}
|
||||
</template>
|
||||
</td>
|
||||
<td>
|
||||
<template v-if="item.editing">
|
||||
<input type="text" placeholder="请输入名称" v-model="item.name">
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ item.name }}
|
||||
</template>
|
||||
</td>
|
||||
<td>
|
||||
<template v-if="item.editing">
|
||||
<select v-model="item.type" :class="{ 'placeholder-text': !item.type }">
|
||||
<option value="">选择检查类型</option>
|
||||
<option
|
||||
v-for="type in checkTypes"
|
||||
:key="type"
|
||||
:value="type"
|
||||
>
|
||||
{{ type }}
|
||||
</option>
|
||||
</select>
|
||||
</template>
|
||||
<template v-else>
|
||||
<span v-if="item.type">{{ item.type }}</span>
|
||||
<span v-else class="placeholder-text">选择检查类型</span>
|
||||
</template>
|
||||
</td>
|
||||
<td class="checkbox-container">
|
||||
<input type="checkbox" v-model="item.selected" @click.stop>
|
||||
</td>
|
||||
<td>
|
||||
<template v-if="item.editing">
|
||||
<select v-model="item.department" :class="{ 'placeholder-text': !item.department }">
|
||||
<option value="">选择执行科室</option>
|
||||
<option
|
||||
v-if="item.department"
|
||||
:value="item.department"
|
||||
>
|
||||
{{ item.department }}
|
||||
</option>
|
||||
<option
|
||||
v-for="dept in departments"
|
||||
:key="dept.dictValue"
|
||||
:value="dept.dictLabel"
|
||||
>
|
||||
{{ dept.dictLabel }}
|
||||
</option>
|
||||
</select>
|
||||
</template>
|
||||
<template v-else>
|
||||
<span v-if="item.department">{{ item.department }}</span>
|
||||
<span v-else class="placeholder-text">选择执行科室</span>
|
||||
</template>
|
||||
</td>
|
||||
<td>
|
||||
<template v-if="item.editing">
|
||||
<input type="text" v-model="item.number">
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ item.number }}
|
||||
</template>
|
||||
</td>
|
||||
<td>
|
||||
<template v-if="item.editing">
|
||||
<input type="text" placeholder="请输入备注" v-model="item.remark">
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ item.remark || '' }}
|
||||
</template>
|
||||
</td>
|
||||
<td class="actions">
|
||||
<template v-if="item.actions">
|
||||
<button class="btn btn-confirm" @click.stop="handleConfirm(index)">
|
||||
✓
|
||||
</button>
|
||||
<button
|
||||
v-if="!item.row.includes('.')"
|
||||
class="btn btn-add"
|
||||
@click.stop="handleAdd(index)"
|
||||
>
|
||||
{{ type }}
|
||||
</option>
|
||||
</select>
|
||||
</template>
|
||||
<template v-else>
|
||||
<span v-if="item.type">{{ item.type }}</span>
|
||||
<span v-else class="placeholder-text">选择检查类型</span>
|
||||
</template>
|
||||
</td>
|
||||
<td class="checkbox-container">
|
||||
<input type="checkbox" v-model="item.selected" @click.stop>
|
||||
</td>
|
||||
<td>
|
||||
<template v-if="item.editing">
|
||||
<select v-model="item.department" :class="{ 'placeholder-text': !item.department }">
|
||||
<option value="">选择执行科室</option>
|
||||
<!-- 添加当前值作为第一个选项,确保能显示 -->
|
||||
<option
|
||||
v-if="item.department"
|
||||
:value="item.department"
|
||||
>
|
||||
{{ item.department }}
|
||||
</option>
|
||||
<!-- 然后显示所有科室选项 -->
|
||||
<option
|
||||
v-for="dept in departments"
|
||||
:key="dept.dictValue"
|
||||
:value="dept.dictLabel"
|
||||
>
|
||||
{{ dept.dictLabel }}
|
||||
</option>
|
||||
</select>
|
||||
</template>
|
||||
<template v-else>
|
||||
<span v-if="item.department">{{ item.department }}</span>
|
||||
<span v-else class="placeholder-text">选择执行科室</span>
|
||||
</template>
|
||||
</td>
|
||||
<td>
|
||||
<template v-if="item.editing">
|
||||
<input type="text" v-model="item.number">
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ item.number }}
|
||||
</template>
|
||||
</td>
|
||||
<td>
|
||||
<template v-if="item.editing">
|
||||
<input type="text" placeholder="请输入备注" v-model="item.remark">
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ item.remark || '' }}
|
||||
</template>
|
||||
</td>
|
||||
<td class="actions">
|
||||
<template v-if="item.actions">
|
||||
<button class="btn btn-confirm" @click.stop="handleConfirm(index)">
|
||||
✓
|
||||
</button>
|
||||
<button
|
||||
v-if="!item.row.includes('.')"
|
||||
class="btn btn-add"
|
||||
@click.stop="handleAdd(index)"
|
||||
>
|
||||
+
|
||||
</button>
|
||||
<button class="btn btn-delete" @click.stop="handleDelete(index)">
|
||||
+
|
||||
</button>
|
||||
<button class="btn btn-delete" @click.stop="handleDelete(index)">
|
||||
🗑
|
||||
</button>
|
||||
</template>
|
||||
<template v-else>
|
||||
</template>
|
||||
<template v-else>
|
||||
<button class="btn btn-confirm" @click.stop="handleConfirm(index)">
|
||||
✓
|
||||
</button>
|
||||
<button class="btn btn-delete" @click.stop="handleDelete(index)">
|
||||
🗑
|
||||
</button>
|
||||
</template>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- 检查方法的表格视图 -->
|
||||
<template v-else-if="activeMenu === '检查方法'">
|
||||
<div class="header">
|
||||
<h1>{{ activeMenu }}管理</h1>
|
||||
<div class="header-actions">
|
||||
<button class="btn btn-add-new" @click="handleAddNewRow">+
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="search-bar">
|
||||
<div class="search-item">
|
||||
<label>检查方法</label>
|
||||
<el-select v-model="searchParams.checkMethod" placeholder="选择检查方法" style="width: 150px">
|
||||
<el-option
|
||||
v-for="method in checkMethods"
|
||||
:key="method.code"
|
||||
:label="method.name"
|
||||
:value="method.code"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<div class="search-item">
|
||||
<label>名称</label>
|
||||
<el-input placeholder="名称/编码" v-model="searchParams.name" />
|
||||
</div>
|
||||
<div class="search-item">
|
||||
<label>使用套餐</label>
|
||||
<el-select v-model="searchParams.packageId" placeholder="选择使用套餐" style="width: 150px">
|
||||
<el-option
|
||||
v-for="pkg in checkPackages"
|
||||
:key="pkg.id"
|
||||
:label="pkg.name"
|
||||
:value="pkg.id"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<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" @click="handleSearch">查询</el-button>
|
||||
<el-button @click="handleReset">重置</el-button>
|
||||
<el-button type="success" @click="handleExport">导出表格</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="table-container">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 50px;">行</th>
|
||||
<th style="width: 100px;">*编码</th>
|
||||
<th style="width: 150px;">*方法名称</th>
|
||||
<th style="width: 150px;">关联检查类型</th>
|
||||
<th style="width: 150px;">*执行科室</th>
|
||||
<th style="width: 100px;">收费金额</th>
|
||||
<th style="width: 100px;">序号</th>
|
||||
<th style="width: 150px;">备注</th>
|
||||
<th style="width: 120px;">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr
|
||||
v-for="(item, index) in tableData"
|
||||
:key="index"
|
||||
:class="{ 'editing-row': item.editing }"
|
||||
@click="handleRowClick(item)"
|
||||
>
|
||||
<td>{{ item.row }}</td>
|
||||
<td>
|
||||
<template v-if="item.editing">
|
||||
<input type="text" placeholder="请输入编码" v-model="item.code">
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ item.code }}
|
||||
</template>
|
||||
</td>
|
||||
<td>
|
||||
<template v-if="item.editing">
|
||||
<input type="text" placeholder="请输入方法名称" v-model="item.name">
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ item.name }}
|
||||
</template>
|
||||
</td>
|
||||
<td>
|
||||
<template v-if="item.editing">
|
||||
<select v-model="item.type" :class="{ 'placeholder-text': !item.type }">
|
||||
<option value="">选择关联检查类型</option>
|
||||
<option
|
||||
v-for="type in checkTypes"
|
||||
:key="type"
|
||||
:value="type"
|
||||
>
|
||||
{{ type }}
|
||||
</option>
|
||||
</select>
|
||||
</template>
|
||||
<template v-else>
|
||||
<span v-if="item.type">{{ item.type }}</span>
|
||||
<span v-else class="placeholder-text">选择关联检查类型</span>
|
||||
</template>
|
||||
</td>
|
||||
<td>
|
||||
<template v-if="item.editing">
|
||||
<select v-model="item.department" :class="{ 'placeholder-text': !item.department }">
|
||||
<option value="">选择执行科室</option>
|
||||
<option
|
||||
v-if="item.department"
|
||||
:value="item.department"
|
||||
>
|
||||
{{ item.department }}
|
||||
</option>
|
||||
<option
|
||||
v-for="dept in departments"
|
||||
:key="dept.dictValue"
|
||||
:value="dept.dictLabel"
|
||||
>
|
||||
{{ dept.dictLabel }}
|
||||
</option>
|
||||
</select>
|
||||
</template>
|
||||
<template v-else>
|
||||
<span v-if="item.department">{{ item.department }}</span>
|
||||
<span v-else class="placeholder-text">选择执行科室</span>
|
||||
</template>
|
||||
</td>
|
||||
<td>
|
||||
<template v-if="item.editing">
|
||||
<input type="number" min="0" step="0.01" placeholder="请输入收费金额" v-model="item.amount">
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ item.amount || '0.00' }}
|
||||
</template>
|
||||
</td>
|
||||
<td>
|
||||
<template v-if="item.editing">
|
||||
<input type="text" v-model="item.number">
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ item.number || '999999' }}
|
||||
</template>
|
||||
</td>
|
||||
<td>
|
||||
<template v-if="item.editing">
|
||||
<input type="text" placeholder="请输入备注" v-model="item.remark">
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ item.remark || '' }}
|
||||
</template>
|
||||
</td>
|
||||
<td class="actions">
|
||||
<button class="btn btn-confirm" @click.stop="handleConfirm(index)">
|
||||
✓
|
||||
</button>
|
||||
<button class="btn btn-delete" @click.stop="handleDelete(index)">
|
||||
🗑
|
||||
</button>
|
||||
</template>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
🗑
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- 检查部位的表格视图 -->
|
||||
<template v-else-if="activeMenu === '检查部位'">
|
||||
<div class="header">
|
||||
<h1>{{ activeMenu }}管理</h1>
|
||||
<div class="header-actions">
|
||||
<button class="btn btn-add-new" @click="handleAddNewRow">+
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="search-bar">
|
||||
<div class="search-item">
|
||||
<label>检查方法</label>
|
||||
<el-select v-model="searchParams.checkMethod" placeholder="选择检查方法" style="width: 150px">
|
||||
<el-option
|
||||
v-for="method in checkMethods"
|
||||
:key="method.code"
|
||||
:label="method.name"
|
||||
:value="method.code"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<div class="search-item">
|
||||
<label>名称</label>
|
||||
<el-input placeholder="名称/编码" v-model="searchParams.name" />
|
||||
</div>
|
||||
<div class="search-item">
|
||||
<label>费用套餐</label>
|
||||
<el-input placeholder="名称" v-model="searchParams.name" />
|
||||
</div>
|
||||
|
||||
<div class="search-actions">
|
||||
<el-button type="primary" @click="handleAddNewRow">新增</el-button>
|
||||
<el-button type="primary" @click="handleSearch">查询</el-button>
|
||||
<el-button @click="handleReset">重置</el-button>
|
||||
<el-button type="success" @click="handleExport">导出表格</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="table-container">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 50px;">行</th>
|
||||
<th style="width: 100px;">*编码</th>
|
||||
<th style="width: 150px;">*部位名称</th>
|
||||
<th style="width: 120px;">优先级</th>
|
||||
<th style="width: 100px;">是否可见</th>
|
||||
<th style="width: 100px;">序号</th>
|
||||
<th style="width: 150px;">备注</th>
|
||||
<th style="width: 120px;">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr
|
||||
v-for="(item, index) in tableData"
|
||||
:key="index"
|
||||
:class="{ 'editing-row': item.editing }"
|
||||
@click="handleRowClick(item)"
|
||||
>
|
||||
<td>{{ item.row }}</td>
|
||||
<td>
|
||||
<template v-if="item.editing">
|
||||
<input type="text" placeholder="请输入编码" v-model="item.code">
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ item.code }}
|
||||
</template>
|
||||
</td>
|
||||
<td>
|
||||
<template v-if="item.editing">
|
||||
<input type="text" placeholder="请输入部位名称" v-model="item.name">
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ item.name }}
|
||||
</template>
|
||||
</td>
|
||||
<td>
|
||||
<template v-if="item.editing">
|
||||
<input type="number" min="1" placeholder="请输入优先级" v-model="item.priority">
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ item.priority || '1' }}
|
||||
</template>
|
||||
</td>
|
||||
<td>
|
||||
<template v-if="item.editing">
|
||||
<select v-model="item.visible">
|
||||
<option value="1">是</option>
|
||||
<option value="0">否</option>
|
||||
</select>
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ item.visible === '1' ? '是' : '否' }}
|
||||
</template>
|
||||
</td>
|
||||
<td>
|
||||
<template v-if="item.editing">
|
||||
<input type="text" v-model="item.number">
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ item.number || '999999' }}
|
||||
</template>
|
||||
</td>
|
||||
<td>
|
||||
<template v-if="item.editing">
|
||||
<input type="text" placeholder="请输入备注" v-model="item.remark">
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ item.remark || '' }}
|
||||
</template>
|
||||
</td>
|
||||
<td class="actions">
|
||||
<button class="btn btn-confirm" @click.stop="handleConfirm(index)">
|
||||
✓
|
||||
</button>
|
||||
<button class="btn btn-delete" @click.stop="handleDelete(index)">
|
||||
🗑
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</template>
|
||||
<!-- 分页区域 -->
|
||||
<div class="pagination">
|
||||
<button class="pagination-btn">‹</button>
|
||||
<span>1</span>
|
||||
<button class="pagination-btn">›</button>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -236,6 +523,19 @@ const departments = ref([]);
|
||||
// 表格数据
|
||||
const tableData = reactive([]);
|
||||
|
||||
// 搜索条件
|
||||
const searchParams = reactive({
|
||||
checkMethod: '',
|
||||
name: '',
|
||||
packageId: '',
|
||||
checkPartCode: '',
|
||||
checkPartName: '',
|
||||
visible: ''
|
||||
});
|
||||
|
||||
// 按钮悬停状态
|
||||
const hoverAddButton = ref(false);
|
||||
|
||||
// 从数据库获取所有检查相关数据
|
||||
onMounted(async () => {
|
||||
try {
|
||||
@@ -362,6 +662,7 @@ async function loadMenuData(menu) {
|
||||
typeResponse.data.forEach((item, index) => {
|
||||
// 直接使用数据库中的department值,不进行转换
|
||||
tableData.push({
|
||||
id: item.id, // 保存id字段,用于判断是新增还是修改
|
||||
row: (index + 1).toString(),
|
||||
code: item.code,
|
||||
name: item.name,
|
||||
@@ -379,27 +680,57 @@ async function loadMenuData(menu) {
|
||||
case '检查方法':
|
||||
const methodResponse = await listCheckMethod();
|
||||
if (methodResponse && methodResponse.data) {
|
||||
|
||||
methodResponse.data.forEach((item, index) => {
|
||||
tableData.push({
|
||||
id: item.id, // 保存id字段,用于判断是新增还是修改
|
||||
row: (index + 1).toString(),
|
||||
code: item.code,
|
||||
name: item.name,
|
||||
type: item.type || '',
|
||||
department: item.department || '',
|
||||
amount: item.amount || '0.00',
|
||||
number: item.number || '999999',
|
||||
remark: item.remark || '',
|
||||
actions: true
|
||||
});
|
||||
});
|
||||
}
|
||||
break;
|
||||
|
||||
case '检查部位':
|
||||
const partResponse = await listCheckPart();
|
||||
// 构建检查部位的搜索参数
|
||||
const partSearchParams = {
|
||||
code: searchParams.checkPartCode,
|
||||
name: searchParams.checkPartName,
|
||||
visible: searchParams.visible
|
||||
};
|
||||
const partResponse = await listCheckPart(partSearchParams);
|
||||
if (partResponse && partResponse.data) {
|
||||
|
||||
partResponse.data.forEach((item, index) => {
|
||||
tableData.push({
|
||||
id: item.id, // 保存id字段,用于判断是新增还是修改
|
||||
row: (index + 1).toString(),
|
||||
code: item.code,
|
||||
name: item.name,
|
||||
priority: item.priority || '1',
|
||||
visible: item.visible !== undefined ? String(item.visible) : '1',
|
||||
number: item.number || '999999',
|
||||
remark: item.remark || '',
|
||||
actions: true
|
||||
});
|
||||
});
|
||||
}
|
||||
break;
|
||||
|
||||
case '套餐设置':
|
||||
const packageResponse = await listCheckPackage();
|
||||
if (packageResponse && packageResponse.data) {
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载菜单数据失败:', error);
|
||||
alert(`加载${menu}数据失败,请检查网络或服务状态`);
|
||||
ElMessage.error(`加载${menu}数据失败,请检查网络或服务状态`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -455,23 +786,78 @@ async function handleDelete(index) {
|
||||
|
||||
// 处理添加新行按钮点击
|
||||
function handleAddNewRow() {
|
||||
// 生成新行的行号
|
||||
const newRowNumber = tableData.length + 1;
|
||||
// 获取当前最大行号,为新建行生成行号
|
||||
const maxRowNum = Math.max(
|
||||
0,
|
||||
...tableData.map(item => {
|
||||
// 处理子行编号,如"1.1"只取主行号"1"
|
||||
const rowParts = item.row.split('.');
|
||||
return parseInt(rowParts[0]) || 0;
|
||||
})
|
||||
);
|
||||
|
||||
// 添加新行数据
|
||||
tableData.push({
|
||||
row: newRowNumber.toString(),
|
||||
code: '',
|
||||
name: '',
|
||||
type: '',
|
||||
selected: true,
|
||||
department: '',
|
||||
number: '999999',
|
||||
remark: '',
|
||||
actions: true,
|
||||
editing: true, // 新行默认进入编辑状态
|
||||
isNew: true // 标记为新增行
|
||||
});
|
||||
let newRow;
|
||||
|
||||
// 根据当前激活的菜单生成不同的初始数据结构
|
||||
if (activeMenu.value === '检查类型') {
|
||||
newRow = {
|
||||
row: String(maxRowNum + 1),
|
||||
code: '',
|
||||
name: '',
|
||||
type: '',
|
||||
selected: true,
|
||||
department: '',
|
||||
number: '999999',
|
||||
remark: '',
|
||||
editing: true, // 新行默认进入编辑状态
|
||||
isNew: true, // 标记为新增行
|
||||
actions: true
|
||||
};
|
||||
} else if (activeMenu.value === '检查方法') {
|
||||
newRow = {
|
||||
row: String(maxRowNum + 1),
|
||||
code: '',
|
||||
name: '',
|
||||
type: '',
|
||||
department: '',
|
||||
amount: '0.00',
|
||||
number: '999999',
|
||||
remark: '',
|
||||
editing: true, // 新行默认进入编辑状态
|
||||
isNew: true, // 标记为新增行
|
||||
actions: true
|
||||
};
|
||||
} else if (activeMenu.value === '检查部位') {
|
||||
newRow = {
|
||||
row: String(maxRowNum + 1),
|
||||
code: '',
|
||||
name: '',
|
||||
priority: '1',
|
||||
visible: '1',
|
||||
number: '999999',
|
||||
remark: '',
|
||||
editing: true, // 新行默认进入编辑状态
|
||||
isNew: true, // 标记为新增行
|
||||
actions: true
|
||||
};
|
||||
} else {
|
||||
// 默认数据结构
|
||||
newRow = {
|
||||
row: String(maxRowNum + 1),
|
||||
code: '',
|
||||
name: '',
|
||||
type: '',
|
||||
selected: true,
|
||||
department: '',
|
||||
number: '999999',
|
||||
remark: '',
|
||||
editing: true, // 新行默认进入编辑状态
|
||||
isNew: true, // 标记为新增行
|
||||
actions: true
|
||||
};
|
||||
}
|
||||
|
||||
tableData.push(newRow);
|
||||
}
|
||||
|
||||
// 处理添加按钮点击
|
||||
@@ -495,6 +881,41 @@ function handleAdd(index) {
|
||||
// 在父行后插入子行
|
||||
tableData.splice(index + 1, 0, childRow);
|
||||
}
|
||||
|
||||
// 处理搜索功能
|
||||
function handleSearch() {
|
||||
console.log('搜索条件:', searchParams);
|
||||
// 这里可以根据activeMenu和searchParams实现不同的搜索逻辑
|
||||
ElMessage.info(`正在搜索${activeMenu.value}数据...`);
|
||||
|
||||
// 模拟搜索延迟
|
||||
setTimeout(() => {
|
||||
// 根据activeMenu执行相应的搜索逻辑
|
||||
loadMenuData(activeMenu.value);
|
||||
}, 300);
|
||||
}
|
||||
|
||||
// 处理重置功能
|
||||
function handleReset() {
|
||||
// 重置所有搜索条件
|
||||
searchParams.checkMethod = '';
|
||||
searchParams.name = '';
|
||||
searchParams.packageId = '';
|
||||
searchParams.checkPartCode = '';
|
||||
searchParams.checkPartName = '';
|
||||
searchParams.visible = '';
|
||||
|
||||
ElMessage.info('搜索条件已重置');
|
||||
}
|
||||
|
||||
// 处理导出表格功能
|
||||
function handleExport() {
|
||||
console.log('导出表格:', activeMenu.value);
|
||||
ElMessage.success(`正在导出${activeMenu.value}数据,请稍候...`);
|
||||
|
||||
// 这里可以实现实际的导出逻辑
|
||||
// 例如调用API或使用前端库生成Excel文件
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@@ -583,6 +1004,83 @@ select {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* 搜索栏样式 */
|
||||
.search-bar {
|
||||
background-color: #FFFFFF;
|
||||
padding: 16px;
|
||||
border-radius: 8px;
|
||||
margin-bottom: 16px;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
|
||||
border: 1px solid #D9D9D9;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.search-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.search-item label {
|
||||
font-size: 14px;
|
||||
color: #000000;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.search-item select,
|
||||
.search-item input {
|
||||
width: 150px;
|
||||
height: 32px;
|
||||
padding: 0 8px;
|
||||
border: 1px solid #D9D9D9;
|
||||
border-radius: 4px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.search-actions {
|
||||
margin-left: auto;
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.search-actions .btn {
|
||||
width: auto;
|
||||
height: 32px;
|
||||
padding: 0 16px;
|
||||
border-radius: 4px;
|
||||
font-size: 14px;
|
||||
cursor: pointer;
|
||||
border: none;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.btn-purple {
|
||||
background-color: #722ED1;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.btn-blue {
|
||||
background-color: #1890FF;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.btn-default {
|
||||
background-color: #FFFFFF;
|
||||
color: #000000;
|
||||
border: 1px solid #D9D9D9;
|
||||
}
|
||||
|
||||
.btn-green {
|
||||
background-color: #52C41A;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.search-actions .btn:hover {
|
||||
opacity: 0.85;
|
||||
}
|
||||
|
||||
.header-actions {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
|
||||
Reference in New Issue
Block a user