index.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch">
  4. <!-- <el-form-item label="安装位置:" prop="name">
  5. <el-input
  6. v-model.trim="queryParams.name"
  7. placeholder="请输入安装位置"
  8. clearable
  9. size="small"
  10. style="width: 160px"
  11. @keyup.enter.native="handleQuery"
  12. />
  13. </el-form-item>
  14. <el-form-item label="设备名称:" prop="name">
  15. <el-input
  16. v-model.trim="queryParams.name"
  17. placeholder="请输入设备名称"
  18. clearable
  19. size="small"
  20. style="width: 160px"
  21. @keyup.enter.native="handleQuery"
  22. />
  23. </el-form-item> -->
  24. <el-form-item label="采集时间:" class="time">
  25. <el-date-picker
  26. style="margin-top:5px;;width:340px"
  27. v-model="dateRange"
  28. size="small"
  29. value-format="yyyy-MM-dd HH:mm:ss"
  30. type="datetimerange"
  31. range-separator="-"
  32. start-placeholder="开始日期"
  33. end-placeholder="结束日期"
  34. ></el-date-picker>
  35. </el-form-item>
  36. <el-form-item class="right">
  37. <el-button plain size="mini" @click="resetQuery">重置</el-button>
  38. <el-button type="primary" size="mini" @click="handleQuery">搜索</el-button>
  39. </el-form-item>
  40. </el-form>
  41. <el-table v-loading="loading" :data="adminList" border style="margin-top:20px">
  42. <el-table-column label="序号" align="left" prop="id" show-overflow-tooltip />
  43. <el-table-column label="设备名称" align="left" prop="deviceName" show-overflow-tooltip />
  44. <el-table-column label="采集时间" align="left" prop="createTime" show-overflow-tooltip />
  45. <el-table-column label="泵1运行状态" align="left" prop="" show-overflow-tooltip >
  46. <template slot-scope="scope">
  47. <span :class="scope.row.b1rs == 0 ? 'color3' : 'color4'">{{scope.row.b1rs == 0 ? "停止" : "运行"}}</span>
  48. </template>
  49. </el-table-column>
  50. <el-table-column label="泵1故障状态 " align="left" prop="" show-overflow-tooltip >
  51. <template slot-scope="scope">
  52. <span :class="scope.row.b1al == 0 ? 'color4' : 'color3'">{{scope.row.b1al == 0 ? "正常" : "故障"}}</span>
  53. </template>
  54. </el-table-column>
  55. <el-table-column label="泵2运行状态" align="left" prop="" show-overflow-tooltip >
  56. <template slot-scope="scope">
  57. <span :class="scope.row.b2rs == 0 ? 'color3' : 'color4'">{{scope.row.b2rs == 0 ? "停止" : "运行"}}</span>
  58. </template>
  59. </el-table-column>
  60. <el-table-column label="泵2故障状态" align="left" prop="" show-overflow-tooltip >
  61. <template slot-scope="scope">
  62. <span :class="scope.row.b2al == 0 ? 'color4' : 'color3'">{{scope.row.b2al == 0 ? "正常" : "故障"}}</span>
  63. </template>
  64. </el-table-column>
  65. <el-table-column label="液位开关" align="left" prop="" show-overflow-tooltip >
  66. <template slot-scope="scope">
  67. <span :class="scope.row.yw == 0 ? 'color4' : 'color3'">{{scope.row.yw == 0 ? "低液位" : "高液位"}}</span>
  68. </template>
  69. </el-table-column>
  70. </el-table>
  71. <pagination
  72. v-show="total>0"
  73. :total="total"
  74. :page.sync="queryParams.current"
  75. :limit.sync="queryParams.size"
  76. @pagination="getList"
  77. />
  78. <!-- 导出-->
  79. <a href="" download="" id="xz" style="position: absolute;z-index: -1;opacity: 0;"></a>
  80. </div>
  81. </template>
  82. <script>
  83. import { getWell, exportWell } from "@/api/business/ba/well";
  84. import { BASEPATH } from "@/assets/js/common.js";
  85. export default {
  86. name: "Device",
  87. data() {
  88. return {
  89. fileList:[],
  90. loading:true,
  91. exportLoading:false,
  92. // 显示搜索条件
  93. showSearch: true,
  94. // 总条数
  95. total: 0,
  96. // 表格数据
  97. adminList: [],
  98. // 弹出层标题
  99. title: "",
  100. // 是否显示弹出层
  101. open: false,
  102. // 查询参数
  103. queryParams: {
  104. current: 1,
  105. size: 10,
  106. name: undefined,
  107. dwtype:undefined,
  108. },
  109. dateRange:[],
  110. };
  111. },
  112. created() {
  113. this.getList();//初始化table
  114. },
  115. methods: {
  116. // 取消按钮
  117. cancel() {
  118. this.open = false;
  119. this.reset();
  120. },
  121. /** 重置按钮操作 */
  122. resetQuery() {
  123. this.dateRange = [];
  124. this.queryParams = {
  125. name: undefined,
  126. channelTypeName:undefined,
  127. current:1,
  128. size:10
  129. }
  130. this.resetForm("queryForm");
  131. this.handleQuery();
  132. },
  133. /** 搜索按钮操作 */
  134. handleQuery() {
  135. this.queryParams.current = 1;
  136. this.getList();
  137. },
  138. /** 查询参数列表 */
  139. getList() {
  140. let data = this.addDateRange(this.queryParams,this.dateRange)
  141. data.endTime = data.params.endTime
  142. data.startTime = data.params.beginTime
  143. delete data.params
  144. getWell(this.queryParams).then(response => {
  145. this.adminList = response.data.records;
  146. this.total = response.data.total;
  147. this.loading = false;
  148. });
  149. },
  150. /** 导出按钮操作 */
  151. handleExport() {
  152. let queryParams = {...this.queryParams};
  153. delete queryParams.current
  154. delete queryParams.size
  155. queryParams.dwType = queryParams.dwtype
  156. this.exportLoading = true;
  157. exportWell(queryParams).then(response =>{
  158. this.exportLoading = false;
  159. document.getElementById("xz").href = BASEPATH() + response.data
  160. document.getElementById("xz").download = response.data
  161. document.getElementById("xz").click()
  162. })
  163. },
  164. }
  165. };
  166. </script>