deviceSetup.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. <template>
  2. <el-row class="el-row-container" style="height: 100%" v-loading="loading">
  3. <el-col
  4. :span="4"
  5. style="height:100%;padding-bottom:32px;"
  6. >
  7. <el-card style="margin:16px;height: 100%; overflow-y: auto">
  8. <data-report-left
  9. @setCurrentData="setCurrentData"
  10. :treeData="treeData"
  11. ></data-report-left>
  12. </el-card>
  13. </el-col>
  14. <el-col
  15. :span="20"
  16. style="padding: 16px 16px 16px 0; height: 100%"
  17. >
  18. <el-card style="height: 100%; overflow-y: auto">
  19. <el-col :span="24" class="elrow-main__col-top">
  20. <div>
  21. <el-input
  22. v-model="waterKeyword"
  23. style="width: 250px"
  24. placeholder="请输入机井编号/机井名称"
  25. clearable
  26. />
  27. <el-select
  28. placeholder="在线状态"
  29. style="margin: 0 10px"
  30. v-model="tmnstatusRunstatus"
  31. >
  32. <el-option
  33. v-for="item in tmnstatusList"
  34. :key="item.value"
  35. :label="item.label"
  36. :value="item.value"
  37. >
  38. </el-option>
  39. </el-select>
  40. <el-button
  41. type="primary"
  42. size="small"
  43. @click="handleSearch"
  44. >查询</el-button
  45. >
  46. </div>
  47. </el-col>
  48. <el-col :span="24" class="elrow-main__col-bottom">
  49. <b-table
  50. ref="tableRef"
  51. :args="{ 'highlight-current-row': true }"
  52. :data="loadData"
  53. :columns="columns"
  54. isShowIndex
  55. >
  56. <template #status="scope">
  57. <span style="display:flex;align-items:center;justify-content:center">
  58. <span class="status nowork" v-if="scope.row.tmnstatusRunstatusContent == '空闲中'"></span>
  59. <span class="status work" v-if="scope.row.tmnstatusRunstatusContent == '工作中'"></span>
  60. <span class="status error" v-if="scope.row.tmnstatusRunstatusContent == '故障'"></span>
  61. <span class="status nolive" v-if="scope.row.tmnstatusRunstatusContent == '离线'"></span>
  62. {{ scope.row.tmnstatusRunstatusContent }}
  63. </span>
  64. </template>
  65. <template #operate="scope">
  66. <el-link
  67. size="small"
  68. :underline="false"
  69. type="primary"
  70. style="margin-right: 10px;color:rgb(219, 162, 28)"
  71. @click="irrigationShowHistory(scope.row)"
  72. >参数设置</el-link
  73. >
  74. <!-- <el-link
  75. size="small"
  76. :underline="false"
  77. type="primary"
  78. style="margin-right: 10px"
  79. @click="download(scope.row)"
  80. >修改</el-link> -->
  81. </template>
  82. </b-table>
  83. </el-col>
  84. </el-card>
  85. </el-col>
  86. <set-preferencs
  87. :visible.sync="associationManageShow"
  88. />
  89. </el-row>
  90. </template>
  91. <script>
  92. import { getBaseList } from '@/api/tmn/index.js'
  93. import { getTree } from '@/api/tree.js'
  94. import BTable from '@/components/Table/index.vue';
  95. import DataReportLeft from '@/components/DataReportLeft/index.vue'
  96. import setPreferencs from './components/setPreferenc.vue'
  97. import { assign, omit } from 'lodash-es';
  98. export default {
  99. name: 'deviceSetup',
  100. components: { BTable,DataReportLeft,setPreferencs },
  101. data() {
  102. return {
  103. tmnstatusRunstatus:'I',
  104. treeData: [],
  105. waterKeyword: '',
  106. tmnstatusList: [{
  107. label: '空闲中',
  108. value: 'I'
  109. }, {
  110. label: '工作中',
  111. value: 'W'
  112. }, {
  113. label: '故障',
  114. value: 'E'
  115. }, {
  116. label: '离线',
  117. value: 'O'
  118. }],
  119. loading: false,
  120. associationManageShow: false,
  121. currentClickId: '',
  122. areaId: '',
  123. columns: [
  124. {
  125. label: '水电双计编号',
  126. prop: 'tmnBizcode',
  127. customRender: '',
  128. align: 'center'
  129. },
  130. {
  131. label: '设备名称',
  132. prop: 'tmnName',
  133. customRender: '',
  134. align: 'center'
  135. },
  136. {
  137. label: '水源名称',
  138. prop: 'waterName',
  139. customRender: '',
  140. align: 'center'
  141. },
  142. {
  143. label: '设备状态',
  144. prop: 'tmnstatusRunstatusContent',
  145. customRender: 'status',
  146. align: 'center'
  147. },{
  148. label: '累计用水量',
  149. prop: 'waterNumTotal',
  150. customRender: '',
  151. align: 'center'
  152. },{
  153. label: '累计用电量',
  154. prop: 'elecNumTotal',
  155. customRender: '',
  156. align: 'center'
  157. }
  158. , {
  159. label: '更新时间',
  160. prop: 'tmnstatusUpdateddate',
  161. customRender: '',
  162. align: 'center'
  163. }
  164. ]
  165. };
  166. },
  167. methods: {
  168. async searchHandler(farmerName, areaId) {
  169. const res = await getFarmerList({
  170. farmerName,
  171. areaId
  172. })
  173. this.userList = res.data
  174. },
  175. setCurrentData(areaId) {
  176. this.currentClickId = areaId
  177. this.areaId = areaId
  178. this.$refs.tableRef.refresh(false);
  179. },
  180. irrigationShowHistory(row) {
  181. this.setEdit = row
  182. this.associationManageShow = true
  183. },
  184. async loadData(parameter) {
  185. if (!this.currentClickId) {
  186. const treeList = this.$store.state.tree.treeList
  187. let res = []
  188. if (treeList.code === '000000') {
  189. res = treeList
  190. } else {
  191. res = await getTree()
  192. this.$store.dispatch('tree/setTree', res)
  193. }
  194. this.treeData = res?.data
  195. this.currentClick = res?.data[0]
  196. this.currentClickId = this.currentClick?.cusareaId
  197. this.areaId = this.currentClickId
  198. }
  199. const params = {
  200. areaId: this.areaId,
  201. waterKeyword: this.waterKeyword,
  202. tmnstatusRunstatus: this.tmnstatusRunstatus
  203. }
  204. const payload = omit(assign({}, parameter, params), []);
  205. return this.getTableData(payload);
  206. },
  207. getTableData(payload) {
  208. return getBaseList(payload)
  209. },
  210. handleSearch() {
  211. this.$refs.tableRef.refresh(true);
  212. },
  213. goDetail(row) {
  214. this.$refs.sourceCodeDetail.open(row.tarcecodeapplyBatchno)
  215. },
  216. download(row) {
  217. }
  218. }
  219. };
  220. </script>
  221. <style lang="scss" scoped>
  222. .el-row-container{
  223. height: 100%;
  224. }
  225. .elrow-main__col-top {
  226. display: flex;
  227. align-items: center;
  228. justify-content: space-between;
  229. margin-bottom: 15px;
  230. .top-left {
  231. height: 100%;
  232. display: flex;
  233. align-items: center;
  234. i {
  235. background-color: #40d5ec;
  236. height: 45%;
  237. width: 5px;
  238. margin-right: 5px;
  239. }
  240. }
  241. }
  242. .status{
  243. display: inline-block;
  244. width: 8px;
  245. height: 8px;
  246. border-radius: 50%;
  247. margin-right: 8px;
  248. }
  249. .nowork{
  250. background: #14A478;
  251. }
  252. .work{
  253. background: #1890FF;
  254. }
  255. .error{
  256. background: #F4A72F;
  257. }
  258. .nolive{
  259. background: rgba(0, 0, 0, 0.26);
  260. }
  261. </style>