From e170fd5e5b5b7fbc9a19d7aff4cf0908adeffe10 Mon Sep 17 00:00:00 2001
From: 付延余 <f-yanyu@outlook.com>
Date: 星期一, 19 十二月 2022 14:09:12 +0800
Subject: [PATCH] ‘第一次提交’

---
 pages/home/home.vue |  271 ++++++++++++++++++++++++++++++------------------------
 1 files changed, 151 insertions(+), 120 deletions(-)

diff --git a/pages/home/home.vue b/pages/home/home.vue
index e3b171d..77b20e8 100644
--- a/pages/home/home.vue
+++ b/pages/home/home.vue
@@ -50,7 +50,7 @@
 					<view class="bottom-container">
 						<!-- 鎸夐挳鍖哄煙 -->
 						<view class="bottom-content__chulizhong bottom-content__item">
-							<view @click="withDrawClick(item.id)" v-if="item.status == 1">
+							<view @click="withDrawClick(item.procInstId)" v-if="item.status == 1">
 								<image src="@/static/home/cehui.png" mode=""></image>
 								<view>鎾ゅ洖</view>
 							</view>
@@ -58,21 +58,25 @@
 								<image src="@/static/home/jindu.png" mode=""></image>
 								<view>鏌ョ湅杩涘害</view>
 							</view>
-							<view @click="theFormDataClick(item.tableId)" v-if="(item.status == 1 || item.status == 2) && item.procDefId == 'WAY_BILL:4:87504'">
+							<view @click="theFormDataClick(item.tableId)" v-if="(item.status == 1 || item.status == 2 || item.status == 3) && item.processName == '鍙戣繍閫氱煡鍗�'">
 								<image src="@/static/home/biaodan.png" mode=""></image>
-								<view>琛ㄥ崟鏁版嵁</view>
+								<view>鐢宠璇︽儏</view>
 							</view>
-							<view @click="apply(item)" v-if="item.status == 3">
+							<!-- <view @click="apply(item)" v-if="item.status == 3">
 								<image src="@/static/home/history.png" mode=""></image>
 								<view>閲嶆柊鐢宠</view>
-							</view>
-							<view @click="editMyApplication(item)" v-if="item.status == 3 && item.procDefId == 'WAY_BILL:4:87504'">
+							</view> -->
+							<view @click="editMyApplication(item)" v-if="item.status == 1 && item.processName == '鍙戣繍閫氱煡鍗�'">
 								<image src="@/static/home/history.png" mode=""></image>
 								<view>缂栬緫</view>
 							</view>
 							<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 @click="deleteWithDrawApplication(item.tableId)" v-if="item.status == 3">
+								<image src="@/static/home/delete.png" mode=""></image>
+								<view>鍒犻櫎</view>
 							</view>
 						</view>
 						<!-- 宸茬粨鏉熷皬缁勬寜閽� -->
@@ -120,10 +124,10 @@
 					<view class="bottom-container">
 						<!-- 寰呭姙鎸夐挳 -->
 						<view class="bottom-content__item">
-							<!-- <view @click="theFormDataClick">
+							<view @click="theFormDataClick(item.tableId)">
                 <image src="@/static/home/jindu.png" mode=""></image>
                 <view>鐢宠璇︽儏</view>
-              </view> -->
+              </view>
 							<view @click="adopClick(item)">
 								<image src="@/static/home/tongguo.png" mode=""></image>
 								<view>閫氳繃</view>
@@ -163,7 +167,7 @@
 						</view>
 						<view class="center-content__two center-margin">
 							<view>
-								<text>鍙戣捣浜猴細{{ item.actBusiness.createByName }}</text>
+								<text>鍙戣捣浜猴細{{ item.actBusiness.createByName || '' }}</text>
 							</view>
 							<view>
 								<text>瀹℃壒鎿嶄綔锛歿{ item.deleteReason }}</text>
@@ -171,7 +175,7 @@
 						</view>
 						<view class="center-content__three center-margin">
 							<view class="">
-								<text>瀹℃壒鎰忚锛歿{ item.comment || '' }}</text>
+								<text>瀹℃壒鎰忚锛歿{ item.comment=='undefined'?'鏈~鍐�':item.comment || '鏈~鍐�' }}</text>
 							</view>
 							<view class="">
 								<text>
@@ -194,7 +198,7 @@
 					<view class="bottom-container">
 						<!-- 宸插姙鎸夐挳 -->
 						<view class="bottom-content__item">
-							<view @click="theFormDataClick(item.tableId)" v-if="item.procDefId == 'WAY_BILL:4:87504'">
+							<view @click="theFormDataClick(item.tableId)" v-if="item.processName == '鍙戣繍閫氱煡鍗�'">
 								<image src="@/static/home/biaodan.png" mode=""></image>
 								<view>琛ㄥ崟鏁版嵁</view>
 							</view>
@@ -245,8 +249,11 @@
 
 		<!-- 鎾ゅ洖妯℃�佹 -->
 		<view class="wodeshenqingMotai">
-			<u-modal width="684rpx" :show="withDrawShow" title="鎾ゅ洖鍘熷洜" :showCancelButton="true" @confirm="withDrawConfirm" @cancel="withDrawCancel">
-				<view class="slot-content"><u--textarea v-model="withDrawData.reason" placeholder="璇疯緭鍏ユ挙鍥炲師鍥�"></u--textarea></view>
+			<u-modal width="684rpx" :show="withDrawShow" title="鎻愮ず" :showCancelButton="true" @confirm="withDrawConfirm" @cancel="withDrawCancel">
+				<view class="slot-content">
+					<!-- <u--textarea v-model="withDrawData.reason" placeholder="璇疯緭鍏ユ挙鍥炲師鍥�"></u--textarea> -->
+					<text>纭鎾ゅ洖璇ョ敵璇峰悧锛�</text>
+				</view>
 			</u-modal>
 		</view>
 
@@ -309,10 +316,10 @@
 					<view class="top"><u-icon name="backspace" color="#FF4233" size="70"></u-icon></view>
 					<view class="bottom-text"><text>閫�鍑�</text></view>
 				</view>
-				<view class="utils-container-body" @click="huanBang">
+				<!-- <view class="utils-container-body" @click="huanBang">
 					<view class="top"><u-icon name="lock-open" color="#1987FF" size="70"></u-icon></view>
 					<view class="bottom-text"><text>鎹㈢粦</text></view>
-				</view>
+				</view> -->
 			</view>
 		</view>
 		<u-gap height="60" bgColor="#eeeeee"></u-gap>
@@ -368,8 +375,8 @@
 			withDrawShow: false,
 			fyData: [],
 			withDrawData: {
-				reason: '',
-				id: '', // 鎾ゅ洖鐢宠ID
+				// reason: '',
+				// id: '', // 鎾ゅ洖鐢宠ID
 				procInstId: ''
 			},
 			withDrawContent: '',
@@ -594,18 +601,12 @@
 			this.menuShow = e;
 		},
 		// 鎾ゅ洖妯℃�佹
-		withDrawClick(id) {
+		withDrawClick(procInstId) {
 			this.withDrawShow = true;
-			this.withDrawData.id = id;
+			this.withDrawData.procInstId = procInstId;
 		},
 		withDrawConfirm() {
-			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.$reqPost('cancel', this.withDrawData).then(res => {
 					this.withDrawShow = false;
 					if (res.code == 0) {
 						uni.showToast({
@@ -613,14 +614,14 @@
 							duration: 2000
 						});
 					}
+					// 鍒锋柊鍒楄〃
 					this.getProcessDataList();
+					this.todoList();
+					this.doneList();
 				});
-			} else {
-				uni.showToast({
-					title: '璇疯鑼冭緭鍏�',
-					duration: 2000
-				});
-			}
+		},
+		withDrawCancel() {
+			this.withDrawShow = false;
 		},
 		// 閫氳繃
 		adopClick(v) {
@@ -637,13 +638,14 @@
 		adoptModalConfirm() {
 			this.adoptModalShow = false;
 			this.adoptForm.comment = this.adoptModalContent;
-
-			this.$reqPost('passAll', this.adoptForm, 'form').then(res => {
+			this.$reqPost('passAll', this.adoptForm).then(res => {
 				if (res.code == 0) {
 					this.$u.toast('鎿嶄綔鎴愬姛!');
 				} else {
-					this.$u.toast('娣诲姞澶辫触!!');
+					this.$u.toast('閫氳繃澶辫触!!');
 				}
+				this.todoList(); // 鎴戠殑寰呭姙
+				this.doneList(); 
 			});
 		},
 		adoptModalCancel() {
@@ -659,20 +661,24 @@
 		rejectModalConfirm() {
 			this.rejectModalShow = false;
 
-			this.$reqPost('backAll', this.rejectForm, 'form').then(res => {
+			this.$reqPost('backAll', this.rejectForm).then(res => {
 				if (res.code == 0) {
 					this.$u.toast('鎿嶄綔鎴愬姛锛�');
 				} else {
 					this.$u.toast('鎿嶄綔澶辫触锛侊紒锛�');
 				}
 				this.todoList(); // 鎴戠殑寰呭姙
+				this.doneList(); 
 			});
 		},
 		rejectModalCancel() {
 			this.rejectModalShow = false;
 		},
-		withDrawCancel() {
-			this.withDrawShow = false;
+		// 鍒犻櫎鐢宠
+		deleteApplicationClick(id) {
+			this.deleteApplicationModalShow = true;
+			this.procInstId = id;
+			console.log(id);
 		},
 		// 鍒犻櫎鐢宠妯℃�佹
 		deleteApplicationModalConfirm() {
@@ -702,83 +708,112 @@
 				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;
+		// 鍒犻櫎鎾ゅ洖鐢宠
+		deleteWithDrawApplication(id){
+			uni
+				.request({
+					url: `${BaseUrl}/yunxiao/xswaybill/${id}`,
+					method: 'DELETE',
+					header: {
+						'TENANT-ID': 5,
+						Authorization: 'Bearer ' + uni.getStorageSync('access_token'),
+						VERSION: 'zzl'
 					}
-					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;
+				})
+				.then(res => {
+					uni.showToast({
+						title:'鍒犻櫎鎴愬姛',
+						icon:'none'
+					})
+					
+					// 鍒锋柊鍒楄〃
+					this.getProcessDataList();
+					
+				})
+				.catch(err => {
+					uni.showToast({
+						title:'鍒犻櫎鍑洪敊',
+						icon:'none'
+					})
+				});
 		},
+		// 閲嶆柊鐢宠
+		// 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('淇敼鐢宠');
@@ -792,12 +827,7 @@
 				url: `/pages/approval-history/approval-history?index=${v}`
 			});
 		},
-		// 鍒犻櫎鐢宠
-		deleteApplicationClick(id) {
-			this.deleteApplicationModalShow = true;
-			this.procInstId = id;
-			console.log(id);
-		},
+		
 		redirectLogin() {
 			redirectLogin();
 		},
@@ -820,7 +850,8 @@
 	.utils {
 		.utils-container {
 			display: flex;
-			justify-content: space-between;
+			// justify-content: space-between;
+			justify-content: center;
 			width: 66%;
 			margin: 0 auto;
 			.utils-container-body {

--
Gitblit v1.9.1