Commit 694adfc1 by 前端

commit:AI外呼编辑

1 parent 62f2fe23
......@@ -24,7 +24,8 @@ const createTask = params => {
url: '/rop-scrm-entmicro/router',
method: 'POST',
data: params,
sign: true
sign: true,
returnAll: true
})
}
//删除任务
......@@ -77,7 +78,28 @@ const phoneCheck = params => {
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 {
checkTask,
createTask,
......@@ -85,5 +107,7 @@ export default {
taskPage,
taskDetail,
phoneStatusPage,
phoneCheck
phoneCheck,
getTaskContent,
updateTaskContent
}
......@@ -88,4 +88,31 @@ util.openTab = function(url) {
link.rel = 'opener'
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
......@@ -38,14 +38,14 @@
<el-tab-pane label="任务队列" :name="1"></el-tab-pane>
<el-tab-pane label="任务记录" :name="2"></el-tab-pane>
</el-tabs>
<ai-tabel :activeIndex="activeIndex" ref="AiForm"></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">
<ai-tabel :activeIndex="activeIndex" ref="AiForm" @update="update"></ai-tabel>
<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">
<div class="el-form-item is-required el-form-item--small">
<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-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 class="tips-error" v-if="taskStatus">请输入任务名称</div> -->
</div>
......@@ -55,11 +55,11 @@
<div class="el-form-item__content" style="margin-left: 154px">
<div class="import-link">
<div class="upload-btn">
<el-button size="small">
<el-button size="small" :disabled="isEdit">
<i class="el-icon-plus"></i>
上传手机号
</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>
<a href="https://img01.glsx.com.cn/weapp/resource/saas/scrm/xlsx/待加客户好友模板.xlsx">手机号模板</a>
</div>
......@@ -67,6 +67,7 @@
<div class="upload-name">{{ fileName }}</div>
<div class="upload-del">
<i
v-if="!isEdit"
class="el-icon-delete"
@click="
fileName = ''
......@@ -142,11 +143,13 @@ export default {
},
data() {
return {
isEdit: false,
loading: false,
taskStatus: false,
fileStatus: false,
staffStatus: false,
activeIndex: 1,
taskId: '',
dialogVisible: false,
importVisible: false,
dialogVisibleDel: false,
......@@ -256,6 +259,7 @@ export default {
util.openUrl(this.ImportResult.errUrl.replace(/https?:/, ''))
},
handleAdd() {
this.isEdit = false
this.staffInfo = []
this.taskName = ''
this.url = ''
......@@ -263,7 +267,29 @@ export default {
this.dialogVisible = true
this.taskStatus = false
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) {
this.staffInfo = item.map(item => {
......@@ -329,9 +355,7 @@ export default {
})
},
handleSure() {
console.log(this.$refs.welcome.previewList)
const staffIds = this.staffInfo.map(item => item.staffId)
// const staffId = staffInfo.join(',')
const { url, fileName, taskName } = this
if (!taskName) {
this.$message.error('请输入任务名称')
......@@ -349,11 +373,10 @@ export default {
this.$message.error('请选择专员')
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 => {
if (item.attType == 1) {
item.attContent = item.attContent.replaceAll('[@昵称]', '@昵称')
item.attContent = item.attContent.replaceAll('@昵称', '[@昵称]')
item.attContent = item.attContent.replace(/(@昵称|#兑换码)/g, '[$1]')
} else if (item.attType == 7) {
item.attContent = JSON.stringify(item.attContent)
}
......@@ -361,8 +384,23 @@ export default {
})
const autoSend = this.autoSend ? 1 : 0
this.loading = true
this.$apis.aiCard.createTask({ url, fileName, taskName, staffIds, attachmentList, autoSend }).then(res => {
if (res) {
const methods = this.isEdit ? 'updateTaskContent' : 'createTask'
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.$refs.AiForm.handleSeach()
this.loading = false
......@@ -373,6 +411,12 @@ export default {
this.staffStatus = false
this.$refs.selectEmpForm.init(this.staffInfo)
}
},
created() {
if(!util.isShowBtn(null,'兑换码')) {
this.btnList.splice(-1)
}
}
}
</script>
......@@ -554,6 +598,7 @@ export default {
.import-link {
display: flex;
cursor: pointer;
margin-bottom:8px;
.upload-btn {
position: relative;
display: inline-block;
......@@ -590,5 +635,14 @@ export default {
}
.gl-form-min /deep/.el-form .welcome-box {
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>
......@@ -5,6 +5,7 @@
<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="goDetail(scope.scope)" v-if="activeIndex == 2">数据详情</el-button>
<el-button type="text" @click="goEdit(scope.scope)">编辑</el-button>
</div>
<template slot="taskStatus" slot-scope="scope">
<div :class="['task_icon', `task_icon${scope.scope.taskStatus}`]">{{ taskStatus(scope.scope.taskStatus) }}</div>
......@@ -104,7 +105,7 @@ export default {
{
label: '操作',
prop: 'optionBtns',
width: '90px',
width: '120px',
addHtml: 'optionBtns',
fixed: 'right'
}
......@@ -147,7 +148,7 @@ export default {
{
label: '操作',
prop: 'optionBtns',
width: '160px',
width: '200px',
addHtml: 'optionBtns',
fixed: 'right'
}
......@@ -222,6 +223,9 @@ export default {
},
goDetail(scope) {
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!