|
|
@@ -39,9 +39,25 @@
|
|
|
maxlength="17"
|
|
|
clearable
|
|
|
/>
|
|
|
+ <span class="c-grid-form__label required">经度:</span>
|
|
|
+ <div class="l-flex--row c-grid-form__option">
|
|
|
+ <el-input
|
|
|
+ v-model.trim="currObj.longitude"
|
|
|
+ class="l-flex__fill c-sibling-item"
|
|
|
+ placeholder="-180 ~ +180"
|
|
|
+ maxlength="13"
|
|
|
+ />
|
|
|
+ <span class="c-sibling-item far c-grid-form__label required">纬度:</span>
|
|
|
+ <el-input
|
|
|
+ v-model.trim="currObj.latitude"
|
|
|
+ class="l-flex__fill c-sibling-item"
|
|
|
+ placeholder="-90 ~ +90"
|
|
|
+ maxlength="12"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
<span class="c-grid-form__label required">地址:</span>
|
|
|
<el-input
|
|
|
- v-model="currObj.address"
|
|
|
+ v-model.trim="currObj.address"
|
|
|
type="textarea"
|
|
|
maxlength="100"
|
|
|
:rows="3"
|
|
|
@@ -67,7 +83,11 @@ import {
|
|
|
deactivateDevice,
|
|
|
getProducts
|
|
|
} from '@/api/device'
|
|
|
-import { validMAC } from '@/utils/validate'
|
|
|
+import {
|
|
|
+ validMAC,
|
|
|
+ validLongitude,
|
|
|
+ validLatitude
|
|
|
+} from '@/utils/validate'
|
|
|
import { bind as bindDevice } from '@/api/external'
|
|
|
|
|
|
export default {
|
|
|
@@ -139,10 +159,10 @@ export default {
|
|
|
: '未激活'
|
|
|
}
|
|
|
}, on: this.onTagClick },
|
|
|
- { type: 'invoke', width: 240, render: [
|
|
|
- { label: '绑定设备', render ({ empty }) { return !empty }, on: this.onBindDevice },
|
|
|
+ { type: 'invoke', width: 280, render: [
|
|
|
{ label: '查看', render ({ empty }) { return !empty }, on: this.onViewDevice },
|
|
|
{ label: '添加备份', render ({ isMaster }) { return isMaster }, on: this.onAddSubDevice },
|
|
|
+ { label: '绑定摄像头', render ({ empty }) { return !empty }, on: this.onBindDevice },
|
|
|
{ label: '删除', render ({ empty }) { return !empty }, on: this.onDelDevice }
|
|
|
] }
|
|
|
]
|
|
|
@@ -193,6 +213,8 @@ export default {
|
|
|
productId: this.$master?.productId,
|
|
|
serialNumber: '',
|
|
|
mac: '',
|
|
|
+ longitude: '',
|
|
|
+ latitude: '',
|
|
|
address: '',
|
|
|
tenant: this.group.path
|
|
|
}
|
|
|
@@ -257,6 +279,20 @@ export default {
|
|
|
})
|
|
|
return false
|
|
|
}
|
|
|
+ if (!validLongitude(item.longitude)) {
|
|
|
+ this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: '经度格式错误,-180 ~ +180'
|
|
|
+ })
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (!validLatitude(item.latitude)) {
|
|
|
+ this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: '纬度格式错误,-90 ~ +90'
|
|
|
+ })
|
|
|
+ return false
|
|
|
+ }
|
|
|
return true
|
|
|
},
|
|
|
onViewDevice (item) {
|
|
|
@@ -339,12 +375,10 @@ export default {
|
|
|
this.$refs.bindDeviceDialog.show()
|
|
|
},
|
|
|
onBindDeviceChoosen ({ value, done }) {
|
|
|
- console.log(bindDevice)
|
|
|
this.$confirm(
|
|
|
- `确定绑定设备 ?`,
|
|
|
+ `绑定 ${[null, 'LED屏画面监测摄像头', '人流量监测摄像头'][value.cameraType]} ${value.name} ?`,
|
|
|
{ type: 'warning' }
|
|
|
).then(() => {
|
|
|
- console.log(bindDevice)
|
|
|
bindDevice(this.$device.id, value.deviceType, value.id).then(done)
|
|
|
})
|
|
|
}
|