1.1删除功能

v1.2.0
‘wangjiuyun 2024-11-06 10:04:43 +08:00
parent 90867530d3
commit c8bb8ef089
2 changed files with 26 additions and 10 deletions

View File

@ -87,6 +87,10 @@ export const workLogApi = {
method: 'put', method: 'put',
data: data, data: data,
}), }),
delLog: (id) => request({
url: `/business/work/hour/${id}`,
method: 'delete',
}),
} }

View File

@ -34,6 +34,7 @@
:highligt="true" :highligt="true"
ref="projectRef" ref="projectRef"
style="height: 100%" style="height: 100%"
rowKey="projectId"
/> />
</div> </div>
</div> </div>
@ -107,9 +108,7 @@
disabled: isFutureDate(data.date) && isInProjectRange(data), disabled: isFutureDate(data.date) && isInProjectRange(data),
}" }"
> >
{{ {{ data.day.split("-")[1] + "/" + data.day.split("-")[2] }}
data.day.split("-")[1] + "/" + data.day.split("-")[2]
}}
</div> </div>
</template> </template>
</el-calendar> </el-calendar>
@ -171,6 +170,7 @@
v-if="projectInfo.userId == $store.state.user.id" v-if="projectInfo.userId == $store.state.user.id"
> >
<el-button @click="logDialogVisible = false">取消</el-button> <el-button @click="logDialogVisible = false">取消</el-button>
<el-button v-if="logForm.loggerId" type="danger" @click="delWorkLog"></el-button>
<el-button type="primary" @click="saveWorkLog"></el-button> <el-button type="primary" @click="saveWorkLog"></el-button>
</span> </span>
</template> </template>
@ -313,8 +313,9 @@ export default {
loggerDate: this.logForm.loggerDate, loggerDate: this.logForm.loggerDate,
}); });
this.logForm.max = this.logForm.max = (
Number(res.data) + (Number(this.logForm.workTime) || 0); Number(res.data) + (Number(this.logForm.workTime) || 0)
).toFixed(1);
this.logDialogVisible = true; this.logDialogVisible = true;
this.$nextTick(() => { this.$nextTick(() => {
this.changeMonth(); this.changeMonth();
@ -412,9 +413,9 @@ export default {
} }
this.logDialogVisible = false; this.logDialogVisible = false;
this.$modal.msgSuccess("操作成功"); this.$modal.msgSuccess("操作成功");
this.handleProjectClick(this.projectInfo);
const response = await workLogApi.userProject(this.projectInfo.userId); const response = await workLogApi.userProject(this.projectInfo.userId);
this.projectList = response.data; this.projectList = response.data;
this.handleProjectClick(this.projectInfo);
}, },
async fetchUserProjects() { async fetchUserProjects() {
try { try {
@ -449,6 +450,17 @@ export default {
// //
this.fetchUserProjects(); 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: { watch: {
$route(to, from) { $route(to, from) {
@ -545,7 +557,7 @@ export default {
color: white; /* 白色文字 */ color: white; /* 白色文字 */
padding: 5px 0; /* 增加一些内边距 */ padding: 5px 0; /* 增加一些内边距 */
} }
.project-info-calendar ::v-deep .el-calendar__body th{ .project-info-calendar ::v-deep .el-calendar__body th {
height: 60px !important; height: 60px !important;
font-weight: bold !important; font-weight: bold !important;
font-size: 20px; font-size: 20px;
@ -560,8 +572,8 @@ export default {
.project-info-calendar .calendar-view ::v-deep .el-calendar-day.disabled { .project-info-calendar .calendar-view ::v-deep .el-calendar-day.disabled {
cursor: not-allowed; cursor: not-allowed;
} }
.project-info-calendar .calendar-view ::v-deep table *{ .project-info-calendar .calendar-view ::v-deep table * {
border: none; border: none;
} }
.project-info-calendar .calendar-view ::v-deep .date-cell { .project-info-calendar .calendar-view ::v-deep .date-cell {
cursor: pointer; cursor: pointer;