Commit 9ae6dc39 by xinla

客户接口问题

1 parent bd42a0a7
......@@ -17,7 +17,7 @@ export default {
},
computed: {
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: {},
......@@ -36,18 +36,24 @@ export default {
</script>
<template>
<el-tooltip
effect="light"
:disabled="!disabled"
class="item"
content="由于企业微信开放平台的限制,两小时内不得重复同步操作"
placement="top-start"
>
<el-tag v-if="disabled" type="info" size="default"><slot></slot></el-tag>
<div class="button-sync">
<el-tooltip
v-if="disabled"
effect="light"
class="item"
content="由于企业微信开放平台的限制,两小时内不得重复同步操作"
placement="top-start"
>
<el-tag type="info" size="default"><slot></slot></el-tag>
</el-tooltip>
<el-button v-else v-preventReClick type="primary" @click="sync">
<slot></slot>
</el-button>
</el-tooltip>
</div>
</template>
<style lang="less" scoped></style>
<style lang="scss" scoped>
.button-sync {
display: inline-block;
}
</style>
import { parseTime } from './common'
/**
* 表格时间格式化
*/
export function formatDate(cellValue) {
if (cellValue == null || cellValue == '') return ''
var date = new Date(cellValue)
var year = date.getFullYear()
var month =
date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1
var day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
var hours = date.getHours() < 10 ? '0' + date.getHours() : date.getHours()
var minutes =
date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()
var seconds =
date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds()
return (
year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds
)
// 日期时间格式化
export function dateFormat(dateString, fmt = 'yyyy-MM-dd hh:mm:ss') {
if (!dateString) {
return
}
var date = new Date(dateString.replace(/-/g, '/'))
var o = {
'M+': date.getMonth() + 1, //月份
'd+': date.getDate(), //日
'h+': date.getHours(), //小时
'm+': date.getMinutes(), //分
's+': date.getSeconds(), //秒
'q+': Math.floor((date.getMonth() + 3) / 3), //季度
'S+': date.getMilliseconds(), //毫秒
'w+': '星期' + '日一二三四五六'.charAt(date.getDay()) //星期
}
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) {
return parseTime(time, option)
} else {
return (
d.getMonth() +
1 +
'月' +
d.getDate() +
'日' +
d.getHours() +
'时' +
d.getMinutes() +
'分'
d.getMonth() + 1 + '月' + d.getDate() + '日' + d.getHours() + '时' + d.getMinutes() + '分'
)
}
}
......@@ -196,8 +201,7 @@ export function toggleClass(element, className) {
classString += '' + className
} else {
classString =
classString.substr(0, nameIndex) +
classString.substr(nameIndex + className.length)
classString.substr(0, nameIndex) + classString.substr(nameIndex + className.length)
}
element.className = classString
}
......@@ -354,7 +358,7 @@ export const beautifierConf = {
indent_inner_html: true,
comma_first: false,
e4x: true,
indent_empty_lines: true,
indent_empty_lines: true
},
js: {
indent_size: '2',
......@@ -373,8 +377,8 @@ export const beautifierConf = {
indent_inner_html: true,
comma_first: false,
e4x: true,
indent_empty_lines: true,
},
indent_empty_lines: true
}
}
// 首字母大小
......@@ -404,7 +408,7 @@ export const pickerOptions = {
const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
picker.$emit('pick', [start, end])
},
}
},
{
text: '最近一个月',
......@@ -413,7 +417,7 @@ export const pickerOptions = {
const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
picker.$emit('pick', [start, end])
},
}
},
{
text: '最近三个月',
......@@ -422,7 +426,7 @@ export const pickerOptions = {
const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
picker.$emit('pick', [start, end])
},
},
],
}
}
]
}
......@@ -44,7 +44,7 @@ service.interceptors.response.use(
type: 'warning'
}).then(() => {
store.dispatch('LogOut').then(() => {
location.href = '/'
location.href = process.env.VUE_APP_BASE_URL
})
})
} else if (code === 500) {
......
<script>
import { getSummary, getFollowUpRecord, getCustomerInfoByUserId } from '@/api/customer'
import { dictTrackState } from '@/utils/dictionary'
import record from './record'
export default {
name: '',
......@@ -31,14 +32,11 @@ export default {
active: '0',
openedTabs: ['0'],
openTrack: ['0'],
lastSyncTime: 0
}
},
computed: {
disabled() {
return (+new Date() - +new Date(this.lastSyncTime)) / 3600000 < 2
lastSyncTime: null,
dictTrackState
}
},
computed: {},
watch: {},
created() {
this.userId ? this.getCustomerInfoByUserId() : this.getSummary()
......@@ -110,15 +108,14 @@ export default {
: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">
<el-tag
type="info"
v-for="(unit, unique) in item.tagNames.split(',')"
:key="unique"
>{{ unit }}</el-tag
>
<el-tag v-for="(unit, unique) in item.tagNames.split(',')" :key="unique">{{
unit
}}</el-tag>
</template>
<div v-else class="sub-text-color ac">
暂无标签
......@@ -139,8 +136,10 @@ export default {
: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">
<el-tag
type="info"
......@@ -162,20 +161,23 @@ export default {
<el-card class="mb10" shadow="never">
<div slot="header" class="card-title">跟进状态</div>
<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">
<el-steps
style="flex:auto;"
:active="item.trackStateList.length"
finish-status="success"
>
<el-steps style="flex:auto;" :active="item.trackStateList.length">
<el-step
v-for="(unit, unique) of item.trackStateList"
:key="unique"
:title="dictTrackState[~~unit.trackState + ''].name"
:status="dictTrackState[~~unit.trackState + ''].color"
:description="unit.trackTime"
></el-step>
</el-steps>
......@@ -241,6 +243,7 @@ export default {
v-show="item === active"
:key="index"
:userId="userId"
:lastSyncTime.sync="lastSyncTime"
:trajectoryType="item == 0 ? null : item"
></record>
</template>
......@@ -290,4 +293,7 @@ export default {
float: right;
top: -11px;
}
.sub-text-color {
flex: auto;
}
</style>
<script>
import { getFollowUpRecord, syncTrack } from '@/api/customer'
import { dictTrackState } from '@/utils/dictionary'
import { dateFormat } from '@/utils'
export default {
name: '',
props: {
......@@ -18,7 +19,8 @@ export default {
viewType: {
type: String,
default: ''
}
},
lastSyncTime: String
},
components: {},
data() {
......@@ -33,7 +35,8 @@ export default {
loading: false,
total: 0,
list: [], // 列表
dictTrackState
dictTrackState,
dateFormat
}
},
computed: {},
......@@ -57,15 +60,36 @@ export default {
}
this.loading = true
getFollowUpRecord(this.query)
.then(({ rows, total }) => {
.then(({ rows, total, lastSyncTime }) => {
if (this.viewType) {
this.list = rows
} else {
debugger
this.list = this.list.concat(rows)
console.log(this.list)
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.$emit('update:lastSyncTime', lastSyncTime)
this.loading = false
})
.catch(() => {
......@@ -119,24 +143,63 @@ export default {
</div>
</template>
<ul v-else class="infinite-list" v-infinite-scroll="getList" style="overflow:auto">
<!-- <li v-for="i in list" class="infinite-list-item" :key="i">
<div>2021-02-16 星期二</div>
</li> -->
<el-timeline v-if="list.length">
<el-timeline-item
v-for="(item, index) in list"
:key="index"
:timestamp="item.trackTime"
placement="top"
>
<p>{{ item.title }}</p>
<p>{{ item.trackContent }}</p>
</el-timeline-item>
</el-timeline>
<el-empty v-else :image-size="150"></el-empty>
</ul>
<div v-else class="timeline-time-wrap">
<ul class="infinite-list" v-infinite-scroll="getList" style="overflow:auto">
<template v-if="list.length">
<li v-for="(unit, i) in list" class="infinite-list-item" :key="i">
<div class="timeline-time">{{ dateFormat(unit[0].createTime, 'yyyy-MM-dd w') }}</div>
<el-timeline class="timeline-box">
<el-timeline-item
v-for="(item, index) in unit"
:key="index"
class="timeline-box-item"
:timestamp="item.trackTime"
placement="top"
type="primary"
>
<p class="timeline-box-item-title">{{ item.title || '无数据' }}</p>
<p>{{ item.trackContent || '无数据' }}</p>
</el-timeline-item>
</el-timeline>
</li>
</template>
<el-empty v-else :image-size="150"></el-empty>
</ul>
</div>
</div>
</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!