From 9c59a7e7156245ec28f5800a5743ec5c599ec194 Mon Sep 17 00:00:00 2001 From: juzi <819872918@qq.com> Date: Tue, 5 Sep 2023 15:45:59 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=83=BD=E6=BA=90=E5=88=86=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 + src/api/analysis/energyAnalysis.js | 37 ++ src/api/monitoring/energyReport.js | 6 +- src/utils/chartMixins/resize.js | 64 +++ src/utils/debounce.js | 40 ++ src/utils/dict.js | 3 +- .../contrastAnalysis/components/barChart.vue | 77 ++++ .../contrastAnalysis/components/lineChart.vue | 78 ++++ .../components/searchArea.vue | 363 +++++++++++++++++ .../analysis/contrastAnalysis/index.vue | 64 +++ .../qoqAnalysis/components/lineChart.vue | 109 ++++++ .../qoqAnalysis/components/searchArea.vue | 181 +++++++++ .../energy/analysis/qoqAnalysis/index.vue | 109 ++++++ .../trendAnalysis/components/barChart.vue | 77 ++++ .../trendAnalysis/components/lineChart.vue | 78 ++++ .../trendAnalysis/components/searchArea.vue | 364 ++++++++++++++++++ .../energy/analysis/trendAnalysis/index.vue | 64 +++ .../yoyAnalysis/components/lineChart.vue | 104 +++++ .../yoyAnalysis/components/searchArea.vue | 156 ++++++++ .../energy/analysis/yoyAnalysis/index.vue | 116 ++++++ .../energy/base/energyPlcConnect/index.vue | 10 +- .../base/energyQuantityRealtime/index.vue | 1 + .../energyLimit/components/energyLimitAdd.vue | 51 ++- .../energy/monitoring/energyLimit/index.vue | 2 +- .../energy/monitoring/energyReport/index.vue | 56 +-- .../monitoring/energyReportSearch/index.vue | 76 ++-- .../components/energyStatisticsDet.vue | 4 + .../components/energyStatisticsDetAdd.vue | 4 + src/views/group/base/groupTeam/index.vue | 8 +- 29 files changed, 2203 insertions(+), 100 deletions(-) create mode 100644 src/api/analysis/energyAnalysis.js create mode 100644 src/utils/chartMixins/resize.js create mode 100644 src/utils/debounce.js create mode 100644 src/views/energy/analysis/contrastAnalysis/components/barChart.vue create mode 100644 src/views/energy/analysis/contrastAnalysis/components/lineChart.vue create mode 100644 src/views/energy/analysis/contrastAnalysis/components/searchArea.vue create mode 100644 src/views/energy/analysis/contrastAnalysis/index.vue create mode 100644 src/views/energy/analysis/qoqAnalysis/components/lineChart.vue create mode 100644 src/views/energy/analysis/qoqAnalysis/components/searchArea.vue create mode 100644 src/views/energy/analysis/qoqAnalysis/index.vue create mode 100644 src/views/energy/analysis/trendAnalysis/components/barChart.vue create mode 100644 src/views/energy/analysis/trendAnalysis/components/lineChart.vue create mode 100644 src/views/energy/analysis/trendAnalysis/components/searchArea.vue create mode 100644 src/views/energy/analysis/trendAnalysis/index.vue create mode 100644 src/views/energy/analysis/yoyAnalysis/components/lineChart.vue create mode 100644 src/views/energy/analysis/yoyAnalysis/components/searchArea.vue create mode 100644 src/views/energy/analysis/yoyAnalysis/index.vue diff --git a/package.json b/package.json index b7ef11cc..5bb88d64 100644 --- a/package.json +++ b/package.json @@ -74,6 +74,7 @@ "vue-video-player": "^5.0.2", "vuedraggable": "2.24.3", "vuex": "3.6.2", + "xlsx": "^0.18.5", "xml-js": "1.6.11" }, "devDependencies": { diff --git a/src/api/analysis/energyAnalysis.js b/src/api/analysis/energyAnalysis.js new file mode 100644 index 00000000..16e466bd --- /dev/null +++ b/src/api/analysis/energyAnalysis.js @@ -0,0 +1,37 @@ +import request from '@/utils/request' + +// 获取走势分析数据 +export function getEnergyTrend(data) { + return request({ + url: '/analysis/energy-analysis/getTrend', + method: 'post', + data: data + }) +} + +// 获取对比分析数据 +export function getCompare(data) { + return request({ + url: '/analysis/energy-analysis/getCompare', + method: 'post', + data: data + }) +} + +// 获取同比分析数据(1:季度,2:月;3:日) +export function getYoy(data) { + return request({ + url: '/analysis/energy-analysis/getYoy', + method: 'post', + data: data + }) +} + +// 获取环比分析数据(1:月,2:周,3:日) +export function getQoq(data) { + return request({ + url: '/analysis/energy-analysis/getChain', + method: 'post', + data: data + }) +} \ No newline at end of file diff --git a/src/api/monitoring/energyReport.js b/src/api/monitoring/energyReport.js index 89dde91f..1e585b22 100644 --- a/src/api/monitoring/energyReport.js +++ b/src/api/monitoring/energyReport.js @@ -23,7 +23,8 @@ export function energyReportPageExport(data) { return request({ url: '/monitoring/energy-report/export', method: 'post', - data: data + data: data, + responseType: 'blob' }) } @@ -32,6 +33,7 @@ export function energyReportPageExportAuto(data) { return request({ url: '/monitoring/energy-report/exportAuto', method: 'post', - data: data + data: data, + responseType: 'blob' }) } \ No newline at end of file diff --git a/src/utils/chartMixins/resize.js b/src/utils/chartMixins/resize.js new file mode 100644 index 00000000..e77f0a4f --- /dev/null +++ b/src/utils/chartMixins/resize.js @@ -0,0 +1,64 @@ +import { debounce } from '@/utils/debounce' + +export default { + data() { + return { + $_sidebarElm: null, + $_resizeHandler: null + } + }, + mounted() { + this.$_resizeHandler = debounce(() => { + if (this.chart) { + this.chart.resize() + } + }, 100) + this.$_initResizeEvent() + this.$_initSidebarResizeEvent() + }, + beforeDestroy() { + this.$_destroyResizeEvent() + this.$_destroySidebarResizeEvent() + }, + // to fixed bug when cached by keep-alive + // https://github.com/PanJiaChen/vue-element-admin/issues/2116 + activated() { + this.$_initResizeEvent() + this.$_initSidebarResizeEvent() + }, + deactivated() { + this.$_destroyResizeEvent() + this.$_destroySidebarResizeEvent() + }, + methods: { + // use $_ for mixins properties + // https://vuejs.org/v2/style-guide/index.html#Private-property-names-essential + $_initResizeEvent() { + window.addEventListener('resize', this.$_resizeHandler) + }, + $_destroyResizeEvent() { + window.removeEventListener('resize', this.$_resizeHandler) + }, + $_sidebarResizeHandler(e) { + if (e.propertyName === 'width') { + this.$_resizeHandler() + } + }, + $_initSidebarResizeEvent() { + this.$_sidebarElm = + document.getElementsByClassName('sidebar-container')[0] + this.$_sidebarElm && + this.$_sidebarElm.addEventListener( + 'transitionend', + this.$_sidebarResizeHandler + ) + }, + $_destroySidebarResizeEvent() { + this.$_sidebarElm && + this.$_sidebarElm.removeEventListener( + 'transitionend', + this.$_sidebarResizeHandler + ) + } + } +} diff --git a/src/utils/debounce.js b/src/utils/debounce.js new file mode 100644 index 00000000..7d325fc1 --- /dev/null +++ b/src/utils/debounce.js @@ -0,0 +1,40 @@ +/** + * @param {Function} func + * @param {number} wait + * @param {boolean} immediate + * @return {*} + */ +export function debounce(func, wait, immediate) { + let timeout, args, context, timestamp, result + + const later = function () { + // 据上一次触发时间间隔 + const last = +new Date() - timestamp + + // 上次被包装函数被调用时间间隔 last 小于设定时间间隔 wait + if (last < wait && last > 0) { + timeout = setTimeout(later, wait - last) + } else { + timeout = null + // 如果设定为immediate===true,因为开始边界已经调用过了此处无需调用 + if (!immediate) { + result = func.apply(context, args) + if (!timeout) context = args = null + } + } + } + + return function (...args) { + context = this + timestamp = +new Date() + const callNow = immediate && !timeout + // 如果延时不存在,重新设定延时 + if (!timeout) timeout = setTimeout(later, wait) + if (callNow) { + result = func.apply(context, args) + context = args = null + } + + return result + } +} diff --git a/src/utils/dict.js b/src/utils/dict.js index cd20bbbd..efd89ef3 100644 --- a/src/utils/dict.js +++ b/src/utils/dict.js @@ -91,7 +91,8 @@ export const DICT_TYPE = { ENERGY_UNIT: 'energy_unit', MONITOR_INDEX_TYPE: 'monitor_index_type', OBJECT_TYPE: 'object_type', - STATISTIC_TYPE: 'statistic_type' + STATISTIC_TYPE: 'statistic_type', + TIME_DIM: 'time_dim' } /** diff --git a/src/views/energy/analysis/contrastAnalysis/components/barChart.vue b/src/views/energy/analysis/contrastAnalysis/components/barChart.vue new file mode 100644 index 00000000..ecb26ae1 --- /dev/null +++ b/src/views/energy/analysis/contrastAnalysis/components/barChart.vue @@ -0,0 +1,77 @@ + + \ No newline at end of file diff --git a/src/views/energy/analysis/contrastAnalysis/components/lineChart.vue b/src/views/energy/analysis/contrastAnalysis/components/lineChart.vue new file mode 100644 index 00000000..593017aa --- /dev/null +++ b/src/views/energy/analysis/contrastAnalysis/components/lineChart.vue @@ -0,0 +1,78 @@ + + \ No newline at end of file diff --git a/src/views/energy/analysis/contrastAnalysis/components/searchArea.vue b/src/views/energy/analysis/contrastAnalysis/components/searchArea.vue new file mode 100644 index 00000000..bfe7af22 --- /dev/null +++ b/src/views/energy/analysis/contrastAnalysis/components/searchArea.vue @@ -0,0 +1,363 @@ + + + \ No newline at end of file diff --git a/src/views/energy/analysis/contrastAnalysis/index.vue b/src/views/energy/analysis/contrastAnalysis/index.vue new file mode 100644 index 00000000..69bf6c49 --- /dev/null +++ b/src/views/energy/analysis/contrastAnalysis/index.vue @@ -0,0 +1,64 @@ + + \ No newline at end of file diff --git a/src/views/energy/analysis/qoqAnalysis/components/lineChart.vue b/src/views/energy/analysis/qoqAnalysis/components/lineChart.vue new file mode 100644 index 00000000..64968301 --- /dev/null +++ b/src/views/energy/analysis/qoqAnalysis/components/lineChart.vue @@ -0,0 +1,109 @@ + + \ No newline at end of file diff --git a/src/views/energy/analysis/qoqAnalysis/components/searchArea.vue b/src/views/energy/analysis/qoqAnalysis/components/searchArea.vue new file mode 100644 index 00000000..9eea64d3 --- /dev/null +++ b/src/views/energy/analysis/qoqAnalysis/components/searchArea.vue @@ -0,0 +1,181 @@ + + + + \ No newline at end of file diff --git a/src/views/energy/analysis/qoqAnalysis/index.vue b/src/views/energy/analysis/qoqAnalysis/index.vue new file mode 100644 index 00000000..0a76dd41 --- /dev/null +++ b/src/views/energy/analysis/qoqAnalysis/index.vue @@ -0,0 +1,109 @@ + + \ No newline at end of file diff --git a/src/views/energy/analysis/trendAnalysis/components/barChart.vue b/src/views/energy/analysis/trendAnalysis/components/barChart.vue new file mode 100644 index 00000000..ecb26ae1 --- /dev/null +++ b/src/views/energy/analysis/trendAnalysis/components/barChart.vue @@ -0,0 +1,77 @@ + + \ No newline at end of file diff --git a/src/views/energy/analysis/trendAnalysis/components/lineChart.vue b/src/views/energy/analysis/trendAnalysis/components/lineChart.vue new file mode 100644 index 00000000..593017aa --- /dev/null +++ b/src/views/energy/analysis/trendAnalysis/components/lineChart.vue @@ -0,0 +1,78 @@ + + \ No newline at end of file diff --git a/src/views/energy/analysis/trendAnalysis/components/searchArea.vue b/src/views/energy/analysis/trendAnalysis/components/searchArea.vue new file mode 100644 index 00000000..fa75aea6 --- /dev/null +++ b/src/views/energy/analysis/trendAnalysis/components/searchArea.vue @@ -0,0 +1,364 @@ + + + \ No newline at end of file diff --git a/src/views/energy/analysis/trendAnalysis/index.vue b/src/views/energy/analysis/trendAnalysis/index.vue new file mode 100644 index 00000000..059ecfed --- /dev/null +++ b/src/views/energy/analysis/trendAnalysis/index.vue @@ -0,0 +1,64 @@ + + \ No newline at end of file diff --git a/src/views/energy/analysis/yoyAnalysis/components/lineChart.vue b/src/views/energy/analysis/yoyAnalysis/components/lineChart.vue new file mode 100644 index 00000000..6d80bd0e --- /dev/null +++ b/src/views/energy/analysis/yoyAnalysis/components/lineChart.vue @@ -0,0 +1,104 @@ + + \ No newline at end of file diff --git a/src/views/energy/analysis/yoyAnalysis/components/searchArea.vue b/src/views/energy/analysis/yoyAnalysis/components/searchArea.vue new file mode 100644 index 00000000..2b2a74be --- /dev/null +++ b/src/views/energy/analysis/yoyAnalysis/components/searchArea.vue @@ -0,0 +1,156 @@ + + + + \ No newline at end of file diff --git a/src/views/energy/analysis/yoyAnalysis/index.vue b/src/views/energy/analysis/yoyAnalysis/index.vue new file mode 100644 index 00000000..2a697c6a --- /dev/null +++ b/src/views/energy/analysis/yoyAnalysis/index.vue @@ -0,0 +1,116 @@ + + \ No newline at end of file diff --git a/src/views/energy/base/energyPlcConnect/index.vue b/src/views/energy/base/energyPlcConnect/index.vue index 10d90aec..539e7436 100644 --- a/src/views/energy/base/energyPlcConnect/index.vue +++ b/src/views/energy/base/energyPlcConnect/index.vue @@ -50,7 +50,7 @@ import { getEnergyPlcConnectPage, deleteEnergyPlcConnect } from "@/api/base/ener // import { publicFormatter } from '@/utils/dict' import { getTree } from '@/api/base/factory' import { getEnergyTypeListAll } from '@/api/base/energyType' -import EnergyPlcConnectAdd from './components/energyPlcConnectAdd.vue' +import EnergyPlcConnectAdd from './components/energyPlcConnectAdd' import EnergyPlcParam from './components/energyPlcParam' const tableProps = [ { @@ -61,6 +61,10 @@ const tableProps = [ prop: 'objCode', label: '对象编码' }, + { + prop: 'remark', + label: '对象备注' + }, { prop: 'plcTableName', label: '关联表名' @@ -76,10 +80,6 @@ const tableProps = [ { prop: 'varNum', label: '绑定参数数量' - }, - { - prop: 'remark', - label: '备注' } ] export default { diff --git a/src/views/energy/base/energyQuantityRealtime/index.vue b/src/views/energy/base/energyQuantityRealtime/index.vue index 835fc656..d642fa61 100644 --- a/src/views/energy/base/energyQuantityRealtime/index.vue +++ b/src/views/energy/base/energyQuantityRealtime/index.vue @@ -137,6 +137,7 @@ export default { this.$modal.confirm('是否确认导出').then(() => { return exportEnergyQuantityRealtimeExcel({...this.queryParams}); }).then(response => { + console.log(response) this.$download.excel(response, '能源抄表.xls'); }).catch(() => {}) } diff --git a/src/views/energy/monitoring/energyLimit/components/energyLimitAdd.vue b/src/views/energy/monitoring/energyLimit/components/energyLimitAdd.vue index aff1a102..0ee81797 100644 --- a/src/views/energy/monitoring/energyLimit/components/energyLimitAdd.vue +++ b/src/views/energy/monitoring/energyLimit/components/energyLimitAdd.vue @@ -27,12 +27,12 @@ - + + v-for="item in detailList" + :key="item.id" + :label="item.name" + :value="item.id"> @@ -52,7 +52,7 @@ + \ No newline at end of file diff --git a/src/views/group/base/groupTeamScheduling/index copy.vue b/src/views/group/base/groupTeamScheduling/index copy.vue deleted file mode 100644 index 6346df1f..00000000 --- a/src/views/group/base/groupTeamScheduling/index copy.vue +++ /dev/null @@ -1,233 +0,0 @@ - - - diff --git a/src/views/group/base/groupTeamScheduling/index.vue b/src/views/group/base/groupTeamScheduling/index.vue index 6346df1f..74e36336 100644 --- a/src/views/group/base/groupTeamScheduling/index.vue +++ b/src/views/group/base/groupTeamScheduling/index.vue @@ -1,232 +1,66 @@