Files
energy_app/src/views/energyEfficiency/TaskFilling.vue
T
jiangyinzhi 63dc3bcc89 xiugai
2025-07-29 10:21:59 +08:00

864 lines
26 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<div>
<!-- <Header :title="title" @onClickLeft="onClickLeft" /> -->
<!-- 头部 -->
<div class="list">
<div class="header">
<div class="header-name">
<img src="@/assets/TaskFilling1.png" alt="" />
{{ item.customerName || item.consName}}
</div>
<div class="header-address">
<img src="@/assets/TaskFilling2.png" alt="" />
<div class="address-warp">地址: {{ item.detailAddress || item.elecAddr }}</div>
</div>
<div class="header-title">{{ typeName }}</div>
</div>
<!-- 选择 -->
<div class="select">
<van-cell>
<template #title>
<div
style="width: 100%; display: flex; justify-content: space-between"
>
<span class="custom-text">
<div class="line"></div>
建筑信息
</span>
<!-- <van-tag type="warning" v-if="!buildId" class="custom-type" >未填写</van-tag> -->
</div>
</template>
</van-cell>
<div class="main1-content" @click="constructionInfo">
<img src="@/assets/ggjz/1.png" alt="" />
<div class="main1-content-text">建筑信息</div>
</div>
<van-cell style="margin-top: 20px">
<template #title>
<span class="custom-text">
<div class="line"></div>
主要用能设备
</span>
<!-- <span class="custom-text"><img src="@/assets/TaskFilling3.png" alt="" />用能设备信息</span> -->
</template>
</van-cell>
<div class="main2-flex">
<div
class="main2-content"
v-for="(item, index) in iconList"
:key="index"
>
<img :src="item.icon" alt="" @click="facilityManage(item)" />
<div class="main2-content-text" @click="facilityManage(item)">
{{ item.name }}
</div>
<div class="img-del" @click="iconDelete(item, index)">
<img src="@/assets/数据采集-减号.png" alt="" />
</div>
</div>
<div
class="main2-content"
@click="energyadd"
v-if="iconList.length < 7"
>
<img src="@/assets/数据采集-新增.png" alt="" />
<div class="main2-content-text">新增</div>
</div>
</div>
<van-cell style="margin-top: 20px">
<template #title>
<span class="custom-text">
<div class="line"></div>
能耗数据信息
</span>
<!-- <span class="custom-text"
><img src="@/assets/TaskFilling4.png" alt="" />能耗数据信息</span> -->
</template>
</van-cell>
<div class="main1-content" @click="energyConsumption">
<img src="@/assets/ggjz/9.png" alt="" />
<div class="main1-content-text">能耗数据</div>
</div>
</div>
</div>
<div class="btn">
<van-button
size="large"
class="faqi"
@click="saveAllInfo"
v-if="taskType < 3"
>
提交
</van-button>
</div>
</div>
</template>
<script>
// import Header from "@/components/headerNew";
import { getCurrentPersonInfoAPI } from '@/api/customerIformation.js'
import { getSingleTaskInfo } from '@/api/customer.js'
import { changeSubStateType, taskList } from '@/api/api'
// import { Dialog } from
import { Notify } from 'vant'
import { getCode } from '@/api/common.js'
import {
getCustomerInfo,
getEnergyEquip,
addEnergyEquip,
getSearchList,
editEnergyEquip,
} from '@/api/energyConsumption'
import { dataMode } from '@/views/facilityManage/common.js'
export default {
name: 'TaskFilling',
components: {
// Header,
},
data() {
return {
showList: [
{
id: 'focusAir',
name: '空调-集中式',
icon: require('@/assets/ggjz/2.png'),
systemTypes: '01',
typeId: '1',
},
{
id: 'multipleAir',
name: '空调-多联式',
icon: require('@/assets/ggjz/3.png'),
systemTypes: '02',
typeId: '8',
},
{
id: 'fissionAir',
name: '空调-分体式',
icon: require('@/assets/ggjz/4.png'),
systemTypes: '03',
typeId: '9',
},
{
id: 'heating',
name: '采暖系统',
icon: require('@/assets/ggjz/5.png'),
systemTypes: '04',
typeId: '2',
},
{
id: 'distribution',
name: '配电系统',
icon: require('@/assets/ggjz/6.png'),
systemTypes: '05',
typeId: '4',
},
{
id: 'illumination',
name: '照明系统',
icon: require('@/assets/ggjz/7.png'),
systemTypes: '06',
typeId: '3',
},
{
id: 'hotWater',
name: '生活热水系统',
icon: require('@/assets/ggjz/8.png'),
systemTypes: '07',
typeId: '5',
},
],
iconList: [],
currentPath: {
path: '',
type: 1,
name: '',
},
title: '任务信息填报',
statusPopup: false,
datePopup: false,
currentDate: new Date(),
// 点击填报用户信息
item: {},
buildId: '',
typeList: [], //类型列表
searchInfo: {},
taskId: '',
taskType: '1',
records:[],
tidCid: null,
editData: {}
}
},
computed: {
showForm() {
if(this.tidCid.taskId) {
return false
}
return true
},
// 类型
typeName() {
this.typeList.forEach((v) => {
v.child.forEach((ev) => {
if (this.item.customerType == ev.code) {
this.item.customerTypeName = v.name + '/' + ev.name
}
})
})
return this.item.customerTypeName
},
},
created() {
this.tidCid = JSON.parse(sessionStorage.getItem('tidCid'))
this.getCustomerStatistic()
// this.getBuildId()
this.getPathInfo()
if (!sessionStorage.getItem('goBack')) {
this.getFacData()
}
this.getCustomerType()
this.getSearchInfo()
let data = JSON.parse(sessionStorage.getItem('tidCid'))
this.tidCid = data
if(data.taskId) {
this.taskId = data.taskId
this.taskType = data.taskType||sessionStorage.getItem('taskType')
}
},
methods: {
//获取所有询问数据
async getSearchInfo() {
/**
* 获取询问的数据,根据询问的enquireMode拆分为n个数组,将enquireMode相同的放置到同类数组中
*/
const res = await getSearchList()
if (res.code == 0) {
const mapList = [
...new Set(res.data.records.map((ele) => ele.enquireMode)),
]
mapList.forEach((ele) => {
this.searchInfo[ele] = []
})
res.data.records.forEach((v) => {
mapList.forEach((ele) => {
if (ele == v.enquireMode) {
this.searchInfo[ele].push(v)
}
})
})
sessionStorage.setItem('searchInfo', JSON.stringify(this.searchInfo))
this.$store.commit('pageData/GET_SEARCHINFO', this.searchInfo)
}
},
// 图标添加
energyadd() {
if(!this.tidCid.taskId) {
return
}
this.buildId = sessionStorage.getItem('buildId')||this.tidCid.buildId
if (!this.buildId) {
Notify({ type: 'danger', message: '请先填写建筑信息' })
} else {
const systemTypes = this.iconList.map((item) => {
return item.systemTypes
})
this.$router.push({
path: './useenergyadd',
query: { systemTypes: systemTypes },
})
}
},
// 图标删除
iconDelete(item, index) {
if(this.showForm) {
return
}
const data = {
nxzdRefrigeSystemDTO: [], //空调信息
nxzdHeatSystemDTO: [], //采暖系统信息
nxzdLightSystemDTO: {}, //照明系统信息
nxzdDistributeSystemDTO: {}, //配电系统
nxzdHotWaterSystemDTO: {}, //生活热水系统信息
nxzdUseEnergyEquipDTO: {
buildId: '', //建筑id
consId: '', //客户编码
equipId: '', //用能设备id
/**
* 集中式空调
*/
cenEnquireDevIds: '', //设备类
cenEnquireIds: '', //运营类
cenEquipModiy: '', //是否改造
cenIntellectModifyYear: '', //集中控制系统改造年份
cenModifyYear: '', //更换高能效设备改造年份
cenWaterModifyYear: '', //水泵增加智能变频控制改造年份
/**
* 多联式空调
*/
conEnquireDevIds: '', //设备类
conEnquireIds: '', //运营类
conEquipModiy: '', //是否改造
conIntellectModifyYear: '', //智能化集中改造年份
conModifyYear: '', //更换高能效设备改造年份
/**
* 配电系统
*/
distributeEnquireDevIds: '', //设备类
distributeEnquireIds: '', //运营类
/**
* 采暖系统
*/
heatEnquireDevIds: '', //设备类
heatEnquireIds: '', //运营类
heatEquipModiy: '', //是否改造
heatMode: '', //采暖方式
heatIntellectModifyYear: '', //智能化集中改造年份
heatModifyYear: '', //更换高能效设备改造年份
heatType: '', //采暖设备类型
/**
* 生活热水
*/
hotWaterEnquireDevIds: '', //设备类
hotWaterEnquireIds: '', //运营类
/**
* 照明系统
*/
lightEnquireDevIds: '', //设备类
lightEnquireIds: '', //运营类
/**
* 输送泵组
*/
pumpNum: '0', // 输送泵组台数
pumpTotalPower: '', //输送泵组总功率
pumpYear: '', // 输送泵组设备年份
}, //用能设备闻询问类
}
for (const key in this.$store.getters.editData.info) {
if (
typeof this.$store.getters.editData.info[key] == 'string' ||
typeof this.$store.getters.editData.info[key] == 'number'
) {
for (const keys in data.nxzdUseEnergyEquipDTO) {
if (key == keys) {
data.nxzdUseEnergyEquipDTO[keys] =
this.$store.getters.editData.info[key]
}
}
} else {
data[key] = this.$store.getters.editData.info[key]
}
}
const searchData = this.$store.getters.searchInfo
this.iconList.splice(index, 1)
switch (item.id) {
case 'heating':
data.nxzdUseEnergyEquipDTO.heatType = ''
data.nxzdUseEnergyEquipDTO.heatMode = ''
data.nxzdUseEnergyEquipDTO.heatEquipModiy = ''
data.nxzdUseEnergyEquipDTO.heatModifyYear = ''
data.nxzdUseEnergyEquipDTO.heatIntellectModifyYear = ''
data.nxzdUseEnergyEquipDTO.pumpNum = '0'
data.nxzdUseEnergyEquipDTO.pumpYear = ''
data.nxzdUseEnergyEquipDTO.pumpTotalPower = ''
data.nxzdHeatSystemDTO = null
this.resetData(data, item.typeId)
break
case 'hotWater':
// eslint-disable-next-line no-case-declarations
const hotres = dataMode(searchData['sbshrs'])
data.nxzdUseEnergyEquipDTO.hotWaterEnquireDevIds = hotres.find((ele) => ele.type == 2).child.map((item) => item.enquireId).join(',')
data.nxzdUseEnergyEquipDTO.hotWaterEnquireIds = hotres.find((ele) => ele.type == 1).child.map((item) => item.enquireId).join(',')
data.nxzdHotWaterSystemDTO = null
this.resetData(data, item.typeId)
break
case 'illumination':
// eslint-disable-next-line no-case-declarations
const illres = dataMode(searchData['sbzm'])
data.nxzdUseEnergyEquipDTO.lightEnquireDevIds = illres.find((ele) => ele.type == 2).child.map((item) => item.enquireId).join(',')
data.nxzdUseEnergyEquipDTO.lightEnquireIds = illres.find((ele) => ele.type == 1).child.map((item) => item.enquireId).join(',')
data.nxzdLightSystemDTO = null
this.resetData(data, item.typeId)
break
case 'distribution':
// eslint-disable-next-line no-case-declarations
const disres = dataMode(searchData['sbpd'])
data.nxzdUseEnergyEquipDTO.distributeEnquireDevIds = disres.find((ele) => ele.type == 2).child.map((item) => item.enquireId).join(',')
data.nxzdUseEnergyEquipDTO.distributeEnquireIds = disres.find((ele) => ele.type == 1).child.map((item) => item.enquireId).join(',')
data.nxzdDistributeSystemDTO = null
this.resetData(data, item.typeId)
break
case 'focusAir':
// eslint-disable-next-line no-case-declarations
const cenres = dataMode(searchData['sbktjz'])
// eslint-disable-next-line no-case-declarations
data.nxzdUseEnergyEquipDTO.cenModifyYear = ''
data.nxzdUseEnergyEquipDTO.cenEquipModiy = ''
data.nxzdUseEnergyEquipDTO.cenWaterModifyYear = ''
data.nxzdUseEnergyEquipDTO.cenIntellectModifyYear = ''
data.nxzdUseEnergyEquipDTO.cenEnquireDevIds = cenres.find((ele) => ele.type == 2).child.map((item) => item.enquireId).join(',')
data.nxzdUseEnergyEquipDTO.cenEnquireIds = cenres.find((ele) => ele.type == 1).child.map((item) => item.enquireId).join(',')
data.nxzdRefrigeSystemDTO = null
this.resetData(data, item.typeId)
break
case 'multipleAir':
// eslint-disable-next-line no-case-declarations
const conres = dataMode(searchData['sbktdls'])
data.nxzdUseEnergyEquipDTO.conEquipModiy = ''
data.nxzdUseEnergyEquipDTO.conIntellectModifyYear = ''
data.nxzdUseEnergyEquipDTO.conModifyYear = ''
data.nxzdUseEnergyEquipDTO.conEnquireDevIds = conres.find((ele) => ele.type == 2).child.map((item) => item.enquireId).join(',')
data.nxzdUseEnergyEquipDTO.conEnquireIds = conres.find((ele) => ele.type == 1).child.map((item) => item.enquireId).join(',')
data.nxzdRefrigeSystemDTO = null
this.resetData(data, item.typeId)
break
case 'fissionAir':
data.nxzdRefrigeSystemDTO = null
this.resetData(data, item.typeId)
break
default:
break
}
},
//清空用能设备数据并保存
async resetData(data, id) {
for (const key in data) {
if (data[key] instanceof Array) {
data[key].forEach((v) => {
for (const keys in v) {
if (keys == 'changeTime') {
delete v['changeTime']
}
if (keys == 'changeUser') {
delete v['changeUser']
}
}
})
} else {
for (const val in data[key]) {
if (val == 'changeTime') {
delete data[key]['changeTime']
}
if (val == 'changeUser') {
delete data[key]['changeUser']
}
}
}
}
data.operDetailCode = id // 用能设备明细类型编号用逗号隔开
const res = await editEnergyEquip(data)
if (res.code == 0) {
this.getFacData()
}
},
//获取用能设备数据
async getFacData() {
try {
// let id = JSON.parse(sessionStorage.getItem('tidCid')).customerId
let id = JSON.parse(sessionStorage.getItem('tidCid')).equipId||sessionStorage.getItem('equipId')
if(!id) return
const res = await getEnergyEquip({equipId: id})
if (res.code == 0) {
const data = {
info: res.data,
pageKey: true,
}
let tidCid = JSON.parse(sessionStorage.getItem('tidCid'))
this.$set(tidCid,'buildId',res.data.buildId )
this.$set(tidCid,'equipId', id )
sessionStorage.removeItem('tidCid')
sessionStorage.setItem('tidCid', JSON.stringify(tidCid))
this.buildId=res.data.buildId
this.editData = res.data
this.$store.commit('pageData/GET_EDITDATA', data)
if(res.data.detaileCode) {
const list = res.data.detaileCode.split(',')
if(list.length > 0) {
this.iconList = this.showList.filter((ele)=> {
return list.some((item)=> item == ele.typeId)
})
} else {
this.iconList = []
}
}
return
}else{
}
} catch (error) {
}
},
//获取当前页面信息
getPathInfo() {
this.currentPath.path = this.$route.path
this.currentPath.name = this.title
this.$store.commit('path/SET_PATH', this.currentPath)
sessionStorage.setItem('goPage', JSON.stringify(this.currentPath))
},
// 根据客户id查询单个建筑信息获取建筑id
// async getBuildId() {
// const id = JSON.parse(sessionStorage.getItem('tidCid')).customerId
// const res = await getInfo({customerId: id})
// if (res.code == 0) {
// sessionStorage.setItem('buildId', res.data.buildId)
// this.buildId = res.data.buildId
// }
// },
//查询单个客户统计信息
async getCustomerStatistic() {
const id = JSON.parse(sessionStorage.getItem('tidCid')).customerId
const res = await getCurrentPersonInfoAPI(id)
if (res.code == 0) {
this.item = res.data
// this.buildId = res.data.buildId
const data = {
taskId: JSON.parse(sessionStorage.getItem('tidCid')).taskId,
customerId: res.data.customerId,
item: {...res.data, ...JSON.parse(sessionStorage.getItem('tidCid')).item},
buildId: this.buildId,
equipId: JSON.parse(sessionStorage.getItem('tidCid')).equipId,
}
sessionStorage.setItem('tidCid', JSON.stringify(data))
this.getSingleTaskInfo()
}else{
this.item = JSON.parse(sessionStorage.getItem('tidCid')).item
}
this.customerStatistic = res.data;
},
async getSingleTaskInfo () {
if(!this.buildId||this.buildId=='null') return
const data = JSON.parse(sessionStorage.getItem('tidCid'))
const id = data.taskId
if(id) {
const res = await getSingleTaskInfo(id)
if(res.code == 0) {
this.taskType = res.data.taskType
sessionStorage.setItem('taskType', this.taskType)
// data.item.taskType = res.data.taskType
if(data) {
data.taskType = res.data.taskType
data.buildId = this.buildId
sessionStorage.setItem('tidCid', JSON.stringify(data))
}
}
} else {
this.taskType = 4
}
},
// 建筑信息
constructionInfo() {
this.$router.push({ path: '/constructioninfo', type: 1 })
},
//查询客户类型
async getCustomerType() {
const data = {
codeSortId: '80000001004',
codeType: 'khlx',
}
const ref = await getCode(data)
if (ref.code === 0) {
this.typeList = ref.data
}
},
// 用能设备信息
async facilityManage(item) {
const consId = JSON.parse(sessionStorage.getItem('tidCid')).customerId
if (!this.buildId) {
this.$store.commit('pageData/GET_EDITDATA', {})
Notify({ type: 'danger', message: '请先填写建筑信息' })
} else {
if (!this.$store.getters.editData) {
const data = {
nxzdDistributeSystemDTO: {},
nxzdHeatSystemDTO: [],
nxzdHotWaterSystemDTO: {},
nxzdLightSystemDTO: {},
nxzdRefrigeSystemDTO: [],
nxzdUseEnergyEquipDTO: {
buildId: this.buildId,
consId,
},
}
const res = await addEnergyEquip(data)
if (res.code == 0) {
this.getFacData()
this.getPathInfo()
this.goFacilityManage(item)
}
return
}
this.getPathInfo()
this.goFacilityManage(item)
// })
return
}
},
//主要用能设备跳转
goFacilityManage(item) {
this.$router.push({
path: '/facilityManage',
query: { id: item.id, typeId: item.typeId },
})
},
// 能耗数据信息
energyConsumption() {
this.$router.push({ path: '/energyconsumption', type: 1 })
},
// 清空页面数据
clearData() {
this.item = {}
},
//提交页面信息
saveAllInfo() {
const city = process.env.VUE_APP_CITY_TYPE=='cq'
const must = this.iconList&&this.iconList.some(ele => ele.typeId == '1'||ele.typeId=='8'||ele.typeId=='9')&&this.iconList.some(ele => ele.typeId=='3')&&this.iconList.some(ele => ele.typeId=='4')
// )&&ele.typeId=='3'&&ele.typeId=='4'}
console.log(city, must ,this.iconList, 'lllllllllllllllllll')
if(!must&&city){
this.$notify({
message: '主要用能设备空调至少填一个、照明系统与配电系统必填',
duration: 1000,
type: 'warning'
})
return
}
let item = JSON.parse(sessionStorage.getItem('tidCid')).item
if(!item.isPosition){
this.$notify({
message: '必须先在app打卡以后才能提交',
duration: 1000,
type: 'warning'
})
return
}
taskList({ taskId: this.taskId }).then((res) => {
this.records = res.data.list[0]
if (!this.records.buildId) {
this.$notify({
message: '请完善信息',
duration: 1000,
background: '#34baae',
})
return false
}
this.$router.push('/taskManage')
changeSubStateType({ taskId: this.taskId }).then((res) => {
if (res.code == 0) {
this.$notify({
message: '保存成功',
duration: 1000,
background: '#34baae',
})
}else if(res.code == 1){
this.$notify({
message: res.msg,
duration: 1000,
// background: '#34baae',
type: 'danger'
})
}
})
})
},
},
}
</script>
<style lang="less" scoped>
.list {
padding: 0 10px;
.select {
box-shadow: 1px 1px 10px 1px rgb(225, 225, 225, 0);
width: 100%;
min-height: calc(12rem - 50px);
margin-top: 15px;
background-color: #fff;
border-radius: 5px;
overflow: hidden;
padding-bottom: 25px;
.custom-type {
width: 50px;
display: block;
text-align: center;
padding-top: 4.5px;
}
.custom-text {
font-size: 0.38rem;
color: #1c9b92;
display: flex;
font-weight: bold;
img {
width: 20px;
height: 20px;
margin-right: 10px;
}
}
}
}
.btn {
position: fixed;
bottom: 20px;
padding: 0 10px;
.faqi {
width: 355px;
background-color: #34baaf;
color: #fff;
border-radius: 8px;
}
}
.van-cell__title,
.van-cell__value {
-webkit-box-flex: 1;
flex: 1;
display: flex;
justify-content: space-between;
padding-bottom: 5px;
border-bottom: 1px dashed #ececec;
}
.van-tag--primary {
border-radius: 7px;
background-color: #2c938b;
}
.van-tag--warning {
border-radius: 7px;
background-color: #ff9205;
}
.header {
box-shadow: 1px 1px 10px 1px rgb(225, 225, 225, 0);
margin-top: 10px;
background-color: #ffffff;
padding: 10px;
box-sizing: border-box;
border-radius: 5px;
position: relative;
.header-name {
display: flex;
padding-bottom: 10px;
box-sizing: border-box;
font-size: 17px;
font-weight: 700;
opacity: 0.9;
width: 58%;
img {
width: 17px;
height: 17px;
margin-right: 10px;
margin-top: 2px;
}
}
.header-address {
display: flex;
border-top: 1px dashed #e0e0e0;
padding: 6px 0;
box-sizing: border-box;
color: #8d8d8d;
line-height: 25px;
img {
width: 15px;
height: 17px;
margin-top: 2px;
margin-right: 13px;
}
.address-warp {
white-space: nowrap; //规定段落中的文本不进行换行
text-overflow: ellipsis;
overflow: hidden;
}
}
.header-title {
position: absolute;
top: 4px;
right: 4px;
color: #ffaa2b;
border: 1px solid #ffd89f;
border-radius: 5px;
padding: 3px 10px;
box-sizing: border-box;
background-color: #ffebcc;
}
}
.line {
display: inline-block;
width: 5px;
height: 17px;
position: relative;
top: 2px;
margin-right: 10px;
border-radius: 3px;
background: linear-gradient(to bottom, #2da197, #2c827c);
}
.van-cell {
position: unset;
display: -webkit-box;
display: -webkit-flex;
display: flex;
box-sizing: border-box;
width: 100%;
padding: 0.266667rem 0.426667rem;
overflow: hidden;
color: #323233;
font-size: 0.373333rem;
line-height: 0.64rem;
background-color: #fff;
}
.main1-content {
font-size: 13px;
text-align: center;
width: 25%;
img {
margin: 0 auto 10px;
width: 50px;
height: 50px;
}
.main1-content-text {
color: #808080;
}
}
.main2-flex {
display: flex;
flex-wrap: wrap;
.main2-content {
font-size: 13px;
margin-top: 10px;
text-align: center;
width: 25%;
position: relative;
img {
margin: 0 auto 10px;
width: 50px;
height: 50px;
}
.main2-content-text {
color: #808080;
}
.img-del {
width: 20px;
height: 20px;
position: absolute;
top: -9px;
right: 12px;
img {
width: 100%;
height: 100%;
}
}
}
}
</style>