Browse Source

招商评估管理增加年度选项

littleblue55 1 month ago
parent
commit
242d0be1fe
1 changed files with 42 additions and 8 deletions
  1. 42 8
      src/views/investment/index.vue

+ 42 - 8
src/views/investment/index.vue

@@ -50,7 +50,7 @@
             placeholder="请输入企业年实缴税金"
             clearable
           /> -->
-          <div style="display: flex; align-items: cente">
+          <div style="display: flex; align-items: center">
             <el-input
               v-model.number="form.newYearTax"
               placeholder="请输入企业年实缴税金"
@@ -59,6 +59,17 @@
             <p style="flex: 0 0 auto; margin: 0 10px">万元</p>
           </div>
         </el-form-item>
+        <el-form-item label="年度" style="margin-bottom: 0" label-width="100px" prop="selectedYear">
+          <el-select v-model="form.selectedYear" style="width: 100%">
+            <el-option
+              v-for="item in selectedYearArray"
+              :key="item.key"
+              :label="item.value"
+              :value="item.key"
+            >
+            </el-option>
+          </el-select>
+        </el-form-item>
         <el-form-item label-width="100px">
           <el-button type="primary" size="mini" @click="submit">计算</el-button>
           <el-button icon="el-icon-refresh" size="mini" @click="resetForm"
@@ -103,6 +114,7 @@ import { listAllIndustry_run } from "@/api/industry_run/industry_run"; // 导入
 require("echarts/theme/macarons"); // echarts theme
 import resize from "@/views/dashboard/mixins/resize";
 import { Decimal } from "decimal.js";
+import { getIndexData } from "@/api/home";
 
 export default {
   mixins: [resize],
@@ -122,6 +134,7 @@ export default {
   },
   data() {
     return {
+      selectedYearArray: [],
       calShow: "init",
       rate: null,
       chart: null,
@@ -133,6 +146,7 @@ export default {
         selectedCode: null,
         newMonthValue: null,
         newYearTax: null,
+        selectedYear: null
       },
       rules: {
         selectedCode: [
@@ -153,6 +167,9 @@ export default {
             trigger: "blur",
           },
         ],
+        selectedYear: [
+          { required: true, message: "请选择年度", trigger: "blur" },
+        ]
       },
       selectedIndustryArray: [],
       selectedYear: null,
@@ -176,11 +193,11 @@ export default {
   },
   methods: {
     // 拉取初始数据
-    fetchData() {
+    async fetchData() {
       const that = this;
       // 获得所有行业
-      that.selectedYear = new Date().getUTCFullYear() + "";
-      listAllIndustry()
+      // that.selectedYear = new Date().getUTCFullYear() + "";
+      await listAllIndustry()
         .then((res) => {
           if (res && res?.rows) {
             that.selectedIndustryArray = res.rows.map((item) => {
@@ -194,6 +211,23 @@ export default {
         .catch((error) => {
           console.error("Error fetching data:", error);
         });
+
+      await getIndexData({
+        year: 0,
+      })
+        .then((res) => {
+          if (res && res?.rows) {
+            that.selectedYearArray = res.rows[0].years.map((v) => {
+              return {
+                key: v,
+                value: v,
+              };
+            });
+          }
+        })
+        .catch((error) => {
+          console.error("Error fetching data:", error);
+        });
     },
     // 提交表单
     submit() {
@@ -214,7 +248,7 @@ export default {
       const that = this;
       listAllIndustry_run({
         code: that.form.selectedCode,
-        year: that.selectedYear,
+        year: that.form.selectedYear,
       })
         .then((res) => {
           if (res && res.rows) {
@@ -471,7 +505,7 @@ export default {
           },
         },
         legend: {
-          data: [`${that.selectedYear}工业生产总值企业数统计`, "正态分布"],
+          data: [`${that.form.selectedYear}工业生产总值企业数统计`, "正态分布"],
         },
         grid: {
           left: "3%",
@@ -503,7 +537,7 @@ export default {
         ],
         series: [
           {
-            name: `${that.selectedYear}工业生产总值企业数统计`,
+            name: `${that.form.selectedYear}工业生产总值企业数统计`,
             type: "bar",
             barWidth: "30%",
             itemStyle: {
@@ -568,7 +602,7 @@ export default {
             return {
               totalIndustrialValue: item.totalIndustrialValue.toFixed(2),
               enterpriseId: item.name,
-              year: that.selectedYear,
+              year: that.form.selectedYear,
               value: item.score.toFixed(2),
             };
           });