Browse Source

查核列表

yuwenfen 4 years ago
parent
commit
a3333805d8

+ 14 - 0
pages.json

@@ -114,6 +114,20 @@
 				"navigationBarTitleText": "查核列表",
 				"enablePullDownRefresh": false
 			}
+    },
+		{
+			"path" : "pages/editCheckList/editCheckList",
+			"style" :	{
+				"navigationBarTitleText": "查核列表",
+				"enablePullDownRefresh": false
+			}
+    },
+		{
+			"path" : "pages/allocationPerson/allocationPerson",
+			"style" :	{
+				"navigationBarTitleText": "指派查核人员",
+				"enablePullDownRefresh": false
+			}
     }
   ],
 	"globalStyle": {

+ 240 - 0
pages/allocationPerson/allocationPerson.vue

@@ -0,0 +1,240 @@
+<template>
+	<view class="allocationPerson-page">
+		<scroll-view class="scroll-y" scroll-y="true">
+      <template v-if="title === '指派查核人员'">
+       	<tm-radio-group
+			    :list="empList"
+			   	:defaultValue='details.empId'
+			   	:setting="{
+			   	  value: 'employeeId',
+			   	  name: 'employeeName'
+			    }"
+          :openkeys="[0]"
+          @change="changeDetails"
+			  />
+      </template>
+      <template v-else>
+        <div class="date-view">
+          <view class="row">
+           	<text class="label">开始时间</text>
+						<view class="date-box">
+							<date-time-picker
+							  :height="100"
+                :start="details.planStartDate"
+                :end="details.planEndDate"
+								:defaultValue="details.startDate"
+								placeholder="请选择起始时间"
+                pickType="startDate"
+								@change="changeDateTime"
+							/>
+						</view>
+          </view>
+					<view class="row">
+           	<text class="label">结束时间</text>
+						<view class="date-box">
+							<date-time-picker
+							  :height="100"
+                :start="details.planStartDate"
+                :end="details.planEndDate"
+								:defaultValue="details.endDate"
+                placeholder="请选择结束时间"
+                pickType="endDate"
+								@change="changeDateTime"
+							/>
+						</view>
+          </view>
+        </div>
+      </template>
+		</scroll-view>
+		<view class="fixed-buttom-btn" @click="sure">
+			<text class="btn-text">确定</text>
+		</view>
+	</view>
+</template>
+
+<script>
+  // 查核列表编辑 查核人和计划时间
+  import { mapState } from "vuex";
+  import moment from 'moment';
+	export default {
+    computed: {
+      ...mapState({
+        checkList: state => state.editCheckList.checkList
+      })
+    },
+		data(){
+			return {
+        title: '', // 导航标题
+        // 查核组员列表
+        empList: [],
+        // 组件信息
+        details: {},
+        // 服务器时间
+        dateStr: '',
+        timer: null,
+			}
+    },
+    onLoad({ details }){
+      const _details = details ? JSON.parse(details) : {};
+      // 强制刷新返回查核列表页面
+      if(getCurrentPages().length === 1){
+        const {situationId, checkId, checkGroupId, planStartDate, planEndDate} = _details;
+        uni.redirectTo({
+          url: `/pages/editCheckList/editCheckList?situationId=${situationId}&checkId=${checkId}&checkGroupId=${checkGroupId}&startDate=${planStartDate}&endDate=${planEndDate}`
+        });
+      }
+      this.getComponentInfo(_details);
+    },
+    watch: {
+      title(newVal, oldVal){
+        if(newVal === '设置查核时间'){
+          this.getDateStr();
+          !this.timer && (this.timer = setInterval(() => {
+            this.getDateStr();
+          }, 10000));
+        }else {
+          this.clearTimer();
+        }
+      }
+    },
+    destroyed() {
+      this.clearTimer();
+    },
+    methods: {
+      getComponentInfo(details) {
+        this.setNavigationBarTitle(details.title);
+        this.details = details;
+        this.getEmpDeptTree(details.checkGroupId);
+      },
+      // 查询部门人员树
+			getEmpDeptTree(checkGroupId) {
+				this.$store.dispatch({
+					type: 'allocationPerson/commActions',
+          key: "getGroupEmpList",
+          data: {checkGroupId}
+				}).then(data => {
+					if(data) {
+            this.empList = data || [];
+          }
+				});
+      },
+      // 指派查核人员改变
+      changeDetails(selectVal, selectData, index) {
+        this.details = {
+          ...this.details,
+          empId: selectData.employeeId,
+          empName: selectData.employeeName
+        }
+      },
+			// 时间变化
+			changeDateTime(dateObj, pickType) {
+        if(pickType === 'startDate'){ // 开始时间变化
+          this.diffDateTime(dateObj.f3, this.details.endDate);
+        }else {
+          this.diffDateTime(this.details.startDate, dateObj.f3);
+        }
+        this.details = {
+          ...this.details,
+          [pickType]: dateObj.f3
+        };
+      },
+      // 开始时间和结束时间对比
+      diffDateTime(startTime, endTime){
+        if (moment(startTime).valueOf() > moment(endTime).valueOf()) {
+          uni.showModal({
+            content: '开始时间不能大于结束时间',
+            showCancel: false
+          });
+        }
+      },
+      // 点击确定
+      sure() {
+        if(this.title === '指派查核人员'){
+          this.setNavigationBarTitle('设置查核时间');
+        }else {
+          this.changeCheckList(this.checkList);
+        }
+      },
+      // 更改查核列表数据
+      changeCheckList(data) {
+        const { situationId, checkId, checkGroupId } = this.details;
+        let checkList = this.checkList.map((item, i) => {
+          if(this.details.index === i) {
+            return {
+              ...item,
+              ...this.details
+            }
+          }else {
+            return item;
+          }
+        });
+        this.$store.commit({
+          type: 'editCheckList/comChangeState',
+          key: 'checkList',
+          data: checkList
+        });
+        // 关闭当前页面,返回上一页面
+        uni.navigateBack({delta: 1});
+      },
+      // 修改导航名称
+      setNavigationBarTitle(title) {
+        this.title = title;
+        uni.setNavigationBarTitle({
+			  	title
+        });
+      },
+     // 获取当前时间
+      getDateStr() {
+        this.$store.dispatch({
+          type: "commActions",
+           key: "getDateStr" ,
+        }).then((data) => {
+          if (data) {
+            this.dateStr = data;
+          }
+        });
+      },
+      // 清除定时器
+      clearTimer(){
+        if(this.timer){
+          clearInterval(this.timer);
+          this.timer = null;
+        }
+      }
+    },
+	}
+</script>
+
+<style lang="less">
+	.allocationPerson-page {
+		height: 100%;
+
+		.scroll-y {
+			height: calc(100% - 87.5rpx);
+      padding-top: 15rpx;
+
+       .date-view {
+         padding: 0 25rpx;
+         background: #fff;
+
+				 .row {
+					 display: flex;
+					 align-items: center;
+					 height: 62.5rpx;
+					 border-top: 0.62rpx solid #DADEE6;
+
+					 	.label {
+							width: 112.5rpx;
+							font-size: 22.5rpx;
+							color: #292C33;
+						}
+
+						.date-box {
+							padding-left: 25rpx;
+							flex: 1;
+						}
+				 }
+			 }
+		}
+	}
+</style>

+ 17 - 0
pages/allocationPerson/model.js

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

+ 14 - 0
pages/allocationPerson/server.js

@@ -0,0 +1,14 @@
+import { creatRequest } from '../../utils/request.js';
+
+const requestList = {
+  // 查核组员列表
+  getGroupEmpList: {
+    method: 'GET',
+    url: 'common/groupEmpList'
+  }
+};
+
+export const commServer = (key, data) => {
+  let obj = requestList[key];
+  return creatRequest(obj, data);
+}

+ 212 - 0
pages/editCheckList/editCheckList.vue

@@ -0,0 +1,212 @@
+<template>
+	<view class="check-map-list">
+		<view class="item"
+			v-for="(item, index) in checkList"
+			: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">
+			 <view class="row" @click="checkEdit(item, index, '指派查核人员')">
+			 	 <text class="label">查核人</text>
+				 <view class="content">
+				 	 <text :class="['base-text', item.empName ? 'black-color' : '']">
+						 {{ item.empName ? item.empName : '选择查核成员'}}
+					 </text>
+				 </view>
+				 <image class="arrow" src="/static/images/icon-more.png"></image>
+			 </view>
+			 <view class="row" @click="checkEdit(item, index, '设置查核时间')">
+			 	 <text class="label">计划时间</text>
+				 <view class="content">
+				 	 <text :class="['base-text', item.startDate ? 'black-color' : '']">
+					   {{ item.startDate ? item.startDate : '选择起始时间' }}
+					 </text>
+				 	 <text class="center-text">至</text>
+					 <text :class="['base-text', item.endDate ? 'black-color' : '']">
+					   {{ item.endDate ? item.endDate : '选择结束时间' }}
+					 </text>
+				 </view>
+				 <image class="arrow" src="/static/images/icon-more.png"></image>
+			 </view>
+			</view>
+		</view>
+		<!-- <view class="null" v-if="checkList.length === 0">暂无数据</view> -->
+	</view>
+</template>
+
+<script>
+  // 查核列表(查核人和计划时间可编辑)
+  import { mapState } from "vuex";
+  import moment from 'moment';
+	export default {
+    computed: {
+      ...mapState({
+        checkList: state => state.editCheckList.checkList
+      })
+    },
+		data() {
+			return {
+        // 查核组id
+        checkGroupId: 0,
+        // 情境id (批量修改有,不然为0)
+        situationId: 0,
+        // 查核id
+        checkId: 0,
+        // 计划开始时间
+        startDate: '',
+        // 计划结束时间
+        endDate: ''
+			};
+		},
+    onLoad({ situationId, checkId, checkGroupId, startDate, endDate }){
+      console.log(99999)
+      this.getCheckList(checkId);
+      this.checkGroupId = checkGroupId;
+      this.situationId = situationId;
+      this.checkId = checkId;
+      this.startDate = startDate;
+      this.endDate = endDate;
+    },
+		methods: {
+      checkEdit(data, index, title) {
+        if(data.startDate){ // 分配开始时间有,需要与当前时间做对比
+          this.$store.dispatch({
+            type: "commActions",
+            key: "getDateStr" ,
+          }).then((dateStr) => {
+            if(dateStr) {
+              if (moment(data.startDate).valueOf() > moment(dateStr).valueOf()) { // 弹窗提示
+                uni.showModal({
+                  content: '因查核计划已开始,故不可修改',
+                  showCancel: false
+                });
+              }else {
+                this.gotoAllocationPerson(data, index, title);
+              }
+            }
+          });
+        }else {// 跳转编辑页面
+          this.gotoAllocationPerson(data, index, title);
+        }
+      },
+			// 打开人员列表页面
+			gotoAllocationPerson(data, index, title) {
+        let details = {
+          index, // 修改的下标
+          title, // 标题
+          situationId: this.situationId,
+          checkId: this.checkId,
+          checkGroupId: this.checkGroupId,
+          planStartDate: this.startDate + ' 00:00',
+          planEndDate: this.endDate + ' 23:59',
+          empId: data.empId,
+          empName: data.empName,
+          startDate: data.startDate,
+          endDate: data.endDate
+        }
+        uni.navigateTo({
+				   url: `/pages/allocationPerson/allocationPerson?details=${encodeURIComponent(JSON.stringify(details))}`
+				});
+			},
+			// 打开日期选择页面
+			openDatePickPage(data) {
+
+      },
+      // 获取查核列表
+      getCheckList(checkId) {
+        this.$store.dispatch({
+          type: 'editCheckList/commActions',
+          key: "getCheckList",
+          data: { checkId }
+        }).then(data => {
+          this.$store.commit({
+            type: 'editCheckList/comChangeState',
+            key: 'checkList',
+            data: data || []
+          })
+        });
+      },
+      // 获取当前时间
+      getDateStr() {
+        this.$store.dispatch({
+          type: "commActions",
+           key: "getDateStr" ,
+        }).then((data) => {
+          if (data) {
+            console.log(8, data)
+          }
+        });
+      },
+		}
+	}
+</script>
+
+<style lang="less">
+	.check-map-list {
+		padding: 25rpx;
+
+		.footer {
+
+			.row {
+				display: flex;
+				align-items: center;
+				justify-content: space-between;
+				border-top: 1px solid #DADEE6;
+				height: 62.5rpx;
+				padding: 0 25rpx;
+				font-size: 22.5rpx;
+
+				.label {
+					color: #525866;
+					width: 93.75rpx;
+				}
+
+				.content {
+					display: flex;
+					flex-direction: row;
+					align-items: center;
+					flex: 1;
+					height: 100%;
+					padding: 0 25rpx;
+
+					.base-text {
+						flex: 1;
+						line-height: 62.5rpx;
+						color: #B8BECC;
+						font-weight: normal;
+					}
+
+					.center-text {
+						padding: 0 25rpx;
+						color: #292C33;
+					}
+
+					.black-color {
+						color: #292C33;
+					}
+				}
+
+				.arrow {
+					width: 12.5rpx;
+					height: 21.25rpx;
+				}
+			}
+		}
+
+		.null {
+			text-align: center;
+			color: #999;
+		}
+	}
+</style>

+ 19 - 0
pages/editCheckList/model.js

@@ -0,0 +1,19 @@
+import { commServer } from './server.js';
+
+export default {
+  namespaced: true,
+  state: {
+     // 查核列表
+     checkList: []
+  },
+  mutations: {
+		comChangeState(state, {key, data}) {
+			state[key] = data;
+		},
+  },
+  actions: {
+		commActions({ commit, state }, { key, data }) {
+      return commServer(key, data);
+		},
+  }
+}

+ 19 - 0
pages/editCheckList/server.js

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

+ 5 - 1
pages/model.js

@@ -11,6 +11,8 @@ import calendar from './calendar/model.js';
 import todayCheck from './todayCheck/model.js';
 import planList from './planList/model.js';
 import checkList from "./checkList/model.js";
+import editCheckList from './editCheckList/model.js';
+import allocationPerson from './allocationPerson/model.js'
 
 export default module = {
   login,
@@ -26,5 +28,7 @@ export default module = {
   situationDetail,
   creatingSituations,
 	planList,
-	checkList
+  checkList,
+  editCheckList,
+  allocationPerson
 }

+ 21 - 17
pages/planList/planList.vue

@@ -1,7 +1,7 @@
 <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="item-box" v-for="(item,index) in planList" @click="gotoCheckList(false,item)">
 				<view class="row1">
 					<text class="title">{{item.name}}</text>
 					<view class="compeleted-box" v-if="item.isCompeleted">
@@ -17,7 +17,7 @@
 				</view>
 			</view>
 		</scroll-view>
-		<view class="btn-distribution" @click="gotoCheckList" v-if="isShowDistribution">
+		<view class="btn-distribution" @click="gotoCheckList(true, planList[0])" v-if="isShowDistribution">
 			<text class="btn-text">批量分配</text>
 		</view>
 	</view>
@@ -30,12 +30,14 @@
 				situationID:'',//情境id
 				planList:[],//计划列表
 				firstFlag:1,//是否为第一次分配的标志,为1时表示是第一次,弹框提示
-				isShowDistribution:true,//是否显示批量分配按钮
-				listHeight:1125,//列表高度
+				isShowDistribution:false,//是否显示批量分配按钮
+        listHeight:1125,//列表高度
+        checkGroupId: 0 // 查核组id
 			}
 		},
-		onLoad({ situationId }){ // situationId:情景id
-		  this.situationID=situationId;
+		onLoad({ situationId, checkGroupId }){ // situationId:情景id checkGroupId: 查核组id
+      this.situationID=situationId;
+      this.checkGroupId = checkGroupId;
 		},
 		created: function() {
 			this.$store.dispatch({
@@ -48,14 +50,10 @@
 				}
 			}).then((data) => {
 				if (data) {
-					this.planList=data.map((item,index)=>{	
+					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,
@@ -83,15 +81,21 @@
 				let startDate=time.replace(/-/g,"/");
 				startDate=Date.parse(startDate);
 				if(myDate>startDate){
-					return false;
+          this.listHeight=1200;
 				}else{
-					return true;
+          this.isShowDistribution=true;
 				}
-			},
-			gotoCheckList(){
+      },
+    	/**
+			* 跳转页面-查核列表
+			* @param {Boolean} type 是否批量编辑
+			* @param {Number} checkId 查核id
+			*/
+			gotoCheckList(type, currentObj){
+        const { id, startDate, endDate } = currentObj;
 				//跳转到查核列表
 				uni.navigateTo({
-					url: `/pages/checkList/checkList?situationId=${this.situationID}`
+					url: `/pages/editCheckList/editCheckList?situationId=${type ? this.situationID : 0}&checkId=${id}&checkGroupId=${this.checkGroupId}&startDate=${startDate}&endDate=${endDate}`
 				});
 			}
 		}
@@ -179,7 +183,7 @@
 			background: #3377FF;
 			position: fixed;
 			bottom: 0rpx;
-		
+
 			.btn-text {
 				font-size: 22.5rpx;
 				font-family: SourceHanSansCN-Normal, SourceHanSansCN;

+ 10 - 7
pages/situationDetail/situationDetail.vue

@@ -82,8 +82,9 @@
 				isUnplanned:false,//是否计划外查核
 				checkFlag:'',//计划查核标志,是新建还是提前开始
 				checkID:'',//新建查核计划时,计划列表中的前一个计划 id
-				checkItemList:[],//时间区间包含当前时间的item
-				
+        checkItemList:[],//时间区间包含当前时间的item
+        checkGroupId: 0 // 查核组id
+
 			}
 		},
 		onLoad({ situationId }){ // situationId:情景id
@@ -107,6 +108,7 @@
 				}
 			}).then((data) => {
 				if (data) {
+          console.log(9, data)
 					this.name=data.name;
 					this.startDate=data.startDate;
 					this.endDate=data.endDate;
@@ -117,7 +119,8 @@
 					this.startEndTime=data.startEndTime;
 					this.planCount=data.planCount;
 					this.toDistribute=data.toDistribute;
-					this.firstCheckTime=data.firstCheckTime;
+          this.firstCheckTime=data.firstCheckTime;
+          this.checkGroupId = data.checkGroupId;
 				}
 			});
 		},
@@ -151,7 +154,7 @@
 						}
 					}
 				})
-				
+
 			},
 			editSituation(){
 				let editEnable=this.compareTime(this.firstCheckTime);
@@ -193,7 +196,7 @@
 			gotoPlanPage(){
 				//跳转到计划列表
 				uni.navigateTo({
-					url: `/pages/planList/planList?situationId=${this.situationID}`
+					url: `/pages/planList/planList?situationId=${this.situationID}&checkGroupId=${this.checkGroupId}`
 				});
 			},
 			startUnplanned(){
@@ -234,7 +237,7 @@
 							if(data){
 								this.gotoCheckPage();
 							}
-							
+
 						});
 					}
 				});
@@ -269,7 +272,7 @@
 						line-height: 35rpx;
 					}
 				}
-				
+
 				.name-text{
 					font-size: 40rpx;
 					font-family: SourceHanSansCN-Normal, SourceHanSansCN;

+ 4 - 1
store/actions.js

@@ -1,3 +1,6 @@
+import { commServer } from './server.js';
 export const actions = {
-	
+  commActions({ commit, state }, { key, data }) {
+    return commServer(key, data);
+  },
 }

+ 14 - 0
store/server.js

@@ -0,0 +1,14 @@
+import { creatRequest } from '../utils/request.js';
+
+const requestList = {
+  // 获取服务器时间
+  getDateStr: {
+    method: 'GET',
+    url: 'common/time'
+  }
+};
+
+export const commServer = (key, data) => {
+  let obj = requestList[key];
+  return creatRequest(obj, data);
+}