Commit 6c4b62e6 authored by wangxl's avatar wangxl

44

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