批量收货

main
HUOJIN\92525 2025-03-31 17:25:55 +08:00
parent ece5371380
commit 89c0ea49d1
6 changed files with 144 additions and 12 deletions

View File

@ -45,4 +45,11 @@ export const asnDetailApi = {
return postRequest('/asnDetail/batchDelete', idList); return postRequest('/asnDetail/batchDelete', idList);
}, },
/**
* @author
*/
batchReceive: (idList: number[]) => {
return postRequest('/asnDetail/batchReceive', idList);
},
}; };

View File

@ -0,0 +1,19 @@
/**
* api
*
* @Author:
* @Date: 2025-03-26 15:16:28
* @Copyright
*/
import {postRequest} from '/@/lib/axios';
export const receiveApi = {
/**
* @author
*/
batchReceive: (idList: number[]) => {
return postRequest('/receive/batchReceive', idList);
},
};

View File

@ -118,7 +118,7 @@ function changeAreaSelect(selectValue: any) {
async function onSubmit() { async function onSubmit() {
try { try {
await formRef.value.validateFields(); await formRef.value.validateFields();
save(); await save();
} catch (err) { } catch (err) {
message.error('参数验证错误,请仔细填写表单数据!'); message.error('参数验证错误,请仔细填写表单数据!');
} }

View File

@ -92,6 +92,10 @@
<template #bodyCell="{ text, record, column }"> <template #bodyCell="{ text, record, column }">
<template v-if="column.dataIndex === 'asnNumber'">
<a @click="showForm(record)">{{ record.asnNumber }}</a>
</template>
<template v-if="column.dataIndex === 'orderType'"> <template v-if="column.dataIndex === 'orderType'">
{{ $smartEnumPlugin.getDescByValue('ASN_ORDER_TYPE_ENUM', text) }} {{ $smartEnumPlugin.getDescByValue('ASN_ORDER_TYPE_ENUM', text) }}
</template> </template>
@ -111,7 +115,8 @@
</template> </template>
编辑 编辑
</a-button> </a-button>
<a-button @click="onDelete(record)" danger type="link" v-privilege="'asn:delete'"> <a-button @click="onDelete(record)" danger type="link"
:disabled="record.orderQuantity-record.receivedQuantity==0" v-privilege="'asn:delete'">
<template #icon> <template #icon>
<DeleteOutlined/> <DeleteOutlined/>
</template> </template>
@ -214,6 +219,7 @@ const columns = ref([
{ {
title: '操作', title: '操作',
dataIndex: 'action', dataIndex: 'action',
align: 'center',
fixed: 'right', fixed: 'right',
width: 140, width: 140,
}, },

View File

@ -18,19 +18,29 @@
</div> </div>
<div class="smart-table-setting-block"> <div class="smart-table-setting-block">
<a-button class="button-style" type="primary" @click="showForm" :disabled="props.asnId==0"> <a-button class="button-style" type="primary" v-privilege="'asnDetail:add'" @click="showForm"
:disabled="props.asnId==0">
<template #icon> <template #icon>
<PlusOutlined/> <PlusOutlined/>
</template> </template>
添加明细 添加明细
</a-button> </a-button>
<a-button class="button-style" type="primary" danger <a-button class="button-style" type="primary" v-privilege="'receive:batchReceive'" @click="confirmBatchReceive"
:disabled="props.asnId==0 || selectedRowKeyList.length == 0">
<template #icon>
<EditOutlined/>
</template>
批量收货
</a-button>
<a-button class="button-style" type="primary" v-privilege="'asnDetail:batchDelete'" @click="confirmBatchDelete"
danger
:disabled="props.asnId==0 || selectedRowKeyList.length == 0"> :disabled="props.asnId==0 || selectedRowKeyList.length == 0">
<template #icon> <template #icon>
<DeleteOutlined/> <DeleteOutlined/>
</template> </template>
批量移除 批量移除
</a-button> </a-button>
<TableOperator v-model="columns" :tableId="TABLE_ID_CONST.BUSINESS.RECEIVE.ASN_DETAIL" :refresh="queryData"/> <TableOperator v-model="columns" :tableId="TABLE_ID_CONST.BUSINESS.RECEIVE.ASN_DETAIL" :refresh="queryData"/>
</div> </div>
@ -48,13 +58,15 @@
<template #bodyCell="{ text, record, index, column }"> <template #bodyCell="{ text, record, index, column }">
<template v-if="column.dataIndex === 'action'"> <template v-if="column.dataIndex === 'action'">
<div class="smart-table-operate"> <div class="smart-table-operate">
<a-button @click="showForm(record)" type="link" v-privilege="'asnDetail:update'"> <a-button @click="showForm(record)" type="link" :disabled="record.orderQuantity-record.receivedQuantity==0"
v-privilege="'asnDetail:update'">
<template #icon> <template #icon>
<EditOutlined/> <EditOutlined/>
</template> </template>
编辑 编辑
</a-button> </a-button>
<a-button @click="onDelete(record)" danger type="link" v-privilege="'asnDetail:delete'"> <a-button @click="onDelete(record)" danger type="link"
:disabled="record.orderQuantity-record.receivedQuantity==0" v-privilege="'asnDetail:delete'">
<template #icon> <template #icon>
<DeleteOutlined/> <DeleteOutlined/>
</template> </template>
@ -92,6 +104,7 @@ import {smartSentry} from '/@/lib/smart-sentry';
import {TABLE_ID_CONST} from "/@/constants/support/table-id-const"; import {TABLE_ID_CONST} from "/@/constants/support/table-id-const";
import TableOperator from "/@/components/support/table-operator/index.vue"; import TableOperator from "/@/components/support/table-operator/index.vue";
import {asnDetailApi} from "/@/api/business/receive/asnDetail/asn-detail-api"; import {asnDetailApi} from "/@/api/business/receive/asnDetail/asn-detail-api";
import {receiveApi} from "/@/api/business/receive/receive-api";
import AsnDetailForm from "/@/views/business/receive/asnDetail/asn-detail-form.vue"; import AsnDetailForm from "/@/views/business/receive/asnDetail/asn-detail-form.vue";
import {message, Modal} from "ant-design-vue"; import {message, Modal} from "ant-design-vue";
import {SmartLoading} from '/@/components/framework/smart-loading'; import {SmartLoading} from '/@/components/framework/smart-loading';
@ -139,7 +152,7 @@ const columns = reactive([
const defaultQueryForm = { const defaultQueryForm = {
pageNum: 1, pageNum: 1,
pageSize: PAGE_SIZE, pageSize: PAGE_SIZE,
asnId: undefined, asnId: 0,
keyword: undefined, keyword: undefined,
} }
@ -197,7 +210,7 @@ function showForm(data: object) {
} }
// //
function onDelete(data) { function onDelete(data: object) {
Modal.confirm({ Modal.confirm({
title: '提示', title: '提示',
content: '确定要删除选吗?', content: '确定要删除选吗?',
@ -213,11 +226,89 @@ function onDelete(data) {
} }
// //
async function requestDelete(data) { async function requestDelete(data: any) {
SmartLoading.show(); SmartLoading.show();
try { try {
await asnDetailApi.delete(data.asnDetailId); const response = await asnDetailApi.delete(data.asnDetailId);
message.success('删除成功'); const {error, success} = JSON.parse(response.msg);
if (error) {
message.error(error);
}
if (success) {
message.success(success);
}
await queryData();
} catch (e) {
smartSentry.captureError(e);
} finally {
SmartLoading.hide();
}
}
//
function confirmBatchDelete() {
Modal.confirm({
title: '提示',
content: '确定要批量删除这些数据吗?',
okText: '删除',
okType: 'danger',
onOk() {
requestBatchDelete();
},
cancelText: '取消',
onCancel() {
},
});
}
//
async function requestBatchDelete() {
try {
SmartLoading.show();
const response = await asnDetailApi.batchDelete(selectedRowKeyList.value);
const {error, success} = JSON.parse(response.msg);
if (error) {
message.error(error);
}
if (success) {
message.success(success);
}
await queryData();
} catch (e) {
smartSentry.captureError(e);
} finally {
SmartLoading.hide();
}
}
// confirmBatchReceive
function confirmBatchReceive() {
Modal.confirm({
title: '提示',
content: '确定是否批量收货?',
okText: '确认',
okType: 'danger',
onOk() {
requestBatchReceive();
},
cancelText: '取消',
onCancel() {
},
});
}
//
async function requestBatchReceive() {
try {
SmartLoading.show();
const response = await receiveApi.batchReceive(selectedRowKeyList.value);
const {error, success} = JSON.parse(response.msg);
if (error) {
message.error(error);
}
if (success) {
message.success(success);
}
await queryData(); await queryData();
} catch (e) { } catch (e) {
smartSentry.captureError(e); smartSentry.captureError(e);

View File

@ -116,7 +116,7 @@ async function save() {
} }
message.success('操作成功'); message.success('操作成功');
emits('reloadList'); emits('reloadList');
onClose(); continueResetForm()
} catch (err) { } catch (err) {
smartSentry.captureError(err); smartSentry.captureError(err);
} finally { } finally {
@ -124,6 +124,15 @@ async function save() {
} }
} }
function continueResetForm() {
const asnId = form.asnId;
Object.assign(form, formDefault);
form.asnId = asnId;
nextTick(() => {
formRef.value.clearValidate();
});
}
defineExpose({ defineExpose({
show, show,
}); });