+
{{ scope.row.loggerId && !scope.row.edit ? "编辑" : "确认" }}
@@ -207,7 +203,7 @@ export default {
demandList: [],
hasTimeLong: 0,
workTimeList: [],
- showContent: false,
+ oldContent: "",
};
},
methods: {
@@ -229,6 +225,7 @@ export default {
.then((res) => {
this.tableData = res.data.map((ele) => {
ele.edit = false;
+ ele.showContent = false;
return ele;
});
});
@@ -247,6 +244,7 @@ export default {
message: "删除成功!",
});
this.getLogList();
+ this.$emit("changeCaleder");
});
})
.catch(() => {});
@@ -267,10 +265,14 @@ export default {
}
this.versionList = [];
this.demandList = [];
+ this.oldContent = "";
this.getDayTime("add");
},
async handleEdit(row) {
- if (this.tableData.filter((ele) => ele.edit).length) {
+ if (
+ this.tableData.filter((ele) => ele.edit && ele.loggerId != row.loggerId)
+ .length
+ ) {
this.$message({
message: "请先保存未完成数据",
type: "warning",
@@ -299,12 +301,14 @@ export default {
await workLogApi.editLog(param);
} else {
await workLogApi.addLog(param);
+ this.$emit("changeCaleder");
}
this.$modal.msgSuccess("操作成功");
row.edit = false;
this.getLogList();
} else {
row.edit = true;
+ this.oldContent = row.workContent;
this.getDayTime("edit", row);
this.getVersionList(row.projectId, row, true);
}
@@ -368,8 +372,6 @@ export default {
},
async getDemandList(val, row, isOpen) {
if (!isOpen) row.demandId = "";
- console.log(222, this.versionList);
-
if (this.versionList.find((ele) => ele.id == val)) {
this.demandList = this.versionList.find(
(ele) => ele.id == val
@@ -379,15 +381,25 @@ export default {
}
if (!isOpen) this.$refs.demandSelectRef.toggleMenu();
},
- openContent() {
- console.log(123);
-
- this.showContent = true;
+ openContent(row) {
+ row.showContent = true;
+ },
+ saveContent(row, type) {
+ this.$nextTick(() => {
+ if (type == 0) {
+ row.workContent = this.oldContent;
+ } else {
+ this.oldContent = row.workContent;
+ }
+ row.showContent = false;
+ });
},
},
watch: {
$route(to, from) {
- if (!this.$route.query.userId) {
+ if (this.$route.query.userId) {
+ console.log(1234444);
+
this.init();
}
},
@@ -411,6 +423,16 @@ export default {
ele.projectState == 1
);
},
+ totalWorkTime() {
+ return (
+ this.tableData
+ .map((ele) => Number(ele.workTime))
+ .reduce((total, now) => {
+ console.log(now, total);
+ return now * 10 + total;
+ }, 0) / 10
+ ).toFixed(1);
+ },
},
mounted() {
this.init();
@@ -450,6 +472,7 @@ export default {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
+ word-break: break-all;
}
.noneText {
color: #999;
diff --git a/src/views/worklog/worklog.vue b/src/views/worklog/worklog.vue
index 10bed49..5198279 100644
--- a/src/views/worklog/worklog.vue
+++ b/src/views/worklog/worklog.vue
@@ -13,6 +13,7 @@
ref="rightRef"
:selectDay="selectDay"
:disableTable="disableTable"
+ @changeCaleder="changeCaleder"
/>
@@ -32,18 +33,31 @@ export default {
return {
selectDay: "",
disableTable: false,
+ userId: this.$store.state.user.id,
};
},
methods: {
+ init() {
+ this.selectDay = this.moment().format("YYYY-MM-DD 00:00:00");
+ if (this.$route.query.userId && this.userId != this.$route.query.userId) {
+ this.setDisableTable(false);
+ }
+ },
searchDay(data) {
this.selectDay = data;
},
setDisableTable(data) {
+ if (this.$route.query.userId && this.userId != this.$route.query.userId) {
+ data = true;
+ }
this.disableTable = data;
},
+ changeCaleder() {
+ this.$refs.leftRef.getLogMonth();
+ },
},
mounted() {
- this.selectDay = this.moment().format("YYYY-MM-DD 00:00:00");
+ this.init();
},
};