From 2fdf183119c9a87dd0d62694fad2a2744989b92a Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期六, 18 七月 2026 10:12:38 +0800
Subject: [PATCH] 银川 1.销售报价选择框复用组件应用
---
src/views/crm/saleQuotation/modules/item-form.vue | 49 ++++++++++++------------
src/api/erp/sale/order/index.ts | 1
src/views/crm/saleQuotation/data.ts | 12 ++----
src/views/erp/sale/order/index.vue | 22 +++++++---
src/views/mes/qc/oqc/data.ts | 6 +-
5 files changed, 48 insertions(+), 42 deletions(-)
diff --git a/src/api/erp/sale/order/index.ts b/src/api/erp/sale/order/index.ts
index 5126cf7..7983b30 100644
--- a/src/api/erp/sale/order/index.ts
+++ b/src/api/erp/sale/order/index.ts
@@ -26,6 +26,7 @@
contractId?: number; // 鍏宠仈 CRM 鍚堝悓缂栧彿
contractNo?: string; // CRM 鍚堝悓鍗曞彿
needProduction?: number; // 鏄惁闇�瑕佺敓浜э細0-涓嶉渶瑕侊紝1-闇�瑕�
+ hasSalesNotice?: boolean; // 鏄惁宸茬敓鎴愬彂璐ч�氱煡鍗�
items?: SaleOrderItem[]; // 閿�鍞鍗曚骇鍝佹槑缁嗗垪琛�
}
diff --git a/src/views/crm/saleQuotation/data.ts b/src/views/crm/saleQuotation/data.ts
index 09cf646..ce713e1 100644
--- a/src/views/crm/saleQuotation/data.ts
+++ b/src/views/crm/saleQuotation/data.ts
@@ -124,6 +124,7 @@
fieldName: 'quotationTime',
label: '鎶ヤ环鏃ユ湡',
component: 'DatePicker',
+ rules: 'required',
componentProps: {
showTime: false,
format: 'YYYY-MM-DD',
@@ -165,7 +166,7 @@
},
{
fieldName: 'items',
- label: '鐗╂枡娓呭崟',
+ label: '浜у搧娓呭崟',
component: 'Input',
formItemClass: 'col-span-3',
},
@@ -340,24 +341,19 @@
];
}
-/** 鐗╂枡鏄庣粏琛ㄦ牸鍒� */
+/** 浜у搧鏄庣粏琛ㄦ牸鍒� */
export function useItemColumns(): VxeTableGridOptions['columns'] {
return [
{ type: 'seq', title: '搴忓彿', minWidth: 50, fixed: 'left' },
{
field: 'itemId',
- title: '鐗╂枡鍚嶇О',
+ title: '浜у搧鍚嶇О',
minWidth: 200,
slots: { default: 'itemId' },
},
{
field: 'itemSpecification',
title: '瑙勬牸鍨嬪彿',
- minWidth: 120,
- },
- {
- field: 'itemBarCode',
- title: '鏉$爜',
minWidth: 120,
},
{
diff --git a/src/views/crm/saleQuotation/modules/item-form.vue b/src/views/crm/saleQuotation/modules/item-form.vue
index e3aacab..62d90fc 100644
--- a/src/views/crm/saleQuotation/modules/item-form.vue
+++ b/src/views/crm/saleQuotation/modules/item-form.vue
@@ -2,14 +2,14 @@
import type { MdmItemApi } from '#/api/mdm/item';
import type { CrmSaleQuotationApi } from '#/api/crm/saleQuotation';
-import { computed, onMounted, ref } from 'vue';
+import { computed, ref } from 'vue';
import { erpPriceMultiply } from '#/packages/utils/src';
-import { InputNumber, Select } from 'ant-design-vue';
+import { InputNumber } from 'ant-design-vue';
import { TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
-import { getItemPage } from '#/api/mdm/item';
+import MdmItemSelect from '#/views/basicData/mdm/components/select.vue';
import { useItemColumns } from '../data';
@@ -24,7 +24,7 @@
const emit = defineEmits(['change']);
const tableData = ref<CrmSaleQuotationApi.SaleQuotationItem[]>([]);
-const itemOptions = ref<MdmItemApi.Item[]>([]);
+const selectedItem = ref<MdmItemApi.Item>();
/** 鑾峰彇琛ㄦ牸鍚堣鏁版嵁 */
const summaries = computed(() => {
@@ -93,13 +93,23 @@
}
}
-/** 澶勭悊鐗╂枡鍙樻洿 */
-function handleItemChange(itemId: number, row: any) {
- const item = itemOptions.value.find((p) => p.id === itemId);
+/** 澶勭悊浜у搧鍙樻洿 */
+function handleItemChange(item: MdmItemApi.Item | undefined, row: any) {
if (!item) {
+ row.itemId = undefined;
+ row.itemName = undefined;
+ row.itemCode = undefined;
+ row.itemBarCode = undefined;
+ row.itemSpecification = undefined;
+ row.itemUnitName = undefined;
+ row.itemUnitName2 = undefined;
+ row.itemUnitName3 = undefined;
+ row.itemPrice = undefined;
+ row.quotationPrice = undefined;
+ row.totalPrice = 0;
return;
}
- row.itemId = itemId;
+ row.itemId = item.id;
row.itemName = item.name;
row.itemCode = item.code;
row.itemBarCode = item.barCode;
@@ -133,7 +143,7 @@
const item = tableData.value[i];
if (item) {
if (!item.itemId) {
- throw new Error(`绗� ${i + 1} 琛岋細鐗╂枡涓嶈兘涓虹┖`);
+ throw new Error(`绗� ${i + 1} 琛岋細浜у搧涓嶈兘涓虹┖`);
}
if (!item.count || item.count <= 0) {
throw new Error(`绗� ${i + 1} 琛岋細鏁伴噺涓嶈兘涓虹┖`);
@@ -173,25 +183,16 @@
getData,
resetData,
});
-
-/** 鍒濆鍖� */
-onMounted(async () => {
- const res = await getItemPage({ pageNo: 1, pageSize: 100, status: 0 });
- itemOptions.value = res.list || [];
-});
</script>
<template>
<Grid class="w-full">
<template #itemId="{ row }">
- <Select
+ <MdmItemSelect
v-if="!disabled"
- v-model:value="row.itemId"
- :options="itemOptions"
- :field-names="{ label: 'name', value: 'id' }"
- class="w-full"
- placeholder="璇烽�夋嫨鐗╂枡"
- @change="(val) => handleItemChange(val, row)"
+ v-model:model-value="row.itemId"
+ placeholder="璇烽�夋嫨浜у搧"
+ @change="(item) => handleItemChange(item, row)"
/>
<span v-else>{{ row.itemName || '-' }}</span>
</template>
@@ -224,7 +225,7 @@
type: 'link',
danger: true,
popConfirm: {
- title: '纭鍒犻櫎璇ョ墿鏂欏悧锛�',
+ title: '纭鍒犻櫎璇ヤ骇鍝佸悧锛�',
confirm: handleDelete.bind(null, row),
},
},
@@ -247,7 +248,7 @@
class="mt-2 flex justify-center"
:actions="[
{
- label: '娣诲姞鐗╂枡',
+ label: '娣诲姞浜у搧',
type: 'default',
onClick: handleAdd,
},
diff --git a/src/views/erp/sale/order/index.vue b/src/views/erp/sale/order/index.vue
index fa775a4..355551e 100644
--- a/src/views/erp/sale/order/index.vue
+++ b/src/views/erp/sale/order/index.vue
@@ -24,6 +24,7 @@
import { useGridColumns, useGridFormSchema } from './data';
import Form from './modules/form.vue';
+import SalesNoticeForm from '#/views/wls/salesnotice/modules/form.vue';
/** ERP 閿�鍞鍗曞垪琛� */
defineOptions({ name: 'ErpSaleOrder' });
@@ -32,6 +33,11 @@
const [FormModal, formModalApi] = useVbenModal({
connectedComponent: Form,
+ destroyOnClose: true,
+});
+
+const [SalesNoticeFormModal, salesNoticeFormModalApi] = useVbenModal({
+ connectedComponent: SalesNoticeForm,
destroyOnClose: true,
});
@@ -147,11 +153,11 @@
try {
const noticeId = await generateFromSaleOrder(row.id!);
message.success('鐢熸垚鍙戣揣閫氱煡鍗曟垚鍔�');
- // 璺宠浆鍒板彂璐ч�氱煡鍗曢〉闈�
- router.push({
- path: '/wls/sales-notice',
- query: { id: noticeId },
- });
+ handleRefresh();
+ // 鐩存帴鎵撳紑鍙戣揣閫氱煡鍗曡鎯呭脊妗�
+ salesNoticeFormModalApi
+ .setData({ formType: 'detail', id: noticeId })
+ .open();
} catch (e) {
console.error(e);
}
@@ -193,7 +199,9 @@
</script>
<template>
- <Page auto-content-height><FormModal @success="handleRefresh" />
+ <Page auto-content-height>
+ <FormModal @success="handleRefresh" />
+ <SalesNoticeFormModal />
<Grid table-title="閿�鍞鍗曞垪琛�">
<template #toolbar-tools>
<TableAction
@@ -319,7 +327,7 @@
type: 'link',
icon: 'ant-design:file-protect-outlined',
auth: ['mes:wm-sales-notice:create'],
- ifShow: () => row.status === 20,
+ ifShow: () => row.status === 20 && !row.hasSalesNotice,
onClick: handleGenerateNotice.bind(null, row),
},
{
diff --git a/src/views/mes/qc/oqc/data.ts b/src/views/mes/qc/oqc/data.ts
index 08ddd90..6706cca 100644
--- a/src/views/mes/qc/oqc/data.ts
+++ b/src/views/mes/qc/oqc/data.ts
@@ -12,7 +12,7 @@
import { generateAutoCode } from '#/api/mes/md/autocode/record';
import { getSimpleUserList } from '#/api/system/user';
-import { MdClientSelect } from '#/views/mes/md/client/components';
+import CrmCustomerSelect from '#/components/crm-customer-select.vue';
import { MdmItemSelect } from '#/views/basicData/mdm/components';
/** 琛ㄥ崟绫诲瀷 */
@@ -135,7 +135,7 @@
{
fieldName: 'clientId',
label: '瀹㈡埛',
- component: markRaw(MdClientSelect),
+ component: markRaw(CrmCustomerSelect),
componentProps: {
placeholder: '璇烽�夋嫨瀹㈡埛',
},
@@ -307,7 +307,7 @@
{
fieldName: 'clientId',
label: '瀹㈡埛',
- component: markRaw(MdClientSelect),
+ component: markRaw(CrmCustomerSelect),
componentProps: {
placeholder: '璇烽�夋嫨瀹㈡埛',
},
--
Gitblit v1.9.3