riku
2024-10-21 e8b4c98c16b6721a7d6617aecf82bfbc23655a58
1. 数据产品模块(暂存)
已修改9个文件
已添加3个文件
515 ■■■■■ 文件已修改
package-lock.json 158 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
package.json 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/fysp/dataproductApi.js 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/index.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components.d.ts 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/core/SiderMenu.vue 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/fysp/data-product/ProdProAnalysis.vue 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/fysp/data-product/ProdProFollow.vue 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/fysp/data-product/ProdSceneReport.vue 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/fysp/data-product/ProdStandardJudge.vue 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/fysp/data-product/components/BaseDataProduct.vue 185 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/fysp/data-product/components/CompReportDownloadDialog.vue 80 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
package-lock.json
@@ -20,7 +20,8 @@
        "pinia": "^2.0.26",
        "vue": "^3.2.45",
        "vue-i18n": "^9.8.0",
        "vue-router": "^4.1.6"
        "vue-router": "^4.1.6",
        "xlsx": "^0.18.5"
      },
      "devDependencies": {
        "@babel/cli": "^7.19.3",
@@ -2800,6 +2801,14 @@
        "node": ">=0.4.0"
      }
    },
    "node_modules/adler-32": {
      "version": "1.3.1",
      "resolved": "https://registry.npmmirror.com/adler-32/-/adler-32-1.3.1.tgz",
      "integrity": "sha512-ynZ4w/nUUv5rrsR8UUGoe1VC9hZj6V5hU9Qw1HlMDJGEJw5S7TfTErWTjMys6M7vr0YWcPqs3qAr4ss0nDfP+A==",
      "engines": {
        "node": ">=0.8"
      }
    },
    "node_modules/agent-base": {
      "version": "6.0.2",
      "dev": true,
@@ -3294,6 +3303,18 @@
      "dev": true,
      "license": "Apache-2.0"
    },
    "node_modules/cfb": {
      "version": "1.2.2",
      "resolved": "https://registry.npmmirror.com/cfb/-/cfb-1.2.2.tgz",
      "integrity": "sha512-KfdUZsSOw19/ObEWasvBP/Ac4reZvAGauZhs6S/gqNhXhI7cKwvlH7ulj+dOEYnca4bm4SGo8C1bTAQvnTjgQA==",
      "dependencies": {
        "adler-32": "~1.3.0",
        "crc-32": "~1.2.0"
      },
      "engines": {
        "node": ">=0.8"
      }
    },
    "node_modules/chai": {
      "version": "4.3.7",
      "dev": true,
@@ -3463,6 +3484,14 @@
        "url": "https://github.com/sponsors/sindresorhus"
      }
    },
    "node_modules/codepage": {
      "version": "1.15.0",
      "resolved": "https://registry.npmmirror.com/codepage/-/codepage-1.15.0.tgz",
      "integrity": "sha512-3g6NUTPd/YtuuGrhMnOMRjFc+LJw/bnMp3+0r/Wcz3IXUuCosKRJvMphm5+Q+bvTVGcJJuRvVLuYba+WojaFaA==",
      "engines": {
        "node": ">=0.8"
      }
    },
    "node_modules/color-convert": {
      "version": "2.0.1",
      "dev": true,
@@ -3547,6 +3576,17 @@
      "version": "1.0.2",
      "dev": true,
      "license": "MIT"
    },
    "node_modules/crc-32": {
      "version": "1.2.2",
      "resolved": "https://registry.npmmirror.com/crc-32/-/crc-32-1.2.2.tgz",
      "integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==",
      "bin": {
        "crc32": "bin/crc32.njs"
      },
      "engines": {
        "node": ">=0.8"
      }
    },
    "node_modules/cross-spawn": {
      "version": "7.0.3",
@@ -4520,6 +4560,14 @@
      },
      "engines": {
        "node": ">= 0.12"
      }
    },
    "node_modules/frac": {
      "version": "1.1.2",
      "resolved": "https://registry.npmmirror.com/frac/-/frac-1.1.2.tgz",
      "integrity": "sha512-w/XBfkibaTl3YDqASwfDUqkna4Z2p9cFSr1aHDt0WoMTECnRfBOv2WArlZILlqgWlmdIlALXGpM2AOhEk5W3IA==",
      "engines": {
        "node": ">=0.8"
      }
    },
    "node_modules/fraction.js": {
@@ -6546,6 +6594,17 @@
        "node": "*"
      }
    },
    "node_modules/ssf": {
      "version": "0.11.2",
      "resolved": "https://registry.npmmirror.com/ssf/-/ssf-0.11.2.tgz",
      "integrity": "sha512-+idbmIXoYET47hH+d7dfm2epdOMUDjqcB4648sTZ+t2JwoyBFL/insLfB/racrDmsKB3diwsDA696pZMieAC5g==",
      "dependencies": {
        "frac": "~1.1.2"
      },
      "engines": {
        "node": ">=0.8"
      }
    },
    "node_modules/sshpk": {
      "version": "1.17.0",
      "dev": true,
@@ -7596,6 +7655,22 @@
        "node": ">= 8"
      }
    },
    "node_modules/wmf": {
      "version": "1.0.2",
      "resolved": "https://registry.npmmirror.com/wmf/-/wmf-1.0.2.tgz",
      "integrity": "sha512-/p9K7bEh0Dj6WbXg4JG0xvLQmIadrner1bi45VMJTfnbVHsc7yIajZyoSoK60/dtVBs12Fm6WkUI5/3WAVsNMw==",
      "engines": {
        "node": ">=0.8"
      }
    },
    "node_modules/word": {
      "version": "0.3.0",
      "resolved": "https://registry.npmmirror.com/word/-/word-0.3.0.tgz",
      "integrity": "sha512-OELeY0Q61OXpdUfTp+oweA/vtLVg5VDOXh+3he3PNzLGG/y0oylSOC1xRVj0+l4vQ3tj/bB1HVHv1ocXkQceFA==",
      "engines": {
        "node": ">=0.8"
      }
    },
    "node_modules/word-wrap": {
      "version": "1.2.3",
      "dev": true,
@@ -7643,6 +7718,26 @@
        "utf-8-validate": {
          "optional": true
        }
      }
    },
    "node_modules/xlsx": {
      "version": "0.18.5",
      "resolved": "https://registry.npmmirror.com/xlsx/-/xlsx-0.18.5.tgz",
      "integrity": "sha512-dmg3LCjBPHZnQp5/F/+nnTa+miPJxUXB6vtk42YjBBKayDNagxGEeIdWApkYPOf3Z3pm3k62Knjzp7lMeTEtFQ==",
      "dependencies": {
        "adler-32": "~1.3.0",
        "cfb": "~1.2.1",
        "codepage": "~1.15.0",
        "crc-32": "~1.2.1",
        "ssf": "~0.11.2",
        "wmf": "~1.0.1",
        "word": "~0.3.0"
      },
      "bin": {
        "xlsx": "bin/xlsx.njs"
      },
      "engines": {
        "node": ">=0.8"
      }
    },
    "node_modules/xml-name-validator": {
@@ -9473,6 +9568,11 @@
      "version": "8.2.0",
      "dev": true
    },
    "adler-32": {
      "version": "1.3.1",
      "resolved": "https://registry.npmmirror.com/adler-32/-/adler-32-1.3.1.tgz",
      "integrity": "sha512-ynZ4w/nUUv5rrsR8UUGoe1VC9hZj6V5hU9Qw1HlMDJGEJw5S7TfTErWTjMys6M7vr0YWcPqs3qAr4ss0nDfP+A=="
    },
    "agent-base": {
      "version": "6.0.2",
      "dev": true,
@@ -9751,6 +9851,15 @@
      "version": "0.12.0",
      "dev": true
    },
    "cfb": {
      "version": "1.2.2",
      "resolved": "https://registry.npmmirror.com/cfb/-/cfb-1.2.2.tgz",
      "integrity": "sha512-KfdUZsSOw19/ObEWasvBP/Ac4reZvAGauZhs6S/gqNhXhI7cKwvlH7ulj+dOEYnca4bm4SGo8C1bTAQvnTjgQA==",
      "requires": {
        "adler-32": "~1.3.0",
        "crc-32": "~1.2.0"
      }
    },
    "chai": {
      "version": "4.3.7",
      "dev": true,
@@ -9853,6 +9962,11 @@
        "string-width": "^4.2.0"
      }
    },
    "codepage": {
      "version": "1.15.0",
      "resolved": "https://registry.npmmirror.com/codepage/-/codepage-1.15.0.tgz",
      "integrity": "sha512-3g6NUTPd/YtuuGrhMnOMRjFc+LJw/bnMp3+0r/Wcz3IXUuCosKRJvMphm5+Q+bvTVGcJJuRvVLuYba+WojaFaA=="
    },
    "color-convert": {
      "version": "2.0.1",
      "dev": true,
@@ -9907,6 +10021,11 @@
    "core-util-is": {
      "version": "1.0.2",
      "dev": true
    },
    "crc-32": {
      "version": "1.2.2",
      "resolved": "https://registry.npmmirror.com/crc-32/-/crc-32-1.2.2.tgz",
      "integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ=="
    },
    "cross-spawn": {
      "version": "7.0.3",
@@ -10554,6 +10673,11 @@
        "combined-stream": "^1.0.6",
        "mime-types": "^2.1.12"
      }
    },
    "frac": {
      "version": "1.1.2",
      "resolved": "https://registry.npmmirror.com/frac/-/frac-1.1.2.tgz",
      "integrity": "sha512-w/XBfkibaTl3YDqASwfDUqkna4Z2p9cFSr1aHDt0WoMTECnRfBOv2WArlZILlqgWlmdIlALXGpM2AOhEk5W3IA=="
    },
    "fraction.js": {
      "version": "4.2.0",
@@ -11781,6 +11905,14 @@
        "through": "2"
      }
    },
    "ssf": {
      "version": "0.11.2",
      "resolved": "https://registry.npmmirror.com/ssf/-/ssf-0.11.2.tgz",
      "integrity": "sha512-+idbmIXoYET47hH+d7dfm2epdOMUDjqcB4648sTZ+t2JwoyBFL/insLfB/racrDmsKB3diwsDA696pZMieAC5g==",
      "requires": {
        "frac": "~1.1.2"
      }
    },
    "sshpk": {
      "version": "1.17.0",
      "dev": true,
@@ -12385,6 +12517,16 @@
        "isexe": "^2.0.0"
      }
    },
    "wmf": {
      "version": "1.0.2",
      "resolved": "https://registry.npmmirror.com/wmf/-/wmf-1.0.2.tgz",
      "integrity": "sha512-/p9K7bEh0Dj6WbXg4JG0xvLQmIadrner1bi45VMJTfnbVHsc7yIajZyoSoK60/dtVBs12Fm6WkUI5/3WAVsNMw=="
    },
    "word": {
      "version": "0.3.0",
      "resolved": "https://registry.npmmirror.com/word/-/word-0.3.0.tgz",
      "integrity": "sha512-OELeY0Q61OXpdUfTp+oweA/vtLVg5VDOXh+3he3PNzLGG/y0oylSOC1xRVj0+l4vQ3tj/bB1HVHv1ocXkQceFA=="
    },
    "word-wrap": {
      "version": "1.2.3",
      "dev": true
@@ -12407,6 +12549,20 @@
      "dev": true,
      "requires": {}
    },
    "xlsx": {
      "version": "0.18.5",
      "resolved": "https://registry.npmmirror.com/xlsx/-/xlsx-0.18.5.tgz",
      "integrity": "sha512-dmg3LCjBPHZnQp5/F/+nnTa+miPJxUXB6vtk42YjBBKayDNagxGEeIdWApkYPOf3Z3pm3k62Knjzp7lMeTEtFQ==",
      "requires": {
        "adler-32": "~1.3.0",
        "cfb": "~1.2.1",
        "codepage": "~1.15.0",
        "crc-32": "~1.2.1",
        "ssf": "~0.11.2",
        "wmf": "~1.0.1",
        "word": "~0.3.0"
      }
    },
    "xml-name-validator": {
      "version": "4.0.0",
      "dev": true
package.json
@@ -25,7 +25,8 @@
    "pinia": "^2.0.26",
    "vue": "^3.2.45",
    "vue-i18n": "^9.8.0",
    "vue-router": "^4.1.6"
    "vue-router": "^4.1.6",
    "xlsx": "^0.18.5"
  },
  "devDependencies": {
    "@babel/cli": "^7.19.3",
src/api/fysp/dataproductApi.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,34 @@
import { Base64 } from 'js-base64';
import { $fysp } from '../index';
export default {
  /**
   * ä¸‹è½½æ•°æ®äº§å“
   */
  downloadProduct(area, type, forceUpdate) {
    return $fysp
      .post(`dataProduct/download?`, area, {
        responseType: 'arraybuffer',
        params: { type, forceUpdate }
      })
      .then((res) => {
        // æ–‡æ¡£æœªç”Ÿæˆï¼Œå·²å¯åŠ¨æ–‡æ¡£ç”ŸæˆåŽå°ä»»åŠ¡
        if (res.data.type == 'application/json') {
          return false;
        }
        // æ–‡æ¡£å·²å­˜åœ¨ï¼Œè¿”回文件数据流
        else {
          return res.data
          // const name = Base64.decode(res.headers.get('filename'));
          // const url = window.URL.createObjectURL(res.data);
          // const link = document.createElement('a');
          // link.href = url;
          // link.setAttribute('download', name);
          // document.body.appendChild(link);
          // link.click();
          // document.body.removeChild(link);
          // window.URL.revokeObjectURL(url);
        }
      });
  }
};
src/api/index.js
@@ -11,7 +11,7 @@
let ip2_file = 'https://fyami.com.cn/';
if (debug) {
  ip1 = 'http://192.168.0.138:8080/';
  ip1 = 'http://192.168.0.138:9001/';
  // ip1_file = 'http://192.168.0.138:8080/';
  // ip2 = 'http://192.168.0.138:8080/';
  // ip2_file = 'https://fyami.com.cn/';
src/components.d.ts
@@ -12,18 +12,23 @@
    BasePanelLayout: typeof import('./components/core/BasePanelLayout.vue')['default']
    CompQuickSet: typeof import('./components/search-option/CompQuickSet.vue')['default']
    Content: typeof import('./components/core/Content.vue')['default']
    ElAffix: typeof import('element-plus/es')['ElAffix']
    ElAside: typeof import('element-plus/es')['ElAside']
    ElAvatar: typeof import('element-plus/es')['ElAvatar']
    ElBadge: typeof import('element-plus/es')['ElBadge']
    ElBreadcrumb: typeof import('element-plus/es')['ElBreadcrumb']
    ElBreadcrumbItem: typeof import('element-plus/es')['ElBreadcrumbItem']
    ElButton: typeof import('element-plus/es')['ElButton']
    ElCalendar: typeof import('element-plus/es')['ElCalendar']
    ElCard: typeof import('element-plus/es')['ElCard']
    ElCascader: typeof import('element-plus/es')['ElCascader']
    ElCheckbox: typeof import('element-plus/es')['ElCheckbox']
    ElCol: typeof import('element-plus/es')['ElCol']
    ElCollapse: typeof import('element-plus/es')['ElCollapse']
    ElCollapseItem: typeof import('element-plus/es')['ElCollapseItem']
    ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider']
    ElContainer: typeof import('element-plus/es')['ElContainer']
    ElDatePicker: typeof import('element-plus/es')['ElDatePicker']
    ElDescriptions: typeof import('element-plus/es')['ElDescriptions']
    ElDescriptionsItem: typeof import('element-plus/es')['ElDescriptionsItem']
    ElDialog: typeof import('element-plus/es')['ElDialog']
@@ -36,14 +41,19 @@
    ElIcon: typeof import('element-plus/es')['ElIcon']
    ElImage: typeof import('element-plus/es')['ElImage']
    ElInput: typeof import('element-plus/es')['ElInput']
    ElLink: typeof import('element-plus/es')['ElLink']
    ElMain: typeof import('element-plus/es')['ElMain']
    ElMenu: typeof import('element-plus/es')['ElMenu']
    ElMenuItem: typeof import('element-plus/es')['ElMenuItem']
    ElMenuItemGroup: typeof import('element-plus/es')['ElMenuItemGroup']
    ElOption: typeof import('element-plus/es')['ElOption']
    ElPagination: typeof import('element-plus/es')['ElPagination']
    ElPopover: typeof import('element-plus/es')['ElPopover']
    ElRadioButton: typeof import('element-plus/es')['ElRadioButton']
    ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup']
    ElRow: typeof import('element-plus/es')['ElRow']
    ElScrollbar: typeof import('element-plus/es')['ElScrollbar']
    ElSegmented: typeof import('element-plus/es')['ElSegmented']
    ElSelect: typeof import('element-plus/es')['ElSelect']
    ElSpace: typeof import('element-plus/es')['ElSpace']
    ElStep: typeof import('element-plus/es')['ElStep']
@@ -55,6 +65,7 @@
    ElTabs: typeof import('element-plus/es')['ElTabs']
    ElTag: typeof import('element-plus/es')['ElTag']
    ElText: typeof import('element-plus/es')['ElText']
    ElTooltip: typeof import('element-plus/es')['ElTooltip']
    ElTree: typeof import('element-plus/es')['ElTree']
    ElUpload: typeof import('element-plus/es')['ElUpload']
    Footer: typeof import('./components/core/Footer.vue')['default']
src/components/core/SiderMenu.vue
@@ -77,7 +77,7 @@
  data() {
    return {
      popVisible: false,
      menuHeight: '800px',
      menuHeight: '600px',
      title: '生态环境线上监管',
      subTitle: '©上海飞羽环保科技有限公司',
      sysIndex: 0,
@@ -139,7 +139,7 @@
    this.navPage(...this.menuPath(this.menus[0]));
  },
  mounted() {
    // this.menuHeight = this.calMenuHeight();
    this.menuHeight = this.calMenuHeight();
  }
};
</script>
@@ -179,7 +179,7 @@
.el-menu-vertical-demo:not(.el-menu--collapse) {
  /* width: 200px; */
  min-height: 100vh;
  /* max-height: 100vh; */
  max-height: 100vh;
}
.el-menu--collapse {
src/views/fysp/data-product/ProdProAnalysis.vue
@@ -0,0 +1,11 @@
<template>
  <BaseDataProduct product-type="3"></BaseDataProduct>
</template>
<script setup>
/**
 * é—®é¢˜æ•´æ”¹åˆ†æž
 */
import BaseDataProduct from './components/BaseDataProduct.vue';
</script>
src/views/fysp/data-product/ProdProFollow.vue
@@ -0,0 +1,11 @@
<template>
  <BaseDataProduct product-type="1"></BaseDataProduct>
</template>
<script setup>
/**
 * é—®é¢˜åŠ¨æ€è·Ÿè¸ª
 */
import BaseDataProduct from './components/BaseDataProduct.vue';
</script>
src/views/fysp/data-product/ProdSceneReport.vue
@@ -0,0 +1,3 @@
<template>
  åœºæ™¯æŠ¥å‘Šç®¡ç†
</template>
src/views/fysp/data-product/ProdStandardJudge.vue
@@ -0,0 +1,11 @@
<template>
  <BaseDataProduct product-type="2"></BaseDataProduct>
</template>
<script setup>
/**
 * è§„范性评估
 */
import BaseDataProduct from './components/BaseDataProduct.vue';
</script>
src/views/fysp/data-product/components/BaseDataProduct.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,185 @@
<template>
  <FYSearchBar ref="searchRef" @search="handleSearch">
    <template #options>
      <!-- åŒºåŽ¿ -->
      <FYOptionLocation
        :allOption="false"
        :level="3"
        :checkStrictly="false"
        v-model:value="formSearch.locations"
      ></FYOptionLocation>
      <!-- åœºæ™¯ç±»åž‹ -->
      <FYOptionScene
        :allOption="false"
        :type="2"
        v-model:value="formSearch.scenetype"
      ></FYOptionScene>
      <!-- æ—¶é—´ -->
      <FYOptionTime
        :initValue="false"
        type="month"
        v-model:value="formSearch.time"
      ></FYOptionTime>
    </template>
    <template #buttons>
      <CompReportDownloadDialog
        name="问题与整改汇总分析与动态跟踪清单"
        :locations="formSearch.locations"
        :scenetype="formSearch.scenetype"
        :time="formSearch.time"
        @submit="handleSearch"
      ></CompReportDownloadDialog>
    </template>
  </FYSearchBar>
  <el-form ref="expandRef" :inline="true">
    <CompQuickSet @quick-set="setOptions"></CompQuickSet>
  </el-form>
  <el-space>
    <el-segmented
      :model-value="activeSheet"
      :options="sheetNames"
      @change="tabChange"
    />
  </el-space>
  <el-table
    ref="tableRef"
    :data="excelData"
    v-loading="loading"
    table-layout="fixed"
    size="small"
    :height="tableHeight"
    border
  >
    <template v-if="excelData">
      <el-table-column
        v-for="(value, key, index) in excelData[0]"
        :key="index"
        :prop="key"
        :label="key"
      >
      </el-table-column>
    </template>
  </el-table>
  <div v-if="excelHtml" v-html="excelHtml"></div>
</template>
<script setup>
/**
 * é—®é¢˜åŠ¨æ€è·Ÿè¸ª
 */
import { ref, onMounted } from 'vue';
import dayjs from 'dayjs';
import * as XLSX from 'xlsx';
import dataproductApi from '@/api/fysp/dataproductApi';
import CompReportDownloadDialog from './CompReportDownloadDialog.vue';
const emit = defineEmits(['search']);
const props = defineProps({
  // æ•°æ®äº§å“ç±»åž‹ï¼Œ1:问题动态跟踪;2:规范性评估;3:问题整改分析
  productType: Number,
  // åœ¨æ•°æ®å±•示之前,做预处理(主要是处理合并表头)
  beforeDataShow: {
    type: Function,
    default: (data) => {
      return data;
    }
  },
  // æ•°æ®è¡¨æ ¼çš„表头行数
  headNum: {
    type: Number,
    default: 1
  }
});
const formSearch = ref({
  locations: {},
  scenetype: {},
  time: dayjs().add(-1, 'M').date(1).toDate()
});
const loading = ref(false);
const tableHeight = ref('500');
let workbook;
const sheetNames = ref();
const activeSheet = ref();
const excelData = ref();
const excelHtml = ref();
const searchRef = ref(null);
const expandRef = ref(null);
function setOptions(param) {
  formSearch.value.locations = param.locations;
  formSearch.value.scenetype = param.scenetype;
  formSearch.value.sourceType = param.sourceType;
  handleSearch(false);
}
function tabChange(tabName) {
  activeSheet.value = tabName;
  getTable(activeSheet.value);
}
function handleSearch(forceUpdate) {
  const locations = formSearch.value.locations;
  const time = formSearch.value.time;
  const scenetype = formSearch.value.scenetype;
  const area = {
    provincecode: locations.pCode,
    provincename: locations.pName,
    citycode: locations.cCode,
    cityname: locations.cName,
    districtcode: locations.dCode,
    districtname: locations.dName,
    starttime: dayjs(time).format('YYYY-MM-DD HH:mm:ss'),
    scensetypeid: scenetype.value
  };
  loading.value = true;
  dataproductApi
    .downloadProduct(area, props.productType, forceUpdate ? forceUpdate : false)
    .then((res) => {
      const data = new Uint8Array(res);
      workbook = XLSX.read(data, { type: 'array' });
      sheetNames.value = workbook.SheetNames;
      activeSheet.value = sheetNames.value[0];
      getTable(activeSheet.value);
    })
    .finally(() => (loading.value = false));
}
function getTable(sheetName) {
  const worksheet = workbook.Sheets[sheetName];
  const tableData = XLSX.utils.sheet_to_json(worksheet, { header: 3 });
  // const tableData = XLSX.utils.sheet_to_csv(worksheet);
  console.log(tableData);
  console.log(tableData[0]);
  combineTableHead(tableData);
  excelData.value = props.beforeDataShow(tableData);
}
// æ ¹æ®è¡¨å¤´çš„行数,合并表头
function combineTableHead(excelData) {
  if (excelData.length < props.headNum) return;
  // const newHead = {};
  // excelData.splice(0, props.headNum).forEach((row) => {
  //   for (const key in row) {
  //     console.log(key);
  //   }
  // });
}
function calcTableHeight() {
  const h1 = searchRef.value.$el.offsetHeight;
  const h2 = expandRef.value.$el.offsetHeight;
  const h = h1 + h2;
  return `calc(100vh - ${h}px - 60px - var(--el-main-padding) * 2)`;
}
onMounted(() => {
  tableHeight.value = calcTableHeight();
  // handleSearch()
});
</script>
src/views/fysp/data-product/components/CompReportDownloadDialog.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,80 @@
<template>
  <el-button icon="Download" type="success" @click="dialogVisible = true"
    >导出报告</el-button
  >
  <el-dialog v-model="dialogVisible" :title="name" width="500">
    <el-text tag="b" size="large">数据范围确认</el-text>
    <el-text tag="div">区域:{{ locationText }}</el-text>
    <el-text tag="div">类型:{{ scenetype.label }}</el-text>
    <el-text tag="div">时间:{{ timeText }}</el-text>
    <template #footer>
      <div class="dialog-footer">
        <el-row align="middle">
          <el-checkbox v-model="forceUpdate" label="强制生成新报告" />
          <el-tooltip placement="bottom-start" effect="light">
            <template #content>
              <el-text tag="b" size="small">不勾选:</el-text><br />
              <el-text size="small"
                >不勾选时,如果已生成过相同区域的报告,则直接获取该份报告记录</el-text
              ><br />
              <el-text tag="b" size="small">勾选:</el-text><br />
              <el-text size="small"
                >勾选时,无论是否有历史记录,都会启动报告生成任务覆盖旧记录,可在后台任务界面查看任务进度</el-text
              ><br />
            </template>
            <el-icon
              class="m-l-8 cursor-p"
              :size="16"
              color="var(--el-color-warning)"
              ><QuestionFilled
            /></el-icon>
          </el-tooltip>
        </el-row>
        <div>
          <el-button @click="dialogVisible = false">取消</el-button>
          <el-button type="primary" @click="handleSubmit">确定</el-button>
        </div>
      </div>
    </template>
  </el-dialog>
</template>
<script>
import dayjs from 'dayjs';
export default {
  props: ['name', 'locations', 'time', 'scenetype'],
  emits: ['submit'],
  data() {
    return {
      dialogVisible: false,
      forceUpdate: false
    };
  },
  computed: {
    locationText() {
      const loc = this.locations;
      let text = '';
      text = loc.pName == loc.cName ? loc.pName : loc.pName + loc.cName;
      text += loc.dName;
      return text;
    },
    timeText() {
      return dayjs(this.time).format('YYYYå¹´MM月');
    }
  },
  methods: {
    handleSubmit() {
      this.$emit('submit', this.forceUpdate);
    }
  }
};
</script>
<style scoped>
.dialog-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2px;
}
</style>