Browse Source

Merge branch 'master' of ssh://1582597470426922.onaliyun.com@s1.nsloop.com:29418/web_TracerMethodology

yuwenfen 4 năm trước cách đây
mục cha
commit
96dee8b97c

+ 24 - 2
components/tm-check-map-list/tm-check-map-list.vue

@@ -8,7 +8,7 @@
 			</view>
 		</view>
 		<view class="content">
-			<text>包含{{item.pointCount || 0}}个查核要点,{{item.itemCount || 0}}个查核项目</text>
+			<text>包含{{pointCount}}个查核要点,{{itemCount}}个查核项目</text>
 			<text>
 				要点概览:
 				<text v-for="(point, c) in item.pointList" :key="c">
@@ -21,6 +21,28 @@
 
 <script>
 	export default {
-		props: ['item']
+		props: ['item'],
+		computed: {
+			pointCount: function() {
+				let num = 0;
+				(this.item.pointList || []).map(({selectFlag})=>{
+					if(selectFlag || selectFlag === 'true') {
+						num++;
+					}
+				})
+				return num;
+			},
+			itemCount: function() {
+				let num = 0;
+				(this.item.pointList || []).map(({itemList})=>{
+					itemList.map(({selectFlag})=>{
+						if(selectFlag || selectFlag === 'true') {
+							num++;
+						}
+					});
+				});
+				return num;
+			}
+		}
 	}
 </script>

+ 1 - 1
pages/checkList/checkList.vue

@@ -25,7 +25,7 @@
 			</view>
 			<view class="footer">
 				<text>查核人:{{item.empName}}</text>
-				<text>
+				<text v-if="item.startDate && item.endDate">
 					{{item.startDate}}~{{item.endDate}}
 				</text>
 			</view>

+ 29 - 8
pages/creatingSituations/components/checkMapAdd.vue

@@ -45,7 +45,12 @@
 			...mapState({
 				checkMap: state => state.creatingSituations.checkMap,
 				condition: state => state.creatingSituations.condition,
-			})
+			}),
+			isDisabled: function() {
+				return function(id) {
+					return this.checkMap.list.find((item)=>item.id === id);
+				}
+			}
 		},
 		created:function(){
 			if(this.checkMap.deptList.length === 0) {
@@ -58,6 +63,7 @@
 		},
 		methods: {
 			changeChecked: function(id) {
+				if(this.isDisabled(id)) return;
 				this.checkedIds = arrFilter(id, this.checkedIds);
 			},
 			btnClick: function(id) {
@@ -66,20 +72,35 @@
 						if(data) {
 							const {list, actionItem} = this.checkMap;
 							let arr = [...this.checkMap.list];
-							data = data.map((item)=>{
-								return {
-									...item,
-									status: 'add'
-								}
-							});
+							let _data = this.checkDep(data);
 							let index = list.findIndex(({id})=> id === actionItem.id);
-							arr.splice(index + 1, 0, ...data);
+							arr.splice(index + 1, 0, ..._data);
 							this.myCommit('list', arr);
 						}
 					});
 				}
 				this.commit('showCheckMapAdd', false);
 			},
+			checkDep: function(list) {
+				return list.map((item, i)=>{
+					return {
+						...item,
+						status: 'add',
+						pointList: (item.pointList || []).map((ptem)=>{
+							return {
+								...ptem,
+								selectFlag: true,
+								itemList: (ptem.itemList || []).map((ntem)=>{
+									return {
+										...ntem,
+										selectFlag: true
+									}
+								})
+							}
+						})
+					}
+				});
+			},
 			/**
 			 * 更新condition数据
 			 * @param {Object} key 要更新的属性

+ 5 - 2
pages/creatingSituations/components/checkMapDetail.vue

@@ -9,7 +9,7 @@
 				<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="child-text">{{child.name}}</view>
 						<view class="check-icon-wrap" 
 							@click="changeChecked(index, n, child.selectFlag)">
 							<image :src="`../../static/check-${child.selectFlag
@@ -42,7 +42,7 @@
 				];
 			},
 			...mapState({
-				checkMap: state => state.creatingSituations.checkMap,
+				checkMap: state => JSON.parse(JSON.stringify(state.creatingSituations.checkMap)),
 			}),
 			selectedNum: function() {
 				let num = 0;
@@ -139,6 +139,9 @@
 						align-items: center;
 						border-top: 1px solid #DADEE6;
 						min-height: 87.5rpx;
+						.child-text {
+							width: calc(100% - 75rpx);
+						}
 						.check-icon-wrap {
 							display: flex;
 							flex-direction: row;

+ 28 - 9
pages/creatingSituations/components/checkPlan.vue

@@ -23,8 +23,8 @@
 				<view>
 					<date-time-pick-group fields="day" 
 						:startTime="startTime()"
-						:startSelectValue="checkPlan.dateObj.start"
-						:endSelectValue="checkPlan.dateObj.end"
+						:startSelectValue="start"
+						:endSelectValue="end"
 						v-on:changeDate="changeDate"></date-time-pick-group>
 					<image src="../../../static/incon-more.png"></image>
 				</view>
@@ -46,7 +46,7 @@
 						<date-time-picker fields="day"
 							placeholder="请选择结束日期"
 							pickType="end"
-							:start="startTime()"
+							:start="checkPlan.dateObj.start"
 							:defaultValue="checkPlan.dateObj.end"
 							v-on:change="changeDate"></date-time-picker>
 						<image src="../../../static/incon-more.png"></image>
@@ -83,7 +83,9 @@
 	export default {
 		data() {
 			return {
-				list: checkPlanList
+				list: checkPlanList,
+				start: todayDate(),
+				end: ''
 			}
 		},
 		computed: {
@@ -95,6 +97,11 @@
 				return this.checkPlan.checkList.length;
 			}
 		},
+		created: function() {
+			const {start,end} = this.checkPlan.dateObj;
+			this.start = start;
+			this.end = end;
+		},
 		methods: {
 			checkModel: function(item) {
 				this.myCommit('checkedItem', item);
@@ -106,14 +113,26 @@
 			 * @param {Object} type 返回类型(start/end)
 			 */
 			changeDate: function(date, type) {
-				let dateObj = {...this.checkPlan.dateObj};
+				let dateObj = JSON.parse(JSON.stringify(this.checkPlan.dateObj));
 				dateObj[type] = date.f1;
-				this.myCommit('dateObj', dateObj);
+				this[type] = date.f1;
 				const {start, end} = dateObj;
 				if(start && end) {
-					dateObj.dayNum = dateDiff(start, end);
-					this.myCommit('dateObj', dateObj);
-					this.createList();
+					let num = dateDiff(start, end);
+					if(num >= 0) {
+						dateObj.dayNum = num + 1; // 开始的那天也要算
+						this.myCommit('dateObj', dateObj);
+						this.createList();
+					} else {
+						uni.showModal({
+						  title: '错误提示',
+						  content: '开始日期必须小于结束日期!',
+						  showCancel: false,
+							success: () => {
+								this[type] = this.checkPlan.dateObj[type];
+							}
+						});
+					}
 				}
 			},
 			/**

+ 1 - 1
pages/planList/planList.vue

@@ -122,7 +122,7 @@
 	.planList-page{
 		height: 100%;
 		.list-box{
-			// height: 1125rpx;
+			padding-bottom: 80rpx;
 			.item-box{
 				width: 100%;
 				height: 125rpx;

+ 1 - 0
pages/situationDetail/components/bottom-popup.vue

@@ -116,6 +116,7 @@
 		position: fixed;
 		top: 0rpx;
 		left: 0rpx;
+		z-index: 10001;
 		// background: rgba(0,0,0,0.5);
 		background-color: #FFFFFF;
 		.popup-box{

+ 32 - 22
pages/situationDetail/situationDetail.vue

@@ -1,6 +1,6 @@
 <template>
 	<view class="detail-page">
-		<tm-top-menu>
+		<tm-top-menu v-if="isAdmin">
 			<button class="copy-btn" @click="editSituation('POST')">复制创建</button>
 		</tm-top-menu>
 		<view class="content-info">
@@ -39,19 +39,19 @@
 			</view>
 		</view>
 		<view class="button-box">
-			<view class="btn-left" @click="delSituation" v-show="isAdmin">
+			<view class="btn-left btn-item" @click="delSituation" v-show="isAdmin">
 				<text class="left-text">作废</text>
 			</view>
-			<view class="btn-right" @click="editSituation('PUT')" v-show="isAdmin">
+			<view class="btn-right btn-item" @click="editSituation('PUT')" v-show="canEdit">
 				<text class="right-text">编辑</text>
 			</view>
-			<view class="btn-center" v-show="isChecker" @click="startUnplanned">
+			<view class="btn-center btn-item" v-show="isChecker" @click="startUnplanned">
 				<text class="center-text">开始一次计划外查核</text>
 			</view>
-			<view class="btn-left" v-show="isUnplanned" @click="createCheck">
+			<view class="btn-left btn-item" v-show="isUnplanned" @click="createCheck">
 				<text class="left-text">新建一个计划外查核</text>
 			</view>
-			<view class="btn-right" v-show="isUnplanned" @click="startCheck">
+			<view class="btn-right btn-item" v-show="isUnplanned" @click="startCheck">
 				<text class="right-text">提前开始一个计划内查核</text>
 			</view>
 		</view>
@@ -86,7 +86,12 @@
 				checkFlag:'',//计划查核标志,是新建还是提前开始
 				checkID:'',//新建查核计划时,计划列表中的前一个计划 id
         checkItemList:[],//时间区间包含当前时间的item
-        checkGroupId: 0 // 查核组id
+        checkGroupId: 0, // 查核组id
+			}
+		},
+		computed: {
+			canEdit: function() {
+				return this.compareTime(this.firstCheckTime) && this.isAdmin;
 			}
 		},
 		onLoad({ situationId }){ // situationId:情景id
@@ -105,7 +110,7 @@
 				payload: {
 					key: 'situationDetail',
 					data:{
-						id:this.situationID
+						id: this.situationID
 					}
 				}
 			}).then((data) => {
@@ -161,15 +166,15 @@
 				let url=`/pages/creatingSituations/creatingSituations?id=${this.situationID}&type=${type}`;
 				if(type === 'PUT') {
 					let editEnable=this.compareTime(this.firstCheckTime);
-					// if(editEnable){
+					if(editEnable){
 						uni.navigateTo({url});
-					// } else{
-					// 	uni.showModal({
-					// 		title:'提示',
-					// 		content:'已进行过一次查核,不可编辑',
-					// 	  showCancel:false
-					// 	})
-					// }
+					} else{
+						uni.showModal({
+							title:'提示',
+							content:'已进行过一次查核,不可编辑',
+						  showCancel:false
+						})
+					}
 				} else {
 					uni.navigateTo({url});
 				}
@@ -451,10 +456,15 @@
 			}
 		}
 		.button-box{
+			display: flex;
+			flex-direction: row;
 			width: 750rpx;
 			height: 75rpx;
 			position: fixed;
 			bottom: 0;
+			.btn-item {
+				flex: 1;
+			}
 			.btn-center{
 				background: #3377FF;
 				text-align: center;
@@ -467,10 +477,10 @@
 				}
 			}
 			.btn-left{
-				width: 375rpx;
-				height: 75rpx;
+				// width: 375rpx;
+				// height: 75rpx;
 				background: #FFFFFF;
-				float: left;
+				// float: left;
 				text-align: center;
 				border: 0.62rpx solid #DADEE6;
 				.left-text{
@@ -482,10 +492,10 @@
 				}
 			}
 			.btn-right{
-				width: 375rpx;
-				height: 75rpx;
+				// width: 375rpx;
+				// height: 75rpx;
 				background: #3377FF;
-				float: right;
+				// float: right;
 				text-align: center;
 				.right-text{
 					font-size: 22.5rpx;

+ 1 - 1
utils/dateHandle.js

@@ -34,7 +34,7 @@ export const dateHandle = {
 		oDate1 = dateHandle.createDate(sDate1);
 		oDate2 = dateHandle.createDate(sDate2);
 		//把相差的毫秒数转换为天数  
-		iDays  =  parseInt(Math.abs(oDate1 - oDate2) / 1000 / 60 / 60 / 24);
+		iDays  =  parseInt((oDate2 - oDate1) / 1000 / 60 / 60 / 24);
 		return  iDays;  
 	},
 	/**