日志完成
parent
da50ed138f
commit
cf743c0dd6
|
@ -2,13 +2,14 @@
|
||||||
<div class="leftBox">
|
<div class="leftBox">
|
||||||
<div class="topBox">
|
<div class="topBox">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="selectedDate"
|
v-model="selectMonth"
|
||||||
type="month"
|
type="month"
|
||||||
format="yyyy年MM月"
|
format="yyyy年MM月"
|
||||||
:clearable="false"
|
:clearable="false"
|
||||||
style="margin-bottom: 10px; width: 150px"
|
style="margin-bottom: 10px; width: 150px"
|
||||||
@change="changeMonth"
|
@change="changeMonth"
|
||||||
prefix-icon="false"
|
prefix-icon="false"
|
||||||
|
value-format="yyyy-MM-dd"
|
||||||
/>
|
/>
|
||||||
<div>
|
<div>
|
||||||
<i
|
<i
|
||||||
|
@ -24,7 +25,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-calendar v-model="selectedDate">
|
<el-calendar v-model="selectMonthValue">
|
||||||
<template #dateCell="{ data }">
|
<template #dateCell="{ data }">
|
||||||
<div
|
<div
|
||||||
:key="data.day"
|
:key="data.day"
|
||||||
|
@ -33,6 +34,9 @@
|
||||||
:class="{
|
:class="{
|
||||||
dayBox: true,
|
dayBox: true,
|
||||||
disabled: isOverDay(data.day),
|
disabled: isOverDay(data.day),
|
||||||
|
hasLog: calendarList.filter(
|
||||||
|
(ele) => ele.date == data.day + ' 00:00:00' && ele.state != -1
|
||||||
|
).length,
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
{{ data.day.split("-")[2] }}
|
{{ data.day.split("-")[2] }}
|
||||||
|
@ -49,23 +53,36 @@ export default {
|
||||||
name: "LeftMonth",
|
name: "LeftMonth",
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
selectedDate: this.moment(new Date()).format("YYYY-MM-DD"),
|
selectMonth: this.moment().format("YYYY-MM"),
|
||||||
nowDay: this.moment(new Date()).format("YYYY-MM-DD"),
|
nowDay: this.moment().format("YYYY-MM-DD 23:59:59"),
|
||||||
|
userId: this.$store.state.user.id,
|
||||||
|
calendarList: [],
|
||||||
|
selectDay:
|
||||||
|
this.moment().date() > 10
|
||||||
|
? "0" + this.moment().date()
|
||||||
|
: this.moment().date(),
|
||||||
|
selectMonthValue: this.moment().format("YYYY-MM-DD"),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
changeMonth() {},
|
|
||||||
preMonth() {
|
preMonth() {
|
||||||
this.selectedDate = this.moment(this.selectedDate)
|
this.selectDay = "01";
|
||||||
|
this.selectMonth = this.moment(this.selectMonth)
|
||||||
.subtract(1, "months")
|
.subtract(1, "months")
|
||||||
.format("YYYY-MM-DD");
|
.format(`YYYY-MM-${this.selectDay}`);
|
||||||
|
this.changeMonth();
|
||||||
},
|
},
|
||||||
nextMonth() {
|
nextMonth() {
|
||||||
this.selectedDate = this.moment(this.selectedDate)
|
this.selectDay = "01";
|
||||||
|
this.selectMonth = this.moment(this.selectMonth)
|
||||||
.add(1, "months")
|
.add(1, "months")
|
||||||
.format("YYYY-MM-DD");
|
.format(`YYYY-MM-${this.selectDay}`);
|
||||||
|
this.changeMonth();
|
||||||
},
|
},
|
||||||
searchLog(data, overDay) {
|
searchLog(data, overDay) {
|
||||||
|
let checkMonth = this.moment(data.day).format("YYYY-MM");
|
||||||
|
let selectMonth = this.moment(this.selectMonth).format("YYYY-MM");
|
||||||
|
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
if (overDay) {
|
if (overDay) {
|
||||||
this.$message({
|
this.$message({
|
||||||
|
@ -74,15 +91,64 @@ export default {
|
||||||
});
|
});
|
||||||
this.$emit("setDisableTable", true);
|
this.$emit("setDisableTable", true);
|
||||||
} else {
|
} else {
|
||||||
this.$emit("setDisableTable", false);
|
this.selectDay = data.day.split("-")[2];
|
||||||
|
if (selectMonth !== checkMonth) {
|
||||||
|
this.selectMonth = data.day;
|
||||||
|
this.getLogMonth();
|
||||||
|
}
|
||||||
this.$emit("searchDay", data.day + " 00:00:00");
|
this.$emit("searchDay", data.day + " 00:00:00");
|
||||||
|
this.$emit("setDisableTable", false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
isOverDay(data) {
|
isOverDay(data) {
|
||||||
return new Date(data).getTime() > new Date(this.nowDay).getTime();
|
return new Date(data).getTime() > new Date(this.nowDay).getTime();
|
||||||
},
|
},
|
||||||
}
|
getLogMonth() {
|
||||||
|
if (this.$route.query.userId) {
|
||||||
|
this.userId = this.$route.query.userId;
|
||||||
|
}
|
||||||
|
let start = this.moment(this.selectMonth)
|
||||||
|
.startOf("month")
|
||||||
|
.format(`YYYY-MM-DD 00:00:00`);
|
||||||
|
let end = this.moment(this.selectMonth)
|
||||||
|
.endOf("month")
|
||||||
|
.format("YYYY-MM-DD 23:59:59");
|
||||||
|
|
||||||
|
workLogApi
|
||||||
|
.getLogData({
|
||||||
|
startDate: start,
|
||||||
|
endDate: end,
|
||||||
|
userId: this.userId,
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
this.calendarList = res.data;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
changeMonth() {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
if (this.selectMonth == this.selectMonthValue) return;
|
||||||
|
this.selectDay = "01";
|
||||||
|
this.selectMonth = this.moment(this.selectMonth).format(
|
||||||
|
`YYYY-MM-${this.selectDay}`
|
||||||
|
);
|
||||||
|
this.selectMonthValue = this.selectMonth;
|
||||||
|
this.searchLog(
|
||||||
|
{ day: this.selectMonth },
|
||||||
|
this.isOverDay(this.selectMonth)
|
||||||
|
);
|
||||||
|
this.searchLog(
|
||||||
|
{ day: this.selectMonth },
|
||||||
|
this.isOverDay(this.selectMonth)
|
||||||
|
);
|
||||||
|
this.getLogMonth();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
watch: {},
|
||||||
|
mounted() {
|
||||||
|
this.getLogMonth();
|
||||||
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -110,6 +176,11 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tbody {
|
tbody {
|
||||||
|
.hasLog {
|
||||||
|
background: #a2c6f2;
|
||||||
|
border-radius: 50%;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
td {
|
td {
|
||||||
border: none;
|
border: none;
|
||||||
padding: 10px 0;
|
padding: 10px 0;
|
||||||
|
@ -129,7 +200,7 @@ export default {
|
||||||
&.prev {
|
&.prev {
|
||||||
color: #333 !important;
|
color: #333 !important;
|
||||||
}
|
}
|
||||||
&.is-selected .el-calendar-day {
|
&.is-selected .dayBox:not(.disabled) {
|
||||||
border-radius: 50% !important;
|
border-radius: 50% !important;
|
||||||
background-color: #4096ff;
|
background-color: #4096ff;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
|
|
|
@ -3,7 +3,9 @@
|
||||||
<div class="topBox" v-show="!disableTable">
|
<div class="topBox" v-show="!disableTable">
|
||||||
<div>
|
<div>
|
||||||
<div class="topTitle">当日日志</div>
|
<div class="topTitle">当日日志</div>
|
||||||
<div class="topText">总计填报工时:<span>1</span>天</div>
|
<div class="topText">
|
||||||
|
总计填报工时:<span> {{ totalWorkTime }} </span>天
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<el-button type="primary" @click="handleAdd">
|
<el-button type="primary" @click="handleAdd">
|
||||||
|
@ -77,7 +79,7 @@
|
||||||
v-model="scope.row.demandId"
|
v-model="scope.row.demandId"
|
||||||
placeholder="进行中且时间匹配的需求"
|
placeholder="进行中且时间匹配的需求"
|
||||||
class="filter-select"
|
class="filter-select"
|
||||||
@change="openContent"
|
@change="openContent(scope.row)"
|
||||||
ref="demandSelectRef"
|
ref="demandSelectRef"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
|
@ -94,13 +96,12 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="工作内容" prop="workContent">
|
<el-table-column label="工作内容" prop="workContent">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<div @click="openContent">
|
<div @click="openContent(scope.row)">
|
||||||
<el-popover
|
<el-popover
|
||||||
v-if="scope.row.edit"
|
|
||||||
placement="bottom"
|
placement="bottom"
|
||||||
width="400"
|
width="400"
|
||||||
trigger="click"
|
trigger="click"
|
||||||
v-model="showContent"
|
v-model="scope.row.showContent"
|
||||||
:key="scope.row.loggerId"
|
:key="scope.row.loggerId"
|
||||||
>
|
>
|
||||||
<el-input
|
<el-input
|
||||||
|
@ -111,6 +112,12 @@
|
||||||
:disabled="!scope.row.edit"
|
:disabled="!scope.row.edit"
|
||||||
>
|
>
|
||||||
</el-input>
|
</el-input>
|
||||||
|
<div style="margin-top: 10px; text-align: right" v-show="!disableTable">
|
||||||
|
<el-button type="primary" @click="saveContent(scope.row, 1)"
|
||||||
|
>确认</el-button
|
||||||
|
>
|
||||||
|
<el-button @click="saveContent(scope.row, 0)">取消</el-button>
|
||||||
|
</div>
|
||||||
<div slot="reference">
|
<div slot="reference">
|
||||||
<div
|
<div
|
||||||
style="cursor: pointer"
|
style="cursor: pointer"
|
||||||
|
@ -123,17 +130,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-popover>
|
</el-popover>
|
||||||
|
|
||||||
<div
|
|
||||||
v-show="!scope.row.edit"
|
|
||||||
style="cursor: pointer"
|
|
||||||
:class="{
|
|
||||||
contentText: true,
|
|
||||||
noneText: !scope.row.workContent,
|
|
||||||
}"
|
|
||||||
>
|
|
||||||
{{ scope.row.workContent || "请输入" }}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
@ -163,7 +159,7 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" width="120">
|
<el-table-column label="操作" width="120">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<div>
|
<div v-show="!disableTable">
|
||||||
<el-button type="text" @click="handleEdit(scope.row)">
|
<el-button type="text" @click="handleEdit(scope.row)">
|
||||||
{{ scope.row.loggerId && !scope.row.edit ? "编辑" : "确认" }}
|
{{ scope.row.loggerId && !scope.row.edit ? "编辑" : "确认" }}
|
||||||
</el-button>
|
</el-button>
|
||||||
|
@ -207,7 +203,7 @@ export default {
|
||||||
demandList: [],
|
demandList: [],
|
||||||
hasTimeLong: 0,
|
hasTimeLong: 0,
|
||||||
workTimeList: [],
|
workTimeList: [],
|
||||||
showContent: false,
|
oldContent: "",
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -229,6 +225,7 @@ export default {
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
this.tableData = res.data.map((ele) => {
|
this.tableData = res.data.map((ele) => {
|
||||||
ele.edit = false;
|
ele.edit = false;
|
||||||
|
ele.showContent = false;
|
||||||
return ele;
|
return ele;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -247,6 +244,7 @@ export default {
|
||||||
message: "删除成功!",
|
message: "删除成功!",
|
||||||
});
|
});
|
||||||
this.getLogList();
|
this.getLogList();
|
||||||
|
this.$emit("changeCaleder");
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch(() => {});
|
.catch(() => {});
|
||||||
|
@ -267,10 +265,14 @@ export default {
|
||||||
}
|
}
|
||||||
this.versionList = [];
|
this.versionList = [];
|
||||||
this.demandList = [];
|
this.demandList = [];
|
||||||
|
this.oldContent = "";
|
||||||
this.getDayTime("add");
|
this.getDayTime("add");
|
||||||
},
|
},
|
||||||
async handleEdit(row) {
|
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({
|
this.$message({
|
||||||
message: "请先保存未完成数据",
|
message: "请先保存未完成数据",
|
||||||
type: "warning",
|
type: "warning",
|
||||||
|
@ -299,12 +301,14 @@ export default {
|
||||||
await workLogApi.editLog(param);
|
await workLogApi.editLog(param);
|
||||||
} else {
|
} else {
|
||||||
await workLogApi.addLog(param);
|
await workLogApi.addLog(param);
|
||||||
|
this.$emit("changeCaleder");
|
||||||
}
|
}
|
||||||
this.$modal.msgSuccess("操作成功");
|
this.$modal.msgSuccess("操作成功");
|
||||||
row.edit = false;
|
row.edit = false;
|
||||||
this.getLogList();
|
this.getLogList();
|
||||||
} else {
|
} else {
|
||||||
row.edit = true;
|
row.edit = true;
|
||||||
|
this.oldContent = row.workContent;
|
||||||
this.getDayTime("edit", row);
|
this.getDayTime("edit", row);
|
||||||
this.getVersionList(row.projectId, row, true);
|
this.getVersionList(row.projectId, row, true);
|
||||||
}
|
}
|
||||||
|
@ -368,8 +372,6 @@ export default {
|
||||||
},
|
},
|
||||||
async getDemandList(val, row, isOpen) {
|
async getDemandList(val, row, isOpen) {
|
||||||
if (!isOpen) row.demandId = "";
|
if (!isOpen) row.demandId = "";
|
||||||
console.log(222, this.versionList);
|
|
||||||
|
|
||||||
if (this.versionList.find((ele) => ele.id == val)) {
|
if (this.versionList.find((ele) => ele.id == val)) {
|
||||||
this.demandList = this.versionList.find(
|
this.demandList = this.versionList.find(
|
||||||
(ele) => ele.id == val
|
(ele) => ele.id == val
|
||||||
|
@ -379,15 +381,25 @@ export default {
|
||||||
}
|
}
|
||||||
if (!isOpen) this.$refs.demandSelectRef.toggleMenu();
|
if (!isOpen) this.$refs.demandSelectRef.toggleMenu();
|
||||||
},
|
},
|
||||||
openContent() {
|
openContent(row) {
|
||||||
console.log(123);
|
row.showContent = true;
|
||||||
|
},
|
||||||
this.showContent = true;
|
saveContent(row, type) {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
if (type == 0) {
|
||||||
|
row.workContent = this.oldContent;
|
||||||
|
} else {
|
||||||
|
this.oldContent = row.workContent;
|
||||||
|
}
|
||||||
|
row.showContent = false;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
$route(to, from) {
|
$route(to, from) {
|
||||||
if (!this.$route.query.userId) {
|
if (this.$route.query.userId) {
|
||||||
|
console.log(1234444);
|
||||||
|
|
||||||
this.init();
|
this.init();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -411,6 +423,16 @@ export default {
|
||||||
ele.projectState == 1
|
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() {
|
mounted() {
|
||||||
this.init();
|
this.init();
|
||||||
|
@ -450,6 +472,7 @@ export default {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
word-break: break-all;
|
||||||
}
|
}
|
||||||
.noneText {
|
.noneText {
|
||||||
color: #999;
|
color: #999;
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
ref="rightRef"
|
ref="rightRef"
|
||||||
:selectDay="selectDay"
|
:selectDay="selectDay"
|
||||||
:disableTable="disableTable"
|
:disableTable="disableTable"
|
||||||
|
@changeCaleder="changeCaleder"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -32,18 +33,31 @@ export default {
|
||||||
return {
|
return {
|
||||||
selectDay: "",
|
selectDay: "",
|
||||||
disableTable: false,
|
disableTable: false,
|
||||||
|
userId: this.$store.state.user.id,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
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) {
|
searchDay(data) {
|
||||||
this.selectDay = data;
|
this.selectDay = data;
|
||||||
},
|
},
|
||||||
setDisableTable(data) {
|
setDisableTable(data) {
|
||||||
|
if (this.$route.query.userId && this.userId != this.$route.query.userId) {
|
||||||
|
data = true;
|
||||||
|
}
|
||||||
this.disableTable = data;
|
this.disableTable = data;
|
||||||
},
|
},
|
||||||
|
changeCaleder() {
|
||||||
|
this.$refs.leftRef.getLogMonth();
|
||||||
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.selectDay = this.moment().format("YYYY-MM-DD 00:00:00");
|
this.init();
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue