|
|
@@ -25,7 +25,6 @@
|
|
|
import search from './components/search.vue';
|
|
|
import { pageByDispatchRecord } from '@/api/salesServiceManagement/index';
|
|
|
import dictMixins from '@/mixins/dictMixins';
|
|
|
-// 导入获取用户列表的接口(与第二个组件保持一致)
|
|
|
import { getUserPage } from '@/api/system/organization';
|
|
|
|
|
|
export default {
|
|
|
@@ -43,7 +42,6 @@ export default {
|
|
|
{ value: 2, label: '通过' },
|
|
|
{ value: 3, label: '不通过' }
|
|
|
],
|
|
|
- // 新增:用户列表(用于匹配用车人名称)
|
|
|
userList: [],
|
|
|
// 加载状态
|
|
|
loading: false
|
|
|
@@ -149,8 +147,8 @@ export default {
|
|
|
align: 'center',
|
|
|
showOverflowTooltip: true,
|
|
|
minWidth: 200,
|
|
|
- // 关键修改:通过vehicle_user(用户ID)匹配用户名
|
|
|
- formatter: (row) => this.getVehicleUserName(row.valueJson?.vehicle_user)
|
|
|
+ formatter: (row) =>
|
|
|
+ this.getVehicleUserName(row.valueJson?.vehicle_user)
|
|
|
},
|
|
|
{
|
|
|
prop: 'vehicle_mileage',
|
|
|
@@ -176,7 +174,9 @@ export default {
|
|
|
minWidth: 200,
|
|
|
formatter: (row) => {
|
|
|
const currentStatus = row.status;
|
|
|
- const matchedItem = this.statusList.find(item => item.value === currentStatus);
|
|
|
+ const matchedItem = this.statusList.find(
|
|
|
+ (item) => item.value === currentStatus
|
|
|
+ );
|
|
|
return matchedItem ? matchedItem.label : '';
|
|
|
}
|
|
|
},
|
|
|
@@ -191,11 +191,9 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
- // 初始化时获取用户列表(用于匹配用车人名称)
|
|
|
this.getUserList();
|
|
|
},
|
|
|
methods: {
|
|
|
- // 新增:获取用户列表(与第二个组件逻辑一致)
|
|
|
async getUserList() {
|
|
|
try {
|
|
|
const res = await getUserPage({
|
|
|
@@ -209,11 +207,12 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
|
|
|
- // 新增:通过vehicle_user(用户ID)获取用户名
|
|
|
getVehicleUserName(vehicleUserId) {
|
|
|
if (!vehicleUserId) return '';
|
|
|
// 在用户列表中匹配ID对应的用户名称
|
|
|
- const matchedUser = this.userList.find(user => user.id === vehicleUserId);
|
|
|
+ const matchedUser = this.userList.find(
|
|
|
+ (user) => user.id === vehicleUserId
|
|
|
+ );
|
|
|
return matchedUser ? matchedUser.name : vehicleUserId; // 未匹配到则显示原始ID
|
|
|
},
|
|
|
|
|
|
@@ -245,20 +244,36 @@ export default {
|
|
|
},
|
|
|
|
|
|
datasource({ page, limit, where }) {
|
|
|
- const dataPromise = pageByDispatchRecord({
|
|
|
+ // 打印参数确认是否正确接收
|
|
|
+ console.log('分页参数:', { page, limit });
|
|
|
+ console.log('查询参数:', where);
|
|
|
+
|
|
|
+ // 正确传递所有参数
|
|
|
+ const params = {
|
|
|
pageNum: page,
|
|
|
size: limit,
|
|
|
- ...where
|
|
|
- });
|
|
|
- dataPromise
|
|
|
- .then((response) => console.log(response))
|
|
|
- .catch((error) => console.error('获取数据失败:', error));
|
|
|
- return dataPromise;
|
|
|
+ ...where // 展开搜索参数
|
|
|
+ };
|
|
|
+ console.log(where)
|
|
|
+ return pageByDispatchRecord(params)
|
|
|
+ .then((response) => {
|
|
|
+ console.log('接口返回:', response);
|
|
|
+ return response; // 确保返回正确的格式给表格组件
|
|
|
+ })
|
|
|
+ .catch((error) => {
|
|
|
+ console.error('获取数据失败:', error);
|
|
|
+ throw error; // 确保错误能被表格组件捕获
|
|
|
+ });
|
|
|
},
|
|
|
|
|
|
/* 刷新表格 */
|
|
|
reload(where) {
|
|
|
- this.$refs.table.reload({ page: 1, ...where });
|
|
|
+ console.log('父组件接收的搜索参数:', where);
|
|
|
+ if (this.$refs.table) {
|
|
|
+ this.$refs.table.reload({ page: 1, where });
|
|
|
+ } else {
|
|
|
+ console.error('表格组件未初始化');
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
};
|