tab3.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. <template>
  2. <div class="draught-fan-list">
  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 v-model="wpId" clearable placeholder="请选择" popper-class="select" @change="getWtArray">
  9. <el-option v-for="item in wpArray" :key="item.id" :value="item.id" :label="item.name" />
  10. </el-select>
  11. </div>
  12. </div>
  13. <div class="query-item">
  14. <div class="lable">风机:</div>
  15. <div class="search-input">
  16. <el-select v-model="wtId" clearable placeholder="请选择" popper-class="select">
  17. <el-option v-for="item in wtArray" :key="item.id" :value="item.id" :label="item.name" />
  18. </el-select>
  19. </div>
  20. </div>
  21. <div class="query-item">
  22. <div class="lable">开始日期:</div>
  23. <div class="search-input">
  24. <el-date-picker v-model="starttime" type="date" value-format="YYYY-MM-DD" placeholder="选择日期" popper-class="date-select">
  25. </el-date-picker>
  26. </div>
  27. </div>
  28. <div class="query-item">
  29. <div class="lable">结束日期:</div>
  30. <div class="search-input">
  31. <el-date-picker v-model="endtime" type="date" value-format="YYYY-MM-DD" placeholder="选择日期" popper-class="date-select">
  32. </el-date-picker>
  33. </div>
  34. </div>
  35. <div class="query-item">
  36. <div class="lable">类型:</div>
  37. <div class="search-input">
  38. <el-select v-model="type" clearable placeholder="请选择" popper-class="select">
  39. <el-option v-for="item in typeArray" :key="item.id" :value="item.id" :label="item.name" />
  40. </el-select>
  41. </div>
  42. </div>
  43. </div>
  44. <div class="query-actions">
  45. <button class="btn green" @click="search()">查询</button>
  46. </div>
  47. </div>
  48. <div class="df-table">
  49. <ComTable height="78vh" :data="tableData"></ComTable>
  50. </div>
  51. </div>
  52. </template>
  53. <script>
  54. import ComTable from "@com/coms/table/table.vue";
  55. export default {
  56. // 名称
  57. name: "cutAnalyse",
  58. // 使用组件
  59. components: {
  60. ComTable
  61. },
  62. // 数据
  63. data () {
  64. const that = this;
  65. return {
  66. wpArray: [],
  67. wpId: "",
  68. wtArray: [],
  69. wtId: "",
  70. type: "异动",
  71. typeArray: [{
  72. id: "检修",
  73. label: "检修",
  74. value: "检修"
  75. }, {
  76. id: "异动",
  77. label: "异动",
  78. value: "异动"
  79. }, {
  80. id: "故障",
  81. label: "故障",
  82. value: "故障"
  83. }],
  84. starttime: new Date().formatDate("yyyy-MM") + "-01",
  85. endtime: new Date().formatDate("yyyy-MM-dd"),
  86. tableData: {
  87. column: [
  88. {
  89. name: "检修负责人",
  90. field: "leader",
  91. is_num: false,
  92. is_light: false,
  93. sortable: true
  94. },
  95. {
  96. name: "检修类型",
  97. field: "type",
  98. is_num: false,
  99. is_light: false,
  100. sortable: true
  101. },
  102. {
  103. name: "风机编号",
  104. field: "wtnum",
  105. is_num: false,
  106. is_light: false,
  107. sortable: true
  108. },
  109. {
  110. name: "开始时间",
  111. field: "starttime",
  112. is_num: false,
  113. is_light: false,
  114. sortable: true
  115. },
  116. {
  117. name: "结束时间",
  118. field: "endtime",
  119. is_num: false,
  120. is_light: false,
  121. sortable: true
  122. },
  123. {
  124. name: "检修原因",
  125. field: "problem",
  126. is_num: false,
  127. is_light: false,
  128. sortable: true
  129. },
  130. {
  131. name: "检修方式",
  132. field: "solveway",
  133. is_num: false,
  134. is_light: false,
  135. sortable: true
  136. },
  137. {
  138. name: "设备唯一编号",
  139. field: "eqnum",
  140. is_num: false,
  141. is_light: false,
  142. sortable: true
  143. }
  144. ],
  145. data: [],
  146. }
  147. };
  148. },
  149. // 函数
  150. methods: {
  151. // 获取风场
  152. getWpArray () {
  153. let that = this;
  154. that.API.requestData({
  155. method: "GET",
  156. subUrl: "powercompare/windfarmAjax",
  157. success (res) {
  158. that.wpArray = res.data;
  159. that.wpId = that.wpId || res.data[0].id;
  160. that.getWtArray(that.wpId, true);
  161. }
  162. });
  163. },
  164. // 获取风机
  165. getWtArray (wpId, keepRequest) {
  166. let that = this;
  167. if (wpId) {
  168. that.API.requestData({
  169. method: "GET",
  170. subUrl: "powercompare/windturbineAjax",
  171. data: {
  172. wpId
  173. },
  174. success (res) {
  175. that.wtArray = res.data;
  176. const findRes = res.data.some(ele => {
  177. return ele.id === that.wtId;
  178. });
  179. that.wtId = (findRes ? that.wtId : res.data[0].id);
  180. that.getTableData();
  181. }
  182. });
  183. } else {
  184. that.wtArray = [];
  185. that.wtId = "";
  186. }
  187. },
  188. getTableData () {
  189. let that = this;
  190. if (!that.wpId || !that.starttime || !that.endtime) {
  191. that.BASE.showMsg({
  192. msg: "场站与日期不可为空"
  193. });
  194. } else {
  195. that.API.requestData({
  196. method: "GET",
  197. baseURL: "http://192.168.10.18:9988/",
  198. subUrl: "equoperationrecord/list",
  199. data: {
  200. wtid: that.wtId,
  201. starttime: that.starttime,
  202. endtime: that.endtime,
  203. type: that.type,
  204. pagenum: 1,
  205. pagesize: 50000
  206. },
  207. success (res) {
  208. that.tableData.data = res.data.records;
  209. }
  210. });
  211. }
  212. },
  213. search () {
  214. this.getTableData();
  215. }
  216. },
  217. created () {
  218. this.getWpArray();
  219. },
  220. mounted () { },
  221. unmounted () { },
  222. };
  223. </script>
  224. <style lang="less" scoped>
  225. .draught-fan-list {
  226. width: 100%;
  227. height: 100%;
  228. display: flex;
  229. flex-direction: column;
  230. .btn-group-tabs {
  231. display: flex;
  232. flex-direction: row;
  233. .photovoltaic {
  234. margin-left: 1.481vh;
  235. }
  236. }
  237. .df-table {
  238. border: 0.093vh solid fade(@darkgray, 50%);
  239. position: relative;
  240. overflow: auto;
  241. flex-grow: 1;
  242. margin-top: 1.481vh;
  243. &:before {
  244. content: '';
  245. width: 0.37vh;
  246. height: 0.37vh;
  247. background: @write;
  248. position: absolute;
  249. left: 0.278vh;
  250. top: 0.278vh;
  251. }
  252. tbody {
  253. height: calc(100vh - 166px);
  254. }
  255. }
  256. }
  257. </style>