|
@@ -47,16 +47,29 @@
|
|
|
:columns="columns"
|
|
|
:data-source="equipmentData"
|
|
|
:pagination="false">
|
|
|
+ <!-- 设备状态 -->
|
|
|
+ <template slot="onlineFlag" slot-scope="text, record">
|
|
|
+ <span :class="record.onlineFlag==0 ? 'red' : record.onlineFlag==1 ? 'green' : ''">{{ record.onlineFlag == 0 ? '离线' : record.onlineFlag == 1 ? '在线' : '--' }}</span>
|
|
|
+ </template>
|
|
|
+ <!-- 投放情况 -->
|
|
|
+ <template slot="situation" slot-scope="text, record">
|
|
|
+ [{{ record.boxOnePercent ? record.boxOnePercent + '%' : '--' }}] --
|
|
|
+ [{{ record.boxTwoPercent ? record.boxTwoPercent + '%' : '--' }}] -
|
|
|
+ [{{ record.boxThreePercent ? record.boxThreePercent + '%' : '--' }}] -
|
|
|
+ [{{ record.boxFourPercent ? record.boxFourPercent + '%' : '--' }}] -
|
|
|
+ [{{ record.boxFivePercent ? record.boxFivePercent + '%' : '--' }}]
|
|
|
+ </template>
|
|
|
<!-- 箱体类型 -->
|
|
|
<template slot="type" slot-scope="record">
|
|
|
<a-select
|
|
|
id="equipment-type"
|
|
|
- allowClear
|
|
|
placeholder="请选择箱体类型"
|
|
|
style="width: 100%;"
|
|
|
- @change="typeChange">
|
|
|
- <a-select-option v-for="(item,index) in typeList" :key="index" :value="item.value">
|
|
|
- {{ item.value }}
|
|
|
+ v-model="record.deviceTypeNo"
|
|
|
+ :disabled="record.state == 1"
|
|
|
+ @change="typeChange($event, record)">
|
|
|
+ <a-select-option v-for="(item,index) in record.deviceTypeList" :key="index" :value="item.deviceTypeNo">
|
|
|
+ {{ item.name }}
|
|
|
</a-select-option>
|
|
|
</a-select>
|
|
|
</template>
|
|
@@ -66,7 +79,7 @@
|
|
|
checkedChildren="启用"
|
|
|
unCheckedChildren="禁用"
|
|
|
id="equipment-changeFlagHandle"
|
|
|
- v-model="record.workStatus == 1 ? true : false"
|
|
|
+ v-model="record.state == 1 ? true : false"
|
|
|
@change="changeFlagHandle(record)"
|
|
|
/>
|
|
|
</template>
|
|
@@ -84,7 +97,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { deviceEnable, deviceListQuery, deviceFindDevice } from '@/api/device'
|
|
|
+import { deviceEnable, deviceListQuery, deviceFindDevice, deviceUpdateDeviceType } from '@/api/device'
|
|
|
import { stationBind, stationUnBind } from '@/api/station'
|
|
|
import { deviceTypeListQuery } from '@/api/boxSetting'
|
|
|
|
|
@@ -112,9 +125,9 @@ export default {
|
|
|
isFocus: false, // 搜索框是否获取焦点
|
|
|
columns: [
|
|
|
{ title: '序号', dataIndex: 'no', width: 60, align: 'center' },
|
|
|
- { title: '设备编号', dataIndex: 'equipmentNo', width: 100, align: 'center' },
|
|
|
- { title: '设备状态', dataIndex: 'equipmentStatus', width: 150, align: 'center' },
|
|
|
- { title: '投放情况', dataIndex: 'putIn', width: 150, align: 'center' },
|
|
|
+ { title: '设备编号', dataIndex: 'srcDeviceCode', width: 100, align: 'center' },
|
|
|
+ { title: '设备状态', scopedSlots: { customRender: 'onlineFlag' }, width: 150, align: 'center' },
|
|
|
+ { title: '投放情况', scopedSlots: { customRender: 'situation' }, width: 150, align: 'center' },
|
|
|
{ title: '箱体类型', scopedSlots: { customRender: 'type' }, width: 150, align: 'center' },
|
|
|
{ title: '工作状态', scopedSlots: { customRender: 'workStatus' }, width: 150, align: 'center' },
|
|
|
{ title: '操作', scopedSlots: { customRender: 'action' }, width: 80, align: 'center' }
|
|
@@ -127,12 +140,14 @@ export default {
|
|
|
// 已绑设备
|
|
|
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
|
|
|
+ this.equipmentData.map((item, index) => {
|
|
|
+ item.deviceTypeList = this.setDeviceType(item.boxNum)
|
|
|
+ })
|
|
|
} else {
|
|
|
this.equipmentData = []
|
|
|
}
|
|
@@ -141,12 +156,24 @@ export default {
|
|
|
// 箱体类型下拉数据
|
|
|
getDeviceType () {
|
|
|
deviceTypeListQuery({}).then(res => {
|
|
|
- console.log(res)
|
|
|
if (res.status == 200) {
|
|
|
-
|
|
|
+ this.typeList = res.data
|
|
|
+ } else {
|
|
|
+ this.typeList = []
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ // 处理每个设备所对应的箱体类型
|
|
|
+ setDeviceType (boxNum) {
|
|
|
+ const arr = []
|
|
|
+ let j = 0
|
|
|
+ for (const i in this.typeList) {
|
|
|
+ if (this.typeList[i].boxNum == boxNum) {
|
|
|
+ arr[j++] = this.typeList[i]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return arr
|
|
|
+ },
|
|
|
// 搜索设备
|
|
|
onSearch (value) {
|
|
|
if (value) {
|
|
@@ -204,8 +231,13 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
// 箱体类型 change
|
|
|
- typeChange (val) {
|
|
|
- console.log(val)
|
|
|
+ typeChange (deviceTypeNo, record) {
|
|
|
+ deviceUpdateDeviceType({ id: record.id, deviceTypeNo: deviceTypeNo }).then(res => {
|
|
|
+ console.log(res)
|
|
|
+ if (res.status == 200) {
|
|
|
+ this.$message.success(res.message)
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
// 更改启用禁用状态
|
|
|
changeFlagHandle (record) {
|
|
@@ -216,7 +248,7 @@ export default {
|
|
|
deviceEnable(_data).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
this.$message.success(res.message)
|
|
|
- this.$refs.table.refresh()
|
|
|
+ this.getDevice()
|
|
|
}
|
|
|
})
|
|
|
}
|
|
@@ -234,8 +266,8 @@ export default {
|
|
|
},
|
|
|
networkId (newValue, oldValue) {
|
|
|
if (this.isShow && newValue) {
|
|
|
- this.getDevice()
|
|
|
this.getDeviceType()
|
|
|
+ this.getDevice()
|
|
|
}
|
|
|
}
|
|
|
}
|