|
@@ -152,6 +152,22 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
+ <el-row v-if="hasAudioId">
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="上属总线转换盒" prop="trans_audio_id">
|
|
|
+ <el-select v-model="deviceModel.trans_audio_id" placeholder="上属总线转换盒" clearable>
|
|
|
+ <el-option v-for="item in audioOptions" :key="item.id" :label="item.name" :value="item.id" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="上属485转换盒" prop="trans_rs485_id">
|
|
|
+ <el-select v-model="deviceModel.trans_rs485_id" placeholder="上属485转换盒" clearable>
|
|
|
+ <el-option v-for="item in rs485Options" :key="item.id" :label="item.name" :value="item.id" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button type="primary" @click="handlerFormSubmit('deviceEditForm')">确 定</el-button>
|
|
@@ -233,7 +249,13 @@ export default {
|
|
|
],
|
|
|
role_id: [
|
|
|
{ required: true, message: '请选择适用人', trigger: 'blur' }
|
|
|
+ ],
|
|
|
+ trans_audio_id: [
|
|
|
+ { required: true, message: '请选择总线转换盒', trigger: 'blur' }
|
|
|
]
|
|
|
+ // trans_rs485_id: [
|
|
|
+ // { required: true, message: '请选择485转换盒', trigger: 'blur' }
|
|
|
+ // ]
|
|
|
},
|
|
|
partFrames: [],
|
|
|
/** 设备类型转换数组 **/
|
|
@@ -254,7 +276,10 @@ export default {
|
|
|
{ key: '模拟门灯', value: 14 },
|
|
|
{ key: '遥控器', value: 15 },
|
|
|
{ key: '信标', value: 16 },
|
|
|
- { key: '看板', value: 17 }
|
|
|
+ // { key: '看板', value: 17 },
|
|
|
+ // { key: '门禁设备', value: 18 },
|
|
|
+ // { key: '探视机', value: 19 },
|
|
|
+ { key: '485转换盒', value: 20 }
|
|
|
],
|
|
|
deviceStatusTransfer: [
|
|
|
{ key: '启用', value: 1, color: 'green' },
|
|
@@ -262,6 +287,9 @@ export default {
|
|
|
],
|
|
|
rolesOptions: [],
|
|
|
hasRoleId: false,
|
|
|
+ audioOptions: [],
|
|
|
+ rs485Options: [],
|
|
|
+ hasAudioId: false,
|
|
|
websock: null,
|
|
|
onlineDevice: []
|
|
|
}
|
|
@@ -576,11 +604,16 @@ export default {
|
|
|
/** 设备类型选中变化 **/
|
|
|
deviceTypeChange(val) {
|
|
|
if (val === 12 || val === 13 || val === 14) { // 模拟设备不需要mac地址
|
|
|
- this.deviceRules.eth_mac[0].required = false
|
|
|
+ // this.deviceRules.eth_mac[0].required = false
|
|
|
+ this.deviceRules.eth_mac[1].pattern = null
|
|
|
+ } else if (val === 15) {
|
|
|
+ this.deviceRules.eth_mac[1].pattern = null
|
|
|
} else {
|
|
|
+ this.deviceRules.eth_mac[1].pattern = /^([0-9A-Fa-f]{2}:?){6}/gi
|
|
|
this.deviceRules.eth_mac[0].required = true
|
|
|
}
|
|
|
this.hasRoleId = val === 7
|
|
|
+ this.hasAudioId = val === 12 || val === 13 || val === 14
|
|
|
},
|
|
|
/** 添加设备事件 **/
|
|
|
handleAdd() {
|
|
@@ -597,6 +630,8 @@ export default {
|
|
|
delete this.deviceModel.id
|
|
|
this.hasRoleId = false
|
|
|
this.getRoles({ page_size: 200, page_no: 1, fixedCondition: ' shop_id = -1', sort: ' role_id', dir: 'desc' })
|
|
|
+ this.hasAudioId = false
|
|
|
+ this.getDevices(this.$store.getters.partId)
|
|
|
this.deviceEditTitle = '添加设备'
|
|
|
this.deviceDialogVisible = true
|
|
|
this.deviceTypeDisabled = false // 新增设备可以选择设备类型
|
|
@@ -604,10 +639,12 @@ export default {
|
|
|
/** 修改设备 **/
|
|
|
handleEdit(params) {
|
|
|
this.getRoles({ page_size: 200, page_no: 1, fixedCondition: ' shop_id = -1', sort: ' role_id', dir: 'desc' })
|
|
|
+ this.getDevices(this.$store.getters.partId)
|
|
|
if (!this.part_view) {
|
|
|
this.getPartFrames(params.part_id)
|
|
|
}
|
|
|
this.hasRoleId = params.device_type === 7
|
|
|
+ this.hasAudioId = params.device_type === 12 || params.device_type === 13 || params.device_type === 14
|
|
|
this.deviceModel = {
|
|
|
...params
|
|
|
}
|
|
@@ -658,6 +695,15 @@ export default {
|
|
|
this.rolesOptions = response.data
|
|
|
})
|
|
|
},
|
|
|
+ getDevices(partId) {
|
|
|
+ // 获取设备列表
|
|
|
+ API_Device.getDeviceByType(partId, 11).then(response => {
|
|
|
+ this.audioOptions = response
|
|
|
+ })
|
|
|
+ API_Device.getDeviceByType(partId, 20).then(response => {
|
|
|
+ this.rs485Options = response
|
|
|
+ })
|
|
|
+ },
|
|
|
|
|
|
initWebSocket: function() {
|
|
|
var stockbase = DeviceUrl.replace('http', 'ws')
|