HealthTab4.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  1. <template>
  2. <div class="health-tab-4">
  3. <div class="query mg-b-8">
  4. <div class="query-items">
  5. <div class="query-item">
  6. <div class="lable">场站:</div>
  7. <div class="search-input">
  8. <el-select
  9. v-model="station"
  10. clearable
  11. placeholder="请选择"
  12. popper-class="select"
  13. >
  14. <el-option
  15. v-for="item in stations"
  16. :key="item.id"
  17. :label="item.name"
  18. :value="item.id"
  19. >
  20. </el-option>
  21. </el-select>
  22. </div>
  23. </div>
  24. <div class="query-item">
  25. <div class="lable">机组</div>
  26. <div class="search-input">
  27. <el-select
  28. v-model="windturbine"
  29. placeholder="请选择"
  30. popper-class="select"
  31. >
  32. <el-option
  33. v-for="item in windturbines"
  34. :key="item.id"
  35. :label="item.name"
  36. :value="item.id"
  37. >
  38. </el-option>
  39. </el-select>
  40. </div>
  41. </div>
  42. <div class="query-item">
  43. <div class="lable">开始日期:</div>
  44. <div class="search-input">
  45. <el-date-picker
  46. v-model="starts"
  47. type="date"
  48. placeholder="选择日期"
  49. popper-class="date-select"
  50. >
  51. </el-date-picker>
  52. </div>
  53. </div>
  54. <div class="query-item">
  55. <div class="lable">结束日期:</div>
  56. <div class="search-input">
  57. <el-date-picker
  58. v-model="endts"
  59. type="date"
  60. placeholder="选择日期"
  61. popper-class="date-select"
  62. >
  63. </el-date-picker>
  64. <div class="unit svg-icon svg-icon-gray">
  65. <svg-icon :svgid="''" />
  66. </div>
  67. </div>
  68. </div>
  69. </div>
  70. <div class="query-actions" style="margin-right: 500px">
  71. <button class="btn green" @click="onClickSearch">搜 索</button>
  72. </div>
  73. </div>
  74. <div class="table-box">
  75. <ComTable :data="tableData" height="80vh"></ComTable>
  76. </div>
  77. <div class="dialog-box">
  78. <!-- <el-dialog
  79. title="日信息对比"
  80. v-model="dialogVisible"
  81. width="1200px"
  82. custom-class="modal"
  83. :close-on-click-modal="false"
  84. > -->
  85. <el-dialog
  86. title="消缺跟踪"
  87. v-model="dialogVisible"
  88. width="1200px"
  89. custom-class="modal"
  90. :close-on-click-modal="false"
  91. >
  92. <info-history :formdata="trackDate" />
  93. </el-dialog>
  94. </div>
  95. <el-dialog
  96. title="消缺历史"
  97. v-model="history"
  98. width="1400px"
  99. height="800px"
  100. custom-class="modal"
  101. :close-on-click-modal="false"
  102. >
  103. <History :formdata="trackDate" />
  104. </el-dialog>
  105. </div>
  106. </template>
  107. <script>
  108. import InfoHistory from "./infotrack2.vue";
  109. import History from "./healthTab4History.vue";
  110. import ComTable from "@com/coms/table/table.vue";
  111. import SvgIcon from "../../components/coms/icon/svg-icon.vue";
  112. import { warn } from "@vue/runtime-core";
  113. import api from "@api/wisdomOverhaul/health/index.js";
  114. import api1 from "@api/economic/index.js";
  115. export default {
  116. components: { InfoHistory, ComTable, SvgIcon, History },
  117. data() {
  118. const that = this;
  119. return {
  120. history: false,
  121. stations: [], // 场站
  122. windturbines: [], // 风机
  123. station: "",
  124. windturbine: "CL01_001",
  125. starts: "",
  126. endts: new Date(),
  127. tableData: {
  128. column: [
  129. {
  130. name: "场站",
  131. width: "120px",
  132. field: "wfname",
  133. is_light: false,
  134. },
  135. {
  136. name: "风机编号",
  137. width: "100px",
  138. field: "wtid",
  139. is_light: false,
  140. },
  141. {
  142. name: "任务开始时间",
  143. width: "150px",
  144. field: "operationdate",
  145. is_light: false,
  146. },
  147. {
  148. name: "任务接受时间",
  149. width: "150px",
  150. field: "departuretime",
  151. is_light: false,
  152. },
  153. {
  154. name: "检修原因",
  155. field: "reason",
  156. is_light: false,
  157. },
  158. {
  159. name: "消缺工艺",
  160. field: "repairedcomment",
  161. is_light: false,
  162. },
  163. {
  164. name: "操作",
  165. width: "170px",
  166. field: "",
  167. is_num: false,
  168. is_light: false,
  169. template() {
  170. return "<el-button type='text' style='cursor: pointer;' value='gz'>消缺跟踪</el-button>&nbsp;&nbsp;<el-button type='text' style='cursor: pointer;' value='ls'>消缺历史</el-button>";
  171. },
  172. click(e, row) {
  173. if ("gz" == event.target.getAttribute("value")) {
  174. that.onClickTrack(row);
  175. }
  176. if ("ls" == event.target.getAttribute("value")) {
  177. that.requestTrack(row);
  178. that.history = true;
  179. }
  180. },
  181. },
  182. ],
  183. data: [],
  184. },
  185. dialogVisible: false,
  186. trackDate: undefined,
  187. };
  188. },
  189. created() {
  190. this.starts = new Date().formatDate("yyyy-MM") + "-01";
  191. // this.starts = "2021-01-01";
  192. this.requestStations();
  193. },
  194. methods: {
  195. // 搜索按钮
  196. onClickSearch() {
  197. this.requestFinishedList();
  198. },
  199. // 消缺跟踪
  200. onClickTrack(row) {
  201. this.dialogVisible = true;
  202. this.requestTrack(row);
  203. },
  204. // 历史查询
  205. onClickHistory(row) {
  206. this.dialogVisible = true;
  207. },
  208. // 获取场站
  209. requestStations() {
  210. api1.benchmarkingWplist({}).then((res) => {
  211. if (res.code == 200) {
  212. if (res.code == 200) {
  213. this.stations = res.data;
  214. this.station = this.stations[0].id;
  215. this.requestFinishedList();
  216. }
  217. }
  218. });
  219. },
  220. // 获取风机
  221. requestWindturbines(wpid) {
  222. api
  223. .powercompareWindturbineAjax({
  224. wpId: wpid,
  225. })
  226. .then((res) => {
  227. if (res.code == 200) this.windturbines = res.data;
  228. });
  229. // let that = this;
  230. // that.API.requestData({
  231. // method: "GET",
  232. // subUrl: "powercompare/windturbineAjax",
  233. // data: { wpId: wpid },
  234. // success(res) {
  235. // if (res.code == 200) that.windturbines = res.data;
  236. // },
  237. // });
  238. },
  239. // 获取已完成消缺单列表
  240. requestFinishedList() {
  241. api
  242. .recommenFinishedList({
  243. wpId: this.station,
  244. wtId: this.windturbine,
  245. beginDate: new Date(this.starts).formatDate("yyyy-MM-dd"),
  246. endDate: new Date(this.endts).formatDate("yyyy-MM-dd"),
  247. })
  248. .then((res) => {
  249. if (res.code == 200) {
  250. this.tableData.data = [];
  251. res.data.forEach((item) => {
  252. let obj = {
  253. wfname: item.wfname,
  254. wtid: item.wtid,
  255. operationdate: item.operationdate
  256. ? new Date(item.operationdate).formatDate(
  257. "yyyy-MM-dd hh:mm:ss"
  258. )
  259. : "",
  260. departuretime: item.departuretime
  261. ? new Date(item.departuretime).formatDate(
  262. "yyyy-MM-dd hh:mm:ss"
  263. )
  264. : "",
  265. reason: item.reason,
  266. repairedcomment: item.repairedcomment,
  267. rid: item.rid,
  268. };
  269. this.tableData.data.push(obj);
  270. });
  271. }
  272. });
  273. // let that = this;
  274. // that.API.requestData({
  275. // method: "POST",
  276. // subUrl: "recommen/finishedList",
  277. // data: {
  278. // wpId: that.station,
  279. // wtId: that.windturbine,
  280. // beginDate: new Date(that.starts).formatDate("yyyy-MM-dd"),
  281. // endDate: new Date(that.endts).formatDate("yyyy-MM-dd"),
  282. // },
  283. // success(res) {
  284. // if (res.code == 200) {
  285. // that.tableData.data = [];
  286. // res.data.forEach((item) => {
  287. // let obj = {
  288. // wfname: item.wfname,
  289. // wtid: item.wtid,
  290. // operationdate: item.operationdate
  291. // ? new Date(item.operationdate).formatDate(
  292. // "yyyy-MM-dd hh:mm:ss"
  293. // )
  294. // : "",
  295. // departuretime: item.departuretime
  296. // ? new Date(item.departuretime).formatDate(
  297. // "yyyy-MM-dd hh:mm:ss"
  298. // )
  299. // : "",
  300. // reason: item.reason,
  301. // repairedcomment: item.repairedcomment,
  302. // rid: item.rid,
  303. // };
  304. // that.tableData.data.push(obj);
  305. // });
  306. // }
  307. // },
  308. // });
  309. },
  310. // 通过消缺单获得详细信息
  311. requestTrack(row) {
  312. api
  313. .recommenFindMainTrack({
  314. rid: row.rid,
  315. })
  316. .then((res) => {
  317. if (res.code == 200) {
  318. this.trackDate = res.data;
  319. }
  320. });
  321. // let that = this;
  322. // that.API.requestData({
  323. // method: "POST",
  324. // subUrl: "recommen/findMainTrack",
  325. // timeout: 30000,
  326. // data: {
  327. // rid: row.rid,
  328. // },
  329. // success(res) {
  330. // if (res.code == 200) {
  331. // that.trackDate = res.data;
  332. // }
  333. // },
  334. // });
  335. },
  336. },
  337. watch: {
  338. station(val) {
  339. this.windturbine = "";
  340. this.requestWindturbines(val);
  341. },
  342. },
  343. };
  344. </script>
  345. <style lang="less" scope>
  346. @titleGray: #9ca5a8;
  347. @rowGray: #606769;
  348. @darkBack: #536268;
  349. .health-tab-4 {
  350. .dialog-box {
  351. height: 100%;
  352. display: flex;
  353. justify-content: center;
  354. align-items: center;
  355. }
  356. }
  357. </style>