list.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. <template>
  2. <div class="xzlist">
  3. <div class="tdTitle">整治项目</div>
  4. <span class="clearBtn" @click="cockpit">
  5. <i class="el-icon-thumb"></i>
  6. 图斑详情查询
  7. </span>
  8. <custom-form ref="formRef" :model="pageObj" :config="formConfig">
  9. <template #type>
  10. <el-select v-model="pageObj.idleReason" placeholder="项目类型">
  11. <el-option
  12. v-for="item in reasonList"
  13. :key="item.code"
  14. :label="item.name"
  15. :value="item.name"
  16. >
  17. </el-option>
  18. </el-select>
  19. </template>
  20. <template #action>
  21. <el-button
  22. size="mini"
  23. type="primary"
  24. icon="el-icon-search"
  25. @click="searchFun"
  26. >
  27. </el-button>
  28. </template>
  29. </custom-form>
  30. <tablePage
  31. class="tablePage"
  32. :cloumn="cloumn"
  33. :table="table"
  34. :indexed="false"
  35. layout="prev, pager,next"
  36. ref="tableDialogRef"
  37. @currentChange="searchFun"
  38. >
  39. <template #mj="{ row }">
  40. {{ Number(row.crmj).toFixed(2) }}
  41. </template>
  42. <template #action="{ row }">
  43. <span class="usable" @click="detail(row)">详情</span>
  44. <span class="usable" @click="handle(row)"> 对比 </span>
  45. </template>
  46. </tablePage>
  47. </div>
  48. </template>
  49. <script>
  50. import tablePage from "@/components/mapView/tablePage.vue";
  51. import customForm from "@/components/mapView/custom-form.vue";
  52. import { GetList } from "@/api/Idleland.js";
  53. import { xzForm, TableHeader, reasonList } from "./config";
  54. import { loadGeoJSON } from "@/utils/MapHelper/help.js";
  55. let geoSources = {};
  56. export default {
  57. components: {
  58. tablePage,
  59. customForm,
  60. },
  61. props: {
  62. type: {
  63. type: String,
  64. },
  65. recordBsm: {
  66. type: String,
  67. },
  68. },
  69. data() {
  70. return {
  71. pageObj: {
  72. key: "",
  73. xzqh: "",
  74. idleReason: "",
  75. isConfirm: true,
  76. pageNum: 1,
  77. pageSize: 10,
  78. isDisposal: false,
  79. startTime: "",
  80. endTime: "",
  81. },
  82. datalist: [{}],
  83. formConfig: xzForm,
  84. cloumn: TableHeader,
  85. reasonList: reasonList,
  86. table: {
  87. data: [{}],
  88. total: 20,
  89. },
  90. now: "",
  91. tempdataLayerId: "",
  92. };
  93. },
  94. mounted() {
  95. this.reset();
  96. },
  97. methods: {
  98. cockpit() {
  99. this.$emit("cockpit");
  100. },
  101. searchFun(page = {}) {
  102. this.getTableData({
  103. ...this.pageObj,
  104. pageNum: page.pageIndex || 1,
  105. pageSize: page.size || 10,
  106. });
  107. },
  108. getTableData() {
  109. this.$emit("updateParent", "loading", true);
  110. this.removeGeoJSON();
  111. GetList(this.pageObj).then((res) => {
  112. this.$emit("updateParent", "loading", false);
  113. this.table = {
  114. ...res.data,
  115. total: res.data.count,
  116. data: res.data.list,
  117. };
  118. this.active_tableData(res.data.list);
  119. });
  120. },
  121. tableRowClassName({ row, rowIndex }) {
  122. // if (rowIndex === this.scrollTop_index) {
  123. // return "warning-row";
  124. // }
  125. // return "";
  126. },
  127. active_tableData(newVal) {
  128. newVal.forEach((res, index) => {
  129. if (res.geom || res.st_asewkt)
  130. loadGeoJSON(
  131. res.geom || res.st_asewkt,
  132. "#55A1E3",
  133. { isfly: false },
  134. (data) => {
  135. geoSources[res.id] = data;
  136. data.name = "Idleland";
  137. data.entities.values.forEach((entity) => {
  138. entity.properties = { type: "图斑上图", id: res.id };
  139. });
  140. }
  141. );
  142. });
  143. },
  144. flyTo(item) {
  145. let id = "h_" + item.id;
  146. this.tempdataLayerId = id;
  147. if (geoSources[id]) return;
  148. loadGeoJSON(
  149. item.geom || item.st_asewkt,
  150. "#ff0000",
  151. { isfly: true },
  152. (data) => {
  153. data.name = "Idleland";
  154. geoSources[id] = data;
  155. data.entities.values.forEach((entity) => {
  156. entity.properties = { type: "图斑上图", id: item.id };
  157. });
  158. }
  159. );
  160. },
  161. removeGeoJSON() {
  162. if (!window.viewer) return;
  163. viewer.entities.removeAll();
  164. viewer.dataSources.removeAll();
  165. // viewer.dataSources._dataSources.forEach((das) => {
  166. // if (das.name == "Idleland") {viewer.dataSources.remove(das);}
  167. // });
  168. },
  169. reset(xzqh) {
  170. this.pageObj = {
  171. key: "",
  172. xzqh,
  173. idleReason: "",
  174. isConfirm: this.$props.type != 0,
  175. pageNum: 1,
  176. pageSize: 10,
  177. isDisposal: this.$props.type == 2,
  178. // startTime: store.state.cockpit_date[0],
  179. // endTime: store.state.cockpit_date[1],
  180. };
  181. },
  182. detail(row) {
  183. this.flyTo(row);
  184. this.bus.$emit("handleView", row);
  185. },
  186. handle(row) {
  187. this.$emit('contrast', row);
  188. },
  189. changerdxz() {
  190. this.pageObj.isConfirm = !this.pageObj.isConfirm;
  191. this.searchFun();
  192. },
  193. },
  194. watch: {
  195. tempdataLayerId(newVal, oldVal) {
  196. if (oldVal && geoSources[oldVal]) {
  197. viewer.dataSources.remove(geoSources[oldVal]);
  198. geoSources[oldVal] = null;
  199. }
  200. },
  201. },
  202. beforeDestroy() {},
  203. };
  204. </script>
  205. <style lang="scss" scoped>
  206. .xzlist {
  207. width: 100%;
  208. height: 100%;
  209. .content {
  210. width: 100%;
  211. height: 50px;
  212. margin: 10px 0;
  213. background: #2e5a70;
  214. border-radius: 5px;
  215. padding-top: 5px;
  216. .item {
  217. width: 48%;
  218. height: 100%;
  219. display: inline-block;
  220. position: relative;
  221. text-align: center;
  222. span {
  223. font-family: "Arial Negreta", "Arial Normal", "Arial";
  224. font-weight: 700;
  225. font-style: normal;
  226. color: #68f4fb;
  227. }
  228. }
  229. }
  230. .tablePage {
  231. height: calc(100% - 120px);
  232. }
  233. .tip {
  234. color: #f56c6c;
  235. }
  236. .xztype {
  237. display: flex;
  238. margin: 5px 0;
  239. align-items: center;
  240. justify-content: space-between;
  241. span {
  242. display: inline-block;
  243. border: 1px solid #3f93f5;
  244. border-radius: 5px;
  245. padding: 0 10px;
  246. line-height: 30px;
  247. }
  248. }
  249. }
  250. </style>
  251. <style lang="scss">
  252. .xzlist {
  253. .el-col {
  254. padding-right: 0 !important;
  255. }
  256. }
  257. </style>