Browse Source

供热1版

develop
ljlong_2630 1 year ago
parent
commit
6ee91b3eca
  1. 2
      package.json
  2. 53
      src/api/model/heatSendLog.js
  3. 62
      src/api/model/heatapiconf.js
  4. 71
      src/api/model/heatparammodel.js
  5. 41
      src/views/model/alert/deviceparamalert.vue
  6. 356
      src/views/model/heatapiconf/heatSendLog.vue
  7. 420
      src/views/model/heatapiconf/index.vue
  8. 305
      src/views/model/heatapiconf/paramModel.vue

2
package.json

@ -23,7 +23,7 @@
"bpmn-js": "^11.4.1",
"diagram-js": "^11.9.1",
"echarts": "5.4.0",
"element-plus": "2.2.27",
"element-plus": "2.2.28",
"file-saver": "2.0.5",
"fuse.js": "6.6.2",
"highlight.js": "11.7.0",

53
src/api/model/heatSendLog.js

@ -0,0 +1,53 @@
import request from '@/utils/request'
// 查询供暖办推送信息日志列表
export function listHeatapi(query) {
return request({
url: '/model/dcHeatSendLog/list',
method: 'get',
params: query
})
}
// 查询供暖办推送信息日志详细
export function getHeatapi(id) {
return request({
url: '/model/dcHeatSendLog/' + id,
method: 'get'
})
}
// 新增供暖办推送信息日志
export function addHeatapi(data) {
return request({
url: '/model/dcHeatSendLog',
method: 'post',
data: data
})
}
// 修改供暖办推送信息日志
export function updateHeatapi(data) {
return request({
url: '/model/dcHeatSendLog',
method: 'put',
data: data
})
}
// 删除供暖办推送信息日志
export function delHeatapi(id) {
return request({
url: '/model/dcHeatSendLog/' + id,
method: 'delete'
})
}
// 导出供暖办推送信息日志
export function exportHeatapi(query) {
return request({
url: '/${baseUrl}/export',
method: 'get',
params: query
})
}

62
src/api/model/heatapiconf.js

@ -0,0 +1,62 @@
import request from '@/utils/request'
// 查询供热办推送接口配置列表
export function listHeatapiconf(query) {
return request({
url: '/model/dcHeatStandardValueConf/list',
method: 'get',
params: query
})
}
// 查询供热办推送接口配置详细
export function getHeatapiconf(id) {
return request({
url: '/model/dcHeatStandardValueConf/' + id,
method: 'get'
})
}
// 新增供热办推送接口配置
export function addHeatapiconf(data) {
return request({
url: '/model/dcHeatStandardValueConf',
method: 'post',
data: data
})
}
// 修改供热办推送接口配置
export function updateHeatapiconf(data) {
return request({
url: '/model/dcHeatStandardValueConf',
method: 'put',
data: data
})
}
// 删除供热办推送接口配置
export function delHeatapiconf(id) {
return request({
url: '/model/dcHeatStandardValueConf/' + id,
method: 'delete'
})
}
// 导出供热办推送接口配置
export function exportHeatapiconf(query) {
return request({
url: '/${baseUrl}/export',
method: 'get',
params: query
})
}
// 查询供热办推送接口配置列表
export function listNoPage(query) {
return request({
url: '/model/dcHeatStandardValueConf/listNoPage',
method: 'get',
params: query
})
}

71
src/api/model/heatparammodel.js

@ -0,0 +1,71 @@
import request from '@/utils/request'
// 查询热源推送参数配置列表
export function listHeatParamModel(query) {
return request({
url: '/model/dcHeatParamModel/list',
method: 'get',
params: query
})
}
// 查询热源推送参数配置详细
export function getHeatParamModel(id) {
return request({
url: '/model/dcHeatParamModel/' + id,
method: 'get'
})
}
// 新增热源推送参数配置
export function addHeatParamModel(data) {
return request({
url: '/model/dcHeatParamModel',
method: 'post',
data: data
})
}
// 修改热源推送参数配置
export function updateHeatParamModel(data) {
return request({
url: '/model/dcHeatParamModel',
method: 'put',
data: data
})
}
// 删除热源推送参数配置
export function delHeatParamModel(id) {
return request({
url: '/model/dcHeatParamModel/' + id,
method: 'delete'
})
}
// 导出热源推送参数配置
export function exportHeatParamModel(query) {
return request({
url: '/${baseUrl}/export',
method: 'get',
params: query
})
}
// 新增热源推送参数配置
export function addBatchHeatParamModel(data) {
return request({
url: '/model/dcHeatParamModel/addBatch',
method: 'post',
data: data
})
}
// 修改热源推送参数配置
export function updateHeatParamModelNew(data) {
return request({
url: '/model/dcHeatParamModel/editBatch',
method: 'put',
data: data
})
}

41
src/views/model/alert/deviceparamalert.vue

@ -285,7 +285,7 @@
<el-table-column label="限值" align="center" prop="value">
<template #default="scope">
<el-form-item :class="{ 'is-error': isInvalid(scope.row.value,scope.row),'is-error-value': colorValue[scope.row.sort]}" label-width="0px">
<el-input v-model="scope.row.value" @change="handleValueChange(scope.row)"></el-input>
<el-input v-model="scope.row.value"></el-input>
</el-form-item>
</template>
</el-table-column>
@ -450,6 +450,7 @@ function getList() {
function cancel() {
open.value = false;
reset();
loading.value = false;
}
//
@ -729,7 +730,6 @@ function getDeviceList(){
}
function getParamsListDevice(deviceUuid){
loading.value = true;
form.value.partion = null;
queryParamsParam.value.deviceUuid = deviceUuid;
if(queryParamsParam.value.partion == null){
@ -879,6 +879,7 @@ function submitFormPolicy() {
function cancelPolicy() {
openPolicy.value = false;
resetPolicy();
loading.value = false;
}
//
@ -1136,12 +1137,28 @@ function handleValueChange(row){
}
if(selectedRowsNow.length>0){
selectedRowsNow.forEach(item=>{
if(item.sort < row.sort){
if(item.value > row.value){
console.log("item.sort: " + parseFloat(item.sort));
console.log("row.sort: " + parseFloat(row.sort));
console.log("item.sort < row.sort");
console.log(parseFloat(item.sort) < parseFloat(row.sort));
console.log("item.sort > row.sort");
console.log(parseFloat(item.sort) > parseFloat(row.sort));
if(parseFloat(item.sort) < parseFloat(row.sort)){
console.log("小于符合: 判断大于");
console.log("item.value: " + parseFloat(item.value));
console.log("row.value: " + parseFloat(row.value));
console.log("item.value > row.value");
console.log(parseFloat(item.value) > parseFloat(row.value));
if(parseFloat(item.value) > parseFloat(row.value)){
flag = false;
}
}else if(item.sort > row.sort){
if(item.value < row.value){
}else if(parseFloat(item.sort) > parseFloat(row.sort)){
console.log("大于符合: 判断小于");
console.log("item.value: " + parseFloat(item.value));
console.log("row.value: " + parseFloat(row.value));
console.log("item.value < row.value");
console.log(parseFloat(item.value) < parseFloat(row.value));
if(parseFloat(item.value) < parseFloat(row.value)){
flag = false;
}
}
@ -1181,12 +1198,12 @@ function handleValueChangeSub(row){
const selectedRowsNow = proxy.$refs.policyTable.getSelectionRows();
if(selectedRowsNow.length>0){
selectedRowsNow.forEach(item=>{
if(item.sort < row.sort){
if(item.value > row.value){
if(parseFloat(item.sort) < parseFloat(row.sort)){
if(parseFloat(item.value) > parseFloat(row.value)){
flag = false;
}
}else if(item.sort > row.sort){
if(item.value < row.value){
}else if(parseFloat(item.sort) > parseFloat(row.sort)){
if(parseFloat(item.value) < parseFloat(row.value)){
flag = false;
}
}
@ -1209,9 +1226,9 @@ const validateCell = (data) => {
} else if (typeof data.value === 'boolean') {
return data.value !== undefined && data.value !== null;
} else if (Array.isArray(data.value)) {
return data.value.lenght == 0;
return data.value.length == 0;
} else if (typeof data.value === 'object') {
return data.value.lenght == 0;
return data.value.length == 0;
} else {
return data.value !== undefined && data.value !== null;
}

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

@ -0,0 +1,356 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item label="配置编号" prop="confId">
<el-input
v-model="queryParams.confId"
placeholder="请输入配置编号"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="推送目标接口" prop="sendIp">
<el-input
v-model="queryParams.sendIp"
placeholder="请输入推送目标接口"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="成功标志" prop="successFlag">
<el-select v-model="queryParams.successFlag" placeholder="请选择成功标志" clearable>
<el-option
v-for="dict in dc_yes_no"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="返回信息" prop="returnInfo">
<el-input
v-model="queryParams.returnInfo"
placeholder="请输入返回信息"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button type="info" plain icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="success"
icon="Plus"
@click="handleAdd"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
icon="Edit"
@click="handleUpdate"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
icon="Delete"
@click="handleDelete"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
icon="Download"
@click="handleExport"
>导出</el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="heatapiList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<!-- <el-table-column label="主键" align="center" prop="id" /> -->
<el-table-column label="配置策略" align="center" prop="confId" >
<template #default="scope">
<span>{{ getConfName(scope.row.confId) }}</span>
</template>
</el-table-column>
<el-table-column label="推送目标接口" align="center" prop="sendIp" />
<el-table-column
label="推送内容" align="center" prop="infoDetail"
show-overflow-tooltip="true"
:tooltip-options="{
placement: 'bottom',
closeDelay: 2000,
leaveDelay: 2000,
autoHide: false,
popperClass: 'custom-tooltip'
}">
</el-table-column>
<el-table-column label="成功标志" align="center" prop="successFlag">
<template #default="scope">
<dict-tag :options="dc_yes_no" :value="scope.row.successFlag"/>
</template>
</el-table-column>
<el-table-column label="返回信息" align="center" prop="returnInfo" />
<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="Delete"
@click="handleDelete(scope.row)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改供暖办推送信息日志对话框 -->
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
<el-form ref="heatapiRef" :model="form" :rules="rules" label-width="80px">
<el-row>
<el-col :span="12">
<el-form-item label="配置编号" prop="confId">
<el-input v-model="form.confId" placeholder="请输入配置编号" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="推送目标接口" prop="sendIp">
<el-input v-model="form.sendIp" placeholder="请输入推送目标接口" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="推送内容" prop="infoDetail">
<el-input v-model="form.infoDetail" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="成功标志">
<el-radio-group v-model="form.successFlag">
<el-radio
v-for="dict in dc_yes_no"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="返回信息" prop="returnInfo">
<el-input v-model="form.returnInfo" placeholder="请输入返回信息" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<style lang="scss" > @import "@/assets/styles/self-defined.scss";
.custom-tooltip {
max-height: 100px;
overflow-y: auto;
}
</style>
<script setup name="HeatSendLog">
import { listHeatapi, getHeatapi, delHeatapi, addHeatapi, updateHeatapi } from "@/api/model/heatSendLog";
import { listHeatapiconf, getHeatapiconf, delHeatapiconf, addHeatapiconf, updateHeatapiconf } from "@/api/model/heatapiconf";
const { proxy } = getCurrentInstance();
const dc_yes_no = ref([
{ label: '成功', value: 'true', elTagType: 'default', elTagClass: null },
{ label: '失败', value: 'false', elTagType: 'default', elTagClass: null }
]);
const heatapiList = ref([]);
const open = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const title = ref("");
const tooltipConfig = ref({ hideAfter: 3000});
const heatapiconfList = ref([]);
const data = reactive({
form: {},
queryParams: {
pageNum: 1,
pageSize: 10,
confId: null,
sendIp: null,
infoDetail: null,
successFlag: null,
returnInfo: null
},
rules: {
}
});
const { queryParams, form, rules } = toRefs(data);
/** 查询供暖办推送信息日志列表 */
function getList() {
loading.value = true;
listHeatapi(queryParams.value).then(response => {
heatapiList.value = response.rows;
total.value = response.total;
loading.value = false;
});
}
//
function cancel() {
open.value = false;
reset();
}
//
function reset() {
form.value = {
tentantId: null,
version: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
deptId: null,
userId: null,
deleteBy: null,
deleteTime: null,
id: null,
confId: null,
sendIp: null,
infoDetail: null,
successFlag: "0",
returnInfo: null
};
proxy.resetForm("heatapiRef");
}
/** 搜索按钮操作 */
function handleQuery() {
queryParams.value.pageNum = 1;
getList();
}
/** 重置按钮操作 */
function resetQuery() {
proxy.resetForm("queryRef");
handleQuery();
}
//
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
}
/** 新增按钮操作 */
function handleAdd() {
reset();
open.value = true;
title.value = "添加供暖办推送信息日志";
}
/** 修改按钮操作 */
function handleUpdate(row) {
reset();
const _id = row.id || ids.value
getHeatapi(_id).then(response => {
form.value = response.data;
open.value = true;
title.value = "修改供暖办推送信息日志";
});
}
/** 提交按钮 */
function submitForm() {
proxy.$refs["heatapiRef"].validate(valid => {
if (valid) {
if (form.value.id != null) {
updateHeatapi(form.value).then(response => {
proxy.$modal.msgSuccess("修改成功");
open.value = false;
getList();
});
} else {
addHeatapi(form.value).then(response => {
proxy.$modal.msgSuccess("新增成功");
open.value = false;
getList();
});
}
}
});
}
/** 删除按钮操作 */
function handleDelete(row) {
const _ids = row.id || ids.value;
proxy.$modal.confirm('是否确认删除供暖办推送信息日志编号为"' + _ids + '"的数据项?').then(function() {
return delHeatapi(_ids);
}).then(() => {
getList();
proxy.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
/** 导出按钮操作 */
function handleExport() {
proxy.download('model/heatapi/export', {
...queryParams.value
}, `heatapi_${new Date().getTime()}.xlsx`)
}
/** 查询供热办推送接口配置列表 */
function getListHeatapiconf() {
loading.value = true;
listHeatapiconf().then(response => {
heatapiconfList.value = response.rows;
total.value = response.total;
loading.value = false;
});
}
function getConfName(id){
let name = '';
heatapiconfList.value.forEach(item=>{
if(String(item.id)==id){
name = item.orgName;
}
})
return name;
}
getListHeatapiconf();
getList();
</script>

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

@ -0,0 +1,420 @@
<template>
<div class="app-container">
<el-row>
<el-col :span="4" class="card-box">
<div class="head-container">
<el-input v-model="deptName" placeholder="请输入部门名称" clearable prefix-icon="Search" style="margin-bottom: 20px" />
</div>
<div class="head-container">
<el-tree :data="deptOptions" :props="{ label: 'label', children: 'children' }" :expand-on-click-node="false"
:filter-node-method="filterNode" ref="deptTreeRef" node-key="id" highlight-current default-expand-all
@node-click="handleNodeClick" />
</div>
</el-col>
<el-col :span="20">
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="90px"
class="my-custom-form">
<el-row>
<!-- <el-col :span="4">
<el-form-item label="机构编号" prop="orgCode">
<el-tree-select v-model="queryParams.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-col> -->
<el-col :span="4">
<el-form-item label="标准值" prop="standard">
<el-input v-model="queryParams.standard" placeholder="请输入标准值" clearable @keyup.enter="handleQuery" />
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="发送地址" prop="sendIp">
<el-input v-model="queryParams.sendIp" placeholder="请输入发送地址" clearable @keyup.enter="handleQuery" />
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item class="childTextAlignCenter">
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button type="info" plain icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="success" icon="Plus" @click="handleAdd">新增</el-button>
</el-col>
<!-- <el-col :span="1.5">
<el-button type="success" icon="Edit" @click="handleUpdate">修改</el-button>
</el-col> -->
<el-col :span="1.5">
<el-button type="success" icon="Delete" @click="handleDelete">删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" icon="Download" @click="handleExport">导出</el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="heatapiconfList" @selection-change="handleSelectionChange"
:max-height="tableHeight" :border="true" :column-width-draggable="true">
<el-table-column type="selection" width="55" align="center" fixed="left" />
<!-- <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="standard" />
<el-table-column label="发送地址" align="center" prop="sendIp" />
<el-table-column label="是否启用" align="center" prop="available">
<template #default="scope">
<el-switch v-model="scope.row.available" @change="changeEnabled(scope.row)"/>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" :width="300"
:fixed="fixedColumns ? 'right' : false">
<template #header>
<div class="fixed-column-header" style="text-align: center;display: block;" @dblclick="toggleFixedColumns">
<span style="text-align: center;display: block;">操作<img style="width:10px;margin-left:5px"
v-show="fixedColumns" :src="lock" alt="Image" /></span>
</div>
</template>
<template #default="scope">
<el-button type="text" icon="Edit" @click="handleUpdate(scope.row)">修改</el-button>
<el-button type="text" icon="Delete" @click="handleDelete(scope.row)">删除</el-button>
<el-button type="text" icon="Edit" @click="turnToParamConf(scope.row)">维护推送参数配置</el-button>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize" @pagination="getList" />
</el-col>
</el-row>
<!-- 添加或修改供热办推送接口配置对话框 -->
<el-dialog :title="title" v-model="open" width="700px" append-to-body>
<el-form ref="heatapiconfRef" :model="form" :rules="rules" label-width="80px">
<el-row>
<el-col :span="14">
<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 />
</el-form-item>
</el-col>
<el-col :span="10">
<el-form-item label="标准值" prop="standard">
<el-input v-model="form.standard" placeholder="请输入标准值" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="发送地址" prop="sendIp">
<el-input v-model="form.sendIp" placeholder="请输入发送地址" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<style lang="scss" > @import "@/assets/styles/self-defined.scss";
</style>
<script setup name="Heatapiconf">
import { listHeatapiconf, getHeatapiconf, delHeatapiconf, addHeatapiconf, updateHeatapiconf } from "@/api/model/heatapiconf";
import { deptTreeSelect } from "@/api/system/user";
import lock from "@/assets/icons/svg/lock.svg";
import { ElMessageBox } from 'element-plus';
const { proxy } = getCurrentInstance();
const heatapiconfList = ref([]);
const open = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const title = ref("");
const deptOptions = ref([]);
const deptName = ref(null);
const fixedColumns = ref(false);
const tableHeight = ref("0px");
const collapseVisible = ref(false);
const router = useRouter();
const data = reactive({
form: {},
queryParams: {
pageNum: 1,
pageSize: 10,
orgCode: null,
standard: null
},
rules: {
}
});
const { queryParams, form, rules } = toRefs(data);
/** 查询供热办推送接口配置列表 */
function getList() {
loading.value = true;
listHeatapiconf(queryParams.value).then(response => {
heatapiconfList.value = response.rows;
total.value = response.total;
loading.value = false;
});
}
//
function cancel() {
open.value = false;
form.value.standard = null;
}
//
function reset() {
form.value = {
tentantId: null,
version: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
deptId: null,
userId: null,
deleteBy: null,
deleteTime: null,
id: null,
standard: null
};
}
/** 搜索按钮操作 */
function handleQuery() {
queryParams.value.pageNum = 1;
getList();
}
/** 重置按钮操作 */
function resetQuery() {
proxy.resetForm("queryRef");
queryParams.value.orgCode = null;
queryParams.value.orgName = null;
queryParams.value.standard = null;
queryParams.value.sendIp = null;
handleQuery();
}
//
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.id);
ids.names = selection.map(item => item.orgName);
single.value = selection.length != 1;
multiple.value = !selection.length;
}
/** 新增按钮操作 */
function handleAdd() {
form.value.standard = null;
form.value.available = true;
form.value.sendIp = null;
open.value = true;
title.value = "添加供热办推送接口配置";
}
/** 修改按钮操作 */
function handleUpdate(row) {
reset();
const _id = row.id || ids.value
if (_id.length === 0) {
ElMessageBox.alert('请选择需要修改的记录', '提示', {
confirmButtonText: '确定',
center: true,
})
return;
} else if (_id.length > 1) {
ElMessageBox.alert('只能选择一条记录进行修改', '提示', {
confirmButtonText: '确定',
center: true,
})
return;
}
getHeatapiconf(_id).then(response => {
form.value = response.data;
open.value = true;
title.value = "修改供热办推送接口配置";
});
}
/** 提交按钮 */
function submitForm() {
proxy.$refs["heatapiconfRef"].validate(valid => {
if (valid) {
if (form.value.id != null) {
updateHeatapiconf(form.value).then(response => {
proxy.$modal.msgSuccess("修改成功");
open.value = false;
getList();
});
} else {
addHeatapiconf(form.value).then(response => {
proxy.$modal.msgSuccess("新增成功");
open.value = false;
getList();
});
}
}
});
}
/** 删除按钮操作 */
function handleDelete(row) {
const _ids = row.id || ids.value;
if (_ids.length == 0) {
ElMessageBox.alert('请先选择要删除的项', '提示', {
confirmButtonText: '确定',
center: true,
})
return;
}
const _names = row.orgName || ids.names;
proxy.$modal.confirm('是否确认删除供热办推送接口配置编号为"' + _names + '"的数据项?').then(function () {
return delHeatapiconf(_ids);
}).then(() => {
getList();
proxy.$modal.msgSuccess("删除成功");
}).catch(() => { });
}
function getDeptTree() {
deptTreeSelect().then(response => {
deptOptions.value = response.data;
const filteredData = getDeptTreeNew(deptOptions.value);
deptOptions.value = filteredData;
});
};
function selectDept(val) {
form.value.orgCode = val.id;
form.value.orgName = val.label;
}
/** 节点单击事件 */
function handleNodeClick(data) {
queryParams.value.orgCode = data.id;
form.value.orgCode = data.id;
form.value.orgName = data.label;
handleQuery();
};
/** 通过条件过滤节点 */
const filterNode = (value, data) => {
if (!value) return true;
return data.label.indexOf(value) !== -1;
};
/** 根据名称筛选部门树 */
watch(deptName, val => {
proxy.$refs["deptTreeRef"].filter(val);
});
/**固定操作列 */
function toggleFixedColumns() {
fixedColumns.value = !fixedColumns.value;
}
onMounted(() => {
calculateTableHeight();
window.addEventListener('resize', calculateTableHeight);
window.onresize = () => {
return (() => {
calculateTableHeight();
})()
}
})
onUnmounted(() => {
window.removeEventListener('resize', calculateTableHeight);
});
watch(
[collapseVisible, showSearch],
() => {
calculateTableHeight();
}
);
const calculateTableHeight = () => {
nextTick(() => {
const heightForm = proxy.$refs.queryRef?.$el.clientHeight || 0;
const windowHeight = window.innerHeight;
const paginationHeight = 60;
const tableHeaderHeight = 40;
const tableMargin = 20;
const remainingHeight = windowHeight - paginationHeight - tableHeaderHeight - tableMargin - heightForm - 100;
tableHeight.value = remainingHeight + 'px';
});
};
function getDeptTreeNew(data, level = 0) {
const result = [];
if (level === 0) {
data.forEach(item => {
if (item.children) {
result.push(...getDeptTreeNew(item.children, level + 1));
}
});
} else {
data.forEach(item => {
if (level < 2) {
const newItem = { ...item };
newItem.id = String(item.id); // id
if (item.children) {
newItem.children = getDeptTreeNew(item.children, level + 1);
}
result.push(newItem);
}
});
}
return result;
}
function changeEnabled(row){
ElMessageBox.confirm('确定修改该启用状态吗', '提示', {
distinguishCancelAndClose: true,
confirmButtonText: '确定',
cancelButtonText: '取消',
})
.then(() => {
console.log("确定");
let param = {
id:row.id,
available:row.available
}
updateHeatapiconf(param);
})
.catch((action) => {
console.log("取消");
row.available = !row.available;
})
}
function turnToParamConf(row){
router.push({
path: "heatParamModel",
query: {
standardConfId:row.id,
}
});
}
getDeptTree();
getList();
</script>

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

@ -0,0 +1,305 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item label="参数模版编号" prop="paramClassId">
<el-input v-model="queryParams.paramClassId" placeholder="请输入参数模版编号" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="参数模板名称" prop="paramClassName">
<el-input v-model="queryParams.paramClassName" placeholder="请输入参数模板名称" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button type="info" plain icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="success" icon="Plus" @click="handleAdd">新增</el-button>
</el-col>
<!-- <el-col :span="1.5">
<el-button type="success" icon="Edit" @click="handleUpdate">修改</el-button>
</el-col> -->
<el-col :span="1.5">
<el-button type="success" icon="Delete" @click="handleDelete">删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" icon="Download" @click="handleExport">导出</el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="heatParamModelList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<!-- <el-table-column label="主键" align="center" prop="id" /> -->
<el-table-column label="热源" align="center" prop="standardConfId">
<template #default="scope">
{{ getHeatName(scope.row.standardConfId) }}
</template>
</el-table-column>
<el-table-column label="参数模版" align="center" prop="paramClassId">
<template #default="scope">
{{ getParamClassName(scope.row.paramClassId) }}
</template>
</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="Delete" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize"
@pagination="getList" />
<!-- 添加或修改热源推送参数配置对话框 -->
<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>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<style lang="scss" > @import "@/assets/styles/self-defined.scss";
.center-message {
position: fixed;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
</style>
<script setup name="HeatParamModel">
import { listHeatParamModel, getHeatParamModel, delHeatParamModel, addHeatParamModel, updateHeatParamModel, addBatchHeatParamModel, updateHeatParamModelNew } from "@/api/model/heatparammodel";
import { listNoPage } from "@/api/model/heatapiconf";
import { listParamclassNoPage } from "@/api/model/paramclass";
const { proxy } = getCurrentInstance();
const heatParamModelList = ref([]);
const open = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const title = ref("");
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 data = reactive({
form: {
standardConfId: standardConfId,
},
queryParams: {
pageNum: 1,
pageSize: 10,
standardConfId: null,
paramClassId: null,
paramClassName: null
},
rules: {
}
});
const { queryParams, form, rules } = toRefs(data);
/** 查询热源推送参数配置列表 */
function getList() {
if (standardConfId != null && standardConfId != undefined && standardConfId != "") {
queryParams.value.standardConfId = standardConfId;
}
loading.value = true;
listHeatParamModel(queryParams.value).then(response => {
heatParamModelList.value = response.rows;
total.value = response.total;
loading.value = false;
});
}
//
function cancel() {
open.value = false;
reset();
}
//
function reset() {
form.value = {
tentantId: null,
version: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
deptId: null,
userId: null,
deleteBy: null,
deleteTime: null,
id: null,
standardConfId: standardConfId,
paramClassId: null,
paramClassName: null
};
proxy.resetForm("heatParamModelRef");
}
/** 搜索按钮操作 */
function handleQuery() {
queryParams.value.pageNum = 1;
getList();
}
/** 重置按钮操作 */
function resetQuery() {
proxy.resetForm("queryRef");
handleQuery();
}
//
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
}
/** 新增按钮操作 */
function handleAdd() {
reset();
open.value = true;
title.value = "添加热源推送参数配置";
}
/** 修改按钮操作 */
function handleUpdate(row) {
reset();
const _id = row.id || ids.value
getHeatParamModel(_id).then(response => {
form.value = response.data;
open.value = true;
title.value = "修改热源推送参数配置";
});
}
/** 提交按钮 */
function submitForm() {
proxy.$refs["heatParamModelRef"].validate(valid => {
if (valid) {
if (form.value.id != null) {
let paramSub = new Array();
form.value.paramClassId?.forEach(item => {
paramSub.push({
paramClassId: item,
standardConfId: standardConfId,
})
})
let paramAll = {
standardConfId: standardConfId,
dcHeatParamModelList: paramSub
}
updateHeatParamModelNew(paramAll).then(response => {
proxy.$modal.msgSuccess("修改成功");
open.value = false;
getList();
});
} else {
let paramSub = new Array();
form.value.paramClassId?.forEach(item => {
paramSub.push({
paramClassId: item,
standardConfId: standardConfId,
})
})
addBatchHeatParamModel(paramSub).then(response => {
proxy.$modal.msgSuccess("新增成功");
open.value = false;
getList();
});
}
}
});
}
/** 删除按钮操作 */
function handleDelete(row) {
const _ids = row.id || ids.value;
proxy.$modal.confirm('是否确认删除热源推送参数配置编号为"' + _ids + '"的数据项?').then(function () {
return delHeatParamModel(_ids);
}).then(() => {
getList();
proxy.$modal.msgSuccess("删除成功");
}).catch(() => { });
}
/** 导出按钮操作 */
function handleExport() {
proxy.download('model/heatParamModel/export', {
...queryParams.value
}, `heatParamModel_${new Date().getTime()}.xlsx`)
}
function getParamModel() {
listParamclassNoPage({}).then(response => {
paramClassList.value = response.data;
});
}
function getParamClassName(paramClassId) {
for (let item of paramClassList.value) {
if (item.paramClassCode === paramClassId) {
return item.paramClassName
}
}
return ''
}
function getHeatList() {
listNoPage({}).then(response => {
heatList.value = response.data;
});
}
function getHeatName(standardConfId) {
for (let item of heatList.value) {
if (String(item.id) === standardConfId) {
return item.orgName
}
}
return ''
}
// created() {
// eventBus.$on('reload-heatParamModel', () => {
// this.reload();
// });
// }
getHeatList();
getParamModel();
getList();
</script>
Loading…
Cancel
Save