Commit 159cd230 by 前端

处理编辑回显名称问题

1 parent bce7f7bb
...@@ -132,13 +132,16 @@ export default { ...@@ -132,13 +132,16 @@ export default {
type: String, type: String,
}, },
selectRobot: { selectRobot: {
type: Array || String, type: [Array, String],
}, },
type: { type: {
type: Boolean, type: Boolean,
}, },
errorType: {
type: Boolean,
},
robotNo: { robotNo: {
type: Number || String, type: [Number, String],
}, },
}, },
watch: { watch: {
...@@ -191,36 +194,34 @@ export default { ...@@ -191,36 +194,34 @@ export default {
// }, // },
}, },
mounted() { mounted() {
console.log(this.type, this.robotNo, this.selectRobot) console.log(this.type, this.errorType, this.robotNo, this.selectRobot)
if (this.type && this.robotNo) this.getlistDepartmentTree(this.robotNo) if (this.type && this.robotNo) this.getlistDepartmentTree(this.robotNo)
if (this.errorType && this.robotNo) this.getlistDepartmentTree(this.robotNo)
}, },
methods: { methods: {
async dealVal(val) {
await this.initData(val)
this.robotListTree = val
console.log(this.robotListTree)
},
getlistDepartmentTree(merchantId) { getlistDepartmentTree(merchantId) {
let params = { addChildrensFlag: true, queryMerchantId: merchantId } let params = { addChildrensFlag: true, queryMerchantId: merchantId }
taskApi.getlistDepartmentTree(params).then(async (res) => { taskApi.getlistDepartmentTree(params).then(async (res) => {
console.log(res)
if (res) { if (res) {
this.robotListTree = res.data.data this.robotListTree = res.data.data
await this.initData(this.robotListTree) await this.initData(this.robotListTree)
console.log(this.robotListTree, '=======22')
if (this.selectRobot && this.selectRobot.length) { if (this.selectRobot && this.selectRobot.length) {
this.$refs[this.memberRef].setCheckedKeys(this.selectRobot) if (this.errorType) {
this.$refs[this.memberRef].setCheckedKeys([this.selectRobot])
} else {
this.$refs[this.memberRef].setCheckedKeys(this.selectRobot)
}
let treeArrInfo = this.getTreeName( let treeArrInfo = this.getTreeName(
this.robotListTree, this.robotListTree,
this.selectRobot[0] this.errorType ? this.selectRobot : this.selectRobot[0]
) )
this.treeArr.push(treeArrInfo) this.treeArr.push(treeArrInfo)
console.log(this.treeArr)
} }
} }
}) })
}, },
getTreeName(treeList, id) { getTreeName(treeList, id) {
console.log(treeList, id)
for (let i = 0; i < treeList.length; i++) { for (let i = 0; i < treeList.length; i++) {
let treeItem = treeList[i] let treeItem = treeList[i]
if (treeItem.id == id) { if (treeItem.id == id) {
...@@ -236,7 +237,6 @@ export default { ...@@ -236,7 +237,6 @@ export default {
} }
}, },
initData(data) { initData(data) {
console.log(11)
data.forEach((item, index) => { data.forEach((item, index) => {
this.$set( this.$set(
item, item,
...@@ -284,56 +284,10 @@ export default { ...@@ -284,56 +284,10 @@ export default {
children.length && this.initData(children) children.length && this.initData(children)
}) })
}, },
getMerchantBrandList() {
let getCheckedNodes = this.$refs[this.memberRef].getCheckedNodes()
const getCheckedKeys = this.$refs[this.memberRef].getCheckedKeys()
const getHalfCheckedNodes =
this.$refs[this.memberRef].getHalfCheckedNodes()
let merchantBrandList = getHalfCheckedNodes.map((car) => {
let merchantBrandId = []
car.children.forEach((item) => {
if (getCheckedKeys.includes(item.id)) {
merchantBrandId.push(item.id)
}
})
return {
cars: car.id,
merchantBrandId,
}
})
let checkNodes = getCheckedNodes.filter((item) => item.children)
let noCheckNodes = getCheckedNodes
.filter((item) => item.children === null)
.map((i) => {
return {
cars: i.id,
}
})
let merchantBrandList2 = checkNodes.map((car) => {
let merchantBrandId = []
car.children.forEach((item) => {
if (getCheckedKeys.includes(item.id)) {
merchantBrandId.push(item.id)
}
})
return {
cars: car.id,
merchantBrandId,
}
})
return merchantBrandList.concat(merchantBrandList2).concat(noCheckNodes)
},
//勾选 //勾选
handleCheck(val) { handleCheck(val) {
// this.treeArr = this.getTreeArray()
console.log(val)
// this.currentCheckData = this.$refs[this.memberRef]
// .getCheckedNodes()
// .filter((item) => item.children && item.children.length == 0)
this.currentCheckData = val this.currentCheckData = val
this.$refs[this.memberRef].setCheckedKeys([val.id]) this.$refs[this.memberRef].setCheckedKeys([val.id])
console.log(this.currentCheckData.staffId)
// console.log(this.treeArr[0].staffId)
if (!this.treeArr.length) { if (!this.treeArr.length) {
this.treeArr = [this.currentCheckData] this.treeArr = [this.currentCheckData]
} }
...@@ -348,43 +302,36 @@ export default { ...@@ -348,43 +302,36 @@ export default {
this.treeArr.length > 0 && this.treeArr.length < this.ids.length this.treeArr.length > 0 && this.treeArr.length < this.ids.length
this.checkedAll = this.treeArr.length === this.ids.length this.checkedAll = this.treeArr.length === this.ids.length
}, },
getCheckList(checkArr = []) { // //获取选择项
checkArr.forEach((item) => (item = parseInt(item))) // getTreeArray() {
this.$refs[this.memberRef].setCheckedKeys(checkArr) // let tree_arr = []
this.$nextTick(() => { // this.robotListTree.forEach((k) => {
this.handleCheck() // let child = k.children
}) // if (child && child.length > 0) {
}, // child.forEach((j) => {
//获取选择项 // tree_arr.push(j.id)
getTreeArray() { // })
let tree_arr = [] // } else {
this.robotListTree.forEach((k) => { // tree_arr.push(k.id)
let child = k.children // }
if (child && child.length > 0) { // })
child.forEach((j) => { // return tree_arr
tree_arr.push(j.id) // },
}) // //全选
} else { // selectAll() {
tree_arr.push(k.id) // this.loading = true
} // this.treeArr = this.getTreeArray()
}) // if (this.getCheckedArr.length == this.treeArr.length) {
return tree_arr // this.checkedAll = false
}, // this.$refs[this.memberRef].setCheckedKeys([])
//全选 // } else {
selectAll() { // this.checkedAll = true
this.loading = true // this.$refs[this.memberRef].setCheckedKeys(this.treeArr)
this.treeArr = this.getTreeArray() // }
if (this.getCheckedArr.length == this.treeArr.length) { // setTimeout(() => {
this.checkedAll = false // this.loading = false
this.$refs[this.memberRef].setCheckedKeys([]) // }, 1000)
} else { // },
this.checkedAll = true
this.$refs[this.memberRef].setCheckedKeys(this.treeArr)
}
setTimeout(() => {
this.loading = false
}, 1000)
},
//重置 //重置
selectClear() { selectClear() {
this.treeArr = [] this.treeArr = []
...@@ -404,10 +351,10 @@ export default { ...@@ -404,10 +351,10 @@ export default {
return data.label.indexOf(value) !== -1 return data.label.indexOf(value) !== -1
}, },
// 显示隐藏 // 显示隐藏
switchBrand() { // switchBrand() {
this.brandTree = !this.brandTree // this.brandTree = !this.brandTree
this.$emit('clickBrand', this.brandTree) // this.$emit('clickBrand', this.brandTree)
}, // },
}, },
} }
</script> </script>
......
...@@ -336,8 +336,9 @@ ...@@ -336,8 +336,9 @@
'missionList' + (itm.taskid || itm.id) + 'robot' 'missionList' + (itm.taskid || itm.id) + 'robot'
" "
:type="isEditor" :type="isEditor"
:errorType="isSubmit"
:robotNo="itm.robotMerchantNo" :robotNo="itm.robotMerchantNo"
:selectRobot="isEditor ? itm.enterMicroRobot : []" :selectRobot="itm.enterMicroRobot"
:memberRef=" :memberRef="
'missionList' + (itm.taskid || itm.id) + 'robot' 'missionList' + (itm.taskid || itm.id) + 'robot'
" "
...@@ -729,6 +730,7 @@ export default { ...@@ -729,6 +730,7 @@ export default {
isEditor: false, isEditor: false,
// 是否是克隆 // 是否是克隆
isClone: false, isClone: false,
isSubmit: false,
// 活动弹框 // 活动弹框
activityDiaVisible: false, activityDiaVisible: false,
// 选择任务开始日期弹框 // 选择任务开始日期弹框
...@@ -814,10 +816,6 @@ export default { ...@@ -814,10 +816,6 @@ export default {
textType: 1, textType: 1,
textContent: '', textContent: '',
showArticle: true, showArticle: true,
// autoReminderFlag: '',
// autoReminderTime: '',
// groupChat: '',
// enterMicroRobot: '',
}, },
// 浏览指标任务类型 // 浏览指标任务类型
browseObj: { browseObj: {
...@@ -830,10 +828,6 @@ export default { ...@@ -830,10 +828,6 @@ export default {
textType: 1, textType: 1,
textContent: '', textContent: '',
showArticle: true, showArticle: true,
// autoReminderFlag: '',
// autoReminderTime: '',
// groupChat: '',
// enterMicroRobot: '',
}, },
// 访客指标任务类型 // 访客指标任务类型
visitorObj: { visitorObj: {
...@@ -844,10 +838,6 @@ export default { ...@@ -844,10 +838,6 @@ export default {
textType: 1, textType: 1,
textContent: '', textContent: '',
showArticle: true, showArticle: true,
// autoReminderFlag: '',
// autoReminderTime: '',
// groupChat: '',
// enterMicroRobot: '',
}, },
// 成单指标任务类型 // 成单指标任务类型
orderObj: { orderObj: {
...@@ -858,24 +848,11 @@ export default { ...@@ -858,24 +848,11 @@ export default {
textType: 1, textType: 1,
textContent: '', textContent: '',
showArticle: true, showArticle: true,
// autoReminderFlag: '',
// autoReminderTime: '',
// groupChat: '',
// enterMicroRobot: '',
}, },
// 添加福利官任务类型 // 添加福利官任务类型
walefaleObj: { walefaleObj: {},
// autoReminderFlag: '',
// autoReminderTime: '',
// groupChat: '',
// enterMicroRobot: '',
},
// 添加一客一群任务类型 // 添加一客一群任务类型
customerObj: { customerObj: {
// autoReminderFlag: '',
// autoReminderTime: '',
// groupChat: '',
// enterMicroRobot: '',
rewardCount: '', rewardCount: '',
triggerValue: '', triggerValue: '',
}, },
...@@ -1002,7 +979,6 @@ export default { ...@@ -1002,7 +979,6 @@ export default {
// 查询发送企微 // 查询发送企微
findEntmicroList() { findEntmicroList() {
taskApi.findEntmicroList({}).then((res) => { taskApi.findEntmicroList({}).then((res) => {
console.log(res)
if (res.code == 0) this.entmicroList = res.data if (res.code == 0) this.entmicroList = res.data
}) })
}, },
...@@ -1147,77 +1123,10 @@ export default { ...@@ -1147,77 +1123,10 @@ export default {
// this.getlistDepartmentTree(val) // this.getlistDepartmentTree(val)
// this.taskList = [] // this.taskList = []
}, },
getTree() {
console.log(111)
},
// 根据商户获取机器人列表
// getlistDepartmentTree(merchantId) {
// return new Promise((resolve) => {
// let params = { addChildrensFlag: true, queryMerchantId: merchantId }
// taskApi.getlistDepartmentTree(params).then((res) => {
// console.log(res)
// if (res) {
// this.brandListTree = res.data.data
// resolve()
// // this.initData(this.brandListTree)
// // console.log(this.brandListTree, '=======22')
// }
// })
// })
// },
// initData(data) {
// data.forEach((item, index) => {
// this.$set(
// item,
// 'label',
// item.staffName ? item.staffName : item.departmentName
// )
// let entmicroStaffResponses =
// this.$Utils.deepClone(item.entmicroStaffResponses) || []
// entmicroStaffResponses = entmicroStaffResponses.filter((staff, idx) => {
// if (staff.staffName) {
// this.$set(staff, 'label', staff.staffName)
// } else {
// this.$set(staff, 'label', staff.departmentName)
// }
// if (staff.staffId && !this.ids.includes(staff.staffId)) {
// this.ids.push(staff.staffId)
// return true
// } else if (staff.staffId && this.ids.includes(staff.staffId)) {
// return false
// }
// })
// let child = this.$Utils.deepClone(item.children) || []
// child = child.filter((staff, idx) => {
// if (staff.staffName) {
// this.$set(staff, 'label', staff.staffName)
// } else {
// this.$set(staff, 'label', staff.departmentName)
// }
// if (staff.staffId && !this.ids.includes(staff.staffId)) {
// this.ids.push(staff.staffId)
// return true
// } else if (staff.staffId && this.ids.includes(staff.staffId)) {
// return false
// } else if (staff.entmicroStaffResponses) {
// staff.staffId = staff.id
// return true
// }
// })
// const children = [...child, ...entmicroStaffResponses]
// item.children = children
// //清除没有员工的部门
// if (!item.staffName && item.entmicroStaffResponses === null) {
// data.splice(index, 1)
// }
// children.length && this.initData(children)
// })
// },
// 获取选中机器人 // 获取选中机器人
getSelectRobot(treeArr) { getSelectRobot(treeArr) {
this.selectRobot = treeArr.map((item) => item.staffId) this.selectRobot = treeArr.map((item) => item.staffId)
this.selectRobotName = treeArr.map((item) => item.staffName) this.selectRobotName = treeArr.map((item) => item.staffName)
console.log(this.selectRobot)
}, },
getMenbers(dateTask, dateTaskIndex, task, taskIndex) { getMenbers(dateTask, dateTaskIndex, task, taskIndex) {
this.$set( this.$set(
...@@ -1231,11 +1140,9 @@ export default { ...@@ -1231,11 +1140,9 @@ export default {
this.selectRobotName[0] this.selectRobotName[0]
) )
this.$refs['taskForm'][dateTaskIndex].clearValidate() this.$refs['taskForm'][dateTaskIndex].clearValidate()
console.log(this.taskList[dateTaskIndex].missionList[taskIndex], '000')
}, },
// 获取群聊数据 // 获取群聊数据
getGroupList(item, index, itm, index1) { getGroupList(item, index, itm, index1) {
console.log(itm)
if (!itm.enterMicroRobot) { if (!itm.enterMicroRobot) {
this.$message({ this.$message({
message: '请先选择企微机器人', message: '请先选择企微机器人',
...@@ -1245,7 +1152,6 @@ export default { ...@@ -1245,7 +1152,6 @@ export default {
} }
let membersIds = itm.enterMicroRobot.join(',') let membersIds = itm.enterMicroRobot.join(',')
taskApi.getGroupList({ msgStaffIdList: membersIds }).then((res) => { taskApi.getGroupList({ msgStaffIdList: membersIds }).then((res) => {
console.log(res, 'list')
if (res.data.code == 0) { if (res.data.code == 0) {
this.groupListData = res.data.data this.groupListData = res.data.data
} }
...@@ -1253,8 +1159,6 @@ export default { ...@@ -1253,8 +1159,6 @@ export default {
}, },
// 选择群聊数据 // 选择群聊数据
changeGroup(val, item, index, itm, index1) { changeGroup(val, item, index, itm, index1) {
console.log(val)
console.log(item, index, itm, index1)
let groupList = this.groupListData.find((item) => item.roomChatId == val) let groupList = this.groupListData.find((item) => item.roomChatId == val)
this.$set(this.taskList[index].missionList[index1], 'groupChat', val) this.$set(this.taskList[index].missionList[index1], 'groupChat', val)
this.$set( this.$set(
...@@ -1432,7 +1336,6 @@ export default { ...@@ -1432,7 +1336,6 @@ export default {
missionList: [], missionList: [],
}) })
// 如果没有传时间值,直接返回 // 如果没有传时间值,直接返回
console.log(this.taskList)
if (!startTime) return this.taskList if (!startTime) return this.taskList
// 如果是编辑/复制页面,任务计划回显 // 如果是编辑/复制页面,任务计划回显
if (this.isEditor || (this.isClone && !this.basicForm.activityName)) if (this.isEditor || (this.isClone && !this.basicForm.activityName))
...@@ -1506,14 +1409,6 @@ export default { ...@@ -1506,14 +1409,6 @@ 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
// },
// 处理复制任务活动天数大于选择活动天数 // 处理复制任务活动天数大于选择活动天数
getNextDate(date, day = 1, format = '{y}-{m}-{d}') { getNextDate(date, day = 1, format = '{y}-{m}-{d}') {
if (date) { if (date) {
...@@ -1551,11 +1446,9 @@ export default { ...@@ -1551,11 +1446,9 @@ export default {
? this.taskList[index].missionList.length - 1 ? this.taskList[index].missionList.length - 1
: 0 : 0
this.taskList[index].missionList[listLength].taskid = this.getUuid() this.taskList[index].missionList[listLength].taskid = this.getUuid()
console.log(this.taskList)
}, },
// 任务选择类型切换 // 任务选择类型切换
selectTaskType(dateTask, dateTaskIndex, task, taskIndex) { selectTaskType(dateTask, dateTaskIndex, task, taskIndex) {
console.log(this.taskList)
// dateTask -- 具体哪一天的任务对象 // dateTask -- 具体哪一天的任务对象
// dateTaskIndex -- 具体哪一天的任务对象索引 // dateTaskIndex -- 具体哪一天的任务对象索引
// task -- 具体哪个任务 // task -- 具体哪个任务
...@@ -1580,11 +1473,9 @@ export default { ...@@ -1580,11 +1473,9 @@ export default {
} }
// 判断任务类型,将任务类型参数push进taskList // 判断任务类型,将任务类型参数push进taskList
let taskItem let taskItem
console.log(task.missonType)
switch (task.missonType) { switch (task.missonType) {
case 1: case 1:
taskItem = Object.assign({}, this.basicObj) taskItem = Object.assign({}, this.basicObj)
console.log(taskItem)
break break
case 2: case 2:
taskItem = Object.assign({}, this.basicObj, this.shareObj) taskItem = Object.assign({}, this.basicObj, this.shareObj)
...@@ -1631,7 +1522,6 @@ export default { ...@@ -1631,7 +1522,6 @@ export default {
) )
return return
this.$nextTick(() => { this.$nextTick(() => {
// this.$set(this.taskList[dateTaskIndex].missionList, taskIndex, taskItem)
var box = document.getElementById( var box = document.getElementById(
'missionList' + task.taskid + 'welcome' 'missionList' + task.taskid + 'welcome'
) )
...@@ -1642,11 +1532,9 @@ export default { ...@@ -1642,11 +1532,9 @@ export default {
let textId = task.taskid || task.id let textId = task.taskid || task.id
this.getTextBox(textId, dateTaskIndex, taskIndex) this.getTextBox(textId, dateTaskIndex, taskIndex)
}) })
console.log(this.taskList, '===')
}, },
// 获取分享素材内容 // 获取分享素材内容
getEditor(dateTask, dateTaskIndex, task, taskIndex) { getEditor(dateTask, dateTaskIndex, task, taskIndex) {
console.log(111)
// dateTask -- 具体哪一天的任务对象 // dateTask -- 具体哪一天的任务对象
// dateTaskIndex -- 具体哪一天的任务对象索引 // dateTaskIndex -- 具体哪一天的任务对象索引
// task -- 具体哪个任务 // task -- 具体哪个任务
...@@ -1739,11 +1627,6 @@ export default { ...@@ -1739,11 +1627,6 @@ export default {
}) })
}) })
}, },
// handleBlur(dateTask) {
// if (dateTask.repeatCount) {
// dateTask.repeatFlag = false
// }
// },
// 重复次数选择框改变 // 重复次数选择框改变
repeatChange(listindex, dateTask, type, taskIndex) { repeatChange(listindex, dateTask, type, taskIndex) {
if (type) { if (type) {
...@@ -1863,6 +1746,13 @@ export default { ...@@ -1863,6 +1746,13 @@ export default {
if (itm.enterMicroRobot) { if (itm.enterMicroRobot) {
itm.enterMicroRobot = itm.enterMicroRobot.split(',') itm.enterMicroRobot = itm.enterMicroRobot.split(',')
} }
// 处理目标群聊回显
if (itm.groupChat) {
this.groupListData.push({
roomName: itm.groupChatName,
roomChatId: itm.groupChat,
})
}
}) })
}) })
// 获取其为机器人列表 // 获取其为机器人列表
...@@ -1870,7 +1760,6 @@ export default { ...@@ -1870,7 +1760,6 @@ export default {
// 判断场景(代运营只有完整周期) // 判断场景(代运营只有完整周期)
if (businessScene == 4) { if (businessScene == 4) {
this.taskList = this.taskEditList.missionDateList this.taskList = this.taskEditList.missionDateList
console.log(this.taskList)
} else { } else {
this.setHouseRatesColumn(startTime, endTime) this.setHouseRatesColumn(startTime, endTime)
} }
...@@ -1936,7 +1825,6 @@ export default { ...@@ -1936,7 +1825,6 @@ export default {
// 企业机器人切换 // 企业机器人切换
robotMerchantChange(itm) { robotMerchantChange(itm) {
let refLable = 'missionList' + (itm.taskid || itm.id) + 'robot' let refLable = 'missionList' + (itm.taskid || itm.id) + 'robot'
console.log(this.$refs[refLable])
this.$refs[refLable][0].getlistDepartmentTree(itm.robotMerchantNo) this.$refs[refLable][0].getlistDepartmentTree(itm.robotMerchantNo)
}, },
// 基础信息表单验证 // 基础信息表单验证
...@@ -1977,6 +1865,7 @@ export default { ...@@ -1977,6 +1865,7 @@ export default {
submitTask() { submitTask() {
// 遍历 // 遍历
// let submitList = JSON.parse(JSON.stringify(this.taskList)) // let submitList = JSON.parse(JSON.stringify(this.taskList))
this.isSubmit = true
this.taskList.map((item) => { this.taskList.map((item) => {
item.missionList.map((itm) => { item.missionList.map((itm) => {
// 重复次数处理 // 重复次数处理
...@@ -2048,11 +1937,6 @@ export default { ...@@ -2048,11 +1937,6 @@ export default {
} }
// 处理软文表情太大 // 处理软文表情太大
if (itm.textContent) { if (itm.textContent) {
// let regErr = /<img\b/gi
// itm.textContent = itm.textContent.replace(
// regErr,
// `<img style="width: 18px;height 18px"`
// )
var regex0 = new RegExp('(i?)(\<img)([^\>]+\>)', 'gmi') var regex0 = new RegExp('(i?)(\<img)([^\>]+\>)', 'gmi')
itm.textContent = itm.textContent itm.textContent = itm.textContent
...@@ -2067,11 +1951,6 @@ export default { ...@@ -2067,11 +1951,6 @@ export default {
if (itm.enterMicroRobot) { if (itm.enterMicroRobot) {
itm.enterMicroRobot = itm.enterMicroRobot.join(',') itm.enterMicroRobot = itm.enterMicroRobot.join(',')
} }
// 处理完整周期时间
// if (item.activityTime == -1 && itm.autoReminderTime) {
// console.log(111)
// itm.autoReminderTime = '0000-00-00 ' + itm.autoReminderTime
// }
}) })
}) })
let params = JSON.parse(JSON.stringify(this.basicForm)) let params = JSON.parse(JSON.stringify(this.basicForm))
...@@ -2087,7 +1966,6 @@ export default { ...@@ -2087,7 +1966,6 @@ export default {
} }
params.missionDateList = this.taskList params.missionDateList = this.taskList
params.id = this.taskId params.id = this.taskId
console.log(params, '===')
// 创建 // 创建
if (!this.isEditor) { if (!this.isEditor) {
taskApi.creatMission(params).then( taskApi.creatMission(params).then(
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!