|
|
@ -22,6 +22,18 @@ |
|
|
|
check-strictly :default-expand-all="true" @node-click="selectDept" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> --> |
|
|
|
<el-col :span="8"> |
|
|
|
<el-form-item label="排除设备" prop="excludeDevices"> |
|
|
|
<el-select v-model="queryParams.excludeDevices" placeholder="请选择排除设备" clearable multiple> |
|
|
|
<el-option |
|
|
|
v-for="dict in listDeviceAll" |
|
|
|
:key="dict.uuid" |
|
|
|
:label="dict.deviceName" |
|
|
|
:value="dict.uuid" |
|
|
|
/> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="4"> |
|
|
|
<el-form-item label="标准值" prop="standard"> |
|
|
|
<el-input v-model="queryParams.standard" placeholder="请输入标准值" clearable @keyup.enter="handleQuery" /> |
|
|
@ -62,6 +74,11 @@ |
|
|
|
<!-- <el-table-column label="主键" align="center" prop="id" /> --> |
|
|
|
<el-table-column label="机构编号" align="center" prop="orgCode" /> |
|
|
|
<el-table-column label="机构名称" align="center" prop="orgName" /> |
|
|
|
<el-table-column label="排除设备" align="center" prop="excludeDevices" show-overflow-tooltip="true" > |
|
|
|
<template #default="scope"> |
|
|
|
{{getDevicesNames(scope.row.excludeDevices)}} |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column label="标准值" align="center" prop="standard" /> |
|
|
|
<el-table-column label="发送地址" align="center" prop="sendIp" /> |
|
|
|
<el-table-column label="是否启用" align="center" prop="available"> |
|
|
@ -96,23 +113,35 @@ |
|
|
|
<el-form ref="heatapiconfRef" :model="form" :rules="rules" label-width="80px"> |
|
|
|
|
|
|
|
<el-row> |
|
|
|
<el-col :span="14"> |
|
|
|
<el-form-item label="机构编号" prop="orgCode"> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item label="所属公司" prop="orgCode"> |
|
|
|
<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" filterable /> |
|
|
|
check-strictly :default-expand-all="true" @node-click="selectDept" filterable style="width:100%" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="10"> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item label="标准值" prop="standard"> |
|
|
|
<el-input v-model="form.standard" placeholder="请输入标准值" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-col :span="24"> |
|
|
|
<el-form-item label="发送地址" prop="sendIp"> |
|
|
|
<el-input v-model="form.sendIp" placeholder="请输入发送地址" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="24"> |
|
|
|
<el-form-item label="排除设备" prop="excludeDevices"> |
|
|
|
<el-select v-model="form.excludeDevices" placeholder="请选择排除设备" clearable multiple style="width:100%" > |
|
|
|
<el-option |
|
|
|
v-for="dict in listDevices" |
|
|
|
:key="dict.uuid" |
|
|
|
:label="dict.deviceName" |
|
|
|
:value="dict.uuid" |
|
|
|
/> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
</el-form> |
|
|
|
<template #footer> |
|
|
@ -128,6 +157,7 @@ |
|
|
|
</style> |
|
|
|
<script setup name="Heatapiconf"> |
|
|
|
import { listHeatapiconf, getHeatapiconf, delHeatapiconf, addHeatapiconf, updateHeatapiconf } from "@/api/model/heatapiconf"; |
|
|
|
import { listDeviceNoPage } from "@/api/model/device"; |
|
|
|
import { deptTreeSelect } from "@/api/system/user"; |
|
|
|
import lock from "@/assets/icons/svg/lock.svg"; |
|
|
|
import { ElMessageBox } from 'element-plus'; |
|
|
@ -148,14 +178,18 @@ const fixedColumns = ref(false); |
|
|
|
const tableHeight = ref("0px"); |
|
|
|
const collapseVisible = ref(false); |
|
|
|
const router = useRouter(); |
|
|
|
|
|
|
|
const listDevices = ref([]); |
|
|
|
const orgCode = ref(null); |
|
|
|
const listDeviceAll = ref([]); |
|
|
|
const param = ref({}); |
|
|
|
const data = reactive({ |
|
|
|
form: {}, |
|
|
|
queryParams: { |
|
|
|
pageNum: 1, |
|
|
|
pageSize: 10, |
|
|
|
orgCode: null, |
|
|
|
standard: null |
|
|
|
standard: null, |
|
|
|
excludeDevices:[], |
|
|
|
}, |
|
|
|
rules: { |
|
|
|
} |
|
|
@ -166,7 +200,9 @@ const { queryParams, form, rules } = toRefs(data); |
|
|
|
/** 查询供热办推送接口配置列表 */ |
|
|
|
function getList() { |
|
|
|
loading.value = true; |
|
|
|
listHeatapiconf(queryParams.value).then(response => { |
|
|
|
param.value = {...queryParams.value}; |
|
|
|
param.value.excludeDevices = param.value.excludeDevices?.join(","); |
|
|
|
listHeatapiconf(param.value).then(response => { |
|
|
|
heatapiconfList.value = response.rows; |
|
|
|
total.value = response.total; |
|
|
|
loading.value = false; |
|
|
@ -177,6 +213,7 @@ function getList() { |
|
|
|
function cancel() { |
|
|
|
open.value = false; |
|
|
|
form.value.standard = null; |
|
|
|
loading.value = false; |
|
|
|
} |
|
|
|
|
|
|
|
// 表单重置 |
|
|
@ -205,11 +242,12 @@ function handleQuery() { |
|
|
|
|
|
|
|
/** 重置按钮操作 */ |
|
|
|
function resetQuery() { |
|
|
|
proxy.resetForm("queryRef"); |
|
|
|
// proxy.resetForm("queryRef"); |
|
|
|
queryParams.value.orgCode = null; |
|
|
|
queryParams.value.orgName = null; |
|
|
|
queryParams.value.standard = null; |
|
|
|
queryParams.value.sendIp = null; |
|
|
|
queryParams.value.excludeDevices = []; |
|
|
|
handleQuery(); |
|
|
|
} |
|
|
|
|
|
|
@ -228,6 +266,8 @@ function handleAdd() { |
|
|
|
form.value.sendIp = null; |
|
|
|
open.value = true; |
|
|
|
title.value = "添加供热办推送接口配置"; |
|
|
|
form.value.excludeDevices = null; |
|
|
|
getListDevice(); |
|
|
|
} |
|
|
|
|
|
|
|
/** 修改按钮操作 */ |
|
|
@ -249,9 +289,11 @@ function handleUpdate(row) { |
|
|
|
} |
|
|
|
getHeatapiconf(_id).then(response => { |
|
|
|
form.value = response.data; |
|
|
|
form.value.excludeDevices = form.value.excludeDevices?.split(","); |
|
|
|
open.value = true; |
|
|
|
title.value = "修改供热办推送接口配置"; |
|
|
|
}); |
|
|
|
getListDevice(); |
|
|
|
} |
|
|
|
|
|
|
|
/** 提交按钮 */ |
|
|
@ -259,12 +301,14 @@ function submitForm() { |
|
|
|
proxy.$refs["heatapiconfRef"].validate(valid => { |
|
|
|
if (valid) { |
|
|
|
if (form.value.id != null) { |
|
|
|
form.value.excludeDevices = form.value.excludeDevices?.join(","); |
|
|
|
updateHeatapiconf(form.value).then(response => { |
|
|
|
proxy.$modal.msgSuccess("修改成功"); |
|
|
|
open.value = false; |
|
|
|
getList(); |
|
|
|
}); |
|
|
|
} else { |
|
|
|
form.value.excludeDevices = form.value.excludeDevices?.join(","); |
|
|
|
addHeatapiconf(form.value).then(response => { |
|
|
|
proxy.$modal.msgSuccess("新增成功"); |
|
|
|
open.value = false; |
|
|
@ -305,6 +349,7 @@ function getDeptTree() { |
|
|
|
function selectDept(val) { |
|
|
|
form.value.orgCode = val.id; |
|
|
|
form.value.orgName = val.label; |
|
|
|
getListDevice(val.id); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -415,6 +460,45 @@ function turnToParamConf(row){ |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
function getListDevice(orgCode) { |
|
|
|
let param = {}; |
|
|
|
if(orgCode != null){ |
|
|
|
param.orgCode = orgCode; |
|
|
|
}else{ |
|
|
|
param.orgCode = form.value.orgCode; |
|
|
|
} |
|
|
|
listDeviceNoPage(param).then(response => { |
|
|
|
listDevices.value = response.data; |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
function getDevicesNames(deviceIds){ |
|
|
|
|
|
|
|
if(!deviceIds) return ''; |
|
|
|
let deviceIdSet = new Set(deviceIds.split(',')); |
|
|
|
let deviceMap = new Map(); |
|
|
|
listDeviceAll.value.forEach(device => { |
|
|
|
deviceMap.set(device.uuid, device.deviceName); |
|
|
|
}); |
|
|
|
let deviceNames = []; |
|
|
|
for (let deviceId of deviceIdSet) { |
|
|
|
let name = deviceMap.get(deviceId); |
|
|
|
if (name) { |
|
|
|
deviceNames.push(name); |
|
|
|
} else { |
|
|
|
console.log("该设备没能匹配到对应设备名称:"+deviceId) |
|
|
|
} |
|
|
|
} |
|
|
|
return deviceNames.join(','); |
|
|
|
} |
|
|
|
|
|
|
|
function getDevicesAll(){ |
|
|
|
listDeviceNoPage().then(response => { |
|
|
|
listDeviceAll.value = response.data; |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
getDevicesAll(); |
|
|
|
getDeptTree(); |
|
|
|
getList(); |
|
|
|
</script> |
|
|
|