Explorar o código

Merge branch 'master' of http://39.105.58.247:3100/powerForecast/powerForecast-ui

# Conflicts:
#	src/views/modules/load-data/index.vue
zhaoyun hai 1 mes
pai
achega
9693824a3d
Modificáronse 2 ficheiros con 245 adicións e 2 borrados
  1. 5 2
      src/views/board.vue
  2. 240 0
      src/views/modules/load-data/index.vue

+ 5 - 2
src/views/board.vue

@@ -3119,7 +3119,7 @@ export default {
           seriesIndex: [0],
         },
       },
-      boardBase: { funnelNum: 6, lineNum: 8, gaugeNum: 8, barNum: 8, pieNum: 6 },
+      boardBase: { funnelNum: 996, lineNum: 998, gaugeNum: 998, barNum: 998, pieNum: 996 },
       gauge: {
         tooltip: { formatter: '{b} : {c}', trigger: 'item' },
         backgroundColor: 'transparent',
@@ -4048,6 +4048,9 @@ export default {
 
             let legendObj = {
               data: xAxis,
+              type: 'scroll',
+              orient: 'horizontal',
+              bottom: 'bottom',
             };
             legendObj = Object.assign(legendObj, this.funnel.legend);
             let seriesObj = {
@@ -4131,7 +4134,7 @@ export default {
             let titleObj = this.pie2 ? this.pie2.title : this.pie.title;
             titleObj.text = '月电采暖负荷统计';
 
-            const legendObj = this.pie2.legend;
+            const legendObj = { ...this.pie2.legend, type: 'scroll', left: '5%', bottom: 'top' };
 
             let seriesObj = {
               type: 'pie',

+ 240 - 0
src/views/modules/load-data/index.vue

@@ -247,6 +247,7 @@
 </template>
 
 <script>
+<<<<<<< HEAD
 	import * as echarts from 'echarts'
 	import chinaJson from "@/components/echarts/china.json";
 	import axios from 'axios';
@@ -641,6 +642,245 @@
 		}
 
 	};
+=======
+import AddOrUpdate from './components/add-or-update.vue';
+import uploadModal from './components/uploadModal.vue';
+import axios from 'axios';
+export default {
+  components: {
+    AddOrUpdate,
+    uploadModal,
+  },
+  data() {
+    return {
+      searchForm: {
+        subNm: '',
+        compNm: '',
+        dateRange: [],
+      },
+      dataList: [],
+      pageIndex: 1,
+      pageSize: 10,
+      totalPage: 0,
+      dataListLoading: false,
+      dataListSelections: [],
+      layouts: ['prev', 'pager', 'next', 'sizes'],
+      compList: [],
+      addOrUpdateOrDetailFlag: false,
+    };
+  },
+  created() {
+    this.getCompList();
+    this.getDataList();
+  },
+  methods: {
+    // 获取公司列表
+    async getCompList() {
+      this.compList = [];
+      const { data } = await this.$http({
+        url: `/company/lists`,
+        method: 'get',
+      });
+      if (data && data.code === 0) {
+        this.compList = data.data.map(item => ({
+          label: item.compName,
+          value: String(item.id),
+        }));
+      }
+    },
+    importHandler() {
+      this.$refs.uploadModal.openDialog();
+    },
+    downloadTemplate() {
+      const link = document.createElement('a');
+      link.href = '././voltageLoad_template.xlsx';
+      link.download = 'voltageLoad_template.xlsx';
+      document.body.appendChild(link);
+      link.click();
+      document.body.removeChild(link);
+    },
+    exportTemplate() {
+      axios
+        .get(this.$base.url + 'file/download?fileName=' + 'voltageLoad_template.xlsx', {
+          headers: {
+            token: this.$storage.get('Token'),
+          },
+          responseType: 'blob',
+        })
+        .then(({ data }) => {
+          const blob = new Blob([data], { type: 'application/vnd.ms-excel' });
+          const fileName = 'voltageLoad_template.xlsx';
+          const a = document.createElement('a');
+          a.href = URL.createObjectURL(blob);
+          a.download = fileName;
+          a.click();
+          URL.revokeObjectURL(a.href);
+        });
+    },
+    // 下载
+    download(file) {
+      let arr = file.replace(new RegExp('upload/', 'g'), '');
+      axios
+        .get(this.$base.url + 'file/download?fileName=' + arr, {
+          headers: {
+            token: this.$storage.get('Token'),
+          },
+          responseType: 'blob',
+        })
+        .then(
+          ({ data }) => {
+            const binaryData = [];
+            binaryData.push(data);
+            const objectUrl = window.URL.createObjectURL(
+              new Blob(binaryData, {
+                type: 'application/pdf;chartset=UTF-8',
+              })
+            );
+            const a = document.createElement('a');
+            a.href = objectUrl;
+            a.download = arr;
+            // a.click()
+            // 下面这个写法兼容火狐
+            a.dispatchEvent(
+              new MouseEvent('click', {
+                bubbles: true,
+                cancelable: true,
+                view: window,
+              })
+            );
+            window.URL.revokeObjectURL(data);
+          },
+          err => {
+            axios
+              .get(
+                (location.href.split(this.$base.name).length > 1 ? location.href.split(this.$base.name)[0] : '') +
+                  this.$base.name +
+                  '/file/download?fileName=' +
+                  arr,
+                {
+                  headers: {
+                    token: this.$storage.get('Token'),
+                  },
+                  responseType: 'blob',
+                }
+              )
+              .then(({ data }) => {
+                const binaryData = [];
+                binaryData.push(data);
+                const objectUrl = window.URL.createObjectURL(
+                  new Blob(binaryData, {
+                    type: 'application/pdf;chartset=UTF-8',
+                  })
+                );
+                const a = document.createElement('a');
+                a.href = objectUrl;
+                a.download = arr;
+                // a.click()
+                // 下面这个写法兼容火狐
+                a.dispatchEvent(
+                  new MouseEvent('click', {
+                    bubbles: true,
+                    cancelable: true,
+                    view: window,
+                  })
+                );
+                window.URL.revokeObjectURL(data);
+              });
+          }
+        );
+    },
+    search() {
+      this.pageIndex = 1;
+      this.getDataList();
+    },
+    // 获取数据列表
+    getDataList() {
+      this.dataListLoading = true;
+      let params = {
+        page: this.pageIndex,
+        limit: this.pageSize,
+        sort: 'id',
+        order: 'desc',
+      };
+      if (this.searchForm.subNm != '' && this.searchForm.subNm != undefined) {
+        params['subNm'] = '%' + this.searchForm.subNm + '%';
+      }
+      if (this.searchForm.compNm != '' && this.searchForm.compNm != undefined) {
+        params['compNm'] = '%' + this.searchForm.compNm + '%';
+      }
+      if (this.searchForm.dateRange != '' && this.searchForm.dateRange != undefined) {
+        params['data_date_start'] = this.searchForm.dateRange[0];
+        params['data_date_end'] = this.searchForm.dateRange[1];
+      }
+      this.$http({
+        url: '/subLoad/page',
+        method: 'get',
+        params: params,
+      }).then(({ data }) => {
+        if (data && data.code === 0) {
+          this.dataList = data.data.list;
+          this.totalPage = data.data.total;
+        } else {
+          this.dataList = [];
+          this.totalPage = 0;
+        }
+        this.dataListLoading = false;
+      });
+    },
+    // 每页数
+    sizeChangeHandle(val) {
+      this.pageSize = val;
+      this.pageIndex = 1;
+      this.getDataList();
+    },
+    // 当前页
+    currentChangeHandle(val) {
+      this.pageIndex = val;
+      this.getDataList();
+    },
+    // 多选
+    selectionChangeHandler(val) {
+      this.dataListSelections = val;
+    },
+    // 添加/修改
+    addOrUpdateHandler(id, type) {
+      this.addOrUpdateOrDetailFlag = true;
+      this.$nextTick(() => {
+        this.$refs.addOrUpdate.openDialog(id, type);
+      });
+    },
+    // 删除
+    async deleteHandler(id) {
+      var ids = id
+        ? [Number(id)]
+        : this.dataListSelections.map(item => {
+            return Number(item.id);
+          });
+      await this.$confirm(`确定进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning',
+      }).then(async () => {
+        await this.$http({
+          url: 'subLoad/delete',
+          method: 'post',
+          data: ids,
+        }).then(async ({ data }) => {
+          if (data && data.code === 0) {
+            this.$message({
+              message: '操作成功',
+              type: 'success',
+            });
+            this.search();
+          } else {
+            this.$message.error(data.msg);
+          }
+        });
+      });
+    },
+  },
+};
+>>>>>>> 4d62baf422410d85bb1b46e1bc897b761f51beb8
 </script>
 <style lang="scss" scoped>
 	//导出excel