|
@ -227,7 +227,7 @@ |
|
|
</el-col> |
|
|
</el-col> |
|
|
</el-row> |
|
|
</el-row> |
|
|
<!-- 添加或修改设备信息对话框 --> |
|
|
<!-- 添加或修改设备信息对话框 --> |
|
|
<el-dialog :title="title" v-model="open" width="800px" append-to-body draggable> |
|
|
<el-dialog ref="deviceDialog" custom-class="deviceDialogClass" :title="title" v-model="open" width="800px" append-to-body draggable> |
|
|
<el-form ref="deviceRef" :model="form" :rules="rules" label-width="125px"> |
|
|
<el-form ref="deviceRef" :model="form" :rules="rules" label-width="125px"> |
|
|
<el-row> |
|
|
<el-row> |
|
|
<el-col :span="12"> |
|
|
<el-col :span="12"> |
|
@ -267,6 +267,20 @@ |
|
|
<el-input v-model="form.issGroupName" placeholder="请输入通讯来源设备ID" /> |
|
|
<el-input v-model="form.issGroupName" placeholder="请输入通讯来源设备ID" /> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-col> |
|
|
</el-col> |
|
|
|
|
|
<el-col :span="12" v-show="thingsboardShow"> |
|
|
|
|
|
<el-form-item label="thingsboard服务" prop="thingsboardServer"> |
|
|
|
|
|
<el-select v-model="form.thingsboardServer" placeholder="请选择thingsboard服务"> |
|
|
|
|
|
<el-option v-for="dict in tbServerList" :key="dict.id" :label="dict.seviceName" :value="dict.id" /> |
|
|
|
|
|
</el-select> |
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
</el-col> |
|
|
|
|
|
<el-col :span="12" v-show="thingsboardShow"> |
|
|
|
|
|
<el-form-item label="是否同步设备到tb服务" prop="synchroDevice"> |
|
|
|
|
|
<el-select v-model="form.synchroDevice" placeholder="请选择是否同步设备到tb服务"> |
|
|
|
|
|
<el-option v-for="dict in synchro_device" :key="dict.value" :label="dict.label" :value="dict.value" /> |
|
|
|
|
|
</el-select> |
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
</el-col> |
|
|
<el-col :span="12"> |
|
|
<el-col :span="12"> |
|
|
<el-form-item label="是否可用" prop="enabledFlag"> |
|
|
<el-form-item label="是否可用" prop="enabledFlag"> |
|
|
<el-select v-model="form.enabledFlag" placeholder="请选择是否可用"> |
|
|
<el-select v-model="form.enabledFlag" placeholder="请选择是否可用"> |
|
@ -282,16 +296,16 @@ |
|
|
</el-select> |
|
|
</el-select> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-col> |
|
|
</el-col> |
|
|
<el-col :span="12"> |
|
|
<el-col :span="12" v-show="false" > |
|
|
<el-form-item label="所属组织名称" prop="orgName"> |
|
|
<el-form-item label="所属组织名称" prop="orgName"> |
|
|
<el-tree-select v-model="form.orgName" :data="deptOptions" |
|
|
<el-input v-model="form.orgName" placeholder="请选择组织名称" disabled /> |
|
|
:props="{ value: 'label', label: 'label', children: 'children' }" value-key="id" placeholder="请选择" |
|
|
|
|
|
check-strictly :default-expand-all="true" @node-click="selectDept" /> |
|
|
|
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-col> |
|
|
</el-col> |
|
|
<el-col :span="12" v-show="false"> |
|
|
<el-col :span="12"> |
|
|
<el-form-item label="所属组织编码" prop="orgCode"> |
|
|
<el-form-item label="所属组织" prop="orgCode"> |
|
|
<el-input v-model="form.orgCode" placeholder="请选择组织名称" disabled /> |
|
|
<el-tree-select v-model="form.orgCode" :data="deptOptions" |
|
|
|
|
|
:props="{value: 'id', label: 'label', children: 'children' }" value-key="id" placeholder="请选择" |
|
|
|
|
|
check-strictly :default-expand-all="true" @node-click="selectDept" /> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-col> |
|
|
</el-col> |
|
|
<el-col :span="12"> |
|
|
<el-col :span="12"> |
|
@ -410,14 +424,27 @@ |
|
|
margin-right: 0 !important; |
|
|
margin-right: 0 !important; |
|
|
width: 96%; |
|
|
width: 96%; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.loading-overlay { |
|
|
|
|
|
position: absolute; |
|
|
|
|
|
top: 0; |
|
|
|
|
|
left: 0; |
|
|
|
|
|
width: 100%; |
|
|
|
|
|
height: 100%; |
|
|
|
|
|
background-color: rgba(255, 255, 255, 0.7); |
|
|
|
|
|
display: flex; |
|
|
|
|
|
justify-content: center; |
|
|
|
|
|
align-items: center; |
|
|
|
|
|
} |
|
|
</style> |
|
|
</style> |
|
|
<script setup name="Device"> |
|
|
<script setup name="Device"> |
|
|
import { getUuid, getDevice, delDevice, addDevice, updateDevice, listWithFilterColumn, selectDcBaseDeviceinfoMaxSort, cleanRedisCache, addAndSyncParamMap } from "@/api/model/device"; |
|
|
import { getUuid, getDevice, delDevice, addDevice, updateDevice, listWithFilterColumn, selectDcBaseDeviceinfoMaxSort, cleanRedisCache, addAndSyncParamMap } from "@/api/model/device"; |
|
|
import { listDevicemodel, } from "@/api/model/devicemodel"; |
|
|
import { listDevicemodel, } from "@/api/model/devicemodel"; |
|
|
import { deptTreeSelect } from "@/api/system/user"; |
|
|
import { deptTreeSelect } from "@/api/system/user"; |
|
|
|
|
|
import { listserverinfoNoPage, } from "@/api/model/tbserverinfo"; |
|
|
import lock from "@/assets/icons/svg/lock.svg"; |
|
|
import lock from "@/assets/icons/svg/lock.svg"; |
|
|
import { ref, onMounted, onUnmounted } from "vue"; |
|
|
import { ref, onMounted, onUnmounted } from "vue"; |
|
|
import { ElMessageBox } from 'element-plus'; |
|
|
import { ElMessageBox,ElLoading } from 'element-plus'; |
|
|
const { proxy } = getCurrentInstance(); |
|
|
const { proxy } = getCurrentInstance(); |
|
|
const { dc_img_configuration, dc_device_type, dc_device_source } = proxy.useDict('dc_img_configuration', 'dc_device_type', 'dc_device_source'); |
|
|
const { dc_img_configuration, dc_device_type, dc_device_source } = proxy.useDict('dc_img_configuration', 'dc_device_type', 'dc_device_source'); |
|
|
const router = useRouter(); |
|
|
const router = useRouter(); |
|
@ -444,6 +471,8 @@ const sortProps = ref([]); |
|
|
const deptName = ref(null); |
|
|
const deptName = ref(null); |
|
|
const devicemodelOptions = ref([]); |
|
|
const devicemodelOptions = ref([]); |
|
|
const ioserverShow = ref(false); |
|
|
const ioserverShow = ref(false); |
|
|
|
|
|
const thingsboardShow = ref(false); |
|
|
|
|
|
const tbServerList = ref([]); |
|
|
const enabledFlag = ref([ |
|
|
const enabledFlag = ref([ |
|
|
{ label: '可用', value: true, elTagType: 'default', elTagClass: null }, |
|
|
{ label: '可用', value: true, elTagType: 'default', elTagClass: null }, |
|
|
{ label: '不可用', value: false, elTagType: 'default', elTagClass: null } |
|
|
{ label: '不可用', value: false, elTagType: 'default', elTagClass: null } |
|
@ -460,6 +489,10 @@ const alertEnabledTable = ref([ |
|
|
{ label: '告警', value: 'true', elTagType: 'default', elTagClass: null }, |
|
|
{ label: '告警', value: 'true', elTagType: 'default', elTagClass: null }, |
|
|
{ label: '不告警', value: 'false', elTagType: 'default', elTagClass: null } |
|
|
{ label: '不告警', value: 'false', elTagType: 'default', elTagClass: null } |
|
|
]); |
|
|
]); |
|
|
|
|
|
const synchro_device = ref([ |
|
|
|
|
|
{ label: '同步', value: 'true', elTagType: 'default', elTagClass: null }, |
|
|
|
|
|
{ label: '不同步', value: 'false', elTagType: 'default', elTagClass: null } |
|
|
|
|
|
]) |
|
|
const data = reactive({ |
|
|
const data = reactive({ |
|
|
form: {}, |
|
|
form: {}, |
|
|
params: { |
|
|
params: { |
|
@ -517,6 +550,12 @@ const data = reactive({ |
|
|
orgCode: [ |
|
|
orgCode: [ |
|
|
{ required: true, message: "所属组织编码", trigger: "change" } |
|
|
{ required: true, message: "所属组织编码", trigger: "change" } |
|
|
], |
|
|
], |
|
|
|
|
|
thingsboardServer: [ |
|
|
|
|
|
{ required: thingsboardShow, message: "thingsboard服务", trigger: "change" } |
|
|
|
|
|
], |
|
|
|
|
|
synchroDevice: [ |
|
|
|
|
|
{ required: thingsboardShow, message: "是否同步设备到tb服务", trigger: "change" } |
|
|
|
|
|
], |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
@ -655,16 +694,22 @@ function handleUpdate(row) { |
|
|
|
|
|
|
|
|
/** 提交按钮 */ |
|
|
/** 提交按钮 */ |
|
|
function submitForm() { |
|
|
function submitForm() { |
|
|
|
|
|
let dialogLoading = null; |
|
|
proxy.$refs["deviceRef"].validate(valid => { |
|
|
proxy.$refs["deviceRef"].validate(valid => { |
|
|
if (valid) { |
|
|
if (valid) { |
|
|
|
|
|
dialogLoading = ElLoading.service({ |
|
|
|
|
|
// target: '.deviceDialogClass', // el-dialog 对象 |
|
|
|
|
|
text: 'Loading...', // Loading 的提示信息 |
|
|
|
|
|
background: 'rgba(0,0,0,0.7)', // 设置背景颜色和透明度 |
|
|
|
|
|
}) |
|
|
if (form.value.id != null) { |
|
|
if (form.value.id != null) { |
|
|
updateDevice(form.value).then(response => { |
|
|
updateDevice(form.value).then(response => { |
|
|
proxy.$modal.msgSuccess("修改成功"); |
|
|
proxy.$modal.msgSuccess("修改成功"); |
|
|
open.value = false; |
|
|
open.value = false; |
|
|
getList(); |
|
|
getList(); |
|
|
|
|
|
dialogLoading.close(); |
|
|
}); |
|
|
}); |
|
|
} else { |
|
|
} else { |
|
|
loading.value = true; |
|
|
|
|
|
let param = { |
|
|
let param = { |
|
|
"obj": { "centerDeviceCode": form.value.centerDeviceCode }, |
|
|
"obj": { "centerDeviceCode": form.value.centerDeviceCode }, |
|
|
"params": new Object(), |
|
|
"params": new Object(), |
|
@ -679,6 +724,7 @@ function submitForm() { |
|
|
confirmButtonText: '确定', |
|
|
confirmButtonText: '确定', |
|
|
center: true, |
|
|
center: true, |
|
|
}) |
|
|
}) |
|
|
|
|
|
dialogLoading.close(); |
|
|
return; |
|
|
return; |
|
|
} else { |
|
|
} else { |
|
|
let param = { |
|
|
let param = { |
|
@ -695,6 +741,7 @@ function submitForm() { |
|
|
confirmButtonText: '确定', |
|
|
confirmButtonText: '确定', |
|
|
center: true, |
|
|
center: true, |
|
|
}) |
|
|
}) |
|
|
|
|
|
dialogLoading.close(); |
|
|
return; |
|
|
return; |
|
|
} else { |
|
|
} else { |
|
|
addAndSyncParamMap(form.value).then(response => { |
|
|
addAndSyncParamMap(form.value).then(response => { |
|
@ -707,12 +754,11 @@ function submitForm() { |
|
|
} else { |
|
|
} else { |
|
|
proxy.$modal.msgError(response.data?.msg); |
|
|
proxy.$modal.msgError(response.data?.msg); |
|
|
} |
|
|
} |
|
|
|
|
|
dialogLoading.close(); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
loading.value = false; |
|
|
|
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -777,7 +823,7 @@ function getDeptTree() { |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
function selectDept(val) { |
|
|
function selectDept(val) { |
|
|
form.value.orgCode = val.id; |
|
|
form.value.orgName = val.label; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function deviceSourceChange(val) { |
|
|
function deviceSourceChange(val) { |
|
@ -787,8 +833,11 @@ function deviceSourceChange(val) { |
|
|
} |
|
|
} |
|
|
if (val == '002') { |
|
|
if (val == '002') { |
|
|
ioserverShow.value = true; |
|
|
ioserverShow.value = true; |
|
|
} else { |
|
|
thingsboardShow.value = false; |
|
|
|
|
|
} else if (val == '001') { |
|
|
|
|
|
getThServerList(); |
|
|
ioserverShow.value = false; |
|
|
ioserverShow.value = false; |
|
|
|
|
|
thingsboardShow.value = true; |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
@ -1019,6 +1068,16 @@ function modelChange(val) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function getThServerList() { |
|
|
|
|
|
let param = { |
|
|
|
|
|
"seviceType": "tb", |
|
|
|
|
|
"enabled": true, |
|
|
|
|
|
} |
|
|
|
|
|
listserverinfoNoPage(param).then(response => { |
|
|
|
|
|
tbServerList.value = response.data; |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
getTreeselect(); |
|
|
getTreeselect(); |
|
|
getDeptTree(); |
|
|
getDeptTree(); |
|
|
getList(); |
|
|
getList(); |
|
|