prod
lily.zhang 3 years ago
parent fe8a7d65fb
commit 8c9268c9c1

@ -1,7 +1,7 @@
/*
* @Author: your name
* @Date: 2021-10-27 15:26:21
* @LastEditTime: 2021-10-27 15:53:06
* @LastEditTime: 2021-10-28 10:28:34
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: /data-show/src/views/IndustryDataExport/getApiData.js
@ -39,13 +39,16 @@ export default {
this.getData(1)
.then((res) => {
let data = res.data1;
let x = this.quDaoAll.replace(/\(.*?\)/g, "");
this.quDaoAll = x + "(" + data[0] + ")";
let arr = [...this.plainOptions];
data.splice(0,1);
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;
this.plainOptions = arr;
resolve(res);
})
.catch(() => {
@ -96,11 +99,14 @@ export default {
let data = res.data;
let arr = [];
data.forEach((ele) => {
let obj = {
label: ele.value,
value: ele.key,
};
arr.push(obj);
let obj = null;
if(ele.key != -1) {
obj = {
label: ele.value,
value: ele.key,
};
arr.push(obj);
}
});
this.plainOptions = arr;
resolve(arr);
@ -118,11 +124,13 @@ export default {
let data = res.data;
let arr = [];
data.forEach((ele) => {
let obj = {
label: ele.value,
value: ele.key,
};
arr.push(obj);
if(ele.key != -1) {
let obj = {
label: ele.value,
value: ele.key,
};
arr.push(obj);
}
});
this.plainOptions1 = arr;
resolve(arr);

@ -1,7 +1,7 @@
<!--
* @Author: xw
* @Date: 2021-10-11 14:11:04
* @LastEditTime: 2021-10-27 18:43:03
* @LastEditTime: 2021-10-28 10:30:38
* @LastEditors: Please set LastEditors
* @Description: 行业数据导出
* @FilePath: /data-show/src/views/IndustryDataExport/index.vue
@ -23,10 +23,16 @@
</div>
<div class="ide-d1-dd1" style="margin-top: 24px">
<span class="s1">渠道</span>
<a-checkbox :disabled="noClick" :indeterminate="qdIndeterminate" :checked="qdCheckAll" @change="onCheckAllChangeQd">
{{quDaoAll}}
</a-checkbox>
<a-checkbox-group v-model="quDao" :disabled="noClick" :options="plainOptions" @change="(val) => onChange(val, 'quDao')" />
</div>
<div class="ide-d1-dd1" style="margin-top: 24px">
<span class="s1">调性</span>
<a-checkbox :disabled="noClick" :indeterminate="qgIndeterminate" :checked="qgCheckAll" @change="onCheckAllChangeQg">
全部
</a-checkbox>
<a-checkbox-group v-model="qingGan" :disabled="noClick" :options="plainOptions3" @change="(val) => onChange(val, 'qingGan')" />
</div>
</div>
@ -66,22 +72,27 @@
</a-form>
</div>
<div slot="footer">
<div class="epor" align="center">
<div class="epor-btn" @click="exportExcel"></div>
</div>
<div class="epor" align="center">
<div class="epor-btn" @click="exportExcel"></div>
</div>
</div>
</v-modal>
</div>
</template>
<script>
import getApiData from "./getApiData"
import tableEvent from "./tableEvent"
import getApiData from "./getApiData";
import tableEvent from "./tableEvent";
export default {
name: "IndustryDataExport",
data() {
return {
quDao: [],
quDaoAll: "全部",
qdIndeterminate:true,
qdCheckAll: false,
qgIndeterminate: true,
qgCheckAll: false,
qingGan: [],
crisis: [],
value3: [],
@ -103,7 +114,7 @@ export default {
sQuDao: "",
sBrand: "",
sSeriesName: "",
iTimeType: 0
iTimeType: 0,
},
modalObj: {
title: "导出选项",
@ -154,20 +165,20 @@ export default {
selectedRowKeys: "",
secIds: [],
execlForm: {
action: "toExcel",
sFileName: "",
sCheckedIds: "",
iNum: "",
sField: ""
}
action: "toExcel",
sFileName: "",
sCheckedIds: "",
iNum: "",
sField: "",
},
};
},
created() {
this.initDoc()
this.initDoc();
},
methods: {
...getApiData,
...tableEvent
...tableEvent,
},
};
</script>
@ -209,19 +220,19 @@ export default {
}
}
.epor {
width: 100%;
height: 80px;
.epor-btn {
width: 480px;
width: 100%;
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;
}
.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>

@ -1,7 +1,7 @@
/*
* @Author: your name
* @Date: 2021-10-27 15:29:37
* @LastEditTime: 2021-10-27 19:37:22
* @LastEditTime: 2021-10-28 10:36:57
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: /data-show/src/views/IndustryDataExport/tableEvent.js
@ -13,7 +13,7 @@ function rowSelection(that) {
that.selectedRowKeys = selectedRowKeys.toString();
that.selectedRows = selectedRows;
that.secIds = selectedRowKeys;
},
// onSelect: (record, selected, selectedRows) => {
// console.log(record, selected, selectedRows);
@ -23,7 +23,7 @@ function rowSelection(that) {
// },
}
}
import {getExcel} from "@/api/comm"
import { getExcel } from "@/api/comm"
export default {
// 初始化页面
initDoc() {
@ -69,8 +69,12 @@ export default {
onChange(val, type) {
this.noClick = true;
if (type === "quDao") {
this.qdIndeterminate = !!this.quDao.length && this.quDao.length < this.plainOptions.length;
this.qdCheckAll = this.quDao.length === this.plainOptions.length;
this.form.sQuDao = this.quDao.toString();
} else if (type === "qingGan") {
this.qgIndeterminate = !!this.qingGan.length && this.qingGan.length < this.plainOptions3.length;
this.qgCheckAll = this.qingGan.length === this.plainOptions3.length;
this.doFormQS(this.qingGan);
}
this.form.iPageIndex = 1;
@ -83,18 +87,18 @@ export default {
fileTypeChange(val = []) {
let obj = {};
this.plainOptions4.forEach(ele => {
if(val.includes(ele.value)) {
obj[ele.value] = 1;
} else {
obj[ele.value] = 0;
}
if (val.includes(ele.value)) {
obj[ele.value] = 1;
} else {
obj[ele.value] = 0;
}
});
this.execlForm.sField = JSON.stringify(obj);
},
// 导出弹框
handlerExport() {
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.iNum = this.secIds.length;
this.modalObj.visible = true;
@ -178,22 +182,61 @@ export default {
// 导出时将对象合并
mergeForm() {
let wKey = ['action', 'iPageIndex', 'iPageSize'];
for(let key in this.form) {
if(!wKey.includes(key)) {
for (let key in this.form) {
if (!wKey.includes(key)) {
this.execlForm[key] = this.form[key]
}
}
},
// 导出数据
exportExcel() {
if(this.execlForm.iNum) {
if (this.execlForm.iNum) {
this.mergeForm();
getExcel(this.execlForm).then(() => {
this.$notification.open({
message: `数据生成中`,
description: '请前往个人中心查看下载进度',
placement:'bottomRight',
});
placement: 'bottomRight',
});
})
}
},
// 点击渠道全部的效果
onCheckAllChangeQd(e) {
let arr = [];
this.plainOptions.forEach(ele => {
let value = ele.value;
arr.push(value)
})
Object.assign(this, {
quDao: e.target.checked ? arr : [],
qdIndeterminate: false,
qdCheckAll: e.target.checked,
});
this.form.sQuDao = this.quDao.toString();
this.form.iPageIndex = 1;
this.pagination.current = 1;
Promise.all([this.getList(), this.getTable()]).then(() => {
this.noClick = false;
});
},
// 点击调性全部的方法
onCheckAllChangeQg(e) {
let arr = [];
this.plainOptions3.forEach(ele => {
let value = ele.value;
arr.push(value)
})
Object.assign(this, {
qingGan: e.target.checked ? arr : [],
qgIndeterminate: false,
qgCheckAll: e.target.checked,
});
this.doFormQS(this.qingGan);
this.form.iPageIndex = 1;
this.pagination.current = 1;
Promise.all([this.getList(), this.getTable()]).then(() => {
this.noClick = false;
});
}
}

Loading…
Cancel
Save