customAlarm.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. <template>
  2. <div>
  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="stationId"
  10. clearable
  11. placeholder="请选择"
  12. popper-class="select"
  13. @change="(stationId) => { Windturbines() }"
  14. >
  15. <el-option
  16. v-for="item in ChangZhan"
  17. :key="item.id"
  18. :value="item.id"
  19. :label="item.name"
  20. ></el-option>
  21. </el-select>
  22. </div>
  23. </div>
  24. <div class="query-item">
  25. <div class="lable">机组:</div>
  26. <div class="search-input">
  27. <el-select v-model="wtId" placeholder="请选择" popper-class="select">
  28. <el-option
  29. v-for="item in windturbines"
  30. :key="item.id"
  31. :label="item.name"
  32. :value="item.id"
  33. ></el-option>
  34. </el-select>
  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="startDate"
  42. type="datetime"
  43. placeholder="开始日期"
  44. popper-class="date-select"
  45. value-format="YYYY-MM-DD HH:mm:ss"
  46. ></el-date-picker>
  47. </div>
  48. </div>
  49. <div class="query-item">
  50. <div class="lable">结束日期:</div>
  51. <div class="search-input">
  52. <el-date-picker
  53. v-model="endDate"
  54. type="datetime"
  55. placeholder="开始日期"
  56. popper-class="date-select"
  57. value-format="YYYY-MM-DD HH:mm:ss"
  58. ></el-date-picker>
  59. </div>
  60. </div>
  61. <div class="query-actions">
  62. <button class="btn green" @click="getTable()">查询</button>
  63. <button class="btn green" @click="exportExcel()">导出</button>
  64. </div>
  65. </div>
  66. </div>
  67. <div class="table-box">
  68. <div class="title">自定义报警</div>
  69. <ComTable
  70. ref="curRef"
  71. :data="tableData"
  72. :pageSize="20"
  73. @onPagging="onChangePage"
  74. height="73vh"
  75. v-loading="tableLoading"
  76. element-loading-text="拼命加载中.."
  77. element-loading-background="rgba(0, 0, 0, 0.8)"
  78. ></ComTable>
  79. </div>
  80. </div>
  81. </template>
  82. <script>
  83. import ComTable from "@/components/coms/table/table.vue";
  84. export default {
  85. name: "customAlarm",
  86. components: { ComTable },
  87. data() {
  88. let that = this;
  89. return {
  90. ChangZhan: [],
  91. stationId: "MHS_FDC",
  92. windturbines: [],
  93. wtId: "",
  94. startDate: "",
  95. endDate: "",
  96. tableLoading: true,
  97. pageIndex: 1,
  98. pageSize: 20,
  99. tableData: {
  100. column: [
  101. {
  102. name: "场站",
  103. field: "stationName",
  104. is_num: false,
  105. is_light: false,
  106. sortable: true,
  107. id: "id"
  108. },
  109. {
  110. name: "机组",
  111. field: "windturbineName",
  112. is_num: false,
  113. is_light: false,
  114. sortable: true,
  115. id: "id"
  116. },
  117. {
  118. name: "报警时间",
  119. field: "alertTime",
  120. is_num: false,
  121. is_light: false,
  122. sortable: true,
  123. id: "id"
  124. },
  125. {
  126. name: "型号",
  127. field: "modelId",
  128. is_num: false,
  129. is_light: false,
  130. sortable: true,
  131. id: "id"
  132. },
  133. {
  134. name: "报警描述",
  135. field: "alertText",
  136. is_num: false,
  137. is_light: false,
  138. sortable: true,
  139. id: "id"
  140. }
  141. ],
  142. data: [],
  143. currentPageTotal: 0
  144. }
  145. };
  146. },
  147. created() {
  148. this.ChangZhanVal();
  149. this.Windturbines();
  150. let end = new Date();
  151. let start = new Date(end.getTime() - 1 * 24 * 60 * 60 * 1000);
  152. this.endDate = end.formatDate("yyyy-MM-dd hh:mm:ss");
  153. this.startDate = start.formatDate("yyyy-MM-dd hh:mm:ss");
  154. this.getTable();
  155. },
  156. methods: {
  157. // 场站
  158. ChangZhanVal() {
  159. var that = this;
  160. that.API.requestData({
  161. method: "GET",
  162. baseURL: "http://10.155.32.4:9001/",
  163. subUrl: "benchmarking/wplist",
  164. success(res) {
  165. that.ChangZhan = res.data;
  166. that.stationId = res.data[0].id;
  167. }
  168. });
  169. },
  170. Windturbines() {
  171. let that = this;
  172. that.API.requestData({
  173. method: "GET",
  174. subUrl: "powercompare/windturbineAjax",
  175. data: { wpId: that.stationId },
  176. success(res) {
  177. that.windturbines = res.data;
  178. // that.wtId = res.data[0].id;
  179. that.windturbines.unshift({ id: "", name: "请选择" });
  180. that.wtId = "";
  181. }
  182. });
  183. },
  184. getTable() {
  185. let that = this;
  186. this.tableLoading = true;
  187. this.API.requestData({
  188. timeout: 30000,
  189. method: "GET",
  190. baseURL: "http://192.168.1.18:8075/",
  191. subUrl: "alarm/history/page2",
  192. data: {
  193. category1: "custom",
  194. stationid: this.stationId,
  195. starttime: this.startDate,
  196. endtime: this.endDate,
  197. windturbineid: this.wtId,
  198. pagenum: this.pageIndex,
  199. pagesize: this.pageSize
  200. },
  201. success(res) {
  202. if (res.data) {
  203. that.tableData.data = res.data.records;
  204. that.tableData.total = res.data.total;
  205. } else {
  206. that.tableData.data = [];
  207. that.tableData.total = 0;
  208. }
  209. that.tableLoading = false;
  210. }
  211. });
  212. },
  213. onChangePage(params) {
  214. this.pageIndex = params.pageIndex;
  215. this.pageSize = params.pageSize;
  216. this.getTable();
  217. },
  218. exportExcel() {
  219. // let excelData = this.BASE.deepCopy(this.tableData);
  220. // excelData.data.forEach(ele => {
  221. // ele["category2"] = this.partsMap[ele["category2"]];
  222. // });
  223. this.BASE.exportExcel(this.tableData, "自定义报警");
  224. }
  225. }
  226. };
  227. </script>
  228. <style lang="less">
  229. .title {
  230. background: rgba(255, 255, 255, 0.1);
  231. margin-bottom: 8px;
  232. padding: 1vh;
  233. }
  234. </style>