## Bug描述
1. 会员编号列空白无数据
2. 出生日期显示"未知"
3. 点击"新增"按钮无反应
## 问题分析
### Bug1: 会员编号空白
**原因**: 前后端字段名不匹配
- 前端: `prop="memberNo"`
- 后端: `memberCode`
### Bug2: 出生日期显示"未知"
**原因**: 后端返回`birthday: null`时,前端直接显示为空单元格,用户体验差
### Bug3: 新增按钮无反应
**原因**: `MemberDialog.vue`组件没有暴露`open`方法
- 父组件调用: `memberDialogRef.value?.open()`
- 子组件未定义: 缺少`defineExpose({ open })`
## 修复内容
### 1. 修正会员编号字段名 (index.vue)
```vue
<!-- 修复前 -->
<el-table-column prop="memberNo" label="会员编号" />
<!-- 修复后 ✅ -->
<el-table-column prop="memberCode" label="会员编号" />
```
### 2. 修正出生日期显示 (index.vue)
```vue
<!-- 修复前 -->
<el-table-column prop="birthday" label="出生日期" />
<!-- 修复后 ✅ -->
<el-table-column prop="birthday" label="出生日期">
<template #default="{ row }">
{{ row.birthday || '-' }}
</template>
</el-table-column>
```
### 3. 修正弹窗组件架构 (MemberDialog.vue)
```javascript
// 1. 移除未使用的props
- const props = defineProps({ modelValue, memberId })
// 2. 添加内部状态
+ const visible = ref(false)
+ const memberId = ref(null)
// 3. 暴露open方法
+ const open = (row) => {
+ memberId.value = row?.memberId || null
+ visible.value = true
+ }
+ defineExpose({ open })
// 4. 修正handleOpen逻辑
- if (props.memberId) {
+ if (memberId.value) {
// 5. 添加handleClose清理
+ const handleClose = () => {
+ formRef.value?.resetFields()
+ memberId.value = null
+ }
```
## 验证结果
- ✅ 会员编号正常显示: MEM20260101
- ✅ 出生日期为空时显示"-"
- ✅ 点击"新增"按钮弹出表单
- ✅ 编辑功能正常
---
作者:湖北新华业务中台研发团队
|
||
|---|---|---|
| .. | ||
| public | ||
| src | ||
| .gitignore | ||
| README.md | ||
| index.html | ||
| package-lock.json | ||
| package.json | ||
| vite.config.js | ||
README.md
Vue 3 + Vite
This template should help get you started developing with Vue 3 in Vite. The template uses Vue 3 <script setup> SFCs, check out the script setup docs to learn more.
Learn more about IDE Support for Vue in the Vue Docs Scaling up Guide.