rtursvrdata.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  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>
  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.rz }}</view>
  42. </uni-td>
  43. </uni-tr>
  44. </uni-table>
  45. <view style="margin-top: 5px;background-color: azure;">
  46. <uniPagination 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 uniGroup 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. uNavBar,
  68. uniGroup,
  69. uniSection,
  70. uniTable,
  71. uniPagination,
  72. uniBreadcrumb,
  73. },
  74. onLoad(option) {
  75. this.getProjectTree();
  76. },
  77. data() {
  78. return {
  79. selectedTreeNode: '',
  80. orgId: '',
  81. projectId: '',
  82. title: '水库水情实时数据',
  83. desc: '',
  84. searchValue: '',
  85. tableData: [],
  86. // 每页数据量
  87. pageSize: 10,
  88. // 当前页
  89. pageCurrent: 1,
  90. // 数据总量
  91. total: 0,
  92. loading: false,
  93. selectedIndexs: [],
  94. projectTree: [],
  95. }
  96. },
  97. computed: {
  98. getIcon() {
  99. return path => {
  100. return 'https://cdn.uviewui.com/uview/example/' + path + '.png';
  101. }
  102. },
  103. },
  104. onShow() {
  105. },
  106. methods: {
  107. toBack() {
  108. uni.navigateBack({
  109. delta: 1
  110. })
  111. },
  112. getProjectTree() {
  113. var that = this;
  114. http.request({
  115. url: '/galaxy-test/rtu/manage/tree',
  116. method: 'GET',
  117. }).then(res => {
  118. if (res.data != null) {
  119. that.projectTree = res.data;
  120. that.selectedTreeNode = that.projectTree[0].value;
  121. that.orgId = that.projectTree[0].orgId;
  122. that.projectId = that.projectTree[0].projectId;
  123. that.getData();
  124. }
  125. }).catch(err => {
  126. console.log(err)
  127. })
  128. },
  129. onnodeclick(e) {
  130. this.orgId = node.orgId;
  131. this.projectId = node.projectId;
  132. this.searchValue = '';
  133. this.pageCurrent = 1;
  134. this.getData();
  135. },
  136. onpopupopened(e) {
  137. },
  138. onpopupclosed(e) {
  139. },
  140. onchange(e) {
  141. console.log('onchange:', this.selectedTreeNode);
  142. },
  143. // 多选处理
  144. selectedItems() {
  145. return this.selectedIndexs.map(i => this.tableData[i])
  146. },
  147. // 多选
  148. selectionChange(e) {
  149. console.log(e.detail.index)
  150. this.selectedIndexs = e.detail.index
  151. },
  152. //批量删除
  153. delTable() {
  154. console.log(this.selectedItems())
  155. },
  156. // 分页触发
  157. change(e) {
  158. this.$refs.table.clearSelection()
  159. this.selectedIndexs.length = 0
  160. this.pageCurrent = e.current;
  161. this.getData(e.current)
  162. },
  163. // 获取数据
  164. getData() {
  165. this.loading = true
  166. const current = this.pageCurrent;
  167. const size = this.pageSize;
  168. const isSubmit = '0';
  169. var formData = {};
  170. formData['rtuName'] = this.searchValue;
  171. formData['projectId'] = this.projectId;
  172. formData['orgId'] = this.orgId;
  173. var that = this;
  174. http.request({
  175. url: '/galaxy-test/rtu/data/rsvr/page',
  176. method: 'GET',
  177. params: {
  178. current,
  179. size,
  180. isSubmit
  181. },
  182. data: formData,
  183. }).then(res => {
  184. if (res.data.records != null) {
  185. that.tableData = res.data.records;
  186. that.total = res.data.total;
  187. }
  188. this.loading = false
  189. }).catch(err => {
  190. console.log(err)
  191. this.loading = false
  192. })
  193. },
  194. search(res) {
  195. this.getData();
  196. },
  197. input(res) {
  198. // console.log('----input:', res)
  199. },
  200. clear(res) {
  201. this.getData();
  202. },
  203. blur(res) {
  204. },
  205. focus(e) {
  206. },
  207. cancel(res) {
  208. this.getData();
  209. },
  210. onBackPress() {
  211. // #ifdef APP-PLUS
  212. plus.key.hideSoftKeybord();
  213. // #endif
  214. },
  215. }
  216. }
  217. </script>
  218. <style>
  219. /* page {
  220. background-color: rgb(240, 242, 244);
  221. } */
  222. </style>
  223. <style lang="scss" scoped>
  224. .wrap {
  225. padding: 0 0 100rpx;
  226. }
  227. .container {
  228. background-color: #f7f7f7;
  229. min-height: 100vh;
  230. overflow: hidden;
  231. }
  232. .goods-carts {
  233. /* #ifndef APP-NVUE */
  234. display: flex;
  235. /* #endif */
  236. flex-direction: column;
  237. position: absolute;
  238. left: 0;
  239. right: 0;
  240. /* #ifdef H5 */
  241. left: var(--window-left);
  242. right: var(--window-right);
  243. /* #endif */
  244. top: 0;
  245. }
  246. .button {
  247. display: flex;
  248. align-items: center;
  249. height: 35px;
  250. margin-left: 10px;
  251. }
  252. .u-cell-icon {
  253. width: 36rpx;
  254. height: 36rpx;
  255. margin-right: 8rpx;
  256. }
  257. .slot-box {
  258. /* #ifndef APP-NVUE */
  259. display: flex;
  260. /* #endif */
  261. flex-direction: row;
  262. align-items: center;
  263. }
  264. .slot-image {
  265. /* #ifndef APP-NVUE */
  266. display: block;
  267. /* #endif */
  268. margin-right: 10px;
  269. width: 30px;
  270. height: 30px;
  271. }
  272. .slot-text {
  273. flex: 1;
  274. font-size: 14px;
  275. color: #4cd964;
  276. margin-right: 10px;
  277. }
  278. .content-box {
  279. flex: 1;
  280. /* #ifdef APP-NVUE */
  281. justify-content: center;
  282. /* #endif */
  283. height: 100%;
  284. line-height: 44px;
  285. padding: 0 15px;
  286. position: relative;
  287. background-color: #fff;
  288. border-bottom-color: #f5f5f5;
  289. border-bottom-width: 1px;
  290. border-bottom-style: solid;
  291. }
  292. .content-text {
  293. font-size: 15px;
  294. }
  295. .example-body {
  296. /* #ifndef APP-NVUE */
  297. display: flex;
  298. /* #endif */
  299. flex-direction: row;
  300. justify-content: center;
  301. padding: 10px 0;
  302. background-color: #fff;
  303. }
  304. .button {
  305. border-color: #e5e5e5;
  306. border-style: solid;
  307. border-width: 1px;
  308. padding: 4px 8px;
  309. border-radius: 4px;
  310. }
  311. .button-text {
  312. font-size: 15px;
  313. }
  314. .slot-button {
  315. /* #ifndef APP-NVUE */
  316. display: flex;
  317. height: 100%;
  318. /* #endif */
  319. flex: 1;
  320. flex-direction: row;
  321. justify-content: center;
  322. align-items: center;
  323. padding: 0 20px;
  324. background-color: #ff5a5f;
  325. }
  326. .slot-button-text {
  327. color: #ffffff;
  328. font-size: 14px;
  329. }
  330. .search-result {
  331. padding-top: 10px;
  332. padding-bottom: 20px;
  333. text-align: center;
  334. }
  335. .search-result-text {
  336. text-align: center;
  337. font-size: 14px;
  338. color: #666;
  339. }
  340. .example-body {
  341. /* #ifndef APP-NVUE */
  342. display: block;
  343. /* #endif */
  344. padding: 0px;
  345. }
  346. .uni-mt-10 {
  347. margin-top: 10px;
  348. }
  349. .uni-group {
  350. display: flex;
  351. align-items: center;
  352. }
  353. .data-pickerview {
  354. height: 400px;
  355. border: 1px #e5e5e5 solid;
  356. }
  357. .popper__arrow {
  358. top: -6px;
  359. left: 50%;
  360. margin-right: 3px;
  361. border-top-width: 0;
  362. border-bottom-color: #EBEEF5;
  363. }
  364. .popper__arrow {
  365. top: -6px;
  366. left: 50%;
  367. margin-right: 3px;
  368. border-top-width: 0;
  369. border-bottom-color: #EBEEF5;
  370. }
  371. </style>