index.vue 8.4 KB

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