Commit e01acdc6 authored by 黄奎's avatar 黄奎

搜索页面修改

parent 5db8d457
......@@ -31,7 +31,8 @@
<el-row>
<el-col :span="24">
<el-form-item>
<el-tag v-for="(tag,index) in keyWordsArr" :key="tag" closable :type="tag" @close="closeTag(index)" style="margin-right:10px;">
<el-tag v-for="(tag,index) in keyWordsArr" :key="tag" closable :type="tag" @close="closeTag(index)"
style="margin-right:10px;">
{{tag}}
</el-tag>
</el-form-item>
......@@ -40,7 +41,7 @@
<el-row>
<el-col :span="24">
<el-form-item>
<el-button type="primary" size="small">儲存修改</el-button>
<el-button type="primary" size="small" @click="saveData()">儲存修改</el-button>
</el-form-item>
</el-col>
</el-row>
......@@ -57,38 +58,38 @@
</el-row>
<el-row>
<el-col :span="24">
<el-button type="primary" size="small" style="margin:40px 0">儲存修改</el-button>
<el-button type="primary" size="small" style="margin:40px 0" @click="saveData()">儲存修改</el-button>
</el-col>
</el-row>
</div>
</el-tab-pane>
<el-tab-pane label="供應商旅行社" name="third">
<div class="webSiteBg">
<el-button @click="setAllArea()">批次設定區域</el-button>
<el-button :disabled="chooseTAArray.length>0?false:true" @click="setTravelagencyArea(1)">批次設定區域</el-button>
<el-table ref="multipleTable" :data="PostMsg.TravelagencyList" tooltip-effect="dark" style="width: 100%"
@selection-change="handleSelectionChange">
<el-table-column type="selection" width="100px">
</el-table-column>
<el-table-column prop="IsOpenSearch" label="開放搜尋" width="100px">
<template slot-scope="scope">
<el-switch v-model="scope.row.IsOpenSearch" :active-value="1" :inactive-value="0" active-color="#13ce66"
inactive-color="#dcdfe6" @change="UpdateAdIsSearch(scope.row)"></el-switch>
<el-switch v-model="scope.row.IsOpenSearch" :active-value="1" :inactive-value="0"
active-color="#13ce66" inactive-color="#dcdfe6"></el-switch>
</template>
</el-table-column>
<el-table-column prop="AgencyName" label="旅行社" width="300px">
</el-table-column>
<el-table-column label="設定區域" width="200px">
<template slot-scope="scope">
<el-button type="primary" size="small" @click="setArea(scope.row.Id)">設定</el-button>
<el-button type="primary" size="small" @click="setTravelagencyArea(2,scope.row)">設定</el-button>
</template>
</el-table-column>
<el-table-column prop="SetArea" label="開放區域">
<template slot-scope="scope">
{{getArea(scope.row.SetArea)}}
{{getAreaName(scope.row.SetArea)}}
</template>
</el-table-column>
</el-table>
<el-button type="primary" size="small" style="margin:40px 0">儲存修改</el-button>
<el-button type="primary" size="small" style="margin:40px 0" @click="saveData()">儲存修改</el-button>
</div>
</el-tab-pane>
<el-tab-pane label="搜尋結果頁面" name="fourth">
......@@ -97,12 +98,12 @@
<el-col :span="8">
<el-form-item label="顯示類型">
<el-select v-model="PostMsg.ShowType" style="width:100%">
<el-option label="豆腐格" value="1" key="1"></el-option>
<el-option label="篩選式列表" value="2" key="2"></el-option>
<el-option label="豆腐格" :value="0" :key="0"></el-option>
<el-option label="篩選式列表" :value="1" :key="1"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" size="small" style="margin:40px 0">儲存修改</el-button>
<el-button type="primary" size="small" style="margin:40px 0" @click="saveData()">儲存修改</el-button>
</el-form-item>
</el-col>
</el-row>
......@@ -110,33 +111,51 @@
</el-tab-pane>
</el-tabs>
</el-form>
<el-dialog custom-class="w450" title="設定區域" :visible.sync="outerVisible" center>
<el-row>
<el-checkbox-group v-model="taAreaArr">
<el-col :span="6" v-for="(item,index) in areaData" :key="index" style="margin-bottom:20px;">
<el-checkbox :label="item.Id" :key="item.AreaName">{{item.AreaName}}</el-checkbox>
</el-col>
</el-checkbox-group>
</el-row>
<div slot="footer" class="dialog-footer">
<button class="hollowFixedBtn" @click="closeArea()">取消</button>
<button class="normalBtn" @click="sureTAArea()">确定</button>
</div>
</el-dialog>
</div>
</template>
<script>
export default {
data() {
return {
//是否显示弹窗
outerVisible: false,
//选项卡
activeName: 'first',
activeName: 'third',
//关键字
keywords:'',
keyWordsArr:[],
keywords: '',
keyWordsArr: [], //关键字数组
PostMsg: {
Id: 0,
ShowTitle: '',
HotWords: '',
SearchAreaIds: '',
ShowType: '',
ShowType: 0,
TravelagencyList: [],
},
tags: ['标签1','标签2'],
checkAll: false, //全选
//地区数据
areaData: [],
//总数据
dataList:[],
dataList: [],
//选中的地区
SearchAreaArr:[],
SearchAreaArr: [],
//选中的旅行社
chooseTAArray: [],
//旅行社区域
taAreaArr: [],
};
},
mounted() {
......@@ -150,30 +169,68 @@
"ws_get_GetSearchConfig", {},
res => {
if (res.data.resultCode == 1) {
console.log(res, 'resss');
var tempData = res.data.data;
if(tempData){
if (tempData) {
if (tempData.Id) {
this.PostMsg.Id = tempData.Id;
}
if(tempData.ShowTitle){
this.PostMsg.ShowTitle=tempData.ShowTitle
if (tempData.ShowTitle) {
this.PostMsg.ShowTitle = tempData.ShowTitle;
}
if (tempData.HotWords) {
this.PostMsg.HotWords = tempData.HotWords;
}
if (tempData.HotWordsList && tempData.HotWordsList.length > 0) {
this.keyWordsArr = tempData.HotWordsList;
}
if(tempData.HotWords){
this.PostMsg.HotWords=tempData.HotWords
if (tempData.SearchAreaIds) {
this.PostMsg.SearchAreaIds = tempData.SearchAreaIds;
}
if(tempData.SearchAreaIds){
this.PostMsg.SearchAreaIds=tempData.SearchAreaIds
if (tempData.SearchAreaIdsList && tempData.SearchAreaIdsList.length > 0) {
this.SearchAreaArr = tempData.SearchAreaIdsList;
}
if(tempData.ShowType){
this.PostMsg.ShowType=tempData.ShowType
if (tempData.ShowType) {
this.PostMsg.ShowType = tempData.ShowType;
}
if(tempData.TravelagencyList){
this.PostMsg.TravelagencyList=tempData.TravelagencyList
if (tempData.TravelagencyList) {
this.PostMsg.TravelagencyList = tempData.TravelagencyList;
}
}
this.keyWordsArr=this.PostMsg.HotWords.split(',');
this.SearchAreaArr = this.PostMsg.SearchAreaIds.split(',');
} else {
this.Error(res.data.message);
}
},
err => {}
);
},
//保存数据
saveData() {
//区域
var tempSearchAreaIds = "";
if (this.SearchAreaArr && this.SearchAreaArr.length > 0) {
this.SearchAreaArr.forEach(item => {
tempSearchAreaIds += item + ",";
})
this.PostMsg.SearchAreaIds = tempSearchAreaIds.substr(0, tempSearchAreaIds.length - 1);
} else {
this.PostMsg.SearchAreaIds = tempSearchAreaIds;
}
//热门关键词
var tempHotWords = "";
if (this.keyWordsArr && this.keyWordsArr.length > 0) {
this.keyWordsArr.forEach(item => {
tempHotWords += item + ",";
})
this.PostMsg.HotWords = tempHotWords.substr(0, tempHotWords.length - 1);
} else {
this.PostMsg.HotWords = tempHotWords;
}
this.apipost(
"ws_post_SetSearchConfig", this.PostMsg,
res => {
if (res.data.resultCode == 1) {
this.getData();
this.Success(res.data.message);
} else {
this.Error(res.data.message);
}
......@@ -187,7 +244,6 @@
"ws_get_GetRootArea", {},
res => {
if (res.data.resultCode == 1) {
console.log(res,'地区');
this.areaData = res.data.data;
} else {
this.Error(res.data.message);
......@@ -198,32 +254,104 @@
},
//关闭标签
closeTag(index) {
this.keyWordsArr.splice(index,1);
this.keyWordsArr.splice(index, 1);
},
//多选
handleSelectionChange(val) {
// this.selectRow = JSON.parse(JSON.stringify(val));
this.chooseTAArray = JSON.parse(JSON.stringify(val));
},
//开放搜寻
UpdateAdIsSearch(item){
//返回地区名称
getAreaName(areaIds) {
var nameStr = "";
if (areaIds) {
var tempArray = areaIds.split(",");
if (tempArray && tempArray.length > 0) {
tempArray.forEach(item => {
var areaItem = this.areaData.find(member => {
return member.Id == item;
});
if (areaItem) {
nameStr += areaItem.AreaName + "、"
}
});
}
}
if (nameStr && nameStr.length > 0) {
nameStr = nameStr.substr(0, nameStr.length - 1)
}
return nameStr;
},
//设定区域
setArea(){
//设置旅行区域
setTravelagencyArea(type, item) {
this.taAreaArr = [];
if (type == 1) {
if (this.chooseTAArray && this.chooseTAArray.length > 0) {
this.outerVisible = true;
this.chooseTAArray.forEach(subItem => {
var tempArray = subItem.SetArea.split(',');
if (tempArray && tempArray.length > 0) {
tempArray.forEach(sItem => {
//数组里面不存在
if (this.taAreaArr.indexOf(Number(sItem)) == -1) {
this.taAreaArr.push(Number(sItem));
}
});
}
});
} else {
this.Info("请选择要设置的旅行社!");
}
} else {
this.outerVisible = true;
if (item) {
if (item.SetArea) {
var tempArray = item.SetArea.split(',');
if (tempArray && tempArray.length > 0) {
tempArray.forEach(sItem => {
this.taAreaArr.push(Number(sItem));
});
}
}
this.chooseTAArray.push(item);
}
}
},
//返回地区
getArea(){
//新增关键字
addKeyWords() {
if (this.keywords != '') {
this.keyWordsArr.push(this.keywords);
this.keywords = '';
}
},
//批次设定区域
setAllArea(){
//关闭弹窗
closeArea() {
this.outerVisible = false;
},
//新增关键字
addKeyWords(){
this.keyWordsArr.push(this.keywords);
this.keywords='';
//选中区域确定
sureTAArea() {
var tempAreaIds = "";
if (this.taAreaArr && this.taAreaArr.length > 0) {
this.taAreaArr.forEach(item => {
tempAreaIds += item + ",";
});
if (tempAreaIds && tempAreaIds.length > 0) {
tempAreaIds = tempAreaIds.substr(0, tempAreaIds.length - 1);
}
}
if (this.chooseTAArray && this.chooseTAArray.length > 0) {
var jsonData = JSON.parse(JSON.stringify(this.chooseTAArray));
var that = this;
jsonData.forEach(item => {
that.PostMsg.TravelagencyList.forEach(subItem => {
if (item.AgencyId == subItem.AgencyId) {
subItem.SetArea = tempAreaIds;
}
})
});
this.chooseTAArray = [];
this.taAreaArr = [];
}
this.outerVisible = false;
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment