dangerarea.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480
  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 style="margin-top: 10px;">
  49. <uni-data-select v-model="dangerAreaValue" :localdata="dangerAreaData" @change="dangerAreaChange"
  50. placeholder="请选择危险区"></uni-data-select>
  51. </view> -->
  52. </view>
  53. <view class="rtu-code">
  54. <uni-easyinput :styles="inputStyles" @input="dangerAreaNameValInput" prefixIcon="search"
  55. v-model="dangerAreaNameVal" placeholder="请录入危险区名称">
  56. </uni-easyinput>
  57. </view>
  58. <view class="submit-btn">
  59. <button type="default" @click="search">查 询</button>
  60. </view>
  61. </view>
  62. <!-- <uni-section title="查询" type="line">
  63. <view class="search-block">
  64. <view class="name">
  65. <uni-easyinput :styles="inputStyles" @input="adNameValInput" prefixIcon="search"
  66. v-model="adNameVal" placeholder="请输入行政区名称">
  67. </uni-easyinput>
  68. </view>
  69. <view class="name">
  70. <uni-easyinput :styles="inputStyles" @input="dangerAreaNameValInput" prefixIcon="search"
  71. v-model="dangerAreaNameVal" placeholder="请输入危险区名称">
  72. </uni-easyinput>
  73. </view>
  74. <view class="submit-btn">
  75. <button type="default" @click="search">查 询</button>
  76. </view>
  77. </view>
  78. </uni-section> -->
  79. <view v-if="list.length>0">
  80. <uni-list>
  81. <uni-list-item v-for="item in list" :key="item.id">
  82. <template v-slot:body>
  83. <view class="list-item-block">
  84. <view class="line">
  85. <text class="title text-ellipsis">{{item.dangerAreaName}}</text>
  86. </view>
  87. <view class="line" style="margin-top: 5px;">
  88. <uni-icons class="input-uni-icon" type="map-pin-ellipse" size="18"
  89. color="orangered" />
  90. <text class="lable">行政区划:</text>
  91. <text class="content" style="color: gray;">{{item.adnm}}</text>
  92. </view>
  93. <view class="item-button-group">
  94. <view class="item-button mid-size" @click="toResidentRegQr(item)">
  95. <view class="view-flex-inline-center">
  96. <uni-icons class="input-uni-icon" type="scan" size="18" color="coral" />
  97. <text class="button-text">群众登记二维码</text>
  98. </view>
  99. </view>
  100. <!-- <view class="item-button mid-size" @click="toQr(item)">
  101. <view class="view-flex-inline-center">
  102. <uni-icons class="input-uni-icon" type="scan" size="18" color="coral" />
  103. <text class="button-text">危险区二维码</text>
  104. </view>
  105. </view> -->
  106. <view class="item-button mid-size" @click="toMap(item)">
  107. <view class="view-flex-inline-center">
  108. <uni-icons class="input-uni-icon" type="location" size="18" color="coral" />
  109. <text class="button-text">地图查看</text>
  110. </view>
  111. </view>
  112. </view>
  113. </view>
  114. </template>
  115. </uni-list-item>
  116. </uni-list>
  117. <uni-group>
  118. <view class="pagination-block">
  119. <uni-pagination show-icon :pageSize="pageSize" :current="pageCurrent" :total="total"
  120. @change="pageChange" />
  121. </view>
  122. </uni-group>
  123. </view>
  124. <view v-else class="view-flex-inline-center">
  125. <view style="margin-top: 10px;color: gray;font-size: 1rem;">暂无数据</view>
  126. </view>
  127. </view>
  128. </view>
  129. </template>
  130. <script>
  131. import http from '@/http/api.js';
  132. import {
  133. devUrl,
  134. prodUrl
  135. } from '@/common/setting';
  136. export default {
  137. components: {
  138. },
  139. data() {
  140. return {
  141. title: '危险区信息',
  142. showSearch: true,
  143. cityRegionValue: '',
  144. cityRegionData: [],
  145. districtRegionValue: '',
  146. districtRegionData: [],
  147. townRegionValue: '',
  148. townRegionData: [],
  149. countryRegionValue: '',
  150. countryRegionData: [],
  151. // dangerAreaValue: '',
  152. // dangerAreaData: [],
  153. pageSize: 10,
  154. pageCurrent: 1,
  155. total: 0,
  156. list: [],
  157. query: {},
  158. // adNameVal: '',
  159. dangerAreaNameVal: '',
  160. inputStyles: {
  161. color: '#808080',
  162. borderColor: '#d3d3d3'
  163. },
  164. }
  165. },
  166. computed: {
  167. },
  168. onInit(option) {
  169. console.log("onInit")
  170. },
  171. onLoad(option) {
  172. console.log("onLoad")
  173. this.getCityRegion({});
  174. },
  175. onShow() {
  176. console.log("onShow")
  177. this.pageCurrent = 1;
  178. this.getPage();
  179. },
  180. onReady() {
  181. console.log("onReady")
  182. },
  183. methods: {
  184. toBack() {
  185. uni.navigateBack({
  186. delta: 1
  187. })
  188. },
  189. searchAreaStatus(e) {
  190. if (e.length > 0) {
  191. this.showSearch = true;
  192. } else {
  193. this.showSearch = false;
  194. }
  195. },
  196. cityRegionChange(e) {
  197. this.cityRegionValue = e;
  198. this.districtRegionData = [];
  199. this.districtRegionValue = '';
  200. this.townRegionData = [];
  201. this.townRegionValue = '';
  202. this.countryRegionData = [];
  203. this.countryRegionValue = '';
  204. // this.dangerAreaData = [];
  205. // this.dangerAreaValue='';
  206. let p = {
  207. 'parentCode': this.cityRegionValue
  208. }
  209. this.getDistrictRegion(p);
  210. this.pageCurrent = 1;
  211. this.list = [];
  212. this.query['adcd'] = this.cityRegionValue;
  213. this.getPage({});
  214. },
  215. districtRegionChange(e) {
  216. if (e == undefined || e == null || e == '') {
  217. this.districtRegionValue = '';
  218. this.townRegionData = [];
  219. this.townRegionValue = '';
  220. this.countryRegionData = [];
  221. this.countryRegionValue = '';
  222. //this.dangerAreaData = [];
  223. //this.dangerAreaValue='';
  224. this.pageCurrent = 1;
  225. this.list = [];
  226. this.query['adcd'] = this.cityRegionValue;
  227. this.getPage({});
  228. } else {
  229. this.districtRegionValue = e;
  230. this.townRegionData = [];
  231. this.townRegionValue = '';
  232. this.countryRegionData = [];
  233. this.countryRegionValue = '';
  234. //this.dangerAreaData = [];
  235. //this.dangerAreaValue='';
  236. let p = {
  237. 'parentCode': this.districtRegionValue
  238. }
  239. this.getTownRegion(p);
  240. this.pageCurrent = 1;
  241. this.list = [];
  242. this.query['adcd'] = this.districtRegionValue;
  243. this.getPage({});
  244. }
  245. },
  246. townRegionChange(e) {
  247. if (e == undefined || e == null || e == '') {
  248. this.townRegionValue = '';
  249. this.countryRegionData = [];
  250. this.countryRegionValue = '';
  251. //this.dangerAreaData = [];
  252. //this.dangerAreaValue='';
  253. this.pageCurrent = 1;
  254. this.list = [];
  255. this.query['adcd'] = this.districtRegionValue;
  256. this.getPage({});
  257. } else {
  258. this.townRegionValue = e;
  259. this.countryRegionData = [];
  260. this.countryRegionValue = '';
  261. //this.dangerAreaData = [];
  262. //this.dangerAreaValue='';
  263. let p = {
  264. 'parentCode': this.townRegionValue
  265. }
  266. this.getCountryRegion(p);
  267. this.pageCurrent = 1;
  268. this.list = [];
  269. this.query['adcd'] = this.townRegionValue;
  270. this.getPage({});
  271. }
  272. },
  273. countryRegionChange(e) {
  274. if (e == undefined || e == null || e == '') {
  275. this.countryRegionValue = '';
  276. //this.dangerAreaValue = '';
  277. //this.dangerAreaData = [];
  278. //this.dangerAreaValue='';
  279. this.pageCurrent = 1;
  280. this.list = [];
  281. this.query['adcd'] = this.townRegionValue;
  282. this.getPage({});
  283. } else {
  284. this.countryRegionValue = e;
  285. //this.dangerAreaValue = '';
  286. //this.dangerAreaData = [];
  287. //this.dangerAreaValue='';
  288. // this.getDangerAreaList({
  289. // 'adcd': this.countryRegionValue
  290. // })
  291. this.pageCurrent = 1;
  292. this.list = [];
  293. this.query['adcd'] = this.countryRegionValue;
  294. this.getPage({});
  295. }
  296. },
  297. // dangerAreaChange(e) {
  298. // if (e == undefined || e == null || e == '') {
  299. // this.dangerAreaValue = '';
  300. // this.pageCurrent = 1;
  301. // this.list = [];
  302. // this.getPage({});
  303. // } else {
  304. // this.dangerAreaValue = e;
  305. // this.pageCurrent = 1;
  306. // this.list = [];
  307. // this.getPage({
  308. // dangerAreaPid: this.dangerAreaValue
  309. // });
  310. // }
  311. // },
  312. getCityRegion(params = {}) {
  313. let that = this;
  314. http.request({
  315. url: '/galaxy-business/baseinfo/region/whole/yj/list',
  316. method: 'GET',
  317. data: params,
  318. }).then(res => {
  319. that.cityRegionData = res.data.map(item => {
  320. return {
  321. value: item.adcd,
  322. text: item.adnm,
  323. }
  324. })
  325. }).catch(err => {
  326. console.log(err)
  327. })
  328. },
  329. getDistrictRegion(params = {}) {
  330. let that = this;
  331. http.request({
  332. url: '/galaxy-business/baseinfo/region/whole/yj/list',
  333. method: 'GET',
  334. data: params,
  335. }).then(res => {
  336. that.districtRegionData = res.data.map(item => {
  337. return {
  338. value: item.adcd,
  339. text: item.adnm,
  340. }
  341. })
  342. }).catch(err => {
  343. console.log(err)
  344. })
  345. },
  346. getTownRegion(params = {}) {
  347. let that = this;
  348. http.request({
  349. url: '/galaxy-business/baseinfo/region/whole/yj/list',
  350. method: 'GET',
  351. data: params,
  352. }).then(res => {
  353. that.townRegionData = res.data.map(item => {
  354. return {
  355. value: item.adcd,
  356. text: item.adnm,
  357. }
  358. })
  359. }).catch(err => {
  360. console.log(err)
  361. })
  362. },
  363. getCountryRegion(params = {}) {
  364. let that = this;
  365. http.request({
  366. url: '/galaxy-business/baseinfo/region/whole/yj/list',
  367. method: 'GET',
  368. data: params,
  369. }).then(res => {
  370. that.countryRegionData = res.data.map(item => {
  371. return {
  372. value: item.adcd,
  373. text: item.adnm,
  374. }
  375. })
  376. }).catch(err => {
  377. console.log(err)
  378. })
  379. },
  380. // getDangerAreaList(params = {}) {
  381. // let postData = Object.assign(params, this.query);
  382. // let that = this;
  383. // http.request({
  384. // url: '/galaxy-business/map/dangerarea/select',
  385. // method: 'GET',
  386. // data: postData,
  387. // }).then(res => {
  388. // that.dangerAreaData = res.data.map(item => {
  389. // return {
  390. // value: item.dangerAreaPid,
  391. // text: item.dangerAreaName,
  392. // }
  393. // })
  394. // }).catch(err => {
  395. // console.log(err)
  396. // })
  397. // },
  398. // adNameValInput(e) {
  399. // if (e == null || e.length == 0) {
  400. // this.adNameVal = '';
  401. // }
  402. // },
  403. dangerAreaNameValInput(e) {
  404. if (e == null || e == '' || e.length == 0) {
  405. this.dangerAreaNameVal = '';
  406. this.pageCurrent = 1;
  407. this.getPage({});
  408. }
  409. },
  410. search() {
  411. this.pageCurrent = 1;
  412. let params = {};
  413. if (this.dangerAreaNameVal != '' && this.dangerAreaNameVal.length > 0) {
  414. params['dangerAreaName'] = this.dangerAreaNameVal;
  415. }
  416. this.getPage(params);
  417. },
  418. toMap(item) {
  419. let url = '/pages/yjxt/dangerarea/dangerareamap?id=' + item.id;
  420. uni.navigateTo({
  421. url: url
  422. })
  423. },
  424. toQr(item) {
  425. let url = '/pages/yjxt/dangerarea/dangerareaqr?qrType=1&id=' + item.dangerAreaPid;
  426. uni.navigateTo({
  427. url: url
  428. })
  429. },
  430. toResidentRegQr(item) {
  431. let url = '/pages/yjxt/dangerarea/dangerareaqr?qrType=2&id=' + item.dangerAreaPid;
  432. uni.navigateTo({
  433. url: url
  434. })
  435. },
  436. pageChange(e) {
  437. this.pageCurrent = e.current;
  438. this.getPage()
  439. },
  440. getPage(params = {}) {
  441. // if (this.adNameVal.length > 0) {
  442. // params['adName'] = this.adNameVal;
  443. // }
  444. // if (this.dangerAreaNameVal.length > 0) {
  445. // params['dangerAreaName'] = this.dangerAreaNameVal;
  446. // }
  447. const current = this.pageCurrent;
  448. const size = this.pageSize;
  449. let postData = Object.assign(params, this.query);
  450. let that = this;
  451. http.request({
  452. url: '/galaxy-business/map/dangerarea/page',
  453. method: 'GET',
  454. params: {
  455. current,
  456. size,
  457. },
  458. data: postData,
  459. }).then(res => {
  460. if (res.data.records != null) {
  461. that.list = res.data.records;
  462. }
  463. this.total = res.data.total;
  464. }).catch(err => {
  465. console.log(err)
  466. })
  467. },
  468. }
  469. }
  470. </script>
  471. <style>
  472. .uni-body {
  473. font-size: 0.7rem;
  474. }
  475. </style>