xdgl.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  1. <template>
  2. <div class="knowledge-2">
  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 v-model="wpId" clearable placeholder="请选择" popper-class="select">
  9. <el-option v-for="item in wpArray" :key="item.id" :value="item.id" :label="item.name" />
  10. </el-select>
  11. </div>
  12. </div>
  13. <div class="query-item">
  14. <div class="query-item">
  15. <div class="lable">开始日期:</div>
  16. <div class="search-input">
  17. <el-date-picker v-model="value1" @change="BeginChange(value1)" type="date"
  18. value-format="YYYY-MM-DD" placeholder="选择日期" popper-class="date-select">
  19. </el-date-picker>
  20. </div>
  21. </div>
  22. <div class="query-item">
  23. <div class="lable">结束日期:</div>
  24. <div class="search-input">
  25. <el-date-picker v-model="value2" @change="EndChange(value2)" type="date"
  26. value-format="YYYY-MM-DD" placeholder="选择日期" popper-class="date-select">
  27. </el-date-picker>
  28. <div class="unit svg-icon svg-icon-gray">
  29. <svg-icon :svgid="''" />
  30. </div>
  31. </div>
  32. </div>
  33. </div>
  34. </div>
  35. <div class="query-actions" style="margin-right: 1500px">
  36. <button class="btn green" @click="onClickSearch">查询</button>
  37. </div>
  38. </div>
  39. <div>
  40. <ComTable :data="tableData" height="85vh"></ComTable>
  41. </div>
  42. <el-dialog title="限电事件" v-model="dialogVisible" width="70%" top="10vh" custom-class="modal"
  43. :close-on-click-modal="false">
  44. <table class="com-table tabLog">
  45. <tr>
  46. <td class="light"> 限电原因:</td>
  47. <td>{{main.description}}</td>
  48. <td class="light"> 限电类型:</td>
  49. <td>{{main.stopTypeId}}</td>
  50. </tr>
  51. <tr>
  52. <td class="light"> 限电指令:</td>
  53. <td>{{main.brownoutsdirective}}</td>
  54. <td class="light"> 当时风速(m/s):</td>
  55. <td>{{main.windspeed}}</td>
  56. </tr>
  57. <tr>
  58. <td class="light"> 限电负荷(MW):</td>
  59. <td>{{main.limitload}}</td>
  60. <td class="light"> 当时负荷(MW):</td>
  61. <td>{{main.thisload}}</td>
  62. </tr>
  63. <tr>
  64. <td class="light"> 限电时刻:</td>
  65. <td>{{new Date(main.stoptime).formatDate("yyyy-MM-dd hh:mm:ss")}}</td>
  66. <td class="light"> 恢复时刻:</td>
  67. <td>{{new Date(main.starttime).formatDate("yyyy-MM-dd hh:mm:ss")}}</td>
  68. </tr>
  69. <tr>
  70. <td class="light"> 限电损失电量(KWh):</td>
  71. <td colspan="3">{{main.losspower}}</td>
  72. </tr>
  73. </table>
  74. <div class="header">
  75. <span class="herder-info">
  76. 限电事件记录
  77. </span>
  78. </div>
  79. <ComTable :data="tableList" height="40vh"></ComTable>
  80. </el-dialog>
  81. </div>
  82. </template>
  83. <script>
  84. import ComTable from "@com/coms/table/table.vue";
  85. export default {
  86. components: {
  87. ComTable
  88. },
  89. data() {
  90. const that = this;
  91. return {
  92. value1: "",
  93. value2: "",
  94. wpId: "",
  95. wpArray: [],
  96. dialogVisible: false,
  97. main:[],
  98. tableList:{
  99. column: [{
  100. name: "编号",
  101. field: "index",
  102. width: "50px",
  103. is_num: true,
  104. is_light: false,
  105. },
  106. {
  107. name: "风机",
  108. field: "windturbineid",
  109. is_num: false,
  110. is_light: false,
  111. },
  112. {
  113. name: "限电时刻",
  114. field: "stopTime",
  115. is_num: false,
  116. is_light: false,
  117. },
  118. {
  119. name: "恢复时刻",
  120. field: "startTime",
  121. width: "150px",
  122. is_num: false,
  123. is_light: false,
  124. },
  125. {
  126. name: "停机小时数",
  127. field: "stophours",
  128. width: "150px",
  129. is_num: false,
  130. is_light: false,
  131. },
  132. {
  133. name: "损失电量(KWh)",
  134. field: "losspower",
  135. width: "150px",
  136. is_num: false,
  137. is_light: false,
  138. },
  139. ],
  140. data: [],
  141. },
  142. tableData: {
  143. column: [{
  144. name: "编号",
  145. field: "index",
  146. width: "50px",
  147. is_num: true,
  148. is_light: false,
  149. },
  150. {
  151. name: "限电时刻",
  152. field: "stopTime",
  153. width: "150px",
  154. is_num: false,
  155. is_light: false,
  156. },
  157. {
  158. name: "恢复时刻",
  159. field: "startTime",
  160. width: "150px",
  161. is_num: false,
  162. is_light: false,
  163. },
  164. {
  165. name: "停机类型",
  166. field: "stopTypeId",
  167. width: "150px",
  168. is_num: false,
  169. is_light: false,
  170. },
  171. {
  172. name: "限电时间",
  173. field: "stopHours",
  174. width: "150px",
  175. is_num: false,
  176. is_light: false,
  177. },
  178. {
  179. name: "损失电量(kWh)",
  180. field: "lossPower",
  181. width: "150px",
  182. is_num: false,
  183. is_light: false,
  184. },
  185. {
  186. name: "限电原因",
  187. field: "description",
  188. width: "200px",
  189. is_num: false,
  190. is_light: false,
  191. },
  192. {
  193. name: "关联风机",
  194. field: "wts",
  195. is_num: false,
  196. is_light: false,
  197. },
  198. {
  199. name: "操作",
  200. field: "cz",
  201. width: "50px",
  202. is_num: false,
  203. is_light: false,
  204. template: function() {
  205. return "<a class='action'>详情</a>";
  206. },
  207. click: function(event, data) {
  208. that.API.requestData({
  209. method: "POST",
  210. subUrl: "/brownouts/getBrownouts",
  211. data: {
  212. mainId: data.id
  213. },
  214. success(res) {
  215. if (res.code == 200) {
  216. that.main = res.data.main;
  217. that.tableList.data = [];
  218. if (res.data.list.length) {
  219. let data = res.data.list;
  220. for (var i = 0; i < data.length; i++) {
  221. let obj = {
  222. index: i + 1,
  223. windturbineid:data[i].windturbineid,
  224. stopTime: new Date(data[i].stoptime).formatDate("yyyy-MM-dd hh:mm:ss"),
  225. startTime: new Date(data[i].starttime).formatDate("yyyy-MM-dd hh:mm:ss"),
  226. stophours: data[i].stophours,
  227. losspower: data[i].losspower
  228. };
  229. that.tableList.data.push(obj);
  230. that.dialogVisible = true;
  231. }
  232. }
  233. }
  234. },
  235. });
  236. }
  237. }
  238. ],
  239. data: [],
  240. },
  241. };
  242. },
  243. created() {
  244. // this.requestSafeList();
  245. this.value1 = new Date((new Date().getTime() - 3600 * 1000 * 24)).formatDate("yyyy-MM-dd");
  246. this.value2 = this.getTime(2);
  247. this.getWp();
  248. this.requestSafeList();
  249. },
  250. methods: {
  251. getTime(val) { //时间戳处理,val=1是默认开始时间(当前月第一天),val=2是默认结束时间(今天)
  252. var date = new Date();
  253. var year = date.getFullYear(),
  254. month = date.getMonth() + 1,
  255. day = date.getDate();
  256. month >= 1 && month <= 9 ? (month = '0' + month) : '';
  257. day >= 0 && day <= 9 ? (day = '0' + day) : '';
  258. var begin = year + '-' + month + '-01';
  259. var end = year + '-' + month + '-' + day;
  260. if (val == 1) {
  261. return begin;
  262. } else if (val == 2) {
  263. return end;
  264. }
  265. },
  266. // 获取风场
  267. getWp(reGetWp) {
  268. let that = this;
  269. that.API.requestData({
  270. baseURL: "http://10.155.32.4:9001",
  271. subUrl: "benchmarking/wplist",
  272. success(res) {
  273. that.wpArray = res.data;
  274. that.wpId = res.data[0].id;
  275. that.wpName = res.data[0].wpId;
  276. // that.getWt(that.wpId, reGetWp);
  277. }
  278. });
  279. },
  280. BeginChange(vl) {
  281. this.value1 = vl;
  282. },
  283. EndChange(vl) {
  284. this.value2 = vl;
  285. },
  286. typeChange(vl) {
  287. this.type = vl;
  288. },
  289. // 搜索按钮
  290. onClickSearch() {
  291. this.requestSafeList();
  292. },
  293. // 获取限电事间
  294. requestSafeList() {
  295. let that = this;
  296. let data = {
  297. tablepar: {
  298. pageNum: 1,
  299. pageSize: 1000,
  300. },
  301. beginDate: that.value1,
  302. endDate: that.value2,
  303. wpId: that.wpId,
  304. };
  305. this.API.requestData({
  306. method: "POST",
  307. subUrl: "/brownouts/getBrownoutsList",
  308. data,
  309. success(res) {
  310. if (res.code == 200) {
  311. that.tableData.data = [];
  312. if (res.data.list.length) {
  313. let data = res.data.list;
  314. for (var i = 0; i < data.length; i++) {
  315. let obj = {
  316. index: i + 1,
  317. id: data[i].id,
  318. stopTime: new Date(data[i].stopTime).formatDate("yyyy-MM-dd hh:mm:ss"),
  319. startTime: new Date(data[i].startTime).formatDate("yyyy-MM-dd hh:mm:ss"),
  320. stopTypeId: data[i].stopTypeId,
  321. stopHours: data[i].stopHours,
  322. lossPower: data[i].lossPower,
  323. description: data[i].description,
  324. wts: data[i].wts,
  325. };
  326. that.tableData.data.push(obj);
  327. }
  328. }
  329. }
  330. },
  331. });
  332. },
  333. },
  334. };
  335. </script>
  336. <style lang="less" scope>
  337. @titleGray: #9ca5a8;
  338. @rowGray: #606769;
  339. @darkBack: #536268;
  340. .knowledge-2 {
  341. .el-select {
  342. width: 200px;
  343. }
  344. .el-input {
  345. width: 200px;
  346. }
  347. .action {
  348. text-decoration: underline;
  349. color: @green;
  350. cursor: pointer;
  351. }
  352. .com-table.tabLog {
  353. tr {
  354. height: 40px;
  355. }
  356. .light {
  357. width: 10.5rem;
  358. color: #05bb4c;
  359. }
  360. }
  361. .header {
  362. display: flex;
  363. width: 100%;
  364. height: 40px;
  365. line-height: 40px;
  366. background: fade(@gray, 60);
  367. color: @white;
  368. .herder-info {
  369. flex: 1 0 25%;
  370. font-size: @fontsize-s;
  371. padding-left: 1rem;
  372. &:last-child {
  373. flex: 1 0 50%;
  374. }
  375. }
  376. }
  377. }
  378. </style>