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

@ -1,7 +1,7 @@
<!--
* @Author: your name
* @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
* @Description: In User Settings Edit
* @FilePath: /data-show/src/lycomponents/iSwitchBrand/index.vue
@ -39,7 +39,7 @@
</template>
<script>
import { getUserBrand,getUserSeriesName } from "@/api/comm";
import { getUserBrand, getUserSeriesName } from "@/api/comm";
export default {
name: "iSwitchBrand",
props: {
@ -49,8 +49,8 @@ export default {
},
brand: {
type: String,
default: ""
}
default: "",
},
},
watch: {
visible: {
@ -64,9 +64,9 @@ export default {
this.brandname = this.brand;
this.getBrands().then(() => {
this.handlerLi(0);
let row = this.cars.find(ele => {
let row = this.cars.find((ele) => {
return ele.brandname === this.brandname;
})
});
this.chooseBrand = row;
});
},
@ -78,32 +78,7 @@ export default {
token: "",
},
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: [],
showCars: [],
@ -111,7 +86,7 @@ export default {
chooseBrand: null,
chooseModel: null,
models: [],
brandname: ""
brandname: "",
};
},
methods: {
@ -128,43 +103,67 @@ export default {
},
//
getBrands() {
if(!this.getToken) return;
if (!this.getToken) return;
return new Promise((resolve, reject) => {
this.form.token = this.getToken;
getUserBrand(this.form).then((res) => {
let data = res.data;
this.cars = data;
resolve(true)
}).catch(() => {
reject(false)
});
getUserBrand(this.form)
.then((res) => {
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;
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.chooseBrand = row;
this.brandname = this.chooseBrand.brandname;
this.getUserSeriesName(this.brandname);
},
//
//
getUserSeriesName(brandName) {
this.form.token = this.getToken;
this.form.sBrandName = brandName;
getUserSeriesName(this.form).then(res => {
this.form.token = this.getToken;
this.form.sBrandName = brandName;
getUserSeriesName(this.form).then((res) => {
let data = res.data || [];
this.models = data;
this.chooseModel = this.models[0];
})
});
},
//
handlerSubmit() {
if(this.chooseBrand && this.chooseModel) {
this.$emit("change", [this.chooseBrand,this.chooseModel]);
this.handlerClose();
if (this.chooseBrand && this.chooseModel) {
this.$emit("change", [this.chooseBrand, this.chooseModel]);
this.handlerClose();
} else {
this.$message.warning('请选择品牌');
}
this.$message.warning("请选择品牌");
}
},
},
};

@ -1,7 +1,7 @@
<!--
* @Author: your name
* @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
* @Description: In User Settings Edit
* @FilePath: /data-show/src/lycomponents/iSwitchBrand/index.vue
@ -96,32 +96,7 @@ export default {
sBrandName: ""
},
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: [],
models: [],
@ -153,6 +128,14 @@ export default {
getUserBrand(this.form)
.then((res) => {
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;
resolve(true);
})
@ -160,6 +143,20 @@ export default {
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) {

@ -1,7 +1,7 @@
/*
* @Author: your name
* @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
* @Description: In User Settings Edit
* @FilePath: /data-show/src/views/IndustryDataExport/getApiData.js
@ -20,10 +20,25 @@ export default {
this.totalNum = res.totalNum;
this.pagination.total = res.totalNum;
let arr = [];
let ids = [];
let ssk = [...this.sk];
data.forEach((ele) => {
let _source = ele._source;
let id = _source.id;
ids.push(id);
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.tableLoading = false;
resolve(res);
@ -180,6 +195,7 @@ export default {
arr.push(obj);
});
this.checkedIds = arr1;
this.fileTypeChange(arr1);
this.plainOptions4 = arr;
resolve(arr);
}).catch(() => {

@ -1,7 +1,7 @@
<!--
* @Author: xw
* @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
* @Description: 行业数据导出
* @FilePath: /data-show/src/views/IndustryDataExport/index.vue
@ -38,10 +38,10 @@
</div>
<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 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>
</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">
<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>
@ -83,11 +83,16 @@
<script>
import getApiData from "./getApiData";
import tableEvent from "./tableEvent";
import {rowSelection} from "./tableEvent";
export default {
name: "IndustryDataExport",
computed: {
rowSelection
},
data() {
return {
title: "",
tableAll: false,
quDao: [],
quDaoAll: "全部",
qdIndeterminate:true,
@ -164,8 +169,8 @@ export default {
tableLoading: false,
noClick: false,
totalNum: 0,
rowSelection: null,
selectedRows: [],
sk: [],
selectedRowKeys: "",
secIds: [],
execlForm: {

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

Loading…
Cancel
Save