sdgk.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  1. <template>
  2. <div class="sdgk">
  3. <div class="tdTitle">试点概况</div>
  4. <div class="content sdata">
  5. <div class="item" v-for="(sd, index) in sdlist" :key="index">
  6. <div class="text">
  7. <p>{{ sd.name }}</p>
  8. <span class="cvalue"
  9. >{{
  10. index == 2
  11. ? sdata[sd.prop] || 0
  12. : (sdata[sd.prop] || 0).toFixed(2)
  13. }}
  14. </span>
  15. <span class="unit">{{ sd.unit }}</span>
  16. </div>
  17. </div>
  18. </div>
  19. <div class="echars">
  20. <div class="echartTitle">
  21. <div class="block-title">整治项目</div>
  22. </div>
  23. <pie unit="个" class="pie_echart" ref="echartRef0"></pie>
  24. <div class="xm" @click="gozzxm"></div>
  25. </div>
  26. <div class="echars">
  27. <div class="echartTitle">
  28. <div class="block-title">现状信息</div>
  29. <div class="selectTab">
  30. <el-select
  31. v-model="tab"
  32. placeholder="请选择"
  33. :popper-append-to-body="false"
  34. @change="Getxzxx()"
  35. >
  36. <el-option
  37. v-for="item in options"
  38. :key="item.value"
  39. :label="item.name"
  40. :value="item.value"
  41. >
  42. </el-option>
  43. </el-select>
  44. </div>
  45. </div>
  46. <div class="content">
  47. <div class="item" v-for="(sd, index) in xzlist" :key="index">
  48. <div class="icon">
  49. <div class="iicon" :class="sd.value"></div>
  50. </div>
  51. <div class="text">
  52. <p>{{ sd.name }}</p>
  53. <span class="cvalue">{{ (xzdata[sd.prop] || 0).toFixed(2) }} </span>
  54. <span class="unit">{{ sd.unit }}</span>
  55. </div>
  56. </div>
  57. </div>
  58. </div>
  59. <div class="echars">
  60. <div class="echartTitle">
  61. <div class="block-title">试点投资</div>
  62. </div>
  63. <div class="content ztzc">
  64. <div class="text">
  65. <span>总投资</span>
  66. <span class="cvalue">{{ (tzdata.jhtz || 0).toFixed(2) }} </span>
  67. <span class="unit">万元</span>
  68. </div>
  69. </div>
  70. <div class="tzdiv" ref="tzRef"></div>
  71. <div class="content tzcontent">
  72. <div class="item">
  73. <div class="text">
  74. <p>财政投资</p>
  75. <span class="cvalue">{{ (tzdata.czjhtz || 0).toFixed(2) }} </span>
  76. <span class="unit">万元</span>
  77. <p>{{ (tzdata.czratio || 0).toFixed(2) }}%</p>
  78. </div>
  79. </div>
  80. <div class="item"></div>
  81. <div class="item">
  82. <div class="text">
  83. <p>社会投资</p>
  84. <span class="cvalue">{{ (tzdata.shjhtz || 0).toFixed(2) }} </span>
  85. <span class="unit">万元</span>
  86. <p>{{ (tzdata.sjratio || 0).toFixed(2) }}%</p>
  87. </div>
  88. </div>
  89. </div>
  90. </div>
  91. </div>
  92. </template>
  93. <script>
  94. import pie from "@/components/echartsTemplate/pie.vue";
  95. import { overview, district, reason } from "@/api/Idleland.js";
  96. import { QueryOne, QueryList } from "@/api/cockpitNew";
  97. import { legends } from "./config.js";
  98. import { loadGeoJSON } from "@/utils/MapHelper/help.js";
  99. let geoSources = {};
  100. export default {
  101. props: {},
  102. data() {
  103. return {
  104. region: "",
  105. sdata: {},
  106. sdlist: [
  107. { name: "试点区域", prop: "试点面积", unit: "公顷" },
  108. { name: "整治区域", prop: "整治面积", unit: "公顷" },
  109. { name: "涉及村庄", prop: "村庄个数", unit: "个" },
  110. ],
  111. tab: "sd",
  112. options: [
  113. { name: "试点区域", value: "sd" },
  114. { name: "整治区域", value: "zzqy" },
  115. ],
  116. xzlist: [
  117. { name: "农用地面积", prop: "nydmk", unit: "公顷" },
  118. { name: "建设用地面积", prop: "jsydmj", unit: "公顷" },
  119. { name: "未利用地面积", prop: "wlytmj", unit: "公顷" },
  120. { name: "耕地面积", prop: "gd", unit: "公顷" },
  121. { name: "永久基本农田", prop: "yjjbnt", unit: "公顷" },
  122. { name: "生态红线划定", prop: "sthxhdmj", unit: "公顷" },
  123. ],
  124. xzdata: {},
  125. tzdata: {},
  126. };
  127. },
  128. components: {
  129. pie,
  130. },
  131. mounted() {},
  132. methods: {
  133. changeData(name, updata) {
  134. this[name] = updata;
  135. },
  136. gozzxm() {
  137. this.$emit("gozzxm");
  138. },
  139. regionChange(region) {
  140. this.region = region;
  141. this.getData();
  142. },
  143. getData() {
  144. this.$emit("updateParent", "loading", true);
  145. this.Getzzxm();
  146. this.Getxzxx();
  147. this.Getsdtz();
  148. this.Getkjxx();
  149. // this.Getkjxx();
  150. // this.Getkjxx();
  151. // this.Getkjxx();
  152. },
  153. async Getzzxm() {
  154. let sdres = await QueryOne({
  155. jscType: "qytuzz_sdzl_sdqk",
  156. id: this.region,
  157. });
  158. this.sdata = sdres.data;
  159. let { data } = await QueryList({
  160. jscType: "jsc_stxf_ywfl_tdzz",
  161. id: this.region,
  162. });
  163. let num = 0;
  164. data.forEach((res) => {
  165. res.name = res.zzlx;
  166. res.value = res.xmsl;
  167. num += res.xmsl;
  168. });
  169. this.setEchart(
  170. { data, type: '"horizontal"', title: { text: "整治项目", num } },
  171. 0
  172. );
  173. },
  174. async Getxzxx() {
  175. let res = await QueryOne({
  176. jscType: `qytuzz_sdzl_xzxx_${this.tab}`,
  177. id: this.region,
  178. });
  179. this.xzdata = res.data;
  180. this.$emit("updateParent", "loading", false);
  181. },
  182. async Getsdtz() {
  183. let { data } = await QueryOne({
  184. jscType: "qytuzz_sdzl_sdtz",
  185. id: this.region,
  186. });
  187. let czratio = data.jhtz ? (data.czjhtz / data.jhtz) * 100 : 0;
  188. let sjratio = data.jhtz ? (data.shjhtz / data.jhtz) * 100 : 0;
  189. this.tzdata = { ...data, czratio, sjratio };
  190. const background = `linear-gradient(to right,#DFE15A ${czratio}%,#62ADED 0%)`;
  191. this.$refs.tzRef.style.background = background;
  192. this.$emit("updateParent", "loading", false);
  193. },
  194. async Getkjxx() {
  195. let jxres = await QueryList({
  196. jscType: "qytuzz_sdzl_kjxx_jx",
  197. id: this.region,
  198. });
  199. if (jxres.data && jxres.data.length)
  200. loadGeoJSON(jxres.data[0].geom, "#ffffff", { isfly: true }, (data) => {
  201. // geoSources[ri] = data;
  202. data.name = "sdqy";
  203. data.show = false;
  204. });
  205. let res = await QueryList({
  206. jscType: "qytuzz_sdzl_kjxx",
  207. id: this.region,
  208. });
  209. this.active_tableData(res.data);
  210. },
  211. active_tableData(newVal) {
  212. newVal.forEach((res, ri) => {
  213. let color = legends[res.type].color;
  214. if (res.geom)
  215. loadGeoJSON(
  216. res.geom,
  217. color,
  218. {
  219. isfly: false,
  220. name: res.name,
  221. lab_max: res.type ? 1000 : 100000,
  222. },
  223. (data) => {
  224. geoSources[ri] = data;
  225. data.name = res.type == 0 ? "sdqy" : "zzqy";
  226. // data.show = false;
  227. // data.entities.values.forEach((entity) => {
  228. // entity.properties = { type: "图斑上图", id: res.id };
  229. // });
  230. }
  231. );
  232. });
  233. },
  234. sourcesshow(isshow) {
  235. Object.keys(geoSources).forEach((name) => {
  236. console.log(name, geoSources[name]);
  237. geoSources[name].show = isshow;
  238. });
  239. },
  240. reset() {
  241. // if (!window.viewer) return;
  242. // viewer.entities.removeAll();
  243. // viewer.dataSources.removeAll();
  244. // viewer.dataSources._dataSources.forEach((das) => {
  245. // if (das.name == "LandConsolidation") {viewer.dataSources.remove(das);}
  246. // });
  247. },
  248. changeCharts(e) {},
  249. setEchart(data, id) {
  250. this.$nextTick(() => {
  251. this.$refs[`echartRef${id}`].setOptions(data);
  252. });
  253. },
  254. },
  255. watch: {
  256. region(newValue) {
  257. console.log(newValue, "---");
  258. },
  259. },
  260. };
  261. </script>
  262. <style lang="scss" scoped>
  263. .sdgk {
  264. height: 100%;
  265. .content {
  266. width: 100%;
  267. height: 190px;
  268. .item {
  269. width: 32%;
  270. // height: 100px;
  271. display: inline-block;
  272. position: relative;
  273. .icon {
  274. width: 100%;
  275. height: 50px;
  276. display: flex;
  277. justify-content: space-between;
  278. }
  279. .iicon {
  280. background: no-repeat 50%;
  281. background-image: url("/static/images/overview/icon_yrkkg.png");
  282. width: 45px;
  283. height: 45px;
  284. flex: 1;
  285. }
  286. }
  287. .text {
  288. display: inline-block;
  289. // border: #00FFFF 1px solid;
  290. width: 100%;
  291. margin-bottom: 4px;
  292. text-align: center;
  293. margin-left: 0.3rem;
  294. .cvalue {
  295. font-family: "Arial Negreta", "Arial Normal", "Arial";
  296. font-weight: 700;
  297. font-style: normal;
  298. color: #68f4fb;
  299. }
  300. .unit {
  301. color: #fff;
  302. }
  303. }
  304. }
  305. .sdata {
  306. height: 50px;
  307. }
  308. .ztzc {
  309. height: 30px;
  310. line-height: 30px;
  311. font-size: 16px;
  312. margin-top: 10px;
  313. }
  314. .tzcontent {
  315. height: 100px;
  316. }
  317. .echartlist {
  318. width: 100%;
  319. height: calc(100% - 120px);
  320. overflow-y: auto;
  321. overflow-x: hidden;
  322. .block-title {
  323. width: calc(100% - 130px) !important;
  324. }
  325. }
  326. .echart {
  327. height: 200px !important;
  328. }
  329. .echars {
  330. position: relative;
  331. }
  332. .pie_echart {
  333. width: 400px;
  334. height: 180px;
  335. }
  336. .xm {
  337. width: 50px;
  338. height: 50px;
  339. position: absolute;
  340. left: 18%;
  341. top: 50%;
  342. cursor: pointer;
  343. z-index: 100;
  344. }
  345. .tzdiv {
  346. height: 20px;
  347. margin: 5px 20px;
  348. // background: #62aded;
  349. }
  350. }
  351. </style>