feat(mes): 添加客户英文名称及出库单查询功能

新增客户英文名称字段,优化客户信息展示。实现按客户编号查询销售出库单列表的功能,提升用户体验。
pull/871/MERGE
YunaiV 2026-03-28 17:19:31 +08:00
parent 480564042e
commit 78e8ec1772
5 changed files with 209 additions and 19 deletions

View File

@ -0,0 +1,76 @@
<template>
<!-- 客户详情-产品清单 tab复用 getProductSalesLinePage 分页接口 -->
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="物料编码" align="center" prop="itemCode" width="140">
<template #default="scope">
<el-button link type="primary" @click="handleViewItem(scope.row.itemId)">
{{ scope.row.itemCode }}
</el-button>
</template>
</el-table-column>
<el-table-column label="物料名称" align="center" prop="itemName" />
<el-table-column label="规格型号" align="center" prop="specification" />
<el-table-column label="单位" align="center" prop="unitMeasureName" />
<el-table-column label="出库数量" align="center" prop="quantity" />
<el-table-column label="批次号" align="center" prop="batchCode" />
</el-table>
<Pagination
:total="total"
v-model:page="queryParams.pageNo"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
<!-- 物料详情弹窗 -->
<MdItemForm ref="itemFormRef" />
</template>
<script setup lang="ts">
import { WmProductSalesLineApi } from '@/api/mes/wm/productsales/line'
import MdItemForm from '@/views/mes/md/item/MdItemForm.vue'
defineOptions({ name: 'ClientProductSalesLineTab' })
const props = defineProps<{
clientId: number
}>()
const loading = ref(false)
const list = ref<any[]>([])
const total = ref(0)
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
clientId: undefined as number | undefined
})
/** 查询列表 */
const getList = async () => {
if (!queryParams.clientId) return
loading.value = true
try {
const data = await WmProductSalesLineApi.getProductSalesLinePage(queryParams)
list.value = data.list
total.value = data.total
} finally {
loading.value = false
}
}
/** 查看物料详情 */
const itemFormRef = ref()
const handleViewItem = (itemId: number) => {
itemFormRef.value.open('detail', itemId)
}
/** 监听 clientId 变化,自动加载 */
watch(
() => props.clientId,
(val) => {
queryParams.clientId = val
queryParams.pageNo = 1
getList()
},
{ immediate: true }
)
</script>

View File

@ -0,0 +1,86 @@
<template>
<!-- 客户详情-销售记录 tab复用 getProductSalesPage 分页接口 -->
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="出库单编号" align="center" prop="code" min-width="160">
<template #default="scope">
<el-button link type="primary" @click="handleDetail(scope.row.id)">
{{ scope.row.code }}
</el-button>
</template>
</el-table-column>
<el-table-column label="出库单名称" align="center" prop="name" min-width="150" />
<el-table-column
label="出库日期"
align="center"
prop="salesDate"
:formatter="dateFormatter2"
width="180px"
/>
<el-table-column label="单据状态" align="center" prop="status" min-width="100">
<template #default="scope">
<dict-tag :type="DICT_TYPE.MES_WM_PRODUCT_SALES_STATUS" :value="scope.row.status" />
</template>
</el-table-column>
</el-table>
<Pagination
:total="total"
v-model:page="queryParams.pageNo"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
<!-- 销售出库单详情弹窗 -->
<ProductSalesForm ref="formRef" />
</template>
<script setup lang="ts">
import { dateFormatter2 } from '@/utils/formatTime'
import { DICT_TYPE } from '@/utils/dict'
import { WmProductSalesApi } from '@/api/mes/wm/productsales'
import ProductSalesForm from '@/views/mes/wm/productsales/ProductSalesForm.vue'
defineOptions({ name: 'ClientProductSalesTab' })
const props = defineProps<{
clientId: number
}>()
const loading = ref(false)
const list = ref<any[]>([])
const total = ref(0)
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
clientId: undefined as number | undefined
})
/** 查询列表 */
const getList = async () => {
if (!queryParams.clientId) return
loading.value = true
try {
const data = await WmProductSalesApi.getProductSalesPage(queryParams)
list.value = data.list
total.value = data.total
} finally {
loading.value = false
}
}
/** 查看详情 */
const formRef = ref()
const handleDetail = (id: number) => {
formRef.value.open('detail', id)
}
/** 监听 clientId 变化,自动加载 */
watch(
() => props.clientId,
(val) => {
queryParams.clientId = val
queryParams.pageNo = 1
getList()
},
{ immediate: true }
)
</script>

View File

@ -6,6 +6,7 @@
:rules="formRules"
label-width="120px"
v-loading="formLoading"
:disabled="isDetail"
>
<el-row>
<el-col :span="12">
@ -149,19 +150,19 @@
</el-col>
</el-row>
</el-form>
<!-- 编辑时显示关联数据 tab -->
<el-tabs v-if="formType === 'update'" v-model="activeTab" class="mt-10px">
<el-tab-pane label="产品清单" name="item">
<!-- TODO @芋艿客户详情-产品清单 tab依赖物料模块按客户查询 -->
<el-empty description="功能开发中,敬请期待" />
<!-- 编辑/详情时显示关联数据 tab -->
<el-tabs v-if="formType !== 'create' && formData.id" v-model="activeTab" class="mt-10px">
<el-tab-pane label="产品清单" name="productSalesLine" lazy>
<ClientProductSalesLineTab :clientId="formData.id" />
</el-tab-pane>
<el-tab-pane label="销售记录" name="salesRecord">
<!-- TODO @芋艿客户详情-销售记录 tab依赖 WM 销售出库模块 -->
<el-empty description="功能开发中,敬请期待" />
<el-tab-pane label="销售记录" name="productSales" lazy>
<ClientProductSalesTab :clientId="formData.id" />
</el-tab-pane>
</el-tabs>
<template #footer>
<el-button @click="submitForm" type="primary" :disabled="formLoading"> </el-button>
<el-button v-if="!isDetail" @click="submitForm" type="primary" :disabled="formLoading">
</el-button>
<el-button @click="dialogVisible = false"> </el-button>
</template>
</Dialog>
@ -169,8 +170,11 @@
<script setup lang="ts">
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
import { MdClientApi, MdClientVO } from '@/api/mes/md/client'
import { AutoCodeRecordApi } from '@/api/mes/md/autocode/record'
import { CommonStatusEnum } from '@/utils/constants'
import { generateRandomStr } from '@/utils'
import { MesAutoCodeRuleCode } from '@/views/mes/utils/constants'
import ClientProductSalesLineTab from './ClientProductSalesLineTab.vue'
import ClientProductSalesTab from './ClientProductSalesTab.vue'
defineOptions({ name: 'MdClientForm' })
@ -178,10 +182,18 @@ const { t } = useI18n() // 国际化
const message = useMessage() //
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
const dialogTitle = computed(() => {
const titles: Record<string, string> = {
create: '新增客户',
update: '修改客户',
detail: '查看客户'
}
return titles[formType.value] || formType.value
})
const formLoading = ref(false) // 12
const formType = ref('') // create - update -
const activeTab = ref('item') // tab
const formType = ref('') // create - update - detail -
const isDetail = computed(() => formType.value === 'detail') //
const activeTab = ref('productSalesLine') // tab
const formData = ref({
id: undefined,
code: undefined,
@ -238,18 +250,17 @@ const formRules = reactive({
const formRef = ref() // Ref
/** 生成客户编码 */
const generateCode = () => {
// TODO @
formData.value.code = 'CL' + generateRandomStr(12)
const generateCode = async () => {
formData.value.code = await AutoCodeRecordApi.generateAutoCode(MesAutoCodeRuleCode.MD_CLIENT_CODE)
}
/** 打开弹窗 */
const open = async (type: string, id?: number) => {
dialogVisible.value = true
dialogTitle.value = t('action.' + type)
formType.value = type
activeTab.value = 'productSalesLine'
resetForm()
//
// /
if (id) {
formLoading.value = true
try {

View File

@ -35,6 +35,15 @@
class="!w-240px"
/>
</el-form-item>
<el-form-item label="英文名称" prop="englishName">
<el-input
v-model="queryParams.englishName"
placeholder="请输入客户英文名称"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="客户类型" prop="type">
<el-select v-model="queryParams.type" placeholder="请选择客户类型" clearable class="!w-240px">
<el-option
@ -90,7 +99,13 @@
<!-- 列表 -->
<ContentWrap>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="客户编码" align="center" prop="code" />
<el-table-column label="客户编码" align="center" prop="code">
<template #default="scope">
<el-button link type="primary" @click="openForm('detail', scope.row.id)">
{{ scope.row.code }}
</el-button>
</template>
</el-table-column>
<el-table-column label="客户名称" align="center" prop="name" width="150" />
<el-table-column label="客户简称" align="center" prop="nickname" />
<el-table-column label="客户类型" align="center" prop="type">
@ -171,6 +186,7 @@ const queryParams = reactive({
code: undefined,
name: undefined,
nickname: undefined,
englishName: undefined,
type: undefined,
status: undefined
})

View File

@ -415,6 +415,7 @@ export const MesAutoCodePaddedMethodEnum = {
export const MesAutoCodeRuleCode = {
MD_ITEM_CODE: 'MD_ITEM_CODE', // 物料编码
MD_VENDOR_CODE: 'MD_VENDOR_CODE', // 供应商编码
MD_CLIENT_CODE: 'MD_CLIENT_CODE', // 客户编码
WM_SN_CODE: 'WM_SN_CODE', // SN 码
WM_PACKAGE_CODE: 'WM_PACKAGE_CODE', // 装箱单编码
WM_BATCH_CODE: 'WM_BATCH_CODE', // 批次编码