diff --git a/src/utils/api.js b/src/utils/api.js index b8bc2dd..c074c0b 100644 --- a/src/utils/api.js +++ b/src/utils/api.js @@ -87,6 +87,10 @@ export const workLogApi = { method: 'put', data: data, }), + delLog: (id) => request({ + url: `/business/work/hour/${id}`, + method: 'delete', + }), } diff --git a/src/views/worklog/index.vue b/src/views/worklog/index.vue index f64275a..fb552fc 100644 --- a/src/views/worklog/index.vue +++ b/src/views/worklog/index.vue @@ -34,6 +34,7 @@ :highligt="true" ref="projectRef" style="height: 100%" + rowKey="projectId" /> @@ -107,9 +108,7 @@ disabled: isFutureDate(data.date) && isInProjectRange(data), }" > - {{ - data.day.split("-")[1] + "/" + data.day.split("-")[2] - }} + {{ data.day.split("-")[1] + "/" + data.day.split("-")[2] }} @@ -171,6 +170,7 @@ v-if="projectInfo.userId == $store.state.user.id" > 取消 + 删除 确定 @@ -313,8 +313,9 @@ export default { loggerDate: this.logForm.loggerDate, }); - this.logForm.max = - Number(res.data) + (Number(this.logForm.workTime) || 0); + this.logForm.max = ( + Number(res.data) + (Number(this.logForm.workTime) || 0) + ).toFixed(1); this.logDialogVisible = true; this.$nextTick(() => { this.changeMonth(); @@ -412,9 +413,9 @@ export default { } this.logDialogVisible = false; this.$modal.msgSuccess("操作成功"); - this.handleProjectClick(this.projectInfo); const response = await workLogApi.userProject(this.projectInfo.userId); this.projectList = response.data; + this.handleProjectClick(this.projectInfo); }, async fetchUserProjects() { try { @@ -449,6 +450,17 @@ export default { //获取项目列表 this.fetchUserProjects(); }, + // 删除日志 + delWorkLog() { + this.$modal.confirm(`是否确认删日志`).then(async () => { + await workLogApi.delLog(this.logForm.loggerId); + this.$modal.msgSuccess("操作成功"); + this.logDialogVisible=false + this.changeMonth(); + const response = await workLogApi.userProject(this.projectInfo.userId); + this.projectList = response.data; + }); + }, }, watch: { $route(to, from) { @@ -545,8 +557,8 @@ export default { color: white; /* 白色文字 */ padding: 5px 0; /* 增加一些内边距 */ } -.project-info-calendar ::v-deep .el-calendar__body th{ - height: 60px !important; +.project-info-calendar ::v-deep .el-calendar__body th { + height: 60px !important; font-weight: bold !important; font-size: 20px; } @@ -560,8 +572,8 @@ export default { .project-info-calendar .calendar-view ::v-deep .el-calendar-day.disabled { cursor: not-allowed; } -.project-info-calendar .calendar-view ::v-deep table *{ -border: none; +.project-info-calendar .calendar-view ::v-deep table * { + border: none; } .project-info-calendar .calendar-view ::v-deep .date-cell { cursor: pointer;