|
|
@@ -155,12 +155,15 @@ export default {
|
|
|
productSelectSchema,
|
|
|
schema: {
|
|
|
keepalive: true,
|
|
|
- listeners: {
|
|
|
- 'row-click': __SUB_DEVICE__ ? this.onRowClick : null
|
|
|
+ props: {
|
|
|
+ size: 'small'
|
|
|
},
|
|
|
+ // listeners: {
|
|
|
+ // 'row-click': __SUB_DEVICE__ ? this.onRowClick : null
|
|
|
+ // },
|
|
|
list: this.getDevicesByTenant,
|
|
|
transform: this.transform,
|
|
|
- transformData: __SUB_DEVICE__ && this.transformTableData,
|
|
|
+ // transformData: __SUB_DEVICE__ && this.transformTableData,
|
|
|
buttons: [
|
|
|
{ type: 'add', on: this.onAddDevice }
|
|
|
],
|
|
|
@@ -175,17 +178,19 @@ export default {
|
|
|
{ key: 'name', type: 'search', placeholder: '设备名称' }
|
|
|
],
|
|
|
cols: [
|
|
|
- { type: 'refresh', render: __SUB_DEVICE__
|
|
|
- ? (data, h) => data.isMaster
|
|
|
- ? h('i', {
|
|
|
- staticClass: `o-expand-icon u-pointer ${data.loading ? 'el-icon-loading' : 'el-icon-arrow-right'}`,
|
|
|
- class: { expand: data.expand }
|
|
|
- })
|
|
|
- : null
|
|
|
- : null },
|
|
|
- __SUB_DEVICE__
|
|
|
- ? { label: '设备名称', render: (data, h) => data.empty ? h('span', { staticClass: 'u-color--info' }, '暂无备份设备') : data.name, 'min-width': 120 }
|
|
|
- : { prop: 'name', label: '设备名称', 'min-width': 120 },
|
|
|
+ // { type: 'refresh', render: __SUB_DEVICE__
|
|
|
+ // ? (data, h) => data.isMaster
|
|
|
+ // ? h('i', {
|
|
|
+ // staticClass: `o-expand-icon u-pointer ${data.loading ? 'el-icon-loading' : 'el-icon-arrow-right'}`,
|
|
|
+ // class: { expand: data.expand }
|
|
|
+ // })
|
|
|
+ // : null
|
|
|
+ // : null },
|
|
|
+ // __SUB_DEVICE__
|
|
|
+ // ? { label: '设备名称', render: (data, h) => data.empty ? h('span', { staticClass: 'u-color--info' }, '暂无备份设备') : data.name, 'min-width': 120 }
|
|
|
+ // : { prop: 'name', label: '设备名称', 'min-width': 120 },
|
|
|
+ { type: 'refresh' },
|
|
|
+ { prop: 'name', label: '设备名称', 'min-width': 120 },
|
|
|
{ label: '型号', render: (data, h) => data.empty
|
|
|
? ''
|
|
|
: h('edit-input', {
|
|
|
@@ -207,18 +212,18 @@ export default {
|
|
|
? { type: 'success', label: '在线' }
|
|
|
: { type: 'danger', label: '离线' }
|
|
|
: { type: 'warning', label: '未激活' },
|
|
|
- on: this.onTagClick },
|
|
|
+ 'size': 'sm', width: 80, on: this.onTagClick },
|
|
|
{ label: '使用情况', type: 'tag', render: ({ empty, isMaster, bound }) => empty || !isMaster
|
|
|
? null
|
|
|
: bound
|
|
|
? { type: 'success', label: '已使用' }
|
|
|
- : { type: 'primary', label: '未使用' }, on: this.onViewMesh },
|
|
|
+ : { type: 'primary', label: '未使用', ignore: true }, 'size': 'sm', width: 80, on: this.onViewMesh },
|
|
|
{ type: 'invoke', render: [
|
|
|
{ label: '配置', render: ({ isMaster }) => isMaster, on: this.onSettingDevice },
|
|
|
{ label: '替换', render: ({ isMaster }) => isMaster, on: this.onReplace },
|
|
|
- __SUB_DEVICE__ && { label: '备机', render: ({ isMaster }) => isMaster, on: this.onAddSubDevice },
|
|
|
+ // __SUB_DEVICE__ && { label: '备机', render: ({ isMaster }) => isMaster, on: this.onAddSubDevice },
|
|
|
{ label: '删除', render: ({ empty }) => !empty, on: this.onDelDevice }
|
|
|
- ].filter(Boolean), width: __SUB_DEVICE__ ? 180 : 140 }
|
|
|
+ ], width: 140 }
|
|
|
]
|
|
|
}
|
|
|
}
|
|
|
@@ -320,11 +325,12 @@ export default {
|
|
|
},
|
|
|
onSave (done) {
|
|
|
if (this.check(this.currObj)) {
|
|
|
- const { range, ...data } = this.currObj
|
|
|
+ const { mac, range, ...data } = this.currObj
|
|
|
if (this.isSub) {
|
|
|
addSubDevice(this.$master, {
|
|
|
openTime: range[0],
|
|
|
closeTime: range[1],
|
|
|
+ mac: mac.toLowerCase(),
|
|
|
...data
|
|
|
}).then(() => {
|
|
|
done()
|
|
|
@@ -334,6 +340,7 @@ export default {
|
|
|
addDevice({
|
|
|
openTime: range[0],
|
|
|
closeTime: range[1],
|
|
|
+ mac: mac.toLowerCase(),
|
|
|
...data
|
|
|
}).then(() => {
|
|
|
done()
|
|
|
@@ -342,7 +349,7 @@ export default {
|
|
|
name: this.currObj.name,
|
|
|
productId: this.currObj.productId,
|
|
|
serialNumber: this.currObj.serialNumber,
|
|
|
- mac: this.currObj.mac
|
|
|
+ mac: mac.toLowerCase()
|
|
|
})
|
|
|
})
|
|
|
}
|
|
|
@@ -384,7 +391,6 @@ export default {
|
|
|
})
|
|
|
return false
|
|
|
}
|
|
|
- item.mac = item.mac.toLowerCase()
|
|
|
if (!item.range || !item.range[0] || !item.range[1]) {
|
|
|
this.$message({
|
|
|
type: 'warning',
|
|
|
@@ -546,13 +552,14 @@ export default {
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
- if (serialNumber === this.$device.serialNumber && mac === this.$device.mac) {
|
|
|
+ const realMac = mac.toLowerCase()
|
|
|
+ if (serialNumber === this.$device.serialNumber && realMac === this.$device.mac) {
|
|
|
done()
|
|
|
return
|
|
|
}
|
|
|
- replaceDevice(this.$device.id, { serialNumber, mac }).then(() => {
|
|
|
+ replaceDevice(this.$device.id, { serialNumber, mac: realMac }).then(() => {
|
|
|
this.$device.serialNumber = serialNumber
|
|
|
- this.$device.mac = mac
|
|
|
+ this.$device.mac = realMac
|
|
|
this.$device = null
|
|
|
done()
|
|
|
})
|