debug(invoice): 添加调试日志并优化员工账号获取逻辑
- 在用户列表获取后添加调试日志输出 - 实现通过employeeId从用户列表中获取员工账号的逻辑 - 添加getUserAccountById方法的调试日志 - 优化发票管理中的员工账号字段赋值逻辑 - 添加空值检查和调试信息输出
This commit is contained in:
@@ -265,7 +265,8 @@ export default {
|
|||||||
employeeAccount: user.userName, // 使用用户账号作为员工账号
|
employeeAccount: user.userName, // 使用用户账号作为员工账号
|
||||||
status: user.status // 0: 启用(管理员), 1: 禁用(普通人员)
|
status: user.status // 0: 启用(管理员), 1: 禁用(普通人员)
|
||||||
}));
|
}));
|
||||||
console.log('获取到的用户列表:', this.userList);
|
console.log('[DEBUG] 获取到的用户列表:', this.userList);
|
||||||
|
console.log('[DEBUG] 第一条用户数据:', this.userList[0]);
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
console.error('获取用户列表失败:', error);
|
console.error('获取用户列表失败:', error);
|
||||||
@@ -327,7 +328,14 @@ export default {
|
|||||||
((record.invoicingStaffId || record.employeeId) ?
|
((record.invoicingStaffId || record.employeeId) ?
|
||||||
this.getUserNameById(record.invoicingStaffId || record.employeeId) : '-'),
|
this.getUserNameById(record.invoicingStaffId || record.employeeId) : '-'),
|
||||||
employeeId: record.invoicingStaffId || record.employeeId || '',
|
employeeId: record.invoicingStaffId || record.employeeId || '',
|
||||||
employeeAccount: record.employeeAccount || '', // 员工账号字段
|
// 员工账号字段:通过employeeId从用户列表中获取
|
||||||
|
employeeAccount: (record.employeeAccount) ? record.employeeAccount :
|
||||||
|
(() => {
|
||||||
|
const empId = record.invoicingStaffId || record.employeeId;
|
||||||
|
const account = this.getUserAccountById(empId);
|
||||||
|
console.log(`[DEBUG] 查找员工账号: employeeId=${empId}, 找到账号=${account}, userList长度=${this.userList.length}`);
|
||||||
|
return account;
|
||||||
|
})(),
|
||||||
date: record.billBusDate || record.createDate ?
|
date: record.billBusDate || record.createDate ?
|
||||||
new Date(record.billBusDate || record.createDate).toISOString().split('T')[0] : '',
|
new Date(record.billBusDate || record.createDate).toISOString().split('T')[0] : '',
|
||||||
startNum: record.startNum || record.beginNumber || '',
|
startNum: record.startNum || record.beginNumber || '',
|
||||||
@@ -481,8 +489,12 @@ export default {
|
|||||||
|
|
||||||
// 根据员工ID获取用户账号
|
// 根据员工ID获取用户账号
|
||||||
getUserAccountById(employeeId) {
|
getUserAccountById(employeeId) {
|
||||||
if (!employeeId) return '';
|
if (!employeeId) {
|
||||||
|
console.log(`[DEBUG] getUserAccountById: employeeId为空,返回空字符串`);
|
||||||
|
return '';
|
||||||
|
}
|
||||||
const user = this.userList.find(u => String(u.employeeId) === String(employeeId));
|
const user = this.userList.find(u => String(u.employeeId) === String(employeeId));
|
||||||
|
console.log(`[DEBUG] getUserAccountById: 查找employeeId=${employeeId}, 匹配结果=`, user);
|
||||||
return user ? user.employeeAccount : '';
|
return user ? user.employeeAccount : '';
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 314 KiB |
Reference in New Issue
Block a user