HealthTab4.vue 8.1 KB

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