c293da23
刘淇
新园林init
|
1
|
<template>
|
cf70629b
刘淇
养护计划 照片 自己写样式
|
2
|
<view class="page-container">
|
12e66ec8
刘淇
新增树
|
3
4
5
|
<!-- 用户信息栏 -->
<view class="user-info-bar">
<view class="user-info">
|
12e66ec8
刘淇
新增树
|
6
|
<view class="user-text">
|
e2e5221c
刘淇
验证码登录
|
7
8
|
<view class="username">你好{{ userName }}</view>
<view class="login-desc">蓟城山水全域智能运营管理平台</view>
|
12e66ec8
刘淇
新增树
|
9
10
|
</view>
</view>
|
4f475013
刘淇
k线图
|
11
|
<view class="msg-icon" @click="handleMsgClick" hover-class="msg-icon--hover">
|
1d3624b0
刘淇
首页。养护任务
|
12
|
<up-icon name="chat" color="#fff" size="24" />
|
578c1373
刘淇
样式优化
|
13
|
<view class="msg-badge">
|
53012a16
刘淇
首页 优化
|
14
|
<up-badge type="error" showZero="true" max="999" :value="msgCount"></up-badge>
|
4f475013
刘淇
k线图
|
15
|
</view>
|
12e66ec8
刘淇
新增树
|
16
17
18
|
</view>
</view>
|
4f475013
刘淇
k线图
|
19
|
<view class="content-wrap">
|
1d3624b0
刘淇
首页。养护任务
|
20
21
22
23
24
25
26
|
<!-- 图表区域 增加平滑动画容器 -->
<view class="chart-wrap" v-show="showChartArea">
<!-- 任务完成情况标题 -->
<view class="module-title">任务完成情况</view>
<!-- 任务完成情况卡片 -->
<view class="task-chart-card">
|
ee792d52
刘淇
动态表单
|
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
<view class="card-header">
<view class="unit-tip">数字指标</view>
<!-- ActionSheet 点击唤起 -->
<view class="sort-trigger" @click="openActionSheet">
{{ sortLabel }}
<up-icon name="arrow-down" size="14" style="margin-left:4rpx;"></up-icon>
</view>
<!-- ActionSheet组件 -->
<up-action-sheet
:show="showActionSheet"
:actions="actionSheetOptions"
@select="handleSheetSelect"
@close="showActionSheet = false"
/>
<view class="date-picker-wrap">
<neo-datetime-pro v-model="dateRange" type="daterange" :clearable="false" placeholder="请选择日期范围"
@confirm="handleDateConfirm" :max-date="maxDate" @popup-show="handlePopupShow"
@popup-hide="handlePopupHide" />
</view>
</view>
|
4f475013
刘淇
k线图
|
48
|
|
1d3624b0
刘淇
首页。养护任务
|
49
|
<!-- 双折线K线图 -->
|
ee792d52
刘淇
动态表单
|
50
|
<!-- <view class="chart-container">
|
1d3624b0
刘淇
首页。养护任务
|
51
52
|
<uni-charts v-if="!isDatePickerOpen" type="line" :data="klineChartData" :categories="klineCategories"
:option="klineOption" :width="chartWidth" :height="chartHeight" />
|
ee792d52
刘淇
动态表单
|
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
</view> -->
<up-grid
:border="false"
col="4"
>
<up-grid-item
v-for="(baseListItem,baseListIndex) in baseList"
:key="baseListIndex"
>
<up-icon
:customStyle="{paddingTop:20+'rpx'}"
:name="baseListItem.name"
:size="22"
></up-icon>
<text class="grid-text">{{baseListItem.num}}</text>
<text class="grid-text">{{baseListItem.title}}</text>
</up-grid-item>
</up-grid>
|
12e66ec8
刘淇
新增树
|
72
73
|
</view>
</view>
|
12e66ec8
刘淇
新增树
|
74
|
|
1d3624b0
刘淇
首页。养护任务
|
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
<view class="con-wrap">
<view class="con-title">养护任务 </view>
<!-- 手写Tab切换:胶囊分段样式 -->
<view class="custom-tab-wrap">
<view class="tab-capsule" :class="{ active: currentTabValue === 0 }" @click="handleTabClick(0)">
待办事项({{ todoTotal }})
</view>
<view class="tab-capsule" :class="{ active: currentTabValue === 1 }" @click="handleTabClick(1)">
已办事项({{ doneTotal }})
</view>
</view>
<!-- 动态组信息文案 -->
|
6cc0ab0e
刘淇
养护任务
|
90
|
<!-- <view class="tip-top" style="padding: 8px 0 0 70px;">
|
1d3624b0
刘淇
首页。养护任务
|
91
|
<text>{{ tipText }}</text>
|
6cc0ab0e
刘淇
养护任务
|
92
|
</view> -->
|
1d3624b0
刘淇
首页。养护任务
|
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
<!-- 顶部进度提示栏 -->
<view v-if="showTipHeader" class="tip-header">
<up-icon name="checkmark-circle" color="#00b42a" size="20"></up-icon>
<text style="color: #1677ff;">今日组内:您已经完成{{ finishNum }}项,小组均值{{ avgNum }}项</text>
</view>
<scroll-view
class="task-list-container"
scroll-y
@scroll="onListScroll"
@scrolltoupper="handleTouchTop"
enhanced
>
<view v-if="taskList.length === 0" class="empty-box">
<up-empty />
</view>
<view class="task-item" v-for="(item, index) in taskList" :key="`${item.taskName}_${index}`"
hover-class="task-item--hover" @click="handleTaskClick(item)">
|
cf70629b
刘淇
养护计划 照片 自己写样式
|
113
|
<view class="task-item__content">
|
1d3624b0
刘淇
首页。养护任务
|
114
115
116
|
<view class="name-fixed-wrap">
<view class="task-item__name ">
事项{{ index + 1 }}
|
cf70629b
刘淇
养护计划 照片 自己写样式
|
117
|
</view>
|
1d3624b0
刘淇
首页。养护任务
|
118
119
|
<view class="task-name-text">
{{ item.taskName || '无' }}
|
cf70629b
刘淇
养护计划 照片 自己写样式
|
120
121
|
</view>
</view>
|
1d3624b0
刘淇
首页。养护任务
|
122
123
124
125
126
127
128
129
130
|
<view v-if="currentTabValue === 0" class="task-item__footer" style="padding-left: 60px;">
<image class="loc-icon" src="https://img.jichengshanshui.com.cn:28207/appimg/定位icon@3x.png" mode="aspectFit"></image>
<template v-if="isWalkTextMode">
<text>距离当前{{ item.distance }}m ·约{{ item.estimatedWalkingMinutes }}分钟步行</text>
</template>
<template v-else>
<text>{{ item.distance }}m ·</text>
<up-icon name="star-fill" color="#ffd21d" size="20"></up-icon>
|
6cc0ab0e
刘淇
养护任务
|
131
|
<text>历史完成率{{ item.historyCompletionRate }}%</text>
|
1d3624b0
刘淇
首页。养护任务
|
132
133
|
</template>
</view>
|
4f475013
刘淇
k线图
|
134
|
</view>
|
4f475013
刘淇
k线图
|
135
|
</view>
|
1d3624b0
刘淇
首页。养护任务
|
136
137
|
</scroll-view>
</view>
|
12e66ec8
刘淇
新增树
|
138
|
</view>
|
12e66ec8
刘淇
新增树
|
139
|
</view>
|
c293da23
刘淇
新园林init
|
140
141
|
</template>
|
cf70629b
刘淇
养护计划 照片 自己写样式
|
142
|
<script setup lang="ts">
|
1d3624b0
刘淇
首页。养护任务
|
143
144
145
146
|
import { ref, computed, nextTick } from 'vue';
import { onShow,onUnload } from '@dcloudio/uni-app'
import { useUserStore } from '@/pinia/user';
import { timeFormat } from '@/uni_modules/uview-plus';
|
4f475013
刘淇
k线图
|
147
|
import uniCharts from '@/components/uni-charts/uni-charts.vue';
|
1d3624b0
刘淇
首页。养护任务
|
148
149
150
151
152
153
|
import { getUnreadCount } from "@/api/user";
import {
getTaskCompletionSummary,
taskDetailsWithDistance,
taskDetailsWithSmartSort
} from "@/api/index/index";
|
cf70629b
刘淇
养护计划 照片 自己写样式
|
154
|
|
1d3624b0
刘淇
首页。养护任务
|
155
156
157
|
const userStore = useUserStore();
const deptId = computed(() => String(userStore.userInfo?.user?.deptId ?? ''));
|
6cc0ab0e
刘淇
养护任务
|
158
|
// ====================== 分组配置(多部门归属同一组) ======================
|
1d3624b0
刘淇
首页。养护任务
|
159
|
type GroupItem = {
|
6cc0ab0e
刘淇
养护任务
|
160
|
deptIds: string[]; // 多个部门ID数组
|
1d3624b0
刘淇
首页。养护任务
|
161
162
163
164
|
label: string;
showTipHeader: boolean; // 是否展示顶部进度条
useWalkText: boolean; // 是否展示步行距离文案
};
|
ee792d52
刘淇
动态表单
|
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
|
// 创建响应式数据
const baseList = ref([
{
num:'123',
name: 'photo',
title: '应办任务数'
},
{
num:'32',
name: 'photo',
title: '已办任务数'
},
{
num:'456',
name: 'lock',
title: '待办任务数'
},
{
num:'0',
name: 'star',
title: '超时未完成'
},
]);
const options1 = ref([
{
label: '默认排序',
value: 1,
},
{
label: '距离优先',
value: 2,
},
{
label: '价格优先',
value: 3,
}
]);
|
1d3624b0
刘淇
首页。养护任务
|
205
|
const groupConfig: GroupItem[] = [
|
6cc0ab0e
刘淇
养护任务
|
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
|
// 组2 A1B2 纯效率·有提醒
{
deptIds: ['361', '363', '279', '277', '270'],
label: '[组2 A1B2 纯效率·有提醒]',
showTipHeader: true,
useWalkText: true
},
// 组3 A2B1 个性化·无提醒
{
deptIds: ['252', '273', '274', '337', '359', '360'],
label: '[组3 A2B1 个性化·无提醒]',
showTipHeader: false,
useWalkText: false
},
// 组4 A2B2 个性化·有提醒
{
deptIds: ['281', '272', '271', '338', '280'],
label: '[组4 A2B2 个性化·有提醒]',
showTipHeader: true,
useWalkText: false
},
|
1d3624b0
刘淇
首页。养护任务
|
227
|
];
|
6cc0ab0e
刘淇
养护任务
|
228
229
230
231
232
233
234
|
// 默认组1:未匹配到的所有部门
const defaultGroup: GroupItem = {
deptIds: [],
label: '[组1 A1B1 纯效率·无提醒]',
showTipHeader: false,
useWalkText: true
};
|
1d3624b0
刘淇
首页。养护任务
|
235
|
|
6cc0ab0e
刘淇
养护任务
|
236
|
// 获取当前部门所属分组
|
1d3624b0
刘淇
首页。养护任务
|
237
|
const currentGroup = computed(() => {
|
6cc0ab0e
刘淇
养护任务
|
238
239
240
241
242
243
244
245
246
|
const targetDept = deptId.value;
// 遍历匹配部门ID
for (const group of groupConfig) {
if (group.deptIds.includes(targetDept)) {
return group;
}
}
// 无匹配返回默认组1
return defaultGroup;
|
1d3624b0
刘淇
首页。养护任务
|
247
248
|
});
|
6cc0ab0e
刘淇
养护任务
|
249
|
// 自动读取分组配置,无需修改其他业务代码
|
1d3624b0
刘淇
首页。养护任务
|
250
251
252
253
254
|
const tipText = computed(() => currentGroup.value.label);
const showTipHeader = computed(() => currentGroup.value.showTipHeader);
const isWalkTextMode = computed(() => currentGroup.value.useWalkText);
const useDistanceApi = computed(() => currentGroup.value.useWalkText);
// =========================================================================
|
c293da23
刘淇
新园林init
|
255
|
|
1d3624b0
刘淇
首页。养护任务
|
256
257
|
const finishNum = ref(0);
const avgNum = ref(0);
|
cf70629b
刘淇
养护计划 照片 自己写样式
|
258
|
const msgCount = ref(0);
|
1d3624b0
刘淇
首页。养护任务
|
259
260
261
|
const currentTabValue = ref(0);
const dateRange = ref<string[]>([]);
|
5b5a4862
刘淇
按钮放大
|
262
|
const yesterday = new Date();
|
1d3624b0
刘淇
首页。养护任务
|
263
|
yesterday.setDate(yesterday.getDate() - 1);
|
5b5a4862
刘淇
按钮放大
|
264
|
const maxDate = ref(timeFormat(yesterday, 'yyyy-mm-dd'));
|
1d3624b0
刘淇
首页。养护任务
|
265
|
const minDate = '2026-01-06';
|
5b5a4862
刘淇
按钮放大
|
266
|
|
5b5a4862
刘淇
按钮放大
|
267
|
const isDatePickerOpen = ref(false);
|
5b5a4862
刘淇
按钮放大
|
268
269
270
|
const handlePopupShow = () => {
isDatePickerOpen.value = true;
};
|
5b5a4862
刘淇
按钮放大
|
271
272
273
|
const handlePopupHide = () => {
isDatePickerOpen.value = false;
};
|
cf70629b
刘淇
养护计划 照片 自己写样式
|
274
|
|
1d3624b0
刘淇
首页。养护任务
|
275
276
277
278
279
280
281
282
283
284
285
286
|
const todoTotal = ref(0);
const doneTotal = ref(0);
const todoFullList = ref<any[]>([]);
const doneFullList = ref<any[]>([]);
const taskList = computed(() => {
return currentTabValue.value === 0 ? todoFullList.value : doneFullList.value;
});
const chooseOptions = computed(() => [
{ title: `待办事项(${todoTotal.value})`, id: 'todo' },
{ title: `已办事项(${doneTotal.value})`, id: 'done' }
]);
|
c293da23
刘淇
新园林init
|
287
|
|
1d3624b0
刘淇
首页。养护任务
|
288
289
|
const currentLon = ref<string>('');
const currentLat = ref<string>('');
|
4f475013
刘淇
k线图
|
290
291
|
const chartWidth = ref(0);
const chartHeight = ref(300);
|
1d3624b0
刘淇
首页。养护任务
|
292
293
|
const klineCategories = ref<string[]>([]);
|
4f475013
刘淇
k线图
|
294
|
const klineChartData = ref([
|
12e66ec8
刘淇
新增树
|
295
|
{
|
4570c70a
刘淇
消息中心
|
296
|
name: '已完成任务数',
|
1d3624b0
刘淇
首页。养护任务
|
297
|
data: [] as number[],
|
4f475013
刘淇
k线图
|
298
|
color: '#25AF69'
|
12e66ec8
刘淇
新增树
|
299
300
|
},
{
|
6bce1057
刘淇
ai 大区经理
|
301
|
name: '总任务数',
|
1d3624b0
刘淇
首页。养护任务
|
302
|
data: [] as number[],
|
4f475013
刘淇
k线图
|
303
304
305
|
color: '#B34C17'
}
]);
|
4570c70a
刘淇
消息中心
|
306
|
|
4f475013
刘淇
k线图
|
307
308
309
|
const klineOption = ref({
grid: {
top: '25%',
|
53012a16
刘淇
首页 优化
|
310
|
left: '12%',
|
4f475013
刘淇
k线图
|
311
|
right: '8%',
|
53012a16
刘淇
首页 优化
|
312
|
bottom: '16%'
|
12e66ec8
刘淇
新增树
|
313
|
},
|
4f475013
刘淇
k线图
|
314
|
xAxis: {
|
1d3624b0
刘淇
首页。养护任务
|
315
|
axisLabel: { fontSize: 12, color: '#666' }
|
12e66ec8
刘淇
新增树
|
316
|
},
|
4f475013
刘淇
k线图
|
317
318
|
yAxis: {
min: 0,
|
1d3624b0
刘淇
首页。养护任务
|
319
320
|
splitLine: { lineStyle: { color: '#f5f5f7' } },
axisLabel: { fontSize: 12, color: '#666' }
|
12e66ec8
刘淇
新增树
|
321
|
},
|
4f475013
刘淇
k线图
|
322
323
|
tooltip: {
trigger: 'axis',
|
1d3624b0
刘淇
首页。养护任务
|
324
|
formatter: (params: any[]) => {
|
4570c70a
刘淇
消息中心
|
325
326
|
return `${params[0].name}<br/>
${params[0].seriesName}: ${params[0].data}<br/>
|
4f475013
刘淇
k线图
|
327
328
329
330
331
332
|
${params[1].seriesName}: ${params[1].data}`;
}
},
legend: {
show: true,
top: '5%',
|
1d3624b0
刘淇
首页。养护任务
|
333
|
textStyle: { fontSize: 12 }
|
12e66ec8
刘淇
新增树
|
334
|
}
|
4f475013
刘淇
k线图
|
335
336
|
});
|
ee792d52
刘淇
动态表单
|
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
|
const value1 = ref(1)
const showActionSheet = ref(false)
// actionSheet选项映射
const actionSheetOptions = computed(()=>{
return options1.value.map(opt => ({
name: opt.label,
value: opt.value
}))
})
// 显示当前选中的文字
const sortLabel = computed(()=>{
const cur = options1.value.find(i=>i.value === value1.value)
return cur?.label ?? "默认排序"
})
// 打开菜单
const openActionSheet = ()=>{
showActionSheet.value = true
}
// 选中回调
const handleSheetSelect = (item: {name:string, value:number})=>{
value1.value = item.value
showActionSheet.value = false
// ========== 在这里添加排序业务逻辑 ==========
console.log('选中排序类型:', item.value)
}
|
4f475013
刘淇
k线图
|
366
|
const userName = computed(() => userStore.userInfo?.user?.nickname || '用户');
|
4f475013
刘淇
k线图
|
367
|
|
1d3624b0
刘淇
首页。养护任务
|
368
|
const rpx2px = (rpx: number) => {
|
cf70629b
刘淇
养护计划 照片 自己写样式
|
369
|
const systemInfo = uni.getSystemInfoSync();
|
1d3624b0
刘淇
首页。养护任务
|
370
371
372
373
374
375
376
377
378
379
380
381
382
383
|
return Math.floor(systemInfo.screenWidth / 750 * rpx);
};
// ========== 滚动逻辑 终极优化 ==========
const showChartArea = ref(true);
// 隐藏阈值:超过80rpx收起
const scrollHideThreshold = rpx2px(80);
// 安全显示区间:≤80rpx一律显示,覆盖所有回弹残留(70/80/90)
const safeShowThreshold = rpx2px(130);
let scrollTimer: number | null = null;
// 下拉触顶强制展示
const handleTouchTop = () => {
showChartArea.value = true;
|
4f475013
刘淇
k线图
|
384
385
|
};
|
1d3624b0
刘淇
首页。养护任务
|
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
|
const onListScroll = (e: any) => {
const scrollTop = e.detail.scrollTop;
console.log('scrollTop', scrollTop)
if (scrollTimer) clearTimeout(scrollTimer);
// 实时:只要在安全区间立刻显示
if (scrollTop <= safeShowThreshold) {
showChartArea.value = true;
} else if (scrollTop > scrollHideThreshold) {
showChartArea.value = false;
}
// 滚动停止兜底二次校验
scrollTimer = setTimeout(() => {
if (scrollTop <= safeShowThreshold) {
showChartArea.value = true;
}
}, 100);
};
// 切换tab重置图表显示
const handleTabClick = (tabIndex: number) => {
if (currentTabValue.value === tabIndex) return;
currentTabValue.value = tabIndex;
// 切换tab强制显示图表
showChartArea.value = true;
};
// 页面每次显示强制重置图表为显示状态
onShow(async () => {
showChartArea.value = true;
chartWidth.value = rpx2px(750 - 60);
chartHeight.value = rpx2px(300);
initRecent7Days();
getUnread();
await loadAllTaskByDept();
});
// 页面销毁清除定时器
onUnload(() => {
if (scrollTimer) clearTimeout(scrollTimer);
});
// ======================================
const getCurrentLocation = (): Promise<{ lon: string; lat: string }> => {
return new Promise((resolve, reject) => {
uni.getSetting({
success: (settingRes) => {
if (!settingRes.authSetting['scope.userLocation']) {
uni.authorize({
scope: 'scope.userLocation',
success: () => {
uni.getLocation({
type: 'gcj02',
success: (loc) => {
|
6cc0ab0e
刘淇
养护任务
|
441
442
|
console.log(loc.longitude)
console.log(loc.latitude)
|
1d3624b0
刘淇
首页。养护任务
|
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
|
resolve({
lon: loc.longitude.toFixed(6),
lat: loc.latitude.toFixed(6)
})
},
fail: (err) => {
uni.showToast({ title: '获取位置失败,请打开手机定位', icon: 'none' })
reject(err)
}
})
},
fail: () => {
uni.showModal({
title: '需要定位权限',
content: '请允许获取位置才能正常使用',
confirmText: '去设置',
success: (modal) => {
if (modal.confirm) {
uni.openSetting()
}
}
})
reject('用户拒绝定位权限')
}
})
} else {
uni.getLocation({
type: 'gcj02',
success: (loc) => {
|
6cc0ab0e
刘淇
养护任务
|
472
473
|
console.log(loc.longitude)
console.log(loc.latitude)
|
1d3624b0
刘淇
首页。养护任务
|
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
|
resolve({
lon: loc.longitude.toFixed(6),
lat: loc.latitude.toFixed(6)
})
},
fail: (err) => {
uni.showToast({ title: '获取位置失败,请打开手机定位', icon: 'none' })
reject(err)
}
})
}
},
fail: (err) => {
reject('获取权限失败:' + err.errMsg)
}
})
})
}
|
4f475013
刘淇
k线图
|
492
|
|
cf70629b
刘淇
养护计划 照片 自己写样式
|
493
|
const initRecent7Days = async () => {
|
5b5a4862
刘淇
按钮放大
|
494
|
const yesterday = new Date();
|
1d3624b0
刘淇
首页。养护任务
|
495
|
yesterday.setDate(yesterday.getDate() - 1);
|
5b5a4862
刘淇
按钮放大
|
496
|
const sevenDaysAgo = new Date(yesterday);
|
1d3624b0
刘淇
首页。养护任务
|
497
|
sevenDaysAgo.setDate(yesterday.getDate() - 6);
|
5b5a4862
刘淇
按钮放大
|
498
|
|
cf70629b
刘淇
养护计划 照片 自己写样式
|
499
500
|
dateRange.value = [
timeFormat(sevenDaysAgo, 'yyyy-mm-dd'),
|
5b5a4862
刘淇
按钮放大
|
501
|
timeFormat(yesterday, 'yyyy-mm-dd')
|
cf70629b
刘淇
养护计划 照片 自己写样式
|
502
|
];
|
1d3624b0
刘淇
首页。养护任务
|
503
|
initChartData(dateRange.value[0], dateRange.value[1]);
|
4f475013
刘淇
k线图
|
504
505
|
};
|
cf70629b
刘淇
养护计划 照片 自己写样式
|
506
507
508
509
510
511
512
513
514
|
const getUnread = async () => {
try {
const res = await getUnreadCount();
msgCount.value = res || 0;
} catch (error) {
console.error('获取未读消息数失败:', error);
msgCount.value = 0;
}
};
|
4570c70a
刘淇
消息中心
|
515
|
|
1d3624b0
刘淇
首页。养护任务
|
516
|
const initChartData = async (beginTime: string, endTime: string) => {
|
cf70629b
刘淇
养护计划 照片 自己写样式
|
517
|
try {
|
1d3624b0
刘淇
首页。养护任务
|
518
|
const postData = { beginTime, endTime };
|
cf70629b
刘淇
养护计划 照片 自己写样式
|
519
|
const res = await getTaskCompletionSummary(postData);
|
1d3624b0
刘淇
首页。养护任务
|
520
521
522
|
klineCategories.value = res.map((item: any) => item.currentDate);
klineChartData.value[0].data = res.map((item: any) => item.completedNum);
klineChartData.value[1].data = res.map((item: any) => item.countpendingNum);
|
cf70629b
刘淇
养护计划 照片 自己写样式
|
523
524
525
526
|
} catch (error) {
console.error('获取图表数据失败:', error);
}
};
|
4f475013
刘淇
k线图
|
527
|
|
1d3624b0
刘淇
首页。养护任务
|
528
|
const loadDistanceApiTask = async (lon: string, lat: string) => {
|
cf70629b
刘淇
养护计划 照片 自己写样式
|
529
|
try {
|
1d3624b0
刘淇
首页。养护任务
|
530
531
|
const paramsTodo = { queryType: 1, currentLon: lon, currentLat: lat };
const paramsDone = { queryType: 2, currentLon: lon, currentLat: lat };
|
cf70629b
刘淇
养护计划 照片 自己写样式
|
532
|
const [todoRes, doneRes] = await Promise.all([
|
1d3624b0
刘淇
首页。养护任务
|
533
534
|
taskDetailsWithDistance(paramsTodo),
taskDetailsWithDistance(paramsDone)
|
cf70629b
刘淇
养护计划 照片 自己写样式
|
535
|
]);
|
1d3624b0
刘淇
首页。养护任务
|
536
537
538
539
540
541
542
543
544
545
546
547
548
549
|
todoFullList.value = todoRes?.sortedTasks || [];
doneFullList.value = doneRes?.sortedTasks || [];
todoTotal.value = Number(todoRes?.totalPendingTasks) || 0;
doneTotal.value = Number(doneRes?.totalPendingTasks) || 0;
finishNum.value = todoRes?.teamProgress?.userCompletedCount ?? 0;
avgNum.value = doneRes?.teamProgress?.teamAverage ?? 0;
await nextTick();
} catch (err) {
uni.showToast({ title: '加载任务失败', icon: 'none' });
console.error('加载distance接口任务报错', err);
todoFullList.value = [];
doneFullList.value = [];
todoTotal.value = 0;
doneTotal.value = 0;
|
cf70629b
刘淇
养护计划 照片 自己写样式
|
550
|
}
|
4f475013
刘淇
k线图
|
551
552
|
};
|
1d3624b0
刘淇
首页。养护任务
|
553
|
const loadSmartSortTask = async (lon: string, lat: string) => {
|
cf70629b
刘淇
养护计划 照片 自己写样式
|
554
|
try {
|
1d3624b0
刘淇
首页。养护任务
|
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
|
const [todoRes, doneRes] = await Promise.all([
taskDetailsWithSmartSort({
queryType: 1,
currentLon: lon,
currentLat: lat
}),
taskDetailsWithSmartSort({
queryType: 2,
currentLon: lon,
currentLat: lat
})
]);
todoFullList.value = todoRes?.sortedTasks || [];
doneFullList.value = doneRes?.sortedTasks || [];
todoTotal.value = Number(todoRes?.totalPendingTasks) || 0;
doneTotal.value = Number(doneRes?.totalPendingTasks) || 0;
finishNum.value = todoRes?.teamProgress?.userCompletedCount ?? 0;
avgNum.value = doneRes?.teamProgress?.teamAverage ?? 0;
await nextTick();
} catch (err) {
uni.showToast({ title: '加载任务失败', icon: 'none' });
console.error('加载smartSort接口任务报错', err);
todoFullList.value = [];
doneFullList.value = [];
todoTotal.value = 0;
doneTotal.value = 0;
|
cf70629b
刘淇
养护计划 照片 自己写样式
|
581
582
583
|
}
};
|
1d3624b0
刘淇
首页。养护任务
|
584
585
586
587
588
589
590
591
592
593
|
const loadAllTaskByDept = async () => {
const loc = await getCurrentLocation();
currentLon.value = loc.lon;
currentLat.value = loc.lat;
if (useDistanceApi.value) {
await loadDistanceApiTask(loc.lon, loc.lat);
} else {
await loadSmartSortTask(loc.lon, loc.lat);
}
};
|
cf70629b
刘淇
养护计划 照片 自己写样式
|
594
|
|
1d3624b0
刘淇
首页。养护任务
|
595
|
const handleDateConfirm = (e: string[]) => {
|
cf70629b
刘淇
养护计划 照片 自己写样式
|
596
|
dateRange.value = e;
|
cf70629b
刘淇
养护计划 照片 自己写样式
|
597
|
initChartData(e[0], e[1]);
|
4f475013
刘淇
k线图
|
598
|
};
|
12e66ec8
刘淇
新增树
|
599
|
|
4f475013
刘淇
k线图
|
600
|
const handleMsgClick = () => {
|
1d3624b0
刘淇
首页。养护任务
|
601
|
uni.navigateTo({ url: '/pages-sub/msg/index' });
|
4f475013
刘淇
k线图
|
602
603
|
};
|
1d3624b0
刘淇
首页。养护任务
|
604
605
606
|
const handleTaskClick = (item: any) => {
if (item.taskType == "maintain") {
if (currentTabValue.value === 0) {
|
50176780
王彪总
业务线 小程序不用写死,从后端接口获取
|
607
608
609
|
// planTypeId / businessType 必须带上:填报页靠这两个参数加载动态字段,
// 缺任一个会直接提示「缺少业务参数」、表单空白(后端的 workTypeId 也会变成 NaN)
uni.navigateTo({ url: `/pages-sub/daily/maintain-manage/add-record?planNo=${item.planNo || ''}&planTypeId=${item.planTypeId ?? ''}&businessType=${item.busiLine ?? ''}` });
|
1d3624b0
刘淇
首页。养护任务
|
610
611
612
613
|
}
if (currentTabValue.value === 1) {
uni.navigateTo({ url: `/pages-sub/daily/maintain-manage/finish-plan-detail?planNo=${item.planNo || ''}` });
}
|
cf70629b
刘淇
养护计划 照片 自己写样式
|
614
|
}
|
1d3624b0
刘淇
首页。养护任务
|
615
616
617
618
619
620
621
622
623
|
if (item.taskType == "inspection") {
if (currentTabValue.value === 0) {
uni.navigateTo({ url: `/pages-sub/daily/patrol-manage/add-patrol-record?planNo=${item.planNo}&batchNo=${item.batchNo}` });
}
if (currentTabValue.value === 1) {
uni.navigateTo({ url: `/pages-sub/daily/patrol-manage/finish-plan-detail?planNo=${item.planNo || ''}` });
}
}
};
|
c293da23
刘淇
新园林init
|
624
625
|
</script>
|
12e66ec8
刘淇
新增树
|
626
|
<style scoped lang="scss">
|
4f475013
刘淇
k线图
|
627
628
|
$primary-color: #1677ff;
$danger-color: #E53935;
|
4f475013
刘淇
k线图
|
629
630
631
632
633
|
$text-color: #333;
$text-color-light: #666;
$text-color-placeholder: #999;
$bg-color: #f5f5f7;
$card-bg: #fff;
|
cf70629b
刘淇
养护计划 照片 自己写样式
|
634
635
636
637
638
|
$border-radius: 16px;
$card-radius: 5px;
$spacing-sm: 5px;
$spacing-md: 10px;
$spacing-lg: 15px;
|
1d3624b0
刘淇
首页。养护任务
|
639
|
$border-color: #e5e5e5;
|
cf70629b
刘淇
养护计划 照片 自己写样式
|
640
641
|
.page-container {
|
1d3624b0
刘淇
首页。养护任务
|
642
|
height: 100vh;
|
cf70629b
刘淇
养护计划 照片 自己写样式
|
643
|
background-color: $bg-color;
|
1d3624b0
刘淇
首页。养护任务
|
644
645
646
|
overflow: hidden;
display: flex;
flex-direction: column;
|
12e66ec8
刘淇
新增树
|
647
648
|
}
|
12e66ec8
刘淇
新增树
|
649
|
.user-info-bar {
|
1d3624b0
刘淇
首页。养护任务
|
650
|
flex-shrink: 0;
|
4f475013
刘淇
k线图
|
651
652
|
background: url("https://img.jichengshanshui.com.cn:28207/appimg/bg.jpg") no-repeat;
background-size: 100% 100%;
|
24c0bbe7
刘淇
登录账号密码 加密存储
|
653
|
padding: 80px $spacing-lg 135px;
|
12e66ec8
刘淇
新增树
|
654
655
656
657
|
display: flex;
justify-content: space-between;
align-items: center;
color: #fff;
|
12e66ec8
刘淇
新增树
|
658
|
|
4f475013
刘淇
k线图
|
659
|
.username {
|
4570c70a
刘淇
消息中心
|
660
|
font-size: 16px;
|
cf70629b
刘淇
养护计划 照片 自己写样式
|
661
|
margin-bottom: 4px;
|
4f475013
刘淇
k线图
|
662
|
}
|
4f475013
刘淇
k线图
|
663
|
.login-desc {
|
cf70629b
刘淇
养护计划 照片 自己写样式
|
664
|
font-size: 16px;
|
12e66ec8
刘淇
新增树
|
665
|
}
|
12e66ec8
刘淇
新增树
|
666
667
|
.msg-icon {
position: relative;
|
cf70629b
刘淇
养护计划 照片 自己写样式
|
668
|
padding: 5px;
|
578c1373
刘淇
样式优化
|
669
|
top: 10px;
|
4f475013
刘淇
k线图
|
670
|
border-radius: 50%;
|
4f475013
刘淇
k线图
|
671
672
673
|
&--hover {
background-color: rgba(255, 255, 255, 0.2);
}
|
12e66ec8
刘淇
新增树
|
674
675
|
.msg-badge {
position: absolute;
|
578c1373
刘淇
样式优化
|
676
677
|
top: -2px;
right: -3px;
|
12e66ec8
刘淇
新增树
|
678
679
680
681
|
}
}
}
|
4f475013
刘淇
k线图
|
682
|
.content-wrap {
|
1d3624b0
刘淇
首页。养护任务
|
683
|
flex: 1;
|
cf70629b
刘淇
养护计划 照片 自己写样式
|
684
|
margin-top: -122px;
|
4f475013
刘淇
k线图
|
685
686
|
border-radius: $border-radius $border-radius 0 0;
background-color: $bg-color;
|
4f475013
刘淇
k线图
|
687
|
overflow: hidden;
|
1d3624b0
刘淇
首页。养护任务
|
688
689
690
691
692
693
694
695
696
697
698
699
700
701
|
display: flex;
flex-direction: column;
}
.chart-wrap {
flex-shrink: 0;
transition: all 0.35s ease-out;
opacity: 1;
overflow: hidden;
}
.chart-wrap[hidden] {
opacity: 0;
height: 0;
margin: 0;
|
4f475013
刘淇
k线图
|
702
|
}
|
12e66ec8
刘淇
新增树
|
703
|
|
4f475013
刘淇
k线图
|
704
|
.module-title {
|
cf70629b
刘淇
养护计划 照片 自己写样式
|
705
|
padding: $spacing-lg;
|
578c1373
刘淇
样式优化
|
706
|
font-size: 14px;
|
4f475013
刘淇
k线图
|
707
708
|
font-weight: 600;
color: $text-color-light;
|
1d3624b0
刘淇
首页。养护任务
|
709
|
flex-shrink: 0;
|
4f475013
刘淇
k线图
|
710
711
712
713
714
715
716
|
}
.task-chart-card {
background-color: $card-bg;
border-radius: $card-radius;
margin: 0 $spacing-lg $spacing-md;
padding: $spacing-md;
|
1d3624b0
刘淇
首页。养护任务
|
717
|
flex-shrink: 0;
|
12e66ec8
刘淇
新增树
|
718
719
720
|
.card-header {
display: flex;
justify-content: space-between;
|
12e66ec8
刘淇
新增树
|
721
|
align-items: center;
|
cf70629b
刘淇
养护计划 照片 自己写样式
|
722
|
font-size: 12px;
|
4f475013
刘淇
k线图
|
723
724
|
color: $text-color-placeholder;
margin-bottom: $spacing-md;
|
4f475013
刘淇
k线图
|
725
|
.date-picker-wrap {
|
cf70629b
刘淇
养护计划 照片 自己写样式
|
726
|
border-radius: 3px;
|
4f475013
刘淇
k线图
|
727
|
transition: background-color 0.2s;
|
5b5a4862
刘淇
按钮放大
|
728
729
|
position: relative;
z-index: 999;
|
4f475013
刘淇
k线图
|
730
731
732
|
&:active {
background-color: $bg-color;
}
|
12e66ec8
刘淇
新增树
|
733
734
|
}
}
|
4f475013
刘淇
k线图
|
735
|
.chart-container {
|
12e66ec8
刘淇
新增树
|
736
|
width: 100%;
|
cf70629b
刘淇
养护计划 照片 自己写样式
|
737
|
height: 150px;
|
4f475013
刘淇
k线图
|
738
739
740
|
display: flex;
align-items: center;
justify-content: center;
|
12e66ec8
刘淇
新增树
|
741
742
|
}
}
|
1d3624b0
刘淇
首页。养护任务
|
743
744
745
746
747
748
749
750
751
752
|
.con-wrap {
border-radius: 8px;
background-color: #fff;
margin: 0 15px;
flex: 1;
min-height: 0;
display: flex;
flex-direction: column;
overflow: hidden;
}
|
12e66ec8
刘淇
新增树
|
753
|
|
1d3624b0
刘淇
首页。养护任务
|
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
|
.con-title {
padding: 10px 15px;
border-bottom: 1px solid #f0e9e9;
flex-shrink: 0;
}
.custom-tab-wrap {
display: flex;
align-items: center;
gap: 20rpx;
padding: 20rpx 0 20rpx 20rpx;
background: #fff;
flex-shrink: 0;
}
.tab-capsule {
padding: 10rpx 20rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 28rpx;
color: #999;
background: #f5f5f5;
border-radius: 0;
transition: all 0.2s ease;
font-weight: 500;
}
.tab-capsule.active {
color: #d4af37;
background: #fff8dc;
}
.tip-header {
display: flex;
align-items: center;
gap: 8rpx;
padding: 12rpx 15rpx;
background: #e6f7ff;
font-size: 14px;
color: #000;
flex-shrink: 0;
}
.tip-top {
padding: 8px 0 0 70px;
flex-shrink: 0;
|
12e66ec8
刘淇
新增树
|
800
801
|
}
|
4f475013
刘淇
k线图
|
802
|
.task-list-container {
|
1d3624b0
刘淇
首页。养护任务
|
803
804
805
806
807
808
809
810
|
width: 100%;
height: 100%;
padding-bottom: 300rpx;
box-sizing: border-box;
}
.empty-box {
padding: 60rpx 0;
|
cf70629b
刘淇
养护计划 照片 自己写样式
|
811
|
}
|
ee792d52
刘淇
动态表单
|
812
813
814
815
816
817
818
|
.sort-trigger {
display: flex;
align-items: center;
font-size: 12px;
color: $text-color-placeholder;
}
|
12e66ec8
刘淇
新增树
|
819
|
|
cf70629b
刘淇
养护计划 照片 自己写样式
|
820
821
822
823
|
.task-item {
padding: $spacing-md;
transition: background-color 0.2s;
border-bottom: 1px solid $border-color;
|
cf70629b
刘淇
养护计划 照片 自己写样式
|
824
825
826
|
&:last-child {
border-bottom: none;
}
|
cf70629b
刘淇
养护计划 照片 自己写样式
|
827
828
829
|
&--hover {
background-color: $bg-color;
}
|
cf70629b
刘淇
养护计划 照片 自己写样式
|
830
831
832
|
&__content {
width: 100%;
}
|
1d3624b0
刘淇
首页。养护任务
|
833
834
835
836
837
838
|
.name-fixed-wrap {
display: flex;
}
.task-item__name {
width: 60px;
}
|
6cc0ab0e
刘淇
养护任务
|
839
840
841
842
843
844
845
846
847
848
|
.task-name-text {
flex: 1;
font-size: 14px;
color: $text-color;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
}
|
cf70629b
刘淇
养护计划 照片 自己写样式
|
849
|
&__name {
|
1d3624b0
刘淇
首页。养护任务
|
850
|
font-size: 15px;
|
cf70629b
刘淇
养护计划 照片 自己写样式
|
851
|
color: $text-color;
|
1d3624b0
刘淇
首页。养护任务
|
852
|
display: inline-block;
|
cf70629b
刘淇
养护计划 照片 自己写样式
|
853
|
}
|
cf70629b
刘淇
养护计划 照片 自己写样式
|
854
855
|
&__footer {
display: flex;
|
1d3624b0
刘淇
首页。养护任务
|
856
857
858
859
860
|
align-items: flex-start;
gap: 6rpx;
font-size: 13px;
color: $text-color-light;
margin-top: $spacing-sm;
|
cf70629b
刘淇
养护计划 照片 自己写样式
|
861
|
align-items: center;
|
cf70629b
刘淇
养护计划 照片 自己写样式
|
862
863
|
}
}
|
1d3624b0
刘淇
首页。养护任务
|
864
865
866
867
|
.loc-icon {
width: 20px;
height: 20px;
}
|
4f475013
刘淇
k线图
|
868
|
|
cf70629b
刘淇
养护计划 照片 自己写样式
|
869
870
|
.urgency-tag {
color: #7D7D7D;
|
12e66ec8
刘淇
新增树
|
871
872
|
}
</style>
|