|
@@ -24,10 +24,10 @@
|
|
<a-card class="search-sub" :bordered="false">
|
|
<a-card class="search-sub" :bordered="false">
|
|
<div class="noData" v-if="noData==1" style="text-align: center;">未查询到结果</div>
|
|
<div class="noData" v-if="noData==1" style="text-align: center;">未查询到结果</div>
|
|
<div class="search-sub-item" v-if="resultData && isFocus">
|
|
<div class="search-sub-item" v-if="resultData && isFocus">
|
|
- <p>{{ resultData.name }}</p>
|
|
|
|
|
|
+ <p>{{ resultData.srcDeviceCode }}</p>
|
|
<a-button
|
|
<a-button
|
|
id="equipment-unbind"
|
|
id="equipment-unbind"
|
|
- v-if="!resultData.params"
|
|
|
|
|
|
+ v-if="resultData.bindingFlag == 0"
|
|
type="primary"
|
|
type="primary"
|
|
ghost
|
|
ghost
|
|
size="small"
|
|
size="small"
|
|
@@ -84,7 +84,10 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
-import { deviceEnable } from '@/api/device'
|
|
|
|
|
|
+import { deviceEnable, deviceListQuery, deviceFindDevice } from '@/api/device'
|
|
|
|
+import { stationBind, stationUnBind } from '@/api/station'
|
|
|
|
+import { deviceTypeListQuery } from '@/api/boxSetting'
|
|
|
|
+
|
|
export default {
|
|
export default {
|
|
name: 'EquipmentModal',
|
|
name: 'EquipmentModal',
|
|
props: {
|
|
props: {
|
|
@@ -95,6 +98,10 @@ export default {
|
|
networkId: {
|
|
networkId: {
|
|
type: [Number, String],
|
|
type: [Number, String],
|
|
default: ''
|
|
default: ''
|
|
|
|
+ },
|
|
|
|
+ networkNo: {
|
|
|
|
+ type: String,
|
|
|
|
+ default: ''
|
|
}
|
|
}
|
|
},
|
|
},
|
|
data () {
|
|
data () {
|
|
@@ -112,49 +119,54 @@ export default {
|
|
{ title: '工作状态', scopedSlots: { customRender: 'workStatus' }, width: 150, align: 'center' },
|
|
{ title: '工作状态', scopedSlots: { customRender: 'workStatus' }, width: 150, align: 'center' },
|
|
{ title: '操作', scopedSlots: { customRender: 'action' }, width: 80, align: 'center' }
|
|
{ title: '操作', scopedSlots: { customRender: 'action' }, width: 80, align: 'center' }
|
|
],
|
|
],
|
|
- equipmentData: [
|
|
|
|
- { id: 1, no: 1, equipmentNo: 'x13132', equipmentStatus: '1', putIn: '10%-34%-0%-98%', type: '咸阳二代新箱体', workStatus: '1' },
|
|
|
|
- { id: 2, no: 2, equipmentNo: 'x23132', equipmentStatus: '1', putIn: '10%-34%-0%-98%', type: '咸阳二代新箱体', workStatus: '1' },
|
|
|
|
- { id: 3, no: 3, equipmentNo: 'x33132', equipmentStatus: '1', putIn: '10%-34%-0%-98%', type: '咸阳二代新箱体', workStatus: '2' },
|
|
|
|
- { id: 4, no: 4, equipmentNo: 'x43132', equipmentStatus: '1', putIn: '10%-34%-0%-98%', type: '咸阳二代新箱体', workStatus: '1' }
|
|
|
|
- ],
|
|
|
|
|
|
+ equipmentData: [],
|
|
typeList: [] // 箱体类型
|
|
typeList: [] // 箱体类型
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
- // 获取详情
|
|
|
|
- getDetails () {},
|
|
|
|
|
|
+ // 已绑设备
|
|
|
|
+ getDevice () {
|
|
|
|
+ deviceListQuery({ stationNo: this.networkNo }).then(res => {
|
|
|
|
+ console.log(res)
|
|
|
|
+ if (res.status == 200) {
|
|
|
|
+ res.data.map((item, index) => {
|
|
|
|
+ item.no = index + 1
|
|
|
|
+ })
|
|
|
|
+ this.equipmentData = res.data
|
|
|
|
+ } else {
|
|
|
|
+ this.equipmentData = []
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ // 箱体类型下拉数据
|
|
|
|
+ getDeviceType () {
|
|
|
|
+ deviceTypeListQuery({}).then(res => {
|
|
|
|
+ console.log(res)
|
|
|
|
+ if (res.status == 200) {
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
// 搜索设备
|
|
// 搜索设备
|
|
onSearch (value) {
|
|
onSearch (value) {
|
|
if (value) {
|
|
if (value) {
|
|
- // findVsDevice({ id: value }).then(res => {
|
|
|
|
- // if (res.status == 200) {
|
|
|
|
- // if (res.data) {
|
|
|
|
- this.noData = 2
|
|
|
|
- // this.resultData = res.data
|
|
|
|
- // } else {
|
|
|
|
- // this.noData = 1
|
|
|
|
- // this.resultData = null
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- // })
|
|
|
|
|
|
+ deviceFindDevice({ srcDeviceCode: value }).then(res => {
|
|
|
|
+ if (res.status == 200) {
|
|
|
|
+ if (res.data) {
|
|
|
|
+ this.noData = 2
|
|
|
|
+ this.resultData = res.data
|
|
|
|
+ } else {
|
|
|
|
+ this.noData = 1
|
|
|
|
+ this.resultData = null
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ })
|
|
} else {
|
|
} else {
|
|
this.noData = 0
|
|
this.noData = 0
|
|
this.resultData = null
|
|
this.resultData = null
|
|
this.isFocus = false
|
|
this.isFocus = false
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- // 门店已绑设备
|
|
|
|
- getStoreEquipment (id) {
|
|
|
|
- // findStoreVsDevice({ code: id }).then(res => {
|
|
|
|
- // if (res.status == 200) {
|
|
|
|
- // res.data.map((item, ind) => {
|
|
|
|
- // item.no = ind + 1
|
|
|
|
- // })
|
|
|
|
- // this.equipmentData = res.data
|
|
|
|
- // }
|
|
|
|
- // })
|
|
|
|
- },
|
|
|
|
// 解绑
|
|
// 解绑
|
|
onUnbundling (item) {
|
|
onUnbundling (item) {
|
|
const _this = this
|
|
const _this = this
|
|
@@ -163,12 +175,12 @@ export default {
|
|
centered: true,
|
|
centered: true,
|
|
content: '确定解绑该设备吗?',
|
|
content: '确定解绑该设备吗?',
|
|
onOk () {
|
|
onOk () {
|
|
- // unbindVsDevice({ id: item.id }).then(res => {
|
|
|
|
- // if (res.status == 200) {
|
|
|
|
- // _this.$message.success(res.message)
|
|
|
|
- // _this.getStoreEquipment(_this.storeCode)
|
|
|
|
- // }
|
|
|
|
- // })
|
|
|
|
|
|
+ stationUnBind({ srcDeviceCode: item.srcDeviceCode }).then(res => {
|
|
|
|
+ if (res.status == 200) {
|
|
|
|
+ _this.$message.success(res.message)
|
|
|
|
+ _this.getDevice()
|
|
|
|
+ }
|
|
|
|
+ })
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
},
|
|
@@ -180,15 +192,14 @@ export default {
|
|
centered: true,
|
|
centered: true,
|
|
content: '确定要绑定该设备吗?',
|
|
content: '确定要绑定该设备吗?',
|
|
onOk () {
|
|
onOk () {
|
|
- // 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)
|
|
|
|
- // }
|
|
|
|
- // })
|
|
|
|
|
|
+ stationBind({ srcDeviceCode: item.srcDeviceCode, stationNo: _this.networkNo }).then(res => {
|
|
|
|
+ if (res.status == 200) {
|
|
|
|
+ _this.$message.success(res.message)
|
|
|
|
+ _this.resultData = null
|
|
|
|
+ _this.isFocus = false
|
|
|
|
+ _this.getDevice()
|
|
|
|
+ }
|
|
|
|
+ })
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
},
|
|
@@ -200,7 +211,7 @@ export default {
|
|
changeFlagHandle (record) {
|
|
changeFlagHandle (record) {
|
|
const _data = {
|
|
const _data = {
|
|
id: record.id,
|
|
id: record.id,
|
|
- flag: record.state == 1 ? '0' : '1'
|
|
|
|
|
|
+ state: record.state == 1 ? '0' : '1'
|
|
}
|
|
}
|
|
deviceEnable(_data).then(res => {
|
|
deviceEnable(_data).then(res => {
|
|
if (res.status == 200) {
|
|
if (res.status == 200) {
|
|
@@ -223,7 +234,8 @@ export default {
|
|
},
|
|
},
|
|
networkId (newValue, oldValue) {
|
|
networkId (newValue, oldValue) {
|
|
if (this.isShow && newValue) {
|
|
if (this.isShow && newValue) {
|
|
- this.getDetails()
|
|
|
|
|
|
+ this.getDevice()
|
|
|
|
+ this.getDeviceType()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|