index.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. <template>
  2. <div class="draught-fan-list">
  3. <div class="query mg-b-8">
  4. <div class="query-items">
  5. <div class="query-item">
  6. <div class="lable">维度:</div>
  7. <div class="search-input">
  8. <el-select
  9. v-model="typeId"
  10. clearable
  11. placeholder="请选择"
  12. popper-class="select"
  13. @change="renderWprray"
  14. >
  15. <el-option
  16. v-for="item in typeArray"
  17. :key="item.id"
  18. :value="item.id"
  19. :label="item.name"
  20. />
  21. </el-select>
  22. </div>
  23. </div>
  24. <div class="query-item">
  25. <div class="lable">开始日期:</div>
  26. <div class="search-input">
  27. <el-date-picker
  28. v-model="beginDate"
  29. type="date"
  30. value-format="YYYY-MM-DD"
  31. placeholder="选择日期"
  32. popper-class="date-select"
  33. >
  34. </el-date-picker>
  35. </div>
  36. </div>
  37. <div class="query-item">
  38. <div class="lable">结束日期:</div>
  39. <div class="search-input">
  40. <el-date-picker
  41. v-model="endDate"
  42. type="date"
  43. value-format="YYYY-MM-DD"
  44. placeholder="选择日期"
  45. popper-class="date-select"
  46. >
  47. </el-date-picker>
  48. </div>
  49. </div>
  50. </div>
  51. <div class="query-actions">
  52. <button class="btn green" @click="search()">搜索</button>
  53. </div>
  54. </div>
  55. <div class="df-table">
  56. <ComTable height="100vh" :data="tableData"></ComTable>
  57. </div>
  58. <!-- <Mlc height="650px" :list="chartData" :units="chartUnit" :showLegend="true" /> -->
  59. <Lbc
  60. height="650px"
  61. :list="chartData"
  62. :units="chartUnit"
  63. :showLegend="true"
  64. :barMaxWidth="'4%'"
  65. :barGap="'150%'"
  66. />
  67. </div>
  68. </template>
  69. <script>
  70. import ComTable from "@com/coms/table/table.vue";
  71. import Lbc from "@com/chart/bar/multiple-bar-chart.vue";
  72. import api from "@api/economic/index.js";
  73. export default {
  74. // 名称
  75. name: "cutAnalyse",
  76. // 使用组件
  77. components: {
  78. ComTable,
  79. Lbc,
  80. },
  81. // 数据
  82. data() {
  83. const that = this;
  84. return {
  85. isAsc: "asc",
  86. typeArray: [
  87. {
  88. id: "1",
  89. name: "按报警统计",
  90. },
  91. {
  92. id: "2",
  93. name: "按报警分类统计",
  94. },
  95. {
  96. id: "3",
  97. name: "按厂家统",
  98. },
  99. ],
  100. typeId: "1",
  101. wpArray: [],
  102. wpId: "",
  103. beginDate: new Date(new Date().getTime() - 3600 * 1000 * 24).formatDate(
  104. "yyyy-MM-dd"
  105. ),
  106. endDate: new Date().formatDate("yyyy-MM-dd"),
  107. dialogShow: false,
  108. tableData: {
  109. column: [
  110. {
  111. name: "序号",
  112. field: "index",
  113. is_num: false,
  114. is_light: false,
  115. sortable: true,
  116. },
  117. {
  118. name: "名称",
  119. field: "name",
  120. is_num: false,
  121. is_light: false,
  122. sortable: true,
  123. },
  124. {
  125. name: "频率(次)",
  126. field: "frequencyday",
  127. is_num: false,
  128. is_light: false,
  129. sortable: true,
  130. },
  131. ],
  132. data: [],
  133. },
  134. chartData: [
  135. {
  136. title: "",
  137. yAxisIndex: 0,
  138. value: [],
  139. },
  140. ],
  141. chartUnit: ["(次)"],
  142. };
  143. },
  144. // 函数
  145. methods: {
  146. // 请求服务
  147. requestData() {
  148. let that = this;
  149. if (!that.typeId || !that.beginDate || !that.endDate) {
  150. that.BASE.showMsg({
  151. msg: "维度与日期不可为空",
  152. });
  153. } else {
  154. api.leaderboardQuerywarningStatistical({
  155. type: this.typeId,
  156. isAsc: this.isAsc,
  157. beginDate: this.beginDate,
  158. endDate: this.endDate,
  159. orderByColumn: "",
  160. }).then((res) => {
  161. let chartData = [];
  162. res.data.forEach((ele, index) => {
  163. if(ele.name != null){
  164. ele.index = i++;
  165. data.push(ele)
  166. chartData.push({
  167. title: ele.name,
  168. yAxisIndex: 0,
  169. value: [
  170. {
  171. text: ele.name,
  172. value: ele.frequencyday,
  173. },
  174. ],
  175. });
  176. }
  177. });
  178. this.chartData = chartData;
  179. this.tableData.data = res.data;
  180. });
  181. // that.API.requestData({
  182. // method: "POST",
  183. // subUrl: "leaderboard/querywarningStatistical",
  184. // data: {
  185. // type: that.typeId,
  186. // isAsc: that.isAsc,
  187. // beginDate: that.beginDate,
  188. // endDate: that.endDate,
  189. // orderByColumn: "",
  190. // },
  191. // success(res) {
  192. // let chartData = [];
  193. // res.data.forEach((ele, index) => {
  194. // ele.index = index + 1;
  195. // chartData.push({
  196. // title: ele.name,
  197. // yAxisIndex: 0,
  198. // value: [
  199. // {
  200. // text: ele.name,
  201. // value: ele.frequencyday,
  202. // },
  203. // ],
  204. // });
  205. // });
  206. // that.chartData = chartData;
  207. // that.tableData.data = res.data;
  208. // },
  209. // });
  210. }
  211. },
  212. search() {
  213. this.requestData();
  214. },
  215. },
  216. created() {
  217. this.requestData();
  218. },
  219. mounted() {},
  220. unmounted() {},
  221. };
  222. </script>
  223. <style lang="less" scoped>
  224. .draught-fan-list {
  225. width: 100%;
  226. height: 100%;
  227. display: flex;
  228. flex-direction: column;
  229. .btn-group-tabs {
  230. display: flex;
  231. flex-direction: row;
  232. .photovoltaic {
  233. margin-left: 1.481vh;
  234. }
  235. }
  236. .df-table {
  237. border: 0.093vh solid fade(@darkgray, 50%);
  238. position: relative;
  239. overflow: hidden;
  240. flex-grow: 1;
  241. margin-top: 1.481vh;
  242. height: 80vh;
  243. &:before {
  244. content: "";
  245. width: 0.37vh;
  246. height: 0.37vh;
  247. background: @write;
  248. position: absolute;
  249. left: 0.278vh;
  250. top: 0.278vh;
  251. }
  252. tbody {
  253. height: calc(100vh - 166px);
  254. }
  255. }
  256. }
  257. </style>