From 7c3218e12105b87cab21e9ced57c99c339ffac10 Mon Sep 17 00:00:00 2001
From: 付延余 <f-yanyu@outlook.com>
Date: 星期二, 26 七月 2022 08:51:58 +0800
Subject: [PATCH] tatolpage

---
 pages/my-todo/my-todo.vue |  447 +++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 319 insertions(+), 128 deletions(-)

diff --git a/pages/my-todo/my-todo.vue b/pages/my-todo/my-todo.vue
index 43945ee..eb4bd8d 100644
--- a/pages/my-todo/my-todo.vue
+++ b/pages/my-todo/my-todo.vue
@@ -2,30 +2,40 @@
 	<!-- 鎴戠殑寰呭姙 -->
 	<view class="my-todo">
 		<!-- 鎼滅储鍖哄煙 -->
-		<view class="searchBox">
-			<view class="search">
-				<u-search @clickIcon="searchIconClick" :clearabled="false" :showAction="false" placeholder="璇疯緭鍏ユ爣棰�" v-model="searchData" shape="square"></u-search>
-			</view>
-			<!-- 鐘舵�侀�夋嫨鍣� -->
-			<view class="data-selet" @click="statusSeletShow = true">
-				<view class="content">
-					<text>{{ dataSeletText }}</text>
+		<view class="searchContainer">
+			<view class="searchBox">
+				<view class="search">
+					<u-search @clickIcon="searchIconClick" :clearabled="true" :showAction="false" placeholder="璇疯緭鍏ユ爣棰�" v-model="todoParams.title" shape="square"></u-search>
 				</view>
-				<view class="uni-select__icon"><image src="@/static/icon/select.png" mode="鍔犺浇澶辫触"></image></view>
+				<!-- 鐘舵�侀�夋嫨鍣� -->
+				<!-- <view class="data-selet" @click="statusSeletShow = true">
+					<view class="content">
+						<text>{{ dataSeletText }}</text>
+					</view>
+					<view class="uni-select__icon"><image src="@/static/icon/select.png" mode="鍔犺浇澶辫触"></image></view>
+				</view> -->
+				<view class="search">
+					<u-search @clickIcon="searchIconClick" :clearabled="true" :showAction="false" placeholder="璇疯緭鍏ヤ换鍔″悕绉�" v-model="todoParams.name" shape="square"></u-search>
+				</view>
 			</view>
-		</view>
-
-		<!-- 鏃堕棿鎼滅储鍖哄煙 -->
-		<view class="timeContiner">
-			<uni-datetime-picker class="time-picker" type="date" :clear-icon="false" v-model="createTime" @change="startDateChange" placeholder="寮�濮嬫椂闂�" />
-			<uni-datetime-picker class="time-picker" type="date" :clear-icon="false" v-model="endTime" @change="endDateChange" placeholder="缁撴潫鏃堕棿" />
+			
+			<!-- 鏃堕棿鎼滅储鍖哄煙 -->
+			<view class="timeContiner">
+				<uni-datetime-picker class="time-picker" type="date" :clear-icon="true" v-model="todoParams.startDate" @change="startDateChange" placeholder="寮�濮嬫椂闂�" />
+				<uni-datetime-picker class="time-picker" type="date" :clear-icon="true" v-model="todoParams.endDate" @change="endDateChange" placeholder="缁撴潫鏃堕棿" />
+			</view>
+			
+			<view class="searchButton">
+				<u-button type="primary" text="鎼滅储" @click="searchButtonClick"></u-button>
+				<u-button type="primary" text="娓呯┖" :plain="true" @click="emptyButtonClick"></u-button>
+			</view>
 		</view>
 
 		<!-- 鎴戠殑寰呭姙鍗$墖鍖哄煙 -->
 		<u-checkbox-group v-model="checkBoxValue" placement="column" @change="checkboxChange" style="margin-bottom:50px">
 			<combination-card v-for="(item, index) in daibanData" index="index">
 				<template v-slot:top>
-					<u-checkbox size="35" :key="item.id" :name="item.id"></u-checkbox>
+					<u-checkbox size="35" :key="item.id" :name="item.id+item.procInstId"></u-checkbox>
 					<view>
 						<text>{{ item.actBusiness.title }}</text>
 					</view>
@@ -53,11 +63,11 @@
 					<view class="bottom-container">
 						<!-- 寰呭姙鎸夐挳 -->
 						<view class="bottom-content__item">
-							<view @click="theFormDataClick">
+							<!-- <view @click="theFormDataClick">
 								<image src="@/static/home/jindu.png" mode=""></image>
 								<view>鐢宠璇︽儏</view>
-							</view>
-							<view @click="adoptModalShow = true">
+							</view> -->
+							<view @click="adopClick(item)">
 								<image src="@/static/home/tongguo.png" mode=""></image>
 								<view>閫氳繃</view>
 							</view>
@@ -65,7 +75,7 @@
 								<image src="@/static/home/bohui.png" mode=""></image>
 								<view>椹冲洖</view>
 							</view>
-							<view @click="approvalHistoryClick">
+							<view @click="approvalHistoryClick(item.procInstId)">
 								<image src="@/static/home/history.png" mode=""></image>
 								<view>鍘嗗彶</view>
 							</view>
@@ -83,15 +93,18 @@
 				</u-checkbox-group>
 			</view>
 			<view class="bottomTabbar_button">
-				<u-button :plain="true" type="primary" text="鎵归噺椹冲洖" @click="rejectModalShow = true"></u-button>
-				<u-button type="primary" text="鎵归噺閫氳繃" @click="adoptModalShow = true"></u-button>
+				<u-button :plain="true" type="primary" text="鎵归噺椹冲洖" @click="batchRejectClick"></u-button>
+				<u-button type="primary" text="鎵归噺閫氳繃" @click="batchAdoptClick"></u-button>
 			</view>
 		</view>
 
 		<!-- 閫氳繃妯℃�佹 -->
 		<view class="adoptModal">
 			<u-modal width="684rpx" :show="adoptModalShow" title="瀹℃壒閫氳繃" :showCancelButton="true" @confirm="adoptModalConfirm" @cancel="adoptModalCancel">
-				<view class="slot-content"><u--textarea v-model="adoptModalContent" placeholder="璇疯緭鍏ュ鎵规剰瑙�"></u--textarea></view>
+				<view class="slot-content"><view class="rejectMesaage">
+						<u-icon name="info-circle-fill" color="#0307ff"></u-icon>
+						<text>{{ modalType == 0 ? '娉ㄦ剰锛氬皢榛樿鍒嗛厤缁欒妭鐐硅瀹氱殑鎵�鏈夊彲瀹℃壒鐢ㄦ埛' : '娉ㄦ剰锛氭墍鏈夋祦绋嬪皢椹冲洖鑷冲彂璧蜂汉' }}</text>
+					</view><u--textarea v-model="adoptForm.comment" placeholder="璇疯緭鍏ュ鎵规剰瑙�"></u--textarea></view>
 			</u-modal>
 		</view>
 
@@ -99,8 +112,12 @@
 		<view class="rejectModal">
 			<u-modal width="684rpx" :show="rejectModalShow" title="椹冲洖" :showCancelButton="true" @confirm="rejectModalConfirm" @cancel="rejectModalCancel">
 				<view class="slot-content">
-					<u--textarea v-model="rejectModalContent" placeholder="璇疯緭鍏ュ鎵规剰瑙�"></u--textarea>
-					<view class="rejectBack">
+					<view class="rejectMesaage">
+						<u-icon name="info-circle-fill" color="#0307ff"></u-icon>
+						<text>{{ modalType == 0 ? '娉ㄦ剰锛氬皢榛樿鍒嗛厤缁欒妭鐐硅瀹氱殑鎵�鏈夊彲瀹℃壒鐢ㄦ埛' : '娉ㄦ剰锛氭墍鏈夋祦绋嬪皢椹冲洖鑷冲彂璧蜂汉' }}</text>
+					</view>
+					<u--textarea v-model="rejectForm.comment" placeholder="璇疯緭鍏ュ鎵规剰瑙�"></u--textarea>
+					<!-- <view class="rejectBack">
 						<view class="rejectBack-title"><text>椹冲洖鑷�</text></view>
 						<view class="data-selet" @click="statusSeletShow = true">
 							<view class="content">
@@ -108,7 +125,7 @@
 							</view>
 							<view class="uni-select__icon"><image src="@/static/icon/select.png" mode="鍔犺浇澶辫触"></image></view>
 						</view>
-					</view>
+					</view> -->
 				</view>
 			</u-modal>
 		</view>
@@ -138,9 +155,6 @@
 			</u-modal>
 		</view> -->
 		
-		<!-- 閫夋嫨鍣� -->
-		<u-picker @cancel="statusSeletShow = false" @confirm="statusConfirm" :show="statusSeletShow" :columns="statusList"></u-picker>
-		
 		<!-- 鑿滃崟鏍� -->
 		<popup-menu @menuShow="menushow" ref="menuRef"></popup-menu>
 	</view>
@@ -152,38 +166,57 @@
 export default {
 	data() {
 		return {
-			// 鏉′欢鎼滅储
-			searchData: '',
-			dataSeletText: '璇烽�夋嫨鐘舵��',
-			// 鏃堕棿閫夋嫨
-			createTime: '',
-			endTime: '',
-			// 閫夋嫨鍣�
-			statusSeletShow: false,
-			statusList: [['涓浗', '缇庡浗', '鏃ユ湰']],
 			// 澶嶉�夋
 			checkBoxValue:[],
 			totalSelectValue:[],
 			// 閫氳繃妯℃�佹
 			adoptModalShow: false,
 			adoptModalContent: '',
+			adoptDataBox:[],
+			// 閫氳繃璇锋眰
+			adoptForm: {
+				ids: '',
+				comment: ''
+			},
 			// 椹冲洖妯℃�佹
 			rejectModalShow: false,
 			rejectModalContent: '',
 			menuShow:false,
+			rejectDataBox:[],
+			// 椹冲洖璇锋眰
+			rejectForm: {
+				procInstIds: '',
+				comment: ''
+			},
+			modalType:0,
 			// data
 			daibanData: [],
 			// 寰呭姙
 			todoParams: {
+				name: '',
 				pageNumber: 1,
-				pageSize: 10
+				pageSize: 10,
+				title: '',
+				startDate: '',
+				endDate: '',
 			},
+			// 涓婃媺鍔犺浇鏇村
+			timer: {},
+			load: 0,
+			loadingText: '鍔犺浇涓�...',
+			loadingType: 0,
+			contentText: {
+				contentDown: '涓婃媺鏄剧ず鏇村',
+				contentRefresh: '姝e湪鍔犺浇...',
+				contentNomore: '娌℃湁鏇村鏁版嵁浜�'
+			}
 		};
 	},
 	onShow(){
 		if(this.menuShow == true){
 			this.$refs.menuRef.menuClick()
 		}
+		this.myApplication.pageNumber = 1;
 		this.init();
 	},
 	// 鐐瑰嚮瀵艰埅鏍忚彍鍗曞悗
@@ -195,40 +228,108 @@
 		combinationCard,
 		popupMenu
 	},
+	// 涓婃媺鍔犺浇鏇村
+	onReachBottom() {
+		if (this.timer != null) {
+			clearTimeout(this.timer);
+		}
+		this.timer = setTimeout(() => {
+			this.getMoreNews();
+		}, 1000);
+	},
+	// 涓嬫媺鍔犺浇
+	onPullDownRefresh() {
+		console.log('refresh');
+		this.todoParams.pageNumber = 1;
+		this.loadingType = 0;
+		this.daibanData = [];
+		setTimeout(()=> {
+			uni.stopPullDownRefresh();
+		}, 1000);
+		this.init();
+	},
 	methods: {
 		init(){
-			this.todoList();
+			// this.todoList();
+			this.getMoreNews();
 		},
 		// 寰呭姙鍒楄〃
-		todoList(){
+		// todoList(){
+		// 	this.$reqGet('todoList', this.todoParams).then(res => {
+		// 		if (res.code === 0) {
+		// 			this.daibanData = res.data.content;
+		// 		}
+		// 	});
+		// },
+		getMoreNews() {
+			if (this.loadingType !== 0) {
+				//loadingType!=0;鐩存帴杩斿洖
+				return false;
+			}
+			this.loadingType = 1;
+			uni.showNavigationBarLoading(); //鏄剧ず鍔犺浇鍔ㄧ敾
 			this.$reqGet('todoList', this.todoParams).then(res => {
-				if (res.code === 0) {
-					this.daibanData = res.data.content;
-				}
-			});
+					// if (res.code === 0) {
+					// 	this.daibanData = res.data.content;
+					// }
+					this.todoParams.pageNumber++; // 寰楀埌鏁版嵁涔嬪悗 page+1
+					if (res.data.content.length < 1) {
+						// 娌℃湁鏁版嵁
+						this.loadingType = 2;
+						uni.hideNavigationBarLoading(); // 鍏抽棴鍔犺浇鍔ㄧ敾
+						uni.showToast({
+							title: '娌℃湁鏇村鏁版嵁浜嗭紒',
+							icon: 'error'
+						});
+						return;
+					}
+					
+					if(this.todoParams.name||this.todoParams.startTime||this.todoParams.endTime||this.todoParams.title){
+						this.daibanData = res.data.content
+					} else{
+						this.daibanData = this.daibanData.concat(res.data.content);
+					}
+					 //灏嗘暟鎹嫾鎺ュ湪涓�璧�
+					this.loadingType = 0; // 灏唋oadingType褰�0閲嶇疆
+					uni.hideNavigationBarLoading(); // 鍏抽棴鍔犺浇鍔ㄧ敾
+				});
+		},
+		// 鎼滅储鐐瑰嚮
+		searchButtonClick(){
+			this.todoParams.pageNumber = 1;
+			this.init();
+		},
+		// 娓呯┖
+		emptyButtonClick(){
+			this.todoParams.name = '';
+			this.todoParams.title = '';
+			this.todoParams.startDate = '';
+			this.todoParams.endDate = '';
+			this.init();
 		},
 		menushow(e){
 			this.menuShow = e;
 		},
 		// 鏃堕棿閫夋嫨鍣�
 		startDateChange() {
-			this.queryRealTimeShippingData.startDate = '';
-			this.$nextTick(() => {
-				console.log(this.queryRealTimeShippingData);
-				this.realTimeShipping();
-			});
+			// this.queryRealTimeShippingData.startDate = '';
+			// this.$nextTick(() => {
+			// 	console.log(this.queryRealTimeShippingData);
+			// 	this.realTimeShipping();
+			// });
 		},
 		endDateChange() {
-			this.queryRealTimeShippingData.endDate = '';
-			this.$nextTick(() => {
-				console.log(this.queryRealTimeShippingData);
-				this.realTimeShipping();
-			});
+			// this.queryRealTimeShippingData.endDate = '';
+			// this.$nextTick(() => {
+			// 	console.log(this.queryRealTimeShippingData);
+			// 	this.realTimeShipping();
+			// });
 		},
 		// 鎼滅储
 		searchIconClick() {
 			console.log(1111, this.searchData);
 		},
+		
 		// 鐘舵��
 		statusConfirm(a) {
 			this.statusSeletShow = false;
@@ -241,7 +342,7 @@
 		totalSelectChange(n){
 			if(n[0] == 'tatalSelect'){
 				this.daibanData.forEach(item=>{
-					this.totalSelectValue.push(item.id)
+					this.totalSelectValue.push(item.id+item.procInstId)
 				})
 				this.checkBoxValue = this.totalSelectValue
 			} else {
@@ -256,14 +357,40 @@
 			});
 		},
 		// 瀹℃壒鍘嗗彶
-		approvalHistoryClick() {
+		approvalHistoryClick(v) {
 			uni.navigateTo({
-				url: '/pages/approval-history/approval-history'
+				url: `/pages/approval-history/approval-history?index=${v}`
 			});
+		},
+		// 閫氳繃
+		adopClick(v){
+			this.adoptModalShow = true;
+			this.adoptForm.ids = v.id;
+			this.modalType = 0;
+		},
+		batchAdoptClick(){
+			if(this.checkBoxValue.length != 0){
+				this.adoptModalShow = true;
+			} else {
+				this.$u.toast('鏈�夋嫨鐢宠锛�')
+			}
 		},
 		// 閫氳繃妯℃�佹
 		adoptModalConfirm() {
 			this.adoptModalShow = false;
+			this.checkBoxValue.forEach(item=>{
+				this.adoptDataBox.push(item.slice(0,6))
+			})
+			this.adoptForm.ids = this.adoptDataBox.toString();
+			this.$reqPost('passAll', this.adoptForm, 'form').then(res => {
+				console.log('鏄惁杩樺師',this.adoptForm.ids,this.rejectForm.procInstIds);
+				if (res.code == 0) {
+					this.$u.toast('鎿嶄綔鎴愬姛!');
+				} else {
+					this.$u.toast('娣诲姞澶辫触!!');
+				}
+				this.init();
+			});
 		},
 		adoptModalCancel() {
 			this.adoptModalShow = false;
@@ -271,9 +398,36 @@
 		// 椹冲洖妯℃�佹
 		rejectModalConfirm() {
 			this.rejectModalShow = false;
+			this.checkBoxValue.forEach(item=>{
+				this.rejectDataBox.push(item.slice(6,12))
+			})
+			this.rejectForm.procInstIds = this.rejectDataBox.toString();
+			this.$reqPost('backAll', this.rejectForm, 'form').then(res => {
+				if (res.code == 0) {
+					this.$u.toast('鎿嶄綔鎴愬姛锛�');
+				} else {
+					this.$u.toast('鎿嶄綔澶辫触锛侊紒锛�');
+				}
+				this.init();
+			});
 		},
 		rejectModalCancel() {
 			this.rejectModalShow = false;
+		},
+		rejectClick(v) {
+			this.modalType = 1;
+			this.rejectModalShow = true;
+			this.rejectForm.procInstIds = v.procInstId;
+		},
+		batchRejectClick(){
+			if(this.checkBoxValue.length != 0){
+				this.rejectModalShow = true;
+				
+				console.log(this.rejectDataBox);
+			} else{
+				this.$u.toast('鏈�変腑鐢宠锛�')
+			}
+			
 		}
 	}
 };
@@ -282,87 +436,102 @@
 <style lang="scss" scoped>
 ::v-deep.my-todo {
 	// 鎼滅储鍖哄煙
-	.searchBox {
-		width: 91%;
-		display: flex;
-		justify-content: space-between;
-		margin: vww(16) auto;
-		.search {
-			width: vww(160);
-			border: 1px solid #d1d1d1;
-			border-radius: vww(4);
-			.u-search {
-				.u-search__content {
-					height: 38px;
-					background-color: #ffffff !important;
-					.u-search__content__icon {
-						width: 10px;
-						height: 5.5px;
-					}
-					.u-search__content__input {
-						background-color: #ffffff !important;
-						.uni-input-placeholder{
-							color:#CCCCCC!important;
-						}
-					}
-				}
+	.searchContainer{
+		.searchButton{
+			width:91%;
+			margin: vww(16) auto;
+			display:flex;
+			.u-button{
+				width:30%;
 			}
 		}
-		// 涓嬫媺鑿滃崟
-		.data-selet {
-			border: 1px solid #d1d1d1;
-			border-radius: 4px;
-			width: vww(160);
-			// width: 100%;
-			height: 40px;
+		// 鏉′欢鎼滅储
+		.searchBox {
+			width: 91%;
 			display: flex;
-			align-items: center;
-			font-size: 13px;
-			color: #CCCCCC;
-			.uni-select__icon {
-				display: flex;
-				align-content: center;
-				margin: 0 10px;
-				image {
-					width: 10px;
-					height: 5.5px;
-				}
-			}
-			.content {
-				margin-left: vww(8);
-				width: vww(150);
-			}
-		}
-	}
-
-	// 鏃堕棿鎼滅储
-	.timeContiner {
-		width: 91%;
-		margin: 0 auto vww(16);
-		display: flex;
-		flex-direction: row;
-		justify-content: space-between;
-		.uni-date {
-			width: vww(160);
-			.uni-date-editor {
-				.uni-date-editor--x  {
-					.uni-date-x {
-						.uni-date__x-input {
-							.uni-input-wrapper{
-								.uni-input-placeholder{
-									color:#CCCCCC;
-									font-size: vww(13);
-								}
+			justify-content: space-between;
+			margin: vww(16) auto;
+			.search {
+				width: vww(160);
+				border: 1px solid #d1d1d1;
+				border-radius: vww(4);
+				.u-search {
+					.u-search__content {
+						height: 38px;
+						background-color: #ffffff !important;
+						.u-search__content__icon {
+							width: 10px;
+							height: 5.5px;
+						}
+						.u-search__content__input {
+							background-color: #ffffff !important;
+							.uni-input-placeholder{
+								color:#CCCCCC!important;
 							}
 						}
 					}
 				}
-				.uni-date-x--border{
-					border: 1px solid #d1d1d1!important;
+			}
+			// 涓嬫媺鑿滃崟
+			.data-selet {
+				border: 1px solid #d1d1d1;
+				border-radius: 4px;
+				width: vww(160);
+				// width: 100%;
+				height: 40px;
+				display: flex;
+				align-items: center;
+				font-size: 13px;
+				color: #CCCCCC;
+				.uni-select__icon {
+					display: flex;
+					align-content: center;
+					margin: 0 10px;
+					image {
+						width: 10px;
+						height: 5.5px;
+					}
+				}
+				.content {
+					margin-left: vww(8);
+					width: vww(150);
 				}
 			}
 		}
+		// 鏃堕棿鎼滅储
+		.timeContiner {
+			width: 91%;
+			margin: 0 auto vww(16);
+			display: flex;
+			flex-direction: row;
+			justify-content: space-between;
+			.uni-date {
+				width: vww(160);
+				.uni-date-editor {
+					.uni-date-editor--x  {
+						.uni-date-x {
+							.uni-date__x-input {
+								.uni-input-wrapper{
+									.uni-input-placeholder{
+										color:#CCCCCC;
+										font-size: vww(13);
+									}
+								}
+							}
+						}
+					}
+					.uni-date-x--border{
+						border: 1px solid #d1d1d1!important;
+					}
+				}
+			}
+		}
+		
 	}
+	
+
+	
+	
 
 	// 鍗$墖涓棿
 	.center-container {
@@ -453,7 +622,18 @@
 		// width:100%;
 		// height:vww(244);
 		.slot-content {
+			.rejectMesaage {
+				display: flex;
+				padding: vww(3);
+				border: 1px solid #0307ff;
+				border-radius: vww(4);
+				font-size: 13px;
+				text {
+					margin-left: vww(5);
+				}
+			}
 			.u-textarea {
+				margin-top:vww(10);
 				width: vww(280);
 				height: vww(90) !important;
 				.uni-textarea-wrapper {
@@ -467,7 +647,18 @@
 	.rejectModal {
 		.slot-content {
 			display: inline-block;
+			.rejectMesaage {
+				display: flex;
+				padding: vww(3);
+				border: 1px solid #0307ff;
+				border-radius: vww(4);
+				font-size: 13px;
+				text {
+					margin-left: vww(5);
+				}
+			}
 			.u-textarea {
+				margin-top:vww(10);
 				width: vww(280);
 				height: vww(90) !important;
 				.uni-textarea-wrapper {

--
Gitblit v1.9.1