ComprehensiveAnalysis.vue 61 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016
  1. <template>
  2. <div class="comprehensive-analysis">
  3. <LawPopup class="comprehensive-analysis-law-popup" />
  4. <LabelCasePopup
  5. class="comprehensive-analysis-label-popup"
  6. style="left: 40%"
  7. v-if="updateCasePopupShow"
  8. ref="updateLabelRef"
  9. @close="closeLabelEvent"
  10. @save="modifyLabelEvent"
  11. />
  12. <div
  13. class="comprehensive-analysis-backbtn"
  14. @click="backEvent"
  15. v-if="$store.state.backMenu.index && $store.state.backMenu.subIndex"
  16. >
  17. <div class="left-arrow"></div>
  18. <div class="title">返回上级</div>
  19. </div>
  20. <div class="comprehensive-analysis-searchbox">
  21. <el-input placeholder="请输入地名地址" v-model="addressInput">
  22. <el-button
  23. type="primary"
  24. slot="append"
  25. icon="el-icon-search"
  26. style="vertical-align: bottom"
  27. ></el-button>
  28. </el-input>
  29. </div>
  30. <!-- 属性弹窗 -->
  31. <AttributePopup
  32. class="comprehensive-analysis-popup"
  33. v-if="attrTableShow"
  34. :boxWidth="boxWidth"
  35. :boxHeight="boxHeight"
  36. :tableType="tableType"
  37. :tableData="tableData"
  38. @close="closeEvent"
  39. />
  40. <!-- 图例 -->
  41. <Legend
  42. v-show="legendShow"
  43. class="comprehensive-analysis-legendbox"
  44. :legendData="{
  45. boxWidth: '230',
  46. boxHeight: legendHeight,
  47. menuIndex: '3',
  48. legendIcon: legendIcon,
  49. legendTitle: legendTitle,
  50. leftWidth: '30%',
  51. rightWidth: '70%',
  52. rightItemWidth: '120',
  53. }"
  54. />
  55. <!-- 开启左边面板的控制按钮 -->
  56. <div class="comprehensive-analysis-leftopenbox" v-show="leftBoxBtn">
  57. <div @click="leftPanelDisplay('show')"><div></div></div>
  58. </div>
  59. <!-- 开启右边面板的控制按钮 -->
  60. <div class="comprehensive-analysis-rightopenbox" v-show="rightBoxBtn">
  61. <div @click="rightPanelDisplay('show')"><div></div></div>
  62. </div>
  63. <!-- 左侧面板的显示与隐藏 -->
  64. <transition name="fade-left">
  65. <div class="comprehensive-analysis-left" v-show="showLeftBox">
  66. <div class="close-btnbox">
  67. <div @click="leftPanelDisplay('hide')"><div></div></div>
  68. </div>
  69. <div class="control-container">
  70. <el-input
  71. class="control-container-input"
  72. v-model="filterText"
  73. placeholder="请输入搜索内容"
  74. ></el-input>
  75. <NewSelect
  76. class="control-container-select"
  77. :placeholder="'请选择街镇'"
  78. v-model="townSelectVal"
  79. :options="townOptions"
  80. :value="townSelectVal"
  81. @selectEvent="changeTownEvent"
  82. />
  83. <el-tooltip
  84. effect="light"
  85. :content="isLeftLock ? '解锁面板' : '锁定面板'"
  86. placement="bottom-end"
  87. >
  88. <div
  89. :class="{ 'lock-style': isLeftLock }"
  90. class="control-container-pin-btn"
  91. @click="leftPanelLock"
  92. ></div>
  93. </el-tooltip>
  94. </div>
  95. <div class="contant-container">
  96. <div class="contant-container-innerbox">
  97. <el-tree
  98. :data="modelData"
  99. :props="defaultProps"
  100. @check-change="handleCheckChange"
  101. node-key="id"
  102. ref="tree"
  103. :filter-node-method="filterNode"
  104. :default-expanded-keys="expandedKeys"
  105. >
  106. <span class="custom-tree-node" slot-scope="{ node }">
  107. <template
  108. v-if="
  109. node.data.mainType === '所有图层' ||
  110. node.data.mainType === '我的模型' ||
  111. node.data.mainType === '预设模型'
  112. "
  113. >
  114. <el-checkbox v-model="node.checked" style="position: relative"
  115. >{{ node.label
  116. }}<span
  117. ><el-button
  118. size="normal"
  119. type="text"
  120. icon="el-icon-location"
  121. @click="locateEvent(node)"
  122. style="position: absolute; right: -30px; top: -12px"
  123. ></el-button
  124. ></span>
  125. <span style="position: absolute; right: -80px; top: -9px">
  126. <el-button
  127. v-if="node.parent.label === '我的模型'"
  128. size="small"
  129. type="text"
  130. icon="el-icon-edit"
  131. @click="handleUpdate(node)"
  132. ></el-button>
  133. <el-button
  134. v-if="node.parent.label === '我的模型'"
  135. size="small"
  136. type="text"
  137. icon="el-icon-delete"
  138. @click="handleDelete(node)"
  139. ></el-button>
  140. </span>
  141. </el-checkbox>
  142. </template>
  143. <template v-else>
  144. <div
  145. :class="{
  146. 'tree-arrow': !node.expanded,
  147. 'tree-arrow-expanded': node.expanded,
  148. }"
  149. ></div>
  150. <span>{{ node.label }}</span>
  151. </template>
  152. </span>
  153. </el-tree>
  154. </div>
  155. </div>
  156. </div>
  157. </transition>
  158. <!-- 右侧面板的显示与隐藏 -->
  159. <transition name="fade-right">
  160. <div class="comprehensive-analysis-right" v-show="showRightBox">
  161. <div class="close-btnbox">
  162. <div @click="rightPanelDisplay('hide')"><div></div></div>
  163. </div>
  164. <div class="control-container">
  165. <el-tooltip
  166. effect="light"
  167. :content="isRightLock ? '解锁面板' : '锁定面板'"
  168. placement="bottom-start"
  169. >
  170. <div
  171. :class="{ 'lock-style': isRightLock }"
  172. @click="rightPanelLock"
  173. ></div>
  174. </el-tooltip>
  175. </div>
  176. <div class="contant-container">
  177. <div class="contant-container-innerbox">
  178. <el-collapse v-model="activeNames">
  179. <el-collapse-item
  180. v-for="key in Object.keys(originalData)"
  181. :key="key"
  182. :title="key"
  183. :name="key"
  184. >
  185. <div
  186. class="panel-list-item"
  187. v-for="(v, i) in originalData[key]"
  188. :key="v.id"
  189. @click.stop="listItemClick('default', v)"
  190. >
  191. <!-- {{ v.column_name + "_" + (i + 1) }} -->
  192. {{ v.title + "_" + (i + 1) }}
  193. </div>
  194. <div class="panel-footer" @mouseenter="mouseenter(key)">
  195. <Pagination :paginationData="paginationData" />
  196. </div>
  197. </el-collapse-item>
  198. <el-collapse-item name="myLabel">
  199. <template slot="title">
  200. 我的标记
  201. <div class="all-icon">
  202. <div
  203. class="all-icon-locate"
  204. @click.stop="labelAllLocate"
  205. ></div>
  206. <div
  207. class="all-icon-visible"
  208. :class="{ click: labelAllVisibleChecked }"
  209. @click.stop="labelAllVisible"
  210. ></div>
  211. </div>
  212. </template>
  213. <div
  214. class="panel-list-item"
  215. v-for="item in rightLabelData"
  216. :key="item.id"
  217. >
  218. <div @click="listItemClick('new', item)">
  219. {{ item.name }}
  220. </div>
  221. <span class="operation-icon"
  222. ><el-button
  223. size="normal"
  224. type="text"
  225. icon="el-icon-edit"
  226. @click="updateLabel(item)"
  227. ></el-button
  228. ><el-button
  229. size="normal"
  230. type="text"
  231. icon="el-icon-delete"
  232. @click="deleteLabel(item.id)"
  233. ></el-button
  234. ></span>
  235. <span
  236. class="visible-icon"
  237. :class="{ click: item.geometryChecked }"
  238. @click="controlLabel(item)"
  239. ></span>
  240. </div>
  241. </el-collapse-item>
  242. </el-collapse>
  243. </div>
  244. </div>
  245. </div>
  246. </transition>
  247. </div>
  248. </template>
  249. <script>
  250. // 综合分析 this.$store.state.leftMenuTitle
  251. import MenuCard from "@/components/layout/MenuCard.vue";
  252. import Legend from "@/components/map/Legend.vue";
  253. import Pagination from "@/components/common/Pagination.vue";
  254. import NewSelect from "@/components/common/NewSelect.vue";
  255. import publicFun from "@/utils/publicFunction.js";
  256. import AttributePopup from "@/components/popup/AttributePopup.vue";
  257. import LabelCasePopup from "@/components/popup/LabelCasePopup.vue";
  258. import LawPopup from "@/components/popup/LawPopup.vue";
  259. import { nextTick } from "vue";
  260. export default {
  261. name: "ComprehensiveAnalysis",
  262. components: {
  263. MenuCard,
  264. Legend,
  265. AttributePopup,
  266. LawPopup,
  267. LabelCasePopup,
  268. Pagination,
  269. NewSelect,
  270. },
  271. data() {
  272. return {
  273. expandedKeys: [],
  274. myModelIdMap: new Map(),
  275. townSelectTreeMap: new Map(),
  276. labelAllVisibleChecked: true,
  277. townSelectVal: "",
  278. townOptions: [],
  279. enteredPanelId: "",
  280. enteredColumnId: "",
  281. enteredMainType: "",
  282. enteredSourceType: "",
  283. uploadBaseUrl: "/dms",
  284. classTextToIndex: {},
  285. addressInput: "",
  286. legendShow: false,
  287. tableType: "normal",
  288. tableData: [],
  289. legendHeight: "0",
  290. boxWidth: "600",
  291. boxHeight: "400",
  292. activeNames: ["myLabel"],
  293. rightPanelTitle: "",
  294. rightPanelDataMap: new Map(),
  295. originalData: {},
  296. rightLabelData: [],
  297. showLeftBox: true,
  298. showRightBox: true,
  299. leftBoxBtn: false,
  300. rightBoxBtn: false,
  301. modelData: [],
  302. defaultProps: {
  303. children: "children",
  304. label: "label",
  305. },
  306. legendIcon: [],
  307. legendTitle: [],
  308. // 我的模型相关数据
  309. myModel: null,
  310. filterText: "",
  311. // 存放对应图层的坐标
  312. treeCoordMap: new Map(),
  313. layerIdMap: new Map(),
  314. randomColor: new Map(),
  315. isLeftLock: true,
  316. isRightLock: true,
  317. currentPage: 1,
  318. currentPageSize: 10,
  319. paginationData: {
  320. pageSize: 10,
  321. pagerCount: 5,
  322. currentPage: 1,
  323. pageSizes: [5, 10, 20, 30],
  324. total: 50,
  325. currentChange: (val) => {
  326. let columnId = this.enteredColumnId;
  327. let panelId = this.enteredPanelId;
  328. let mainType = this.enteredMainType;
  329. let sourceType = this.enteredSourceType;
  330. this.changeSingleLayer(val, columnId, panelId, mainType, sourceType);
  331. },
  332. handleSizeChange: (val) => {
  333. this.handleSizeChange(val);
  334. },
  335. },
  336. };
  337. },
  338. computed: {
  339. getCustomModel() {
  340. return this.$store.state.customModelsArr;
  341. },
  342. getLeftMenuTitle() {
  343. return this.$store.state.leftMenuTitle;
  344. },
  345. getMyLabelData() {
  346. return this.$store.getters.myLabelPointsArr;
  347. },
  348. getMyPoints() {
  349. return map2DViewer.myLabels;
  350. },
  351. attrTableShow: {
  352. get() {
  353. return this.$store.state.attrTableShow;
  354. },
  355. set(val) {
  356. this.$store.state.attrTableShow = val;
  357. },
  358. },
  359. updateCasePopupShow: {
  360. get() {
  361. return this.$store.state.updateCasePopupShow;
  362. },
  363. set(val) {
  364. this.$store.state.updateCasePopupShow = val;
  365. },
  366. },
  367. uploadDataArr() {
  368. return uploadDataIdArr;
  369. },
  370. },
  371. watch: {
  372. // 控制全选的显示或隐藏
  373. labelAllVisibleChecked(val) {
  374. if (this.rightLabelData.length > 0) {
  375. this.rightLabelData.forEach((item) => {
  376. this.controlLabel(item);
  377. });
  378. if (val) {
  379. this.labelAllLocate();
  380. }
  381. }
  382. },
  383. "$store.state.navSelect": {
  384. handler(val) {
  385. if (val.index === "1" || val.index === "2") {
  386. this.clearAllData();
  387. this.labelAllVisibleChecked = false;
  388. }
  389. if (val.index === "3") {
  390. // 如果没有初始化设置
  391. if (!map2DViewer.groups["我的标记图层组"]) {
  392. this.getUserMarkers();
  393. }
  394. this.labelAllVisibleChecked = true;
  395. // 进入该页面后监听地图移动事件
  396. map2DViewer.map.on("move", (e) => {
  397. if (!this.isLeftLock) {
  398. this.showLeftBox = false;
  399. this.leftBoxBtn = true;
  400. }
  401. if (!this.isRightLock) {
  402. this.showRightBox = false;
  403. this.rightBoxBtn = true;
  404. }
  405. });
  406. }
  407. },
  408. deep: true,
  409. },
  410. uploadDataArr: {
  411. handler(val) {
  412. if (val.length > 0) {
  413. // console.log(val, "uploadDataIdArr");
  414. }
  415. },
  416. immediate: true,
  417. deep: true,
  418. },
  419. getLeftMenuTitle: {
  420. handler(val) {
  421. this.$nextTick(() => {
  422. // 从疑点筛查进入综合分析页面默认勾选
  423. if (defaultModelNameMap.has(val)) {
  424. // console.log(val, "678");
  425. // 设置默认勾选项
  426. this.$refs.tree.setCheckedKeys([defaultModelNameMap.get(val)]);
  427. }
  428. });
  429. },
  430. immediate: true,
  431. },
  432. legendTitle(val) {
  433. // console.log(val, "监听当前图例item数量");
  434. if (val.length === 0) {
  435. this.legendShow = false;
  436. }
  437. if (val.length > 0 && val.length <= 10) {
  438. this.legendShow = true;
  439. this.legendHeight = 50 * val.length + 50 + "";
  440. }
  441. },
  442. filterText(val) {
  443. this.$refs.tree.filter(val);
  444. },
  445. getCustomModel: {
  446. handler(val) {
  447. // console.log(val, "目前存在的自定义模型");
  448. this.getMyModelData();
  449. },
  450. deep: true,
  451. },
  452. getMyLabelData: {
  453. handler(val) {
  454. // console.log("标记点保存事件成功,允许开始定位");
  455. this.rightLabelData = [];
  456. if (val.length > 0) {
  457. let _myLabelPointsItem = {};
  458. let _myLabelPointsItemState = false;
  459. this.rightLabelData = val.map((v, i) => {
  460. let data = JSON.parse(v.geojson);
  461. if (
  462. sessionStorage.getItem("myLabelPointsId") &&
  463. sessionStorage.getItem("myLabelPointsId") == v.id
  464. ) {
  465. sessionStorage.removeItem("myLabelPointsId");
  466. _myLabelPointsItemState = true;
  467. _myLabelPointsItem = {
  468. id: v.id,
  469. name: data.properties.name,
  470. coord: data.geometry.coordinates[0][0],
  471. type: data.properties.title,
  472. des: data.properties.desc,
  473. geojson: v.geojson,
  474. geometryChecked: false,
  475. featureType: data.properties.featureType,
  476. };
  477. return _myLabelPointsItem;
  478. }
  479. return {
  480. id: v.id,
  481. name: data.properties.name,
  482. coord: data.geometry.coordinates[0][0],
  483. type: data.properties.title,
  484. des: data.properties.desc,
  485. geojson: v.geojson,
  486. geometryChecked: false,
  487. featureType: data.properties.featureType,
  488. };
  489. });
  490. if (_myLabelPointsItemState) {
  491. setTimeout(() => {
  492. this.controlLabel(_myLabelPointsItem);
  493. if (map2DViewer.groups["我的标记图层组"]) {
  494. map2DViewer.map.fitBounds(
  495. map2DViewer.groups["我的标记图层组"].getBounds()
  496. );
  497. }
  498. }, 300);
  499. } else {
  500. setTimeout(() => {
  501. if (this.rightLabelData.length > 0) {
  502. this.rightLabelData.forEach((item) => {
  503. this.controlLabel(item);
  504. });
  505. if (map2DViewer.groups["我的标记图层组"]) {
  506. map2DViewer.map.fitBounds(
  507. map2DViewer.groups["我的标记图层组"].getBounds()
  508. );
  509. }
  510. }
  511. }, 300);
  512. }
  513. // console.log(this.rightLabelData, "rightLabelData");
  514. }
  515. },
  516. deep: true,
  517. // immediate: true,
  518. },
  519. },
  520. created() {
  521. this.townOptions = [];
  522. this.getColumnList();
  523. this.classDictQuery("0", "c_task_type", "任务类型");
  524. this.classDictQuery("0", "浦东新区行政区划", "浦东新区行政区划");
  525. },
  526. mounted() {
  527. // 获取我的标记数据
  528. if (this.$store.state.navSelect.index === "3") {
  529. this.getUserMarkers();
  530. map2DViewer.map.on("move", (e) => {
  531. if (!this.isLeftLock) {
  532. this.showLeftBox = false;
  533. this.leftBoxBtn = true;
  534. }
  535. if (!this.isRightLock) {
  536. this.showRightBox = false;
  537. this.rightBoxBtn = true;
  538. }
  539. });
  540. this.$bus.$off("viewDetailsPopup");
  541. this.$bus.$on("viewDetailsPopup", (data) => {
  542. this.viewDetailsPopup(data);
  543. });
  544. }
  545. },
  546. // beforeDestroy() {
  547. // this.clearAllData();
  548. // },
  549. methods: {
  550. // 勾选镇时默认展开当前镇
  551. changeTownEvent(val) {
  552. if (this.townSelectTreeMap.has(val)) {
  553. this.expandedKeys = [];
  554. this.expandedKeys.push(this.townSelectTreeMap.get(val).id);
  555. console.log(this.expandedKeys);
  556. }
  557. },
  558. // 清除页面所有数据
  559. clearAllData() {
  560. // uploadDataIdArr = [];
  561. // this.treeCoordMap.clear();
  562. map2DViewer.map.off("move");
  563. // 所有图层或预设模型全部删除
  564. if (Object.getOwnPropertyNames(map2DViewer.analysisGroups).length > 0) {
  565. for (let group in map2DViewer.analysisGroups) {
  566. // 仅从地图上删除对应图层组
  567. this.$store.state.mapMethodsCollection
  568. .get("RENDER")
  569. .deleteGroupFromMap(group);
  570. map2DViewer.analysisGroups[group].remove();
  571. }
  572. this.$refs.tree.setCheckedKeys([]);
  573. }
  574. map2DViewer.analysisGroups = {};
  575. map2DViewer.polygons = {};
  576. this.attrTableShow = false;
  577. this.updateCasePopupShow = false;
  578. map2DViewer.map.closePopup();
  579. },
  580. labelAllLocate() {
  581. if (map2DViewer.groups["我的标记图层组"]) {
  582. map2DViewer.map.fitBounds(
  583. map2DViewer.groups["我的标记图层组"].getBounds()
  584. );
  585. }
  586. },
  587. labelAllVisible() {
  588. this.labelAllVisibleChecked = !this.labelAllVisibleChecked;
  589. },
  590. mouseenter(val) {
  591. if (this.rightPanelDataMap.has(val)) {
  592. // 方便获取
  593. this.enteredPanelId = val;
  594. this.enteredColumnId = this.rightPanelDataMap.get(val).id;
  595. this.enteredMainType = this.rightPanelDataMap.get(val).mainType;
  596. this.enteredSourceType = this.rightPanelDataMap.get(val).sourceType;
  597. }
  598. },
  599. handleSizeChange(val) {
  600. console.log(`每页 ${val} 条`);
  601. this.currentPageSize = val;
  602. this.changeSingleLayer(
  603. this.currentPage,
  604. this.enteredColumnId,
  605. this.enteredPanelId,
  606. this.enteredMainType,
  607. this.enteredColumnId
  608. );
  609. },
  610. getTableData() {},
  611. /**
  612. * 获取图层信息 -- 所有模型和预设模型
  613. * @columnId
  614. * @id label_columnId
  615. * @mainType 所有图层/预设模型
  616. * @sourceType 土地资源/林地资源/生态资源/水资源/全部
  617. */
  618. displaySingleLayer(columnId, id, mainType, sourceType) {
  619. if (id !== "永久基本农田_50") {
  620. // console.log(columnId, "columnId");
  621. let layerParams = new FormData();
  622. layerParams = {
  623. columnId: columnId,
  624. states: "0,1,2,3",
  625. pageSize: 10,
  626. page: 0,
  627. };
  628. this.$Post(this.urlsCollection.selectContentList, layerParams).then(
  629. (res) => {
  630. if (res.code === 202 && res.content === "数据不存在") {
  631. this.$message.info("暂无数据!");
  632. }
  633. if (res.code === 200 && res.content.data.length > 0) {
  634. this.paginationData.currentPage = 1;
  635. this.paginationData.total = res.content.count;
  636. let uniqueId = id;
  637. map2DViewer.analysisGroups[uniqueId] = L.featureGroup();
  638. map2DViewer.analysisGroups[uniqueId].addTo(map2DViewer.map);
  639. this.legendTitle.push({
  640. name: uniqueId,
  641. info: uniqueId,
  642. });
  643. this.legendIcon.push({
  644. name: uniqueId,
  645. background: "transparent",
  646. border: `1px solid ${this.randomColor.get(uniqueId)}`,
  647. });
  648. if (!this.$store.state.selectSelectDataMap["singlePolygon"]) {
  649. this.$store.state.selectSelectDataMap["singlePolygon"] = [];
  650. }
  651. this.layerIdMap.set(uniqueId, uniqueId);
  652. this.originalData[uniqueId] = res.content.data.map((ele) => {
  653. let cid = ele.id;
  654. let geometry = ele.c_content;
  655. // 激活当前展开面板
  656. this.activeNames = ["myLabel", uniqueId];
  657. this.$store.state.mapMethodsCollection
  658. .get("RENDER")
  659. .addSinglePolygon(
  660. geometry,
  661. cid,
  662. this.randomColor.get(uniqueId),
  663. uniqueId,
  664. mainType,
  665. sourceType
  666. );
  667. return {
  668. id: ele.id,
  669. // "垃圾堆放点"
  670. column_name: ele.column_name,
  671. // 是否疑点
  672. c_boolean: ele.c_boolean ? "是" : "否",
  673. // 行政区划
  674. c_xzqh: ele.c_xzqh,
  675. // 空间信息
  676. c_content: ele.c_content,
  677. // 疑点修改时间
  678. c_date_time: ele.c_date_time,
  679. // 修改人员名称
  680. // c_editor_name: ele.c_editor_name,
  681. // 标题
  682. title: ele.title,
  683. column_id: ele.column_id,
  684. content: ele.content,
  685. secret_level: ele.secret_level,
  686. };
  687. });
  688. }
  689. }
  690. );
  691. }
  692. },
  693. /**
  694. * 切换页时改变图层数据
  695. * @val 当前页
  696. * @columnId
  697. * @id label_columnId
  698. * @mainType 所有图层/预设模型
  699. * @sourceType 土地资源,水资源,林地资源,全部
  700. */
  701. changeSingleLayer(val, columnId, id, mainType, sourceType) {
  702. let layerParams = new FormData();
  703. layerParams = {
  704. columnId: columnId,
  705. states: "0,1,2,3",
  706. pageSize: 10,
  707. page: val - 1,
  708. };
  709. this.$Post(this.urlsCollection.selectContentList, layerParams).then(
  710. (res) => {
  711. // console.log(res, "changeSingeLayer");
  712. if (res.code === 200 && res.content.data.length > 0) {
  713. this.paginationData.currentPage = val;
  714. this.paginationData.total = res.content.count;
  715. let uniqueId = id;
  716. if (map2DViewer.analysisGroups[uniqueId]) {
  717. this.layerIdMap.set(uniqueId, uniqueId);
  718. map2DViewer.analysisGroups[uniqueId].clearLayers();
  719. this.originalData[uniqueId] = res.content.data.map((ele) => {
  720. let cid = ele.id;
  721. let geometry = ele.c_content;
  722. this.activeNames = ["myLabel", uniqueId];
  723. this.$store.state.mapMethodsCollection
  724. .get("RENDER")
  725. .addSinglePolygon(
  726. geometry,
  727. cid,
  728. this.randomColor.get(uniqueId),
  729. uniqueId,
  730. mainType,
  731. sourceType
  732. );
  733. return {
  734. id: ele.id,
  735. // "垃圾堆放点"
  736. column_name: ele.column_name,
  737. // 是否疑点
  738. c_boolean: ele.c_boolean ? "是" : "否",
  739. // 行政区划
  740. c_xzqh: ele.c_xzqh,
  741. // 空间信息
  742. c_content: ele.c_content,
  743. // 疑点修改时间
  744. c_date_time: ele.c_date_time,
  745. // 修改人员名称
  746. // c_editor_name: ele.c_editor_name,
  747. // 标题
  748. title: ele.title,
  749. column_id: ele.column_id,
  750. content: ele.content,
  751. secret_level: ele.secret_level,
  752. };
  753. });
  754. }
  755. }
  756. }
  757. );
  758. },
  759. // 数据字典查询 -- 根据内容获取对应的index
  760. // this.classTextToIndex["任务类型"]
  761. classDictQuery(type, cName, keyName) {
  762. let params = new FormData();
  763. params = {
  764. type: type,
  765. cName: cName,
  766. };
  767. this.$Post(this.urlsCollection.selectByCNameAType, params).then((res) => {
  768. if (res.code === 200 && res.content.length > 0) {
  769. this.classTextToIndex[keyName] = new Map();
  770. res.content.forEach((v) => {
  771. this.classTextToIndex[keyName].set(v.name, v.index + "");
  772. });
  773. if (keyName === "浦东新区行政区划") {
  774. this.classTextToIndex[keyName].forEach((v, i) => {
  775. this.townOptions.push({
  776. value: i,
  777. label: i,
  778. });
  779. });
  780. }
  781. }
  782. });
  783. },
  784. // 获取分级栏目列表
  785. getColumnList() {
  786. this.modelData = [];
  787. this.$Post(this.urlsCollection.getColumnList).then((res) => {
  788. if (res.code === 200 && res.content.length > 0) {
  789. let data = res.content.map((item1) => {
  790. if (item1.title === "所有图层" && item1.columnList.length > 0) {
  791. return {
  792. id: `${item1.title}_${item1.id}`,
  793. label: item1.title,
  794. // 镇
  795. children:
  796. !item1.columnList || item1.columnList.length === 0
  797. ? []
  798. : item1.columnList.map((item2) => {
  799. this.townSelectTreeMap.set(item2.title, {
  800. id: `${item2.title}_${item2.id}`,
  801. });
  802. return {
  803. id: `${item2.title}_${item2.id}`,
  804. label: item2.title,
  805. // 水资源,土地资源,林地资源
  806. children:
  807. !item2.columnList || item2.columnList.length === 0
  808. ? []
  809. : item2.columnList.map((item3) => {
  810. return {
  811. id: `${item3.title}_${item3.id}`,
  812. label: item3.title,
  813. tag: item3.tag,
  814. children:
  815. !item3.columnList ||
  816. item3.columnList.length === 0
  817. ? []
  818. : item3.columnList.map((item4) => {
  819. this.rightPanelDataMap.set(
  820. `${item4.title}_${item4.id}`,
  821. {
  822. id: item4.id,
  823. mainType: item1.title,
  824. sourceType: item3.title,
  825. }
  826. );
  827. this.randomColor.set(
  828. `${item4.title}_${item4.id}`,
  829. publicFun.getRandomColor()
  830. );
  831. return {
  832. id: `${item4.title}_${item4.id}`,
  833. label: item4.title,
  834. children: [],
  835. columnId: item4.id,
  836. townId: item2.id,
  837. townType: item2.title,
  838. sourceId: item3.id,
  839. sourceType: item3.title,
  840. mainType: item1.title,
  841. color: publicFun.getRandomColor(),
  842. };
  843. }),
  844. };
  845. }),
  846. };
  847. }),
  848. };
  849. }
  850. if (item1.title === "预设模型" && item1.columnList.length > 0) {
  851. return {
  852. id: `${item1.title}_${item1.id}`,
  853. label: item1.title,
  854. children:
  855. item1.columnList.length === 0
  856. ? []
  857. : item1.columnList.map((item2) => {
  858. return {
  859. id: `${item2.title}_${item2.id}`,
  860. label: item2.title,
  861. children:
  862. item2.columnList.length === 0
  863. ? []
  864. : item2.columnList.map((item3) => {
  865. this.rightPanelDataMap.set(
  866. `${item3.title}_${item3.id}`,
  867. {
  868. id: item3.id,
  869. mainType: item1.title,
  870. sourceType: item2.title,
  871. }
  872. );
  873. this.randomColor.set(
  874. `${item3.title}_${item3.id}`,
  875. publicFun.getRandomColor()
  876. );
  877. defaultModelNameMap.set(
  878. item3.label,
  879. `${item3.title}_${item3.id}`
  880. );
  881. return {
  882. id: `${item3.title}_${item3.id}`,
  883. label: item3.title,
  884. sourceType: item2.title,
  885. mainType: item1.title,
  886. columnId: item3.id,
  887. children: [],
  888. };
  889. }),
  890. };
  891. }),
  892. };
  893. }
  894. if (item1.title === "我的模型") {
  895. this.myModelIdMap.set(
  896. `${item1.title}_${item1.id}`,
  897. `${item1.title}_${item1.id}`
  898. );
  899. return {
  900. id: `${item1.title}_${item1.id}`,
  901. children: [],
  902. label: item1.title,
  903. };
  904. }
  905. });
  906. data.forEach((v) => {
  907. if (v) {
  908. this.modelData.unshift(v);
  909. }
  910. });
  911. this.modelData.push({
  912. id: "我的图层",
  913. label: "我的图层",
  914. children: [],
  915. });
  916. this.getMyModelData();
  917. }
  918. });
  919. },
  920. getMyModelData() {
  921. let params = new FormData();
  922. params = {
  923. columnId: 49,
  924. states: "0,1,2,3",
  925. pageSize: 10,
  926. page: 0,
  927. };
  928. this.$Post(this.urlsCollection.selectContentList, params)
  929. .then((res) => {
  930. // console.log(res, "判断是否有");
  931. if (res.code === 200 && res.content.data.length > 0) {
  932. let children = res.content.data.map((ele) => {
  933. customModelIdMap.set(ele.title, {
  934. column_id: ele.column_id,
  935. id: ele.id,
  936. });
  937. return {
  938. id: ele.id,
  939. label: ele.title,
  940. children: [],
  941. column_id: ele.column_id,
  942. model_name: ele.model_name,
  943. model_id: ele.model_id,
  944. state: ele.state,
  945. mainType: "我的模型",
  946. c_bind_layer: ele.c_bind_layer,
  947. c_layer_name: ele.c_layer_name,
  948. c_dzfx_file: ele.c_dzfx_file || "",
  949. };
  950. });
  951. if (this.modelData.length > 0) {
  952. this.modelData.forEach((ele) => {
  953. if (ele.label == "我的模型") {
  954. ele.children = children;
  955. }
  956. });
  957. }
  958. }
  959. })
  960. .catch((err) => {
  961. console.log(err, "getMyModelData");
  962. });
  963. },
  964. // 调用我的标记接口
  965. getUserMarkers() {
  966. if (localStorage.getItem("USER_ID")) {
  967. let paramData = new FormData();
  968. paramData = {
  969. userId: Number(localStorage.getItem("USER_ID")),
  970. sourceId: 0,
  971. pageSize: 10,
  972. };
  973. if (!map2DViewer.groups["我的标记图层组"]) {
  974. map2DViewer.groups["我的标记图层组"] = L.featureGroup();
  975. map2DViewer.groups["我的标记图层组"].addTo(map2DViewer.map);
  976. }
  977. this.$Post(this.urlsCollection.selectByUser, paramData).then((res) => {
  978. if (res.code === 200 && res.content.length >= 1) {
  979. this.$store.state.myLabelPointsArr = [];
  980. this.$store.state.myLabelPointsArr = res.content.map((v) => {
  981. let data = JSON.parse(v.geojson);
  982. let name = data.properties.name;
  983. myLabelNameMap.set(name, v.geojson);
  984. return {
  985. id: v.id,
  986. geojson: v.geojson,
  987. type: v.type,
  988. };
  989. });
  990. }
  991. // res.content 返回数据为空
  992. if (res.code === 205) {
  993. this.$store.state.myLabelPointsArr = [];
  994. }
  995. });
  996. }
  997. },
  998. // 回退事件
  999. backEvent() {
  1000. if (
  1001. this.$store.state.backMenu.index &&
  1002. this.$store.state.backMenu.subIndex
  1003. ) {
  1004. this.$store.commit("changeNavSelect", {
  1005. index: this.$store.state.backMenu.index,
  1006. subIndex: this.$store.state.backMenu.subIndex,
  1007. name: this.$store.state.backMenu.name
  1008. ? this.$store.state.backMenu.name
  1009. : "",
  1010. });
  1011. }
  1012. },
  1013. // 左侧面板的显示与隐藏
  1014. leftPanelDisplay(val) {
  1015. if (val === "show") {
  1016. this.showLeftBox = true;
  1017. this.leftBoxBtn = false;
  1018. }
  1019. if (val === "hide") {
  1020. this.showLeftBox = false;
  1021. this.leftBoxBtn = true;
  1022. }
  1023. },
  1024. // 右侧面板的显示与隐藏
  1025. rightPanelDisplay(val) {
  1026. if (val === "show") {
  1027. this.showRightBox = true;
  1028. this.rightBoxBtn = false;
  1029. }
  1030. if (val === "hide") {
  1031. this.showRightBox = false;
  1032. this.rightBoxBtn = true;
  1033. }
  1034. },
  1035. leftPanelLock() {
  1036. this.isLeftLock = !this.isLeftLock;
  1037. },
  1038. rightPanelLock() {
  1039. this.isRightLock = !this.isRightLock;
  1040. },
  1041. // 节点过滤事件
  1042. filterNode(value, data) {
  1043. if (!value) return true;
  1044. return data.label.indexOf(value) !== -1;
  1045. },
  1046. locateEvent(node) {
  1047. if (this.layerIdMap.has(node.data.id)) {
  1048. let layer = this.layerIdMap.get(node.data.id);
  1049. // console.log(layer, "layer");
  1050. map2DViewer.map.fitBounds(
  1051. map2DViewer.analysisGroups[node.data.id].getBounds()
  1052. );
  1053. }
  1054. },
  1055. handleUpdate(node) {
  1056. this.$bus.$emit("updateModel", node);
  1057. },
  1058. handleDelete(node) {
  1059. // debugger;
  1060. // console.log(node, "删除节点");
  1061. let deleteParams = {
  1062. id: customModelIdMap.get(node.data.label).id,
  1063. columnId: 49,
  1064. state: 4,
  1065. };
  1066. this.$Post(this.urlsCollection.updateAudit, deleteParams).then((res) => {
  1067. if (res.code === 200) {
  1068. this.$message.info("模型已删除!");
  1069. this.$store.state.customModelsArr =
  1070. this.$store.state.customModelsArr =
  1071. this.$store.state.customModelsArr.filter((v) => {
  1072. return v.name !== node.data.label;
  1073. });
  1074. // this.getMyModelData();
  1075. }
  1076. });
  1077. },
  1078. // 节点change事件
  1079. handleCheckChange(data, checked) {
  1080. if (data.mainType && data.mainType !== "我的模型") {
  1081. if (checked) {
  1082. this.showRightBox = true;
  1083. // 第一级菜单是所有图层
  1084. if (data.mainType === "所有图层") {
  1085. this.$store.state.treeDataCollection.set(data.id, {
  1086. // mainType: data.mainType,
  1087. townId: data.townId,
  1088. townType: data.townType,
  1089. sourceId: data.sourceId,
  1090. sourceType: data.sourceType,
  1091. layerId: data.id,
  1092. layerName: data.label,
  1093. });
  1094. this.rightPanelTitle = data.id;
  1095. let searchParam = [];
  1096. let targetTown = this.classTextToIndex["浦东新区行政区划"].get(
  1097. data.townType
  1098. );
  1099. let targetType = this.classTextToIndex["任务类型"].get(
  1100. data.sourceType
  1101. );
  1102. let paramUser = {
  1103. field: "c_user_id",
  1104. searchType: "1",
  1105. content: {
  1106. value: localStorage.getItem("USER_ID"),
  1107. },
  1108. };
  1109. searchParam.push(paramUser);
  1110. let paramTown = {
  1111. field: "c_area_code",
  1112. searchType: "1",
  1113. content: {
  1114. value: targetTown,
  1115. },
  1116. };
  1117. searchParam.push(paramTown);
  1118. let paramType = {
  1119. field: "c_task_type",
  1120. searchType: "1",
  1121. content: {
  1122. value: targetType,
  1123. },
  1124. };
  1125. searchParam.push(paramType);
  1126. let params = new FormData();
  1127. params = {
  1128. columnId: 48,
  1129. states: "2,3",
  1130. pageSize: 10,
  1131. page: 0,
  1132. search: JSON.stringify(searchParam),
  1133. };
  1134. this.$Post(this.urlsCollection.selectContentList, params).then(
  1135. (res) => {
  1136. // debugger;
  1137. if (res.code === 202 && res.content === "数据不存在") {
  1138. this.$message.info("当前用户无权限!");
  1139. layerAuthorityMap.set(data.id, "无权限");
  1140. }
  1141. if (res.code === 200 && res.content.data.length > 0) {
  1142. layerAuthorityMap.set(data.id, "有权限");
  1143. this.displaySingleLayer(
  1144. data.columnId,
  1145. data.id,
  1146. data.mainType,
  1147. data.sourceType
  1148. );
  1149. }
  1150. }
  1151. );
  1152. }
  1153. // 第一级菜单是预设模型
  1154. if (data.mainType === "预设模型") {
  1155. layerAuthorityMap.set(data.id, "有权限");
  1156. this.rightPanelTitle = data.id;
  1157. this.displaySingleLayer(
  1158. data.columnId,
  1159. data.id,
  1160. data.mainType,
  1161. data.sourceType
  1162. );
  1163. }
  1164. } else {
  1165. if (this.$store.state.selectSelectDataMap["singlePolygon"][data.id]) {
  1166. delete this.$store.state.selectSelectDataMap["singlePolygon"][
  1167. data.id
  1168. ];
  1169. }
  1170. delete this.originalData[data.id];
  1171. map2DViewer.map.closePopup();
  1172. // 移除图例
  1173. if (this.legendTitle.length > 0) {
  1174. this.legendTitle = this.legendTitle.filter((v) => {
  1175. return v.name !== data.id;
  1176. });
  1177. this.legendIcon = this.legendIcon.filter((v) => {
  1178. return v.name !== data.id;
  1179. });
  1180. }
  1181. this.layerIdMap.has(data.id) && this.layerIdMap.delete(data.id);
  1182. //关联自定义模型
  1183. this.$store.state.treeDataCollection.has(data.id) &&
  1184. this.$store.state.treeDataCollection.delete(data.id);
  1185. // 只激活我的标记
  1186. this.activeNames = ["myLabel"];
  1187. this.$store.state.mapMethodsCollection
  1188. .get("RENDER")
  1189. .deleteGroupFromMap(data.id);
  1190. }
  1191. }
  1192. // 第一级菜单是我的模型
  1193. if (data.mainType && data.mainType === "我的模型") {
  1194. // 显示叠置分析的数据
  1195. checked ? this.displayMyModelData(data) : this.deleteMyModelData(data);
  1196. }
  1197. },
  1198. displayMyModelData(data) {
  1199. debugger;
  1200. // 如果有叠置分析文件 -- 呈现叠置分析内容
  1201. if (data.c_dzfx_file) {
  1202. debugger;
  1203. this.$Get(this.uploadBaseUrl + data.c_dzfx_file, "").then(
  1204. (response) => {
  1205. if (response.features.length > 0) {
  1206. response.features.forEach((v) => {
  1207. let geojson = publicFun.standardGeojson(v.geometry.coordinates);
  1208. // console.log(geojson, "geojson")
  1209. this.readGeojson(geojson, data.id);
  1210. });
  1211. }
  1212. }
  1213. );
  1214. } else {
  1215. let params = new FormData();
  1216. params = {
  1217. modelId: data.id,
  1218. userId: localStorage.getItem("USER_ID"),
  1219. };
  1220. // 调用我的模型查看接口读取所有图层数据
  1221. this.$Post(this.urlsCollection.getModelCoverAgeInfo, params).then(
  1222. (res) => {
  1223. if (res.code === 201 && res.message === "未申请任务权限") {
  1224. this.$message.info("暂无数据!");
  1225. }
  1226. if (res.code === 200 && res.content.length > 0) {
  1227. debugger;
  1228. console.log(res.content, "查看我的模型图层数据");
  1229. let uniqueId = `${data.label}_${data.id}`;
  1230. map2DViewer.analysisGroups[uniqueId] = L.featureGroup();
  1231. map2DViewer.analysisGroups[uniqueId].addTo(map2DViewer.map);
  1232. this.layerIdMap.set(uniqueId, uniqueId);
  1233. // 判断能用的数据
  1234. // 根据column_name或 column_id判断有几个图层
  1235. res.content.forEach((ele, index) => {
  1236. let cid = ele.id;
  1237. let geometry = ele.c_content;
  1238. // this.$store.state.mapMethodsCollection
  1239. // .get("RENDER")
  1240. // .addSinglePolygon(
  1241. // geometry,
  1242. // cid,
  1243. // // this.randomColor.get(uniqueId),
  1244. // uniqueId,
  1245. // mainType,
  1246. // sourceType
  1247. // );
  1248. // let legendTitle = this.legendTitle.push({});
  1249. // map2DViewer.analysisGroups[uniqueId] = L.featureGroup();
  1250. // map2DViewer.analysisGroups[uniqueId].addTo(map2DViewer.map);
  1251. });
  1252. }
  1253. }
  1254. );
  1255. }
  1256. },
  1257. readGeojson(geojson, id) {
  1258. map2DViewer.overlay[id] = [];
  1259. let states = [];
  1260. states.push(geojson);
  1261. let geojsonData = L.geoJSON(states, {
  1262. style: function (feature) {
  1263. // console.log(feature);
  1264. },
  1265. }).addTo(map2DViewer.map);
  1266. map2DViewer.overlay[id] = geojsonData;
  1267. },
  1268. deleteMyModelData(data) {
  1269. // 如果有叠置分析文件,删除叠置分析图层
  1270. if (data.c_dzfx_file) {
  1271. if (map2DViewer.overlay[data.id]) {
  1272. map2DViewer.map.removeLayer(map2DViewer.overlay[data.id]);
  1273. }
  1274. } else {
  1275. // 删除绘制的图层数据
  1276. }
  1277. },
  1278. //显示详细信息
  1279. viewDetailsPopup(data) {
  1280. this.$store.state.bottomMenuIndexs.index = -1;
  1281. this.$store.state.bottomMenuIndexs.subIndex = -1;
  1282. this.updateCasePopupShow = false;
  1283. this.tableType = "normal";
  1284. this.boxWidth = "600";
  1285. this.boxHeight = "600";
  1286. this.tableData = [];
  1287. let obj = JSON.parse(data).properties;
  1288. this.tableData.push(obj);
  1289. this.attrTableShow = true;
  1290. },
  1291. // 右侧面板项点击事件
  1292. listItemClick(type, data) {
  1293. this.$store.state.bottomMenuIndexs.index = -1;
  1294. this.$store.state.bottomMenuIndexs.subIndex = -1;
  1295. this.updateCasePopupShow = false;
  1296. this.tableData = [];
  1297. if (type === "default") {
  1298. this.tableType = "normal";
  1299. this.boxWidth = "600";
  1300. this.boxHeight = "600";
  1301. if (data.c_content) {
  1302. let obj = JSON.parse(data.c_content).properties;
  1303. console.log(obj);
  1304. this.tableData.push(obj);
  1305. }
  1306. }
  1307. if (type === "new") {
  1308. this.rightLabelData.forEach((item) => {
  1309. if (item.id == data.id) {
  1310. item.geometryChecked = false;
  1311. this.controlLabel(item);
  1312. }
  1313. });
  1314. if (data.featureType === "点") {
  1315. this.$store.state.mapMethodsCollection
  1316. .get("RENDER")
  1317. .setView(data.coord, 16);
  1318. } else {
  1319. map2DViewer.map.fitBounds(
  1320. map2DViewer.myLabels[`label_${data.id}`].getBounds()
  1321. );
  1322. }
  1323. let geoType = JSON.parse(data.geojson).properties.featureType;
  1324. this.$store.state.mapMethodsCollection
  1325. .get("RENDER")
  1326. .drawGeometry(geoType, data);
  1327. this.tableType = "personal";
  1328. this.boxWidth = "300";
  1329. this.boxHeight = "300";
  1330. this.tableData.push({
  1331. 名称: data.name,
  1332. 类别: data.type,
  1333. 描述: data.des,
  1334. });
  1335. }
  1336. this.attrTableShow = true;
  1337. },
  1338. closeEvent() {
  1339. this.attrTableShow = false;
  1340. },
  1341. // 关闭修改标记弹窗
  1342. closeLabelEvent() {
  1343. this.updateCasePopupShow = false;
  1344. },
  1345. modifyLabelEvent() {
  1346. this.$nextTick(() => {
  1347. let selectType = this.$refs.updateLabelRef.selectVal;
  1348. let desContent = this.$refs.updateLabelRef.textContent;
  1349. let currentNameInput = this.$refs.updateLabelRef.nameInput;
  1350. let geojson = JSON.parse(this.$refs.updateLabelRef.geojson);
  1351. let geometryType = geojson.properties.featureTypeIndex;
  1352. if (
  1353. myLabelNameMap.has(currentNameInput) &&
  1354. currentNameInput !== geojson.properties.name
  1355. ) {
  1356. this.$message.info("该名称已存在,请重新输入!");
  1357. } else {
  1358. let id = this.$refs.updateLabelRef.id;
  1359. let params = new FormData();
  1360. let nameInput = this.$refs.updateLabelRef.nameInput;
  1361. // 修改标题和描述
  1362. geojson.properties.title = selectType;
  1363. geojson.properties.desc = desContent;
  1364. geojson.properties.name = nameInput;
  1365. console.log(geojson, "修改后的geojson数据");
  1366. params = {
  1367. userId: Number(localStorage.getItem("USER_ID")),
  1368. sourceId: 0,
  1369. type: geometryType,
  1370. geojson: JSON.stringify(geojson),
  1371. id: id,
  1372. };
  1373. this.$Post(this.urlsCollection.updateConllection, params).then(
  1374. (res) => {
  1375. if (res.code === 200) {
  1376. // console.log("修改成功", res);
  1377. this.updateCasePopupShow = false;
  1378. this.getUserMarkers();
  1379. this.$message.success("修改成功!");
  1380. }
  1381. },
  1382. (error) => {
  1383. this.$message.error("保存失败");
  1384. console.log(error);
  1385. }
  1386. );
  1387. }
  1388. });
  1389. },
  1390. // 修改标记 -- 仅支持修改类型和描述
  1391. updateLabel(val) {
  1392. // console.log("修改标记", val);
  1393. this.$store.state.bottomMenuIndexs.index = -1;
  1394. this.$store.state.bottomMenuIndexs.subIndex = -1;
  1395. this.updateCasePopupShow = true;
  1396. this.attrTableShow = false;
  1397. if (this.updateCasePopupShow) {
  1398. this.$nextTick(() => {
  1399. this.$refs.updateLabelRef.menuData.title = "修改标记";
  1400. this.$refs.updateLabelRef.nameInput = val.name;
  1401. this.$refs.updateLabelRef.selectVal = val.type;
  1402. this.$refs.updateLabelRef.textContent = val.des;
  1403. this.$refs.updateLabelRef.id = val.id;
  1404. this.$refs.updateLabelRef.geojson = val.geojson;
  1405. });
  1406. }
  1407. },
  1408. // 删除标记
  1409. deleteLabel(id) {
  1410. if (localStorage.getItem("USER_ID")) {
  1411. // console.log("删除标记");
  1412. let params = new FormData();
  1413. this.$store.state.mapMethodsCollection
  1414. .get("RENDER")
  1415. .deleteGeometry(map2DViewer.myLabels[`label_${id}`]);
  1416. map2DViewer.myLabels[`label_${id}`] = null;
  1417. params = {
  1418. userId: Number(localStorage.getItem("USER_ID")),
  1419. sourceId: 0,
  1420. id: id,
  1421. };
  1422. this.$Post(this.urlsCollection.deleteConllection, params).then(
  1423. (res) => {
  1424. if (res.code === 200) {
  1425. // console.log("疑点删除成功");
  1426. this.getUserMarkers();
  1427. }
  1428. }
  1429. );
  1430. }
  1431. },
  1432. // 控制标记的显示与隐藏
  1433. controlLabel(val) {
  1434. val.geometryChecked = !val.geometryChecked;
  1435. // 已经绘制了几何体
  1436. if (map2DViewer.myLabels[`label_${val.id}`]) {
  1437. if (val.featureType === "点") {
  1438. map2DViewer.myLabels[`label_${val.id}`].setOpacity(
  1439. val.geometryChecked ? 1 : 0
  1440. );
  1441. }
  1442. if (val.featureType !== "点") {
  1443. map2DViewer.myLabels[`label_${val.id}`].setStyle(
  1444. val.geometryChecked
  1445. ? {
  1446. opacity: 1,
  1447. fillOpacity: 0.4,
  1448. }
  1449. : {
  1450. opacity: 0,
  1451. fillOpacity: 0,
  1452. }
  1453. );
  1454. }
  1455. } else {
  1456. // 未绘制几何体
  1457. // console.log(val, "未绘制几何体");
  1458. if (val.geometryChecked && val.geojson) {
  1459. let geoType = JSON.parse(val.geojson).properties.featureType;
  1460. this.$store.state.mapMethodsCollection
  1461. .get("RENDER")
  1462. .drawGeometry(geoType, val);
  1463. }
  1464. }
  1465. },
  1466. },
  1467. };
  1468. </script>
  1469. <style lang="less" scoped>
  1470. @commonBorderColor: rgb(0, 170, 255);
  1471. .comprehensive-analysis {
  1472. &-law-popup {
  1473. position: fixed;
  1474. left: 0;
  1475. right: 0;
  1476. margin: 100px auto;
  1477. pointer-events: auto;
  1478. z-index: 99;
  1479. }
  1480. &-label-popup {
  1481. position: absolute;
  1482. top: 15%;
  1483. left: 35%;
  1484. pointer-events: auto;
  1485. z-index: 99;
  1486. }
  1487. .el-checkbox {
  1488. color: #fff;
  1489. /deep/.el-checkbox__input.is-checked + .el-checkbox__label {
  1490. color: rgba(116, 255, 255, 1);
  1491. }
  1492. /deep/.el-checkbox__input.is-checked .el-checkbox__inner::after {
  1493. width: 70%;
  1494. height: 70%;
  1495. background: #74ffff;
  1496. border-radius: 0;
  1497. transform: rotate(0deg) scaleY(1);
  1498. position: static;
  1499. }
  1500. /deep/.el-checkbox__inner {
  1501. border: 1px solid #dcdfe6;
  1502. background: rgba(0, 170, 255, 0);
  1503. display: flex;
  1504. align-items: center;
  1505. justify-content: center;
  1506. position: static;
  1507. &::after {
  1508. transition: 0ms;
  1509. }
  1510. }
  1511. /deep/.el-checkbox__label {
  1512. padding-left: 0;
  1513. font-size: 15px;
  1514. position: absolute;
  1515. top: 1px;
  1516. left: 25px;
  1517. }
  1518. }
  1519. &-searchbox {
  1520. width: 300px;
  1521. height: 40px;
  1522. display: flex;
  1523. align-items: center;
  1524. justify-content: center;
  1525. position: absolute;
  1526. left: 21%;
  1527. top: 30px;
  1528. pointer-events: auto;
  1529. /deep/.el-input-group__append,
  1530. .el-input-group__prepend {
  1531. background-color: transparent;
  1532. color: #fff;
  1533. border-left: none;
  1534. }
  1535. /deep/.el-input-group--append .el-input__inner,
  1536. .el-input-group__prepend {
  1537. border-right: none;
  1538. }
  1539. }
  1540. &-backbtn {
  1541. width: 120px;
  1542. height: 35px;
  1543. background: @commonBorderColor;
  1544. color: #fff;
  1545. border-radius: 3px;
  1546. position: absolute;
  1547. left: 30px;
  1548. top: 15px;
  1549. pointer-events: auto;
  1550. cursor: pointer;
  1551. .left-arrow {
  1552. width: 7px;
  1553. height: 7px;
  1554. border-top: 2px solid #ffffff;
  1555. border-right: 2px solid #ffffff;
  1556. transform: translate(-50%, -50%) rotate(225deg);
  1557. position: absolute;
  1558. top: 16.5px;
  1559. left: 25px;
  1560. }
  1561. .title {
  1562. width: 80px;
  1563. height: 35px;
  1564. line-height: 35px;
  1565. position: absolute;
  1566. left: 34px;
  1567. }
  1568. }
  1569. &-legendbox {
  1570. position: absolute;
  1571. right: 410px;
  1572. top: 30px;
  1573. z-index: 1;
  1574. }
  1575. /* 弹窗 */
  1576. &-popup {
  1577. position: fixed;
  1578. left: 0;
  1579. right: 0;
  1580. margin: 100px auto;
  1581. pointer-events: auto;
  1582. z-index: 99;
  1583. }
  1584. /* 左侧面板开启按钮 */
  1585. &-leftopenbox {
  1586. position: absolute;
  1587. left: 5px;
  1588. width: 50px;
  1589. height: 100%;
  1590. display: flex;
  1591. flex-direction: column;
  1592. justify-content: center;
  1593. & > div {
  1594. pointer-events: auto;
  1595. width: 40px;
  1596. height: 40px;
  1597. border-radius: 50%;
  1598. background: rgba(102, 203, 255, 1);
  1599. position: relative;
  1600. cursor: pointer;
  1601. & > div {
  1602. position: absolute;
  1603. top: 8px;
  1604. left: 16px;
  1605. display: inline-block;
  1606. width: 0px;
  1607. height: 0px;
  1608. border: 12px solid transparent;
  1609. border-left-color: #fff;
  1610. }
  1611. }
  1612. }
  1613. /* 右侧面板开启按钮 */
  1614. &-rightopenbox {
  1615. position: absolute;
  1616. right: 0;
  1617. width: 50px;
  1618. height: 100%;
  1619. display: flex;
  1620. flex-direction: column;
  1621. justify-content: center;
  1622. & > div {
  1623. pointer-events: auto;
  1624. width: 40px;
  1625. height: 40px;
  1626. border-radius: 50%;
  1627. cursor: pointer;
  1628. position: relative;
  1629. background: rgba(102, 203, 255, 1);
  1630. & > div {
  1631. position: absolute;
  1632. top: 8px;
  1633. right: 16px;
  1634. display: inline-block;
  1635. width: 0px;
  1636. height: 0px;
  1637. border: 12px solid transparent;
  1638. border-right-color: #fff;
  1639. }
  1640. }
  1641. }
  1642. /* 左边树状面板 */
  1643. &-left {
  1644. width: 400px;
  1645. height: 85%;
  1646. position: absolute;
  1647. top: 60px;
  1648. left: 0;
  1649. background: url("../assets/image/tree_background.png") no-repeat center;
  1650. background-size: 100% 100%;
  1651. pointer-events: auto;
  1652. .close-btnbox {
  1653. position: absolute;
  1654. right: -20px;
  1655. height: 100%;
  1656. width: 40px;
  1657. display: flex;
  1658. flex-direction: column;
  1659. justify-content: center;
  1660. & > div {
  1661. pointer-events: auto;
  1662. width: 40px;
  1663. height: 40px;
  1664. border-radius: 50%;
  1665. cursor: pointer;
  1666. position: relative;
  1667. background: rgba(102, 203, 255, 1);
  1668. & > div {
  1669. position: absolute;
  1670. top: 8px;
  1671. right: 16px;
  1672. display: inline-block;
  1673. width: 0px;
  1674. height: 0px;
  1675. border: 12px solid transparent;
  1676. border-right-color: #fff;
  1677. }
  1678. }
  1679. }
  1680. .control-container {
  1681. width: 100%;
  1682. height: 8%;
  1683. display: flex;
  1684. justify-content: flex-end;
  1685. align-items: center;
  1686. position: relative;
  1687. &-pin-btn {
  1688. width: 30px;
  1689. height: 30px;
  1690. background: url("../assets/image/panel_unlock.png") no-repeat center;
  1691. position: absolute;
  1692. top: 0;
  1693. right: 3px;
  1694. cursor: pointer;
  1695. &.lock-style {
  1696. background: url("../assets/image/panel_lock.png") no-repeat center;
  1697. }
  1698. }
  1699. &-input {
  1700. width: 200px;
  1701. position: absolute;
  1702. bottom: 5px;
  1703. left: 30px;
  1704. /deep/.el-input__inner {
  1705. font-size: 15px;
  1706. height: 35px;
  1707. }
  1708. }
  1709. &-select {
  1710. width: 130px;
  1711. position: absolute;
  1712. bottom: 7px;
  1713. right: 35px;
  1714. }
  1715. }
  1716. .contant-container {
  1717. width: 100%;
  1718. height: 92%;
  1719. overflow: auto;
  1720. display: flex;
  1721. align-items: center;
  1722. justify-content: center;
  1723. &-innerbox {
  1724. width: 90%;
  1725. height: 98%;
  1726. .tree-arrow {
  1727. position: relative;
  1728. top: 0;
  1729. left: 0;
  1730. display: inline-block;
  1731. width: 0px;
  1732. height: 0px;
  1733. border: 7px solid transparent;
  1734. border-left-color: #fff;
  1735. }
  1736. .tree-arrow-expanded {
  1737. position: relative;
  1738. top: 4px;
  1739. left: -3px;
  1740. display: inline-block;
  1741. width: 0px;
  1742. height: 0px;
  1743. border: 7px solid transparent;
  1744. border-top-color: #fff;
  1745. }
  1746. .custom-tree-node {
  1747. position: relative;
  1748. width: 250px;
  1749. .el-checkbox {
  1750. width: 50%;
  1751. }
  1752. }
  1753. }
  1754. }
  1755. }
  1756. /* 右面板 -- 显示标记疑点 */
  1757. &-right {
  1758. width: 400px;
  1759. height: 85%;
  1760. position: absolute;
  1761. top: 60px;
  1762. right: 0;
  1763. background: url("../assets/image/tree_background.png") no-repeat center;
  1764. background-size: 100% 100%;
  1765. pointer-events: auto;
  1766. z-index: 2;
  1767. // 关闭折叠面板
  1768. .close-btnbox {
  1769. position: absolute;
  1770. left: -20px;
  1771. height: 100%;
  1772. width: 40px;
  1773. display: flex;
  1774. flex-direction: column;
  1775. justify-content: center;
  1776. & > div {
  1777. pointer-events: auto;
  1778. width: 40px;
  1779. height: 40px;
  1780. border-radius: 50%;
  1781. background: rgba(102, 203, 255, 1);
  1782. position: relative;
  1783. cursor: pointer;
  1784. & > div {
  1785. position: absolute;
  1786. top: 8px;
  1787. left: 16px;
  1788. display: inline-block;
  1789. width: 0px;
  1790. height: 0px;
  1791. border: 12px solid transparent;
  1792. border-left-color: #fff;
  1793. }
  1794. }
  1795. }
  1796. .control-container {
  1797. width: 100%;
  1798. height: 5%;
  1799. position: relative;
  1800. & > div {
  1801. width: 30px;
  1802. height: 30px;
  1803. background: url("../assets/image/panel_unlock.png") no-repeat center;
  1804. position: absolute;
  1805. top: 0;
  1806. left: 3px;
  1807. cursor: pointer;
  1808. &.lock-style {
  1809. background: url("../assets/image/panel_lock.png") no-repeat center;
  1810. }
  1811. }
  1812. }
  1813. .contant-container {
  1814. width: 100%;
  1815. height: 95%;
  1816. overflow: auto;
  1817. display: flex;
  1818. align-items: center;
  1819. justify-content: center;
  1820. &-innerbox {
  1821. width: 90%;
  1822. height: 98%;
  1823. .el-collapse-item__header {
  1824. .all-icon {
  1825. position: relative;
  1826. left: 10px;
  1827. display: flex;
  1828. align-items: center;
  1829. justify-content: space-around;
  1830. width: 100px;
  1831. & > div {
  1832. width: 30px;
  1833. height: 30px;
  1834. }
  1835. &-locate {
  1836. background: url("../assets/map/white_locate.png") no-repeat center;
  1837. }
  1838. &-visible {
  1839. background: url("../assets/map/white_hide.png") no-repeat center;
  1840. &.click {
  1841. background: url("../assets/map/white_display.png") no-repeat
  1842. center;
  1843. }
  1844. }
  1845. }
  1846. }
  1847. .panel-list-item {
  1848. position: relative;
  1849. margin: 0 auto;
  1850. width: 80%;
  1851. height: auto;
  1852. background: #00aaff;
  1853. font-family: "PingFangSC SC";
  1854. font-weight: 400;
  1855. font-size: 18px;
  1856. line-height: 40px;
  1857. background: rgba(0, 47, 86, 0.3);
  1858. color: #fff;
  1859. padding-left: 20px;
  1860. border-left: 1px solid rgba(207, 222, 255, 0.2);
  1861. border-right: 1px solid rgba(207, 222, 255, 0.2);
  1862. border-bottom: 1px solid rgba(207, 222, 255, 0.2);
  1863. cursor: pointer;
  1864. .operation-icon {
  1865. position: absolute;
  1866. right: 100px;
  1867. top: 0;
  1868. display: flex;
  1869. align-items: center;
  1870. justify-content: space-around;
  1871. width: 75px;
  1872. // background: red;
  1873. }
  1874. .visible-icon {
  1875. position: absolute;
  1876. right: 60px;
  1877. top: 9.5px;
  1878. width: 20px;
  1879. height: 20px;
  1880. background: url("../assets/map/eye_invisible.png") no-repeat center;
  1881. &.click {
  1882. background: url("../assets/map/eye_visible.png") no-repeat center;
  1883. }
  1884. }
  1885. }
  1886. .panel-footer {
  1887. border: none;
  1888. width: 100%;
  1889. height: 50px;
  1890. margin-top: 10px;
  1891. overflow-x: auto;
  1892. }
  1893. }
  1894. }
  1895. }
  1896. /* 侧边栏收缩动画效果 */
  1897. /* 左边 */
  1898. .fade-left-enter-from {
  1899. opacity: 0;
  1900. transform: translateX(-300px);
  1901. }
  1902. .fade-left-enter-to {
  1903. opacity: 1;
  1904. transform: translateX(0);
  1905. }
  1906. /* 主动输入控住过渡的持续时间和缓动曲线 */
  1907. .fade-left-enter-active {
  1908. transition: all 0.3s ease;
  1909. }
  1910. .fade-left-leave-from {
  1911. opacity: 1;
  1912. transform: translateX(0);
  1913. }
  1914. .fade-left-leave-to {
  1915. opacity: 0;
  1916. transform: translateX(-300px);
  1917. }
  1918. .fade-left-leave-active {
  1919. transition: all 0.3s ease;
  1920. }
  1921. /* 右边 */
  1922. .fade-right-enter-from {
  1923. opacity: 0;
  1924. transform: translateX(300px);
  1925. }
  1926. .fade-right-enter-to {
  1927. opacity: 1;
  1928. transform: translateX(0);
  1929. }
  1930. .fade-right-enter-active {
  1931. transition: all 0.3s ease;
  1932. }
  1933. .fade-right-leave-from {
  1934. opacity: 1;
  1935. transform: translateX(0);
  1936. }
  1937. .fade-right-leave-to {
  1938. opacity: 0;
  1939. transform: translateX(300px);
  1940. }
  1941. .fade-right-leave-active {
  1942. transition: all 0.3s ease;
  1943. }
  1944. }
  1945. </style>