index.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  1. <template>
  2. <div class="stopQueryBox">
  3. <div class="form-wrapper">
  4. <div class="search-wrapper">
  5. <div class="search-item">
  6. <span class="label">风场:</span>
  7. <div class="search-content">
  8. <el-select
  9. v-model="wpId"
  10. size="mini"
  11. placeholder="全部"
  12. popper-class="select"
  13. @change="
  14. () => {
  15. wtId = '';
  16. getWtList();
  17. }
  18. "
  19. >
  20. <el-option
  21. v-for="item in wpArray"
  22. :key="item.id"
  23. :value="item.id"
  24. :label="item.aname"
  25. >
  26. </el-option>
  27. </el-select>
  28. </div>
  29. </div>
  30. <div class="search-item">
  31. <span class="label">风机:</span>
  32. <div class="search-content">
  33. <el-select
  34. v-model="wtId"
  35. clearable
  36. size="mini"
  37. placeholder="全部"
  38. popper-class="select"
  39. @change="() => {}"
  40. >
  41. <el-option
  42. v-for="item in wtArray"
  43. :key="item.nemCode"
  44. :value="item.nemCode"
  45. :label="item.name"
  46. >
  47. </el-option>
  48. </el-select>
  49. </div>
  50. </div>
  51. <div class="search-item">
  52. <span class="label">停机类型:</span>
  53. <div class="search-content">
  54. <el-select
  55. v-model="type"
  56. size="mini"
  57. placeholder="全部"
  58. popper-class="select"
  59. @change="() => {}"
  60. >
  61. <el-option value="gz" label="故障" />
  62. <el-option value="wh" label="检修" />
  63. </el-select>
  64. </div>
  65. </div>
  66. <div class="search-item">
  67. <span class="label">故障描述:</span>
  68. <div class="search-content">
  69. <el-input
  70. v-model="description"
  71. placeholder="请输入..."
  72. size="mini"
  73. clearable
  74. ></el-input>
  75. </div>
  76. </div>
  77. <div class="search-item">
  78. <span class="label">日期区间:</span>
  79. <div class="search-content">
  80. <el-date-picker
  81. v-model="dateRange"
  82. size="mini"
  83. type="datetimerange"
  84. range-separator="-"
  85. format="YYYY-MM-DD HH:mm:ss"
  86. value-format="YYYY-MM-DD HH:mm:ss"
  87. start-placeholder="开始时间"
  88. end-placeholder="结束时间"
  89. @change="getTableData"
  90. popper-class="date-select"
  91. >
  92. </el-date-picker>
  93. </div>
  94. </div>
  95. </div>
  96. <div class="btns">
  97. <el-button class="buttons" round size="mini" @click="getTableData"
  98. >查询</el-button
  99. >
  100. </div>
  101. </div>
  102. <div class="table-wrapper">
  103. <div class="leftContent" :data-type="$store.state.moreSty">
  104. <span>{{ pageTitle }}</span>
  105. </div>
  106. <el-table
  107. size="mini"
  108. :data="tableData"
  109. height="calc(100% - 43px - 40px)"
  110. style="width: 100%"
  111. stripe
  112. >
  113. <el-table-column
  114. :label="item.label"
  115. :prop="item.prop"
  116. show-overflow-tooltip
  117. header-align="center"
  118. :align="
  119. item.prop == 'handleWay' || item.prop == 'faultView'
  120. ? 'left'
  121. : 'center'
  122. "
  123. v-for="(item, index) in tHeader"
  124. :key="index"
  125. >
  126. <template #default="scope">
  127. <span>
  128. {{
  129. scope.row[item.prop] != "NULL" && scope.row[item.prop] != null
  130. ? scope.row[item.prop]
  131. : "--"
  132. }}
  133. </span>
  134. </template>
  135. </el-table-column>
  136. </el-table>
  137. <div class="pagination-wrapper">
  138. <el-pagination
  139. layout="total, sizes, prev, pager, next"
  140. :page-sizes="[22, 100, 500, 1000]"
  141. @size-change="
  142. (value) => {
  143. pageNum = 1;
  144. pageSize = value;
  145. getTableData();
  146. }
  147. "
  148. :current-page="pageNum"
  149. :page-size="pageSize"
  150. :total="total"
  151. @current-change="currentChange"
  152. ></el-pagination>
  153. </div>
  154. </div>
  155. </div>
  156. </template>
  157. <script>
  158. import dayjs from "dayjs";
  159. import {
  160. getWpList,
  161. fetchWindturbineList,
  162. getStopQueryTableData,
  163. } from "@/api/zhbj/index.js";
  164. export default {
  165. name: "stopQuery",
  166. data() {
  167. return {
  168. pageTitle: "停机查询",
  169. wpId: "",
  170. wpArray: [],
  171. wtId: "",
  172. wtArray: [],
  173. dateRange: [],
  174. type: "gz",
  175. description: "",
  176. pageNum: 1,
  177. pageSize: 22,
  178. total: 0,
  179. tableData: [],
  180. tHeader: [
  181. {
  182. label: "设备编号",
  183. prop: "code",
  184. },
  185. {
  186. label: "停机时间",
  187. prop: "stopTimeName",
  188. },
  189. {
  190. label: "恢复启动时间",
  191. prop: "startTimeName",
  192. },
  193. {
  194. label: "停机小时数",
  195. prop: "stopHours",
  196. },
  197. {
  198. label: "损失电量",
  199. prop: "lossPower",
  200. },
  201. {
  202. label: "报警编号",
  203. prop: "warningId",
  204. },
  205. {
  206. label: "处理方式",
  207. prop: "handleWay",
  208. },
  209. {
  210. label: "故障现象",
  211. prop: "faultView",
  212. },
  213. {
  214. label: "故障类型",
  215. prop: "typeName",
  216. },
  217. ],
  218. };
  219. },
  220. created() {
  221. this.dateRange = [
  222. dayjs().subtract(7, "day").format("YYYY-MM-DD HH:mm:ss"),
  223. dayjs().format("YYYY-MM-DD HH:mm:ss"),
  224. ];
  225. this.getWpList();
  226. this.getTableData();
  227. },
  228. methods: {
  229. async getWpList() {
  230. const { data } = await getWpList("windturbine");
  231. this.wpId = data?.[0]?.id || "";
  232. this.wpArray = data || [];
  233. this.getWtList();
  234. },
  235. async getWtList() {
  236. const { data } = await fetchWindturbineList(this.wpId);
  237. this.wtArray = data || [];
  238. this.getTableData();
  239. },
  240. async getTableData() {
  241. // this.BASE.showLoading();
  242. // const { data } = await getStopQueryTableData({
  243. // wpId: this.wpId,
  244. // wtId: this.wtId,
  245. // type: this.type,
  246. // description: this.description,
  247. // begin: this.dateRange?.[0] || "",
  248. // end: this.dateRange?.[1] || "",
  249. // pageNum: this.pageNum,
  250. // pageSize: this.pageSize,
  251. // });
  252. // this.BASE.closeLoading();
  253. // data?.records?.forEach((ele) => {
  254. // ele.stopTimeName = dayjs(ele.stopTime).format("YYYY-MM-DD HH:mm:ss");
  255. // ele.startTimeName = ele.startTime
  256. // ? dayjs(ele.startTime).format("YYYY-MM-DD HH:mm:ss")
  257. // : "--";
  258. // ele.typeName = ele.stopTypeId === "gz" ? "故障" : "检修";
  259. // });
  260. // this.tableData = data?.records || [];
  261. // this.total = data.total || 0;
  262. this.tableData = new Array(15).fill({
  263. code: "01",
  264. stopTimeName: "2024-06-12 12:55:03",
  265. startTimeName: "",
  266. stopHours: 5,
  267. lossPower: 24,
  268. warningId: "002",
  269. handleWay: "",
  270. faultView: "",
  271. typeName: "故障",
  272. });
  273. },
  274. currentChange(pageNum) {
  275. this.pageNum = pageNum;
  276. this.getTableData();
  277. },
  278. },
  279. };
  280. </script>
  281. <style lang="less" scoped>
  282. .stopQueryBox {
  283. height: 100%;
  284. width: 100%;
  285. padding: 0 20px;
  286. padding-bottom: 15px;
  287. .form-wrapper ::v-deep {
  288. display: flex;
  289. // flex-direction: column;
  290. padding-top: 15px;
  291. .search-wrapper {
  292. display: flex;
  293. align-items: center;
  294. font-size: 14px;
  295. font-family: Microsoft YaHei;
  296. font-weight: 400;
  297. color: #b3b3b3;
  298. margin-bottom: 15px;
  299. .search-item {
  300. display: flex;
  301. margin-right: 10px;
  302. max-width: 450px;
  303. align-items: center;
  304. .label {
  305. margin-right: 10px;
  306. text-align: right;
  307. white-space: nowrap;
  308. // width: 60px;
  309. }
  310. .search-content {
  311. flex: 1;
  312. }
  313. }
  314. }
  315. .buttons {
  316. background-color: rgba(5, 187, 76, 0.2);
  317. border: 1px solid #3b6c53;
  318. color: #b3b3b3;
  319. font-size: 14px;
  320. &:hover {
  321. background-color: rgba(5, 187, 76, 0.5);
  322. color: #ffffff;
  323. }
  324. }
  325. }
  326. .table-wrapper {
  327. height: calc(100% - 62px);
  328. width: 100%;
  329. .leftContent[data-type~="greenSty"] {
  330. background: url("~@/assets/imgs/title_left_bg1.png") no-repeat;
  331. }
  332. .leftContent[data-type~="blueSty"] {
  333. background: url("~@/assets/imgs/title_left_bg.png") no-repeat;
  334. }
  335. .leftContent {
  336. width: 242px;
  337. height: 41px;
  338. display: flex;
  339. align-items: center;
  340. span {
  341. font-size: 16px;
  342. font-family: Microsoft YaHei;
  343. font-weight: 400;
  344. color: #05bb4c;
  345. margin-left: 25px;
  346. }
  347. }
  348. .pagination-wrapper :deep {
  349. text-align: right;
  350. margin-top: 10px;
  351. }
  352. }
  353. }
  354. </style>