scjg.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. <template>
  2. <div class="scjg">
  3. <div>
  4. <div class="downloadDiv">
  5. <span>项目名称:{{ ruleForm.name }}</span>
  6. <el-button type="primary" size="mini" @click="download">
  7. 导出报告
  8. </el-button>
  9. </div>
  10. <div>分析面积:{{ ruleForm.xzmj }}平方千米</div>
  11. </div>
  12. <div v-for="(eitem, i) in echarts" :key="i" class="echars">
  13. <div class="echartTitle">
  14. <div class="block-title">{{ eitem.label }}</div>
  15. <div
  16. class="eicon"
  17. :class="eitem.iseyes ? 'eyes' : 'close_eyes'"
  18. @click="eyesChaneg(i)"
  19. ></div>
  20. <div
  21. class="eicon"
  22. :class="eitem.isshow ? 'eshow' : 'eclose'"
  23. @click="eitem.isshow = !eitem.isshow"
  24. ></div>
  25. </div>
  26. <pie v-show="eitem.isshow" class="echart" :ref="`echartRef`"></pie>
  27. </div>
  28. <!-- v-show="isshow" -->
  29. </div>
  30. </template>
  31. <script>
  32. import pie from "@/components/echartsTemplate/pie.vue";
  33. import hgxfx from "../../../../static/data/ghss/data.js";
  34. export default {
  35. components: { pie },
  36. props: {
  37. scjgObj: {
  38. type: Object,
  39. },
  40. jgTable: {
  41. type: Boolean,
  42. },
  43. },
  44. data() {
  45. return {
  46. echarts: [
  47. { label: "现状分析", iseyes: false, isshow: true },
  48. { label: "三线分析", iseyes: false, isshow: true },
  49. // { label: "土地利用规划分析", iseyes: false, isshow: false },
  50. { label: "详细规划分析", iseyes: false, isshow: false },
  51. ],
  52. ruleForm: {
  53. name: "",
  54. xzmj: "",
  55. fileList: [],
  56. },
  57. dataSources: {},
  58. };
  59. },
  60. mounted() {
  61. this.ruleForm.name = hgxfx.name;
  62. this.ruleForm.xzmj = hgxfx.xzmj;
  63. this.setEchart1();
  64. this.setEchart2();
  65. // this.setEchart3();
  66. this.setEchart4();
  67. },
  68. methods: {
  69. eyesChaneg(i) {
  70. this.echarts[i].iseyes = !this.echarts[i].iseyes;
  71. let label = this.echarts[i].label;
  72. let id = "scjg" + i;
  73. if (this.dataSources[id]) {
  74. this.dataSources[id].show = this.echarts[i].iseyes;
  75. } else this.addPolygon(label, id);
  76. // emit("eyesChaneg");
  77. },
  78. setEchart1() {
  79. this.$nextTick(() => {
  80. this.$refs.echartRef[0].setOptions(hgxfx.xzfxlist);
  81. });
  82. },
  83. setEchart2() {
  84. this.$nextTick(() => {
  85. this.$refs.echartRef[1].setOptions(hgxfx.sxfxlist);
  86. });
  87. },
  88. setEchart3() {
  89. this.$nextTick(() => {
  90. this.$refs.echartRef[2].setOptions(hgxfx.tdlylist);
  91. });
  92. },
  93. setEchart4() {
  94. this.$nextTick(() => {
  95. this.$refs.echartRef[2].setOptions(hgxfx.xxghlist);
  96. });
  97. },
  98. // 加载GeoJSON数据
  99. addPolygon(label, id) {
  100. let _this = this;
  101. // viewer.entities.removeAll();
  102. let polygon = Cesium.GeoJsonDataSource.load(
  103. `/static/data/ghss/${label}.geojson`,
  104. { clampToGround: true }
  105. );
  106. polygon.then(function (dataSource) {
  107. // dataSource.id = id;
  108. // 将数据源添加到Cesium Viewer
  109. viewer.dataSources.add(dataSource);
  110. viewer.zoomTo(dataSource);
  111. _this.dataSources[id] = dataSource;
  112. // 可以获取实体并进行操作
  113. // dataSource.entities.values.forEach((entity) => {
  114. // // 你可以在这里设置实体的属性,例如位置、颜色等
  115. // // console.log(entity);
  116. // });
  117. });
  118. },
  119. download() {
  120. window.open(this.$props.scjgObj.task.fxbg);
  121. },
  122. viewReport() {
  123. window.open(
  124. this.$props.scjgObj.task.fxbg.replace(".docx", ".pdf"),
  125. "_blank"
  126. );
  127. },
  128. reset() {
  129. this.dataSources = {};
  130. viewer.dataSources.removeAll();
  131. },
  132. },
  133. // watch(
  134. // () => prop.scjgObj,
  135. // (newValue, oldValue) => {
  136. // this.jcfwlist[0].value = newValue.task.fxmj + "m²";
  137. // nextTick(() => {
  138. // this.setEcharts(newValue);
  139. // });
  140. // }
  141. // );
  142. watch: {},
  143. };
  144. </script>
  145. <style lang="scss" scoped>
  146. .scjg {
  147. height: 100%;
  148. overflow-y: auto;
  149. overflow-x: hidden;
  150. line-height: 40px;
  151. .downloadDiv {
  152. span {
  153. width: calc(100% - 100px);
  154. display: inline-block;
  155. }
  156. }
  157. .echars {
  158. margin-bottom: 10px;
  159. .echartTitle {
  160. width: 100%;
  161. height: 40px;
  162. display: flex;
  163. justify-content: space-between;
  164. background: rgba(38, 38, 38, 0.9);
  165. margin-right: 10px;
  166. line-height: 40px;
  167. .block-title {
  168. width: calc(100% - 80px);
  169. }
  170. .eicon {
  171. width: 30px;
  172. height: 30px;
  173. margin: 5px;
  174. background-size: 100% 100%;
  175. }
  176. .eyes {
  177. background-image: url("/static/images/ghzc/eyes.png");
  178. }
  179. .close_eyes {
  180. background-image: url("/static/images/ghzc/close_eyes.png");
  181. }
  182. .eshow {
  183. background-image: url("/static/images/ghzc/to_bottom.png");
  184. }
  185. .eclose {
  186. background-image: url("/static/images/ghzc/to_right.png");
  187. }
  188. }
  189. .echart {
  190. width: 380px;
  191. height: 150px;
  192. }
  193. }
  194. }
  195. </style>