diff --git a/src/api/oa/crm/crmGiftApply/types.ts b/src/api/oa/crm/crmGiftApply/types.ts
index 5e7130d..cb7a648 100644
--- a/src/api/oa/crm/crmGiftApply/types.ts
+++ b/src/api/oa/crm/crmGiftApply/types.ts
@@ -96,6 +96,16 @@ export interface CrmGiftApplyVO {
*/
remark: string;
+ /**
+ * 创建时间
+ */
+ createTime?: string;
+
+ /**
+ * 更新时间
+ */
+ updateTime?: string;
+
/**
* 礼品申请明细列表
*/
diff --git a/src/components/GiftSelect/index.vue b/src/components/GiftSelect/index.vue
index 8ae8168..f2885b6 100644
--- a/src/components/GiftSelect/index.vue
+++ b/src/components/GiftSelect/index.vue
@@ -53,19 +53,19 @@
@checkbox-all="handleCheckboxAll"
@checkbox-change="handleCheckboxChange"
>
-
-
-
-
-
+
+
+
+
+
{{ scope.row.unitPrice ? '¥' + scope.row.unitPrice : '-' }}
-
+
{{ scope.row.inventoryQuantity ?? '-' }}
-
+
-
-
-
-
+
+
@@ -82,8 +88,8 @@
-
-
+
+
- {{ scope.row.giftName ? `${scope.row.giftCode || ''} ${scope.row.giftName}` : '选择礼品' }}
+ {{ scope.row.giftName || '选择礼品' }}
-
-
+
+
{{ scope.row.unitPrice ? '¥' + scope.row.unitPrice : '-' }}
-
-
+
+
-
+
{{ scope.row.giftAmount ? '¥' + scope.row.giftAmount : '-' }}
-
+
-
+
@@ -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') {
diff --git a/src/views/oa/crm/crmGiftApply/index.vue b/src/views/oa/crm/crmGiftApply/index.vue
index 1a0cc12..0b02fda 100644
--- a/src/views/oa/crm/crmGiftApply/index.vue
+++ b/src/views/oa/crm/crmGiftApply/index.vue
@@ -41,24 +41,24 @@
-
-
-
-
-
+
+
+
+
+
{{ parseTime(scope.row.applicationDate, '{y}-{m}-{d}') }}
-
-
-
-
+
+
+
+
{{ scope.row.totalAmount ? '¥' + scope.row.totalAmount : '-' }}
-
+
@@ -68,12 +68,12 @@
-->
-
+
- {{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}') }}
+ {{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}
-
+
@@ -178,8 +178,7 @@ const columns = ref([
{ 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`
);