Commit 531a1010 by xinla

Merge remote-tracking branch 'origin/front_end_dev_2.0' into develop

2 parents ef8e0f0a 9ae6dc39
...@@ -28,14 +28,36 @@ export function getWeCustomerInfo(data) { ...@@ -28,14 +28,36 @@ export function getWeCustomerInfo(data) {
} }
}) })
} }
// 获取当前系统所有可用标签 //
/**
* 获取当前系统所有可用标签
* @param {*} params
* groupTagType 是 1:企业客户标签;3:个人标签
userId 员工的id 当groupTagType为3的时候需要传该字段
* @returns
*/
export function getAllTags(params) { export function getAllTags(params) {
return request({ return request({
url: service + '/findAllTags', url: service + '/findAllTags',
params params
}) })
} }
// 更新客户画像标签 //
/**
* 更新客户画像标签
* @param {*} data
* {
"externalUserid": "wmiGuBCgAApTcSW-3caqljFmKhm0r-bQ",//客户id
"userId": "ShengXiYong",//当前员工id
"isCompanyTag": false,//是否是企业标签true是;false:不是
"addTag": [
{
"tagId": "1471332704915922947"//标签id
}
]
}
* @returns
*/
export function updateWeCustomerPorTraitTag(data) { export function updateWeCustomerPorTraitTag(data) {
return request({ return request({
url: service + '/updateWeCustomerPorTraitTag', url: service + '/updateWeCustomerPorTraitTag',
...@@ -97,3 +119,39 @@ export function handleWait(params) { ...@@ -97,3 +119,39 @@ export function handleWait(params) {
method: 'delete' method: 'delete'
}) })
} }
/**
* 客户画像个人标签新增或更新
* @param {*} params
* {
"gourpName": "个人标签分组", //标签组名
"groupId": "1471327408994738177",//标签组id,新增的时候没有则传 null
"weTags": [
{
"groupId": "1471327408994738177",//标签组id,新增的时候没有则传 null
"name": "个人标签3",//标签名
"tagId": "1471327409208647681"//标签id,新增的时候没有则传 null
}
]
}
* @returns
*/
export function addOrUpdatePersonTags(data) {
return request({
url: service + '/addOrUpdatePersonTags/',
method: 'post',
data
})
}
/**
* 删除个人标签
* @ids {*} ids 标签id,多个用逗号隔开
* @returns
*/
export function deletePersonTag(ids) {
return request({
url: service + '/deletePersonTag/' + ids,
method: 'delete'
})
}
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
<div class="userlabel"> <div class="userlabel">
<div class="detail"> <div class="detail">
<div>企业标签</div> <div>企业标签</div>
<div class="data" is-link @click="labelEdit">编辑</div> <div class="data" is-link @click="labelEdit()">编辑</div>
</div> </div>
<div v-if="form.tags" class="labelstyle mt10"> <div v-if="form.tags" class="labelstyle mt10">
<div class="label" v-for="(unit, unique) in form.tags" :key="unique"> <div class="label" v-for="(unit, unique) in form.tags" :key="unique">
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
<div class="userlabel"> <div class="userlabel">
<div class="detail"> <div class="detail">
<div>个人标签</div> <div>个人标签</div>
<div class="data" is-link @click="labelEdit">编辑</div> <div class="data" is-link @click="labelEdit('person')">编辑</div>
</div> </div>
<div v-if="form.tags" class="labelstyle mt10"> <div v-if="form.tags" class="labelstyle mt10">
<div class="label" v-for="(unit, unique) in form.personTags" :key="unique"> <div class="label" v-for="(unit, unique) in form.personTags" :key="unique">
...@@ -154,15 +154,33 @@ ...@@ -154,15 +154,33 @@
:key="unique" :key="unique"
class="label" class="label"
:style="addTag.some((e) => e.tagId == unit.tagId) ? isActive : ''" :style="addTag.some((e) => e.tagId == unit.tagId) ? isActive : ''"
@click="userLabel(unit)" @click="clickLabel(unit)"
> >
{{ unit.name }} {{ unit.name }}
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<van-button type="info" class="saveinfo" round @click="saveInfo">保存</van-button> <div v-if="editLabelType === 'person'" class="ac" @click="showAddTag = true">
添加标签
</div>
<van-button type="info" class="saveinfo" round @click="saveCustomerTag">保存</van-button>
</van-action-sheet> </van-action-sheet>
<van-dialog
v-model="showAddTag"
title="添加标签"
show-cancel-button
@confirm="submitNewPersonTag"
>
<van-field
v-model="newPersonTag"
placeholder="请输入标签(不超过15字)"
required
:rules="[{ required: true, message: '请输入标签(不超过15字)' }]"
class="conagency"
/>
</van-dialog>
<!-- 点击客户标签里的编辑触发弹出框结束 --> <!-- 点击客户标签里的编辑触发弹出框结束 -->
<!-- 点击添加待办触发弹出框开始 --> <!-- 点击添加待办触发弹出框开始 -->
...@@ -248,9 +266,7 @@ ...@@ -248,9 +266,7 @@
</van-action-sheet> --> </van-action-sheet> -->
<!-- 保存 --> <!-- 保存 -->
<div style="margin: 30px"> <div style="margin: 30px">
<van-button round block type="info" native-type="submit" @click="saveInfo2" <van-button round block type="info" native-type="submit">保存</van-button>
>保存</van-button
>
</div> </div>
</van-form> </van-form>
</van-action-sheet> </van-action-sheet>
...@@ -318,7 +334,8 @@ export default { ...@@ -318,7 +334,8 @@ export default {
position: '', // 职业 position: '', // 职业
remarkCorpName: '', // 公司 remarkCorpName: '', // 公司
description: '', // 其他描述 description: '', // 其他描述
weTagGroupList: [] // 客户标签合集 tags: [], // 企业标签合集
personTags: [] // 个人标签合集
}, },
alllabel: [], // 标签组 alllabel: [], // 标签组
// 点击测试组标签获取的变量 // 点击测试组标签获取的变量
...@@ -352,7 +369,10 @@ export default { ...@@ -352,7 +369,10 @@ export default {
3: { name: '已成交', color: 'primary' }, 3: { name: '已成交', color: 'primary' },
4: { name: '无意向', color: 'warning' }, 4: { name: '无意向', color: 'warning' },
5: { name: '已流失', color: 'danger' } 5: { name: '已流失', color: 'danger' }
}) }),
editLabelType: '', // 编辑标签类型
showAddTag: false,
newPersonTag: ''
} }
}, },
watch: { watch: {
...@@ -423,7 +443,6 @@ export default { ...@@ -423,7 +443,6 @@ export default {
_this.findAddGroupNum() _this.findAddGroupNum()
_this.getCustomerInfo() _this.getCustomerInfo()
_this.findTrajectory() _this.findTrajectory()
_this.getAllTags()
} else { } else {
//错误处理 //错误处理
_this.$dialog({ message: '进入失败:' + JSON.stringify(res) }) _this.$dialog({ message: '进入失败:' + JSON.stringify(res) })
...@@ -437,8 +456,17 @@ export default { ...@@ -437,8 +456,17 @@ export default {
} }
}) })
}, },
getAllTags() { getAllTags(type) {
getAllTags() let params = {
groupTagType: 1
}
if (type === 'person') {
params = {
groupTagType: 3,
userId: this.userId
}
}
getAllTags(params)
.then(({ data }) => { .then(({ data }) => {
this.alllabel = data this.alllabel = data
...@@ -453,8 +481,6 @@ export default { ...@@ -453,8 +481,6 @@ export default {
console.log(err) console.log(err)
}) })
}, },
// 客户待办点击保存事件
saveInfo2() {},
// 添加或编辑轨迹 // 添加或编辑轨迹
addOrEditWaitHandle(form) { addOrEditWaitHandle(form) {
addOrEditWaitHandle(form) addOrEditWaitHandle(form)
...@@ -498,7 +524,7 @@ export default { ...@@ -498,7 +524,7 @@ export default {
this.findTrajectory() this.findTrajectory()
}, },
// 添加代办 // 添加代办
// 表单提交 // 客户待办点击保存事件
onSubmit() { onSubmit() {
let form = { let form = {
trajectoryType: 4, trajectoryType: 4,
...@@ -564,8 +590,8 @@ export default { ...@@ -564,8 +590,8 @@ export default {
} }
}) })
}, },
// 第一层标签 // 点击选择标签
userLabel(item) { clickLabel(item) {
let index = this.addTag.findIndex((e) => { let index = this.addTag.findIndex((e) => {
return item.tagId == e.tagId return item.tagId == e.tagId
}) })
...@@ -581,12 +607,13 @@ export default { ...@@ -581,12 +607,13 @@ export default {
this.addTag.splice(index, 1) this.addTag.splice(index, 1)
} }
}, },
saveInfo() { saveCustomerTag() {
// 更新客户画像标签 [{ groupId: this.groupId, name: this.name, tagId: this.tagId }] // 更新客户画像标签 [{ groupId: this.groupId, name: this.name, tagId: this.tagId }]
updateWeCustomerPorTraitTag({ updateWeCustomerPorTraitTag({
externalUserid: this.externalUserid, externalUserid: this.externalUserid,
userId: this.userId, userId: this.userId,
addTag: this.addTag isCompanyTag: this.editLabelType !== 'person', //是否是企业标签true是;false:不是
addTag: this.addTag.map((e) => ({ tagId: e.tagId }))
}) })
.then((res) => { .then((res) => {
// console.log(res); // console.log(res);
...@@ -604,13 +631,17 @@ export default { ...@@ -604,13 +631,17 @@ export default {
}) })
}, },
// 点击编辑按钮 // 点击编辑按钮
labelEdit() { async labelEdit(type) {
let tags = this.form.tags this.editLabelType = type
await this.getAllTags(type)
this.addTag = []
let tags = this.form[type === 'person' ? 'personTags' : 'tags']
let hasErrorTag = [] // 异常活已经删除的标签 let hasErrorTag = [] // 异常活已经删除的标签
let repeat = [] // 重复的标签 let repeat = [] // 重复的标签
tags.forEach((unit) => { tags.forEach((unit) => {
// 判断是否有重复标签 // 判断是否有重复标签
let isRepeat = this.addTag.some((d) => { let isRepeat = this.listTagOneArray.some((d) => {
return d.tagId === unit.tagId return d.tagId === unit.tagId
}) })
// 去重 // 去重
...@@ -696,7 +727,10 @@ export default { ...@@ -696,7 +727,10 @@ export default {
.catch((err) => { .catch((err) => {
console.log(err) console.log(err)
}) })
} },
// 添加个人标签
submitNewPersonTag() {}
} }
} }
</script> </script>
......
...@@ -17,7 +17,7 @@ export default { ...@@ -17,7 +17,7 @@ export default {
}, },
computed: { computed: {
disabled() { disabled() {
return this.lastSyncTime ? (+new Date() - +new Date(this.lastSyncTime)) / 3600000 < 2 : true return this.lastSyncTime ? (+new Date() - +new Date(this.lastSyncTime)) / 3600000 < 2 : false
} }
}, },
watch: {}, watch: {},
...@@ -36,18 +36,24 @@ export default { ...@@ -36,18 +36,24 @@ export default {
</script> </script>
<template> <template>
<div class="button-sync">
<el-tooltip <el-tooltip
v-if="disabled"
effect="light" effect="light"
:disabled="!disabled"
class="item" class="item"
content="由于企业微信开放平台的限制,两小时内不得重复同步操作" content="由于企业微信开放平台的限制,两小时内不得重复同步操作"
placement="top-start" placement="top-start"
> >
<el-tag v-if="disabled" type="info" size="default"><slot></slot></el-tag> <el-tag type="info" size="default"><slot></slot></el-tag>
</el-tooltip>
<el-button v-else v-preventReClick type="primary" @click="sync"> <el-button v-else v-preventReClick type="primary" @click="sync">
<slot></slot> <slot></slot>
</el-button> </el-button>
</el-tooltip> </div>
</template> </template>
<style lang="less" scoped></style> <style lang="scss" scoped>
.button-sync {
display: inline-block;
}
</style>
...@@ -168,11 +168,11 @@ ...@@ -168,11 +168,11 @@
// console.log(data, checked, indeterminate); // console.log(data, checked, indeterminate);
this.userList = this.unique(this.userList) this.userList = this.unique(this.userList)
}, },
unique(arr){ unique (arr) {
for(var i=0; i<arr.length; i++){ for (var i = 0; i < arr.length; i++) {
for(var j=i+1; j<arr.length; j++){ for (var j = i + 1; j < arr.length; j++) {
if(arr[i].userId.split('_')[0] == arr[j].userId.split('_')[0]){ if (arr[i].userId.split('_')[0] == arr[j].userId.split('_')[0]) {
arr.splice(j,1); arr.splice(j, 1);
j--; j--;
} }
} }
...@@ -200,7 +200,7 @@ ...@@ -200,7 +200,7 @@
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12" :xs="24"> <el-col :span="12" :xs="24">
<div class="head-container"> <div class="head-container">
<el-tree node-key="userId" ref="tree" lazy accordion show-checkbox :check-on-click-node="false" :expand-on-click-node="true" :default-checked-keys="defaultCheckedKeys" :load="loadNode" :props="defaultProps" :check-strictly="!isOnlyLeaf" @check-change="handleCheckChange"></el-tree> <el-tree node-key="userId" ref="tree" lazy accordion show-checkbox :check-on-click-node="false" :expand-on-click-node="true" :default-checked-keys="defaultCheckedKeys" :load="loadNode" :props="defaultProps" :check-strictly="isOnlyLeaf" @check-change="handleCheckChange"></el-tree>
</div> </div>
</el-col> </el-col>
<el-col :span="12" :xs="24" class="user-list"> <el-col :span="12" :xs="24" class="user-list">
......
...@@ -280,7 +280,7 @@ ...@@ -280,7 +280,7 @@
showMore () { showMore () {
let exit = true let exit = true
if (this.isSingle) { if (this.isSingle) {
if (this.form.materialMsgList.length === 3) { if (this.form.materialMsgList.length === 1) {
exit = false exit = false
} }
} }
...@@ -316,12 +316,12 @@ ...@@ -316,12 +316,12 @@
if (val) { if (val) {
const textIndex = $textarea.selectionStart const textIndex = $textarea.selectionStart
if (textIndex == 0 && document.activeElement != $textarea) { if (textIndex == 0 && document.activeElement != $textarea) {
this.form.welcomeMsg += '#客户昵称#' this.form.welcomeMsg += '%客户昵称%'
} else { } else {
this.form.welcomeMsg = msg.slice(0, textIndex) + '#客户昵称#' + msg.slice(textIndex) this.form.welcomeMsg = msg.slice(0, textIndex) + '%客户昵称%' + msg.slice(textIndex)
} }
} else { } else {
this.form.welcomeMsg = msg.replace(/\#客户昵称\#/, '') this.form.welcomeMsg = msg.replace(/\%客户昵称\%/, '')
} }
}, },
onChooseMaterial (materialType, rowIndex) { onChooseMaterial (materialType, rowIndex) {
......
import { parseTime } from './common' import { parseTime } from './common'
/** // 日期时间格式化
* 表格时间格式化 export function dateFormat(dateString, fmt = 'yyyy-MM-dd hh:mm:ss') {
*/ if (!dateString) {
export function formatDate(cellValue) { return
if (cellValue == null || cellValue == '') return '' }
var date = new Date(cellValue) var date = new Date(dateString.replace(/-/g, '/'))
var year = date.getFullYear() var o = {
var month = 'M+': date.getMonth() + 1, //月份
date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1 'd+': date.getDate(), //日
var day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate() 'h+': date.getHours(), //小时
var hours = date.getHours() < 10 ? '0' + date.getHours() : date.getHours() 'm+': date.getMinutes(), //分
var minutes = 's+': date.getSeconds(), //秒
date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes() 'q+': Math.floor((date.getMonth() + 3) / 3), //季度
var seconds = 'S+': date.getMilliseconds(), //毫秒
date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds() 'w+': '星期' + '日一二三四五六'.charAt(date.getDay()) //星期
return ( }
year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds
if (/(y+)/.test(fmt)) {
fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length))
}
for (var k in o) {
if (new RegExp('(' + k + ')').test(fmt)) {
fmt = fmt.replace(
RegExp.$1,
RegExp.$1.length == 1 || String(o[k]).length > 1 ? o[k] : '0' + o[k]
) )
}
}
return fmt
} }
/** /**
...@@ -50,15 +63,7 @@ export function formatTime(time, option) { ...@@ -50,15 +63,7 @@ export function formatTime(time, option) {
return parseTime(time, option) return parseTime(time, option)
} else { } else {
return ( return (
d.getMonth() + d.getMonth() + 1 + '月' + d.getDate() + '日' + d.getHours() + '时' + d.getMinutes() + '分'
1 +
'月' +
d.getDate() +
'日' +
d.getHours() +
'时' +
d.getMinutes() +
'分'
) )
} }
} }
...@@ -196,8 +201,7 @@ export function toggleClass(element, className) { ...@@ -196,8 +201,7 @@ export function toggleClass(element, className) {
classString += '' + className classString += '' + className
} else { } else {
classString = classString =
classString.substr(0, nameIndex) + classString.substr(0, nameIndex) + classString.substr(nameIndex + className.length)
classString.substr(nameIndex + className.length)
} }
element.className = classString element.className = classString
} }
...@@ -354,7 +358,7 @@ export const beautifierConf = { ...@@ -354,7 +358,7 @@ export const beautifierConf = {
indent_inner_html: true, indent_inner_html: true,
comma_first: false, comma_first: false,
e4x: true, e4x: true,
indent_empty_lines: true, indent_empty_lines: true
}, },
js: { js: {
indent_size: '2', indent_size: '2',
...@@ -373,8 +377,8 @@ export const beautifierConf = { ...@@ -373,8 +377,8 @@ export const beautifierConf = {
indent_inner_html: true, indent_inner_html: true,
comma_first: false, comma_first: false,
e4x: true, e4x: true,
indent_empty_lines: true, indent_empty_lines: true
}, }
} }
// 首字母大小 // 首字母大小
...@@ -404,7 +408,7 @@ export const pickerOptions = { ...@@ -404,7 +408,7 @@ export const pickerOptions = {
const start = new Date() const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7) start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
picker.$emit('pick', [start, end]) picker.$emit('pick', [start, end])
}, }
}, },
{ {
text: '最近一个月', text: '最近一个月',
...@@ -413,7 +417,7 @@ export const pickerOptions = { ...@@ -413,7 +417,7 @@ export const pickerOptions = {
const start = new Date() const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30) start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
picker.$emit('pick', [start, end]) picker.$emit('pick', [start, end])
}, }
}, },
{ {
text: '最近三个月', text: '最近三个月',
...@@ -422,7 +426,7 @@ export const pickerOptions = { ...@@ -422,7 +426,7 @@ export const pickerOptions = {
const start = new Date() const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90) start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
picker.$emit('pick', [start, end]) picker.$emit('pick', [start, end])
}, }
}, }
], ]
} }
...@@ -44,7 +44,7 @@ service.interceptors.response.use( ...@@ -44,7 +44,7 @@ service.interceptors.response.use(
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
store.dispatch('LogOut').then(() => { store.dispatch('LogOut').then(() => {
location.href = '/' location.href = process.env.VUE_APP_BASE_URL
}) })
}) })
} else if (code === 500) { } else if (code === 500) {
......
<script> <script>
import { getSummary, getFollowUpRecord, getCustomerInfoByUserId } from '@/api/customer' import { getSummary, getFollowUpRecord, getCustomerInfoByUserId } from '@/api/customer'
import { dictTrackState } from '@/utils/dictionary'
import record from './record' import record from './record'
export default { export default {
name: '', name: '',
...@@ -9,6 +10,10 @@ export default { ...@@ -9,6 +10,10 @@ export default {
type: String, type: String,
default: '' default: ''
} }
// trackUsers: {
// type: Array,
// default: ''
// }
}, },
components: { components: {
record record
...@@ -27,14 +32,11 @@ export default { ...@@ -27,14 +32,11 @@ export default {
active: '0', active: '0',
openedTabs: ['0'], openedTabs: ['0'],
openTrack: ['0'], openTrack: ['0'],
lastSyncTime: 0 lastSyncTime: null,
} dictTrackState
},
computed: {
disabled() {
return (+new Date() - +new Date(this.lastSyncTime)) / 3600000 < 2
} }
}, },
computed: {},
watch: {}, watch: {},
created() { created() {
this.userId ? this.getCustomerInfoByUserId() : this.getSummary() this.userId ? this.getCustomerInfoByUserId() : this.getSummary()
...@@ -105,15 +107,15 @@ export default { ...@@ -105,15 +107,15 @@ export default {
:key="index" :key="index"
:class="['flex', index && 'mt20']" :class="['flex', index && 'mt20']"
> >
<!-- 汇总的场景显示名字 -->
<template v-if="!userId">
<div class="name oe">{{ item.userName }}</div> <div class="name oe">{{ item.userName }}</div>
: :
</template>
<template v-if="item.tagNames"> <template v-if="item.tagNames">
<el-tag <el-tag v-for="(unit, unique) in item.tagNames.split(',')" :key="unique">{{
type="info" unit
v-for="(unit, unique) in item.tagNames.split(',')" }}</el-tag>
:key="unique"
>{{ unit }}</el-tag
>
</template> </template>
<div v-else class="sub-text-color ac"> <div v-else class="sub-text-color ac">
暂无标签 暂无标签
...@@ -133,8 +135,11 @@ export default { ...@@ -133,8 +135,11 @@ export default {
:key="index" :key="index"
:class="['flex', index && 'mt20']" :class="['flex', index && 'mt20']"
> >
<!-- 汇总的场景显示名字 -->
<template v-if="!userId">
<div class="name oe">{{ item.userName }}</div> <div class="name oe">{{ item.userName }}</div>
: :
</template>
<template v-if="item.tagNames"> <template v-if="item.tagNames">
<el-tag <el-tag
type="info" type="info"
...@@ -156,19 +161,23 @@ export default { ...@@ -156,19 +161,23 @@ export default {
<el-card class="mb10" shadow="never"> <el-card class="mb10" shadow="never">
<div slot="header" class="card-title">跟进状态</div> <div slot="header" class="card-title">跟进状态</div>
<template v-if="portrayalSum.trackStates && portrayalSum.trackStates.length"> <template v-if="portrayalSum.trackStates && portrayalSum.trackStates.length">
<div class="flex mb20" v-for="(item, index) of portrayalSum.trackStates" :key="index"> <div
v-for="(item, index) of portrayalSum.trackStates"
:key="index"
:class="['flex', index && 'mt20']"
>
<!-- 汇总的场景显示名字 -->
<template v-if="!userId">
<div class="name oe">{{ item.userName }}</div> <div class="name oe">{{ item.userName }}</div>
: :
</template>
<template v-if="item.trackStateList.length"> <template v-if="item.trackStateList.length">
<el-steps <el-steps style="flex:auto;" :active="item.trackStateList.length">
style="flex:auto;"
:active="item.trackStateList.length"
finish-status="success"
>
<el-step <el-step
v-for="(unit, unique) of item.trackStateList" v-for="(unit, unique) of item.trackStateList"
:key="unique" :key="unique"
:title="dictTrackState[~~unit.trackState + ''].name" :title="dictTrackState[~~unit.trackState + ''].name"
:status="dictTrackState[~~unit.trackState + ''].color"
:description="unit.trackTime" :description="unit.trackTime"
></el-step> ></el-step>
</el-steps> </el-steps>
...@@ -183,19 +192,22 @@ export default { ...@@ -183,19 +192,22 @@ export default {
<el-card shadow="never"> <el-card shadow="never">
<div slot="header" class="card-title">跟进记录</div> <div slot="header" class="card-title">跟进记录</div>
<!-- 单个人的场景 -->
<record v-if="userId" :userId="userId" viewType="1"></record>
<!-- 汇总的场景 -->
<el-tabs <el-tabs
v-if="portrayalSum.trackStates && portrayalSum.trackStates.length" v-else-if="portrayalSum.trackUsers && portrayalSum.trackUsers.length"
value="0" value="0"
@tab-click="changeTab" @tab-click="changeTab"
> >
<el-tab-pane <el-tab-pane
v-for="(item, index) in portrayalSum.trackStates" v-for="(item, index) in portrayalSum.trackUsers"
:key="index" :key="index"
:label="item.userName" :label="item.userName"
> >
<record <record
v-if="openedTabs.includes(index + '')" v-if="openedTabs.includes(index + '')"
:userId="item.userId" :userId="item.trackUserId"
viewType="1" viewType="1"
></record> ></record>
</el-tab-pane> </el-tab-pane>
...@@ -231,6 +243,7 @@ export default { ...@@ -231,6 +243,7 @@ export default {
v-show="item === active" v-show="item === active"
:key="index" :key="index"
:userId="userId" :userId="userId"
:lastSyncTime.sync="lastSyncTime"
:trajectoryType="item == 0 ? null : item" :trajectoryType="item == 0 ? null : item"
></record> ></record>
</template> </template>
...@@ -280,4 +293,7 @@ export default { ...@@ -280,4 +293,7 @@ export default {
float: right; float: right;
top: -11px; top: -11px;
} }
.sub-text-color {
flex: auto;
}
</style> </style>
<script> <script>
import { getFollowUpRecord, syncTrack } from '@/api/customer' import { getFollowUpRecord, syncTrack } from '@/api/customer'
import { dictTrackState } from '@/utils/dictionary' import { dictTrackState } from '@/utils/dictionary'
import { dateFormat } from '@/utils'
export default { export default {
name: '', name: '',
props: { props: {
...@@ -14,16 +15,18 @@ export default { ...@@ -14,16 +15,18 @@ export default {
type: String, type: String,
default: null default: null
}, },
// 视图展示类型 1:表格展示,2:轨迹时间线展示
viewType: { viewType: {
type: String, type: String,
default: '' default: ''
} },
lastSyncTime: String
}, },
components: {}, components: {},
data() { data() {
return { return {
query: { query: {
pageNum: 1, pageNum: 0,
pageSize: 10, pageSize: 10,
externalUserid: '', // 是 当前客户id externalUserid: '', // 是 当前客户id
userId: null, // 当前跟进人id, userId: null, // 当前跟进人id,
...@@ -32,13 +35,14 @@ export default { ...@@ -32,13 +35,14 @@ export default {
loading: false, loading: false,
total: 0, total: 0,
list: [], // 列表 list: [], // 列表
dictTrackState dictTrackState,
dateFormat
} }
}, },
computed: {}, computed: {},
watch: {}, watch: {},
created() { created() {
this.viewType && this.getList() this.viewType && this.getList(1)
}, },
mounted() {}, mounted() {},
methods: { methods: {
...@@ -56,13 +60,36 @@ export default { ...@@ -56,13 +60,36 @@ export default {
} }
this.loading = true this.loading = true
getFollowUpRecord(this.query) getFollowUpRecord(this.query)
.then(({ rows, total }) => { .then(({ rows, total, lastSyncTime }) => {
if (this.viewType) { if (this.viewType) {
this.list = rows this.list = rows
} else { } else {
this.list = this.list.concat(rows) let list = []
let dayList = []
// 提取天
rows.forEach((ele) => {
let date = this.dateFormat(ele.createTime, 'yyyyMMdd')
dayList.includes(date) || dayList.push(date)
})
dayList.sort((a, b) => b - a)
// 提取每天的时间点
for (let i = 0; i < dayList.length; i++) {
let timeList = []
for (let j = 0; j < rows.length; j++) {
// console.log(rows[j].createTime);
if (dayList[i] == this.dateFormat(rows[j].createTime, 'yyyyMMdd')) {
timeList.push(rows[j])
}
}
list.push(timeList)
}
this.list = this.list.concat(list)
} }
this.total = +total this.total = +total
this.$emit('update:lastSyncTime', lastSyncTime)
this.loading = false this.loading = false
}) })
.catch(() => { .catch(() => {
...@@ -116,24 +143,63 @@ export default { ...@@ -116,24 +143,63 @@ export default {
</div> </div>
</template> </template>
<ul v-else class="infinite-list" v-infinite-scroll="getList" style="overflow:auto"> <div v-else class="timeline-time-wrap">
<!-- <li v-for="i in list" class="infinite-list-item" :key="i"> <ul class="infinite-list" v-infinite-scroll="getList" style="overflow:auto">
<div>2021-02-16 星期二</div> <template v-if="list.length">
</li> --> <li v-for="(unit, i) in list" class="infinite-list-item" :key="i">
<el-timeline v-if="list.length"> <div class="timeline-time">{{ dateFormat(unit[0].createTime, 'yyyy-MM-dd w') }}</div>
<el-timeline class="timeline-box">
<el-timeline-item <el-timeline-item
v-for="(item, index) in list" v-for="(item, index) in unit"
:key="index" :key="index"
class="timeline-box-item"
:timestamp="item.trackTime" :timestamp="item.trackTime"
placement="top" placement="top"
type="primary"
> >
<p>{{ item.title }}</p> <p class="timeline-box-item-title">{{ item.title || '无数据' }}</p>
<p>{{ item.trackContent }}</p> <p>{{ item.trackContent || '无数据' }}</p>
</el-timeline-item> </el-timeline-item>
</el-timeline> </el-timeline>
</li>
</template>
<el-empty v-else :image-size="150"></el-empty> <el-empty v-else :image-size="150"></el-empty>
</ul> </ul>
</div> </div>
</div>
</template> </template>
<style lang="less" scoped></style> <style lang="scss" scoped>
.timeline-time-wrap {
display: flex;
justify-content: center;
}
.timeline-time {
font-size: 14px;
color: #999999;
line-height: 48px;
}
.el-timeline > .timeline-box-item:first-child /deep/ .el-timeline-item__node {
border-radius: 0 !important;
}
.timeline-box {
padding-left: 70px;
&-item {
/deep/ .el-timeline-item__timestamp {
position: absolute;
top: 4px;
left: -45px;
margin: 0;
}
&-title {
font-weight: 700;
line-height: 25px;
}
}
}
/deep/ .el-timeline-item__tail {
border-left-color: #3c88f0;
}
</style>
...@@ -62,11 +62,15 @@ export default { ...@@ -62,11 +62,15 @@ export default {
getDetail(this.$route.query).then(({ data }) => { getDetail(this.$route.query).then(({ data }) => {
data.companyTags && (data.companyTags = data.companyTags.split(',')) data.companyTags && (data.companyTags = data.companyTags.split(','))
this.customer = data this.customer = data
if (data.trackUsers && data.trackUsers.length === 1) {
this.openedTabs = [data.trackUsers[0].trackUserId]
}
this.birthday = data.birthday this.birthday = data.birthday
}) })
}, },
changeTab(tab) { changeTab(tab) {
this.openedTabs.includes(tab.id) || this.openedTabs.push(tab.id) this.openedTabs.includes(tab.$attrs.id) || this.openedTabs.push(tab.$attrs.id)
} }
// remark(item) { // remark(item) {
......
...@@ -147,6 +147,7 @@ export default { ...@@ -147,6 +147,7 @@ export default {
}) })
api.sync().then((r) => { api.sync().then((r) => {
loading.close() loading.close()
this.getList(1)
this.msgSuccess('后台开始同步数据,请稍后关注进度') this.msgSuccess('后台开始同步数据,请稍后关注进度')
}) })
}, },
......
...@@ -138,7 +138,7 @@ ...@@ -138,7 +138,7 @@
</SelectTag> </SelectTag>
<!-- 选择使用员工弹窗 --> <!-- 选择使用员工弹窗 -->
<SelectUser :key="codeForm.qrType" :defaultValues="selectedUserList" :visible.sync="dialogVisibleSelectUser" title="选择使用员工" :isOnlyLeaf="codeForm.qrType !== 2" :isSigleSelect="codeForm.qrType == 1" @success="selectedUser"></SelectUser> <SelectUser :key="codeForm.qrType" :defaultValues="selectedUserList" :visible.sync="dialogVisibleSelectUser" title="选择使用员工" :isOnlyLeaf="true" :isSigleSelect="codeForm.qrType == 1" @success="selectedUser"></SelectUser>
</div> </div>
</template> </template>
......
...@@ -18,8 +18,9 @@ ...@@ -18,8 +18,9 @@
</div> </div>
<div> <div>
<div style="margin:10px 0;display:flex;"> <div style="margin:10px 0;display:flex;">
<el-button type="primary" size="mini" @click="gotoRoute">发表动态</el-button> <el-button type="primary" size="mini" @click="gotoRoute" style="margin-right:10px;">发表动态</el-button>
<el-button type="primary" :disabled="disable" size="mini" @click="syncFn">同步朋友圈</el-button> <!-- <el-button type="primary" :disabled="disable" size="mini" @click="syncFn">同步朋友圈</el-button> -->
<ButtonSync :lastSyncTime="lastSyncTime" @click="syncFn">同步朋友圈</ButtonSync>
<div class="time" v-if="lastSyncTime">最近同步:{{lastSyncTime}}</div> <div class="time" v-if="lastSyncTime">最近同步:{{lastSyncTime}}</div>
<div class="time" v-else>暂无记录,请手动点击同步</div> <div class="time" v-else>暂无记录,请手动点击同步</div>
</div> </div>
......
...@@ -195,7 +195,7 @@ export default { ...@@ -195,7 +195,7 @@ export default {
syncHMoments({ filterType: 1 }).then((res) => { syncHMoments({ filterType: 1 }).then((res) => {
if (res.code === 200) { if (res.code === 200) {
this.msgSuccess(res.msg) this.msgSuccess(res.msg)
this.getList() this.getList(1)
} }
}) })
}, },
...@@ -224,7 +224,7 @@ export default { ...@@ -224,7 +224,7 @@ export default {
}), }),
(this.userArray = []) (this.userArray = [])
this.value1 = [] this.value1 = []
this.getList() this.getList(1)
}, },
getList(type) { getList(type) {
type && (this.query.pageNum = type) type && (this.query.pageNum = type)
......
...@@ -203,13 +203,15 @@ ...@@ -203,13 +203,15 @@
if (dd.annexType === 'link') { if (dd.annexType === 'link') {
let reUrl = /(http|https):\/\/([\w.]+\/?)\S*/ let reUrl = /(http|https):\/\/([\w.]+\/?)\S*/
if (!reUrl.test(dd.annexUrl)) { if (!reUrl.test(dd.annexUrl)) {
console.log(123)
goto = false goto = false
dd.contentError = '必须以 http://或 https://开头' dd.contentError = '必须以 http://或 https://开头'
} }
} }
}) })
this.$forceUpdate() this.$forceUpdate()
if (!this.form.otherContent.length) {
this.form.contentType = 'text'
}
if (goto) { if (goto) {
gotoPublish(this.form).then(res => { gotoPublish(this.form).then(res => {
if (res.code === 200) { if (res.code === 200) {
......
...@@ -169,7 +169,7 @@ export default { ...@@ -169,7 +169,7 @@ export default {
}, },
methods: { methods: {
getCode() { getCode() {
getCodeImg().then(res => { getCodeImg().then((res) => {
this.codeUrl = 'data:image/gif;base64,' + res.img this.codeUrl = 'data:image/gif;base64,' + res.img
this.loginForm.uuid = res.uuid this.loginForm.uuid = res.uuid
}) })
...@@ -185,7 +185,7 @@ export default { ...@@ -185,7 +185,7 @@ export default {
} }
}, },
handleLogin() { handleLogin() {
this.$refs.loginForm.validate(valid => { this.$refs.loginForm.validate((valid) => {
if (valid) { if (valid) {
this.loading = true this.loading = true
if (this.loginForm.rememberMe) { if (this.loginForm.rememberMe) {
...@@ -204,7 +204,7 @@ export default { ...@@ -204,7 +204,7 @@ export default {
this.$store this.$store
.dispatch('Login', this.loginForm) .dispatch('Login', this.loginForm)
.then(() => { .then(() => {
this.$router.push({ path: this.redirect || '/' }) this.$router.push({ path: this.redirect || process.env.VUE_APP_BASE_URL })
}) })
.catch(() => { .catch(() => {
this.loading = false this.loading = false
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!