PipeMileageDialog.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. <template>
  2. <base-drag-bg-dialog
  3. :dialogConfig="baseDialogConfig"
  4. @handleClose="closeDialog"
  5. @onActivated="onActivated"
  6. >
  7. <!-- 弹窗内容 -->
  8. <div class="dialog_box">
  9. <!-- 内容 -->
  10. <div class="dialog_content_box">
  11. <div class="chart-box">
  12. <div class="dateTime-chart">
  13. <!-- <div class="chart-title">
  14. {{ baseDialogConfig.title }}
  15. </div> -->
  16. <el-row class="chart-row">
  17. <el-col>
  18. <date-time-bar
  19. v-if="statisticData"
  20. :data="statisticData"
  21. :baseConfig="{ ids: 'stackBarChart', unit: '次' }"
  22. @handleChartClick="handleChartClick"
  23. />
  24. </el-col>
  25. </el-row>
  26. </div>
  27. </div>
  28. </div>
  29. </div>
  30. </base-drag-bg-dialog>
  31. </template>
  32. <script>
  33. import BaseDragBgDialog from "@/views/components/base/BaseDragBgDialog.vue";
  34. import { getMileageList } from "@/API/report";
  35. import { DateTimeBar } from "@/views/components/chart";
  36. import { mapGetters } from "vuex";
  37. export default {
  38. name: "PipeMileageDialog",
  39. components: { BaseDragBgDialog, DateTimeBar },
  40. watch: {
  41. "pipeMileageDialog.show": {
  42. handler(newVal) {
  43. this.baseDialogConfig.show = newVal;
  44. if (this.statisticData.date.length == 0) {
  45. this.getMileageList();
  46. }
  47. // if (newVal) {
  48. // this.openFullScreen()
  49. // }
  50. },
  51. // deep: true,
  52. immediate: true,
  53. },
  54. },
  55. data() {
  56. return {
  57. BASE_URL,
  58. baseDialogConfig: {
  59. dialogId: "pipeMileage",
  60. show: false,
  61. title: "陕京四线里程高程图",
  62. width: 1560,
  63. height: 460,
  64. center: true,
  65. zIndex: 10,
  66. },
  67. statisticData: {
  68. date: [],
  69. seriesData: [
  70. {
  71. data: [],
  72. name: "高程",
  73. code: "100006",
  74. markPointData: [],
  75. },
  76. ],
  77. chartType: "line",
  78. limitNumber: 0,
  79. },
  80. };
  81. },
  82. computed: {
  83. ...mapGetters(["pipeMileageDialog"]),
  84. },
  85. created() {},
  86. mounted() {
  87. this.getMileageList();
  88. },
  89. methods: {
  90. closeDialog() {
  91. this.$store.dispatch("dialog/setPipeMileageDialog", {
  92. show: false,
  93. dialogMsg: {},
  94. type: "",
  95. });
  96. },
  97. async getMileageList() {
  98. try {
  99. const res = await getMileageList({
  100. pageSize: 10000000,
  101. pageIndex: 1,
  102. listOrder: ["field001,asc"],
  103. pageId: "822794755799785472",
  104. });
  105. if (res.code === 20000) {
  106. let mileage = [];
  107. let data = [];
  108. let points = [];
  109. res.data.content.forEach((item, index) => {
  110. mileage.push(item.field002);
  111. data.push(item.field003);
  112. if (item.field004) {
  113. points.push({
  114. yAxis: item.field003,
  115. xAxis: index,
  116. value: item.field004,
  117. });
  118. }
  119. });
  120. this.statisticData.date = mileage;
  121. this.statisticData.seriesData[0].data = data;
  122. this.statisticData.seriesData[0].markPointData = points;
  123. }
  124. console.log("图表信息:", this.statisticData);
  125. // 刷新报警列表页
  126. } catch (err) {
  127. console.log(err);
  128. }
  129. },
  130. onActivated() {
  131. // console.log("aaa");
  132. this.$nextTick(() => {
  133. this.$refs.dealContent.focus();
  134. });
  135. },
  136. // 图表的点击操作
  137. handleChartClick(params) {
  138. if (params.seriesType === "bar") {
  139. let selectTime = params.name.replace(
  140. /(\d{4}).(\d{1,2}).(\d{1,2}).+/gm,
  141. "$1-$2-$3"
  142. );
  143. this.query.tags.dateTag = params.name;
  144. this.queryTags.find((tag) => tag.type === "dateTag").name = params.name;
  145. this.getCacheData();
  146. }
  147. },
  148. openFullScreen() {
  149. const loading = this.$loading({
  150. lock: true,
  151. text: "Loading",
  152. spinner: "el-icon-loading",
  153. background: "rgba(0, 0, 0, 0.7)",
  154. });
  155. setTimeout(() => {
  156. loading.close();
  157. }, 800);
  158. },
  159. },
  160. };
  161. </script>
  162. <style lang="less" scoped>
  163. .dialog_box {
  164. width: 100%;
  165. height: 100%;
  166. box-sizing: border-box;
  167. padding: 30px 10px 0;
  168. pointer-events: auto;
  169. .dialog_content_box {
  170. width: 100%;
  171. padding: 0 20px;
  172. box-sizing: border-box;
  173. .search-box {
  174. width: 100%;
  175. display: flex;
  176. padding: 0.052083rem /* 10/192 */ 0;
  177. color: #fff;
  178. .search-item {
  179. display: flex;
  180. .search-label {
  181. display: inline-block;
  182. width: 0.28125rem /* 54/192 */;
  183. font-size: 0.072917rem /* 14/192 */;
  184. line-height: 0.145833rem /* 28/192 */;
  185. text-align: center;
  186. }
  187. .search-date.el-input__inner {
  188. width: 1.5625rem /* 300/192 */;
  189. height: 0.145833rem /* 28/192 */;
  190. border-radius: 0;
  191. }
  192. .el-select {
  193. margin-right: 0.052083rem /* 10/192 */;
  194. ::v-deep .el-input__inner {
  195. width: 0.520833rem /* 100/192 */;
  196. height: 0.145833rem /* 28/192 */;
  197. border-radius: 0;
  198. // padding-right: 0.182292rem /* 35/192 */;
  199. }
  200. ::v-deep .el-input__icon {
  201. line-height: 0.145833rem /* 28/192 */;
  202. }
  203. }
  204. }
  205. .search-btn {
  206. box-sizing: border-box;
  207. width: 0.145833rem /* 28/192 */;
  208. height: 0.145833rem /* 28/192 */;
  209. line-height: 0.145833rem /* 28/192 */;
  210. text-align: center;
  211. justify-content: right;
  212. color: #fff;
  213. font-size: 0.072917rem /* 14/192 */;
  214. cursor: pointer;
  215. border: 0.005208rem /* 1/192 */ solid #5bd6ff;
  216. border-radius: 0;
  217. &:hover {
  218. border-color: #ccc;
  219. }
  220. img {
  221. width: 0.083333rem /* 16/192 */;
  222. height: 0.083333rem /* 16/192 */;
  223. }
  224. &:last-child {
  225. margin-left: 10px;
  226. }
  227. }
  228. }
  229. .chart-box {
  230. .chart-title {
  231. height: 50px;
  232. line-height: 50px;
  233. font-size: 16px;
  234. font-weight: 500;
  235. color: #fff;
  236. .title-icon {
  237. display: inline-block;
  238. width: 8px;
  239. height: 8px;
  240. background: url("~@/assets/imgs/dialog/img_block.png") center
  241. no-repeat;
  242. box-shadow: 0 0 6px 1px #ffe175;
  243. margin: 0 6px;
  244. }
  245. .title-count {
  246. color: #ffc800;
  247. }
  248. .el-tag {
  249. margin-right: 10px;
  250. // background-color: rgba(0, 0, 0, 0.1);
  251. // border-color: rgba(4, 42, 47, 0.4);
  252. // color: #fff;
  253. }
  254. }
  255. .chart-query {
  256. margin-left: 20px;
  257. .el-radio-group {
  258. ::v-deep .el-radio__label {
  259. font-size: 12px;
  260. padding-left: 5px;
  261. }
  262. ::v-deep .el-radio {
  263. color: #fff;
  264. margin-right: 16px;
  265. }
  266. ::v-deep .el-radio__input.is-checked + .el-radio__label {
  267. color: #fff;
  268. }
  269. ::v-deep .el-radio__inner {
  270. width: 12px;
  271. height: 12px;
  272. background-color: rgba(0, 0, 0, 0.1);
  273. }
  274. ::v-deep .el-radio__input.is-checked .el-radio__inner {
  275. background: rgba(4, 42, 47, 0.4);
  276. border-color: #76c1e1;
  277. }
  278. }
  279. }
  280. .dateTime-chart {
  281. .el-col {
  282. height: 330px;
  283. }
  284. }
  285. .split-line {
  286. width: 100%;
  287. height: 6px;
  288. background: url("~@/assets/imgs/dialog/split_line.png") center no-repeat;
  289. background-size: contain;
  290. margin: 20px auto 10px;
  291. }
  292. .rank-chart {
  293. .el-col {
  294. height: 300px;
  295. }
  296. .scatter-box {
  297. height: 310px;
  298. }
  299. }
  300. }
  301. }
  302. }
  303. </style>