|
|
|
|
@ -180,6 +180,16 @@
|
|
|
|
|
<span>{{ parseTime(scope.row.fillTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="开始时间" align="center" prop="beginDate" width="180" v-if="columns[23].visible">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<span>{{ parseTime(scope.row.beginDate, '{y}-{m}-{d}') }}</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="结束时间" align="center" prop="endDate" width="180" v-if="columns[24].visible">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<span>{{ parseTime(scope.row.endDate, '{y}-{m}-{d}') }}</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="所在的工作周" align="center" prop="currentWorkWeek" width="100" v-if="columns[4].visible" />
|
|
|
|
|
<el-table-column label="所属里程碑" align="center" prop="milestonePlan" width="100" v-if="columns[5].visible" />
|
|
|
|
|
<el-table-column label="二级进度阶段" align="center" prop="secondaryPhase" width="100" v-if="columns[6].visible" />
|
|
|
|
|
@ -255,20 +265,30 @@
|
|
|
|
|
<el-form-item label="填写日期" prop="fillTime">
|
|
|
|
|
<el-date-picker
|
|
|
|
|
clearable
|
|
|
|
|
v-model="datePart"
|
|
|
|
|
type="date"
|
|
|
|
|
format="YYYY-MM-DD"
|
|
|
|
|
value-format="YYYY-MM-DD"
|
|
|
|
|
v-model="projectReportForm.fillTime"
|
|
|
|
|
type="datetime"
|
|
|
|
|
value-format="YYYY-MM-DD HH:mm:ss"
|
|
|
|
|
placeholder="请选择填写日期"
|
|
|
|
|
@change="handleDateChange"
|
|
|
|
|
:disabled="true"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<!-- <el-col :span="12">
|
|
|
|
|
<el-form-item label="所在的工作周" prop="currentWorkWeek">
|
|
|
|
|
<el-input v-model="projectReportForm.currentWorkWeek" placeholder="请输入所在的工作周" clearable />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-col> -->
|
|
|
|
|
<el-form-item label="起始时间">
|
|
|
|
|
<el-date-picker
|
|
|
|
|
v-model="dateRange"
|
|
|
|
|
value-format="YYYY-MM-DD HH:mm:ss"
|
|
|
|
|
type="daterange"
|
|
|
|
|
range-separator="-"
|
|
|
|
|
start-placeholder="开始日期"
|
|
|
|
|
end-placeholder="结束日期"
|
|
|
|
|
:default-time="[new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 1, 1, 23, 59, 59)]"
|
|
|
|
|
></el-date-picker>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="所属里程碑" prop="milestonePlan">
|
|
|
|
|
<el-input v-model="projectReportForm.milestonePlan" placeholder="请输入所属里程碑" clearable />
|
|
|
|
|
@ -569,13 +589,13 @@ import {
|
|
|
|
|
ProjectReportDetailFormEx
|
|
|
|
|
} from '@/api/oa/erp/projectReportDetail/types';
|
|
|
|
|
import ProjectSelect from '@/components/ProjectSelect/index.vue';
|
|
|
|
|
// 导入FileUpload组件
|
|
|
|
|
import FileUpload from '@/components/FileUpload/index.vue';
|
|
|
|
|
import download from '@/plugins/download';
|
|
|
|
|
|
|
|
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
|
|
const route = useRoute();
|
|
|
|
|
const router = useRouter();
|
|
|
|
|
const dateRange = ref<[DateModelType, DateModelType]>(['', '']);
|
|
|
|
|
const modifiedPageType = computed(() => {
|
|
|
|
|
// 在新增状态下且存在审批中记录时,将 pageType 改为 'view' 来隐藏提交按钮
|
|
|
|
|
if (routeParams.value.type === 'add' && projectReportForm.value.flowStatus === 'waiting') {
|
|
|
|
|
@ -733,7 +753,9 @@ const initProjectReportFormData: ProjectReportDetailFormEx = {
|
|
|
|
|
bizExt: undefined,
|
|
|
|
|
variables: undefined,
|
|
|
|
|
createTime: undefined,
|
|
|
|
|
updateTime: undefined
|
|
|
|
|
updateTime: undefined,
|
|
|
|
|
beginDate: undefined,
|
|
|
|
|
endDate: undefined
|
|
|
|
|
} as any;
|
|
|
|
|
const projectReportForm = ref<ProjectReportDetailFormEx>({ ...initProjectReportFormData });
|
|
|
|
|
// 新增模式下项目周报明细表单规则验证
|
|
|
|
|
@ -798,7 +820,9 @@ const initProjectReportDetailFormData: ProjectReportDetailForm = {
|
|
|
|
|
contractId: undefined,
|
|
|
|
|
ossId: undefined,
|
|
|
|
|
remark: undefined,
|
|
|
|
|
activeFlag: undefined
|
|
|
|
|
activeFlag: undefined,
|
|
|
|
|
beginDate: undefined,
|
|
|
|
|
endDate: undefined
|
|
|
|
|
};
|
|
|
|
|
const projectReportDetailData = reactive<PageData<ProjectReportDetailForm, ProjectReportDetailQuery>>({
|
|
|
|
|
form: { ...initProjectReportDetailFormData },
|
|
|
|
|
@ -824,6 +848,8 @@ const projectReportDetailData = reactive<PageData<ProjectReportDetailForm, Proje
|
|
|
|
|
contractId: undefined,
|
|
|
|
|
ossId: undefined,
|
|
|
|
|
activeFlag: undefined,
|
|
|
|
|
beginDate: undefined,
|
|
|
|
|
endDate: undefined,
|
|
|
|
|
params: {}
|
|
|
|
|
},
|
|
|
|
|
rules: {
|
|
|
|
|
@ -975,7 +1001,7 @@ const columns = ref<FieldOption[]>([
|
|
|
|
|
{ key: 1, label: `项目周报ID`, visible: false },
|
|
|
|
|
{ key: 2, label: `项目ID`, visible: false },
|
|
|
|
|
{ key: 3, label: `填写日期`, visible: true },
|
|
|
|
|
{ key: 4, label: `所在的工作周`, visible: true },
|
|
|
|
|
{ key: 4, label: `所在的工作周`, visible: false },
|
|
|
|
|
{ key: 5, label: `所属里程碑`, visible: true },
|
|
|
|
|
{ key: 6, label: `二级进度阶段`, visible: true },
|
|
|
|
|
{ key: 7, label: `本周完成工作`, visible: true },
|
|
|
|
|
@ -993,11 +1019,11 @@ const columns = ref<FieldOption[]>([
|
|
|
|
|
{ key: 19, label: `备注`, visible: false },
|
|
|
|
|
{ key: 20, label: `激活标识`, visible: false },
|
|
|
|
|
{ key: 21, label: `创建时间`, visible: true },
|
|
|
|
|
{ key: 22, label: `更新时间`, visible: true }
|
|
|
|
|
{ key: 22, label: `更新时间`, visible: true },
|
|
|
|
|
// { key: 21, label: `删除标志`, visible: true },
|
|
|
|
|
// { key: 22, label: `创建部门`, visible: true },
|
|
|
|
|
// { key: 23, label: `创建时间`, visible: true },
|
|
|
|
|
// { key: 24, label: `创建人`, visible: true },
|
|
|
|
|
{ key: 23, label: `开始时间`, visible: true },
|
|
|
|
|
{ key: 24, label: `结束时间`, visible: true }
|
|
|
|
|
// { key: 25, label: `更新人`, visible: true },
|
|
|
|
|
// { key: 26, label: `更新时间`, visible: true }
|
|
|
|
|
]);
|
|
|
|
|
@ -1126,185 +1152,6 @@ const submitProjectReportForm = () => {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
// 添加响应式变量来存储日期部分
|
|
|
|
|
const datePart = ref(''); // 日期部分(YYYY-MM-DD)
|
|
|
|
|
// 统一处理日期时间格式的函数
|
|
|
|
|
const formatDateTime = (dateStr?: string, includeTime: boolean = true): string => {
|
|
|
|
|
if (!dateStr) {
|
|
|
|
|
const now = new Date();
|
|
|
|
|
const year = now.getFullYear();
|
|
|
|
|
const month = String(now.getMonth() + 1).padStart(2, '0');
|
|
|
|
|
const day = String(now.getDate()).padStart(2, '0');
|
|
|
|
|
|
|
|
|
|
if (includeTime) {
|
|
|
|
|
const hours = String(now.getHours()).padStart(2, '0');
|
|
|
|
|
const minutes = String(now.getMinutes()).padStart(2, '0');
|
|
|
|
|
const seconds = String(now.getSeconds()).padStart(2, '0');
|
|
|
|
|
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
|
|
|
|
}
|
|
|
|
|
return `${year}-${month}-${day}`;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 如果传入的日期字符串已经包含时间,直接返回
|
|
|
|
|
if (dateStr.includes(' ')) {
|
|
|
|
|
return dateStr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 如果只有日期,添加默认时间
|
|
|
|
|
if (includeTime) {
|
|
|
|
|
const now = new Date();
|
|
|
|
|
const hours = String(now.getHours()).padStart(2, '0');
|
|
|
|
|
const minutes = String(now.getMinutes()).padStart(2, '0');
|
|
|
|
|
const seconds = String(now.getSeconds()).padStart(2, '0');
|
|
|
|
|
return `${dateStr} ${hours}:${minutes}:${seconds}`;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return dateStr;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 解析日期时间,提取日期部分
|
|
|
|
|
const parseDatePart = (dateTimeStr?: string): string => {
|
|
|
|
|
if (!dateTimeStr) return '';
|
|
|
|
|
|
|
|
|
|
const [date] = dateTimeStr.split(' ');
|
|
|
|
|
return date || '';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 工作周计算函数 - 包含星期几
|
|
|
|
|
const getWorkWeek = (dateString: string): string => {
|
|
|
|
|
if (!dateString) return '';
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
// 处理可能包含时间的字符串
|
|
|
|
|
const [datePart] = dateString.split(' ');
|
|
|
|
|
const date = new Date(datePart);
|
|
|
|
|
|
|
|
|
|
if (isNaN(date.getTime())) {
|
|
|
|
|
console.warn('无效的日期格式:', dateString);
|
|
|
|
|
return '';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const year = date.getFullYear();
|
|
|
|
|
const firstDayOfYear = new Date(year, 0, 1);
|
|
|
|
|
|
|
|
|
|
// 使用时间戳计算天数差
|
|
|
|
|
const timeDiff = date.getTime() - firstDayOfYear.getTime();
|
|
|
|
|
const days = Math.floor(timeDiff / (24 * 60 * 60 * 1000)) + 1;
|
|
|
|
|
|
|
|
|
|
// 计算周数
|
|
|
|
|
const firstDayWeek = firstDayOfYear.getDay();
|
|
|
|
|
const isoFirstDayWeek = firstDayWeek === 0 ? 7 : firstDayWeek;
|
|
|
|
|
const weekNumber = Math.ceil((days + isoFirstDayWeek - 1) / 7);
|
|
|
|
|
|
|
|
|
|
// 获取星期几(0-周日,1-周一,...,6-周六)
|
|
|
|
|
const weekday = date.getDay();
|
|
|
|
|
const weekdays = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
|
|
|
|
|
|
|
|
|
|
return `${weekdays[weekday]}`;
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error('计算工作周失败:', error);
|
|
|
|
|
return '';
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 初始化默认日期
|
|
|
|
|
const initDefaultDate = () => {
|
|
|
|
|
if (routeParams.value.type === 'add') {
|
|
|
|
|
// 确保 fillTime 有完整的日期时间格式
|
|
|
|
|
if (!projectReportForm.value.fillTime) {
|
|
|
|
|
projectReportForm.value.fillTime = formatDateTime();
|
|
|
|
|
} else {
|
|
|
|
|
// 确保已有的 fillTime 是完整的格式
|
|
|
|
|
projectReportForm.value.fillTime = formatDateTime(projectReportForm.value.fillTime, true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 从 fillTime 中提取日期部分设置到 datePart
|
|
|
|
|
datePart.value = parseDatePart(projectReportForm.value.fillTime);
|
|
|
|
|
|
|
|
|
|
// 计算工作周
|
|
|
|
|
if (datePart.value) {
|
|
|
|
|
projectReportForm.value.currentWorkWeek = getWorkWeek(datePart.value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 处理日期变化 - 优化版本
|
|
|
|
|
const handleDateChange = (selectedDate: string) => {
|
|
|
|
|
if (selectedDate) {
|
|
|
|
|
// 获取当前的时间部分,如果已有 fillTime 则保留原时间,否则使用当前时间
|
|
|
|
|
let timeStr = '00:00:00'; // 默认时间
|
|
|
|
|
|
|
|
|
|
if (projectReportForm.value.fillTime && projectReportForm.value.fillTime.includes(' ')) {
|
|
|
|
|
const [, existingTime] = projectReportForm.value.fillTime.split(' ');
|
|
|
|
|
if (existingTime) {
|
|
|
|
|
timeStr = existingTime;
|
|
|
|
|
} else {
|
|
|
|
|
const now = new Date();
|
|
|
|
|
const hours = String(now.getHours()).padStart(2, '0');
|
|
|
|
|
const minutes = String(now.getMinutes()).padStart(2, '0');
|
|
|
|
|
const seconds = String(now.getSeconds()).padStart(2, '0');
|
|
|
|
|
timeStr = `${hours}:${minutes}:${seconds}`;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
const now = new Date();
|
|
|
|
|
const hours = String(now.getHours()).padStart(2, '0');
|
|
|
|
|
const minutes = String(now.getMinutes()).padStart(2, '0');
|
|
|
|
|
const seconds = String(now.getSeconds()).padStart(2, '0');
|
|
|
|
|
timeStr = `${hours}:${minutes}:${seconds}`;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 组合成完整的日期时间字符串
|
|
|
|
|
projectReportForm.value.fillTime = `${selectedDate} ${timeStr}`;
|
|
|
|
|
|
|
|
|
|
// 计算工作周
|
|
|
|
|
projectReportForm.value.currentWorkWeek = getWorkWeek(selectedDate);
|
|
|
|
|
} else {
|
|
|
|
|
// 如果清空了日期
|
|
|
|
|
projectReportForm.value.fillTime = '';
|
|
|
|
|
projectReportForm.value.currentWorkWeek = '';
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 添加修改对话框的日期部分变量
|
|
|
|
|
const modifyDatePart = ref('');
|
|
|
|
|
|
|
|
|
|
// 处理修改对话框日期变化
|
|
|
|
|
const handleModifyDateChange = (selectedDate: string) => {
|
|
|
|
|
if (selectedDate) {
|
|
|
|
|
// 获取当前的时间部分,如果已有 fillTime 则保留原时间
|
|
|
|
|
let timeStr = '00:00:00'; // 默认时间
|
|
|
|
|
|
|
|
|
|
if (detailForm.value.fillTime && detailForm.value.fillTime.includes(' ')) {
|
|
|
|
|
const [, existingTime] = detailForm.value.fillTime.split(' ');
|
|
|
|
|
if (existingTime) {
|
|
|
|
|
timeStr = existingTime;
|
|
|
|
|
} else {
|
|
|
|
|
const now = new Date();
|
|
|
|
|
const hours = String(now.getHours()).padStart(2, '0');
|
|
|
|
|
const minutes = String(now.getMinutes()).padStart(2, '0');
|
|
|
|
|
const seconds = String(now.getSeconds()).padStart(2, '0');
|
|
|
|
|
timeStr = `${hours}:${minutes}:${seconds}`;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
const now = new Date();
|
|
|
|
|
const hours = String(now.getHours()).padStart(2, '0');
|
|
|
|
|
const minutes = String(now.getMinutes()).padStart(2, '0');
|
|
|
|
|
const seconds = String(now.getSeconds()).padStart(2, '0');
|
|
|
|
|
timeStr = `${hours}:${minutes}:${seconds}`;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 组合成完整的日期时间字符串
|
|
|
|
|
detailForm.value.fillTime = `${selectedDate} ${timeStr}`;
|
|
|
|
|
|
|
|
|
|
// 计算工作周
|
|
|
|
|
detailForm.value.currentWorkWeek = getWorkWeek(selectedDate);
|
|
|
|
|
} else {
|
|
|
|
|
// 如果清空了日期
|
|
|
|
|
detailForm.value.fillTime = '';
|
|
|
|
|
detailForm.value.currentWorkWeek = '';
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 审批记录
|
|
|
|
|
const handleApprovalRecord = (row?: ProjectReportDetailVO) => {
|
|
|
|
|
if (row) {
|
|
|
|
|
@ -1349,11 +1196,6 @@ const getProjectDetail = async () => {
|
|
|
|
|
reportId: form.value.reportId
|
|
|
|
|
});
|
|
|
|
|
projectReportDetailList.value = res.rows;
|
|
|
|
|
// 确保每条数据的 fillTime 都有完整格式
|
|
|
|
|
projectReportDetailList.value = res.rows.map((item) => ({
|
|
|
|
|
...item,
|
|
|
|
|
fillTime: formatDateTime(item.fillTime, true)
|
|
|
|
|
}));
|
|
|
|
|
total.value = res.total;
|
|
|
|
|
loading.value = false;
|
|
|
|
|
};
|
|
|
|
|
@ -1370,8 +1212,8 @@ const isDetailFormDisabled = computed(() => {
|
|
|
|
|
const shouldCheckApprovalData = computed(() => {
|
|
|
|
|
return (routeParams.value.type === 'add' || routeParams.value.type === 'update') && routeParams.value.reportData;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 查询是否存在审批中的数据
|
|
|
|
|
// 在 checkApprovalData 函数中确保日期格式
|
|
|
|
|
const checkApprovalData = async () => {
|
|
|
|
|
try {
|
|
|
|
|
if (!shouldCheckApprovalData.value) return;
|
|
|
|
|
@ -1396,14 +1238,12 @@ const checkApprovalData = async () => {
|
|
|
|
|
const approvalData = res.rows[0];
|
|
|
|
|
Object.assign(projectReportForm.value, approvalData);
|
|
|
|
|
|
|
|
|
|
// 确保 fillTime 有完整格式
|
|
|
|
|
projectReportForm.value.fillTime = formatDateTime(approvalData.fillTime, true);
|
|
|
|
|
|
|
|
|
|
// 设置日期部分
|
|
|
|
|
datePart.value = parseDatePart(projectReportForm.value.fillTime);
|
|
|
|
|
|
|
|
|
|
// 确保 flowStatus 被正确设置为 'waiting'
|
|
|
|
|
projectReportForm.value.flowStatus = 'waiting';
|
|
|
|
|
// 设置日期范围
|
|
|
|
|
if (approvalData.beginDate && approvalData.endDate) {
|
|
|
|
|
dateRange.value = [approvalData.beginDate, approvalData.endDate];
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
hasApprovalData.value = false;
|
|
|
|
|
}
|
|
|
|
|
@ -1433,6 +1273,15 @@ watch(
|
|
|
|
|
const submitForm = async (status: string, mode: boolean) => {
|
|
|
|
|
try {
|
|
|
|
|
buttonLoading.value = true;
|
|
|
|
|
// 处理日期范围数据
|
|
|
|
|
if (dateRange.value && dateRange.value.length === 2) {
|
|
|
|
|
// 将日期范围拆分为 beginDate 和 endDate
|
|
|
|
|
projectReportForm.value.beginDate = String(dateRange.value[0]);
|
|
|
|
|
projectReportForm.value.endDate = String(dateRange.value[1]);
|
|
|
|
|
} else if (projectReportForm.value.beginDate && projectReportForm.value.endDate) {
|
|
|
|
|
// 如果已经存在 beginDate 和 endDate,则设置到 dateRange 中
|
|
|
|
|
dateRange.value = [projectReportForm.value.beginDate, projectReportForm.value.endDate];
|
|
|
|
|
}
|
|
|
|
|
// 验证两个表单
|
|
|
|
|
let formValid = false;
|
|
|
|
|
let detailFormValid = false;
|
|
|
|
|
@ -1484,11 +1333,9 @@ const submitForm = async (status: string, mode: boolean) => {
|
|
|
|
|
businessTitle: '项目周报明细',
|
|
|
|
|
businessCode: msg
|
|
|
|
|
};
|
|
|
|
|
form.value.status = '0';
|
|
|
|
|
// 直接使用现有的两个表单数据
|
|
|
|
|
projectReportForm.value.projectId = form.value.projectId;
|
|
|
|
|
projectReportForm.value.flowStatus = 'waiting';
|
|
|
|
|
// projectReportForm.value.projectPhases = String(form.value.reportId);
|
|
|
|
|
|
|
|
|
|
const requestData = {
|
|
|
|
|
projectReport: form.value, // 项目周报数据
|
|
|
|
|
@ -1497,8 +1344,6 @@ const submitForm = async (status: string, mode: boolean) => {
|
|
|
|
|
const res = await projectReportSubmitAndFlowStart(requestData).finally(() => (buttonLoading.value = false));
|
|
|
|
|
projectReportForm.value = { ...projectReportForm.value, ...res.data };
|
|
|
|
|
|
|
|
|
|
// // 提交成功后清除缓存
|
|
|
|
|
// clearDraftCache();
|
|
|
|
|
proxy?.$modal.msgSuccess('操作成功');
|
|
|
|
|
proxy?.$tab.closePage();
|
|
|
|
|
router.go(-1);
|
|
|
|
|
@ -1545,14 +1390,19 @@ onMounted(async () => {
|
|
|
|
|
|
|
|
|
|
if (routeParams.value.type === 'add') {
|
|
|
|
|
// 检查是否有审批中的数据(在add模式下)
|
|
|
|
|
initDefaultDate();
|
|
|
|
|
if (shouldCheckApprovalData.value) {
|
|
|
|
|
await checkApprovalData();
|
|
|
|
|
} else {
|
|
|
|
|
Object.assign(projectReportForm.value, reportData);
|
|
|
|
|
// 确保项目周报表单的日期格式正确
|
|
|
|
|
projectReportForm.value.fillTime = formatDateTime(projectReportForm.value.fillTime, true);
|
|
|
|
|
datePart.value = parseDatePart(projectReportForm.value.fillTime);
|
|
|
|
|
// 新增模式下自动设置当前日期时间
|
|
|
|
|
const now = new Date();
|
|
|
|
|
const year = now.getFullYear();
|
|
|
|
|
const month = String(now.getMonth() + 1).padStart(2, '0');
|
|
|
|
|
const day = String(now.getDate()).padStart(2, '0');
|
|
|
|
|
const hours = String(now.getHours()).padStart(2, '0');
|
|
|
|
|
const minutes = String(now.getMinutes()).padStart(2, '0');
|
|
|
|
|
const seconds = String(now.getSeconds()).padStart(2, '0');
|
|
|
|
|
projectReportForm.value.fillTime = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
|
|
|
|
projectReportForm.value.informationNote = undefined;
|
|
|
|
|
projectReportForm.value.remark = undefined;
|
|
|
|
|
projectReportForm.value.ossId = undefined;
|
|
|
|
|
@ -1570,18 +1420,25 @@ onMounted(async () => {
|
|
|
|
|
const res = await listProjectReportDetail({ pageNum: 1, pageSize: 10, reportId: reportId });
|
|
|
|
|
if (res.rows && res.rows.length > 0) {
|
|
|
|
|
const detailData = res.rows[0];
|
|
|
|
|
// 确保日期格式正确
|
|
|
|
|
detailData.fillTime = formatDateTime(detailData.fillTime, true);
|
|
|
|
|
Object.assign(projectReportForm.value, detailData);
|
|
|
|
|
datePart.value = parseDatePart(projectReportForm.value.fillTime);
|
|
|
|
|
}
|
|
|
|
|
Object.assign(projectReportForm.value, res.rows[0]);
|
|
|
|
|
// view模式下设置日期范围
|
|
|
|
|
if (projectReportForm.value.beginDate && projectReportForm.value.endDate) {
|
|
|
|
|
dateRange.value = [projectReportForm.value.beginDate, projectReportForm.value.endDate];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
proxy?.$modal.closeLoading();
|
|
|
|
|
} else if (routeParams.value.type === 'add') {
|
|
|
|
|
// 纯新增模式,初始化默认日期和时间,会检查缓存
|
|
|
|
|
initDefaultDate();
|
|
|
|
|
} else if (routeParams.value.type === 'approval' || routeParams.value.type === 'view') {
|
|
|
|
|
// 纯新增模式,设置当前日期时间
|
|
|
|
|
const now = new Date();
|
|
|
|
|
const year = now.getFullYear();
|
|
|
|
|
const month = String(now.getMonth() + 1).padStart(2, '0');
|
|
|
|
|
const day = String(now.getDate()).padStart(2, '0');
|
|
|
|
|
const hours = String(now.getHours()).padStart(2, '0');
|
|
|
|
|
const minutes = String(now.getMinutes()).padStart(2, '0');
|
|
|
|
|
const seconds = String(now.getSeconds()).padStart(2, '0');
|
|
|
|
|
projectReportForm.value.fillTime = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
|
|
|
|
} else if (routeParams.value.type === 'approval' || routeParams.value.type === 'view' || routeParams.value.type === 'update') {
|
|
|
|
|
// 编辑或审批模式:从接口获取数据
|
|
|
|
|
const projectDetailReportId = routeParams.value.id;
|
|
|
|
|
if (projectDetailReportId) {
|
|
|
|
|
@ -1591,24 +1448,24 @@ onMounted(async () => {
|
|
|
|
|
if (reportId && routeParams.value.type === 'view') {
|
|
|
|
|
const reportRes = await getProjectReport(reportId);
|
|
|
|
|
Object.assign(form.value, reportRes.data);
|
|
|
|
|
// 确保日期格式正确
|
|
|
|
|
reportDetailRes.data.fillTime = formatDateTime(reportDetailRes.data.fillTime, true);
|
|
|
|
|
Object.assign(projectReportForm.value, reportDetailRes.data);
|
|
|
|
|
|
|
|
|
|
// 设置日期部分
|
|
|
|
|
datePart.value = parseDatePart(projectReportForm.value.fillTime);
|
|
|
|
|
projectReportDetailList.value = [reportDetailRes.data];
|
|
|
|
|
}
|
|
|
|
|
if (reportId && routeParams.value.type === 'approval') {
|
|
|
|
|
const reportRes = await getProjectReport(reportId);
|
|
|
|
|
Object.assign(form.value, reportRes.data);
|
|
|
|
|
// 确保日期格式正确
|
|
|
|
|
reportDetailRes.data.fillTime = formatDateTime(reportDetailRes.data.fillTime, true);
|
|
|
|
|
Object.assign(projectReportForm.value, reportDetailRes.data);
|
|
|
|
|
|
|
|
|
|
// 设置日期部分
|
|
|
|
|
datePart.value = parseDatePart(projectReportForm.value.fillTime);
|
|
|
|
|
}
|
|
|
|
|
// view模式下设置日期范围
|
|
|
|
|
if (projectReportForm.value.beginDate && projectReportForm.value.endDate) {
|
|
|
|
|
dateRange.value = [projectReportForm.value.beginDate, projectReportForm.value.endDate];
|
|
|
|
|
}
|
|
|
|
|
if (reportId && routeParams.value.type === 'update') {
|
|
|
|
|
const reportRes = await getProjectReport(reportId);
|
|
|
|
|
Object.assign(form.value, reportRes.data);
|
|
|
|
|
Object.assign(projectReportForm.value, reportDetailRes.data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
proxy?.$modal.closeLoading();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|