rtugrounddatadetail.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. <template>
  2. <view class="container">
  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>
  10. <uSection title="">
  11. <uni-table ref="table" :loading="loading" border stripe type="" emptyText="暂无更多数据">
  12. <uni-tr>
  13. <uni-th width="240" align="center">含水量</uni-th>
  14. <uni-th align="center">数值</uni-th>
  15. </uni-tr>
  16. <uni-tr v-for="(item,index) in tableData" :key="index">
  17. <uni-td>
  18. <view style="text-align: center;">{{ item.name }}</view>
  19. </uni-td>
  20. <uni-td align="center">
  21. <view style="text-align: center;color: coral;">{{ item.value }}</view>
  22. </uni-td>
  23. </uni-tr>
  24. </uni-table>
  25. </uSection>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. import uSearchBar from '@/uni_modules/uni-search-bar/components/uni-search-bar/uni-search-bar.vue'
  31. import uNavBar from '@/uni_modules/uni-nav-bar/components/uni-nav-bar/uni-nav-bar.vue'
  32. import uDataPicker from '@/uni_modules/uni-data-picker/components/uni-data-picker/uni-data-picker.vue'
  33. import uGroup from '@/uni_modules/uni-group/uni-group.vue'
  34. import uSection from '@/uni_modules/uni-section/uni-section.vue'
  35. import uniTable from '@/uni_modules/uni-table/components/uni-table/uni-table.vue'
  36. import uPagination from '@/uni_modules/uni-pagination/components/uni-pagination/uni-pagination.vue'
  37. import uBreadcrumb from '@/uni_modules/uni-breadcrumb/components/uni-breadcrumb/uni-breadcrumb.vue'
  38. import http from '@/http/api.js';
  39. export default {
  40. components: {
  41. uSearchBar,
  42. uDataPicker,
  43. uGroup,
  44. uSection,
  45. uniTable,
  46. uPagination,
  47. uBreadcrumb,
  48. uNavBar,
  49. },
  50. onLoad(option) {
  51. this.selectedIndexs = [];
  52. this.id = option.id;
  53. this.getData();
  54. },
  55. data() {
  56. return {
  57. id: '',
  58. title: '墒情详情',
  59. desc: '',
  60. tableData: [],
  61. // 每页数据量
  62. pageSize: 10,
  63. // 当前页
  64. pageCurrent: 1,
  65. // 数据总量
  66. total: 0,
  67. loading: false,
  68. selectedIndexs: [],
  69. }
  70. },
  71. computed: {
  72. getIcon() {
  73. return path => {
  74. return 'https://cdn.uviewui.com/uview/example/' + path + '.png';
  75. }
  76. },
  77. },
  78. onShow() {},
  79. methods: {
  80. toBack() {
  81. uni.navigateBack({
  82. delta: 1
  83. })
  84. },
  85. // 获取数据
  86. getData() {
  87. this.loading = true
  88. var formData = {};
  89. formData['id'] = this.id;
  90. var that = this;
  91. http.request({
  92. url: '/galaxy-test/rtu/data/ground/detail',
  93. method: 'GET',
  94. data: formData,
  95. }).then(res => {
  96. if (res.data != null) {
  97. var values = [];
  98. var v1 = {
  99. 'name': '垂线平均含水量',
  100. 'value': res.data.vtavslm
  101. };
  102. values.push(v1);
  103. var v2 = {
  104. 'name': '表层含水量',
  105. 'value': res.data.srlslm
  106. };
  107. values.push(v2);
  108. var slm10 = {
  109. 'name': '10CM深度含水量',
  110. 'value': res.data.slm10
  111. };
  112. values.push(slm10);
  113. var slm20 = {
  114. 'name': '20CM深度含水量',
  115. 'value': res.data.slm20
  116. };
  117. values.push(slm20);
  118. var slm30 = {
  119. 'name': '30CM深度含水量',
  120. 'value': res.data.slm30
  121. };
  122. values.push(slm30);
  123. var slm40 = {
  124. 'name': '40CM深度含水量',
  125. 'value': res.data.slm40
  126. };
  127. values.push(slm40);
  128. var slm60 = {
  129. 'name': '60CM深度含水量',
  130. 'value': res.data.slm60
  131. };
  132. values.push(slm60);
  133. var slm80 = {
  134. 'name': '80CM深度含水量',
  135. 'value': res.data.slm80
  136. };
  137. values.push(slm80);
  138. var slm100 = {
  139. 'name': '100CM深度含水量',
  140. 'value': res.data.slm100
  141. };
  142. values.push(slm100);
  143. that.tableData = values;
  144. that.total = values.length;
  145. console.log('data', values);
  146. }
  147. this.loading = false
  148. }).catch(err => {
  149. console.log(err)
  150. this.loading = false
  151. })
  152. },
  153. }
  154. }
  155. </script>
  156. <style>
  157. /* page {
  158. background-color: rgb(240, 242, 244);
  159. } */
  160. </style>
  161. <style lang="scss" scoped>
  162. .container {
  163. background-color: #f7f7f7;
  164. min-height: 100vh;
  165. overflow: hidden;
  166. }
  167. .goods-carts {
  168. /* #ifndef APP-NVUE */
  169. display: flex;
  170. /* #endif */
  171. flex-direction: column;
  172. position: absolute;
  173. left: 0;
  174. right: 0;
  175. /* #ifdef H5 */
  176. left: var(--window-left);
  177. right: var(--window-right);
  178. /* #endif */
  179. top: 0;
  180. }
  181. .button {
  182. display: flex;
  183. align-items: center;
  184. height: 35px;
  185. margin-left: 10px;
  186. }
  187. .u-cell-icon {
  188. width: 36rpx;
  189. height: 36rpx;
  190. margin-right: 8rpx;
  191. }
  192. .slot-box {
  193. /* #ifndef APP-NVUE */
  194. display: flex;
  195. /* #endif */
  196. flex-direction: row;
  197. align-items: center;
  198. }
  199. .slot-image {
  200. /* #ifndef APP-NVUE */
  201. display: block;
  202. /* #endif */
  203. margin-right: 10px;
  204. width: 30px;
  205. height: 30px;
  206. }
  207. .slot-text {
  208. flex: 1;
  209. font-size: 14px;
  210. color: #4cd964;
  211. margin-right: 10px;
  212. }
  213. .content-box {
  214. flex: 1;
  215. /* #ifdef APP-NVUE */
  216. justify-content: center;
  217. /* #endif */
  218. height: 100%;
  219. line-height: 44px;
  220. padding: 0 15px;
  221. position: relative;
  222. background-color: #fff;
  223. border-bottom-color: #f5f5f5;
  224. border-bottom-width: 1px;
  225. border-bottom-style: solid;
  226. }
  227. .content-text {
  228. font-size: 15px;
  229. }
  230. .example-body {
  231. /* #ifndef APP-NVUE */
  232. display: flex;
  233. /* #endif */
  234. flex-direction: row;
  235. justify-content: center;
  236. padding: 10px 0;
  237. background-color: #fff;
  238. }
  239. .button {
  240. border-color: #e5e5e5;
  241. border-style: solid;
  242. border-width: 1px;
  243. padding: 4px 8px;
  244. border-radius: 4px;
  245. }
  246. .button-text {
  247. font-size: 15px;
  248. }
  249. .slot-button {
  250. /* #ifndef APP-NVUE */
  251. display: flex;
  252. height: 100%;
  253. /* #endif */
  254. flex: 1;
  255. flex-direction: row;
  256. justify-content: center;
  257. align-items: center;
  258. padding: 0 20px;
  259. background-color: #ff5a5f;
  260. }
  261. .slot-button-text {
  262. color: #ffffff;
  263. font-size: 14px;
  264. }
  265. .search-result {
  266. padding-top: 10px;
  267. padding-bottom: 20px;
  268. text-align: center;
  269. }
  270. .search-result-text {
  271. text-align: center;
  272. font-size: 14px;
  273. color: #666;
  274. }
  275. .example-body {
  276. /* #ifndef APP-NVUE */
  277. display: block;
  278. /* #endif */
  279. padding: 0px;
  280. }
  281. .uni-mt-10 {
  282. margin-top: 10px;
  283. }
  284. .uni-group {
  285. display: flex;
  286. align-items: center;
  287. }
  288. .data-pickerview {
  289. height: 400px;
  290. border: 1px #e5e5e5 solid;
  291. }
  292. .popper__arrow {
  293. top: -6px;
  294. left: 50%;
  295. margin-right: 3px;
  296. border-top-width: 0;
  297. border-bottom-color: #EBEEF5;
  298. }
  299. .popper__arrow {
  300. top: -6px;
  301. left: 50%;
  302. margin-right: 3px;
  303. border-top-width: 0;
  304. border-bottom-color: #EBEEF5;
  305. }
  306. </style>