Bladeren bron

下拉刷新

wangxin 1 jaar geleden
bovenliggende
commit
824606b6e6
3 gewijzigde bestanden met toevoegingen van 83 en 27 verwijderingen
  1. 10 8
      pages.json
  2. 63 10
      pages/batchReporting/index.vue
  3. 10 9
      pages/index/index.vue

+ 10 - 8
pages.json

@@ -30,7 +30,8 @@
 		{
 			"path": "pages/batchReporting/index",
 			"style": {
-				"navigationBarTitleText": "批次报工"
+				"navigationBarTitleText": "批次报工",
+				"enablePullDownRefresh": true
 			}
 		},
 		{
@@ -43,6 +44,7 @@
 			"path": "pages/reportingForWork/index",
 			"style": {
 				"navigationBarTitleText": "报工记录"
+
 			}
 		},
 		{
@@ -147,16 +149,16 @@
 		"navigationBarTitleText": "uni-app",
 		"navigationBarBackgroundColor": "rgba(255, 255, 255, 1)",
 		"backgroundColor": "#F8F8F8"
+
 	},
 	"uniIdRouter": {},
 	"condition": { //模式配置,仅开发期间生效
 		"current": 0, //当前激活的模式(list 的索引项)
-		"list": [
-			{
-				"name": "", //模式名称
-				"path": "pages/index/index",
-				"query": "" //启动参数,在页面的onLoad函数里面得到
-			}
-		]
+		"list": [{
+			"name": "", //模式名称
+			"path": "pages/index/index",
+			"query": "" //启动参数,在页面的onLoad函数里面得到
+		}]
 	}
+
 }

+ 63 - 10
pages/batchReporting/index.vue

@@ -20,6 +20,7 @@
 			<switch class="switch" @change="switchChange" color="rgba(255,85,85,1)" />
 			<text>否</text> -->
 		</view>
+
 		<view class="scroll-container" style="padding-bottom:  150rpx">
 			<view v-if="listData.length == 0" style="color: #999;margin: 50% auto;">
 				<text>暂无批次</text>
@@ -77,7 +78,8 @@
 				</view>
 				<view class="item-info uni-row">
 					<text class="label">下道工序</text>
-					<view class="label right uni-row">{{ item.nextProcess ? item['nextProcess'].processAlias : '-' }}
+					<view class="label right uni-row">
+						{{ item.nextProcess ? item['nextProcess'].processAlias : '-' }}
 						(<view style="color:  #1684fc;" @click.stop="handleClickProcessList(item)">&nbsp;工艺列表&nbsp;
 						</view>)
 					</view>
@@ -140,6 +142,7 @@
 	import {
 		normalizeProps,
 		reactive,
+		onMounted,
 		ref
 	} from 'vue'
 	import {
@@ -166,7 +169,9 @@
 	import {
 		toHHmmss
 	} from '@/utils/common.js'
-
+	import {
+		onPullDownRefresh
+	} from "@dcloudio/uni-app"
 
 	const turnoverApplicationDialog = ref(null)
 	const selectProduction = ref(null)
@@ -175,6 +180,7 @@
 	const curPlan = ref(null)
 	const bizDayworkObj = ref({})
 	const bottomStatus = ref(false) // 底部按钮显示
+	const paging = ref();
 	const reqParam = ref(null);
 	const normalStatus = ref(true)
 	const curDayworkItem = ref({}) // 当前报工记录,回显是否显示取消周转的状态	
@@ -185,6 +191,8 @@
 	const curProcessAfte = ref([])
 	const showRight = ref(null) // 抽屉
 
+
+
 	onLoad(() => {
 		curPlan.value = store.planDetails;
 		normalStatus.value = true;
@@ -206,12 +214,59 @@
 			}
 		})
 		console.log(wasteRecyclingList.value.length)
+
+	})
+
+	// 页面下拉刷新操作
+	onPullDownRefresh(() => {
+		let reqData = {
+			productionPlanDetailId: store.planDetails.id,
+			deptId: store.curDeptDetails.deptId,
+			keywords: keywords.value
+		};
+		// console.log(normalStatus.value)
+
+		getDayWorkList(reqData).then(res => {
+			if (res.code == 200) {
+				tempList.value = res.data
+				if (normalStatus.value) {
+					listData.value = res.data.filter(item => {
+						return item.isWasteRecycling == 0 && item.isAmend == 0;
+					});
+				} else {
+					listData.value = res.data.filter(item => {
+						return item.isWasteRecycling == 1 || item.isAmend == 1;
+					})
+				}
+				for (let i = 0; i < listData.value.length; i++) {
+					if (listData.value[i].prevProcess) {
+						let sum = 0;
+						for (let j = 0; j < listData.value[i].dayworkItemList.length; j++) {
+							if (listData.value[i].dayworkItemList[j].processId == listData.value[i]
+								.prevProcess
+								.id && (listData.value[i].dayworkItemList[j].status == 2 || listData.value[
+										i]
+									.dayworkItemList[j].status == 3)) {
+								sum += listData.value[i].dayworkItemList[j].qualifiedNum;
+							}
+						}
+						listData.value[i].processQualifiedNum = sum;
+					}
+				}
+				uni.stopPullDownRefresh();
+			}
+		})
 	})
 
+
 	onShow(() => {
 		reflush();
+
+
 	})
 
+	;
+
 	function reflush() {
 		init(store.planDetails.id);
 	}
@@ -239,12 +294,7 @@
 				}
 			})
 		}
-		// .catch(err => {
-		// 	uri.showToast({
-		// 		icon: "fail",
-		// 		title: "网络请求失败。"
-		// 	})
-		// })
+
 	}
 
 	function handleStartNewBatch() {
@@ -282,8 +332,10 @@
 					if (listData.value[i].prevProcess) {
 						let sum = 0;
 						for (let j = 0; j < listData.value[i].dayworkItemList.length; j++) {
-							if (listData.value[i].dayworkItemList[j].processId == listData.value[i].prevProcess
-								.id && (listData.value[i].dayworkItemList[j].status == 2 || listData.value[i]
+							if (listData.value[i].dayworkItemList[j].processId == listData.value[i]
+								.prevProcess
+								.id && (listData.value[i].dayworkItemList[j].status == 2 || listData
+									.value[i]
 									.dayworkItemList[j].status == 3)) {
 								sum += listData.value[i].dayworkItemList[j].qualifiedNum;
 							}
@@ -292,6 +344,7 @@
 					}
 				}
 			}
+
 			uni.hideLoading();
 		})
 	}

+ 10 - 9
pages/index/index.vue

@@ -2,14 +2,16 @@
 	<view class="page-container uni-column">
 		<view class="uni-row" style="align-items: center;margin:8rpx 0 16rpx 0">
 			<image class="logo" src="../../static/images/logo.png" @click="handleShowGear" />
-			<uni-icons v-if="showGear > 4" class="icon-gear" type="gear-filled" size="60" @click="toggle('top')"></uni-icons>
+			<uni-icons v-if="showGear > 4" class="icon-gear" type="gear-filled" size="60"
+				@click="toggle('top')"></uni-icons>
 		</view>
 		<view class="title uni-row" v-if="loggedUsers.length > 0">
 			<text>点击头像切换用户</text>
 		</view>
 		<!-- 输入框示例 -->
 		<uni-popup ref="inputDialog" type="dialog" style="z-index: 2;">
-			<uni-popup-dialog ref="inputClose" mode="input" title="手动设置" placeholder="请输入管理员密码" @confirm="dialogInputConfirm"></uni-popup-dialog>
+			<uni-popup-dialog ref="inputClose" mode="input" title="手动设置" placeholder="请输入管理员密码"
+				@confirm="dialogInputConfirm"></uni-popup-dialog>
 		</uni-popup>
 		<!-- 弹出层 -->
 		<uni-popup ref="popup" background-color="#fff" style="z-index: 1;">
@@ -124,7 +126,7 @@
 	function doCheckUpdata() {
 		checkUpdate().then(res => {
 			updateFlag.value = res;
-			if (!res) {		
+			if (!res) {
 				uni.showModal({
 					title: '更新',
 					content: '发现新版本',
@@ -228,18 +230,18 @@
 			inputDialog.value.open(type);
 		}
 	}
-	
-	function dialogInputConfirm(val){
-		if(val == 'admin888'){
+
+	function dialogInputConfirm(val) {
+		if (val == 'admin888') {
 			showWrite.value = true;
-		}else {
+		} else {
 			uni.showToast({
 				icon: 'none',
 				title: '密码错误'
 			})
 		}
 	}
-	
+
 	function toggle(type) {
 		showGear.value += 1;
 		if (showGear.value > 5) {
@@ -301,7 +303,6 @@
 			loginDialog.value.open(_user)
 		}
 	}
-
 	const handleSelectUser = (user) => {
 		handleShowLoginDialog(user)
 	}