Эх сурвалжийг харах

中图BenchmarkLandPriceAnalysis文件夹更新

lkk 11 сар өмнө
parent
commit
dd8ee834f3

+ 762 - 0
src/views/ConstructionApplication3D/BenchmarkLandPriceAnalysis/BenchmarkLandPriceAnalysis/BenchmarkLandPrice.vue

@@ -0,0 +1,762 @@
+<template>
+  <div
+    class="ZTGlobal"
+    style="width: 100%; padding: 1rem 1rem 0rem 1rem; color: white"
+  >
+    <el-row :gutter="10">
+      <el-col :span="24">
+        根据2020年《三亚市国有建设用地土地定级与基准地价》和《三亚市集体建设用地土地定级与基准地价》编制成果,实现指定范围基准地价的自动预估。
+        <el-link type="primary" @click="jzdjsmShow">更多>></el-link>
+      </el-col>
+    </el-row>
+    <el-row :gutter="10">
+      <el-col :span="24">
+        <el-tabs
+          v-model="activeName"
+          style="height: 100%"
+          @tab-click="handleClick"
+        >
+          <el-tab-pane label="拆迁补偿预估" name="first">
+            <el-form
+              ref="ruleForm"
+              :model="form"
+              :rules="rules"
+              label-width="90px"
+            >
+              <el-form-item label="项目名称" size="mini" prop="ProjectName">
+                <el-col :span="20">
+                  <el-input size="mini" v-model="form.ProjectName"></el-input>
+                </el-col>
+              </el-form-item>
+              <el-form-item label="项目类型" size="mini" prop="ProjectType">
+                <el-col :span="20">
+                  <!-- <el-select
+                    v-model="form.ProjectType"
+                    placeholder="请选择土地用途"
+                    clearable
+                    @change="handleChange"
+                  >
+                    <el-option
+                      v-for="dict in zt_jzdj_LandUse"
+                      :key="dict.value"
+                      :label="dict.label"
+                      :value="dict.value"
+                    />
+                  </el-select> -->
+                  <!-- <el-cascader
+                    placeholder="请选择土地用途"
+                    v-model="form.ProjectType"
+                    :options="landUseNatureRelation"
+                    :show-all-levels="false"
+                    clearable
+                    @change="handleChange"
+                    :props="{
+                      value: 'tdyt',
+                      label: 'tdyt',
+                      children: 'children',
+                      emitPath: false,
+                    }"
+                  ></el-cascader> -->
+                  <el-input size="mini" v-model="form.ProjectType"></el-input>
+                </el-col>
+              </el-form-item>
+              <el-form-item label="选址范围" size="mini" prop="ProjectScope">
+                <el-col :span="20">
+                  <input @change="handleUpload" type="file" style="display:none" id="fileInput" accept=".zip"></input>
+            <el-button type="primary" @click="inputGeometry">导入范围</el-button>
+                  <!-- <el-button type="primary">导入范围</el-button> -->
+                  <el-button type="primary" @click="getProjectScope"
+                    >绘制范围</el-button
+                  >
+                </el-col>
+              </el-form-item>
+              <el-form-item
+                label="建设单位"
+                size="mini"
+                prop="ConstructionUnit"
+              >
+                <el-col :span="20">
+                  <el-input
+                    size="mini"
+                    v-model="form.ConstructionUnit"
+                  ></el-input>
+                </el-col>
+              </el-form-item>
+            </el-form>
+            <div class="SaveCenter">
+              <el-button type="primary" @click="submitForm('ruleForm')"
+                >开始分析</el-button
+              >
+              <el-button @click="resetForm('ruleForm')">重置</el-button>
+            </div>
+          </el-tab-pane>
+          <el-tab-pane label="分析记录" name="second">
+            <el-row :gutter="10">
+              <el-col :span="10">
+                <el-input
+                  size="mini"
+                  placeholder="请输入项目名称"
+                  v-model="input3"
+                  class="input-with-select"
+                >
+                  <el-button slot="append" icon="el-icon-search"></el-button>
+                </el-input>
+              </el-col>
+              <el-col :span="14">
+                <el-date-picker
+                  size="mini"
+                  v-model="value1"
+                  type="daterange"
+                  range-separator=""
+                  start-placeholder="开始日期"
+                  end-placeholder="结束日期"
+                >
+                </el-date-picker>
+              </el-col>
+            </el-row>
+            <el-row>
+              <el-col>
+                <el-row
+                  :gutter="10"
+                  v-for="itemModel in BenchmarkLandPriceList"
+                  :key="itemModel.id"
+                >
+                  <el-col :span="24">
+                    <el-card shadow="hover" class="card_body_style hover_style">
+                      <el-row>
+                        <el-col :span="24">
+                          {{ itemModel.ProjectName }}
+                        </el-col>
+                      </el-row>
+                      <el-row>
+                        <el-col :span="24">
+                          {{ itemModel.analysisDate }}
+                        </el-col>
+                      </el-row>
+                      <el-row>
+                        <el-col :span="12">
+                          <el-button
+                            v-if="itemModel.AnalysisStatus == '完成'"
+                            size="mini"
+                            type="primary"
+                            >{{ itemModel.AnalysisStatus }}</el-button
+                          >
+                          <el-button
+                            v-if="itemModel.AnalysisStatus == '正在分析'"
+                            size="mini"
+                            type="success"
+                            >{{ itemModel.AnalysisStatus }}</el-button
+                          >
+                          <el-button
+                            v-if="itemModel.AnalysisStatus == '异常'"
+                            size="mini"
+                            type="danger"
+                            >{{ itemModel.AnalysisStatus }}</el-button
+                          >
+                        </el-col>
+                        <el-col :span="12">
+                          <div style="float: right">
+                            <!-- <el-button size="mini" type="default">日志</el-button> -->
+                            <el-button
+                              size="mini"
+                              type="default"
+                              @click="openAnalyzeResults(itemModel)"
+                              >结果</el-button
+                            >
+                            <el-button
+                              size="mini"
+                              type="default"
+                              @click="handleGetBG(itemModel)"
+                              >报告</el-button
+                            >
+                          </div>
+                        </el-col>
+                      </el-row>
+                    </el-card>
+                  </el-col>
+                </el-row>
+              </el-col>
+            </el-row>
+          </el-tab-pane>
+        </el-tabs>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+<script>
+import { v4 as uuidv4 } from "uuid";
+import moment from "moment";
+import jzdjfxsmInfo from "./jzdjfxsmInfo.vue";
+import jzdjfxsmjg from "./jzdjfxsmjg.vue";
+import {
+  cartesian3ToWGS84,
+  mapQuery,
+  flatten,
+  mercator2lonLat,
+  undergroundMode,
+} from "@/utils/MapHelper/MapHelper.js";
+import {
+  booleanContains,
+  area,
+  intersect,
+  polygon,
+  point,
+  midpoint,
+  difference,
+} from "@turf/turf";
+import { getJZDJWord, getWord } from "@/api/zt/ztApi.js";
+let handlerPolygon;var polygonEntity = null;
+export default {
+  data() {
+    return {
+      landUseNatureRelation: window.landUseNatureRelation,
+      tooltip: createTooltip(document.body),
+      /**
+       * tabs 标签
+       */
+      activeName: "first",
+      //绘制事件
+      // handlerPolygon: null,
+
+      form: {
+        id: "",
+        ProjectScope: [],
+        ProjectName: "",
+        ProjectType: "",
+        ConstructionUnit: "",
+        ReportPath: "",
+      },
+      rules: {
+        ProjectName: [
+          { required: true, message: "请输入项目名称", trigger: "blur" },
+        ],
+        ProjectScope: [
+          { required: true, message: "请添加项目范围", trigger: "blur" },
+        ],
+        ProjectType: [
+          { required: true, message: "请选择土地用途", trigger: "blur" },
+        ],
+      },
+      BenchmarkLandPriceList: [],
+      LayerData: {
+        GHDKData: [],
+      },
+    };
+  },
+  mounted() {
+    this.init();
+  },
+  methods: {
+    init() {
+      this.BenchmarkLandPriceList = window.BenchmarkLandPriceList;
+    },
+    /**
+     * tas切换
+     * @param {String} tab
+     * @param {Object} event
+     */
+    handleClick(tab, event) {
+      console.log(tab, event);
+    },
+
+    /**
+     *基准地价说明
+     */
+    jzdjsmShow() {
+      var that = this;
+      if (that.layerid) that.$layer.close(that.layerid);
+      var width = "40rem";
+      var height = "30rem";
+
+      that.layerid = that.$layer.iframe({
+        content: {
+          content: jzdjfxsmInfo, //传递的组件对象
+          parent: this, //当前的vue对象
+          data: {}, //props
+        },
+
+        area: [width.toString(), height.toString()],
+        title: "基准地价分析说明",
+        maxmin: false,
+        shade: false, //是否显示遮罩
+        shadeClose: false, //点击遮罩是否关闭
+        cancel: () => {
+          //关闭事件
+          // alert("关闭iframe");
+        },
+      });
+    },
+    /**
+     * 绘制范围
+     */
+    getProjectScope() {
+      let that = this;
+      this.clearScope();
+      handlerPolygon = new Cesium.DrawHandler(
+        viewer,
+        Cesium.DrawMode.Polygon,
+        Cesium.ClampMode.Space
+      );
+      handlerPolygon.activate();
+      handlerPolygon.activeEvt.addEventListener(function (isActive) {
+        if (isActive == true) {
+          // viewer.enableCursorStyle = false;
+          // viewer._element.style.cursor = "";
+          document.body.classList.add("drawCur");
+        } else {
+          // viewer.enableCursorStyle = true;
+          document.body.classList.remove("drawCur");
+        }
+      });
+      handlerPolygon.movingEvt.addEventListener((windowPosition) => {
+        that.tooltip.showAt(
+          windowPosition,
+          "<p>点击鼠标左键开始绘制分析区域</p>"
+        );
+      });
+      handlerPolygon.drawEvt.addEventListener((result) => {
+        that.tooltip.setVisible(false);
+        var polygon = result.object;
+        if (!polygon) {
+          return;
+        }
+        let points = [];
+        let positions = polygon.positions;
+        //遍历多边形,取出所有点
+        for (var i = 0, len = positions.length; i < len; i++) {
+          let xyz = cartesian3ToWGS84(positions[i]);
+          points.push({ x: xyz.lng, y: xyz.lat, z: xyz.alt });
+        }
+        if (points.length > 0) {
+          if (points[0] != points[points.length - 1]) {
+            points.push(points[0]);
+          }
+        }
+        that.form.ProjectScope = points;
+        // if (this.calculateBooleanContains(positions)) {
+        //   that.form.ProjectScope = points;
+        // } else {
+        //   this.$message.error("请在规划地块范围内选择范围");
+        // }
+      });
+    },
+    submitForm(formName) {
+      let that = this;
+      this.$refs[formName].validate((valid) => {
+        if (valid) {
+          that.form.id = uuidv4();
+          that.form.analysisDate = moment(new Date()).format(
+            "YYYY-MM-DD HH:mm:ss"
+          );
+          that.form.AnalysisStatus = "完成";
+          window.BenchmarkLandPriceList.push(
+            JSON.parse(JSON.stringify(that.form))
+          );
+          debugger;
+          that.openAnalyzeResults(JSON.parse(JSON.stringify(that.form)));
+          that.resetForm(formName);
+          that.$message({
+            message: "开始分析",
+            type: "success",
+          });
+        } else {
+          return false;
+        }
+      });
+    },
+    resetForm(formName) {
+      this.clear();
+      this.$refs[formName].resetFields();
+    },
+    /**
+     * 点击导入范围
+     */
+     inputGeometry() {
+      var element = document.getElementById('fileInput')
+      // debugger
+      // document.getElementsByClassName("el-upload__input")= ""
+      if (element)
+        element.click();
+
+    },
+    handleUpload(event) {
+      this.clearScope();
+      debugger
+      
+      // let fileName = document.getElementsByClassName("el-upload__input")[0].value
+      let fileName = event.target.files[0];
+      var size = fileName.size
+      if (size > 512*1024) {
+        {
+          this.$message("文件大小超限,请重新输入!");
+          event.target.value = ''
+          return
+        }
+      }
+      let reader = new FileReader();
+      var geojson;
+      var that = this
+
+      reader.readAsArrayBuffer(fileName);
+      reader.onload = function (e) {
+        debugger;
+        let res = e.target.result; //ArrayBuffer
+        shp(res)
+          .then(function (res) {
+            // self.addGeometry(res)
+            geojson = res;
+            console.log(geojson);
+            that.addGeometry(geojson)
+          })
+          .catch(function (e) {
+            console.log(e);
+          });
+        event.target.value = ''
+      };
+      // this.parsingZip();
+    },
+        /**
+     * 导入范围添加图形
+     */
+     addGeometry(geojson) {
+      var that = this;
+      debugger
+      var coordinates = geojson.features[0].geometry.coordinates;
+      var box = geojson.features[0].geometry.bbox;
+      var centerX = (box[0] + box[2]) / 2;
+      var centerY = (box[1] + box[3]) / 2;
+      var positions = [];
+      that.form.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++) {
+            that.form.ProjectScope.push({ x: coor[j][0], y: coor[j][1] })
+            positions.push(coor[j][0])
+            positions.push(coor[j][1])
+          }
+        }
+      }
+      viewer.entities.removeById('polygon');
+      polygonEntity = new Cesium.Entity({
+        id:'polygon',
+
+        position: Cesium.Cartesian3.fromDegreesArray([
+          centerX,
+          centerY,
+        ]),
+        // classificationType: ClassificationType.TERRAIN,
+        polygon: {
+          hierarchy: new Cesium.PolygonHierarchy(
+            new Cesium.Cartesian3.fromDegreesArray(positions)
+          ),
+          // positions: new Cesium.Cartesian3.fromDegreesArray(positions),
+          material: new Cesium.Color(255 / 255, 211 / 255, 128 / 255, 1),
+          outline: true,
+          outlineColor: Cesium.Color.BLACK,
+          outlineWidth: 1.0,
+        },
+      });
+      
+      viewer.entities.add(polygonEntity);
+      viewer.flyTo(polygonEntity)
+    },
+
+    /**
+     * 打开分析结果弹窗
+     * @param BenchmarkLandPrice 基准地价信息
+     */
+    openAnalyzeResults(BenchmarkLandPrice) {
+      if (this.FXJGInfolayerid) {
+        this.$layer.close(this.FXJGInfolayerid);
+      }
+      let that = this;
+      let w = document.body.offsetWidth;
+      let h = document.body.offsetHeight;
+      //左上角(left=弹窗宽/2;top=弹窗高/2+header高)
+      //右上角 (left=w-弹窗宽+(弹窗宽/2);top=弹窗高/2+header高);
+      let left = w - 430 + 430 / 2;
+      let top = 830 / 2 + 60;
+      this.FXJGInfolayerid = this.$layer.iframe({
+        content: {
+          content: jzdjfxsmjg, //传递的组件对象
+          parent: this, //当前的vue对象
+          data: { info: { BenchmarkLandPrice } }, //props
+        },
+        offset: [left, top], //left top
+        area: ["430px", "830px"], //宽 高
+        title: "分析结果",
+        maxmin: false,
+        shade: false, //是否显示遮罩
+        shadeClose: false, //点击遮罩是否关闭
+        cancel: () => {},
+      });
+    },
+    //切换用地类型时加载用地规划图层
+    handleChange() {
+      this.clear();
+      if (this.form.ProjectType) {
+        this.getGHDK(this.form.ProjectType);
+      }
+    },
+    /**
+     * 查询区域内规划地块
+     * @param ProjectType
+     */
+    async getGHDK(ProjectType) {
+      let that = this;
+      //查询规划地块
+      let layer = flatten(window.layerTree).find(
+        (item) => item.core == "003006"
+      );
+      let sql = "";
+      let landUseNatureRelation = flatten(window.landUseNatureRelation).find(
+        (c) => c.tdyt == ProjectType
+      );
+      landUseNatureRelation.GHDKType.forEach((Type, i) => {
+        if (i == 0) {
+          sql += " KZXXGYDDM like '" + Type.ydxzdl + "%' ";
+        } else {
+          sql += "|| KZXXGYDDM like '" + Type.ydxzdl + "%' ";
+        }
+      });
+      if (sql == "") {
+        this.$message.error("当前土地用途类型未配置,请联系管理员");
+        return;
+      }
+      let queryByGeometryParameters = {
+        getFeatureMode: "SQL",
+        datasetNames: [
+          layer.date_server.dataSourceName +
+            ":" +
+            layer.date_server.datasetName,
+        ],
+        queryParameter: {
+          attributeFilter: sql,
+        },
+        hasGeometry: "true",
+        maxFeatures: 99999999,
+      };
+      let e = await mapQuery(
+        layer.date_server.url + "/featureResults.json?returnContent=true",
+        queryByGeometryParameters
+      );
+      if (e && e.totalCount > 0) {
+        e.features.forEach((feature) => {
+          let featureData = {
+            id: uuidv4(),
+            layerInfo: layer,
+            data: [],
+            geometry: feature.geometry,
+          };
+
+          feature.fieldNames.forEach((fieldName, i) => {
+            let Field = e.datasetInfos
+              ? e.datasetInfos[0].fieldInfos.find(
+                  (c) =>
+                    c.name &&
+                    c.name.toUpperCase() == fieldName.toUpperCase() &&
+                    c.name.toUpperCase().indexOf("SM") == -1
+                )
+              : null;
+            if (Field) {
+              featureData.data.push({
+                label: fieldName,
+                labelCN: Field ? Field.caption : fieldName,
+                value: e.features[0].fieldValues[i],
+              });
+            }
+          });
+
+          let point3ds = [];
+          let pointholes = [];
+          let startindex = 0;
+          for (
+            let index = 0;
+            index < featureData.geometry.parts.length;
+            index++
+          ) {
+            let thisps = [];
+            const endindex = startindex + featureData.geometry.parts[index];
+            let geometryPoints = featureData.geometry.points.slice(
+              startindex,
+              endindex
+            );
+            for (
+              let pointindex = 0;
+              pointindex < geometryPoints.length;
+              pointindex++
+            ) {
+              const point = geometryPoints[pointindex];
+              thisps.push(point.x);
+              thisps.push(point.y);
+            }
+            if (featureData.geometry.partTopo[index] === 1) {
+              point3ds.push(Cesium.Cartesian3.fromDegreesArray(thisps));
+            } else {
+              pointholes.push(Cesium.Cartesian3.fromDegreesArray(thisps));
+            }
+
+            startindex = endindex;
+          }
+
+          if (point3ds.length > 0 && pointholes.length > 0) {
+            let holes = [];
+            pointholes.forEach((hole) => {
+              holes.push({ positions: hole });
+            });
+
+            var orangePolygon1 = viewer.entities.add({
+              id: "GHDK-" + featureData.id,
+              polygon: {
+                hierarchy: {
+                  // Cesium.PolygonHierarchy
+                  positions: point3ds[0],
+                  holes: holes, // Cesium.PolygonHierarchy 数组
+                },
+                material: Cesium.Color.RED.withAlpha(0.4),
+                outline: true,
+                outlineColor: Cesium.Color.BLACK,
+                outlineWidth: 2.0,
+              },
+            });
+          } else if (point3ds.length > 0) {
+            var orangePolygon1 = viewer.entities.add({
+              id: "GHDK-" + featureData.id,
+              polygon: {
+                hierarchy: point3ds[0],
+                material: Cesium.Color.RED.withAlpha(0.4),
+                outline: true,
+                outlineColor: Cesium.Color.BLACK,
+                outlineWidth: 2.0,
+              },
+            });
+          }
+
+          that.LayerData.GHDKData.push(featureData);
+        });
+      }
+    },
+    async handleGetBG(item) {
+      debugger;
+      if (item.ReportPath != "") {
+        debugger;
+        await getWord({ fileName: item.ReportPath });
+      }
+    },
+    /**
+     * 与已有的规划地块比较看是否包含
+     * @param points
+     */
+    calculateBooleanContains(points) {
+      let DataPs = points.map((item) => {
+        let xyz = cartesian3ToWGS84(item);
+        return [xyz.lng, xyz.lat];
+      });
+      if (DataPs.length > 0) {
+        if (
+          JSON.stringify(DataPs[0]) != JSON.stringify(DataPs[DataPs.length - 1])
+        ) {
+          DataPs.push(DataPs[0]);
+        }
+        //绘制的图形边界
+        let polygonPs = polygon([DataPs]);
+        //规划地块的范围
+        for (let index = 0; index < this.LayerData.GHDKData.length; index++) {
+          const geometry = this.LayerData.GHDKData[index].geometry;
+
+          let point3ds = [];
+          let pointholes = [];
+          let startindex = 0;
+          for (let index = 0; index < geometry.parts.length; index++) {
+            let thisps = [];
+            const endindex = startindex + geometry.parts[index];
+            let geometryPoints = geometry.points.slice(startindex, endindex);
+            for (
+              let pointindex = 0;
+              pointindex < geometryPoints.length;
+              pointindex++
+            ) {
+              const point = geometryPoints[pointindex];
+              thisps.push([point.x, point.y]);
+            }
+            if (geometry.partTopo[index] === 1) {
+              point3ds.push(thisps);
+            } else {
+              pointholes.push(thisps);
+            }
+
+            startindex = endindex;
+          }
+
+          // 主多边形
+          var mainPolygon = polygon(point3ds);
+
+          // 岛洞多边形
+          var holePolygon = polygon(pointholes);
+
+          // 计算差集 得到有导洞的图形
+          var getdifference = difference(mainPolygon, holePolygon);
+          let areaPs = booleanContains(getdifference, polygonPs);
+          if (areaPs) {
+            return true;
+          }
+        }
+        return false;
+      } else {
+        return false;
+      }
+    },
+
+    clearGHDK() {
+      //删除规划地块图层
+      for (let index = 0; index < this.LayerData.GHDKData.length; index++) {
+        const element = this.LayerData.GHDKData[index];
+        viewer.entities.removeById("GHDK-" + element.id);
+      }
+      this.LayerData.GHDKData = [];
+    },
+    clearScope() {
+      if (polygonEntity) {
+        viewer.entities.remove(polygonEntity)
+      }
+      if (handlerPolygon) {
+        handlerPolygon.clear();
+        handlerPolygon.deactivate();
+        handlerPolygon = null;
+      }
+      this.tooltip.setVisible(false);
+    },
+    clear() {
+      this.clearScope();
+      this.clearGHDK();
+    },
+  },
+  beforeDestroy() {
+    this.clear();
+  },
+};
+</script>
+<style lang="scss">
+@import "@/../../zt.scss";
+</style>
+<style scoped>
+.el-date-editor--daterange.el-input__inner {
+  width: auto;
+  background-color: rgba(4, 28, 50, 0.5);
+  border: 1px solid rgba(15, 122, 200, 0.4);
+}
+.card_body_style {
+  border: 1px dashed #02a7f0;
+}
+.hover_style:hover {
+  border: 1px solid #02a7f0;
+}
+.con-col {
+  display: flex;
+  flex-flow: column nowrap;
+  justify-content: center;
+  align-items: center;
+  border-radius: 4px;
+}
+</style>

+ 104 - 0
src/views/ConstructionApplication3D/BenchmarkLandPriceAnalysis/BenchmarkLandPriceAnalysis/jzdjfxsmInfo.vue

@@ -0,0 +1,104 @@
+<template>
+  <div
+    class="ZTGlobal"
+    style="width: 100%; padding: 1rem 1rem 0rem 1rem; color: white"
+  >
+    <el-row :gutter="10">
+      <el-col :span="24">
+        根据2020年《三亚市国有建设用地土地定级与基准地价》和《三亚市集体建设用地土地定级与基准地价》编制成果,实现指定范围内国有建设用地和集体建设用的基准地价预估。
+      </el-col>
+    </el-row>
+    <el-row :gutter="10">
+      <el-col :span="24" style="text-align: center">
+        国有建设用地和集体建设用地基准地价内涵说明
+      </el-col>
+    </el-row>
+    <el-row :gutter="10">
+      <el-col :span="24">
+        <table
+          id="tab1"
+          style="
+            width: 100%;
+            height: 100%;
+            font-size: 12px;
+            text-align: center;
+            background-color: #1e3443;
+          "
+          cellspacing="0"
+          cellpadding="0"
+        >
+          <colgroup>
+            <col style="background-color: #0a2450" />
+          </colgroup>
+          <tr style="background-color: #0a2450">
+            <td>内涵</td>
+            <td>商服用地</td>
+            <td>住宅用地</td>
+            <td>工矿仓储用地</td>
+            <td colspan="2">公共服务项目用地<br />(一)</td>
+            <td>公共服务项目用地<br />(二)</td>
+          </tr>
+          <tr>
+            <td>评估基准日</td>
+            <td colspan="6">2019年7月1日</td>
+          </tr>
+          <tr>
+            <td>土地开发程度</td>
+            <td colspan="6">五通一平</td>
+          </tr>
+          <tr>
+            <td rowspan="2">设定容积率</td>
+            <td rowspan="2">2</td>
+            <td rowspan="2">2.5</td>
+            <td rowspan="2">1</td>
+            <td>中心城区</td>
+            <td>中心城区以外区域</td>
+            <td rowspan="2">1</td>
+          </tr>
+          <tr>
+            <td>1.5</td>
+            <td>1</td>
+          </tr>
+          <tr>
+            <td>土地使用年限</td>
+            <td>40年</td>
+            <td>70年</td>
+            <td>50年</td>
+            <td colspan="2">50年</td>
+            <td>50年</td>
+          </tr>
+          <tr>
+            <td>价格类型</td>
+            <td>平均楼面地价</td>
+            <td>平均楼面地价</td>
+            <td>地面地价</td>
+            <td colspan="2">地面地价</td>
+            <td>地面地价</td>
+          </tr>
+          <tr>
+            <td>备注</td>
+            <td colspan="6" style="text-align: left">
+              (1) 商服用地、住宅用地的价格表现形式为平均楼面地价;<br />
+              (2)五通一平:即宗地外通路、通给水、通排水、通电力、通电讯和宗地内土地平整;<br />
+              (3)
+              公共服务项目用地(一)指新闻出版、教育、科研、医疗卫生、社会福利、机关团体、文化设施、体育用地等项目用地;<br />
+              (4)公共服务项目用地
+              (二)指用于城乡基础设施的用地,包括公用设施、公园与绿地用地等项目用地;<br />
+              (5) 公共服务项目用地为非政府投资的公共服务用地价格
+            </td>
+          </tr>
+        </table>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+<style lang="scss">
+@import "@/../../zt.scss";
+</style>
+<style scoped>
+#tab1 table,
+th,
+td {
+  border: 1px solid rgb(255, 255, 255);
+}
+</style>

+ 1274 - 0
src/views/ConstructionApplication3D/BenchmarkLandPriceAnalysis/BenchmarkLandPriceAnalysis/jzdjfxsmjg.vue

@@ -0,0 +1,1274 @@
+<template>
+  <div
+    class="ZTGlobal"
+    style="width: 100%; padding: 1rem 1rem 0rem 1rem; color: white"
+  >
+    <el-row :gutter="10" style="display: flex; align-items: center">
+      <el-col :span="18">
+        {{ thisBenchmarkLandPrice.ProjectName }}
+      </el-col>
+      <el-col :span="6">
+        <el-button
+          :disabled="thisBenchmarkLandPrice.AnalysisStatus != '完成'"
+          size="mini"
+          type="default"
+          @click="handleGetBG"
+          >导出报告</el-button
+        >
+      </el-col>
+    </el-row>
+    <el-row :gutter="10" style="display: flex; align-items: center">
+      <el-col :span="24">
+        土地用途:
+        <el-select
+          size="mini"
+          v-model="jzdj_LandUse"
+          placeholder="请选择土地用途"
+          clearable
+          @change="handleChange"
+        >
+          <el-option
+            v-for="dict in zt_jzdj_LandUse"
+            :key="dict.value"
+            :label="dict.label"
+            :value="dict.value"
+          />
+        </el-select>
+      </el-col>
+    </el-row>
+    <el-row :gutter="10">
+      <el-col :span="12">
+        <el-row :gutter="10" class="container_center">
+          <el-col
+            :span="8"
+            class="container_center"
+            style="
+              height: 3rem;
+              background-color: rgba(2, 167, 240, 1);
+              border-radius: 6px;
+            "
+          >
+            <i style="font-size: 2rem" class="el-icon-office-building"></i>
+          </el-col>
+          <el-col
+            :span="16"
+            class="container_center"
+            style="justify-content: flex-start"
+          >
+            <div class="con-col" style="align-items: flex-start">
+              <a style="color: white">分析面积(亩)</a>
+              <a style="font-weight: bold; color: rgba(2, 167, 240, 1)">{{
+                (Number(formData.fxzmj) / 666.67).toFixed(2)
+              }}</a>
+            </div>
+          </el-col>
+        </el-row>
+      </el-col>
+      <el-col :span="12">
+        <el-row :gutter="10" class="container_center">
+          <el-col
+            :span="8"
+            class="container_center"
+            style="
+              height: 3rem;
+              background-color: rgba(2, 167, 240, 1);
+              border-radius: 6px;
+            "
+          >
+            <i style="font-size: 2rem" class="el-icon-bank-card"></i>
+          </el-col>
+          <el-col
+            :span="16"
+            class="container_center"
+            style="justify-content: flex-start"
+          >
+            <div class="con-col" style="align-items: flex-start">
+              <a style="color: white">总地价(万元)</a>
+              <a style="font-weight: bold; color: rgba(2, 167, 240, 1)">{{
+                (formData.zdj / 10000).toFixed(2)
+              }}</a>
+            </div>
+          </el-col>
+        </el-row>
+      </el-col>
+    </el-row>
+    <el-row :gutter="10">
+      <el-col :span="12">
+        <el-row :gutter="10" class="container_center">
+          <el-col
+            :span="8"
+            class="container_center"
+            style="
+              height: 3rem;
+              background-color: rgba(2, 167, 240, 1);
+              border-radius: 6px;
+            "
+          >
+            <i style="font-size: 2rem" class="el-icon-discount"></i>
+          </el-col>
+          <el-col
+            :span="16"
+            class="container_center"
+            style="justify-content: flex-start"
+          >
+            <div class="con-col" style="align-items: flex-start">
+              <a style="color: white">国有建设</a>
+              <a style="color: white">用地地价(万元)</a>
+              <a style="font-weight: bold; color: rgba(2, 167, 240, 1)">{{
+                (formData.gyzdj / 10000).toFixed(2)
+              }}</a>
+            </div>
+          </el-col>
+        </el-row>
+      </el-col>
+      <el-col :span="12">
+        <el-row :gutter="10" class="container_center">
+          <el-col
+            :span="8"
+            class="container_center"
+            style="
+              height: 3rem;
+              background-color: rgba(2, 167, 240, 1);
+              border-radius: 6px;
+            "
+          >
+            <i style="font-size: 2rem" class="el-icon-price-tag"></i>
+          </el-col>
+          <el-col
+            :span="16"
+            class="container_center"
+            style="justify-content: flex-start"
+          >
+            <div class="con-col" style="align-items: flex-start">
+              <a style="color: white">集体建设</a>
+              <a style="color: white">用地地价(万元)</a>
+              <a style="font-weight: bold; color: rgba(2, 167, 240, 1)">{{
+                (formData.jtzdj / 10000).toFixed(2)
+              }}</a>
+            </div>
+          </el-col>
+        </el-row>
+      </el-col>
+    </el-row>
+    <!-- <el-row :gutter="10" style="display: flex; align-items: center">
+      <el-col :span="24">
+        土地用途:
+        <el-select
+          size="mini"
+          v-model="jzdj_LandUse"
+          placeholder="请选择土地用途"
+          clearable
+        >
+          <el-option
+            v-for="dict in zt_jzdj_LandUse"
+            :key="dict.value"
+            :label="dict.label"
+            :value="dict.value"
+          />
+        </el-select>
+      </el-col>
+    </el-row> -->
+    <el-row :gutter="10">
+      <el-col :span="24">
+        <div id="echartFGY" ref="echartFGY" class="EchartsWH">
+          <div
+            id="GYEcharts"
+            ref="GYEcharts"
+            :style="{ width: '100%', height: '100%' }"
+          ></div>
+        </div>
+      </el-col>
+    </el-row>
+    <el-row :gutter="10">
+      <el-col :span="24">
+        <div id="echartFJT" ref="echartFJT" class="EchartsWH">
+          <div
+            id="JTEcharts"
+            ref="JTEcharts"
+            :style="{ width: '100%', height: '100%' }"
+          ></div>
+        </div>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+<script>
+import { v4 as uuidv4 } from "uuid";
+import moment from "moment";
+import elementResizeDetectorMaker from "element-resize-detector";
+import PlanningPlotInfo from "@/views/ConstructionApplication3D/PlanningPlot/PlanningPlotInfo.vue";
+import {
+  cartesian3ToWGS84,
+  mapQuery,
+  flatten,
+  mercator2lonLat,
+  undergroundMode,
+} from "@/utils/MapHelper/MapHelper.js";
+import {
+  area,
+  intersect,
+  polygon,
+  point,
+  midpoint,
+  difference,
+} from "@turf/turf";
+// import html2canvas from "html2canvas";
+import { getJZDJWord, getWord } from "@/api/zt/ztApi.js";
+export default {
+  data() {
+    return {
+      thisBenchmarkLandPrice: null,
+      //点查entities事件
+      getEntitiesHandler: {},
+      tooltip: createTooltip(document.body),
+      zt_jzdj_LandUse: window.dict.zt_jzdj_LandUse,
+      jzdj_LandUse: "商服用地",
+      GYmyChart: null,
+      JTmyChart: null,
+      formData: {
+        fxzmj: 0, //分析面积
+        zdj: 0,
+        gyzdj: 0, //国有总地价
+        jtzdj: 0, //集体总地价
+      },
+      LayerData: {
+        GYData: [],
+        JTData: [],
+        GHDKData: [],
+        JZDJData: [],
+      },
+    };
+  },
+  props: {
+    info: {
+      type: Object,
+      default: () => {
+        return {};
+      },
+    },
+    layerid: {
+      type: String,
+      default: "",
+    },
+    lydata: {
+      type: Object,
+      default: () => {
+        return {};
+      },
+    },
+    lyoption: {
+      type: Object,
+      default: () => {
+        return {};
+      },
+    },
+  },
+  created() {
+    debugger;
+    this.thisBenchmarkLandPrice = this.info.BenchmarkLandPrice;
+  },
+  mounted() {
+    const erd = elementResizeDetectorMaker();
+    let that = this;
+    erd.listenTo([this.$refs.echartFGY, this.$refs.echartFJT], () => {
+      that.$nextTick(() => {
+        //监听到事件后执行的业务逻辑
+        window.echarts.init(this.$refs.GYEcharts).resize();
+        window.echarts.init(this.$refs.JTEcharts).resize();
+      });
+    });
+    this.init();
+  },
+  methods: {
+    async init() {
+      this.initEntitiesHandler();
+      debugger;
+      this.DrawScope();
+      await this.CalculateAnalysisArea();
+      await this.getGYLandOwnership();
+      await this.getJTLandOwnership();
+      let entitys = [];
+      if (viewer.entities.getById("HZFW")) {
+        entitys.push(viewer.entities.getById("HZFW"));
+      }
+      this.LayerData.GYData.forEach((GYData) => {
+        if (viewer.entities.getById(GYData.id)) {
+          entitys.push(viewer.entities.getById(GYData.id));
+        }
+      });
+      this.LayerData.JTData.forEach((JTData) => {
+        if (viewer.entities.getById(JTData.id)) {
+          entitys.push(viewer.entities.getById(JTData.id));
+        }
+      });
+      viewer.flyTo(entitys);
+      await this.CalculateJZDJ();
+      // await this.getGHDK();
+      // await this.getJZDJ();
+      await this.initGY();
+      await this.initJT();
+    },
+    /**
+     * 渲染绘制范围
+     */
+    DrawScope() {
+      let ProjectScope = this.info.BenchmarkLandPrice.ProjectScope;
+      if (ProjectScope.length > 0) {
+        if (ProjectScope[0] != ProjectScope[ProjectScope.length - 1]) {
+          ProjectScope.push(ProjectScope[0]);
+        }
+        let points = ProjectScope.map((obj) => [obj.x, obj.y]).flat();
+        var orangePolygon1 = viewer.entities.add({
+          id: "HZFW",
+          polygon: {
+            hierarchy: Cesium.Cartesian3.fromDegreesArray(points),
+            material: Cesium.Color.RED.withAlpha(0.4),
+            outline: true,
+            outlineColor: Cesium.Color.BLACK,
+            outlineWidth: 2.0,
+          },
+        });
+      } else {
+        this.$message.error("请在传入分析范围");
+      }
+    },
+    /**
+     * 计算分析面积
+     */
+    CalculateAnalysisArea() {
+      this.formData.fxzmj = 0;
+      let points = this.info.BenchmarkLandPrice.ProjectScope;
+      let DataPs = points.map((item) => [item.x, item.y]);
+      if (DataPs.length > 0) {
+        if (
+          JSON.stringify(DataPs[0]) != JSON.stringify(DataPs[DataPs.length - 1])
+        ) {
+          DataPs.push(DataPs[0]);
+        }
+        let polygonPs = polygon([DataPs]);
+        let areaPs = area(polygonPs);
+        this.formData.fxzmj += +Number(areaPs).toFixed(2);
+      }
+    },
+    /**
+     * 计算基准地价
+     */
+    async CalculateJZDJ() {
+      let that = this;
+      debugger;
+      if (that.jzdj_LandUse) {
+        let landUseNatureRelation = flatten(window.landUseNatureRelation).find(
+          (c) => c.tdyt == that.jzdj_LandUse
+        );
+        if (landUseNatureRelation) {
+          let layerinfos = landUseNatureRelation.layerinfo;
+          for (let index = 0; index < layerinfos.length; index++) {
+            const layerinfo = layerinfos[index];
+            let layer = flatten(window.layerTree).find(
+              (item) => item.core == layerinfo.layerCore
+            );
+            if (layer && layer.date_server && layer.date_server.url) {
+              let points = this.info.BenchmarkLandPrice.ProjectScope;
+              let geo = {
+                id: 0,
+                style: null,
+                parts: [points.length],
+                points: points,
+                type: "REGION",
+                prjCoordSys: {
+                  epsgCode: null,
+                },
+              };
+              let queryByGeometryParameters = {
+                getFeatureMode: "SPATIAL",
+                datasetNames: [
+                  layer.date_server.dataSourceName +
+                    ":" +
+                    layer.date_server.datasetName,
+                ],
+                geometry: geo,
+                spatialQueryMode: "INTERSECT",
+                hasGeometry: "true",
+              };
+              let e = await mapQuery(
+                layer.date_server.url +
+                  "/featureResults.json?returnContent=true",
+                queryByGeometryParameters
+              );
+              if (e && e.totalCount > 0) {
+                e.features.forEach((feature) => {
+                  let layerData = {
+                    id: uuidv4(),
+                    layerInfo: layerinfo,
+                    data: [],
+                    geometry: feature.geometry,
+                  };
+                  feature.fieldNames.forEach((fieldName, i) => {
+                    let Field = e.datasetInfos
+                      ? e.datasetInfos[0].fieldInfos.find(
+                          (c) =>
+                            c.name &&
+                            c.name.toUpperCase() == fieldName.toUpperCase() &&
+                            c.name.toUpperCase().indexOf("SM") == -1
+                        )
+                      : null;
+                    if (Field) {
+                      layerData.data.push({
+                        label: fieldName,
+                        labelCN: Field ? Field.caption : fieldName,
+                        value: feature.fieldValues[i],
+                      });
+                    }
+                  });
+                  let ps = [];
+                  for (
+                    let index = 0;
+                    index < feature.geometry.points.length;
+                    index++
+                  ) {
+                    const element = feature.geometry.points[index];
+                    ps.push(element.x);
+                    ps.push(element.y);
+                  }
+                  // var orangePolygon1 = viewer.entities.add({
+                  //   id: uuidv4(),
+                  //   polygon: {
+                  //     hierarchy: Cesium.Cartesian3.fromDegreesArray(ps),
+                  //     material: Cesium.Color.FUCHSIA.withAlpha(0.4),
+                  //     outline: true,
+                  //     outlineColor: Cesium.Color.BLACK,
+                  //     outlineWidth: 2.0,
+                  //   },
+                  // });
+                  that.LayerData.JZDJData.push(layerData);
+                });
+              }
+            } else {
+              this.$message.error(
+                "服务编码【" +
+                  layerinfo.layerCore +
+                  "】配置不正确,请检查后重试"
+              );
+            }
+          }
+
+          //转换成超图格式面
+          let HZgeometry = {
+            partTopo: [1],
+            parts: [this.info.BenchmarkLandPrice.ProjectScope.length],
+            points: this.info.BenchmarkLandPrice.ProjectScope,
+          };
+          // 循环国有土地
+          that.LayerData.GYData.forEach((Data) => {
+            that.LayerData.JZDJData.forEach((JZDJ) => {
+              let area = that.calculateIntersectArea(
+                Data.geometry,
+                JZDJ.geometry,
+                HZgeometry
+              );
+              if (Number(area) > 0) {
+                let fromData = { area: area };
+                //土地级别
+                let tdjb = JZDJ.data.find(
+                  (c) => c.label == JZDJ.layerInfo.tdjbField
+                ).value;
+                fromData.tdjb = tdjb;
+                //单价
+                let dj = JZDJ.data.find(
+                  (c) => c.label == JZDJ.layerInfo.ydlxPriceField
+                ).value;
+                fromData.dj = Number(dj);
+                //占用面积地价
+                fromData.zdj = Number(area * dj);
+                Data.fromData.push(fromData);
+              }
+            });
+          });
+          // 循环国有土地
+          that.LayerData.JTData.forEach((Data) => {
+            that.LayerData.JZDJData.forEach((JZDJ) => {
+              let area = that.calculateIntersectArea(
+                Data.geometry,
+                JZDJ.geometry,
+                HZgeometry
+              );
+              if (Number(area) > 0) {
+                let fromData = { area: area };
+                //土地级别
+                let tdjb = JZDJ.data.find(
+                  (c) => c.label == JZDJ.layerInfo.tdjbField
+                ).value;
+                fromData.tdjb = tdjb;
+                //单价
+                let dj = JZDJ.data.find(
+                  (c) => c.label == JZDJ.layerInfo.ydlxPriceField
+                ).value;
+                fromData.dj = Number(dj);
+                //占用面积地价
+                fromData.zdj = Number(area * dj);
+
+                Data.fromData.push(fromData);
+              }
+            });
+          });
+
+          that.gyjtzdj();
+
+          setTimeout(function () {
+            that.setFXBG();
+          }, 4000); // 这里的3000毫秒等于3秒
+
+          debugger;
+        } else {
+          this.$message.error("未配置当前土地用途,请联系管理员添加");
+        }
+      } else {
+        this.$message.error("请在土地用途");
+      }
+    },
+    //计算国有和集体分别总地价
+    gyjtzdj() {
+      this.formData.zdj = 0;
+      this.formData.gyzdj = 0;
+      this.formData.jtzdj = 0;
+      this.LayerData.GYData.forEach((gyelement) => {
+        gyelement.fromData.forEach((element) => {
+          this.formData.gyzdj += element.zdj;
+        });
+      });
+      this.LayerData.JTData.forEach((jtelement) => {
+        jtelement.fromData.forEach((element) => {
+          this.formData.jtzdj += element.zdj;
+        });
+      });
+      // 循环得出总地价
+      //转换成超图格式面
+      let HZgeometry = {
+        partTopo: [1],
+        parts: [this.info.BenchmarkLandPrice.ProjectScope.length],
+        points: this.info.BenchmarkLandPrice.ProjectScope,
+      };
+      this.LayerData.JZDJData.forEach((JZDJ) => {
+        let area = this.calculateIntersectArea(JZDJ.geometry, HZgeometry);
+        if (Number(area) > 0) {
+          //单价
+          let djval = JZDJ.data.find(
+            (c) => c.label == JZDJ.layerInfo.ydlxPriceField
+          );
+          if (djval) {
+            this.formData.zdj += Number(area * Number(djval.value));
+          }
+        }
+      });
+    },
+
+    /**
+     * 查询区域内国有土地权属
+     */
+    async getGYLandOwnership() {
+      let that = this;
+      //查询国有使用权
+      let layer = flatten(window.layerTree).find(
+        (item) => item.core == "007001"
+      );
+      let points = this.info.BenchmarkLandPrice.ProjectScope;
+      let geo = {
+        id: 0,
+        style: null,
+        parts: [points.length],
+        points: points,
+        type: "REGION",
+        prjCoordSys: {
+          epsgCode: null,
+        },
+      };
+      let queryByGeometryParameters = {
+        getFeatureMode: "SPATIAL",
+        datasetNames: [
+          layer.date_server.dataSourceName +
+            ":" +
+            layer.date_server.datasetName,
+        ],
+        geometry: geo,
+        spatialQueryMode: "INTERSECT",
+        hasGeometry: "true",
+      };
+      let e = await mapQuery(
+        layer.date_server.url + "/featureResults.json?returnContent=true",
+        queryByGeometryParameters
+      );
+      if (e && e.totalCount > 0) {
+        e.features.forEach((feature) => {
+          let featureData = {
+            id: uuidv4(),
+            layerInfo: layer,
+            data: [],
+            fromData: [],
+            geometry: feature.geometry,
+          };
+
+          feature.fieldNames.forEach((fieldName, i) => {
+            let Field = e.datasetInfos
+              ? e.datasetInfos[0].fieldInfos.find(
+                  (c) =>
+                    c.name &&
+                    c.name.toUpperCase() == fieldName.toUpperCase() &&
+                    c.name.toUpperCase().indexOf("SM") == -1
+                )
+              : null;
+            if (Field) {
+              featureData.data.push({
+                label: fieldName,
+                labelCN: Field ? Field.caption : fieldName,
+                value: e.features[0].fieldValues[i],
+              });
+            }
+          });
+
+          let ps = [];
+          for (
+            let index = 0;
+            index < featureData.geometry.points.length;
+            index++
+          ) {
+            const element = featureData.geometry.points[index];
+            ps.push(element.x);
+            ps.push(element.y);
+          }
+
+          var orangePolygon1 = viewer.entities.add({
+            id: "GYTD-" + featureData.id,
+            polygon: {
+              hierarchy: Cesium.Cartesian3.fromDegreesArray(ps),
+              material: Cesium.Color.AQUAMARINE.withAlpha(0.4),
+              outline: true,
+              outlineColor: Cesium.Color.BLACK,
+              outlineWidth: 2.0,
+            },
+          });
+
+          that.LayerData.GYData.push(featureData);
+        });
+      }
+    },
+    /**
+     * 查询区域内集体土地权属
+     */
+    async getJTLandOwnership() {
+      let that = this;
+      //查询集体使用权
+      let layer = flatten(window.layerTree).find(
+        (item) => item.core == "007002"
+      );
+      let points = this.info.BenchmarkLandPrice.ProjectScope;
+      let geo = {
+        id: 0,
+        style: null,
+        parts: [points.length],
+        points: points,
+        type: "REGION",
+        prjCoordSys: {
+          epsgCode: null,
+        },
+      };
+      let queryByGeometryParameters = {
+        getFeatureMode: "SPATIAL",
+        datasetNames: [
+          layer.date_server.dataSourceName +
+            ":" +
+            layer.date_server.datasetName,
+        ],
+        geometry: geo,
+        spatialQueryMode: "INTERSECT",
+        hasGeometry: "true",
+      };
+      let e = await mapQuery(
+        layer.date_server.url + "/featureResults.json?returnContent=true",
+        queryByGeometryParameters
+      );
+      if (e && e.totalCount > 0) {
+        e.features.forEach((feature) => {
+          let featureData = {
+            id: uuidv4(),
+            layerInfo: layer,
+            data: [],
+            fromData: [],
+            geometry: feature.geometry,
+          };
+
+          feature.fieldNames.forEach((fieldName, i) => {
+            let Field = e.datasetInfos
+              ? e.datasetInfos[0].fieldInfos.find(
+                  (c) =>
+                    c.name &&
+                    c.name.toUpperCase() == fieldName.toUpperCase() &&
+                    c.name.toUpperCase().indexOf("SM") == -1
+                )
+              : null;
+            if (Field) {
+              featureData.data.push({
+                label: fieldName,
+                labelCN: Field ? Field.caption : fieldName,
+                value: e.features[0].fieldValues[i],
+              });
+            }
+          });
+
+          let ps = [];
+          for (
+            let index = 0;
+            index < featureData.geometry.points.length;
+            index++
+          ) {
+            const element = featureData.geometry.points[index];
+            ps.push(element.x);
+            ps.push(element.y);
+          }
+
+          var orangePolygon1 = viewer.entities.add({
+            id: "JTTD-" + featureData.id,
+            polygon: {
+              hierarchy: Cesium.Cartesian3.fromDegreesArray(ps),
+              material: Cesium.Color.ORANGE.withAlpha(0.4),
+              outline: true,
+              outlineColor: Cesium.Color.BLACK,
+              outlineWidth: 2.0,
+            },
+          });
+
+          that.LayerData.JTData.push(featureData);
+        });
+      }
+    },
+
+    initEntitiesHandler() {
+      debugger;
+      let that = this;
+      this.getEntitiesHandler = new Cesium.ScreenSpaceEventHandler(
+        scene.canvas
+      );
+      this.getEntitiesHandler.setInputAction(function (click) {
+        debugger;
+        let pick = viewer.scene.pick(click.position);
+        let id, info;
+        //集体所有权信息弹窗
+        if (pick && pick.id.id && pick.id.id.indexOf("JTTD") !== -1) {
+          id = pick.id.id.split("JTTD-")[1];
+          info = that.LayerData.JTData.find((c) => c.id == id);
+          that.openOBJInfo("集体所有权详情", info.data);
+        }
+        //国有所有权信息弹窗
+        if (pick && pick.id.id && pick.id.id.indexOf("GYTD-") !== -1) {
+          id = pick.id.id.split("GYTD-")[1];
+          info = that.LayerData.GYData.find((c) => c.id == id);
+          that.openOBJInfo("国有所有权详情", info.data);
+        }
+      }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
+    },
+    //打开用地红线信息弹窗
+    openOBJInfo(title, info) {
+      let w = document.body.offsetWidth;
+      let h = document.body.offsetHeight;
+      //左上角(left=弹窗宽/2;top=弹窗高/2+header高)
+      //右上角 (left=w-弹窗宽+(弹窗宽/2);top=弹窗高/2+header高);
+      let left = 430 / 2 + 556;
+      let top = 430 / 2 + 60;
+      this.$layer.iframe({
+        id: "OBJInfolayer",
+        content: {
+          content: PlanningPlotInfo, //传递的组件对象
+          parent: this, //当前的vue对象
+          data: { info }, //props
+        },
+        offset: [left, top], //left top
+        area: ["430px", "430px"], //宽 高
+        title: title,
+        maxmin: false,
+        shade: false, //是否显示遮罩
+        shadeClose: false, //点击遮罩是否关闭
+        cancel: () => {
+          //关闭事件
+          // alert("关闭iframe");
+        },
+      });
+    },
+    /**
+     * 打印分析报告
+     */
+    async handleGetBG() {
+      debugger;
+      if (this.info.BenchmarkLandPrice.ReportPath != "") {
+        debugger;
+        await getWord({ fileName: this.info.BenchmarkLandPrice.ReportPath });
+      }
+    },
+
+    /**
+     * 生成报告
+     */
+    async setFXBG() {
+      let that = this;
+      var promise = scene.outputSceneToFile();
+      // html2canvas(document.getElementById("cesiumContainer")).then(
+      Cesium.when(promise, async function (canvas) {
+        // 将canvas转换为base64图片
+        // let imageBase64 = canvas.toDataURL("image/jpeg");
+        let imageBase64 = canvas;
+        debugger;
+        let data = {
+          projectName: that.info.BenchmarkLandPrice.ProjectName, //项目名称
+          analysisDate: moment(new Date()).format("YYYY-MM-DD HH:mm:ss"), //分析时间
+          projectType: that.info.BenchmarkLandPrice.ProjectType, //项目类型
+          buildUnit: that.info.BenchmarkLandPrice.ConstructionUnit, //建设单位
+          analysisArea: that.formData.fxzmj, //分析面积(平方米)
+          totalLandPrice: that.formData.zdj, //总地价(万元) 国有+集体 总地价预估合计
+          areaSCL: 0, //国有建设用地面积(平方米) 国有 土地面积合计
+          baseLandPriceSCL: 0, //国有建设用地基准地价(万元)
+          areaCCL: 0, //集体建设用地面积(平方米) 集体 土地面积合计
+          baseLandPriceCCL: 0, //集体建设用地基准地价(万元)
+          picBase64List: [imageBase64], //图片集 分析范围
+          definitionBLP: that.jzdj_LandUse, //报告类型名称
+          totalArea: 0, //国有+集体土地面积合计 平方米 tableList01 土地面积 + tableList01土地面积
+          landPriceESCL: 0, //国有土地地价预估 万元 国有 总地价预估合计 tableList01 总地价预估 累加
+          landPriceECCL: 0, // 集体土地地价预估 万元 集体 总地价预估合计 tableList02 总地价预估 累加
+          tableList01: [], //国有建设用地
+          tableList02: [], //集体建设用地
+        };
+        debugger;
+        that.LayerData.GYData.forEach((gyelement) => {
+          gyelement.fromData.forEach((element) => {
+            data.totalArea += element.area;
+            data.baseLandPriceSCL += element.zdj;
+            data.areaSCL += element.area;
+            data.landPriceESCL += element.zdj;
+            data.tableList01.push({
+              lv: element.tdjb,
+              landPrice: Number((element.dj * 666.67).toFixed(2)),
+              area: Number((element.area / 666.67).toFixed(2)),
+              landPriceES: Number((element.zdj / 10000).toFixed(2)),
+            });
+          });
+        });
+        that.LayerData.JTData.forEach((jtelement) => {
+          jtelement.fromData.forEach((element) => {
+            data.totalArea += element.area;
+            data.baseLandPriceCCL += element.zdj;
+            data.areaCCL += element.area;
+            data.landPriceECCL += element.zdj;
+            data.tableList02.push({
+              lv: element.tdjb,
+              landPrice: Number((element.dj * 666.67).toFixed(2)),
+              area: Number((element.area / 666.67).toFixed(2)),
+              landPriceES: Number((element.zdj / 10000).toFixed(2)),
+            });
+          });
+        });
+        data.analysisArea = Number((data.analysisArea / 666.67).toFixed(2));
+        data.totalLandPrice = Number((data.totalLandPrice / 10000).toFixed(2));
+        data.areaSCL = Number((data.areaSCL / 666.67).toFixed(2));
+        data.areaCCL = Number((data.areaCCL / 666.67).toFixed(2));
+        data.totalArea = Number((data.totalArea / 666.67).toFixed(2));
+        data.landPriceESCL = Number((data.landPriceESCL / 10000).toFixed(2));
+        data.landPriceECCL = Number((data.landPriceECCL / 10000).toFixed(2));
+        data.baseLandPriceCCL = Number(
+          (data.baseLandPriceCCL / 10000).toFixed(2)
+        );
+        data.baseLandPriceSCL = Number(
+          (data.baseLandPriceSCL / 10000).toFixed(2)
+        );
+        debugger;
+        let JZDJWordPath = await getJZDJWord(data);
+        debugger;
+        if (JZDJWordPath.code == 200) {
+          that.info.BenchmarkLandPrice.AnalysisStatus = "完成";
+          that.info.BenchmarkLandPrice.ReportPath = JZDJWordPath.msg;
+          let BenchmarkLandPrice = window.BenchmarkLandPriceList.find(
+            (c) => (c.id = that.info.BenchmarkLandPrice.id)
+          );
+          BenchmarkLandPrice.AnalysisStatus = "完成";
+          BenchmarkLandPrice.ReportPath = JZDJWordPath.msg;
+
+          // that.$notify({
+          //   title: "成功",
+          //   message:
+          //     that.info.BenchmarkLandPrice.ProjectName + "报告已生成,可下载",
+          //   type: "success",
+          // });
+        } else {
+          that.info.BenchmarkLandPrice.AnalysisStatus = "异常";
+          let BenchmarkLandPrice = window.BenchmarkLandPriceList.find(
+            (c) => (c.id = that.info.BenchmarkLandPrice.id)
+          );
+          BenchmarkLandPrice.AnalysisStatus = "异常";
+          that.$notify.error({
+            title: "异常",
+            message:
+              that.info.BenchmarkLandPrice.ProjectName +
+              "报告生成异常,请重新选取区域分析",
+          });
+        }
+      });
+    },
+
+    /**
+     * 计算两个面的交集面积
+     * @param Points1
+     * @param Points2
+     * @param Points3
+     */
+    calculateIntersectArea(Points1, Points2, Points3) {
+      var geometry1;
+      var geometry2;
+      var geometry3;
+      if (Points1) {
+        geometry1 = this.AssemblySurface(Points1);
+      }
+      if (Points2) {
+        geometry2 = this.AssemblySurface(Points2);
+      }
+      if (Points3) {
+        geometry3 = this.AssemblySurface(Points3);
+      }
+      let areaPs;
+      if (geometry1 && geometry2) {
+        areaPs = intersect(geometry1, geometry2);
+      }
+      if (areaPs && geometry3) {
+        areaPs = intersect(areaPs, geometry3);
+      }
+      if (areaPs) {
+        const areadifference = area(areaPs);
+        return Number(areadifference.toFixed(2));
+      } else {
+        return 0;
+      }
+    },
+    /**
+     * 组装带洞和不带洞的面
+     * @param geometry 超图返回的图形数组
+     */
+    AssemblySurface(geometry) {
+      let point3ds = [];
+      let pointholes = [];
+      let startindex = 0;
+      for (let index = 0; index < geometry.parts.length; index++) {
+        let thisps = [];
+        const endindex = startindex + geometry.parts[index];
+        let geometryPoints = geometry.points.slice(startindex, endindex);
+        for (
+          let pointindex = 0;
+          pointindex < geometryPoints.length;
+          pointindex++
+        ) {
+          const point = geometryPoints[pointindex];
+          thisps.push([point.x, point.y]);
+        }
+        if (geometry.partTopo[index] === 1) {
+          point3ds.push(thisps);
+        } else {
+          pointholes.push(thisps);
+        }
+
+        startindex = endindex;
+      }
+
+      // 主多边形
+      var mainPolygon = polygon(point3ds);
+
+      // 岛洞多边形
+      var holePolygon = polygon(pointholes);
+
+      // 计算差集 得到有导洞的图形
+      var getdifference = difference(mainPolygon, holePolygon);
+      return getdifference;
+    },
+    clear() {
+      //删除国有土地权属图层
+      for (let index = 0; index < this.LayerData.GYData.length; index++) {
+        const element = this.LayerData.GYData[index];
+        viewer.entities.removeById("GYTD-" + element.id);
+      }
+      this.LayerData.GYData = [];
+      //删除国有土集体属图层
+      for (let index = 0; index < this.LayerData.JTData.length; index++) {
+        const element = this.LayerData.JTData[index];
+        viewer.entities.removeById("JTTD-" + element.id);
+      }
+      this.LayerData.JTData = [];
+      //删除规划地块图层
+      for (let index = 0; index < this.LayerData.GHDKData.length; index++) {
+        const element = this.LayerData.GHDKData[index];
+        viewer.entities.removeById("GHDK-" + element.id);
+      }
+      this.LayerData.GHDKData = [];
+      //删除绘制范围
+      viewer.entities.removeById("HZFW");
+    },
+    initGY() {
+      this.GYmyChart = window.echarts.init(this.$refs.GYEcharts);
+
+      let djGroup = this.GroupByzdj(this.LayerData.GYData);
+      let data = [];
+      djGroup.forEach((element) => {
+        data.push({
+          value: Number((element.zdj / 10000).toFixed(2)),
+          name: element.tdjb,
+        });
+      });
+
+      var option = {
+        color: [
+          "#5470c6",
+          "#91cc75",
+          "#fac858",
+          "#ee6666",
+          "#73c0de",
+          "#3ba272",
+          "#fc8452",
+          "#9a60b4",
+          "#ea7ccc",
+        ],
+        tooltip: {
+          trigger: "item",
+        },
+
+        legend: {
+          orient: "vertical",
+          top: "center",
+          right: 0,
+          radius: "60%",
+          textStyle: {
+            color: "#FFFFFF",
+          },
+          formatter: function (name) {
+            var val = data.find((t) => t.name == name);
+            if (val) {
+              return name + "  " + val.value + "万元";
+            } else {
+              return name;
+            }
+          },
+        },
+        series: [
+          {
+            type: "pie",
+            radius: ["40%", "70%"],
+            center: ["35%", "50%"], // 将饼图的中心点向左调整到容器宽度的30%,纵坐标保持在中心
+            avoidLabelOverlap: false,
+            itemStyle: {
+              borderRadius: 10,
+              borderColor: "#fff",
+              borderWidth: 2,
+            },
+
+            label: {
+              position: "center",
+              show: true,
+              formatter: () => {
+                let str =
+                  "国有建设用地" +
+                  "\n" +
+                  "基准地价预估" +
+                  "\n" +
+                  (this.formData.gyzdj / 10000).toFixed(2) +
+                  "万元";
+                return str;
+              },
+              color: "#FFFFFF",
+              lineHeight: 16,
+              fontSize: 12,
+            },
+            // emphasis: {
+            //   label: {
+            //     show: true,
+            //     fontSize: 20,
+            //     fontWeight: "bold",
+            //   },
+            // },
+            labelLine: {
+              show: false,
+            },
+            data: data.length > 0 ? data : [{ value: 0, name: "无数据" }],
+          },
+        ],
+      };
+
+      this.GYmyChart.setOption(option);
+    },
+    initJT() {
+      this.JTmyChart = window.echarts.init(this.$refs.JTEcharts);
+
+      let djGroup = this.GroupByzdj(this.LayerData.JTData);
+      let data = [];
+      djGroup.forEach((element) => {
+        data.push({
+          value: Number((element.zdj / 10000).toFixed(2)),
+          name: element.tdjb,
+        });
+      });
+
+      var option = {
+        color: [
+          "#5470c6",
+          "#91cc75",
+          "#fac858",
+          "#ee6666",
+          "#73c0de",
+          "#3ba272",
+          "#fc8452",
+          "#9a60b4",
+          "#ea7ccc",
+        ],
+        tooltip: {
+          trigger: "item",
+        },
+        legend: {
+          orient: "vertical",
+          top: "center",
+          right: 0,
+          radius: "60%",
+          textStyle: {
+            color: "#FFFFFF",
+          },
+          formatter: function (name) {
+            var val = data.find((t) => t.name == name);
+            if (val) {
+              return name + "  " + val.value + "万元";
+            } else {
+              return name;
+            }
+          },
+        },
+        series: [
+          {
+            type: "pie",
+            radius: ["40%", "70%"],
+            center: ["35%", "50%"], // 将饼图的中心点向左调整到容器宽度的30%,纵坐标保持在中心
+            avoidLabelOverlap: false,
+            itemStyle: {
+              borderRadius: 10,
+              borderColor: "#fff",
+              borderWidth: 2,
+            },
+            label: {
+              position: "center",
+              show: true,
+              formatter: () => {
+                let str =
+                  "集体建设用地" +
+                  "\n" +
+                  "基准地价预估" +
+                  "\n" +
+                  (this.formData.jtzdj / 10000).toFixed(2) +
+                  "万元";
+                return str;
+              },
+              color: "#FFFFFF",
+              lineHeight: 16,
+              fontSize: 12,
+            },
+            // emphasis: {
+            //   label: {
+            //     show: true,
+            //     fontSize: 20,
+            //     fontWeight: "bold",
+            //   },
+            // },
+            labelLine: {
+              show: false,
+            },
+            data: data.length > 0 ? data : [{ value: 0, name: "无数据" }],
+          },
+        ],
+      };
+
+      this.JTmyChart.setOption(option);
+    },
+    //切换用地类型时加载用地规划图层
+    async handleChange() {
+      //先清空数据
+      this.formData.gyzdj = 0;
+      this.formData.jtzdj = 0;
+      this.LayerData.GYData.forEach((element) => {
+        element.fromData = [];
+      });
+      this.LayerData.JTData.forEach((element) => {
+        element.fromData = [];
+      });
+      this.LayerData.JZDJData = [];
+
+      await this.CalculateJZDJ();
+      await this.initGY();
+      await this.initJT();
+    },
+
+    /**
+     * 对数组字段分组并求和计算每个土地级别的总地价
+     * @param djData
+     */
+    GroupByzdj(djData) {
+      let data = [];
+      djData.forEach((element) => {
+        data = data.concat(element.fromData);
+      });
+      const groupedData = data.reduce((accumulator, currentValue) => {
+        // 如果累加器(accumulator)中没有这个分组,就添加它
+        if (!accumulator[currentValue.tdjb]) {
+          accumulator[currentValue.tdjb] = { tdjb: currentValue.tdjb, zdj: 0 };
+        }
+        // 将当前对象的b值累加到对应分组上
+        accumulator[currentValue.tdjb].zdj += currentValue.zdj;
+        // 返回累加器,以便下一次迭代使用
+        return accumulator;
+      }, {});
+
+      // 将结果转换为数组(如果需要的话)
+      const resultArray = Object.keys(groupedData).map(
+        (key) => groupedData[key]
+      );
+      return resultArray;
+    },
+  },
+  beforeDestroy() {
+    if (this.getEntitiesHandler) {
+      this.getEntitiesHandler.removeInputAction(
+        Cesium.ScreenSpaceEventType.LEFT_CLICK
+      );
+    }
+    this.clear();
+  },
+};
+</script>
+<style lang="scss">
+@import "@/../../zt.scss";
+</style>
+<style scoped>
+.el-date-editor--daterange.el-input__inner {
+  width: auto;
+  background-color: rgba(4, 28, 50, 0.5);
+  border: 1px solid rgba(15, 122, 200, 0.4);
+}
+.card_body_style {
+  border: 1px dashed #02a7f0;
+}
+.hover_style:hover {
+  border: 1px solid #02a7f0;
+}
+.con-col {
+  display: flex;
+  flex-flow: column nowrap;
+  justify-content: center;
+  align-items: center;
+  border-radius: 4px;
+}
+
+.container_center {
+  display: flex;
+  align-items: center; /* 垂直居中 */
+  justify-content: center; /* 水平居中,如果也需要水平居中的话 */
+}
+.EchartsWH {
+  width: 100%;
+  height: 16rem;
+}
+</style>

+ 0 - 0
src/views/ConstructionApplication3D/BenchmarkLandPriceAnalysis/BenchmarkLandPriceAnalysis/基准地价分析.text