ソースを参照

情境创建完成

lvxinghai 4 年 前
コミット
3c241c6b33

+ 17 - 0
App.vue

@@ -91,4 +91,21 @@
 		}
 	}
 	// 新建情境样式end
+	// 查核地图列表样式start
+	.check-map-list {
+		overflow: hidden;
+		padding: 0 25rpx;
+		.item {
+			position: relative;
+			overflow: hidden;
+			margin-bottom: 25rpx;
+			border-radius: 5rpx;
+			padding-top: 16.25rpx;
+			padding-bottom: 0;
+			width: 100%;
+			background-color: #fff;
+			box-shadow: 0 3.75rpx 12.5rpx 0 rgba(0, 13, 51, 0.1);
+		}
+	}
+	// 查核地图列表样式end
 </style>

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

@@ -0,0 +1,80 @@
+<template>
+	<view class="content-wrap">
+		<view class="title-wrap">
+			<text>{{item.name}}</text>
+			<view>
+				<image src="../../static/icon-map.png"></image>
+				<text>{{item.deptClassName}}</text>
+			</view>
+		</view>
+		<view class="content">
+			<text>包含{{item.pointCount || 0}}个查核要点,{{item.itemCount || 0}}个查核项目</text>
+			<text>
+				要点概览:
+				<text v-for="(point, c) in item.pointList" :key="c">
+					{{point.name}};
+				</text>
+			</text>
+		</view>
+	</view>
+</template>
+
+<script>
+	export default {
+		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>

+ 7 - 0
pages.json

@@ -99,6 +99,13 @@
 				"navigationBarTitleText": "情境详情",
 				"enablePullDownRefresh": false
 			}
+		},
+		{
+			"path" : "pages/checkMapList/checkMapList",
+			"style" : {
+				"navigationBarTitleText": "查核地图",
+				"enablePullDownRefresh": false
+			}
 		}
 	],
 	"globalStyle": {

+ 32 - 0
pages/checkMapList/checkMapList.vue

@@ -0,0 +1,32 @@
+<template>
+	<view class="check-map-list">
+		<view class="item"
+			v-for="(item, index) in checkMap.list" 
+			:key="index">
+			<tm-check-map-list :item="item"></tm-check-map-list>
+		</view>
+		<text class="null" v-if="checkMap.list.length === 0">暂无数据</text>
+	</view>
+</template>
+
+<script>
+	import { mapState } from "vuex";
+	
+	export default {
+		computed: {
+			...mapState({
+				checkMap: state => state.creatingSituations.checkMap,
+			})
+		},
+	}
+</script>
+
+<style lang="less">
+	.check-map-list {
+		padding: 25rpx;
+		text-align: center;
+	}
+	.null {
+		color: #999;
+	}
+</style>

+ 147 - 182
pages/creatingSituations/components/checkMap.vue

@@ -1,38 +1,25 @@
 <template>
 	<view class="check-map">
 		<view class="title">请对查核地图进行配置</view>
-		<view class="list">
+		<view class="check-map-list">
 			<view class="item" 
-				v-for="(item, index) in list" 
+				v-for="(item, index) in checkMap.list" 
 				:class="{disable: item.status === 'disable'}"
 				@click="detail(item)"
 				:key="index">
-				<view class="title-wrap">
-					<text>{{item.name}}</text>
-					<view>
-						<image src="../../../static/icon-map.png"></image>
-						<text>{{item.deptClassName}}</text>
-					</view>
-				</view>
-				<view class="content">
-					<text>包含{{item.pointCount}}个查核要点,{{item.itemCount}}个查核项目</text>
-					<text>
-						<text v-for="(point, c) in item.pointList" :key="c">
-							{{point.name}};
-						</text>
-					</text>
-				</view>
+				<tm-check-map-list :item="item"></tm-check-map-list>
 				<view class="btn-group">
 					<view class="btn" 
 						v-for="(btn, index) in btnGroupArr" 
-						@click="btnClick($event, btn.id)"
+						@click="btnClick($event, btn.id, item)"
 						:key="index">
 						<image :src="`../../static/icon-${btn.id}${item.status === 'disable' 
 							? 'dis' : ''}.png`"></image>
 						<text>{{btn.label}}</text>
 					</view>
-					<view class="btn">
-						<image :src="`../../static/icon-${creatIcon(item.status)['icon']}.png`">
+					<view class="btn" 
+						@click="btnClick($event, creatIcon(item.status)['id'], item)">
+						<image :src="`../../static/icon-${creatIcon(item.status)['id']}.png`">
 						</image>
 						<text>{{ creatIcon(item.status)['label'] }}</text>
 					</view>
@@ -54,18 +41,13 @@
 	import {_stopPropagation} from "../../../utils/compatible.js";
 	const btnGroupArr = [
 		{id: 'add', label: '新增'},
-		{id: 'shang', label: '上移'},
-		{id: 'xia', label: '下移'},
+		{id: 'pre', label: '上移'},
+		{id: 'next', label: '下移'},
 	];
 	export default {
 		data() {
 			return {
 				btnGroupArr,
-				list: [
-					{status: 'normal'},
-					{status: 'add'},
-					{status: 'disable'},
-				]
 			}
 		},
 		computed: {
@@ -73,57 +55,101 @@
 				checkMap: state => state.creatingSituations.checkMap,
 				checkRent: state => state.creatingSituations.checkRent,
 				condition: state => state.creatingSituations.condition,
+				needReload: state => state.creatingSituations.needReload,
 			})
 		},
 		created:function(){
-			if(this.checkMap.list.length === 0) {
-				const {points} = this.checkRent.checkedItem;
-				if(!points) return;
-				let checkPointIds = points.map(({id})=> id);
-				console.log(checkPointIds)
-				this.$store.dispatch({
-					type: 'creatingSituations/commActions',
-					key: 'checkDeptList',
-					data: { 
-						depType: this.condition.depType,
-						checkPointIds,
-					}
-				}).then((data)=> {
-					if(data) this.myCommit('list', data);
-				});
-			}
+			this.init();
 		},
 		methods: {
+			init: function() {
+				if(this.needReload) { // 点击上一步不用获取数据
+					const {points} = this.checkRent.checkedItem;
+					const {depType} = this.condition;
+					if(!points) return;
+					let checkPointIds = points.map(({id})=> id);
+					this.dispatch('checkDeptList', { depType, checkPointIds })
+						.then((data)=> {
+							if(data) {
+								let _data = data.map((item)=>{
+									return {
+										...item,
+										status: 'normal'
+									}
+								})
+								this.myCommit('list', _data);
+							} 
+						});
+					// 获取新增单位
+					this.dispatch('deptList', { depType }).then((data)=>{
+						if(data) this.myCommit('deptList', data);
+					});
+				}
+			},
 			creatIcon: function(status) {
-				let obj = {icon: 'jinyong', label: '禁用'};
+				let obj = {id: 'jinyong', label: '禁用'};
 				switch(status) {
 					case 'add': 
-						obj = {icon: 'del', label: '删除'};
+						obj = {id: 'del', label: '删除'};
 						break;
 					case 'disable': 
-						obj = {icon: 'qiyong', label: '启用'};
+						obj = {id: 'qiyong', label: '启用'};
 						break;
 				}
 				return obj;
 			},
 			detail: function(item) {
-				this.$store.commit({
-					type: 'creatingSituations/comChangeState',
-					key: 'showCheckMapDetail',
-					data: true
-				});
+				if(item.status === 'disable') return;
+				this.commit('needReload', false); // 不用新获取数据
+				this.commit('showCheckMapDetail', true);
+				this.myCommit('actionItem', item);
 			},
-			btnClick: function(e, id) {
+			btnClick: function(e, btnType, item) {
+				if(item.status === 'disable' && btnType !== 'qiyong') return;
 				_stopPropagation(e);
-				switch(id) {
-					case 'add': 
-						this.$store.commit({
-							type: 'creatingSituations/comChangeState',
-							key: 'showCheckMapAdd',
-							data: true
-						});
+				switch(btnType) {
+					case 'add': // 新增
+						this.commit('needReload', false); // 不用新获取数据
+						this.commit('showCheckMapAdd', true);
+						this.myCommit('actionItem', item);
+						break;
+					default: // 其他
+						this.preAndNext(btnType, item);
+						break;
+				}
+			},
+			preAndNext: function(type, item) {
+				let arr = [...this.checkMap.list];
+				let index = arr.findIndex(({id}) => id === item.id);
+				switch(type) {
+					case 'pre': // 上移
+						if(index > 0) {
+							let pre = arr[index - 1];
+							arr[index - 1] = item;
+							arr[index] = pre;
+						}
+						break;
+					case 'next': // 下移
+						if(index < arr.length - 1) {
+							let next = arr[index + 1];
+							arr[index + 1] = item;
+							arr[index] = next;
+						}
+						break;
+					case 'del': // 删除
+						arr.splice(index, 1);
+						break;
+					case 'jinyong': // 禁用
+						arr.splice(index, 1);
+						arr.push({...item, status: 'disable'});
+						break;
+					case 'qiyong': // 启用
+						let _index = arr.findIndex(({status})=>status === 'disable');
+						arr.splice(index, 1); // 删掉原来的
+						arr.splice(_index, 0, {...item, status: 'normal'}); // 添加到disable的前面
 						break;
 				}
+				this.myCommit('list', arr);
 			},
 			/**
 			 * 更新condition数据
@@ -133,11 +159,13 @@
 			myCommit: function(key, value) {
 				let data = {...this.checkMap};
 				data[key] = value;
-				this.$store.commit({
-					type: 'creatingSituations/comChangeState', 
-					key: 'checkMap', 
-					data
-				});
+				this.commit('checkMap', data);
+			},
+			dispatch: function(key, data) {
+				return this.$store.dispatch({type: 'creatingSituations/commActions', key, data});
+			},
+			commit: function(key, data) {
+				this.$store.commit({type: 'creatingSituations/comChangeState', key, data});
 			}
 		}
 	}
@@ -145,138 +173,75 @@
 
 <style lang="less">
 	.check-map {
-		.list {
-			overflow: hidden;
-			padding: 0 25rpx;
-			.item {
-				position: relative;
-				overflow: hidden;
-				margin-bottom: 25rpx;
-				border-radius: 5rpx;
-				padding-top: 16.25rpx;
-				padding-bottom: 0;
+		.check-map-list {
+			.btn-group {
+				display: flex;
+				flex-direction: row;
+				padding: 15rpx 0;
 				width: 100%;
-				background-color: #fff;
-				box-shadow: 0 3.75rpx 12.5rpx 0 rgba(0, 13, 51, 0.1);
-				
-				.title-wrap {
+				height: 77.5rpx;
+				background-color: #FAFBFC;
+				.btn {
 					display: flex;
-					flex-direction: row;
+					flex-direction: column;
 					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;
-						}
+					justify-content: center;
+					border-right: 1px solid #DADEE6;
+					flex: 1;
+					font-size: 17.5rpx;
+					line-height: 26.25rpx;
+					color: #7A8599;
+					&:last-child {
+						border-right: 0;
 					}
-				}
-				.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;
-						}
+					image {
+						width: 25rpx;
+						height: 25rpx;
 					}
 				}
-				.btn-group {
-					display: flex;
-					flex-direction: row;
-					padding: 15rpx 0;
+			}
+			.dis-img-wrap,
+			.add-img-wrap {
+				position: absolute;
+				top: 18.75rpx;
+				right: 18.75rpx;
+				width: 93.75rpx;
+				height: 93.75rpx;
+				image {
 					width: 100%;
-					height: 77.5rpx;
-					background-color: #FAFBFC;
-					.btn {
-						display: flex;
-						flex-direction: column;
-						align-items: center;
-						justify-content: center;
-						border-right: 1px solid #DADEE6;
-						flex: 1;
-						font-size: 17.5rpx;
-						line-height: 26.25rpx;
-						color: #7A8599;
-						&:last-child {
-							border-right: 0;
-						}
-						image {
-							width: 25rpx;
-							height: 25rpx;
-						}
-					}
+					height: 100%;
 				}
-				.dis-img-wrap,
-				.add-img-wrap {
+			}
+			.add-img-wrap {
+				top: 0;
+				right: 0;
+				width: 100rpx;
+				height: 35rpx;
+				text {
 					position: absolute;
-					top: 18.75rpx;
-					right: 18.75rpx;
-					width: 93.75rpx;
-					height: 93.75rpx;
-					image {
-						width: 100%;
-						height: 100%;
+					top: 4.37rpx;
+					left: 28.75rpx;
+					font-size: 17.5rpx;
+					line-height: 26.25rpx;
+					color: #fff;
+				}
+			}
+			&.disable {
+				.title-wrap {
+					>text, >view {
+						color: #B8BECC;
 					}
 				}
-				.add-img-wrap {
-					top: 0;
-					right: 0;
-					width: 100rpx;
-					height: 35rpx;
+				.content {
 					text {
-						position: absolute;
-						top: 4.37rpx;
-						left: 28.75rpx;
-						font-size: 17.5rpx;
-						line-height: 26.25rpx;
-						color: #fff;
+						color: #B8BECC;
 					}
 				}
-				&.disable {
-					.title-wrap {
-						>text, >view {
-							color: #B8BECC;
-						}
-					}
-					.content {
-						text {
-							color: #B8BECC;
-						}
-					}
-					.btn-group {
-						.btn {
-							color: #B8BECC;
-							&:last-child {
-								color: #7A8599;
-							}
+				.btn-group {
+					.btn {
+						color: #B8BECC;
+						&:last-child {
+							color: #7A8599;
 						}
 					}
 				}

+ 48 - 26
pages/creatingSituations/components/checkMapAdd.vue

@@ -4,25 +4,18 @@
 			<view class="body-content">
 				<text class="top-title">选择要新增的单位</text>
 				<view class="list">
-					<view class="item">
-						<view class="item-title">门诊</view>
+					<view class="item"v-for="(item, index) in checkMap.deptList" :key="index">
+						<view class="item-title">{{item.name}}</view>
 						<view class="chidren">
-							<view class="child" 
-								:class="{active: checkedIds.includes(0)}"
-								@click="changeChecked(0)">
-								<text>挂号处</text>
-								<image v-if="checkedIds.includes(0)" 
+							<view class="child"
+								v-for="(child, n) in item.departmentList"
+								:key="n"
+								:class="{active: checkedIds.includes(child.id)}"
+								@click="changeChecked(child.id)">
+								<text>{{child.name}}</text>
+								<image v-if="checkedIds.includes(child.id)" 
 									src="../../../static/bottom-img.png"></image>
 							</view>
-							<view class="child">
-								<text>分诊处</text>
-							</view>
-							<view class="child">
-								<text>挂号处</text>
-							</view>
-							<view class="child">
-								<text>分诊处</text>
-							</view>
 						</view>
 					</view>
 				</view>
@@ -34,6 +27,7 @@
 </template>
 
 <script>
+	import { mapState } from "vuex";
 	import {arrFilter} from "../../../utils/arrFilter.js";
 	export default {
 		data() {
@@ -47,7 +41,10 @@
 					{id: 'cancle', label: '取消'},
 					{id: 'ok', label: `已选${this.checkedIds.length}项,确定新增`}
 				];
-			}
+			},
+			...mapState({
+				checkMap: state => state.creatingSituations.checkMap,
+			})
 		},
 		methods: {
 			changeChecked: function(id) {
@@ -55,15 +52,40 @@
 			},
 			btnClick: function(id) {
 				if(id === 'ok') {
-					
-				} else {
-					this.$store.commit({
-						type: 'creatingSituations/comChangeState',
-						key: 'showCheckMapAdd',
-						data: false
+					this.dispatch('addDeptList', {depIds: this.checkedIds}).then((data)=>{
+						if(data) {
+							const {list, actionItem} = this.checkMap;
+							let arr = [...this.checkMap.list];
+							data = data.map((item)=>{
+								return {
+									...item,
+									status: 'add'
+								}
+							});
+							let index = list.findIndex(({id})=> id === actionItem.id);
+							arr.splice(index + 1, 0, ...data);
+							this.myCommit('list', arr);
+						}
 					});
 				}
-			}
+				this.commit('showCheckMapAdd', false);
+			},
+			/**
+			 * 更新condition数据
+			 * @param {Object} key 要更新的属性
+			 * @param {Object} value 值
+			 */
+			myCommit: function(key, value) {
+				let data = {...this.checkMap};
+				data[key] = value;
+				this.commit('checkMap', data);
+			},
+			dispatch: function(key, data) {
+				return this.$store.dispatch({type: 'creatingSituations/commActions', key, data});
+			},
+			commit: function(key,data) {
+				this.$store.commit({type: 'creatingSituations/comChangeState', key, data});
+			},
 		}
 	}
 </script>
@@ -104,14 +126,14 @@
 						display: flex;
 						flex-direction: row;
 						flex-wrap: wrap;
-						justify-content: space-between;
+						margin: 0 -17.5rpx;
 						.child {
 							position: relative;
 							display: flex;
 							flex-direction: row;
 							justify-content: center;
 							align-items: center;
-							margin: 10rpx 0;
+							margin: 10rpx 17.5rpx;
 							border-radius: 5rpx;
 							width: 200rpx;
 							height: 50rpx;

+ 52 - 46
pages/creatingSituations/components/checkMapDetail.vue

@@ -1,49 +1,20 @@
 <template>
 	<view class="check-map-detail">
-		<view class="item">
-			<view class="icon-wrap" @click="openChildren(0)">
-				<image :src="`../../static/list-${openItems.includes(0)
+		<view class="item" v-for="(item, index) in checkMap.actionItem.pointList" :key="index">
+			<view class="icon-wrap" @click="openChildren(item.id)">
+				<image :src="`../../static/list-${openItems.includes(item.id)
 					?'close':'open'}.png`"></image>
 			</view>
 			<view class="content">
-				<view class="content-title" @click="openChildren(0)">疼痛之评估及再评估</view>
-				<view class="children" v-if="openItems.includes(0)">
-					<view class="child">
-						<text>PRN order时间间隔与时机</text>
-						<view class="check-icon-wrap" @click="changeChecked(1)">
-							<image :src="`../../static/check-${checkedIds.includes(1)
+				<view class="content-title" @click="openChildren(item.id)">{{item.name}}</view>
+				<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)
 								?'checkbox':'no'}.png`"></image>
 						</view>
 					</view>
-					<view class="child">
-						<text>过敏反应表现</text>
-						<view class="check-icon-wrap">
-							<image src="../../../static/check-no.png"></image>
-						</view>
-					</view>
-				</view>
-			</view>
-		</view>
-		<view class="item">
-			<view class="icon-wrap" @click="openChildren(1)">
-				<image :src="`../../static/list-${openItems.includes(1)
-					?'close':'open'}.png`"></image>
-			</view>
-			<view class="content">
-				<view class="content-title" @click="openChildren(1)">疼痛之评估及再评估</view>
-				<view class="children" v-if="openItems.includes(1)">
-					<view class="child">
-						<text>PRN order时间间隔与时机</text>
-						<view class="check-icon-wrap">
-							<image src="../../../static/check-no.png"></image>
-						</view>
-					</view>
-					<view class="child">
-						<text>过敏反应表现</text>
-						<view class="check-icon-wrap">
-							<image src="../../../static/check-no.png"></image>
-						</view>
-					</view>
 				</view>
 			</view>
 		</view>
@@ -53,6 +24,7 @@
 </template>
 
 <script>
+	import { mapState } from "vuex";
 	import {arrFilter} from "../../../utils/arrFilter.js";
 	
 	export default {
@@ -68,7 +40,21 @@
 					{id: 'cancle', label: '取消'},
 					{id: 'ok', label: `已选${this.checkedIds.length}项,确定`}
 				];
-			}
+			},
+			...mapState({
+				checkMap: state => state.creatingSituations.checkMap,
+			})
+		},
+		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) {
@@ -79,14 +65,34 @@
 			},
 			btnClick: function(id) {
 				if(id === 'ok') {
-					
-				} else {
-					this.$store.commit({
-						type: 'creatingSituations/comChangeState',
-						key: 'showCheckMapDetail',
-						data: false
+					let pointList = [...this.checkMap.actionItem.pointList];
+					pointList.map((item)=>{
+						item.itemList.map((ntem)=>{
+							ntem.selectFlag = this.checkedIds.includes(ntem.id) ? true : false;
+						});
 					});
-				}
+					let list = [...this.checkMap.list];
+					let index = list.findIndex(({id})=> id === this.checkMap.actionItem.id);
+					list[index].pointList = pointList;
+					this.myCommit('list', list);
+				} 
+				this.commit('showCheckMapDetail', false);
+			},
+			/**
+			 * 更新condition数据
+			 * @param {Object} key 要更新的属性
+			 * @param {Object} value 值
+			 */
+			myCommit: function(key, value) {
+				let data = {...this.checkMap};
+				data[key] = value;
+				this.commit('checkMap', data);
+			},
+			dispatch: function(key, data) {
+				return this.$store.dispatch({type: 'creatingSituations/commActions', key, data});
+			},
+			commit: function(key,data) {
+				this.$store.commit({type: 'creatingSituations/comChangeState', key, data});
 			},
 		}
 	}

+ 50 - 39
pages/creatingSituations/components/checkPlan.vue

@@ -13,7 +13,7 @@
 						<text>{{item.label}}</text>
 					</view>
 					<view class="img-wrap" @click="checkModel(item)">
-						<image :src="`../../static/check-${checkedItem.id === item.id 
+						<image :src="`../../static/check-${checkPlan.checkedItem.id === item.id 
 							? 'radio': 'no'}.png`"></image>
 					</view>
 				</view>
@@ -23,8 +23,8 @@
 				<view>
 					<date-time-pick-group fields="day" 
 						:startTime="startTime()"
-						:startSelectValue="dateObj.start"
-						:endSelectValue="dateObj.end"
+						:startSelectValue="checkPlan.dateObj.start"
+						:endSelectValue="checkPlan.dateObj.end"
 						v-on:changeDate="changeDate"></date-time-pick-group>
 					<image src="../../../static/incon-more.png"></image>
 				</view>
@@ -38,7 +38,7 @@
 			<view class="top-box">
 				<view class="result-box">
 					<text>开始日期</text>
-					<text>{{dateObj.start}}</text>
+					<text>{{checkPlan.dateObj.start}}</text>
 				</view>
 				<view class="date-box">
 					<text>结束日期</text>
@@ -47,14 +47,14 @@
 							placeholder="请选择结束日期"
 							pickType="end"
 							:start="startTime()"
-							:defaultValue="dateObj.end"
+							:defaultValue="checkPlan.dateObj.end"
 							v-on:change="changeDate"></date-time-picker>
 						<image src="../../../static/incon-more.png"></image>
 					</view>
 				</view>
 			</view>
 			<view class="content2-list">
-				<view class="item" v-for="(item, index) in checkList" :key="index">
+				<view class="item" v-for="(item, index) in checkPlan.checkList" :key="index">
 					<text>第{{index + 1}}次查核</text>
 					<view class="date-box">
 						<text>开始日期</text>
@@ -75,41 +75,35 @@
 </template>
 
 <script>
-	import {dateHandle} from "../../../utils/dateHandle.js";
 	import { mapState } from "vuex";
+	import {dateHandle} from "../../../utils/dateHandle.js";
 	const {dateDiff, getNewData, todayDate, compare} = dateHandle;
 	const list = [
-		{id: 'week', label: '每周', model: 7},
-		{id: 'month', label: '每月', model: 30},
-		{id: 'twoMonth', label: '每两月', model: 60},
-		{id: 'quarter', label: '每季度', model: 90},
-		{id: 'halfAYear', label: '每半年', model: 180},
-		{id: 'custom', label: '天', model: null},
+		{id: 'week', value: 1, label: '每周', model: 7},
+		{id: 'month', value: 2, label: '每月', model: 30},
+		{id: 'twoMonth', value: 3, label: '每两月', model: 60},
+		{id: 'quarter', value: 4, label: '每季度', model: 90},
+		{id: 'halfAYear', value: 5, label: '每半年', model: 180},
+		{id: 'custom', value: 6, label: '天', model: null},
 	];
 	export default {
 		data() {
 			return {
-				list, 
-				checkedItem: list[1], // 选中的取模方式对象
-				dateObj: { // 保存开始日期结束日期的对象
-					start: todayDate(),
-					end: '',
-					dayNum: 0 // 两个日期间隔的天数
-				}, 
-				checkList: [], // 核查计划数组
+				list
 			}
 		},
 		computed: {
 			...mapState({
 				showCheckPlan1: state => state.creatingSituations.showCheckPlan1,
+				checkPlan: state => state.creatingSituations.checkPlan,
 			}),
 			checkNumber: function() { // 查核频次
-				return this.checkList.length;
+				return this.checkPlan.checkList.length;
 			}
 		},
 		methods: {
 			checkModel: function(item) {
-				this.checkedItem = item;
+				this.myCommit('checkedItem', item);
 				this.createList();
 			},
 			/**
@@ -118,10 +112,13 @@
 			 * @param {Object} type 返回类型(start/end)
 			 */
 			changeDate: function(date, type) {
-				this.dateObj[type] = date.f1;
-				const {start, end} = this.dateObj;
+				let dateObj = {...this.checkPlan.dateObj};
+				dateObj[type] = date.f1;
+				this.myCommit('dateObj', dateObj);
+				const {start, end} = dateObj;
 				if(start && end) {
-					this.dateObj.dayNum = dateDiff(start, end);
+					dateObj.dayNum = dateDiff(start, end);
+					this.myCommit('dateObj', dateObj);
 					this.createList();
 				}
 			},
@@ -129,51 +126,65 @@
 			 * 构造计划列表
 			 */
 			createList: function() {
-				const { model } = this.checkedItem;
-				const {start, dayNum} = this.dateObj;
+				const { model } = this.checkPlan.checkedItem;
+				const {start, dayNum} = this.checkPlan.dateObj;
+				let checkList = [];
 				if(model && dayNum > 0) { // 确保前两步都做好了
 					let num = Math.floor(dayNum / model);
-					this.checkList = [start];
+					checkList = [start];
 					for(let i = 0; i < num - 1; i++) {
-						this.checkList[i+1] = getNewData(this.checkList[i], model);
+						checkList[i+1] = getNewData(checkList[i], model);
 					}
-				} else {
-					this.checkList = [];
 				}
+				this.myCommit('checkList', checkList);
 			},
 			/**
 			 * 已经生成的计划日期变化
 			 * @param {Object} date
 			 */
 			changeChildDate: function(date, index) {
-				let newList = this.checkList.slice(0, index); // 不包括index
+				let newList = this.checkPlan.checkList.slice(0, index); // 不包括index
 				newList[index] = date.f1;
-				const { model } = this.checkedItem;
+				const { model } = this.checkPlan.checkedItem;
 				let i = index;
 				// 判断下一个计划开始时间日期不能大于结束的前X(模)天
 				while(compare(this.endDate(), getNewData(newList[i], model))) { 
 					newList[i+1] = getNewData(newList[i], model);
 					i++;
 				}
-				this.checkList = newList;
+				this.myCommit('checkList', newList);
 			},
 			startTime: function() { // 限制只能从今天开始
 				return this.formateStartEnd(todayDate());
 			},
 			endDate: function() { // 获取能选择的最大日期,取结束日期的前模天
-				let day = -Number(this.checkedItem.model); // 使用负数能取前X天
-				return getNewData(this.dateObj.end, day);
+				let day = -Number(this.checkPlan.checkedItem.model); // 使用负数能取前X天
+				return getNewData(this.checkPlan.dateObj.end, day);
 			},
 			startDate: function(index) { // 子级能选择的最早开始时间
 				if(index > 0) {
-					let day = Number(this.checkedItem.model);
-					return this.formateStartEnd(getNewData(this.checkList[index - 1], day));
+					let day = Number(this.checkPlan.checkedItem.model);
+					return this.formateStartEnd(getNewData(this.checkPlan.checkList[index - 1], day));
 				} else {
 					return this.startTime();
 				}
 			},
 			formateStartEnd: function(str) {
 				return str + ' 00:00';
+			},
+			/**
+			 * 更新condition数据
+			 * @param {Object} key 要更新的属性
+			 * @param {Object} value 值
+			 */
+			myCommit: function(key, value) {
+				let data = {...this.checkPlan};
+				data[key] = value;
+				this.$store.commit({
+					type: 'creatingSituations/comChangeState', 
+					key: 'checkPlan', 
+					data
+				});
 			}
 		}
 	}

+ 9 - 1
pages/creatingSituations/components/checkRent.vue

@@ -55,10 +55,11 @@
 			...mapState({
 				checkRent: state => state.creatingSituations.checkRent,
 				condition: state => state.creatingSituations.condition,
+				needReload: state => state.creatingSituations.needReload,
 			})
 		},
 		created:function(){
-			if(this.checkRent.list.length === 0) {
+			if(this.needReload) { // 点击上一步不用获取数据
 				this.$store.dispatch({
 					type: 'creatingSituations/commActions',
 					key: 'checkGroupList',
@@ -74,7 +75,14 @@
 			},
 			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数据

+ 15 - 2
pages/creatingSituations/components/condition.vue

@@ -23,16 +23,19 @@
 		computed: {
 			...mapState({
 				condition: state => state.creatingSituations.condition,
+				needReload: state => state.creatingSituations.needReload,
 				theme: state => state.creatingSituations.theme
 			})
 		},
 		created: function(){
-			if(this.condition.options.length === 0)
+			if(this.needReload) // 点击上一步不用获取数据
 				this.getOptions(this.condition.depType);
 		},
 		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);
@@ -70,7 +73,7 @@
 			 * @param {Object} data
 			 */
 			optionsHandle: function(data) {
-				let options = data.map((item, i)=>{
+				let options = data.map((item)=>{
 					return {
 						...item,
 						key: item.id,
@@ -80,6 +83,16 @@
 				});
 				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 要更新的属性

+ 47 - 14
pages/creatingSituations/components/situationPreview.vue

@@ -4,46 +4,52 @@
 		<view class="box1">
 			<view class="row1">
 				<view class="top">
-					<text>主题:个案追踪</text>
-					<view>
+					<text>主题:{{theme.title}}</text>
+					<view @click="goMapList">
 						<text>查看查核地图</text>
 						<image src="../../../static/icon-blueMore.png"></image>
 					</view>
 				</view>
 				<view class="list">
-					<text>门诊</text>
-					<text>住院</text>
-					<text>ICU</text>
+					<text v-for="(item, index) in list" :key="index">{{item.name}}</text>
 				</view>
 			</view>
 			<view class="row2">
 				<view class="item">
 					<text>查核组</text>
-					<text>内科查核二组</text>
+					<text>{{checkRent.checkedItem.name}}</text>
 				</view>
 				<view class="item">
 					<text>组长</text>
-					<text>王晓雪</text>
+					<text>{{checkRent.checkedItem.groupManagerName}}</text>
 				</view>
 			</view>
 		</view>
 		<view class="box2">
 			<view>情景名称</view>
 			<view class="input-wrap">
-				<input placeholder="限2~16个中文、英文或数字" />
+				<input maxlength="16" 
+					v-model="situationPreview.sitName" 
+					placeholder="限2~16个中文、英文或数字" />
 			</view>
 		</view>
 		<view class="box2">
 			<view>
 				<text>计划开始前</text>
-				<input placeholder="请输入" type="number" />
+				<input v-model="situationPreview.preDay" 
+					placeholder="请输入" 
+					type="number" />
 				<text>天的</text>
-				<input placeholder="请输入" type="number" />
+				<input v-model="situationPreview.preH" 
+					placeholder="请输入" 
+					type="number" />
 				<text>时提醒</text>
 			</view>
 			<view>
 				<text>启动</text>
-				<input placeholder="请输入" type="number" />
+				<input v-model="situationPreview.startDay" 
+					placeholder="请输入" 
+					type="number" />
 				<text>天前提醒</text>
 			</view>
 		</view>
@@ -51,10 +57,37 @@
 </template>
 
 <script>
+	import { mapState } from "vuex";
 	export default {
-		data() {
-			return {
-				
+		computed: {
+			...mapState({
+				theme: state => state.creatingSituations.theme,
+				condition: state => state.creatingSituations.condition,
+				checkRent: state => state.creatingSituations.checkRent,
+				situationPreview: state => state.creatingSituations.situationPreview,
+			}),
+			list: function() {
+				const { conditionIds, options } = this.condition;
+				let list = [];
+				this.loopOptions(options, conditionIds, list);
+				return list;
+			}
+		},
+		methods: {
+			loopOptions: function(arr, conditionIds, list) {
+				arr.map((item)=>{
+					if(conditionIds.includes(item.id)) {
+						list.push(item);
+					}
+					if(item.children.length > 0) {
+						this.loopOptions(item.children, conditionIds, list);
+					}
+				});
+			},
+			goMapList: function() {
+				uni.navigateTo({
+					url: '/pages/checkMapList/checkMapList'
+				});
 			}
 		}
 	}

+ 1 - 0
pages/creatingSituations/components/theme.vue

@@ -44,6 +44,7 @@
 		methods: {
 			checkedHandle: function(item) {
 				this.myCommit('theme', item);
+				this.myCommit('needReload', true);
 				this.myCommit('stepActive', 1);
 			},
 			myCommit: function(key, data) {

+ 74 - 3
pages/creatingSituations/creatingSituations.vue

@@ -48,7 +48,7 @@
 					{id: 'condition', title: '条件', component: condition, hint: '追踪条件'},
 					{id: 'checkRent', title: '查核组', component: checkRent, hint: '查核组'},
 					{id: 'checkMap', title: '地图', component: checkMap, hint: '地图'},
-					{id: 'checkPlan', title: '计划', component: checkPlan, hint: '计划'},
+					{id: 'checkPlan', title: '计划', component: checkPlan, hint: '制定计划'},
 					{id: 'situationPreview', title: '预览', component: situationPreview},
 				]
 			}
@@ -59,8 +59,12 @@
 				showCheckMapAdd: state => state.creatingSituations.showCheckMapAdd,
 				showCheckPlan1: state => state.creatingSituations.showCheckPlan1,
 				stepActive: state => state.creatingSituations.stepActive,
+				theme: state => state.creatingSituations.theme,
 				condition: state => state.creatingSituations.condition,
 				checkRent: state => state.creatingSituations.checkRent,
+				checkMap: state => state.creatingSituations.checkMap,
+				checkPlan: state => state.creatingSituations.checkPlan,
+				situationPreview: state => state.creatingSituations.situationPreview,
 			}),
 			botmBtnGroup: function() {
 				if(this.stepActive === 4) {
@@ -77,10 +81,61 @@
 			}
 		},
 		methods: {
+			save: function() {
+				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: '温馨提示',
+						content: `情境名称不能为空!`,
+						showCancel: false
+					});
+					return;
+				}
+				this.dispatch('save', {
+					name: sitName,
+					topic: this.theme.id,
+					checkPlanStartDate: dateObj.start,
+					checkPlanEndDate: dateObj.end,
+					remindPlanDay: preDay,
+					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
+						}
+					}),
+					planConfig: {
+						frequency: checkedItem.value,
+						day: checkedItem.model,
+						startDate: dateObj.start,
+						endDate: dateObj.end,
+						num: checkList.length
+					},
+					planList: [...checkList].map((date, i)=>{
+						return {
+							startDate: date,
+							endDate: i === checkList.length - 1 ? dateObj.end : checkList[i+1]
+						}
+					})
+				}).then((data)=>{
+					if(data) {
+						
+					}
+				});
+			},
 			changeStep: function(id) {
 				switch(id) {
 					case 'pre': // 上一步
 						if(this.stepActive > 0) 
+							this.myCommit('needReload', false);
 							this.myCommit('stepActive', this.stepActive - 1);
 						break;
 					case 'next': // 下一步
@@ -93,6 +148,9 @@
 					case 'checkPlanCallback': // 生成查核计划-返回
 						this.myCommit('showCheckPlan1', true);
 						break;
+					case 'situationPreviewOK': // 完成
+						this.save();
+						break;
 				}
 			},
 			/**
@@ -109,8 +167,18 @@
 						let condition = this.checkRent.checkedItem.id !== null && points;
 						flage = this.errorHandle(condition, 2);
 						break;
+					case 4: 
+						const {checkList} = this.checkPlan;
+						flage = this.errorHandle(checkList.length > 0, 4);
+						break;
+					default: 
+						flage = true;
+						break;
 				}
-				if(flage) this.myCommit('stepActive', stepActive + 1);
+				if(flage) {
+					this.myCommit('needReload', true);
+					this.myCommit('stepActive', stepActive + 1);
+				} 
 			},
 			/**
 			 * 错误处理,满足条件返回true
@@ -131,7 +199,10 @@
 			},
 			myCommit: function(key, data) {
 				this.$store.commit({type: 'creatingSituations/comChangeState',key,data});
-			}
+			},
+			dispatch: function(key, data) {
+				return this.$store.dispatch({type: 'creatingSituations/commActions', key, data});
+			},
 		},
 		components: {
 			checkMapDetail,

+ 20 - 1
pages/creatingSituations/model.js

@@ -1,11 +1,13 @@
 import { commServer } from './server.js';
-
+	import {dateHandle} from "../../utils/dateHandle.js";
+	
 export default {
   namespaced: true,
   state: {
 		showCheckMapDetail: false,
 		showCheckMapAdd: false,
 		showCheckPlan1: true,
+		needReload: true, // 切换页面是否需要获取新数据
 		stepActive: 0, // 步骤进度
 		theme: {id: null, title: null, des: null}, // 主题选中数据(id: 0个案 1系统)
 		condition: { // 条件页面数据
@@ -20,6 +22,23 @@ export default {
 		},
 		checkMap: { // 查核地图数据
 			list: [], // 列表数据
+			actionItem: {id: '', pointList: []}, // 当前操作的列表项
+			deptList: [], // 新增单位数据
+		},
+		checkPlan: { // 查核计划
+			checkedItem: {id: 'month', value: 2, label: '每月', model: 30}, // 选中的取模方式对象
+			dateObj: { // 保存开始日期结束日期的对象
+				start: dateHandle.todayDate(),
+				end: '',
+				dayNum: 0 // 两个日期间隔的天数
+			}, 
+			checkList: [], // 核查计划数组
+		},
+		situationPreview: { // 预览
+			sitName: null,
+			preDay: null,
+			preH: null,
+			startDay: null
 		}
   },
   mutations: {

+ 16 - 0
pages/creatingSituations/server.js

@@ -17,6 +17,22 @@ const requestList = {
   checkDeptList: {
     method: 'POST',
     url: 'situation/checkDeptList',
+  },
+	// 地图新增单位树
+  deptList: {
+    method: 'GET',
+    url: 'common/deptList',
+  },
+	// 地图新增选择返回新增单位
+  addDeptList: {
+    method: 'POST',
+    url: 'situation/addDeptList',
+  },
+	// 情境新增保存
+  save: {
+    method: 'POST',
+    url: 'situation',
+		successMessage: '保存成功!'
   },
 };
 

+ 0 - 0
static/icon-xia-dis.png → static/icon-next-dis.png


+ 0 - 0
static/icon-xia.png → static/icon-next.png


+ 0 - 0
static/icon-shang-dis.png → static/icon-pre-dis.png


+ 0 - 0
static/icon-shang.png → static/icon-pre.png