BenchmarkLandPrice.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868
  1. <template>
  2. <div class="ZTGlobal" style="width: 100%; padding: 1rem 1rem 0rem 1rem; color: white">
  3. <el-row :gutter="10">
  4. <el-col :span="24">
  5. 基于三亚市控制性详细规划数据和2020年《三亚市国有建设用地土地定级与基准地价》编制成果,实现指定范围内国有建设用地的基准地价预估。
  6. <el-link type="primary" @click="jzdjsmShow">更多>></el-link>
  7. </el-col>
  8. </el-row>
  9. <el-row :gutter="10">
  10. <el-col :span="24">
  11. <el-tabs v-model="activeName" style="height: 100%" @tab-click="handleClick" v-loading="loading"
  12. element-loading-text="正在分析....." element-loading-spinner="el-icon-loading"
  13. element-loading-background="rgba(0, 0, 0, 0.8)">
  14. <el-tab-pane label="基准地价分析" name="first">
  15. <el-form ref="ruleForm" :model="form" :rules="rules" label-width="90px">
  16. <el-form-item label="项目名称" size="mini" prop="ProjectName">
  17. <el-col :span="20">
  18. <el-input size="mini" v-model="form.ProjectName"></el-input>
  19. </el-col>
  20. </el-form-item>
  21. <!-- <el-form-item label="项目类型" size="mini" prop="ProjectType">
  22. <el-col :span="20">
  23. <el-input size="mini" v-model="form.ProjectType"></el-input>
  24. </el-col>
  25. </el-form-item> -->
  26. <el-form-item label="选址范围" size="mini" prop="ProjectScope">
  27. <el-col :span="20">
  28. <input @change="handleUpload" type="file" style="display:none" id="fileInput" accept=".zip"></input>
  29. <el-button type="primary" @click="inputGeometry">导入</el-button>
  30. <!-- <el-button type="primary">导入范围</el-button> -->
  31. <el-button type="primary" @click="getProjectScope">绘制
  32. </el-button>
  33. <el-button type="primary" @click="resetForm('ruleForm')">清除
  34. </el-button>
  35. </el-col>
  36. </el-form-item>
  37. <el-form-item label="建设单位" size="mini" prop="ConstructionUnit">
  38. <el-col :span="20">
  39. <el-input size="mini" v-model="form.ConstructionUnit"></el-input>
  40. </el-col>
  41. </el-form-item>
  42. </el-form>
  43. <div class="SaveCenter">
  44. <el-button type="primary" @click="submitForm('ruleForm')">开始分析</el-button>
  45. <el-button @click="resetForm('ruleForm')">重置</el-button>
  46. </div>
  47. </el-tab-pane>
  48. <el-tab-pane label="分析记录" name="second">
  49. <el-row :gutter="10">
  50. <el-col :span="8">
  51. <el-input size="mini" placeholder="请输入项目名称" v-model="input3" class="input-with-select">
  52. </el-input>
  53. </el-col>
  54. <el-col :span="12">
  55. <el-date-picker size="mini" v-model="datevalue" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
  56. range-separator="" start-placeholder="开始日期" end-placeholder="结束日期">
  57. </el-date-picker>
  58. </el-col>
  59. <el-col :span="4">
  60. <el-button size="mini" icon="el-icon-search" @click="getBenchmarkLandPriceList()"></el-button>
  61. </el-col>
  62. </el-row>
  63. <el-row>
  64. <el-col>
  65. <el-row :gutter="10" v-for="itemModel in BenchmarkLandPriceList" :key="itemModel.id">
  66. <el-col :span="24">
  67. <el-card shadow="hover" class="card_body_style hover_style">
  68. <el-row>
  69. <el-col :span="24">
  70. {{ itemModel.ProjectName }}
  71. </el-col>
  72. </el-row>
  73. <el-row>
  74. <el-col :span="24">
  75. {{ itemModel.analysisDate }}
  76. </el-col>
  77. </el-row>
  78. <el-row>
  79. <el-col :span="8">
  80. <el-button v-if="itemModel.AnalysisStatus == '完成'" size="mini" type="primary">{{
  81. itemModel.AnalysisStatus }}</el-button>
  82. <el-button v-if="itemModel.AnalysisStatus == '正在分析'" size="mini" type="success">{{
  83. itemModel.AnalysisStatus }}</el-button>
  84. <el-button v-if="itemModel.AnalysisStatus == '异常'" size="mini" type="danger">{{
  85. itemModel.AnalysisStatus }}</el-button>
  86. </el-col>
  87. <el-col :span="12">
  88. <div ><!--style="float: right" -->
  89. <!-- <el-button size="mini" type="default">日志</el-button> -->
  90. <el-button size="mini" type="default"
  91. @click="openAnalyzeResults(itemModel.id)">结果</el-button>
  92. <el-button size="mini" type="default" @click="handleGetBG(itemModel.id)">报告</el-button>
  93. </div>
  94. </el-col>
  95. <el-col :span="4">
  96. <el-button size="mini" type="warning"
  97. @click="deleteAnalyzeResults(itemModel.id)">删除</el-button>
  98. </el-col>
  99. </el-row>
  100. </el-card>
  101. </el-col>
  102. </el-row>
  103. <el-pagination :hide-on-single-page="true" style="color: white" @size-change="handleSizeChange"
  104. @current-change="handleCurrentChange" :page-size="queryParams.pageSize" layout="prev, pager, next"
  105. :total="queryParams.total">
  106. </el-pagination>
  107. </el-col>
  108. </el-row>
  109. </el-tab-pane>
  110. <el-tab-pane label="分析结果" name="third">
  111. <jzdjfxsmjg v-if="iSjzdjfxsmjgShow" :info="{ BenchmarkLandPrice: BenchmarkLandPriceinfo }"></jzdjfxsmjg>
  112. </el-tab-pane>
  113. </el-tabs>
  114. </el-col>
  115. </el-row>
  116. </div>
  117. </template>
  118. <script>
  119. import { v4 as uuidv4 } from "uuid";
  120. import moment from "moment";
  121. import jzdjfxsmInfo from "./jzdjfxsmInfo.vue";
  122. import jzdjfxsmjg from "./jzdjfxsmjg.vue";
  123. import BenchmarkLandPrice from "./BenchmarkLandPrice.js";
  124. import {
  125. cartesian3ToWGS84,
  126. mapQuery,
  127. mapanalyze,
  128. flatten,
  129. mercator2lonLat,
  130. undergroundMode,
  131. } from "@/utils/MapHelper/MapHelper.js";
  132. import {
  133. booleanContains,
  134. area,
  135. intersect,
  136. polygon,
  137. point,
  138. midpoint,
  139. difference,
  140. } from "@turf/turf";
  141. import { getJZDJWord, listBenchmarkLandPrices, addBenchmarkLandPrices, updateBenchmarkLandPrices, addZtBenchmarkLandPriceResults, getBenchmarkLandPrices, listZtBenchmarkLandPriceResults, getAnalyseResult, delBenchmarkLandPrices } from "@/api/zt/ztApi.js";
  142. let handlerPolygon; var polygonEntity = null;
  143. export default {
  144. data() {
  145. return {
  146. landUseNatureRelation: window.landUseNatureRelation,
  147. tooltip: createTooltip(document.body),
  148. /**
  149. * tabs 标签
  150. */
  151. activeName: "first",
  152. //绘制事件
  153. // handlerPolygon: null,
  154. iSjzdjfxsmjgShow: false,
  155. BenchmarkLandPriceinfo: null,
  156. form: {
  157. id: "",
  158. ProjectScope: [],
  159. ProjectName: "",
  160. ProjectType: "",
  161. ConstructionUnit: "",
  162. // ztBenchmarkLandPriceResultsList: []
  163. },
  164. input3: "",
  165. datevalue: [],
  166. // datevalue:[moment().add(-1, 'days').startOf("day").format('YYYY-MM-DD HH:mm:ss'),moment().endOf("day").format('YYYY-MM-DD HH:mm:ss')],
  167. rules: {
  168. ProjectName: [
  169. { required: true, message: "请输入项目名称", trigger: "blur" },
  170. ],
  171. ProjectScope: [
  172. { required: true, message: "请添加项目范围", trigger: "blur" },
  173. ],
  174. ProjectType: [
  175. { required: true, message: "请选择土地用途", trigger: "blur" },
  176. ],
  177. },
  178. BenchmarkLandPriceList: [],
  179. LayerData: {
  180. GHDKData: [],
  181. },
  182. queryParams: {
  183. total: 0,
  184. pageNum: 1,
  185. pageSize: 10,
  186. },
  187. loading: false
  188. };
  189. },
  190. components: {
  191. jzdjfxsmjg
  192. },
  193. mounted() {
  194. this.init();
  195. },
  196. methods: {
  197. async init() {
  198. var date = new Date()
  199. this.form.ProjectName = "基准地价分析_" + this.formatDateTime(date)
  200. this.form.ConstructionUnit = "建设单位"
  201. await this.getBenchmarkLandPriceList();
  202. },
  203. //页大小触发
  204. handleSizeChange(val) {
  205. this.queryParams.pageSize = val;
  206. this.queryParams.pageNum = 1;
  207. this.getBenchmarkLandPriceList();
  208. },
  209. //跳转页触发
  210. handleCurrentChange(val) {
  211. this.queryParams.pageNum = val;
  212. this.getBenchmarkLandPriceList();
  213. },
  214. /**
  215. * 获取基准地价信息
  216. */
  217. async getBenchmarkLandPriceList() {
  218. debugger
  219. let BenchmarkLandPrices = await listBenchmarkLandPrices({
  220. params: {
  221. beginTime: this.datevalue ? this.datevalue[0] : '',
  222. endTime: this.datevalue ? this.datevalue[1] : ''
  223. },
  224. ProjectName: this.input3,
  225. ...this.queryParams
  226. });
  227. this.queryParams.total = BenchmarkLandPrices.total;
  228. this.BenchmarkLandPriceList = BenchmarkLandPrices.rows;
  229. // this.BenchmarkLandPriceList = window.BenchmarkLandPriceList;
  230. },
  231. formatDateTime(date) {
  232. var y = date.getFullYear();
  233. var m = date.getMonth() + 1;
  234. m = m < 10 ? ('0' + m) : m;
  235. var d = date.getDate();
  236. d = d < 10 ? ('0' + d) : d;
  237. var h = date.getHours();
  238. h = h < 10 ? ('0' + h) : h;
  239. var minute = date.getMinutes();
  240. minute = minute < 10 ? ('0' + minute) : minute;
  241. var second = date.getSeconds();
  242. second = second < 10 ? ('0' + second) : second;
  243. return y.toString() + m.toString() + d.toString() + h.toString() + minute.toString() + second.toString();
  244. },
  245. /**
  246. * tas切换
  247. * @param {String} tab
  248. * @param {Object} event
  249. */
  250. handleClick(tab, event) {
  251. if (this.activeName == "third") {
  252. this.iSjzdjfxsmjgShow = true;
  253. } else {
  254. this.iSjzdjfxsmjgShow = false;
  255. }
  256. },
  257. /**
  258. *基准地价说明
  259. */
  260. jzdjsmShow() {
  261. var that = this;
  262. if (that.layerid) that.$layer.close(that.layerid);
  263. var width = "40rem";
  264. var height = "30rem";
  265. that.layerid = that.$layer.iframe({
  266. content: {
  267. content: jzdjfxsmInfo, //传递的组件对象
  268. parent: this, //当前的vue对象
  269. data: {}, //props
  270. },
  271. area: [width.toString(), height.toString()],
  272. title: "基准地价分析说明",
  273. maxmin: false,
  274. shade: false, //是否显示遮罩
  275. shadeClose: false, //点击遮罩是否关闭
  276. cancel: () => {
  277. //关闭事件
  278. // alert("关闭iframe");
  279. },
  280. });
  281. },
  282. /**
  283. * 绘制范围
  284. */
  285. getProjectScope() {
  286. let that = this;
  287. this.clearScope();
  288. handlerPolygon = new Cesium.DrawHandler(
  289. viewer,
  290. Cesium.DrawMode.Polygon,
  291. Cesium.ClampMode.Space
  292. );
  293. handlerPolygon.activate();
  294. handlerPolygon.activeEvt.addEventListener(function (isActive) {
  295. if (isActive == true) {
  296. // viewer.enableCursorStyle = false;
  297. // viewer._element.style.cursor = "";
  298. document.body.classList.add("drawCur");
  299. } else {
  300. // viewer.enableCursorStyle = true;
  301. document.body.classList.remove("drawCur");
  302. }
  303. });
  304. handlerPolygon.movingEvt.addEventListener((windowPosition) => {
  305. that.tooltip.showAt(
  306. windowPosition,
  307. "<p>点击鼠标左键开始绘制分析区域</p>"
  308. );
  309. });
  310. handlerPolygon.drawEvt.addEventListener((result) => {
  311. handlerPolygon.polygon.show = true;
  312. handlerPolygon.polyline.show = false;
  313. debugger
  314. handlerPolygon.polygon.polygon.material.color = Cesium.Color.WHITE.withAlpha(0.3);
  315. handlerPolygon.polygon.polygon.outline = true;
  316. handlerPolygon.polygon.polygon.outlineColor = Cesium.Color.RED;
  317. handlerPolygon.polygon.polygon.outlineWidth = 2.0;
  318. that.tooltip.setVisible(false);
  319. var polygon = result.object;
  320. if (!polygon) {
  321. return;
  322. }
  323. let points = [];
  324. let positions = polygon.positions;
  325. //遍历多边形,取出所有点
  326. for (var i = 0, len = positions.length; i < len; i++) {
  327. let xyz = cartesian3ToWGS84(positions[i]);
  328. points.push({ x: xyz.lng, y: xyz.lat, z: xyz.alt });
  329. }
  330. if (points.length > 0) {
  331. if (points[0] != points[points.length - 1]) {
  332. points.push(points[0]);
  333. }
  334. }
  335. that.form.ProjectScope = points;
  336. // if (this.calculateBooleanContains(positions)) {
  337. // that.form.ProjectScope = points;
  338. // } else {
  339. // this.$message.error("请在规划地块范围内选择范围");
  340. // }
  341. });
  342. },
  343. submitForm(formName) {
  344. let that = this;
  345. that.loading = true;
  346. this.$refs[formName].validate(async (valid) => {
  347. if (valid) {
  348. var area = await that.getRegionArea() / 666.66;
  349. if (area > 3000) {
  350. this.clear();
  351. that.loading = false;
  352. that.$alert("项目范围不要超过3000亩,请重新输入项目范围", "警告");
  353. return false;
  354. }
  355. that.form.id = uuidv4();
  356. that.form.analysisDate = moment(new Date()).format(
  357. "YYYY-MM-DD HH:mm:ss"
  358. );
  359. that.form.AnalysisStatus = "正在分析";
  360. // window.BenchmarkLandPriceList.push(
  361. // JSON.parse(JSON.stringify(that.form))
  362. // );
  363. that.form.ProjectScope = JSON.stringify(that.form.ProjectScope);
  364. var rownum = await addBenchmarkLandPrices(that.form);
  365. debugger
  366. if (rownum.code == 200) {
  367. debugger
  368. let data = JSON.parse(JSON.stringify(that.form));
  369. // let response = await getAnalyseResult(data);
  370. BenchmarkLandPrice.calculateLandPrice(data, true, async function (response) {
  371. that.loading = false;
  372. if (response) {
  373. response.id = uuidv4();
  374. response.BenchmarkLandPriceid = data.id;
  375. data.AnalysisStatus = "完成";
  376. var urownum = await updateBenchmarkLandPrices({ id: data.id, AnalysisStatus: data.AnalysisStatus });
  377. if (urownum.code == 200) {
  378. debugger
  379. await addZtBenchmarkLandPriceResults(response);
  380. }
  381. await that.openAnalyzeResults(data.id);
  382. } else {
  383. that.$message.error("分析异常");
  384. data.AnalysisStatus = "异常";
  385. var urownum = await updateBenchmarkLandPrices({ id: data.id, AnalysisStatus: data.AnalysisStatus });
  386. }
  387. that.resetForm(formName);
  388. that.init();
  389. });
  390. that.init();
  391. that.$message({
  392. message: "开始分析",
  393. type: "success",
  394. });
  395. } else {
  396. that.loading = false;
  397. this.$message.error("项目保存失败");
  398. }
  399. } else {
  400. that.loading = false;
  401. return false;
  402. }
  403. });
  404. },
  405. resetForm(formName) {
  406. debugger
  407. this.clear();
  408. this.$refs[formName].resetFields();
  409. var date = new Date();
  410. this.form.ProjectName = "基准地价分析_" + this.formatDateTime(date);
  411. this.form.ConstructionUnit = "建设单位";
  412. },
  413. /**
  414. * 点击导入范围
  415. */
  416. inputGeometry() {
  417. var element = document.getElementById('fileInput')
  418. // debugger
  419. // document.getElementsByClassName("el-upload__input")= ""
  420. if (element)
  421. element.click();
  422. },
  423. handleUpload(event) {
  424. this.clearScope();
  425. debugger
  426. // let fileName = document.getElementsByClassName("el-upload__input")[0].value
  427. let fileName = event.target.files[0];
  428. var size = fileName.size
  429. if (size > 512 * 1024) {
  430. {
  431. this.$message("文件大小超限,请重新输入!");
  432. event.target.value = ''
  433. return
  434. }
  435. }
  436. let reader = new FileReader();
  437. var geojson;
  438. var that = this
  439. reader.readAsArrayBuffer(fileName);
  440. reader.onload = function (e) {
  441. debugger;
  442. let res = e.target.result; //ArrayBuffer
  443. shp(res)
  444. .then(function (res) {
  445. debugger
  446. // self.addGeometry(res)
  447. geojson = res;
  448. console.log(geojson);
  449. that.addGeometry(geojson)
  450. })
  451. .catch(function (e) {
  452. console.log(e);
  453. });
  454. event.target.value = ''
  455. };
  456. // this.parsingZip();
  457. },
  458. /**
  459. * 导入范围添加图形
  460. */
  461. addGeometry(geojson) {
  462. var that = this;
  463. debugger
  464. var coordinates = geojson.features[0].geometry.coordinates;
  465. var box = geojson.features[0].geometry.bbox;
  466. var centerX = (box[0] + box[2]) / 2;
  467. var centerY = (box[1] + box[3]) / 2;
  468. var positions = [];
  469. that.form.ProjectScope = [];
  470. for (var i = 0; i < coordinates.length; i++) {
  471. var coor = coordinates[i];
  472. if (coor && coor.length > 0) {
  473. for (var j = 0; j < coor.length; j++) {
  474. that.form.ProjectScope.push({ x: coor[j][0], y: coor[j][1] })
  475. positions.push(coor[j][0])
  476. positions.push(coor[j][1])
  477. }
  478. }
  479. }
  480. viewer.entities.removeById('polygon');
  481. polygonEntity = new Cesium.Entity({
  482. id: 'polygon',
  483. position: Cesium.Cartesian3.fromDegreesArray([
  484. centerX,
  485. centerY,
  486. ]),
  487. // classificationType: ClassificationType.TERRAIN,
  488. polygon: {
  489. hierarchy: new Cesium.PolygonHierarchy(
  490. new Cesium.Cartesian3.fromDegreesArray(positions)
  491. ),
  492. // positions: new Cesium.Cartesian3.fromDegreesArray(positions),
  493. material: Cesium.Color.WHITE.withAlpha(0.3),
  494. outline: true,
  495. outlineColor: Cesium.Color.RED,
  496. outlineWidth: 2.0,
  497. },
  498. });
  499. viewer.entities.add(polygonEntity);
  500. viewer.flyTo(polygonEntity)
  501. },
  502. //范围面积
  503. async getRegionArea() {
  504. debugger
  505. var points1 = this.form.ProjectScope;
  506. var parts1 = [];
  507. var poly1;
  508. for (var i = 0; i < points1.length; i++) {
  509. parts1.push([points1[i].x, points1[i].y]);
  510. }
  511. poly1 = polygon([parts1]);
  512. var textarea = area(poly1) * window.earthRadius;
  513. return textarea;
  514. // let sd = { point2Ds: JSON.stringify(points1), unit: 'METER', prjCoordSys: { epsgcode: 4326 } };
  515. // let data = await mapanalyze(window.supermapIServerUrl + '/iserver/services/geometry/restjsr/v1/geometry/area.rjson', sd);
  516. // if (data) {
  517. // return data.area;
  518. // } else {
  519. // return 0
  520. // }
  521. },
  522. /**
  523. * 删除基准地价分析结果
  524. * @param BenchmarkLandPriceid 基准地价id
  525. */
  526. async deleteAnalyzeResults(BenchmarkLandPriceid) {
  527. let data = await delBenchmarkLandPrices(BenchmarkLandPriceid);
  528. if (data.code == 200) {
  529. this.$message({
  530. message: "删除成功",
  531. type: "success",
  532. });
  533. }
  534. this.init();
  535. },
  536. /**
  537. * 打开分析结果弹窗
  538. * @param BenchmarkLandPrice 基准地价信息
  539. */
  540. async openAnalyzeResults(BenchmarkLandPriceid) {
  541. debugger
  542. this.BenchmarkLandPriceinfo = (await getBenchmarkLandPrices(BenchmarkLandPriceid)).data;
  543. this.BenchmarkLandPriceinfo.ztBenchmarkLandPriceResultsList = (await listZtBenchmarkLandPriceResults({ BenchmarkLandPriceid: this.BenchmarkLandPriceinfo.id })).rows;
  544. this.iSjzdjfxsmjgShow = true;
  545. this.activeName = "third";
  546. // debugger
  547. // if (this.FXJGInfolayerid) {
  548. // this.$layer.close(this.FXJGInfolayerid);
  549. // }
  550. // let that = this;
  551. // let w = document.body.offsetWidth;
  552. // let h = document.body.offsetHeight;
  553. // //左上角(left=弹窗宽/2;top=弹窗高/2+header高)
  554. // //右上角 (left=w-弹窗宽+(弹窗宽/2);top=弹窗高/2+header高);
  555. // let left = w - 480 + 480 / 2;
  556. // let top = 830 / 2 + 60;
  557. // this.FXJGInfolayerid = this.$layer.iframe({
  558. // content: {
  559. // content: jzdjfxsmjg, //传递的组件对象
  560. // parent: this, //当前的vue对象
  561. // data: { info: { BenchmarkLandPrice } }, //props
  562. // },
  563. // offset: [left, top], //left top
  564. // area: ["480px", "830px"], //宽 高
  565. // title: "分析结果",
  566. // maxmin: false,
  567. // shade: false, //是否显示遮罩
  568. // shadeClose: false, //点击遮罩是否关闭
  569. // cancel: () => {
  570. // // this.init();
  571. // },
  572. // });
  573. },
  574. //切换用地类型时加载用地规划图层
  575. handleChange() {
  576. this.clear();
  577. if (this.form.ProjectType) {
  578. this.getGHDK(this.form.ProjectType);
  579. }
  580. },
  581. /**
  582. * 查询区域内规划地块
  583. * @param ProjectType
  584. */
  585. async getGHDK(ProjectType) {
  586. let that = this;
  587. //查询规划地块
  588. let layer = flatten(window.layerTree).find(
  589. (item) => item.core == "003006"
  590. );
  591. let sql = "";
  592. let landUseNatureRelation = flatten(window.landUseNatureRelation).find(
  593. (c) => c.tdyt == ProjectType
  594. );
  595. landUseNatureRelation.GHDKType.forEach((Type, i) => {
  596. if (i == 0) {
  597. sql += " KZXXGYDDM like '" + Type.ydxzdl + "%' ";
  598. } else {
  599. sql += "|| KZXXGYDDM like '" + Type.ydxzdl + "%' ";
  600. }
  601. });
  602. if (sql == "") {
  603. this.$message.error("当前土地用途类型未配置,请联系管理员");
  604. return;
  605. }
  606. let queryByGeometryParameters = {
  607. getFeatureMode: "SQL",
  608. datasetNames: [
  609. layer.date_server.datasourcename +
  610. ":" +
  611. layer.date_server.datasetname,
  612. ],
  613. queryParameter: {
  614. attributeFilter: sql,
  615. },
  616. hasGeometry: "true",
  617. maxFeatures: 99999999,
  618. };
  619. let e = await mapQuery(
  620. layer.date_server.url + "/featureResults.json?returnContent=true",
  621. queryByGeometryParameters
  622. );
  623. if (e && e.totalCount > 0) {
  624. e.features.forEach((feature) => {
  625. let featureData = {
  626. id: uuidv4(),
  627. layerInfo: layer,
  628. data: [],
  629. geometry: feature.geometry,
  630. };
  631. feature.fieldNames.forEach((fieldName, i) => {
  632. let Field = e.datasetInfos
  633. ? e.datasetInfos[0].fieldInfos.find(
  634. (c) =>
  635. c.name &&
  636. c.name.toUpperCase() == fieldName.toUpperCase() &&
  637. c.name.toUpperCase().indexOf("SM") == -1
  638. )
  639. : null;
  640. if (Field) {
  641. featureData.data.push({
  642. label: fieldName,
  643. labelCN: Field ? Field.caption : fieldName,
  644. value: e.features[0].fieldValues[i],
  645. });
  646. }
  647. });
  648. let point3ds = [];
  649. let pointholes = [];
  650. let startindex = 0;
  651. for (
  652. let index = 0;
  653. index < featureData.geometry.parts.length;
  654. index++
  655. ) {
  656. let thisps = [];
  657. const endindex = startindex + featureData.geometry.parts[index];
  658. let geometryPoints = featureData.geometry.points.slice(
  659. startindex,
  660. endindex
  661. );
  662. for (
  663. let pointindex = 0;
  664. pointindex < geometryPoints.length;
  665. pointindex++
  666. ) {
  667. const point = geometryPoints[pointindex];
  668. thisps.push(point.x);
  669. thisps.push(point.y);
  670. }
  671. if (featureData.geometry.partTopo[index] === 1) {
  672. point3ds.push(Cesium.Cartesian3.fromDegreesArray(thisps));
  673. } else {
  674. pointholes.push(Cesium.Cartesian3.fromDegreesArray(thisps));
  675. }
  676. startindex = endindex;
  677. }
  678. if (point3ds.length > 0 && pointholes.length > 0) {
  679. let holes = [];
  680. pointholes.forEach((hole) => {
  681. holes.push({ positions: hole });
  682. });
  683. var orangePolygon1 = viewer.entities.add({
  684. id: "GHDK-" + featureData.id,
  685. polygon: {
  686. hierarchy: {
  687. // Cesium.PolygonHierarchy
  688. positions: point3ds[0],
  689. holes: holes, // Cesium.PolygonHierarchy 数组
  690. },
  691. material: Cesium.Color.RED.withAlpha(0.4),
  692. outline: true,
  693. outlineColor: Cesium.Color.BLACK,
  694. outlineWidth: 2.0,
  695. },
  696. });
  697. } else if (point3ds.length > 0) {
  698. var orangePolygon1 = viewer.entities.add({
  699. id: "GHDK-" + featureData.id,
  700. polygon: {
  701. hierarchy: point3ds[0],
  702. material: Cesium.Color.RED.withAlpha(0.4),
  703. outline: true,
  704. outlineColor: Cesium.Color.BLACK,
  705. outlineWidth: 2.0,
  706. },
  707. });
  708. }
  709. that.LayerData.GHDKData.push(featureData);
  710. });
  711. }
  712. },
  713. async handleGetBG(id) {
  714. var item = (
  715. await listZtBenchmarkLandPriceResults({
  716. BenchmarkLandPriceid: id,
  717. })
  718. ).rows;
  719. if (item.length > 0) {
  720. await getJZDJWord(item[0]);
  721. }
  722. },
  723. // /**
  724. // * 与已有的规划地块比较看是否包含
  725. // * @param points
  726. // */
  727. // calculateBooleanContains(points) {
  728. // let DataPs = points.map((item) => {
  729. // let xyz = cartesian3ToWGS84(item);
  730. // return [xyz.lng, xyz.lat];
  731. // });
  732. // if (DataPs.length > 0) {
  733. // if (
  734. // JSON.stringify(DataPs[0]) != JSON.stringify(DataPs[DataPs.length - 1])
  735. // ) {
  736. // DataPs.push(DataPs[0]);
  737. // }
  738. // //绘制的图形边界
  739. // let polygonPs = polygon([DataPs]);
  740. // //规划地块的范围
  741. // for (let index = 0; index < this.LayerData.GHDKData.length; index++) {
  742. // const geometry = this.LayerData.GHDKData[index].geometry;
  743. // let point3ds = [];
  744. // let pointholes = [];
  745. // let startindex = 0;
  746. // for (let index = 0; index < geometry.parts.length; index++) {
  747. // let thisps = [];
  748. // const endindex = startindex + geometry.parts[index];
  749. // let geometryPoints = geometry.points.slice(startindex, endindex);
  750. // for (
  751. // let pointindex = 0;
  752. // pointindex < geometryPoints.length;
  753. // pointindex++
  754. // ) {
  755. // const point = geometryPoints[pointindex];
  756. // thisps.push([point.x, point.y]);
  757. // }
  758. // if (geometry.partTopo[index] === 1) {
  759. // point3ds.push(thisps);
  760. // } else {
  761. // pointholes.push(thisps);
  762. // }
  763. // startindex = endindex;
  764. // }
  765. // // 主多边形
  766. // var mainPolygon = polygon(point3ds);
  767. // // 岛洞多边形
  768. // var holePolygon = polygon(pointholes);
  769. // // 计算差集 得到有导洞的图形
  770. // var getdifference = difference(mainPolygon, holePolygon);
  771. // let areaPs = booleanContains(getdifference, polygonPs);
  772. // if (areaPs) {
  773. // return true;
  774. // }
  775. // }
  776. // return false;
  777. // } else {
  778. // return false;
  779. // }
  780. // },
  781. clearGHDK() {
  782. //删除规划地块图层
  783. for (let index = 0; index < this.LayerData.GHDKData.length; index++) {
  784. const element = this.LayerData.GHDKData[index];
  785. viewer.entities.removeById("GHDK-" + element.id);
  786. }
  787. this.LayerData.GHDKData = [];
  788. },
  789. clearScope() {
  790. if (polygonEntity) {
  791. viewer.entities.remove(polygonEntity)
  792. }
  793. if (handlerPolygon) {
  794. handlerPolygon.clear();
  795. handlerPolygon.deactivate();
  796. handlerPolygon = null;
  797. }
  798. this.tooltip.setVisible(false);
  799. },
  800. clear() {
  801. this.clearScope();
  802. this.clearGHDK();
  803. },
  804. },
  805. beforeDestroy() {
  806. this.clear();
  807. },
  808. };
  809. </script>
  810. <style lang="scss">
  811. @import "@/../../zt.scss";
  812. </style>
  813. <style scoped>
  814. .el-date-editor--daterange.el-input__inner {
  815. width: auto;
  816. background-color: rgba(4, 28, 50, 0.5);
  817. border: 1px solid rgba(15, 122, 200, 0.4);
  818. }
  819. .card_body_style {
  820. border: 1px dashed #02a7f0;
  821. }
  822. .hover_style:hover {
  823. border: 1px solid #02a7f0;
  824. }
  825. .con-col {
  826. display: flex;
  827. flex-flow: column nowrap;
  828. justify-content: center;
  829. align-items: center;
  830. border-radius: 4px;
  831. }
  832. </style>