Browse Source

智能查询加标签,导出功能

dlt_feature_0615
mk 2 years ago
parent
commit
8bec14ca6b
  1. 102
      src/views/modules/shequ/chaxun.vue

102
src/views/modules/shequ/chaxun.vue

@ -44,19 +44,37 @@
{{ smatrFlag ? "关闭智能查询" : "智能查询" }}
</div> -->
</div>
<div class="rules_box" >
<el-tag
v-for="item in hotTagList"
:key="item.label"
:type="item.label"
effect="plain" @click="handelClickTag(item.label)" style="margin-right: 10px;cursor: pointer;">
{{ item.label }}
</el-tag>
</div>
<p v-show="smatrFlag && searchStatus == 'ing'" class="rules_box">
已显示{{searchData.searchKey}}的搜索结果如不满足需求
<el-button type="text" @click="handleClickEditRules"
>请点击此处调整</el-button
>
</p>
</div>
</div>
<div class="m-box" v-if="searchStatus == 'ing'">
<div
class="m-tb"
v-if="
<div class="header_btn">
<el-button
@click="handleExport"
type="primary"
size="small"
class="diy-button--white el-button--default"
>导出</el-button
>
</div>
<div v-if="
searchData.type == 'jumin' &&
searchData.searchKey != '' &&
searchStatus == 'ing'
@ -333,13 +351,10 @@
<script>
import { requestPost } from "@/js/dai/request";
import { mapGetters } from "vuex";
import nextTick from "dai-js/tools/nextTick";
import getQueryPara from "dai-js/modules/getQueryPara";
import resiInfo from "@/views/modules/cpts/resi/info";
import houseInfo from "@/views/modules/cpts/house/info";
import smatrRules from "./cpts/smatr-rules.vue";
import { requestGet } from "../../../js/dai/request";
import { addDynamicRoute } from '@/router'
import axios from "axios";
export default {
components: {
@ -466,6 +481,8 @@ export default {
rulesData: [],
childrenRulesData: [],
hotTagList:[],
};
},
computed: {
@ -484,11 +501,64 @@ export default {
},
},
activated() {
this.getApiData();
this.firstSearch();
this.getHotResidentSearch()
},
methods: {
async handleExport() {
const url = this.searchData.type === 'fangwu'?"/actual/base/communityHouse/houseSearchExport":'/actual/base/residentBaseInfo/residentSearchExport';
axios({
url: window.SITE_CONFIG["apiURL"] + url,
method: "post",
data: {
searchKey:this.searchData.searchKey
},
responseType: "blob",
})
.then((res) => {
let fileName = window.decodeURI(
res.headers["content-disposition"].split(";")[1].split("=")[1]
);
console.log("filename", fileName);
let blob = new Blob([res.data], {
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
});
var url = window.URL.createObjectURL(blob);
var aLink = document.createElement("a");
aLink.style.display = "none";
aLink.href = url;
aLink.setAttribute("download", fileName);
document.body.appendChild(aLink);
aLink.click();
document.body.removeChild(aLink); //
window.URL.revokeObjectURL(url); //blob
})
.catch((err) => {
return this.$message.error("网络错误");
});
},
handelClickTag(label){
this.searchData.searchKey = label;
this.handleClickSearchBtn();
},
async getHotResidentSearch(){
let url = '/actual/base/residentBaseInfo/hotResidentSearch'
let {code,data,msg} = await requestPost(url)
if(code === 0){
this.hotTagList = data
}else{
console.log(msg);
}
},
async getHotHouseSearch(){
let url = '/actual/base/communityHouse/hotHouseSearch'
let {code,data,msg} = await requestPost(url)
if(code === 0){
this.hotTagList = data
}else{
console.log(msg);
}
},
firstSearch() {
this.searchData.searchKey = localStorage.getItem("homeSearchKey") || "";
this.searchData.type = localStorage.getItem("homeSearchType") || "";
@ -636,7 +706,6 @@ export default {
}
},
getApiData() {},
async getSearchJumin() {
// "/actual/base/residentBaseInfo/communitySearch"
@ -719,11 +788,13 @@ export default {
this.getRulesList();
},
handelClickTab(type) {
console.log(type);
if(type === 'jumin'){
this.getHotResidentSearch()
}else{
this.getHotHouseSearch()
}
this.searchData.type = type;
this.handleClickSearchBtn();
// this.searchData.searchKey = ''
},
dialogCancle() {
this.showSmatrForm = false;
@ -782,7 +853,7 @@ export default {
.m-search {
box-sizing: border-box;
padding: 40px 80px;
padding: 20px 80px;
margin-bottom: 16px;
background-size: 100%;
@ -947,4 +1018,7 @@ export default {
margin: 15px auto 0;
}
}
.header_btn{
margin-bottom: 10px;
}
</style>

Loading…
Cancel
Save