jclxqk.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461
  1. <template>
  2. <div>
  3. <div class="headerSelect">
  4. <el-select
  5. v-model="yearsVal"
  6. placeholder="请选择"
  7. @change="yearsChange"
  8. clearable
  9. >
  10. <el-option
  11. v-for="item in yearsOpt"
  12. :key="item.quarter"
  13. :label="item.quarter"
  14. :value="item"
  15. >
  16. </el-option>
  17. </el-select>
  18. <el-cascader
  19. :show-all-levels="false"
  20. :options="xzqTreeData"
  21. placeholder="行政区"
  22. @change="regionChange"
  23. :props="{ checkStrictly: true, expandTrigger: 'hover' }"
  24. clearable
  25. v-model="region"
  26. ></el-cascader>
  27. <el-select
  28. v-model="monitorVal"
  29. placeholder="请选择"
  30. @change="typeChange"
  31. clearable
  32. >
  33. <el-option
  34. v-for="item in monitorOpt"
  35. :key="item.dictCode"
  36. :label="item.dictValue"
  37. :value="item.dictCode"
  38. >
  39. </el-option>
  40. </el-select>
  41. </div>
  42. <div class="divrow">
  43. <div class="divCol">
  44. <div class="divImg">
  45. <img
  46. src="/static/images/overview/icon_yrkkg.png"
  47. style="height: 3.1rem; width: 3.1rem"
  48. />
  49. </div>
  50. <div class="divText">
  51. <div>
  52. <span style="color: #fff">监测图斑数</span>
  53. </div>
  54. <div>
  55. <span class="numberColor">{{ sdata.jcgs }}个</span>
  56. </div>
  57. </div>
  58. </div>
  59. <div class="divCol">
  60. <div class="divImg">
  61. <img
  62. src="/static/images/overview/icon_yrkkg.png"
  63. style="height: 3.1rem; width: 3.1rem"
  64. />
  65. </div>
  66. <div class="divText">
  67. <div>
  68. <span style="color: #fff">监测面积</span>
  69. </div>
  70. <div>
  71. <span class="numberColor">{{ sdata.jcmj }}km²</span>
  72. </div>
  73. </div>
  74. </div>
  75. </div>
  76. <div class="echars">
  77. <div class="echartTitle">
  78. <div class="block-title">监测类型情况</div>
  79. <div class="selectTab">
  80. <el-select
  81. v-model="tab"
  82. placeholder="请选择"
  83. :popper-append-to-body="true"
  84. @change="GetInfo()"
  85. >
  86. <el-option
  87. v-for="item in options"
  88. :key="item.value"
  89. :label="item.name"
  90. :value="item.value"
  91. >
  92. </el-option>
  93. </el-select>
  94. </div>
  95. </div>
  96. <div class="content">
  97. <div class="echars2">
  98. <div ref="echars_pie" id="echars_pie"></div>
  99. </div>
  100. </div>
  101. </div>
  102. <Statistics
  103. title="图斑分布情况"
  104. :cityList="cityList"
  105. height="236"
  106. ></Statistics>
  107. </div>
  108. </template>
  109. <script>
  110. import Statistics from "./statistics";
  111. import { GetXzqhTree } from "@/api/map";
  112. import { QueryOne, QueryList } from "@/api/cockpitNew";
  113. import { GetDateList, CodeList, JscQueryList } from "@/api/ghss/jctb.js";
  114. export default {
  115. components: {
  116. Statistics,
  117. },
  118. data() {
  119. return {
  120. region: "4602",
  121. xzqTreeData: [], //申请范围
  122. tab: 1,
  123. options: [
  124. { name: "图斑数", value: 1 },
  125. { name: "监测面积", value: 2 },
  126. ],
  127. sdata: {},
  128. myChart: null,
  129. cityList: [],
  130. yearsOpt: [], //检测图斑时间季度
  131. monitorOpt: [
  132. {
  133. value: "全部监测类型",
  134. label: "全部监测类型",
  135. },
  136. {
  137. value: "新增建筑物",
  138. label: "新增建筑物",
  139. },
  140. {
  141. value: "新增耕地",
  142. label: "新增耕地",
  143. },
  144. ],
  145. monitorVal: "",
  146. yearsVal: "",
  147. val0: "2024-02-17 00:00:00",
  148. val1: "2024-12-31 23:59:59",
  149. val2: "",
  150. };
  151. },
  152. computed: {},
  153. mounted() {
  154. this.getXzqTreeData();
  155. this.getData();
  156. },
  157. methods: {
  158. regionChange(region) {
  159. if (region.length && region.length > 1) {
  160. this.region = region[1];
  161. } else {
  162. this.region = region[0];
  163. }
  164. this.getData();
  165. },
  166. typeChange(val) {
  167. this.val2 = val;
  168. this.getzl();
  169. },
  170. //年份季度改变
  171. yearsChange(val) {
  172. if (val) {
  173. val = JSON.parse(JSON.stringify(val));
  174. this.val0 = val.startTime;
  175. this.val1 = val.endTime;
  176. this.yearsVal = val.quarter;
  177. } else {
  178. this.val0 = "2024-02-17 00:00:00";
  179. this.val1 = "2024-12-31 23:59:59";
  180. }
  181. // this.getzl();
  182. // this.GetCityList();
  183. // this.initEcharts();
  184. this.getData();
  185. },
  186. getXzqTreeData() {
  187. GetXzqhTree().then((res) => {
  188. if (res.data.length > 0) {
  189. const list = res.data[0].children.filter((item) => {
  190. return item.label == "三亚市";
  191. });
  192. if (list.length > 0) {
  193. list[0].value = "4602";
  194. this.xzqTreeData = list[0];
  195. } else this.xzqTreeData = res.data;
  196. }
  197. });
  198. GetDateList().then((res) => {
  199. this.yearsOpt = res.data;
  200. });
  201. //检测类型分类
  202. CodeList({
  203. dictType: "卫片执法后地类分类标准‌",
  204. pageNum: 1,
  205. pageSize: 999,
  206. }).then((res) => {
  207. if (res.code == 200) {
  208. this.monitorOpt = res.rows;
  209. }
  210. });
  211. },
  212. getData() {
  213. this.getzl();
  214. this.GetCityList();
  215. this.initEcharts();
  216. },
  217. async getzl() {
  218. let sdres = await QueryOne({
  219. jscType: "t_gdbh_jctb_tbzl",
  220. id: this.region,
  221. val0: this.val0,
  222. val1: this.val1,
  223. val2: this.val2,
  224. });
  225. this.sdata = sdres.data;
  226. },
  227. async GetCityList() {
  228. this.cityList = [];
  229. let flres = await QueryList({
  230. jscType: "t_gdbh_jctb_qxfl",
  231. id: this.region,
  232. val0: this.val0,
  233. val1: this.val1,
  234. });
  235. flres.data.forEach((fl) => {
  236. this.cityList.push({
  237. name: fl.xzqmc,
  238. number: fl.jcgs,
  239. area: fl.jcmj,
  240. unit: "km²",
  241. });
  242. });
  243. },
  244. async initEcharts() {
  245. this.myChart = echarts.init(this.$refs.echars_pie);
  246. let jclxres = await JscQueryList({
  247. jscType: "t_gdbh_jctb_jclx",
  248. id: this.region,
  249. val0: this.val0,
  250. val1: this.val1,
  251. });
  252. var names = [];
  253. var values = [];
  254. if (jclxres.data.length) {
  255. jclxres.data.forEach((item) => {
  256. names.push(item.dict_value);
  257. values.push(item.jcmj);
  258. });
  259. }
  260. let option = {
  261. // backgroundColor: "#041139",
  262. tooltip: {
  263. trigger: "item",
  264. },
  265. legend: {
  266. show: false,
  267. },
  268. grid: {
  269. top: 10,
  270. left: 30,
  271. right: 20,
  272. bottom: 60,
  273. },
  274. xAxis: [
  275. {
  276. data: names,
  277. axisLabel: {
  278. textStyle: {
  279. color: "#D8F0FF",
  280. fontSize: 11,
  281. },
  282. interval: 0,
  283. // rotate: 30,
  284. margin: 10, //刻度标签与轴线之间的距离。
  285. rotate: 40,
  286. // 超过4个字显示省略号
  287. formatter: function (value) {
  288. if (value.length > 5) {
  289. return `${value.slice(0, 5)}...`;
  290. }
  291. return value;
  292. },
  293. },
  294. axisLine: {
  295. show: false, //不显示x轴
  296. lineStyle: {
  297. color: "rgba(53,65,95,1)",
  298. },
  299. },
  300. axisTick: {
  301. show: false, //不显示刻度
  302. },
  303. boundaryGap: true,
  304. splitLine: {
  305. show: false,
  306. },
  307. },
  308. ],
  309. yAxis: [
  310. {
  311. splitLine: {
  312. show: false,
  313. },
  314. axisTick: {
  315. show: false,
  316. },
  317. axisLine: {
  318. show: false, //不显示x轴
  319. lineStyle: {
  320. color: "rgba(53,65,95,1)",
  321. },
  322. },
  323. axisLabel: {
  324. show: true,
  325. textStyle: {
  326. color: "#D8F0FF",
  327. fontSize: 14,
  328. },
  329. },
  330. },
  331. ],
  332. series: [
  333. // 柱体
  334. {
  335. name: "监测类型情况",
  336. type: "bar",
  337. barWidth: 15,
  338. showBackground: true,
  339. backgroundStyle: {
  340. color: "rgba(105,160,231,0.2)",
  341. borderRadius: [30, 30, 30, 30],
  342. },
  343. itemStyle: {
  344. // normal: {
  345. // color: "#E5E5E5",
  346. // barBorderRadius: 24
  347. // },
  348. color: {
  349. x: 0,
  350. y: 0,
  351. x2: 0,
  352. y2: 1,
  353. type: "linear",
  354. global: false,
  355. colorStops: [
  356. {
  357. //第一节下面
  358. offset: 0,
  359. color: "#00D5FF",
  360. },
  361. {
  362. offset: 1,
  363. color: "#10274B",
  364. },
  365. ],
  366. },
  367. borderRadius: [30, 30, 30, 30],
  368. },
  369. label: {
  370. show: false, //每条柱状图是否显示数字
  371. formatter: "{c}",
  372. position: "top",
  373. color: "#fff",
  374. fontSize: 14,
  375. },
  376. data: values,
  377. },
  378. ],
  379. };
  380. this.myChart.setOption(option);
  381. },
  382. },
  383. watch: {},
  384. beforeDestroy() {},
  385. };
  386. </script>
  387. <style lang="less" scoped>
  388. .divrow {
  389. margin: 0;
  390. padding: 0;
  391. display: flex;
  392. justify-content: space-between;
  393. }
  394. .divImg {
  395. width: 30%;
  396. }
  397. img {
  398. height: 3.1rem;
  399. width: 3.1rem;
  400. }
  401. .divCol {
  402. width: 184px;
  403. height: 75px;
  404. background: inherit;
  405. background-color: rgba(104, 244, 251, 0.21568627);
  406. border: none;
  407. border-radius: 5px;
  408. display: flex;
  409. white-space: nowrap;
  410. align-items: center;
  411. padding-left: 15px;
  412. justify-content: space-around;
  413. }
  414. .divText {
  415. width: 65%;
  416. padding-left: 0.5rem;
  417. .numberColor {
  418. font-weight: 700;
  419. font-style: normal;
  420. font-size: 13px;
  421. color: #00ffff;
  422. }
  423. }
  424. #echars_pie {
  425. height: 260px;
  426. width: 402px;
  427. }
  428. .headerSelect {
  429. width: 100%;
  430. height: 26px;
  431. // background: #00ffff;
  432. margin: 5px 0px;
  433. display: flex;
  434. justify-content: space-between;
  435. /deep/ .el-input--suffix .el-input__inner {
  436. padding-right: 15px;
  437. height: 26px;
  438. background-color: transparent;
  439. border: none;
  440. color: #fff;
  441. }
  442. /deep/ .el-cascader {
  443. line-height: 26px;
  444. }
  445. /deep/.el-input__icon {
  446. line-height: 1;
  447. color: #fff;
  448. }
  449. /deep/ .el-input__inner::placeholder {
  450. color: #fff;
  451. }
  452. }
  453. </style>