批量收货

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);
},
/**
* @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() {
try {
await formRef.value.validateFields();
save();
await save();
} catch (err) {
message.error('参数验证错误,请仔细填写表单数据!');
}

View File

@ -92,6 +92,10 @@
<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'">
{{ $smartEnumPlugin.getDescByValue('ASN_ORDER_TYPE_ENUM', text) }}
</template>
@ -111,7 +115,8 @@
</template>
编辑
</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>
<DeleteOutlined/>
</template>
@ -214,6 +219,7 @@ const columns = ref([
{
title: '操作',
dataIndex: 'action',
align: 'center',
fixed: 'right',
width: 140,
},

View File

@ -18,19 +18,29 @@
</div>
<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>
<PlusOutlined/>
</template>
添加明细
</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">
<template #icon>
<DeleteOutlined/>
</template>
批量移除
</a-button>
<TableOperator v-model="columns" :tableId="TABLE_ID_CONST.BUSINESS.RECEIVE.ASN_DETAIL" :refresh="queryData"/>
</div>
@ -48,13 +58,15 @@
<template #bodyCell="{ text, record, index, column }">
<template v-if="column.dataIndex === 'action'">
<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>
<EditOutlined/>
</template>
编辑
</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>
<DeleteOutlined/>
</template>
@ -92,6 +104,7 @@ import {smartSentry} from '/@/lib/smart-sentry';
import {TABLE_ID_CONST} from "/@/constants/support/table-id-const";
import TableOperator from "/@/components/support/table-operator/index.vue";
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 {message, Modal} from "ant-design-vue";
import {SmartLoading} from '/@/components/framework/smart-loading';
@ -139,7 +152,7 @@ const columns = reactive([
const defaultQueryForm = {
pageNum: 1,
pageSize: PAGE_SIZE,
asnId: undefined,
asnId: 0,
keyword: undefined,
}
@ -197,7 +210,7 @@ function showForm(data: object) {
}
//
function onDelete(data) {
function onDelete(data: object) {
Modal.confirm({
title: '提示',
content: '确定要删除选吗?',
@ -213,11 +226,89 @@ function onDelete(data) {
}
//
async function requestDelete(data) {
async function requestDelete(data: any) {
SmartLoading.show();
try {
await asnDetailApi.delete(data.asnDetailId);
message.success('删除成功');
const response = await asnDetailApi.delete(data.asnDetailId);
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();
} catch (e) {
smartSentry.captureError(e);

View File

@ -116,7 +116,7 @@ async function save() {
}
message.success('操作成功');
emits('reloadList');
onClose();
continueResetForm()
} catch (err) {
smartSentry.captureError(err);
} 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({
show,
});