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/home/home.vue |  293 +++++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 249 insertions(+), 44 deletions(-)

diff --git a/pages/home/home.vue b/pages/home/home.vue
index cbd0679..3fb7798 100644
--- a/pages/home/home.vue
+++ b/pages/home/home.vue
@@ -41,32 +41,31 @@
 			<template v-slot:bottom>
 				<view class="bottom-container">
 					<!-- 鎸夐挳鍖哄煙 -->
-					<view class="bottom-content__chulizhong bottom-content__item" >
+					<view class="bottom-content__chulizhong bottom-content__item">
 						<view @click="withDrawClick(item.id)" v-if="item.status == 1">
 							<image src="@/static/home/cehui.png" mode=""></image>
 							<view>鎾ゅ洖</view>
 						</view>
-						<view @click="checkTheScheduleClick" v-if="item.status == 1">
+						<view @click="checkTheScheduleClick(item.procInstId)" v-if="item.status == 1">
 							<image src="@/static/home/jindu.png" mode=""></image>
 							<view>鏌ョ湅杩涘害</view>
 						</view>
-						<view @click="theFormDataClick" v-if="item.status == 1 || item.status == 2 ">
+						<view @click="theFormDataClick(item.tableId)" v-if="item.status == 1 || item.status == 2">
 							<image src="@/static/home/biaodan.png" mode=""></image>
 							<view>琛ㄥ崟鏁版嵁</view>
 						</view>
-						<view v-if="item.status == 3">
-							<image src="@/static/home/history.png" mode="" ></image>
+						<view @click="apply(item)" v-if="item.status == 3">
+							<image src="@/static/home/history.png" mode=""></image>
 							<view>閲嶆柊鐢宠</view>
 						</view>
-						<view v-if="item.status == 3">
-							<image src="@/static/home/history.png" mode="" ></image>
+						<view @click="editMyApplication(item)" v-if="item.status == 3">
+							<image src="@/static/home/history.png" mode=""></image>
 							<view>缂栬緫</view>
 						</view>
-						<view @click="approvalHistoryClick" v-if="item.status == 2 || item.status == 3">
+						<view @click="approvalHistoryClick(item.procInstId)" v-if="item.status == 2 || item.status == 3">
 							<image src="@/static/home/history.png" mode=""></image>
 							<view>瀹℃壒鍘嗗彶</view>
 						</view>
-						
 					</view>
 					<!-- 宸茬粨鏉熷皬缁勬寜閽� -->
 					<!-- <view class="bottom-content__chulizhong bottom-content__item" v-if="item.status == 2">
@@ -111,19 +110,19 @@
 				<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>
-						<view @click="rejectModalShow = true">
+						<view @click="rejectClick(item)">
 							<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>
@@ -168,7 +167,7 @@
 									item.duration >= 86400000
 										? parseInt(item.duration / 86400000 + '澶�' + parseInt(item.duration % 86400000) / 3600000 + '鏃�' + parseInt(item.duration % 3600000) / 60000 + '鍒�')
 										: item.duration >= 3600000
-										? parseInt(item.duration / 3600000) + '鏃�' + parseInt(item.duration / 3600000 % 3600000)  + '鍒�'
+										? parseInt(item.duration / 3600000) + '鏃�' + parseInt((item.duration / 3600000) % 3600000) + '鍒�'
 										: parseInt(item.duration / 60000) + '鍒�'
 								}}
 							</text>
@@ -183,11 +182,11 @@
 				<view class="bottom-container">
 					<!-- 宸插姙鎸夐挳 -->
 					<view class="bottom-content__item">
-						<view @click="theFormDataClick">
+						<view @click="theFormDataClick(item.tableId)">
 							<image src="@/static/home/biaodan.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>
@@ -203,14 +202,20 @@
 		<!-- 鎾ゅ洖妯℃�佹 -->
 		<view class="wodeshenqingMotai">
 			<u-modal width="684rpx" :show="withDrawShow" title="鎾ゅ洖鍘熷洜" :showCancelButton="true" @confirm="withDrawConfirm" @cancel="withDrawCancel">
-				<view class="slot-content"><u--textarea v-model="withDrawContent" placeholder="璇疯緭鍏ユ挙鍥炲師鍥�"></u--textarea></view>
+				<view class="slot-content"><u--textarea v-model="withDrawData.reason" placeholder="璇疯緭鍏ユ挙鍥炲師鍥�"></u--textarea></view>
 			</u-modal>
 		</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>
 
@@ -218,8 +223,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">
@@ -227,7 +236,7 @@
 							</view>
 							<view class="uni-select__icon"><image src="@/static/icon/select.png" mode="鍔犺浇澶辫触"></image></view>
 						</view>
-					</view>
+					</view> -->
 				</view>
 			</u-modal>
 		</view>
@@ -245,7 +254,7 @@
 		</view>
 
 		<!-- 閫夋嫨鍣� -->
-		<u-picker @cancel="statusSeletShow = false" @confirm="statusConfirm" :show="statusSeletShow" :columns="statusList"></u-picker>
+		<!-- <u-picker @cancel="statusSeletShow = false" @confirm="statusConfirm" :show="statusSeletShow" :columns="statusList"></u-picker> -->
 
 		<!-- 鑿滃崟鏍� -->
 		<popup-menu @menuShow="menushow" ref="menuRef"></popup-menu>
@@ -257,30 +266,58 @@
 import popupMenu from '@/components/common/popup-menu/popup-menu.vue';
 import combinedTitle from '@/components/common/combined-title/combined-title.vue';
 import combinationCard from '@/components/common/combination-card/combination-card.vue';
-import {setAccessToken} from '@/utils/status.js'
+import { setAccessToken } from '@/utils/status.js';
 export default {
 	name: 'home',
 	data() {
 		return {
 			// menuShow:false,// 鑿滃崟鏄剧ず
 			status: ['鑽夌', '澶勭悊涓�', '宸茬粨鏉�', '宸叉挙鍥�'],
-			statusColor: ['#DDDDDD', '#FF9900', '#007AFF', '#06BE00'],
+			statusColor: ['#dd8b8c', '#FF9900', '#007AFF', '#06BE00'],
 			result: ['鏈彁浜�', '澶勭悊涓�', '閫氳繃', '椹冲洖'],
-			resultColor: ['#DDDDDD', '#FF9900', '#06BE00', '#be2b2d'],
+			resultColor: ['#dd8b8c', '#FF9900', '#06BE00', '#be2b2d'],
 			list3: ['https://cdn.uviewui.com/uview/swiper/swiper3.png', 'https://cdn.uviewui.com/uview/swiper/swiper2.png', 'https://cdn.uviewui.com/uview/swiper/swiper1.png'],
 			// 鎾ゅ洖妯℃�佹
 			withDrawShow: false,
+			withDrawData: {
+				reason: '',
+				id: '', // 鎾ゅ洖鐢宠ID
+				procInstId: ''
+			},
 			withDrawContent: '',
-			withDrawId: 0, // 鎾ゅ洖鐢宠ID
+			// 閲嶆柊鐢宠
+			form: {
+				sendMessage: true,
+				sendSms: true,
+				sendEmail: true,
+				procDefId: '',
+				assignees: [],
+				priority: '0'
+			},
+			assigneeList: [],
+			showAssign: false,
+			isGateway: false,
+			isCustom: false,
 			// 閫氳繃妯℃�佹
 			adoptModalShow: false,
-			adoptModalContent: '',
+			// 閫氳繃璇锋眰
+			adoptForm: {
+				ids: '',
+				comment: ''
+			},
 			// 椹冲洖妯℃�佹
 			rejectModalShow: false,
 			rejectModalContent: '',
-			dataSeletText: '璇烽�夋嫨鐘舵��',
+			// dataSeletText: '璇烽�夋嫨鐘舵��',
+			// 椹冲洖璇锋眰
+			rejectForm: {
+				procInstIds: '',
+				comment: ''
+			},
+			modalType: 0,
 			// 鍒犻櫎鐢宠妯℃�佹
 			deleteApplicationModalShow: false,
+			procInstId:'',
 			// 閫夋嫨鍣�
 			statusSeletShow: false,
 			statusList: [['涓浗', '缇庡浗', '鏃ユ湰']],
@@ -331,13 +368,13 @@
 	methods: {
 		getUserInfo() {
 			this.$reqGet('getUserInfo').then(res => {
-				if(res.code == 0) {
-					uni.setStorageSync('userInfo',res.data.sysUser)
+				if (res.code == 0) {
+					uni.setStorageSync('userInfo', res.data.sysUser);
 				}
-			})
+			});
 		},
 		init() {
-			this.getUserInfo()
+			this.getUserInfo();
 			this.getProcessDataList(); // 鐢宠鍒楄〃
 			this.todoList(); // 鎴戠殑寰呭姙
 			this.doneList(); // 鎴戠殑宸插姙
@@ -359,7 +396,11 @@
 			});
 		},
 		doneList() {
+			uni.showLoading({
+				title:'鍔犺浇涓�...'
+			})
 			this.$reqGet('doneList', this.haveTodoParams).then(res => {
+				uni.hideLoading();
 				if (res.code === 0) {
 					// console.log('宸插姙', res);
 					this.yibanData = res.data.content;
@@ -372,12 +413,25 @@
 		// 鎾ゅ洖妯℃�佹
 		withDrawClick(id) {
 			this.withDrawShow = true;
-			this.withDrawId = id;
+			this.withDrawData.id = id;
 		},
 		withDrawConfirm() {
-			console.log(this.withDrawId);
-			if (this.withDrawContent.length >= 2) {
-				console.log(this.withDrawContent);
+			this.shenqingData.forEach(i => {
+				if (i.id == this.withDrawData.id) {
+					this.withDrawData.procInstId = i.procInstId;
+				}
+			});
+			if (this.withDrawData.reason.length >= 2) {
+				this.$reqPost('withDraw', this.withDrawData, 'form').then(res => {
+					this.withDrawShow = false;
+					if (res.code == 0) {
+						uni.showToast({
+							title: res.data,
+							duration: 2000
+						});
+					}
+					this.getProcessDataList();
+				});
 			} else {
 				uni.showToast({
 					title: '璇疯鑼冭緭鍏�',
@@ -385,16 +439,51 @@
 				});
 			}
 		},
+		// 閫氳繃
+		adopClick(v) {
+			console.log('閫氳繃鐐瑰嚮', v);
+			this.adoptModalShow = true;
+			this.adoptForm.ids = v.id;
+			this.modalType = 0;
+			// let urlparam = v.procDefId+'/'+v.key;
+			// this.$reqGet('getNextNode',{},urlparam).then(res=>{
+			// 	console.log('閫氳繃娆茶姹�');
+			// })
+		},
 		// 閫氳繃妯℃�佹
 		adoptModalConfirm() {
 			this.adoptModalShow = false;
+			this.adoptForm.comment = this.adoptModalContent;
+
+			this.$reqPost('passAll', this.adoptForm, 'form').then(res => {
+				if (res.code == 0) {
+					this.$u.toast('鎿嶄綔鎴愬姛!');
+				} else {
+					this.$u.toast('娣诲姞澶辫触!!');
+				}
+			});
 		},
 		adoptModalCancel() {
 			this.adoptModalShow = false;
 		},
+		// 椹冲洖
+		rejectClick(v) {
+			this.modalType = 1;
+			this.rejectModalShow = true;
+			this.rejectForm.procInstIds = v.procInstId;
+		},
 		// 椹冲洖妯℃�佹
 		rejectModalConfirm() {
 			this.rejectModalShow = false;
+
+			this.$reqPost('backAll', this.rejectForm, 'form').then(res => {
+				if (res.code == 0) {
+					this.$u.toast('鎿嶄綔鎴愬姛锛�');
+				} else {
+					this.$u.toast('鎿嶄綔澶辫触锛侊紒锛�');
+				}
+				this.todoList(); // 鎴戠殑寰呭姙
+			});
 		},
 		rejectModalCancel() {
 			this.rejectModalShow = false;
@@ -405,31 +494,126 @@
 		// 鍒犻櫎鐢宠妯℃�佹
 		deleteApplicationModalConfirm() {
 			this.deleteApplicationModalShow = false;
+			this.$reqPost('deleteHistoric',{ids:this.procInstId},'form').then(res=>{
+				if(res.code == 0){
+					this.$u.toast('鎿嶄綔鎴愬姛锛�')
+					this.yibanData = [];
+					this.doneList(); // 鎴戠殑宸插姙
+				} else {
+					this.$u.toast('鎿嶄綔澶辫触锛侊紒锛�')
+				}
+			})
+			
 		},
 		deleteApplicationModalCancel() {
 			this.deleteApplicationModalShow = false;
 		},
 		// 鏌ョ湅杩涘害
-		checkTheScheduleClick() {
+		checkTheScheduleClick(v) {
 			uni.navigateTo({
-				url: '/pages/check-the-schedule/check-the-schedule'
+				url: `/pages/check-the-schedule/check-the-schedule?index=${v}`
 			});
 		},
 		// 琛ㄥ崟鏁版嵁
-		theFormDataClick() {
+		theFormDataClick(v) {
 			uni.navigateTo({
-				url: '/pages/the-form-data/the-form-data'
+				url: `/pages/the-form-data/the-form-data?index=${v}`
+			});
+		},
+		// 閲嶆柊鐢宠
+		apply(v){
+			if (!v.procDefId || v.procDefId == 'null') {
+				this.$u.toast('娴佺▼瀹氫箟涓虹┖');
+				return;
+			}
+			this.form.id = v.id;
+			this.form.procDefId = v.procDefId;
+			this.form.title = v.title;
+			// 鍔犺浇瀹℃壒浜�
+			// this.userLoading = true;
+			uni.showLoading({
+				title: '瀹℃壒浜哄姞杞戒腑'
+			});
+			// getFirstNode(v.procDefId).then((res) => {
+			this.$reqGet('getFirstNode', {}, v.procDefId).then(res => {
+				// this.userLoading = false;
+				console.log('瀹℃壒浜�', res);
+				uni.hideLoading();
+				if (res.data) {
+					this.error = '';
+					if (res.data.type == 3 || res.data.type == 4) {
+						this.isGateway = true;
+						this.form.firstGateway = true;
+						this.showAssign = false;
+						this.isCustom = false;
+						return;
+					}
+					if (res.data.type == 5) {
+						this.isCustom = true;
+						this.isGateway = false;
+						this.form.firstGateway = false;
+						this.showAssign = false;
+						return;
+					}
+					if (res.data.type == 1) {
+						this.showAssign = true;
+						this.isGateway = false;
+						this.form.firstGateway = false;
+						this.isCustom = false;
+						if (res.data.users && res.data.users.length > 0) {
+							this.assigneeList = res.data.users;
+							// 榛樿鍕鹃��
+							let ids = [];
+							res.data.users.forEach(e => {
+								ids.push(e.userId);
+							});
+							this.form.assignees = ids;
+							this.showAssign = true;
+							// 鑾峰彇琛ㄥ崟鍐呭锛岄噸鏂板垱寤虹敵璇�
+							this.$reqPost('apply',this.form,'form').then(res=>{
+								console.log('閲嶆柊鎻愪氦鐢宠',res);
+								if(res.code == 0){
+									uni.showToast({
+										title:res.data,
+										icon:'success',
+										duration:2000	
+									});
+								}
+								// 鍒濆鍖栫敵璇峰垪琛�
+								// this.myApplication.pageNumber = 1;
+								// this.shenqingData = [];
+								// this.getMoreNews();
+								this.getProcessDataList();
+							})
+						} else {
+							this.form.assignees = [];
+							this.showAssign = true;
+							this.error = '璇疯繘鍏�"娴佺▼绠$悊"涓哄鎵硅妭鐐瑰垎閰嶅�欓�夊鎵逛汉鍛�';
+						}
+					}
+				}
+				console.log(this.form);
+			});
+			
+			this.modalVisible = true;
+		},
+		// 淇敼
+		editMyApplication(v){
+			console.log('淇敼鐢宠');
+			uni.navigateTo({
+				url: `/pages/edit-my-application/edit-my-application?index=${v.tableId}`
 			});
 		},
 		// 瀹℃壒鍘嗗彶
-		approvalHistoryClick() {
+		approvalHistoryClick(v) {
 			uni.navigateTo({
-				url: '/pages/approval-history/approval-history'
+				url: `/pages/approval-history/approval-history?index=${v}`
 			});
 		},
 		// 鍒犻櫎鐢宠
 		deleteApplicationClick(id) {
 			this.deleteApplicationModalShow = true;
+			this.procInstId = id;
 			console.log(id);
 		}
 	}
@@ -440,7 +624,6 @@
 ::v-deep.home {
 	height: 100%;
 	width: 100%;
-	padding-bottom: vww(24);
 	.home_swipe {
 		width: 100%;
 		height: vww(160);
@@ -537,7 +720,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 {
@@ -551,7 +745,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