HealthTab4.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  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. <info-history :formdata="trackDate" />
  86. </el-dialog>
  87. </div>
  88. </div>
  89. </template>
  90. <script>
  91. import InfoHistory from "./infotrack2.vue";
  92. import ComTable from "@com/coms/table/table.vue";
  93. import SvgIcon from "../../components/coms/icon/svg-icon.vue";
  94. import { warn } from "@vue/runtime-core";
  95. export default {
  96. components: { InfoHistory, ComTable, SvgIcon },
  97. data() {
  98. const that = this;
  99. return {
  100. stations: [], // 场站
  101. windturbines: [], // 风机
  102. station: "",
  103. windturbine: "",
  104. starts: "",
  105. endts: new Date(),
  106. tableData: {
  107. column: [
  108. {
  109. name: "场站",
  110. field: "wfname",
  111. is_light: false,
  112. },
  113. {
  114. name: "风机编号",
  115. field: "wtid",
  116. is_light: false,
  117. },
  118. {
  119. name: "任务开始时间",
  120. field: "operationdate",
  121. is_light: false,
  122. },
  123. {
  124. name: "任务接受时间",
  125. field: "departuretime",
  126. is_light: false,
  127. },
  128. {
  129. name: "检修原因",
  130. field: "reason",
  131. is_light: false,
  132. },
  133. {
  134. name: "消缺工艺",
  135. field: "repairedcomment",
  136. is_light: false,
  137. },
  138. {
  139. name: "操作",
  140. field: "",
  141. is_num: false,
  142. is_light: false,
  143. template() {
  144. return "<el-button type='text' style='cursor: pointer;'>消缺跟踪</el-button>";
  145. },
  146. click(e, row) {
  147. that.onClickTrack(row);
  148. },
  149. },
  150. ],
  151. data: [],
  152. },
  153. dialogVisible: false,
  154. trackDate: undefined,
  155. };
  156. },
  157. created() {
  158. this.starts = new Date().formatDate("yyyy-MM") + "-01";
  159. // this.starts = "2021-01-01";
  160. this.requestStations();
  161. },
  162. methods: {
  163. // 搜索按钮
  164. onClickSearch() {
  165. this.requestFinishedList();
  166. },
  167. // 消缺跟踪
  168. onClickTrack(row) {
  169. this.requestTrack(row);
  170. },
  171. // 历史查询
  172. onClickHistory(row) {
  173. this.dialogVisible = true;
  174. },
  175. // 获取场站
  176. requestStations() {
  177. let that = this;
  178. that.API.requestData({
  179. method: "GET",
  180. subUrl: "powercompare/windfarmAjax",
  181. success(res) {
  182. if (res.code == 200) {
  183. that.stations = res.data;
  184. that.station = that.stations[3].id;
  185. that.requestFinishedList();
  186. }
  187. },
  188. });
  189. },
  190. // 获取风机
  191. requestWindturbines(wpid) {
  192. let that = this;
  193. that.API.requestData({
  194. method: "GET",
  195. subUrl: "powercompare/windturbineAjax",
  196. data: { wpId: wpid },
  197. success(res) {
  198. if (res.code == 200) that.windturbines = res.data;
  199. },
  200. });
  201. },
  202. // 获取已完成消缺单列表
  203. requestFinishedList() {
  204. let that = this;
  205. that.API.requestData({
  206. method: "POST",
  207. subUrl: "recommen/finishedList",
  208. data: {
  209. wpId: that.station,
  210. wtId: that.windturbine,
  211. beginDate: new Date(that.starts).formatDate("yyyy-MM-dd"),
  212. endDate: new Date(that.endts).formatDate("yyyy-MM-dd"),
  213. },
  214. success(res) {
  215. if (res.code == 200) {
  216. that.tableData.data = [];
  217. res.data.forEach((item) => {
  218. let obj = {
  219. wfname: item.wfname,
  220. wtid: item.wtid,
  221. operationdate: item.operationdate
  222. ? new Date(item.operationdate).formatDate(
  223. "yyyy-MM-dd hh:mm:ss"
  224. )
  225. : "",
  226. departuretime: item.departuretime
  227. ? new Date(item.departuretime).formatDate(
  228. "yyyy-MM-dd hh:mm:ss"
  229. )
  230. : "",
  231. reason: item.reason,
  232. repairedcomment: item.repairedcomment,
  233. rid: item.rid,
  234. };
  235. that.tableData.data.push(obj);
  236. });
  237. }
  238. },
  239. });
  240. },
  241. // 通过消缺单获得详细信息
  242. requestTrack(row) {
  243. let that = this;
  244. that.API.requestData({
  245. method: "POST",
  246. subUrl: "recommen/findMainTrack",
  247. timeout: 30000,
  248. data: {
  249. rid: row.rid,
  250. },
  251. success(res) {
  252. if (res.code == 200) {
  253. that.trackDate = res.data;
  254. that.dialogVisible = true;
  255. }
  256. },
  257. });
  258. },
  259. },
  260. watch: {
  261. station(val) {
  262. this.windturbine = "";
  263. this.requestWindturbines(val);
  264. },
  265. },
  266. };
  267. </script>
  268. <style lang="less" scope>
  269. @titleGray: #9ca5a8;
  270. @rowGray: #606769;
  271. @darkBack: #536268;
  272. .health-tab-4 {
  273. .dialog-box {
  274. height: 100%;
  275. display: flex;
  276. justify-content: center;
  277. align-items: center;
  278. }
  279. }
  280. </style>