index.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  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. export default {
  73. // 名称
  74. name: "cutAnalyse",
  75. // 使用组件
  76. components: {
  77. ComTable,
  78. Lbc,
  79. },
  80. // 数据
  81. data() {
  82. const that = this;
  83. return {
  84. isAsc: "asc",
  85. typeArray: [
  86. {
  87. id: "1",
  88. name: "按报警统计",
  89. },
  90. {
  91. id: "2",
  92. name: "按报警分类统计",
  93. },
  94. {
  95. id: "3",
  96. name: "按厂家统",
  97. },
  98. ],
  99. typeId: "1",
  100. wpArray: [],
  101. wpId: "",
  102. beginDate: new Date(new Date().getTime() - 3600 * 1000 * 24).formatDate(
  103. "yyyy-MM-dd"
  104. ),
  105. endDate: new Date().formatDate("yyyy-MM-dd"),
  106. dialogShow: false,
  107. tableData: {
  108. column: [
  109. {
  110. name: "序号",
  111. field: "index",
  112. is_num: false,
  113. is_light: false,
  114. sortable: true,
  115. },
  116. {
  117. name: "名称",
  118. field: "name",
  119. is_num: false,
  120. is_light: false,
  121. sortable: true,
  122. },
  123. {
  124. name: "频率(次)",
  125. field: "frequencyday",
  126. is_num: false,
  127. is_light: false,
  128. sortable: true,
  129. },
  130. ],
  131. data: [],
  132. },
  133. chartData: [
  134. {
  135. title: "",
  136. yAxisIndex: 0,
  137. value: [],
  138. },
  139. ],
  140. chartUnit: ["(次)"],
  141. };
  142. },
  143. // 函数
  144. methods: {
  145. // 请求服务
  146. requestData() {
  147. let that = this;
  148. if (!that.typeId || !that.beginDate || !that.endDate) {
  149. that.BASE.showMsg({
  150. msg: "维度与日期不可为空",
  151. });
  152. } else {
  153. that.API.requestData({
  154. method: "POST",
  155. subUrl: "leaderboard/querywarningStatistical",
  156. data: {
  157. type: that.typeId,
  158. isAsc: that.isAsc,
  159. beginDate: that.beginDate,
  160. endDate: that.endDate,
  161. orderByColumn: "",
  162. },
  163. success(res) {
  164. let chartData = [];
  165. let data = [];
  166. let i = 1;
  167. res.data.forEach((ele, index) => {
  168. if(ele.name != null){
  169. ele.index = i++;
  170. data.push(ele)
  171. chartData.push({
  172. title: ele.name,
  173. yAxisIndex: 0,
  174. value: [
  175. {
  176. text: ele.name,
  177. value: ele.frequencyday,
  178. },
  179. ],
  180. });
  181. }
  182. });
  183. that.chartData = chartData;
  184. that.tableData.data = data;
  185. },
  186. });
  187. }
  188. },
  189. search() {
  190. this.requestData();
  191. },
  192. },
  193. created() {
  194. this.requestData();
  195. },
  196. mounted() {},
  197. unmounted() {},
  198. };
  199. </script>
  200. <style lang="less" scoped>
  201. .draught-fan-list {
  202. width: 100%;
  203. height: 100%;
  204. display: flex;
  205. flex-direction: column;
  206. .btn-group-tabs {
  207. display: flex;
  208. flex-direction: row;
  209. .photovoltaic {
  210. margin-left: 1.481vh;
  211. }
  212. }
  213. .df-table {
  214. border: 0.093vh solid fade(@darkgray, 50%);
  215. position: relative;
  216. overflow: hidden;
  217. flex-grow: 1;
  218. margin-top: 1.481vh;
  219. height: 80vh;
  220. &:before {
  221. content: "";
  222. width: 0.37vh;
  223. height: 0.37vh;
  224. background: @write;
  225. position: absolute;
  226. left: 0.278vh;
  227. top: 0.278vh;
  228. }
  229. tbody {
  230. height: calc(100vh - 166px);
  231. }
  232. }
  233. }
  234. </style>