HealthTab4.vue 7.9 KB

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