dangerarea.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380
  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-collapse @change="searchAreaStatus">
  19. <uni-collapse-item :show-animation="true" :open="true">
  20. <template v-slot:title>
  21. <view class="view-flex-block-center" style="height: 40px;width: 100%;">
  22. <view class="view-flex-inline-center">
  23. <text v-if="showSearch" style="color: coral;">点击收起查询区</text>
  24. <text v-else style="color: coral;">点击展开查询区</text>
  25. </view>
  26. </view>
  27. </template>
  28. </uni-collapse-item>
  29. </uni-collapse>
  30. <view v-if="showSearch" class="search-block">
  31. <view style="padding-left: 10px;padding-right: 10px;margin-top: 10px;">
  32. <view>
  33. <uni-data-select v-model="cityRegionValue" :localdata="cityRegionData"
  34. @change="cityRegionChange" :clear="false" placeholder="请选择盟市"></uni-data-select>
  35. </view>
  36. <view style="margin-top: 10px;">
  37. <uni-data-select v-model="districtRegionValue" :localdata="districtRegionData"
  38. @change="districtRegionChange" placeholder="请选择区旗县"></uni-data-select>
  39. </view>
  40. <view style="margin-top: 10px;">
  41. <uni-data-select v-model="townRegionValue" :localdata="townRegionData"
  42. @change="townRegionChange" placeholder="请选择乡镇"></uni-data-select>
  43. </view>
  44. <view style="margin-top: 10px;">
  45. <uni-data-select v-model="countryRegionValue" :localdata="countryRegionData"
  46. @change="countryRegionChange" placeholder="请选择村"></uni-data-select>
  47. </view>
  48. </view>
  49. <view class="rtu-code">
  50. <uni-easyinput :styles="inputStyles" @input="dangerAreaNameValInput" prefixIcon="search"
  51. v-model="dangerAreaNameVal" placeholder="请录入危险区名称">
  52. </uni-easyinput>
  53. </view>
  54. <view class="submit-btn">
  55. <button type="default" @click="search">查 询</button>
  56. </view>
  57. </view>
  58. <view v-if="list.length>0">
  59. <uni-list>
  60. <uni-list-item v-for="item in list" :key="item.id">
  61. <template v-slot:body>
  62. <view class="list-item-block">
  63. <view class="line">
  64. <text class="title text-ellipsis">{{item.dangerAreaName}}</text>
  65. </view>
  66. <view class="line" style="margin-top: 5px;">
  67. <!-- <uni-icons class="input-uni-icon" type="map-pin-ellipse" size="18"
  68. color="orangered" /> -->
  69. <text class="lable">行政区划:</text>
  70. </view>
  71. <view class="line" style="margin-top: 5px;">
  72. <text class="content" style="color: gray;">{{item.fullAadName}}</text>
  73. </view>
  74. <view class="item-button-group">
  75. <view class="item-button mid-size" @click="toResidentRegQr(item)">
  76. <view class="view-flex-inline-center">
  77. <uni-icons class="input-uni-icon" type="scan" size="18" color="coral" />
  78. <text class="button-text">群众登记二维码</text>
  79. </view>
  80. </view>
  81. <view class="item-button mid-size" @click="toMap(item)">
  82. <view class="view-flex-inline-center">
  83. <uni-icons class="input-uni-icon" type="location" size="18" color="coral" />
  84. <text class="button-text">地图查看</text>
  85. </view>
  86. </view>
  87. </view>
  88. </view>
  89. </template>
  90. </uni-list-item>
  91. </uni-list>
  92. <uni-group>
  93. <view class="pagination-block">
  94. <uni-pagination show-icon :pageSize="pageSize" :current="pageCurrent" :total="total"
  95. @change="pageChange" />
  96. </view>
  97. </uni-group>
  98. </view>
  99. <view v-else class="view-flex-inline-center">
  100. <view style="margin-top: 10px;color: gray;font-size: 1rem;">暂无数据</view>
  101. </view>
  102. </view>
  103. </view>
  104. </template>
  105. <script>
  106. import http from '@/http/api.js';
  107. import {
  108. devUrl,
  109. prodUrl
  110. } from '@/common/setting';
  111. export default {
  112. components: {},
  113. data() {
  114. return {
  115. title: '危险区信息',
  116. showSearch: true,
  117. cityRegionValue: '',
  118. cityRegionData: [],
  119. districtRegionValue: '',
  120. districtRegionData: [],
  121. townRegionValue: '',
  122. townRegionData: [],
  123. countryRegionValue: '',
  124. countryRegionData: [],
  125. pageSize: 10,
  126. pageCurrent: 1,
  127. total: 0,
  128. list: [],
  129. query: {},
  130. dangerAreaNameVal: '',
  131. inputStyles: {
  132. color: '#808080',
  133. borderColor: '#d3d3d3'
  134. },
  135. }
  136. },
  137. computed: {
  138. },
  139. onInit(option) {},
  140. onLoad(option) {
  141. this.getCityRegion({});
  142. },
  143. onShow() {
  144. this.pageCurrent = 1;
  145. this.getPage();
  146. },
  147. onReady() {},
  148. methods: {
  149. toBack() {
  150. uni.navigateBack({
  151. delta: 1
  152. })
  153. },
  154. searchAreaStatus(e) {
  155. if (e.length > 0) {
  156. this.showSearch = true;
  157. } else {
  158. this.showSearch = false;
  159. }
  160. },
  161. cityRegionChange(e) {
  162. this.cityRegionValue = e;
  163. this.districtRegionData = [];
  164. this.districtRegionValue = '';
  165. this.townRegionData = [];
  166. this.townRegionValue = '';
  167. this.countryRegionData = [];
  168. this.countryRegionValue = '';
  169. let p = {
  170. 'parentCode': this.cityRegionValue
  171. }
  172. this.getDistrictRegion(p);
  173. this.pageCurrent = 1;
  174. this.list = [];
  175. this.query['adcd'] = this.cityRegionValue;
  176. this.getPage({});
  177. },
  178. districtRegionChange(e) {
  179. if (e == undefined || e == null || e == '') {
  180. this.districtRegionValue = '';
  181. this.townRegionData = [];
  182. this.townRegionValue = '';
  183. this.countryRegionData = [];
  184. this.countryRegionValue = '';
  185. this.pageCurrent = 1;
  186. this.list = [];
  187. this.query['adcd'] = this.cityRegionValue;
  188. this.getPage({});
  189. } else {
  190. this.districtRegionValue = e;
  191. this.townRegionData = [];
  192. this.townRegionValue = '';
  193. this.countryRegionData = [];
  194. this.countryRegionValue = '';
  195. let p = {
  196. 'parentCode': this.districtRegionValue
  197. }
  198. this.getTownRegion(p);
  199. this.pageCurrent = 1;
  200. this.list = [];
  201. this.query['adcd'] = this.districtRegionValue;
  202. this.getPage({});
  203. }
  204. },
  205. townRegionChange(e) {
  206. if (e == undefined || e == null || e == '') {
  207. this.townRegionValue = '';
  208. this.countryRegionData = [];
  209. this.countryRegionValue = '';
  210. this.pageCurrent = 1;
  211. this.list = [];
  212. this.query['adcd'] = this.districtRegionValue;
  213. this.getPage({});
  214. } else {
  215. this.townRegionValue = e;
  216. this.countryRegionData = [];
  217. this.countryRegionValue = '';
  218. let p = {
  219. 'parentCode': this.townRegionValue
  220. }
  221. this.getCountryRegion(p);
  222. this.pageCurrent = 1;
  223. this.list = [];
  224. this.query['adcd'] = this.townRegionValue;
  225. this.getPage({});
  226. }
  227. },
  228. countryRegionChange(e) {
  229. if (e == undefined || e == null || e == '') {
  230. this.countryRegionValue = '';
  231. this.pageCurrent = 1;
  232. this.list = [];
  233. this.query['adcd'] = this.townRegionValue;
  234. this.getPage({});
  235. } else {
  236. this.countryRegionValue = e;
  237. this.pageCurrent = 1;
  238. this.list = [];
  239. this.query['adcd'] = this.countryRegionValue;
  240. this.getPage({});
  241. }
  242. },
  243. getCityRegion(params = {}) {
  244. let that = this;
  245. http.request({
  246. url: '/galaxy-business/baseinfo/region/whole/yj/list',
  247. method: 'GET',
  248. data: params,
  249. }).then(res => {
  250. that.cityRegionData = res.data.map(item => {
  251. return {
  252. value: item.adcd,
  253. text: item.adnm,
  254. }
  255. })
  256. }).catch(err => {
  257. console.log(err)
  258. })
  259. },
  260. getDistrictRegion(params = {}) {
  261. let that = this;
  262. http.request({
  263. url: '/galaxy-business/baseinfo/region/whole/yj/list',
  264. method: 'GET',
  265. data: params,
  266. }).then(res => {
  267. that.districtRegionData = res.data.map(item => {
  268. return {
  269. value: item.adcd,
  270. text: item.adnm,
  271. }
  272. })
  273. }).catch(err => {
  274. console.log(err)
  275. })
  276. },
  277. getTownRegion(params = {}) {
  278. let that = this;
  279. http.request({
  280. url: '/galaxy-business/baseinfo/region/whole/yj/list',
  281. method: 'GET',
  282. data: params,
  283. }).then(res => {
  284. that.townRegionData = res.data.map(item => {
  285. return {
  286. value: item.adcd,
  287. text: item.adnm,
  288. }
  289. })
  290. }).catch(err => {
  291. console.log(err)
  292. })
  293. },
  294. getCountryRegion(params = {}) {
  295. let that = this;
  296. http.request({
  297. url: '/galaxy-business/baseinfo/region/whole/yj/list',
  298. method: 'GET',
  299. data: params,
  300. }).then(res => {
  301. that.countryRegionData = res.data.map(item => {
  302. return {
  303. value: item.adcd,
  304. text: item.adnm,
  305. }
  306. })
  307. }).catch(err => {
  308. console.log(err)
  309. })
  310. },
  311. dangerAreaNameValInput(e) {
  312. if (e == null || e == '' || e.length == 0) {
  313. this.dangerAreaNameVal = '';
  314. this.pageCurrent = 1;
  315. this.getPage({});
  316. }
  317. },
  318. search() {
  319. this.pageCurrent = 1;
  320. let params = {};
  321. if (this.dangerAreaNameVal != '' && this.dangerAreaNameVal.length > 0) {
  322. params['dangerAreaName'] = this.dangerAreaNameVal;
  323. }
  324. this.getPage(params);
  325. },
  326. toMap(item) {
  327. let url = '/pages/yjxt/dangerarea/dangerareamap?id=' + item.id;
  328. uni.navigateTo({
  329. url: url
  330. })
  331. },
  332. toQr(item) {
  333. let url = '/pages/yjxt/dangerarea/dangerareaqr?qrType=1&id=' + item.dangerAreaPid;
  334. uni.navigateTo({
  335. url: url
  336. })
  337. },
  338. toResidentRegQr(item) {
  339. let url = '/pages/yjxt/dangerarea/dangerareaqr?qrType=2&id=' + item.dangerAreaPid;
  340. uni.navigateTo({
  341. url: url
  342. })
  343. },
  344. pageChange(e) {
  345. this.pageCurrent = e.current;
  346. this.getPage()
  347. },
  348. getPage(params = {}) {
  349. const current = this.pageCurrent;
  350. const size = this.pageSize;
  351. let postData = Object.assign(params, this.query);
  352. let that = this;
  353. http.request({
  354. url: '/galaxy-business/map/dangerarea/page',
  355. method: 'GET',
  356. params: {
  357. current,
  358. size,
  359. },
  360. data: postData,
  361. }).then(res => {
  362. if (res.data.records != null) {
  363. that.list = res.data.records;
  364. }
  365. this.total = res.data.total;
  366. }).catch(err => {
  367. console.log(err)
  368. })
  369. },
  370. }
  371. }
  372. </script>
  373. <style>
  374. .uni-body {
  375. font-size: 0.7rem;
  376. }
  377. </style>