feat: 周计划查看支持下拉刷新

This commit is contained in:
wangzhuo
2025-09-17 21:44:01 +08:00
parent 933714be60
commit 3a1339fc76
2 changed files with 37 additions and 33 deletions

View File

@@ -331,7 +331,8 @@
"path": "pages/business/CRM/plan/planView", "path": "pages/business/CRM/plan/planView",
//周计划查看 //周计划查看
"style": { "style": {
"navigationBarTitleText": "" "navigationBarTitleText": "",
"enablePullDownRefresh": true
} }
}, },
{ {

View File

@@ -58,6 +58,7 @@
<view class="demo-uni-col mar-left"> <view class="demo-uni-col mar-left">
<text>{{ WeekShortCN[i] }}</text> <text>{{ WeekShortCN[i] }}</text>
<text v-if="list[0][field]">{{ list[0][field].substring(8) }}</text> <text v-if="list[0][field]">{{ list[0][field].substring(8) }}</text>
<text v-else>{{ getWeek(i) }}</text>
</view> </view>
</uni-col> </uni-col>
</block> </block>
@@ -103,9 +104,10 @@ import MescrollUni from 'mescroll-uni/mescroll-uni.vue';
import {getNavBarPaddingTop} from '@/utils/system.js' import {getNavBarPaddingTop} from '@/utils/system.js'
import {getAllWeekPlanList} from "@/api/crm/plan/getPlan"; import {getAllWeekPlanList} from "@/api/crm/plan/getPlan";
import {AreaList, COLOR_MAP, OrdinalDate, WeekShortCN, WorkEvent, WorkType} from "./dataMap"; import {AreaList, COLOR_MAP, OrdinalDate, WeekShortCN, WorkEvent, WorkType} from "./dataMap";
import {getCurrentWeekNum} from "./dateTimeUtils"; import {getCurrentWeekNum, getWeek2} from "./dateTimeUtils";
import {getDate} from "@/utils/datetime"; import {getDate} from "@/utils/datetime";
import {getWeekPlanListByDate} from "@/api/crm/plan/getPlan"; import {getWeekPlanListByDate} from "@/api/crm/plan/getPlan";
import {onPullDownRefresh} from "@dcloudio/uni-app";
// const currentYear = new Date().getFullYear(); // const currentYear = new Date().getFullYear();
const currentMonth = new Date().getMonth() + 1; const currentMonth = new Date().getMonth() + 1;
@@ -118,8 +120,11 @@ onMounted(() => {
uni.showLoading({}) uni.showLoading({})
getPlanList().then(res => { getPlanList().then(res => {
let {total, rows} = res; let {total, rows} = res;
console.log(rows, "周计划数据获取成功") console.log(total, rows, "周计划数据获取成功")
list.value = rows; list.value = rows;
}).catch((err) => {
console.warn(err, "周计划数据获取失败")
}).finally(() => {
uni.hideLoading(); uni.hideLoading();
}) })
}) })
@@ -140,22 +145,21 @@ let searchValue = ref({
// 查询列表 // 查询列表
let list = ref([]); let list = ref([]);
const mescrollRef = ref(null); const mescrollRef = ref(null);
const upOption = ref({ onPullDownRefresh(() => {
page: {num: 0, size: 10}, getPlanList().then(res => {
noMoreSize: 5, const {rows} = res;
empty: {tip: '~ 空空如也 ~'}, list.value = rows;
textLoading: '加载中...', console.log(rows,'刷新周计划成功');
textNoMore: '已经到底了' }).finally(()=>{
uni.stopPullDownRefresh();
})
}); });
const downOption = ref({ // 查询当前周一周日期
auto: true, const aweek = getWeek2('本周');
textInOffset: '下拉刷新', const getWeek = (i) => {
textOutOffset: '释放更新', return aweek[OrdinalDate[i]].substring(7)
textLoading: '刷新中...' }
});
let cssFlag = ref(false);//控制样式
// 获取数据列表 // 获取数据列表
const getPlanList = (month, date, pageIndex, pageSize) => { const getPlanList = (month, date, pageIndex, pageSize) => {
@@ -197,10 +201,7 @@ let handleSearch = () => {
uni.hideLoading(); uni.hideLoading();
}) })
} }
const mescrollInit = (mescroll) => {
cssFlag.value = true;
mescrollRef.value = mescroll;
};
// 搜索区域变更 // 搜索区域变更
const bindPickerChange = (e) => { const bindPickerChange = (e) => {
// console.log('picker发送选择改变携带值为', peopleIndex.value) // console.log('picker发送选择改变携带值为', peopleIndex.value)
@@ -231,8 +232,7 @@ let handleDetail = (rowIndex, colIndex) => {
} }
} }
}) })
} } else {
else{
uni.showToast({ uni.showToast({
title: "暂无内容", title: "暂无内容",
icon: "none", icon: "none",
@@ -366,10 +366,12 @@ let handleDetail = (rowIndex, colIndex) => {
margin: 20rpx 0 0 0; margin: 20rpx 0 0 0;
border-radius: 8px 8px 0 0; border-radius: 8px 8px 0 0;
/* #ifdef APP-PLUS */ /* #ifdef APP-PLUS */
min-height: calc(100vh - 160rpx/*.topbar height*/ - 68rpx/*.search height*/ - 40rpx/*.white-bg padding-top*/ - 40rpx/*.white-bg padding-bottom*/); min-height: calc(100vh - 160rpx/*.topbar height*/ - 68rpx/*.search height*/ - 40rpx/*.white-bg padding-top*/ - 40rpx /*.white-bg padding-bottom*/
);
/* #endif */ /* #endif */
/* #ifndef APP-PLUS */ /* #ifndef APP-PLUS */
min-height: calc(100vh - 116rpx/*.topbar height*/ - 68rpx/*.search height*/ - 40rpx/*.white-bg padding-top*/ - 40rpx/*.white-bg padding-bottom*/); min-height: calc(100vh - 116rpx/*.topbar height*/ - 68rpx/*.search height*/ - 40rpx/*.white-bg padding-top*/ - 40rpx /*.white-bg padding-bottom*/
);
/* #endif */ /* #endif */
//overflow-y: auto; //overflow-y: auto;
} }
@@ -394,6 +396,7 @@ let handleDetail = (rowIndex, colIndex) => {
:deep(.form-con .uni-forms-item) { :deep(.form-con .uni-forms-item) {
margin-bottom: 22px !important; margin-bottom: 22px !important;
} }
/*.con-bg { /*.con-bg {
height: 420rpx; height: 420rpx;
}*/ }*/