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

12号晚最后一次提交

parent 9e0e22ac
<script setup>
import {computed, isRef, onMounted, reactive, ref, shallowRef} from "vue";
import {computed, isRef, onBeforeMount, onMounted, reactive, ref, shallowRef} from "vue";
import ReviseWindow from "./weatherManageSub/ReviseWindow.vue";
import BindWindow from "./weatherManageSub/BindWindow.vue";
import {getWeatherMagData, alterWeatherMagData, deleteWeatherMagData} from '@/api/scheduling.js'
import {
getWeatherMagData,
alterWeatherMagData,
deleteWeatherMagData,
getOrganizationStructureInterface
} from '@/api/scheduling.js'
import AddWindow from "./weatherManageSub/AddWindow.vue";
import {ElMessage, ElMessageBox} from "element-plus";
import store from "@/store/index.js";
......@@ -10,6 +15,7 @@ import cloneDeep from 'lodash/cloneDeep'
import {vFloatNumber} from "@/utils/directives.js";
const data = ref()
const dataBackup = ref([]);
const reviseWindowOpen = ref(false) // 修改按钮弹窗状态
const bindWindowOpen = ref(false) // 绑定按钮弹窗状态
const addWindowOpen = ref(false) // 新增按钮弹窗状态
......@@ -20,7 +26,33 @@ const tableHeaderClass = data => { // 表头样式
const tableBodyClass = data => { // 表体样式
return 'table-body-class'
}
const isAutoSearchKey = ref() // 手自动模式查询
const supplySearchKey = ref() // 供热站查询
const organizationStructure = ref([]) // 组织结构数据
const supplyData = ref([]) // 供热站数据
const transferStructData = ref([]) // 换热站结构数据,每个供热站和一定数量的换热站对应
function search() {
if(!isAutoSearchKey.value && !supplySearchKey.value){
getData()
}else {
if(isAutoSearchKey.value && supplySearchKey.value){
data.value = dataBackup.value.filter(item => {
return item.isAuto === isAutoSearchKey.value && item.supplyName.includes(supplySearchKey.value)
})
}else {
if(isAutoSearchKey.value){
data.value = dataBackup.value.filter(item => {
return item.isAuto === isAutoSearchKey.value
})
}else {
data.value = dataBackup.value.filter(item => {
return item.supplyName.includes(supplySearchKey.value)
})
}
}
}
}
const revise = (row) => { // 修改按钮单击事件
dependentSub.value = row
reviseWindowOpen.value = true
......@@ -99,11 +131,16 @@ const onCancelBind = () => {
getData()
}
onMounted(() => {
})
onBeforeMount(()=>{
getData()
getOrganizationStructure()
})
function getData() {
getWeatherMagData().then(res => {
data.value = res.data
dataBackup.value = [...data.value];
})
}
function handleAddWinOpenClose(){
......@@ -143,17 +180,69 @@ function getCurrentDateTime() {
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
} // 生成时间
function getSupply() {
supplyData.value = []
organizationStructure.value[0].serviceCenterList.forEach(fir_item => {
fir_item.supplyList.forEach(sec_item => {
let temp = {
supplyId: sec_item.supplyId,
supplyName: sec_item.supplyName,
}
supplyData.value.push({...temp})
})
})
} // 根据组织结构获取供热站数据
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
}
)
})
transferStructData.value.forEach(item=>{
item.transferList.forEach((unit)=>{
unit.isUsed = false
unit.customizeId = ''
})
})
})
} // 根据组织结构获取换热站结构数据
function getOrganizationStructure() {
getOrganizationStructureInterface().then(res => {
organizationStructure.value = res.data
getSupply()
getAllTransfer()
}).catch(err => {
ElMessage.error('接口异常,获取数据失败.')
})
} // 获取组织结构
</script>
<template>
<div class="weather-manage-container">
<el-row>
<el-col :span="15" left-col>
<el-button type="primary" @click="addWindowOpen = true" class="add-btn">新增</el-button>
<el-button type="primary" @click="getData">查询</el-button>
<div class="isAuto-search-area">
手自动模式:
<el-select v-model="isAutoSearchKey" style="width: 300px" placeholder="请选择手自动模式" clearable>
<el-option :label="手动模式" value="手动模式"/>
<el-option :label="自动模式" value="自动模式"/>
</el-select>
</div>
<div class="supplyName-search-area">
供热站名称:
<el-input v-model="supplySearchKey" placeholder="请输入供热站名称" clearable style="width: 300px"/>
</div>
</el-col>
<el-col :span="9" right-col>
<el-button type="primary" @click="addWindowOpen = true" class="add-btn">新增</el-button>
<el-button type="primary" @click="search">查询</el-button>
</el-col>
</el-row>
<div class="table-wrapper">
......@@ -162,7 +251,7 @@ function getCurrentDateTime() {
stripe
border
style="width: 100%"
height="900px"
height="720px"
:header-cell-class-name="tableHeaderClass"
:row-class-name="tableBodyClass">
<el-table-column prop="allowPagingId" label="编号" align="center" width="60"/>
......@@ -183,7 +272,6 @@ function getCurrentDateTime() {
<div class="table-operate-column">
<el-button link @click="revise(scope.row)" type="primary">修改</el-button>
<el-button link @click="bind(scope.row)" type="primary">绑定换热站</el-button>
<el-button link type="primary">详情</el-button>
</div>
</template>
</el-table-column>
......@@ -203,22 +291,34 @@ function getCurrentDateTime() {
<BindWindow
:open="bindWindowOpen"
:data="dependentSub"
:supply="supplyData"
:transfer="transferStructData"
:all-weather-mag-data="dataBackup"
@onCancel="onCancelBind"
@onConfirm="confirmBind"></BindWindow>
</div>
</div>
</template>
<style scoped>
.weather-manage-container {
width: 100%;
margin: 4px;
}
.el-col[left-col] {
.el-col[left-col]{
border-right: 1px solid #a6c3e9;
display: flex;
align-items: center;
justify-content: start;
padding-left: 20px;
font-size: 14px;
.isAuto-search-area{
margin-right: 20px;
}
.supplyName-search-area{
}
}
.el-row {
......
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