prod
lily.zhang 3 years ago
parent 5ad87e0053
commit af38e24f17

@ -1,7 +1,7 @@
<!-- <!--
* @Author: your name * @Author: your name
* @Date: 2021-10-15 09:16:31 * @Date: 2021-10-15 09:16:31
* @LastEditTime: 2021-11-01 17:46:27 * @LastEditTime: 2021-11-21 14:43:22
* @LastEditors: Please set LastEditors * @LastEditors: Please set LastEditors
* @Description: In User Settings Edit * @Description: In User Settings Edit
* @FilePath: /data-show/src/lycomponents/iSwitchBrand/index.vue * @FilePath: /data-show/src/lycomponents/iSwitchBrand/index.vue
@ -39,7 +39,7 @@
</template> </template>
<script> <script>
import { getUserBrand,getUserSeriesName } from "@/api/comm"; import { getUserBrand, getUserSeriesName } from "@/api/comm";
export default { export default {
name: "iSwitchBrand", name: "iSwitchBrand",
props: { props: {
@ -49,8 +49,8 @@ export default {
}, },
brand: { brand: {
type: String, type: String,
default: "" default: "",
} },
}, },
watch: { watch: {
visible: { visible: {
@ -64,9 +64,9 @@ export default {
this.brandname = this.brand; this.brandname = this.brand;
this.getBrands().then(() => { this.getBrands().then(() => {
this.handlerLi(0); this.handlerLi(0);
let row = this.cars.find(ele => { let row = this.cars.find((ele) => {
return ele.brandname === this.brandname; return ele.brandname === this.brandname;
}) });
this.chooseBrand = row; this.chooseBrand = row;
}); });
}, },
@ -78,32 +78,7 @@ export default {
token: "", token: "",
}, },
letterArr: [ letterArr: [
"热门",
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"I",
"J",
"K",
"L",
"M",
"N",
"O",
"P",
"Q",
"R",
"S",
"T",
"V",
"W",
"X",
"Y",
"Z",
], ],
cars: [], cars: [],
showCars: [], showCars: [],
@ -111,7 +86,7 @@ export default {
chooseBrand: null, chooseBrand: null,
chooseModel: null, chooseModel: null,
models: [], models: [],
brandname: "" brandname: "",
}; };
}, },
methods: { methods: {
@ -128,42 +103,66 @@ export default {
}, },
// //
getBrands() { getBrands() {
if(!this.getToken) return; if (!this.getToken) return;
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this.form.token = this.getToken; this.form.token = this.getToken;
getUserBrand(this.form).then((res) => { getUserBrand(this.form)
let data = res.data; .then((res) => {
this.cars = data; let data = res.data || [];
resolve(true) let arr = [];
}).catch(() => { data.forEach((ele) => {
reject(false) let fk = ele.firstword;
}); arr.push(fk);
});
let sarr = new Set(arr);
let arr1 = Array.from(sarr);
this.letterArr = this.todo(arr1, '热门');
this.cars = data;
resolve(true);
})
.catch(() => {
reject(false);
});
}); });
}, },
todo(arr, id) {
let index = 1,
newArr = [],
length = arr.length;
for (let i = 0; i < length; i++) {
if (arr[i] === id) {
console.log(111)
newArr[0] = arr[i];
} else {
newArr[index++] = arr[i];
}
}
return newArr;
},
// //
handlerChoose(n, row) { handlerChoose(row) {
this.showActive = row.brandid; this.showActive = row.brandid;
this.chooseBrand = row; this.chooseBrand = row;
this.brandname = this.chooseBrand.brandname; this.brandname = this.chooseBrand.brandname;
this.getUserSeriesName(this.brandname); this.getUserSeriesName(this.brandname);
}, },
// //
getUserSeriesName(brandName) { getUserSeriesName(brandName) {
this.form.token = this.getToken; this.form.token = this.getToken;
this.form.sBrandName = brandName; this.form.sBrandName = brandName;
getUserSeriesName(this.form).then(res => { getUserSeriesName(this.form).then((res) => {
let data = res.data || []; let data = res.data || [];
this.models = data; this.models = data;
this.chooseModel = this.models[0]; this.chooseModel = this.models[0];
}) });
}, },
// //
handlerSubmit() { handlerSubmit() {
if(this.chooseBrand && this.chooseModel) { if (this.chooseBrand && this.chooseModel) {
this.$emit("change", [this.chooseBrand,this.chooseModel]); this.$emit("change", [this.chooseBrand, this.chooseModel]);
this.handlerClose(); this.handlerClose();
} else { } else {
this.$message.warning('请选择品牌'); this.$message.warning("请选择品牌");
} }
}, },
}, },

@ -1,7 +1,7 @@
<!-- <!--
* @Author: your name * @Author: your name
* @Date: 2021-10-15 09:16:31 * @Date: 2021-10-15 09:16:31
* @LastEditTime: 2021-11-09 18:01:58 * @LastEditTime: 2021-11-21 14:58:52
* @LastEditors: Please set LastEditors * @LastEditors: Please set LastEditors
* @Description: In User Settings Edit * @Description: In User Settings Edit
* @FilePath: /data-show/src/lycomponents/iSwitchBrand/index.vue * @FilePath: /data-show/src/lycomponents/iSwitchBrand/index.vue
@ -96,32 +96,7 @@ export default {
sBrandName: "" sBrandName: ""
}, },
letterArr: [ letterArr: [
"热门",
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"I",
"J",
"K",
"L",
"M",
"N",
"O",
"P",
"Q",
"R",
"S",
"T",
"V",
"W",
"X",
"Y",
"Z",
], ],
cars: [], cars: [],
models: [], models: [],
@ -153,6 +128,14 @@ export default {
getUserBrand(this.form) getUserBrand(this.form)
.then((res) => { .then((res) => {
let data = res.data; let data = res.data;
let arr = [];
data.forEach((ele) => {
let fk = ele.firstword;
arr.push(fk);
});
let sarr = new Set(arr);
let arr1 = Array.from(sarr);
this.letterArr = this.todo(arr1, '热门');
this.cars = data; this.cars = data;
resolve(true); resolve(true);
}) })
@ -160,6 +143,20 @@ export default {
reject(false); reject(false);
}); });
}); });
},
todo(arr, id) {
let index = 1,
newArr = [],
length = arr.length;
for (let i = 0; i < length; i++) {
if (arr[i] === id) {
console.log(111)
newArr[0] = arr[i];
} else {
newArr[index++] = arr[i];
}
}
return newArr;
}, },
// //
handlerChoose(n, row) { handlerChoose(n, row) {

@ -1,7 +1,7 @@
/* /*
* @Author: your name * @Author: your name
* @Date: 2021-10-27 15:26:21 * @Date: 2021-10-27 15:26:21
* @LastEditTime: 2021-11-19 16:04:37 * @LastEditTime: 2021-11-21 16:23:53
* @LastEditors: Please set LastEditors * @LastEditors: Please set LastEditors
* @Description: In User Settings Edit * @Description: In User Settings Edit
* @FilePath: /data-show/src/views/IndustryDataExport/getApiData.js * @FilePath: /data-show/src/views/IndustryDataExport/getApiData.js
@ -20,10 +20,25 @@ export default {
this.totalNum = res.totalNum; this.totalNum = res.totalNum;
this.pagination.total = res.totalNum; this.pagination.total = res.totalNum;
let arr = []; let arr = [];
let ids = [];
let ssk = [...this.sk];
data.forEach((ele) => { data.forEach((ele) => {
let _source = ele._source; let _source = ele._source;
let id = _source.id;
ids.push(id);
arr.push(_source); arr.push(_source);
}); });
if(this.tableAll) {
ids.forEach(ele => {
let n = this.sk.findIndex(e => {
return ele === e;
})
if(n === -1) {
ssk.push(ele);
}
})
this.sk = ssk;
}
this.tbData = arr; this.tbData = arr;
this.tableLoading = false; this.tableLoading = false;
resolve(res); resolve(res);
@ -180,6 +195,7 @@ export default {
arr.push(obj); arr.push(obj);
}); });
this.checkedIds = arr1; this.checkedIds = arr1;
this.fileTypeChange(arr1);
this.plainOptions4 = arr; this.plainOptions4 = arr;
resolve(arr); resolve(arr);
}).catch(() => { }).catch(() => {

@ -1,7 +1,7 @@
<!-- <!--
* @Author: xw * @Author: xw
* @Date: 2021-10-11 14:11:04 * @Date: 2021-10-11 14:11:04
* @LastEditTime: 2021-11-19 13:58:15 * @LastEditTime: 2021-11-21 16:10:55
* @LastEditors: Please set LastEditors * @LastEditors: Please set LastEditors
* @Description: 行业数据导出 * @Description: 行业数据导出
* @FilePath: /data-show/src/views/IndustryDataExport/index.vue * @FilePath: /data-show/src/views/IndustryDataExport/index.vue
@ -38,10 +38,10 @@
</div> </div>
<div class="ide-d2"> <div class="ide-d2">
<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>
<span class="s1" v-if="form.token"><span class="ss1">{{totalNum}}</span>条数据已选中<span class="ss1">{{secIds.length}}</span>条数据</span> <span class="s1" v-if="form.token"><span class="ss1">{{totalNum}}</span>条数据已选中<span class="ss1">{{tableAll ? totalNum : secIds.length}}</span>条数据</span>
<a-button type="primary" v-if="form.token" @click="handlerExport" v-has="btnUrl"></a-button> <a-button type="primary" v-if="form.token" @click="handlerExport" v-has="btnUrl"></a-button>
</div> </div>
<v-table :row-selection="rowSelection" :columns="columns" :data="tbData" :loading="tableLoading" :pagination="pagination" @change="handlerPage"> <v-table ref="rtable" :row-selection="rowSelection" :columns="columns" :data="tbData" :loading="tableLoading" :pagination="pagination" @change="handlerPage">
<template slot="titlex" slot-scope="text, record"> <template slot="titlex" slot-scope="text, record">
<a :href="record.url" style="color: #fff" target="_blank">{{ text|doStr(100) }}</a> <a :href="record.url" style="color: #fff" target="_blank">{{ text|doStr(100) }}</a>
<a-tag color="#108ee9" v-if="record.affections === 1" style="margin-left: 0.6rem;margin-right: 0px;"></a-tag> <a-tag color="#108ee9" v-if="record.affections === 1" style="margin-left: 0.6rem;margin-right: 0px;"></a-tag>
@ -83,11 +83,16 @@
<script> <script>
import getApiData from "./getApiData"; import getApiData from "./getApiData";
import tableEvent from "./tableEvent"; import tableEvent from "./tableEvent";
import {rowSelection} from "./tableEvent";
export default { export default {
name: "IndustryDataExport", name: "IndustryDataExport",
computed: {
rowSelection
},
data() { data() {
return { return {
title: "", title: "",
tableAll: false,
quDao: [], quDao: [],
quDaoAll: "全部", quDaoAll: "全部",
qdIndeterminate:true, qdIndeterminate:true,
@ -164,8 +169,8 @@ export default {
tableLoading: false, tableLoading: false,
noClick: false, noClick: false,
totalNum: 0, totalNum: 0,
rowSelection: null,
selectedRows: [], selectedRows: [],
sk: [],
selectedRowKeys: "", selectedRowKeys: "",
secIds: [], secIds: [],
execlForm: { execlForm: {

@ -1,36 +1,48 @@
/* /*
* @Author: your name * @Author: your name
* @Date: 2021-10-27 15:29:37 * @Date: 2021-10-27 15:29:37
* @LastEditTime: 2021-11-19 14:04:51 * @LastEditTime: 2021-11-21 16:36:03
* @LastEditors: Please set LastEditors * @LastEditors: Please set LastEditors
* @Description: In User Settings Edit * @Description: In User Settings Edit
* @FilePath: /data-show/src/views/IndustryDataExport/tableEvent.js * @FilePath: /data-show/src/views/IndustryDataExport/tableEvent.js
*/ */
import moment from "moment"; import moment from "moment";
function rowSelection(that) { export function rowSelection() {
return { let a = null;
onChange: (selectedRowKeys, selectedRows) => { if (!this.form.token) {
that.selectedRowKeys = selectedRowKeys.toString(); a = null
that.selectedRows = selectedRows; } else {
that.secIds = selectedRowKeys; a = {
onChange: (selectedRowKeys, selectedRows) => {
this.sk = selectedRowKeys;
this.selectedRowKeys = selectedRowKeys.toString();
this.selectedRows = selectedRows;
this.secIds = selectedRowKeys;
}, },
// onSelect: (record, selected, selectedRows) => { onSelect:(record, selected) => {
// }, if(!selected) {
// onSelectAll: (selected, selectedRows, changeRows) => { this.tableAll = false;
// }, }
},
selectedRowKeys: this.sk,
onSelectAll: () => {
this.tableAll = true;
},
}
} }
return a
} }
import { getExcel } from "@/api/comm" import { getExcel } from "@/api/comm"
export default { export default {
// 初始化页面 // 初始化页面
initDoc() { initDoc() {
this.title = this.$route.query.title || '行业数据' this.title = this.$route.query.title || '行业数据'
if(this.title === '品牌-行业数据') { if (this.title === '品牌-行业数据') {
this.btnUrl = 'btn_brand_c_toppt' this.btnUrl = 'btn_brand_c_toppt'
} else if(this.title === '车型-行业数据') { } else if (this.title === '车型-行业数据') {
this.btnUrl = 'btn_model_toexcel' this.btnUrl = 'btn_model_toexcel'
} else if(this.title === '事件-行业数据') { } else if (this.title === '事件-行业数据') {
this.btnUrl = 'btn_event_toexcel' this.btnUrl = 'btn_event_toexcel'
} }
Promise.all([ Promise.all([
@ -66,9 +78,7 @@ export default {
} else { } else {
this.gValue = 0; this.gValue = 0;
} }
if (this.form.token) {
this.rowSelection = rowSelection(this);
}
this.getList(); this.getList();
this.getTable(); this.getTable();
}); });
@ -107,8 +117,8 @@ export default {
handlerExport() { handlerExport() {
this.getToExcelField(this.form.sType, this.form.token).then(() => { this.getToExcelField(this.form.sType, this.form.token).then(() => {
this.execlForm.sFileName = this.form.sBrand + '洞察-' + this.getDatetimeSs(); this.execlForm.sFileName = this.form.sBrand + '洞察-' + this.getDatetimeSs();
this.execlForm.sCheckedIds = this.secIds.toString(); this.execlForm.sCheckedIds = this.tableAll ? '' : this.secIds.toString();
this.execlForm.iNum = this.secIds.length; this.execlForm.iNum = this.tableAll ? this.totalNum : this.secIds.length;
this.modalObj.visible = true; this.modalObj.visible = true;
}) })
}, },
@ -199,7 +209,15 @@ export default {
}, },
// 导出数据 // 导出数据
exportExcel() { exportExcel() {
if (this.execlForm.iNum) { if(this.execlForm.iNum === 0) {
this.$message.warning('请选择下载数据');
return;
}
if(this.checkedIds.length === 0) {
this.$message.warning('请选择下载字段');
return;
}
if (this.execlForm.iNum && this.checkedIds.length > 0) {
this.mergeForm(); this.mergeForm();
getExcel(this.execlForm).then(() => { getExcel(this.execlForm).then(() => {
this.$notification.open({ this.$notification.open({
@ -207,6 +225,7 @@ export default {
description: '请前往个人中心查看下载进度', description: '请前往个人中心查看下载进度',
placement: 'bottomRight', placement: 'bottomRight',
}); });
this.modalObj.visible = false;
}) })
} }
}, },
@ -261,15 +280,15 @@ export default {
).valueOf(); ).valueOf();
return ( return (
current > current >
moment( moment(
new Date(selectV + this.offsetDays), new Date(selectV + this.offsetDays),
"YYYY-MM-DD" "YYYY-MM-DD"
) || ) ||
current < current <
moment( moment(
new Date(selectV - this.offsetDays), new Date(selectV - this.offsetDays),
"YYYY-MM-DD" "YYYY-MM-DD"
) )
); );
} else { } else {
return false; return false;

Loading…
Cancel
Save