operationRecords.vue 14 KB

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