index.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <template>
  2. <view class="receivedBox">
  3. <view class="container">
  4. <map
  5. class="mapBox"
  6. :latitude="latitude"
  7. :longitude="longitude"
  8. :markers="covers"
  9. :scale="scale"
  10. id="map"
  11. ref="map"
  12. >
  13. </map>
  14. <SlideCard>
  15. <view class="titleBox">
  16. <view class="search">
  17. <input
  18. v-model="dkbhModel"
  19. placeholder-class="address"
  20. class="input"
  21. type="text"
  22. placeholder="请输入地块编号"
  23. />
  24. </view>
  25. <view class="searchBtn" @click="queryClick()">
  26. <image class="icon" src="../../static/images/search.png"></image>
  27. </view>
  28. </view>
  29. <scroll-view scroll-y="true" class="scroll-view_H" lower-threshold="50">
  30. <view
  31. class="cardBox"
  32. @click="cardBoxClick(item, index)"
  33. v-for="(item, index) in listData"
  34. :key="index"
  35. >
  36. <view class="cardBoxTitle">
  37. <view class="titleOne">
  38. <view class="x1">{{ index + 1 }}</view>
  39. <view class="x2">{{ item.dkbh }}</view>
  40. </view>
  41. <view class="citys">
  42. <image class="icon" src="../../static/images/citys.png"></image>
  43. <view class="x1">{{ item.dkwz }}</view>
  44. </view>
  45. </view>
  46. <div class="cardBoxContent">
  47. <view class="x1"> 管地单位:{{ item.gddw }} </view>
  48. <view class="x1"> 地块面积:{{ item.mj }} 亩 </view>
  49. <view class="x1"> 上次巡查时间:{{ item.xcsj }} </view>
  50. </div>
  51. <div class="cardBoxBtns">
  52. <view class="btn btn1" @click.stop="toDetailHandle(item)">
  53. <image class="icon" src="../../static/images/xcxq.png"></image>
  54. <view class="x1">详情</view>
  55. </view>
  56. <view class="btn btn2" @click.stop="toDetailHandle1(item)">
  57. <image
  58. class="icon"
  59. src="../../static/images/xuncha.png"
  60. ></image>
  61. <view class="x1">巡查</view>
  62. </view>
  63. </div>
  64. </view>
  65. </scroll-view>
  66. </SlideCard>
  67. </view>
  68. </view>
  69. </template>
  70. <script>
  71. import SlideCard from '../../components/SlideCard/SlideCard.vue';
  72. import CustomMixins from '@/mixins/CustomMixins.js';
  73. import httpAjax from '@/utils/https.js';
  74. import config from '@/utils/config.js';
  75. export default {
  76. mixins: [CustomMixins],
  77. components: {
  78. SlideCard,
  79. },
  80. data() {
  81. return {
  82. dkbhModel: '',
  83. scale: 12,
  84. id: 0, // 使用 marker点击事件 需要填写id
  85. title: 'map',
  86. latitude: 30.131,
  87. longitude: 120.19308,
  88. covers: [],
  89. count: 0,
  90. listData: [],
  91. scrollTop: 0,
  92. pageNo: 1, //当前页
  93. pageSize: 10, //每页显示多少条
  94. isRequest: true, //是否请求 是 true,否 false
  95. detailData: {},
  96. mapObj: null,
  97. };
  98. },
  99. mounted() {
  100. this.queryWarningPage();
  101. this.mapObj = uni.createMapContext('map');
  102. },
  103. methods: {
  104. cardBoxClick(item, index) {
  105. let url = config.bjdkgl + '/0/query';
  106. let params = {
  107. where: item.dksyh,
  108. };
  109. //https://zlzd.zrzyt.zj.gov.cn/arcMapServer216/arcgis/rest/services/YSYBZ/BJ_DKGL/MapServer/0/query
  110. httpAjax({
  111. url: url,
  112. method: 'POST',
  113. data: params,
  114. }).then((result) => {
  115. console.log(result);
  116. });
  117. },
  118. queryClick() {
  119. this.queryWarningPage();
  120. },
  121. location(val) {
  122. const sendData = {
  123. id: val.id,
  124. };
  125. httpAjax({
  126. url: 'app-api/mining/app/task',
  127. method: 'GET',
  128. data: sendData,
  129. })
  130. .then((result) => {
  131. const data = result['data'];
  132. this.latitude = data.lat - (Math.random() / 100000 + 0.004);
  133. this.longitude = data.lng;
  134. this.scale = 15.3 + (Math.random() + 1) / 1000;
  135. this.covers = [
  136. {
  137. id: Math.random(),
  138. latitude: data.lat,
  139. longitude: data.lng,
  140. width: 18,
  141. height: 25,
  142. iconPath: '../../static/images/location.png',
  143. },
  144. ];
  145. })
  146. .catch((err) => {
  147. console.error('');
  148. });
  149. },
  150. toDetailHandle(item) {
  151. uni.navigateTo({
  152. url: `/pages/receivedDetail/index?obj=${JSON.stringify(item)}`,
  153. });
  154. },
  155. toDetailHandle1(item) {
  156. uni.navigateTo({
  157. url: `/pages/nocheckDetail/index?obj=${JSON.stringify(item)}`,
  158. });
  159. },
  160. scrollHandle() {
  161. if (this.isRequest) {
  162. this.pageNo += 1;
  163. this.queryWarningPage();
  164. }
  165. },
  166. queryWarningPage() {
  167. if (!this.isRequest) return;
  168. const sendData = {
  169. dkbh: this.dkbhModel,
  170. xcryId: uni.getStorageSync('userInfo').id,
  171. // xcryId: '11e77c7e53b2730407fd3e481b2d6558',
  172. };
  173. httpAjax({
  174. url: 'app/xc/getXcryDkList',
  175. method: 'GET',
  176. data: sendData,
  177. })
  178. .then((result) => {
  179. if (result.data) {
  180. this.listData = result.data;
  181. this.listData.forEach((item) => {
  182. if (item.lxdh.indexOf('\n') > -1) {
  183. item.lxdh = item.lxdh.replace('\n', '');
  184. }
  185. for (let key in item) {
  186. if (item[key] == null) {
  187. item[key] = '';
  188. }
  189. }
  190. });
  191. console.log(this.listData);
  192. }
  193. })
  194. .catch((err) => {
  195. console.error('');
  196. });
  197. },
  198. queryWarningRegional() {
  199. //查询预警区域分布
  200. if (!this.isRequest) return;
  201. const sendData = {
  202. taskStatus: 1,
  203. };
  204. httpAjax({
  205. url: '/admin-api/mining/deviceWarning/regional',
  206. method: 'GET',
  207. data: sendData,
  208. })
  209. .then((result) => {})
  210. .catch((err) => {
  211. console.error('');
  212. });
  213. },
  214. },
  215. };
  216. </script>
  217. <style lang="scss">
  218. @import './index.scss';
  219. </style>