feat: 派单记录显示

property-only-app
wx-jincw 2 months ago
parent e20f33ddb8
commit da1bd8069e

@ -0,0 +1,266 @@
<template>
<view
class="house-popup-mask"
v-if="visible"
@click="close"
>
<view class="house-popup" @click.stop>
<view class="popup-title">派单记录</view>
<scroll-view scroll-y class="dispatch-list">
<view
class="dispatch-item"
v-for="(item, index) in records"
:key="index"
>
<view class="dispatch-header">
<text class="dispatch-status" :class="dispatchStatusClass(item.status)">
{{ getDispatchStatusText(item.status) }}
</text>
<text class="dispatch-time">{{ item.assignTime }}</text>
</view>
<view class="dispatch-body">
<view class="row">
<text class="label">派单人</text>
<text class="value">{{ item.assignerName || '-' }}</text>
</view>
<view class="row">
<text class="label">执行人</text>
<text class="value">{{ item.executorName || '-' }}</text>
</view>
<view class="row">
<text class="label">执行人部门</text>
<text class="value">{{ item.executorDeptName || '-' }}</text>
</view>
<view class="row">
<text class="label">联系方式</text>
<text class="value">{{ item.phone || '-' }}</text>
</view>
<view class="row">
<text class="label">预计完成时间</text>
<text class="value">{{ item.expectedCompleteTime || '-' }}</text>
</view>
<view class="row">
<text class="label">实际完成时间</text>
<text class="value">{{ item.completeTime || '-' }}</text>
</view>
<view class="row" v-if="item.handleContent">
<text class="label">处理内容</text>
<text class="value">{{ item.handleContent }}</text>
</view>
<view class="row">
<text class="label">业主确认</text>
<text class="value">{{ item.ownerConfirm === '1' ? '是' : '否' }}</text>
</view>
</view>
</view>
<view
class="empty"
v-if="!loading && records.length === 0"
>
暂无派单记录
</view>
<view
class="load-more"
v-if="loading"
>
加载中...
</view>
</scroll-view>
</view>
</view>
</template>
<script>
import { listMaintenanceDispatch } from '@/api/property.js';
export default {
props: {
visible: {
type: Boolean,
default: false
},
orderId: {
type: String,
default: ''
}
},
data() {
return {
records: [],
loading: false
};
},
watch: {
visible: {
handler(newVal) {
console.log('DispatchRecord visible changed:', newVal);
if (newVal && this.orderId) {
this.fetchRecords();
}
},
immediate: true
},
orderId: {
handler(newVal) {
console.log('DispatchRecord orderId changed:', newVal);
if (newVal && this.visible) {
this.fetchRecords();
}
}
}
},
methods: {
//
async fetchRecords() {
this.loading = true;
try {
const res = await listMaintenanceDispatch({
page: 1,
limit: 99,
orderId: this.orderId
});
this.records = res?.data?.list || [];
} catch (e) {
console.error('获取派单记录失败:', e);
uni.showToast({
title: typeof e === 'string' ? e : '获取派单记录失败',
icon: 'none'
});
} finally {
this.loading = false;
}
},
//
getDispatchStatusText(status) {
const statusMap = {
0: '待处理',
1: '处理中',
2: '已完成'
};
return statusMap[status] || '未知状态';
},
//
dispatchStatusClass(status) {
const classMap = {
0: 'pending',
1: 'doing',
2: 'done'
};
return classMap[status] || '';
},
//
close() {
this.$emit('update:visible', false);
this.records = [];
}
}
};
</script>
<style lang="scss" scoped>
.house-popup-mask {
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.4);
display: flex;
align-items: flex-end;
justify-content: center;
z-index: 9999;
overflow: hidden;
.house-popup {
width: 100%;
max-height: 70vh;
background-color: #fff;
border-radius: 20rpx 20rpx 0 0;
padding: 24rpx 30rpx 40rpx;
box-sizing: border-box;
.popup-title {
text-align: center;
font-size: 28rpx;
font-weight: 600;
color: #333;
margin-bottom: 20rpx;
}
.dispatch-list {
max-height: 60vh;
.dispatch-item {
padding: 20rpx 0;
border-bottom: 1rpx solid #f0f0f0;
.dispatch-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 16rpx;
.dispatch-status {
padding: 4rpx 12rpx;
border-radius: 16rpx;
font-size: 20rpx;
}
.dispatch-status.pending {
background-color: #E6F7FF;
color: #409EFF;
}
.dispatch-status.doing {
background-color: #FFF7E6;
color: #FA8C16;
}
.dispatch-status.done {
background-color: #F6FFED;
color: #52C41A;
}
.dispatch-time {
font-size: 22rpx;
color: #999;
}
}
.dispatch-body {
.row {
display: flex;
margin-bottom: 10rpx;
.label {
width: 160rpx;
font-size: 24rpx;
color: #666;
}
.value {
flex: 1;
font-size: 24rpx;
color: #333;
}
}
}
}
.empty {
text-align: center;
padding: 40rpx 0;
font-size: 24rpx;
color: #999;
}
.load-more {
text-align: center;
padding: 20rpx 0;
font-size: 22rpx;
color: #999;
}
}
}
}
</style>

@ -131,7 +131,10 @@
<text class="time">
{{ item.reportTime || item.createTime || '' }}
</text>
<view class="btn-group">
<text class="cancel-btn" @click="handleCancel(item.id)" v-if="!item.status || item.status === '0'"></text>
<text class="dispatch-btn" @click="viewDispatchRecords(item.id)"></text>
</view>
</view>
</view>
@ -222,6 +225,14 @@
</scroll-view>
</view>
</view>
<!-- 派单记录弹窗组件 -->
<DispatchRecord
:visible="dispatchPopupVisible"
:orderId="currentOrderId"
@update:visible="dispatchPopupVisible = $event"
/>
</view>
</view>
</template>
@ -230,8 +241,13 @@
import { createMaintenanceOrder, listMaintenanceOrder, listMaintenanceOrderDetail, listHouses, updateMaintenanceOrderStatus } from '@/api/property.js';
import request from '@/utils/request.js';
import { HTTP_ADMIN_URL } from '@/config/app';
//
import DispatchRecord from './components/DispatchRecord.vue';
export default {
components: {
DispatchRecord
},
dicts: ['fault_type'],
data() {
return {
@ -260,7 +276,10 @@ export default {
2: 'status-done',
99: 'status-done',
'__default__': 'status-pending'
}
},
//
dispatchPopupVisible: false,
currentOrderId: ''
};
},
computed: {
@ -566,6 +585,14 @@ export default {
}
}
});
},
//
viewDispatchRecords(orderId) {
console.log('viewDispatchRecords called with orderId:', orderId);
this.currentOrderId = String(orderId);
console.log('currentOrderId:', this.currentOrderId);
this.dispatchPopupVisible = true;
console.log('dispatchPopupVisible:', this.dispatchPopupVisible);
}
}
};
@ -833,6 +860,11 @@ export default {
margin-bottom: 8rpx;
}
.btn-group {
display: flex;
gap: 12rpx;
}
.cancel-btn {
font-size: 22rpx;
color: #FF4D4F;
@ -840,6 +872,14 @@ export default {
border-radius: 16rpx;
background-color: #FFF1F0;
}
.dispatch-btn {
font-size: 22rpx;
color: #409EFF;
padding: 4rpx 12rpx;
border-radius: 16rpx;
background-color: #E6F7FF;
}
}
}
@ -972,6 +1012,8 @@ export default {
color: #999;
}
}
}
}
}

Loading…
Cancel
Save