rturiverdata.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. <!--
  2. * @Title:
  3. * @Description: 河道数据
  4. * @Author: swp
  5. * @Date: 2022-08-24 10:49:21
  6. * @LastEditors:
  7. * @LastEditTime: 2022-08-24 10:49:21
  8. -->
  9. <template>
  10. <view class="wrap">
  11. <view class="container">
  12. <uni-section title="查询" titleFontSize="0.8rem" type="line" style="padding-left: 0px;padding-right: 0px;">
  13. <view class="search-block">
  14. <view class="adcd-adnm">
  15. <uni-data-picker placeholder="请选择地区" popup-title="请选择所在地区" :localdata="regionTree"
  16. v-model="selectedTreeNode" @change="onTreeChange" @nodeclick="onTreeNodeClick"
  17. @popupopened="onTreePopupOpened" @popupclosed="onTreePopupClosed" :clear-icon="false">
  18. </uni-data-picker>
  19. </view>
  20. <view class="rtu-code">
  21. <uni-easyinput :styles="inputStyles" @input="searchRtuCodeValClear" prefixIcon="search"
  22. v-model="searchRtuCodeVal" placeholder="请输入测站编码">
  23. </uni-easyinput>
  24. </view>
  25. <view class="rtu-name">
  26. <uni-easyinput :styles="inputStyles" @input="searchRtuNameValClear" prefixIcon="search"
  27. v-model="searchRtuNameVal" placeholder="请输入测站名称">
  28. </uni-easyinput>
  29. </view>
  30. <view class="submit-btn">
  31. <button type="default" @click="search">查 询</button>
  32. </view>
  33. </view>
  34. </uni-section>
  35. <uni-table ref="table" :loading="loading" border stripe type="" emptyText="暂无更多数据">
  36. <uni-tr>
  37. <uni-th width="120" align="center">上报时间</uni-th>
  38. <uni-th align="center">测站名称</uni-th>
  39. <uni-th width="120" align="center">水位</uni-th>
  40. </uni-tr>
  41. <uni-tr v-for="(item, index) in tableData" :key="index">
  42. <uni-td>
  43. <view style="text-align: center;">{{ item.wlTm }}</view>
  44. </uni-td>
  45. <uni-td>
  46. <view style="text-align: center;">
  47. {{ item.rtuName }}/{{ item.rtuCode }}
  48. </view>
  49. </uni-td>
  50. <uni-td align="center">
  51. <view style="text-align: center;color: coral;">{{ item.wl }}</view>
  52. </uni-td>
  53. </uni-tr>
  54. </uni-table>
  55. <view class="pagination-block">
  56. <uni-pagination :page-size="pageSize" :current="pageCurrent" :total="total" @change="pageChange"
  57. prev-text="前一页" next-text="后一页" />
  58. </view>
  59. </view>
  60. </view>
  61. </template>
  62. <script>
  63. import http from '@/http/api.js';
  64. export default {
  65. components: {},
  66. onLoad(option) {
  67. this.selectedIndexs = [];
  68. },
  69. created() {
  70. this.getRegionTree();
  71. },
  72. data() {
  73. return {
  74. title: '水情实时数据',
  75. regionTree: [],
  76. regionCode: '',
  77. selectedTreeNode: '',
  78. searchRtuNameVal: '',
  79. searchRtuCodeVal: '',
  80. query: {},
  81. inputStyles: {
  82. color: '#808080',
  83. borderColor: '#d3d3d3'
  84. },
  85. // 每页数据量
  86. pageSize: 10,
  87. // 当前页
  88. pageCurrent: 1,
  89. // 数据总量
  90. total: 0,
  91. loading: false,
  92. selectedIndexs: [],
  93. tableData: [],
  94. }
  95. },
  96. computed: {},
  97. onShow() {},
  98. methods: {
  99. toBack() {
  100. uni.navigateBack({
  101. delta: 1
  102. })
  103. },
  104. onBackPress() {
  105. // #ifdef APP-PLUS
  106. plus.key.hideSoftKeybord();
  107. // #endif
  108. },
  109. // 分页触发
  110. pageChange(e) {
  111. this.$refs.table.clearSelection()
  112. //this.selectedIndexs.length = 0
  113. this.pageCurrent = e.current;
  114. this.getPage()
  115. },
  116. onTreeNodeClick(node) {
  117. console.log(JSON.stringify(node))
  118. },
  119. onTreePopupOpened(e) {
  120. console.log(JSON.stringify(e))
  121. },
  122. onTreePopupClosed(e) {
  123. console.log(JSON.stringify(e))
  124. },
  125. onTreeChange(e) {
  126. console.log(JSON.stringify(e))
  127. let nodes = e.detail.value;
  128. if (nodes.length > 0) {
  129. let node = nodes[nodes.length - 1];
  130. this.regionCode = node.value;
  131. this.query = {};
  132. this.query['adCode'] = this.regionCode;
  133. this.searchRtuNameVal = '';
  134. this.searchRtuCodeVal = '';
  135. this.pageCurrent = 1;
  136. this.getPage();
  137. } else {
  138. this.regionCode = '';
  139. this.query = {};
  140. this.searchRtuNameVal = '';
  141. this.searchRtuCodeVal = '';
  142. this.pageCurrent = 1;
  143. this.getPage();
  144. }
  145. },
  146. //录入查询
  147. search() {
  148. this.pageCurrent = 1;
  149. // console.log(JSON.stringify(res))
  150. let params = {};
  151. if (this.searchRtuCodeVal.length > 0) {
  152. params['rtuCode'] = this.searchRtuCodeVal;
  153. }
  154. if (this.searchRtuNameVal.length > 0) {
  155. params['rtuName'] = this.searchRtuNameVal;
  156. }
  157. this.getPage(params);
  158. },
  159. searchRtuNameValClear(e) {
  160. if (e == null || e.length == 0) {
  161. this.searchRtuNameVal = '';
  162. if (this.searchRtuNameVal.length == 0) {
  163. let params = {};
  164. if (this.searchRtuCodeVal.length > 0) {
  165. params['rtuCode'] = this.searchRtuCodeVal;
  166. }
  167. this.getPage(params);
  168. }
  169. }
  170. },
  171. searchRtuCodeValClear(e) {
  172. if (e == null || e.length == 0) {
  173. this.searchRtuCodeVal = '';
  174. if (this.searchRtuCodeVal.length == 0) {
  175. let params = {};
  176. if (this.searchRtuNameVal.length > 0) {
  177. params['rtuName'] = this.searchRtuNameVal;
  178. }
  179. this.getPage(params);
  180. }
  181. }
  182. },
  183. // 多选处理
  184. selectedItems() {
  185. return this.selectedIndexs.map(i => this.tableData[i])
  186. },
  187. // 多选
  188. selectionChange(e) {
  189. console.log(e.detail.index)
  190. this.selectedIndexs = e.detail.index
  191. },
  192. //批量删除
  193. delTable() {
  194. //console.log(this.selectedItems())
  195. },
  196. getRegionTree() {
  197. var that = this;
  198. http.request({
  199. url: '/galaxy-business/baseinfo/region/tree',
  200. method: 'GET',
  201. }).then(res => {
  202. if (res.data != null) {
  203. that.regionTree = res.data;
  204. that.selectedTreeNode = that.regionTree[0].value;
  205. that.regionCode = that.regionTree[0].value;
  206. that.query = {};
  207. that.query['adCode'] = that.regionCode;
  208. //that.orgId = that.projectTree[0].orgId;
  209. //that.projectId = that.projectTree[0].projectId;
  210. that.getPage();
  211. //that.getCountInfo(that.regionCode);
  212. }
  213. }).catch(err => {
  214. console.log(err)
  215. })
  216. },
  217. // 获取数据
  218. getPage(params = {}) {
  219. this.loading = true
  220. const current = this.pageCurrent;
  221. const size = this.pageSize;
  222. const isSubmit = '0';
  223. let postData = Object.assign(params, this.query);
  224. var that = this;
  225. http.request({
  226. url: '/galaxy-business/rtu/data/river/page',
  227. method: 'GET',
  228. params: {
  229. current,
  230. size,
  231. isSubmit
  232. },
  233. data: postData,
  234. }).then(res => {
  235. if (res.data.records != null) {
  236. that.tableData = res.data.records;
  237. that.total = res.data.total;
  238. }
  239. this.loading = false
  240. }).catch(err => {
  241. console.log(err)
  242. this.loading = false
  243. })
  244. },
  245. }
  246. }
  247. </script>
  248. <style>
  249. /* page {
  250. background-color: rgb(240, 242, 244);
  251. } */
  252. </style>
  253. <style lang="scss" scoped>
  254. .wrap {
  255. padding: 0 0 100rpx;
  256. }
  257. .container {
  258. background-color: #f7f7f7;
  259. min-height: 100vh;
  260. overflow: hidden;
  261. }
  262. </style>