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

14号解决Bug第一次

parent eefb9eb1
<script setup>
import { computed, onMounted, reactive, ref } from "vue";
import { zhCn } from "element-plus/es/locale/index";
import { getAnnualParam, alterAnnualParam, addAnnualParam, deleteAnnualParam } from '@/api/scheduling.js'
import {computed, onBeforeMount, onMounted, reactive, ref} from "vue";
import {
getAnnualParam,
alterAnnualParam,
addAnnualParam,
deleteAnnualParam,
getOrganizationStructureInterface
} from '@/api/scheduling.js'
import { ElMessage, ElMessageBox } from "element-plus";
import { vFloatNumber } from "@/utils/directives.js";
......@@ -38,6 +43,8 @@ const selectYearValue = computed(() => {
return (currentYear.value - 1) + "年-" + currentYear.value + "年"
}
})
const organizationStructure = ref([]) // 组织结构数据
const supplyData = ref([]) // 供热站数据
function handleEdit(val) {
currentYear.value = new Date().getFullYear()
......@@ -92,7 +99,13 @@ function handleSearch() {
data.value = dataBackup.value.filter(item => item.year.includes(searchKey.value))
}
} // 处理查询
function onSubmit() {
function onReviseSubmit() {
if(reviseForm.value.hasOwnProperty('supplyName')){
delete reviseForm.value.supplyName
}
if(reviseForm.value.year.length > 4){
reviseForm.value.year = reviseForm.value.year.slice(6,10)
}
alterAnnualParam(reviseForm.value).then(res => {
if (res.success) {
getData()
......@@ -115,14 +128,13 @@ function onSubmit() {
})
} // 提交修改
function onAddSubmit() { // 提交新增
addForm.value.year = addForm.value.year.slice(6, 10)
data.value.forEach((item, index, array) => {
if (item.energyType === addForm.energyType && item.year === addForm.year) {
alert("该类型年度已存在")
return
}
})
console.log('>>>>>>>>==',addForm.value)
console.log('========>>>>',addForm.value.year)
addAnnualParam(addForm.value).then(res => {
if (res.success) {
getData()
......@@ -149,8 +161,9 @@ function handleClose() {
addWindowOpen.value = false
resetInput()
} // 关闭弹窗
onMounted(() => {
onBeforeMount(()=>{
getData()
getOrganizationStructure()
})
function getData() {
......@@ -206,7 +219,35 @@ function customSort(a, b) {
}
return valA - valB
}
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 getOrganizationStructure() {
getOrganizationStructureInterface().then(res => {
organizationStructure.value = res.data
getSupply()
}).catch(err => {
ElMessage.error('接口异常,获取数据失败.')
})
} // 获取组织结构
function showSupplyName(id){
let supplyName = ""
supplyData.value.forEach(item=>{
if(item.supplyId === id){
supplyName = item.supplyName
}
})
return supplyName
}
</script>
<template>
......@@ -227,6 +268,11 @@ function customSort(a, b) {
:header-cell-class-name="tableHeaderClass" :row-class-name="tableBodyClass" style="width: 100%">
<el-table-column label="序号" type="index" align="center" width="60" />
<el-table-column label="节能类型" sortable :sort-method="customSort" prop="energyType" />
<el-table-column label="供热站名称">
<template #default="scope">
{{showSupplyName(scope.row.supplyId)}}
</template>
</el-table-column>
<el-table-column label="年度" sortable prop="year" />
<el-table-column label="热指标(W/m²)" prop="standard" />
<el-table-column label="度日数标定值" prop="degreeStandard" />
......@@ -262,6 +308,14 @@ function customSort(a, b) {
</el-select>
</el-col>
</el-row>
<el-row>
<el-col :span="8" col-label>供热站:</el-col>
<el-col :span="16" col-value>
<el-select placeholder="请选择供热站" size="small" v-model="reviseForm.supplyId" style="width: 370px">
<el-option v-for="item in supplyData" :key="item.supplyId" :value="item.supplyId" :label="item.supplyName" />
</el-select>
</el-col>
</el-row>
<el-row>
<el-col :span="8" col-label>热指标(W/m²):</el-col>
<el-col :span="16" col-value>
......@@ -295,7 +349,7 @@ function customSort(a, b) {
</template>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="onSubmit">保存</el-button>
<el-button type="primary" @click="onReviseSubmit">保存</el-button>
<el-button type="primary" @click="handleClose">关闭</el-button>
</div>
</template>
......@@ -318,6 +372,14 @@ function customSort(a, b) {
</el-select>
</el-col>
</el-row>
<el-row>
<el-col :span="8" col-label>供热站:</el-col>
<el-col :span="16" col-value>
<el-select placeholder="请选择供热站" size="small" v-model="addForm.supplyId" style="width: 370px">
<el-option v-for="item in supplyData" :key="item.supplyId" :value="item.supplyId" :label="item.supplyName" />
</el-select>
</el-col>
</el-row>
<el-row>
<el-col :span="8" col-label>热指标(W/m²):</el-col>
<el-col :span="16" col-value>
......
......@@ -156,7 +156,7 @@ function getData(){
})
}
function customSort(a,b){
return a.phenomenonType - b.phenomenonType
return b.phenomenonType - a.phenomenonType
}
</script>
<template>
......@@ -178,6 +178,7 @@ function customSort(a,b){
stripe
border
style="width: 100%"
:default-sort="{ prop: 'phenomenonName', order: 'descending' }"
:header-cell-class-name="tableHeaderClass"
:row-class-name="tableBodyClass">
<el-table-column type="index" label="序号" align="center" width="100"/>
......@@ -201,12 +202,6 @@ function customSort(a,b){
width="700px"
:before-close="handleClose">
<template #default>
<!-- <el-row first>
<el-col :span="8" col-label class="energy-type-class">名称:</el-col>
<el-col :span="16" col-value>
<el-input placeholder="" size="small" v-model="reviseForm.phenomenonName" style="width: 370px"/>
</el-col>
</el-row> -->
<el-row>
<el-col :span="8" col-label class="energy-type-class">名称:</el-col>
<el-col :span="16" col-value>
......
......@@ -147,12 +147,12 @@ function handleAdd(val){
console.log("新增数据",val)
alterWeatherMagData(val).then(res=>{
if(res.success){
getData()
addWindowOpen.value = false
ElMessage({
message: '新增成功.',
message: res.message,
type: 'success',
})
getData()
addWindowOpen.value = false
}else {
ElMessage({
message: res.message,
......@@ -255,6 +255,7 @@ function resetSearch(){
border
style="width: 100%"
height="720px"
:default-sort="{ prop: 'operateTime', order: 'descending' }"
:header-cell-class-name="tableHeaderClass"
:row-class-name="tableBodyClass">
<el-table-column prop="allowPagingId" label="编号" align="center" width="60"/>
......
......@@ -144,7 +144,10 @@ function resetInput() {
windDesc: "",
};
}
function resetSearch(){
searchKey.value = "";
getData()
}
function customSort(a, b) {
return a.windLevel - b.windLevel;
}
......@@ -176,6 +179,9 @@ function customSort(a, b) {
<el-button type="primary" @click="add" class="add-search-btn"
>新增</el-button
>
<el-button type="primary" @click="resetSearch" class="add-search-btn"
>重置</el-button
>
</div>
<div class="table-wrapper">
<el-table
......@@ -183,6 +189,7 @@ function customSort(a, b) {
stripe
border
style="width: 100%"
:default-sort="{prop: 'windLevel', order: 'descending'}"
:header-cell-class-name="tableHeaderClass"
:row-class-name="tableBodyClass"
>
......
......@@ -3,14 +3,11 @@ import {
ref,
defineProps,
defineEmits,
watchEffect, watch,
watchEffect
} from "vue";
import {getTransferInterface, getWeatherMagData} from "@/api/scheduling.js"
import {ElLoading} from 'element-plus'
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: {
......@@ -27,18 +24,7 @@ const props = defineProps({
type: Array,
default: [],
required: true
},
transfer: {
type: Array,
default: [],
required: true
},
allWeatherMagData: {
type: Array,
default: [],
required: true
}
})
}})
const emit = defineEmits({
onCancel: null,
onConfirm: ({}) => {
......@@ -50,7 +36,6 @@ const supplyData = ref([]) // 供热站数据
const transferData = ref([]) // 换热站数据
const selectedTransfer = ref([]) // 被本气象干预方案选中的换热站
let optional = '' // 可以选换热站的供热站
let isAlreadyBind = false
let loadingInstance = null
const inputStyle = {
color: 'black',
......@@ -152,7 +137,7 @@ function selectChange(val) {
* @param val
*/
function checkboxChange(val) {
console.log('checkboxChange====>>>===>>>', val)
// console.log('checkboxChange====>>>===>>>', val)
}
</script>
<template>
......
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