169 库房管理-》采购管理-》采购管理:选中采购管理中的数据,点击删除报错,已解决,并新增批量删除功能

This commit is contained in:
liuliu
2026-03-10 18:07:07 +08:00
parent 39b608dfd0
commit 066c457d90
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;
@@ -558,6 +559,15 @@ public class CardManageAppServiceImpl implements ICardManageAppService {
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("更新成功");

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();