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

气象干预所有功能完成

parent 5ff241bb
...@@ -16,6 +16,9 @@ export const postEnergyDel = params => { ...@@ -16,6 +16,9 @@ export const postEnergyDel = params => {
console.log(error); console.log(error);
}) })
} }
export const getOrganizationStructureInterface = ()=>{
return http.get('/api/home/GetOrg')
} // 获取组织结构接口
// 能源消耗-修改 // 能源消耗-修改
export const postEnergyUpdate = params => { export const postEnergyUpdate = params => {
......
...@@ -53,8 +53,34 @@ const confirmRevise = val => { // 修改弹窗确认按钮事件 ...@@ -53,8 +53,34 @@ const confirmRevise = val => { // 修改弹窗确认按钮事件
}) })
} }
const confirmBind = 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 bindWindowOpen.value = false
getData()
} }
onMounted(() => { onMounted(() => {
getData() getData()
...@@ -62,7 +88,6 @@ onMounted(() => { ...@@ -62,7 +88,6 @@ onMounted(() => {
function getData() { function getData() {
getWeatherMagData().then(res => { getWeatherMagData().then(res => {
data.value = res.data data.value = res.data
console.log("气象干预所有数据",data.value)
}) })
} }
function handleAddWinOpenClose(){ function handleAddWinOpenClose(){
...@@ -155,7 +180,7 @@ function getCurrentDateTime() { ...@@ -155,7 +180,7 @@ function getCurrentDateTime() {
<BindWindow <BindWindow
:open="bindWindowOpen" :open="bindWindowOpen"
:data="dependentSub" :data="dependentSub"
@onCancel="bindWindowOpen = false" @onCancel="onCancelBind"
@onConfirm="confirmBind"></BindWindow> @onConfirm="confirmBind"></BindWindow>
</div> </div>
</div> </div>
......
<script setup> <script setup>
import {ref, defineProps, defineEmits, watchEffect, onMounted, reactive} from "vue"; import {ref, defineProps, defineEmits, watchEffect, onMounted, reactive, computed} from "vue";
import {getTransfer} from "@/api/scheduling.js" import {getTransfer,getOrganizationStructureInterface} from "@/api/scheduling.js"
import {getWeatherMagData, alterWeatherMagData, deleteWeatherMagData} from '@/api/scheduling.js'
import store from "@/store/index.js"; import store from "@/store/index.js";
import cloneDeep from 'lodash/cloneDeep' import cloneDeep from 'lodash/cloneDeep'
import http from "@/api/http.js";
import {ElMessage} from "element-plus";
const props = defineProps({ const props = defineProps({
open: { open: {
...@@ -23,55 +26,74 @@ const emit = defineEmits({ ...@@ -23,55 +26,74 @@ const emit = defineEmits({
} }
}) })
const bindData = ref({}) const bindData = ref({})
let preSupplyName = bindData.value.supplyName // 上一选中的供热站
watchEffect(()=>{ watchEffect(()=>{
// bindData.value = {...props.data} // bindData.value = {...props.data}
bindData.value = cloneDeep(props.data) // 深拷贝数据 bindData.value = cloneDeep(props.data) // 深拷贝数据
}) })
watchEffect(()=>{
if(bindData.value.supplyName !== preSupplyName){
checkboxGroup.value.length = 0
preSupplyName = bindData.value.supplyName
}
})
const inputStyle = { const inputStyle = {
color: 'black', color: 'black',
height: '24px' height: '24px'
} }
const organizationStructure = ref([]) // 组织结构数据
const supplyData = ref([]) // 供热站数据 const supplyData = ref([]) // 供热站数据
const transferData = ref([]) // 换热站数据 const transferStructData = ref([]) // 换热站结构数据,每个供热站和一定数量的换热站对应
const heatExchangeList = ref([ const BindTransferData = ref([]) // 绑定换热站数据
'兴安里', const checkboxGroup = ref([]) // checkboxGroup上绑定的数据,是根据自定义Id获取到的换热站数据
'永明里', const checkBoxTransferList = ref([]) // 根据供热站变化展示的不同的transfer
'润泽园',
'凯旋一期',
'凯旋二期',
'凯旋三期',
'兴旺里东区',
'兴旺里西区',
'兴盛里南环',
'兴盛里北环',
'七邻里',
'胜利里南区',
'胜利里北区',
'兴慧里',
'兴德里',
'行政办公区',
'开元里',
'振业里'
]) // 换热站列表
onMounted(()=>{ onMounted(()=>{
getSupply() getOrganizationStructure()
getTransferData() })
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 = ()=>{ 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 = { let param = {
id: bindData.value.customizeId id: bindData.value.customizeId
} }
getTransfer(param).then(res=>{ 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(){ function getSupply(){
let result = store.getters.getEnterprise() organizationStructure.value[0].serviceCenterList.forEach(fir_item =>{
result[0].serviceCenterList.forEach(fir_item =>{
fir_item.supplyList.forEach(sec_item=>{ fir_item.supplyList.forEach(sec_item=>{
supplyData.value.push({ supplyData.value.push({
supplyId: sec_item.supplyId, supplyId: sec_item.supplyId,
...@@ -79,6 +101,35 @@ function getSupply(){ ...@@ -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> </script>
...@@ -87,7 +138,8 @@ function getSupply(){ ...@@ -87,7 +138,8 @@ function getSupply(){
v-model="props.open" v-model="props.open"
width="1000px" width="1000px"
title="换热站绑定" title="换热站绑定"
@close="emit('onCancel')"> @close="emit('onCancel')"
@open="onOpen">
<template #default> <template #default>
<div class="dialog-content"> <div class="dialog-content">
<el-row style="border-top: #a6c3e9 1px solid" class="not-select-row"> <el-row style="border-top: #a6c3e9 1px solid" class="not-select-row">
...@@ -99,17 +151,20 @@ function getSupply(){ ...@@ -99,17 +151,20 @@ function getSupply(){
<el-row class="not-select-row"> <el-row class="not-select-row">
<el-col :span="8" class="content-col-label">供热站:</el-col> <el-col :span="8" class="content-col-label">供热站:</el-col>
<el-col :span="16" class="content-col-value"> <el-col :span="16" class="content-col-value">
<el-select v-model="bindData.supplyId" placeholder="" style="width: 210px;" class="custom-select" size="small"> <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.supplyId"/> <!--此处还需考虑--> <el-option v-for="item in supplyData" :key="item.supplyId" :label="item.supplyName" :value="item.supplyName"/> <!--此处还需考虑-->
</el-select> </el-select>
</el-col> </el-col>
</el-row> </el-row>
<el-row class="select-row"> <el-row class="select-row">
<el-col :span="8" class="content-col-label">换热站:</el-col> <el-col :span="8" class="content-col-label">换热站:</el-col>
<el-col :span="16" class="content-col-value"> <el-col :span="16" class="content-col-value">
<el-checkbox-group v-model="bindData.heatExchangeList" style="width: 510px"> <el-checkbox-group @change="checkBoxChange" v-model="checkboxGroup" style="width: 510px">
<el-checkbox v-for="item in heatExchangeList" :key="item" :label="item"/> <el-checkbox v-for="item in checkBoxTransferList" :key="item.unitId" :label="item.unitName" :value="item.unitId"></el-checkbox>
</el-checkbox-group> </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-col>
</el-row> </el-row>
</div> </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