From e6a02c8b09a796e436a501e9b87d19e25c34c9d1 Mon Sep 17 00:00:00 2001
From: zjj <3272660260@qq.com>
Date: 星期日, 07 四月 2024 15:53:37 +0800
Subject: [PATCH] #

---
 pages/business/plan/planDetails.vue |  340 +++++++++++++++++++++++++++++++++++++-------------------
 1 files changed, 223 insertions(+), 117 deletions(-)

diff --git a/pages/business/plan/planDetails.vue b/pages/business/plan/planDetails.vue
index ac2a205..63a50e9 100644
--- a/pages/business/plan/planDetails.vue
+++ b/pages/business/plan/planDetails.vue
@@ -10,8 +10,14 @@
 			</view>
 			<!-- 姝ラ鏉� -->
 			<view style="background-color: #FFF;margin-top: 10px;padding-top: 20px;padding-bottom: 20px;">
-				<uni-steps :options="list1" :active="active" />
+				<uni-steps :options="list1" :active="current" />
 			</view>
+			<!-- <view style="background-color: #FFF;margin-top: 10px;padding-top: 20px;padding-bottom: 20px;">
+				<u-steps :current="current">
+					<u-steps-item :title="`${item.title}`" :desc="item.username" v-for="item in list1" />
+				</u-steps>
+			</view> -->
+			
 			<!-- 鍩烘湰淇℃伅 -->
 			<view class="container">
 				<view><y-title title="鍩烘湰淇℃伅"></y-title></view><view></view>
@@ -25,8 +31,8 @@
 			</view>
 			<!-- 鍏朵粬淇℃伅 -->
 
-			<view class="container">
-				<view><y-title title="鍏朵粬淇℃伅"></y-title></view><view></view>
+			<view class="container" v-show="info.length > 0">
+				<view><y-title title="涓�у寲"></y-title></view><view></view>
 			</view>
 			<view class="detail-box">
 				<plan-detail :info="info"></plan-detail>
@@ -36,7 +42,7 @@
 			<!-- 鍞墠瑙勫垝 -->
 			<view class="container">
 				<view><y-title title="鍞墠瑙勫垝"></y-title></view><view></view>
-				<view class="list-item1">瑙勫垝鍛�</view><view class="list-item2">{{detl.uuid}}</view>
+				<view class="list-item1">瑙勫垝鍛�</view><view class="list-item2">{{detl.planner$}}</view>
 				<view class="list-item1">瀹屾垚鏃堕棿</view><view class="list-item2">{{detl.finishTime$}}</view>
 				<view class="list-item1">鏇存敼鏂规</view><view class="list-item2">{{detl.change}}</view>
 				<view class="list-item1">鏇存敼娆℃暟</view><view class="list-item2">{{detl.changeTime}}</view>
@@ -57,20 +63,44 @@
 		<view>
 			<!-- 杈撳叆妗嗙ず渚� -->
 			<uni-popup ref="inputDialog" type="dialog">
-				<uni-popup-dialog ref="inputClose" mode="input" title="娣诲姞璺熻繘浜�" value="瀵硅瘽妗嗛缃彁绀哄唴瀹�!"
+				<uni-popup-dialog ref="inputClose" mode="input" title="閫夋嫨瑙勫垝鍛�"
 					placeholder="璇疯緭鍏ュ唴瀹�" @confirm="confirm">
-						<uni-combox :candidates="addFollower.followers" placeholder="璇烽�夋嫨"
-						v-model="addFollower.follower" @input="autoLoad('follower',addFollower.follower)"></uni-combox>
+						<uni-combox :candidates="planners" placeholder="璇烽�夋嫨"
+						v-model="planner" @input="autoLoad('planner',planner)"></uni-combox>
 				</uni-popup-dialog>
 			</uni-popup>
+		</view>
+		
+		<view class="foot">
+			<button v-show="((((detl.settle == 2 || detl.settle == 3) && detl.settleSize==4) || detl.settle == 1) && user.id == detl.director)"  
+				size="mini" type="primary" @click="approval(id)">瀹℃壒</button>
+			<button v-show="(((detl.settle == 2 || detl.settle == 3)&& detl.settleSize==4) && user.id == detl.director)"
+				size="mini" type="primary" @click="approvalEnd(id)">鍥為��瀹℃壒</button>
+			<button  v-show="(detl.settle == 1 && user.id == detl.userId)"
+				size="mini" type="primary" @click="edite(id)">淇敼</button>
+			<!-- <button  size="mini" type="warn" @click="del(id)">鍒犻櫎</button> -->
 		</view>
 	</view>
 </template>
 
 <script>
+	import user from '@/pages/api/user/user.js'
 	export default {
 		data() {
 			return {
+				planner: '',
+				plannerId: '',
+				planners: [],
+				plannerList: [],
+				nowUserId: '', // 褰撳墠鐧诲綍浜哄憳 user.userId
+				director: '',  // 褰撳墠鑺傜偣瀹℃牳  dire
+				userId: '', // 褰撳墠浠诲姟涓氬姟鍛� userid
+				user: {
+					username: '',
+					id: 0,
+					type: ''
+				},
+				current: 1,
 				id: 0,
 				detl: {
 					id: '',
@@ -87,9 +117,10 @@
 				followers: [],
 				cstmrId: '',
 				active: 0,
+				steps: [],
 				list1: [{
 					title: '寮�濮�',
-					desc: ''
+					desc: '123'
 				}, {
 					title: '缁勯暱瀹℃牳',
 					desc: ''
@@ -107,13 +138,10 @@
 			}
 		},
 		onLoad(option) { 
-			if (option == '') {
+			this.current = 1
+			if (JSON.stringify(option) != "{}") {
 				this.id = option.id
 				this.init()
-				this.autoLoad('follower','')
-				setTimeout(()=>{
-					this.getFollowers()
-				},500)
 			} else {
 				let _this = this
 				const eventChannel = this.getOpenerEventChannel();
@@ -121,14 +149,23 @@
 					_this.id = data.data
 					_this.init()
 				})
-				
-				this.autoLoad('follower','')
-				setTimeout(()=>{
-					this.getFollowers()
-				},500)
 			}
 		},
+		onShow() {
+			this.getDetail()
+		},
 		methods: {
+			// 鑾峰彇鐢ㄦ埛淇℃伅
+			async getDetail() {
+				let res = await user.getDetail()
+				if (res.code === 200) {
+					this.user.username = res.data.username
+					this.user.id = res.data.id
+				} else if (res.code === 403) {
+					this.backLogin(res)
+				}
+			},
+			// 鍒濆鍖�
 			init() {
 				let that = this
 				that.info = []
@@ -137,52 +174,92 @@
 					header: {'token' : uni.getStorageSync('token')},
 					method: 'GET',
 					success(res) {
-						console.log(res);
 						res = res.data
-						that.detl = res.data
-						that.active = res.data.settle
-						if (res.data.planType == 4) {
-							that.info.push(
-							{name:'璐х墿瑙勬牸',val:res.data.input_1},
-							{name:'璐х墿閲嶉噺',val:res.data.input_2},
-							{name:'浠撳簱娓╁害',val:res.data.input_6},
-							{name:'椤堕儴鏈�浣庣偣绂诲湴璺濈',val:res.data.input_8},
-							{name:'杩涘弶鏂瑰悜',val:res.data.input_4},
-							{name:'鍘傛埧鍙敤楂樺害',val:res.data.input_5},
-							{name:'閫氶亾澶у皬鏈夋棤瑕佹眰',val:res.data.input_7},
-							{name:'骞冲簱璐ф灦绫诲瀷',val:res.data.select_2},
-							{name:'鏄惁闇�瑕佽法姊�',val:res.data.radio_1 == 'value1' ? '鏄�' : '鍚�'},
-							{name:'鏄惁闇�瑕佺綉灞傛澘',val:res.data.radio_2 == 'value1' ? '鏄�' : '鍚�'},
-							{name:'鏄惁闇�瑕佸眰鏉�',val:res.data.radio_8 == 'value1' ? '鏄�' : '鍚�'},
-							{name:'鍦伴潰鏈夋棤鐢电紗娌�',val:res.data.radio_3 == 'value1' ? '鏄�' : '鍚�'},
-							{name:'鍦伴潰骞虫暣搴﹀拰鍦伴潰娌夐檷鏄惁婊¤冻鏍囧噯',val:res.data.radio_5 == 'value1' ? '鏄�' : '鍚�'},
-							{name:'甯冨眬鍖哄煙鏄惁鎻愪緵CAD鍦哄湴鍥剧焊/鍦哄湴',val:res.data.radio_7 == 'value1' ? '鏄�' : '鍚�'},
-							{name:'鍏朵粬瑕佹眰鍙婃敞鎰忕偣',val:res.data.textarea_2 ? res.data.textarea_2 : '--'},
-							)
-						} else if(res.data.planType == 5) {
-							that.info.push(
-							{name:'璐х墿瑙勬牸',val:res.data.input_2},
-							{name:'璐х墿閲嶉噺',val:res.data.input_5},
-							{name:'鍘傛埧鍙敤楂樺害',val:res.data.input_4},
-							{name:'椤堕儴鏈�浣庣偣绂诲湴璺濈',val:res.data.input_9},
-							{name:'杩涘弶鏂瑰悜',val:res.data.input_3},
-							{name:'浠撳簱娓╁害',val:res.data.input_7},
-							{name:'鎶楅渿璁鹃槻鐑堝害',val:res.data.input_6},
-							{name:'鍩烘湰鍦伴渿鍔犻�熷害',val:res.data.input_11},
-							{name:'瀹㈡埛鎶�鏈鎺ヨ仈绯绘柟寮忥紙閫夊~锛�',val:res.data.input_8},
-							{name:'绔嬩綋搴撹揣鏋剁被鍨�',val:res.data.select_3},
-							{name:'鏄惁鏈夋秷闃茶姹�',val:res.data.radio_5 == 'value1' ? '鏄�' : '鍚�'},
-							{name:'鍚﹂渶瑕佽揣鏋惰儗缃�',val:res.data.radio_8 == 'value1' ? '鏄�' : '鍚�'},
-							{name:'鍦伴潰鏈夋棤鐢电紗娌�',val:res.data.radio_7 == 'value1' ? '鏄�' : '鍚�'},
-							{name:'甯冨眬鍖哄煙鏄惁鎻愪緵CAD鍦哄湴鍥剧焊/鍦哄湴',val:res.data.radio_6 == 'value1' ? '鏄�' : '鍚�'},
-							{name:'鍦伴潰骞虫暣搴﹀拰鍦伴潰娌夐檷鏄惁婊¤冻鏍囧噯',val:res.data.radio_10 == 'value1' ? '鏄�' : '鍚�'},
-							{name:'鍏朵粬瑕佹眰鍙婃敞鎰忕偣',val:res.data.textarea_2 ? res.data.textarea_2 : '--'},
-							)
+						if (res.code === 200) {
+							that.detl = res.data
+							that.active = res.data.settle
+							that.list1 = JSON.parse(res.data.settleMsg)
+							for (let key of that.list1) {
+								key.desc = key.username
+							}
+							that.current = res.data.settle-1
+							if (res.data.planType == 4) {
+								switch(res.data.select_2) {
+									case 'value1':
+										res.data.select_2 = '妯寮�'
+										break;
+									case 'value2':
+										res.data.select_2 = '椹跺叆寮�'
+										break;
+									case 'value3':
+										res.data.select_2 = '鎮寮�'
+										break;
+									case 'value4':
+										res.data.select_2 = '娴佸埄寮�'
+										break;
+									case 'value5':
+										res.data.select_2 = '閲嶅姏寮�'
+										break;
+									case 'value6':
+										res.data.select_2 = '鍏朵粬'
+										break;
+								}
+								that.info.push(
+								{name:'璐х墿瑙勬牸',val:res.data.input_1},
+								{name:'璐х墿閲嶉噺',val:res.data.input_2},
+								{name:'浠撳簱娓╁害',val:res.data.input_6},
+								{name:'椤堕儴鏈�浣庣偣绂诲湴璺濈',val:res.data.input_8},
+								{name:'杩涘弶鏂瑰悜',val:res.data.input_4},
+								{name:'鍘傛埧鍙敤楂樺害',val:res.data.input_5},
+								{name:'閫氶亾澶у皬鏈夋棤瑕佹眰',val:res.data.input_7},
+								{name:'骞冲簱璐ф灦绫诲瀷',val:res.data.select_2},
+								{name:'鏄惁闇�瑕佽法姊�',val:res.data.radio_1 == 'value1' ? '鏄�' : '鍚�'},
+								{name:'鏄惁闇�瑕佺綉灞傛澘',val:res.data.radio_2 == 'value1' ? '鏄�' : '鍚�'},
+								{name:'鏄惁闇�瑕佸眰鏉�',val:res.data.radio_8 == 'value1' ? '鏄�' : '鍚�'},
+								{name:'鍦伴潰鏈夋棤鐢电紗娌�',val:res.data.radio_3 == 'value1' ? '鏄�' : '鍚�'},
+								{name:'鍦伴潰骞虫暣搴﹀拰鍦伴潰娌夐檷鏄惁婊¤冻鏍囧噯',val:res.data.radio_5 == 'value1' ? '鏄�' : '鍚�'},
+								{name:'甯冨眬鍖哄煙鏄惁鎻愪緵CAD鍦哄湴鍥剧焊/鍦哄湴',val:res.data.radio_7 == 'value1' ? '鏄�' : '鍚�'},
+								{name:'鍏朵粬瑕佹眰鍙婃敞鎰忕偣',val:res.data.textarea_2 ? res.data.textarea_2 : '--'},
+								)
+							} else if(res.data.planType == 5) {
+								switch(res.data.select_3) {
+									case 'value1':
+										res.data.select_3 = '鐗涜吙寮�'
+										break;
+									case 'value2':
+										res.data.select_3 = '妯寮�'
+										break;
+									case 'value3':
+										res.data.select_3 = '鏂拌兘婧�'
+										break;
+									case 'value4':
+										res.data.select_3 = '鍏朵粬'
+										break;
+								}
+								that.info.push(
+								{name:'璐х墿瑙勬牸',val:res.data.input_2},
+								{name:'璐х墿閲嶉噺',val:res.data.input_5},
+								{name:'鍘傛埧鍙敤楂樺害',val:res.data.input_4},
+								{name:'椤堕儴鏈�浣庣偣绂诲湴璺濈',val:res.data.input_9},
+								{name:'杩涘弶鏂瑰悜',val:res.data.input_3},
+								{name:'浠撳簱娓╁害',val:res.data.input_7},
+								{name:'鎶楅渿璁鹃槻鐑堝害',val:res.data.input_6},
+								{name:'鍩烘湰鍦伴渿鍔犻�熷害',val:res.data.input_11},
+								{name:'瀹㈡埛鎶�鏈鎺ヨ仈绯绘柟寮忥紙閫夊~锛�',val:res.data.input_8},
+								{name:'绔嬩綋搴撹揣鏋剁被鍨�',val:res.data.select_3},
+								{name:'鏄惁鏈夋秷闃茶姹�',val:res.data.radio_5 == 'value1' ? '鏄�' : '鍚�'},
+								{name:'鍚﹂渶瑕佽揣鏋惰儗缃�',val:res.data.radio_8 == 'value1' ? '鏄�' : '鍚�'},
+								{name:'鍦伴潰鏈夋棤鐢电紗娌�',val:res.data.radio_7 == 'value1' ? '鏄�' : '鍚�'},
+								{name:'甯冨眬鍖哄煙鏄惁鎻愪緵CAD鍦哄湴鍥剧焊/鍦哄湴',val:res.data.radio_6 == 'value1' ? '鏄�' : '鍚�'},
+								{name:'鍦伴潰骞虫暣搴﹀拰鍦伴潰娌夐檷鏄惁婊¤冻鏍囧噯',val:res.data.radio_10 == 'value1' ? '鏄�' : '鍚�'},
+								{name:'鍏朵粬瑕佹眰鍙婃敞鎰忕偣',val:res.data.textarea_2 ? res.data.textarea_2 : '--'},
+								)
+							}
 						}
-						// that.cstmrId = that.cstmr.id
 					}
 				})
 			},
+			// 鍒犻櫎
 			del(e) {
 				let that = this
 				e = Number(e)
@@ -191,9 +268,7 @@
 					header: {'token' : uni.getStorageSync('token'),
 					},
 					method: 'GET',
-					
 					success(res) {
-						console.log(res);
 						res = res.data
 						if (res.code === 200) {
 							uni.navigateBack()
@@ -213,89 +288,120 @@
 			addPerson() {
 				this.$refs.inputDialog.open()
 			},
-			// 纭閫夋嫨宸ヤ綔浜�
-			confirm() {
-				let that = this
-				var followerId
-				var followerList = that.addFollower.followerList
-				for (var i = 0;i < followerList.length; i++) {
-					if (followerList[i].name == this.addFollower.follower) {
-						followerId =followerList[i].value
-					}
-				}
-				uni.request({
-					url: that.baseUrl + '/detl/followers/add/json',
-					header:{'token':uni.getStorageSync('token'),
-						// 'content-type':'application/x-www-form-urlencoded',
-						},
-					data: {
-						cstmrId: that.cstmrId,
-						followerIds:followerId},
-					method: 'POST',
-					success(result) {
-						var res = result.data
-						that.getFollowers()
-					}
-				})
-				this.addFollower.follower = ''
-			},
 			// 宸ヤ綔浜哄垪琛�
 			autoLoad(type,condition) {
 				let that = this
-				that.addFollower.followers = []
-				that.addFollower.followerList = []
 				uni.request({
-					url: that.baseUrl + '/user/all/get/kv',
-					header:{'token':uni.getStorageSync('token')},
-					data: {condition:condition},
+					url: that.baseUrl + '/plan/planner/list/auth',
+					header:{
+						'token':uni.getStorageSync('token'),
+						'content-type': 'application/x-www-form-urlencoded;charset=UTF-8'
+					},
+					sslVerify: false,
+					data: {planId:condition},
 					method: 'POST',
 					success(result) {
 						var res = result.data
 						if (res.code === 200) {
-							var element;
-							if (type == 'follower') {
-								for(element of res.data) {
-									that.addFollower.followers.push(element.name)
-									that.addFollower.followerList.push(element)
+							if (res.data) {
+								for (let k of res.data) {
+									that.planners.push(k.name)
+									that.plannerList.push(k)
 								}
-								return
 							}
 						}
 					}
 				})
 			},
-			getFollowers() {
-				let that = this
+			edite(id) {
+				let _this = this,url = '';
+				switch(this.detl.planType) {
+					case 4:
+						url = `/pages/business/plan/modiPlan?id=${id}`
+						break
+					case 5:
+						url = `/pages/business/plan/modiPlan2?id=${id}`
+						break
+					case 6:
+						url = `/pages/business/plan/modiPlan3?id=${id}`
+						break
+					case 7:
+						url = `/pages/business/plan/modiPlan4?id=${id}`
+						break
+					case 8:
+						url = `/pages/business/plan/modiPlan5?id=${id}`
+						break
+					case 9:
+						url = `/pages/business/plan/modiPlan6?id=${id}`
+						break
+					case 11:
+						url = `/pages/business/plan/modiPlan7?id=${id}`
+						break
+						
+				}
+				uni.navigateTo({
+					url: url
+				})
+			},
+			// 瀹℃壒
+			approval() {
+				let _this = this 
+				this.$refs.inputDialog.open()
+				this.autoLoad("type",this.detl.id)
+			},
+			// 瑙勫垝鍛樺鎵�
+			confirm() {
+				for (let element of this.plannerList) {
+					if(element.value == this.planner) {
+						this.plannerId = element.value
+					}
+				}
+				let _this = this
 				uni.request({
-					url: that.baseUrl + '/detl/followers/table/auth',
-					header:{'token':uni.getStorageSync('token')},
-					data: {cstmrId:that.cstmrId},
-					method:'GET',
+					url: `${_this.baseUrl}/plan/approval/auth`,
+					header: {
+						'token':uni.getStorageSync('token'),
+						'content-type': 'application/x-www-form-urlencoded;charset=UTF-8'
+					},
+					sslVerify: false,
+					data: {
+						planId: _this.detl.id,
+						plannerId: _this.plannerId
+					},
+					method: 'POST',
 					success(res) {
 						res = res.data
-						that.followers = res.data
+						uni.showToast({title: res.msg, icon: "none", position: 'top'})
+						uni.navigateBack()
 					}
 				})
 			},
-			removeFollowers(userId) {
-				let that = this
+			approvalEnd() {
+				let _this = this
 				uni.request({
-					url: that.baseUrl + '/cstmr/followers/remove/auth',
-					header:{
+					url: `${_this.baseUrl}/plan/approvalEnd/auth`,
+					header: {
 						'token':uni.getStorageSync('token'),
-						'content-type': 'application/x-www-form-urlencoded'
+						'content-type': 'application/x-www-form-urlencoded;charset=UTF-8'
 					},
-					data: {
-						cstmrId:that.cstmrId,
-						userId: userId
-						},
-					method:'POST',
+					sslVerify: false,
+					data: { planId: _this.detl.id },
+					method: 'POST',
 					success(res) {
 						res = res.data
-						that.getFollowers()
+						uni.showToast({title: res.msg, icon: "none", position: 'top'})
+						uni.navigateBack()
 					}
 				})
-			}
+			},
+			backLogin(res) {
+				uni.showToast({title: res.msg, icon: "none", position: 'top'})
+				setTimeout(() => {
+					uni.reLaunch({
+						url: '../../login/login'
+					});
+				}, 1000);
+			},
 		}
 	}
 </script>

--
Gitblit v1.9.1