Browse Source

意向地块和备选地块进行基准地价分析

maxiaoxiao 6 tháng trước cách đây
mục cha
commit
e05d07c008
1 tập tin đã thay đổi với 115 bổ sung8 xóa
  1. 115 8
      src/views/siteselection/components/xzjg.vue

+ 115 - 8
src/views/siteselection/components/xzjg.vue

@@ -18,9 +18,13 @@
         <span @click="download(true)" class="export">导出报告</span>
       </div>
       <div class="bxCon" style="height: 90%">
-        <el-collapse accordion v-model="activeNames">
+        <el-collapse
+          accordion
+          v-model="activeNames1"
+          @change="(v) => getLandPrices(v, 0)"
+        >
           <el-collapse-item
-            :name="'gb' + index1"
+            :name="index1"
             v-for="(item1, index1) in bgList"
             :key="index1"
           >
@@ -45,8 +49,12 @@
               <p style="color: #cddeeb">
                 <img src="/static/images/ghzc/iconSun.png" />
                 <span style="margin-left: 20px">基准地价:</span
-                ><span style="color: #02a7f0"
-                  >{{ item1.landPrice || 0 }}万元</span
+                ><span style="color: #02a7f0">
+                  {{
+                    item1.totalLandPrice
+                      ? item1.totalLandPrice + "万元"
+                      : "分析中"
+                  }}</span
                 >
               </p>
             </div>
@@ -61,7 +69,11 @@
         </span>
       </div>
       <div class="bxCon">
-        <el-collapse accordion v-model="activeNames">
+        <el-collapse
+          accordion
+          v-model="activeNames"
+          @change="(v) => getLandPrices(v, 1)"
+        >
           <el-collapse-item
             :name="index"
             v-for="(item, index) in xzjgObj.dks"
@@ -107,9 +119,9 @@
                 <!-- <i class="iconSun"></i> -->
                 <img src="/static/images/ghzc/iconSun.png" />
                 <span style="margin-left: 20px">基准地价:</span
-                ><span style="color: #02a7f0"
-                  >{{ item.landPrice || 0 }}万元</span
-                >
+                ><span style="color: #02a7f0">{{
+                  item.totalLandPrice ? item.totalLandPrice + "万元" : "分析中"
+                }}</span>
               </p>
             </div>
           </el-collapse-item>
@@ -151,6 +163,19 @@ import { WriteWkt, DownFile } from "@/api/cockpitNew";
 // 使用
 import parse from "wellknown";
 import * as turf from "@turf/turf";
+import { v4 as uuidv4 } from "uuid";
+import moment from "moment";
+import {
+  getJZDJWord,
+  listBenchmarkLandPrices,
+  addBenchmarkLandPrices,
+  updateBenchmarkLandPrices,
+  addZtBenchmarkLandPriceResults,
+  getBenchmarkLandPrices,
+  listZtBenchmarkLandPriceResults,
+  getAnalyseResult,
+  delBenchmarkLandPrices,
+} from "@/api/zt/ztApi.js";
 let dataSources = {};
 export default {
   components: { dkDetails },
@@ -536,6 +561,88 @@ export default {
       viewer.entities.removeAll();
       viewer.dataSources.removeAll();
     },
+    getLandPrices(val, listi) {
+      let data = listi ? this.xzjgObj.dks : this.bgList;
+      console.log(data, this.bgList, val, "geom");
+      let coordinates = parse(data[val].geom).coordinates;
+      let ProjectScope = [];
+      for (var i = 0; i < coordinates.length; i++) {
+        var coor = coordinates[i];
+        if (coor && coor.length > 0) {
+          for (var j = 0; j < coor.length; j++) {
+            ProjectScope.push({ x: coor[j][0], y: coor[j][1] });
+          }
+        }
+      }
+      console.log(ProjectScope, "geom");
+      this.submitForm(ProjectScope, val, listi);
+    },
+    async submitForm(ProjectScope, val,listi) {
+      let that = this;
+      // that.loading = true;
+
+      // var area = await that.getRegionArea() / 666.66;
+      // if (area > 3000) {
+      //   this.clear();
+      //   that.loading = false;
+      //   that.$alert("项目范围不要超过3000亩,请重新输入项目范围", "警告");
+      //   return false;
+      // }
+      that.$message({
+        message: "开始分析",
+        type: "success",
+      });
+      let form = {
+        id: uuidv4(),
+        analysisDate: moment(new Date()).format("YYYY-MM-DD HH:mm:ss"),
+        AnalysisStatus: "正在分析",
+        ProjectScope: JSON.stringify(ProjectScope),
+      };
+
+      var rownum = await addBenchmarkLandPrices(form);
+      if (rownum.code == 200) {
+        let data = JSON.parse(JSON.stringify(form));
+        let response = await getAnalyseResult(data);
+
+        // that.loading = false;
+        if (response) {
+          response.id = uuidv4();
+          response.BenchmarkLandPriceid = data.id;
+          var urownum = await updateBenchmarkLandPrices({
+            id: data.id,
+            AnalysisStatus: "完成",
+          });
+          if (urownum.code == 200) {
+            await addZtBenchmarkLandPriceResults(response);
+            var partres = await listZtBenchmarkLandPriceResults({
+              BenchmarkLandPriceid: data.id,
+            });
+            if (listi)
+              this.$set(
+                this.xzjgObj.dks[val],
+                "totalLandPrice",
+                partres.rows[0].totalLandPrice
+              );
+            else
+              this.$set(
+                this.bgList[val],
+                "totalLandPrice",
+                partres.rows[0].totalLandPrice
+              );
+          }
+          // await that.openAnalyzeResults(data.id);
+        } else {
+          that.$message.error("分析异常");
+          var urownum = await updateBenchmarkLandPrices({
+            id: data.id,
+            AnalysisStatus: "异常",
+          });
+        }
+      } else {
+        // that.loading = false;
+        this.$message.error("项目保存失败");
+      }
+    },
   },
   beforeResolve(to, from, next) {
     console.log(to, from, next, "to, from, next");