123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326 |
- <template>
- <view style="padding-bottom: 140rpx;background-color: #fff;overflow: hidden;">
- <uni-table ref="table" border stripe emptyText="暂无更多数据" style="display: static;
- overflow: visible;">
- <uni-tr>
- <uni-th width="300rpx" align="center">日期</uni-th>
- <uni-th align="center">考勤</uni-th>
- </uni-tr>
- <uni-tr>
- <uni-td align="center">
- <view class="name">
- <view>
- 星期一
- </view>
- <view>
- {{weekList[0]}}
- </view>
- </view>
- </uni-td>
- <uni-td align="center" width="200rpx">
- <view class="select">
- 上午:
- <uni-data-select v-model="list.mondayMorning" :disabled="type" :localdata="range" @change="change"
- :clear="false"></uni-data-select>
- </view>
- <view class="select" style="margin-top: 40rpx;">
- 下午:
- <uni-data-select v-model="list.mondayAfternoon" :disabled="type" :localdata="range" @change="change"
- :clear="false"></uni-data-select>
- </view>
- </uni-td>
- </uni-tr>
- <uni-tr>
- <uni-td align="center">
- <view class="name">
- <view>
- 星期二
- </view>
- <view>
- {{weekList[1]}}
- </view>
- </view>
- </uni-td>
- <uni-td align="center" width="200rpx">
- <view class="select">
- 上午:
- <uni-data-select v-model="list.tuesdayMorning" :disabled="type" :localdata="range" @change="change"
- :clear="false"></uni-data-select>
- </view>
- <view class="select" style="margin-top: 40rpx;">
- 下午:
- <uni-data-select v-model="list.tuesdayAfternoon" :disabled="type" :localdata="range" @change="change"
- :clear="false"></uni-data-select>
- </view>
- </uni-td>
- </uni-tr>
- <uni-tr>
- <uni-td align="center">
- <view class="name">
- <view>
- 星期三
- </view>
- <view>
- {{weekList[2]}}
- </view>
- </view>
- </uni-td>
- <uni-td align="center" width="200rpx">
- <view class="select">
- 上午:
- <uni-data-select v-model="list.wednesdayMorning" :disabled="type" :localdata="range" @change="change"
- :clear="false"></uni-data-select>
- </view>
- <view class="select" style="margin-top: 40rpx;">
- 下午:
- <uni-data-select v-model="list.wednesdayAfternoon" :disabled="type" :localdata="range" @change="change"
- :clear="false"></uni-data-select>
- </view>
- </uni-td>
- </uni-tr>
- <uni-tr>
- <uni-td align="center">
- <view class="name">
- <view>
- 星期四
- </view>
- <view>
- {{weekList[3]}}
- </view>
- </view>
- </uni-td>
- <uni-td align="center" width="200rpx">
- <view class="select">
- 上午:
- <uni-data-select v-model="list.thursdayMorning" :disabled="type" :localdata="range" @change="change"
- :clear="false"></uni-data-select>
- </view>
- <view class="select" style="margin-top: 40rpx;">
- 下午:
- <uni-data-select v-model="list.thursdayAfternoon" :disabled="type" :localdata="range" @change="change"
- :clear="false"></uni-data-select>
- </view>
- </uni-td>
- </uni-tr>
- <uni-tr>
- <uni-td align="center">
- <view class="name">
- <view>
- 星期五
- </view>
- <view>
- {{weekList[4]}}
- </view>
- </view>
- </uni-td>
- <uni-td align="center" width="200rpx">
- <view class="select">
- 上午:
- <uni-data-select v-model="list.fridayMorning" :disabled="type" :localdata="range" @change="change"
- :clear="false"></uni-data-select>
- </view>
- <view class="select" style="margin-top: 40rpx;">
- 下午:
- <uni-data-select v-model="list.fridayAfternoon" :disabled="type" :localdata="range" @change="change"
- :clear="false"></uni-data-select>
- </view>
- </uni-td>
- </uni-tr>
- <uni-tr>
- <uni-td align="center">
- <view class="name">
- <view>
- 星期六
- </view>
- <view>
- {{weekList[5]}}
- </view>
- </view>
- </uni-td>
- <uni-td align="center" width="200rpx">
- <view class="select">
- 上午:
- <uni-data-select :position="position" v-model="list.saturdayMorning" :disabled="type" :localdata="range" @change="change"
- :clear="false"></uni-data-select>
- </view>
- <view class="select" style="margin-top: 40rpx;">
- 下午:
- <uni-data-select :position="position" v-model="list.saturdayAfternoon" :disabled="type" :localdata="range" @change="change"
- :clear="false"></uni-data-select>
- </view>
- </uni-td>
- </uni-tr>
- <uni-tr>
- <uni-td align="center">
- <view class="name">
- <view>
- 星期日
- </view>
- <view>
- {{weekList[6]}}
- </view>
- </view>
- </uni-td>
- <uni-td align="center" width="200rpx">
- <view class="select">
- 上午:
- <uni-data-select :position="position" v-model="list.sundayMorning" :disabled="type" :localdata="range" @change="change"
- :clear="false"></uni-data-select>
- </view>
- <view class="select" style="margin-top: 40rpx;">
- 下午:
- <uni-data-select :position="position" v-model="list.sundayAfternoon" :disabled="type" :localdata="range" @change="change"
- :clear="false"></uni-data-select>
- </view>
- </uni-td>
- </uni-tr>
- </uni-table>
- <view style="width: 100vw;position: fixed;bottom: 0;left: 0;padding: 20rpx;background-color: #fff;box-sizing: border-box;z-index: 999;" v-if="!type==true">
- <u-button type="primary" text="保存" @click="save"></u-button>
- </view>
- </view>
- </template>
- <script>
- import {
- getNowWeekList
- } from "@/utils/wjw.js"
- export default {
- data() {
- return {
- list: {
- beginTime: null,
- createBy: null,
- createTime: null,
- deptId: null,
- endTime: null,
- fridayAfternoon: "0",
- fridayMorning: "0",
- fullName: null,
- id: null,
- isSave: null,
- loginDeptId: null,
- mondayAfternoon: "0",
- mondayMorning: "0",
- remark: null,
- saturdayAfternoon: "11",
- saturdayMorning: "11",
- sumTableDate: null,
- sundayAfternoon: "11",
- sundayMorning: "11",
- thursdayAfternoon: "0",
- thursdayMorning: "0",
- tuesdayAfternoon: "0",
- tuesdayMorning: "0",
- updateBy: null,
- updateTime: null,
- userId: null,
- wednesdayAfternoon: "0",
- wednesdayMorning: "0",
- weekEnd: null,
- weekNumber: null,
- weekStart: null,
- },
- //本周日期列表
- weekList: [],
- //下拉框
- range: [],
- type:true,//能否修改
- position:'bottom'
- }
- },
- onLoad(options) {
- if(options.type == 'false'){
- this.type = true
- }else{
- this.type = false
- }
- this.list.userId = options.id
- this.list.deptId = options.deptId
- this.list.fullName = options.name
- this.list.weekNumber = options.weekNumber
- uni.setNavigationBarTitle({
- title:options.name+'本周考勤列表',
- color:'#fff'
- })
- this.getDay()
- this.getDicts('info_kq')
- // setTimeout(() => {
- this.getDk(options.id, options.weekNumber)
- // }, 1500)
- },
- methods: {
- getDay() {
- let day = uni.$u.timeFormat(new Date().toLocaleDateString(), 'yyyy-mm-dd')
- this.weekList = getNowWeekList(day)
- },
- // 查询字典数据详细
- getDicts(dictType) {
- uni.$u.http.get('/system/dict/data/type/' + dictType).then(res => {
- // console.log(res)
- this.range = res.data.map(item => {
- let obj = {
- value: item.dictValue,
- text: item.dictLabel
- }
- return obj
- })
- })
- },
- //查询打卡记录
- getDk(id, num) {
- uni.$u.http.post('/oa/attendance/selectOnePerson', {
- userId: id,
- weekNumber: num
- }).then(res => {
- if (res == '') {
- this.$forceUpdate()
- } else {
- this.list = res
- this.$forceUpdate()
- }
- })
- },
- //选择打卡
- change(e) {
-
- },
- //提交保存打卡
- save(){
- uni.showLoading({
- title:"保存中...",
- mask:true
- })
- this.list.weekStart = this.weekList[0]
- this.list.weekEnd = this.weekList[6]
- uni.$u.http.post('/oa/attendance/dtkq',this.list).then(res=>{
- uni.hideLoading()
- uni.showToast({
- title:"保存成功",
- mask:true
- })
- setTimeout(()=>{
- uni.$emit('query' , {a : 1});
- uni.navigateBack()
- },1800)
- }).catch(res=>{
- uni.hideLoading()
- })
- }
- }
- }
- </script>
- <style lang="scss">
- .select {
- display: flex;
- align-items: center;
- }
- // ::v-deep .uni-select__selector{
- // height: 200px;
- // overflow: auto;
- // }
- </style>
|