Commit 0e536030 by 怪兽?别跑

表单下载方式调整

1 parent 6c8e6d7d
...@@ -30,7 +30,7 @@ export function insertInfoToSurvey(data) { ...@@ -30,7 +30,7 @@ export function insertInfoToSurvey(data) {
return request({ return request({
url: service + '/survey/add', url: service + '/survey/add',
method: 'post', method: 'post',
data, data
}) })
} }
...@@ -39,7 +39,7 @@ export function surveyList(data) { ...@@ -39,7 +39,7 @@ export function surveyList(data) {
return request({ return request({
url: service + '/survey/list', url: service + '/survey/list',
method: 'GET', method: 'GET',
params: data, params: data
}) })
} }
...@@ -47,7 +47,7 @@ export function surveyList(data) { ...@@ -47,7 +47,7 @@ export function surveyList(data) {
export function deleteInfoToSurvey(ids) { export function deleteInfoToSurvey(ids) {
return request({ return request({
url: service + '/survey/delete/' + ids, url: service + '/survey/delete/' + ids,
method: 'DELETE', method: 'DELETE'
}) })
} }
...@@ -55,7 +55,7 @@ export function deleteInfoToSurvey(ids) { ...@@ -55,7 +55,7 @@ export function deleteInfoToSurvey(ids) {
export function selectInfoToSurvey(id) { export function selectInfoToSurvey(id) {
return request({ return request({
url: service + '/survey/getInfo/' + id, url: service + '/survey/getInfo/' + id,
method: 'GET', method: 'GET'
}) })
} }
...@@ -64,7 +64,7 @@ export function submitForm(data) { ...@@ -64,7 +64,7 @@ export function submitForm(data) {
return request({ return request({
url: service + '/answer/add', url: service + '/answer/add',
method: 'post', method: 'post',
data, data
}) })
} }
...@@ -73,7 +73,7 @@ export function isCompleteSurvey(data) { ...@@ -73,7 +73,7 @@ export function isCompleteSurvey(data) {
return request({ return request({
url: service + '/answer/isCompleteSurvey', url: service + '/answer/isCompleteSurvey',
method: 'post', method: 'post',
data, data
}) })
} }
...@@ -82,7 +82,7 @@ export function insertPieValue(data) { ...@@ -82,7 +82,7 @@ export function insertPieValue(data) {
return request({ return request({
url: service + '/statistic/insertPieValue', url: service + '/statistic/insertPieValue',
method: 'post', method: 'post',
data, data
}) })
} }
...@@ -91,7 +91,7 @@ export function updateSurveyStatus(data) { ...@@ -91,7 +91,7 @@ export function updateSurveyStatus(data) {
return request({ return request({
url: service + '/survey/updateStatus', url: service + '/survey/updateStatus',
method: 'put', method: 'put',
data, data
}) })
} }
...@@ -100,7 +100,7 @@ export function getAccessToken(data) { ...@@ -100,7 +100,7 @@ export function getAccessToken(data) {
return request({ return request({
url: service + '/Statistics/getAccessToken' + data, url: service + '/Statistics/getAccessToken' + data,
method: 'get', method: 'get',
data, data
}) })
} }
...@@ -109,7 +109,7 @@ export function updateSurveyGroup(data) { ...@@ -109,7 +109,7 @@ export function updateSurveyGroup(data) {
return request({ return request({
url: service + '/updateSurveyGroup', url: service + '/updateSurveyGroup',
method: 'post', method: 'post',
data, data
}) })
} }
...@@ -120,7 +120,7 @@ export function selectStatistics(data) { ...@@ -120,7 +120,7 @@ export function selectStatistics(data) {
return request({ return request({
url: service + '/statistic/getStatistics', url: service + '/statistic/getStatistics',
method: 'get', method: 'get',
params: data, params: data
}) })
} }
...@@ -129,7 +129,7 @@ export function lineChart(data) { ...@@ -129,7 +129,7 @@ export function lineChart(data) {
return request({ return request({
url: service + '/statistic/lineChart', url: service + '/statistic/lineChart',
method: 'post', method: 'post',
data, data
}) })
} }
...@@ -138,7 +138,7 @@ export function StatisticsDataList(data) { ...@@ -138,7 +138,7 @@ export function StatisticsDataList(data) {
return request({ return request({
url: service + '/statistic/dataList', url: service + '/statistic/dataList',
method: 'post', method: 'post',
data, data
}) })
} }
...@@ -147,7 +147,7 @@ export function updateInfoToSurvey(data) { ...@@ -147,7 +147,7 @@ export function updateInfoToSurvey(data) {
return request({ return request({
url: service + '/survey/update', url: service + '/survey/update',
method: 'put', method: 'put',
data, data
}) })
} }
...@@ -156,7 +156,7 @@ export function selectAnswerInfo(data) { ...@@ -156,7 +156,7 @@ export function selectAnswerInfo(data) {
return request({ return request({
url: service + '/answer/getAnswerList', url: service + '/answer/getAnswerList',
method: 'post', method: 'post',
data, data
}) })
} }
...@@ -165,7 +165,7 @@ export function pieChart(data) { ...@@ -165,7 +165,7 @@ export function pieChart(data) {
return request({ return request({
url: service + '/statistic/pieChart', url: service + '/statistic/pieChart',
method: 'post', method: 'post',
data, data
}) })
} }
...@@ -185,7 +185,8 @@ export function overviewExport(data) { ...@@ -185,7 +185,8 @@ export function overviewExport(data) {
return request({ return request({
url: service + '/statistic/data/export', url: service + '/statistic/data/export',
method: 'post', method: 'post',
data, responseType: 'blob',
data
}) })
} }
...@@ -195,7 +196,7 @@ export function answerExport(data) { ...@@ -195,7 +196,7 @@ export function answerExport(data) {
url: service + '/statistic/answer/export', url: service + '/statistic/answer/export',
method: 'get', method: 'get',
params: data, params: data,
responseType: 'blob', responseType: 'blob'
}) })
} }
...@@ -205,6 +206,7 @@ export function userExport(data) { ...@@ -205,6 +206,7 @@ export function userExport(data) {
url: service + '/statistic/user/export', url: service + '/statistic/user/export',
method: 'post', method: 'post',
data, data,
responseType: 'blob'
}) })
} }
...@@ -213,7 +215,7 @@ export function statisticsCustomer(data) { ...@@ -213,7 +215,7 @@ export function statisticsCustomer(data) {
return request({ return request({
url: service + '/statistic/customer', url: service + '/statistic/customer',
method: 'post', method: 'post',
data, data
}) })
} }
...@@ -222,7 +224,7 @@ export function areaStatistic(data) { ...@@ -222,7 +224,7 @@ export function areaStatistic(data) {
return request({ return request({
url: service + '/statistic/areaStatistic', url: service + '/statistic/areaStatistic',
method: 'post', method: 'post',
data, data
}) })
} }
...@@ -239,6 +241,6 @@ export function siteStas(data) { ...@@ -239,6 +241,6 @@ export function siteStas(data) {
return request({ return request({
url: service + '/statistic/siteStas', url: service + '/statistic/siteStas',
method: 'post', method: 'post',
data, data
}) })
} }
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<div class="g-card"> <div class="g-card">
<div class="g-card-title">数据趋势</div> <div class="g-card-title">数据趋势</div>
<search-title :id="$route.query.id" :showScene="true" @search="getLineData"></search-title> <search-title :id="$route.query.id" :showScene="true" @search="getLineData"></search-title>
<chart-line style="height: 300px" :legend="legend" :xData="xdata" :series="series"></chart-line> <chart-line style="height: 300px;" :legend="legend" :xData="xdata" :series="series"></chart-line>
</div> </div>
<!-- <div class="g-card"> <!-- <div class="g-card">
<div class="g-card-title"> <div class="g-card-title">
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
<search-title :id="$route.query.id" :showScene="true" @search="getTableFn"></search-title> <search-title :id="$route.query.id" :showScene="true" @search="getTableFn"></search-title>
<el-button type="primary" size="mini" @click="exportFn" v-loading="exportLoading">导出Excel</el-button> <el-button type="primary" size="mini" @click="exportFn" v-loading="exportLoading">导出Excel</el-button>
</div> </div>
<el-table v-loading="loading" :data="tableList" style="width: 100%"> <el-table v-loading="loading" :data="tableList" style="width: 100%;">
<el-table-column label="日期" align="center" min-width="100" prop="xtime" show-overflow-tooltip /> <el-table-column label="日期" align="center" min-width="100" prop="xtime" show-overflow-tooltip />
<el-table-column label="总访问数" align="center" min-width="100" prop="visitTotalCnt" show-overflow-tooltip /> <el-table-column label="总访问数" align="center" min-width="100" prop="visitTotalCnt" show-overflow-tooltip />
<el-table-column <el-table-column
...@@ -38,49 +38,54 @@ ...@@ -38,49 +38,54 @@
align="center" align="center"
prop="consultTotalCnt" prop="consultTotalCnt"
min-width="100" min-width="100"
show-overflow-tooltip></el-table-column> show-overflow-tooltip
></el-table-column>
<el-table-column <el-table-column
label="有效收集量" label="有效收集量"
align="center" align="center"
prop="EffectiveCollectionQuantity" prop="EffectiveCollectionQuantity"
min-width="100" min-width="100"
show-overflow-tooltip></el-table-column> show-overflow-tooltip
></el-table-column>
<el-table-column <el-table-column
label="收集率" label="收集率"
align="center" align="center"
prop="CollectionQuantity" prop="CollectionQuantity"
min-width="100" min-width="100"
show-overflow-tooltip></el-table-column> show-overflow-tooltip
></el-table-column>
<el-table-column <el-table-column
label="平均完成时间" label="平均完成时间"
align="center" align="center"
prop="average" prop="average"
min-width="100" min-width="100"
show-overflow-tooltip></el-table-column> show-overflow-tooltip
></el-table-column>
</el-table> </el-table>
<div class="bottom"> <div class="bottom">
<pagination <pagination
:total="total" :total="total"
:page.sync="query.pageNum" :page.sync="query.pageNum"
:limit.sync="query.pageSize" :limit.sync="query.pageSize"
@pagination="getTableChangeSize(query.pageNum, query.pageSize)" /> @pagination="getTableChangeSize(query.pageNum, query.pageSize)"
/>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import { selectStatistics, lineChart, overviewExport, StatisticsDataList } from '@/api/drainageCode/smartForms.js' import { selectStatistics, lineChart, overviewExport, StatisticsDataList } from '@/api/drainageCode/smartForms.js'
import SearchTitle from '../components/SearchTitle.vue' import SearchTitle from '../components/SearchTitle.vue'
import ChartBar from '@/components/ChartBar.vue' import ChartBar from '@/components/ChartBar.vue'
import ChartLine from '@/components/ChartLine.vue' import ChartLine from '@/components/ChartLine.vue'
import { download } from '@/utils/common' import { download } from '@/utils/common'
export default { export default {
name: 'scene-statistics-scene', name: 'scene-statistics-scene',
components: { components: {
SearchTitle, SearchTitle,
ChartLine, ChartLine,
ChartBar, ChartBar
}, },
data() { data() {
return { return {
...@@ -99,37 +104,37 @@ export default { ...@@ -99,37 +104,37 @@ export default {
tips: '全部渠道访问当前表单的PV', tips: '全部渠道访问当前表单的PV',
value: 0, value: 0,
title1: '较前日', title1: '较前日',
value1: 0, value1: 0
}, },
{ {
title: '总访问用户', title: '总访问用户',
tips: '全部渠道访问当前表单的UV', tips: '全部渠道访问当前表单的UV',
value: 0, value: 0,
title1: '较前日', title1: '较前日',
value1: 0, value1: 0
}, },
{ {
title: '有效收集量', title: '有效收集量',
tips: '全部渠道成功提交表单的UV', tips: '全部渠道成功提交表单的UV',
value: 0, value: 0,
title1: '较前日', title1: '较前日',
value1: 0, value1: 0
}, },
{ {
title: '收集率', title: '收集率',
tips: '有效收集量/总访问用户,精确到两位小数', tips: '有效收集量/总访问用户,精确到两位小数',
value: 0 + '%', value: 0 + '%'
}, },
{ {
title: '平均完成时间', title: '平均完成时间',
tips: '有效收集用户从进入表单到提交表单的平均时长', tips: '有效收集用户从进入表单到提交表单的平均时长',
value: 0 + 'm', value: 0 + 'm'
}, }
], ],
total: 0, total: 0,
query: { query: {
pageSize: 10, pageSize: 10,
pageNum: 1, pageNum: 1
}, },
tableList: [], tableList: [],
loading: false, loading: false,
...@@ -138,7 +143,7 @@ export default { ...@@ -138,7 +143,7 @@ export default {
bar2: [], bar2: [],
value1: [], value1: [],
value2: [], value2: [],
tableSearch: {}, tableSearch: {}
} }
}, },
methods: { methods: {
...@@ -147,7 +152,7 @@ export default { ...@@ -147,7 +152,7 @@ export default {
this.$confirm('确认导出吗?', '提示', { this.$confirm('确认导出吗?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning', type: 'warning'
}).then(() => { }).then(() => {
this.exportLoading = true this.exportLoading = true
let datas = this.tableSearch let datas = this.tableSearch
...@@ -159,7 +164,15 @@ export default { ...@@ -159,7 +164,15 @@ export default {
overviewExport(datas) overviewExport(datas)
.then((res) => { .then((res) => {
console.log('数据报表导出返回值', res) console.log('数据报表导出返回值', res)
download(res.data) if (res != null) {
let blob = new Blob([res], { type: 'application/vnd.ms-excel' })
let url = window.URL.createObjectURL(blob)
const link = document.createElement('a') // 创建a标签
link.href = url
link.download = '数据报表.xlsx' //指定下载文件名
link.click()
URL.revokeObjectURL(url) // 释放内存
}
}) })
.catch((error) => { .catch((error) => {
console.error(error) console.error(error)
...@@ -247,7 +260,7 @@ export default { ...@@ -247,7 +260,7 @@ export default {
}, },
selectStatistics() { selectStatistics() {
let data = { let data = {
belongId: this.$route.query.id, belongId: this.$route.query.id
} }
selectStatistics(data).then((res) => { selectStatistics(data).then((res) => {
if (res.data.length) { if (res.data.length) {
...@@ -364,7 +377,7 @@ export default { ...@@ -364,7 +377,7 @@ export default {
consultTotalCnt: res.data.result[i].totalUser, consultTotalCnt: res.data.result[i].totalUser,
EffectiveCollectionQuantity: res.data.result[i].collectionVolume, EffectiveCollectionQuantity: res.data.result[i].collectionVolume,
CollectionQuantity: res.data.result[i].collectionRate, CollectionQuantity: res.data.result[i].collectionRate,
average: res.data.result[i].averageTime, average: res.data.result[i].averageTime
} }
b.push(a) b.push(a)
} }
...@@ -393,7 +406,7 @@ export default { ...@@ -393,7 +406,7 @@ export default {
} }
this.tableSearch = data this.tableSearch = data
that.getTableChangeSize(1, 10) that.getTableChangeSize(1, 10)
}, }
}, },
created() { created() {
// this.getTableChangeSize() // this.getTableChangeSize()
...@@ -402,7 +415,7 @@ export default { ...@@ -402,7 +415,7 @@ export default {
}, },
mounted() { mounted() {
// this.getTableChangeSize(1,10) // this.getTableChangeSize(1,10)
}, }
} }
</script> </script>
<style lang="scss" scoped></style> <style lang="scss" scoped></style>
<template> <template>
<div style="padding-bottom: 30px"> <div style="padding-bottom: 30px;">
<div> <div>
<div class="g-card"> <div class="g-card">
<div class="mid-action"> <div class="mid-action">
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
{{tableList[0].answer}} {{tableList[0].answer}}
</div> --> </div> -->
<template v-if="tableList"> <template v-if="tableList">
<el-table v-loading="loading1" :data="tableList" style="width: 100%"> <el-table v-loading="loading1" :data="tableList" style="width: 100%;">
<!-- <el-table-column label="日期" align="center" min-width="100" show-overflow-tooltip > <!-- <el-table-column label="日期" align="center" min-width="100" show-overflow-tooltip >
<template slot-scope="{ row }"> <template slot-scope="{ row }">
<div style="display: flex;justify-content:center;">{{row.updateTime.substring(0,10)}}</div> <div style="display: flex;justify-content:center;">{{row.updateTime.substring(0,10)}}</div>
...@@ -69,7 +69,8 @@ ...@@ -69,7 +69,8 @@
:total="total" :total="total"
:page.sync="query.pageNum" :page.sync="query.pageNum"
:limit.sync="query.pageSize" :limit.sync="query.pageSize"
@pagination="getTableChangeSize(query.pageNum, query.pageSize)" /> @pagination="getTableChangeSize(query.pageNum, query.pageSize)"
/>
</template> </template>
</div> </div>
</div> </div>
...@@ -77,12 +78,12 @@ ...@@ -77,12 +78,12 @@
</template> </template>
<script> <script>
import { statisticsCustomer, userExport } from '@/api/drainageCode/smartForms.js' import { statisticsCustomer, userExport } from '@/api/drainageCode/smartForms.js'
import SearchTitle from '../components/SearchTitle.vue' import SearchTitle from '../components/SearchTitle.vue'
export default { export default {
props: ['formId'], props: ['formId'],
components: { components: {
SearchTitle, SearchTitle
}, },
data() { data() {
return { return {
...@@ -91,11 +92,11 @@ export default { ...@@ -91,11 +92,11 @@ export default {
baseList: '', baseList: '',
query: { query: {
pageSize: 10, pageSize: 10,
pageNum: 1, pageNum: 1
}, },
tableList: [], tableList: [],
exportLoading: false, exportLoading: false,
dataSource: '默认渠道', dataSource: '默认渠道'
} }
}, },
methods: { methods: {
...@@ -104,7 +105,7 @@ export default { ...@@ -104,7 +105,7 @@ export default {
this.$confirm('确认导出吗?', '提示', { this.$confirm('确认导出吗?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning', type: 'warning'
}).then(() => { }).then(() => {
this.exportLoading = true this.exportLoading = true
let data = this.tableSearch let data = this.tableSearch
...@@ -116,7 +117,15 @@ export default { ...@@ -116,7 +117,15 @@ export default {
userExport(data) userExport(data)
.then((res) => { .then((res) => {
console.log('数据报表导出返回值', res) console.log('数据报表导出返回值', res)
this.download(res.data) if (res != null) {
let blob = new Blob([res], { type: 'application/vnd.ms-excel' })
let url = window.URL.createObjectURL(blob)
const link = document.createElement('a') // 创建a标签
link.href = url
link.download = '数据报表.xlsx' //指定下载文件名
link.click()
URL.revokeObjectURL(url) // 释放内存
}
}) })
.catch((error) => { .catch((error) => {
console.error(error) console.error(error)
...@@ -225,14 +234,14 @@ export default { ...@@ -225,14 +234,14 @@ export default {
this.tableSearch = data this.tableSearch = data
that.dataSource = data.dataSource that.dataSource = data.dataSource
that.getTableChangeSize(1, 10) that.getTableChangeSize(1, 10)
}
}, },
}, mounted() {}
mounted() {}, }
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.dataStatistics_optionGraph_ul { .dataStatistics_optionGraph_ul {
margin-top: 30px; margin-top: 30px;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
...@@ -243,9 +252,9 @@ export default { ...@@ -243,9 +252,9 @@ export default {
background-color: #fff; background-color: #fff;
padding: 30px; padding: 30px;
} }
} }
.data-content { .data-content {
margin-top: 10px; margin-top: 10px;
.chart-content { .chart-content {
...@@ -272,5 +281,5 @@ export default { ...@@ -272,5 +281,5 @@ export default {
.table-content { .table-content {
margin-top: 10px; margin-top: 10px;
} }
} }
</style> </style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!