Browse Source

外勤打卡选择类型传参

wgl 4 years ago
parent
commit
2fc8662ae2
1 changed files with 43 additions and 3 deletions
  1. 43 3
      src/projects/business/views/Master/Attendance/Sign.vue

+ 43 - 3
src/projects/business/views/Master/Attendance/Sign.vue

@@ -8,8 +8,8 @@
 				<form class="mui-input-group">
 					<div class="mui-input-row">
 						<label><span class="colorfe616c">*</span>考勤类型</label>
-						<div class="mui-navigate-right">
-							<button class="mui-btn mui-btn-block" type='button'>出差</button>
+						<div class="mui-navigate-right" @click="selectType">
+							<button class="mui-btn mui-btn-block" type='button' v-text="attendanceTypeName"></button>
 						</div>
 					</div>
 				</form>
@@ -86,8 +86,9 @@
 				isLoading: false,
 
 				subForm: {
-					workAttendanceId: ''
+					workAttendanceId: '',
 				},
+				attendanceType: '3',
 				tjForm: {
 					alarmConfigId: '',
 					workAttendanceDate: '',
@@ -112,6 +113,16 @@
 					style: 'font-size:14px;color:#000;',
 					title: '考勤记录'
 				},
+
+				typeStatusList: [{
+						value: '2',
+						text: '外出'
+					},
+					{
+						value: '3',
+						text: '出差'
+					}
+				],
 			}
 		},
 		created() {
@@ -120,6 +131,7 @@
 		methods: {
 			//获取详情
 			getTime() {
+				this.subForm.attendanceType = this.attendanceType;
 				this.isLoading = true;
 				API_Attendance.patchCard(this.subForm).then(response => {
 
@@ -227,6 +239,7 @@
 			},
 			//提交
 			submit() {
+				this.tjForm.attendanceType = this.attendanceType;
 				this.tjForm.photoFile = this.picList.join(',');
 				if (this.tjForm.address == '定位中……') {
 					this.tjForm.address = '';
@@ -293,6 +306,18 @@
 					console.log(error)
 				})
 			},
+			//选择考勤类型
+			selectType() {
+				var _this = this;
+				var picker = new mui.PopPicker();
+				picker.setData(_this.typeStatusList);
+				picker.pickers[0].setSelectedValue(this.attendanceType);
+				picker.show(function(selectItems) {
+					_this.attendanceType = selectItems[0].value;
+					//_this.approvalPersonName = selectItems[0].text;
+					_this.getTime();
+				})
+			},
 			//右上角点击事件
 			doRightLink() {
 				this.$router.push({
@@ -349,6 +374,21 @@
 					console.log(newValue)
 				}
 			},
+			attendanceTypeName: {
+				// getter
+				get: function() {
+					for (var i = 0; i < this.typeStatusList.length; i++) {
+						if (this.typeStatusList[i]['value'] == this.attendanceType) {
+							return this.typeStatusList[i]['text'];
+						}
+					}
+					return '';
+				},
+				// setter
+				set: function(newValue) {
+					console.log(newValue)
+				}
+			},
 			...mapGetters({
 				openId: 'wx_openid',
 				token: 'token',