diff --git a/ruoyi-demo/src/main/java/com/ruoyi/mts/domain/bo/MesPlanRecordBo.java b/ruoyi-demo/src/main/java/com/ruoyi/mts/domain/bo/MesPlanRecordBo.java
index 4576091..3bc4e53 100644
--- a/ruoyi-demo/src/main/java/com/ruoyi/mts/domain/bo/MesPlanRecordBo.java
+++ b/ruoyi-demo/src/main/java/com/ruoyi/mts/domain/bo/MesPlanRecordBo.java
@@ -1,5 +1,7 @@
package com.ruoyi.mts.domain.bo;
+import cn.hutool.core.date.DatePattern;
+import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.core.validate.AddGroup;
import com.ruoyi.common.core.validate.EditGroup;
@@ -37,7 +39,8 @@ public class MesPlanRecordBo extends BaseEntity {
/**
* 记录日期
*/
- @DateTimeFormat(pattern = "yyyy-MM-dd")
+ @DateTimeFormat(pattern = DatePattern.NORM_DATE_PATTERN)
+ @JsonFormat(pattern = DatePattern.NORM_DATE_PATTERN)
private Date recordDate;
/**
@@ -46,7 +49,7 @@ public class MesPlanRecordBo extends BaseEntity {
private String remark;
private String ganttColor;
-
+
private String flag;
/**
* oss_id
diff --git a/ruoyi-demo/src/main/java/com/ruoyi/mts/domain/vo/MesPlanRecordVo.java b/ruoyi-demo/src/main/java/com/ruoyi/mts/domain/vo/MesPlanRecordVo.java
index bbfde9e..4772acc 100644
--- a/ruoyi-demo/src/main/java/com/ruoyi/mts/domain/vo/MesPlanRecordVo.java
+++ b/ruoyi-demo/src/main/java/com/ruoyi/mts/domain/vo/MesPlanRecordVo.java
@@ -1,7 +1,9 @@
package com.ruoyi.mts.domain.vo;
+import cn.hutool.core.date.DatePattern;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
+import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
@@ -34,6 +36,7 @@ public class MesPlanRecordVo implements Serializable {
/**
* 记录日期
*/
+ @JsonFormat(pattern = DatePattern.NORM_DATE_PATTERN)
private Date recordDate;
/**
diff --git a/ruoyi-ui-vue3/src/views/mts/planDetail/index.vue b/ruoyi-ui-vue3/src/views/mts/planDetail/index.vue
index 79dcfd8..f7832ce 100644
--- a/ruoyi-ui-vue3/src/views/mts/planDetail/index.vue
+++ b/ruoyi-ui-vue3/src/views/mts/planDetail/index.vue
@@ -55,8 +55,8 @@
任务备注
- 新增
- 修改
+ 新增
+
@@ -134,29 +134,24 @@
-
-
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
@@ -170,6 +165,7 @@ import dayjs from 'dayjs'
import { listPlanDetail, getPlanDetail, delPlanDetail, addPlanDetail, updatePlanDetail } from "@/api/mts/planDetail";
import { getPlanMain } from "@/api/mts/planMain";
import { queryByBo } from "@/api/mts/planrecord";
+import { addPlanRecord, updatePlanRecord } from "@/api/mts/planRecord";
const { proxy } = getCurrentInstance();
const route = useRoute();
@@ -251,7 +247,7 @@ function getDays(start, end) {
*/
function handleChangeCellStyle({ row, column, rowIndex, columnIndex }) {
// 获取两个日期之间的所有日期
- const planDates = getDays(row.planStartDate, row.planEndDate)
+ const planDates = row.record.map(v => v.recordDate)
let arr = planDates.filter(v => allDates.indexOf(v) > -1)
let cellStyle = {} //column.label == dayjs(row.planStartDate).format('YYYY-MM-DD')
@@ -279,7 +275,7 @@ const nbsp = " "
function handleName(row) {
let res = ''
if (row.parentId != 0) {
- res = res + nbsp
+ res = res + nbsp
}
return res
}
@@ -361,13 +357,69 @@ function resetQuery() {
}
const openDate = ref(false)
-const openDateRef = ref(null)
const formDate = ref({})
async function handleDate(column, row) {
- const res = await queryByBo({recordDate: column.label, detailId: row.id})
+ console.log('handleDate', column.label, row.id)
+ const res = await queryByBo({ recordDate: column.label, detailId: row.id })
console.log('res', res)
openDate.value = true
- formDate.value = res.data
+ if (res.data) {
+ formDate.value = res.data
+ }
+ formDate.value.flag = row.flag
+ formDate.value.recordDate = column.label
+ formDate.value.detailId = row.id
+}
+
+function submitFormDate() {
+ proxy.$refs["planRecordRef"].validate(valid => {
+ if (valid) {
+ buttonLoading.value = true;
+ if (formDate.value.id != null) {
+ updatePlanRecord(formDate.value).then(response => {
+ proxy.$modal.msgSuccess("修改成功");
+ openDate.value = false;
+ getList();
+ }).finally(() => {
+ buttonLoading.value = false;
+ });
+ } else {
+ addPlanRecord(formDate.value).then(response => {
+ proxy.$modal.msgSuccess("新增成功");
+ openDate.value = false;
+ getList();
+ }).finally(() => {
+ buttonLoading.value = false;
+ });
+ }
+ }
+ });
+}
+
+// 取消按钮
+function cancelDate() {
+ openDate.value = false;
+ resetDate();
+}
+
+// 表单重置
+function resetDate() {
+ formDate.value = {
+ id: null,
+ detailId: null,
+ recordDate: null,
+ startDate: null,
+ remark: null,
+ flag: null,
+ ganttColor: null,
+ ossId: null,
+ createBy: null,
+ createTime: null,
+ updateBy: null,
+ updateTime: null,
+ delFlag: null
+ };
+ proxy.resetForm("planRecordRef");
}
/** 新增按钮操作 */