1.1.34 礼品申请客户名称改为可以输入的文字,默认带出部门

dev
yinq 4 weeks ago
parent cdb54f1baa
commit e85482ac73

@ -96,6 +96,16 @@ export interface CrmGiftApplyVO {
*/
remark: string;
/**
*
*/
createTime?: string;
/**
*
*/
updateTime?: string;
/**
*
*/

@ -53,19 +53,19 @@
@checkbox-all="handleCheckboxAll"
@checkbox-change="handleCheckboxChange"
>
<vxe-column type="checkbox" width="50" align="center" />
<vxe-column key="giftCode" title="礼品编码" align="center" field="giftCode" width="140" />
<vxe-column key="giftName" title="礼品名称" align="center" field="giftName" width="180" />
<vxe-column key="specification" title="规格型号" align="center" field="specification" width="160" />
<vxe-column key="unitPrice" title="采购单价(元)" align="center" field="unitPrice" width="120">
<vxe-column type="checkbox" width="48" align="center" />
<vxe-column key="giftCode" title="礼品编码" align="center" field="giftCode" width="108" show-overflow />
<vxe-column key="giftName" title="礼品名称" align="center" field="giftName" min-width="160" show-overflow />
<vxe-column key="specification" title="规格型号" align="center" field="specification" min-width="240" show-overflow="tooltip" />
<vxe-column key="unitPrice" title="采购单价(元)" align="center" field="unitPrice" width="116">
<template #default="scope">{{ scope.row.unitPrice ? '¥' + scope.row.unitPrice : '-' }}</template>
</vxe-column>
<vxe-column key="inventoryQuantity" title="库存数量" align="center" field="inventoryQuantity" width="140">
<vxe-column key="inventoryQuantity" title="库存数量" align="center" field="inventoryQuantity" width="96">
<template #default="scope">
<el-tag :type="inventoryTagType(scope.row.inventoryQuantity)" disable-transitions>{{ scope.row.inventoryQuantity ?? '-' }}</el-tag>
</template>
</vxe-column>
<vxe-column key="remark" title="备注" align="center" field="remark" min-width="160" show-overflow />
<vxe-column key="remark" title="备注" align="center" field="remark" min-width="132" show-overflow />
</vxe-table>
<pagination

@ -46,10 +46,16 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="客户名称" prop="customerUnitId">
<el-select v-model="form.customerUnitId" placeholder="请选择客户" filterable @change="handleCustomerChange" style="width: 100%">
<el-option v-for="customer in customerList" :key="customer.customerId" :label="customer.customerName" :value="customer.customerId" />
</el-select>
<el-form-item label="客户名称" prop="customerUnitName">
<el-autocomplete
v-model="form.customerUnitName"
:fetch-suggestions="queryCustomerSuggestions"
clearable
placeholder="请输入或选择客户名称"
style="width: 100%"
@select="handleCustomerSuggestSelect"
@blur="onCustomerNameBlur"
/>
</el-form-item>
</el-col>
<el-col :span="12">
@ -82,8 +88,8 @@
</el-col>
</el-row>
<el-table :data="form.detailList" border style="width: 100%">
<el-table-column type="index" label="序号" width="60" align="center" />
<el-table-column label="礼品" min-width="200" align="center">
<el-table-column type="index" label="序号" width="52" align="center" />
<el-table-column label="礼品" min-width="150" align="center">
<template #default="scope">
<el-button
type="primary"
@ -92,40 +98,41 @@
:disabled="routeParams.type === 'view' || routeParams.type === 'approval'"
@click="openGiftSelect(scope.$index)"
>
{{ scope.row.giftName ? `${scope.row.giftCode || ''} ${scope.row.giftName}` : '选择礼品' }}
{{ scope.row.giftName || '选择礼品' }}
</el-button>
</template>
</el-table-column>
<el-table-column label="规格型号" prop="specification" min-width="120" align="center" />
<el-table-column label="单价(元)" prop="unitPrice" width="100" align="center">
<el-table-column label="规格型号" prop="specification" min-width="200" align="center" show-overflow-tooltip />
<el-table-column label="单价(元)" prop="unitPrice" width="92" align="center">
<template #default="scope">
{{ scope.row.unitPrice ? '¥' + scope.row.unitPrice : '-' }}
</template>
</el-table-column>
<el-table-column label="库存数量" prop="inventoryQuantity" width="100" align="center" />
<el-table-column label="申请数量" width="120" align="center">
<el-table-column label="库存数量" prop="inventoryQuantity" width="92" align="center" />
<el-table-column label="申请数量" width="128" align="center">
<template #default="scope">
<el-input-number
v-model="scope.row.applicationQuantity"
:min="1"
:max="scope.row.inventoryQuantity || 999999"
size="small"
style="width: 100%"
@change="calculateAmount(scope.$index)"
:disabled="routeParams.type === 'view' || routeParams.type === 'approval'"
/>
</template>
</el-table-column>
<el-table-column label="金额(元)" width="120" align="center">
<el-table-column label="金额(元)" width="104" align="center">
<template #default="scope">
{{ scope.row.giftAmount ? '¥' + scope.row.giftAmount : '-' }}
</template>
</el-table-column>
<el-table-column label="备注" min-width="150" align="center">
<el-table-column label="备注" min-width="140" align="center">
<template #default="scope">
<el-input v-model="scope.row.remark" placeholder="备注" :disabled="routeParams.type === 'view' || routeParams.type === 'approval'" />
</template>
</el-table-column>
<el-table-column label="操作" width="80" align="center" fixed="right" v-if="routeParams.type !== 'view' && routeParams.type !== 'approval'">
<el-table-column label="操作" width="64" align="center" fixed="right" v-if="routeParams.type !== 'view' && routeParams.type !== 'approval'">
<template #default="scope">
<el-button link type="danger" icon="Delete" @click="handleDeleteDetail(scope.$index)"></el-button>
</template>
@ -266,7 +273,7 @@ const rules = reactive({
applicationCode: [], //
applicationDate: [{ required: true, message: '申请日期不能为空', trigger: 'change' }],
applicantId: [{ required: true, message: '申请人不能为空', trigger: 'blur' }],
customerUnitId: [{ required: true, message: '客户不能为空', trigger: 'change' }]
customerUnitName: [{ required: true, message: '客户名称不能为空', trigger: ['blur', 'change'] }]
// 'variables.approverId': [
// {
// validator: (rule: any, value: any, callback: any) => {
@ -341,7 +348,7 @@ const initUserInfo = async () => {
form.value.applicantId = user.userId;
form.value.applicantName = user.nickName;
form.value.applicantDeptId = user.deptId;
form.value.applicantDeptName = user.dept?.deptName;
form.value.applicantDeptName = user.deptName;
//
form.value.recipientId = user.userId;
form.value.recipientName = user.nickName;
@ -371,12 +378,38 @@ const handleApproverSelectChange = (approverId: number | string) => {
}
};
/** 客户选择变更 */
const handleCustomerChange = (customerId: number | string) => {
const customer = customerList.value.find((c) => c.customerId === customerId);
if (customer) {
form.value.customerUnitName = customer.customerName;
/** 根据客户名称与档案列表同步 customerUnitId手填无匹配则清空关联 ID */
const syncCustomerUnitIdFromName = () => {
const name = form.value.customerUnitName?.trim();
if (!name) {
form.value.customerUnitId = undefined;
return;
}
const matched = customerList.value.find((c) => c.customerName?.trim() === name);
form.value.customerUnitId = matched?.customerId;
};
type CustomerNameSuggest = { value: string; customerId: string | number };
/** 客户名称联想(档案客户,可点选) */
const queryCustomerSuggestions = (queryString: string, cb: (rows: CustomerNameSuggest[]) => void) => {
const q = (queryString || '').trim().toLowerCase();
const rows = customerList.value
.filter((c) => c.customerName)
.filter((c) => !q || String(c.customerName).toLowerCase().includes(q))
.map((c) => ({ value: c.customerName!, customerId: c.customerId }));
cb(rows);
};
/** 从联想列表选中时写入档案客户 ID */
const handleCustomerSuggestSelect = (item: CustomerNameSuggest) => {
form.value.customerUnitName = item.value;
form.value.customerUnitId = item.customerId;
};
/** 失焦保留手输内容并同步关联客户 ID */
const onCustomerNameBlur = () => {
syncCustomerUnitIdFromName();
};
/** 礼品选择回填 */
@ -450,6 +483,7 @@ const handleDeleteDetail = (index: number) => {
const submitForm = async (status: string) => {
try {
await formRef.value?.validate();
syncCustomerUnitIdFromName();
// P0-1: - 稿
if (form.value.giftApplyId && form.value.applicationStatus !== '1') {

@ -41,24 +41,24 @@
</template>
<el-table v-loading="loading" border :data="crmGiftApplyList" @selection-change="handleSelectionChange">
<el-table-column type="index" label="序号" width="60" align="center" />
<el-table-column label="申请编号" align="center" prop="applicationCode" min-width="140" v-if="columns[0].visible" />
<el-table-column label="申请人" align="center" prop="applicantName" min-width="100" v-if="columns[1].visible" />
<el-table-column label="申请部门" align="center" prop="applicantDeptName" min-width="120" v-if="columns[2].visible" />
<el-table-column label="申请日期" align="center" prop="applicationDate" width="120" v-if="columns[3].visible">
<el-table-column type="index" label="序号" width="52" align="center" />
<el-table-column label="申请编号" align="center" prop="applicationCode" min-width="140" show-overflow-tooltip v-if="columns[0].visible" />
<el-table-column label="申请人" align="center" prop="applicantName" min-width="88" show-overflow-tooltip v-if="columns[1].visible" />
<el-table-column label="申请部门" align="center" prop="applicantDeptName" min-width="110" show-overflow-tooltip v-if="columns[2].visible" />
<el-table-column label="申请日期" align="center" prop="applicationDate" width="112" v-if="columns[3].visible">
<template #default="scope">
<span>{{ parseTime(scope.row.applicationDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="客户名称" align="center" prop="customerUnitName" min-width="150" show-overflow-tooltip v-if="columns[4].visible" />
<el-table-column label="客人姓名" align="center" prop="guestName" min-width="100" v-if="columns[5].visible" />
<el-table-column label="人数" align="center" prop="peopleCount" width="80" v-if="columns[6].visible" />
<el-table-column label="申请总金额" align="center" prop="totalAmount" min-width="110" v-if="columns[7].visible">
<el-table-column label="客户名称" align="center" prop="customerUnitName" min-width="200" show-overflow-tooltip v-if="columns[4].visible" />
<el-table-column label="客人姓名" align="center" prop="guestName" min-width="90" show-overflow-tooltip v-if="columns[5].visible" />
<el-table-column label="人数" align="center" prop="peopleCount" width="64" v-if="columns[6].visible" />
<el-table-column label="申请总金额" align="center" prop="totalAmount" width="108" v-if="columns[7].visible">
<template #default="scope">
<span>{{ scope.row.totalAmount ? '¥' + scope.row.totalAmount : '-' }}</span>
</template>
</el-table-column>
<el-table-column label="申请状态" align="center" prop="applicationStatus" width="100" v-if="columns[8].visible">
<el-table-column label="申请状态" align="center" prop="applicationStatus" width="96" v-if="columns[8].visible">
<template #default="scope">
<dict-tag :options="gift_apply_status" :value="scope.row.applicationStatus" />
</template>
@ -68,12 +68,12 @@
<dict-tag :options="wf_business_status" :value="scope.row.flowStatus" />
</template>
</el-table-column> -->
<el-table-column label="创建时间" align="center" prop="createTime" width="160" v-if="columns[9].visible">
<el-table-column label="创建时间" align="center" prop="createTime" width="180" v-if="columns[9].visible">
<template #default="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}') }}</span>
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" fixed="right" width="220" class-name="small-padding fixed-width">
<el-table-column label="操作" align="center" fixed="right" width="200" class-name="small-padding fixed-width">
<template #default="scope">
<!-- 查看非草稿状态 -->
<el-tooltip content="查看" placement="top" v-if="scope.row.applicationStatus !== '1'">
@ -178,8 +178,7 @@ const columns = ref<FieldOption[]>([
{ key: 5, label: `客人姓名`, visible: true },
{ key: 6, label: `人数`, visible: true },
{ key: 7, label: `申请总金额`, visible: true },
// { key: 8, label: ``, visible: true },
{ key: 8, label: `流程状态`, visible: true },
{ key: 8, label: `申请状态`, visible: true },
{ key: 9, label: `创建时间`, visible: true }
]);
@ -255,7 +254,7 @@ const handleExport = () => {
proxy?.download(
'oa/crm/crmGiftApply/export',
{
...queryParams.value
...queryParams
},
`crmGiftApply_${new Date().getTime()}.xlsx`
);

Loading…
Cancel
Save