operationRecords.vue 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  1. <template>
  2. <el-dialog
  3. width="50%"
  4. @open="opened()"
  5. @closed="closed()"
  6. :show-close="false"
  7. class="my-info-dialog"
  8. >
  9. <template #title>
  10. <div class="showTitles">
  11. <div class="titles">校验记录详情</div>
  12. </div>
  13. </template>
  14. <div class="bodyDetial">
  15. <!-- <div style="width: 50%;height:200px;background-color:red;"></div>
  16. <div style="width: 50%;height:200px;background-color:yellow;"></div> -->
  17. <div class="left-item">
  18. <el-scrollbar>
  19. <el-input placeholder="输入关键字进行过滤" v-model="filterText">
  20. </el-input>
  21. <el-tree
  22. class="filter-tree"
  23. :data="showData"
  24. :props="defaultProps"
  25. :filter-node-method="filterNode"
  26. node-key="id"
  27. :default-expanded-keys="[0]"
  28. ref="tree"
  29. @node-click="handleChange"
  30. >
  31. </el-tree>
  32. </el-scrollbar>
  33. </div>
  34. <div class="right-item">
  35. <div class="dateBar">
  36. <el-date-picker
  37. class="pickers"
  38. @change="changes"
  39. v-model="timeValue"
  40. type="datetimerange"
  41. range-separator="至"
  42. start-placeholder="开始日期"
  43. end-placeholder="结束日期"
  44. >
  45. </el-date-picker>
  46. <div class="buttons" @click="getControlRecord()">查询</div>
  47. </div>
  48. <el-scrollbar style="height: 86%">
  49. <div class="tables">
  50. <el-table
  51. :data="recordData"
  52. class="table"
  53. style="width: 100%"
  54. height="49vh"
  55. :header-cell-style="{
  56. background: 'rgb(30,30,30)',
  57. color: 'rgb(220,220,220)',
  58. padding: '4px',
  59. fontSize: '14px',
  60. 'border-bottom': 'solid 1px rgba(77, 77, 77, 1)',
  61. }"
  62. :cell-style="{
  63. height: '40px',
  64. background: 'rgb(30,30,30)',
  65. color: 'rgb(220,220,220)',
  66. padding: '3px',
  67. fontSize: '12px',
  68. 'border-bottom': '1px solid #000000',
  69. }"
  70. >
  71. <el-table-column
  72. prop="time"
  73. label="日期"
  74. width="120"
  75. align="center"
  76. >
  77. </el-table-column>
  78. <el-table-column
  79. prop="showName"
  80. label="风机号"
  81. width="120"
  82. align="center"
  83. >
  84. </el-table-column>
  85. <el-table-column
  86. prop="controls"
  87. label="控制命令"
  88. width="100"
  89. align="center"
  90. >
  91. </el-table-column>
  92. <el-table-column prop="result" label="操作结果" align="center">
  93. </el-table-column>
  94. <el-table-column
  95. prop="userName"
  96. label="操作人"
  97. width="160"
  98. align="center"
  99. >
  100. </el-table-column>
  101. </el-table>
  102. </div>
  103. </el-scrollbar>
  104. <div class="paginations">
  105. <el-pagination
  106. :hide-on-single-page="true"
  107. :page-size="currentPage"
  108. background
  109. layout="prev, pager, next"
  110. :total="total"
  111. @current-change="handleCurrentChange"
  112. >
  113. </el-pagination>
  114. </div>
  115. </div>
  116. </div>
  117. </el-dialog>
  118. </template>
  119. <script>
  120. import dayjs from "dayjs";
  121. import api from "api/index";
  122. export default {
  123. props: {},
  124. updated() {
  125. if (this.timeValue.length === 0) {
  126. let date = new Date();
  127. this.timeValue[0] = date.getTime() - 28800000;
  128. this.timeValue[1] = date.getTime() + 3600000;
  129. }
  130. },
  131. mounted() {},
  132. data() {
  133. return {
  134. currentPage: 10,
  135. filterText: "",
  136. pageIndex: 1,
  137. station: [],
  138. datas: {},
  139. chooseStation: {},
  140. timeValue: [],
  141. showData: [
  142. {
  143. id: 0,
  144. windturbineId: "全部",
  145. stationId: "",
  146. children: [],
  147. },
  148. ],
  149. defaultProps: {
  150. children: "children",
  151. label: "windturbineId",
  152. },
  153. recordData: [],
  154. total: "",
  155. controlErorCodes: [
  156. "控制成功",
  157. "控制命令发送失败",
  158. "无效的控制地址",
  159. "被控设备异常",
  160. "无效的控制功能",
  161. "网络连接错误,检查场站通信",
  162. "控制结果读取超时",
  163. "未知错误",
  164. "控制命令错误",
  165. "收到无法识别数据",
  166. "未读取到数据包",
  167. "未知错误",
  168. "风机操作过频繁",
  169. "风机被挂牌",
  170. "风机操作与风机状态不符",
  171. "需要登录",
  172. ],
  173. };
  174. },
  175. methods: {
  176. // getWindturbineFdc() {
  177. // api.getWindturbineFdc().then((res) => {
  178. // this.station = res.data;
  179. // this.getControlRecord();
  180. // });
  181. // },
  182. dataDeal() {
  183. let stationList = this.$store.state.stationList;
  184. this.showData[0].children = [];
  185. stationList.forEach((item, index) => {
  186. let obj = {};
  187. obj.id = index + 1;
  188. obj.windturbineId = item.name;
  189. obj.stationId = item.code;
  190. obj.children = [];
  191. this.showData[0].children.push(obj);
  192. });
  193. this.datas = this.$store.state.windturbinelist
  194. ? this.$store.state.windturbinelist
  195. : {};
  196. let arr = Object.keys(this.datas).sort();
  197. for (let id of arr) {
  198. let item = this.datas[id];
  199. this.showData[0].children
  200. .filter((val) => val.stationId === item.stationId)[0]
  201. .children.push(item);
  202. }
  203. },
  204. handleChange(value) {
  205. this.chooseStation = value;
  206. this.pageIndex = 1;
  207. this.getControlRecord(value);
  208. },
  209. closed() {
  210. this.pageIndex = 1;
  211. this.chooseStation = {};
  212. this.showData = [
  213. {
  214. id: 0,
  215. windturbineId: "全部",
  216. stationId: "",
  217. children: [],
  218. },
  219. ];
  220. let stationList = this.$store.state.stationList;
  221. stationList.forEach((item, index) => {
  222. let obj = {};
  223. obj.id = index + 1;
  224. obj.windturbineId = item.name;
  225. obj.stationId = item.code;
  226. obj.children = [];
  227. this.showData[0].children.push(obj);
  228. });
  229. this.$emit("closed");
  230. },
  231. filterNode(value, data) {
  232. if (!value) return true;
  233. return data.windturbineId.indexOf(value) !== -1;
  234. },
  235. handleCurrentChange(val) {
  236. this.pageIndex = val;
  237. this.getControlRecord();
  238. },
  239. opened() {
  240. let date = new Date();
  241. this.timeValue[0] = date.getTime() - 28800000;
  242. this.timeValue[1] = date.getTime() + 3600000;
  243. this.getControlRecord();
  244. },
  245. getControlRecord() {
  246. api
  247. .controlRecord({
  248. stationId: this.chooseStation.stationId
  249. ? this.chooseStation.stationId
  250. : "",
  251. userName: "",
  252. windturbineId: this.chooseStation.id
  253. ? ""
  254. : this.chooseStation.stationId
  255. ? this.chooseStation.windturbineId
  256. : "",
  257. startTime: dayjs(this.timeValue[0]).format("YYYY/MM/DD HH:mm:ss"),
  258. endTime: dayjs(this.timeValue[1]).format("YYYY/MM/DD HH:mm:ss"),
  259. pageSize: this.currentPage,
  260. pageIndex: this.pageIndex,
  261. })
  262. .then((res) => {
  263. if (res) {
  264. let types = {
  265. Start: "启动",
  266. Stop: "停止",
  267. Reset: "复位",
  268. Maintain: "维护",
  269. UnMaintain: "取消维护",
  270. Lock: "挂牌",
  271. UnLock: "取消挂牌",
  272. };
  273. res.data.dataList.forEach((item) => {
  274. item.time = dayjs(item.time).format("MM-DD HH:mm:ss");
  275. item.result = this.controlErorCodes[item.errorCode];
  276. item.controls = types[item.controlType];
  277. item.showName = item.windturbineId;
  278. });
  279. this.total = res.data.total;
  280. this.recordData = res.data.dataList;
  281. }
  282. });
  283. },
  284. },
  285. watch: {
  286. filterText(val) {
  287. this.$refs.tree.filter(val);
  288. },
  289. },
  290. };
  291. </script>
  292. <style scoped>
  293. .showTitles {
  294. display: flex;
  295. flex-direction: row;
  296. align-items: center;
  297. justify-content: space-between;
  298. margin-top: -10px;
  299. font-size: 18px;
  300. color: #ffffff;
  301. height: 40px;
  302. }
  303. .titles {
  304. font-size: 16px;
  305. color: #ffffff;
  306. }
  307. .el-dialog__body {
  308. padding: 30px 10px 10px 10px;
  309. }
  310. .bodyDetial {
  311. display: flex;
  312. flex-direction: row;
  313. background-color: black;
  314. width: 100%;
  315. margin-top: -30px;
  316. height: 60vh;
  317. }
  318. .left-item {
  319. width: 20%;
  320. height: 100%;
  321. background-color: rgba(77, 77, 77, 1);
  322. border-right: 2px solid #000000;
  323. }
  324. .right-item {
  325. width: 80%;
  326. height: 100%;
  327. background-color: rgba(77, 77, 77, 1);
  328. }
  329. .el-tree {
  330. color: #ffffff !important;
  331. background-color: rgba(77, 77, 77, 1) !important;
  332. }
  333. .el-tree-node:focus > .el-tree-node__content {
  334. background-color: #000000 !important;
  335. }
  336. .el-tree-node__content:hover {
  337. background-color: #000000 !important;
  338. }
  339. .dateBar {
  340. display: flex;
  341. flex-direction: row;
  342. align-items: center;
  343. justify-content: space-between;
  344. margin-left: 20px;
  345. }
  346. .pickers {
  347. margin-left: 20px;
  348. }
  349. .tables {
  350. margin-top: 20px;
  351. width: 95%;
  352. margin-left: 3%;
  353. }
  354. .table {
  355. background-color: rgba(77, 77, 77, 1) !important;
  356. }
  357. .el-table td,
  358. .el-table th.is-leaf {
  359. border-bottom: 1px solid rgba(77, 77, 77, 1) !important;
  360. }
  361. .el-table__header {
  362. width: 100% !important;
  363. }
  364. .el-table__body-wrapper {
  365. background-color: rgba(77, 77, 77, 1) !important;
  366. }
  367. .el-table::before {
  368. width: 0;
  369. }
  370. tr {
  371. line-height: 1.5;
  372. background: #1e1e1e;
  373. margin-bottom: 2px;
  374. border-radius: 5px;
  375. }
  376. .table-main {
  377. font-size: 14px;
  378. width: 600px;
  379. text-align: center;
  380. background: #000000;
  381. margin: 5px;
  382. border-collapse: separate;
  383. border-spacing: 0px 5px;
  384. }
  385. .paginations {
  386. display: flex;
  387. flex-direction: row-reverse;
  388. }
  389. </style>