Browse Source

对接中央空调冷源监控模块

dev
selia-zx 2 months ago
parent
commit
84617875ab
  1. 93
      src/api/centerairC/energyManage.js
  2. 27
      src/api/centerairC/sysMonitor.js
  3. BIN
      src/assets/fonts/DS-DIGIT.ttf
  4. 1
      src/assets/icons/svg/centerairC.svg
  5. 1
      src/assets/icons/svg/enSourceAnalysis.svg
  6. 1
      src/assets/icons/svg/energyAnalysis.svg
  7. 1
      src/assets/icons/svg/energyManage.svg
  8. 1
      src/assets/icons/svg/overview.svg
  9. 1
      src/assets/icons/svg/sysMonitor.svg
  10. BIN
      src/assets/move-img/535gqbottomright.png
  11. BIN
      src/assets/move-img/53cloud.png
  12. BIN
      src/assets/move-img/53earth.png
  13. BIN
      src/assets/move-img/53gqbottomleft.png
  14. BIN
      src/assets/move-img/53gqleft.png
  15. BIN
      src/assets/move-img/53gqright.png
  16. BIN
      src/assets/move-img/circle.png
  17. BIN
      src/assets/move-img/circle1.png
  18. BIN
      src/assets/move-img/circle2.png
  19. 2342
      src/assets/styles/energy.css
  20. 61
      src/assets/styles/index.scss
  21. 1
      src/main.js
  22. 38
      src/utils/datetime.js
  23. 714
      src/views/centerairC/enSourceAnalysis/components/deviceEnergy.vue
  24. 816
      src/views/centerairC/enSourceAnalysis/components/equipment.vue
  25. 218
      src/views/centerairC/enSourceAnalysis/components/machineChart.vue
  26. 638
      src/views/centerairC/enSourceAnalysis/components/machineRoom.vue
  27. 97
      src/views/centerairC/enSourceAnalysis/index.vue
  28. 835
      src/views/centerairC/energyAnalysis/components/energyAnalysis.vue
  29. 904
      src/views/centerairC/energyAnalysis/components/qnqAnalysis.vue
  30. 917
      src/views/centerairC/energyAnalysis/components/ynyAnalysis.vue
  31. 1009
      src/views/centerairC/energyAnalysis/components/ynyQnqAnalysis.vue
  32. 91
      src/views/centerairC/energyAnalysis/index.vue
  33. 1000
      src/views/centerairC/overview/index.vue
  34. 58
      src/views/region/index.vue

93
src/api/centerairC/energyManage.js

@ -0,0 +1,93 @@
import request from '@/utils/request'
// 系统能耗分析-瞬时能耗分析
export const sysEnergy = (data) => {
return request({
url: '/energy/sys',
method: 'post',
data
})
}
// 系统能耗分析-同比分析-查询
export const yoyEnergy = (data) => {
return request({
url: '/energy/yoy',
method: 'post',
data
})
}
// 系统能耗分析-环比分析-查询
export const momEnergy = (data) => {
return request({
url: '/energy/mom',
method: 'post',
data
})
}
// 系统能耗分析-同比环比分析-查询
export const yoyMomEnergy = (data) => {
return request({
url: '/energy/yoyMom',
method: 'post',
data
})
}
// 能源查询
export const energyInquiry = (data) => {
return request({
url: '/energy/sys/query',
method: 'post',
data
})
}
// 能源查询-导出
export const exportData = (data) => {
return request({
url: '/energy/sys/query/export',
method: 'post',
data,
responseType: 'blob',
})
}
// 能源分析-机房能耗
export const energyAnalyze = (data) => {
return request({
url: '/energy/sys/analyze',
method: 'post',
data
})
}
// 能源分析-机房能耗-导出
export const analyzeExport = (data) => {
return request({
url: '/energy/sys/analyze/export',
method: 'post',
data,
responseType: 'blob',
})
}
// 能源分析-设备能耗
export const deviceAnalyze = (data) => {
return request({
url: '/energy/sys/analyze/device',
method: 'post',
data
})
}
// 能源分析-设备能耗-导出
export const deviceAnalyzeExport = (data) => {
return request({
url: '/energy/sys/analyze/device/export',
method: 'post',
data,
responseType: 'blob',
})
}
// 能源分析-设备组能耗
export const deviceEnergy = (data) => {
return request({
url: '/energy/device',
method: 'post',
data
})
}

27
src/api/centerairC/sysMonitor.js

@ -0,0 +1,27 @@
import request from '@/utils/request'
// 查询设备参数列表
export function cmpList(query) {
return request({
url: '/device/cmp/list',
method: 'get',
params: query
})
}
// 根据id查询设备参数信息
export function getCMP(cmpId) {
return request({
url: '/device/cmp/' + cmpId,
method: 'get'
})
}
// 新增设备参数
export function addCMP(data) {
return request({
url: '/device/cmp',
method: 'post',
data: data
})
}

BIN
src/assets/fonts/DS-DIGIT.ttf

Binary file not shown.

1
src/assets/icons/svg/centerairC.svg

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1741855010181" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4236" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M229.64705844 201.41176437c0 16.94117625-11.29411781 28.23529406-28.23529407 28.23529407s-28.23529406-11.29411781-28.23529406-28.23529407 11.29411781-28.23529406 28.23529406-28.23529406 28.23529406 11.29411781 28.23529407 28.23529406zM201.41176437 850.82352969c16.94117625 0 28.23529406-11.29411781 28.23529407-28.23529406s-11.29411781-28.23529406-28.23529407-28.23529407-28.23529406 11.29411781-28.23529406 28.23529407 11.29411781 28.23529406 28.23529406 28.23529406zM850.82352969 201.41176437c0 16.94117625-11.29411781 28.23529406-28.23529406 28.23529407s-28.23529406-11.29411781-28.23529407-28.23529407 11.29411781-28.23529406 28.23529407-28.23529406 28.23529406 11.29411781 28.23529406 28.23529406zM822.58823563 850.82352969c16.94117625 0 28.23529406-11.29411781 28.23529406-28.23529406s-11.29411781-28.23529406-28.23529406-28.23529407-28.23529406 11.29411781-28.23529407 28.23529407 11.29411781 28.23529406 28.23529407 28.23529406zM370.82352969 370.82352969H201.41176437v-56.47058813h169.41176532v56.47058813zM427.29411781 370.82352969h169.41176438v-56.47058813h-169.41176438v56.47058813zM822.58823563 370.82352969h-169.41176532v-56.47058813h169.41176532v56.47058813zM201.41176437 483.76470594h169.41176532v-56.47058813H201.41176437v56.47058813zM596.70588219 483.76470594h-169.41176438v-56.47058813h169.41176438v56.47058813zM653.17647031 483.76470594h169.41176531v-56.47058813h-169.41176531v56.47058813zM370.82352969 596.70588219H201.41176437v-56.47058813h169.41176532v56.47058813zM427.29411781 596.70588219h169.41176438v-56.47058813h-169.41176438v56.47058813zM822.58823563 596.70588219h-169.41176532v-56.47058813h169.41176532v56.47058813zM201.41176437 709.64705844h169.41176532v-56.47058813H201.41176437v56.47058813zM596.70588219 709.64705844h-169.41176438v-56.47058813h169.41176438v56.47058813zM653.17647031 709.64705844h169.41176531v-56.47058813h-169.41176531v56.47058813z" p-id="4237" fill="#ffffff"></path><path d="M60.23529406 201.41176437c0-79.05882375 62.1176475-141.17647031 141.17647031-141.17647031h621.17647126c79.05882375 0 141.17647031 62.1176475 141.17647031 141.17647031v621.17647126c0 79.05882375-62.1176475 141.17647031-141.17647031 141.17647031H201.41176437c-79.05882375 0-141.17647031-62.1176475-141.17647031-141.17647031V201.41176437z m141.17647031-84.70588218C153.41176437 116.70588219 116.70588219 153.41176437 116.70588219 201.41176437v621.17647126c0 48 36.70588219 84.70588219 84.70588218 84.70588218h621.17647126c48 0 84.70588219-36.70588219 84.70588218-84.70588218V201.41176437c0-48-36.70588219-84.70588219-84.70588218-84.70588218H201.41176437z" p-id="4238" fill="#ffffff"></path></svg>

After

Width:  |  Height:  |  Size: 2.9 KiB

1
src/assets/icons/svg/enSourceAnalysis.svg

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1741855190867" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6541" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M217.73376 480l243.2 121.6c16 6.4 32 12.8 54.4 12.8 19.2 0 35.2-3.2 54.4-12.8l243.2-121.6c12.8-6.4 22.4-22.4 22.4-38.4s-9.6-28.8-22.4-38.4l-243.2-121.6c-16-9.6-35.2-12.8-54.4-12.8-19.2 0-35.2 3.2-54.4 12.8l-240 121.6c-12.8 9.6-22.4 22.4-22.4 38.4-6.4 12.8 3.2 28.8 19.2 38.4z m563.2 76.8L544.13376 688c-19.2 9.6-41.6 9.6-60.8 0l-240-131.2c-16-9.6-35.2-3.2-44.8 12.8-9.6 16-3.2 35.2 12.8 44.8l243.2 131.2c19.2 9.6 38.4 12.8 60.8 12.8 19.2 0 38.4-3.2 60.8-12.8l243.2-131.2c16-9.6 19.2-28.8 9.6-44.8-12.8-16-32-22.4-48-12.8zM192.13376 227.2c0 38.4-28.8 67.2-64 67.2s-64-28.8-64-67.2S92.93376 160 128.13376 160s64 32 64 67.2z m790.4 524.8c0 38.4-28.8 67.2-64 67.2s-64-28.8-64-67.2 28.8-67.2 64-67.2 64 28.8 64 67.2zM326.53376 99.2c0 19.2-16 35.2-35.2 35.2-19.2 0-35.2-16-35.2-35.2C256.13376 80 272.13376 64 291.33376 64s35.2 12.8 35.2 35.2z m-57.6-32c80-41.6 166.4-64 256-60.8 137.6 3.2 262.4 57.6 358.4 156.8 96 99.2 144 227.2 140.8 361.6-3.2 80-22.4 156.8-64 230.4-3.2 12.8-16 19.2-32 19.2-19.2 0-35.2-16-35.2-35.2V729.6l3.2-3.2c35.2-60.8 54.4-128 54.4-201.6 3.2-115.2-41.6-227.2-121.6-310.4-83.2-83.2-192-131.2-310.4-134.4-70.4-3.2-144 12.8-211.2 48M144.13376 278.4c-44.8 67.2-70.4 147.2-73.6 230.4-3.2 115.2 41.6 227.2 121.6 310.4 80 83.2 192 131.2 310.4 134.4 92.8 3.2 185.6-25.6 262.4-80 6.4-6.4 12.8-9.6 22.4-9.6 19.2 0 35.2 16 35.2 35.2 0 9.6-3.2 16-9.6 22.4-89.6 64-192 99.2-300.8 99.2h-12.8C217.73376 1011.2-6.26624 777.6 0.13376 499.2c3.2-96 32-182.4 80-259.2" p-id="6542" fill="#ffffff"></path></svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

1
src/assets/icons/svg/energyAnalysis.svg

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1741855250921" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="8933" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M749.056 25.6l102.4 97.28-307.2 272.384-204.8-168.448L0 557.568l70.144 65.024 274.944-265.728 204.8 168.448L927.232 194.56l96.256 97.28V25.6h-274.432zM222.72 803.84h-122.88c-18.944 0-33.28 19.456-33.28 45.568v103.936c0 26.112 14.336 45.568 33.28 45.568h123.392c18.944 0 33.28-19.456 33.28-45.568v-103.936c-0.512-26.112-14.848-45.568-33.792-45.568z m244.736-129.536h-102.4c-25.6 0-44.544 26.112-44.544 45.568v233.472c0 26.112 18.944 45.568 44.544 45.568h102.4c24.064 0.512 44.544-18.944 44.544-43.008v-235.52c0-20.48-18.944-46.08-44.544-46.08z m256-58.368h-102.4c-24.064-0.512-44.544 18.944-44.544 43.008V959.488c0 19.456 18.944 38.912 44.544 38.912h102.4c24.064 0.512 44.544-18.944 44.544-43.008V654.848c0-19.456-18.944-38.912-44.544-38.912z m256-194.56h-102.4c-24.064-0.512-44.544 18.944-44.544 43.008v488.448c0 26.112 18.944 45.568 44.544 45.568h102.4c24.064 0.512 44.544-18.944 44.544-43.008V466.944c0.512-24.064-18.432-44.544-42.496-45.568h-2.048z" fill="#ffffff" p-id="8934"></path></svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

1
src/assets/icons/svg/energyManage.svg

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1741855149275" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5338" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M511.0784 94.6176A417.4848 417.4848 0 1 0 928.5632 512a417.9456 417.9456 0 0 0-417.4848-417.3824z m0 773.5296A356.0448 356.0448 0 1 1 867.1232 512a356.4544 356.4544 0 0 1-356.0448 356.1472z" fill="#ffffff" p-id="5339"></path><path d="M513.6896 229.8368l-162.2016 311.04h162.048v226.2016l162.2016-311.04h-162.048V229.8368z" fill="#ffffff" p-id="5340"></path></svg>

After

Width:  |  Height:  |  Size: 696 B

1
src/assets/icons/svg/overview.svg

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1741855227330" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7735" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M525.312 576.512c-4.096 2.048-8.704 3.584-13.312 3.584-4.608 0-9.216-1.024-13.312-3.584L307.2 472.064c-8.192 4.608-17.408 7.68-27.648 7.68C249.344 479.744 225.28 455.68 225.28 425.472s24.064-54.272 54.272-54.272c29.184 0 53.248 23.552 54.272 52.224l178.688 97.28 441.856-241.664c0.512-0.512 1.536-0.512 2.048-1.024-1.536-1.536-3.584-3.072-5.632-4.096L529.92 35.84c-10.752-6.144-23.552-6.144-34.304 0L74.752 274.432c-10.752 6.144-17.408 17.408-17.408 29.696V506.88c4.608 0 9.216 1.024 13.312 3.072l441.856 241.664 177.152-93.184c1.536-28.672 25.088-51.712 54.272-51.712 30.208 0 54.272 24.064 54.272 54.272s-24.064 54.272-54.272 54.272c-10.24 0-19.968-3.072-28.672-8.192l-190.464 99.84c-4.096 2.048-8.192 3.072-12.8 3.072-4.608 0-9.216-1.024-13.312-3.584l-441.344-241.664v154.624c0 12.288 6.656 23.552 17.408 29.696L495.104 988.16c10.752 6.144 23.552 6.144 34.304 0l420.352-238.08c10.752-6.144 17.408-17.408 17.408-29.696V334.848l-441.856 241.664zM247.296 260.608l252.416-141.824c7.68-4.608 17.408-4.608 25.088 0l252.416 141.824c17.408 9.728 17.408 34.816 0 44.544l-252.416 141.824c-7.68 4.608-17.408 4.608-25.088 0L247.296 305.152c-17.408-9.728-17.408-34.816 0-44.544z" p-id="7736" fill="#ffffff"></path><path d="M503.808 387.072L342.016 295.424c-11.264-6.144-11.264-22.528 0-28.672l162.304-91.136c5.12-3.072 11.264-3.072 16.384 0l162.304 91.136c11.264 6.144 11.264 22.528 0 28.672l-162.304 91.136c-5.632 3.072-11.776 3.072-16.896 0.512z" p-id="7737" fill="#ffffff"></path></svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

1
src/assets/icons/svg/sysMonitor.svg

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1741855339433" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="10087" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M664.144969 270.69644l2.544441 4.584578 91.874954 208.265941h59.370292a28.470233 28.470233 0 0 1 28.034698 23.335505l0.458458 5.111805a28.44731 28.44731 0 0 1-23.381351 27.988852l-5.111805 0.458458h-77.937835a28.470233 28.470233 0 0 1-23.748117-12.779513l-2.292289-4.183427-71.313119-161.606394-104.069933 275.601939c-8.298087 21.960131-37.387238 24.493111-49.903137 6.315257l-2.578825-4.584579-45.032023-98.809129H398.972947a28.412925 28.412925 0 0 1-22.750971-11.369754l-2.796593-4.584579-30.441601-61.983502-33.410116 62.900418a28.470233 28.470233 0 0 1-19.942917 14.613344l-5.169112 0.469919h-85.433621a28.44731 28.44731 0 0 1-5.111805-56.436162l5.111805-0.458458h68.298758l51.576509-96.952374c10.06315-18.911386 36.011864-19.954378 47.966153-3.598894l2.69344 4.447041 47.049237 96.104227h42.682426a28.424387 28.424387 0 0 1 23.564734 12.527361l2.292289 4.11466 24.286805 53.284264 104.620082-276.690776c8.412702-22.143514 37.708158-24.504572 50.08652-6.086028z m132.299475-173.984756H227.555556a130.855333 130.855333 0 0 0-130.545874 121.881021l-0.297998 8.962851v398.216491a130.855333 130.855333 0 0 0 121.892482 130.545874l8.95139 0.297997h568.888888a130.855333 130.855333 0 0 0 130.545874-121.88102l0.297998-8.962851V227.555556a130.855333 130.855333 0 0 0-121.881021-130.545874z m0-96.711684c125.674759 0 227.555556 101.880796 227.555556 227.555556v398.216491c0 125.674759-101.880796 227.521171-227.555556 227.521171H227.555556C101.880796 853.293218 0 751.446806 0 625.772047V227.555556C0 101.880796 101.880796 0 227.555556 0z m65.421936 927.288316a48.355842 48.355842 0 0 1 0 96.711684H162.13362a48.355842 48.355842 0 1 1 0-96.711684z" fill="#ffffff" p-id="10088"></path></svg>

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
src/assets/move-img/535gqbottomright.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

BIN
src/assets/move-img/53cloud.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

BIN
src/assets/move-img/53earth.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 KiB

BIN
src/assets/move-img/53gqbottomleft.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
src/assets/move-img/53gqleft.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

BIN
src/assets/move-img/53gqright.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

BIN
src/assets/move-img/circle.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 KiB

BIN
src/assets/move-img/circle1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

BIN
src/assets/move-img/circle2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

2342
src/assets/styles/energy.css

File diff suppressed because it is too large Load Diff

61
src/assets/styles/index.scss

@ -451,3 +451,64 @@ table th {
.el-dialog .el-row .el-date-editor{
width: 100% !important;
}
// 原生table
.analysis-table {
width: 100%;
overflow-x: auto;
}
.analysis-table table {
border-collapse: collapse;
/* 合并边框 */
width: 100%;
}
.analysis-table table thead {
width: 100%;
}
.analysis-table table thead th {
padding: 0 0.25rem;
}
.analysis-table th {
height: 50px;
/* 设置高度 */
border: 1px solid #719eb2;
/* 设置边框 */
text-align: center;
/* 水平居中 */
color: #147cde;
background-color: #00477d;
font-size: 16px;
}
.analysis-table td {
padding: 0 0.25rem;
white-space: nowrap;
border: 1px solid #719eb2;
/* 设置边框 */
text-align: center;
/* 水平居中 */
font-size: 16px;
color: #ffffff;
}
.analysis-table tr td {
padding: 0.15rem 0.19rem;
color: #e2f3ff;
}
/* 修改水平滚动条样式 */
.analysis-table::-webkit-scrollbar {
width: 8px;
/* 设置滚动条宽度 */
// background-color: #517f82;
/* 设置滚动条背景颜色 */
}
.analysis-table::-webkit-scrollbar-thumb {
background-color: rgb(21, 50, 104);
/* 设置滑块颜色 */
}
.analysis-table::-webkit-scrollbar-thumb:hover {
background-color: rgb(38, 75, 143);
/* 设置滑块颜色 */
}
.analysis-table::-webkit-scrollbar-track {
background-color: #002249;
/* 设置滑道颜色 */
}

1
src/main.js

@ -8,6 +8,7 @@ import './assets/styles/element-variables.scss'
import '@/assets/styles/index.scss' // global css
import '@/assets/styles/ruoyi.scss' // ruoyi css
import '@/assets/fonts/fonts.css' //字体css
import '@/assets/styles/energy.css'
import App from './App'
import store from './store'
import router from './router'

38
src/utils/datetime.js

@ -21,6 +21,14 @@ export function formatDay (datetime) {
return formatWithSeperator2(datetime, "-", ":");
}
/**
* 时间格式化
* 2018-09-23T11:54:16.000+0000 格式化成 2018/09/23 11:54:16
* @param datetime 国际化日期格式
*/
export function format2(datetime) {
return formatWithSeperator3(datetime, "-", ":");
}
/**
* 时间格式化
* 2018-09-23T11:54:16.000+0000 格式化成类似 2018/09/23 11:54:16
@ -89,6 +97,36 @@ export function formatWithSeperator2 (datetime, dateSeprator, timeSeprator) {
return timeFormat;
}
}
export function formatWithSeperator3(datetime, dateSeprator, timeSeprator) {
if (datetime != null) {
const dateMat = new Date(datetime);
const year = dateMat.getFullYear();
let month = dateMat.getMonth() + 1;
// 小于时的加多一个0 不然就是9和09的区别 使用let,const报错
if (month < 10) {
month = "0" + month;
}
let day = dateMat.getDate();
if (day < 10) {
day = "0" + day;
}
let hh = dateMat.getHours();
if (hh < 10) {
hh = "0" + hh;
}
let mm = dateMat.getMinutes();
if (mm < 10) {
mm = "0" + mm;
}
let ss = dateMat.getSeconds();
if (ss < 10) {
ss = "0" + ss;
}
const timeFormat = year + dateSeprator + month + dateSeprator + day + " " + hh + timeSeprator + mm + timeSeprator + ss;
return timeFormat;
}
}
/* 昨天 今天 this.getDay(-1)昨天 this.getDay(0)今天*/
export function getDay(day) {

714
src/views/centerairC/enSourceAnalysis/components/deviceEnergy.vue

@ -0,0 +1,714 @@
<template>
<div class="main-body">
<div class="irregular-border">
<div class="main-content">
<div class="condition">
<div class="condition-left">
<div class="time-label">时间类型:</div>
<el-radio-group
v-model="dateType"
style="margin-right: 0.24rem"
@change="updateDateType"
>
<el-radio label="hour">小时</el-radio>
<el-radio label="day"></el-radio>
<el-radio label="month"></el-radio>
<el-radio label="year"></el-radio>
</el-radio-group>
<el-date-picker
v-if="dateType == 'hour'"
v-model="timeDate"
@change="handleConfirm"
type="datetimerange"
:default-time="['00:00:00', '23:59:59']"
range-separator="至"
placeholder="选择日期"
start-placeholder="开始日期"
end-placeholder="结束日期"
>
</el-date-picker>
<el-date-picker
v-model="dayDate"
type="daterange"
v-if="dateType == 'day'"
:key="this.dateType"
range-separator="至"
value-format="yyyy-MM-dd"
start-placeholder="开始日期"
end-placeholder="结束日期"
@change="dateChange"
>
</el-date-picker>
<el-date-picker
v-model="monthDate"
type="monthrange"
v-if="dateType == 'month'"
:key="this.dateType"
range-separator="至"
start-placeholder="开始月份"
end-placeholder="结束月份"
value-format="yyyy-MM"
@change="dateChange"
>
</el-date-picker>
<div
class="years-div"
v-if="dateType == 'year'"
:key="this.dateType"
>
<el-date-picker
v-model="startYear"
type="year"
placeholder="选择开始年份"
style="width: 180px"
value-format="yyyy"
>
</el-date-picker>
<div class="years-word"></div>
<el-date-picker
v-model="endYear"
type="year"
placeholder="选择结束年份"
style="width: 180px"
value-format="yyyy"
>
</el-date-picker>
</div>
<el-select
v-model="deviceType"
placeholder="请选择设备类型"
style="margin-left: 0.24rem"
@change="changeData"
>
<el-option
v-for="item in deviceTypes"
:key="item.dictValue"
:label="item.dictLabel"
:value="item.dictValue"
>
</el-option>
</el-select>
<el-select
style="margin-left: 0.24rem"
v-model="systemType"
placeholder="请选择系统类型"
clearable
>
<el-option
v-for="dict in systemTypes"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
/>
</el-select>
<div class="success-btn">
<el-button
type="success"
style="margin-left: 0.24rem"
@click="findData"
>查询</el-button
>
</div>
</div>
<!-- <div class="condition-right">
<el-button type="warning">导出</el-button>
</div> -->
</div>
<div class="charts-table" v-loading="listLoading">
<div class="charts-title">
{{ this.titleDate }} {{ this.deviceTitle }} 用电量
</div>
<div class="charts_refs" ref="charts_refs"></div>
<div class="analysis-table">
<table>
<thead>
<tr>
<th v-if="dateList.length > 0">数据类型</th>
<th v-for="(item, index) in dateList" :key="index">
{{ item }}
</th>
</tr>
</thead>
<tbody>
<tr>
<td v-if="electData.length > 0">用电量(kwh)</td>
<td v-for="(item, index) in electData" :key="index">
{{ item }}
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import { format2 } from "@/utils/datetime";
import { deviceEnergy } from "@/api/centerairC/energyManage";
import * as echarts from "echarts";
import { listData } from "@/api/system/dict/data";
export default {
data() {
return {
listLoading: false,
deviceType: "",
deviceTypes: [],
dateType: "hour", //
timeDate: [], //
deviceTitle: "冷水机组",
dayDate: [], //
monthDate: [], //
startYear: "", //
endYear: "", //
startTime: "", //
endTime: "", //
//
dateList: [],
electData: [],
// 线
dateList2: [],
electData2: [],
chartInstance2: null,
option2: {},
titleDate: "",
systemType: "", //
systemTypes: [],
};
},
mounted() {
this.initializeTimeDate();
this.initChart2();
this.screenAdapter();
window.addEventListener("resize", this.screenAdapter);
this.initData();
},
destroyed() {
//mounted
window.removeEventListener("resize", this.screenAdapter);
},
methods: {
/** 查询系统类型-字典数据列表 */
getDictList() {
return new Promise((resolve, reject) => {
let data = {
pageNum: 1,
pageSize: 100,
dictType: "sys_type",
};
listData(data)
.then((response) => {
this.systemTypes = response.rows;
if (this.systemTypes.length > 0) {
this.systemType = this.systemTypes[0].dictValue;
}
resolve();
})
.catch((error) => {
reject(error);
});
});
},
/** 查询设备类型列表-字典数据列表 */
getList() {
return new Promise((resolve, reject) => {
let data = {
pageNum: 1,
pageSize: 100,
dictType: "sys_device_type",
};
listData(data)
.then((response) => {
this.electType = [];
this.deviceTypes = response.rows;
if (this.deviceTypes.length > 0) {
this.deviceType = this.deviceTypes[0].dictValue;
}
resolve();
})
.catch((error) => {
reject(error);
});
});
},
/** 初始化数据 */
initData() {
Promise.all([this.getDictList(), this.getList()])
.then(() => {
this.getTableData();
})
.catch((error) => {
console.error("数据获取失败:", error);
});
},
handleConfirm() {
console.log("打印选择的时间", this.timeDate);
// const start = new Date(this.timeDate[0]);
// start.setHours(0, 0, 0, 0);
// const end = new Date(this.timeDate[1]);
// end.setHours(23, 59, 59, 999);
// this.timeDate = [start, end];
},
//
initializeTimeDate() {
const start = new Date(new Date().setHours(0, 0, 0, 0));
const end = new Date(new Date().setHours(23, 59, 59, 59));
this.timeDate = [format2(start), format2(end)]; //
this.titleDate = format2(start) + "至" + format2(end);
},
//
updateDateType() {
// this.dateType = this.radio;
console.log(this.dateType);
(this.timeDate = []), //
(this.dayDate = []), //
(this.monthDate = []), //
(this.startYear = ""), //
(this.endYear = ""); //
},
//
dateChange() {
// console.log("", this.timeform.time1);
if (!this.dayDate) {
this.$nextTick(() => {
this.dayDate = [];
});
}
if (!this.monthDate) {
this.$nextTick(() => {
this.monthDate = [];
});
}
},
//
changeData(value) {
console.log(value);
// let obj = {};
// obj = this.deviceTypes.find((item) => {
// return item.value === value;
// });
// console.log(obj.label);
},
//
findData() {
console.log(this.dateType);
switch (this.dateType) {
case "hour":
if (!this.timeDate) {
this.showMessage("请选择时间!", "warning");
} else {
this.titleDate =
format2(this.timeDate[0]) + "至" + format2(this.timeDate[1]);
this.getTableData();
}
break;
case "day":
if (this.dayDate.length === 0) {
this.showMessage("请选择时间!", "warning");
} else {
const newLength =
new Date(this.dayDate[1]).getTime() -
new Date(this.dayDate[0]).getTime();
const dayDiff = Math.floor(newLength / (1000 * 60 * 60 * 24));
if (dayDiff > 31) {
this.showMessage(
"最多只能选择30天区间,请重新选择再查询!",
"warning"
);
} else {
this.titleDate = this.dayDate[0] + "至" + this.dayDate[1];
this.getTableData();
}
}
break;
case "month":
if (this.monthDate.length === 0) {
this.showMessage("请选择时间!", "warning");
} else {
const [start, end] = this.monthDate;
const startDate = new Date(start);
const endDate = new Date(end);
const startYear = startDate.getFullYear();
const startMonth = startDate.getMonth();
const endYear = endDate.getFullYear();
const endMonth = endDate.getMonth();
const monthDiff =
(endYear - startYear) * 12 + (endMonth - startMonth);
if (monthDiff > 12) {
this.showMessage(
"最多只能选择12个月区间,请重新选择再查询!",
"warning"
);
} else {
this.titleDate = this.monthDate[0] + "至" + this.monthDate[1];
this.getTableData();
}
}
break;
case "year":
if (!this.startYear || !this.endYear) {
this.showMessage("请选择全年份区间!", "warning");
} else if (this.startYear > this.endYear) {
this.showMessage("结束年份要大于开始年份!", "warning");
} else {
this.titleDate = this.startYear + "至" + this.endYear;
this.getTableData();
}
break;
default:
break;
}
// el-selectlabel
let value = this.deviceType;
let obj = {};
obj = this.deviceTypes.find((item) => {
return item.dictValue === value;
});
this.deviceTitle = obj.dictLabel;
console.log(obj.dictLabel);
},
//
showMessage(message, type) {
this.$message({
message: message,
type: type,
});
},
//
getTableData() {
if (this.dateType == "hour") {
this.startTime = format2(this.timeDate[0]);
this.endTime = format2(this.timeDate[1]);
} else if (this.dateType == "day") {
this.startTime = this.dayDate.length > 0 ? this.dayDate[0] : "";
this.endTime = this.dayDate.length > 0 ? this.dayDate[1] : "";
} else if (this.dateType == "month") {
this.startTime = this.monthDate.length > 0 ? this.monthDate[0] : "";
this.endTime = this.monthDate.length > 0 ? this.monthDate[1] : "";
} else if (this.dateType == "year") {
(this.startTime = this.startYear), (this.endTime = this.endYear);
}
let data = {
timeType: this.dateType,
startTime: this.startTime,
endTime: this.endTime,
deviceType: this.deviceType,
systemType: this.systemType,
};
console.log("查询数据参数", data);
// this.option2.series[0].data = ["1"];
// this.option2.xAxis.data = ["1"];
// this.screenAdapter();
// this.chartInstance2.setOption(this.option2);
this.listLoading = true;
deviceEnergy(data).then((res) => {
console.log("查询返回", res);
if (res.code == 200 && res.data.lineTimes) {
if (res.data.times && res.data.times.length > 0) {
// .map(time => `${time}:00`)
this.dateList = res.data.times;
this.electData = res.data.data[0].meter;
console.log("表头", this.dateList);
console.log("表格内容", this.electData);
} else {
this.dateList = [];
this.electData = [];
}
//
this.dateList2 = res.data.lineTimes.map((item) => {
// 使slice()
return item.slice(0, 16);
});
this.electData2 = res.data.data[1].lineMeter;
this.option2.series[0].data = this.electData2;
this.option2.xAxis.data = this.dateList2;
console.log("x轴", this.dateList2);
console.log("折线图数据", this.electData2);
this.screenAdapter();
this.chartInstance2.setOption(this.option2);
} else {
this.dateList = [];
this.electData = [];
this.option2.series[0].data = [];
this.option2.xAxis.data = [];
this.screenAdapter();
this.chartInstance2.setOption(this.option2);
}
});
// Just to simulate the time of the request
setTimeout(() => {
this.listLoading = false;
}, 1.0 * 1000);
},
//chartInstance2 线
initChart2() {
this.chartInstance2 = echarts.init(this.$refs.charts_refs);
this.option2 = {
tooltip: {
trigger: "axis",
// 使 formatter tooltip
formatter: function (params) {
let seriesHTML = "";
params.forEach(function (item) {
seriesHTML +=
"<div>" +
item.seriesName +
': <span style="color: #000000; font-weight: bold;">' +
item.value +
"</span></div>";
});
return "<div>" + params[0].name + "</div>" + seriesHTML;
},
// tooltip
formatter: function (params) {
var res = params[0].name + "<br/>";
for (var i = 0, l = params.length; i < l; i++) {
var seriesName = params[i].seriesName;
var value = params[i].value;
var marker =
'<span style="display:inline-block;margin-right:5px;border-radius:10px;width:9px;height:9px;background-color:' +
params[i].color +
'"></span>';
// seriesName
if (seriesName === "用电量") {
res +=
marker +
seriesName +
":" +
'<span style="color: #000000; font-weight: bold;margin-left:5px">' +
value +
" " +
"kwh" +
"</span><br>";
} else {
res +=
marker +
seriesName +
":" +
'<span style="color: #000000; font-weight: bold;margin-left:5px">' +
value +
"</span><br>";
}
}
return res;
},
},
legend: {
show: false, //
},
grid: {
top: "5%",
left: "3%",
right: "4.4%",
bottom: "20%",
containLabel: true,
},
xAxis: {
type: "category",
data: this.dateList2,
//true
boundaryGap: true,
// x
axisLabel: {
// interval: 0, //x
// rotate: 30, //x30
color: "rgba(255, 255, 255, 1)",
},
axisTick: {
show: false, // 线
},
// x
axisLine: {
show: true,
lineStyle: {
color: "#365576",
},
},
splitLine: {
lineStyle: {
color: "#e2e6f0",
},
}, //x线
},
yAxis: {
min: 0,
miniInterval: 5,
type: "value",
// y
axisLabel: {
color: "rgba(255, 255, 255, 1)",
},
// y
axisLine: {
show: true,
lineStyle: {
color: "#365576", // y 线
},
},
splitLine: {
lineStyle: {
color: "#1a3d62", // 线
type: "dashed", // 线线
},
},
},
series: [
{
name: "用电量",
type: "line",
smooth: true,
symbol: "circle",
//
symbolSize: 8,
data: this.electData2,
sampling: "lttb", //
//
// itemStyle: {
// color: "#0184d5",
// borderColor: "rgba(221, 220, 107, .1)",
// borderWidth: 12
// },
//
showSymbol: false,
//线
itemStyle: {
color: "#01c29b", //线
lineStyle: {
color: "#01c29b", //线
},
},
areaStyle: {
color: {
//线
type: "linear",
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{
offset: 0,
color: "rgba(1, 194, 155, 1)", // 0%
},
{
offset: 0.8,
color: "rgba(1, 194, 155,0.2)", // 100%
},
],
// global: false, // false
},
},
},
],
};
//
this.chartInstance2.setOption(this.option2, true);
},
//
screenAdapter() {
//,2.6 mes_ref
const titleFontSize = this.$refs.charts_refs.offsetWidth / 130;
//optionoption
const adapterOption = {
// x
xAxis: {
axisLabel: {
fontSize: titleFontSize * 1.5,
},
},
yAxis: {
axisLabel: {
fontSize: titleFontSize * 1.5,
},
},
// X
dataZoom: [
{
type: "slider", //inside
show: this.showZoom,
height: titleFontSize, // 20
// fillerColor: 'rgba(255, 0, 0, 0.5)', //
// backgroundColor: 'rgba(0, 0, 0, 0.1)', // 0.1
start: 0,
end: 100,
xAxisIndex: [0],
handleSize: "120%", // 120%
},
],
};
//.chartInstanceoptiondataoption
this.chartInstance2.setOption(adapterOption);
//resize
this.chartInstance2.resize();
},
},
};
</script>
<style lang="scss" scoped>
.condition {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
width: 100%;
margin-bottom: 0.24rem;
.condition-left {
display: flex;
flex-direction: row;
align-items: center;
flex-wrap: wrap;
.years-div {
display: flex;
flex-direction: row;
align-items: center;
.years-word {
font-size: 14px;
margin: 0 5px;
color: #388ff3;
}
}
.time-label {
font-size: 16px;
line-height: 7px;
margin-right: 12px;
white-space: nowrap;
}
}
}
.charts-title {
font-size: 0.24rem;
line-height: 0.07rem;
letter-spacing: 0.02rem;
color: #1f70e9;
margin: 0.3rem 0;
width: 100%;
text-align: center;
}
.analysis-table table thead th {
min-width: 1.6rem;
}
.analysis-table {
margin-bottom: 0.37rem;
}
.main-content {
min-height: 6.9rem;
}
.charts_refs {
width: 17rem;
height: 4.55rem;
margin-left: -0.35rem;
}
</style>

816
src/views/centerairC/enSourceAnalysis/components/equipment.vue

@ -0,0 +1,816 @@
<template>
<div class="main-body">
<div class="irregular-border">
<div class="main-content">
<div class="condition">
<div class="condition-left">
<div class="time-label">时间类型:</div>
<el-radio-group
v-model="dateType"
style="margin-right: 0.24rem"
@change="updateDateType"
>
<el-radio label="hour">小时</el-radio>
<el-radio label="day"></el-radio>
<el-radio label="month"></el-radio>
<el-radio label="year"></el-radio>
</el-radio-group>
<el-date-picker
v-model="timeDate"
:default-time="['00:00:00', '23:59:59']"
type="datetimerange"
range-separator="至"
v-if="dateType == 'hour'"
placeholder="选择日期"
start-placeholder="开始日期"
end-placeholder="结束日期"
>
</el-date-picker>
<el-date-picker
v-model="dayDate"
type="daterange"
v-if="dateType == 'day'"
:key="this.dateType"
range-separator="至"
value-format="yyyy-MM-dd"
start-placeholder="开始日期"
end-placeholder="结束日期"
@change="dateChange"
>
</el-date-picker>
<el-date-picker
v-model="monthDate"
type="monthrange"
v-if="dateType == 'month'"
:key="this.dateType"
range-separator="至"
start-placeholder="开始月份"
end-placeholder="结束月份"
value-format="yyyy-MM"
@change="dateChange"
>
</el-date-picker>
<div
class="years-div"
v-if="dateType == 'year'"
:key="this.dateType"
>
<el-date-picker
v-model="startYear"
type="year"
placeholder="选择开始年份"
style="width: 180px"
value-format="yyyy"
>
</el-date-picker>
<div class="years-word"></div>
<el-date-picker
v-model="endYear"
type="year"
placeholder="选择结束年份"
style="width: 180px"
value-format="yyyy"
>
</el-date-picker>
</div>
<el-select
multiple
collapse-tags
style="margin: 0 0.24rem; width: 250px"
v-model="electType"
placeholder="请选择查询类型"
@change="handleSelectChange"
>
<el-option
v-for="item in electTypes"
:key="item.id"
:label="item.otherName"
:value="item.id"
></el-option>
</el-select>
<el-select
style="margin: 0 10px"
v-model="systemType"
placeholder="请选择系统类型"
clearable
>
<el-option
v-for="dict in systemTypes"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
/>
</el-select>
<div class="success-btn">
<el-button type="success" @click="findData">查询</el-button>
</div>
<div class="primary-btn">
<el-button type="primary" @click="leadingPrint">打印</el-button>
</div>
<div class="warning-btn">
<el-button type="warning" @click="exportData">导出</el-button>
</div>
</div>
</div>
<div class="charts-table" v-loading="listLoading">
<div class="details_ref" ref="details_ref"></div>
<div class="table-content" style="width: 100%">
<el-table
border
:data="tableData"
style="width: 100%"
v-if="tableData && tableData.length > 0"
>
<el-table-column
v-for="header in headers"
:key="header.key"
:prop="header.key"
:label="header.label"
>
</el-table-column>
</el-table>
<div class="page" v-if="tableData && tableData.length > 0">
<el-pagination
background
style="width: 100%; height: 20%"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="this.pageParm.page"
:page-size="10"
layout="->,total, sizes, prev, pager, next, jumper"
:page-sizes="[10, 20, 30, 50, 100, 200, 9999]"
:total="this.pageParm.total"
>
</el-pagination>
</div>
</div>
</div>
</div>
</div>
<el-dialog
:visible.sync="dialogPrintVisible"
title="打印预览"
width="900px"
>
<div id="report" ref="report" class="report">
<table
border="1"
style="
table-layout: fixed;
width: 100%;
border: 1px solid #e2e6f0;
margin-bottom: 35px;
"
>
<thead>
<tr>
<th rowspan="1" :colspan="headers.length">设备能耗报表</th>
</tr>
<tr>
<th
align="center"
v-for="(item, index) in headers"
:key="index + 2"
>
{{ item.label }}
</th>
</tr>
</thead>
<tr v-for="(item, index) in tableData" :key="index">
<td align="center" v-for="(value, key) in item" :key="key">
{{ value }}
</td>
</tr>
</table>
<div
class="detail"
style="
display: flex;
flex-direction: row;
font-size: 14px;
justify-content: space-between;
flex-wrap: nowrap;
width: 40%;
color: #ffffff;
"
>
<div>操作员: {{ this.userName }}</div>
<div class="print-date">日期 {{ this.operationDate }}</div>
</div>
</div>
<el-row type="flex" justify="end" style="margin-top: 0.2rem">
<el-col :span="2">
<el-button type="info" @click="dialogPrintVisible = false"
>取消</el-button
>
</el-col>
<el-col :span="2" style="margin-left: 60px">
<el-button type="success" @click="surePrint">确认</el-button>
</el-col>
</el-row>
</el-dialog>
</div>
</template>
<script>
import { getDay, format2 } from "@/utils/datetime";
import * as echarts from "echarts";
import {
deviceAnalyze,
deviceAnalyzeExport,
} from "@/api/centerairC/energyManage";
import { cpmList } from "@/api/device/gather";
import { listData } from "@/api/system/dict/data";
export default {
data() {
return {
listLoading: false,
dateType: "hour", //
timeDate: [], //
dayDate: [], //
monthDate: [], //
startYear: "", //
endYear: "", //
startTime: "", //
endTime: "", //
//
timeData: [],
dataArr: [],
//
curValue2: [],
lastValue2: [],
mom2: [],
unitValue: "", //
electType: [],
electTypes: [],
selectElect: [],
//
headers: [
// { key: 'name', label: 'Name' },
// { key: 'age', label: 'Age' },
// { key: 'gender', label: 'Gender' }
],
tableData: [
// { name: 'Alice', age: 26, gender: 'Female' },
// { name: 'Bob', age: 30, gender: 'Male' },
// { name: 'Charlie', age: 25, gender: 'Male' }
],
pageParm: {
page: 1, //
pageSize: 10, //
total: null, //
},
dialogPrintVisible: false,
userName: "", //
operationDate: getDay(0), //
systemType: "", //
systemTypes: [],
electType: "",
electTypes: [],
};
},
mounted() {
this.initData();
this.initializeTimeDate();
this.initChart1();
window.addEventListener("resize", this.screenAdapter);
this.screenAdapter();
this.userName = sessionStorage.getItem("userName");
},
destroyed() {
//mounted
window.removeEventListener("resize", this.screenAdapter);
},
methods: {
/** 查询系统类型-字典数据列表 */
getDictList() {
return new Promise((resolve, reject) => {
let data = {
pageNum: 1,
pageSize: 100,
dictType: "sys_type",
};
listData(data)
.then((response) => {
this.systemTypes = response.rows;
if (this.systemTypes.length > 0) {
this.systemType = this.systemTypes[0].dictValue;
}
resolve();
})
.catch((error) => {
reject(error);
});
});
},
/** 查询设备类型列表 */
getList() {
return new Promise((resolve, reject) => {
let data = {
pageNum: 1,
pageSize: 100,
mtType: "5", // ModBus
};
cpmList(data)
.then((response) => {
this.electType = [];
this.electTypes = response.rows;
this.electType = [this.electTypes[0].id];
console.log("this.electTypes", this.electTypes);
console.log("this.electType", this.electType);
this.handleSelectChange();
resolve();
})
.catch((error) => {
reject(error);
});
});
},
/** 初始化数据 */
initData() {
Promise.all([this.getDictList(), this.getList()])
.then(() => {
this.getTableData();
this.getChartsData();
})
.catch((error) => {
console.error("数据获取失败:", error);
});
},
//
handleSizeChange(val) {
this.pageParm.pageSize = val;
this.pageParm.page = 1;
//
this.getTableData();
},
//
handleCurrentChange(val) {
this.pageParm.page = val;
//
this.getTableData();
},
// el-select
handleSelectChange() {
console.log("----和默认选中值比较", this.electType);
this.selectElect = this.electType.map((v) => {
const selectedItem = this.electTypes.find((item) => item.id === v);
return {
name: selectedItem ? selectedItem.otherName : "",
value: v,
};
});
console.log("this.selectElect", this.selectElect);
},
//
initializeTimeDate() {
const start = new Date(new Date().setHours(0, 0, 0, 0));
const end = new Date(new Date().setHours(23, 59, 59, 59));
this.timeDate = [format2(start), format2(end)]; //
},
//
updateDateType() {
// this.dateType = this.radio;
console.log(this.dateType);
(this.timeDate = []), //
(this.dayDate = []), //
(this.monthDate = []), //
(this.startYear = ""), //
(this.endYear = ""); //
},
//
dateChange() {
// console.log("", this.timeform.time1);
if (!this.dayDate) {
this.$nextTick(() => {
this.dayDate = [];
});
}
if (!this.monthDate) {
this.$nextTick(() => {
this.monthDate = [];
});
}
},
//
findData() {
this.pageParm.page = 1;
console.log("this.dateType", this.dateType);
console.log("this.timeDate", this.timeDate);
switch (this.dateType) {
case "hour":
if (!this.timeDate) {
this.showMessage("请选择时间!", "warning");
} else {
this.getTableData();
this.getChartsData();
}
break;
case "day":
if (this.dayDate.length === 0) {
this.showMessage("请选择时间!", "warning");
} else {
this.getTableData();
this.getChartsData();
}
break;
case "month":
if (this.monthDate.length === 0) {
this.showMessage("请选择时间!", "warning");
} else {
this.getTableData();
this.getChartsData();
}
break;
case "year":
if (!this.startYear || !this.endYear) {
this.showMessage("请选择全年份区间!", "warning");
} else if (this.startYear > this.endYear) {
this.showMessage("结束年份要大于开始年份!", "warning");
} else {
this.getTableData();
this.getChartsData();
}
break;
default:
break;
}
},
//
showMessage(message, type) {
this.$message({
message: message,
type: type,
});
},
//
getTableData() {
if (this.dateType == "hour") {
this.startTime = format2(this.timeDate[0]);
this.endTime = format2(this.timeDate[1]);
} else if (this.dateType == "day") {
this.startTime = this.dayDate.length > 0 ? this.dayDate[0] : "";
this.endTime = this.dayDate.length > 0 ? this.dayDate[1] : "";
} else if (this.dateType == "month") {
this.startTime = this.monthDate.length > 0 ? this.monthDate[0] : "";
this.endTime = this.monthDate.length > 0 ? this.monthDate[1] : "";
} else if (this.dateType == "year") {
(this.startTime = this.startYear), (this.endTime = this.endYear);
}
let data = {
timeType: this.dateType,
startTime: this.startTime,
endTime: this.endTime,
pageNum: this.pageParm.page,
pageSize: this.pageParm.pageSize,
searchParams: this.selectElect,
systemType: this.systemType,
};
console.log("查询数据参数", data);
this.listLoading = true;
deviceAnalyze(data).then((res) => {
console.log("查询返回", res);
if (res.code == 200 && res.data.content) {
// content this.tableData
this.tableData = res.data.content[1].timeStr.map((date, index) => {
const rowData = { date };
res.data.content[0].dataList.forEach((data, dataIndex) => {
rowData[`data${dataIndex + 1}`] = data.value[index];
});
return rowData;
});
console.log("tableData", this.tableData);
// content header
this.headers = [
{ key: "date", label: "时间" },
...res.data.content[0].dataList.map((data, index) => {
const matched = this.electTypes.find(
(item) => item.value === data.name
);
const label = matched ? matched.label : "";
return {
key: `data${index + 1}`,
label: label,
};
}),
];
this.pageParm.total = res.data.totalSize;
console.log("header", this.headers);
} else {
this.tableData = [];
this.headers = [];
}
});
// Just to simulate the time of the request
setTimeout(() => {
this.listLoading = false;
}, 1.0 * 1000);
},
//
getChartsData() {
console.log("???????????????");
debugger;
this.timeData = [];
this.dataArr = [];
if (this.dateType == "hour") {
this.startTime = format2(this.timeDate[0]);
this.endTime = format2(this.timeDate[1]);
} else if (this.dateType == "day") {
this.startTime = this.dayDate.length > 0 ? this.dayDate[0] : "";
this.endTime = this.dayDate.length > 0 ? this.dayDate[1] : "";
} else if (this.dateType == "month") {
this.startTime = this.monthDate.length > 0 ? this.monthDate[0] : "";
this.endTime = this.monthDate.length > 0 ? this.monthDate[1] : "";
} else if (this.dateType == "year") {
(this.startTime = this.startYear), (this.endTime = this.endYear);
}
let data = {
timeType: this.dateType,
startTime: this.startTime,
endTime: this.endTime,
pageNum: 0,
pageSize: 10,
searchParams: this.selectElect,
systemType: this.systemType,
};
console.log("查询数据参数", data);
deviceAnalyze(data).then((res) => {
console.log("查询返回", res);
if (res.code == 200 && res.data.content) {
this.timeData = res.data.content[1].timeStr;
// x {nameselect,data}
console.log(
"res.data.content[0].dataList",
res.data.content[0].dataList
);
this.dataArr = [];
this.dataArr = res.data.content[0].dataList;
this.dataArr.forEach((obj) => {
const match = this.electTypes.find((s) => s.value === obj.name);
if (match) {
obj.name = match.label;
}
obj.type = "line";
obj.smooth = true;
(obj.sampling = "lttb"),
(obj.showSymbol = false),
(obj.data = obj.value);
delete obj.value;
});
console.log("图表数据", this.dataArr);
this.option1.series = this.dataArr;
this.option1.xAxis.data = this.timeData;
//
this.chartInstance1.clear();
this.screenAdapter();
this.chartInstance1.setOption(this.option1);
} else {
this.timeData = [];
this.curValue2 = [];
this.lastValue2 = [];
this.mom2 = [];
this.option1.series = [];
this.option1.xAxis.data = [];
//
this.chartInstance1.clear();
this.screenAdapter();
this.chartInstance1.setOption(this.option1);
}
});
},
initChart1() {
this.chartInstance1 = echarts.init(this.$refs.details_ref);
this.option1 = {
tooltip: {
trigger: "axis",
// hover
showDelay: 0, // ms
axisPointer: {
type: "shadow",
shadowStyle: {
color: "rgba(30, 69, 113, 0.15)",
width: "",
},
},
valueFormatter: function (value) {
return value + " " + "kwh";
},
},
legend: {
show: true,
top: "0%",
textStyle: {
fontSize: 14, // 14
color: "#ffffff",
},
},
grid: {
top: "9%",
left: "3%",
right: "2%",
bottom: "25%",
containLabel: true,
},
xAxis: {
type: "category",
//true
boundaryGap: true,
// x
axisLabel: {
// interval: 0, //x
// rotate: 30, //x30
color: "rgba(255, 255, 255, 1)",
},
axisTick: {
show: false, // 线
},
// x
axisLine: {
show: true,
lineStyle: {
color: "#365576",
},
},
splitLine: {
lineStyle: {
color: "#e2e6f0",
},
},
},
yAxis: {
min: 0,
miniInterval: 5,
type: "value",
// y
axisLabel: {
color: "rgba(255, 255, 255, 1)",
},
// y
axisLine: {
show: true,
lineStyle: {
color: "#365576", // y 线
},
},
splitLine: {
lineStyle: {
color: "#1a3d62", // 线
type: "dashed", // 线线
},
},
},
// X
dataZoom: [
{
type: "slider", //inside
show: true,
height: 15, // 20
// fillerColor: 'rgba(255, 0, 0, 0.5)', //
// backgroundColor: 'rgba(0, 0, 0, 0.1)', // 0.1
start: 0,
end: 100,
xAxisIndex: [0],
handleSize: "120%", // 120%
textStyle: {
fontSize: 12, // 12px
},
},
],
series: [],
};
//
this.chartInstance1.setOption(this.option1, true);
},
// 线
screenAdapter() {
//,2.6 mes_ref
const titleFontSize = (this.$refs.details_ref.offsetWidth / 100) * 1.8;
//optionoption
const adapterOption = {
//fontSize
textStyle: {
fontSize: titleFontSize,
},
};
//.chartInstanceoptiondataoption
this.chartInstance1.setOption(adapterOption);
//resize
this.chartInstance1.resize();
},
//
exportData() {
if (this.dateType == "hour") {
this.startTime = format2(this.timeDate[0]);
this.endTime = format2(this.timeDate[1]);
} else if (this.dateType == "day") {
this.startTime = this.dayDate.length > 0 ? this.dayDate[0] : "";
this.endTime = this.dayDate.length > 0 ? this.dayDate[1] : "";
} else if (this.dateType == "month") {
this.startTime = this.monthDate.length > 0 ? this.monthDate[0] : "";
this.endTime = this.monthDate.length > 0 ? this.monthDate[1] : "";
} else if (this.dateType == "year") {
(this.startTime = this.startYear), (this.endTime = this.endYear);
}
let data = {
timeType: this.dateType,
startTime: this.startTime,
endTime: this.endTime,
pageNum: 0,
pageSize: 10,
searchParams: this.selectElect,
};
console.log("导出数据参数", data);
deviceAnalyzeExport(data).then((res) => {
console.log("导出返回", res);
if (res) {
//
// blob URL
const url = window.URL.createObjectURL(new Blob([res]));
// <a>hrefdownload
const link = document.createElement("a");
link.href = url;
link.setAttribute("download", "设备能耗报表.xls"); //
//
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
// blob URL
window.URL.revokeObjectURL(url);
this.$message({
type: "success",
message: "导出成功!",
});
} else {
this.$message.error("导出失败!");
}
});
// .catch((err) => {
// this.$message.error('!');
// })
},
//
leadingPrint() {
this.dialogPrintVisible = true;
console.log("头部数据", this.headers);
console.log("表格数据", this.tableData);
},
//
surePrint() {
const printHTML = document.querySelector("#report").innerHTML;
//
window.document.body.innerHTML = printHTML;
window.print(); // window
window.location.reload(); //
},
},
};
</script>
<style lang="scss" scoped>
.condition {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
width: 100%;
margin-bottom: 0.24rem;
.condition-left {
display: flex;
flex-direction: row;
align-items: center;
flex-wrap: wrap;
.years-div {
display: flex;
flex-direction: row;
align-items: center;
.years-word {
font-size: 14px;
margin: 0 5px;
color: #388ff3;
}
}
.time-label {
font-size: 16px;
line-height: 7px;
margin-right: 12px;
white-space: nowrap;
}
}
}
.main-content {
min-height: 6.6rem;
}
.details_ref {
width: 16.5rem;
height: 3.55rem;
margin-bottom: 0.39rem;
margin-left: -0.3rem;
}
</style>

218
src/views/centerairC/enSourceAnalysis/components/machineChart.vue

@ -0,0 +1,218 @@
<template>
<div class="prop-content">
<div class="elect" ref="elect"></div>
</div>
</template>
<script>
import * as echarts from "echarts";
export default {
props: {
chartsData: {
type: Array, //
required: true, // true
},
// chartInstance1: "",
// option1: {},
deviceStatus: [], //
},
data() {
return {
chartInstance1: null,
option1: {},
// legendData: ["", "", "", ""],
};
},
watch: {
chartsData: {
handler(newDataA, oldDataA) {
if (newDataA) {
// this.chartInstance1.dispose(); //
this.screenAdapter(); //
// console.log("")
}
},
deep: true, //
},
},
mounted() {
this.initChart1();
this.screenAdapter();
window.addEventListener("resize", this.screenAdapter);
},
destroyed() {
//mounted
window.removeEventListener("resize", this.screenAdapter);
},
methods: {
initChart1() {
this.chartInstance1 = echarts.init(this.$refs.elect);
this.option1 = {
// backgroundColor: '#031a40',
//
tooltip: {
trigger: "item", //
backgroundColor: "rgba(50,50,50,0.7)", //
// borderColor: '#0ac1c7',//
textStyle: {
color: "#fff",
fontSize: "15",
},
// formatter: '{a0}<br />{b0}{c0} kwh'//1.
formatter: "{b0}:{c0} kwh", //1.
// formatter:function(params){ //2.,return dom
// console.log('params',params)
// return params[0].name
// }
},
//
// backgroundColor: '#081736',
series: [
{
name: "详情",
type: "pie",
minAngle: 2, //0 ~ 360
radius: ["30%", "50%"],
center: ["50%", "50%"],
emphasis: {
scale: true, //
},
color: [
"#0ac1c7",
"#deb140",
"#49dff0",
"#034079",
"#6f81da",
"#00ffb4",
,
"#FFE900",
"#F5B157",
"#1DA7FF",
"#2967EA",
],
},
],
};
//
this.chartInstance1.setOption(this.option1);
},
//
screenAdapter() {
//,2.6 mes_ref
const titleFontSize = (this.$refs.elect.offsetWidth / 100) * 2.4;
// console.log("chartsData", this.chartsData)
// value
for (let i = 0; i < this.chartsData.length; i++) {
this.chartsData[i].value = parseFloat(this.chartsData[i].value);
}
var scale = 1;
var echartData = this.chartsData;
var rich = {
yellow: {
color: "#ffc72b",
fontSize: titleFontSize * 1.5,
padding: [5, 4],
align: "center",
},
total: {
color: "#ffc72b",
fontSize: titleFontSize * 1.4,
align: "center",
},
white: {
color: "#fff",
align: "center",
fontSize: titleFontSize * 1.4,
padding: [5, 0],
},
blue: {
color: "#49dff0",
fontSize: titleFontSize * 1.09,
align: "center",
},
hr: {
borderColor: "#eee",
width: "100%",
borderWidth: titleFontSize * 0.1,
height: 0,
},
};
//optionoption
const option1 = {
tooltip: {
textStyle: {
fontSize: titleFontSize * 1.3,
},
},
series: [
{
label: {
formatter: function (params, ticket, callback) {
var total = 0;
var percent = 0;
echartData.forEach(function (value, index, array) {
total += value.value;
});
if (total !== 0) {
percent = ((params.value / total) * 100).toFixed(2);
}
return (
"{white|" +
params.name +
"}\n" +
"{hr|}\n" +
"{yellow|" +
params.value +
"}" +
"{blue| (" +
(total !== 0 ? percent : 0) +
"%)}"
);
},
rich: rich,
},
data: echartData,
labelLine: {
//线
length: titleFontSize * 2,
length2: 0,
lineStyle: {
color: "#fff",
},
},
itemStyle: {
// color: "#052f37"
borderRadius: 5,
borderColor: "#052f37",
borderWidth: 2,
},
},
],
};
//.chartInstanceoptiondataoption
this.chartInstance1.setOption(option1);
//resize
this.chartInstance1.resize();
},
},
};
</script>
<style lang="scss" scoped>
.prop-content {
color: rgb(243, 223, 106);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 100%;
.elect {
width: 100%;
height: 3.3rem;
}
}
</style>

638
src/views/centerairC/enSourceAnalysis/components/machineRoom.vue

@ -0,0 +1,638 @@
<template>
<div class="big-machine" v-loading="listLoading">
<div class="condition">
<div class="condition-left">
<div class="time-label">时间类型:</div>
<el-radio-group
v-model="dateType"
style="margin-right: 0.24rem"
@change="updateDateType"
>
<el-radio label="hour">小时</el-radio>
<el-radio label="day"></el-radio>
<el-radio label="month"></el-radio>
<el-radio label="year"></el-radio>
</el-radio-group>
<el-date-picker
v-model="timeDate"
:default-time="['00:00:00', '23:59:59']"
type="datetimerange"
range-separator="至"
v-if="dateType == 'hour'"
placeholder="选择日期"
start-placeholder="开始日期"
end-placeholder="结束日期"
>
</el-date-picker>
<el-date-picker
v-model="dayDate"
type="daterange"
v-if="dateType == 'day'"
:key="this.dateType"
range-separator="至"
value-format="yyyy-MM-dd"
start-placeholder="开始日期"
end-placeholder="结束日期"
@change="dateChange"
>
</el-date-picker>
<el-date-picker
v-model="monthDate"
type="monthrange"
v-if="dateType == 'month'"
:key="this.dateType"
range-separator="至"
start-placeholder="开始月份"
end-placeholder="结束月份"
value-format="yyyy-MM"
@change="dateChange"
>
</el-date-picker>
<div class="years-div" v-if="dateType == 'year'" :key="this.dateType">
<el-date-picker
v-model="startYear"
type="year"
placeholder="选择开始年份"
style="width: 180px"
value-format="yyyy"
>
</el-date-picker>
<div class="years-word"></div>
<el-date-picker
v-model="endYear"
type="year"
placeholder="选择结束年份"
style="width: 180px"
value-format="yyyy"
>
</el-date-picker>
</div>
<el-select
style="margin-left: 10px"
v-model="systemType"
placeholder="请选择系统类型"
clearable
>
<el-option
v-for="dict in systemTypes"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
/>
</el-select>
<div class="success-btn" style="margin: 0 0.24rem">
<el-button type="success" @click="findData"
>查询</el-button
>
</div>
<div class="warning-btn">
<el-button type="warning" @click="exportData">导出</el-button>
</div>
</div>
</div>
<div class="machine">
<div class="machine-left">
<div class="machine-li">
<div class="tit">冷水机组</div>
<div class="machine-center-li">
<div class="machine-context">
<div class="chart">
<machine-chart :chartsData="chiller"></machine-chart>
</div>
</div>
</div>
</div>
<div class="machine-li">
<div class="tit">冷冻水泵</div>
<div class="machine-center-li">
<div class="machine-context">
<div class="chart">
<machine-chart :chartsData="chillerPump"></machine-chart>
</div>
</div>
</div>
</div>
</div>
<div class="machine-center">
<div class="total">
<div class="data1">
<span>冷水机组</span>
<div class="p-class">
<countTo
class="p-class2"
:startVal="startVal"
:endVal="allDataArr[0].value"
:duration="duration"
:separator="separator"
:decimals="2"
ref="CountToPower"
></countTo
>kwh
</div>
</div>
<div class="data2">
<span>冷冻水泵</span>
<div class="p-class">
<countTo
class="p-class2"
:startVal="startVal"
:endVal="allDataArr[1].value"
:duration="duration"
:separator="separator"
:decimals="2"
ref="CountToPower"
></countTo
>kwh
</div>
</div>
<div class="data3">
<span>冷却水泵</span>
<div class="p-class">
<countTo
class="p-class2"
:startVal="startVal"
:endVal="allDataArr[2].value"
:duration="duration"
:separator="separator"
:decimals="2"
ref="CountToPower"
></countTo
>kwh
</div>
</div>
<div class="data4">
<span>冷却塔</span>
<div class="p-class">
<countTo
class="p-class2"
:startVal="startVal"
:endVal="allDataArr[3].value"
:duration="duration"
:separator="separator"
:decimals="2"
ref="CountToPower"
></countTo
>kwh
</div>
</div>
<canvas class="rain"></canvas>
<canvas class="dashed"></canvas>
<div class="sphere">
<div class="sphere-bg"></div>
<div class="sum">
<div class="sum-title">总耗电量</div>
<div class="p-all">
<countTo
:startVal="startVal"
:endVal="allElect"
:duration="duration"
:separator="separator"
:decimals="2"
ref="CountToPower"
></countTo
>kwh
</div>
</div>
</div>
<div class="cicle3"></div>
<div class="cicle4"></div>
<div class="cicle5"></div>
<div class="cicle6"></div>
<div class="cicle7"></div>
<div class="cicle8">
<span>{{ electProp[0] }}%</span>
<p>冷水机组</p>
</div>
<div class="cicle9">
<span>{{ electProp[1] }}%</span>
<p>冷冻水泵</p>
</div>
<div class="cicle10">
<span>{{ electProp[2] }}%</span>
<p>冷却水泵</p>
</div>
<div class="cicle11">
<span>{{ electProp[3] }}%</span>
<p>冷却塔</p>
</div>
</div>
</div>
<div class="machine-right">
<div class="machine-li">
<div class="tit">冷却水泵</div>
<div class="machine-center-li">
<div class="machine-context">
<div class="chart">
<machine-chart :chartsData="coolPump"></machine-chart>
</div>
</div>
</div>
</div>
<div class="machine-li">
<div class="tit">冷却塔</div>
<div class="machine-center-li">
<div class="machine-context">
<div class="chart">
<machine-chart :chartsData="coolTower"></machine-chart>
</div>
</div>
</div>
</div>
</div>
</div>
<el-dialog title="" :visible.sync="dialogVisible" width="750px">
<prop-chart></prop-chart>
</el-dialog>
</div>
</template>
<script>
import { format2 } from "@/utils/datetime";
import machineChart from "./machineChart.vue";
// import propChart from './propChart.vue';
import countTo from "vue-count-to";
import { energyAnalyze, analyzeExport } from "@/api/centerairC/energyManage";
import { listData } from "@/api/system/dict/data";
export default {
components: { machineChart, countTo },
data() {
return {
listLoading: false,
dateType: "hour", //
timeDate: [], //
dayDate: [], //
monthDate: [], //
startYear: "", //
endYear: "", //
startTime: "", //
endTime: "", //
allDataArr: [
{ value: 0 }, //
{ value: 0 },
{ value: 0 },
{ value: 0 },
],
chillerPump: [], //
chiller: [], //
coolPump: [], //
coolTower: [], //
allElect: 0, //
electProp: [], //
dialogVisible: false,
startVal: 0, //
duration: 1000, //
separator: "", //
systemType: "", //
systemTypes: [],
};
},
created() {
//
},
mounted() {
this.initializeTimeDate();
this.getDictList();
},
methods: {
/** 查询系统类型-字典数据列表 */
getDictList() {
let data = {
pageNum: 1,
pageSize: 100,
dictType: "sys_type",
};
listData(data).then((response) => {
this.systemTypes = response.rows;
this.systemType = this.systemTypes[0].dictValue;
this.getTableData();
});
},
//
initializeTimeDate() {
const start = new Date(new Date().setHours(0, 0, 0, 0));
const end = new Date(new Date().setHours(23, 59, 59, 59));
this.timeDate = [format2(start), format2(end)]; //
},
//
updateDateType() {
// this.dateType = this.radio;
console.log(this.dateType);
(this.timeDate = []), //
(this.dayDate = []), //
(this.monthDate = []), //
(this.startYear = ""), //
(this.endYear = ""); //
},
//
dateChange() {
// console.log("", this.timeform.time1);
if (!this.dayDate) {
this.$nextTick(() => {
this.dayDate = [];
});
}
if (!this.monthDate) {
this.$nextTick(() => {
this.monthDate = [];
});
}
},
//
findData() {
console.log("this.dateType", this.dateType);
console.log("this.timeDate", this.timeDate);
switch (this.dateType) {
case "hour":
if (!this.timeDate) {
this.showMessage("请选择时间!", "warning");
} else {
this.getTableData();
}
break;
case "day":
if (this.dayDate.length === 0) {
this.showMessage("请选择时间!", "warning");
} else {
const newLength =
new Date(this.dayDate[1]).getTime() -
new Date(this.dayDate[0]).getTime();
const dayDiff = Math.floor(newLength / (1000 * 60 * 60 * 24));
if (dayDiff > 31) {
this.showMessage(
"最多只能选择30天区间,请重新选择再查询!",
"warning"
);
} else {
this.getTableData();
}
}
break;
case "month":
if (this.monthDate.length === 0) {
this.showMessage("请选择时间!", "warning");
} else {
const [start, end] = this.monthDate;
const startDate = new Date(start);
const endDate = new Date(end);
const startYear = startDate.getFullYear();
const startMonth = startDate.getMonth();
const endYear = endDate.getFullYear();
const endMonth = endDate.getMonth();
const monthDiff =
(endYear - startYear) * 12 + (endMonth - startMonth);
if (monthDiff > 12) {
this.showMessage(
"最多只能选择12个月区间,请重新选择再查询!",
"warning"
);
} else {
this.getTableData();
}
}
break;
case "year":
if (!this.startYear || !this.endYear) {
this.showMessage("请选择全年份区间!", "warning");
} else if (this.startYear > this.endYear) {
this.showMessage("结束年份要大于开始年份!", "warning");
} else {
this.getTableData();
}
break;
default:
break;
}
},
//
showMessage(message, type) {
this.$message({
message: message,
type: type,
});
},
//
getTableData() {
if (this.dateType == "hour") {
this.startTime = format2(this.timeDate[0]);
this.endTime = format2(this.timeDate[1]);
} else if (this.dateType == "day") {
this.startTime = this.dayDate.length > 0 ? this.dayDate[0] : "";
this.endTime = this.dayDate.length > 0 ? this.dayDate[1] : "";
} else if (this.dateType == "month") {
this.startTime = this.monthDate.length > 0 ? this.monthDate[0] : "";
this.endTime = this.monthDate.length > 0 ? this.monthDate[1] : "";
} else if (this.dateType == "year") {
(this.startTime = this.startYear), (this.endTime = this.endYear);
}
let data = {
timeType: this.dateType,
startTime: this.startTime,
endTime: this.endTime,
systemType: this.systemType,
};
console.log("查询数据参数", data);
this.listLoading = true;
energyAnalyze(data).then((res) => {
console.log("能源返回", res);
if (res.code == 200 && res.data.length > 0) {
this.allDataArr = res.data.all;
this.allDataArr = this.allDataArr.map((item) => {
item.value = parseFloat(item.value);
return item;
});
this.chillerPump = res.data.chillerPump;
this.chiller = res.data.chiller;
this.coolPump = res.data.coolPump;
this.coolTower = res.data.coolTower;
console.log("this.allDataArr", this.allDataArr);
//
this.allElect = this.allDataArr.reduce(
(sum, item) => sum + item.value,
0
);
console.log("this.allElect ", this.allElect);
this.electProp = [];
//
this.allDataArr.forEach((item) => {
console.log("两数相除", item.value, this.allElect);
let percentage;
if (this.allElect === 0) {
percentage = 0; // null
} else {
percentage = (parseFloat(item.value) / this.allElect) * 100;
percentage = percentage.toFixed(2);
}
this.electProp.push(percentage);
});
console.log("百分比数组", this.electProp);
} else {
this.chiller = [];
this.chillerPump = [];
this.coolPump = [];
this.coolTower = [];
}
});
// Just to simulate the time of the request
setTimeout(() => {
this.listLoading = false;
}, 1.0 * 1000);
},
//
exportData() {
let data = {
timeType: this.dateType,
startTime: this.startTime,
endTime: this.endTime,
systemType: this.systemType,
};
console.log("导出数据参数", data);
analyzeExport(data).then((res) => {
console.log("导出返回", res);
if (res) {
//
// blob URL
const url = window.URL.createObjectURL(new Blob([res]));
// <a>hrefdownload
const link = document.createElement("a");
link.href = url;
link.setAttribute("download", "机房能耗报表.xls"); //
//
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
// blob URL
window.URL.revokeObjectURL(url);
this.$message({
type: "success",
message: "导出成功!",
});
} else {
this.$message.error("导出失败!");
}
});
// .catch((err) => {
// this.$message.error('!');
// })
},
onReversal() {
this.dialogVisible = true;
},
},
};
</script>
<style lang="scss" scoped>
.condition {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
width: 100%;
margin-bottom: 0.24rem;
.condition-left {
display: flex;
flex-direction: row;
align-items: center;
flex-wrap: wrap;
.years-div {
display: flex;
flex-direction: row;
align-items: center;
.years-word {
font-size: 14px;
margin: 0 5px;
color: #388ff3;
}
}
.time-label {
font-size: 16px;
line-height: 7px;
margin-right: 12px;
white-space: nowrap;
}
}
}
.machine {
display: flex;
flex-direction: row;
justify-content: space-between;
flex-wrap: nowrap;
width: 100%;
.machine-center {
width: 50%;
}
.machine-left,
.machine-right {
display: flex;
flex-direction: column;
width: 25%;
// background: #00be97;
display: flex;
flex-direction: column;
justify-content: space-between;
margin-right: 1px;
.machine-li {
width: 100%;
margin-bottom: 0.18rem;
border: 1px solid rgba(9, 83, 133, 0.5);
box-shadow: inset 0 0 30px rgba(9, 83, 133, 0.4);
position: relative;
border-radius: 0.07rem;
.tit {
padding: 0.1rem 0.1rem 0.1rem 0.25rem;
border-bottom: 1px solid rgba(9, 83, 133, 0.5);
font-size:0.18rem;
font-weight: 500;
position: relative;
// background: rgba(64, 72, 71, 0.5);
border-radius: 0.07rem 0.07rem 0 0;
box-shadow: 0 0 5px rgba(9, 83, 133, 0.5);
display: flex;
flex-direction: row;
align-items: center;
}
.tit::before {
position: absolute;
content: "";
width: 6px;
height: 6px;
background: rgba(20, 231, 231, 0.9);
box-shadow: 0 0 5px rgba(0, 93, 130, 0.9);
border-radius: 50%;
left: 0.1rem;
top: 0.18rem;
}
.machine-center-li {
width: 100%;
.machine-context {
display: flex;
flex-direction: row;
justify-content: space-between;
width: 100%;
.chart {
width: 100%;
height: 280px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
}
}
}
}
}
</style>

97
src/views/centerairC/enSourceAnalysis/index.vue

@ -0,0 +1,97 @@
<template>
<div class="paramsDetails">
<div class="details-content">
<div class="details-header">
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="机房能耗" name="first">
<machineRoom
v-if="activeName === 'first'"
@switch-tab="switchToEquitesMess"
@switch-fourth="switchToPatrolTem"
></machineRoom>
</el-tab-pane>
<el-tab-pane label="设备能耗" name="second">
<equipment v-if="activeName === 'second'"></equipment>
</el-tab-pane>
<el-tab-pane label="设备组能耗" name="three">
<device-energy v-if="activeName === 'three'"></device-energy>
</el-tab-pane>
</el-tabs>
</div>
</div>
</div>
</template>
<script>
import machineRoom from "./components/machineRoom.vue";
import equipment from "./components/equipment.vue";
import DeviceEnergy from "./components/deviceEnergy.vue";
export default {
components: { machineRoom, equipment, DeviceEnergy },
data() {
return {
activeName: "first", //
};
},
methods: {
handleClick(tab, event) {
console.log(tab, event);
},
//switch-tab
// activeName'second'tabtab
switchToEquitesMess() {
this.activeName = "second";
},
switchToPatrolTem() {
// this.activeName = 'fourth';
},
//
},
};
</script>
<style lang="scss" scoped>
.paramsDetails {
display: flex;
flex-direction: row;
align-items: stretch;
justify-content: space-between;
.details-content {
width: 100%;
// height: 0.42rem;
position: relative;
}
}
</style>
<style scoped>
.none-div {
padding-top: 0.31rem;
}
.none-div >>> .el-tree {
background: transparent;
color: #789d9f;
}
.none-div >>> .el-tree-node:focus > .el-tree-node__content {
background-color: #00be97;
color: #fff;
}
.none-div >>> .el-tree-node__content:hover,
.none-div >>> .el-upload-list__item:hover {
background-color: #00be97;
color: #fff;
}
.none-div >>> .el-tree-node__content {
height: 0.48rem;
justify-content: center;
}
.none-div >>> .el-tree-node__expand-icon.is-leaf {
display: none !important;
}
</style>

835
src/views/centerairC/energyAnalysis/components/energyAnalysis.vue

@ -0,0 +1,835 @@
<template>
<div class="main-body">
<div class="irregular-border">
<div class="main-content">
<div class="condition">
<div class="condition-left">
<div class="time-label">时间类型:</div>
<el-radio-group
v-model="dateType"
style="margin-right: 0.24rem"
@change="updateDateType"
>
<el-radio label="hour">小时</el-radio>
<el-radio label="day"></el-radio>
<el-radio label="month"></el-radio>
<el-radio label="year"></el-radio>
</el-radio-group>
<el-date-picker
v-model="timeDate"
:default-time="['00:00:00', '23:59:59']"
type="datetimerange"
range-separator="至"
v-if="dateType == 'hour'"
placeholder="选择日期"
start-placeholder="开始日期"
end-placeholder="结束日期"
>
</el-date-picker>
<el-date-picker
v-model="dayDate"
type="daterange"
v-if="dateType == 'day'"
:key="this.dateType"
range-separator="至"
value-format="yyyy-MM-dd"
start-placeholder="开始日期"
end-placeholder="结束日期"
@change="dateChange"
>
</el-date-picker>
<el-date-picker
v-model="monthDate"
type="monthrange"
v-if="dateType == 'month'"
:key="this.dateType"
range-separator="至"
start-placeholder="开始月份"
end-placeholder="结束月份"
value-format="yyyy-MM"
@change="dateChange"
>
</el-date-picker>
<div
class="years-div"
v-if="dateType == 'year'"
:key="this.dateType"
>
<el-date-picker
v-model="startYear"
type="year"
placeholder="选择开始年份"
style="width: 180px"
value-format="yyyy"
>
</el-date-picker>
<div class="years-word"></div>
<el-date-picker
v-model="endYear"
type="year"
placeholder="选择结束年份"
style="width: 180px"
value-format="yyyy"
>
</el-date-picker>
</div>
<el-select
style="margin-left: 10px"
v-model="systemType"
placeholder="请选择系统类型"
clearable
>
<el-option
v-for="dict in systemTypes"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
/>
</el-select>
<div class="success-btn" style="margin-left: 0.24rem">
<el-button type="success" @click="findData">查询</el-button>
</div>
</div>
<!-- <div class="condition-right">
<el-button type="warning">导出</el-button>
</div> -->
</div>
<div class="charts-table">
<div class="charts-title">
{{ this.titleDate }} {{ this.checkList }}
</div>
<!-- 选择 -->
<div class="charts-check">
<el-radio-group
v-model="checkList"
style="margin-right: 0.24rem"
@change="handleCheckChange"
>
<el-radio label="瞬时冷量"></el-radio>
<el-radio label="瞬时功率"></el-radio>
<el-radio label="瞬时系统EER"></el-radio>
</el-radio-group>
</div>
<div class="connect-div" v-loading="listLoading">
<div class="charts_refs" ref="charts_refs"></div>
<div class="analysis-table" style="margin-bottom: 0.2rem">
<table>
<thead>
<tr>
<th v-if="dateList">时间</th>
<th v-for="(item, index) in dateList" :key="index">
{{ item }}
</th>
</tr>
</thead>
<tbody>
<tr>
<td v-if="coldData">制冷量(kwr)</td>
<td v-for="(item, index) in coldData" :key="index">
{{ item }}
</td>
</tr>
<tr>
<td v-if="electData">用电量(kwh)</td>
<td v-for="(item, index) in electData" :key="index">
{{ item }}
</td>
</tr>
<tr>
<td v-if="copData">瞬时系统EER</td>
<td v-for="(item, index) in copData" :key="index">
{{ item }}
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import { format2 } from "@/utils/datetime";
import * as echarts from "echarts";
import { sysEnergy } from "@/api/centerairC/energyManage";
import { listData } from "@/api/system/dict/data";
export default {
data() {
return {
listLoading: false,
dateType: "hour", //
timeDate: [], //
dayDate: [], //
monthDate: [], //
startYear: "", //
endYear: "", //
startTime: "", //
endTime: "", //
//
dateList: [],
coldData: [],
electData: [],
copData: [],
checkList: "瞬时冷量", //
chartInstance2: null,
option2: {},
//
titleDate: "",
showZoom: true,
systemType: "", //
systemTypes: [],
};
},
mounted() {
this.initializeTimeDate();
this.initChart2();
this.screenAdapter();
this.screenAdapter2();
window.addEventListener("resize", this.screenAdapter2);
window.addEventListener("resize", this.screenAdapter);
this.getDictList();
},
destroyed() {
//mounted
window.removeEventListener("resize", this.screenAdapter2);
window.removeEventListener("resize", this.screenAdapter);
},
methods: {
/** 查询系统类型-字典数据列表 */
getDictList() {
let data = {
pageNum: 1,
pageSize: 100,
dictType: "sys_type",
};
listData(data).then((response) => {
this.systemTypes = response.rows;
this.systemType = this.systemTypes[0].dictValue;
this.getTableData();
});
},
//
initializeTimeDate() {
const start = new Date(new Date().setHours(0, 0, 0, 0));
const end = new Date(new Date().setHours(23, 59, 59, 59));
this.timeDate = [format2(start), format2(end)]; //
this.titleDate = format2(start) + "至" + format2(end);
},
//
updateDateType() {
// this.dateType = this.radio;
console.log(this.dateType);
(this.timeDate = []), //
(this.dayDate = []), //
(this.monthDate = []), //
(this.startYear = ""), //
(this.endYear = ""); //
},
//
handleCheckChange() {
console.log("选中的值:", this.checkList);
this.screenAdapter2();
},
//
dateChange() {
// console.log("", this.timeform.time1);
if (!this.dayDate) {
this.$nextTick(() => {
this.dayDate = [];
});
}
if (!this.monthDate) {
this.$nextTick(() => {
this.monthDate = [];
});
}
},
//
findData() {
console.log("this.dateType", this.dateType);
console.log("this.timeDate", this.timeDate);
switch (this.dateType) {
case "hour":
if (!this.timeDate) {
this.showMessage("请选择时间!", "warning");
} else {
this.titleDate =
format2(this.timeDate[0]) + "至" + format2(this.timeDate[1]);
this.getTableData();
}
break;
case "day":
if (this.dayDate.length === 0) {
this.showMessage("请选择时间!", "warning");
} else {
const newLength =
new Date(this.dayDate[1]).getTime() -
new Date(this.dayDate[0]).getTime();
const dayDiff = Math.floor(newLength / (1000 * 60 * 60 * 24));
if (dayDiff > 31) {
this.showMessage(
"最多只能选择30天区间,请重新选择再查询!",
"warning"
);
} else {
this.titleDate = this.dayDate[0] + "至" + this.dayDate[1];
this.getTableData();
}
}
break;
case "month":
if (this.monthDate.length === 0) {
this.showMessage("请选择时间!", "warning");
} else {
const [start, end] = this.monthDate;
const startDate = new Date(start);
const endDate = new Date(end);
const startYear = startDate.getFullYear();
const startMonth = startDate.getMonth();
const endYear = endDate.getFullYear();
const endMonth = endDate.getMonth();
const monthDiff =
(endYear - startYear) * 12 + (endMonth - startMonth);
if (monthDiff > 12) {
this.showMessage(
"最多只能选择12个月区间,请重新选择再查询!",
"warning"
);
} else {
this.titleDate = this.monthDate[0] + "至" + this.monthDate[1];
this.getTableData();
}
}
break;
case "year":
if (!this.startYear || !this.endYear) {
this.showMessage("请选择全年份区间!", "warning");
} else if (this.startYear > this.endYear) {
this.showMessage("结束年份要大于开始年份!", "warning");
} else {
this.titleDate = this.startYear + "至" + this.endYear;
this.getTableData();
}
break;
default:
break;
}
},
//
showMessage(message, type) {
this.$message({
message: message,
type: type,
});
},
//
getTableData() {
if (this.dateType == "hour") {
this.startTime = format2(this.timeDate[0]);
this.endTime = format2(this.timeDate[1]);
} else if (this.dateType == "day") {
this.startTime = this.dayDate.length > 0 ? this.dayDate[0] : "";
this.endTime = this.dayDate.length > 0 ? this.dayDate[1] : "";
} else if (this.dateType == "month") {
this.startTime = this.monthDate.length > 0 ? this.monthDate[0] : "";
this.endTime = this.monthDate.length > 0 ? this.monthDate[1] : "";
} else if (this.dateType == "year") {
(this.startTime = this.startYear), (this.endTime = this.endYear);
}
let data = {
timeType: this.dateType,
startTime: this.startTime,
endTime: this.endTime,
systemType: this.systemType,
};
console.log("查询数据参数", data);
// this.showZoom = true
// this.copData2 = ["3", "4"]
// this.dateList2 = ["2022", "2023"]
// this.option2.dataZoom[0].show = this.showZoom;
// this.option2.series[0].data = this.coldData2;
// this.option2.series[1].data = this.electData2;
// this.option2.series[2].data = this.copData2;
// this.option2.xAxis.data = this.dateList2;
// this.chartInstance2.setOption(this.option2);
// this.screenAdapter2();
this.listLoading = true;
sysEnergy(data).then((res) => {
console.log("查询返回", res.data.times);
if (res.code == 200 && res.data.data !== null) {
//
this.dateList2 = res.data.lineTimes;
this.copData2 = res.data.data[5].lineCop;
this.nowColdData2 = res.data.data[6].lineInstantaneousCold;
this.nowElectData2 = res.data.data[7].lineInstantaneousMeter;
// if (this.dateType == 'hour' && this.dateType == 'day') {
// this.showZoom = true
// } else {
// this.showZoom = false
// }
// this.option2.dataZoom[0].show = this.showZoom
this.option2.series[0].data = this.nowColdData2;
this.option2.series[1].data = this.nowElectData2;
this.option2.series[2].data = this.copData2;
// this.option2.series[3].data = this.nowColdData2;
// this.option2.series[4].data = this.nowElectData2;
this.option2.xAxis.data = this.dateList2;
this.chartInstance2.setOption(this.option2);
this.screenAdapter2();
} else {
this.dateList2 = [];
this.copData2 = [];
this.nowColdData2 = [];
this.nowElectData2 = [];
this.option2.series[0].data = [];
this.option2.series[1].data = [];
this.option2.series[2].data = [];
// this.option2.series[3].data = [];
// this.option2.series[4].data = [];
this.option2.xAxis.data = [];
this.chartInstance2.setOption(this.option2);
this.screenAdapter2();
}
if (res.code == 200 && res.data.data !== null) {
console.log("cop的值", res.data.data[0].cold);
//
this.dateList = res.data.times;
this.coldData = res.data.data[0].cold;
this.electData = res.data.data[1].meter;
this.copData = res.data.data[2].cop;
} else {
this.dateList = [];
this.coldData = [];
this.electData = [];
this.copData = [];
}
console.log(" this.dateList", this.dateList);
});
// Just to simulate the time of the request
setTimeout(() => {
this.listLoading = false;
}, 1.0 * 1000);
},
//chartInstance2 线
initChart2() {
this.chartInstance2 = echarts.init(this.$refs.charts_refs);
this.option2 = {
tooltip: {
trigger: "axis",
// 使 formatter tooltip
formatter: function (params) {
let seriesHTML = "";
params.forEach(function (item) {
seriesHTML +=
"<div>" +
item.seriesName +
': <span style="color: #000000; font-weight: bold;">' +
item.value +
"</span></div>";
});
return "<div>" + params[0].name + "</div>" + seriesHTML;
},
// tooltip
formatter: function (params) {
var res = params[0].name + "<br/>";
for (var i = 0, l = params.length; i < l; i++) {
var seriesName = params[i].seriesName;
var value = params[i].value;
var marker =
'<span style="display:inline-block;margin-right:5px;border-radius:10px;width:9px;height:9px;background-color:' +
params[i].color +
'"></span>';
// seriesName
if (seriesName === "瞬时冷量") {
res +=
marker +
seriesName +
":" +
'<span style="color: #000000; font-weight: bold;margin-left:5px">' +
value +
" " +
"kwr" +
"</span><br>";
} else if (seriesName === "瞬时功率") {
res +=
marker +
seriesName +
":" +
'<span style="color: #000000; font-weight: bold;margin-left:5px">' +
value +
" " +
"kw" +
"</span><br>";
} else {
res +=
marker +
seriesName +
":" +
'<span style="color: #000000; font-weight: bold;margin-left:5px">' +
value +
" " +
"</span><br>";
}
}
return res;
},
},
legend: {
data: ["瞬时系统EER", "瞬时冷量", "瞬时功率"],
selectedMode: false, //
show: false, //
},
grid: {
top: "5%",
left: "3%",
right: "4.4%",
bottom: "20%",
containLabel: true,
},
xAxis: {
type: "category",
//true
boundaryGap: true,
// x
axisLabel: {
// interval: 0, //x
// rotate: 30, //x30
color: "rgba(255, 255, 255, 1)",
},
axisTick: {
show: false, // 线
},
// x
axisLine: {
show: true,
lineStyle: {
color: "#365576",
},
},
splitLine: {
lineStyle: {
color: "#e2e6f0",
},
},
},
yAxis: {
min: 0,
miniInterval: 5,
type: "value",
// y
axisLabel: {
color: "rgba(255, 255, 255, 1)",
},
// y
axisLine: {
show: true,
lineStyle: {
color: "#365576", // y 线
},
},
splitLine: {
lineStyle: {
color: "#1a3d62", // 线
type: "dashed", // 线线
},
},
},
// X
dataZoom: [
{
type: "slider", //inside
show: this.showZoom,
height: 15, // 20
// fillerColor: 'rgba(255, 0, 0, 0.5)', //
// backgroundColor: 'rgba(0, 0, 0, 0.1)', // 0.1
start: 0,
end: 100,
xAxisIndex: [0],
handleSize: "120%", // 120%
},
],
series: [
{
name: "瞬时系统EER",
type: "line",
smooth: true,
symbol: "circle",
//
symbolSize: 8,
//
// itemStyle: {
// color: "#0184d5",
// borderColor: "rgba(221, 220, 107, .1)",
// borderWidth: 12
// },
//
showSymbol: false,
//线
itemStyle: {
color: "#e45050", //线
lineStyle: {
color: "#e45050", //线
},
},
areaStyle: {
color: {
//线
type: "linear",
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{
offset: 0,
color: "rgba(228, 80, 80, 1)", // 0%
},
{
offset: 0.8,
color: "rgba(228, 80, 80,0.2)", // 100%
},
],
// global: false, // false
},
},
},
{
name: "瞬时冷量",
type: "line",
smooth: true,
symbol: "circle",
//
symbolSize: 8,
//
// itemStyle: {
// color: "#0184d5",
// borderColor: "rgba(221, 220, 107, .1)",
// borderWidth: 12
// },
//
showSymbol: false,
//线
itemStyle: {
color: "#0b75d3", //线
lineStyle: {
color: "#0b75d3", //线
},
},
areaStyle: {
color: {
//线
type: "linear",
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{
offset: 0,
color: "rgba(11, 117, 211, 1)", // 0%
},
{
offset: 0.8,
color: "rgba(11, 117, 211,0.2)", // 100%
},
],
// global: false, // false
},
},
},
{
name: "瞬时功率",
type: "line",
smooth: true,
symbol: "circle",
//
symbolSize: 8,
//
// itemStyle: {
// color: "#0184d5",
// borderColor: "rgba(221, 220, 107, .1)",
// borderWidth: 12
// },
//
showSymbol: false,
//线
itemStyle: {
color: "#01c29b", //线
lineStyle: {
color: "#01c29b", //线
},
},
areaStyle: {
color: {
//线
type: "linear",
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{
offset: 0,
color: "rgba(1, 194, 155, 1)", // 0%
},
{
offset: 0.8,
color: "rgba(1, 194, 155,0.2)", // 100%
},
],
// global: false, // false
},
},
},
],
};
//
this.chartInstance2.setOption(this.option2, true);
},
//
screenAdapter2() {
// console.log("checkList:", this.checkList);
const selected = {
瞬时系统EER: false,
瞬时冷量: false,
瞬时功率: false,
};
const updatedSelected = {
...selected,
[this.checkList]: true,
};
// console.log(updatedSelected);
//,2.6 mes_ref
const titleFontSize = this.$refs.charts_refs.offsetWidth / 130;
//optionoption
const adapterOption = {
legend: {
selected: updatedSelected,
},
xAxis: {
// data: ["2021", "2022", "2023"],
data: this.dateList2,
},
series: [
{
name: "瞬时系统EER",
// data: ["1", "2", "6"],
data: this.copData2,
},
{
name: "瞬时冷量",
// data: ["1", "2", "6"],
data: this.nowColdData2,
},
{
name: "瞬时功率",
// data: ["1", "2", "6"],
data: this.nowElectData2,
},
],
};
//.chartInstanceoptiondataoption
this.chartInstance2.setOption(adapterOption);
//resize
this.chartInstance2.resize();
},
//
screenAdapter() {
//,2.6 mes_ref
const titleFontSize = this.$refs.charts_refs.offsetWidth / 130;
//optionoption
const adapterOption = {
// x
xAxis: {
axisLabel: {
fontSize: titleFontSize * 1.5,
},
},
yAxis: {
axisLabel: {
fontSize: titleFontSize * 1.5,
},
},
};
//.chartInstanceoptiondataoption
this.chartInstance2.setOption(adapterOption);
//resize
this.chartInstance2.resize();
},
},
};
</script>
<style lang="scss" scoped>
.condition-left {
display: flex;
flex-direction: row;
align-items: center;
flex-wrap: wrap;
.years-div {
display: flex;
flex-direction: row;
align-items: center;
.years-word {
font-size: 14px;
margin: 0 5px;
color: #388ff3;
}
}
.time-label {
font-size: 16px;
line-height: 7px;
margin-right: 12px;
white-space: nowrap;
}
}
.charts-title {
font-size: 0.24rem;
line-height: 0.07rem;
letter-spacing: 0.02rem;
color: #1f70e9;
margin: 0.3rem 0;
width: 100%;
text-align: center;
}
.charts-check {
width: 100%;
text-align: center;
}
.main-content {
min-height: 6.6rem;
}
.analysis-table table thead th {
min-width: 1.6rem;
}
.connect-div {
display: flex;
flex-direction: column;
align-items: center;
width: 16rem;
}
.charts_refs {
width: 16rem;
height: 4.55rem;
margin-left: -0.35rem;
}
/*
媒体查询
*/
@media (max-width: 1210px) {
}
</style>

904
src/views/centerairC/energyAnalysis/components/qnqAnalysis.vue

@ -0,0 +1,904 @@
<template>
<div class="main-body">
<div class="irregular-border">
<div class="main-content">
<div class="condition">
<div class="condition-left">
<div class="time-label">时间类型:</div>
<el-radio-group
v-model="dateType"
style="margin-right: 0.24rem"
@change="updateDateType"
>
<el-radio label="hour">小时</el-radio>
<el-radio label="day"></el-radio>
<el-radio label="month"></el-radio>
<el-radio label="year"></el-radio>
</el-radio-group>
<div class="condition-btn">
<div
class="legend-li"
v-for="(item, index) in timeData2"
:key="index + 1"
@click="handleEnter(item.title, index)"
:class="{ timeStyle2: timeIndex2 == index }"
>
{{ item.title }}
</div>
</div>
<el-date-picker
v-model="timeDate"
:default-time="['00:00:00', '23:59:59']"
type="datetimerange"
range-separator="至"
v-if="dateType == 'hour'"
placeholder="选择日期"
start-placeholder="开始日期"
end-placeholder="结束日期"
>
</el-date-picker>
<el-date-picker
v-model="dayDate"
type="daterange"
v-if="dateType == 'day'"
:key="this.dateType"
range-separator="至"
value-format="yyyy-MM-dd"
start-placeholder="开始日期"
end-placeholder="结束日期"
@change="dateChange"
>
</el-date-picker>
<el-date-picker
v-model="monthDate"
type="monthrange"
v-if="dateType == 'month'"
:key="this.dateType"
range-separator="至"
start-placeholder="开始月份"
end-placeholder="结束月份"
value-format="yyyy-MM"
@change="dateChange"
>
</el-date-picker>
<div
class="years-div"
v-if="dateType == 'year'"
:key="this.dateType"
>
<el-date-picker
v-model="startYear"
type="year"
placeholder="选择开始年份"
style="width: 180px"
value-format="yyyy"
>
</el-date-picker>
<div class="years-word"></div>
<el-date-picker
v-model="endYear"
type="year"
placeholder="选择结束年份"
style="width: 180px"
value-format="yyyy"
>
</el-date-picker>
</div>
<el-select
style="margin-left: 10px"
v-model="systemType"
placeholder="请选择系统类型"
clearable
>
<el-option
v-for="dict in systemTypes"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
/>
</el-select>
<div class="success-btn" style="margin-left: 0.24rem">
<el-button type="success" @click="findData">查询</el-button>
</div>
</div>
<!-- <div class="condition-right">
<el-button type="warning">导出</el-button>
</div> -->
</div>
<div class="charts-table" v-loading="listLoading">
<div class="charts-title">
{{ this.titleDate }} {{ this.checkList }}
</div>
<div class="details_ref" ref="details_ref"></div>
<div class="analysis-table" style="margin-bottom: 0.2rem">
<table>
<thead>
<tr>
<th v-if="dateList.length > 0">类型</th>
<th v-for="(item, index) in dateList" :key="index + 2">
{{ item }}
</th>
</tr>
</thead>
<tbody>
<tr>
<td v-if="curValue2.length > 0">本期{{ this.unitValue }}</td>
<td v-for="(item, index) in curValue2" :key="index + 3">
{{ item }}
</td>
</tr>
<tr>
<td v-if="lastValue2.length > 0">上期{{ this.unitValue }}</td>
<td v-for="(item, index) in lastValue2" :key="index + 4">
{{ item }}
</td>
</tr>
<tr>
<td v-if="mom2.length > 0">环比(%)</td>
<td v-for="(item, index) in mom2" :key="index + 5">
{{ item }}
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import { format2 } from "@/utils/datetime";
import * as echarts from "echarts";
import { momEnergy } from "@/api/centerairC/energyManage";
import { listData } from "@/api/system/dict/data";
export default {
data() {
return {
listLoading: false,
dateType: "hour", //
timeDate: [], //
dayDate: [], //
monthDate: [], //
startYear: "", //
endYear: "", //
startTime: "", //
endTime: "", //
timeData2: [{ title: "制冷量" }, { title: "用电量" }, { title: "EER" }],
timeIndex2: 0, //
paramType: "cloud", //
//
titleDate: "",
checkList: "制冷量", //
//
dateList: [],
curValue: [],
lastValue: [],
mom: [],
//
curValue2: [],
lastValue2: [],
mom2: [],
unitValue: "", //
systemType: "", //
systemTypes: [],
};
},
mounted() {
this.initializeTimeDate();
this.initChart1();
window.addEventListener("resize", this.screenAdapter);
this.screenAdapter();
this.getDictList();
},
destroyed() {
//mounted
window.removeEventListener("resize", this.screenAdapter);
},
methods: {
/** 查询系统类型-字典数据列表 */
getDictList() {
let data = {
pageNum: 1,
pageSize: 100,
dictType: "sys_type",
};
listData(data).then((response) => {
this.systemTypes = response.rows;
this.systemType = this.systemTypes[0].dictValue;
this.getTableData();
});
},
//
initializeTimeDate() {
const start = new Date(new Date().setHours(0, 0, 0, 0));
const end = new Date(new Date().setHours(23, 59, 59, 59));
this.timeDate = [format2(start), format2(end)]; //
this.titleDate = format2(start) + "至" + format2(end);
},
//
updateDateType() {
// this.dateType = this.radio;
console.log(this.dateType);
(this.timeDate = []), //
(this.dayDate = []), //
(this.monthDate = []), //
(this.startYear = ""), //
(this.endYear = ""); //
},
//
handleEnter(title, index) {
console.log("打印", title, index);
this.timeIndex2 = index;
if (index == "0") {
this.paramType = "cloud";
} else if (index == "1") {
this.paramType = "meter";
} else if (index == "2") {
this.paramType = "cop";
}
},
//
dateChange() {
// console.log("", this.timeform.time1);
if (!this.dayDate) {
this.$nextTick(() => {
this.dayDate = [];
});
}
if (!this.monthDate) {
this.$nextTick(() => {
this.monthDate = [];
});
}
},
//
findData() {
console.log("this.dateType", this.dateType);
console.log("this.timeDate", this.timeDate);
switch (this.dateType) {
case "hour":
if (!this.timeDate) {
this.showMessage("请选择时间!", "warning");
} else {
this.titleDate =
format2(this.timeDate[0]) + "至" + format2(this.timeDate[1]);
this.checkList = this.timeData2[this.timeIndex2].title;
this.getTableData();
}
break;
case "day":
if (this.dayDate.length === 0) {
this.showMessage("请选择时间!", "warning");
} else {
this.titleDate = this.dayDate[0] + "至" + this.dayDate[1];
this.checkList = this.timeData2[this.timeIndex2].title;
this.getTableData();
// const newLength = new Date(this.dayDate[1]).getTime() - new Date(this.dayDate[0]).getTime();
// const dayDiff = Math.floor(newLength / (1000 * 60 * 60 * 24));
// if (dayDiff > 31) {
// this.showMessage('30', 'warning');
// } else {
// this.titleDate = this.dayDate[0] + "" + this.dayDate[1];
// this.getTableData();
// }
}
break;
case "month":
if (this.monthDate.length === 0) {
this.showMessage("请选择时间!", "warning");
} else {
this.titleDate = this.monthDate[0] + "至" + this.monthDate[1];
this.checkList = this.timeData2[this.timeIndex2].title;
this.getTableData();
// const [start, end] = this.monthDate;
// const startDate = new Date(start);
// const endDate = new Date(end);
// const startYear = startDate.getFullYear();
// const startMonth = startDate.getMonth();
// const endYear = endDate.getFullYear();
// const endMonth = endDate.getMonth();
// const monthDiff = (endYear - startYear) * 12 + (endMonth - startMonth);
// if (monthDiff > 12) {
// this.showMessage('12', 'warning');
// } else {
// this.titleDate = this.monthDate[0] + "" + this.monthDate[1];
// this.getTableData();
// }
}
break;
case "year":
if (!this.startYear || !this.endYear) {
this.showMessage("请选择全年份区间!", "warning");
} else if (this.startYear > this.endYear) {
this.showMessage("结束年份要大于开始年份!", "warning");
} else {
this.titleDate = this.startYear + "至" + this.endYear;
this.checkList = this.timeData2[this.timeIndex2].title;
this.getTableData();
}
break;
default:
break;
}
},
//
showMessage(message, type) {
this.$message({
message: message,
type: type,
});
},
//
getTableData() {
if (this.dateType == "hour") {
this.startTime = format2(this.timeDate[0]);
this.endTime = format2(this.timeDate[1]);
} else if (this.dateType == "day") {
this.startTime = this.dayDate.length > 0 ? this.dayDate[0] : "";
this.endTime = this.dayDate.length > 0 ? this.dayDate[1] : "";
} else if (this.dateType == "month") {
this.startTime = this.monthDate.length > 0 ? this.monthDate[0] : "";
this.endTime = this.monthDate.length > 0 ? this.monthDate[1] : "";
} else if (this.dateType == "year") {
(this.startTime = this.startYear), (this.endTime = this.endYear);
}
let data = {
timeType: this.dateType,
startTime: this.startTime,
endTime: this.endTime,
paramType: this.paramType,
systemType: this.systemType,
};
console.log("查询数据参数", data);
this.listLoading = true;
momEnergy(data).then((res) => {
console.log("查询返回", res);
if (res.code == 200 && res.data.data !== null) {
this.dateList = res.data.times;
//
this.curValue2 = [];
this.lastValue2 = [];
this.mom2 = [];
this.curValue2 = res.data.data[0].curValue;
this.lastValue2 = res.data.data[1].lastValue;
this.mom2 = res.data.data[2].mom;
console.log("后端返回的时间", this.dateList);
console.log("后端返回的本期值", this.curValue2);
console.log("后端返回的上期值", this.lastValue2);
console.log("后端返回的环比值", this.mom2);
// 线
this.curValue = this.curValue2.map(function (value) {
if (value === null) {
return 0;
} else if (typeof value === "string") {
return parseFloat(value);
}
return value;
});
this.lastValue = this.lastValue2.map(function (value) {
if (value === null) {
return 0;
} else if (typeof value === "string") {
return parseFloat(value);
}
return value;
});
this.mom = this.mom2.map(function (value) {
if (value === "上期无数据") {
return 0;
} else if (typeof value === "string") {
if (value.endsWith("%")) {
return parseFloat(value);
} else {
return parseFloat(value);
}
}
return value;
});
console.log("处理过的本期值", this.curValue);
console.log("处理过的上期值", this.lastValue);
console.log("处理过的环比值", this.mom);
// y
// var Min1 = Math.floor(Math.min(...this.curValue, ...this.lastValue)),
// y0
var Min1 = 0,
Min2 = Math.floor(Math.min(...this.mom)),
Max1 = Math.ceil(Math.max(...this.curValue, ...this.lastValue)),
Max2 = Math.ceil(Math.max(...this.mom));
console.log("Min1", Min1);
console.log("Min2", Min2);
console.log("Max1", Max1);
console.log("Max2", Max2);
// tooltip-
if (this.timeIndex2 == 0) {
this.unitValue = "(kwr)";
} else if (this.timeIndex2 == 1) {
this.unitValue = "(kwh)";
} else {
this.unitValue = " ";
}
const adapterOption = {
xAxis: {
data: this.dateList,
},
yAxis: [
//y
{
min: Min1,
max: Max1,
splitNumber: 10,
interval: (Max1 - Min1) / 10,
},
{
min: Min2,
max: Max2,
splitNumber: 10,
interval: (Max2 - Min2) / 10,
},
],
series: [
{
name: "本期",
data: this.curValue,
},
{
name: "环比",
data: this.mom,
},
],
};
//.chartInstanceoptiondataoption
this.chartInstance1.setOption(adapterOption);
//resize
this.chartInstance1.resize();
} else {
// console.log("", this.dateList)
// console.log("", this.curValue2)
// console.log("", this.lastValue2)
// console.log("", this.mom2)
this.dateList = [];
(this.curValue2 = []), (this.lastValue2 = []), (this.mom2 = []);
var Min1 = 0,
Min2 = 0,
Max1 = 0,
Max2 = 0;
const adapterOption = {
xAxis: {
data: [],
},
yAxis: [
//y
{
min: Min1,
max: Max1,
splitNumber: 10,
interval: (Max1 - Min1) / 10,
},
{
min: Min2,
max: Max2,
splitNumber: 10,
interval: (Max2 - Min2) / 10,
},
],
series: [
{
name: "本期",
data: [],
},
{
name: "环比",
data: [],
},
],
};
//.chartInstanceoptiondataoption
this.chartInstance1.setOption(adapterOption);
//resize
this.chartInstance1.resize();
}
});
// Just to simulate the time of the request
setTimeout(() => {
this.listLoading = false;
}, 1.0 * 1000);
},
initChart1() {
// // y
// var Min1 = 1;
// var Min2 = 3;
// var Max1 = 10;
// var Max2 = 12;
// console.log("Min1", Min1);
// console.log("Min2", Min2);
// console.log("Max1", Max1);
// console.log("Max2", Max2);
this.chartInstance1 = echarts.init(this.$refs.details_ref);
this.option1 = {
tooltip: {
trigger: "axis",
// 使 formatter tooltip
formatter: function (params) {
let seriesHTML = "";
params.forEach(function (item) {
seriesHTML +=
"<div>" +
item.seriesName +
': <span style="color: #000000; font-weight: bold;">' +
item.value +
"</span></div>";
});
return "<div>" + params[0].name + "</div>" + seriesHTML;
},
// tooltip
formatter: function (params) {
var res = params[0].name + "<br/>";
for (var i = 0, l = params.length; i < l; i++) {
var seriesName = params[i].seriesName;
var value = params[i].value;
// console.log("", params[i].color.colorStops[0].color)
var marker =
'<span style="display:inline-block;margin-right:5px;border-radius:10px;width:9px;height:9px;background-color:' +
params[i].color.colorStops[0].color +
'"></span>';
// seriesName
if (seriesName === "本期") {
res +=
marker +
seriesName +
":" +
'<span style="color: #000000; font-weight: bold;margin-left:5px">' +
value +
" " +
"kwr" +
"</span><br>";
} else if (seriesName === "上期") {
res +=
marker +
seriesName +
":" +
'<span style="color: #000000; font-weight: bold;margin-left:5px">' +
value +
" " +
"kwh" +
"</span><br>";
} else {
res +=
marker +
seriesName +
":" +
'<span style="color: #000000; font-weight: bold;margin-left:5px">' +
value +
" " +
"%" +
"</span><br>";
}
}
return res;
},
},
legend: {
data: ["本期", "环比"],
textStyle: {
color: "#ffff",
fontSize: 16, //
},
left: "41%",
top: "0%",
bottom: "10%",
//
itemGap: 50,
itemWidth: 16,
itemHeight: 8,
},
grid: {
top: "20%",
left: "3%",
right: "4%",
bottom: "0%",
containLabel: true,
},
xAxis: {
type: "category",
//true
boundaryGap: true,
// x
axisLabel: {
// interval: 0, //x
// rotate: 30, //x30
color: "rgba(255, 255, 255, 1)",
},
axisTick: {
show: false, // 线
},
// x
axisLine: {
show: true,
lineStyle: {
color: "#365576",
},
},
splitLine: {
lineStyle: {
color: "#e2e6f0",
},
},
},
yAxis: [
{
type: "value",
name: "本期", // y
nameTextStyle: {
fontSize: 15, //
color: "#fff", //
// ...
},
// y
axisLabel: {
color: "rgba(255, 255, 255, 1)",
},
// y
axisLine: {
show: true,
lineStyle: {
color: "#365576", // y 线
},
},
splitLine: {
lineStyle: {
color: "#1a3d62", // 线
type: "dashed", // 线线
},
},
},
{
type: "value",
name: "环比", // y
nameTextStyle: {
fontSize: 15, //
color: "#fff", //
// ...
},
// y
axisLabel: {
color: "rgba(255, 255, 255, 1)",
formatter: "{value} %",
},
// y
axisLine: {
show: true,
lineStyle: {
color: "#365576", // y 线
},
},
splitLine: {
lineStyle: {
color: "#1a3d62", // 线
type: "dashed", // 线线
},
},
// min: Min2,
// max: Max2,
// splitNumber: 10,
// interval: (Max2 - Min2) / 10,
},
],
series: [
{
name: "本期",
type: "bar",
smooth: true,
symbol: "circle",
//
symbolSize: 8,
//
showSymbol: false,
//线
itemStyle: {
color: "#0b75d3",
// 使
color: {
type: "linear",
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{
offset: 0,
color: "rgba(1, 102, 251, 1)", //
},
{
offset: 1,
color: "rgba(1, 102, 251, 0)", //
},
],
global: false, // false
},
borderRadius: [5, 5, 0, 0], //
},
},
{
name: "上期",
type: "bar",
smooth: true,
symbol: "circle",
//
symbolSize: 8,
//
showSymbol: false,
//线
itemStyle: {
color: "#0b75d3",
// 使
color: {
type: "linear",
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{
offset: 0,
color: "rgba(0, 224, 225, 1)", //
},
{
offset: 1,
color: "rgba(0, 224, 225, 0)", //
},
],
global: false, // false
},
borderRadius: [5, 5, 0, 0],
},
},
{
name: "环比",
type: "line",
smooth: false,
symbol: "circle",
//
symbolSize: 8,
yAxisIndex: 1,
//
showSymbol: false,
//线
itemStyle: {
color: "#EE5217", //线
color: {
type: "linear",
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{
offset: 0,
color: "#EE5217", //
},
{
offset: 1,
color: "#EE5217", //
},
],
global: false, // false
},
lineStyle: {
color: "#EE5217", //线
},
},
},
],
};
//
this.chartInstance1.setOption(this.option1, true);
},
// 线
screenAdapter() {
//,2.6 mes_ref
const titleFontSize = (this.$refs.details_ref.offsetWidth / 100) * 1.8;
//optionoption
const adapterOption = {
//fontSize
textStyle: {
fontSize: titleFontSize,
},
};
//.chartInstanceoptiondataoption
this.chartInstance1.setOption(adapterOption);
//resize
this.chartInstance1.resize();
},
},
};
</script>
<style lang="scss" scoped>
.condition-left {
display: flex;
flex-direction: row;
align-items: center;
flex-wrap: wrap;
.years-div {
display: flex;
flex-direction: row;
align-items: center;
.years-word {
font-size: 14px;
margin: 0 5px;
color: #388ff3;
}
}
.time-label {
font-size: 16px;
line-height: 7px;
margin-right: 12px;
white-space: nowrap;
}
}
.charts-title {
font-size: 0.24rem;
line-height: 0.07rem;
letter-spacing: 0.02rem;
color: #1f70e9;
margin: 0.3rem 0;
width: 100%;
text-align: center;
}
.main-content {
min-height: 6.6rem;
}
.analysis-table table thead th {
min-width: 1.6rem;
}
.details_ref {
width: 16.5rem;
height: 3.55rem;
margin-bottom: 0.39rem;
margin-left: -0.3rem;
}
.condition-btn {
display: flex;
flex-direction: row;
overflow: hidden;
cursor: pointer;
border-radius: 4px;
margin-right: 0.24rem;
background-color: #324868;
.legend-li {
text-align: center;
line-height: 100%;
padding: 7px 13px;
white-space: nowrap;
font-size: 16px;
color: #9eb5cf;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
.timeStyle2 {
color: #ffffff !important;
background-color: #2886e3;
border: 1px solid #2886e3;
border-radius: 4px;
}
}
/*
媒体查询
*/
@media (max-width: 1210px) {
}
</style>

917
src/views/centerairC/energyAnalysis/components/ynyAnalysis.vue

@ -0,0 +1,917 @@
<template>
<div class="main-body">
<div class="irregular-border">
<div class="main-content">
<div class="condition">
<div class="condition-left">
<div class="time-label">时间类型:</div>
<el-radio-group
v-model="dateType"
style="margin-right: 0.24rem"
@change="updateDateType"
>
<el-radio label="hour">小时</el-radio>
<el-radio label="day"></el-radio>
<el-radio label="month"></el-radio>
<el-radio label="year"></el-radio>
</el-radio-group>
<div class="condition-btn">
<div
class="legend-li"
v-for="(item, index) in timeData2"
:key="index + 1"
@click="handleEnter(item.title, index)"
:class="{ timeStyle2: timeIndex2 == index }"
>
{{ item.title }}
</div>
</div>
<el-date-picker
v-model="timeDate"
:default-time="['00:00:00', '23:59:59']"
type="datetimerange"
range-separator="至"
v-if="dateType == 'hour'"
placeholder="选择日期"
start-placeholder="开始日期"
end-placeholder="结束日期"
>
</el-date-picker>
<el-date-picker
v-model="dayDate"
type="daterange"
v-if="dateType == 'day'"
:key="this.dateType"
range-separator="至"
value-format="yyyy-MM-dd"
start-placeholder="开始日期"
end-placeholder="结束日期"
@change="dateChange"
>
</el-date-picker>
<el-date-picker
v-model="monthDate"
type="monthrange"
v-if="dateType == 'month'"
:key="this.dateType"
range-separator="至"
start-placeholder="开始月份"
end-placeholder="结束月份"
value-format="yyyy-MM"
@change="dateChange"
>
</el-date-picker>
<div
class="years-div"
v-if="dateType == 'year'"
:key="this.dateType"
>
<el-date-picker
v-model="startYear"
type="year"
placeholder="选择开始年份"
style="width: 180px"
value-format="yyyy"
>
</el-date-picker>
<div class="years-word"></div>
<el-date-picker
v-model="endYear"
type="year"
placeholder="选择结束年份"
style="width: 180px"
value-format="yyyy"
>
</el-date-picker>
</div>
<el-select
style="margin-left: 10px"
v-model="systemType"
placeholder="请选择系统类型"
clearable
>
<el-option
v-for="dict in systemTypes"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
/>
</el-select>
<div class="success-btn" style="margin-left: 0.24rem">
<el-button type="success" @click="findData">查询</el-button>
</div>
</div>
<!-- <div class="condition-right">
<el-button type="warning">导出</el-button>
</div> -->
</div>
<div class="charts-table" v-loading="listLoading">
<div class="charts-title">
{{ this.titleDate }} {{ this.checkList }}
</div>
<div class="details_ref" ref="details_ref"></div>
<div class="analysis-table" style="margin-bottom: 0.2rem">
<table>
<thead>
<tr>
<th v-if="dateList.length > 0">类型</th>
<th v-for="(item, index) in dateList" :key="index + 2">
{{ item }}
</th>
</tr>
</thead>
<tbody>
<tr>
<td v-if="curValue2.length > 0">本期{{ this.unitValue }}</td>
<td v-for="(item, index) in curValue2" :key="index + 3">
{{ item }}
</td>
</tr>
<tr>
<td v-if="lastValue2.length > 0">上期{{ this.unitValue }}</td>
<td v-for="(item, index) in lastValue2" :key="index + 4">
{{ item }}
</td>
</tr>
<tr>
<td v-if="yoy2.length > 0">同比(%)</td>
<td v-for="(item, index) in yoy2" :key="index + 5">
{{ item }}
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import { format2 } from "@/utils/datetime";
import * as echarts from "echarts";
import { yoyEnergy } from "@/api/centerairC/energyManage";
import { listData } from "@/api/system/dict/data";
export default {
data() {
return {
listLoading: false,
dateType: "hour", //
timeDate: [], //
dayDate: [], //
monthDate: [], //
startYear: "", //
endYear: "", //
startTime: "", //
endTime: "", //
timeData2: [{ title: "制冷量" }, { title: "用电量" }, { title: "EER" }],
timeIndex2: 0, //
paramType: "cloud", //
//
titleDate: "",
checkList: "制冷量", //
//
dateList: [],
curValue: [],
lastValue: [],
yoy: [],
//
curValue2: [],
lastValue2: [],
yoy2: [],
unitValue: "", //
systemType: "", //
systemTypes: [],
};
},
mounted() {
this.initializeTimeDate();
this.initChart1();
window.addEventListener("resize", this.screenAdapter);
this.screenAdapter();
this.getDictList();
},
destroyed() {
//mounted
window.removeEventListener("resize", this.screenAdapter);
},
methods: {
/** 查询系统类型-字典数据列表 */
getDictList() {
let data = {
pageNum: 1,
pageSize: 100,
dictType: "sys_type",
};
listData(data).then((response) => {
this.systemTypes = response.rows;
this.systemType = this.systemTypes[0].dictValue;
this.getTableData();
});
},
//
initializeTimeDate() {
const start = new Date(new Date().setHours(0, 0, 0, 0));
const end = new Date(new Date().setHours(23, 59, 59, 59));
this.timeDate = [format2(start), format2(end)]; //
this.titleDate = format2(start) + "至" + format2(end);
},
//
updateDateType() {
// this.dateType = this.radio;
console.log(this.dateType);
(this.timeDate = ""), //
(this.dayDate = []), //
(this.monthDate = []), //
(this.startYear = ""), //
(this.endYear = ""); //
},
handleEnter(title, index) {
console.log("打印", title, index);
this.timeIndex2 = index;
if (index == "0") {
this.paramType = "cloud";
} else if (index == "1") {
this.paramType = "meter";
} else if (index == "2") {
this.paramType = "cop";
}
},
//
dateChange() {
// console.log("", this.timeform.time1);
if (!this.dayDate) {
this.$nextTick(() => {
this.dayDate = [];
});
}
if (!this.monthDate) {
this.$nextTick(() => {
this.monthDate = [];
});
}
},
//
findData() {
console.log("this.dateType", this.dateType);
console.log("this.timeDate", this.timeDate);
switch (this.dateType) {
case "hour":
if (!this.timeDate) {
this.showMessage("请选择时间!", "warning");
} else {
this.titleDate =
format2(this.timeDate[0]) + "至" + format2(this.timeDate[1]);
this.checkList = this.timeData2[this.timeIndex2].title;
this.getTableData();
}
break;
case "day":
if (this.dayDate.length === 0) {
this.showMessage("请选择时间!", "warning");
} else {
this.titleDate = this.dayDate[0] + "至" + this.dayDate[1];
this.checkList = this.timeData2[this.timeIndex2].title;
this.getTableData();
// const newLength = new Date(this.dayDate[1]).getTime() - new Date(this.dayDate[0]).getTime();
// const dayDiff = Math.floor(newLength / (1000 * 60 * 60 * 24));
// if (dayDiff > 31) {
// this.showMessage('30', 'warning');
// } else {
// this.titleDate = this.dayDate[0] + "" + this.dayDate[1];
// this.getTableData();
// }
}
break;
case "month":
if (this.monthDate.length === 0) {
this.showMessage("请选择时间!", "warning");
} else {
this.titleDate = this.monthDate[0] + "至" + this.monthDate[1];
this.checkList = this.timeData2[this.timeIndex2].title;
this.getTableData();
// const [start, end] = this.monthDate;
// const startDate = new Date(start);
// const endDate = new Date(end);
// const startYear = startDate.getFullYear();
// const startMonth = startDate.getMonth();
// const endYear = endDate.getFullYear();
// const endMonth = endDate.getMonth();
// const monthDiff = (endYear - startYear) * 12 + (endMonth - startMonth);
// if (monthDiff > 12) {
// this.showMessage('12', 'warning');
// } else {
// this.titleDate = this.monthDate[0] + "" + this.monthDate[1];
// this.getTableData();
// }
}
break;
case "year":
if (!this.startYear || !this.endYear) {
this.showMessage("请选择全年份区间!", "warning");
} else if (this.startYear > this.endYear) {
this.showMessage("结束年份要大于开始年份!", "warning");
} else {
this.titleDate = this.startYear + "至" + this.endYear;
this.checkList = this.timeData2[this.timeIndex2].title;
this.getTableData();
}
break;
default:
break;
}
},
//
showMessage(message, type) {
this.$message({
message: message,
type: type,
});
},
//
getTableData() {
if (this.dateType == "hour") {
this.startTime = format2(this.timeDate[0]);
this.endTime = format2(this.timeDate[1]);
} else if (this.dateType == "day") {
this.startTime = this.dayDate.length > 0 ? this.dayDate[0] : "";
this.endTime = this.dayDate.length > 0 ? this.dayDate[1] : "";
} else if (this.dateType == "month") {
this.startTime = this.monthDate.length > 0 ? this.monthDate[0] : "";
this.endTime = this.monthDate.length > 0 ? this.monthDate[1] : "";
} else if (this.dateType == "year") {
(this.startTime = this.startYear), (this.endTime = this.endYear);
}
let data = {
timeType: this.dateType,
startTime: this.startTime,
endTime: this.endTime,
paramType: this.paramType,
systemType: this.systemType,
};
console.log("查询数据参数", data);
this.listLoading = true;
yoyEnergy(data).then((res) => {
console.log("查询返回", res);
if (res.code == 200 && res.data.data !== null) {
this.dateList = res.data.times;
//
this.curValue2 = [];
this.lastValue2 = [];
this.yoy2 = [];
this.curValue2 = res.data.data[0].curValue;
this.lastValue2 = res.data.data[1].lastValue;
this.yoy2 = res.data.data[2].yoy;
console.log("后端返回的时间", this.dateList);
console.log("后端返回的本期值", this.curValue2);
console.log("后端返回的上期值", this.lastValue2);
console.log("后端返回的同比值", this.yoy2);
// 线
this.curValue = this.curValue2.map(function (value) {
if (value === null) {
return 0;
} else if (typeof value === "string") {
return parseFloat(value);
}
return value;
});
this.lastValue = this.lastValue2.map(function (value) {
if (value === null) {
return 0;
} else if (typeof value === "string") {
return parseFloat(value);
}
return value;
});
this.yoy = this.yoy2.map(function (value) {
if (value === "同期无数据") {
return 0;
} else if (typeof value === "string") {
if (value.endsWith("%")) {
return parseFloat(value);
} else {
return parseFloat(value);
}
}
return value;
});
console.log("处理过的本期值", this.curValue);
console.log("处理过的上期值", this.lastValue);
console.log("处理过的同比值", this.yoy);
// y
// var Min1 = Math.floor(Math.min(...this.curValue, ...this.lastValue)),
var Min1 = 0,
Min2 = Math.floor(Math.min(...this.yoy)),
Max1 = Math.ceil(Math.max(...this.curValue, ...this.lastValue)),
Max2 = Math.ceil(Math.max(...this.yoy));
console.log("Min1", Min1);
console.log("Min2", Min2);
console.log("Max1", Max1);
console.log("Max2", Max2);
// tooltip-
if (this.timeIndex2 == 0) {
this.unitValue = "(kwr)";
} else if (this.timeIndex2 == 1) {
this.unitValue = "(kwh)";
} else {
this.unitValue = " ";
}
const adapterOption = {
xAxis: {
data: this.dateList,
},
yAxis: [
//y
{
min: Min1,
max: Max1,
splitNumber: 10,
interval: (Max1 - Min1) / 10,
},
{
min: Min2,
max: Max2,
splitNumber: 10,
interval: (Max2 - Min2) / 10,
},
],
series: [
{
name: "本期",
data: this.curValue,
},
{
name: "上期",
data: this.lastValue,
},
{
name: "同比",
data: this.yoy,
},
],
};
//.chartInstanceoptiondataoption
this.chartInstance1.setOption(adapterOption);
//resize
this.chartInstance1.resize();
} else {
console.log("后端返回的时间", this.dateList);
console.log("后端返回的本期值", this.curValue2);
console.log("后端返回的上期值", this.lastValue2);
console.log("后端返回的同比值", this.yoy2);
this.dateList = [];
(this.curValue2 = []), (this.lastValue2 = []), (this.yoy2 = []);
var Min1 = 0,
Min2 = 0,
Max1 = 0,
Max2 = 0;
const adapterOption = {
xAxis: {
data: [],
},
yAxis: [
//y
{
min: Min1,
max: Max1,
splitNumber: 10,
interval: (Max1 - Min1) / 10,
},
{
min: Min2,
max: Max2,
splitNumber: 10,
interval: (Max2 - Min2) / 10,
},
],
series: [
{
name: "本期",
data: [],
},
{
name: "上期",
data: [],
},
{
name: "同比",
data: [],
},
],
};
//.chartInstanceoptiondataoption
this.chartInstance1.setOption(adapterOption);
//resize
this.chartInstance1.resize();
}
});
// Just to simulate the time of the request
setTimeout(() => {
this.listLoading = false;
}, 1.0 * 1000);
},
initChart1() {
// // y
// var Min1 = 1;
// var Min2 = 3;
// var Max1 = 10;
// var Max2 = 12;
// console.log("Min1", Min1);
// console.log("Min2", Min2);
// console.log("Max1", Max1);
// console.log("Max2", Max2);
this.chartInstance1 = echarts.init(this.$refs.details_ref);
this.option1 = {
tooltip: {
trigger: "axis",
// 使 formatter tooltip
formatter: function (params) {
let seriesHTML = "";
params.forEach(function (item) {
seriesHTML +=
"<div>" +
item.seriesName +
': <span style="color: #000000; font-weight: bold;">' +
item.value +
"</span></div>";
});
return "<div>" + params[0].name + "</div>" + seriesHTML;
},
// tooltip
formatter: function (params) {
var res = params[0].name + "<br/>";
for (var i = 0, l = params.length; i < l; i++) {
var seriesName = params[i].seriesName;
var value = params[i].value;
// console.log("", params[i].color.colorStops[0].color)
var marker =
'<span style="display:inline-block;margin-right:5px;border-radius:10px;width:9px;height:9px;background-color:' +
params[i].color.colorStops[0].color +
'"></span>';
// seriesName
if (seriesName === "本期") {
res +=
marker +
seriesName +
":" +
'<span style="color: #000000; font-weight: bold;margin-left:5px">' +
value +
" " +
"kwr" +
"</span><br>";
} else if (seriesName === "上期") {
res +=
marker +
seriesName +
":" +
'<span style="color: #000000; font-weight: bold;margin-left:5px">' +
value +
" " +
"kwh" +
"</span><br>";
} else {
res +=
marker +
seriesName +
":" +
'<span style="color: #000000; font-weight: bold;margin-left:5px">' +
value +
" " +
"%" +
"</span><br>";
}
}
return res;
},
},
legend: {
data: ["本期", "上期", "同比"],
textStyle: {
color: "#ffff",
fontSize: 16, //
},
left: "41%",
top: "0%",
bottom: "10%",
//
itemGap: 50,
itemWidth: 16,
itemHeight: 8,
},
grid: {
top: "20%",
left: "3%",
right: "4%",
bottom: "0%",
containLabel: true,
},
xAxis: {
type: "category",
//true
boundaryGap: true,
// x
axisLabel: {
// interval: 0, //x
// rotate: 30, //x30
color: "rgba(255, 255, 255, 1)",
},
axisTick: {
show: false, // 线
},
// x
axisLine: {
show: true,
lineStyle: {
color: "#365576",
},
},
splitLine: {
lineStyle: {
color: "#e2e6f0",
},
},
},
yAxis: [
{
type: "value",
name: "本期、上期", // y
nameTextStyle: {
fontSize: 15, //
color: "#fff", //
// ...
},
// y
axisLabel: {
color: "#ffffff",
},
// y
axisLine: {
show: true,
lineStyle: {
color: "#365576", // y 线
},
},
splitLine: {
lineStyle: {
color: "#1a3d62", // 线
type: "dashed", // 线线
},
},
},
{
type: "value",
// y
axisLabel: {
color: "#ffffff",
formatter: "{value} %",
// formatter: function (val) {
// return val + "%";
// }
},
// y
axisLine: {
show: false,
},
name: "同比", // y
nameTextStyle: {
fontSize: 15, //
color: "#fff", //
// ...
},
// y
axisLine: {
show: true,
lineStyle: {
color: "#365576", // y 线
},
},
splitLine: {
lineStyle: {
color: "#1a3d62", // 线
type: "dashed", // 线线
},
},
// min: Min2,
// max: Max2,
// splitNumber: 10,
// interval: (Max2 - Min2) / 10,
},
],
series: [
{
name: "本期",
type: "bar",
smooth: true,
symbol: "circle",
//
symbolSize: 8,
//
showSymbol: false,
//线
itemStyle: {
color: "#0b75d3",
// 使
color: {
type: "linear",
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{
offset: 0,
color: "rgba(1, 102, 251, 1)", //
},
{
offset: 1,
color: "rgba(1, 102, 251, 0)", //
},
],
global: false, // false
},
borderRadius: [5, 5, 0, 0], //
},
},
{
name: "上期",
type: "bar",
smooth: true,
symbol: "circle",
//
symbolSize: 8,
//
showSymbol: false,
//线
itemStyle: {
color: "#0b75d3",
// 使
color: {
type: "linear",
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{
offset: 0,
color: "rgba(0, 224, 225, 1)", //
},
{
offset: 1,
color: "rgba(0, 224, 225, 0)", //
},
],
global: false, // false
},
borderRadius: [5, 5, 0, 0],
},
},
{
name: "同比",
type: "line",
smooth: false,
symbol: "circle",
//
symbolSize: 8,
yAxisIndex: 1,
//
showSymbol: false,
//线
itemStyle: {
color: "#EE5217", //线
color: {
type: "linear",
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{
offset: 0,
color: "#EE5217", //
},
{
offset: 1,
color: "#EE5217", //
},
],
global: false, // false
},
lineStyle: {
color: "#EE5217", //线
},
},
},
],
};
//
this.chartInstance1.setOption(this.option1, true);
},
// 线
screenAdapter() {
//,2.6 mes_ref
const titleFontSize = (this.$refs.details_ref.offsetWidth / 100) * 1.8;
//optionoption
const adapterOption = {
//fontSize
textStyle: {
fontSize: titleFontSize,
},
};
//.chartInstanceoptiondataoption
this.chartInstance1.setOption(adapterOption);
//resize
this.chartInstance1.resize();
},
},
};
</script>
<style lang="scss" scoped>
.condition-left {
display: flex;
flex-direction: row;
align-items: center;
flex-wrap: wrap;
.years-div {
display: flex;
flex-direction: row;
align-items: center;
.years-word {
font-size: 14px;
margin: 0 5px;
color: #388ff3;
}
}
.time-label {
font-size: 16px;
line-height: 7px;
margin-right: 12px;
white-space: nowrap;
}
}
.charts-title {
font-size: 0.24rem;
line-height: 0.07rem;
letter-spacing: 0.02rem;
color: #1f70e9;
margin: 0.3rem 0;
width: 100%;
text-align: center;
}
.main-content {
min-height: 6.6rem;
}
.analysis-table table thead th {
min-width: 1.6rem;
}
.details_ref {
width: 16.5rem;
height: 3.55rem;
margin-bottom: 0.39rem;
margin-left: -0.3rem;
}
.condition-btn {
display: flex;
flex-direction: row;
overflow: hidden;
cursor: pointer;
border-radius: 4px;
margin-right: 0.24rem;
background-color: #324868;
.legend-li {
text-align: center;
line-height: 100%;
padding: 7px 13px;
white-space: nowrap;
font-size: 16px;
color: #9eb5cf;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
.timeStyle2 {
color: #ffffff !important;
background-color: #2886e3;
border: 1px solid #2886e3;
border-radius: 4px;
}
}
/*
媒体查询
*/
@media (max-width: 1210px) {
}
</style>

1009
src/views/centerairC/energyAnalysis/components/ynyQnqAnalysis.vue

File diff suppressed because it is too large Load Diff

91
src/views/centerairC/energyAnalysis/index.vue

@ -0,0 +1,91 @@
<template>
<div class="paramsDetails">
<div class="details-content">
<div class="details-header">
<el-tabs v-model="activeName" @tab-click="handleClick" lazy>
<el-tab-pane label="能耗分析" name="first">
<energy-analysis v-if="activeName === 'first'"></energy-analysis>
</el-tab-pane>
<el-tab-pane label="环比分析" name="third">
<qnq-analysis v-if="activeName === 'third'"></qnq-analysis>
</el-tab-pane>
<el-tab-pane label="同比分析" name="second">
<yny-analysis v-if="activeName === 'second'"></yny-analysis>
</el-tab-pane>
<el-tab-pane label="同比环比分析" name="four">
<yny-qnq-analysis v-if="activeName === 'four'"></yny-qnq-analysis>
</el-tab-pane>
</el-tabs>
</div>
</div>
</div>
</template>
<script>
import energyAnalysis from "./components/energyAnalysis.vue";
import qnqAnalysis from "./components/qnqAnalysis.vue";
import ynyAnalysis from "./components/ynyAnalysis.vue";
import ynyQnqAnalysis from "./components/ynyQnqAnalysis.vue";
export default {
components: { energyAnalysis, qnqAnalysis, ynyAnalysis, ynyQnqAnalysis },
data() {
return {
activeName: "first", //
};
},
methods: {
handleClick(tab, event) {
console.log(tab, event);
},
handleNodeClick(data) {
console.log(data);
},
//
},
};
</script>
<style lang="scss" scoped>
.paramsDetails {
display: flex;
flex-direction: row;
align-items: stretch;
justify-content: space-between;
.details-content {
width: 100%;
// height: 0.42rem;
position: relative;
}
}
</style>
<style scoped>
.none-div {
padding-top: 0.31rem;
}
.none-div >>> .el-tree {
background: transparent;
color: #789d9f;
}
.none-div >>> .el-tree-node:focus > .el-tree-node__content {
background-color: #00be97;
color: #fff;
}
.none-div >>> .el-tree-node__content:hover,
.none-div >>> .el-upload-list__item:hover {
background-color: #00be97;
color: #fff;
}
.none-div >>> .el-tree-node__content {
height: 0.48rem;
justify-content: center;
}
.none-div >>> .el-tree-node__expand-icon.is-leaf {
display: none !important;
}
</style>

1000
src/views/centerairC/overview/index.vue

File diff suppressed because it is too large Load Diff

58
src/views/region/index.vue

@ -116,6 +116,14 @@
</el-table-column>
<el-table-column prop="createBy" label="创建者"> </el-table-column>
<el-table-column prop="areaName" label="区域名称"> </el-table-column>
<el-table-column label="系统类型" align="center" prop="systemType">
<template slot-scope="scope">
<dict-tag
:options="dict.type.sys_type"
:value="scope.row.systemType"
/>
</template>
</el-table-column>
</template>
<template v-if="currentLevel === 1">
<el-table-column prop="buildingName" label="楼栋名称">
@ -214,26 +222,36 @@
>
<el-row type="flex" justify="center">
<el-col :span="12">
<el-form-item
label="区域名称"
placeholder="请输入区域名称"
prop="areaName"
>
<el-form-item label="区域名称" prop="areaName">
<el-input
placeholder="请输入区域名称"
v-model="dialogForm.areaName"
></el-input></el-form-item
></el-col>
<el-col :span="12">
<el-form-item
label="排序"
placeholder="请输入数字"
prop="orderNum"
>
<el-form-item label="排序" prop="orderNum">
<el-input
placeholder="请输入数字"
v-model="dialogForm.orderNum"
></el-input></el-form-item
></el-col>
</el-row>
<el-row type="flex" justify="start">
<el-col :span="12">
<el-form-item label="系统类型" prop="systemType">
<el-select
v-model="dialogForm.systemType"
placeholder="选择系统类型"
clearable
>
<el-option
v-for="dict in dict.type.sys_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/> </el-select></el-form-item
></el-col>
</el-row>
</template>
<template
v-if="
@ -493,6 +511,8 @@ import {
delHouse,
} from "@/api/region";
export default {
name: "region",
dicts: ["sys_type"],
data() {
return {
treeData: [
@ -826,18 +846,18 @@ export default {
console.log("请求楼层");
//
this.getFloorMes();
} else if (this.currentLevel === 3 ) {
} else if (this.currentLevel === 3) {
// ;
this.getRoomMes();
}else if (this.currentLevel === 4){
} else if (this.currentLevel === 4) {
// id
getHouse(th8is.currentId).then((res) => {
console.log("详情返回", res);
if (res.code == 200) {
this.tableData = [res.data];
this.total = 1;
}
});
console.log("详情返回", res);
if (res.code == 200) {
this.tableData = [res.data];
this.total = 1;
}
});
}
},
//
@ -1300,6 +1320,7 @@ export default {
orderNum: this.dialogForm.orderNum,
remark: "",
parentId: "0",
systemType: this.dialogForm.systemType,
};
addArea(data).then((res) => {
if (res.code == 200) {
@ -1416,6 +1437,7 @@ export default {
orderNum: this.dialogForm.orderNum,
remark: "",
parentId: "0",
systemType: this.dialogForm.systemType,
};
updateArea(data).then((res) => {
if (res.code == 200) {

Loading…
Cancel
Save