Browse Source

供暖办推送接口代码第二版

develop
ljlong_2630 1 year ago
parent
commit
c2cf6ed537
  1. 9
      src/api/model/heatparammodel.js
  2. 1
      src/views/model/heatapiconf/heatSendLog.vue
  3. 102
      src/views/model/heatapiconf/index.vue
  4. 39
      src/views/model/heatapiconf/paramModel.vue

9
src/api/model/heatparammodel.js

@ -69,3 +69,12 @@ export function updateHeatParamModelNew(data) {
data: data
})
}
// 查询热源推送参数配置列表
export function listHeatParamModelNoPage(query) {
return request({
url: '/model/dcHeatParamModel/listNoPage',
method: 'get',
params: query
})
}

1
src/views/model/heatapiconf/heatSendLog.vue

@ -99,6 +99,7 @@
</template>
</el-table-column>
<el-table-column label="返回信息" align="center" prop="returnInfo" />
<el-table-column label="发送时间" align="center" prop="createTime" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<el-button

102
src/views/model/heatapiconf/index.vue

@ -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>

39
src/views/model/heatapiconf/paramModel.vue

@ -17,9 +17,9 @@
<el-col :span="1.5">
<el-button type="success" icon="Plus" @click="handleAdd">新增</el-button>
</el-col>
<!-- <el-col :span="1.5">
<el-col :span="1.5">
<el-button type="success" icon="Edit" @click="handleUpdate">修改</el-button>
</el-col> -->
</el-col>
<el-col :span="1.5">
<el-button type="success" icon="Delete" @click="handleDelete">删除</el-button>
</el-col>
@ -44,7 +44,7 @@
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<el-button type="text" icon="Edit" @click="handleUpdate(scope.row)">修改</el-button>
<!-- <el-button type="text" icon="Edit" @click="handleUpdate(scope.row)">修改</el-button> -->
<el-button type="text" icon="Delete" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
@ -56,14 +56,12 @@
<!-- 添加或修改热源推送参数配置对话框 -->
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
<el-form ref="heatParamModelRef" :model="form" :rules="rules" label-width="100px">
<el-row>
<el-col :span="24">
<el-form-item label="参数模版编号" prop="paramClassId">
<el-select v-model="form.paramClassId" filterable placeholder="请选择参数模版ID" @change="paramClassChange"
multiple>
<el-option v-for="dict in paramClassList" :label="dict.paramClassName" :value=dict.paramClassCode>
<el-option v-for="dict in paramClassListNew" :label="dict.paramClassName" :value=dict.paramClassCode>
</el-option>
</el-select>
</el-form-item>
@ -90,7 +88,7 @@
}
</style>
<script setup name="HeatParamModel">
import { listHeatParamModel, getHeatParamModel, delHeatParamModel, addHeatParamModel, updateHeatParamModel, addBatchHeatParamModel, updateHeatParamModelNew } from "@/api/model/heatparammodel";
import { listHeatParamModel, getHeatParamModel, delHeatParamModel, addHeatParamModel, updateHeatParamModel, addBatchHeatParamModel, updateHeatParamModelNew, listHeatParamModelNoPage } from "@/api/model/heatparammodel";
import { listNoPage } from "@/api/model/heatapiconf";
import { listParamclassNoPage } from "@/api/model/paramclass";
const { proxy } = getCurrentInstance();
@ -108,6 +106,8 @@ const router = useRouter();
const heatList = ref([]);
const standardConfId = (router.currentRoute._value.query.standardConfId !== undefined && router.currentRoute._value.query.standardConfId !== null && router.currentRoute._value.query.standardConfId !== "") ? router.currentRoute._value.query.standardConfId : null;
const paramClassList = ref([]);
const paramClassSelectedOld = ref([]);
const paramClassListNew = ref([]);
const data = reactive({
form: {
standardConfId: standardConfId,
@ -187,6 +187,18 @@ function handleSelectionChange(selection) {
/** 新增按钮操作 */
function handleAdd() {
reset();
paramClassSelectedOld.value = [];
let param = {
standardConfId:standardConfId
}
listHeatParamModelNoPage(param).then(response => {
response.data?.forEach(item=>{
paramClassSelectedOld.value.push(item.paramClassId);
});
paramClassListNew.value = paramClassList.value.filter(item => {
return !paramClassSelectedOld.value.includes(item.paramClassCode);
});
});
open.value = true;
title.value = "添加热源推送参数配置";
}
@ -194,9 +206,16 @@ function handleAdd() {
/** 修改按钮操作 */
function handleUpdate(row) {
reset();
const _id = row.id || ids.value
getHeatParamModel(_id).then(response => {
form.value = response.data;
paramClassSelectedOld.value = [];
paramClassListNew.value = paramClassList.value;
let param = {
standardConfId:standardConfId
}
listHeatParamModelNoPage(param).then(response => {
response.data?.forEach(item=>{
paramClassSelectedOld.value.push(item.paramClassId);
});
form.value.paramClassId = paramClassSelectedOld.value;
open.value = true;
title.value = "修改热源推送参数配置";
});

Loading…
Cancel
Save