webview.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  1. <template>
  2. <div class="webview">
  3. <WebViewMap class="mapBox" @mapClick="mapClickHandle" />
  4. <SlideCard>
  5. <div class="titleBox">
  6. <div class="search">
  7. <input
  8. v-model="dkbhModel"
  9. placeholder-class="address"
  10. class="input"
  11. type="text"
  12. placeholder="请输入地块编号"
  13. />
  14. </div>
  15. <div class="searchBtn" @click="queryClick()">
  16. <img class="icon" src="./assets/images/webview/search.png" />
  17. </div>
  18. </div>
  19. <div class="overs">
  20. <div
  21. @click="cardBoxClick(item, index)"
  22. v-for="(item, index) in listData"
  23. :key="index"
  24. :class="{'cardBox': true, 'active': currentIndex === index}"
  25. >
  26. <div class="cardBoxTitle">
  27. <div class="titleOne">
  28. <div class="x1">{{ index + 1 }}</div>
  29. <div class="x2">{{ item.dkbh }}</div>
  30. </div>
  31. <div class="citys">
  32. <img class="icon" src="./assets/images/webview/citys.png" />
  33. <div class="x1">{{ item.dkwz }}</div>
  34. </div>
  35. </div>
  36. <div class="cardBoxContent">
  37. <div class="x1">管地单位:{{ item.gddw }}</div>
  38. <div class="x1">地块面积:{{ item.mj }} 亩</div>
  39. <div class="x1">上次巡查时间:{{ item.xcsj }}</div>
  40. </div>
  41. <div class="cardBoxBtns">
  42. <div class="btn btn1" @click="toDetailHandle(item)">
  43. <img class="icon" src="./assets/images/webview/xcxq.png" />
  44. <div class="x1">详情</div>
  45. </div>
  46. <div class="btn btn2" @click.stop="toDetailHandle1(item)">
  47. <img class="icon" src="./assets/images/webview/xuncha.png" />
  48. <div class="x1">巡查</div>
  49. </div>
  50. </div>
  51. </div>
  52. </div>
  53. </SlideCard>
  54. </div>
  55. </template>
  56. <script>
  57. import WebViewMap from './webViewMap';
  58. import wx from 'weixin-js-sdk';
  59. import SlideCard from './SlideCard';
  60. export default {
  61. name: 'Login',
  62. components: { WebViewMap, SlideCard },
  63. data() {
  64. return {
  65. citys: {},
  66. userInfo: {},
  67. dkbhModel: '',
  68. scale: 12,
  69. id: 0, // 使用 marker点击事件 需要填写id
  70. title: 'map',
  71. latitude: 30.131,
  72. longitude: 120.19308,
  73. covers: [],
  74. count: 0,
  75. listData: [{}, {}, {}],
  76. scrollTop: 0,
  77. pageNo: 1, //当前页
  78. pageSize: 10, //每页显示多少条
  79. isRequest: true, //是否请求 是 true,否 false
  80. detailData: {},
  81. mapObj: null,
  82. currentIndex: -1
  83. };
  84. },
  85. mounted() {},
  86. created() {
  87. console.log(this.$vm);
  88. let that = this;
  89. setInterval(() => {
  90. that.citys = JSON.parse(that.$route.query.city);
  91. that.$vm.$emit('addPoint', that.citys);
  92. }, 3000);
  93. this.userInfo = JSON.parse(this.$route.query.objs);
  94. this.queryWarningPage();
  95. },
  96. methods: {
  97. mapClickHandle (payload) {
  98. this.toDetailInfo(payload['dksyh'])
  99. },
  100. toDetailInfo (dksyh) {
  101. const urlApi = `/app/xc/getXcryDkDetailByDksyh`;
  102. let params = {
  103. dksyh: dksyh
  104. };
  105. this.$ajax.get(urlApi, params, this, false).then((result) => {
  106. if (result.data) {
  107. console.log(result.data)
  108. this.toDetailHandle(result.data);
  109. }
  110. });
  111. },
  112. toDetailHandle (item) {
  113. wx.miniProgram.navigateTo({
  114. url: `/pages/receivedDetail/index?obj=${JSON.stringify(item)}`,
  115. });
  116. },
  117. toDetailHandle1(item) {
  118. wx.miniProgram.navigateTo({
  119. url: `/pages/nocheckDetail/index?obj=${JSON.stringify(item)}`,
  120. });
  121. },
  122. abc() {
  123. wx.miniProgram.postMessage({
  124. data: {
  125. title: '我是从uni-app H5 传递过来的 message',
  126. desc: '传递的消息信息,必须写在 data 对象中',
  127. },
  128. });
  129. // uni.webView.navigateBack();
  130. },
  131. cardBoxClick(item, index) {
  132. let dksyh = item.dksyh;
  133. this.currentIndex = index;
  134. this.$vm.$emit('location-feature-where', {
  135. layerId: 'bj-dkgl',
  136. where: `dksyh = '${dksyh}'`,
  137. setting: { outFields: 'dksyh,dkbh,dkwz,gddw,dkmj' },
  138. isFit: true,
  139. });
  140. },
  141. queryClick() {
  142. this.queryWarningPage();
  143. },
  144. queryWarningPage() {
  145. let urlApi = `/app/xc/getXcryDkList`;
  146. let params = {
  147. dkbh: this.dkbhModel ? this.dkbhModel.toUpperCase() : '',
  148. xcryId: this.userInfo.id,
  149. };
  150. this.$ajax.get(urlApi, params, this, false).then((result) => {
  151. if (result.data) {
  152. this.listData = result.data;
  153. this.listData.forEach((item) => {
  154. if (item.lxdh.indexOf('\n') > -1) {
  155. item.lxdh = item.lxdh.replace('\n', '');
  156. }
  157. for (let key in item) {
  158. if (item[key] == null) {
  159. item[key] = '';
  160. }
  161. }
  162. });
  163. }
  164. });
  165. },
  166. },
  167. };
  168. </script>
  169. <style scoped lang="scss">
  170. .webview {
  171. width: 100%;
  172. height: 100%;
  173. .mapBox {
  174. }
  175. .titleBox {
  176. display: flex;
  177. align-items: center;
  178. justify-content: space-between;
  179. margin-bottom: 10px;
  180. width: 100%;
  181. height: 32px;
  182. border: 1px solid #e7eaef;
  183. background-color: #f9f9f9;
  184. border-radius: 4px;
  185. .search {
  186. width: calc(100% - 35px);
  187. height: 100%;
  188. display: flex;
  189. align-items: center;
  190. justify-content: center;
  191. .input {
  192. width: 100%;
  193. height: 100%;
  194. padding-left: 10px;
  195. border: 0;
  196. outline: none; /*清除input点击之后的黑色边框*/
  197. font-size: 14px;
  198. background-color: transparent;
  199. }
  200. .address {
  201. color: #a6aab2;
  202. }
  203. }
  204. .searchBtn {
  205. display: flex;
  206. align-items: center;
  207. justify-content: center;
  208. width: 35px;
  209. height: 32px;
  210. background-color: #3991fe;
  211. border-radius: 4px;
  212. .icon {
  213. width: 16px;
  214. height: 16px;
  215. }
  216. }
  217. }
  218. .cardBox {
  219. width: 100%;
  220. background: #ffffff;
  221. box-shadow: 0px 3px 11px 0px #ebf1f9;
  222. border-radius: 6px;
  223. padding: 10px;
  224. box-sizing: border-box;
  225. border: 1px solid #eff2f8;
  226. margin-bottom: 10px;
  227. &.active {
  228. background-color: #e1edfc;
  229. }
  230. .cardBoxTitle {
  231. width: 100%;
  232. display: flex;
  233. align-items: center;
  234. justify-content: space-between;
  235. .titleOne {
  236. display: flex;
  237. align-items: center;
  238. .x1 {
  239. width: 20px;
  240. height: 20px;
  241. background: linear-gradient(180deg, #67abff 0%, #246ddc 100%);
  242. border-radius: 4px 4px 4px 4px;
  243. color: #fff;
  244. line-height: 20px;
  245. text-align: center;
  246. margin-right: 10px;
  247. font-size: 14px;
  248. }
  249. .x2 {
  250. color: #2c3649;
  251. font-size: 20px;
  252. font-weight: 600;
  253. }
  254. }
  255. .citys {
  256. display: flex;
  257. align-items: center;
  258. .icon {
  259. width: 15px;
  260. height: 15px;
  261. margin-right: 4px;
  262. }
  263. .x1 {
  264. color: #2c3649;
  265. font-size: 14px;
  266. }
  267. }
  268. }
  269. .cardBoxContent {
  270. width: 100%;
  271. margin: 10px 0;
  272. .x1 {
  273. width: 100%;
  274. color: #2c3649;
  275. font-size: 14px;
  276. margin: 4px;
  277. }
  278. }
  279. .cardBoxBtns {
  280. width: 100%;
  281. display: flex;
  282. align-items: center;
  283. justify-content: space-between;
  284. .btn {
  285. width: calc(50% - 20px);
  286. height: 33px;
  287. display: flex;
  288. align-items: center;
  289. justify-content: center;
  290. border-radius: 4px;
  291. .icon {
  292. width: 18px;
  293. height: 18px;
  294. margin-right: 4px;
  295. }
  296. .x1 {
  297. color: #2c3649;
  298. font-size: 14px;
  299. }
  300. }
  301. .btn1 {
  302. background-color: #e1f6ef;
  303. }
  304. .btn2 {
  305. background-color: #cee1f9;
  306. }
  307. }
  308. }
  309. }
  310. .overs {
  311. width: 100%;
  312. height: calc(50vh - 70px);
  313. overflow-y: auto;
  314. }
  315. </style>