This commit is contained in:
2025-08-21 14:25:49 +08:00
parent 98d98e41f2
commit 2833f7d28b
8 changed files with 1127 additions and 1099 deletions

View File

@@ -24,7 +24,11 @@ const config = {
} }
// 设置后台接口服务的基础地址 // 设置后台接口服务的基础地址
config.baseUrl = 'http://tc.cqsznc.com:7080/api'; // config.baseUrl = 'http://tc.cqsznc.com:7080/api';
//正式
// config.baseUrl = 'http://183.230.235.66:11010/api'; // config.baseUrl = 'http://183.230.235.66:11010/api';
// config.baseUrl = 'http://58cbd58.r28.cpolar.top';
config.baseUrl = 'http://818aa9b.r28.cpolar.top';
export default config; export default config;

View File

@@ -39,6 +39,8 @@ const install = (Vue, vm) => {
//获取处理人 //获取处理人
getHandler:(params = {})=>vm.$u.get(config.adminPath+'/property/enum-fetcher/enum-values/getServiceWorkOrdersHandler',params), getHandler:(params = {})=>vm.$u.get(config.adminPath+'/property/enum-fetcher/enum-values/getServiceWorkOrdersHandler',params),
getHandler2:(params = {})=>vm.$u.get(config.adminPath+'/property/enum-fetcher/enum-values/getAccount',params),
//会议列表 //会议列表
getMeetings:(params = {})=>vm.$u.get(config.adminPath+'/property/roomBooking/list',params), getMeetings:(params = {})=>vm.$u.get(config.adminPath+'/property/roomBooking/list',params),

View File

@@ -349,7 +349,7 @@
{ {
"path": "pages/sys/user/myRepair/addRepair", "path": "pages/sys/user/myRepair/addRepair",
"style": { "style": {
"navigationBarTitleText": "新增" "navigationBarTitleText": "新增报事报修"
} }
}, },
{ {

View File

@@ -3,15 +3,19 @@
<!-- 可滚动内容区 --> <!-- 可滚动内容区 -->
<view class="add-repair-scroll-content"> <view class="add-repair-scroll-content">
<!-- 地址选择 --> <!-- 地址选择 -->
<view class="add-repair-section"> <!-- <view class="add-repair-section">
<view class="add-repair-detail"> <view class="add-repair-detail">
<view class="add-repair-detail1">详细地址 </view> <view class="add-repair-detail1">详细地址 </view>
<input type="text" v-model="repairInfo.location" placeholder="请输入地址" class="add-repair-detail2" /> <input type="text" v-model="repairInfo.location" placeholder="请输入地址" class="add-repair-detail2" />
</view> </view>
</view> </view> -->
<!-- 报事报修类型 --> <!-- 报事报修类型 -->
<view class="add-repair-section"> <view class="add-repair-section">
<view class="add-repair-label">详细地址</view>
<input type="text" v-model="repairInfo.location" placeholder="请输入地址" class="add-repair-detail2" />
<view class="add-repair-label">报事报修</view> <view class="add-repair-label">报事报修</view>
<view class="repair-type" @click="chooseType"> <view class="repair-type" @click="chooseType">
<text class="text-type">{{ selectedType }}</text> <text class="text-type">{{ selectedType }}</text>
@@ -182,17 +186,18 @@ export default {
} }
.repair-type { .repair-type {
width: 363rpx; width: 100%;
height: 73rpx; height: 98rpx;
background: #F7F7F7; background: #F7F8FA;
border-radius: 10rpx; border-radius: 10rpx;
padding:0rpx 28rpx 0rpx 35rpx; padding: 0 20rpx;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
margin-bottom: 40rpx; margin-bottom: 40rpx;
box-sizing: border-box;
} }
.text-type{ .text-type{
font-size: 24rpx; font-size: 24rpx;
color:#808080; color:#808080;
@@ -239,14 +244,15 @@ export default {
} }
.add-repair-detail2 { .add-repair-detail2 {
width: 460rpx; width: 100%;
height: 98rpx; height: 98rpx;
background-color: #F7F8FA; background-color: #F7F8FA;
border-radius: 10rpx; border-radius: 10rpx;
font-size: 24rpx; font-size: 24rpx;
color: #676767; color: #676767;
margin-left: 25rpx; padding: 0 20rpx;
padding-left: 15rpx; margin-bottom: 40rpx;
box-sizing: border-box;
} }
.add-repair-label { .add-repair-label {
font-size: 32rpx; font-size: 32rpx;
@@ -303,7 +309,7 @@ export default {
} }
.add-repair-detail-textarea { .add-repair-detail-textarea {
width: 75vw; width: 100%;
min-height: 120rpx; min-height: 120rpx;
background: #F7F8FA; background: #F7F8FA;
border-radius: 10rpx; border-radius: 10rpx;
@@ -311,6 +317,7 @@ export default {
color: #888; color: #888;
padding: 18rpx; padding: 18rpx;
margin-top: 18rpx; margin-top: 18rpx;
box-sizing: border-box;
} }
.add-repair-submit-btn { .add-repair-submit-btn {

View File

@@ -1,9 +1,18 @@
<template> <template>
<view class="repair-container"> <view class="repair-container">
<!-- 可滚动内容区 --> <!-- 可滚动内容区 -->
<scroll-view scroll-y class="repair-scroll-content" @scroll="handleScroll"> <scroll-view
scroll-y
class="repair-scroll-content"
refresher-background="#f7f7f7"
@scroll="handleScroll"
@scrolltolower="loadMore"
refresher-enabled
:refresher-triggered="refreshing"
@refresherrefresh="onRefresh">
<!-- 空状态 --> <!-- 空状态 -->
<view v-if="records.length === 0" class="repair-empty-box"> <view v-if="records.length === 0 && !loading" class="repair-empty-box">
<view class="repair-empty-img-box"> <view class="repair-empty-img-box">
<image src="/static/ic_my_repair_01.png" class="repair-empty-img" /> <image src="/static/ic_my_repair_01.png" class="repair-empty-img" />
</view> </view>
@@ -11,6 +20,7 @@
<image src="/static/ic_my_repair_02.png" class="repair-add-btn" @click="addRepair" /> <image src="/static/ic_my_repair_02.png" class="repair-add-btn" @click="addRepair" />
</view> </view>
</view> </view>
<!-- 有数据时 --> <!-- 有数据时 -->
<view v-else class="repair-list-box"> <view v-else class="repair-list-box">
<view v-for="(item, idx) in records" :key="idx" class="repair-card" @click="showDetail(item)"> <view v-for="(item, idx) in records" :key="idx" class="repair-card" @click="showDetail(item)">
@@ -24,14 +34,23 @@
<view class="repair-info">建立时间{{ item.createTime }}</view> <view class="repair-info">建立时间{{ item.createTime }}</view>
<view class="repair-info">报事内容{{ item.typeName }}</view> <view class="repair-info">报事内容{{ item.typeName }}</view>
<view class="repair-info">报事位置{{ item.location }}</view> <view class="repair-info">报事位置{{ item.location }}</view>
<view v-if="getStatusLabel(item.status) === '已结束'" class="repair-eval-btn eval-btn-right">服务评价 <view v-if="getStatusLabel(item.status) === '已结束'" class="repair-eval-btn eval-btn-right">服务评价</view>
</view> </view>
<!-- 加载提示 -->
<view v-if="loading" style="text-align:center;color:#999;font-size:26rpx;padding:20rpx;">
加载中...
</view> </view>
<view v-if="finished && records.length > 0" style="text-align:center;color:#999;font-size:26rpx;padding:20rpx;">
没有更多数据了
</view>
<!-- 悬浮新增按钮 --> <!-- 悬浮新增按钮 -->
<image src="/static/ic_my_repair_02.png" :class="['repair-add-btn-fixed', { 'hide': isAddBtnHidden }]" <image src="/static/ic_my_repair_02.png" :class="['repair-add-btn-fixed', { 'hide': isAddBtnHidden }]"
@click="addRepair" /> @click="addRepair" />
</view> </view>
</scroll-view> </scroll-view>
<!-- 详情弹窗 --> <!-- 详情弹窗 -->
<view v-if="showDetailDialog" class="repair-detail-mask" @click.self="closeDetail"> <view v-if="showDetailDialog" class="repair-detail-mask" @click.self="closeDetail">
<view class="repair-detail-dialog"> <view class="repair-detail-dialog">
@@ -49,8 +68,7 @@
</view> </view>
</view> </view>
<view class="repair-detail-progress-labels"> <view class="repair-detail-progress-labels">
<view v-for="(step, idx) in progressSteps" :key="idx" class="repair-detail-label">{{ step }} <view v-for="(step, idx) in progressSteps" :key="idx" class="repair-detail-label">{{ step }}</view>
</view>
</view> </view>
</view> </view>
<view class="repair-detail-info">建立时间{{ detailItem.createTime }}</view> <view class="repair-detail-info">建立时间{{ detailItem.createTime }}</view>
@@ -67,7 +85,6 @@
export default { export default {
data() { data() {
return { return {
// 空数组可切换空状态
records: [], records: [],
showDetailDialog: false, showDetailDialog: false,
detailItem: {}, detailItem: {},
@@ -75,15 +92,22 @@
detailStatus: '', detailStatus: '',
progressSteps: ['创建工单', '已接单', '处理中', '已结束'], progressSteps: ['创建工单', '已接单', '处理中', '已结束'],
lastScrollTop: 0, lastScrollTop: 0,
isAddBtnHidden: false isAddBtnHidden: false,
// 分页相关
pageNum: 1,
pageSize: 10,
finished: false,
loading: false,
refreshing: false
} }
}, },
onLoad() { onLoad() {
this.getOrders() this.onRefresh()
}, },
onShow() { onShow() {
uni.$once('refreshData',s=> { uni.$once('refreshData', () => {
this.getOrders() this.onRefresh()
}); });
}, },
methods: { methods: {
@@ -95,13 +119,47 @@
url: '/pages/sys/user/myRepair/addRepair' url: '/pages/sys/user/myRepair/addRepair'
}); });
}, },
async getOrders() { // 获取工单列表
let params = { async getOrders(reset = false) {
"type": "1952989217332658178" if (this.loading) return;
if (reset) {
this.pageNum = 1;
this.finished = false;
this.records = [];
} }
this.loading = true;
let params = {
type: "1952989217332658178",
pageNum: this.pageNum,
pageSize: this.pageSize
};
let res = await this.$u.api.getOrderList(params); let res = await this.$u.api.getOrderList(params);
if (res.code == '200') { if (res.code == '200') {
this.records = res.rows const rows = res.rows || [];
if (reset) {
this.records = rows;
} else {
this.records = this.records.concat(rows);
}
if (rows.length < this.pageSize) {
this.finished = true;
} else {
this.pageNum++;
}
}
this.loading = false;
this.refreshing = false;
},
// 下拉刷新
onRefresh() {
this.refreshing = true;
this.getOrders(true);
},
// 滚动加载更多
loadMore() {
if (!this.finished) {
this.getOrders(false);
} }
}, },
getStatusColor(status) { getStatusColor(status) {
@@ -116,7 +174,6 @@
}, },
showDetail(item) { showDetail(item) {
this.detailItem = item; this.detailItem = item;
// 进度映射
if (item.status == 0) { if (item.status == 0) {
this.detailStep = 0; this.detailStep = 0;
this.detailStatus = '创建工单'; this.detailStatus = '创建工单';
@@ -130,7 +187,6 @@
this.detailStep = 1; this.detailStep = 1;
this.detailStatus = '已接单'; this.detailStatus = '已接单';
} }
this.showDetailDialog = true; this.showDetailDialog = true;
}, },
closeDetail() { closeDetail() {
@@ -147,7 +203,6 @@
return statusMap[status] || ''; return statusMap[status] || '';
}, },
goTEvaluate() { goTEvaluate() {
// 将detailItem转换为JSON字符串并进行编码以确保安全传输
const detailItemStr = encodeURIComponent(JSON.stringify(this.detailItem)); const detailItemStr = encodeURIComponent(JSON.stringify(this.detailItem));
uni.navigateTo({ uni.navigateTo({
url: `/pages/sys/user/myRepair/repairEvaluate?detailItem=${detailItemStr}` url: `/pages/sys/user/myRepair/repairEvaluate?detailItem=${detailItemStr}`
@@ -155,15 +210,10 @@
}, },
handleScroll(e) { handleScroll(e) {
const scrollTop = e.detail.scrollTop; const scrollTop = e.detail.scrollTop;
// 为了避免过于频繁的触发,可以设置一个阈值 if (Math.abs(scrollTop - this.lastScrollTop) < 20) return;
if (Math.abs(scrollTop - this.lastScrollTop) < 20) {
return;
}
if (scrollTop > this.lastScrollTop && scrollTop > 50) { if (scrollTop > this.lastScrollTop && scrollTop > 50) {
// 向下滚动,隐藏按钮
this.isAddBtnHidden = true; this.isAddBtnHidden = true;
} else { } else {
// 向上滚动,显示按钮
this.isAddBtnHidden = false; this.isAddBtnHidden = false;
} }
this.lastScrollTop = scrollTop; this.lastScrollTop = scrollTop;
@@ -179,44 +229,15 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
.repair-navbar {
width: 100%;
height: 120rpx;
padding-top: 40rpx;
display: flex;
align-items: center;
justify-content: center;
position: relative;
background: #fff;
flex-shrink: 0;
/* 防止被压缩 */
}
.repair-back {
position: absolute;
left: 37rpx;
width: 15rpx;
height: 33rpx;
}
.repair-title {
font-size: 36rpx;
color: #000;
font-weight: 500;
}
.repair-scroll-content { .repair-scroll-content {
flex: 1; flex: 1;
overflow-y: auto; overflow-y: auto;
padding-bottom: 40rpx; padding-bottom: 40rpx;
} }
.repair-empty-box { .repair-empty-box {
margin: 48rpx 24rpx 0 24rpx; margin: 48rpx 24rpx 0 24rpx;
position: relative; position: relative;
} }
.repair-empty-img-box { .repair-empty-img-box {
border: 2rpx dashed #BDBDBD; border: 2rpx dashed #BDBDBD;
border-radius: 8rpx; border-radius: 8rpx;
@@ -227,7 +248,6 @@
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
.repair-empty-img { .repair-empty-img {
width: 90%; width: 90%;
max-width: 400rpx; max-width: 400rpx;
@@ -235,13 +255,11 @@
object-fit: contain; object-fit: contain;
margin: 24rpx auto; margin: 24rpx auto;
} }
.repair-add-btn-box { .repair-add-btn-box {
position: absolute; position: absolute;
right: 24rpx; right: 24rpx;
bottom: -40rpx; bottom: -40rpx;
} }
.repair-add-btn { .repair-add-btn {
width: 80rpx; width: 80rpx;
height: 80rpx; height: 80rpx;
@@ -250,13 +268,11 @@
background: #fff; background: #fff;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.08); box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.08);
} }
.repair-list-box { .repair-list-box {
margin: 32rpx 0 0 0; margin: 32rpx 0 0 0;
padding: 0 24rpx; padding: 0 24rpx;
position: relative; position: relative;
} }
.repair-card { .repair-card {
background: #fff; background: #fff;
border-radius: 12rpx; border-radius: 12rpx;
@@ -265,7 +281,6 @@
padding-top: 25rpx; padding-top: 25rpx;
padding-bottom: 32rpx; padding-bottom: 32rpx;
} }
.repair-row { .repair-row {
display: flex; display: flex;
align-items: center; align-items: center;
@@ -275,44 +290,30 @@
margin-left: 19rpx; margin-left: 19rpx;
margin-right: 50rpx; margin-right: 50rpx;
} }
.repair-no { .repair-no {
font-size: 24rpx; font-size: 24rpx;
color: #0B0B0B; color: #0B0B0B;
font-weight: 500; font-weight: 500;
} }
.repair-status { .repair-status {
font-size: 24rpx; font-size: 24rpx;
font-weight: 500; font-weight: 500;
} }
.repair-status.orange { color: #F3AB44; }
.repair-status.doing { color: #00C9AA; }
.repair-status.done { color: #8A8A8A; }
.repair-line-image { .repair-line-image {
margin: left 29rpx; margin-left: 29rpx;
margin-right: 39rpx; margin-right: 39rpx;
height: 2rpx; height: 2rpx;
margin-bottom: 29rpx; margin-bottom: 29rpx;
} }
.repair-status.orange {
color: #F3AB44;
}
.repair-status.doing {
color: #00C9AA;
}
.repair-status.done {
color: #8A8A8A;
}
.repair-info { .repair-info {
font-size: 24rpx; font-size: 24rpx;
color: #888; color: #888;
margin-bottom: 30rpx; margin-bottom: 30rpx;
margin-left: 47rpx; margin-left: 47rpx;
} }
.repair-eval-btn { .repair-eval-btn {
margin-top: -20rpx; margin-top: -20rpx;
margin-bottom: 0; margin-bottom: 0;
@@ -332,7 +333,6 @@
font-weight: 500; font-weight: 500;
width: fit-content; width: fit-content;
} }
.repair-add-btn-fixed { .repair-add-btn-fixed {
position: fixed; position: fixed;
right: 40rpx; right: 40rpx;
@@ -343,11 +343,7 @@
transition: transform 0.3s ease; transition: transform 0.3s ease;
transform: translateX(0); transform: translateX(0);
} }
.repair-add-btn-fixed.hide { transform: translateX(200%); }
.repair-add-btn-fixed.hide {
transform: translateX(200%);
}
.repair-detail-mask { .repair-detail-mask {
position: fixed; position: fixed;
left: 0; left: 0;
@@ -360,7 +356,6 @@
align-items: flex-end; align-items: flex-end;
justify-content: center; justify-content: center;
} }
.repair-detail-dialog { .repair-detail-dialog {
width: 100vw; width: 100vw;
background: #fff; background: #fff;
@@ -369,7 +364,6 @@
padding: 52rpx 56rpx 69rpx 56rpx; padding: 52rpx 56rpx 69rpx 56rpx;
margin-bottom: 0; margin-bottom: 0;
} }
.repair-detail-title { .repair-detail-title {
font-size: 36rpx; font-size: 36rpx;
color: #000; color: #000;
@@ -377,7 +371,6 @@
position: relative; position: relative;
margin-bottom: 48rpx; margin-bottom: 48rpx;
} }
.repair-detail-close { .repair-detail-close {
width: 32rpx; width: 32rpx;
height: 32rpx; height: 32rpx;
@@ -385,7 +378,6 @@
right: 0; right: 0;
top: 0; top: 0;
} }
.repair-detail-progress-box { .repair-detail-progress-box {
height: 107rpx; height: 107rpx;
margin-bottom: 41rpx; margin-bottom: 41rpx;
@@ -396,7 +388,6 @@
justify-content: center; justify-content: center;
align-items: stretch; align-items: stretch;
} }
.repair-detail-progress { .repair-detail-progress {
display: flex; display: flex;
align-items: center; align-items: center;
@@ -405,14 +396,12 @@
margin-left: 75rpx; margin-left: 75rpx;
width: 100%; width: 100%;
} }
.repair-detail-step { .repair-detail-step {
display: flex; display: flex;
align-items: center; align-items: center;
flex: 1; flex: 1;
position: relative; position: relative;
} }
.repair-detail-dot { .repair-detail-dot {
width: 22rpx; width: 22rpx;
height: 22rpx; height: 22rpx;
@@ -422,17 +411,14 @@
position: relative; position: relative;
z-index: 2; z-index: 2;
} }
.repair-detail-dot.active { .repair-detail-dot.active {
background: #2186FF; background: #2186FF;
border-color: #2186FF; border-color: #2186FF;
} }
.repair-detail-dot.current { .repair-detail-dot.current {
background: #EF8D00; background: #EF8D00;
border-color: #EF8D00; border-color: #EF8D00;
} }
.repair-detail-line { .repair-detail-line {
flex: 1; flex: 1;
height: 4rpx; height: 4rpx;
@@ -440,18 +426,13 @@
margin: 0 2rpx; margin: 0 2rpx;
z-index: 1; z-index: 1;
} }
.repair-detail-line.active { background: #2186FF; }
.repair-detail-line.active {
background: #2186FF;
}
.repair-detail-progress-labels { .repair-detail-progress-labels {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
margin-left: 0; margin-left: 0;
width: 100%; width: 100%;
} }
.repair-detail-label { .repair-detail-label {
font-size: 22rpx; font-size: 22rpx;
color: #888; color: #888;
@@ -460,13 +441,11 @@
position: relative; position: relative;
top: 8rpx; top: 8rpx;
} }
.repair-detail-info { .repair-detail-info {
font-size: 26rpx; font-size: 26rpx;
color: #222; color: #222;
margin-bottom: 30rpx; margin-bottom: 30rpx;
} }
.repair-detail-btn { .repair-detail-btn {
width: 445rpx; width: 445rpx;
height: 73rpx; height: 73rpx;
@@ -475,15 +454,13 @@
font-size: 32rpx; font-size: 32rpx;
border: none; border: none;
border-radius: 30rpx; border-radius: 30rpx;
margin-top: 32rpx;
font-weight: 600;
margin-top: 100rpx; margin-top: 100rpx;
font-weight: 600;
} }
</style>
/* 让服务评价按钮靠右 */ /* 让服务评价按钮靠右 */
.eval-btn-right { .eval-btn-right {
margin-left: auto; margin-left: auto;
display: block; display: block;
width: fit-content; width: fit-content;
} }
</style>

View File

@@ -1,10 +1,12 @@
<template> <template>
<view class="warn-container"> <view class="warn-container">
<!-- 顶部导航 -->
<view class="warn-navbar"> <view class="warn-navbar">
<image src="/static/ic_back.png" class="warn-back" @click="goBack" /> <image src="/static/ic_back.png" class="warn-back" @click="goBack" />
<text class="warn-title">预警处理</text> <text class="warn-title">预警处理</text>
<text class="warn-right-txt" @click="goStatistics">预警统计</text> <text class="warn-right-txt" @click="goStatistics">预警统计</text>
</view> </view>
<!-- tab栏 --> <!-- tab栏 -->
<view class="warn-tabs"> <view class="warn-tabs">
<view v-for="(tab, idx) in tabs" :key="idx" :class="['warn-tab', { active: idx === activeTab }]" <view v-for="(tab, idx) in tabs" :key="idx" :class="['warn-tab', { active: idx === activeTab }]"
@@ -15,13 +17,13 @@
</view> </view>
<!-- 列表区 --> <!-- 列表区 -->
<scroll-view scroll-y class="warn-list"> <scroll-view class="warn-list" scroll-y refresher-enabled refresher-background="#f7f7f7"
:refresher-triggered="refresherTriggered" @refresherrefresh="onRefresh" @scrolltolower="loadMore"
:lower-threshold="50">
<view v-for="(item, idx) in list" :key="idx" class="warn-card" @click="goDetail2(item)"> <view v-for="(item, idx) in list" :key="idx" class="warn-card" @click="goDetail2(item)">
<view class="warn-row"> <view class="warn-row">
<view class="warn-no">{{item.smallTypeName}}</view> <view class="warn-no">{{item.smallTypeName}}</view>
<view class="warn-status"> <view class="warn-status">{{item.levelName}}</view>
{{item.levelName}}
</view>
</view> </view>
<image class="warn-line-image" src="/static/ic_my_repair_03.png" /> <image class="warn-line-image" src="/static/ic_my_repair_03.png" />
<view class="warn-info">预警内容{{ item.description }}</view> <view class="warn-info">预警内容{{ item.description }}</view>
@@ -32,6 +34,15 @@
<view class="warn-eval-btn">去处理</view> <view class="warn-eval-btn">去处理</view>
</view> </view>
</view> </view>
<!-- 底部加载提示 -->
<view v-if="loading" style="text-align:center;color:#999;font-size:26rpx;padding:20rpx;">
加载中...
</view>
<view v-if="noMore[activeTab]" style="text-align:center;color:#999;font-size:26rpx;padding:20rpx;">
没有更多数据了
</view>
</scroll-view> </scroll-view>
</view> </view>
</template> </template>
@@ -42,56 +53,75 @@
return { return {
tabs: ["待处理", "全部"], tabs: ["待处理", "全部"],
activeTab: 0, activeTab: 0,
tabData: [ tabData: [
[], [],
[] []
], ], // 每个 tab 的数据
tabLoaded: [false, false], pageNum: [1, 1], // 每个 tab 当前页码
pageSize: 10,
noMore: [false, false], // 每个 tab 是否没有更多数据
tabLoaded: [false, false], // tab 是否加载过
loading: false, loading: false,
lastScrollTop: 0, refresherTriggered: false
}; };
}, },
computed: { computed: {
list() { list() {
return this.tabData[this.activeTab]; return this.tabData[this.activeTab];
}, }
},
onShow() {
uni.$once('refreshData',s=> {
this.loadTabData(this.activeTab);
});
}, },
created() { created() {
this.loadTabData(this.activeTab); this.onRefresh()
}, },
methods: { methods: {
goBack() { goBack() {
uni.navigateBack(); uni.navigateBack();
}, },
// 切换 tab
async changeTab(idx) { async changeTab(idx) {
this.activeTab = idx; this.activeTab = idx;
if (!this.tabLoaded[idx]) { if (!this.tabLoaded[idx]) {
await this.loadTabData(idx); this.onRefresh()
} }
}, },
// 下拉刷新
async onRefresh() {
this.refresherTriggered = true;
this.pageNum[this.activeTab] = 1;
this.noMore[this.activeTab] = false;
this.tabData[this.activeTab] = [];
await this.loadTabData(this.activeTab);
this.refresherTriggered = false;
},
// 滚动加载更多
async loadMore() {
if (this.loading || this.noMore[this.activeTab]) return;
this.pageNum[this.activeTab]++;
await this.loadTabData(this.activeTab);
},
// 请求数据
async loadTabData(idx) { async loadTabData(idx) {
this.loading = true; this.loading = true;
let params = {}; let params = {
if (idx == 0) { pageNum: this.pageNum[idx],
params = { pageSize: this.pageSize
'states': [20, 30, 31, 32] };
} // 待处理
if (idx === 0) {
params.states = [20, 30, 31, 32];
} }
let res = await this.$u.api.getWarns(params); let res = await this.$u.api.getWarns(params);
if (res.code == "200") { if (res.code == "200") {
this.$set(this.tabData, idx, res.rows); let rows = res.rows || [];
if (rows.length < this.pageSize) {
this.noMore[idx] = true;
} }
this.$set(this.tabLoaded, idx, true); this.$set(this.tabData, idx, [...this.tabData[idx], ...rows]);
}
this.tabLoaded[idx] = true;
this.loading = false; this.loading = false;
}, },
goDetail(item) { goDetail(item) {
const itemStr = encodeURIComponent(JSON.stringify(item)); const itemStr = encodeURIComponent(JSON.stringify(item));
uni.navigateTo({ uni.navigateTo({
@@ -109,7 +139,7 @@
url: "/pages/sys/workbench/earlyWarning/warnStatistics" url: "/pages/sys/workbench/earlyWarning/warnStatistics"
}); });
} }
}, }
}; };
</script> </script>

View File

@@ -1,5 +1,6 @@
<template> <template>
<view class="order-container" @click="handleOutsideClick"> <view class="order-container" @click="handleOutsideClick">
<!-- 筛选区 -->
<view class="filter"> <view class="filter">
<!-- 工单类型按钮 --> <!-- 工单类型按钮 -->
<view class="filter-btn" @click.stop="togglePopup('type')"> <view class="filter-btn" @click.stop="togglePopup('type')">
@@ -57,7 +58,16 @@
</view> </view>
<!-- 列表区 --> <!-- 列表区 -->
<scroll-view scroll-y class="order-list" @scroll="handleScroll"> <scroll-view
scroll-y
class="order-list"
:refresher-enabled="true"
:refresher-triggered="isRefreshing"
refresher-background="#f7f7f7"
@refresherrefresh="onRefresh"
@scrolltolower="onLoadMore"
@scroll="handleScroll"
>
<view v-for="(item, idx) in list" :key="idx" class="order-card" @click="goDetail(item)"> <view v-for="(item, idx) in list" :key="idx" class="order-card" @click="goDetail(item)">
<view class="order-row"> <view class="order-row">
<view class="order-no">工单号{{ item.orderNo }}</view> <view class="order-no">工单号{{ item.orderNo }}</view>
@@ -76,11 +86,15 @@
服务评价 服务评价
</view> </view>
</view> </view>
</scroll-view>
<!-- 悬浮新增按钮 --> <!-- 加载更多提示 -->
<image v-if="false" src="/static/ic_my_repair_02.png" :class="['order-add-btn-fixed', { hide: isAddBtnHidden }]" <view v-if="loading" style="text-align:center;color:#999;font-size:26rpx;padding:20rpx;">
@click="addOrder" /> 加载中...
</view>
<view v-if="!hasMore && list.length > 0" style="text-align:center;color:#999;font-size:26rpx;padding:20rpx;">
没有更多数据了
</view>
</scroll-view>
</view> </view>
</template> </template>
@@ -90,85 +104,100 @@
return { return {
tabs: ["待办", "全部"], tabs: ["待办", "全部"],
activeTab: 0, activeTab: 0,
// 每个 tab 分页数据
tabData: [ tabData: [
[], { list: [], pageNum: 1, pageSize: 10, hasMore: true },
[] { list: [], pageNum: 1, pageSize: 10, hasMore: true },
], ],
tabLoaded: [false, false], tabLoaded: [false, false],
isRefreshing: false, // 控制下拉刷新动画
loading: false, loading: false,
lastScrollTop: 0, lastScrollTop: 0,
isAddBtnHidden: false, isAddBtnHidden: false,
activePopup: null, // 当前显示哪个弹窗null表示都关闭 activePopup: null,
selectedFilters: { selectedFilters: {
type: null, type: null,
status: null, status: null,
handler: null, handler: null,
}, },
typeList: [{ typeList: [{ orderTypeName: '全部' }],
'orderTypeName': '全部'
}],
statusList: [], statusList: [],
handlerList: [ handlerList: [{ name: "全部" }],
{
"name": '全部'
},
],
}; };
}, },
computed: { computed: {
list() { list() {
return this.tabData[this.activeTab]; return this.tabData[this.activeTab].list;
}, },
hasMore() {
return this.tabData[this.activeTab].hasMore;
}
}, },
created() { created() {
console.log("t1","!1111") this.loadFilterData()
this.loadTabData(this.activeTab); this.onRefresh();
this.loadFilterData();
}, },
methods: { methods: {
goBack() { async changeTab(idx) {
uni.navigateBack(); this.activeTab = idx;
if (!this.tabLoaded[idx]) {
this.isRefreshing = true;
await this.onRefresh();
}
}, },
addOrder() { async onRefresh() {
uni.navigateTo({ const tab = this.tabData[this.activeTab];
url: "/pages/sys/workbench/order/addOrder", tab.pageNum = 1;
}); tab.hasMore = true;
this.isRefreshing = true;
await this.loadTabData(this.activeTab);
this.isRefreshing = false;
}, },
async onLoadMore() {
const tab = this.tabData[this.activeTab];
if (!tab.hasMore || this.loading) return;
tab.pageNum++;
this.loading = true;
await this.loadTabData(this.activeTab);
this.loading = false;
},
async loadTabData(idx) {
let params = {
pageNum: this.tabData[idx].pageNum,
pageSize: this.tabData[idx].pageSize,
};
if (this.selectedFilters.type && this.selectedFilters.type.id) {
params.type = this.selectedFilters.type.id;
}
if (this.selectedFilters.status && this.selectedFilters.status.id) {
params.status = this.selectedFilters.status.id;
}
if (this.selectedFilters.handler && this.selectedFilters.handler.value) {
params.handler = this.selectedFilters.handler.value;
}
if (idx == 0) {
params.status = "1,2";
}
let res = await this.$u.api.getOrderList2(params);
if (res.code == "200") {
if (this.tabData[idx].pageNum === 1) {
this.tabData[idx].list = res.rows;
} else {
this.tabData[idx].list = [...this.tabData[idx].list, ...res.rows];
}
// 判断是否还有更多数据
this.tabData[idx].hasMore = res.rows.length >= this.tabData[idx].pageSize;
}
this.$set(this.tabLoaded, idx, true);
},
// 其它方法保持不变
handleScroll(e) { handleScroll(e) {
const scrollTop = e.detail.scrollTop; const scrollTop = e.detail.scrollTop;
if (Math.abs(scrollTop - this.lastScrollTop) < 20) return; if (Math.abs(scrollTop - this.lastScrollTop) < 20) return;
this.isAddBtnHidden = scrollTop > this.lastScrollTop && scrollTop > 50; this.isAddBtnHidden = scrollTop > this.lastScrollTop && scrollTop > 50;
this.lastScrollTop = scrollTop; this.lastScrollTop = scrollTop;
}, },
async changeTab(idx) {
this.activeTab = idx;
if (!this.tabLoaded[idx]) {
await this.loadTabData(idx);
}
},
async loadTabData(idx) {
this.loading = true;
let params = {};
if (this.selectedFilters.type && this.selectedFilters.type.id) {
params.type = this.selectedFilters.type.id
}
if(this.selectedFilters.status&&this.selectedFilters.status.id){
params.status = this.selectedFilters.status.id
}
if(this.selectedFilters.handler&&this.selectedFilters.handler.value){
params.handler = this.selectedFilters.handler.value
}
if(idx == 0){
params.status = "1,2"
}
let res = await this.$u.api.getOrderList2(params);
if (res.code == "200") {
this.$set(this.tabData, idx, res.rows);
}
this.$set(this.tabLoaded, idx, true);
this.loading = false;
},
getStatusLabel(status) { getStatusLabel(status) {
const statusMap = { const statusMap = {
0: "创建工单", 0: "创建工单",
@@ -196,16 +225,12 @@
}); });
}, },
togglePopup(name) { togglePopup(name) {
if (this.activePopup === name) { this.activePopup = this.activePopup === name ? null : name;
this.activePopup = null;
} else {
this.activePopup = name;
}
}, },
selectFilter(name, value) { selectFilter(name, value) {
this.selectedFilters[name] = value; this.selectedFilters[name] = value;
this.activePopup = null; this.activePopup = null;
this.loadTabData(this.activeTab) this.onRefresh();
}, },
handleOutsideClick() { handleOutsideClick() {
if (this.activePopup !== null) { if (this.activePopup !== null) {
@@ -213,37 +238,20 @@
} }
}, },
async loadFilterData() { async loadFilterData() {
// 工单类型
let resType = await this.$u.api.getOrdersType(); let resType = await this.$u.api.getOrdersType();
if (resType.code === 200) { if (resType.code === 200) {
this.typeList = [...this.typeList, ...resType.rows]; this.typeList = [...this.typeList, ...resType.rows];
} }
let handlers = await this.$u.api.getHandler2();
let handlers = await this.$u.api.getHandler();
if (handlers.code === 200) { if (handlers.code === 200) {
this.handlerList = [...this.handlerList,...handlers.data] this.handlerList = [...this.handlerList, ...handlers.data];
} }
this.statusList = [
this.statusList = [{ { name: "全部" },
name: "全部" { name: "创建工单", id: "0" },
}, { name: "已接单", id: "1,2" },
{ { name: "处理中", id: "3" },
name: "创建工单", { name: "已完成", id: "4" },
id:"0"
},
{
name: "已接单",
id:"1,2"
},
{
name: "处理中",
id:"3"
},
{
name: "已完成",
id:"4"
},
]; ];
}, },
}, },

View File

@@ -38,11 +38,11 @@
</view> </view>
<!-- 底部操作按钮 --> <!-- 底部操作按钮 -->
<view v-if="(!this.isManager&&this.detailStep == 2) || this.detailStep == 0" class="btn-group"> <view v-if="((!this.isManager&&this.detailStep != 0) || (this.isManager&&this.detailStep == 0))&&this.detailStep!=3" class="btn-group">
<button class="btn ghost" <button class="btn ghost"
@click="transfer">{{this.isManager ? '指派':this.detailStep == 0 ? '拒绝':'转派'}}</button> @click="transfer">{{this.isManager ? '指派':this.detailStep == 1 ? '开始':'完成'}}</button>
<button v-if="!this.isManager" class="btn primary" <button v-if="this.detailStep == 1" class="btn primary"
@click="complete">{{this.detailStep == 0 ? '接单':'完成'}}</button> @click="complete">转派</button>
</view> </view>
<SelectUser :visible.sync="showSelect" :list="users" :multiple="false" @confirm="onConfirm" /> <SelectUser :visible.sync="showSelect" :list="users" :multiple="false" @confirm="onConfirm" />