Browse Source

BUG修复

master
jarvis 4 years ago
parent
commit
77bf514d33
  1. 2
      public/img/icons/safari-pinned-tab.svg
  2. 4
      src/App.vue
  3. 2
      src/assets/icon/iconfont.svg
  4. 31
      src/components/HeadNav/HeadNav.vue
  5. 44
      src/components/List/List.vue
  6. 19
      src/components/MemberPicker/MemberPicker.vue
  7. 91
      src/components/TimePicker/TimePicker.vue
  8. 8
      src/store/modules/home/mutations.js
  9. 1
      src/store/modules/home/state.js

2
public/img/icons/safari-pinned-tab.svg

@ -1,3 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://test.w3.org/2000/svg">
<path d="M8.00251 14.9297L0 1.07422H6.14651L8.00251 4.27503L9.84583 1.07422H16L8.00251 14.9297Z" fill="black"/>
</svg>

Before

Width:  |  Height:  |  Size: 215 B

After

Width:  |  Height:  |  Size: 216 B

4
src/App.vue

@ -18,14 +18,16 @@ export default {
async created() {
const userId = this.$route.query.uid;
const roleId = this.$route.query.rid;
const params = { userId };
await this.getUserId(params);
await this.setRoleId(roleId);
await this.getAllMembers({ projectId: this.$route.query.pid });
this.setProjectId(this.$route.query.pid);
},
methods: {
...mapMutations('home', ['setProjectId', 'setMembers']),
...mapMutations('home', ['setProjectId', 'setMembers', 'setRoleId']),
...mapActions('user', ['getUserId']),
...mapActions('home', ['getAllMembers']),
},

2
src/assets/icon/iconfont.svg

@ -1,5 +1,5 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://test.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<!--
2013-9-30: Created.
-->

Before

Width:  |  Height:  |  Size: 1018 B

After

Width:  |  Height:  |  Size: 1011 B

31
src/components/HeadNav/HeadNav.vue

@ -3,9 +3,11 @@
<div class="d-flex align-center">
<!-- <a-icon type="left" class="mr-1" @click="back" /> -->
考勤管理
<a-icon @click="showMessage" type="exclamation-circle" class="ml-2" />
</div>
<div class="d-flex align-center">
<a-button type="primary" size="small" class="mr-3" @click="openSearch"> 搜索 </a-button>
<a-button type="primary" size="small" class="mr-3" @click="openSearch"> 过滤 </a-button>
<a-button type="primary" size="small" @click="clockExport"> 导出 </a-button>
</div>
<div class="timer p-4" v-if="show">
@ -13,11 +15,15 @@
<TimePicker />
<!-- 成员选择 -->
<MemberPicker />
<div class="mt-5 flex justify-center">
<a-button size="small" class="mr-10" @click="show = false"> 取消 </a-button>
<a-button type="primary" size="small" @click="searchParam"> 确认 </a-button>
<div class="mt-5 flex">
<a-button size="small" class="mr-3" @click="show = false"> 取消 </a-button>
<a-button type="primary" size="small" @click="searchParam"> 过滤 </a-button>
</div>
</div>
<a-modal v-model="visible" @ok="handleOk" title="提示">
<p>静态小红点审核人未审核你的打卡状态</p>
<p>动态小红点某成员选择你为打卡人需要你审核</p>
</a-modal>
</div>
</template>
@ -30,9 +36,12 @@ import MemberPicker from '@/components/MemberPicker/MemberPicker.vue';
export default {
components: { TimePicker, MemberPicker },
data() {
return { show: false };
return {
show: false,
visible: false,
};
},
computed: mapState('home', ['projectId', 'startTime', 'endTime', 'memberIdList']),
computed: mapState('home', ['projectId', 'startTime', 'endTime', 'memberIdList', 'roleId']),
methods: {
/**
* 导出考勤excel
@ -43,8 +52,8 @@ export default {
*/
async clockExport() {
try {
const { projectId, memberIdList, startTime, endTime } = this;
const params = { param: { projectId, memberIdList, startTime, endTime } };
const { projectId, memberIdList, startTime, endTime, roleId } = this;
const params = { param: { projectId, memberIdList, startTime, endTime, roleId } };
const res = await clockExport(params);
const { code, msg, data } = res.data;
if (code === 200) {
@ -72,6 +81,12 @@ export default {
// window.location.href = document.referrer;
// window.history.back(-1);
// },
showMessage() {
this.visible = !this.visible;
},
handleOk() {
this.visible = false;
},
},
};
</script>

44
src/components/List/List.vue

@ -52,8 +52,16 @@
@cancel="changeStatus(record.id, 0, 'morning')"
>
<a-icon slot="icon" type="" />
<a-button slot="title" size="small" @click="rejectStatus(record.id, 2, 'morning', record.morning)">确认</a-button>
<a-button class="ml-2" slot="title" size="small" @click="rejectStatus(record.id, 1, 'morning', record.morning)">
<a-button class="okBtn" slot="title" size="small" @click="rejectStatus(record.id, 2, 'morning', record.morning)"
>确认</a-button
>
<a-button
type="danger"
class="ml-2"
slot="title"
size="small"
@click="rejectStatus(record.id, 1, 'morning', record.morning)"
>
驳回
</a-button>
<span
@ -122,8 +130,16 @@
@cancel="changeStatus(record.id, 0, 'night')"
>
<a-icon slot="icon" type="" />
<a-button slot="title" size="small" @click="rejectStatus(record.id, 2, 'night', record.night)">确认</a-button>
<a-button class="ml-2" slot="title" size="small" @click="rejectStatus(record.id, 1, 'night', record.night)">
<a-button type="primary" slot="title" size="small" @click="rejectStatus(record.id, 2, 'night', record.night)"
>确认</a-button
>
<a-button
type="danger"
class="ml-2"
slot="title"
size="small"
@click="rejectStatus(record.id, 1, 'night', record.night)"
>
驳回
</a-button>
<span
@ -171,10 +187,6 @@
</template>
</a-table>
</div>
<div class="text-gray-400 text-xs m-3 flex flex-col justify-start">
<div class="flex align-center mb-2"><a-icon type="exclamation-circle" class="mr-1" />静态小红点审核人未审核你的打卡状态</div>
<div class="mb-10 ml-4">动态小红点某成员选择你为打卡人需要你审核</div>
</div>
</div>
<a-empty class="mt-8 mb-8" description="暂无打卡信息" v-else />
</div>
@ -219,7 +231,7 @@ export default {
};
},
computed: mapState('home', ['projectId', 'members', 'startTime', 'endTime', 'memberIdList']),
computed: mapState('home', ['projectId', 'members', 'startTime', 'endTime', 'memberIdList', 'roleId']),
mounted() {
this.timer = setInterval(async () => {
@ -248,8 +260,8 @@ export default {
...mapMutations('home', ['setStartTime', 'setEndTime', 'setMemberIdList']),
async setParams() {
const { projectId, startTime, endTime, memberIdList } = this;
const params = { param: { projectId, memberIdList, startTime, endTime } };
const { projectId, startTime, endTime, memberIdList, roleId } = this;
const params = { param: { projectId, memberIdList, startTime, endTime, roleId } };
await this.getClockQuery(params);
},
@ -335,7 +347,7 @@ export default {
},
changeVisible(status, type) {
if (status !== 2) {
if (status !== 0) {
this[type] = true;
}
},
@ -481,6 +493,10 @@ img {
top: 2px;
right: -10px;
}
.okBtn {
background-color: #10b981 !important;
color: #fff;
}
</style>
<style>
@ -493,4 +509,8 @@ img {
left: 2px;
top: 8px;
}
.ant-popover-buttons button:nth-child(1) {
background-color: #3b82f6 !important;
color: #fff;
}
</style>

19
src/components/MemberPicker/MemberPicker.vue

@ -1,7 +1,14 @@
<template>
<div class="mt-3">
<!-- 多选 -->
<a-select mode="multiple" style="width: 100%" placeholder="请选择成员" @change="handleChange" :default-value="memberIdList">
<a-select
mode="multiple"
style="width: 100%"
placeholder="请选择成员"
@change="handleChange"
:default-value="memberIdList && memberIdList.length ? memberIdList : '全部'"
>
<a-select-option value=""> 全部 </a-select-option>
<a-select-option :value="member.memberId" v-for="member in members" :key="member.memberId"> {{ member.name }} </a-select-option>
</a-select>
</div>
@ -21,7 +28,17 @@ export default {
...mapMutations('home', ['setMemberIdList']),
handleChange(value) {
console.log(value);
if (value) {
const index = value.findIndex(item => item === '全部');
console.log(index);
if (index !== -1) {
value.splice(index, 1);
}
this.setMemberIdList(value);
} else {
this.setMemberIdList();
}
},
},
};

91
src/components/TimePicker/TimePicker.vue

@ -13,11 +13,11 @@
@openChange="handleStartOpenChange"
>
<template slot="renderExtraFooter">
<a-button size="small" type="primary" ghost @click="setYesterday('startValue', 'startOpen')">昨天</a-button>
<a-button class="ml-3" size="small" type="primary" ghost @click="setToday('startValue', 'startOpen')">今天</a-button>
<a-button class="ml-3" size="small" type="primary" ghost @click="setMonday('startValue', 'startOpen')">本周</a-button>
<a-button class="ml-3" size="small" type="primary" ghost @click="setMonthOne('startValue', 'startOpen')">本月</a-button>
<a-button size="small" type="primary" ghost @click="setLastMonthOne('startValue', 'startOpen')">上月</a-button>
<a-button size="small" type="primary" ghost @click="setYesterday('startOpen')">昨天</a-button>
<a-button class="ml-3" size="small" type="primary" ghost @click="setToday('startOpen')">今天</a-button>
<a-button class="ml-3" size="small" type="primary" ghost @click="setWeek('startOpen')">本周</a-button>
<a-button class="ml-3" size="small" type="primary" ghost @click="setMonth('startOpen')">本月</a-button>
<a-button size="small" type="primary" ghost @click="setLastMonth('startOpen')">上月</a-button>
</template>
</a-date-picker>
<a-date-picker
@ -32,11 +32,11 @@
@openChange="handleEndOpenChange"
>
<template slot="renderExtraFooter">
<a-button size="small" type="primary" ghost @click="setYesterday('endValue', 'endOpen')">昨天</a-button>
<a-button class="ml-3" size="small" type="primary" ghost @click="setToday('endValue', 'endOpen')">今天</a-button>
<a-button class="ml-3" size="small" type="primary" ghost @click="setSunday('endValue', 'endOpen')">本周</a-button>
<a-button class="ml-3" size="small" type="primary" ghost @click="setMonthEnd('endValue', 'endOpen')">本月</a-button>
<a-button size="small" type="primary" ghost @click="setLastMonthEnd('endValue', 'endOpen')">上月</a-button>
<a-button size="small" type="primary" ghost @click="setYesterday('endOpen')">昨天</a-button>
<a-button class="ml-3" size="small" type="primary" ghost @click="setToday('endOpen')">今天</a-button>
<a-button class="ml-3" size="small" type="primary" ghost @click="setWeek('endOpen')">本周</a-button>
<a-button class="ml-3" size="small" type="primary" ghost @click="setMonth('endOpen')">本月</a-button>
<a-button size="small" type="primary" ghost @click="setLastMonth('endOpen')">上月</a-button>
</template>
</a-date-picker>
</div>
@ -95,88 +95,73 @@ export default {
...mapMutations('home', ['setStartTime', 'setEndTime']),
//
setYesterday(value, open) {
this[value] = this.$moment(new Date().getTime() - 24 * 60 * 60 * 1000).format('YYYY-MM-DD');
setYesterday(open) {
const day = this.$moment(new Date().getTime() - 24 * 60 * 60 * 1000).format('YYYY-MM-DD');
this.startValue = day;
this.endValue = day;
this[open] = false;
if (open === 'startOpen' && !this.startOpen) {
this.endOpen = true;
}
},
//
setToday(value, open) {
this[value] = this.$moment(new Date()).format('YYYY-MM-DD');
setToday(open) {
const today = this.$moment(new Date()).format('YYYY-MM-DD');
this.startValue = today;
this.endValue = today;
this[open] = false;
if (open === 'startOpen' && !this.startOpen) {
this.endOpen = true;
}
},
//
setMonday(value, open) {
var date = this.$moment(this.$moment().format('YYYY-MM-DD'));
var dow = date.day();
var monday1 = date.subtract(dow - 1, 'days').format('YYYY-MM-DD'); //
this[value] = monday1;
setWeek(open) {
const startWeek = this.$moment()
.startOf('week')
.format('YYYY-MM-DD');
this.startValue = startWeek;
const endWeek = this.$moment()
.endOf('week')
.format('YYYY-MM-DD');
this.endValue = endWeek;
this[open] = false;
if (open === 'startOpen' && !this.startOpen) {
/* if (open === 'startOpen' && !this.startOpen) {
this.endOpen = true;
}
} */
},
//
setSunday(value, open) {
/* setSunday(value, open) {
var date = this.$moment(this.$moment().format('YYYY-MM-DD'));
var dow = date.day();
var monday1 = date.subtract(dow - 7, 'days').format('YYYY-MM-DD'); //
this[value] = monday1;
this[open] = false;
},
}, */
// 1
setMonthOne(value, open) {
setMonth(open) {
const m = this.$moment()
.startOf('month')
.format('YYYY-MM-DD');
this[value] = m;
this[open] = false;
if (open === 'startOpen' && !this.startOpen) {
this.endOpen = true;
}
},
//
setMonthEnd(value, open) {
this.startValue = m;
const end =
this.$moment()
.endOf('month')
.format('YYYY-MM-DD') + ' 23:59:59';
this[value] = end;
this.endValue = end;
this[open] = false;
},
// 1
setLastMonthOne(value, open) {
setLastMonth(open) {
const t = this.$moment().format('YYYY-MM-DD');
const afterM = this.$moment(t, 'YYYY-MM-DD')
.subtract(1, 'months')
.startOf('month')
.format('YYYY-MM-DD');
this[value] = afterM;
this[open] = false;
if (open === 'startOpen' && !this.startOpen) {
this.endOpen = true;
}
},
//
setLastMonthEnd(value, open) {
const t = this.$moment().format('YYYY-MM-DD');
const afterM = this.$moment(t, 'YYYY-MM-DD')
this.startValue = afterM;
const lastM = this.$moment(t, 'YYYY-MM-DD')
.subtract(1, 'months')
.endOf('month')
.format('YYYY-MM-DD');
this[value] = afterM;
this.endValue = lastM;
this[open] = false;
},

8
src/store/modules/home/mutations.js

@ -52,6 +52,14 @@ const mutations = {
setMemberIdList(state, data) {
state.memberIdList = data;
},
/**
* 设置角色id信息
* @param {object} state
* @param {String} data
*/
setRoleId(state, data) {
state.roleId = data;
},
};
export default mutations;

1
src/store/modules/home/state.js

@ -12,6 +12,7 @@ const state = {
startTime: null,
endTime: null,
memberIdList: [],
roleId: '',
};
export default state;

Loading…
Cancel
Save