zouling преди 4 месеца
родител
ревизия
029560d493
променени са 6 файла, в които са добавени 147 реда и са изтрити 38 реда
  1. 7 1
      api/work/check.js
  2. 1 1
      permission.js
  3. 23 4
      work/components/clock/cardlist.vue
  4. 48 8
      work/pages/clock/clock.vue
  5. 13 3
      work/pages/clock/kaorules.vue
  6. 55 21
      work/pages/clock/setswork.vue

+ 7 - 1
api/work/check.js

@@ -123,7 +123,13 @@ export function getXiuconfig(data) {
 	data:data
   })
 }
-
+//删除考勤配置system:schedule:remove
+export function getXiuconfigDel(data) {
+  return request({
+    url: '/system/schedule/delete/'+data,
+    method: 'get',
+  })
+}
 // //获取部门用户列表
 // export function getsubordinateList(data) {
 //   return request({

+ 1 - 1
permission.js

@@ -5,7 +5,7 @@ const loginPage = "/pages/login"
   
 // 页面白名单
 const whiteList = ['/pages/mine/pwd/resetpwd','/pages/mine/pwd/forgetpwd','/pages/order/notice','/pages/order/search','/a/code',
-  '/pages/login', '/pages/register', '/pages/common/webview/index','/pages/agreement','/pages/order/come','/pages/order/comedetail',
+  '/pages/login', '/pages/register', '/pages/common/webview/index','/pages/agreement','/pages/order/come','/pages/order/face','/pages/order/comedetail',
 ]
 
 // 检查地址白名单

+ 23 - 4
work/components/clock/cardlist.vue

@@ -131,10 +131,11 @@
 		</block>
 		<!-- 考勤规则 -->
 		<block v-if="type=='rule'">
-		<view class="clist" v-for="(ite,idx) in datainfo" :key="idx" style="padding-left: 20rpx;padding-rignt:20rpx"> 
+		<view class="clist" v-for="(ite,idx) in datainfo" :key="idx" style="padding-left: 20rpx;padding-rignt:20rpx" @click="getDetail(ite.dutyId)"> 
 			<view class="flexc">
-				<view class="tit flex1">{{ite.locations}}</view>
-				<view class="clistr" @click="getDetail(ite.dutyId)">
+				<view class="tit flex1" v-if="ite.isEquip=='Y'">打卡机使用</view>
+				<view class="tit flex1" v-else>{{ite.locations}}</view>
+				<view class="clistr" v-if="checkPermi(['system:schedule:remove'])" @click.stop="getDelFn(ite.dutyId)">
 					<image :src="updataimg"></image>
 				</view>
 			</view>
@@ -230,6 +231,7 @@
 </template>
 
 <script>
+	import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
 	export default{
 		props:{
 			datainfo: {
@@ -278,12 +280,29 @@
 			}
 		},
 		mounted() {
-			console.log(this.datainfo)
+			// console.log(this.datainfo)
 		},
 		methods:{
+			checkPermi, checkRole,
 			getDetail(e){
 				this.$emit('getdetail',e)
 			},
+			getDelFn(id){
+				var that=this;
+				uni.showModal({
+					title: '确认删除',
+					content: "是否确认删除该考勤设置",
+					cancelText: '取消',
+					confirmText: '确认',
+					success: function(res) {
+						if (res.confirm) {
+							that.$emit("getDelFn",id)
+						} else if (res.cancel) {
+							// console.log('用户点击取消');
+						}
+					}
+				});
+			},
 			getFold(idx){
 				if(this.foldidx==idx){
 					this.foldidx=-1

+ 48 - 8
work/pages/clock/clock.vue

@@ -186,6 +186,7 @@ export default {
 			kaWeek: 0,
 			recordList: [],
 			userId: this.$store.state.user.userId,
+			// userId: 9,
 			deptId: this.$store.state.user.deptId,
 			// kaSort: 1, //打卡分类 1:上午上班 2:上午下班 3:下午上班 4:下午下班,
 			kaType: 1, //打卡类别 1正常 2:迟到 3:外勤 4:早退
@@ -224,6 +225,9 @@ export default {
 			yestkaWeek:'',
 			recordYestList:[],
 			guoflag:false,
+			pageNum: 1,
+			pageSize: 10,
+			reachflag: true,
 		};
 	},
 	created() {
@@ -241,6 +245,12 @@ export default {
 	onUnload() {
 		clearInterval(this.timefn)
 	},
+	onReachBottom() {
+		if (this.reachflag) {
+			this.pageNum++
+			this.getRecordList()
+		}
+	},
 	methods: {
 		init() {
 			var that=this;
@@ -399,7 +409,10 @@ export default {
 			}	
 		},
 		getRuleFn() {
-			clocklist().then(res => {
+			var params={
+				isEquip:'N'
+			}
+			clocklist(params).then(res => {
 				if (res.rows) {
 					this.ruleflag=true;
 					this.rulelist=res.rows;
@@ -416,15 +429,30 @@ export default {
 			var params = {
 				// deptId: this.deptId,
 				userId: this.userId,
-				recordDate: this.kaTime
+				recordDate: this.kaTime,
+				pageSize: this.pageSize,
+				pageNum: this.pageNum,
 			};
 			var a=0;
 			getRecordList(params).then(res => {
 				if (res.code == 200) {
-					this.recordList = JSON.parse(JSON.stringify(res.rows));
+					if (res.rows.length < this.pageSize) {
+						this.reachflag = false
+						this.wtdt = '到底了~';
+					} else {
+						var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum -
+							1)
+						if (num < res.total) {
+							this.reachflag = true
+							this.wtdt = '上拉加载更多'
+						} else {
+							this.reachflag = false
+							this.wtdt = '到底了~';
+						}
+					}
+					var newArr=JSON.parse(JSON.stringify(res.rows))
 					// 循环处理,获取上班时间,下班时间
-					var newArr=this.recordList;
-					if(newArr&&newArr.length){
+					if(newArr&&newArr.length&&this.pageNum == 1){
 						Object.keys(newArr).some((key) => {
 							// 去重
 							var type=newArr[key].type||'';
@@ -438,10 +466,23 @@ export default {
 						})
 					}
 					
+					if (this.pageNum == 1) {
+						this.recordList = newArr;
+					} else {
+						this.recordList = this.recordList.concat(newArr)
+					}
 					this.loctiotimeup();
 				} else {
-					this.$toast(res.msg);
+					this.$toast(res.msg)
 				}
+				// if (res.code == 200) {
+				// 	this.recordList = JSON.parse(JSON.stringify(res.rows));
+					
+					
+					
+				// } else {
+				// 	this.$toast(res.msg);
+				// }
 			});
 			// this.$toast("登录中,请耐心等待...")
 		},
@@ -622,7 +663,6 @@ export default {
 			params.recordTime=this.gettime;
 			params.week=this.kaWeek;
 			params.recordDt=this.kaTime+' '+this.gettime;
-				
 			if(this.imgurl){
 				params.pictureUrl=this.imgurl;
 			}
@@ -645,7 +685,7 @@ export default {
 			});
 			return
 
-			// return
+			// return 打卡全走新增,不用覆盖
 			if (newArr.length) {
 				var len = newArr.length - 1;
 				// params['recordId'] = newArr[0].recordId;

+ 13 - 3
work/pages/clock/kaorules.vue

@@ -15,7 +15,7 @@
 		</view>
 		
 		
-		<card-list :datainfo="prolist" type='rule' :wtdt="wtdt"   @getdetail='goDetail'></card-list>
+		<card-list :datainfo="prolist" type='rule' :wtdt="wtdt"   @getdetail='goDetail' @getDelFn="getDelFn"></card-list>
 		
 		<view>
 			<view class="exele">
@@ -63,7 +63,7 @@
 </template>
 
 <script>
-	import {getdeptTreeNow,clocklist} from "@/api/work/check.js"
+	import {getdeptTreeNow,clocklist,getXiuconfigDel} from "@/api/work/check.js"
 	import selectMorePicker from "@/components/selectMorePicker.vue"
 	import selectPicker from '@/components/selectPicker.vue'
 	import {
@@ -140,7 +140,17 @@
 			getClose() {
 				this.uplatflag = false;
 			},
-			
+			getDelFn(data){
+				var that=this;
+				getXiuconfigDel(data).then(res=>{
+					if(res.code==200){
+						this.$toast("删除成功")
+						setTimeout(function() {
+							that.getSearch()
+						}, 1500);
+					}
+				})
+			},
 
 			getSearch() {
 				this.pageNum = 1;

+ 55 - 21
work/pages/clock/setswork.vue

@@ -23,6 +23,14 @@
 			</picker>
 					<image :src="rimg"></image>
 			</view>
+			<view class="list" >
+				<view class="listl">是否打卡机使用</view>
+				<!-- <view class="listi" > -->
+			<picker @change="bindPickerChangea" range-key='label' :value="indexa" :range="surelist" class="listi">
+				<view class="f15" :style="isEquip?'':'color: #AAAAAA;'">{{isEquip||"请选择是否打卡机使用"}}</view>
+			</picker>
+					<image :src="rimg"></image>
+			</view>
 		</view>
 		<view class="lbox">
 			<!-- <view class="list">
@@ -93,6 +101,7 @@
 					"lon": "",
 					"lat": "",
 					"isPicture":'Y',
+					"isEquip":'Y',
 					"distance": "100",
 					"startWorkTime": "09:00:00",
 					"endWorkTime": "18:00:00",
@@ -112,7 +121,9 @@
 					data: []
 				},
 				indexs:0,
+				indexa:0,
 				isPicture:'是',
+				isEquip:'是',
 				surelist:[{
 					"label": '是',
 					"value":'Y'
@@ -267,10 +278,16 @@ this.$tab.navigateTo("/work/pages/clock/setwoek?address="+this.formData.location
 				var val=e.detail.value
 				this.formData.kaNum=this.array[val];
 			},
+			bindPickerChangea(e){
+				var val=e.detail.value;
+				this.indexa=val;
+				this.isEquip=this.surelist[val].label;
+				this.formData.isEquip=this.surelist[val].value;
+			},
 			bindPickerChanges(e){
 				var val=e.detail.value;
-				this.indexs=val
-				this.isPicture=this.surelist[val].label
+				this.indexs=val;
+				this.isPicture=this.surelist[val].label;
 				this.formData.isPicture=this.surelist[val].value;
 			},
 			bindStartTimeChange(e){
@@ -292,13 +309,21 @@ this.$tab.navigateTo("/work/pages/clock/setwoek?address="+this.formData.location
 						var that=this;
 						this.formData=res.data
 						var isPicture=res.data.isPicture
+						var isEquip=res.data.isEquip
 						if(isPicture=='Y'){
 							this.isPicture='是';
 							this.indexs=0;
 						}else{
 							this.isPicture='否';
 							this.indexs=1;
-						}	
+						}
+						if(isEquip=='Y'){
+							this.isEquip='是';
+							this.indexa=0;
+						}else{
+							this.isEquip='否';
+							this.indexa=1;
+						}
 					}else{
 						 this.$toast(res.msg)
 					}
@@ -306,27 +331,36 @@ this.$tab.navigateTo("/work/pages/clock/setwoek?address="+this.formData.location
 				})
 			},
 			getSure(){
-				if (this.formData.locations === "") {
-					this.$toast('请选择考勤地址')
-					return
-				} 
-				 if (this.formData.distance === "") {
-					this.$toast('请输入打卡半径')
-					return
-				}  
-				// if (this.formData.deptId === "") {
-				// 	this.$toast('请选择打卡部门')
-				// 	return
-				// } 
-				 if (this.formData.isPicture === "") {
-					this.$toast('请选择是否开启拍照打卡')
+				var params=JSON.parse(JSON.stringify(this.formData))
+				if(params.isEquip === "") {
+					this.$toast('请选择是否打卡机使用')
 					return
 				}
-				if(this.formData.startWorkTime === ""){
+				if(params.isEquip !='Y') {
+					if (params.locations === "") {
+						this.$toast('请选择考勤地址')
+						return
+					} 
+					 if (params.distance === "") {
+						this.$toast('请输入打卡半径')
+						return
+					}  
+					// if (this.formData.deptId === "") {
+					// 	this.$toast('请选择打卡部门')
+					// 	return
+					// } 
+					 if (params.isPicture === "") {
+						this.$toast('请选择是否开启拍照打卡')
+						return
+					}
+					
+				}
+				
+				if(params.startWorkTime === ""){
 					this.$toast('请选择上班时间')
 					return
 				}
-				if(this.formData.endWorkTime === ""){
+				if(params.endWorkTime === ""){
 					this.$toast('请选择下班时间')
 					return
 				}
@@ -361,7 +395,7 @@ this.$tab.navigateTo("/work/pages/clock/setwoek?address="+this.formData.location
 				// }
 				// 保存
 				if(this.type=='add'){
-					getBaoconfig(this.formData).then(res=>{
+					getBaoconfig(params).then(res=>{
 						if(res.code==200){
 							var that=this;
 							 this.$toast("保存成功")
@@ -378,7 +412,7 @@ this.$tab.navigateTo("/work/pages/clock/setwoek?address="+this.formData.location
 					})
 				}else{
 					// 修改
-					getXiuconfig(this.formData).then(res=>{
+					getXiuconfig(params).then(res=>{
 						if(res.code==200){
 							var that=this;
 							this.$toast("修改成功")