Merge branch 'develop' of https://gitea.gentronhealth.com/wangyizhe/his into develop

This commit is contained in:
2026-03-10 18:39:28 +08:00
7 changed files with 133 additions and 73 deletions

View File

@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.core.common.core.domain.R; import com.core.common.core.domain.R;
import com.core.common.core.domain.model.LoginUser;
import com.core.common.utils.SecurityUtils; import com.core.common.utils.SecurityUtils;
import com.core.common.core.domain.model.LoginUser; import com.core.common.core.domain.model.LoginUser;
import com.openhis.infectious.domain.InfectiousAudit; import com.openhis.infectious.domain.InfectiousAudit;
@@ -39,7 +40,7 @@ import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
* 报卡管理 Service实现 * 报卡管理 Service 实现
* *
* @author system * @author system
* @date 2026-03-05 * @date 2026-03-05
@@ -102,7 +103,7 @@ public class CardManageAppServiceImpl implements ICardManageAppService {
IPage<InfectiousCard> result = infectiousCardMapper.selectPage(page, wrapper); IPage<InfectiousCard> result = infectiousCardMapper.selectPage(page, wrapper);
// 转换为DTO // 转换为 DTO
List<InfectiousCardDto> list = result.getRecords().stream().map(this::convertToDto).collect(Collectors.toList()); List<InfectiousCardDto> list = result.getRecords().stream().map(this::convertToDto).collect(Collectors.toList());
Map<String, Object> resultMap = new HashMap<>(); Map<String, Object> resultMap = new HashMap<>();
@@ -177,7 +178,7 @@ public class CardManageAppServiceImpl implements ICardManageAppService {
if (card == null) continue; if (card == null) continue;
if ("2".equals(card.getStatus()) || "3".equals(card.getStatus())) continue; if ("2".equals(card.getStatus()) || "3".equals(card.getStatus())) continue;
// 更新状态为退回(审核失败) // 更新状态为退回 (审核失败)
String oldStatus = card.getStatus(); String oldStatus = card.getStatus();
card.setStatus("5"); card.setStatus("5");
card.setReturnReason(batchReturnDto.getReturnReason()); card.setReturnReason(batchReturnDto.getReturnReason());
@@ -316,12 +317,12 @@ public class CardManageAppServiceImpl implements ICardManageAppService {
@Override @Override
public DoctorCardStatisticsDto getDoctorCardStatistics() { public DoctorCardStatisticsDto getDoctorCardStatistics() {
Long doctorId = SecurityUtils.getUserId(); Long doctorId = SecurityUtils.getUserId();
DoctorCardStatisticsDto dto = new DoctorCardStatisticsDto(); DoctorCardStatisticsDto dto = new DoctorCardStatisticsDto();
Integer totalCount = infectiousCardMapper.countByDoctorId(doctorId); Integer totalCount = infectiousCardMapper.countByDoctorId(doctorId);
Integer pendingFailedCount = infectiousCardMapper.countPendingFailedByDoctorId(doctorId); Integer pendingFailedCount = infectiousCardMapper.countPendingFailedByDoctorId(doctorId);
Integer reportedCount = infectiousCardMapper.countReportedByDoctorId(doctorId); Integer reportedCount = infectiousCardMapper.countReportedByDoctorId(doctorId);
dto.setTotalCount(totalCount != null ? totalCount : 0); dto.setTotalCount(totalCount != null ? totalCount : 0);
dto.setPendingFailedCount(pendingFailedCount != null ? pendingFailedCount : 0); dto.setPendingFailedCount(pendingFailedCount != null ? pendingFailedCount : 0);
dto.setReportedCount(reportedCount != null ? reportedCount : 0); dto.setReportedCount(reportedCount != null ? reportedCount : 0);
@@ -331,18 +332,18 @@ public class CardManageAppServiceImpl implements ICardManageAppService {
@Override @Override
public R<?> getDoctorCardPage(DoctorCardQueryDto queryParams) { public R<?> getDoctorCardPage(DoctorCardQueryDto queryParams) {
Long doctorId = SecurityUtils.getUserId(); Long doctorId = SecurityUtils.getUserId();
Page<InfectiousCard> page = new Page<>(queryParams.getPageNo(), queryParams.getPageSize()); Page<InfectiousCard> page = new Page<>(queryParams.getPageNo(), queryParams.getPageSize());
LambdaQueryWrapper<InfectiousCard> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<InfectiousCard> wrapper = new LambdaQueryWrapper<>();
// 只查询当前医生的报卡 // 只查询当前医生的报卡
wrapper.eq(InfectiousCard::getDoctorId, doctorId); wrapper.eq(InfectiousCard::getDoctorId, doctorId);
// 状态筛选 // 状态筛选
if (StringUtils.hasText(queryParams.getStatus())) { if (StringUtils.hasText(queryParams.getStatus())) {
wrapper.eq(InfectiousCard::getStatus, queryParams.getStatus()); wrapper.eq(InfectiousCard::getStatus, queryParams.getStatus());
} }
// 时间范围筛选 // 时间范围筛选
if (StringUtils.hasText(queryParams.getStartDate())) { if (StringUtils.hasText(queryParams.getStartDate())) {
LocalDateTime startDateTime = LocalDateTime.parse(queryParams.getStartDate() + "T00:00:00"); LocalDateTime startDateTime = LocalDateTime.parse(queryParams.getStartDate() + "T00:00:00");
@@ -352,7 +353,7 @@ public class CardManageAppServiceImpl implements ICardManageAppService {
LocalDateTime endDateTime = LocalDateTime.parse(queryParams.getEndDate() + "T23:59:59"); LocalDateTime endDateTime = LocalDateTime.parse(queryParams.getEndDate() + "T23:59:59");
wrapper.le(InfectiousCard::getCreateTime, endDateTime); wrapper.le(InfectiousCard::getCreateTime, endDateTime);
} }
// 关键词搜索(患者姓名或报卡名称) // 关键词搜索(患者姓名或报卡名称)
if (StringUtils.hasText(queryParams.getKeyword())) { if (StringUtils.hasText(queryParams.getKeyword())) {
wrapper.and(w -> w wrapper.and(w -> w
@@ -361,17 +362,17 @@ public class CardManageAppServiceImpl implements ICardManageAppService {
.like(InfectiousCard::getDiseaseName, queryParams.getKeyword()) .like(InfectiousCard::getDiseaseName, queryParams.getKeyword())
); );
} }
// 按创建时间倒序 // 按创建时间倒序
wrapper.orderByDesc(InfectiousCard::getCreateTime); wrapper.orderByDesc(InfectiousCard::getCreateTime);
IPage<InfectiousCard> result = infectiousCardMapper.selectPage(page, wrapper); IPage<InfectiousCard> result = infectiousCardMapper.selectPage(page, wrapper);
// 转换为DTO // 转换为 DTO
List<DoctorCardListDto> list = result.getRecords().stream() List<DoctorCardListDto> list = result.getRecords().stream()
.map(this::convertToDoctorCardListDto) .map(this::convertToDoctorCardListDto)
.collect(Collectors.toList()); .collect(Collectors.toList());
Map<String, Object> resultMap = new HashMap<>(); Map<String, Object> resultMap = new HashMap<>();
resultMap.put("list", list); resultMap.put("list", list);
resultMap.put("total", result.getTotal()); resultMap.put("total", result.getTotal());
@@ -385,22 +386,22 @@ public class CardManageAppServiceImpl implements ICardManageAppService {
if (card == null) { if (card == null) {
return R.fail("报卡不存在"); return R.fail("报卡不存在");
} }
// 验证权限:只能提交自己的报卡 // 验证权限:只能提交自己的报卡
if (!card.getDoctorId().equals(SecurityUtils.getUserId())) { if (!card.getDoctorId().equals(SecurityUtils.getUserId())) {
return R.fail("无权操作此报卡"); return R.fail("无权操作此报卡");
} }
// 验证状态:只有暂存状态可以提交 // 验证状态:只有暂存状态可以提交
if (!"0".equals(card.getStatus())) { if (!"0".equals(card.getStatus())) {
return R.fail("只能提交暂存状态的报卡"); return R.fail("只能提交暂存状态的报卡");
} }
// 更新状态为已提交 // 更新状态为已提交
card.setStatus("1"); card.setStatus("1");
card.setUpdateTime(new Date()); card.setUpdateTime(new Date());
infectiousCardMapper.updateById(card); infectiousCardMapper.updateById(card);
return R.ok("提交成功"); return R.ok("提交成功");
} }
@@ -411,22 +412,22 @@ public class CardManageAppServiceImpl implements ICardManageAppService {
if (card == null) { if (card == null) {
return R.fail("报卡不存在"); return R.fail("报卡不存在");
} }
// 验证权限:只能撤回自己的报卡 // 验证权限:只能撤回自己的报卡
if (!card.getDoctorId().equals(SecurityUtils.getUserId())) { if (!card.getDoctorId().equals(SecurityUtils.getUserId())) {
return R.fail("无权操作此报卡"); return R.fail("无权操作此报卡");
} }
// 验证状态:只有已提交状态可以撤回 // 验证状态:只有已提交状态可以撤回
if (!"1".equals(card.getStatus())) { if (!"1".equals(card.getStatus())) {
return R.fail("只能撤回已提交状态的报卡"); return R.fail("只能撤回已提交状态的报卡");
} }
// 更新状态为暂存 // 更新状态为暂存
card.setStatus("0"); card.setStatus("0");
card.setUpdateTime(new Date()); card.setUpdateTime(new Date());
infectiousCardMapper.updateById(card); infectiousCardMapper.updateById(card);
return R.ok("撤回成功"); return R.ok("撤回成功");
} }
@@ -437,22 +438,22 @@ public class CardManageAppServiceImpl implements ICardManageAppService {
if (card == null) { if (card == null) {
return R.fail("报卡不存在"); return R.fail("报卡不存在");
} }
// 验证权限:只能删除自己的报卡 // 验证权限:只能删除自己的报卡
if (!card.getDoctorId().equals(SecurityUtils.getUserId())) { if (!card.getDoctorId().equals(SecurityUtils.getUserId())) {
return R.fail("无权操作此报卡"); return R.fail("无权操作此报卡");
} }
// 验证状态:只有暂存状态可以删除 // 验证状态:只有暂存状态可以删除
if (!"0".equals(card.getStatus())) { if (!"0".equals(card.getStatus())) {
return R.fail("只能删除暂存状态的报卡"); return R.fail("只能删除暂存状态的报卡");
} }
// 更新状态为作废 // 更新状态为作废
card.setStatus("6"); card.setStatus("6");
card.setUpdateTime(new Date()); card.setUpdateTime(new Date());
infectiousCardMapper.updateById(card); infectiousCardMapper.updateById(card);
return R.ok("删除成功"); return R.ok("删除成功");
} }
@@ -462,31 +463,31 @@ public class CardManageAppServiceImpl implements ICardManageAppService {
if (cardNos == null || cardNos.isEmpty()) { if (cardNos == null || cardNos.isEmpty()) {
return R.fail("请选择要提交的报卡"); return R.fail("请选择要提交的报卡");
} }
Long doctorId = SecurityUtils.getUserId(); Long doctorId = SecurityUtils.getUserId();
int successCount = 0; int successCount = 0;
for (String cardNo : cardNos) { for (String cardNo : cardNos) {
InfectiousCard card = infectiousCardMapper.selectByCardNo(cardNo); InfectiousCard card = infectiousCardMapper.selectByCardNo(cardNo);
if (card == null) continue; if (card == null) continue;
// 验证权限:只能提交自己的报卡 // 验证权限:只能提交自己的报卡
if (!card.getDoctorId().equals(doctorId)) continue; if (!card.getDoctorId().equals(doctorId)) continue;
// 验证状态:只有暂存状态可以提交 // 验证状态:只有暂存状态可以提交
if (!"0".equals(card.getStatus())) continue; if (!"0".equals(card.getStatus())) continue;
// 更新状态为已提交 // 更新状态为已提交
card.setStatus("1"); card.setStatus("1");
card.setUpdateTime(new Date()); card.setUpdateTime(new Date());
infectiousCardMapper.updateById(card); infectiousCardMapper.updateById(card);
successCount++; successCount++;
} }
if (successCount == 0) { if (successCount == 0) {
return R.fail("没有可提交的报卡,只能提交暂存状态的报卡"); return R.fail("没有可提交的报卡,只能提交暂存状态的报卡");
} }
return R.ok("批量提交成功,共提交" + successCount + ""); return R.ok("批量提交成功,共提交" + successCount + "");
} }
@@ -496,31 +497,31 @@ public class CardManageAppServiceImpl implements ICardManageAppService {
if (cardNos == null || cardNos.isEmpty()) { if (cardNos == null || cardNos.isEmpty()) {
return R.fail("请选择要删除的报卡"); return R.fail("请选择要删除的报卡");
} }
Long doctorId = SecurityUtils.getUserId(); Long doctorId = SecurityUtils.getUserId();
int successCount = 0; int successCount = 0;
for (String cardNo : cardNos) { for (String cardNo : cardNos) {
InfectiousCard card = infectiousCardMapper.selectByCardNo(cardNo); InfectiousCard card = infectiousCardMapper.selectByCardNo(cardNo);
if (card == null) continue; if (card == null) continue;
// 验证权限:只能删除自己的报卡 // 验证权限:只能删除自己的报卡
if (!card.getDoctorId().equals(doctorId)) continue; if (!card.getDoctorId().equals(doctorId)) continue;
// 验证状态:只有暂存状态可以删除 // 验证状态:只有暂存状态可以删除
if (!"0".equals(card.getStatus())) continue; if (!"0".equals(card.getStatus())) continue;
// 更新状态为作废 // 更新状态为作废
card.setStatus("6"); card.setStatus("6");
card.setUpdateTime(new Date()); card.setUpdateTime(new Date());
infectiousCardMapper.updateById(card); infectiousCardMapper.updateById(card);
successCount++; successCount++;
} }
if (successCount == 0) { if (successCount == 0) {
return R.fail("没有可删除的报卡,只能删除暂存状态的报卡"); return R.fail("没有可删除的报卡,只能删除暂存状态的报卡");
} }
return R.ok("批量删除成功,共删除" + successCount + ""); return R.ok("批量删除成功,共删除" + successCount + "");
} }
@@ -529,35 +530,44 @@ public class CardManageAppServiceImpl implements ICardManageAppService {
// 获取当前登录用户信息 // 获取当前登录用户信息
LoginUser loginUser = SecurityUtils.getLoginUser(); LoginUser loginUser = SecurityUtils.getLoginUser();
Long currentUserId = loginUser.getUserId(); Long currentUserId = loginUser.getUserId();
// 查询报卡 // 查询报卡
InfectiousCard card = infectiousCardMapper.selectByCardNo(updateDto.getCardNo()); InfectiousCard card = infectiousCardMapper.selectByCardNo(updateDto.getCardNo());
if (card == null) { if (card == null) {
return R.fail("报卡不存在"); return R.fail("报卡不存在");
} }
// 验证是否当前医生的报卡 - 根据doctorId字段验证 // 验证是否当前医生的报卡 - 根据 doctorId 字段验证
if (!currentUserId.equals(card.getDoctorId())) { if (!currentUserId.equals(card.getDoctorId())) {
return R.fail("只能修改自己的报卡"); return R.fail("只能修改自己的报卡");
} }
// 验证状态是否允许修改(只能修改暂存状态的报卡) // 验证状态是否允许修改(只能修改暂存状态的报卡)
if (!"0".equals(card.getStatus())) { if (!"0".equals(card.getStatus())) {
return R.fail("只能修改暂存状态的报卡"); return R.fail("只能修改暂存状态的报卡");
} }
// 更新字段 // 更新字段
card.setPhone(updateDto.getPhone()); card.setPhone(updateDto.getPhone());
card.setOnsetDate(updateDto.getOnsetDate()); card.setOnsetDate(updateDto.getOnsetDate());
card.setDiagDate(updateDto.getDiagDate()); card.setDiagDate(updateDto.getDiagDate());
card.setDiseaseType(updateDto.getDiseaseType()); // 使用diseaseType字段 card.setDiseaseType(updateDto.getDiseaseType()); // 使用 diseaseType 字段
card.setAddressProv(updateDto.getAddressProv()); card.setAddressProv(updateDto.getAddressProv());
card.setAddressCity(updateDto.getAddressCity()); card.setAddressCity(updateDto.getAddressCity());
card.setAddressCounty(updateDto.getAddressCounty()); card.setAddressCounty(updateDto.getAddressCounty());
card.setAddressHouse(updateDto.getAddressHouse()); card.setAddressHouse(updateDto.getAddressHouse());
card.setUpdateTime(new Date()); card.setUpdateTime(new Date());
card.setUpdateBy(loginUser.getUsername()); // 使用username作为更新者 card.setUpdateBy(loginUser.getUsername()); // 使用username作为更新者
card.setUpdateTime(new Date());
card.setUpdateBy(loginUser.getUsername()); // 使用 username 作为更新者
card.setUpdateTime(new Date());
card.setUpdateBy(loginUser.getUsername()); // 使用 username 作为更新者
card.setUpdateTime(new Date());
card.setUpdateBy(loginUser.getUsername()); // 使用 username 作为更新者
int rows = infectiousCardMapper.updateById(card); int rows = infectiousCardMapper.updateById(card);
if (rows > 0) { if (rows > 0) {
return R.ok("更新成功"); return R.ok("更新成功");
@@ -571,25 +581,25 @@ public class CardManageAppServiceImpl implements ICardManageAppService {
if (card == null) { if (card == null) {
return; return;
} }
// 验证权限:只能导出自己的报卡 // 验证权限:只能导出自己的报卡
if (!card.getDoctorId().equals(SecurityUtils.getUserId())) { if (!card.getDoctorId().equals(SecurityUtils.getUserId())) {
return; return;
} }
// 验证状态:只有已上报状态可以导出 // 验证状态:只有已上报状态可以导出
if (!"3".equals(card.getStatus())) { if (!"3".equals(card.getStatus())) {
return; return;
} }
try { try {
// TODO: 实现Word导出逻辑使用Apache POI或其他库 // TODO: 实现 Word 导出逻辑,使用 Apache POI 或其他库
// 这里简化为返回文本内容 // 这里简化为返回文本内容
response.setContentType("application/vnd.openxmlformats-officedocument.wordprocessingml.document"); response.setContentType("application/vnd.openxmlformats-officedocument.wordprocessingml.document");
response.setHeader("Content-Disposition", "attachment;filename=" + response.setHeader("Content-Disposition", "attachment;filename=" +
URLEncoder.encode("传染病报告卡-" + cardNo + ".docx", StandardCharsets.UTF_8)); URLEncoder.encode("传染病报告卡-" + cardNo + ".docx", StandardCharsets.UTF_8));
// 实际应生成Word文档内容 // 实际应生成 Word 文档内容
response.getWriter().write("报卡编号:" + cardNo); response.getWriter().write("报卡编号:" + cardNo);
} catch (IOException e) { } catch (IOException e) {
log.error("导出报卡失败", e); log.error("导出报卡失败", e);
@@ -597,13 +607,13 @@ public class CardManageAppServiceImpl implements ICardManageAppService {
} }
/** /**
* 转换为医生报卡列表DTO * 转换为医生报卡列表 DTO
*/ */
private DoctorCardListDto convertToDoctorCardListDto(InfectiousCard card) { private DoctorCardListDto convertToDoctorCardListDto(InfectiousCard card) {
DoctorCardListDto dto = new DoctorCardListDto(); DoctorCardListDto dto = new DoctorCardListDto();
BeanUtils.copyProperties(card, dto); BeanUtils.copyProperties(card, dto);
dto.setCardName(getCardName(card.getCardNameCode())); dto.setCardName(getCardName(card.getCardNameCode()));
dto.setSubmitTime(card.getCreateTime() != null ? dto.setSubmitTime(card.getCreateTime() != null ?
new SimpleDateFormat("yyyy-MM-dd HH:mm").format(card.getCreateTime()) : null); new SimpleDateFormat("yyyy-MM-dd HH:mm").format(card.getCreateTime()) : null);
return dto; return dto;
} }
@@ -623,7 +633,7 @@ public class CardManageAppServiceImpl implements ICardManageAppService {
} }
/** /**
* 转换审核记录为DTO * 转换审核记录为 DTO
*/ */
private AuditRecordDto convertAuditToDto(InfectiousAudit audit) { private AuditRecordDto convertAuditToDto(InfectiousAudit audit) {
AuditRecordDto dto = new AuditRecordDto(); AuditRecordDto dto = new AuditRecordDto();
@@ -633,7 +643,7 @@ public class CardManageAppServiceImpl implements ICardManageAppService {
} }
/** /**
* 转换为报卡DTO * 转换为报卡 DTO
*/ */
private InfectiousCardDto convertToDto(InfectiousCard card) { private InfectiousCardDto convertToDto(InfectiousCard card) {
InfectiousCardDto dto = new InfectiousCardDto(); InfectiousCardDto dto = new InfectiousCardDto();

View File

@@ -70,6 +70,14 @@ public interface IPurchaseInventoryAppService {
*/ */
R<?> deleteReceipt(List<Long> supplyRequestIds); R<?> deleteReceipt(List<Long> supplyRequestIds);
/**
* 根据单据号删除单据
*
* @param busNoList 单据号列表
* @return 操作结果
*/
R<?> deleteReceiptByBusNo(List<String> busNoList);
/** /**
* 提交审批 * 提交审批
* *

View File

@@ -271,6 +271,33 @@ public class PurchaseInventoryAppServiceImpl implements IPurchaseInventoryAppSer
: R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null)); : R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
} }
/**
* 根据单据号删除单据
*
* @param busNoList 单据号列表
* @return 操作结果
*/
@Override
public R<?> deleteReceiptByBusNo(List<String> busNoList) {
// 收集所有需要删除的 supplyRequestId
List<Long> allRequestIdList = new ArrayList<>();
for (String busNo : busNoList) {
List<SupplyRequest> supplyRequestIdList = supplyRequestService.getSupplyByBusNo(busNo);
List<Long> requestIdList = supplyRequestIdList.stream()
.map(SupplyRequest::getId)
.toList();
allRequestIdList.addAll(requestIdList);
}
// 删除单据
if (!allRequestIdList.isEmpty()) {
boolean result = supplyRequestService.removeByIds(allRequestIdList);
return result ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null))
: R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
}
return R.ok();
}
/** /**
* 提交审批 * 提交审批
* *

View File

@@ -102,6 +102,17 @@ public class PurchaseInventoryController {
return purchaseInventoryAppService.deleteReceipt(supplyRequestIds); return purchaseInventoryAppService.deleteReceipt(supplyRequestIds);
} }
/**
* 根据单据号删除单据
*
* @param busNoList 单据号列表
* @return 操作结果
*/
@DeleteMapping("/inventory-receipt-by-bus-no")
public R<?> deleteInventoryReceiptByBusNo(@RequestParam List<String> busNoList) {
return purchaseInventoryAppService.deleteReceiptByBusNo(busNoList);
}
/** /**
* 提交审批 * 提交审批
* *

View File

@@ -551,7 +551,7 @@
<script setup name="InventoryReceiptDialog"> <script setup name="InventoryReceiptDialog">
import { import {
addPurchaseinventory, addPurchaseInventory,
delPurchaseinventory, delPurchaseinventory,
getCount, getCount,
getDispensaryList, getDispensaryList,
@@ -755,7 +755,7 @@ function handleClickOutside(event) {
function saveRow(row, index) { function saveRow(row, index) {
form.purchaseinventoryList[index] = row; form.purchaseinventoryList[index] = row;
addPurchaseinventory(row).then((response) => { addPurchaseInventory(row).then((response) => {
reset(); reset();
data.isAdding = false; // 允许新增下一行 data.isAdding = false; // 允许新增下一行
proxy.$message.success('保存成功!'); proxy.$message.success('保存成功!');
@@ -846,7 +846,7 @@ function handleSave(row, index) {
if (valid) { if (valid) {
proxy.$refs['formRef'].validate((valid) => { proxy.$refs['formRef'].validate((valid) => {
if (valid) { if (valid) {
addPurchaseinventory(row).then((res) => { addPurchaseInventory(row).then((res) => {
// 当前行没有id视为首次新增 // 当前行没有id视为首次新增
if (!row.id) { if (!row.id) {
data.isAdding = false; // 允许新增下一行 data.isAdding = false; // 允许新增下一行

View File

@@ -19,7 +19,7 @@ export function getpurchaseInventoryDetail(busNo) {
} }
// 添加/编辑入库单据 // 添加/编辑入库单据
export function addPurchaseinventory(data) { export function addPurchaseInventory(data) {
return request({ return request({
url: '/inventory-manage/purchase/inventory-receipt', url: '/inventory-manage/purchase/inventory-receipt',
method: 'put', method: 'put',
@@ -45,7 +45,7 @@ export function getInitBusNo() {
} }
// 删除单据 // 删除单据(根据供应请求 ID
export function delPurchaseinventory(param) { export function delPurchaseinventory(param) {
return request({ return request({
url: '/inventory-manage/purchase/inventory-receipt?supplyRequestIds=' + param, url: '/inventory-manage/purchase/inventory-receipt?supplyRequestIds=' + param,
@@ -53,6 +53,14 @@ export function delPurchaseinventory(param) {
}) })
} }
// 删除单据(根据单据号)
export function delPurchaseinventoryByBusNo(busNoList) {
return request({
url: '/inventory-manage/purchase/inventory-receipt-by-bus-no?busNoList=' + busNoList,
method: 'delete',
})
}
// 提交审批 // 提交审批
export function submitApproval(busNo) { export function submitApproval(busNo) {
return request({ return request({

View File

@@ -396,7 +396,7 @@
<script setup name="Purchaseinventory"> <script setup name="Purchaseinventory">
import { import {
delPurchaseinventory, delPurchaseinventoryByBusNo,
generatedReturnDetail, generatedReturnDetail,
getInit, getInit,
getpurchaseInventoryDetail, getpurchaseInventoryDetail,
@@ -644,18 +644,14 @@ function handleSelectionChangeReturn(selection) {
} }
/** 删除按钮操作 */ /** 删除按钮操作 */
function handleDelete(row) { function handleDelete(row) {
let length = selectedRows.value.length; // 获取选中行的单据号列表
let ids = []; const busNoList = selectedRows.value.map((item) => item.supplyBusNo);
if (selectedRows.value[0].id) {
ids = selectedRows.value.map((item) => {
return item.id;
});
}
const deleteIds = selectedRows.value.map((item) => item.supplierId).join(',');
proxy.$modal proxy.$modal
.confirm('是否确认删除以上数据?') .confirm('是否确认删除以上数据?')
.then(function () { .then(function () {
return delPurchaseinventory(ids); // 调用后端接口,根据单据号删除
return delPurchaseinventoryByBusNo(busNoList);
}) })
.then(() => { .then(() => {
getList(); getList();