|
@@ -13,14 +13,16 @@
|
|
|
id="equipment-search"
|
|
|
class="search-s"
|
|
|
allow-clear
|
|
|
- placeholder="请通过设备ID搜索"
|
|
|
+ placeholder="请通过设备国标ID搜索"
|
|
|
enter-button="查询"
|
|
|
size="large"
|
|
|
+ @blur="noData=0"
|
|
|
@focus="isFocus=true"
|
|
|
@search="onSearch"
|
|
|
/>
|
|
|
- <a-card class="search-sub" :bordered="false" v-if="resultData && isFocus">
|
|
|
- <div class="search-sub-item">
|
|
|
+ <a-card class="search-sub" :bordered="false">
|
|
|
+ <div class="noData" v-if="noData==1" style="text-align: center;">未查询到结果</div>
|
|
|
+ <div class="search-sub-item" v-if="resultData && isFocus">
|
|
|
<p>{{ resultData.name }}</p>
|
|
|
<a-button
|
|
|
id="equipment-bind"
|
|
@@ -45,7 +47,9 @@
|
|
|
:columns="columns"
|
|
|
:data-source="equipmentData"
|
|
|
:pagination="false"
|
|
|
- @expand="eqExpand">
|
|
|
+ :expandedRowKeys="expandedRowKeys"
|
|
|
+ @expand="eqExpand"
|
|
|
+ @expandedRowsChange="expandedRowsChange">
|
|
|
<div slot="expandedRowRender" slot-scope="record" style="margin: 30px 30px;">
|
|
|
<div class="eq-subTit">设备通道(机位):</div>
|
|
|
<a-table
|
|
@@ -54,7 +58,7 @@
|
|
|
size="small"
|
|
|
:rowKey="(record) => record.gbId"
|
|
|
:columns="passagewayColumns"
|
|
|
- :data-source="passagewayData"
|
|
|
+ :data-source="record.passagewayData"
|
|
|
:pagination="false">
|
|
|
<template slot="action" slot-scope="record">
|
|
|
<a-button type="link" id="equipment-edit" @click="onEdit(record)" v-hasPermission="'B_store_deviceTd_edit'">编辑</a-button>
|
|
@@ -141,9 +145,11 @@ export default {
|
|
|
deviceName: [{ required: true, message: '请输入名称', trigger: 'blur' }]
|
|
|
},
|
|
|
resultData: null, // 设备搜索结果
|
|
|
+ noData: 0,
|
|
|
isFocus: false, // 搜索框是否获取焦点
|
|
|
vsDeviceId: '', // 设备id
|
|
|
- deviceId: '' // 设备通道id
|
|
|
+ deviceId: '', // 设备通道id
|
|
|
+ expandedRowKeys: []
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
@@ -152,7 +158,12 @@ export default {
|
|
|
if (value) {
|
|
|
findVsDevice({ id: value }).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
- this.resultData = res.data
|
|
|
+ if (res.data) {
|
|
|
+ this.noData = 2
|
|
|
+ this.resultData = res.data
|
|
|
+ } else {
|
|
|
+ this.noData = 1
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
} else {
|
|
@@ -197,6 +208,7 @@ export default {
|
|
|
bindVsDevice({ storeCode: _this.storeCode, vsDeviceId: item.id }).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
_this.$message.success(res.message)
|
|
|
+ _this.expandedRowKeys = []
|
|
|
_this.resultData = null
|
|
|
_this.isFocus = false
|
|
|
_this.getStoreEquipment(_this.storeCode)
|
|
@@ -237,6 +249,10 @@ export default {
|
|
|
this.getDeviceChannels()
|
|
|
}
|
|
|
},
|
|
|
+ // 展开的行变化时触发
|
|
|
+ expandedRowsChange (expandedRows) {
|
|
|
+ this.expandedRowKeys = expandedRows
|
|
|
+ },
|
|
|
// 获取设备通道信息
|
|
|
getDeviceChannels () {
|
|
|
vsDeviceChannels({ id: this.vsDeviceId }).then(res => {
|
|
@@ -245,7 +261,16 @@ export default {
|
|
|
res.data.map((item, ind) => {
|
|
|
item.no = ind + 1
|
|
|
})
|
|
|
+ const ind = this.equipmentData.findIndex(item => item.vsDeviceId == this.vsDeviceId)
|
|
|
+ if (ind != -1) {
|
|
|
+ this.$set(this.equipmentData[ind], 'passagewayData', res.data)
|
|
|
+ }
|
|
|
this.passagewayData = res.data
|
|
|
+ } else {
|
|
|
+ const ind = this.equipmentData.findIndex(item => item.vsDeviceId == this.vsDeviceId)
|
|
|
+ if (ind != -1) {
|
|
|
+ this.$set(this.equipmentData[ind], 'passagewayData', [])
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
})
|
|
@@ -262,6 +287,7 @@ export default {
|
|
|
this.$emit('close')
|
|
|
} else {
|
|
|
// 重置信息
|
|
|
+ this.expandedRowKeys = []
|
|
|
this.resultData = null
|
|
|
this.isFocus = false
|
|
|
}
|