dangerarea.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  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="container">
  11. <uni-nav-bar dark :fixed="true" backgroundColor="#3F9EFF" statusBar="false" left-icon="left" left-text="返回"
  12. @clickLeft="toBack">
  13. <view class="nav-title">
  14. <text>{{title}}</text>
  15. </view>
  16. </uni-nav-bar>
  17. <view class="container">
  18. <uni-section title="查询" type="line">
  19. <view class="search-block">
  20. <view class="name">
  21. <uni-easyinput :styles="inputStyles" @input="adNameValInput" prefixIcon="search"
  22. v-model="adNameVal" placeholder="请输入行政区名称">
  23. </uni-easyinput>
  24. </view>
  25. <view class="name">
  26. <uni-easyinput :styles="inputStyles" @input="dangerAreaNameValInput" prefixIcon="search"
  27. v-model="dangerAreaNameVal" 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-list>
  36. <uni-list-item v-for="item in list" :key="item.id">
  37. <template v-slot:body>
  38. <view class="list-item-block">
  39. <view class="line">
  40. <text class="title text-ellipsis">{{item.dangerAreaName}}</text>
  41. </view>
  42. <view class="line" style="margin-top: 5px;">
  43. <uni-icons class="input-uni-icon" type="map-pin-ellipse" size="18" color="orangered" />
  44. <text class="lable">行政区划:</text>
  45. <text class="content" style="color: blue;">{{item.adnm}}</text>
  46. </view>
  47. <view class="item-button-group">
  48. <view class="item-button mid-size" @click="toQr(item)">
  49. <view class="view-flex-inline-center">
  50. <uni-icons class="input-uni-icon" type="scan" size="18" color="coral" />
  51. <text class="button-text">危险区二维码</text>
  52. </view>
  53. </view>
  54. <view class="item-button mid-size" @click="toMap(item)">
  55. <view class="view-flex-inline-center">
  56. <uni-icons class="input-uni-icon" type="location" size="18" color="coral" />
  57. <text class="button-text">地图查看</text>
  58. </view>
  59. </view>
  60. </view>
  61. </view>
  62. </template>
  63. </uni-list-item>
  64. </uni-list>
  65. <uni-group>
  66. <view class="pagination-block">
  67. <uni-pagination show-icon :pageSize="pageSize" :current="pageCurrent" :total="total"
  68. @change="pageChange" />
  69. </view>
  70. </uni-group>
  71. </view>
  72. </view>
  73. </template>
  74. <script>
  75. import http from '@/http/api.js';
  76. import {
  77. devUrl,
  78. prodUrl
  79. } from '@/common/setting';
  80. export default {
  81. components: {
  82. },
  83. onLoad(options) {
  84. this.id = options.id;
  85. this.baseURL = process.env.NODE_ENV === 'development' ? devUrl : prodUrl;
  86. this.getPage();
  87. },
  88. data() {
  89. return {
  90. title: '危险区信息',
  91. pageSize: 10,
  92. pageCurrent: 1,
  93. total: 0,
  94. list: [],
  95. query: {},
  96. adNameVal: '',
  97. dangerAreaNameVal: '',
  98. inputStyles: {
  99. color: '#808080',
  100. borderColor: '#d3d3d3'
  101. },
  102. }
  103. },
  104. computed: {
  105. },
  106. onInit(option) {
  107. console.log("onInit")
  108. },
  109. onLoad(option) {
  110. console.log("onLoad")
  111. this.getPage();
  112. },
  113. onShow() {
  114. console.log("onShow")
  115. },
  116. onReady() {
  117. console.log("onReady")
  118. },
  119. methods: {
  120. toBack() {
  121. uni.navigateBack({
  122. delta: 1
  123. })
  124. },
  125. adNameValInput(e) {
  126. if (e == null || e.length == 0) {
  127. this.adNameVal = '';
  128. }
  129. },
  130. dangerAreaNameValInput(e) {
  131. if (e == null || e.length == 0) {
  132. this.dangerAreaNameVal = '';
  133. }
  134. },
  135. search() {
  136. this.pageCurrent = 1;
  137. this.getPage();
  138. },
  139. toMap(item) {
  140. let url = '/pages/yjxt/dangerarea/dangerareamap?id=' + item.id;
  141. uni.navigateTo({
  142. url: url
  143. })
  144. },
  145. toQr(item) {
  146. let url = '/pages/yjxt/dangerarea/dangerareaqr?id=' + item.dangerAreaPid;
  147. uni.navigateTo({
  148. url: url
  149. })
  150. },
  151. pageChange(e) {
  152. this.pageCurrent = e.current;
  153. this.getPage()
  154. },
  155. getPage(params = {}) {
  156. if (this.adNameVal.length > 0) {
  157. params['adName'] = this.adNameVal;
  158. }
  159. if (this.dangerAreaNameVal.length > 0) {
  160. params['dangerAreaName'] = this.dangerAreaNameVal;
  161. }
  162. const current = this.pageCurrent;
  163. const size = this.pageSize;
  164. let postData = Object.assign(params, this.query);
  165. let that = this;
  166. http.request({
  167. url: '/galaxy-business/map/dangerarea/page',
  168. method: 'GET',
  169. params: {
  170. current,
  171. size,
  172. },
  173. data: postData,
  174. }).then(res => {
  175. if (res.data.records != null) {
  176. that.list = res.data.records;
  177. }
  178. this.total = res.data.total;
  179. }).catch(err => {
  180. console.log(err)
  181. })
  182. },
  183. }
  184. }
  185. </script>
  186. <style>
  187. /* page {
  188. background-color: rgb(240, 242, 244);
  189. } */
  190. .uni-body {
  191. font-size: 0.7rem;
  192. }
  193. </style>