<template>
|
<div class="el-dialog-search">
|
<div class="site">
|
<div style="white-space: nowrap">站点名称:</div>
|
<el-input v-model="searchSite"
|
placeholder="请输入站点名称"
|
size="small"></el-input>
|
</div>
|
<div class="site">
|
<div style="white-space: nowrap">站点编码:</div>
|
<el-input v-model="searchStcd"
|
placeholder="请输入站点编码"
|
size="small"></el-input>
|
</div>
|
<div>
|
行政区:
|
<el-select v-model="searchRegionValue"
|
size="small"
|
placeholder="请选择行政区">
|
<el-option v-for="item in searchRegionData"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value">
|
</el-option>
|
</el-select>
|
</div>
|
<div v-if="baseData">
|
类别:
|
<el-select v-model="searchKindValue"
|
size="small"
|
placeholder="请选择分类">
|
<el-option v-for="item in searchKindData"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value">
|
</el-option>
|
</el-select>
|
</div>
|
<div>
|
<el-button size="small"
|
type="primary"
|
icon="el-icon-search"
|
@click="dialogSearch">搜索</el-button>
|
<el-button size="small"
|
type="primary"
|
icon="el-icon-delete"
|
plain
|
@click="dialogSearchClear">清空</el-button>
|
</div>
|
<div>
|
<el-button type="primary"
|
size="small"
|
@click="exportExcel"
|
icon="iconfont el-icon-daochu">数据导出</el-button>
|
</div>
|
</div>
|
</template>
|
|
<script>
|
|
export default {
|
name: 'DialogSearch',
|
props: ['yjOrZc', 'yjData', 'zcData', 'baseData', 'baseDataList'],
|
data () {
|
return {
|
searchSite: '',
|
searchStcd: '',
|
searchRegionValue: '',
|
searchRegionData: [
|
{
|
value: '全部',
|
label: '全部'
|
},
|
{
|
value: '南城县',
|
label: '南城县'
|
},
|
{
|
value: '广昌县',
|
label: '广昌县'
|
},
|
{
|
value: '乐安县',
|
label: '乐安县'
|
},
|
{
|
value: '南丰县',
|
label: '南丰县'
|
},
|
{
|
value: '黎川县',
|
label: '黎川县'
|
},
|
{
|
value: '东乡区',
|
label: '东乡区'
|
},
|
{
|
value: '金溪县',
|
label: '金溪县'
|
},
|
{
|
value: '宜黄县',
|
label: '宜黄县'
|
},
|
{
|
value: '崇仁县',
|
label: '崇仁县'
|
},
|
{
|
value: '临川区',
|
label: '临川区'
|
},
|
{
|
value: '资溪县',
|
label: '资溪县'
|
}
|
],
|
searchKindValue: '',
|
searchKindData: [
|
{
|
value: '全部',
|
label: '全部'
|
},
|
{
|
value: '基本站',
|
label: '基本站'
|
},
|
{
|
value: '非基本站',
|
label: '非基本站'
|
}
|
]
|
}
|
},
|
created () {
|
this.searchSite = ''
|
this.searchStcd = ''
|
this.searchRegionValue = '全部'
|
this.searchKindValue = '全部'
|
},
|
|
mounted () {
|
},
|
methods: {
|
// dialog搜索方法
|
dialogSearch () {
|
var that = this
|
var arr = []
|
if (this.yjOrZc == 'yj') {
|
if (this.searchRegionValue == '全部') {
|
this.yjData.forEach((item) => {
|
if (
|
item.STNM &&
|
item.STNM.indexOf(this.searchSite) != -1 &&
|
item.STCD &&
|
item.STCD.indexOf(this.searchStcd) != -1 &&
|
item.ADDVNM
|
) {
|
arr.push(item)
|
}
|
})
|
} else {
|
this.yjData.forEach((item) => {
|
if (
|
item.STNM &&
|
item.STNM.indexOf(this.searchSite) != -1 &&
|
item.STCD &&
|
item.STCD.indexOf(this.searchStcd) != -1 &&
|
item.ADDVNM &&
|
item.ADDVNM.indexOf(this.searchRegionValue) != -1
|
) {
|
arr.push(item)
|
}
|
})
|
}
|
} else {
|
if (this.searchRegionValue == '全部') {
|
this.zcData.forEach((item) => {
|
if (
|
item.STNM &&
|
item.STNM.indexOf(this.searchSite) != -1 &&
|
item.STCD &&
|
item.STCD.indexOf(this.searchStcd) != -1 &&
|
item.ADDVNM
|
) {
|
arr.push(item)
|
}
|
})
|
} else {
|
this.zcData.forEach((item) => {
|
if (
|
item.STNM &&
|
item.STNM.indexOf(this.searchSite) != -1 &&
|
item.STCD &&
|
item.STCD.indexOf(this.searchStcd) != -1 &&
|
item.ADDVNM &&
|
item.ADDVNM.indexOf(this.searchRegionValue) != -1
|
) {
|
arr.push(item)
|
}
|
})
|
}
|
}
|
|
if (that.baseData == true && that.searchKindValue != '全部') {
|
var brr = []
|
|
if (that.searchKindValue == '基本站') {
|
arr.forEach(item => {
|
that.baseDataList.forEach(it => {
|
if (item.STCD == it.STCD) {
|
brr.push(item)
|
}
|
})
|
})
|
} else if (that.searchKindValue == '非基本站') {
|
arr.forEach(item => {
|
var flag = false
|
that.baseDataList.forEach(it => {
|
if (item.STCD == it.STCD) {
|
flag = true
|
}
|
})
|
|
if (flag == false) {
|
brr.push(item)
|
}
|
})
|
}
|
brr.forEach((item, index) => {
|
item.ind = index + 1
|
})
|
this.$emit('changeDialogTable', brr)
|
} else {
|
arr.forEach((item, index) => {
|
item.ind = index + 1
|
})
|
this.$emit('changeDialogTable', arr)
|
}
|
|
// this.tableData = arr
|
},
|
// dialog清空方法
|
dialogSearchClear () {
|
this.inputOrSelectClear()
|
if (this.yjOrZc == 'yj') {
|
this.$emit('changeDialogTable', this.yjData)
|
} else {
|
this.$emit('changeDialogTable', this.zcData)
|
}
|
},
|
inputOrSelectClear () {
|
this.searchSite = ''
|
this.searchStcd = ''
|
this.searchRegionValue = '全部'
|
this.searchKindValue = '全部'
|
},
|
exportExcel () {
|
this.$emit('exportParent')
|
}
|
}
|
}
|
</script>
|
|
<style lang='scss'>
|
.el-dialog-search {
|
display: flex;
|
margin: 0;
|
.site {
|
display: flex;
|
}
|
& > div {
|
margin-left: 10px;
|
}
|
}
|
</style>
|