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

14号解决Bug第一次

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