Commit 9d7aae1e by 李伟康

提交

1 parent 57270929
...@@ -2,30 +2,67 @@ ...@@ -2,30 +2,67 @@
<div class="journey"> <div class="journey">
<div class="container"> <div class="container">
<div class="sticky"> <div class="sticky">
<GLCombiForm ref="showSearch" :rowNumber="2" :formObj="searchForm" :formData="searchFormData" :searchSelectObj="searchSelectObj" @handleOk="handleSearch" @handleRest="handleReset" :key="FormKey"></GLCombiForm> <GLCombiForm
ref="showSearch"
:rowNumber="2"
:formObj="searchForm"
:formData="searchFormData"
:searchSelectObj="searchSelectObj"
@handleOk="handleSearch"
@handleRest="handleReset"
:key="FormKey"
></GLCombiForm>
<div :class="['sticky-btns', { hiddenExport: viewType == 1 }]"> <div :class="['sticky-btns', { hiddenExport: viewType == 1 }]">
<div class="btns"> <div class="btns">
<el-button type="default" @click="handleRefresh" plain>状态刷新</el-button> <el-button
<el-button type="default" @click="changeViewType">切换为看板视图</el-button> type="default"
<el-button type="default" @click="handleExport">导出</el-button> @click="handleRefresh"
plain
>状态刷新</el-button>
<el-button
type="default"
@click="changeViewType"
>切换为看板视图</el-button>
<el-button
type="default"
@click="handleExport"
>导出</el-button>
</div> </div>
</div> </div>
</div> </div>
<template v-if="viewType == 1"> <template v-if="viewType == 1">
<div class="journey-data-view"> <div class="journey-data-view">
<data-view :params="tableSearchForm" ref="dataView" :stageList="stageList"></data-view> <data-view
:params="tableSearchForm"
ref="dataView"
:stageList="stageList"
></data-view>
</div> </div>
</template> </template>
<template v-else> <template v-else>
<template v-if="stageList && stageList.length">
<div class="flex"> <div class="flex">
<div class="flex-default tabs"> <div class="flex-default tabs">
<el-tabs v-model="searchForm.requestSource" @tab-click="handleSearch"> <template v-for="(i,index) in stageList">
<el-tab-pane :label="i" :name="index" :key="index" v-for="(i, index) in requestSourceList"></el-tab-pane> <template>
</el-tabs> <div
:class="['tab',{'active':searchForm.sopJourneyStage == i.value}]"
:key="index"
@click="changeTab(i.value)"
>
{{ i.label }}
</div>
</template>
</template>
</div> </div>
</div> </div>
</template>
<div class="journey-table"> <div class="journey-table">
<journey-table ref="table" :params="tableSearchForm" :stageList="stageList"></journey-table> <journey-table
ref="table"
:params="tableSearchForm"
:stageList="stageList"
></journey-table>
</div> </div>
</template> </template>
</div> </div>
...@@ -45,7 +82,6 @@ export default { ...@@ -45,7 +82,6 @@ export default {
name: '', name: '',
data () { data () {
return { return {
requestSourceList: ['全部', '进行中', '高意向', '成功续保', '战败'],
viewType: 11, viewType: 11,
journeyList: [], journeyList: [],
FormKey: Date.now() FormKey: Date.now()
...@@ -56,12 +92,16 @@ export default { ...@@ -56,12 +92,16 @@ export default {
this.getCustomersList(); this.getCustomersList();
}, },
methods: { methods: {
getList() { getList () {
this.$apis.journeyConfig.byGroupIdSop({ groupId: 'M153312087', pageNumber: 1 }).then(res => { this.$apis.journeyConfig.byGroupIdSop({ groupId: 'M153312087', pageNumber: 1 }).then(res => {
this.journeyList = res.list || [] this.journeyList = res.list || []
this.journeyList.forEach(item => { this.journeyList.forEach(item => {
const stages = JSON.parse(item.instParam).stages const stages = JSON.parse(item.instParam).stages
item.journeyItem = [] item.journeyItem = []
item.journeyItem = [{
label: '全部',
value: ''
}]
for (let k in stages) { for (let k in stages) {
item.journeyItem.push({ item.journeyItem.push({
label: stages[k].value, label: stages[k].value,
...@@ -75,6 +115,10 @@ export default { ...@@ -75,6 +115,10 @@ export default {
this.handleSearch() this.handleSearch()
}) })
}, },
changeTab(val){
this.searchForm.sopJourneyStage = val
this.handleSearch()
},
handleSearch () { handleSearch () {
const { viewType, $refs } = this, const { viewType, $refs } = this,
el = viewType == 1 ? $refs.dataView : $refs.table, el = viewType == 1 ? $refs.dataView : $refs.table,
...@@ -89,15 +133,14 @@ export default { ...@@ -89,15 +133,14 @@ export default {
}) })
}, },
handleReset () { handleReset () {
let { requestSource } = this.searchForm // this.searchForm = this.$options.data.call(this).searchForm
this.searchForm = Object.assign(this.$options.data.call(this).searchForm, { requestSource })
this.searchSelectObj = this.$options.data.call(this).searchSelectObj this.searchSelectObj = this.$options.data.call(this).searchSelectObj
this.searchFormData = this.$options.data.call(this).searchFormData // this.searchFormData = this.$options.data.call(this).searchFormData
this.FormKey = Date.now() this.FormKey = Date.now()
this.handleSearch() this.handleSearch()
}, },
handleExport () { handleExport () {
this.$apis.journey.exportExcel({...this.searchForm, pageSize: 10000,pageNumber: 1}).then(res=>{ this.$apis.journey.exportExcel({ ...this.searchForm, pageSize: 10000, pageNumber: 1 }).then(res => {
console.log(res) console.log(res)
}) })
}, },
...@@ -114,12 +157,9 @@ export default { ...@@ -114,12 +157,9 @@ export default {
background-color: #fff; background-color: #fff;
.flex-default.tabs { .flex-default.tabs {
border-bottom: none; border-bottom: none;
/deep/.el-tabs__nav-wrap { display: flex;
&::after { gap: 2px;
display: none; .tab {
}
}
/deep/.el-tabs__item {
background: #fafafa; background: #fafafa;
border: 1px solid #e5e5e5 !important; border: 1px solid #e5e5e5 !important;
border-radius: 4px 4px 0 0; border-radius: 4px 4px 0 0;
...@@ -129,10 +169,12 @@ export default { ...@@ -129,10 +169,12 @@ export default {
width: fit-content; width: fit-content;
min-width: 86px; min-width: 86px;
padding: 0 20px !important; padding: 0 20px !important;
text-align: center;
cursor: pointer;
} }
/deep/.is-active { .active,.tab:hover {
border-bottom: none; background-color: #fff;
font-weight: 500; color: #5850ff;
} }
} }
&-table-box { &-table-box {
......
let _this = null let _this = null
const defaultFormData = { const defaultFormData = {
requestSource: '0' sopJourneyStage: ''
} }
import * as dayjs from 'dayjs' import * as dayjs from 'dayjs'
export default { export default {
created() { created () {
_this = this _this = this
}, },
data() { data () {
return { return {
searchForm: { searchForm: {
...defaultFormData ...defaultFormData
...@@ -61,7 +61,7 @@ export default { ...@@ -61,7 +61,7 @@ export default {
name: 'wechatNickname' name: 'wechatNickname'
} }
], ],
handleSelectChange(value) { handleSelectChange (value) {
_this.searchSelectObj.keyword.value = '' _this.searchSelectObj.keyword.value = ''
} }
}, },
...@@ -81,7 +81,7 @@ export default { ...@@ -81,7 +81,7 @@ export default {
labelWidth: 72, labelWidth: 72,
isClear: true, isClear: true,
customPickerOptions: { customPickerOptions: {
disabledDate(val) { disabledDate (val) {
let disabled = true, let disabled = true,
startTime = dayjs().subtract(1, 'year'), startTime = dayjs().subtract(1, 'year'),
endTime = dayjs(), endTime = dayjs(),
...@@ -106,7 +106,7 @@ export default { ...@@ -106,7 +106,7 @@ export default {
// console.log(newval) // console.log(newval)
// } // }
// }, // },
'searchForm.a'(newval) { 'searchForm.a' (newval) {
//清空旅程阶段并调用旅程阶段接口 //清空旅程阶段并调用旅程阶段接口
console.log(newval, 'a') console.log(newval, 'a')
} }
...@@ -117,12 +117,13 @@ export default { ...@@ -117,12 +117,13 @@ export default {
// } // }
// }, // },
methods: { methods: {
getStage(e) { getStage (e) {
const step = _this.searchFormData.find(i => i.name === 'sopJourneyStage') const step = _this.searchFormData.find(i => i.name === 'sopJourneyStage')
step.optionList = _this.journeyList.find(i => i.instId == e).journeyItem let optionList = _this.journeyList.find(i => i.instId == e).journeyItem
step.optionList = optionList
this.stageList = step.optionList this.stageList = step.optionList
}, },
getSelectInputParams() { getSelectInputParams () {
const list = Object.keys(this.searchSelectObj) const list = Object.keys(this.searchSelectObj)
var params = {} var params = {}
list.forEach(i => { list.forEach(i => {
......
...@@ -2,27 +2,47 @@ ...@@ -2,27 +2,47 @@
<div class="data-view"> <div class="data-view">
<div class="title">旅程看板</div> <div class="title">旅程看板</div>
<div class="carousel-box"> <div class="carousel-box">
<el-carousel ref="carousel" :autoplay="false" :loop="false" height="100%" arrow="never" class="carousel" @change="viewIndex = $event"> <el-carousel
ref="carousel"
:autoplay="false"
:loop="false"
height="100%"
arrow="never"
class="carousel"
@change="viewIndex = $event"
>
<template v-for="(i, index) in viewList"> <template v-for="(i, index) in viewList">
<template> <template>
<el-carousel-item :key="index" class="carousel-item"> <el-carousel-item
:key="index"
class="carousel-item"
>
<template v-for="(c, cindex) in i"> <template v-for="(c, cindex) in i">
<template> <template>
<div :key="cindex" class="group"> <div
:key="cindex"
class="group"
>
<div class="title"> <div class="title">
<div class="text flex"> <div class="text flex">
<div class="icon"></div> <div class="icon"></div>
{{ c.title }} {{ c.title }}
</div> </div>
<div class="line-box"> <div class="line-box">
<div class="line" :style="[{ width: (100 * (cindex + 1)) / i.length + '%' }]"></div> <div
class="line"
:style="[{ width: (100 * (cindex + 1)) / i.length + '%' }]"
></div>
</div> </div>
</div> </div>
<el-scrollbar class="content"> <el-scrollbar class="content">
<template v-if="c.list.length"> <template v-if="c.list.length">
<template v-for="(item, ind) in c.list"> <template v-for="(item, ind) in c.list">
<template> <template>
<div :key="ind" class="item"> <div
:key="ind"
class="item"
>
<div class="top flex"> <div class="top flex">
<div class="icon"> <div class="icon">
<template v-if="item.icon"> <template v-if="item.icon">
...@@ -58,10 +78,16 @@ ...@@ -58,10 +78,16 @@
</template> </template>
</template> </template>
</el-carousel> </el-carousel>
<div class="arrow left" @click="$refs.carousel.prev()"> <div
class="arrow left"
@click="$refs.carousel.prev()"
>
<img :src="viewIndex == 0 ? leftIcon : leftActiveIcon" /> <img :src="viewIndex == 0 ? leftIcon : leftActiveIcon" />
</div> </div>
<div class="arrow right" @click="$refs.carousel.next()"> <div
class="arrow right"
@click="$refs.carousel.next()"
>
<img :src="viewIndex < viewList.length - 1 ? rightActiveIcon : rightIcon" /> <img :src="viewIndex < viewList.length - 1 ? rightActiveIcon : rightIcon" />
</div> </div>
</div> </div>
...@@ -91,7 +117,7 @@ export default { ...@@ -91,7 +117,7 @@ export default {
leftActiveIcon: require('@/assets/icon/left-active.png'), leftActiveIcon: require('@/assets/icon/left-active.png'),
rightIcon: require('@/assets/icon/right.png'), rightIcon: require('@/assets/icon/right.png'),
rightActiveIcon: require('@/assets/icon/right-active.png'), rightActiveIcon: require('@/assets/icon/right-active.png'),
pageNumber:1 pageNumber: 1
} }
}, },
mounted () { mounted () {
...@@ -99,16 +125,36 @@ export default { ...@@ -99,16 +125,36 @@ export default {
}, },
methods: { methods: {
async refreshTable () { async refreshTable () {
function splitArrayIntoChunks (arr, chunkSize) {
const weight = 1 / arr.length
return arr.reduce((result, item, index) => {
const chunkIndex = Math.floor(index / chunkSize)
item.width = `${(weight * index + weight) * 100}%`
result[chunkIndex] = result[chunkIndex] || []
result[chunkIndex].push(item)
return result
}, [])
}
const params = { const params = {
...JSON.parse(JSON.stringify(this.params)), ...JSON.parse(JSON.stringify(this.params)),
pageSize: 10, pageSize: 9999,
pageNumber: this.pageNumber pageNumber: this.pageNumber
} }
const stageList = this.stageList const stageList = this.stageList,
for(let k of stageList) { arr = []
const list = await this.$apis.journey.getCustomersList(params) for (let k of stageList) {
this.viewList.push(list.list) if (k.value) {
params.sopJourneyStage = k.value
const { list } = await this.$apis.journey.getCustomersList(params)
arr.push({
title: k.label,
list
})
}
} }
this.viewList = splitArrayIntoChunks(arr, 4)
this.dataViewLoading = false
}, },
} }
} }
......
...@@ -182,6 +182,7 @@ export default { ...@@ -182,6 +182,7 @@ export default {
} }
}, },
mounted () { mounted () {
this.refreshTable()
}, },
methods: { methods: {
// beforeSearchFn () { // beforeSearchFn () {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!