xzjg.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494
  1. <template>
  2. <div class="xzjg">
  3. <div>项目名称:选址结果</div>
  4. <div class="box-sizing" style="height: 47%; width: 100%">
  5. <div class="title block-title">
  6. 意向地块 ({{ bgList ? bgList.length : 0 }})
  7. <span @click="download" class="export">导出报告</span>
  8. </div>
  9. <div class="bxCon" style="height: 90%">
  10. <el-collapse accordion v-model="activeNames">
  11. <el-collapse-item
  12. :name="'gb' + index1"
  13. v-for="(item1, index1) in bgList"
  14. :key="index1"
  15. >
  16. <template slot="title">
  17. 地块编号{{ item1.dkbm }} ({{ item1.area || 0 }})亩
  18. <span class="tools">
  19. <i
  20. class="header-icon el-icon-place"
  21. @click.stop="mapview(item1)"
  22. ></i>
  23. <i
  24. class="header-icon el-icon-delete"
  25. @click="deleteprogramme($event, item1)"
  26. ></i>
  27. </span>
  28. </template>
  29. <div class="collapseCon">
  30. <p class="oneItem">
  31. <span>{{ item1.kzxxgydmc }}</span>
  32. <span>{{ item1.area || 0 }}亩</span>
  33. </p>
  34. <p style="color: #cddeeb">
  35. <img src="/static/images/ghzc/iconSun.png" />
  36. <span style="margin-left: 20px">基准地标价:</span
  37. ><span style="color: #02a7f0"
  38. >{{ item1.landPrice || 0 }}万元</span
  39. >
  40. </p>
  41. </div>
  42. </el-collapse-item>
  43. </el-collapse>
  44. </div>
  45. </div>
  46. <div style="height: 47%; width: 100%" v-if="xzjgObj">
  47. <div class="title flex-box">
  48. <span class="block-title"
  49. >备选地块 ({{ xzjgObj.dks ? xzjgObj.dks.length : 0 }})
  50. </span>
  51. </div>
  52. <div class="bxCon">
  53. <el-collapse accordion v-model="activeNames">
  54. <el-collapse-item
  55. :name="index"
  56. v-for="(item, index) in xzjgObj.dks"
  57. :key="item.dkbm"
  58. >
  59. <template slot="title">
  60. <!-- 地块编号B_P_123 -->
  61. 地块编号{{ item.dkbm }} ({{ item.area || 0 }})亩
  62. <span class="tools">
  63. <i
  64. class="header-icon el-icon-place"
  65. @click.stop="mapview(item)"
  66. ></i>
  67. <i
  68. class="header-icon el-icon-plus"
  69. @click="addprogramme($event, item)"
  70. ></i>
  71. </span>
  72. </template>
  73. <div class="collapseCon">
  74. <p class="oneItem">
  75. <span>{{ item.kzxxgydmc }}</span>
  76. <span>{{ item.area || 0}}亩</span>
  77. </p>
  78. <p style="color: #cddeeb">
  79. <!-- <i class="iconSun"></i> -->
  80. <img src="/static/images/ghzc/iconSun.png" />
  81. <span style="margin-left: 20px">基准地标价:</span
  82. ><span style="color: #02a7f0"
  83. >{{ item.landPrice || 0 }}万元</span
  84. >
  85. </p>
  86. </div>
  87. </el-collapse-item>
  88. </el-collapse>
  89. </div>
  90. </div>
  91. <!-- <div class="xz-btn flex-box" style="justify-content: space-between">
  92. <div>
  93. <el-button round class="btn-style" @click="resetAll">重选</el-button>
  94. <el-button
  95. round
  96. @click="downReport"
  97. v-if="reportText == '查看报告'"
  98. >下载报告</el-button
  99. >
  100. <el-button
  101. type="primary"
  102. round
  103. @click="submit"
  104. >{{ reportText }}</el-button
  105. >
  106. </div>
  107. </div> -->
  108. </div>
  109. </template>
  110. <script>
  111. import drawData from "./draw.json";
  112. import ghjgData from "./规划结果.json";
  113. import { GetXzjg } from "../../../api/ghss/ghxz.js";
  114. // 使用
  115. import parse from "wellknown";
  116. import data from "../../../../static/data/ghss/data";
  117. let dataSources = {}
  118. export default {
  119. components: {},
  120. props: {
  121. activeTabs: {
  122. type: String,
  123. },
  124. scjgObj: {
  125. type: Object,
  126. },
  127. rwBsm: {
  128. type: String,
  129. },
  130. },
  131. data() {
  132. return {
  133. bgList: [],
  134. model: null,
  135. layer: null,
  136. reportText: "生成报告",
  137. rwObj: {
  138. bsm: "6d39b2d4307b46e2a4cf6f8c68a30c31",
  139. sjy: "SDE.XZYDYH",
  140. sjymc: "国土空间总体规划",
  141. ydbsm: "0",
  142. ydmc: null,
  143. ydmjbegin: "0",
  144. ydmjend: "100",
  145. xmmc: "111",
  146. jsdw: "111",
  147. fxbg: "/file/statics/shape/辅助选址报告/6d39b2d4307b46e2a4cf6f8c68a30c31/111(选址报告)_1676448756708.pdf",
  148. rwzt: 2,
  149. fwlx: 1,
  150. xzfw: null,
  151. zip: "/file/statics/shape/辅助选址报告/6d39b2d4307b46e2a4cf6f8c68a30c31/111_1676448756708.zip",
  152. },
  153. geoJsonEntities: null,
  154. xzjgObj: null,
  155. tempObj: null,
  156. copyData: null,
  157. arrww: [],
  158. tempdataSourcesId: null,
  159. xzjgBSM: "",
  160. };
  161. },
  162. mounted() {
  163. this.GetXzjg()
  164. },
  165. methods: {
  166. GetXzjg() {
  167. GetXzjg({ bsm: this.$props.rwBsm }).then((res) => {
  168. if (res.success) {
  169. this.xzjgObj = JSON.parse(JSON.stringify(res.data));
  170. this.copyData = JSON.parse(JSON.stringify(res.data));
  171. this.tempObj = JSON.parse(JSON.stringify(res.data));
  172. this.xzjgObj.dks.forEach((item) => {
  173. this.drawWktPloygon(item.geom, "#0000ff"); //item.dkbm
  174. });
  175. this.drawWktPloygon(res.data.geom, "#ff0000"); //res.data.bsm
  176. } else {
  177. this.$message.error(res.message);
  178. }
  179. });
  180. },
  181. download() {
  182. window.open(this.$props.scjgObj.task.fxbg);
  183. },
  184. viewReport() {
  185. window.open(
  186. this.$props.scjgObj.task.fxbg.replace(".docx", ".pdf"),
  187. "_blank"
  188. );
  189. },
  190. // 手动处理为GeoJSON
  191. getGeoJSON(data) {
  192. return {
  193. type: "FeatureCollection",
  194. features: data.map((geometry) => ({
  195. type: "Feature",
  196. geometry: parse(geometry),
  197. })),
  198. };
  199. },
  200. drawWktPloygon(item, itemColor, id) {
  201. // const geometry = parse(item); // 就可以得到{type: 'MultiPolygon', coordinates: Array(1)}
  202. // console.log(geometry, "geometry");
  203. let geom = {
  204. type: "FeatureCollection",
  205. features: [
  206. {
  207. type: "Feature",
  208. geometry: parse(item),
  209. },
  210. ],
  211. };
  212. this.loadGeoJSON(geom, itemColor, id);
  213. // viewer.entities.removeAll();
  214. // let geoms =
  215. // item
  216. // .substring(item.indexOf("(((") + 3, item.length - 3)
  217. // .split(")),((") ||
  218. // item.substring(item.indexOf("((") + 2, item.length - 2).split(")),((");
  219. // for (let i = 0; i < geoms.length; i++) {
  220. // let geom = geoms[i].split(",");
  221. // let points = [];
  222. // for (let j = 0; j < geom.length; j++) {
  223. // points.push(parseFloat(geom[j].split(" ")[0]));
  224. // points.push(parseFloat(geom[j].split(" ")[1]));
  225. // }
  226. // points.push(parseFloat(geom[0].split(" ")[0]));
  227. // points.push(parseFloat(geom[0].split(" ")[1]));
  228. // viewer.entities.add({
  229. // polygon: {
  230. // hierarchy: {
  231. // positions: Cesium.Cartesian3.fromDegreesArray(points),
  232. // },
  233. // material: Cesium.Color.WHITE.withAlpha(0.3),
  234. // clampToGround: true,
  235. // outline: true,
  236. // outlineWidth: 5,
  237. // outlineColor: Cesium.Color.fromCssColorString(itemColor),
  238. // },
  239. // });
  240. // }
  241. // viewer.flyTo(viewer.entities);
  242. },
  243. // 加载GeoJSON数据
  244. loadGeoJSON(geojson, yanse, id) {
  245. let _this = this;
  246. const dataSource = new Cesium.GeoJsonDataSource();
  247. dataSource
  248. .load(geojson, {
  249. clampToGround: true,
  250. stroke: Cesium.Color.fromCssColorString(yanse),
  251. fill: Cesium.Color.WHITE.withAlpha(0.3), //注意:颜色必须大写,即不能为blue
  252. strokeWidth: 5,
  253. })
  254. .then((data) => {
  255. viewer.dataSources.add(data);
  256. // let entities = data.entities.values;
  257. viewer.flyTo(data, {
  258. offset: new Cesium.HeadingPitchRange(0, -45, 5000),
  259. });
  260. if (id) {
  261. this.tempdataSourcesId = id;
  262. dataSources[id] = dataSource;
  263. }
  264. });
  265. },
  266. addprogramme(e, item) {
  267. e.stopPropagation();
  268. const list = this.bgList.filter((item1) => {
  269. return item1 == item;
  270. });
  271. if (list.length == 0) {
  272. this.bgList.push(item);
  273. const list = this.xzjgObj.dks.filter((item1) => {
  274. return item1.dkbm != item.dkbm;
  275. });
  276. this.xzjgObj.dks = list;
  277. }
  278. },
  279. deleteprogramme(e, item) {
  280. e.stopPropagation();
  281. this.bgList = this.bgList.filter((item1) => {
  282. return item1.dkbm != item.dkbm;
  283. });
  284. const temp = JSON.parse(
  285. JSON.stringify(
  286. this.tempObj.dks.filter((item1) => {
  287. return item1.dkbm == item.dkbm;
  288. })
  289. )
  290. );
  291. this.xzjgObj.dks.push(temp[0]);
  292. },
  293. resetAll() {
  294. // this.xzjgObj = JSON.parse(JSON.stringify(this.tempObj))
  295. // parent.emit("update:xzjgObj", JSON.parse(JSON.stringify(this.tempObj)));
  296. this.xzjgObj = this.copyData;
  297. this.reportText = "生成报告";
  298. this.bgList = [];
  299. },
  300. mapview(item) {
  301. console.log(item)
  302. this.drawWktPloygon(item.geom, "#ff0000", item.dkbm);
  303. },
  304. submit() {
  305. console.log("生成报告");
  306. },
  307. downReport() {
  308. window.open(this.model.zip, "_blank");
  309. },
  310. loadJgMap() {},
  311. loadJg(bsm) {
  312. console.log(bsm, "bsm");
  313. },
  314. initData() {
  315. this.model = this.rwObj;
  316. this.bgList = this.tempObj.items.filter(
  317. (item) => !this.xzjgObj.dks.some((ele) => ele.dkbm === item.dkbm)
  318. );
  319. this.bgList.sort(function (a, b) {
  320. return parseInt(a.yxfa) - parseInt(b.yxfa);
  321. });
  322. },
  323. },
  324. beforeResolve(to, from, next) {
  325. console.log(to, from, next, "to, from, next");
  326. },
  327. watch: {
  328. activeTabs(newValue, oldValue) {
  329. if (newValue == "scjg") {
  330. this.initData();
  331. }
  332. },
  333. //监听区域id的变化,用于删除上一次点击生成的geojson区域面
  334. tempdataSourcesId(newVal, oldVal) {
  335. if (oldVal) {
  336. viewer.dataSources.remove(dataSources[oldVal]);
  337. }
  338. },
  339. },
  340. beforeDestroy() {
  341. viewer.entities.removeAll();
  342. viewer.dataSources.removeAll();
  343. },
  344. };
  345. </script>
  346. <style lang="scss" scoped>
  347. .xzjg {
  348. // height: calc(100vh - 108px);
  349. // height: 49vh;
  350. height: 100%;
  351. min-width: 300px;
  352. box-sizing: border-box;
  353. padding: 0px 10px;
  354. .blue {
  355. color: #409eff;
  356. }
  357. .title {
  358. button {
  359. padding: 0;
  360. float: right;
  361. margin-right: 5px;
  362. min-height: unset;
  363. }
  364. .export {
  365. display: inline-block;
  366. background-color: #0f7ac8;
  367. text-align: center;
  368. width: 95px;
  369. height: 28px;
  370. line-height: 28px;
  371. float: right;
  372. }
  373. }
  374. .el-form-item {
  375. margin-bottom: 0;
  376. }
  377. .xz-btn {
  378. width: 100%;
  379. position: absolute;
  380. height: 55px;
  381. z-index: 2;
  382. bottom: 0;
  383. right: 0;
  384. display: flex;
  385. align-items: center;
  386. }
  387. .clat-title {
  388. padding-left: 10px;
  389. padding-right: 5px;
  390. display: inline-flex;
  391. .clat-title-head {
  392. display: inline-block;
  393. max-width: 280px;
  394. overflow: hidden;
  395. text-overflow: ellipsis;
  396. }
  397. }
  398. }
  399. .tools {
  400. position: absolute;
  401. right: 30px;
  402. }
  403. .collapseCon {
  404. p {
  405. width: 100%;
  406. height: 30px;
  407. line-height: 30px;
  408. // background-color: pink;
  409. color: #fff;
  410. }
  411. p:nth-child(2) {
  412. position: relative;
  413. // padding-right: 20px;
  414. img {
  415. position: absolute;
  416. top: 6px;
  417. }
  418. }
  419. .oneItem {
  420. .iconSun {
  421. width: 16px;
  422. height: 16px;
  423. display: inline-block;
  424. background: url("../../../../static//images//ghzc//iconSun.png") no-repeat;
  425. background-size: 100% 100%;
  426. }
  427. span {
  428. // border: 1px solid #02a7f0;
  429. padding: 3px 5px;
  430. border-radius: 2px 2px 2px 2px;
  431. }
  432. span:first-child {
  433. background: rgba(253, 219, 59, 0.2);
  434. font-size: 14px;
  435. color: #ffc700;
  436. }
  437. span:nth-child(2) {
  438. background: rgba(155, 255, 139, 0.2);
  439. font-size: 14px;
  440. color: #9bff8b;
  441. }
  442. p {
  443. font-size: 14px;
  444. color: #cddeeb;
  445. }
  446. }
  447. }
  448. .bxCon {
  449. width: 100%;
  450. height: 94%;
  451. // background-color: #9aff8b87;
  452. overflow: hidden;
  453. overflow-y: auto;
  454. }
  455. /deep/ .el-collapse {
  456. // width: 95%;
  457. border: none;
  458. }
  459. /deep/ .el-scrollbar {
  460. border: 1px solid #0f7ac8 !important;
  461. // padding: 0 10px;
  462. }
  463. /deep/ .el-collapse-item__header {
  464. border-bottom: 1px solid rgba(102, 126, 143, 0.747);
  465. position: relative;
  466. }
  467. /deep/ .el-collapse-item__wrap {
  468. border-bottom: 1px solid rgba(102, 126, 143, 0.5) !important;
  469. }
  470. /deep/ .el-scrollbar__wrap {
  471. padding: 0 10px;
  472. }
  473. </style>