index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522
  1. <template>
  2. <div class="powerLinefitting">
  3. <div class="powerLinefitting_top">
  4. <div class="form-wrapper">
  5. <div class="select-wrapper">
  6. <el-select
  7. size="mini"
  8. v-model="tabEvent"
  9. placeholder="请选择"
  10. @change="changeBtn"
  11. >
  12. <el-option
  13. v-for="item in tabOptions"
  14. :key="item.id"
  15. :label="item.name"
  16. :value="item.id"
  17. >
  18. </el-option>
  19. </el-select>
  20. <el-select
  21. size="mini"
  22. v-model="companyVal"
  23. placeholder="请选择"
  24. @change="changeCompan"
  25. >
  26. <el-option
  27. v-for="item in companyOptions"
  28. :key="item.id"
  29. :label="item.aname"
  30. :value="item.id"
  31. >
  32. </el-option>
  33. </el-select>
  34. <el-select
  35. size="mini"
  36. v-model="stationVal"
  37. placeholder="请选择"
  38. @change="changeStation"
  39. >
  40. <el-option
  41. v-for="item in stationOptions"
  42. :key="item.id"
  43. :label="item.aname"
  44. :value="item.id"
  45. >
  46. </el-option>
  47. </el-select>
  48. </div>
  49. <div class="date-wrapper">
  50. <div class="date-item-wrapper">
  51. 开始时间
  52. <div class="date-item-date">
  53. <el-date-picker
  54. size="mini"
  55. v-model="starTime"
  56. type="datetime"
  57. value-format="YYYY-MM-DD HH:mm:ss"
  58. placeholder="选择时间"
  59. >
  60. </el-date-picker>
  61. </div>
  62. </div>
  63. <div class="date-item-wrapper">
  64. 结束时间
  65. <div class="date-item-date">
  66. <el-date-picker
  67. size="mini"
  68. v-model="endTime"
  69. type="datetime"
  70. value-format="YYYY-MM-DD HH:mm:ss"
  71. placeholder="选择时间"
  72. >
  73. </el-date-picker>
  74. </div>
  75. </div>
  76. </div>
  77. </div>
  78. <div class="but">
  79. <el-button round size="mini" class="buttons" @click="getTableData"
  80. >查询</el-button
  81. >
  82. <el-button round size="mini" class="buttons" @click="handleAdd"
  83. >新增</el-button
  84. >
  85. <el-button round size="mini" class="buttons" @click="downXlsxFn"
  86. >导出</el-button
  87. >
  88. </div>
  89. </div>
  90. <div style="background: rgba(0, 0, 0, 0.4); height: calc(100% - 60px)">
  91. <div class="powerLinefitting_title clearfix">
  92. <div class="leftContent floatLeft"><span>故障录入</span></div>
  93. <div class="rightContent floatRight"></div>
  94. </div>
  95. <div class="powerLinefitting_Table">
  96. <el-table
  97. :data="stationAnalyseData"
  98. stripe
  99. size="mini"
  100. height="calc(100% - 35px)"
  101. ref="fitting_table"
  102. style="width: 100%"
  103. @row-click="handleRowClick"
  104. >
  105. <el-table-column
  106. v-for="(item, index) in tableHeader"
  107. :key="index"
  108. sortable
  109. :prop="item.code"
  110. :label="item.title"
  111. align="center"
  112. >
  113. <template #default="scope" v-if="item.title === '操作'">
  114. <span class="operationBtn" @click="handleEdit(scope.row)"
  115. >编辑</span
  116. >
  117. <span class="operationBtn" @click="handleDelete(scope.row)"
  118. >删除</span
  119. >
  120. </template>
  121. </el-table-column>
  122. </el-table>
  123. <div class="pagination-wrapper">
  124. <el-pagination
  125. @current-change="handleCurrentChange"
  126. :current-page="page.currentPage"
  127. :page-size="page.pagesize"
  128. layout="total, prev, pager, next, jumper"
  129. :total="page.total"
  130. >
  131. </el-pagination>
  132. </div>
  133. </div>
  134. </div>
  135. <operation
  136. ref="operation"
  137. :stationOptions="stationOptions"
  138. @handleSuccess="getTableData"
  139. />
  140. </div>
  141. </template>
  142. <script>
  143. import { GetFaultList, FaultDelete } from "@/api/insert.js";
  144. import { GetOrganization, GetStationByCompany } from "@/api/headerNav.js";
  145. import utils from "@/utils/downXlsx";
  146. import dayjs from "dayjs";
  147. import operation from "./components/operation.vue";
  148. export default {
  149. name: "faultInsert", //故障录入
  150. data() {
  151. return {
  152. companyVal: "",
  153. companyOptions: [],
  154. stationVal: "",
  155. stationOptions: [],
  156. starTime: "",
  157. endTime: "",
  158. stationAnalyseData: [],
  159. stationLineData: [],
  160. tableHeader: [
  161. { title: "场站", code: "windpowerstationName" },
  162. { title: "设备", code: "equipmentName" },
  163. { title: "开始时间", code: "begindate" },
  164. { title: "计划结束时间", code: "planEnddate" },
  165. { title: "实际结束时间", code: "actualEnddate" },
  166. { title: "故障描述", code: "faultDescription" },
  167. { title: "处理过程", code: "processingProcess" },
  168. { title: "备注", code: "spare1" },
  169. { title: "操作" },
  170. ],
  171. tabEvent: -2,
  172. tabOptions: [{ id: -2, name: "光伏" }],
  173. page: {
  174. pagesize: 20,
  175. currentPage: 1,
  176. total: 0,
  177. },
  178. };
  179. },
  180. components: {
  181. operation,
  182. },
  183. created() {
  184. this.starTime = dayjs().startOf("day").format("YYYY-MM-DD HH:mm:ss");
  185. this.endTime = dayjs().format("YYYY-MM-DD HH:mm:ss");
  186. this.getCompanyData();
  187. },
  188. methods: {
  189. //切换风电光伏
  190. changeBtn() {},
  191. // 获取公司列表
  192. async getCompanyData() {
  193. this.companyOptions = [];
  194. const datas = await GetOrganization({ type: this.tabEvent });
  195. this.companyOptions = datas.data;
  196. this.companyVal = datas.data[0]?.id;
  197. this.getStationData(this.companyVal);
  198. },
  199. // 获取场站列表
  200. async getStationData() {
  201. this.stationOptions = [];
  202. let params = {
  203. type: this.tabEvent,
  204. companyids: this.companyVal,
  205. };
  206. const datas = await GetStationByCompany(params);
  207. this.stationOptions = datas.data;
  208. this.stationVal = datas.data[0].id;
  209. this.getTableData();
  210. },
  211. //切换公司
  212. changeCompan(val) {
  213. this.companyVal = val;
  214. this.getStationData();
  215. },
  216. //切换场站
  217. changeStation(val) {
  218. this.stationVal = val;
  219. this.getTableData();
  220. },
  221. //查询
  222. async getTableData() {
  223. let params = {
  224. windpowerstationId: this.stationVal,
  225. pageSize: this.page.pagesize,
  226. pageNum: this.page.currentPage,
  227. begindate: this.starTime,
  228. planEnddate: this.endTime,
  229. };
  230. const { data } = await GetFaultList(params);
  231. this.stationAnalyseData = data.records;
  232. this.page.total = data.total;
  233. },
  234. //新增
  235. handleAdd() {
  236. this.$refs["operation"].form.windpowerstationId = this.stationVal;
  237. this.$refs["operation"].getEquipment(this.stationVal);
  238. this.$refs["operation"].form.begindate = dayjs().format(
  239. "YYYY-MM-DD HH:mm:ss"
  240. );
  241. // this.$refs["operation"].form.planEnddate = dayjs().format(
  242. // "YYYY-MM-DD HH:mm:ss"
  243. // );
  244. // this.$refs["operation"].form.actualEnddate = dayjs().format(
  245. // "YYYY-MM-DD HH:mm:ss"
  246. // );
  247. this.$refs["operation"].openDialog();
  248. },
  249. //编辑
  250. handleEdit(row) {
  251. this.$refs["operation"].getEquipment(row.windpowerstationId);
  252. this.$refs["operation"].openDialog(row);
  253. },
  254. //删除
  255. handleDelete(row) {
  256. if (row.id) {
  257. this.$confirm("你确定要删除吗?", "提示", {
  258. confirmButtonText: "确定",
  259. cancelButtonText: "取消",
  260. type: "warning",
  261. })
  262. .then(() => {
  263. FaultDelete(row.id).then((res) => {
  264. if (res.data) {
  265. this.$message({
  266. type: "success",
  267. message: "删除成功!",
  268. });
  269. this.getTableData();
  270. }
  271. });
  272. })
  273. .catch(() => {
  274. this.$message({
  275. type: "info",
  276. message: "已取消删除",
  277. });
  278. });
  279. } else {
  280. this.$baseMessage("未选中任何行", "error");
  281. return false;
  282. }
  283. },
  284. //导出
  285. downXlsxFn() {
  286. let header = [];
  287. this.tableHeader.forEach((it) => {
  288. if (it.title !== "操作") {
  289. header.push(it.title);
  290. }
  291. });
  292. utils.exportExcel(
  293. this.$refs["fitting_table"].$el,
  294. header,
  295. "故障录入列表"
  296. );
  297. },
  298. },
  299. };
  300. </script>
  301. <style lang="less" scoped>
  302. .powerLinefitting {
  303. padding: 0 23px;
  304. height: 100%;
  305. .powerLinefitting_top::v-deep {
  306. display: flex;
  307. flex-direction: row;
  308. align-items: center;
  309. margin-top: 10px;
  310. margin-bottom: 10px;
  311. padding-left: 10px;
  312. .form-wrapper {
  313. display: flex;
  314. align-items: center;
  315. .select-wrapper {
  316. display: flex;
  317. align-items: center;
  318. .el-select {
  319. width: 155px;
  320. .el-input .el-input__inner {
  321. width: 150px;
  322. }
  323. }
  324. }
  325. .date-wrapper {
  326. display: flex;
  327. align-items: center;
  328. font-size: 14px;
  329. font-family: Microsoft YaHei;
  330. font-weight: 400;
  331. color: #b3b3b3;
  332. margin-left: 10px;
  333. .date-item-wrapper {
  334. display: flex;
  335. align-items: center;
  336. margin-right: 15px;
  337. .date-item-date {
  338. margin-left: 10px;
  339. .el-input .el-input__inner {
  340. font-size: 13px;
  341. color: #b3b3b3;
  342. }
  343. }
  344. }
  345. }
  346. }
  347. .station {
  348. display: flex;
  349. flex-direction: row;
  350. align-items: center;
  351. font-size: 14px;
  352. font-family: Microsoft YaHei;
  353. font-weight: 400;
  354. color: #b3b3b3;
  355. margin-right: 25px;
  356. }
  357. .search-input {
  358. margin-left: 10px;
  359. .el-input__inner {
  360. width: 175px;
  361. }
  362. .el-input__suffix {
  363. right: -50px;
  364. }
  365. }
  366. .but {
  367. display: flex;
  368. flex-direction: row;
  369. align-content: center;
  370. .buttons:nth-child(1) {
  371. background: rgba(0, 70, 199, 0.6);
  372. border: 1px solid #1f51ae;
  373. border-radius: 13px;
  374. color: #fff;
  375. &:hover {
  376. background: rgba(14, 90, 229, 0.9);
  377. border-radius: 13px;
  378. color: #fff;
  379. }
  380. }
  381. .buttons:nth-child(2) {
  382. background: rgba(0, 70, 199, 0.6);
  383. border: 1px solid #1f51ae;
  384. border-radius: 13px;
  385. color: #fff;
  386. &:hover {
  387. background: rgba(14, 90, 229, 0.9);
  388. border-radius: 13px;
  389. color: #fff;
  390. }
  391. }
  392. .buttons:nth-child(3) {
  393. background: rgba(67, 81, 107, 0.3);
  394. border: 1px solid #3b4c6c;
  395. border-radius: 13px;
  396. font-size: 14px;
  397. color: #b3b3b3;
  398. }
  399. }
  400. }
  401. .powerLinefitting_title {
  402. padding-left: 10px;
  403. .leftContent {
  404. width: 242px;
  405. height: 41px;
  406. line-height: 41px;
  407. background: url("../../../../../assets/imgs/title_left_bg.png");
  408. span {
  409. font-size: 16px;
  410. font-family: Microsoft YaHei;
  411. font-weight: 400;
  412. color: #ffffff;
  413. margin-left: 25px;
  414. }
  415. }
  416. .floatLeft {
  417. float: left;
  418. }
  419. .floatRight {
  420. float: right;
  421. }
  422. .rightContent {
  423. width: 212px;
  424. height: 28px;
  425. margin-top: 13px;
  426. background: url("../../../../../assets/imgs/title_right_bg.png");
  427. }
  428. }
  429. .clearfix::after {
  430. content: "";
  431. clear: both;
  432. height: 0;
  433. line-height: 0;
  434. visibility: hidden;
  435. display: block;
  436. }
  437. .clearfix {
  438. zoom: 1;
  439. }
  440. .powerLinefitting_Table ::v-deep {
  441. margin: 0 5px 5px 5px;
  442. padding-bottom: 10px;
  443. height: calc(100% - 41px - 10px);
  444. .operationBtn {
  445. cursor: pointer;
  446. color: #1c99ff;
  447. padding: 3px 10px;
  448. }
  449. .pagination-wrapper {
  450. display: flex;
  451. justify-content: flex-end;
  452. padding-right: 20px;
  453. .el-pagination {
  454. display: flex;
  455. align-items: center;
  456. .btn-prev,
  457. .btn-next,
  458. .btn-quickprev,
  459. .btn-quicknext,
  460. .el-pager,
  461. .number {
  462. background: rgba(58, 63, 75, 0.4);
  463. color: #fff;
  464. border-radius: 2px;
  465. }
  466. .el-pager .active {
  467. background: #083c94;
  468. color: #fff;
  469. border-radius: 2px;
  470. }
  471. .el-pagination__total,
  472. .el-pagination__jump {
  473. color: #fff;
  474. .el-input__inner {
  475. background: rgba(58, 63, 75, 0.2);
  476. border: 1px solid #3e4349;
  477. color: #fff;
  478. border-radius: 2px;
  479. }
  480. }
  481. }
  482. }
  483. .el-table--mini {
  484. margin: 5px;
  485. .el-table__header-wrapper {
  486. tr {
  487. background: rgba(83, 89, 104, 0.3) !important;
  488. // th {
  489. // vertical-align: top !important;
  490. // }
  491. .cell {
  492. color: #b3b3b3;
  493. font-family: MicrosoftYaHei;
  494. font-size: 14px;
  495. }
  496. }
  497. }
  498. .el-table__body-wrapper {
  499. tr {
  500. &:nth-child(2n) {
  501. background: rgba(83, 89, 104, 0.05) !important;
  502. }
  503. .cell {
  504. color: #d8d8d9;
  505. font-family: ArialMT;
  506. font-size: 13px;
  507. height: 25px !important;
  508. }
  509. }
  510. }
  511. }
  512. }
  513. }
  514. </style>