dangerarearesidentrecordlist.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487
  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>
  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. <!-- <scroll-view scroll-y="true" :refresher-enabled="true" :refresher-triggered='triggered'
  18. :refresher-threshold="100" refresher-background="lightpink" @refresherpulling="onPulling"
  19. @refresherrefresh="onRefresh" @refresherrestore="onRestore" @refresherabort="onAbort"> -->
  20. <uni-collapse @change="searchAreaStatus">
  21. <uni-collapse-item :show-animation="true" :open="true">
  22. <template v-slot:title>
  23. <view class="view-flex-block-center" style="height: 40px;width: 100%;">
  24. <view class="view-flex-inline-center">
  25. <text v-if="showSearch" style="color: coral;">点击收起查询区</text>
  26. <text v-else style="color: coral;">点击展开查询区</text>
  27. </view>
  28. </view>
  29. </template>
  30. </uni-collapse-item>
  31. </uni-collapse>
  32. <view v-if="showSearch" class="search-block">
  33. <view style="padding-left: 10px;padding-right: 10px;margin-top: 10px;">
  34. <view>
  35. <uni-data-select v-model="cityRegionValue" :localdata="cityRegionData" @change="cityRegionChange"
  36. placeholder="请选择盟市"></uni-data-select>
  37. </view>
  38. <view style="margin-top: 10px;">
  39. <uni-data-select v-model="districtRegionValue" :localdata="districtRegionData"
  40. @change="districtRegionChange" placeholder="请选择区旗县"></uni-data-select>
  41. </view>
  42. <view style="margin-top: 10px;">
  43. <uni-data-select v-model="townRegionValue" :localdata="townRegionData" @change="townRegionChange"
  44. placeholder="请选择乡镇"></uni-data-select>
  45. </view>
  46. <view style="margin-top: 10px;">
  47. <uni-data-select v-model="countryRegionValue" :localdata="countryRegionData"
  48. @change="countryRegionChange" placeholder="请选择村"></uni-data-select>
  49. </view>
  50. <view style="margin-top: 10px;">
  51. <uni-data-select v-model="dangerAreaValue" :localdata="dangerAreaData" @change="dangerAreaChange"
  52. placeholder="请选择危险区"></uni-data-select>
  53. </view>
  54. </view>
  55. <view class="rtu-code" style="margin-top: 10px;">
  56. <uni-easyinput :styles="inputStyles" @input="personNameValInput" prefixIcon="search"
  57. v-model="personNameVal" placeholder="请录入户主名称">
  58. </uni-easyinput>
  59. </view>
  60. <view class="submit-btn">
  61. <button type="default" @click="search">查 询</button>
  62. </view>
  63. </view>
  64. <view class="container">
  65. <uni-list>
  66. <uni-list-item v-for="item in list" :key="item.id">
  67. <template v-slot:body>
  68. <view class="list-item-block">
  69. <view class="line">
  70. <text class="text text-ellipsis">户主姓名:{{item.personName}}</text>
  71. </view>
  72. <view class="line">
  73. <text class="text text-ellipsis">手机号:{{item.personId}}</text>
  74. </view>
  75. <view class="line">
  76. <text class="text text-ellipsis">危险区:{{item.dangerAreaName}}</text>
  77. </view>
  78. <view class="line">
  79. <text class="text text-ellipsis">所属行政区:{{item.adName}}</text>
  80. </view>
  81. <view class="line">
  82. <text class="text text-ellipsis">住址经纬度:{{item.longitude}},{{item.latitude}}</text>
  83. </view>
  84. <view class="line">
  85. <text class="text text-ellipsis">住址:{{item.address}}</text>
  86. </view>
  87. <view class="item-button-group" style="padding-right: 10px;">
  88. <view class="item-button mid-size" @click="onAddLocationClick(item)">
  89. <view class="items-line">
  90. <uni-icons class="input-uni-icon" type="location" size="18" color="coral" />
  91. <text class="button-text">定位补录</text>
  92. </view>
  93. </view>
  94. <view class="item-button mid-size" @click="onOpenFamilyListClick(item)">
  95. <view class="items-line">
  96. <uni-icons class="input-uni-icon" type="staff" size="18" color="coral" />
  97. <text class="button-text">家庭成员表</text>
  98. </view>
  99. </view>
  100. </view>
  101. </view>
  102. </template>
  103. </uni-list-item>
  104. </uni-list>
  105. <uni-group>
  106. <view class="pagination-block">
  107. <uni-pagination show-icon :pageSize="pageSize" :current="pageCurrent" :total="total"
  108. @change="pageChange" />
  109. </view>
  110. </uni-group>
  111. </view>
  112. <!-- </scroll-view> -->
  113. </view>
  114. </template>
  115. <script>
  116. import http from '@/http/api.js';
  117. export default {
  118. components: {},
  119. data() {
  120. return {
  121. title: '登记人员清单',
  122. showSearch: true,
  123. cityRegionValue: '',
  124. cityRegionData: [],
  125. districtRegionValue: '',
  126. districtRegionData: [],
  127. townRegionValue: '',
  128. townRegionData: [],
  129. countryRegionValue: '',
  130. countryRegionData: [],
  131. dangerAreaValue: '',
  132. dangerAreaData: [],
  133. pageSize: 10,
  134. pageCurrent: 1,
  135. total: 0,
  136. list: [],
  137. query: {},
  138. personNameVal: '',
  139. inputStyles: {
  140. color: '#808080',
  141. borderColor: '#d3d3d3'
  142. },
  143. triggered: false
  144. }
  145. },
  146. computed: {
  147. },
  148. onLoad(option) {
  149. this.query = {};
  150. this.query['isHouseholder'] = 1;
  151. this.getCityRegion({});
  152. //this._freshing = false;
  153. this.getPage();
  154. },
  155. onShow() {
  156. },
  157. methods: {
  158. toBack() {
  159. uni.navigateBack({
  160. delta: 1
  161. })
  162. },
  163. // onPulling(e) {
  164. // console.log("onpulling", e);
  165. // },
  166. // onRefresh() {
  167. // if (this._freshing) return;
  168. // this._freshing = true;
  169. // this.triggered = true;
  170. // this.pageCurrent = 1;
  171. // let params = {};
  172. // if (this.dangerAreaValue != '' && this.dangerAreaValue.length > 0) {
  173. // params['dangerAreaPid'] = this.dangerAreaValue;
  174. // }
  175. // if (this.personNameVal != '' && this.personNameVal.length > 0) {
  176. // params['personName'] = this.personNameVal;
  177. // }
  178. // this.getPage(params);
  179. // },
  180. // onRestore() {
  181. // this.triggered = 'restore';
  182. // console.log("onRestore");
  183. // },
  184. // onAbort() {
  185. // console.log("onAbort");
  186. // },
  187. pageChange(e) {
  188. this.pageCurrent = e.current;
  189. let params = {};
  190. if (this.dangerAreaValue != '' && this.dangerAreaValue.length > 0) {
  191. params['dangerAreaPid'] = this.dangerAreaValue;
  192. }
  193. if (this.personNameVal != '' && this.personNameVal.length > 0) {
  194. params['personName'] = this.personNameVal;
  195. }
  196. this.getPage(params)
  197. },
  198. searchAreaStatus(e) {
  199. if (e.length > 0) {
  200. this.showSearch = true;
  201. } else {
  202. this.showSearch = false;
  203. }
  204. },
  205. cityRegionChange(e) {
  206. this.cityRegionValue = e;
  207. this.districtRegionData = [];
  208. this.districtRegionValue = '';
  209. this.townRegionData = [];
  210. this.townRegionValue = '';
  211. this.countryRegionData = [];
  212. this.countryRegionValue = '';
  213. this.dangerAreaData = [];
  214. this.dangerAreaValue = '';
  215. let p = {
  216. 'parentCode': this.cityRegionValue
  217. }
  218. this.getDistrictRegion(p);
  219. this.pageCurrent = 1;
  220. this.list = [];
  221. this.query['dangerAreaCode'] = this.cityRegionValue;
  222. this.getPage({});
  223. },
  224. districtRegionChange(e) {
  225. if (e == undefined || e == null || e == '') {
  226. this.districtRegionValue = '';
  227. this.townRegionData = [];
  228. this.townRegionValue = '';
  229. this.countryRegionData = [];
  230. this.countryRegionValue = '';
  231. this.dangerAreaData = [];
  232. this.dangerAreaValue = '';
  233. this.pageCurrent = 1;
  234. this.list = [];
  235. this.query['dangerAreaCode'] = this.cityRegionValue;
  236. this.getPage({});
  237. } else {
  238. this.districtRegionValue = e;
  239. this.townRegionData = [];
  240. this.townRegionValue = '';
  241. this.countryRegionData = [];
  242. this.countryRegionValue = '';
  243. this.dangerAreaData = [];
  244. this.dangerAreaValue = '';
  245. let p = {
  246. 'parentCode': this.districtRegionValue
  247. }
  248. this.getTownRegion(p);
  249. this.pageCurrent = 1;
  250. this.list = [];
  251. this.query['dangerAreaCode'] = this.districtRegionValue;
  252. this.getPage({});
  253. }
  254. },
  255. townRegionChange(e) {
  256. if (e == undefined || e == null || e == '') {
  257. this.townRegionValue = '';
  258. this.countryRegionData = [];
  259. this.countryRegionValue = '';
  260. this.dangerAreaData = [];
  261. this.dangerAreaValue = '';
  262. this.pageCurrent = 1;
  263. this.list = [];
  264. this.query['dangerAreaCode'] = this.districtRegionValue;
  265. this.getPage({});
  266. } else {
  267. this.townRegionValue = e;
  268. this.countryRegionData = [];
  269. this.countryRegionValue = '';
  270. this.dangerAreaData = [];
  271. this.dangerAreaValue = '';
  272. let p = {
  273. 'parentCode': this.townRegionValue
  274. }
  275. this.getCountryRegion(p);
  276. this.pageCurrent = 1;
  277. this.list = [];
  278. this.query['dangerAreaCode'] = this.townRegionValue;
  279. this.getPage({});
  280. }
  281. },
  282. countryRegionChange(e) {
  283. if (e == undefined || e == null || e == '') {
  284. this.countryRegionValue = '';
  285. this.dangerAreaValue = '';
  286. this.dangerAreaData = [];
  287. this.dangerAreaValue = '';
  288. this.pageCurrent = 1;
  289. this.list = [];
  290. this.query['dangerAreaCode'] = this.townRegionValue;
  291. this.getPage({});
  292. } else {
  293. this.countryRegionValue = e;
  294. this.dangerAreaValue = '';
  295. this.dangerAreaData = [];
  296. this.dangerAreaValue = '';
  297. this.getDangerAreaList({
  298. 'adcd': this.countryRegionValue
  299. })
  300. this.pageCurrent = 1;
  301. this.list = [];
  302. this.query['dangerAreaCode'] = this.countryRegionValue;
  303. this.getPage({});
  304. }
  305. },
  306. dangerAreaChange(e) {
  307. if (e == undefined || e == null || e == '') {
  308. this.dangerAreaValue = '';
  309. this.pageCurrent = 1;
  310. this.list = [];
  311. this.getPage({});
  312. } else {
  313. this.dangerAreaValue = e;
  314. this.pageCurrent = 1;
  315. this.list = [];
  316. this.getPage({
  317. dangerAreaPid: this.dangerAreaValue
  318. });
  319. }
  320. },
  321. getCityRegion(params = {}) {
  322. let that = this;
  323. http.request({
  324. url: '/galaxy-business/baseinfo/region/whole/yj/list',
  325. method: 'GET',
  326. data: params,
  327. }).then(res => {
  328. //console.log(JSON.stringify(res.data))
  329. that.cityRegionData = res.data.map(item => {
  330. return {
  331. value: item.adcd,
  332. text: item.adnm,
  333. }
  334. })
  335. }).catch(err => {
  336. console.log(err)
  337. })
  338. },
  339. getDistrictRegion(params = {}) {
  340. let that = this;
  341. http.request({
  342. url: '/galaxy-business/baseinfo/region/whole/yj/list',
  343. method: 'GET',
  344. data: params,
  345. }).then(res => {
  346. that.districtRegionData = res.data.map(item => {
  347. return {
  348. value: item.adcd,
  349. text: item.adnm,
  350. }
  351. })
  352. }).catch(err => {
  353. console.log(err)
  354. })
  355. },
  356. getTownRegion(params = {}) {
  357. let that = this;
  358. http.request({
  359. url: '/galaxy-business/baseinfo/region/whole/yj/list',
  360. method: 'GET',
  361. data: params,
  362. }).then(res => {
  363. that.townRegionData = res.data.map(item => {
  364. return {
  365. value: item.adcd,
  366. text: item.adnm,
  367. }
  368. })
  369. }).catch(err => {
  370. console.log(err)
  371. })
  372. },
  373. getCountryRegion(params = {}) {
  374. let that = this;
  375. http.request({
  376. url: '/galaxy-business/baseinfo/region/whole/yj/list',
  377. method: 'GET',
  378. data: params,
  379. }).then(res => {
  380. that.countryRegionData = res.data.map(item => {
  381. return {
  382. value: item.adcd,
  383. text: item.adnm,
  384. }
  385. })
  386. }).catch(err => {
  387. console.log(err)
  388. })
  389. },
  390. getDangerAreaList(params = {}) {
  391. let postData = Object.assign(params, this.query);
  392. let that = this;
  393. http.request({
  394. url: '/galaxy-business/map/dangerarea/select',
  395. method: 'GET',
  396. data: postData,
  397. }).then(res => {
  398. that.dangerAreaData = res.data.map(item => {
  399. return {
  400. value: item.dangerAreaPid,
  401. text: item.dangerAreaName,
  402. }
  403. })
  404. }).catch(err => {
  405. console.log(err)
  406. })
  407. },
  408. personNameValInput(e) {
  409. if (e == null || e == '' || e.length == 0) {
  410. this.personNameVal = '';
  411. this.pageCurrent = 1;
  412. let params = {};
  413. if (this.dangerAreaValue != '' && this.dangerAreaValue.length > 0) {
  414. params['dangerAreaPid'] = this.dangerAreaValue;
  415. }
  416. this.getPage(params);
  417. }
  418. },
  419. search() {
  420. this.pageCurrent = 1;
  421. let params = {};
  422. if (this.dangerAreaValue != '' && this.dangerAreaValue.length > 0) {
  423. params['dangerAreaPid'] = this.dangerAreaValue;
  424. }
  425. if (this.personNameVal != '' && this.personNameVal.length > 0) {
  426. params['personName'] = this.personNameVal;
  427. }
  428. this.getPage(params);
  429. },
  430. onAddLocationClick(item) {
  431. var url = '/pages/yjxt/resident/dangerarearesidentlocation?type=2&id=' + item.id + '&lng=' + item
  432. .longitude +
  433. '&lat=' + item.latitude + '&add=' + item.address;
  434. uni.navigateTo({
  435. url: url
  436. })
  437. },
  438. onOpenFamilyListClick(item) {
  439. var url = '/pages/yjxt/resident/dangerarearesidentfamilylist?personId=' + item.personId;
  440. uni.navigateTo({
  441. url: url
  442. })
  443. },
  444. getPage(params = {}) {
  445. const current = this.pageCurrent;
  446. const size = this.pageSize;
  447. let postData = Object.assign(params, this.query);
  448. //let that = this;
  449. http.request({
  450. url: '/galaxy-business/yj/resident/page',
  451. method: 'GET',
  452. params: {
  453. current,
  454. size,
  455. },
  456. data: postData,
  457. }).then(res => {
  458. //console.log("get page +++++++++")
  459. if (res.data.records != null) {
  460. // that.list = res.data.records.map(item => {
  461. // let id = item.personId.replace(/^(\d{6})\d+(\d{4})$/, '$1******$2')
  462. // return {
  463. // ...item,
  464. // 'pId': id
  465. // }
  466. // })
  467. this.list = res.data.records;
  468. }
  469. this.total = res.data.total;
  470. }).catch(err => {
  471. console.log(err)
  472. }).finally(() => {
  473. //console.log("get page finally +++++++++")
  474. //this.triggered = false;
  475. //this._freshing = false;
  476. })
  477. },
  478. }
  479. }
  480. </script>
  481. <style lang="scss" scoped>
  482. </style>