- {{ record.checkerName || members[0].name }}
+
+ {{ record.checkerName || checkers[0].name }}
-
+
{{ member.name }}
@@ -218,20 +234,17 @@ export default {
clockInfos: [],
options: null,
checkerId: undefined,
- morningVisible: false,
- visible: false,
placement: 'left',
timer: null,
- showNightTime: false,
- showMorningTime: false,
chooseTime: '',
auditOptions: null,
morningLoading: false,
nightLoading: false,
+ today: this.$moment(new Date()).format('YYYY-MM-DD'),
};
},
- computed: mapState('home', ['projectId', 'members', 'startTime', 'endTime', 'memberIdList', 'roleId']),
+ computed: mapState('home', ['projectId', 'members', 'startTime', 'endTime', 'memberIdList', 'roleId', 'checkers']),
mounted() {
this.timer = setInterval(async () => {
@@ -277,7 +290,16 @@ export default {
const res = await clockQuery(params);
const { code, msg, data } = res.data;
if (code === 200) {
- this.clockInfos = data;
+ data.forEach(item => {
+ item.recordList.forEach(clcok => {
+ clcok.morningVisible = false;
+ clcok.nightVisible = false;
+ clcok.showNightTime = false;
+ clcok.showMorningTime = false;
+ });
+ });
+
+ this.clockInfos = [...data];
} else {
this.$message.error(msg || '获取失败');
throw msg;
@@ -302,7 +324,7 @@ export default {
this.clockInfos[listIndex].recordList[index].night = selectTime;
}
const dateTime = this.$moment(`${clockTime} ${selectTime}`).format('x') - 0;
- const params = { param: { checkerId: this.checkerId || checkerId || this.members[0].memberId, clockType, dateTime, id, memberId } };
+ const params = { param: { checkerId: this.checkerId || checkerId || this.checkers[0].memberId, clockType, dateTime, id, memberId } };
this.handleClockPunch(params);
},
@@ -346,55 +368,57 @@ export default {
}
},
- changeVisible(status, type) {
+ changeVisible(index, status, type) {
if (status !== 0) {
- this[type] = true;
+ this.clockInfos.forEach(item => {
+ item.recordList.forEach((clcok, i) => {
+ if (i === index && type === 'morningVisible') {
+ clcok.morningVisible = !clcok.morningVisible;
+ clcok.nightVisible = false;
+ } else if (i === index && type === 'nightVisible') {
+ clcok.morningVisible = false;
+ clcok.nightVisible = !clcok.nightVisible;
+ } else {
+ clcok.morningVisible = false;
+ clcok.nightVisible = false;
+ }
+ });
+ });
}
},
// 修改
- changeStatus(id, type, timeType) {
- if (timeType === 'morning') {
- this.morningVisible = false;
- this.showMorningTime = true;
- } else {
- this.visible = false;
- this.showNightTime = true;
- }
+ changeStatus(id, type, record, visible, show) {
+ record[visible] = false;
+ record[show] = true;
this.auditOptions = { id, type };
},
// 选择修改时间
timeChange(time) {
this.chooseTime = this.$moment(time).format('x');
},
- async openChange(open, timeType) {
+ async openChange(open, record, show, timeType) {
if (!open && this.chooseTime) {
this.auditOptions[timeType] = this.chooseTime;
this.auditOptions.projectId = this.projectId;
const params = { param: this.auditOptions };
- await this.handleClockAudit(params);
+ await this.handleClockAudit(params, record, show);
}
if (!open && !this.chooseTime) {
- this.showNightTime = false;
- this.showMorningTime = false;
+ record[show] = false;
}
},
// 驳回
- async rejectStatus(id, type, timeType, time) {
- if (timeType === 'morning') {
- this.morningVisible = false;
- } else {
- this.visible = false;
- }
+ async rejectStatus(id, type, timeType, time, record, show) {
+ record[show] = false;
const params = { param: { id, type, [timeType]: time, projectId: this.projectId } };
- await this.handleClockAudit(params);
+ await this.handleClockAudit(params, record, show);
},
// 取消
- cancel() {
- this.visible = false;
- this.morningVisible = false;
+ cancel(record, type) {
+ record[type] = false;
},
/**
@@ -405,14 +429,13 @@ export default {
* @param {string} projectId 项目id
* @param {string} type 审批类型(0-修改,1-驳回,2-通过)
*/
- async handleClockAudit(params) {
+ async handleClockAudit(params, record, show) {
try {
const res = await clockAudit(params);
const { code, msg } = res.data;
if (code === 200) {
this.$message.success(params.param.type === 0 ? '修改成功' : params.param.type === 1 ? '驳回成功' : '审核通过');
- this.showNightTime = false;
- this.showMorningTime = false;
+ record[show] = false;
this.auditOptions = null;
const options = { startTime: this.startTime, endTime: this.endTime, memberIdList: this.memberIdList };
this.setParams(options);
@@ -484,6 +507,7 @@ img {
.daka {
position: relative;
}
+
.dian {
position: absolute;
width: 6px;
@@ -493,6 +517,11 @@ img {
top: 2px;
right: -10px;
}
+
+.dian-yellow {
+ background-color: rgb(253, 230, 138);
+}
+
.okBtn {
background-color: #10b981 !important;
color: #fff;
diff --git a/src/components/MemberPicker/MemberPicker.vue b/src/components/MemberPicker/MemberPicker.vue
index 76351ad..c0100c8 100644
--- a/src/components/MemberPicker/MemberPicker.vue
+++ b/src/components/MemberPicker/MemberPicker.vue
@@ -6,7 +6,7 @@
style="width: 100%"
placeholder="请选择成员"
@change="handleChange"
- :default-value="memberIdList && memberIdList.length ? memberIdList : '全部'"
+ :value="memberIdList && memberIdList.length ? memberIdList : '全部'"
>
全部
{{ member.name }}
@@ -28,10 +28,10 @@ export default {
...mapMutations('home', ['setMemberIdList']),
handleChange(value) {
- console.log(value);
- if (value) {
+ if (value[value.length - 1] === '') {
+ this.setMemberIdList();
+ } else if (value) {
const index = value.findIndex(item => item === '全部');
- console.log(index);
if (index !== -1) {
value.splice(index, 1);
}
diff --git a/src/store/modules/home/actions.js b/src/store/modules/home/actions.js
index 71206be..c6025de 100644
--- a/src/store/modules/home/actions.js
+++ b/src/store/modules/home/actions.js
@@ -35,6 +35,14 @@ const actions = {
const { code, msg, data } = res.data;
if (code === 200) {
commit('setMembers', data);
+ // 筛选审核人
+ let checkers = [];
+ data.forEach(item => {
+ if (item.userId && item.userId !== '0' && item.isMine !== 1) {
+ checkers.push(item);
+ }
+ });
+ commit('setCheckers', [...checkers]);
return data;
} else {
message.error(msg || '查询失败');
diff --git a/src/store/modules/home/mutations.js b/src/store/modules/home/mutations.js
index 1cd958d..22a16d4 100644
--- a/src/store/modules/home/mutations.js
+++ b/src/store/modules/home/mutations.js
@@ -26,6 +26,15 @@ const mutations = {
state.members = data;
},
+ /**
+ * 设置审核人信息
+ * @param {object} state
+ * @param {Array} data
+ */
+ setCheckers(state, data) {
+ state.checkers = data;
+ },
+
/**
* 设置开始时间
* @param {object} state
diff --git a/src/store/modules/home/state.js b/src/store/modules/home/state.js
index 2c637db..85a3d5d 100644
--- a/src/store/modules/home/state.js
+++ b/src/store/modules/home/state.js
@@ -13,6 +13,7 @@ const state = {
endTime: null,
memberIdList: [],
roleId: '',
+ checkers: [], // 审核人列表
};
export default state;