Browse Source

行业水平分析和企业水平分析增加企业分类下拉框,其他页面增加loading效果

littleblue55 1 month ago
parent
commit
139726e35a

+ 6 - 0
src/api/base_data_year/base_data_year.js

@@ -8,6 +8,12 @@ export function listBase_data_year(query) {
     params: query
   })
 }
+export function listBase_data_year_all() {
+  return request({
+    url: '/base_data_year/base_data_year/list/all',
+    method: 'get'
+  })
+}
 
 // 查询base_data_year详细
 export function getBase_data_year(id) {

+ 8 - 0
src/api/score/score.js

@@ -9,6 +9,14 @@ export function listScore(query) {
   })
 }
 
+
+export function listScoreAll() {
+  return request({
+    url: '/score/score/list/all',
+    method: 'get'
+  })
+}
+
 // 查询score详细
 export function getScore(id) {
   return request({

+ 1 - 1
src/views/base_data_month/base_data_month/index.vue

@@ -373,7 +373,7 @@ export default {
     };
   },
   created() {
-    this.getList();
+    // this.getList();
   },
   methods: {
     /** 查询base_data_month列表 */

+ 20 - 2
src/views/benefit/index.vue

@@ -108,8 +108,11 @@
         align="center"
       ></el-table-column>
       <el-table-column
-      align="center" 
-      prop="year" label="年度" width="100"></el-table-column>
+        align="center"
+        prop="year"
+        label="年度"
+        width="100"
+      ></el-table-column>
       <el-table-column
         prop="season"
         label="季度"
@@ -235,6 +238,12 @@ export default {
     async init() {
       const that = this;
       // 获取所有的行业
+      const loading = this.$loading({
+        lock: true,
+        text: "Loading",
+        spinner: "el-icon-loading",
+        background: "rgba(0, 0, 0, 0.7)",
+      });
       await listAllIndustry()
         .then((res) => {
           if (res && res?.rows) {
@@ -283,17 +292,26 @@ export default {
           console.error("Error fetching data:", error);
         });
       // 第一次的时候初始化from
+      loading.close();
       this.resetForm();
     },
     submit() {
+      const load = this.$loading({
+            lock: true,
+            text: "Loading",
+            spinner: "el-icon-loading",
+            background: "rgba(0, 0, 0, 0.7)",
+          });
       benefitList(this.form)
         .then((res) => {
+          load.close();
           if (res && res?.rows) {
             this.mode = this.form.mode;
             this.tableData = res.rows;
           }
         })
         .catch((error) => {
+          load.close();
           console.error("Error fetching data:", error);
         });
     },

+ 33 - 4
src/views/dashboard/sandianscore.vue

@@ -33,6 +33,21 @@
             </el-option>
           </el-select></el-form-item
         >
+        <el-form-item label="企业分类">
+          <el-select
+            v-model="typeNum"
+            style="width: 100%"
+            clearable
+          >
+            <el-option
+              v-for="item in enterTypeList"
+              :key="item.number"
+              :value="item.number"
+              :label="keyToChineseEtype(item.number)"
+            >
+            </el-option>
+          </el-select>
+        </el-form-item>
         <el-form-item label="行业代码" style="margin-bottom: 0"
           ><el-input
             v-model="selectedCode"
@@ -96,8 +111,9 @@
 
 <script>
 import * as echarts from "echarts";
-import { listScore } from "@/api/score/score"; // 导入得分数据的接口
-import { listIndustry } from "@/api/industry/industry"; // 导入行业数据的接口
+import { listScoreAll } from "@/api/score/score"; // 导入得分数据的接口
+import { listAllIndustry } from "@/api/industry/industry"; // 导入行业数据的接口
+import { listEtypeAll } from "@/api/etype/etype";
 require("echarts/theme/macarons"); // echarts theme
 import resize from "./mixins/resize";
 import { Decimal } from "decimal.js";
@@ -199,6 +215,8 @@ export default {
       detectMin: null,
       detectMax: null,
       tableData: [],
+      enterTypeList: [],
+      typeNum: null
     };
   },
   mounted() {
@@ -213,7 +231,7 @@ export default {
   },
   methods: {
     fetchData() {
-      listScore(this.queryParams)
+      listScoreAll(this.queryParams)
         .then((response) => {
           this.chartData = response.rows;
           this.availableYears = [
@@ -238,7 +256,7 @@ export default {
           console.error("Error fetching data:", error);
         });
 
-      listIndustry(this.industryQueryParams)
+      listAllIndustry(this.industryQueryParams)
         .then((response) => {
           this.industryData = response.rows;
           this.industryMap = this.industryData.reduce((map, item) => {
@@ -250,6 +268,17 @@ export default {
         .catch((error) => {
           console.error("Error fetching data:", error);
         });
+      this.getEtypeAll()
+    },
+    getEtypeAll() {
+      return listEtypeAll().then((res) => {
+        this.enterTypeList = res;
+        // console.log(this.enterTypeList);
+      });
+    },
+    keyToChineseEtype(num) {
+      const item = this.enterTypeList.find((element) => element.number === num);
+      return item ? item.name : null;
     },
     initChart() {
       if (this.chart) {

+ 42 - 12
src/views/dashboard/zhifangbasedata.vue

@@ -30,18 +30,33 @@
             </el-option>
           </el-select>
         </el-form-item>
-        <el-form-item label="行业代码" style="margin-bottom: 0">
+        <el-form-item label="数据分布区间" style="margin-bottom: 0">
           <el-input
-            v-model="selectedCode"
-            placeholder="请输入行业代码"
+            v-model="selectedRange"
+            placeholder="请设置数据分布区间"
             clearable
             style="width: 100%"
           />
         </el-form-item>
-        <el-form-item label="数据分布区间" style="margin-bottom: 0">
+        <el-form-item label="企业分类">
+          <el-select
+            v-model="typeNum"
+            style="width: 100%"
+            clearable
+          >
+            <el-option
+              v-for="item in enterTypeList"
+              :key="item.number"
+              :value="item.number"
+              :label="keyToChineseEtype(item.number)"
+            >
+            </el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="行业代码" style="margin-bottom: 0">
           <el-input
-            v-model="selectedRange"
-            placeholder="请设置数据分布区间"
+            v-model="selectedCode"
+            placeholder="请输入行业代码"
             clearable
             style="width: 100%"
           />
@@ -51,6 +66,7 @@
             {{ industryMap.get(selectedCode) }}
           </div>
         </el-form-item>
+        
         <el-form-item style="margin-bottom: 0">
           <el-button type="primary" icon="el-icon-search" @click="updateChart" size="mini"
             >搜索</el-button
@@ -110,8 +126,9 @@
 
 <script>
 import * as echarts from "echarts";
-import { listBase_data_year } from "@/api/base_data_year/base_data_year";
-import { listIndustry } from "@/api/industry/industry"; // 导入行业数据的接口
+import { listBase_data_year, listBase_data_year_all} from "@/api/base_data_year/base_data_year";
+import { listAllIndustry } from "@/api/industry/industry"; // 导入行业数据的接口
+import { listEtypeAll } from "@/api/etype/etype";
 require("echarts/theme/macarons"); // echarts theme
 import resize from "./mixins/resize";
 
@@ -179,7 +196,7 @@ export default {
       selectedYear: null,
       queryParams: {
         pageNum: 1,
-        pageSize: 2000000, // 默认 2000000 条(全部一次性数据)
+        pageSize: 10, // 默认 2000000 条(全部一次性数据)
         enterpriseName: null,
         location: null,
         code: null,
@@ -200,13 +217,15 @@ export default {
       },
       industryQueryParams: {
         pageNum: 1,
-        pageSize: 2000000,
+        pageSize: 10,
         industryName: null,
         code: null,
       }, //  查询行业信息
       availableYears: [],
       selectedRange: 300, // 不能为 0
       tableData: [],
+      enterTypeList: [],
+      typeNum: null
     };
   },
   mounted() {
@@ -221,7 +240,7 @@ export default {
   },
   methods: {
     fetchData() {
-      listBase_data_year(this.queryParams)
+      listBase_data_year_all(this.queryParams)
         .then((response) => {
           this.chartData = response.rows;
           this.availableYears = [
@@ -237,7 +256,7 @@ export default {
           console.error("Error fetching data:", error);
         });
 
-      listIndustry(this.industryQueryParams)
+      listAllIndustry(this.industryQueryParams)
         .then((response) => {
           this.industryData = response.rows;
           // console.log("industry_info" + this.industryData);
@@ -250,6 +269,17 @@ export default {
         .catch((error) => {
           console.error("Error fetching data:", error);
         });
+      this.getEtypeAll()
+    },
+    getEtypeAll() {
+      return listEtypeAll().then((res) => {
+        this.enterTypeList = res;
+        // console.log(this.enterTypeList);
+      });
+    },
+    keyToChineseEtype(num) {
+      const item = this.enterTypeList.find((element) => element.number === num);
+      return item ? item.name : null;
     },
     initChart() {
       if (this.chart) {

+ 11 - 1
src/views/growthRate/index.vue

@@ -336,16 +336,25 @@ export default {
   methods: {
     fetchData() {
       // 获取年份,获取季度、月度
+      const loading = this.$loading({
+        lock: true,
+        text: 'Loading',
+        spinner: 'el-icon-loading',
+        background: 'rgba(0, 0, 0, 0.7)'
+      });
       Promise.all([
         this.getYearData(),
         this.getAllIndustry(),
         this.getEtypeAll(),
       ])
         .then(() => {
+          loading.close();
           this.initChart();
         })
         .catch((error) => {
-          console.error("Error fetching data:", error);
+          loading.close()
+          this.$message.error(error)
+          // console.error("Error fetching data:", error);
         });
     },
     getYearData() {
@@ -459,6 +468,7 @@ export default {
         });
     },
     updateChart(rawData) {
+      
       const that = this;
       if (!this.chart) {
         return;

+ 30 - 18
src/views/investment/index.vue

@@ -379,9 +379,7 @@ export default {
             validator: (rule, value, callback) => {
               const currentYear = new Date().getFullYear();
               if (value < 1900 || value > currentYear) {
-                callback(
-                  new Error(`请输入合理的年度,示例:2025`)
-                );
+                callback(new Error(`请输入合理的年度,示例:2025`));
               } else {
                 callback();
               }
@@ -481,22 +479,36 @@ export default {
       //   averageOutputValuePerMuInRecentThreeYears: 22,
       //   averageTaxPerMuInRecentThreeYears: 22,
       // }
-      analysisInvestment(this.form).then((res) => {
-        if (res && res?.code === 200 && res?.rows.length > 0) {
-          let data = res.rows[0];
-          this.BaseA = data.standardA;
-          this.BaseB = data.standardB;
-          this.BaseData = data.list;
-          // console.log(this.BaseData);
-          this.BaseData.push({
-            id: "新企业",
-            typeNum: this.form.typeNum,
-            enterpriseName: "新企业",
-            landUsedInRecentThreeYears: this.form.landArea,
-            averageAnnualOutputValue: this.form.annualOutputValue,
-            averageAnnualTaxPaid: this.form.taxPaid,
+      this.$refs.ruleForm.validate((valid) => {
+        if (valid) {
+          const loading = this.$loading({
+            lock: true,
+            text: "Loading",
+            spinner: "el-icon-loading",
+            background: "rgba(0, 0, 0, 0.7)",
           });
-          this.updateChart();
+          analysisInvestment(this.form).then((res) => {
+            loading.close();
+            if (res && res?.code === 200 && res?.rows.length > 0) {
+              let data = res.rows[0];
+              this.BaseA = data.standardA;
+              this.BaseB = data.standardB;
+              this.BaseData = data.list;
+              // console.log(this.BaseData);
+              this.BaseData.push({
+                id: "新企业",
+                typeNum: this.form.typeNum,
+                enterpriseName: "新企业",
+                landUsedInRecentThreeYears: this.form.landArea,
+                averageAnnualOutputValue: this.form.annualOutputValue,
+                averageAnnualTaxPaid: this.form.taxPaid,
+              });
+              this.updateChart();
+            }
+          });
+        } else {
+          loading.close();
+          console.log("error submit!!");
         }
       });
     },

+ 57 - 38
src/views/match/index.vue

@@ -21,11 +21,7 @@
           </el-select>
         </el-form-item>
         <el-form-item label="行业">
-          <el-select
-            v-model="matchForm.code"
-            style="width: 100%"
-            filterable
-          >
+          <el-select v-model="matchForm.code" style="width: 100%" filterable>
             <el-option
               v-for="item in industryData"
               :key="item.key"
@@ -36,11 +32,7 @@
           </el-select>
         </el-form-item>
         <el-form-item label="企业分类">
-          <el-select
-            v-model="matchForm.companyType"
-            style="width: 100%"
-            clearable
-          >
+          <el-select v-model="matchForm.typeNum" style="width: 100%" clearable>
             <el-option
               v-for="item in enterTypeList"
               :key="item.number"
@@ -129,18 +121,17 @@
         </el-form-item>
       </el-form>
     </div>
-    <el-table :data="tableData" border>\
-      code: "2422"
-      enterpriseName: "企业1"
-      location: "A"
-      trueThreshold: -0.24883973894126177
-      typeName: "A"
-      typeNum: "1"
-      <el-table-column prop="enterpriseName" label="企业名称" sortable></el-table-column>
+    <el-table :data="tableData" border>
+      <el-table-column
+        prop="enterpriseName"
+        label="企业名称"
+        sortable
+      ></el-table-column>
       <el-table-column
         prop="location"
         label="坐落地"
-        width="200" sortable
+        width="200"
+        sortable
       ></el-table-column>
       <el-table-column
         prop="code"
@@ -155,7 +146,8 @@
       <el-table-column
         prop="trueThreshold"
         label="相差值"
-        width="200" sortable
+        width="200"
+        sortable
       ></el-table-column>
     </el-table>
     <el-pagination
@@ -164,7 +156,7 @@
       :page.sync="matchForm.pageNum"
       :limit.sync="matchForm.pageSize"
       @pagination="submit"
-       >
+    >
     </el-pagination>
   </div>
 </template>
@@ -196,7 +188,7 @@ export default {
         pageSize: 10,
         dataKey: "powerConsume", //评估指标
         code: "", //行业
-        companyType: "", //企业分类
+        typeNum: "", //企业分类
         threshold: null, //相差值阈值
         // 用电
         year: "", //年度 (用电和用人都用这个年度)
@@ -225,7 +217,6 @@ export default {
       monthMap: new Map(),
       yearsOptions: [],
       enterTypeList: [],
-      enterTypeList: [],
       industryData: [],
       industryMap: new Map(),
       tableData: [],
@@ -239,9 +230,24 @@ export default {
   methods: {
     fetchData() {
       // 获取年份,获取季度、月度
-      this.getYearData();
-      this.getAllIndustry();
-      this.getEtypeAll();
+      const load = this.$loading({
+        lock: true,
+        text: "Loading",
+        spinner: "el-icon-loading",
+        background: "rgba(0, 0, 0, 0.7)",
+      });
+      Promise.all([
+        this.getYearData(),
+        this.getAllIndustry(),
+        this.getEtypeAll(),
+      ])
+        .then(() => {
+          load.close();
+        })
+        .catch((err) => {
+          load.close();
+          this.$message.error(err);
+        });
     },
     getYearData() {
       return getYearData().then((res) => {
@@ -329,18 +335,31 @@ export default {
       if (this.validateForm()) {
         // this.$message.success("提交成功");
         // console.log(this.matchForm);
-        analysisMatch(this.matchForm).then(res=>{
-          // console.log(res,"test")
-          if(res && res?.rows){
-            this.total = res.total;
-            this.tableData = res.rows.map(item => {
-              return {
-                ...item,
-                trueThreshold: parseFloat(item.trueThreshold).toFixed(4) // 转换并保留4位小数
-              };
-            });
-          }
-        })
+        this.tableData = [];
+        const loading = this.$loading({
+          lock: true,
+          text: "Loading",
+          spinner: "el-icon-loading",
+          background: "rgba(0, 0, 0, 0.7)",
+        });
+        analysisMatch(this.matchForm)
+          .then((res) => {
+            loading.close();
+            // console.log(res,"test")
+            if (res && res?.rows) {
+              this.total = res.total;
+              this.tableData = res.rows.map((item) => {
+                return {
+                  ...item,
+                  trueThreshold: parseFloat(item.trueThreshold).toFixed(4), // 转换并保留4位小数
+                };
+              });
+            }
+          })
+          .catch((err) => {
+            loading.close();
+            this.$message.error(err);
+          });
       }
     },
     clearUnrelatedFields() {

+ 90 - 4
src/views/priceindex/priceindex/index.vue

@@ -90,6 +90,16 @@
           v-hasPermi="['priceindex:priceindex:export']"
         >导出</el-button>
       </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="info"
+          icon="el-icon-upload2"
+          size="mini"
+          @click="handleImport"
+          v-hasPermi="['priceindex:priceindex:import']"
+          >导入</el-button
+        >
+      </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
@@ -159,12 +169,47 @@
         <el-button @click="cancel">取 消</el-button>
       </div>
     </el-dialog>
+    <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px">
+      <el-upload
+        ref="upload"
+        :limit="1"
+        accept=".xlsx, .xls"
+        :headers="upload.headers"
+        :action="upload.url"
+        :disabled="upload.isUploading"
+        :on-progress="handleFileUploadProgress"
+        :on-success="handleFileSuccess"
+        :auto-upload="false"
+        drag
+      >
+        <i class="el-icon-upload"></i>
+        <div class="el-upload__text">
+          将文件拖到此处,或
+          <em>点击上传</em>
+        </div>
+        <div class="el-upload__tip" slot="tip">
+          <el-link
+            type="primary"
+            style="font-size: 12px"
+            @click="importTemplate"
+            >点击此处下载文件上传模板</el-link
+          >
+        </div>
+        <div class="el-upload__tip" style="color: red" slot="tip">
+          提示:仅允许导入“xls”或“xlsx”格式文件!
+        </div>
+      </el-upload>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitFileForm">确 定</el-button>
+        <el-button @click="upload.open = false">取 消</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
 <script>
 import { listPriceindex, getPriceindex, delPriceindex, addPriceindex, updatePriceindex } from "@/api/priceindex/priceindex";
-
+import { getToken } from "@/utils/auth";
 export default {
   name: "Priceindex",
   data() {
@@ -202,7 +247,20 @@ export default {
       form: {},
       // 表单校验
       rules: {
-      }
+      },
+      upload: {
+        // 是否显示弹出层(用户导入)
+        open: false,
+        // 弹出层标题(用户导入)
+        title: "",
+        // 是否禁用上传
+        isUploading: false,
+        // 是否更新已经存在的用户数据
+        // 设置上传的请求头部
+        headers: { Authorization: "Bearer " + getToken() },
+        // 上传的地址
+        url: process.env.VUE_APP_BASE_API + "/priceindex/priceindex/importData",
+      },
     };
   },
   created() {
@@ -291,7 +349,7 @@ export default {
     /** 删除按钮操作 */
     handleDelete(row) {
       const ids = row.id || this.ids;
-      this.$modal.confirm('是否确认删除priceindex编号为"' + ids + '"的数据项?').then(function() {
+      this.$modal.confirm('是否确认删除编号为"' + ids + '"的数据项?').then(function() {
         return delPriceindex(ids);
       }).then(() => {
         this.getList();
@@ -303,7 +361,35 @@ export default {
       this.download('priceindex/priceindex/export', {
         ...this.queryParams
       }, `priceindex_${new Date().getTime()}.xlsx`)
-    }
+    },
+    handleImport() {
+      this.upload.title = "数据导入";
+      this.upload.open = true;
+    },
+    /** 下载模板操作 */
+    importTemplate() {
+      this.download(
+        "priceindex/priceindex/importTemplate",
+        {},
+        `priceindex_template_${new Date().getTime()}.xlsx`
+      );
+    },
+    // 文件上传中处理
+    handleFileUploadProgress(event, file, fileList) {
+      this.upload.isUploading = true;
+    },
+    // 文件上传成功处理
+    handleFileSuccess(response, file, fileList) {
+      this.upload.open = false;
+      this.upload.isUploading = false;
+      this.$refs.upload.clearFiles();
+      this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
+      this.getList();
+    },
+    // 提交上传文件
+    submitFileForm() {
+      this.$refs.upload.submit();
+    },
   }
 };
 </script>

+ 1 - 1
vue.config.js

@@ -35,7 +35,7 @@ module.exports = {
     proxy: {
       // detail: https://cli.vuejs.org/config/#devserver-proxy
       [process.env.VUE_APP_BASE_API]: {
-        target: `http://localhost:8080`,
+        target: `http://127.0.0.1:8080`,
         changeOrigin: true,
         pathRewrite: {
           ['^' + process.env.VUE_APP_BASE_API]: ''