1b2e87e78bc75c3195b0b6835090d698bff3376b.svn-base 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <template>
  2. <div class="query" v-drag="'.query .ant-card-head'">
  3. <a-card v-show='value' title="查询" style="width: 350px; box-shadow: 0 0 5px #357ee5;">
  4. <a-icon slot="extra" type="close" style='cursor: pointer; color: #FFFFFF;' @click="$emit('input',false)"/>
  5. <a-input-group compact>
  6. <a-select v-model='queryType' style="width: 40%">
  7. <a-select-option v-for="(item,index) in list" :value="item.id">
  8. {{ item.queryName }}
  9. </a-select-option>
  10. </a-select>
  11. <a-input-search allow-clear :loading="isLoading" style="width: 60%" v-model='keyword'
  12. @search="handleSearch"
  13. @pressEnter='handleSearch'/>
  14. </a-input-group>
  15. <a-list style='margin-top: 20px;' item-layout="horizontal" :data-source="data" :pagination="pagination">
  16. <a-list-item slot="renderItem" slot-scope="item, index">
  17. <a-list-item-meta @click="handleCoord(item)" :description="item.otherInfo">
  18. <span slot="title">{{ item.name }}</span>
  19. <a-avatar slot="avatar" class="result" :src="require(`@/assets/result${index+1}.png`)">
  20. </a-avatar>
  21. </a-list-item-meta>
  22. <a-tag color="blue">
  23. {{ item.layerName }}
  24. </a-tag>
  25. <!-- <a slot="actions">详情</a>-->
  26. </a-list-item>
  27. </a-list>
  28. </a-card>
  29. <locate-by-geoinfo ref="locateByGeoinfo"></locate-by-geoinfo>
  30. </div>
  31. </template>
  32. <script>
  33. import {getAction, httpAction} from "../../../api/manage";
  34. import LocateByGeoinfo from "./LocateByGeoinfo";
  35. export default {
  36. name: 'queryTool',
  37. components: {LocateByGeoinfo},
  38. data() {
  39. return {
  40. map: '',
  41. visible: false,
  42. list: [{id: 'hhxx', name: '河湖信息'}, {id: 'hhhj', name: '河湖划界'}, {id: 'shgc', name: '涉河工程'}, {
  43. id: 'axgh',
  44. name: '岸线规划'
  45. },],
  46. isLoading: false,
  47. vectorLayer: '',
  48. queryType: '',
  49. lastType: '',
  50. keyword: '',
  51. data: [],
  52. onPage: false,
  53. pagination: {
  54. onChange: page => {
  55. this.pagination.current = page;
  56. this.onPage = true;
  57. this.handleSearch();
  58. },
  59. disabled: false,
  60. pageSize: 10,
  61. total: 0,
  62. size: 'small',
  63. current: 1
  64. },
  65. }
  66. },
  67. props: {
  68. value: {
  69. type: Boolean,
  70. default: false,
  71. required: true
  72. }
  73. },
  74. watch: {
  75. value(val) {
  76. if (val === false) {
  77. //清空搜索框
  78. } else {
  79. }
  80. }
  81. },
  82. inject: ['baseMap'],
  83. async created() {
  84. let {success, result: {records}} = await getAction(this.baseMap.queryUrl, {});
  85. if (success) {
  86. this.list = records;
  87. this.queryType = this.list[0].id;
  88. }
  89. },
  90. methods: {
  91. async handleSearch() {
  92. if (this.queryType && this.keyword) {
  93. if (this.queryType !== this.lastType) {
  94. this.pagination.current = 1;
  95. }
  96. if (!this.onPage) {
  97. this.pagination.current = 1;
  98. }
  99. this.lastType = this.queryType;
  100. this.isLoading = true;
  101. this.pagination.disabled = true;
  102. let queryItem = this.list.find((item) => {
  103. return item.id === this.queryType;
  104. })
  105. this.onPage = false;
  106. let {success, message, result} = await getAction(queryItem.queryPort, {
  107. queryInfo: this.keyword,
  108. pageNo: this.pagination.current,
  109. pageSize: 10
  110. });
  111. if (success) {
  112. this.isLoading = false;
  113. this.pagination.disabled = false;
  114. if (result.total === 0 || result === '') {
  115. this.$message.error('没有查询到信息');
  116. this.data = [];
  117. this.pagination.total = 0;
  118. return;
  119. }
  120. this.data = result.records;
  121. this.pagination.total = result.total;
  122. } else {
  123. this.$message.info(message);
  124. }
  125. } else {
  126. this.$message.warn('请输入查询关键字!');
  127. }
  128. },
  129. handleCoord(item) {
  130. this.$refs.locateByGeoinfo.locate(item, this.baseMap.map);
  131. },
  132. clear() {
  133. this.$refs.locateByGeoinfo.clear();
  134. }
  135. /*createVectorLayer() {
  136. if (this.map === '' || this.vectorLayer === '') return
  137. const vectorSource = new VectorSource();
  138. this.vectorLayer = new VectorLayer({
  139. name: 'locMap',
  140. source: vectorSource,
  141. style: new Style({
  142. fill: new Fill({
  143. color: 'rgba(255, 255, 255, 0.6)',
  144. }),
  145. stroke: new Stroke({
  146. color: '#ff0000',
  147. lineDash: [6, 6],
  148. width: 2
  149. }),
  150. image: new CircleStyle({
  151. radius: 7,
  152. fill: new Fill({
  153. color: '#ffcc33',
  154. }),
  155. }),
  156. }),
  157. zIndex: 100
  158. })
  159. this.map.addLayer(this.vectorLayer);
  160. }*/
  161. },
  162. };
  163. </script>
  164. <style>
  165. .query a > .anticon {
  166. /* vertical-align: 0.2em; */
  167. }
  168. .ant-list-item:hover {
  169. background: #e6f7ff;
  170. cursor: pointer;
  171. }
  172. .query .ant-avatar {
  173. /* background: url("https://img1.baidu.com/it/u=1159474645,508069395&fm=26&fmt=auto"); */
  174. }
  175. .query .ant-list-item {
  176. align-items: flex-start;
  177. }
  178. .query .ant-list-item-action {
  179. margin-left: 10px;
  180. }
  181. .ant-avatar.result > img {
  182. display: inline-block;
  183. height: auto;
  184. width: auto;
  185. }
  186. .query .ant-spin-nested-loading {
  187. max-height: 500px;
  188. overflow-y: auto;
  189. }
  190. #toolBar ::-webkit-scrollbar {
  191. width: 3px !important;
  192. }
  193. #toolBar ::-webkit-scrollbar {
  194. width: 3px !important;
  195. height: 0;
  196. }
  197. #toolBar ::-webkit-scrollbar-thumb {
  198. border-radius: 10px;
  199. -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, .3);
  200. background: #428fff;
  201. }
  202. .icon-close {
  203. cursor: pointer;
  204. position: absolute;
  205. right: 5px;
  206. top: 5px;
  207. }
  208. </style>