feat: 修改时间问题

This commit is contained in:
chenli
2026-01-29 15:32:10 +08:00
parent 949e49ab1b
commit 87ce9403e5

View File

@@ -1160,17 +1160,17 @@
} }
return acc; return acc;
},{}) },{})
this.formData = { const formData = {
...res.data, ...res.data,
id: this.dataForm.id, id: this.dataForm.id,
sDate: res.data.sDate,
eDate: res.data.eDate ? new Date(res.data.eDate).getTime() : null,
applyDepId: res.data.applyDepId ? String(res.data.applyDepId) : '', applyDepId: res.data.applyDepId ? String(res.data.applyDepId) : '',
applyDepName: res.data.applyDepName || '', applyDepName: res.data.applyDepName || '',
applyDepData: res.data.applyDepData || null, applyDepData: res.data.applyDepData || null,
...result ...result
}; };
console.log(this.formData,'formData123') formData.sDate = res.data.sDate ? Number(new Date(res.data.sDate).getTime()) : null;
formData.eDate = res.data.eDate ? Number(new Date(res.data.eDate).getTime()) : null;
this.formData = {...formData}
this.$nextTick(()=>{ this.$nextTick(()=>{
if (this.$refs.dynamicForm && this.$refs.dynamicForm.setFormData) { if (this.$refs.dynamicForm && this.$refs.dynamicForm.setFormData) {
this.$refs.dynamicForm.setFormData('applyDepId', this.formData.applyDepId); this.$refs.dynamicForm.setFormData('applyDepId', this.formData.applyDepId);
@@ -1451,8 +1451,8 @@
sumbitForm(data, callback) { sumbitForm(data, callback) {
const {billNoPrefix} = this.config const {billNoPrefix} = this.config
if (!data) return; if (!data) return;
const filePathArr = [...data.attachment] const filePathArr =Array(data.attachment) ? [...data.attachment] : [data.attachment]
const attachment = filePathArr.map(item => item.fileUrl) const attachment = !!filePathArr.length ? filePathArr.map(item => item.fileUrl) : []
this.btnLoading = true; this.btnLoading = true;
const applyDepName = this.deptList?.filter(item=>item.deptId === data.applyDepId)[0]?.deptName const applyDepName = this.deptList?.filter(item=>item.deptId === data.applyDepId)[0]?.deptName
const formData = { const formData = {
@@ -1473,8 +1473,9 @@
attachments: data.attachment, attachments: data.attachment,
data: { data: {
...formData, ...formData,
eDate: this.formatTime(formData.eDate), ...(formData?.eDate ? { eDate: this.formatTime(formData.eDate) } : {}),
sDate: this.formatTime(formData.sDate), ...(formData?.sDate ? { sDate: this.formatTime(formData.sDate) } : {})
} }
} }
const formMethod = createModel; const formMethod = createModel;