From 858df78951d5c29e8d4217cffcf81d2cc4fabcd4 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期一, 03 八月 2026 14:58:59 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_pro2.0' into dev_pro2.0
---
src/views/erp/sale/order/index.vue | 193 ++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 179 insertions(+), 14 deletions(-)
diff --git a/src/views/erp/sale/order/index.vue b/src/views/erp/sale/order/index.vue
index 8c663a6..7071c8e 100644
--- a/src/views/erp/sale/order/index.vue
+++ b/src/views/erp/sale/order/index.vue
@@ -2,30 +2,43 @@
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { ErpSaleOrderApi } from '#/api/erp/sale/order';
-import { ref } from 'vue';
+import { onMounted, ref } from 'vue';
+import { useRoute, useRouter } from 'vue-router';
-import { Page, useVbenModal } from '../../../../packages/effects/common-ui/src';
-import { downloadFileFromBlobPart, isEmpty } from '../../../../packages/utils/src';
+import { Page, useVbenModal } from '@vben/common-ui';
+import { downloadFileFromBlobPart, isEmpty } from '@vben/utils';
-import { message } from 'ant-design-vue';
+import { message, Tag, Tooltip } from 'ant-design-vue';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import {
+ cancelSaleOrder,
deleteSaleOrder,
+ enableSaleOrder,
exportSaleOrder,
getSaleOrderPage,
updateSaleOrderStatus,
} from '#/api/erp/sale/order';
+import { generateFromSaleOrder } from '#/api/mes/wm/salesnotice';
import { $t } from '#/locales';
import { useGridColumns, useGridFormSchema } from './data';
import Form from './modules/form.vue';
+import SalesNoticeForm from '#/views/wls/salesnotice/modules/form.vue';
/** ERP 閿�鍞鍗曞垪琛� */
defineOptions({ name: 'ErpSaleOrder' });
+const router = useRouter();
+const route = useRoute();
+
const [FormModal, formModalApi] = useVbenModal({
connectedComponent: Form,
+ destroyOnClose: true,
+});
+
+const [SalesNoticeFormModal, salesNoticeFormModalApi] = useVbenModal({
+ connectedComponent: SalesNoticeForm,
destroyOnClose: true,
});
@@ -83,6 +96,36 @@
}
}
+/** 浣滃簾閿�鍞鍗� */
+async function handleCancel(row: ErpSaleOrderApi.SaleOrder) {
+ const hideLoading = message.loading({
+ content: '姝e湪浣滃簾璇ヨ鍗�...',
+ duration: 0,
+ });
+ try {
+ await cancelSaleOrder(row.id!);
+ message.success('浣滃簾鎴愬姛');
+ handleRefresh();
+ } finally {
+ hideLoading();
+ }
+}
+
+/** 鍚敤閿�鍞鍗曪紙鎭㈠宸蹭綔搴熻鍗曪級 */
+async function handleEnable(row: ErpSaleOrderApi.SaleOrder) {
+ const hideLoading = message.loading({
+ content: '姝e湪鍚敤璇ヨ鍗�...',
+ duration: 0,
+ });
+ try {
+ await enableSaleOrder(row.id!);
+ message.success('鍚敤鎴愬姛');
+ handleRefresh();
+ } finally {
+ hideLoading();
+ }
+}
+
const checkedIds = ref<number[]>([]);
function handleRowCheckboxChange({
records,
@@ -97,6 +140,30 @@
formModalApi.setData({ formType: 'detail', id: row.id }).open();
}
+/** 鏌ョ湅鍏宠仈鍚堝悓 */
+function handleViewContract(row: ErpSaleOrderApi.SaleOrder) {
+ if (row.contractId) {
+ router.push({
+ path: `/crm/contract/detail/${row.contractId}`,
+ });
+ }
+}
+
+/** 鐢熸垚鍙戣揣閫氱煡鍗� */
+async function handleGenerateNotice(row: ErpSaleOrderApi.SaleOrder) {
+ try {
+ const noticeId = await generateFromSaleOrder(row.id!);
+ message.success('鐢熸垚鍙戣揣閫氱煡鍗曟垚鍔�');
+ handleRefresh();
+ // 鐩存帴鎵撳紑鍙戣揣閫氱煡鍗曡鎯呭脊妗�
+ salesNoticeFormModalApi
+ .setData({ formType: 'detail', id: noticeId })
+ .open();
+ } catch (e) {
+ console.error(e);
+ }
+}
+
const [Grid, gridApi] = useVbenVxeGrid({
formOptions: {
schema: useGridFormSchema(),
@@ -108,10 +175,19 @@
proxyConfig: {
ajax: {
query: async ({ page }, formValues) => {
+ // 鐢熶骇鐘舵�佹悳绱㈠弬鏁拌浆鎹細-1(鏃犻渶鐢熶骇) 鈫� needProduction=0
+ const { productionStatus, ...rest } = formValues;
+ const params: Record<string, any> = { ...rest };
+ if (productionStatus === -1) {
+ params.needProduction = 0;
+ } else if (productionStatus != null) {
+ params.productionStatus = productionStatus;
+ params.needProduction = 1;
+ }
return await getSaleOrderPage({
pageNo: page.currentPage,
pageSize: page.pageSize,
- ...formValues,
+ ...params,
});
},
},
@@ -130,10 +206,20 @@
checkboxChange: handleRowCheckboxChange,
},
});
+
+/** 澶勭悊浠庡悎鍚岃烦杞繃鏉ョ殑鏌ヨ鍙傛暟 */
+onMounted(() => {
+ const orderId = route.query.id;
+ if (orderId) {
+ formModalApi.setData({ formType: 'detail', id: Number(orderId) }).open();
+ }
+});
</script>
<template>
- <Page auto-content-height><FormModal @success="handleRefresh" />
+ <Page auto-content-height>
+ <FormModal @success="handleRefresh" />
+ <SalesNoticeFormModal />
<Grid table-title="閿�鍞鍗曞垪琛�">
<template #toolbar-tools>
<TableAction
@@ -167,6 +253,46 @@
]"
/>
</template>
+ <template #no="{ row }">
+ <Tooltip v-if="row.status === 30" title="璇ヨ鍗曞凡浣滃簾锛岃鍗曞凡澶辨晥">
+ <span class="text-red-500 cursor-pointer" @click="handleDetail(row)">
+ {{ row.no }}
+ </span>
+ </Tooltip>
+ <a v-else class="text-primary cursor-pointer" @click="handleDetail(row)">
+ {{ row.no }}
+ </a>
+ </template>
+ <template #contractNo="{ row }">
+ <a v-if="row.contractId" class="text-primary cursor-pointer" @click="handleViewContract(row)">
+ {{ row.contractNo }}
+ </a>
+ <span v-else>-</span>
+ </template>
+ <template #status="{ row }">
+ <Tag v-if="row.status === 10" color="warning">鏈鏍�</Tag>
+ <Tag v-if="row.status === 20" color="success">宸插鏍�</Tag>
+ <Tag v-if="row.status === 30" color="error">宸蹭綔搴�</Tag>
+ </template>
+ <template #needProduction="{ row }">
+ <Tag v-if="row.needProduction === 1" color="success">鏄�</Tag>
+ <Tag v-else color="default">鍚�</Tag>
+ </template>
+ <template #outStatus="{ row }">
+ <Tag v-if="row.outStatus === 0" color="default">鏈嚭搴�</Tag>
+ <Tag v-else-if="row.outStatus === 1" color="processing">宸查鐣�</Tag>
+ <Tag v-else-if="row.outStatus === 2" color="warning">閮ㄥ垎鍑哄簱</Tag>
+ <Tag v-else-if="row.outStatus === 3" color="success">鍏ㄩ儴鍑哄簱</Tag>
+ </template>
+ <template #productionStatus="{ row }">
+ <template v-if="row.needProduction !== 1">
+ <Tag color="default">鏃犻渶鐢熶骇</Tag>
+ </template>
+ <template v-else>
+ <Tag v-if="row.productionStatus === 0" color="warning">鏈畬鎴�</Tag>
+ <Tag v-else-if="row.productionStatus === 1" color="success">宸插畬鎴�</Tag>
+ </template>
+ </template>
<template #actions="{ row }">
<TableAction
:actions="[
@@ -182,22 +308,60 @@
type: 'link',
icon: ACTION_ICON.EDIT,
auth: ['erp:sale-order:update'],
- ifShow: () => row.status !== 20,
+ ifShow: () => row.status === 10,
onClick: handleEdit.bind(null, row),
},
{
- label: row.status === 10 ? '瀹℃壒' : '鍙嶅鎵�',
+ label: '瀹℃壒',
type: 'link',
icon: ACTION_ICON.AUDIT,
auth: ['erp:sale-order:update-status'],
+ ifShow: () => row.status === 10,
popConfirm: {
- title: `纭${row.status === 10 ? '瀹℃壒' : '鍙嶅鎵�'}${row.no}鍚楋紵`,
- confirm: handleUpdateStatus.bind(
- null,
- row,
- row.status === 10 ? 20 : 10,
- ),
+ title: `纭瀹℃壒${row.no}鍚楋紵`,
+ confirm: handleUpdateStatus.bind(null, row, 20),
},
+ },
+ {
+ label: '鍙嶅鎵�',
+ type: 'link',
+ icon: ACTION_ICON.AUDIT,
+ auth: ['erp:sale-order:update-status'],
+ ifShow: () => row.status === 20,
+ popConfirm: {
+ title: `纭鍙嶅鎵�${row.no}鍚楋紵`,
+ confirm: handleUpdateStatus.bind(null, row, 10),
+ },
+ },
+ {
+ label: '浣滃簾',
+ type: 'link',
+ icon: 'ant-design:stop-outlined',
+ auth: ['erp:sale-order:cancel'],
+ ifShow: () => row.status === 20,
+ popConfirm: {
+ title: `纭浣滃簾${row.no}鍚楋紵浣滃簾鍚庝笉鍙仮澶嶏紒`,
+ confirm: handleCancel.bind(null, row),
+ },
+ },
+ {
+ label: '鍚敤',
+ type: 'link',
+ icon: 'ant-design:check-circle-outlined',
+ auth: ['erp:sale-order:enable'],
+ ifShow: () => row.status === 30,
+ popConfirm: {
+ title: `纭鍚敤${row.no}鍚楋紵`,
+ confirm: handleEnable.bind(null, row),
+ },
+ },
+ {
+ label: '鐢熸垚鍙戣揣閫氱煡鍗�',
+ type: 'link',
+ icon: 'ant-design:file-protect-outlined',
+ auth: ['mes:wm-sales-notice:create'],
+ ifShow: () => row.status === 20 && row.canCreateSalesNotice,
+ onClick: handleGenerateNotice.bind(null, row),
},
{
label: $t('common.delete'),
@@ -205,6 +369,7 @@
danger: true,
icon: ACTION_ICON.DELETE,
auth: ['erp:sale-order:delete'],
+ ifShow: () => row.status === 10,
popConfirm: {
title: $t('ui.actionMessage.deleteConfirm', [row.no]),
confirm: handleDelete.bind(null, [row.id!]),
--
Gitblit v1.9.3