rtugrounddata.vue 8.8 KB

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