Commit f9b76a0e authored by 裴文涛's avatar 裴文涛

气象干预所有功能完成

parent 5ff241bb
......@@ -16,6 +16,9 @@ export const postEnergyDel = params => {
console.log(error);
})
}
export const getOrganizationStructureInterface = ()=>{
return http.get('/api/home/GetOrg')
} // 获取组织结构接口
// 能源消耗-修改
export const postEnergyUpdate = params => {
......
......@@ -53,8 +53,34 @@ const confirmRevise = val => { // 修改弹窗确认按钮事件
})
}
const confirmBind = val => {
// console.log(val)
let params = cloneDeep(val)
params.isAuto = params.isAuto === '自动模式' ? true : false
params.isFixed = params.isFixed === '固定模式' ? true : false
params.operateTime = getCurrentDateTime()
console.log(params)
// 绑定,新增,和修改用的是同一个接口
alterWeatherMagData(params).then(res=>{
console.log(res)
ElMessage({
message: '绑定成功.',
type: 'success',
})
getData()
bindWindowOpen.value = false
}).catch(err=>{
console.log(err)
ElMessage({
message: '绑定失败.',
type: 'error',
})
bindWindowOpen.value = false
getData()
})
}
const onCancelBind = () => {
bindWindowOpen.value = false
getData()
}
onMounted(() => {
getData()
......@@ -62,7 +88,6 @@ onMounted(() => {
function getData() {
getWeatherMagData().then(res => {
data.value = res.data
console.log("气象干预所有数据",data.value)
})
}
function handleAddWinOpenClose(){
......@@ -155,7 +180,7 @@ function getCurrentDateTime() {
<BindWindow
:open="bindWindowOpen"
:data="dependentSub"
@onCancel="bindWindowOpen = false"
@onCancel="onCancelBind"
@onConfirm="confirmBind"></BindWindow>
</div>
</div>
......
<script setup>
import {ref, defineProps, defineEmits, watchEffect, onMounted, reactive} from "vue";
import {getTransfer} from "@/api/scheduling.js"
import {ref, defineProps, defineEmits, watchEffect, onMounted, reactive, computed} from "vue";
import {getTransfer,getOrganizationStructureInterface} from "@/api/scheduling.js"
import {getWeatherMagData, alterWeatherMagData, deleteWeatherMagData} from '@/api/scheduling.js'
import store from "@/store/index.js";
import cloneDeep from 'lodash/cloneDeep'
import http from "@/api/http.js";
import {ElMessage} from "element-plus";
const props = defineProps({
open: {
......@@ -23,55 +26,74 @@ const emit = defineEmits({
}
})
const bindData = ref({})
let preSupplyName = bindData.value.supplyName // 上一选中的供热站
watchEffect(()=>{
// bindData.value = {...props.data}
bindData.value = cloneDeep(props.data) // 深拷贝数据
})
watchEffect(()=>{
if(bindData.value.supplyName !== preSupplyName){
checkboxGroup.value.length = 0
preSupplyName = bindData.value.supplyName
}
})
const inputStyle = {
color: 'black',
height: '24px'
}
const organizationStructure = ref([]) // 组织结构数据
const supplyData = ref([]) // 供热站数据
const transferData = ref([]) // 换热站数据
const heatExchangeList = ref([
'兴安里',
'永明里',
'润泽园',
'凯旋一期',
'凯旋二期',
'凯旋三期',
'兴旺里东区',
'兴旺里西区',
'兴盛里南环',
'兴盛里北环',
'七邻里',
'胜利里南区',
'胜利里北区',
'兴慧里',
'兴德里',
'行政办公区',
'开元里',
'振业里'
]) // 换热站列表
const transferStructData = ref([]) // 换热站结构数据,每个供热站和一定数量的换热站对应
const BindTransferData = ref([]) // 绑定换热站数据
const checkboxGroup = ref([]) // checkboxGroup上绑定的数据,是根据自定义Id获取到的换热站数据
const checkBoxTransferList = ref([]) // 根据供热站变化展示的不同的transfer
onMounted(()=>{
getSupply()
getTransferData()
getOrganizationStructure()
})
watchEffect(()=>{
// 监听绑定的bindData.supplyName的变换,返回对应的换热站数据
checkBoxTransferList.value.length =0 // 每次供热站的值变化后,清空当前展示的数据,重新赋值
transferStructData.value.forEach(item=>{
if(item.supplyName === bindData.value.supplyName){
item.transferList.forEach(transferObj =>{
checkBoxTransferList.value.push({
unitId:transferObj.unitId,
unitName:transferObj.unitName
})
})
}
})
// console.log("根据供热站变化的换热站数据计算属性",selTransferCheckBoxLs.value)
})
const onSubmit = ()=>{
emit('onConfirm', bindData)
supplyData.value.forEach(item=>{
if(item.supplyName === bindData.value.supplyName){
bindData.value.supplyId = item.supplyId
}
})
checkboxGroup.value.forEach(item=>{
bindData.value.transfers.push({
customizeId: bindData.value.customizeId,
unitId: item,
updateNullFields: ''
})
})
emit('onConfirm', bindData.value)
} // 点击保存按钮
function getTransferData(){ // 获取绑定换热站数据,若在onMounted中无法调用失败(id可能为空),则在opOpen时操作
function getBindTransferData(){ // 获取绑定换热站数据,若在onMounted中无法调用失败(id可能为空),则在opOpen时操作
let param = {
id: bindData.value.customizeId
}
getTransfer(param).then(res=>{
transferData.value = res.data
BindTransferData.value = res.data
checkboxGroup.value.length = 0 // 每一次打开弹窗都会根据新的Id获取获取对应的换热站数据,并且清空原数组,重新赋值
BindTransferData.value.forEach(item=>{
checkboxGroup.value.push(item.unitId)
})
})
}
function getSupply(){
let result = store.getters.getEnterprise()
result[0].serviceCenterList.forEach(fir_item =>{
organizationStructure.value[0].serviceCenterList.forEach(fir_item =>{
fir_item.supplyList.forEach(sec_item=>{
supplyData.value.push({
supplyId: sec_item.supplyId,
......@@ -79,6 +101,35 @@ function getSupply(){
})
})
})
} // 根据组织结构获取供热站数据
function getAllTransfer(){
organizationStructure.value[0].serviceCenterList.forEach(serviceCenter=>{ // 共有两个服务中心
let supplyList = serviceCenter.supplyList // 供热站列表,每个服务中心对应一定的供热站
supplyList.forEach(supply=>{ // 供热站
transferStructData.value.push(
{
supplyId: supply.supplyId,
supplyName: supply.supplyName,
transferList:supply.transferList
}
)
})
})
} // 根据组织结构获取换热站结构数据
function getOrganizationStructure(){
getOrganizationStructureInterface().then(res=>{
organizationStructure.value = res.data
getSupply()
getAllTransfer()
}).catch(err=>{
ElMessage.error('接口异常,获取数据失败.')
})
} // 获取组织结构
function onOpen(){
getBindTransferData()
}
function checkBoxChange(val){
}
</script>
......@@ -87,7 +138,8 @@ function getSupply(){
v-model="props.open"
width="1000px"
title="换热站绑定"
@close="emit('onCancel')">
@close="emit('onCancel')"
@open="onOpen">
<template #default>
<div class="dialog-content">
<el-row style="border-top: #a6c3e9 1px solid" class="not-select-row">
......@@ -99,17 +151,20 @@ function getSupply(){
<el-row class="not-select-row">
<el-col :span="8" class="content-col-label">供热站:</el-col>
<el-col :span="16" class="content-col-value">
<el-select v-model="bindData.supplyId" placeholder="" style="width: 210px;" class="custom-select" size="small">
<el-option v-for="item in supplyData" :key="item.supplyId" :label="item.supplyName" :value="item.supplyId"/> <!--此处还需考虑-->
<el-select v-model="bindData.supplyName" placeholder="" style="width: 210px;" class="custom-select" size="small">
<el-option v-for="item in supplyData" :key="item.supplyId" :label="item.supplyName" :value="item.supplyName"/> <!--此处还需考虑-->
</el-select>
</el-col>
</el-row>
<el-row class="select-row">
<el-col :span="8" class="content-col-label">换热站:</el-col>
<el-col :span="16" class="content-col-value">
<el-checkbox-group v-model="bindData.heatExchangeList" style="width: 510px">
<el-checkbox v-for="item in heatExchangeList" :key="item" :label="item"/>
<el-checkbox-group @change="checkBoxChange" v-model="checkboxGroup" style="width: 510px">
<el-checkbox v-for="item in checkBoxTransferList" :key="item.unitId" :label="item.unitName" :value="item.unitId"></el-checkbox>
</el-checkbox-group>
<!-- <el-checkbox-group v-model="bindData.heatExchangeList" style="width: 510px">-->
<!-- <el-checkbox v-for="item in heatExchangeList" :key="item" :label="item"/>-->
<!-- </el-checkbox-group>-->
</el-col>
</el-row>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment