Commit 795785ef authored by 杨硕's avatar 杨硕

对接首页统计图接口

parent 23799b48
......@@ -19,7 +19,15 @@ export function barChar(query) {
// 文章视频推广次数
export function pieChart(query) {
return request({
url: '/sysunit/statisticsByTypePieChart',
url: '/sysunit/statisticsByType',
method: 'get',
params: query
})
}
export function aListOfPromotionAmounts(query) {
return request({
url: '/sysunit/aListOfPromotionAmounts',
method: 'get',
params: query
})
......
......@@ -133,6 +133,20 @@ export function importSysUserExcel(data) {
})
}
export function importSpokesmanExcel(data) {
return request({
url: '/cmspriceclick/import',
method: 'post',
headers: {
'Content-Type': 'multipart/form-data'
},
transformRequest: [(data) => {
return data
}],
data
})
}
// 7.导出用户
export function exportUser(query) {
return request({
......
......@@ -140,7 +140,16 @@
<!-- 备注-->
<el-table-column label="备注" prop="remarks" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span> {{ scope.row.remarks || '-' }}</span>
<span v-if="scope.row.edit === '0'"> {{ scope.row.remarks || '-' }}</span>
<el-input
v-if="scope.row.edit === '1'"
v-model.trim="scope.row.remarks"
placeholder="备注"
controls-position="right"
step-strictly
clearable
size="small"
/>
</template>
</el-table-column>
<el-table-column label="操作" width="250">
......@@ -792,7 +801,7 @@ import {
} from '@/api/try/teaTrialCourse'
import { getDict } from '@/api/system/dict/data'
import { validOpenCourse } from '@/api/classManagement'
import { importSysUserExcel, importTemplateSysuser, listByIdentity } from '@/api/system/user'
import {importSpokesmanExcel, importSysUserExcel, importTemplateSysuser, listByIdentity} from '@/api/system/user'
import { listAllShop, listCourseAll } from '@/api/sysUnit'
import { mapGetters } from 'vuex'
import {
......@@ -1030,6 +1039,7 @@ export default {
handleImport() {
this.upload.title = '推广次数导入'
this.upload.open = true
this.filelist = []
},
// 获取所有部门信息
getDeptList() {
......@@ -1581,18 +1591,23 @@ export default {
// 列表渲染数据
var data = []
const _this = this
this.tableData = []
_this.fullscreenLoading = true
cmspriceclickList(this.queryParams).then(res => {
_this.total = res.total// 总记录数
res.records.forEach(item => item['edit'] = '0')
_this.tableData = res.records
this.tableDataOri = JSON.parse(JSON.stringify(res.records))
_this.fullscreenLoading = false
if (res.records.length === 0) {
_this.tableDataTips = '暂无数据'
this.tableData = [
{
remarks: "111111",
edit: '0'
}
})
]
_this.fullscreenLoading = false
// cmspriceclickList(this.queryParams).then(res => {
// _this.total = res.total// 总记录数
// res.records.forEach(item => item['edit'] = '0')
// _this.tableData = res.records
// this.tableDataOri = JSON.parse(JSON.stringify(res.records))
// _this.fullscreenLoading = false
// if (res.records.length === 0) {
// _this.tableDataTips = '暂无数据'
// }
// })
},
/** 4.重置时将单位回复正常**/
handleClear() {
......@@ -1616,6 +1631,7 @@ export default {
const obj = {
businessId: this.tableData[index].businessId,
price: this.tableData[index].price,
remarks: this.tableData[index].remarks,
clickThroughRate: this.tableData[index].clickThroughRate
}
cmspriceclickUpdate(obj).then(res => {
......@@ -1650,9 +1666,10 @@ export default {
handleFileSuccess(response, file, fileList) {
this.upload.open = false
this.upload.isUploading = false
this.fileList = []
this.$refs.upload.clearFiles()
this.$alert(response.msg, '导入结果', { dangerouslyUseHTMLString: true })
this.getList()
this.loadData()
},
/** 导入change*/
employeeUpload(file, fileList) {
......@@ -1676,10 +1693,7 @@ export default {
submitFileForm() {
// this.$refs.upload.submit()
this.importLoading = true
if (!this.upload.deptId) {
this.$message.warning('请选择所属商家')
this.importLoading = false
} else if (this.fileList.length === 0) {
if (this.fileList.length === 0) {
this.$message.warning('请上传文件')
// 导入成功后关闭弹出框
this.importLoading = false
......@@ -1688,8 +1702,8 @@ export default {
console.log('this.fileList', this.fileList)
var formData = new FormData() // 当前为空
formData.append('file', this.fileList)
formData.append('deptId', this.upload.deptId)
importSysUserExcel(formData).then(res => {
// formData.append('deptId', this.upload.deptId)
importSpokesmanExcel(formData).then(res => {
if (res.code === 200) {
this.$message.success('导入成功')
this.fileList = []
......@@ -1697,7 +1711,7 @@ export default {
this.importLoading = false
this.upload.open = false
// 导入成功后刷新页面
this.getList()
this.loadData()
} else if (res.code === 41020) {
this.$message.info('上传超时,请重新上传')
this.importLoading = false
......
......@@ -79,8 +79,8 @@
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-row :gutter="20">
<el-col :span="16">
<!-- <v-chart ref="barChart" :options="barData" class="chart section" />-->
<el-card>
<div slot="header" class="clearfix">
......@@ -91,6 +91,46 @@
</div>
</el-card>
</el-col>
<el-col :span="8" style="height: 100%">
<!-- <v-chart ref="barChart" :options="barData" class="chart section" />-->
<el-card>
<div slot="header" class="clearfix">
<span>代言人:</span>
</div>
<div class="table-demo-wrapper" style="height: 16vh; width: 100%">
<el-table
:data="list"
style="width: 100%"
class="top"
>
<el-table-column type="index" label="序号" align="center" />
<el-table-column prop="name" label="姓名" align="center" />
<el-table-column prop="phone" label="手机号" align="center" />
<el-table-column prop="clickThroughRate" label="推广次数" align="center" />
<el-table-column prop="price" label="金额" align="center" />
</el-table>
<vue-seamless-scroll
:data="list"
class="seamless-warp"
style="width: 100%"
:class-option="classOption"
>
<el-table
:data="list"
style="width: 100%"
class="bottom"
>
<el-table-column type="index" label="序号" align="center" />
<el-table-column prop="name" label="姓名" align="center" />
<el-table-column prop="phone" label="手机号" align="center" />
<el-table-column prop="clickThroughRate" label="推广次数" align="center" />
<el-table-column prop="price" label="金额" align="center" />
</el-table>
</vue-seamless-scroll>
</div>
</el-card>
</el-col>
</el-row>
<el-row :gutter="20">
......@@ -104,7 +144,7 @@
</div>
</div>
<div id="echarts-textPieChart" class="span_1">
<div id="dataCharts_textPieChart" style="height: 14vh" />
<div id="dataCharts_textPieChart" style="height: 16vh" />
</div>
</el-card>
</el-col>
......@@ -139,8 +179,9 @@
<script>
import * as echarts from 'echarts'
import { listAllShop } from '@/api/sysUnit'
import { barChar, pieChart, statistics } from '@/api/dashboard'
import { aListOfPromotionAmounts, barChar, pieChart, statistics } from '@/api/dashboard'
import { mapGetters } from 'vuex'
import vueSeamlessScroll from 'vue-seamless-scroll'
export default {
name: 'Index',
data() {
......@@ -151,6 +192,8 @@ export default {
data.push([r, i])
}
return {
list: [],
allowScroll: true,
isActive: '1',
activeName: 'first',
dataList: {},
......@@ -181,7 +224,23 @@ export default {
'name',
'roles',
'deptId'
])
]),
classOption() {
return {
step: 0.4, // 数值越大速度滚动越快
limitMoveNum: 2, // 开始无缝滚动的数据量 this.dataList.length
hoverStop: true, // 是否开启鼠标悬停stop
direction: 1, // 0向下 1向上 2向左 3向右
openWatch: true, // 开启数据实时监控刷新dom
singleHeight: 0, // 单步运动停止的高度(默认值0是无缝不停止的滚动) direction => 0/1
singleWidth: 0, // 单步运动停止的宽度(默认值0是无缝不停止的滚动) direction => 2/3
waitTime: 2000 // 单步运动停止的时间(默认值1000ms)
}
}
},
// 注册组件
components: {
vueSeamlessScroll
},
created() {
this.getDeptList() // 商家下拉
......@@ -231,6 +290,8 @@ export default {
changeCompany() {
this.getTableData() // 代言人,文章,视频数据
this.handleGetPeoplePromotionFrequency()
this.handleGetPeopleTextPie()
this.getPromotionArticle()
this.deptList.forEach(item => {
if (item.businessId === this.company) {
this.companyName = item.unitName
......@@ -249,6 +310,7 @@ export default {
this.handleGetTextVideoEcharts() // 文章视频echarts更新
this.handleGetPeoplePromotionFrequency() // 代言人文章视频推广次数统计
this.handleGetPeopleTextPie() // 代言人文章视频饼图
this.getPromotionArticle() // 滚动表格数据
}
})
})
......@@ -397,7 +459,7 @@ export default {
color: '#91CC75'
},
// data: [10, 39, 6, 50, 34, 8, 51, 9, 33, 20, 60]
data: this.barArticle
data: this.barVideo
},
{
name: '视频',
......@@ -407,18 +469,18 @@ export default {
color: '#5470C6'
},
// data: [25, 7, 33, 32, 22, 22, 20, 34, 40, 30, 10]
data: this.barVideo
data: this.barArticle
}]
}
myChartPeoplePromotionFrequency.setOption(optionAverage)
}
})
},
/** 代言人文章视频饼图*/
/** 代言人文章饼图*/
handleGetPeopleTextPie() {
pieChart({ businessId: this.company }).then(res => {
pieChart({ businessId: this.company, type: 0 }).then(res => {
if (res.code === 200) {
console.log("饼状图",res.data)
console.log('饼状图', res.data)
const myChartPeopleTextPie = echarts.init(document.getElementById('dataCharts_textPieChart'))
const optionAverage = {
tooltip: {
......@@ -460,6 +522,13 @@ export default {
myChartPeopleTextPie.setOption(optionAverage)
}
})
},
getPromotionArticle() {
aListOfPromotionAmounts({ businessId: this.company }).then(res => {
if (res.code === 200) {
this.list = res.data
}
})
}
}
}
......@@ -565,4 +634,19 @@ export default {
margin-left: 50px;
margin-top: 8px;
}
.seamless-warp {
//height: 229px;
overflow: hidden;
}
.min {
display: flex;
width: 100%;
}
>>> .top .el-table__body-wrapper {
display: none !important;
}
>>> .bottom .el-table__header-wrapper {
display: none !important;
width: 100%;
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment