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

@ -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-10-27 15:53:06 * @LastEditTime: 2021-10-28 10:28:34
* @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
@ -39,7 +39,10 @@ export default {
this.getData(1) this.getData(1)
.then((res) => { .then((res) => {
let data = res.data1; let data = res.data1;
let x = this.quDaoAll.replace(/\(.*?\)/g, "");
this.quDaoAll = x + "(" + data[0] + ")";
let arr = [...this.plainOptions]; let arr = [...this.plainOptions];
data.splice(0,1);
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
let label = arr[i].label || ""; let label = arr[i].label || "";
let str = label.replace(/\(.*?\)/g, ""); let str = label.replace(/\(.*?\)/g, "");
@ -96,11 +99,14 @@ export default {
let data = res.data; let data = res.data;
let arr = []; let arr = [];
data.forEach((ele) => { data.forEach((ele) => {
let obj = { let obj = null;
label: ele.value, if(ele.key != -1) {
value: ele.key, obj = {
}; label: ele.value,
arr.push(obj); value: ele.key,
};
arr.push(obj);
}
}); });
this.plainOptions = arr; this.plainOptions = arr;
resolve(arr); resolve(arr);
@ -118,11 +124,13 @@ export default {
let data = res.data; let data = res.data;
let arr = []; let arr = [];
data.forEach((ele) => { data.forEach((ele) => {
let obj = { if(ele.key != -1) {
label: ele.value, let obj = {
value: ele.key, label: ele.value,
}; value: ele.key,
arr.push(obj); };
arr.push(obj);
}
}); });
this.plainOptions1 = arr; this.plainOptions1 = arr;
resolve(arr); resolve(arr);

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

@ -1,7 +1,7 @@
/* /*
* @Author: your name * @Author: your name
* @Date: 2021-10-27 15:29:37 * @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 * @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
@ -23,7 +23,7 @@ function rowSelection(that) {
// }, // },
} }
} }
import {getExcel} from "@/api/comm" import { getExcel } from "@/api/comm"
export default { export default {
// 初始化页面 // 初始化页面
initDoc() { initDoc() {
@ -69,8 +69,12 @@ export default {
onChange(val, type) { onChange(val, type) {
this.noClick = true; this.noClick = true;
if (type === "quDao") { 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(); this.form.sQuDao = this.quDao.toString();
} else if (type === "qingGan") { } 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.doFormQS(this.qingGan);
} }
this.form.iPageIndex = 1; this.form.iPageIndex = 1;
@ -83,18 +87,18 @@ export default {
fileTypeChange(val = []) { fileTypeChange(val = []) {
let obj = {}; let obj = {};
this.plainOptions4.forEach(ele => { this.plainOptions4.forEach(ele => {
if(val.includes(ele.value)) { if (val.includes(ele.value)) {
obj[ele.value] = 1; obj[ele.value] = 1;
} else { } else {
obj[ele.value] = 0; obj[ele.value] = 0;
} }
}); });
this.execlForm.sField = JSON.stringify(obj); this.execlForm.sField = JSON.stringify(obj);
}, },
// 导出弹框 // 导出弹框
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.secIds.toString();
this.execlForm.iNum = this.secIds.length; this.execlForm.iNum = this.secIds.length;
this.modalObj.visible = true; this.modalObj.visible = true;
@ -178,22 +182,61 @@ export default {
// 导出时将对象合并 // 导出时将对象合并
mergeForm() { mergeForm() {
let wKey = ['action', 'iPageIndex', 'iPageSize']; let wKey = ['action', 'iPageIndex', 'iPageSize'];
for(let key in this.form) { for (let key in this.form) {
if(!wKey.includes(key)) { if (!wKey.includes(key)) {
this.execlForm[key] = this.form[key] this.execlForm[key] = this.form[key]
} }
} }
}, },
// 导出数据
exportExcel() { exportExcel() {
if(this.execlForm.iNum) { if (this.execlForm.iNum) {
this.mergeForm(); this.mergeForm();
getExcel(this.execlForm).then(() => { getExcel(this.execlForm).then(() => {
this.$notification.open({ this.$notification.open({
message: `数据生成中`, message: `数据生成中`,
description: '请前往个人中心查看下载进度', 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