Commit f3fce26e by zhangquan

Merge branch 'master' of http://192.168.3.233:8090/saas/scrm-micro-content into v3.11.0

2 parents 5d7dcd76 581c47a2
This diff could not be displayed because it is too large.
......@@ -14,7 +14,7 @@
"dayjs": "^1.10.7",
"el-tree-transfer": "^2.2.6",
"element-ui": "^2.4.5",
"glsx-common": "^2.0.4",
"glsx-common": "^2.1.0",
"glsx-components": "^1.5.3",
"vod-js-sdk-v6": "^1.5.0",
"vue": "^2.6.10",
......
import { http } from '@/main'
export default {
/** 查询话术库列表 */
getChatLibraryList (params = {}) {
params.method = 'marketing.api.scriptlibrary.page'
return http({
url: 'rop-scrm-marketing/router',
method: 'POST',
data: params,
sign: true,
// returnAll: true
})
},
/**获取话术组列表*/
getChatGroup (params = {}) {
params.method = 'marketing.api.scriptlibrary.group.list'
return http({
url: 'rop-scrm-marketing/router',
method: 'POST',
data: params,
sign: true
})
},
/** 根据条件删除话术库 */
delChatLibrary (params = {}) {
params.method = 'marketing.api.scriptlibrary.delete'
return http({
url: 'rop-scrm-marketing/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
},
/** 新增或更新话术库数据 */
updateOrAddChatLibrary (params = {}) {
params.method = 'marketing.api.scriptlibrary.add.or.update'
return http({
url: 'rop-scrm-marketing/router',
method: 'POST',
data: params,
sign: true
})
},
/** 更改话术状态 */
updateChatLibraryState (params = {}) {
params.method = 'marketing.api.scriptlibrary.state.update'
return http({
url: 'rop-scrm-marketing/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
},
/**根据id查询话术库详情 */
getChatLibraryDetail (params = {}) {
params.method = 'marketing.api.scriptlibrary.detail.get'
return http({
url: 'rop-scrm-marketing/router',
method: 'POST',
data: params,
sign: true
})
},
/** 编辑话术组 */
updateChatGroup (params = {}) {
params.method = 'marketing.api.scriptlibrary.group.update'
return http({
url: 'rop-scrm-marketing/router',
method: 'POST',
data: params,
sign: true,
returnAll: true
})
},
}
\ No newline at end of file
......@@ -18,8 +18,8 @@ module.exports = {
code_message_map: {}
},
request: {
// baseURL: 'http://scrm.test.glsx.com.cn/',
baseURL: 'http://192.168.2.42:8064/',
baseURL: 'http://scrm.dev.glsx.com.cn/',
// baseURL: 'http://192.168.2.42:8064/',
// 设置超时时间
timeout: 180000,
// 携带凭证
......
......@@ -12,17 +12,14 @@ let cfg = require('./conf.js')
import { Http } from 'glsx-common'
let timeout = 30000 //超时时间
export const fetchConfig = function(isEnv = true) {
// console.log(1111111)
// if (isEnv) {
// let { request } = cfg
// Object.assign(request, { timeout })
// return Promise.resolve(cfg)
// }
//return window.fetch('https://', {}).then(res => res.json())
// request({ url: 'https://oss-config.test.glsx.com.cn/mock/5be17454f31545347559d499/config/oss_commodity_center', method: 'get' })
// return new Http().get('https://oss-config.test.glsx.com.cn/mock/6351298f6a118b4ff787ef2b/live/config')
return new Http().get('https://oss-config.dev.glsx.com.cn/mock/63969466b9cfb051d7d5fc27/content/config')
return new Http().get('https://oss-config.glsx.com.cn/mock/63c129a528a4279537834035/content/config')
// let params = { moduleName: 'content', mockUrl: 'https://oss-config.glsx.com.cn/mock/63c129a528a4279537834035/content/config', httpOptions: { Headers: { refererurl: location.href }, request: { timeout: 30000 } } }
// return utils.getConfig(params)
}
export const config = {
install(vue, cfg) {
......
<template>
<div
class="container"
v-loading="loading"
>
<div class="chat-library-box">
<div class="box-title">{{ title }}</div>
<div class="form">
<el-form
ref="chatForm"
:model="chatForm"
label-width="154px"
label-position="right"
>
<el-form-item
label="选择话术组:"
prop="scriptGroup"
:rules="rules.scriptGroup"
>
<div class="flex">
<el-select
v-model="chatForm.scriptGroup"
filterable
placeholder="请选择"
:popper-append-to-body="false"
ref="select"
>
<template v-if="addState || editState">
<div class="input-box">
<el-input
ref="editInput"
class="input"
v-model="editGroupText.newGroup"
maxlength="10"
placeholder="请输入"
@input.self="editGroupText.newGroup = $event.replace(emojiReg, '')"
@keyup.enter.native="updateChatGroup"
>
<div
slot="suffix"
class="input-btn"
>
<div @click="updateChatGroup">确定</div>
<div
class="cancel"
@click="showEditGroupInput('')"
>取消</div>
</div>
</el-input>
</div>
</template>
<template v-else>
<div
class="add-btn"
@click.self="addState = true; focusInput()"
>
<i class="el-icon-circle-plus-outline"></i>
新增一项
</div>
</template>
<el-option
v-for="(item, i) in chatGroup"
:key="i"
:label="item.value"
:value="item.value"
>
<div class="option-item">
{{ item.value }}
<div class="item-btn">
<i
v-if="!i.isAdd"
class="el-icon-edit"
@click.stop="showEditGroupInput(item.value)"
></i>
<i
class="el-icon-circle-close"
@click.stop="delChatLibrary(item)"
></i>
</div>
</div>
</el-option>
</el-select>
</div>
</el-form-item>
<el-form-item
label="话术内容:"
prop="scriptContent"
:rules="rules.scriptContent"
>
<el-input
type="textarea"
:autosize="{ minRows: 5, maxRows: 20}"
placeholder="请输入文本内容"
v-model="chatForm.scriptContent"
maxlength="300"
show-word-limit
@input="chatForm.scriptContent = $event.replace(emojiReg, '')"
>
</el-input>
</el-form-item>
</el-form>
</div>
</div>
<GLFooter class="gl-footer">
<el-button
@click="$router.back()"
class="btn-cancle"
>取消</el-button>
<el-button
@click="handleSubmit"
type="primary"
>确定</el-button>
</GLFooter>
</div>
</template>
<script type='text/ecmascript-6'>
import { utils } from 'glsx-common'
const emojiReg = /([^\u0020-\u007E\u00A0-\u00BE\u2E80-\uA4CF\uF900-\uFAFF\uFE30-\uFE4F\uFF00-\uFFEF\u0080-\u009F\u2000-\u201f\u2026\u2022\u20ac])/g
export default {
name: 'detail',
data () {
return {
emojiReg,
groupVisible: false,
editState: false,
addState: false,
title: '',
loading: true,
chatGroup: [],
chatForm: {
scriptGroup: '',
scriptContent: ''
},
rules: {
scriptGroup: [
{ required: true, message: '请选择话术组', trigger: 'change' },
],
scriptContent: [
{ required: true, message: '请输入话术内容', trigger: 'change' }
]
},
editGroupText: {
oldGroup: '',
newGroup: ''
}
}
},
mounted () {
const { id, $title } = this.$route.query
this.title = $title
this.getChatGroup(id)
},
methods: {
/**获取话术组 */
async getChatGroup (id) {
const data = await this.$apis.chatLibrary.getChatGroup()
let chatGroup = data.length && data.map(e => {
return {
value: e
}
})
this.chatGroup = chatGroup || []
if (id) this.getChatLibraryDetail(id)
else this.loading = false
},
/**提交修改 */
handleSubmit () {
const { chatForm } = this
this.$refs.chatForm.validate(async valid => {
if (valid) {
const res = await this.$apis.chatLibrary.updateOrAddChatLibrary(chatForm)
if (res) {
this.$message({
message: `${chatForm.id ? '修改' : '创建'}成功`,
type: 'success'
})
this.$router.back()
}
}
})
},
/**详情 */
async getChatLibraryDetail (id) {
const {
scriptContent,
scriptGroup,
state
} = await this.$apis.chatLibrary.getChatLibraryDetail({ id })
this.chatForm = {
scriptContent,
scriptGroup,
state,
id
}
this.loading = false
},
/**编辑聚焦 */
focusInput () {
this.$nextTick(() => {
this.$refs.editInput.focus()
})
},
/**新增编辑话术组 */
showEditGroupInput (value) {
this.editGroupText = {
oldGroup: value,
newGroup: value
}
this.editState = value ? true : false
this.addState = false
if (value) this.focusInput()
},
/**关闭弹框 */
close () {
this.showEditGroupInput('')
this.groupVisible = false
},
/**更新新增 */
async updateChatGroup () {
const { editGroupText, addState, $message, chatForm } = this
try {
if (!editGroupText.newGroup) throw '请输入话术组!'
if (addState) {
this.chatGroup.map(e => {
if (e.value == editGroupText.newGroup) throw '该话术组已存在!'
})
this.chatGroup.unshift({
value: editGroupText.newGroup,
isAdd: true
})
$message({
message: '新增成功',
type: 'success'
})
} else {
const { isAdd } = this.chatGroup.find(e => e.value == editGroupText.oldGroup)
if (isAdd) {
$message({
message: '修改成功',
type: 'success'
})
} else {
const { data, message } = await this.$apis.chatLibrary.updateChatGroup(editGroupText)
$message({
message: data ? '修改成功' : message,
type: data ? 'success' : 'error'
})
}
this.chatGroup.find(e => {
if (e.value == editGroupText.oldGroup) {
e.value = editGroupText.newGroup
if(chatForm.scriptGroup == editGroupText.oldGroup) this.chatForm.scriptGroup = editGroupText.newGroup
}
})
}
this.showEditGroupInput('')
} catch (error) {
$message({
message: error,
type: 'error'
})
}
this.$refs.select.blur()
},
filterMethod(e){
console.log(e)
},
/**删除 */
delChatLibrary ({
value,
isAdd
}) {
const { chatForm, chatGroup } = this
this.$confirm('是否删除已有内容的话术组名,删除后完全清空话术内容,谨慎操作', '删除', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: utils.debounce((action) => {
if (action == 'confirm') {
if (isAdd) {
this.chatGroup.splice(chatGroup.findIndex(e => e.value == value), 1)
check()
} else this.$apis.chatLibrary.delChatLibrary({
scriptGroup: value
}).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
this.getChatGroup()
check()
}
})
}
}, 500)
})
const check = () => {
if (chatForm.scriptGroup == value) this.chatForm.scriptGroup = ''
}
},
/**选择话术组 */
choose (val) {
this.chatForm.scriptGroup = val
this.close()
}
}
}
</script>
<style scoped lang='scss'>
.container {
.chat-library-box {
background: #fff;
min-height: calc(100vh - 136px);
margin-bottom: 16px;
.box-title {
height: 56px;
line-height: 56px;
padding-left: 20px;
border-bottom: 1px solid #e5e5e5;
font-weight: 600;
font-size: 16px;
color: #333;
}
.form {
padding: 32px 20px;
.flex {
.el-select {
width: 474px;
/deep/.el-scrollbar {
display: block !important;
}
}
.el-button {
margin-left: 8px;
}
}
.el-textarea {
width: 592px;
}
}
}
.edit-group-box {
width: 474px;
margin: 0 auto;
.item {
height: 32px;
margin-bottom: 4px;
padding: 0 16px;
font-size: 14px;
color: #323233;
display: flex;
align-items: center;
cursor: pointer;
&:hover {
background: #f5f7fa;
.item-btn {
display: flex;
}
}
&-btn {
display: none;
margin-left: auto;
align-items: center;
font-size: 16px;
color: #9b9b9b;
gap: 8px;
i {
&:hover {
color: #5850ff;
}
}
}
}
}
}
/deep/.el-scrollbar__view.el-select-dropdown__list {
padding-top: 0;
.add-btn {
color: #5850ff;
height: 40px;
margin-bottom: 4px;
padding: 0 16px;
font-size: 14px;
display: flex;
align-items: center;
cursor: pointer;
background: #fff;
z-index: 2;
position: sticky;
top: 0;
&:hover {
background: #f5f7fa;
}
i {
font-size: 20px;
margin-right: 6px;
}
}
.input-box {
position: sticky;
top: 0;
margin-bottom: 4px;
padding: 0 16px;
background: #fff;
z-index: 2;
.input {
.el-input__inner {
height: 32px;
line-height: 32px;
}
&-btn {
display: flex;
height: 100%;
align-items: center;
font-size: 12px;
color: #5850ff;
gap: 0 8px;
cursor: pointer;
.cancel {
color: #666666;
}
div:hover {
opacity: 0.75;
}
}
}
}
}
/deep/.option-item {
display: flex;
align-items: center;
&:hover {
background: #f5f7fa;
.item-btn {
display: flex;
}
}
.item-btn {
display: none;
margin-left: auto;
align-items: center;
font-size: 16px;
color: #9b9b9b;
gap: 8px;
i {
&:hover {
color: #5850ff;
}
}
}
}
</style>
\ No newline at end of file
<template>
<div class="main-container">
<div class="top">
<el-button
type="primary"
@click="jumpDetail()"
:size="size"
>
<i class="el-icon-plus"></i>
创建话术
</el-button>
</div>
<div class="container">
<div class="tabelList">
<GLTable
ref="listRef"
:getListApi="getListApi"
:searchForm="tableSearchForm"
:noDataImg="url"
:tableParams="tableParams"
:pageConf="pageConf"
>
<div
slot-scope="scope"
slot="scriptContent"
>
<el-tooltip
placement="top"
:content="scope.scope.scriptContent"
>
<div class="tooltip-content">{{ scope.scope.scriptContent }}</div>
</el-tooltip>
</div>
<div
slot="state"
slot-scope="scope"
class="chat-switch"
>
<el-switch
:value="scope.scope.state == 0 ? true : false"
@change="changeState(scope.scope)"
></el-switch>
<span>
{{ CHAT_STATE[scope.scope.state] }}
</span>
</div>
<span
slot="auth-button"
slot-scope="scope"
>
<GLTableButton
:buttonList="tableButtonList"
:buttonItem="scope.scope"
:buttonNum="3"
></GLTableButton>
</span>
</GLTable>
</div>
</div>
</div>
</template>
<script>
import url from '@/assets/empty.png'
import * as dayjs from 'dayjs'
import { utils } from 'glsx-common'
const CHAT_STATE = {
0: '启用',
1: '停用'
}
export default {
name: 'materialList',
components: {
},
data () {
return {
CHAT_STATE,
url,
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' },
// 表格按钮
tableButtonList: [
{
type: 'el-button',
name: '编辑',
attrs: {
type: 'text',
},
listeners: {
click: row => this.jumpDetail(row.id)
}
},
{
type: 'el-button',
name: '删除',
attrs: {
type: 'text',
},
listeners: {
click: row => {
this.showConfirm({
title: '删除',
txt: '确定要删除此话术?',
apiModule: 'chatLibrary',
apiName: 'delChatLibrary',
apiParams: {
id: row.id
}
})
}
}
}
],
tableSearchForm: {
},
getListApi: this.$apis.chatLibrary.getChatLibraryList,
tableParams: {
listName: 'data',
tableOption: true,
tableColumns: [
{
label: '话术组',
prop: 'scriptGroup',
},
{
label: '话术内容',
prop: 'scriptContent',
addHtml: 'scriptContent'
},
{
label: '状态',
prop: 'state',
addHtml: 'state',
width: 170
},
{
label: '更新时间',
prop: 'updatedTime',
width: 210,
formatter: cellVal => {
return dayjs(cellVal.updatedTime).format('YYYY-MM-DD HH:mm:ss')
}
}
]
}
}
},
mounted () {
},
methods: {
/**跳转 */
jumpDetail (id) {
this.$router.push({
path: '/ChatLibrary/detail',
query: id ? { id, $title: '编辑话术' } : { $title: '创建话术' }
})
},
/**搜索 */
handleSearch () {
this.$refs.listRef.refreshTable()
},
/**二次弹框 */
showConfirm ({
title,
txt,
apiModule,
apiName,
apiParams,
fn
}) {
this.$confirm(txt, title, {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: utils.debounce((action) => {
if (action == 'confirm') {
this.$apis[apiModule][apiName](apiParams).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
fn && fn()
this.handleSearch()
}
})
}
}, 500)
})
},
/**改变状态 */
changeState ({
id,
state
}) {
state = state == 0 ? 1 : 0
this.showConfirm({
title: '',
txt: `确定要${CHAT_STATE[state]}此话术?`,
apiModule: 'chatLibrary',
apiName: 'updateChatLibraryState',
apiParams: {
id,
state
}
})
}
}
}
</script>
<style lang="scss" scoped>
.container {
margin-top: 10px;
height: 100%;
.tabelList {
margin-top: 10px;
height: 100%;
background-color: #fff;
box-sizing: border-box;
padding: 20px;
.chat-switch {
span {
font-size: 14px;
color: #666666;
margin-left: 8px;
}
}
.tooltip-content {
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
}
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!