deviceSetup.vue 7.8 KB

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