Explorar o código

情境创建完成

lvxinghai %!s(int64=4) %!d(string=hai) anos
pai
achega
be8dfadf45

+ 62 - 0
App.vue

@@ -105,7 +105,69 @@
 			width: 100%;
 			background-color: #fff;
 			box-shadow: 0 3.75rpx 12.5rpx 0 rgba(0, 13, 51, 0.1);
+			
+			.title-wrap {
+				display: flex;
+				flex-direction: row;
+				align-items: center;
+				padding: 0 25rpx;
+				>text {
+					font-size: 35rpx;
+					line-height: 52.5rpx;
+					color: #292C33;
+				}
+				>view {
+					display: flex;
+					flex-direction: row;
+					align-items: center;
+					margin-left: 20rpx;
+					border-radius: 17.5rpx;
+					height: 35rpx;
+					font-size: 17.5rpx;
+					line-height: 35rpx;
+					color: #8F9BB3;
+					background-color: #EDF2FA;
+					image {
+						width: 35rpx;
+						height: 35rpx;
+					}
+					text {
+						padding-left: 10rpx;
+						padding-right: 20rpx;
+					}
+				}
+			}
+			.content {
+				display: flex;
+				flex-direction: column;
+				padding: 11.25rpx 25rpx 20rpx;
+				>text {
+					overflow: hidden;
+					white-space: nowrap;
+					text-overflow: ellipsis;
+					font-size: 20rpx;
+					line-height: 30rpx;
+					color: #666F80;
+					&:first-child {
+						margin-bottom: 5rpx;
+						font-weight: bold;
+						color: #292C33;
+					}
+				}
+			}
 		}
 	}
 	// 查核地图列表样式end
+	// 弹出层样式start
+	.modal {
+		overflow: hidden;
+		position: absolute;
+		top: 0;
+		left: 0;
+		width: 100%;
+		height: 100%;
+		z-index: 1000;
+		background-color: rgba(18, 20, 26, 0.5);
+	}
+	// 弹出层样式end
 </style>

+ 0 - 54
components/tm-check-map-list/tm-check-map-list.vue

@@ -24,57 +24,3 @@
 		props: ['item']
 	}
 </script>
-
-<style lang="less">
-	.content-wrap {
-		.title-wrap {
-			display: flex;
-			flex-direction: row;
-			align-items: center;
-			padding: 0 25rpx;
-			>text {
-				font-size: 35rpx;
-				line-height: 52.5rpx;
-				color: #292C33;
-			}
-			>view {
-				display: flex;
-				flex-direction: row;
-				align-items: center;
-				margin-left: 20rpx;
-				border-radius: 17.5rpx;
-				height: 35rpx;
-				font-size: 17.5rpx;
-				line-height: 35rpx;
-				color: #8F9BB3;
-				background-color: #EDF2FA;
-				image {
-					width: 35rpx;
-					height: 35rpx;
-				}
-				text {
-					padding-left: 10rpx;
-					padding-right: 20rpx;
-				}
-			}
-		}
-		.content {
-			display: flex;
-			flex-direction: column;
-			padding: 11.25rpx 25rpx 20rpx;
-			>text {
-				overflow: hidden;
-				white-space: nowrap;
-				text-overflow: ellipsis;
-				font-size: 20rpx;
-				line-height: 30rpx;
-				color: #666F80;
-				&:first-child {
-					margin-bottom: 5rpx;
-					font-weight: bold;
-					color: #292C33;
-				}
-			}
-		}
-	}
-</style>

+ 9 - 8
pages.json

@@ -1,11 +1,5 @@
 {
 	"pages": [
-		{
-			"path": "pages/index/index",
-			"style": {
-				"navigationBarTitleText": "追踪方法学"
-			}
-		},
 		{
 			"path": "pages/login/login"
 		},
@@ -106,8 +100,15 @@
 				"navigationBarTitleText": "查核地图",
 				"enablePullDownRefresh": false
 			}
-		}
-	],
+		},
+		{
+			"path" : "pages/checkList/checkList",
+			"style" :	{
+				"navigationBarTitleText": "查核列表",
+				"enablePullDownRefresh": false
+			}
+    }
+  ],
 	"globalStyle": {
 		"navigationStyle": "custom",
 		"navigationBarTextStyle": "black",

+ 127 - 0
pages/checkList/checkList.vue

@@ -0,0 +1,127 @@
+<template>
+	<view class="check-map-list">
+		<view class="item"
+			v-for="(item, index) in depList" 
+			:key="index">
+			<view class="title-wrap">
+				<text>{{item.deptName}}</text>
+				<view>
+					<image src="../../static/icon-map.png"></image>
+					<text>{{item.deptClassName}}</text>
+				</view>
+			</view>
+			<view class="content">
+				<text>{{item.decs}}</text>
+				<text>
+					要点概览:{{item.checkPointNames}}
+				</text>
+			</view>
+			<view class="footer">
+				<text>查核人:{{item.empName}}</text>
+				<text>{{item.startDate}}~{{item.endDate}}</text>
+			</view>
+		</view>
+		<view class="null" v-if="depList.length === 0">暂无数据</view>
+		<view class="modal">
+			<view class="content-list">
+				<view class="list-item">
+					<text>第1次查核计划(2020-09-21 ~ 2020-09-22)</text>
+					<view class="item-icon">已完成</view>
+				</view>
+				<view class="list-item active">
+					<text>第1次查核计划(2020-09-21 ~ 2020-09-22)</text>
+					<view class="item-icon">进行中</view>
+				</view>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				depList: [
+					{
+						"checkId":30, //类型:Number  必有字段  备注:计划id
+						"deptId":1, //类型:Number  必有字段  备注:单位id
+						"deptName":"测试单位1", //类型:String  必有字段  备注:单位名称
+						"deptClassId":1, //类型:Number  必有字段  备注:单位分组id
+						"deptClassName":"单位分类1", //类型:String  必有字段  备注:单位分组名称
+						"checkPointNames":"要点1", //类型:String  必有字段  备注:要点名称拼接
+						"decs":"包含1个查核要点, 已完成0/2个查核项目", //类型:String  必有字段  备注:描述
+						"empId":6, //类型:Number  必有字段  备注:分配查核人id
+						"empName":"查核组员2", //类型:String  必有字段  备注:分配查核人名称
+						"startDate":"2021-02-20 08:00", //类型:String  必有字段  备注:分配开始时间
+						"endDate":"2021-02-21 05:00" //类型:String  必有字段  备注:分配结束时间
+					}
+				]
+			};
+		},
+		created: function(){
+			this.dispatch('depList', {checkId: ''}).then((data)=>{
+				console.log(data);
+				if(data) {
+					// this.depList = data;
+				}
+			});
+		},
+		methods: {
+			dispatch: function(key, data) {
+				return this.$store.dispatch({type: 'checkList/commActions', key, data});
+			},
+		}
+	}
+</script>
+
+<style lang="less">
+	.check-map-list {
+		padding: 25rpx;
+		.footer {
+			display: flex;
+			flex-direction: row;
+			justify-content: space-between;
+			align-items: center;
+			margin: 0 25rpx 16.87rpx;
+			border-top: 1px solid #DADEE6;
+			padding-top: 16.25rpx;
+			font-size: 17.5rpx;
+			line-height: 26.25rpx;
+			color: #666E80;
+		}
+	}
+	.null {
+		text-align: center;
+		color: #999;
+	}
+	.content-list {
+		width: 100%;
+		background-color: #fff;
+		.list-item {
+			display: flex;
+			flex-direction: row;
+			align-items: center;
+			border-bottom: 1px solid #DADEE6;
+			padding: 0 25rpx;
+			width: 100%;
+			height: 87.5rpx;
+			font-size: 22.5rpx;
+			line-height: 33.75rpx;
+			color: #292C33;
+			.item-icon {
+				border-radius: 5rpx;
+				padding: 6.25rpx 11.25rpx;
+				line-height: 26.25rpx;
+				color: #29CC96;
+				background-color: #e9f9f4;
+			}
+			&.active {
+				color: #3377FF;
+				.item-icon {
+					color: #FFAA00;
+					background-color: #fff9ef;
+				}
+			}
+		}
+	}
+</style>

+ 18 - 0
pages/checkList/model.js

@@ -0,0 +1,18 @@
+import { commServer } from './server.js';
+	import {dateHandle} from "../../utils/dateHandle.js";
+	
+export default {
+  namespaced: true,
+  state: {
+  },
+  mutations: {
+		comChangeState(state, {key, data}) {
+			state[key] = data;
+		},
+  },
+  actions: {
+		commActions({ commit, state }, { key, data }) {
+      return commServer(key, data);
+		},
+  }
+}

+ 16 - 0
pages/checkList/server.js

@@ -0,0 +1,16 @@
+import { creatRequest } from '../../utils/request.js';
+
+const requestList = {
+  // 查核列表
+  depList: {
+    method: 'GET',
+    url: 'plan/depList',
+		// successMessage: '',
+		// needLoading: false // 还有这两个参数,但不是必传的,默认loading
+  }, 
+};
+
+export const commServer = (key, data) => {
+  let obj = requestList[key];
+  return creatRequest(obj, data);
+}

+ 2 - 2
pages/checkMapList/checkMapList.vue

@@ -5,7 +5,7 @@
 			:key="index">
 			<tm-check-map-list :item="item"></tm-check-map-list>
 		</view>
-		<text class="null" v-if="checkMap.list.length === 0">暂无数据</text>
+		<view class="null" v-if="checkMap.list.length === 0">暂无数据</view>
 	</view>
 </template>
 
@@ -24,9 +24,9 @@
 <style lang="less">
 	.check-map-list {
 		padding: 25rpx;
-		text-align: center;
 	}
 	.null {
+		text-align: center;
 		color: #999;
 	}
 </style>

+ 21 - 6
pages/creatingSituations/components/checkMap.vue

@@ -71,12 +71,7 @@
 					this.dispatch('checkDeptList', { depType, checkPointIds })
 						.then((data)=> {
 							if(data) {
-								let _data = data.map((item)=>{
-									return {
-										...item,
-										status: 'normal'
-									}
-								})
+								let _data = this.checkDep(data);
 								this.myCommit('list', _data);
 							} 
 						});
@@ -86,6 +81,26 @@
 					});
 				}
 			},
+			checkDep: function(list) {
+				return list.map((item, i)=>{
+					return {
+						...item,
+						status: 'normal',
+						pointList: (item.pointList || []).map((ptem)=>{
+							return {
+								...ptem,
+								selectFlag: true,
+								itemList: (ptem.itemList || []).map((ntem)=>{
+									return {
+										...ntem,
+										selectFlag: true
+									}
+								})
+							}
+						})
+					}
+				});
+			},
 			creatIcon: function(status) {
 				let obj = {id: 'jinyong', label: '禁用'};
 				switch(status) {

+ 0 - 7
pages/creatingSituations/components/checkMapAdd.vue

@@ -92,13 +92,6 @@
 
 <style lang="less">
 	.modal {
-		position: absolute;
-		bottom: 0;
-		width: 100%;
-		height: 100%;
-		z-index: 1000;
-		background-color: rgba(18, 20, 26, 0.5);
-		
 		.modal-body {
 			margin-top: 10%;
 			border-radius: 25rpx 25rpx 0 0;

+ 19 - 20
pages/creatingSituations/components/checkMapDetail.vue

@@ -10,8 +10,9 @@
 				<view class="children" v-if="openItems.includes(item.id)">
 					<view class="child" v-for="(child, n) in item.itemList" :key="n">
 						<text>{{child.name}}</text>
-						<view class="check-icon-wrap" @click="changeChecked(child.id)">
-							<image :src="`../../static/check-${checkedIds.includes(child.id)
+						<view class="check-icon-wrap" 
+							@click="changeChecked(index, n, child.selectFlag)">
+							<image :src="`../../static/check-${child.selectFlag
 								?'checkbox':'no'}.png`"></image>
 						</view>
 					</view>
@@ -31,48 +32,46 @@
 		data() {
 			return {
 				openItems: [],
-				checkedIds: [],
 			}
 		},
 		computed: {
 			botmBtnGroup: function() {
 				return [
 					{id: 'cancle', label: '取消'},
-					{id: 'ok', label: `已选${this.checkedIds.length}项,确定`}
+					{id: 'ok', label: `已选${this.selectedNum}项,确定`}
 				];
 			},
 			...mapState({
 				checkMap: state => state.creatingSituations.checkMap,
-			})
+			}),
+			selectedNum: function() {
+				let num = 0;
+				this.checkMap.actionItem.pointList.map((item)=>{
+					item.itemList.map((ntem)=>{
+						if(ntem.selectFlag) num++;
+					});
+				});
+				return num;
+			},
 		},
 		created:function(){
-			// 默认全选中
 			this.checkMap.actionItem.pointList.map((item)=>{
 				this.openItems.push(item.id);
-				item.itemList.map((ntem)=>{
-					if(ntem.selectFlag === undefined || ntem.selectFlag) {
-						this.checkedIds.push(ntem.id);
-					}
-				});
 			});
 		},
 		methods: {
 			openChildren: function(key) {
 				this.openItems = arrFilter(key, this.openItems);
 			},
-			changeChecked: function(id) {
-				this.checkedIds = arrFilter(id, this.checkedIds);
+			changeChecked: function(i, n, selectFlag) {
+				this.checkMap.actionItem.pointList[i].itemList[n].selectFlag = !selectFlag;
+				this.myCommit('actionItem', this.checkMap.actionItem);
 			},
 			btnClick: function(id) {
 				if(id === 'ok') {
-					let pointList = [...this.checkMap.actionItem.pointList];
-					pointList.map((item)=>{
-						item.itemList.map((ntem)=>{
-							ntem.selectFlag = this.checkedIds.includes(ntem.id) ? true : false;
-						});
-					});
+					const {id, pointList} = this.checkMap.actionItem;
 					let list = [...this.checkMap.list];
-					let index = list.findIndex(({id})=> id === this.checkMap.actionItem.id);
+					let index = list.findIndex((item)=> item.id === id);
 					list[index].pointList = pointList;
 					this.myCommit('list', list);
 				} 

+ 0 - 7
pages/creatingSituations/components/checkRent.vue

@@ -75,14 +75,7 @@
 			},
 			checkedHandle: function(e, item) {
 				_stopPropagation(e);
-				let _list = [...this.checkRent.list].map((ntem)=>{
-					return {
-						...ntem,
-						selectFlag: ntem.id === item.id ? true : false
-					}
-				});
 				this.myCommit('checkedItem', item);
-				this.myCommit('list', _list);
 			},
 			/**
 			 * 更新condition数据

+ 0 - 12
pages/creatingSituations/components/condition.vue

@@ -34,8 +34,6 @@
 		methods: {
 			checkedHandle: function(keys) {
 				this.myCommit('conditionIds', keys);
-				let _options = this.optionsHandle2([...this.condition.options], keys);
-				this.myCommit('options', _options);
 			},
 			selectBtnHandle: function(depType) {
 				this.myCommit('depType', depType);
@@ -83,16 +81,6 @@
 				});
 				return options;
 			},
-			optionsHandle2: function(data, keys) {
-				let options = data.map((item)=>{
-					return {
-						...item,
-						selectFlag: this.condition.conditionIds.includes(item.id),
-						child: this.optionsHandle2(item.child, keys)
-					}
-				});
-				return options;
-			},
 			/**
 			 * 更新condition数据
 			 * @param {Object} key 要更新的属性

+ 40 - 11
pages/creatingSituations/creatingSituations.vue

@@ -85,7 +85,6 @@
 				const {sitName,preDay,preH,startDay} = this.situationPreview;
 				const {dateObj,checkedItem,checkList} = this.checkPlan;
 				const {depType, options} = this.condition;
-				const {list} = this.checkMap;
 				if(!sitName) {
 					uni.showModal({
 						title: '温馨提示',
@@ -103,15 +102,9 @@
 					remindPlanHour: preH,
 					remindCheckDay: startDay,
 					depType,
-					filterCondition: options,
-					checkGroup: this.checkRent.list,
-					checkDep: [...list].map((item,i)=>{
-						return {
-							...item,
-							sort: i+1,
-							enableFlag: item.status === 'disable' ? false : true
-						}
-					}),
+					filterCondition: this.optionsHandle(options),
+					checkGroup: this.checkGroup(),
+					checkDep: this.checkDep(),
 					planConfig: {
 						frequency: checkedItem.value,
 						day: checkedItem.model,
@@ -126,8 +119,11 @@
 						}
 					})
 				}).then((data)=>{
+					console.log(data);
 					if(data) {
-						
+						uni.navigateTo({
+							url: '/pages/situationsCenter/situationsCenter'
+						});
 					}
 				});
 			},
@@ -197,6 +193,39 @@
 					return false;
 				}
 			},
+			/**
+			 * 构造条件提交结果
+			 */
+			optionsHandle: function(arr) {
+				let options = [...arr].map((item)=>{
+					return {
+						...item,
+						selectFlag: this.condition.conditionIds.includes(item.id),
+						child: this.optionsHandle(item.child)
+					}
+				});
+				return options;
+			},
+			checkDep: function() {
+				const {list} = this.checkMap;
+				return list.map((item, i)=>{
+					return {
+						...item,
+						sort: i+1,
+						enableFlag: item.status === 'disable' ? false : true,
+					}
+				});
+			},
+			checkGroup: function() {
+				const {list, checkedItem} = this.checkRent;
+				let _list = [...list].map((ntem)=>{
+					return {
+						...ntem,
+						selectFlag: ntem.id === checkedItem.id ? true : false
+					}
+				});
+				return _list;
+			},
 			myCommit: function(key, data) {
 				this.$store.commit({type: 'creatingSituations/comChangeState',key,data});
 			},

+ 0 - 51
pages/index/index.vue

@@ -1,51 +0,0 @@
-<template>
-	<view class="content">
-		<view class="text-area">
-			<text class="title">{{title}}</text>
-		</view>
-	</view>
-</template>
-
-<script>
-	export default {
-		data() {
-			return {
-				title: 'Hello'
-			}
-		},
-		onLoad() {
-
-		},
-		methods: {
-
-		}
-	}
-</script>
-
-<style>
-	.content {
-		display: flex;
-		flex-direction: column;
-		align-items: center;
-		justify-content: center;
-	}
-
-	.logo {
-		height: 200rpx;
-		width: 200rpx;
-		margin-top: 200rpx;
-		margin-left: auto;
-		margin-right: auto;
-		margin-bottom: 50rpx;
-	}
-
-	.text-area {
-		display: flex;
-		justify-content: center;
-	}
-
-	.title {
-		font-size: 36rpx;
-		color: #8f8f94;
-	}
-</style>

+ 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 checkList from "./checkList/model.js";
 
 export default module = {
   login,
@@ -22,5 +23,6 @@ export default module = {
   todayCheck,
   situationsCenter,
   situationDetail,
-  creatingSituations
+  creatingSituations,
+	checkList
 }

+ 3 - 3
utils/request.js

@@ -107,7 +107,7 @@ function notifyException(resArr, additional) {
       showCancel: false
     });
     console.error(`请求错误: ${error.errMsg}`);
-    return null;
+    return false;
   } else if (res.data.code !== 'SUCCESS') {
     const { code, msg } = res.data;
     if (code === '410' || code === '401') {
@@ -132,7 +132,7 @@ function notifyException(resArr, additional) {
       });
     }
     console.error(`错误信息: ${msg}`);
-    return null;
+    return false;
   } else if (additional.successMessage) {
     let msg = additional.successMessage;
     uni.showModal({
@@ -141,7 +141,7 @@ function notifyException(resArr, additional) {
       showCancel: false
     });
   }
-  return res.data.data;
+  return res.data.data ? res.data.data : true;
 }
 
 export {