rturaindata.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404
  1. <template>
  2. <view class="wrap">
  3. <uNavBar dark :fixed="true" backgroundColor="#3F9EFF" status-bar left-icon="left" left-text="返回"
  4. @clickLeft="toBack">
  5. <view style="width: 100%;display: flex;flex-direction: row;justify-content: center;align-items: center;">
  6. <text style="color: white;font-size: 1rem;">{{title}}</text>
  7. </view>
  8. </uNavBar>
  9. <view class="container">
  10. <uni-section title="查询" titleFontSize="0.8rem" type="line" style="padding-left: 10px;padding-right: 10px;">
  11. <uni-data-picker placeholder="请选择机构" popup-title="请选择所在地区" :localdata="projectTree"
  12. v-model="selectedTreeNode" @change="onchange" @nodeclick="onnodeclick" @popupopened="onpopupopened"
  13. @popupclosed="onpopupclosed">
  14. </uni-data-picker>
  15. </uni-section>
  16. <uni-section title="">
  17. <uni-search-bar placeholder="请录入测站编码或测站名称" @confirm="search" :focus="false" v-model="searchValue"
  18. @blur="blur" @focus="focus" @input="input" @cancel="cancel" @clear="clear">
  19. </uni-search-bar>
  20. </uni-section>
  21. <uni-section title="">
  22. <uni-table ref="table" :loading="loading" border stripe type="" emptyText="暂无更多数据">
  23. <uni-tr>
  24. <uni-th width="120" align="center">上报时间</uni-th>
  25. <uni-th align="center">测站名称</uni-th>
  26. <uni-th width="120" align="center">降水量</uni-th>
  27. </uni-tr>
  28. <uni-tr v-for="(item, index) in tableData" :key="index">
  29. <uni-td>
  30. <view style="text-align: center;">{{ item.tm }}</view>
  31. </uni-td>
  32. <uni-td>
  33. <view v-if="item.rtuName" style="text-align: center;">
  34. {{ item.rtuName }}
  35. </view>
  36. <view v-else style="text-align: center;">
  37. {{ item.rtuCode }}
  38. </view>
  39. </uni-td>
  40. <uni-td align="center">
  41. <view style="text-align: center;color: coral;">{{ item.drp }}</view>
  42. </uni-td>
  43. </uni-tr>
  44. </uni-table>
  45. <view style="margin-top: 5px;background-color: azure;">
  46. <uni-pagination show-icon :page-size="pageSize" :current="pageCurrent" :total="total"
  47. @change="change" />
  48. </view>
  49. </uni-section>
  50. </view>
  51. </view>
  52. </template>
  53. <script>
  54. import uniSearchBar from '@/uni_modules/uni-search-bar/components/uni-search-bar/uni-search-bar.vue'
  55. import uNavBar from '@/uni_modules/uni-nav-bar/components/uni-nav-bar/uni-nav-bar.vue'
  56. import uniDataPicker from '@/uni_modules/uni-data-picker/components/uni-data-picker/uni-data-picker.vue'
  57. import uGroup from '@/uni_modules/uni-group/uni-group.vue'
  58. import uniSection from '@/uni_modules/uni-section/uni-section.vue'
  59. import uniTable from '@/uni_modules/uni-table/components/uni-table/uni-table.vue'
  60. import uniPagination from '@/uni_modules/uni-pagination/components/uni-pagination/uni-pagination.vue'
  61. import uniBreadcrumb from '@/uni_modules/uni-breadcrumb/components/uni-breadcrumb/uni-breadcrumb.vue'
  62. import http from '@/http/api.js';
  63. import tableData from './data.js'
  64. export default {
  65. components: {
  66. uniSearchBar,
  67. uGroup,
  68. uniSection,
  69. uniTable,
  70. uniPagination,
  71. uniBreadcrumb,
  72. uNavBar,
  73. },
  74. onLoad(option) {
  75. this.selectedIndexs = [];
  76. this.getProjectTree();
  77. },
  78. data() {
  79. return {
  80. selectedTreeNode: '',
  81. title: '雨水情实时数据',
  82. desc: '',
  83. orgId: '',
  84. projectId: '',
  85. searchValue: '',
  86. tableData: [],
  87. // 每页数据量
  88. pageSize: 10,
  89. // 当前页
  90. pageCurrent: 1,
  91. // 数据总量
  92. total: 0,
  93. loading: false,
  94. selectedIndexs: [],
  95. projectTree: [],
  96. }
  97. },
  98. computed: {
  99. getIcon() {
  100. return path => {
  101. return 'https://cdn.uviewui.com/uview/example/' + path + '.png';
  102. }
  103. },
  104. },
  105. onShow() {
  106. },
  107. methods: {
  108. toBack() {
  109. uni.navigateBack({
  110. delta: 1
  111. })
  112. },
  113. getProjectTree() {
  114. var that = this;
  115. http.request({
  116. url: '/galaxy-test/rtu/manage/tree',
  117. method: 'GET',
  118. }).then(res => {
  119. if (res.data != null) {
  120. that.projectTree = res.data;
  121. that.selectedTreeNode = that.projectTree[0].value;
  122. that.orgId = that.projectTree[0].orgId;
  123. that.projectId = that.projectTree[0].projectId;
  124. that.getData();
  125. }
  126. }).catch(err => {
  127. console.log(err)
  128. })
  129. },
  130. onnodeclick(e) {
  131. this.orgId = node.orgId;
  132. this.projectId = node.projectId;
  133. this.searchValue = '';
  134. this.pageCurrent = 1;
  135. this.getData();
  136. },
  137. onpopupopened(e) {
  138. //console.log('popupopened');
  139. },
  140. onpopupclosed(e) {
  141. // console.log('popupclosed');
  142. },
  143. onchange(e) {
  144. console.log('onchange:', this.selectedTreeNode);
  145. },
  146. // 多选处理
  147. selectedItems() {
  148. return this.selectedIndexs.map(i => this.tableData[i])
  149. },
  150. // 多选
  151. selectionChange(e) {
  152. console.log(e.detail.index)
  153. this.selectedIndexs = e.detail.index
  154. },
  155. //批量删除
  156. delTable() {
  157. //console.log(this.selectedItems())
  158. },
  159. // 分页触发
  160. change(e) {
  161. this.$refs.table.clearSelection()
  162. this.selectedIndexs.length = 0
  163. this.pageCurrent = e.current;
  164. this.getData()
  165. },
  166. // 获取数据
  167. getData() {
  168. this.loading = true
  169. const current = this.pageCurrent;
  170. const size = this.pageSize;
  171. const isSubmit = '0';
  172. var formData = {};
  173. formData['rtuName'] = this.searchValue;
  174. formData['projectId'] = this.projectId;
  175. formData['orgId'] = this.orgId;
  176. var that = this;
  177. http.request({
  178. url: '/galaxy-test/rtu/data/rain/page',
  179. method: 'GET',
  180. params: {
  181. current,
  182. size,
  183. isSubmit
  184. },
  185. data: formData,
  186. }).then(res => {
  187. if (res.data.records != null) {
  188. that.tableData = res.data.records;
  189. that.total = res.data.total;
  190. }
  191. this.loading = false
  192. }).catch(err => {
  193. console.log(err)
  194. this.loading = false
  195. })
  196. },
  197. search(res) {
  198. this.getData();
  199. },
  200. input(res) {
  201. //console.log('----input:', res)
  202. },
  203. clear(res) {
  204. this.searchValue = '';
  205. this.getData();
  206. },
  207. blur(res) {
  208. },
  209. focus(e) {
  210. },
  211. cancel(res) {
  212. this.searchValue = '';
  213. this.getData();
  214. },
  215. onBackPress() {
  216. // #ifdef APP-PLUS
  217. plus.key.hideSoftKeybord();
  218. // #endif
  219. },
  220. }
  221. }
  222. </script>
  223. <style>
  224. /* page {
  225. background-color: rgb(240, 242, 244);
  226. } */
  227. </style>
  228. <style lang="scss" scoped>
  229. .wrap {
  230. padding: 0 0 100rpx;
  231. }
  232. .container {
  233. background-color: #f7f7f7;
  234. min-height: 100vh;
  235. overflow: hidden;
  236. }
  237. .goods-carts {
  238. /* #ifndef APP-NVUE */
  239. display: flex;
  240. /* #endif */
  241. flex-direction: column;
  242. position: absolute;
  243. left: 0;
  244. right: 0;
  245. /* #ifdef H5 */
  246. left: var(--window-left);
  247. right: var(--window-right);
  248. /* #endif */
  249. top: 0;
  250. }
  251. .button {
  252. display: flex;
  253. align-items: center;
  254. height: 35px;
  255. margin-left: 10px;
  256. }
  257. .u-cell-icon {
  258. width: 36rpx;
  259. height: 36rpx;
  260. margin-right: 8rpx;
  261. }
  262. .slot-box {
  263. /* #ifndef APP-NVUE */
  264. display: flex;
  265. /* #endif */
  266. flex-direction: row;
  267. align-items: center;
  268. }
  269. .slot-image {
  270. /* #ifndef APP-NVUE */
  271. display: block;
  272. /* #endif */
  273. margin-right: 10px;
  274. width: 30px;
  275. height: 30px;
  276. }
  277. .slot-text {
  278. flex: 1;
  279. font-size: 14px;
  280. color: #4cd964;
  281. margin-right: 10px;
  282. }
  283. .content-box {
  284. flex: 1;
  285. /* #ifdef APP-NVUE */
  286. justify-content: center;
  287. /* #endif */
  288. height: 100%;
  289. line-height: 44px;
  290. padding: 0 15px;
  291. position: relative;
  292. background-color: #fff;
  293. border-bottom-color: #f5f5f5;
  294. border-bottom-width: 1px;
  295. border-bottom-style: solid;
  296. }
  297. .content-text {
  298. font-size: 15px;
  299. }
  300. .example-body {
  301. /* #ifndef APP-NVUE */
  302. display: flex;
  303. /* #endif */
  304. flex-direction: row;
  305. justify-content: center;
  306. padding: 10px 0;
  307. background-color: #fff;
  308. }
  309. .button {
  310. border-color: #e5e5e5;
  311. border-style: solid;
  312. border-width: 1px;
  313. padding: 4px 8px;
  314. border-radius: 4px;
  315. }
  316. .button-text {
  317. font-size: 15px;
  318. }
  319. .slot-button {
  320. /* #ifndef APP-NVUE */
  321. display: flex;
  322. height: 100%;
  323. /* #endif */
  324. flex: 1;
  325. flex-direction: row;
  326. justify-content: center;
  327. align-items: center;
  328. padding: 0 20px;
  329. background-color: #ff5a5f;
  330. }
  331. .slot-button-text {
  332. color: #ffffff;
  333. font-size: 14px;
  334. }
  335. .search-result {
  336. padding-top: 10px;
  337. padding-bottom: 20px;
  338. text-align: center;
  339. }
  340. .search-result-text {
  341. text-align: center;
  342. font-size: 14px;
  343. color: #666;
  344. }
  345. .example-body {
  346. /* #ifndef APP-NVUE */
  347. display: block;
  348. /* #endif */
  349. padding: 0px;
  350. }
  351. .uni-mt-10 {
  352. margin-top: 10px;
  353. }
  354. .uni-group {
  355. display: flex;
  356. align-items: center;
  357. }
  358. .data-pickerview {
  359. height: 400px;
  360. border: 1px #e5e5e5 solid;
  361. }
  362. .popper__arrow {
  363. top: -6px;
  364. left: 50%;
  365. margin-right: 3px;
  366. border-top-width: 0;
  367. border-bottom-color: #EBEEF5;
  368. }
  369. .popper__arrow {
  370. top: -6px;
  371. left: 50%;
  372. margin-right: 3px;
  373. border-top-width: 0;
  374. border-bottom-color: #EBEEF5;
  375. }
  376. </style>