|
|
|
@ -3,6 +3,7 @@ |
|
|
|
<view class="main_box"> |
|
|
|
<fui-segmented-control |
|
|
|
:values="optionTable" |
|
|
|
:current="(Number(filteredData.status))" |
|
|
|
type="text" |
|
|
|
activeColor="#29d3b4" |
|
|
|
color="#fff" |
|
|
|
@ -10,10 +11,10 @@ |
|
|
|
</fui-segmented-control> |
|
|
|
|
|
|
|
<view class="main_section"> |
|
|
|
<!--考勤--> |
|
|
|
<!--全部--> |
|
|
|
<scroll-view |
|
|
|
class="section_1" |
|
|
|
v-if="filteredData.type == '1'" |
|
|
|
v-if="filteredData.status == '0'" |
|
|
|
scroll-y="true" |
|
|
|
:lower-threshold="lowerThreshold" |
|
|
|
@scrolltolower="loadMoreData" |
|
|
|
@ -95,10 +96,10 @@ |
|
|
|
|
|
|
|
</scroll-view> |
|
|
|
|
|
|
|
<!--请假--> |
|
|
|
<!--考勤--> |
|
|
|
<scroll-view |
|
|
|
class="section_1" |
|
|
|
v-if="filteredData.type == '2'" |
|
|
|
v-if="filteredData.status == '1'" |
|
|
|
scroll-y="true" |
|
|
|
:lower-threshold="lowerThreshold" |
|
|
|
@scrolltolower="loadMoreData" |
|
|
|
@ -180,10 +181,10 @@ |
|
|
|
|
|
|
|
</scroll-view> |
|
|
|
|
|
|
|
<!--异常--> |
|
|
|
<!--请假--> |
|
|
|
<scroll-view |
|
|
|
class="section_1" |
|
|
|
v-if="filteredData.type == '3'" |
|
|
|
v-if="filteredData.status == '2'" |
|
|
|
scroll-y="true" |
|
|
|
:lower-threshold="lowerThreshold" |
|
|
|
@scrolltolower="loadMoreData" |
|
|
|
@ -265,15 +266,20 @@ |
|
|
|
|
|
|
|
</scroll-view> |
|
|
|
|
|
|
|
<!--请假按钮--> |
|
|
|
<view class="section_btn"> |
|
|
|
<view class="btn">请假</view> |
|
|
|
<view class="btn" @click="openShow()">请假</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
<!-- 请假提示框--> |
|
|
|
<fui-dialog :show="show" :content="content" maskClosable @click="onClick" @close="closeShow"></fui-dialog> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import commonApi from '@/api/common.js'; |
|
|
|
import marketApi from '@/api/market.js'; |
|
|
|
import AQTabber from "@/components/AQ/AQTabber.vue" |
|
|
|
|
|
|
|
@ -286,6 +292,10 @@ export default { |
|
|
|
return { |
|
|
|
//tab切换 |
|
|
|
optionTable: [ |
|
|
|
{ |
|
|
|
id: 0, |
|
|
|
name: '全部' |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: 1, |
|
|
|
name: '考勤' |
|
|
|
@ -293,13 +303,10 @@ export default { |
|
|
|
{ |
|
|
|
id: 2, |
|
|
|
name: '请假' |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: 3, |
|
|
|
name: '异常' |
|
|
|
} |
|
|
|
], |
|
|
|
|
|
|
|
|
|
|
|
loading:false,//加载状态 |
|
|
|
lowerThreshold: 100,//距离底部多远触发 |
|
|
|
isReachedBottom: false,//防止重复加载|true=不可加载|false=可加载 |
|
|
|
@ -309,9 +316,18 @@ export default { |
|
|
|
page:1,//当前页码 |
|
|
|
limit:10,//每页返回数据条数 |
|
|
|
total:10,//数据总条数 |
|
|
|
type: '1',//1=考勤,2=请假,3=异常 |
|
|
|
status:'0'//0全部 1考勤 2请假 |
|
|
|
}, |
|
|
|
tableList:[],//表格数据 |
|
|
|
|
|
|
|
//请假表单 |
|
|
|
formData:{ |
|
|
|
date:'',//请假日期 |
|
|
|
}, |
|
|
|
|
|
|
|
//请假提示框相关 |
|
|
|
show:false,//是否展示 |
|
|
|
content:'',//请假提示语 |
|
|
|
} |
|
|
|
}, |
|
|
|
onLoad(options) {}, |
|
|
|
@ -321,14 +337,34 @@ export default { |
|
|
|
methods: { |
|
|
|
//初始化 |
|
|
|
async init(){ |
|
|
|
this.getCurrentDate()//获取并格式化当前日期 |
|
|
|
await this.getList(); |
|
|
|
}, |
|
|
|
|
|
|
|
// 获取并格式化当前日期 |
|
|
|
getCurrentDate() { |
|
|
|
let now = new Date(); |
|
|
|
let year = now.getFullYear(); |
|
|
|
let month = String(now.getMonth() + 1).padStart(2, '0'); // 月份从 0 开始,需要加 1 |
|
|
|
let day = String(now.getDate()).padStart(2, '0'); |
|
|
|
|
|
|
|
|
|
|
|
let res = `${year}-${month}-${day}` |
|
|
|
|
|
|
|
this.content = `${res} 是否确认请假?` |
|
|
|
|
|
|
|
this.formData.date = res |
|
|
|
}, |
|
|
|
|
|
|
|
//切换tag列表 |
|
|
|
async segmented(e) { |
|
|
|
console.log(e) |
|
|
|
//重置为第一页 |
|
|
|
await this.resetFilteredData() |
|
|
|
this.filteredData.type = e.id//1=考勤,2=请假,3=异常 |
|
|
|
|
|
|
|
//e.id|0全部 1考勤 2请假 |
|
|
|
let status = e.id |
|
|
|
this.filteredData.status = String(status) |
|
|
|
await this.getList() |
|
|
|
}, |
|
|
|
|
|
|
|
@ -368,7 +404,7 @@ export default { |
|
|
|
this.tableList = [] |
|
|
|
} |
|
|
|
|
|
|
|
let res = await marketApi.myClient(data) |
|
|
|
let res = await commonApi.clockingList(data) |
|
|
|
this.loading = false |
|
|
|
this.isReachedBottom = false; |
|
|
|
if (res.code != 1){ |
|
|
|
@ -379,23 +415,59 @@ export default { |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
this.tableList = this.tableList.concat(res.data.list.data); // 使用 concat 方法 将新数据追加到数组中 |
|
|
|
this.tableList = this.tableList.concat(res.data.data); // 使用 concat 方法 将新数据追加到数组中 |
|
|
|
|
|
|
|
console.log('列表',this.tableList) |
|
|
|
this.filteredData.total = res.data.list.total |
|
|
|
this.filteredData.total = res.data.data.total |
|
|
|
this.filteredData.page++ |
|
|
|
}, |
|
|
|
|
|
|
|
this.countArr = { |
|
|
|
type_0:res.data.count[0], |
|
|
|
type_1:res.data.count[1], |
|
|
|
type_2:res.data.count[2], |
|
|
|
type_3:res.data.count[3], |
|
|
|
max_count:res.data.gh.max_count, |
|
|
|
lq_count:res.data.gh.lq_count, |
|
|
|
//打开请假提示框 |
|
|
|
openShow(){ |
|
|
|
this.show = true |
|
|
|
}, |
|
|
|
//关闭请假提示框 |
|
|
|
closeShow(){ |
|
|
|
this.show = false |
|
|
|
}, |
|
|
|
//点击确认请假按钮 |
|
|
|
onClick(e){ |
|
|
|
console.log('xxx',e) |
|
|
|
if(e.index == 0){ |
|
|
|
//取消按钮 |
|
|
|
this.closeShow() |
|
|
|
}else{ |
|
|
|
//确认按钮 |
|
|
|
this.submitRest() |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
//发起请假请求 |
|
|
|
async submitRest() { |
|
|
|
|
|
|
|
this.closeShow() |
|
|
|
|
|
|
|
let param = {...this.formData} |
|
|
|
let res = await commonApi.clockingRest(param) |
|
|
|
if (res.code != 1) { |
|
|
|
uni.showToast({ |
|
|
|
title: res.msg, |
|
|
|
icon: 'none' |
|
|
|
}) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
uni.showToast({ |
|
|
|
title: '操作成功', |
|
|
|
icon: 'success' |
|
|
|
}) |
|
|
|
|
|
|
|
//延迟1s执行 |
|
|
|
setTimeout(() => { |
|
|
|
this.segmented({id:0})//初始化 |
|
|
|
}, 1500) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|