index.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  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. >
  91. </el-date-picker>
  92. </div>
  93. </div>
  94. </div>
  95. <div class="btns">
  96. <el-button class="buttons" round size="mini" @click="getTableData"
  97. >查询</el-button
  98. >
  99. </div>
  100. </div>
  101. <div class="table-wrapper">
  102. <div class="leftContent">
  103. <span>{{ pageTitle }}</span>
  104. </div>
  105. <el-table
  106. size="mini"
  107. :data="tableData"
  108. height="calc(100% - 43px - 40px)"
  109. style="width: 100%"
  110. stripe
  111. >
  112. <el-table-column
  113. :label="item.label"
  114. :prop="item.prop"
  115. show-overflow-tooltip
  116. header-align="center"
  117. align="center"
  118. v-for="(item, index) in tHeader"
  119. :key="index"
  120. >
  121. <template #default="scope">
  122. <span>
  123. {{ scope.row[item.prop] != "NULL" ? scope.row[item.prop] : "--" }}
  124. </span>
  125. </template>
  126. </el-table-column>
  127. </el-table>
  128. <div class="pagination-wrapper">
  129. <el-pagination
  130. layout="total, sizes, prev, pager, next"
  131. :page-sizes="[22, 100, 500, 1000]"
  132. @size-change="
  133. (value) => {
  134. pageNum = 1;
  135. pageSize = value;
  136. getTableData();
  137. }
  138. "
  139. :current-page="pageNum"
  140. :page-size="pageSize"
  141. :total="total"
  142. @current-change="currentChange"
  143. ></el-pagination>
  144. </div>
  145. </div>
  146. </div>
  147. </template>
  148. <script>
  149. import dayjs from "dayjs";
  150. import {
  151. getWpList,
  152. fetchWindturbineList,
  153. getStopQueryTableData,
  154. } from "@/api/zhbj/index.js";
  155. export default {
  156. name: "stopQuery",
  157. data() {
  158. return {
  159. pageTitle: "停机查询",
  160. wpId: "",
  161. wpArray: [],
  162. wtId: "",
  163. wtArray: [],
  164. dateRange: [],
  165. type: "gz",
  166. description: "",
  167. pageNum: 1,
  168. pageSize: 22,
  169. total: 0,
  170. tableData: [],
  171. tHeader: [
  172. {
  173. label: "设备编号",
  174. prop: "code",
  175. },
  176. {
  177. label: "停机时间",
  178. prop: "stopTimeName",
  179. },
  180. {
  181. label: "恢复启动时间",
  182. prop: "startTimeName",
  183. },
  184. {
  185. label: "停机小时数",
  186. prop: "stopHours",
  187. },
  188. {
  189. label: "损失电量",
  190. prop: "lossPower",
  191. },
  192. {
  193. label: "报警编号",
  194. prop: "warningId",
  195. },
  196. {
  197. label: "处理方式",
  198. prop: "handleWay",
  199. },
  200. {
  201. label: "故障现象",
  202. prop: "faultView",
  203. },
  204. {
  205. label: "故障类型",
  206. prop: "typeName",
  207. },
  208. ],
  209. };
  210. },
  211. created() {
  212. this.dateRange = [
  213. dayjs().subtract(7, "day").format("YYYY-MM-DD HH:mm:ss"),
  214. dayjs().format("YYYY-MM-DD HH:mm:ss"),
  215. ];
  216. this.getWpList();
  217. },
  218. methods: {
  219. async getWpList() {
  220. const { data } = await getWpList("windturbine");
  221. this.wpId = data?.[0]?.id || "";
  222. this.wpArray = data || [];
  223. this.getWtList();
  224. },
  225. async getWtList() {
  226. const { data } = await fetchWindturbineList(this.wpId);
  227. this.wtArray = data || [];
  228. this.getTableData();
  229. },
  230. async getTableData() {
  231. this.BASE.showLoading();
  232. const { data } = await getStopQueryTableData({
  233. wpId: this.wpId,
  234. wtId: this.wtId,
  235. type: this.type,
  236. description: this.description,
  237. begin: this.dateRange?.[0] || "",
  238. end: this.dateRange?.[1] || "",
  239. pageNum: this.pageNum,
  240. pageSize: this.pageSize,
  241. });
  242. this.BASE.closeLoading();
  243. data?.records?.forEach((ele) => {
  244. ele.stopTimeName = dayjs(ele.stopTime).format("YYYY-MM-DD HH:mm:ss");
  245. ele.startTimeName = ele.startTime
  246. ? dayjs(ele.startTime).format("YYYY-MM-DD HH:mm:ss")
  247. : "";
  248. ele.typeName = ele.stopTypeId === "gz" ? "故障" : "检修";
  249. });
  250. this.tableData = data?.records || [];
  251. this.total = data.total || 0;
  252. },
  253. currentChange(pageNum) {
  254. this.pageNum = pageNum;
  255. this.getTableData();
  256. },
  257. },
  258. };
  259. </script>
  260. <style lang="less" scoped>
  261. .stopQueryBox {
  262. height: 100%;
  263. width: 100%;
  264. padding: 0 20px;
  265. padding-bottom: 15px;
  266. .form-wrapper ::v-deep {
  267. display: flex;
  268. // flex-direction: column;
  269. padding-top: 15px;
  270. .search-wrapper {
  271. display: flex;
  272. align-items: center;
  273. font-size: 14px;
  274. font-family: Microsoft YaHei;
  275. font-weight: 400;
  276. color: #b3b3b3;
  277. margin-bottom: 15px;
  278. .search-item {
  279. display: flex;
  280. margin-right: 10px;
  281. max-width: 450px;
  282. align-items: center;
  283. .label {
  284. margin-right: 10px;
  285. text-align: right;
  286. white-space: nowrap;
  287. // width: 60px;
  288. }
  289. .search-content {
  290. flex: 1;
  291. }
  292. }
  293. }
  294. .buttons {
  295. background-color: rgba(5, 187, 76, 0.2);
  296. border: 1px solid #3b6c53;
  297. color: #b3b3b3;
  298. font-size: 14px;
  299. &:hover {
  300. background-color: rgba(5, 187, 76, 0.5);
  301. color: #ffffff;
  302. }
  303. }
  304. }
  305. .table-wrapper {
  306. height: calc(100% - 62px);
  307. width: 100%;
  308. .leftContent {
  309. width: 242px;
  310. height: 41px;
  311. display: flex;
  312. align-items: center;
  313. background: url("~@/assets/imgs/title_left_bg1.png") no-repeat;
  314. span {
  315. font-size: 16px;
  316. font-family: Microsoft YaHei;
  317. font-weight: 400;
  318. color: #05bb4c;
  319. margin-left: 25px;
  320. }
  321. }
  322. .pagination-wrapper :deep {
  323. text-align: right;
  324. margin-top: 10px;
  325. }
  326. }
  327. }
  328. </style>