Commit 6c4b62e6 authored by wangxl's avatar wangxl

44

parent 21198a2f
......@@ -238,7 +238,7 @@ export default {
},
},
},
data() {
data () {
return {
educationList: [],
studyList: [],
......@@ -250,7 +250,7 @@ export default {
}
};
},
created() {
created () {
// 根据 resumeType 分类并排序
if (this.resumeList && this.resumeList.length > 0) {
// 学历记录
......@@ -259,8 +259,8 @@ export default {
.sort((a, b) => a.showIndex - b.showIndex)
.map(item => ({
...item,
resumeRange: item.resumeStart && item.resumeEnd ?
[moment(item.resumeStart), moment(item.resumeEnd)] : []
resumeRange: item.resumeStart && item.resumeEnd ?
[item.resumeStart, item.resumeEnd] : []
}))
// 研修经历
......@@ -269,8 +269,8 @@ export default {
.sort((a, b) => a.showIndex - b.showIndex)
.map(item => ({
...item,
resumeRange: item.resumeStart && item.resumeEnd ?
[moment(item.resumeStart), moment(item.resumeEnd)] : []
resumeRange: item.resumeStart && item.resumeEnd ?
[item.resumeStart, item.resumeEnd] : []
}))
// 工作经历
......@@ -279,8 +279,8 @@ export default {
.sort((a, b) => a.showIndex - b.showIndex)
.map(item => ({
...item,
resumeRange: item.resumeStart && item.resumeEnd ?
[moment(item.resumeStart), moment(item.resumeEnd)] : []
resumeRange: item.resumeStart && item.resumeEnd ?
[item.resumeStart, item.resumeEnd] : []
}))
this.formModel.educationList = this.educationList
......@@ -291,26 +291,26 @@ export default {
methods: {
moment,
checkDateRange,
educationDateChange(dates, dateStrings, index) {
educationDateChange (dates, dateStrings, index) {
if (dateStrings[0] && dateStrings[1]) {
this.educationList[index].resumeStart = dateStrings[0]
this.educationList[index].resumeEnd = dateStrings[1]
}
},
studyDateChange(dates, dateStrings, index) {
studyDateChange (dates, dateStrings, index) {
if (dateStrings[0] && dateStrings[1]) {
this.studyList[index].resumeStart = dateStrings[0]
this.studyList[index].resumeEnd = dateStrings[1]
}
},
workDateChange(dates, dateStrings, index) {
workDateChange (dates, dateStrings, index) {
if (dateStrings[0] && dateStrings[1]) {
this.workList[index].resumeStart = dateStrings[0]
this.workList[index].resumeEnd = dateStrings[1]
}
},
addEducationArray() {
const newItem = {
addEducationArray () {
const newItem = {
...Education,
showIndex: this.educationList.length + 1,
resumeRange: []
......@@ -320,13 +320,13 @@ export default {
this.$refs.form && this.$refs.form.clearValidate()
})
},
deleteEducationArray(item) {
deleteEducationArray (item) {
let index = this.educationList.indexOf(item)
if (index !== -1) {
this.educationList.splice(index, 1)
}
},
addStudyArray() {
addStudyArray () {
const newItem = {
...Study,
showIndex: this.studyList.length + 1,
......@@ -337,13 +337,13 @@ export default {
this.$refs.form && this.$refs.form.clearValidate()
})
},
deleteStudyArray(item) {
deleteStudyArray (item) {
let index = this.studyList.indexOf(item)
if (index !== -1) {
this.studyList.splice(index, 1)
}
},
addWorkArray() {
addWorkArray () {
const newItem = {
...Work,
showIndex: this.workList.length + 1,
......@@ -354,22 +354,22 @@ export default {
this.$refs.form && this.$refs.form.clearValidate()
})
},
deleteWorkArray(item) {
deleteWorkArray (item) {
let index = this.workList.indexOf(item)
if (index !== -1) {
this.workList.splice(index, 1)
}
},
mergeResumeList() {
mergeResumeList () {
// 清空原有数据
this.resumeList.length = 0
// 合并三个数组
const allLists = [
...this.educationList.map((item, index) => {
// 创建一个新对象,避免直接修改原对象
const newItem = { ...item }
// 安全地添加时间部分
if (newItem.resumeStart) {
newItem.resumeStart = newItem.resumeStart + " 00:00:00"
......@@ -377,7 +377,7 @@ export default {
if (newItem.resumeEnd) {
newItem.resumeEnd = newItem.resumeEnd + " 23:59:59"
}
newItem.showIndex = index + 1
return newItem
}),
......@@ -404,38 +404,38 @@ export default {
return newItem
})
]
// 移除 resumeRange 字段,因为后端不需要
const cleanedList = allLists.map(item => {
const newItem = { ...item }
delete newItem.resumeRange
return newItem
})
// 更新 resumeList
this.resumeList.push(...cleanedList)
//console.log('合并后的简历列表:', this.resumeList)
return this.resumeList
}
},
watch: {
educationList: {
handler(val) {
handler (val) {
this.formModel.educationList = val
},
deep: true,
immediate: true
},
studyList: {
handler(val) {
handler (val) {
this.formModel.studyList = val
},
deep: true,
immediate: true
},
workList: {
handler(val) {
handler (val) {
this.formModel.workList = val
},
deep: true,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment