[fix 84048] 搜索结果以最后一次为准

This commit is contained in:
danshihao
2024-04-25 17:42:25 +08:00
parent 57f1bea434
commit 09b6457934
@@ -26,7 +26,7 @@
</a-col>
<a-col flex="220px">
<a-input class="search-input" placeholder="请输入井口名称" v-model="queryParam.wellheadName">
<span slot="suffix" class="input-search-suffix" @click="searchQuery">
<span slot="suffix" class="input-search-suffix" @click="searchQueryInput">
<img :src="require('@assets/images/icon/search-primary.png')" alt="查询">
</span>
</a-input>
@@ -433,31 +433,6 @@ export default {
align: 'center',
width: '10%'
}
// {
// title: '批量操作',
// dataIndex: 'actionBatch',
// customRender: (value, row, index) => {
// console.log(value, row, index, 'aaaaaa')
// const obj = {
// children: (
// <div>
// <a href='javascript:' class='all-alarms'></a>
// </div>
// ),
// attrs: {}
// }
// if (index === 0) {
// obj.attrs.rowSpan = this.dataSource.length
// } else {
// obj.attrs.rowSpan = 0
// }
// return obj
// },
// // scopedSlots: { customRender: 'actionBatch' },
// align: 'center',
// fixed: 'right',
// width: 100
// }
],
// 右侧表格
rightColumn: [{
@@ -533,7 +508,8 @@ export default {
{ label: '泵径', unit: 'mm', valueField: 'pumpDiameter' },
{ label: '泵效', unit: '%', valueField: 'pumpEfficiency' }
]
}
},
allOilWellList: [] // 所有油井
}
},
watch: {
@@ -557,6 +533,14 @@ export default {
this.$set(this.queryParam, 'singleWell', this.singleWellList[0].id)
this.searchQuery()
})
// 获取所有油井下拉
getWellheadList({
wellheadType: wellheadType.oil.value
}).then(res => {
if (res.success) {
this.allOilWellList = res.result || []
}
})
},
beforeDestroy () {
// 离开页面前清除定时器
@@ -569,17 +553,38 @@ export default {
searchQuery () {
const params = Object.assign({}, this.queryParam)
console.log(params)
// if (!params.singleWell && !params.wellheadName) {
// this.$message.warning('请选择油井或输入井口名称查询')
// return
// }
// 选择单井查询
// 选择的油井
if (params.singleWell) {
const singleWell = this.singleWellList.find(item => item.id === params.singleWell)
this.hasData = true
this.allData = Object.assign({}, staticData, {
wellName: singleWell.wellheadName
})
this.allData = Object.assign({}, staticData)
this.dataSource = staticTableData
setTimeout(() => {
// 加载功图计产监控
this.initProductionMonitoring(staticMonitoringChart)
}, 100)
// 每10秒请求一次实时数据
this.loadOilWellRealTimeData()
clearInterval(this.timer)
this.timer = setInterval(() => {
this.loadOilWellRealTimeData()
}, 1000 * 10)
return
}
// 置空数据,不请求实时数据
this.hasData = false
this.allData = {}
this.dataSource = []
clearInterval(this.timer)
this.timer = null
},
// 输入框的搜索
searchQueryInput () {
const params = Object.assign({}, this.queryParam)
console.log(params)
// 如果有输入的井口,返回信息,否则置空
if (params.wellheadName && this.allOilWellList.find(item => item.wellheadName === params.wellheadName)) {
this.hasData = true
this.allData = Object.assign({}, staticData)
this.dataSource = staticTableData
setTimeout(() => {
// 加载功图计产监控