Procházet zdrojové kódy

计划列表页面

“yst před 4 roky
rodič
revize
997521d097

+ 10 - 1
pages.json

@@ -107,7 +107,16 @@
 				"enablePullDownRefresh": false
 			}
 		}
-	],
+	    ,{
+            "path" : "pages/planList/planList",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "计划列表",
+                "enablePullDownRefresh": false
+            }
+            
+        }
+    ],
 	"globalStyle": {
 		"navigationStyle": "custom",
 		"navigationBarTextStyle": "black",

+ 1 - 1
pages/home/home.vue

@@ -107,7 +107,7 @@
 						key: 'logout',
 					}
 				}).then((data)=>{
-					if(data!==null){
+					if(data){
 						uni.navigateTo({
 							url: '/pages/login/login'
 						});

+ 3 - 1
pages/model.js

@@ -9,6 +9,7 @@ import situationDetail from './situationDetail/model.js';
 import creatingSituations from "./creatingSituations/model.js";
 import calendar from './calendar/model.js';
 import todayCheck from './todayCheck/model.js';
+import planList from './planList/model.js';
 
 export default module = {
   login,
@@ -22,5 +23,6 @@ export default module = {
   todayCheck,
   situationsCenter,
   situationDetail,
-  creatingSituations
+  creatingSituations,
+	planList,
 }

+ 14 - 0
pages/planList/model.js

@@ -0,0 +1,14 @@
+import { commServer } from './server.js';
+
+export default {
+  namespaced: true,
+  state: {
+  },
+  mutations: {},
+  actions: {
+		commActions({ commit, state }, { payload }) {
+			// payload = {key,data} // data是请求数据,key是请求接口id
+      return commServer(payload);
+		},
+  }
+}

+ 193 - 0
pages/planList/planList.vue

@@ -0,0 +1,193 @@
+<template>
+	<view class="planList-page">
+		<scroll-view class="list-box" scroll-y="true" :style="{'height':listHeight+'rpx'}">
+			<view class="item-box" v-for="(item,index) in planList" @click="gotoCheckList">
+				<view class="row1">
+					<text class="title">{{item.name}}</text>
+					<view class="compeleted-box" v-if="item.isCompeleted">
+						<text class="compeleted-text" >已完成</text>
+					</view>
+					<view class="continued-box" v-if="item.isContinued">
+						<text class="continued-text" >进行中</text>
+					</view>
+				</view>
+				<view class="row2">
+					<text class="TobeDistributed">剩余1个单位待分配</text>
+					<text class="startEndTime">起止时间:2020-12-26 ~ 2020-12-18</text>
+				</view>
+			</view>
+		</scroll-view>
+		<view class="btn-distribution" @click="gotoCheckList" v-if="isShowDistribution">
+			<text class="btn-text">批量分配</text>
+		</view>
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				situationID:'',//情境id
+				planList:[],//计划列表
+				firstFlag:1,//是否为第一次分配的标志,为1时表示是第一次,弹框提示
+				isShowDistribution:true,//是否显示批量分配按钮
+				listHeight:1125,//列表高度
+			}
+		},
+		onLoad({ situationId }){ // situationId:情景id
+		  this.situationID=situationId;
+		},
+		created: function() {
+			this.$store.dispatch({
+				type: 'planList/commActions',
+				payload: {
+					key: 'planList',
+					data:{
+						situationId:this.situationID
+					}
+				}
+			}).then((data) => {
+				if (data) {
+					this.planList=data.map((item,index)=>{	
+						if(item.empList.length!=item.toDistribute){
+							this.firstFlag=0;
+						}
+						if(!this.compareTime(item.startDate)){
+							this.isShowDistribution=false;
+							this.listHeight=1200;
+						}
+						return {
+							id:item.id,
+							name:item.name,
+							startDate:item.startDate,
+							endDate:item.endDate,
+							status:item.status,
+							isCompeleted:item.status==3?true:false,
+							isContinued:item.status==2?true:false,
+							toDistribute:item.toDistribute,
+						}
+					});
+					if(this.firstFlag==1){
+						uni.showModal({
+							title:'提示',
+							content:'您的分配工作量较大,建议使用批量分配功能',
+						  showCancel:false
+						})
+					}
+				}
+			});
+		},
+		methods: {
+			compareTime(time){
+				let myDate=new Date();
+				let startDate=time.replace(/-/g,"/");
+				startDate=Date.parse(startDate);
+				if(myDate>startDate){
+					return false;
+				}else{
+					return true;
+				}
+			},
+			gotoCheckList(){
+				//跳转到查核列表
+				uni.navigateTo({
+					url: `/pages/creatingSituations/creatingSituations?situationId=${this.situationID}`
+				});
+			}
+		}
+	}
+</script>
+
+<style lang="less">
+	.planList-page{
+		height: 100%;
+		.list-box{
+			// height: 1125rpx;
+			.item-box{
+				width: 100%;
+				height: 125rpx;
+				background: #FFFFFF;
+				border: 0.62rpx solid #DADEE6;
+				.row1{
+					margin-top: 30rpx;
+					margin-left: 25rpx;
+					margin-right: 25rpx;
+					.title{
+						font-size: 25rpx;
+						font-family: SourceHanSansCN-Bold, SourceHanSansCN;
+						font-weight: bold;
+						color: #292C33;
+						float: left;
+					}
+					.compeleted-box{
+						width: 75rpx;
+						height: 31.25rpx;
+						border-radius: 8px;
+						background: rgba(41, 204, 150, 0.1);
+						text-align: center;
+						float: right;
+						.compeleted-text{
+							font-size: 17.5rpx;
+							font-family: SourceHanSansCN-Medium, SourceHanSansCN;
+							font-weight: 500;
+							color: #29CC96;
+							line-height: 31.25rpx;
+						}
+					}
+					.continued-box{
+						width: 75rpx;
+						height: 31.25rpx;
+						border-radius: 8px;
+						background: rgba(255, 204, 102, 0.1);
+						text-align: center;
+						float: right;
+						.continued-text{
+							width: 75rpx;
+							height: 31.25rpx;
+							font-size: 17.5rpx;
+							font-family: SourceHanSansCN-Medium, SourceHanSansCN;
+							font-weight: 500;
+							color: #FFAA00;
+							line-height: 31.25rpx;
+						}
+					}
+				}
+				.row2{
+					margin-left: 25rpx;
+					margin-top: 75rpx;
+					margin-right: 25rpx;
+					.TobeDistributed{
+						font-size: 20rpx;
+						font-family: SourceHanSansCN-Normal, SourceHanSansCN;
+						font-weight: 400;
+						color: #666E80;
+						float: left;
+					}
+					.startEndTime{
+						font-size: 20rpx;
+						font-family: SourceHanSansCN-Normal, SourceHanSansCN;
+						font-weight: 400;
+						color: #666E80;
+						float: right;
+					}
+				}
+			}
+		}
+		.btn-distribution {
+			width: 750rpx;
+			height: 75rpx;
+			background: #3377FF;
+			position: fixed;
+			bottom: 0rpx;
+		
+			.btn-text {
+				font-size: 22.5rpx;
+				font-family: SourceHanSansCN-Normal, SourceHanSansCN;
+				font-weight: 400;
+				color: #FFFFFF;
+				line-height: 75rpx;
+				margin-left: 352.5rpx;
+			}
+		}
+	}
+</style>

+ 19 - 0
pages/planList/server.js

@@ -0,0 +1,19 @@
+import { creatRequest } from '../../utils/request.js';
+
+const requestList = {
+	//计划列表
+	planList:{
+		method:'GET',
+		url: 'plan/list'
+	},
+	//分配单位查核人员
+	batchDistribute:{
+		method:'POST',
+		url: 'plan/batchDistribute'
+	},
+
+};
+export const commServer = ({ key, data }) => {
+  let obj = requestList[key];
+  return creatRequest(obj, data);
+}

+ 5 - 3
pages/role-switching/role-switching.vue

@@ -66,9 +66,11 @@
 						}
 					}
 				}).then((data)=>{
-					uni.navigateTo({
-						url: '/pages/home/home'
-					});
+					if(data){
+						uni.navigateTo({
+							url: '/pages/home/home'
+						});
+					}
 				});
 			}
 		},

+ 5 - 52
pages/situationDetail/components/bottom-popup.vue

@@ -34,45 +34,13 @@
 				flag:-3,//是否为进行中计划,判断下一个未开始的查核计划
 				planList:[],//查核计划列表
 				arrUnstarted:[],//未开始计划数组
-				// isCompeleted:false,//计划进行状态,是否已完成,状态的显示
-				// isContinued:true,//是否进行中
-				// planList:[
-				// 	{
-				// 		id:'1',
-				// 		name:'第1次查核',
-				// 		startDate:'2021-02-05',
-				// 		endDate:'2021-02-10',
-				// 		status:3,
-				//   },
-				// 	{
-				// 		id:'2',
-				// 		name:'第2次查核',
-				// 		startDate:'2021-02-05',
-				// 		endDate:'2021-02-10',
-				// 		status:2
-				// 	},
-				// 	{
-				// 		id:'3',
-				// 		name:'第3次查核',
-				// 		startDate:'2021-02-05',
-				// 		endDate:'2021-02-10',
-				// 		status:1
-				// 	},
-				// 	{
-				// 		id:'4',
-				// 		name:'第4次查核',
-				// 		startDate:'2021-02-05',
-				// 		endDate:'2021-02-10',
-				// 		status:1
-				// 	},
-				// ],//查核计划列表
 			}
 		},
 		created: function() {
 			this.$store.dispatch({
 				type: 'situationDetail/commActions',
 				payload: {
-					key: 'planlList',
+					key: 'planList',
 					data:{
 						situationId:this.situationID
 					}
@@ -98,22 +66,6 @@
 					});
 				}
 			});
-			// this.planList=this.planList.map((item,index)=>{
-			// 	if(item.status==2){
-			// 		this.flag=index;
-			// 	}
-			// 	return {
-			// 		id:item.id,
-			// 		name:item.name,
-			// 		startDate:item.startDate,
-			// 		endDate:item.endDate,
-			// 		status:item.status,
-			// 		isCompeleted:item.status==3?true:false,
-			// 		isContinued:item.status==2?true:false,
-			// 		isChecked:false,
-			// 		nameClass:index==this.flag+1?'item-text':'disable-text',
-			// 	}
-			// });
 		},
 		methods: {
 			show(){
@@ -142,14 +94,15 @@
 				this.$store.dispatch({
 					type: 'situationDetail/commActions',
 					payload: {
-						key: 'planlAdvance',
+						key: 'planAdvance',
 						data:{
 							checkId:this.selectedPlanID
 						}
 					}
 				}).then((data)=>{
-					console.log(data);
-					this.hide();
+					if(data){
+						this.hide();
+					}
 				});
 			},
 		},

+ 2 - 2
pages/situationDetail/server.js

@@ -12,12 +12,12 @@ const requestList = {
 		url: 'situation'
 	},
 	//查核计划列表
-	planlList:{
+	planList:{
 		method:'GET',
 		url: 'plan/list'
 	},
 	//提前开始计划内查核
-	planlAdvance:{
+	planAdvance:{
 		method:'GET',
 		url: 'plan/advance'
 	},

+ 8 - 5
pages/situationDetail/situationDetail.vue

@@ -193,7 +193,7 @@
 			gotoPlanPage(){
 				//跳转到计划列表
 				uni.navigateTo({
-					url: `/pages/creatingSituations/creatingSituations?situationId=${this.situationID}`
+					url: `/pages/planList/planList?situationId=${this.situationID}`
 				});
 			},
 			startUnplanned(){
@@ -207,7 +207,7 @@
 				this.$store.dispatch({
 					type: 'situationDetail/commActions',
 					payload: {
-						key: 'planlList',
+						key: 'planList',
 						data:{
 							situationId:this.situationID
 						}
@@ -231,9 +231,12 @@
 								}
 							}
 						}).then((data) => {
-							 uni.navigateTo({
-							 	 url: `/pages/creatingSituations/creatingSituations`
-							 });
+							if(data){
+								uni.navigateTo({
+									 url: `/pages/creatingSituations/creatingSituations`
+								});
+							}
+							
 						});
 					}
 				});