index.vue 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963
  1. <template>
  2. <div class="base-container">
  3. <fnHeader></fnHeader>
  4. <div class="top-bg"></div>
  5. <el-upload
  6. ref="uploadRef"
  7. class="upload-demo"
  8. :limit="1"
  9. :on-exceed="handleExceed"
  10. :on-success="onSuccess"
  11. :before-upload="beforeUpload"
  12. action="https://feiniaotech-dev.sysuimars.cn/site/plugin_ownership/uploadFile"
  13. :headers="headerUpload"
  14. >
  15. <template #trigger>
  16. <div class="btn blue" :class="{ 'disabled-button': !disabledForm && isEdit }">
  17. <el-icon><Upload /></el-icon>
  18. <span>RTK点位数据导入</span>
  19. </div>
  20. </template>
  21. </el-upload>
  22. <div class="top">
  23. <!-- <div class="back btn" @click="goBack">
  24. <img class="icon" src="@/assets/images/common/back-icon.png" alt="" />
  25. <span>返回</span>
  26. </div> -->
  27. <el-select
  28. v-model="locationVal"
  29. filterable
  30. remote
  31. :disabled="!disabledForm && isEdit"
  32. effect="dark"
  33. reserve-keyword
  34. placeholder="搜索地区"
  35. :remote-method="remoteMethod"
  36. :loading="loading"
  37. @change="handleSearchRes"
  38. class="v-select"
  39. >
  40. <template #prefix>
  41. <el-icon class="el-input__icon"><search /></el-icon>
  42. </template>
  43. <el-option
  44. v-for="(item, index) in locationOptions.list"
  45. :key="index"
  46. :label="item.title"
  47. :value="item.point"
  48. >
  49. <span>{{ item.title }}</span>
  50. <span class="sub-title">{{ item.province }}{{ item.city }}{{ item.district }}</span>
  51. </el-option>
  52. </el-select>
  53. <div class="search">
  54. <div class="add btn" :class="{ 'disabled-button': !disabledForm && isEdit }" @click="handleAdd">
  55. <el-icon><Plus /></el-icon>
  56. <span>创建</span>
  57. </div>
  58. <div class="upload btn" :class="{ 'disabled-button': !disabledForm && isEdit }" @click="handleExport">
  59. <img class="icon" src="@/assets/images/common/back-icon.png" alt="" />
  60. <span>导出</span>
  61. </div>
  62. </div>
  63. </div>
  64. <div class="content">
  65. <el-form :inline="true" :model="formInlineSearch" class="search-form" ref="formInlineRef">
  66. <el-form-item label="农场地址">
  67. <el-input v-model="formInlineSearch.address" placeholder="请输入农场地址" clearable />
  68. </el-form-item>
  69. <el-form-item label="农场名称">
  70. <el-input v-model="formInlineSearch.farmName" placeholder="请输入农场名称" clearable />
  71. </el-form-item>
  72. <el-form-item label="作物物种">
  73. <el-input v-model="formInlineSearch.speciesTypeName" placeholder="请输入作物物种" clearable />
  74. </el-form-item>
  75. <el-form-item label="客户姓名">
  76. <el-input v-model="formInlineSearch.masterName" placeholder="请输入客户姓名" clearable />
  77. </el-form-item>
  78. <el-form-item label="联系电话">
  79. <el-input v-model="formInlineSearch.masterTel" placeholder="请输入联系电话" clearable />
  80. </el-form-item>
  81. <div class="button">
  82. <el-button
  83. class="btn"
  84. :class="{ 'disabled-button': !disabledForm && isEdit }"
  85. type="primary"
  86. @click="onSearch"
  87. >查询</el-button
  88. >
  89. <el-button class="btn reset" :class="{ 'disabled-button': !disabledForm && isEdit }" @click="onRest"
  90. >重置</el-button
  91. >
  92. </div>
  93. </el-form>
  94. <div class="box">
  95. <div class="map-box" :class="{ 'cursor-pointer': mouseStyle }">
  96. <div ref="mapRef" class="map"></div>
  97. </div>
  98. <div class="tool-group">
  99. <!-- <div class="btn" @click="handleCancel">
  100. <img class="icon" src="@/assets/images/common/back-black-icon.png" alt="" />
  101. <span>撤销</span>
  102. </div> -->
  103. <!-- <div
  104. class="btn"
  105. @click="handleDeletePoint"
  106. v-show="mapData.selectPointArr.length > 0 && !disabledForm"
  107. >
  108. <el-icon size="15"><CloseBold /></el-icon>
  109. <span>删除点</span>
  110. </div> -->
  111. <div class="btn delete" @click="handleDelete" v-show="mapData.selectPointArr.length > 0">
  112. <el-icon size="15" color="#fff"><CloseBold /></el-icon>
  113. <span>删除地块</span>
  114. </div>
  115. </div>
  116. <div class="edit-popup" v-show="isEdit">
  117. <div class="edit-title">
  118. <div class="name">
  119. <img src="@/assets/images/common/chart-icon.png" alt="" />
  120. <span>地块属性</span>
  121. </div>
  122. <div class="btn-group">
  123. <div v-show="disabledForm" class="edit" @click="handleEdit">编辑</div>
  124. <div v-show="!disabledForm" class="edit" @click="handleDeletePoint">删除点</div>
  125. <div
  126. v-show="mapData.selectPointArr.length > 0"
  127. class="edit ml"
  128. :class="{ 'disabled-button': !disabledForm }"
  129. @click="handlePrint"
  130. >
  131. 打印
  132. </div>
  133. </div>
  134. </div>
  135. <div class="edit-cont">
  136. <el-form
  137. :inline="true"
  138. ref="ruleFormRef"
  139. :disabled="disabledForm"
  140. :model="formInline"
  141. :rules="rules"
  142. label-position="top"
  143. class="form-inline"
  144. >
  145. <el-form-item label="农场地址" prop="address">
  146. <el-input v-model="formInline.address" placeholder="请输入农场地址" clearable />
  147. </el-form-item>
  148. <el-form-item label="农场名称" prop="farmName">
  149. <el-input v-model="formInline.farmName" placeholder="请输入农场名称" clearable />
  150. </el-form-item>
  151. <el-form-item label="创建时间">
  152. <el-input v-model="formInline.createDate" clearable disabled />
  153. </el-form-item>
  154. <el-form-item label="农场面积">
  155. <el-input v-model="formInline.mu" disabled clearable />
  156. </el-form-item>
  157. <el-form-item label="作物物种" prop="speciesTypeName">
  158. <el-input v-model="formInline.speciesTypeName" placeholder="请输入作物物种" clearable />
  159. </el-form-item>
  160. <el-form-item label="客户姓名" prop="masterName">
  161. <el-input v-model="formInline.masterName" placeholder="请输入姓名" clearable />
  162. </el-form-item>
  163. <el-form-item label="联系电话" prop="masterTel">
  164. <el-input v-model="formInline.masterTel" placeholder="请输入联系电话" clearable />
  165. </el-form-item>
  166. </el-form>
  167. <div class="list-box" v-show="pointList.length > 0">
  168. <span>边界点经纬度</span>
  169. <div class="list-cont">
  170. <div class="list-item" v-for="(item, index) in pointList" :key="index">
  171. <span>A{{ index + 1 }}</span>
  172. <div class="item-box">北纬{{ item[1] }}</div>
  173. <div class="item-box">东经{{ item[0] }}</div>
  174. </div>
  175. </div>
  176. </div>
  177. </div>
  178. <div class="edit-footer">
  179. <div @click="onCancel" class="btn cancel">取消</div>
  180. <div @click="onSubmit" class="btn save">保存</div>
  181. </div>
  182. </div>
  183. </div>
  184. </div>
  185. </div>
  186. <!-- 导出弹窗 -->
  187. <el-dialog v-model="dialogVisible" width="82%" center :show-close="false" modal-class="dialog-dark">
  188. <div>
  189. <el-table :data="gridData" border max-height="600" class="table-dark">
  190. <el-table-column property="farmName" label="农场名称" show-overflow-tooltip />
  191. <el-table-column property="address" label="农场地址" width="230" show-overflow-tooltip />
  192. <el-table-column property="createDate" label="创建时间" width="170" />
  193. <el-table-column property="mu" label="农场面积">
  194. <template #default="scope">
  195. <span>{{ scope.row.mu }}亩</span>
  196. </template>
  197. </el-table-column>
  198. <el-table-column property="speciesTypeName" label="作物物种" />
  199. <el-table-column property="masterName" label="客户姓名" />
  200. <el-table-column property="masterTel" width="120" label="联系电话" />
  201. <el-table-column property="points" label="边界点经纬度" width="480" show-overflow-tooltip />
  202. </el-table>
  203. </div>
  204. <template #footer>
  205. <div class="dialog-footer">
  206. <el-button class="btn" @click="dialogVisible = false">取消</el-button>
  207. <el-button class="btn" type="primary" @click="handleDowload"> 下载 </el-button>
  208. </div>
  209. </template>
  210. </el-dialog>
  211. <Pdf
  212. :title="formInline.id + ''"
  213. :showDialog="pdfShow"
  214. @closeDialog="pdfShow = false"
  215. v-if="formInline.id && pdfShow"
  216. :rowId="formInline.id"
  217. ></Pdf>
  218. </template>
  219. <script setup>
  220. import { onMounted, ref, reactive, watchEffect, watch } from "vue";
  221. import fnHeader from "@/components/fnHeader.vue";
  222. import AuthenticMap from "./authenticMap";
  223. import { mapData } from "./authenticMap";
  224. import { useRouter } from "vue-router";
  225. import { ElMessage, ElMessageBox } from "element-plus";
  226. import { dateFormat } from "@/utils/date_util";
  227. import { exportExcel, parseMultiPolygon } from "@/utils/index";
  228. import { useStore } from "vuex";
  229. import Pdf from "./Pdf";
  230. const pdfShow = ref(false);
  231. const mouseStyle = ref(1);
  232. const router = useRouter();
  233. const store = useStore();
  234. let authenticMap = new AuthenticMap();
  235. const mapRef = ref();
  236. const userInfo = JSON.parse(sessionStorage.getItem("userinfo"));
  237. const location = ref(userInfo.location);
  238. onMounted(() => {
  239. authenticMap.initMap(location.value, mapRef.value);
  240. getList();
  241. });
  242. // 获取地块列表
  243. const plotList = ref([]);
  244. const getList = (callback) => {
  245. authenticMap.clearLayer();
  246. return VE_API.authentic.getList(formInlineSearch).then(({ code, data }) => {
  247. plotList.value = data || [];
  248. const geom = [];
  249. data.forEach((item) => {
  250. geom.push({ featureWkt: item.geom, ...item });
  251. });
  252. authenticMap.setAreaGeometry(geom);
  253. authenticMap.addPoint(data);
  254. callback && callback(geom);
  255. });
  256. };
  257. // 搜索
  258. const locationVal = ref("");
  259. const loading = ref(false);
  260. const MAP_KEY = "CZLBZ-LJICQ-R4A5J-BN62X-YXCRJ-GNBUT";
  261. const handleSearchRes = (v) => {
  262. authenticMap.setMapCenter(v);
  263. onRest();
  264. };
  265. const locationOptions = reactive({
  266. list: [],
  267. });
  268. const remoteMethod = async (keyword) => {
  269. if (keyword) {
  270. locationOptions.list = [];
  271. loading.value = true;
  272. const params = {
  273. key: MAP_KEY,
  274. keyword,
  275. // location: location.value,
  276. location: "22.574540836684672,113.1093017627431",
  277. };
  278. await VE_API.old_mini_map.getCtiyList({ word: keyword }).then(({ data }) => {
  279. if (data && data.length) {
  280. data.forEach((item) => {
  281. item.point = item.location.lat + "," + item.location.lng;
  282. locationOptions.list.push(item);
  283. });
  284. }
  285. });
  286. VE_API.old_mini_map.search(params).then(({ data }) => {
  287. loading.value = false;
  288. data.forEach((item) => {
  289. item.point = item.location.lat + "," + item.location.lng;
  290. locationOptions.list.push(item);
  291. });
  292. });
  293. } else {
  294. locationOptions.list = [];
  295. }
  296. };
  297. const validatePhoneNumber = (rule, value, callback) => {
  298. const phoneRegex = /^[1][3-9]\d{9}$/;
  299. if (!value) {
  300. callback(new Error("请输入联系电话"));
  301. } else if (!phoneRegex.test(value)) {
  302. callback(new Error("手机号码格式不正确"));
  303. } else {
  304. callback();
  305. }
  306. };
  307. const rules = {
  308. address: [{ required: true, message: "请输入农场地址", trigger: "change" }],
  309. farmName: [{ required: true, message: "请输入农场名称", trigger: "change" }],
  310. speciesTypeName: [{ required: true, message: "请输入作物物种", trigger: "change" }],
  311. masterName: [{ required: true, message: "请输入姓名", trigger: "change" }],
  312. masterTel: [{ required: true, validator: validatePhoneNumber, trigger: "change" }],
  313. };
  314. const ruleFormRef = ref(null);
  315. const initForm = {
  316. id: "",
  317. address: "",
  318. farmName: "",
  319. createDate: "",
  320. mu: "",
  321. speciesTypeName: "",
  322. masterName: "",
  323. masterTel: "",
  324. geom: "",
  325. };
  326. const formInline = reactive({
  327. ...initForm,
  328. });
  329. const disabledForm = ref(false);
  330. // 筛选
  331. const formInlineRef = ref(null);
  332. const formInlineSearch = reactive({
  333. ...initForm,
  334. });
  335. const onSearch = () => {
  336. authenticMap.search(formInlineSearch);
  337. };
  338. const onRest = () => {
  339. Object.assign(formInlineSearch, initForm);
  340. isUpdata.value = false;
  341. onCancel();
  342. };
  343. const isEdit = ref(false);
  344. const typeStr = ref("");
  345. // 编辑
  346. const handleEdit = () => {
  347. typeStr.value = "edit";
  348. disabledForm.value = false;
  349. mapData.disabledForm = false;
  350. authenticMap.startModify();
  351. };
  352. // 取消
  353. const isUpdata = ref(true);
  354. const onCancel = () => {
  355. isEdit.value = false;
  356. store.commit("authentic/SET_ISEDIT_STATUS", false);
  357. if (isUpdata.value) {
  358. authenticMap.cancelDraw();
  359. getList((geoms) => {
  360. authenticMap.allUnSelect();
  361. });
  362. } else {
  363. Object.assign(formInlineSearch, initForm);
  364. getList((geoms) => {
  365. authenticMap.allUnSelect();
  366. });
  367. }
  368. authenticMap.setPoint("point");
  369. authenticMap.clearMapData("isEdit", false, formInline.id);
  370. authenticMap.endDraw();
  371. };
  372. // 保存
  373. const onSubmit = () => {
  374. if (!ruleFormRef.value) return;
  375. ruleFormRef.value.validate((valid, fields) => {
  376. if (valid) {
  377. formInline.mu = formInline.mu.split("亩")[0];
  378. VE_API.authentic.saveData(formInline).then((res) => {
  379. store.commit("authentic/SET_ISEDIT_STATUS", false);
  380. isUpdata.value = false;
  381. disabledForm.value = true;
  382. mapData.disabledForm = true;
  383. Object.assign(formInlineSearch, initForm);
  384. authenticMap.endDraw();
  385. getList().then(() => {
  386. isRefresh.value = false;
  387. isEdit.value = false;
  388. authenticMap.allUnSelect();
  389. authenticMap.clearMapData();
  390. // authenticMap.getSelectPointArr(
  391. // point.id || plotList.value[plotList.value.length - 1].id
  392. // );
  393. });
  394. });
  395. }
  396. });
  397. };
  398. //上传
  399. const uploadRef = ref(null);
  400. const headerUpload = { token: store.getters.token };
  401. // 校验文件格式和大小
  402. const beforeUpload = (file) => {
  403. const isCsv = file.type === "application/vnd.ms-excel" || file.type === "text/csv" || file.name.endsWith(".csv");
  404. updateFormInline({ ...initForm });
  405. ruleFormRef.value.resetFields();
  406. onCancel()
  407. if (!isCsv) {
  408. ElMessage.error("上传文件只能是 CSV 格式!");
  409. }
  410. return isCsv;
  411. };
  412. const handleExceed = (files) => {
  413. uploadRef.value.clearFiles();
  414. const file = files[0];
  415. uploadRef.value.handleStart(file);
  416. };
  417. const heightArr = ref([]);
  418. const onSuccess = (res) => {
  419. typeStr.value = "upload";
  420. if (res.code === 0) {
  421. ElMessage.success("上传成功");
  422. store.commit("authentic/SET_ISEDIT_STATUS", true);
  423. isEdit.value = true;
  424. disabledForm.value = false;
  425. formInline.createDate = dateFormat(new Date(), "YYYY-mm-dd HH:MM:SS");
  426. const geom = [{ featureWkt: res.data.geom, ...res.data }];
  427. authenticMap.setAreaGeometry(geom);
  428. authenticMap.fit([res.data.geom]);
  429. updatePointList("upload");
  430. heightArr.value = res.data.height;
  431. const arr = pointList.value.map((item, index) => {
  432. return [...item, res.data.height[index]];
  433. });
  434. getArea(arr);
  435. authenticMap.startModify("upload");
  436. uploadRef.value.clearFiles();
  437. } else {
  438. ElMessage.error("上传失败");
  439. }
  440. };
  441. // 获取面积/亩
  442. const getArea = (arr) => {
  443. VE_API.authentic.getArea(arr).then((res) => {
  444. const area = (res.data / 666.67).toFixed(2);
  445. formInline.mu = area + "亩";
  446. });
  447. };
  448. // 打印
  449. const handlePrint = () => {
  450. pdfShow.value = true;
  451. };
  452. // 返回
  453. const goBack = () => {
  454. router.go(-1);
  455. };
  456. function updateFormInline(newData, name) {
  457. Object.assign(formInline, newData);
  458. }
  459. // 删除地块
  460. const handleDelete = () => {
  461. const id = mapData.selectPointArr.map((item) => item.values_.id);
  462. if (id.length < 0) return ElMessage("请选择地块");
  463. ElMessageBox.confirm("您确定删除该地块吗?", "提示", {
  464. confirmButtonText: "确认",
  465. cancelButtonText: "取消",
  466. type: "warning",
  467. })
  468. .then(() => {
  469. VE_API.authentic.deleteData(id).then((res) => {
  470. isUpdata.value = false;
  471. onCancel();
  472. });
  473. })
  474. .catch(() => {});
  475. };
  476. // 创建
  477. const isRefresh = ref(true);
  478. const handleAdd = () => {
  479. typeStr.value = "add";
  480. isRefresh.value = false;
  481. isEdit.value = false;
  482. if (isUpdata.value) {
  483. authenticMap.cancelDraw();
  484. authenticMap.allUnSelect();
  485. } else {
  486. getList();
  487. isUpdata.value = true;
  488. }
  489. updateFormInline({ ...initForm });
  490. ruleFormRef.value.resetFields();
  491. pointList.value = [];
  492. authenticMap.clearMapData("curPointData", {});
  493. authenticMap.clearMapData("isEdit", false);
  494. authenticMap.setPoint("point");
  495. authenticMap.startDraw();
  496. };
  497. // 删除点
  498. const handleDeletePoint = () => {
  499. authenticMap.removePoint(() => {
  500. updatePointList(typeStr.value);
  501. });
  502. };
  503. // 撤销
  504. const handleCancel = () => {
  505. authenticMap.undoLastDraw();
  506. };
  507. // 导出
  508. const gridData = ref([]);
  509. const dialogVisible = ref(false);
  510. const handleExport = () => {
  511. if (mapData.selectPointArr.length < 1) return ElMessage("请选择地块");
  512. const ids = mapData.selectPointArr.map((item) => item.values_.id);
  513. VE_API.authentic.exportData(ids).then(({ data }) => {
  514. gridData.value = data.map((item) => {
  515. return {
  516. ...item,
  517. createDate: dateFormat(new Date(item.createDate), "YYYY-mm-dd HH:MM:SS"),
  518. };
  519. });
  520. dialogVisible.value = true;
  521. });
  522. };
  523. // 下载
  524. const handleDowload = () => {
  525. const fieldLabels = [
  526. "农场名称",
  527. "农场地址",
  528. "创建时间",
  529. "农场面积",
  530. "作物物种",
  531. "客户姓名",
  532. "联系电话",
  533. "边界点经纬度",
  534. ];
  535. const fieldKeys = [
  536. "farmName",
  537. "address",
  538. "createDate",
  539. "mu",
  540. "speciesTypeName",
  541. "masterName",
  542. "masterTel",
  543. "points",
  544. ];
  545. const fileName = "农场数据" + dateFormat(new Date(), "YYYY-mm-dd HH:MM");
  546. exportExcel(gridData.value, fieldLabels, fieldKeys, fileName);
  547. };
  548. const pointList = ref([]);
  549. // 获取编辑回显数据
  550. const getDetailsData = (id) => {
  551. VE_API.authentic.getDetails({ id }).then(({ data }) => {
  552. isEdit.value = true;
  553. disabledForm.value = true;
  554. mapData.disabledForm = true;
  555. data.createDate = dateFormat(new Date(data.createDate), "YYYY-mm-dd HH:MM:SS");
  556. updateFormInline({ ...data });
  557. formInline.mu = data.mu + "亩";
  558. // 经纬度列表
  559. let arr = JSON.parse(data.points);
  560. // 删除最后数组最后一项闭合数据
  561. arr.pop();
  562. pointList.value = arr;
  563. });
  564. };
  565. // 添加经纬度列表
  566. const updatePointList = (type) => {
  567. const { geometryArr, area } = authenticMap.getAreaGeometry(type);
  568. const lastItem = geometryArr[geometryArr.length - 1];
  569. formInline.geom = lastItem.featureWkt;
  570. let result = parseMultiPolygon(lastItem.featureWkt);
  571. result.pop();
  572. pointList.value = result;
  573. //判断是否是导入数据,
  574. if (store.state.authentic.isEditStatus) {
  575. const arr = pointList.value.map((item, index) => {
  576. return [...item, heightArr.value[index]];
  577. });
  578. if (arr[0][2]) {
  579. getArea(arr);
  580. }
  581. } else {
  582. formInline.mu = area + "亩";
  583. }
  584. };
  585. watchEffect(() => {
  586. if (mapData.isEditArea) {
  587. isUpdata.value = false;
  588. updatePointList("edit");
  589. }
  590. });
  591. watch(
  592. () => mapData.isEdit,
  593. (newVale, oldValue) => {
  594. if (newVale && mapData.selectPointArr.length < 2 && !isRefresh.value) {
  595. isEdit.value = true;
  596. disabledForm.value = false;
  597. mapData.disabledForm = false;
  598. isUpdata.value = true;
  599. formInline.createDate = dateFormat(new Date(), "YYYY-mm-dd HH:MM:SS");
  600. updatePointList("add");
  601. authenticMap.startModify();
  602. }
  603. }
  604. );
  605. watch(
  606. () => mapData.selectPointArr,
  607. (newVale, oldValue) => {
  608. if (mapData.selectPointArr.length === 1) {
  609. const obj = mapData.selectPointArr[0];
  610. const id = obj.values_.id;
  611. getDetailsData(id);
  612. mapData.curPointData = obj.values_;
  613. } else {
  614. if (isRefresh.value) {
  615. isEdit.value = false;
  616. authenticMap.endDraw();
  617. isRefresh.value = true;
  618. }
  619. if (mapData.selectPointArr.length === 0 || mapData.selectPointArr.length > 1) {
  620. isEdit.value = false;
  621. }
  622. }
  623. }
  624. );
  625. </script>
  626. <style lang="scss" scoped>
  627. ::v-deep {
  628. .el-upload-list {
  629. display: none;
  630. }
  631. }
  632. .base-container {
  633. width: 100%;
  634. height: 100vh;
  635. color: #fff;
  636. box-sizing: border-box;
  637. z-index: 1;
  638. position: relative;
  639. .top-bg {
  640. position: absolute;
  641. top: 0;
  642. width: 100%;
  643. height: 74px;
  644. background: #101010;
  645. z-index: -1;
  646. }
  647. .upload-demo {
  648. display: flex;
  649. align-items: center;
  650. justify-content: flex-end;
  651. padding-right: 20px;
  652. background: #101010;
  653. }
  654. .blue {
  655. background: #2199f8;
  656. }
  657. .btn {
  658. display: flex;
  659. align-items: center;
  660. padding: 6px 16px;
  661. border-radius: 4px;
  662. cursor: pointer;
  663. .icon {
  664. width: 13px;
  665. height: 13px;
  666. }
  667. span {
  668. margin-left: 10px;
  669. }
  670. }
  671. .disabled-button {
  672. pointer-events: none;
  673. opacity: 0.5;
  674. cursor: not-allowed;
  675. }
  676. .top {
  677. display: flex;
  678. justify-content: space-between;
  679. // justify-content: flex-end;
  680. width: 100%;
  681. height: 40px;
  682. background: #101010;
  683. padding: 17px 20px 0 20px;
  684. box-sizing: border-box;
  685. display: flex;
  686. align-items: center;
  687. .back {
  688. border: 1px solid rgba(255, 255, 255, 0.4);
  689. }
  690. .v-select {
  691. width: 300px;
  692. ::v-deep {
  693. .el-select__wrapper {
  694. background: #101010;
  695. box-shadow: none;
  696. border: 1px solid rgba(255, 255, 255, 0.7);
  697. .el-select__input {
  698. color: #fff;
  699. }
  700. }
  701. }
  702. }
  703. .search {
  704. display: flex;
  705. align-items: center;
  706. justify-content: flex-end;
  707. width: 60%;
  708. .input-with-select {
  709. margin-left: 25px;
  710. }
  711. .upload {
  712. background: #2199f8;
  713. margin-left: 25px;
  714. }
  715. .add {
  716. background: #fff;
  717. color: #000;
  718. margin-left: 25px;
  719. }
  720. }
  721. }
  722. .content {
  723. width: 100%;
  724. height: calc(100% - 74px - 40px - 32px);
  725. box-sizing: border-box;
  726. background: #101010;
  727. padding: 13px 20px 20px 20px;
  728. .search-form {
  729. height: 40px;
  730. margin: 5px 0;
  731. display: flex;
  732. // justify-content: flex-end;
  733. justify-content: space-between;
  734. ::v-deep {
  735. .el-form-item__label {
  736. color: #fff;
  737. }
  738. .el-form-item__content {
  739. width: 190px;
  740. }
  741. .el-input__wrapper {
  742. background: #101010;
  743. box-shadow: none;
  744. border: 1px solid rgba(255, 255, 255, 0.7);
  745. .el-input__inner {
  746. color: #fff;
  747. }
  748. }
  749. }
  750. .button {
  751. display: flex;
  752. .btn {
  753. width: 84px;
  754. &.reset {
  755. margin-left: 25px;
  756. }
  757. }
  758. }
  759. }
  760. .box {
  761. border: 1px solid rgba(255, 255, 255, 0.4);
  762. border-radius: 8px;
  763. padding: 20px;
  764. box-sizing: border-box;
  765. background: #232323;
  766. width: 100%;
  767. height: calc(100% - 50px);
  768. position: relative;
  769. .map-box {
  770. width: 100%;
  771. height: 100%;
  772. border-radius: 4px;
  773. border: 1px solid rgba(255, 255, 255, 0.4);
  774. .map {
  775. width: 100%;
  776. height: 100%;
  777. }
  778. }
  779. .tool-group {
  780. position: absolute;
  781. display: flex;
  782. right: calc(500px + 36px);
  783. top: 42px;
  784. .btn {
  785. background: #fff;
  786. color: #000;
  787. margin-right: 10px;
  788. }
  789. .delete {
  790. background: #e45c5c;
  791. color: #fff;
  792. }
  793. }
  794. .edit-popup {
  795. width: 500px;
  796. height: calc(100% - 53px - 20px);
  797. position: absolute;
  798. top: 36px;
  799. right: 36px;
  800. border: 1px solid rgba(255, 255, 255, 0.4);
  801. border-radius: 8px;
  802. background: #232323;
  803. .edit-title {
  804. padding: 0 10px;
  805. background: rgba(68, 68, 68, 0.4);
  806. border-bottom: 1px solid rgba(68, 68, 68, 0.4);
  807. display: flex;
  808. align-items: center;
  809. justify-content: space-between;
  810. .btn-group {
  811. display: flex;
  812. .ml {
  813. margin-left: 20px;
  814. }
  815. }
  816. .name {
  817. display: flex;
  818. padding: 12px 0px;
  819. align-items: center;
  820. }
  821. span {
  822. margin-left: 8px;
  823. font-size: 18px;
  824. font-family: "SOURCEHANTIFINE";
  825. }
  826. .edit {
  827. color: #2199f8;
  828. padding: 6px 20px;
  829. border: 1px solid #2199f8;
  830. border-radius: 4px;
  831. cursor: pointer;
  832. }
  833. }
  834. .edit-cont {
  835. padding: 16px;
  836. width: calc(100% - 32px);
  837. height: calc(100% - 64px - 84px);
  838. .form-inline {
  839. height: 320px;
  840. ::v-deep {
  841. .el-input {
  842. width: 200px;
  843. --el-input-placeholder-color: #666666;
  844. }
  845. .el-form-item__label {
  846. color: #bbbbbb;
  847. }
  848. .el-input__wrapper {
  849. background: #232323;
  850. border: 1px solid #444444;
  851. box-shadow: none;
  852. .el-input__inner {
  853. color: #fff;
  854. }
  855. }
  856. }
  857. }
  858. .list-box {
  859. width: 100%;
  860. height: calc(100% - 320px);
  861. span {
  862. color: #bbbbbb;
  863. }
  864. .list-cont {
  865. width: 100%;
  866. height: calc(100% - 20px);
  867. border-radius: 4px;
  868. margin-top: 5px;
  869. background: rgba(68, 68, 68, 0.4);
  870. padding: 12px 16px;
  871. box-sizing: border-box;
  872. overflow-y: auto;
  873. .list-item {
  874. width: 100%;
  875. margin-bottom: 8px;
  876. display: flex;
  877. align-items: center;
  878. .item-box {
  879. padding: 8px;
  880. border: 1px solid #444444;
  881. border-radius: 4px;
  882. margin-left: 10px;
  883. }
  884. }
  885. }
  886. }
  887. }
  888. .edit-footer {
  889. width: 100%;
  890. height: 64px;
  891. display: flex;
  892. align-items: center;
  893. justify-content: flex-end;
  894. box-sizing: border-box;
  895. padding: 12px 16px;
  896. border-top: 1px solid rgba(68, 68, 68, 0.4);
  897. background: rgba(68, 68, 68, 0.4);
  898. .btn {
  899. padding: 10px 35px;
  900. }
  901. .cancel {
  902. border: 1px solid rgba(255, 255, 255, 0.4);
  903. margin-right: 16px;
  904. }
  905. .save {
  906. background: #2199f8;
  907. }
  908. }
  909. }
  910. }
  911. }
  912. }
  913. .dialog-footer {
  914. .btn {
  915. width: 200px;
  916. height: 40px;
  917. }
  918. }
  919. </style>