Commit 694adfc1 by 前端

commit:AI外呼编辑

1 parent 62f2fe23
...@@ -24,7 +24,8 @@ const createTask = params => { ...@@ -24,7 +24,8 @@ const createTask = params => {
url: '/rop-scrm-entmicro/router', url: '/rop-scrm-entmicro/router',
method: 'POST', method: 'POST',
data: params, data: params,
sign: true sign: true,
returnAll: true
}) })
} }
//删除任务 //删除任务
...@@ -77,7 +78,28 @@ const phoneCheck = params => { ...@@ -77,7 +78,28 @@ const phoneCheck = params => {
sign: true sign: true
}) })
} }
//门店任务创建内容回显
const getTaskContent = params => {
params.method = 'entmicro.api.outbound.call.merchant.task.create.content.echo'
return http({
url: '/rop-scrm-entmicro/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
// 更改外呼任务跟进人和欢迎语
const updateTaskContent = params => {
params.method = 'entmicro.api.outbound.call.merchant.task.create.content.update'
return http({
url: '/rop-scrm-entmicro/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
}
export default { export default {
checkTask, checkTask,
createTask, createTask,
...@@ -85,5 +107,7 @@ export default { ...@@ -85,5 +107,7 @@ export default {
taskPage, taskPage,
taskDetail, taskDetail,
phoneStatusPage, phoneStatusPage,
phoneCheck phoneCheck,
getTaskContent,
updateTaskContent
} }
...@@ -88,4 +88,31 @@ util.openTab = function(url) { ...@@ -88,4 +88,31 @@ util.openTab = function(url) {
link.rel = 'opener' link.rel = 'opener'
link.click() link.click()
} }
util.isShowBtn = function(value, permissions) {
let isShowStatus = false
const menu = JSON.parse(sessionStorage['SCRM_BASE_MENULIST'])
menuLevel(menu)
function menuLevel(item) {
item.forEach(itm => {
if (value && itm.path == value) {
isShowStatus = true
}
if (
!value &&
itm.path ==
'/' +
location.pathname
.split('/')
.slice(-2)
.join('/') &&
itm.meta && itm.meta.permissions.includes(permissions)
){isShowStatus = true}
if (itm.children) {
menuLevel(itm.children)
}
})
}
return isShowStatus
}
export default util export default util
...@@ -38,14 +38,14 @@ ...@@ -38,14 +38,14 @@
<el-tab-pane label="任务队列" :name="1"></el-tab-pane> <el-tab-pane label="任务队列" :name="1"></el-tab-pane>
<el-tab-pane label="任务记录" :name="2"></el-tab-pane> <el-tab-pane label="任务记录" :name="2"></el-tab-pane>
</el-tabs> </el-tabs>
<ai-tabel :activeIndex="activeIndex" ref="AiForm"></ai-tabel> <ai-tabel :activeIndex="activeIndex" ref="AiForm" @update="update"></ai-tabel>
<GLDialog title="创建任务" destroy-on-close="true" okText="创建" class="gl-form-page gl-form-min" v-loading="loading" @onOk="handleSure" @onCancel="dialogVisible = false" :visible.sync="dialogVisible"> <GLDialog :title="!isEdit ? '创建任务' : '编辑任务'" destroy-on-close="true" okText="保存" class="gl-form-page gl-form-min" v-loading="loading" @onOk="handleSure" @onCancel="dialogVisible = false" :visible.sync="dialogVisible">
<el-form ref="addForm" class="code-body-form" label-width="154px"> <el-form ref="addForm" class="code-body-form" label-width="154px">
<div class="el-form-item is-required el-form-item--small"> <div class="el-form-item is-required el-form-item--small">
<label for="remark" class="el-form-item__label" style="width: 154px">任务名称:</label> <label for="remark" class="el-form-item__label" style="width: 154px">任务名称:</label>
<div class="el-form-item__content" style="margin-left: 154px"> <div class="el-form-item__content" style="margin-left: 154px">
<div class="el-input el-input--small"> <div class="el-input el-input--small">
<input type="text" @blur="checkTask" v-model.trim="taskName" autocomplete="off" placeholder="请输入任务名称" maxlength="10" class="el-input__inner" /> <input type="text" @blur="checkTask" :disabled="isEdit" v-model.trim="taskName" autocomplete="off" placeholder="请输入任务名称" maxlength="10" class="el-input__inner" />
</div> </div>
<!-- <div class="tips-error" v-if="taskStatus">请输入任务名称</div> --> <!-- <div class="tips-error" v-if="taskStatus">请输入任务名称</div> -->
</div> </div>
...@@ -55,11 +55,11 @@ ...@@ -55,11 +55,11 @@
<div class="el-form-item__content" style="margin-left: 154px"> <div class="el-form-item__content" style="margin-left: 154px">
<div class="import-link"> <div class="import-link">
<div class="upload-btn"> <div class="upload-btn">
<el-button size="small"> <el-button size="small" :disabled="isEdit">
<i class="el-icon-plus"></i> <i class="el-icon-plus"></i>
上传手机号 上传手机号
</el-button> </el-button>
<input type="file" style="opacity: 0" ref="file" accept="*" @change="uploadFile" /> <input type="file" v-if="!isEdit" style="opacity: 0" ref="file" accept="*" @change="uploadFile" />
</div> </div>
<a href="https://img01.glsx.com.cn/weapp/resource/saas/scrm/xlsx/待加客户好友模板.xlsx">手机号模板</a> <a href="https://img01.glsx.com.cn/weapp/resource/saas/scrm/xlsx/待加客户好友模板.xlsx">手机号模板</a>
</div> </div>
...@@ -67,6 +67,7 @@ ...@@ -67,6 +67,7 @@
<div class="upload-name">{{ fileName }}</div> <div class="upload-name">{{ fileName }}</div>
<div class="upload-del"> <div class="upload-del">
<i <i
v-if="!isEdit"
class="el-icon-delete" class="el-icon-delete"
@click=" @click="
fileName = '' fileName = ''
...@@ -142,11 +143,13 @@ export default { ...@@ -142,11 +143,13 @@ export default {
}, },
data() { data() {
return { return {
isEdit: false,
loading: false, loading: false,
taskStatus: false, taskStatus: false,
fileStatus: false, fileStatus: false,
staffStatus: false, staffStatus: false,
activeIndex: 1, activeIndex: 1,
taskId: '',
dialogVisible: false, dialogVisible: false,
importVisible: false, importVisible: false,
dialogVisibleDel: false, dialogVisibleDel: false,
...@@ -256,6 +259,7 @@ export default { ...@@ -256,6 +259,7 @@ export default {
util.openUrl(this.ImportResult.errUrl.replace(/https?:/, '')) util.openUrl(this.ImportResult.errUrl.replace(/https?:/, ''))
}, },
handleAdd() { handleAdd() {
this.isEdit = false
this.staffInfo = [] this.staffInfo = []
this.taskName = '' this.taskName = ''
this.url = '' this.url = ''
...@@ -263,7 +267,29 @@ export default { ...@@ -263,7 +267,29 @@ export default {
this.dialogVisible = true this.dialogVisible = true
this.taskStatus = false this.taskStatus = false
this.autoSend = true this.autoSend = true
this.$refs.welcome.previewList = [] },
update(data) {
this.isEdit = true
this.taskId = data.id
this.$apis.aiCard.getTaskContent({ id: this.taskId }).then(res => {
if (res.code == 0) {
this.taskName = data.taskName
this.phoneCheck(res.data.excelName, res.data.excelUrl)
this.staffInfo = res.data.staffs
this.autoSend = res.data.autoSend == 1 ? true : false
const attachmentList = res.data && res.data.attachmentList ? res.data.attachmentList : []
const preview = this.$common.utils.deepClone(attachmentList)
this.$nextTick(() => {
preview.map(item => {
if (item.attType == 7) {
item.attContent = JSON.parse(item.attContent)
}
})
preview.length>0&&this.$refs.welcome.updateList(preview)
})
this.dialogVisible = true
}
})
}, },
selectTable(item) { selectTable(item) {
this.staffInfo = item.map(item => { this.staffInfo = item.map(item => {
...@@ -329,9 +355,7 @@ export default { ...@@ -329,9 +355,7 @@ export default {
}) })
}, },
handleSure() { handleSure() {
console.log(this.$refs.welcome.previewList)
const staffIds = this.staffInfo.map(item => item.staffId) const staffIds = this.staffInfo.map(item => item.staffId)
// const staffId = staffInfo.join(',')
const { url, fileName, taskName } = this const { url, fileName, taskName } = this
if (!taskName) { if (!taskName) {
this.$message.error('请输入任务名称') this.$message.error('请输入任务名称')
...@@ -349,11 +373,10 @@ export default { ...@@ -349,11 +373,10 @@ export default {
this.$message.error('请选择专员') this.$message.error('请选择专员')
return return
} }
const previewList = this.$refs.welcome.previewList ? this.$common.utils.deepClone(this.$refs.welcome.previewList) : [] const previewList = this.autoSend && this.$refs.welcome.previewList ? this.$common.utils.deepClone(this.$refs.welcome.previewList) : []
const attachmentList = previewList.map(item => { const attachmentList = previewList.map(item => {
if (item.attType == 1) { if (item.attType == 1) {
item.attContent = item.attContent.replaceAll('[@昵称]', '@昵称') item.attContent = item.attContent.replace(/(@昵称|#兑换码)/g, '[$1]')
item.attContent = item.attContent.replaceAll('@昵称', '[@昵称]')
} else if (item.attType == 7) { } else if (item.attType == 7) {
item.attContent = JSON.stringify(item.attContent) item.attContent = JSON.stringify(item.attContent)
} }
...@@ -361,8 +384,23 @@ export default { ...@@ -361,8 +384,23 @@ export default {
}) })
const autoSend = this.autoSend ? 1 : 0 const autoSend = this.autoSend ? 1 : 0
this.loading = true this.loading = true
this.$apis.aiCard.createTask({ url, fileName, taskName, staffIds, attachmentList, autoSend }).then(res => { const methods = this.isEdit ? 'updateTaskContent' : 'createTask'
if (res) { const message = this.isEdit ? '编辑成功' : '创建成功'
let params = {
url,
fileName,
taskName,
staffIds,
attachmentList,
autoSend
}
if (this.isEdit) params.taskId = this.taskId
this.$apis.aiCard[methods](params).then(res => {
this.$message({
message: res.code == '0' ? message : res.message,
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == 0) {
this.dialogVisible = false this.dialogVisible = false
this.$refs.AiForm.handleSeach() this.$refs.AiForm.handleSeach()
this.loading = false this.loading = false
...@@ -373,6 +411,12 @@ export default { ...@@ -373,6 +411,12 @@ export default {
this.staffStatus = false this.staffStatus = false
this.$refs.selectEmpForm.init(this.staffInfo) this.$refs.selectEmpForm.init(this.staffInfo)
} }
},
created() {
if(!util.isShowBtn(null,'兑换码')) {
this.btnList.splice(-1)
}
} }
} }
</script> </script>
...@@ -554,6 +598,7 @@ export default { ...@@ -554,6 +598,7 @@ export default {
.import-link { .import-link {
display: flex; display: flex;
cursor: pointer; cursor: pointer;
margin-bottom:8px;
.upload-btn { .upload-btn {
position: relative; position: relative;
display: inline-block; display: inline-block;
...@@ -590,5 +635,14 @@ export default { ...@@ -590,5 +635,14 @@ export default {
} }
.gl-form-min /deep/.el-form .welcome-box { .gl-form-min /deep/.el-form .welcome-box {
width: 100% !important; width: 100% !important;
.add-btn:nth-last-child(1){
padding-right:0px;
}
.text-num{
color: #999999;
}
}
.gl-form-page .el-form {
padding-left: 0px !important;;
} }
</style> </style>
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
<div class="table-btns" slot="optionBtns" slot-scope="scope"> <div class="table-btns" slot="optionBtns" slot-scope="scope">
<el-button type="text" @click="handleDel(scope.scope)" :disabled="scope.scope.taskStatus == 2 || scope.scope.taskStatus == 3">删除</el-button> <el-button type="text" @click="handleDel(scope.scope)" :disabled="scope.scope.taskStatus == 2 || scope.scope.taskStatus == 3">删除</el-button>
<el-button type="text" @click="goDetail(scope.scope)" v-if="activeIndex == 2">数据详情</el-button> <el-button type="text" @click="goDetail(scope.scope)" v-if="activeIndex == 2">数据详情</el-button>
<el-button type="text" @click="goEdit(scope.scope)">编辑</el-button>
</div> </div>
<template slot="taskStatus" slot-scope="scope"> <template slot="taskStatus" slot-scope="scope">
<div :class="['task_icon', `task_icon${scope.scope.taskStatus}`]">{{ taskStatus(scope.scope.taskStatus) }}</div> <div :class="['task_icon', `task_icon${scope.scope.taskStatus}`]">{{ taskStatus(scope.scope.taskStatus) }}</div>
...@@ -104,7 +105,7 @@ export default { ...@@ -104,7 +105,7 @@ export default {
{ {
label: '操作', label: '操作',
prop: 'optionBtns', prop: 'optionBtns',
width: '90px', width: '120px',
addHtml: 'optionBtns', addHtml: 'optionBtns',
fixed: 'right' fixed: 'right'
} }
...@@ -147,7 +148,7 @@ export default { ...@@ -147,7 +148,7 @@ export default {
{ {
label: '操作', label: '操作',
prop: 'optionBtns', prop: 'optionBtns',
width: '160px', width: '200px',
addHtml: 'optionBtns', addHtml: 'optionBtns',
fixed: 'right' fixed: 'right'
} }
...@@ -222,6 +223,9 @@ export default { ...@@ -222,6 +223,9 @@ export default {
}, },
goDetail(scope) { goDetail(scope) {
this.$router.push('/home/taskDetail?id=' + scope.id) this.$router.push('/home/taskDetail?id=' + scope.id)
},
goEdit(data){
this.$emit('update',data)
} }
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!