Commit 9a0b4040 by 前端

代码合并。bug修复

1 parent d3c98794
......@@ -250,7 +250,7 @@ export default {
text-align: center;
.date-item {
// float: left;
width: 50px;
width: 52px;
height: 60px;
margin-left: 6px;
background: #f7f8fa;
......
......@@ -493,11 +493,11 @@ export default {
data() {
// 奖励积分校验规则
const validateAwardIntegral = (rule, value, callback) => {
let reg = /(^[1-9]{1}[0-9]*$)|(^([0]{1}|[1-9]+)\.{1}[0-9]{1,2}$)/
let reg = /(^[1-9]{1}[0-9]*$)|(^([0]{1}|[1-9]+[0]*)\.{1}[0-9]{1,2}$)/
if (!value) {
callback(new Error('奖励积分不能为空'))
} else if (!reg.test(value)) {
callback(new Error('仅支持输出大于或等于0的数字,可支持小数点后两位'))
callback(new Error('仅支持输出大于0的数字,可支持小数点后两位'))
} else if (value == 0) {
callback(new Error('奖励积分应大于0'))
} else if (value > 999999) {
......@@ -919,6 +919,11 @@ export default {
if (!this.addTabList.length && !this.isClone) {
this.addTabList = this.getTab(date, dateTime)
this.taskList = this.addTabList.concat(this.oldTaskList)
console.log(this.taskList, '=====')
this.$nextTick(() => {
this.textIds = []
this.creatEdtior()
})
return
}
// 处理如果之前有修改任务日期且添加了任务,重新选择时添加任务丢失问题
......@@ -926,6 +931,10 @@ export default {
let newAddTabList = this.getTab(date, dateTime)
this.addTabList = this.delDate(newAddTabList, this.addTabList)
this.taskList = this.addTabList.concat(this.oldTaskList)
this.$nextTick(() => {
this.textIds = []
this.creatEdtior()
})
return
}
// 如果是复制
......@@ -937,12 +946,20 @@ export default {
// 在日期内
if (dateFlag >= 0) {
this.taskList = this.taskList.slice(dateFlag)
this.$nextTick(() => {
this.textIds = []
this.creatEdtior()
})
return
}
// 在日期外且第一次选择
if (dateFlag < 0 && !this.addTabList.length) {
this.addTabList = this.getTab(date, dateTime)
this.taskList = this.addTabList.concat(this.oldTaskList)
this.$nextTick(() => {
this.textIds = []
this.creatEdtior()
})
return
}
// 在日期外但不是第一次选择(重新选择时之前添加任务丢失问题)
......@@ -950,6 +967,10 @@ export default {
let newAddTabList = this.getTab(date, dateTime)
this.addTabList = this.delDate(newAddTabList, this.addTabList)
this.taskList = this.addTabList.concat(this.oldTaskList)
this.$nextTick(() => {
this.textIds = []
this.creatEdtior()
})
return
}
}
......@@ -1007,9 +1028,32 @@ export default {
if (this.isClone && !this.basicForm.activityName) this.getCloneTaskList()
// 处理当前日期之前是否可编辑处理
this.getEditTaskList()
this.cloneList = this.taskList
this.$nextTick(() => {
// this.taskList.map((item, index) => {
// item.missionList.map((itm, inx) => {
// if (itm.textType == 1) {
// this.getTextBox(itm.id, index, inx, itm.textContent)
// }
// })
// })
this.creatEdtior()
this.cloneList = this.taskList
})
return this.taskList
},
// 任务日期变化重新创建富文本
creatEdtior() {
console.log(this.taskList, '=====')
this.taskList.map((item, index) => {
item.missionList.map((itm, inx) => {
if (itm.textType == 1) {
console.log(111)
let textId = itm.id || itm.taskid
this.getTextBox(textId, index, inx, itm.textContent)
}
})
})
},
// 根据活动日期范围生成tab
getTab(startTime, endTime) {
let tabList = []
......@@ -1032,29 +1076,29 @@ export default {
startTime.setDate(startTime.getDate() + 1)
}
// 多添加一个完整周期tab
this.taskList.push({
activityTime: '-1',
missionList: [],
})
// 如果是编辑/复制页面,任务计划回显
if (this.isEditor || (this.isClone && !this.basicForm.activityName))
this.dealEcho()
if (this.isClone && this.basicForm.activityName) this.dealEcho(1)
// 处理当前日期之前是否可编辑处理
this.getEditTaskList()
// 如果是克隆,还需处理克隆时间
if (this.isClone && !this.basicForm.activityName) this.getCloneTaskList()
this.$nextTick(() => {
this.taskList.map((item, index) => {
item.missionList.map((itm, inx) => {
if (itm.textType == 1) {
this.getTextBox(itm.id, index, inx, itm.textContent)
}
})
})
this.cloneList = this.taskList
})
return this.taskList
// this.taskList.push({
// activityTime: '-1',
// missionList: [],
// })
// // 如果是编辑/复制页面,任务计划回显
// if (this.isEditor || (this.isClone && !this.basicForm.activityName))
// this.dealEcho()
// if (this.isClone && this.basicForm.activityName) this.dealEcho(1)
// // 处理当前日期之前是否可编辑处理
// this.getEditTaskList()
// // 如果是克隆,还需处理克隆时间
// if (this.isClone && !this.basicForm.activityName) this.getCloneTaskList()
// this.$nextTick(() => {
// this.taskList.map((item, index) => {
// item.missionList.map((itm, inx) => {
// if (itm.textType == 1) {
// this.getTextBox(itm.id, index, inx, itm.textContent)
// }
// })
// })
// this.cloneList = this.taskList
// })
return tabList
},
// 处理任务计划回显
dealEcho(val) {
......@@ -1082,13 +1126,13 @@ export default {
}
},
// 根据日期获取天数
getDateByDays(startDate, endDdate) {
let d1 = Date.parse(new Date(startDate))
let d2 = Date.parse(new Date(endDdate))
// 时间戳相减 / 天数
let day = parseInt((d2 - d1) / (1000 * 60 * 60 * 24)) + 1
return day
},
// getDateByDays(startDate, endDdate) {
// let d1 = Date.parse(new Date(startDate))
// let d2 = Date.parse(new Date(endDdate))
// // 时间戳相减 / 天数
// let day = parseInt((d2 - d1) / (1000 * 60 * 60 * 24)) + 1
// return day
// },
// 处理复制任务活动天数大于选择活动天数
getNextDate(date, day = 1, format = '{y}-{m}-{d}') {
if (date) {
......@@ -1307,10 +1351,10 @@ export default {
}
})
} else {
this.$nextTick(() => {
dateTask.repeatCount = ''
this.$set(dateTask, 'repeatFlag', false)
})
// this.$nextTick(() => {
dateTask.repeatCount = ''
this.$set(dateTask, 'repeatFlag', false)
// })
}
},
// 页面风格切换
......@@ -1517,7 +1561,7 @@ export default {
this.basicFormValidate()
} catch (err) {
if (err) {
this.taskList = JSON.parse(JSON.stringify(this.cloneList))
// this.taskList = JSON.parse(JSON.stringify(this.cloneList))
return
}
}
......@@ -1546,7 +1590,7 @@ export default {
}
// 处理div标签
if (itm.missionMaterialList && itm.missionMaterialList.length) {
item.missionMaterialList.map((content) => {
itm.missionMaterialList.map((content) => {
if (content.materialType == 1) {
content.materialContent = content.materialContent.replace(
/]*?>[\s\S]*?<\/div>/gi,
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!