prod
lily.zhang 3 years ago
parent fbfcc4abb7
commit eac02edfd4

@ -1,7 +1,7 @@
/*
* @Author: your name
* @Date: 2021-10-20 16:36:08
* @LastEditTime: 2021-10-27 09:01:56
* @LastEditTime: 2021-10-27 15:41:11
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: /data-show/src/api/comm/index.js
@ -65,3 +65,14 @@ export function getUserBrand(params) {
params: obj
})
}
// 获取导出字段
export function getToExcelField(params) {
let obj = Object.assign({action: 'getToExcelField'}, params)
return httpService({
url: `/api/v6.ashx`,
method: 'get',
params: obj
})
}

@ -1,7 +1,7 @@
/*
* @Author: your name
* @Date: 2021-10-20 16:17:39
* @LastEditTime: 2021-10-23 17:18:24
* @LastEditTime: 2021-10-27 13:33:16
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: /data-show/src/api/home/index.js
@ -150,11 +150,10 @@ export function getHomeList0528(params) {
// 首页_行业数据
export function getListHome(params) {
let obj = Object.assign({action: 'getListHome',sType: 'Home'}, params)
return httpService({
url: `/api/v6.ashx`,
method: 'post',
data: obj,
data: params,
headers: {
'content-type': 'application/x-www-form-urlencoded'
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

@ -202,4 +202,8 @@
color: #41D4FF !important;
}
.ant-table-tbody > tr.ant-table-row-selected td {
background: #2668c2 !important;
}

@ -1,7 +1,7 @@
<!--
* @Author: xw
* @Date: 2021-10-12 09:32:35
* @LastEditTime: 2021-10-27 10:53:12
* @LastEditTime: 2021-10-27 13:38:10
* @LastEditors: Please set LastEditors
* @Description: 舆情传播趋势
* @FilePath: /data-show/src/views/BrandInsight/titsopo/index.vue
@ -9,13 +9,13 @@
<template>
<div class="tit-outter" v-loading="load">
<div class="tit-header">
<a-button type="primary" size="small">进入数据列表页</a-button>
<a-button type="primary" size="small" @click="goIDE"></a-button>
<a-button type="primary" style="margin-left: 16px;margin-right: 16px;" size="small">导出报告</a-button>
</div>
<div class="tit-inner">
<vLabel-div title="舆情传播趋势"></vLabel-div>
<div class="tit-bd">
<v-echarts :opt="opt"></v-echarts>
<v-echarts :opt="opt" @getData="clickEchars"></v-echarts>
</div>
</div>
</div>
@ -23,6 +23,7 @@
<script>
import {getSourcetypeTime} from "@/api/BrandInsight"
import moment from "moment";
import createOpt from "./opt"
export default {
name: "titsopo",
@ -43,6 +44,7 @@ export default {
this.getData()
},
methods: {
//
getData() {
let obj = Object.assign({},this.getCommTime, this.form);
this.load = true;
@ -59,6 +61,44 @@ export default {
this.opt = createOpt(dx, ds);
this.load = false;
})
},
//
goIDE() {
this.$router.push({path: '/industryDataExport',query: {token: this.getToken, action: 'getList', sType: 'BrandData', brand: this.form.sBrand }})
},
//
clickEchars(data = []) {
let qudao = [];
let startTime = "";
let endTime = "";
data.forEach(ele => {
let seriesName = ele.seriesName;
endTime = ele.name;
qudao.push(seriesName);
})
if (this.getCommTime.sTimeType == 34) {
// let endTime = moment(time).add(24, "hours").format("YYYY-MM-DD HH:mm:ss");
startTime = moment(endTime)
.subtract(24, "hours")
.format("YYYY-MM-DD HH:mm:ss");
} else if (this.getCommTime.sTimeType == 23) {
startTime = moment(endTime)
.subtract(3, "days")
.format("YYYY-MM-DD HH:mm:ss");
} else if (this.getCommTime.sTimeType == 3) {
startTime = moment(endTime)
.subtract(7, "days")
.format("YYYY-MM-DD HH:mm:ss");
} else {
startTime = moment(endTime)
.subtract(30, "days")
.format("YYYY-MM-DD HH:mm:ss");
}
let sTimeType = 4;
this.$router.push({
path: "/industryDataExport",
query: { startTime, endTime, qudao, sTimeType, token: this.getToken, action: 'getList', sType: 'BrandData', brand: this.form.sBrand },
});
}
}
}

@ -1,7 +1,7 @@
<!--
* @Author: xw
* @Date: 2021-10-09 11:28:39
* @LastEditTime: 2021-10-23 12:58:13
* @LastEditTime: 2021-10-27 13:31:03
* @LastEditors: Please set LastEditors
* @Description: 晴雨表
* @FilePath: /data-show/src/views/Index/barometer/index.vue
@ -105,9 +105,10 @@ export default {
.subtract(30, "days")
.format("YYYY-MM-DD HH:mm:ss");
}
let sTimeType = 4;
this.$router.push({
path: "/industryDataExport",
query: { startTime, endTime, series },
query: { startTime, endTime, series, sTimeType, action: 'getListHome', sType: 'Home' },
});
},
},

@ -0,0 +1,177 @@
/*
* @Author: your name
* @Date: 2021-10-27 15:26:21
* @LastEditTime: 2021-10-27 15:53:06
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: /data-show/src/views/IndustryDataExport/getApiData.js
*/
import { getQuDao, getQingGan, getCrisis, getTwoTime, getToExcelField } from "@/api/comm";
import { getListHome } from "@/api/home";
export default {
// 获取表格数据
getTable() {
return new Promise((resolve, reject) => {
this.tableLoading = true;
this.tbData = [];
this.getData(0)
.then((res) => {
let data = res.data;
this.totalNum = res.totalNum;
this.pagination.total = res.totalNum;
let arr = [];
data.forEach((ele) => {
let _source = ele._source;
arr.push(_source);
});
this.tbData = arr;
this.tableLoading = false;
resolve(res);
})
.catch(() => {
reject(false);
});
});
},
// 获取渠道数据
getList() {
return new Promise((resolve, reject) => {
this.getData(1)
.then((res) => {
let data = res.data1;
let arr = [...this.plainOptions];
for (let i = 0; i < data.length; i++) {
let label = arr[i].label || "";
let str = label.replace(/\(.*?\)/g, "");
arr[i].label = str + "(" + data[i] + ")";
}
this.plainOptions = arr;
resolve(res);
})
.catch(() => {
reject(false);
});
});
},
// 获取后台数据
getData(isSourcetype) {
return new Promise((resolve, reject) => {
let obj = Object.assign({}, this.form);
obj.isSourcetype = isSourcetype;
getListHome(obj)
.then((res) => {
resolve(res);
})
.catch(() => {
reject(false);
});
});
},
// 获取时间选项
getTime() {
return new Promise((resolve, reject) => {
getTwoTime()
.then((res) => {
let data = res.data;
this.timesSel = data;
this.form.sTimeType = this.timesSel[0].key;
let arr = [];
data.forEach((ele) => {
let value = ele.value;
arr.push(value);
});
this.btnTimes = arr;
resolve(data);
})
.catch(() => {
reject(false);
});
});
},
// 获取渠道
getQuDao() {
return new Promise((resolve, reject) => {
getQuDao()
.then((res) => {
let data = res.data;
let arr = [];
data.forEach((ele) => {
let obj = {
label: ele.value,
value: ele.key,
};
arr.push(obj);
});
this.plainOptions = arr;
resolve(arr);
})
.catch(() => {
reject(false);
});
});
},
// 获取情感
getQingGan() {
return new Promise((resolve, reject) => {
getQingGan()
.then((res) => {
let data = res.data;
let arr = [];
data.forEach((ele) => {
let obj = {
label: ele.value,
value: ele.key,
};
arr.push(obj);
});
this.plainOptions1 = arr;
resolve(arr);
})
.catch(() => {
reject(false);
});
});
},
// 获取负面等级
getCrisis() {
return new Promise((resolve, reject) => {
getCrisis()
.then((res) => {
let data = res.data;
let arr = [];
data.forEach((ele) => {
let obj = {
label: ele.value,
value: ele.key,
};
arr.push(obj);
});
this.plainOptions2 = arr;
resolve(arr);
})
.catch(() => {
reject(false);
});
});
},
// 获取导出字段
getToExcelField(sType, token) {
return new Promise((resolve, reject) => {
getToExcelField({sType: sType, token: token}).then(res => {
let data = res.data;
let arr = [];
data.forEach((ele) => {
let obj = {
label: ele.name,
value: ele.field,
};
arr.push(obj);
});
this.plainOptions4 = arr;
resolve(arr);
}).catch(() => {
reject(false);
})
})
}
}

@ -1,7 +1,7 @@
<!--
* @Author: xw
* @Date: 2021-10-11 14:11:04
* @LastEditTime: 2021-10-23 16:59:10
* @LastEditTime: 2021-10-27 16:53:57
* @LastEditors: Please set LastEditors
* @Description: 行业数据导出
* @FilePath: /data-show/src/views/IndustryDataExport/index.vue
@ -27,41 +27,56 @@
</div>
<div class="ide-d1-dd1" style="margin-top: 24px">
<span class="s1">调性</span>
<a-checkbox-group v-model="qingGan" :options="plainOptions3" @change="(val) => onChange(val, 'qingGan')" />
<a-checkbox-group v-model="qingGan" :disabled="noClick" :options="plainOptions3" @change="(val) => onChange(val, 'qingGan')" />
</div>
</div>
<div class="ide-d2">
<span class="s1"><span class="ss1">{{totalNum}}</span>条数据</span>
<!-- <span class="s1"><span class="ss1">{{totalNum}}</span>条数据已选中<span class="ss1">0</span>条数据</span> -->
<!-- <a-button type="primary" @click="handlerExport"></a-button> -->
<span class="s1" v-if="!form.token"><span class="ss1">{{totalNum}}</span>条数据</span>
<span class="s1" v-if="form.token"><span class="ss1">{{totalNum}}</span>条数据已选中<span class="ss1">{{secIds.length}}</span>条数据</span>
<a-button type="primary" v-if="form.token" @click="handlerExport"></a-button>
</div>
<v-table :columns="columns" :data="tbData" :loading="tableLoading" :pagination="pagination" @change="handlerPage"></v-table>
<v-table :row-selection="rowSelection" :columns="columns" :data="tbData" :loading="tableLoading" :pagination="pagination" @change="handlerPage">
<template slot="titlex" slot-scope="text, record">
<a :href="record.url" style="color: #fff" target="_blank">{{ text }}</a>
<a-tag color="#108ee9" v-if="record.affections === 1"></a-tag>
<a-tag color="#fece42" v-if="record.affections === 3"></a-tag>
<a-tag color="#cb7632" v-if="record.affections === 2"></a-tag>
<a-tag color="#d48c44" v-if="record.crisis === 1"></a-tag>
<a-tag color="#d46a46" v-if="record.crisis === 2"></a-tag>
<a-tag color="#d81c33" v-if="record.crisis === 3"></a-tag>
</template>
</v-table>
</div>
</div>
<!-- <v-modal :title="modalObj.title" :visible.sync="modalObj.visible" :eleStyle="{ width: '1200px', height: '531px' }">
<div slot="body" style="padding: 0px 24px 24px 24px">
<a-form :label-col="{ span: 2 }" :wrapper-col="{ span: 8 }">
<v-modal :title="modalObj.title" :visible.sync="modalObj.visible" :eleStyle="{ width: '60rem', height: '36rem'}">
<div slot="body" style="padding: 1rem 1rem 1rem 1rem">
<a-form :label-col="{ span: 3 }" :wrapper-col="{ span: 8 }">
<a-form-item label="文件名称">
<a-input placeholder="请输入文件名称"></a-input>
</a-form-item>
<a-form-item label="导出格式">
<span style="color: #63aecc; font-size: 14px">xlsz</span>
</a-form-item>
<a-form-item label="导出字段" :wrapper-col="{ span: 22 }">
<a-checkbox-group v-model="value1" :options="plainOptions3" @change="onChange" />
<a-form-item label="导出字段" :wrapper-col="{ span: 21 }">
<a-checkbox-group v-model="value1" :options="plainOptions4" @change="onChange" />
</a-form-item>
<a-form-item label="导出条数">
<span style="color: #63aecc; font-size: 14px">2</span>
<span style="color: #63aecc; font-size: 14px">{{secIds.length}}</span>
</a-form-item>
</a-form>
</div>
</v-modal> -->
<div slot="footer">
<div class="epor" align="center">
<div class="epor-btn">确定</div>
</div>
</div>
</v-modal>
</div>
</template>
<script>
import { getQuDao, getQingGan, getCrisis, getTwoTime } from "@/api/comm";
import { getListHome } from "@/api/home";
import getApiData from "./getApiData"
import tableEvent from "./tableEvent"
export default {
name: "IndustryDataExport",
data() {
@ -73,7 +88,10 @@ export default {
gValue: 0,
selVal: 4,
selTime: [],
value1: [],
form: {
action: "",
sType: "",
sStartTime: "",
sEndTime: "",
sQingGan: "",
@ -83,6 +101,9 @@ export default {
iPageSize: 20,
token: "",
sQuDao: "",
sBrand: "",
sSeriesName: "",
iTimeType: 0
},
modalObj: {
title: "导出选项",
@ -94,11 +115,13 @@ export default {
plainOptions1: [],
plainOptions2: [],
plainOptions3: [],
plainOptions4: [],
columns: [
{
title: "标题及内容",
dataIndex: "title",
key: "title",
scopedSlots: { customRender: "titlex" },
},
{
title: "来源",
@ -126,250 +149,18 @@ export default {
tableLoading: false,
noClick: false,
totalNum: 0,
rowSelection: null,
selectedRows: [],
selectedRowKeys: "",
secIds: []
};
},
created() {
Promise.all([
this.getQuDao(),
this.getQingGan(),
this.getCrisis(),
this.getTime(),
]).then(() => {
let series = this.$route.query.series || [];
this.form.token = this.$route.query.token || "";
this.plainOptions3 = this.doQingGanAndCrisis();
this.qingGan = series;
this.doFormQS(series);
this.form.sTimeType = 4;
this.form.sStartTime = this.$route.query.startTime || "";
this.form.sEndTime = this.$route.query.endTime || "";
if (this.form.sStartTime && this.form.sEndTime) {
this.selTime = [this.form.sStartTime, this.form.sEndTime];
}
this.gValue = 4;
this.getList();
this.getTable();
});
this.initDoc()
},
methods: {
onChange(val, type) {
this.noClick = true;
if (type === "quDao") {
this.form.sQuDao = this.quDao.toString();
} else if (type === "qingGan") {
this.doFormQS(this.qingGan);
}
Promise.all([this.getList(), this.getTable()]).then(() => {
this.noClick = false;
});
},
//
handlerExport() {
this.modalObj.visible = true;
},
//
doFormQS(val = []) {
let qingGan = [];
let crisis = [];
val.forEach((ele) => {
let n1 = this.plainOptions1.findIndex((e) => {
return e.label === ele;
});
let n2 = this.plainOptions2.findIndex((e) => {
return e.label === ele;
});
if (n1 != -1) {
qingGan.push(this.plainOptions1[n1].value);
}
if (n2 != -1) {
crisis.push(this.plainOptions2[n2].value);
}
});
this.form.sQingGan = qingGan.toString();
this.form.sCrisis = crisis.toString();
},
//
doQingGanAndCrisis() {
let arr = [];
let tes = [...this.plainOptions1, ...this.plainOptions2];
tes.forEach((ele) => {
let obj = {
label: ele.label,
value: ele.label,
};
arr.push(obj);
});
return arr;
},
//
handlerBack() {
this.$router.go(-1);
},
//
handlerTime(n) {
let ele = this.timesSel[n];
this.form.sTimeType = ele.key;
if (ele.key != this.selVal) {
this.getData();
}
},
//
handlerChangeTime(val) {
this.form.sStartTime = val[0];
this.form.sEndTime = val[1];
this.getData();
},
//
handlerPage(p) {
let iPageIndex = p.current;
this.form.iPageIndex = iPageIndex;
this.pagination.current = iPageIndex;
this.getData();
},
//
getTable() {
return new Promise((resolve, reject) => {
this.tableLoading = true;
this.getData(0)
.then((res) => {
let data = res.data;
this.totalNum = res.totalNum;
this.pagination.total = res.totalNum;
let arr = [];
data.forEach((ele) => {
let _source = ele._source;
arr.push(_source);
});
this.tbData = arr;
this.tableLoading = false;
resolve(res);
})
.catch(() => {
reject(false);
});
});
},
//
getList() {
return new Promise((resolve, reject) => {
this.getData(1)
.then((res) => {
let data = res.data1;
let arr = [...this.plainOptions];
for (let i = 0; i < data.length; i++) {
let label = arr[i].label || "";
let str = label.replace(/\(.*?\)/g, "");
arr[i].label = str + "(" + data[i] + ")";
}
this.plainOptions = arr;
resolve(res);
})
.catch(() => {
reject(false);
});
});
},
//
getData(isSourcetype) {
return new Promise((resolve, reject) => {
let obj = Object.assign({}, this.form);
obj.isSourcetype = isSourcetype;
getListHome(obj)
.then((res) => {
resolve(res);
})
.catch(() => {
reject(false);
});
});
},
//
getTime() {
return new Promise((resolve, reject) => {
getTwoTime()
.then((res) => {
let data = res.data;
this.timesSel = data;
this.form.sTimeType = this.timesSel[0].key;
let arr = [];
data.forEach((ele) => {
let value = ele.value;
arr.push(value);
});
this.btnTimes = arr;
resolve(data);
})
.catch(() => {
reject(false);
});
});
},
//
getQuDao() {
return new Promise((resolve, reject) => {
getQuDao()
.then((res) => {
let data = res.data;
let arr = [];
data.forEach((ele) => {
let obj = {
label: ele.value,
value: ele.key,
};
arr.push(obj);
});
this.plainOptions = arr;
resolve(arr);
})
.catch(() => {
reject(false);
});
});
},
//
getQingGan() {
return new Promise((resolve, reject) => {
getQingGan()
.then((res) => {
let data = res.data;
let arr = [];
data.forEach((ele) => {
let obj = {
label: ele.value,
value: ele.key,
};
arr.push(obj);
});
this.plainOptions1 = arr;
resolve(arr);
})
.catch(() => {
reject(false);
});
});
},
//
getCrisis() {
return new Promise((resolve, reject) => {
getCrisis()
.then((res) => {
let data = res.data;
let arr = [];
data.forEach((ele) => {
let obj = {
label: ele.value,
value: ele.key,
};
arr.push(obj);
});
this.plainOptions2 = arr;
resolve(arr);
})
.catch(() => {
reject(false);
});
});
},
...getApiData,
...tableEvent
},
};
</script>
@ -410,4 +201,20 @@ export default {
}
}
}
.epor {
width: 100%;
height: 80px;
.epor-btn {
width: 480px;
height: 80px;
background-image: url("../../assets/images/comm/img_bbut.png");
background-repeat: no-repeat;
background-size: cover;
text-align: center;
line-height: 80px;
color: #63AECC;
font-size: 28px;
cursor: pointer;
}
}
</style>

@ -0,0 +1,163 @@
/*
* @Author: your name
* @Date: 2021-10-27 15:29:37
* @LastEditTime: 2021-10-27 16:53:08
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: /data-show/src/views/IndustryDataExport/tableEvent.js
*/
function rowSelection(that) {
return {
onChange: (selectedRowKeys, selectedRows) => {
// console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows);
that.selectedRowKeys = selectedRowKeys.toString();
that.selectedRows = selectedRows;
that.secIds = selectedRowKeys;
},
// onSelect: (record, selected, selectedRows) => {
// console.log(record, selected, selectedRows);
// },
// onSelectAll: (selected, selectedRows, changeRows) => {
// console.log(selected, selectedRows, changeRows);
// },
}
}
export default {
// 初始化页面
initDoc() {
Promise.all([
this.getQuDao(),
this.getQingGan(),
this.getCrisis(),
this.getTime(),
]).then(() => {
let series = this.$route.query.series || [];
let qudao = this.$route.query.qudao || [];
this.form.token = this.$route.query.token || "";
this.form.action = this.$route.query.action || "";
this.form.sType = this.$route.query.sType || "";
this.form.sBrand = this.$route.query.brand || "";
this.form.sSeriesName = this.$route.query.seriesName || "";
this.doFormQudao(qudao);
this.plainOptions3 = this.doQingGanAndCrisis();
this.qingGan = series;
this.doFormQS(series);
this.form.sTimeType = this.$route.query.sTimeType || 34;
this.gValue = 0;
this.form.sStartTime = this.$route.query.startTime || "";
this.form.sEndTime = this.$route.query.endTime || "";
if (this.form.sStartTime && this.form.sEndTime) {
this.selTime = [this.form.sStartTime, this.form.sEndTime];
}
if (this.form.sTimeType === 4) {
this.gValue = 4;
}
if (this.form.token) {
this.rowSelection = rowSelection(this);
}
this.getList();
this.getTable();
});
},
// 选择情感和渠道的情况
onChange(val, type) {
this.noClick = true;
if (type === "quDao") {
this.form.sQuDao = this.quDao.toString();
} else if (type === "qingGan") {
this.doFormQS(this.qingGan);
}
this.form.iPageIndex = 1;
this.pagination.current = 1;
Promise.all([this.getList(), this.getTable()]).then(() => {
this.noClick = false;
});
},
// 导出弹框
handlerExport() {
this.getToExcelField(this.form.sType, this.form.token).then(() => {
this.modalObj.visible = true;
})
},
// 给后台传渠道
doFormQudao(val = []) {
let arr = [];
val.forEach((ele) => {
let n = this.plainOptions.findIndex((e) => {
return e.label === ele;
});
if (n != -1) {
arr.push(this.plainOptions[n].value);
}
});
this.quDao = arr;
this.form.sQuDao = arr.toString();
},
// 给后台传情感和负面等级
doFormQS(val = []) {
let qingGan = [];
let crisis = [];
val.forEach((ele) => {
let n1 = this.plainOptions1.findIndex((e) => {
return e.label === ele;
});
let n2 = this.plainOptions2.findIndex((e) => {
return e.label === ele;
});
if (n1 != -1) {
qingGan.push(this.plainOptions1[n1].value);
}
if (n2 != -1) {
crisis.push(this.plainOptions2[n2].value);
}
});
this.form.sQingGan = qingGan.toString();
this.form.sCrisis = crisis.toString();
},
// 处理情感和负面等级
doQingGanAndCrisis() {
let arr = [];
let tes = [...this.plainOptions1, ...this.plainOptions2];
tes.forEach((ele) => {
let obj = {
label: ele.label,
value: ele.label,
};
arr.push(obj);
});
return arr;
},
// 返回
handlerBack() {
this.$router.go(-1);
},
// 改变时间的选项
handlerTime(n) {
let ele = this.timesSel[n];
this.form.sTimeType = ele.key;
if (ele.key != this.selVal) {
this.getTable();
this.getList();
}
},
// 选择时间的效果
handlerChangeTime(val) {
this.form.sStartTime = val[0];
this.form.sEndTime = val[1];
this.getTable();
this.getList();
},
// 改变页面的数据
handlerPage(p) {
let iPageIndex = p.current;
this.form.iPageIndex = iPageIndex;
this.pagination.current = iPageIndex;
this.getTable();
},
}
Loading…
Cancel
Save