Commit 9ae6dc39 by xinla

客户接口问题

1 parent bd42a0a7
...@@ -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>
<el-tooltip <div class="button-sync">
effect="light" <el-tooltip
:disabled="!disabled" v-if="disabled"
class="item" effect="light"
content="由于企业微信开放平台的限制,两小时内不得重复同步操作" class="item"
placement="top-start" content="由于企业微信开放平台的限制,两小时内不得重复同步操作"
> 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>
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: '',
...@@ -31,14 +32,11 @@ export default { ...@@ -31,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()
...@@ -110,15 +108,14 @@ export default { ...@@ -110,15 +108,14 @@ export default {
:class="['flex', index && 'mt20']" :class="['flex', index && 'mt20']"
> >
<!-- 汇总的场景显示名字 --> <!-- 汇总的场景显示名字 -->
<div v-if="!userId" class="name oe">{{ item.userName }}</div> <template v-if="!userId">
: <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">
暂无标签 暂无标签
...@@ -139,8 +136,10 @@ export default { ...@@ -139,8 +136,10 @@ export default {
:class="['flex', index && 'mt20']" :class="['flex', index && 'mt20']"
> >
<!-- 汇总的场景显示名字 --> <!-- 汇总的场景显示名字 -->
<div v-if="!userId" class="name oe">{{ item.userName }}</div> <template v-if="!userId">
: <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"
...@@ -162,20 +161,23 @@ export default { ...@@ -162,20 +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']"
>
<!-- 汇总的场景显示名字 --> <!-- 汇总的场景显示名字 -->
<div class="name oe" v-if="!userId">{{ item.userName }}</div> <template v-if="!userId">
: <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>
...@@ -241,6 +243,7 @@ export default { ...@@ -241,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>
...@@ -290,4 +293,7 @@ export default { ...@@ -290,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: {
...@@ -18,7 +19,8 @@ export default { ...@@ -18,7 +19,8 @@ export default {
viewType: { viewType: {
type: String, type: String,
default: '' default: ''
} },
lastSyncTime: String
}, },
components: {}, components: {},
data() { data() {
...@@ -33,7 +35,8 @@ export default { ...@@ -33,7 +35,8 @@ export default {
loading: false, loading: false,
total: 0, total: 0,
list: [], // 列表 list: [], // 列表
dictTrackState dictTrackState,
dateFormat
} }
}, },
computed: {}, computed: {},
...@@ -57,15 +60,36 @@ export default { ...@@ -57,15 +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 {
debugger let list = []
this.list = this.list.concat(rows) let dayList = []
console.log(this.list)
// 提取天
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(() => {
...@@ -119,24 +143,63 @@ export default { ...@@ -119,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-item <el-timeline class="timeline-box">
v-for="(item, index) in list" <el-timeline-item
:key="index" v-for="(item, index) in unit"
:timestamp="item.trackTime" :key="index"
placement="top" class="timeline-box-item"
> :timestamp="item.trackTime"
<p>{{ item.title }}</p> placement="top"
<p>{{ item.trackContent }}</p> type="primary"
</el-timeline-item> >
</el-timeline> <p class="timeline-box-item-title">{{ item.title || '无数据' }}</p>
<el-empty v-else :image-size="150"></el-empty> <p>{{ item.trackContent || '无数据' }}</p>
</ul> </el-timeline-item>
</el-timeline>
</li>
</template>
<el-empty v-else :image-size="150"></el-empty>
</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>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!