index copy 2.vue 48 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354
  1. <template>
  2. <div class="create-farm">
  3. <custom-header :name="paramsType === 'client' ? '新增用户' : paramsType === 'edit' ? '编辑农场' : '创建农场'"
  4. :isGoBack="true" @goback="backgToHome"></custom-header>
  5. <!-- 地图 -->
  6. <div class="map-container" ref="mapContainer"></div>
  7. <div class="farm-content">
  8. <div class="top-mask"></div>
  9. <div class="farm-filter">
  10. <el-select v-model="locationVal" filterable remote reserve-keyword placeholder="搜索位置"
  11. :remote-method="remoteMethod" :loading="loading" @change="handleSearchRes"
  12. popper-class="location-search-popper">
  13. <el-option v-for="(item, index) in locationOptions.list" :key="index" :label="item.title"
  14. :value="{ value: item.point, item }">
  15. <span>{{ item.title }}</span>
  16. <span class="sub-title">{{ item.province }}{{ item.city }}{{ item.district || '' }}</span>
  17. </el-option>
  18. </el-select>
  19. </div>
  20. <!-- 创建 -->
  21. <div class="create-wrap">
  22. <div class="create-box">
  23. <div class="box-content">
  24. <div class="create-title">
  25. <img class="title-icon" src="@/assets/img/home/create-icon.png" alt="" />
  26. {{ paramsType === "client" ? "新增用户" : paramsType === "edit" ? "编辑农场" : "创建农场" }}
  27. </div>
  28. <div class="create-content">
  29. <div class="create-from">
  30. <el-form ref="ruleFormRef" :model="ruleForm" :rules="rules" class="demo-ruleForm">
  31. <el-form-item label="农场位置" prop="address">
  32. <div class="position-wrap">
  33. <el-input placeholder="农场位置" readonly v-model="ruleForm.address"
  34. autocomplete="off" />
  35. <!-- <div class="draw-btn" @click="toSubPage">
  36. {{ hasDefaultPolygon ? "点击勾选地块" : "新增地块" }}
  37. </div> -->
  38. </div>
  39. </el-form-item>
  40. <el-form-item label="种植作物" prop="speciesItem">
  41. <div class="select-wrap client-wrap">
  42. <el-select v-model="ruleForm.speciesItem" filterable class="select-item specie-select"
  43. multiple :max-collapse-tags="3" collapse-tags placeholder="种植作物(可多选)" @change="changeSpecie">
  44. <el-option v-for="(item, index) in specieList" :key="index"
  45. :label="item.name" :value="{ value: item.id, ...item }" />
  46. </el-select>
  47. </div>
  48. </el-form-item>
  49. <el-form-item label="联系人" prop="fzr">
  50. <div class="area-box">
  51. <el-input placeholder="请输入联系人姓名" v-model="ruleForm.fzr" autocomplete="off"
  52. style="width: fit-content" />
  53. </div>
  54. </el-form-item>
  55. <el-form-item label="联系电话" prop="tel">
  56. <div class="area-box">
  57. <el-input placeholder="请输入联系人电话" type="number" v-model="ruleForm.tel" autocomplete="off"
  58. style="width: fit-content" />
  59. </div>
  60. </el-form-item>
  61. <el-form-item label="农场面积" prop="mu">
  62. <div class="area-box">
  63. <el-input :placeholder="isFromEditMap ? '勾选地块获得农场面积' : '请输入农场的真实面积'
  64. " v-model="ruleForm.mu" :readonly="isFromEditMap" type="text"
  65. autocomplete="off" style="width: fit-content" @input="handleMianjiInput"
  66. @keypress="handleMianjiKeypress" />
  67. <div class="unit">亩</div>
  68. </div>
  69. </el-form-item>
  70. <el-form-item label="农场名称" prop="name">
  71. <el-input placeholder="请输入您的农场名称" v-model="ruleForm.name" autocomplete="off"
  72. @input="handleFarmNameInput" />
  73. </el-form-item>
  74. <el-form-item label="基地类别" prop="baseType" class="select-wrap client-wrap">
  75. <el-select placeholder="请选择" v-model="ruleForm.baseType" autocomplete="off">
  76. <el-option v-for="(item, index) in baseTypeList" :key="index"
  77. :label="item.name" :value="item.id" />
  78. </el-select>
  79. </el-form-item>
  80. </el-form>
  81. </div>
  82. <div class="create-btn">
  83. <div class="btn-item sencond-btn" @click="resetForm(ruleFormRef)">取消</div>
  84. <div class="btn-item primary-btn" @click="submitForm(ruleFormRef)">
  85. {{
  86. paramsType === "client"
  87. ? "添加"
  88. : paramsType === "edit"
  89. ? "确认修改"
  90. : "立即创建"
  91. }}
  92. </div>
  93. </div>
  94. </div>
  95. </div>
  96. </div>
  97. </div>
  98. </div>
  99. </div>
  100. <!-- 农情采集成功弹窗 -->
  101. <tip-popup
  102. v-model:show="showSuccessPopup"
  103. type="success"
  104. text="农情采集成功"
  105. @confirm="handlePopupConfirm"
  106. @handleClickOverlay="handlePopupConfirm"
  107. />
  108. <!-- 成熟收获时间弹窗 -->
  109. <harvest-time-popup
  110. v-model:show="showHarvestPopup"
  111. :crops="harvestCrops"
  112. @confirm="handleHarvestConfirm"
  113. />
  114. </template>
  115. <script setup>
  116. import customHeader from "@/components/customHeader.vue";
  117. import IndexMap from "./map/index.js";
  118. import { useRoute, useRouter } from "vue-router";
  119. import { mapLocation } from "./map/index.js";
  120. import { onMounted, ref, reactive, watch, onActivated, nextTick, onDeactivated } from "vue";
  121. import { useStore } from "vuex";
  122. import { convertPointToArray } from "@/utils/index";
  123. import { ElMessage } from "element-plus";
  124. import { Checkbox } from "vant";
  125. import tipPopup from "@/components/popup/tipPopup.vue";
  126. import harvestTimePopup from "@/components/popup/harvestTimePopup.vue";
  127. import wx from "weixin-js-sdk";
  128. import { transformFromGCJToWGS, transformFromWGSToGCJ } from "@/utils/WSCoordinate.js";
  129. const route = useRoute();
  130. const router = useRouter();
  131. const store = useStore();
  132. const indexMap = new IndexMap();
  133. const mapContainer = ref(null);
  134. // 农情采集成功弹窗
  135. const showSuccessPopup = ref(false);
  136. // 成熟收获时间弹窗
  137. const showHarvestPopup = ref(false);
  138. const harvestCrops = ref([]);
  139. const pendingCreateParams = ref(null);
  140. const handlePopupConfirm = () => {
  141. showSuccessPopup.value = false;
  142. router.replace(`/home`);
  143. };
  144. // 标记是否从编辑地图页面确认返回
  145. const isFromEditMap = ref(false);
  146. // 标记是否已创建默认地块
  147. const hasDefaultPolygon = ref(false);
  148. // 标记用户是否手动修改过农场名称
  149. const isFarmNameManuallyModified = ref(false);
  150. /**
  151. * 根据中心点生成指定边长的正方形地块WKT
  152. * @param {Array} center - 中心点坐标 [lng, lat]
  153. * @param {Number} sideLength - 正方形边长(米)
  154. * @returns {Object} 包含WKT字符串和面积(亩)的对象
  155. */
  156. function generateSquarePolygonBySideLength(center, sideLength) {
  157. // 确保输入是数字类型
  158. const lng = parseFloat(center[0]);
  159. const lat = parseFloat(center[1]);
  160. // 半边长(米)
  161. const halfSide = sideLength / 2;
  162. // 纬度方向:1度约等于111000米
  163. const latDelta = halfSide / 111000;
  164. // 经度方向:需要根据纬度调整,1度约等于111000 * cos(lat)米
  165. const lngDelta = halfSide / (111000 * Math.cos((lat * Math.PI) / 180));
  166. // 计算四个顶点(逆时针顺序)
  167. const topLeft = [lng - lngDelta, lat + latDelta];
  168. const topRight = [lng + lngDelta, lat + latDelta];
  169. const bottomRight = [lng + lngDelta, lat - latDelta];
  170. const bottomLeft = [lng - lngDelta, lat - latDelta];
  171. // 生成MULTIPOLYGON格式的WKT(需要闭合,所以第一个点要重复)
  172. // 明确使用join来格式化坐标点
  173. const formatPoint = (point) => `${point[0]} ${point[1]}`;
  174. const coordinates = [topLeft, topRight, bottomRight, bottomLeft, topLeft].map(formatPoint).join(", ");
  175. // 注意:MULTIPOLYGON 和括号之间需要有一个空格
  176. const wkt = `MULTIPOLYGON (((${coordinates})))`;
  177. // 计算面积(亩): 边长200米 = 40,000平方米 ≈ 60亩
  178. const areaInSquareMeters = sideLength * sideLength;
  179. const areaInMu = (areaInSquareMeters / 666.67).toFixed(2);
  180. return { wkt, area: areaInMu };
  181. }
  182. /**
  183. * 根据中心点和亩数生成正方形地块WKT
  184. * @param {Array} center - 中心点坐标 [lng, lat]
  185. * @param {Number} mu - 面积(亩)
  186. * @returns {Object} 包含WKT字符串和面积(亩)的对象
  187. */
  188. function generateSquarePolygonByMu(center, mu) {
  189. // 确保输入是数字类型
  190. const lng = parseFloat(center[0]);
  191. const lat = parseFloat(center[1]);
  192. // 1亩 ≈ 666.67平方米
  193. const areaInSquareMeters = mu * 666.67;
  194. // 正方形边长(米)
  195. const sideLength = Math.sqrt(areaInSquareMeters);
  196. // 半边长(米)
  197. const halfSide = sideLength / 2;
  198. // 纬度方向:1度约等于111000米
  199. const latDelta = halfSide / 111000;
  200. // 经度方向:需要根据纬度调整,1度约等于111000 * cos(lat)米
  201. const lngDelta = halfSide / (111000 * Math.cos((lat * Math.PI) / 180));
  202. // 计算四个顶点(逆时针顺序)
  203. const topLeft = [lng - lngDelta, lat + latDelta];
  204. const topRight = [lng + lngDelta, lat + latDelta];
  205. const bottomRight = [lng + lngDelta, lat - latDelta];
  206. const bottomLeft = [lng - lngDelta, lat - latDelta];
  207. // 生成MULTIPOLYGON格式的WKT(需要闭合,所以第一个点要重复)
  208. const formatPoint = (point) => `${point[0]} ${point[1]}`;
  209. const coordinates = [topLeft, topRight, bottomRight, bottomLeft, topLeft].map(formatPoint).join(", ");
  210. // 注意:MULTIPOLYGON 和括号之间需要有一个空格
  211. const wkt = `MULTIPOLYGON (((${coordinates})))`;
  212. return { wkt, area: parseFloat(mu).toFixed(2) };
  213. }
  214. onMounted(() => {
  215. // 清除上一次的地块数据,确保每次进入都是全新状态
  216. store.commit("home/SET_FARM_POLYGON", null);
  217. isFromEditMap.value = false; // 初始化时可以手动输入
  218. hasDefaultPolygon.value = false; // 初始化时没有默认地块
  219. centerPoint.value = store.state.home.miniUserLocationPoint;
  220. // const arr = convertPointToArray(centerPoint.value);
  221. // getLocationName(`${arr[1]},${arr[0]}`);
  222. indexMap.initMap(centerPoint.value, mapContainer.value);
  223. // 不再初始化时绘制默认地块,等待用户点击"新增地块"按钮
  224. // 清空地块和面积数据
  225. polygonArr.value = null;
  226. ruleForm.mu = "";
  227. // 如果是编辑模式,等待品类列表加载完成后再回填数据
  228. if (route.query.type === "edit" && store.state.home.editFarmData) {
  229. getSpecieList().then(() => {
  230. populateEditData();
  231. });
  232. } else {
  233. getSpecieList();
  234. }
  235. getBaseTypeList();
  236. });
  237. const polygonArr = ref(null);
  238. const paramsType = ref(null);
  239. onActivated(() => {
  240. const centerPointVal = sessionStorage.getItem('centerPoint') ? JSON.parse(sessionStorage.getItem('centerPoint')) : null;
  241. paramsType.value = route.query.type;
  242. centerPoint.value = centerPointVal || store.state.home.miniUserLocationPoint;
  243. const arr = convertPointToArray(centerPoint.value);
  244. getLocationName(`${arr[1]},${arr[0]}`);
  245. // 仅在携带 isReload 标记、且不是编辑/小程序回流场景时,认为是一次全新创建,重置表单和地块,
  246. // 避免破坏原有自动生成农场名称等逻辑
  247. if (route.query.isReload && paramsType.value !== "edit" && !route.query.miniJson) {
  248. // 重置表单字段到初始值
  249. ruleFormRef.value && ruleFormRef.value.resetFields();
  250. // 重置与地块绘制相关的内部状态
  251. polygonArr.value = null;
  252. isFromEditMap.value = false;
  253. hasDefaultPolygon.value = false;
  254. // 重置农场名称手动修改标记,允许自动生成农场名称
  255. isFarmNameManuallyModified.value = false;
  256. // 清空上一次地块缓存
  257. store.commit("home/SET_FARM_POLYGON", null);
  258. getSpecieList();
  259. }
  260. // 确保地图已初始化,使用 nextTick 等待 DOM 更新
  261. nextTick(() => {
  262. // 检查地图实例是否已初始化
  263. if (!indexMap.kmap) {
  264. // 如果地图未初始化,重新初始化
  265. if (mapContainer.value) {
  266. centerPoint.value = store.state.home.miniUserLocationPoint;
  267. const arr = convertPointToArray(centerPoint.value);
  268. indexMap.initMap(centerPoint.value, mapContainer.value);
  269. }
  270. // 等待地图初始化完成后再继续
  271. setTimeout(() => {
  272. handleMapUpdate();
  273. }, 100);
  274. return;
  275. }
  276. handleMapUpdate();
  277. });
  278. });
  279. onDeactivated(() => {
  280. sessionStorage.setItem('centerPoint', JSON.stringify(centerPoint.value));
  281. });
  282. // 处理地图更新的逻辑
  283. function handleMapUpdate() {
  284. if (route.query.isReload) {
  285. // 清除旧的地块数据
  286. store.commit("home/SET_FARM_POLYGON", null);
  287. isFromEditMap.value = false; // 从home进入,可以手动输入
  288. hasDefaultPolygon.value = false; // 重置默认地块状态
  289. centerPoint.value = store.state.home.miniUserLocationPoint;
  290. const arr = convertPointToArray(centerPoint.value);
  291. getLocationName(`${arr[1]},${arr[0]}`);
  292. indexMap.setMapPosition(arr);
  293. indexMap.clearLayer();
  294. // 不再自动生成默认地块,等待用户点击"新增地块"
  295. polygonArr.value = null;
  296. ruleForm.mu = "";
  297. ruleForm.defaultFarm = 0;
  298. return; // 直接返回,不执行下面的逻辑
  299. }
  300. indexMap.clearLayer();
  301. // 绘制勾画范围(从edit_map返回的情况)
  302. const polygonData = store.state.home.polygonData;
  303. // 优先处理从编辑地图页面返回的数据
  304. if (polygonData) {
  305. // 检查地块数据是否有效(数组存在且不为空)
  306. const hasValidGeometry =
  307. polygonData.geometryArr && Array.isArray(polygonData.geometryArr) && polygonData.geometryArr.length > 0;
  308. if (hasValidGeometry) {
  309. // 用户从edit_map返回,且有有效的地块数据
  310. // 根据 isConfirmed 判断是否锁定输入框
  311. if (polygonData.isConfirmed) {
  312. // 用户点击了"确认"按钮,锁定输入框并显示精确面积
  313. isFromEditMap.value = true;
  314. ruleForm.mu = polygonData.mianji;
  315. } else {
  316. // 用户点击了"取消",不锁定输入框,面积保持原样
  317. isFromEditMap.value = false;
  318. // 面积输入框保持之前的值,不更新
  319. }
  320. // 使用 nextTick 确保地图渲染完成后再设置地块
  321. nextTick(() => {
  322. indexMap.setAreaGeometry(polygonData.geometryArr);
  323. });
  324. polygonArr.value = polygonData.geometryArr;
  325. // 有地块数据时,标记已创建默认地块
  326. hasDefaultPolygon.value = true;
  327. } else {
  328. // 用户在编辑页面删除了所有地块
  329. // 重置所有状态
  330. polygonArr.value = null;
  331. ruleForm.mu = "";
  332. isFromEditMap.value = false;
  333. hasDefaultPolygon.value = false;
  334. ruleForm.defaultFarm = 0;
  335. }
  336. } else if (route.query.type === "edit" && store.state.home.editFarmData) {
  337. // 如果是编辑模式且没有从编辑地图返回的数据,回填原始编辑数据
  338. populateEditData();
  339. } else if (centerPoint.value && polygonArr.value) {
  340. // 没有新的编辑数据,保持当前地块
  341. // 同样需要检查数据有效性
  342. if (Array.isArray(polygonArr.value) && polygonArr.value.length > 0) {
  343. nextTick(() => {
  344. indexMap.setAreaGeometry(polygonArr.value);
  345. });
  346. // 保持 hasDefaultPolygon 状态
  347. }
  348. }
  349. }
  350. // 搜索
  351. const MAP_KEY = "CZLBZ-LJICQ-R4A5J-BN62X-YXCRJ-GNBUT";
  352. const locationVal = ref(null);
  353. const locationOptions = reactive({
  354. list: [],
  355. });
  356. const loading = ref(false);
  357. const remoteMethod = async (keyword) => {
  358. if (keyword) {
  359. locationOptions.list = [];
  360. loading.value = true;
  361. const params = {
  362. key: MAP_KEY,
  363. keyword,
  364. location: route.query.userLocation || "113.61702297075017,23.584863449735067",
  365. };
  366. await VE_API.old_mini_map.getCtiyList({ word: keyword }).then(({ data }) => {
  367. if (data && data.length) {
  368. data.forEach((item) => {
  369. item.point = item.location.lat + "," + item.location.lng;
  370. locationOptions.list.push(item);
  371. });
  372. }
  373. });
  374. VE_API.old_mini_map.search(params).then(({ data }) => {
  375. loading.value = false;
  376. data.forEach((item) => {
  377. item.point = item.location.lat + "," + item.location.lng;
  378. locationOptions.list.push(item);
  379. });
  380. });
  381. } else {
  382. locationOptions.list = [];
  383. }
  384. };
  385. const handleSearchRes = (v) => {
  386. const parts = v.value.split(",");
  387. let { latitude, longitude } = transformFromGCJToWGS(parseFloat(parts[0]), parseFloat(parts[1]));
  388. const coordinateArray = [longitude, latitude];
  389. indexMap.setMapPosition(coordinateArray);
  390. centerPoint.value = `POINT (${coordinateArray[0]} ${coordinateArray[1]})`;
  391. ruleForm.address = v.item?.title || v.item?.address;
  392. pointAddress.value = v.item?.province + v.item?.city + (v.item?.district || '');
  393. // 更新farmCity以便后续更新农场名称
  394. farmCity.value = v.item?.city + (v.item?.district || "");
  395. // 地址修改后,如果满足条件则自动更新农场名称
  396. updateFarmNameIfNeeded();
  397. getSpecieList();
  398. };
  399. // 表单
  400. const ruleFormRef = ref(null);
  401. const ruleForm = reactive({
  402. address: "",
  403. mu: "",
  404. // 多选品类:数组
  405. speciesItem: [],
  406. name: "",
  407. fzr: "",
  408. tel: "",
  409. baseType: null,
  410. defaultFarm: 0, // 0:否 1:是
  411. });
  412. // 自定义验证规则:验证面积必须是大于0的数字
  413. const validateMianji = (rule, value, callback) => {
  414. if (!value) {
  415. callback(new Error("请输入农场面积"));
  416. } else {
  417. const num = parseFloat(value);
  418. if (isNaN(num)) {
  419. callback(new Error("面积必须是数字"));
  420. } else if (num <= 0) {
  421. callback(new Error("面积必须大于0"));
  422. } else {
  423. callback();
  424. }
  425. }
  426. };
  427. const rules = reactive({
  428. address: [{ required: true, message: "请选择农场位置", trigger: "blur" }],
  429. mu: [
  430. { required: true, message: "请输入农场面积", trigger: "blur" },
  431. { validator: validateMianji, trigger: ["blur", "change"] },
  432. ],
  433. speciesItem: [{ required: true, message: "请选择种植作物", trigger: ["blur", "change"] }],
  434. name: [{ required: true, message: "请输入您的农场名称", trigger: ["blur", "change"] }],
  435. fzr: [{ required: true, message: "请输入联系人姓名", trigger: ["blur", "change"] }],
  436. tel: [
  437. { required: true, message: "请输入联系人电话", trigger: ["blur", "change"] },
  438. {
  439. pattern: /^1[3-9]\d{9}$/,
  440. message: "请输入正确的手机号码",
  441. trigger: ["blur", "change"],
  442. },
  443. ],
  444. defaultFarm: [{ required: true, message: "请选择是否为默认农场", trigger: "blur" }],
  445. baseType: [{ required: true, message: "请选择基地类别", trigger: "blur" }],
  446. });
  447. const curRole = localStorage.getItem("SET_USER_CUR_ROLE");
  448. // 成熟收获时间弹窗确认
  449. const handleHarvestConfirm = (list) => {
  450. if (!pendingCreateParams.value) return;
  451. const { params, mainSpecies } = pendingCreateParams.value;
  452. // 将成熟时间附加到参数中(可按需要调整字段名)
  453. const harvestInfo = (list || []).map((item) => ({
  454. name: item.name,
  455. month: item.month,
  456. day: item.day,
  457. }));
  458. // 处理 geom 参数,如果是数组需要序列化
  459. const queryParams = {
  460. ...params,
  461. ...route.query,
  462. harvestInfo: JSON.stringify(harvestInfo),
  463. };
  464. if (Array.isArray(queryParams.geom)) {
  465. queryParams.geom = JSON.stringify(queryParams.geom);
  466. }
  467. if (queryParams.speciesContainer && typeof queryParams.speciesContainer === "object") {
  468. queryParams.speciesContainer = JSON.stringify(queryParams.speciesContainer);
  469. }
  470. delete queryParams.speciesItem;
  471. queryParams.speciesName = mainSpecies?.name;
  472. showHarvestPopup.value = false;
  473. setTimeout(() => {
  474. router.push({
  475. path: "/prescription",
  476. query: queryParams,
  477. });
  478. }, 500);
  479. pendingCreateParams.value = null;
  480. };
  481. const submitForm = (formEl) => {
  482. if (!formEl) return;
  483. formEl.validate((valid) => {
  484. if (valid) {
  485. const speciesList = Array.isArray(ruleForm.speciesItem) ? ruleForm.speciesItem : (ruleForm.speciesItem ? [ruleForm.speciesItem] : []);
  486. const mainSpecies = speciesList[0];
  487. const speciesContainer = speciesList.map((item) => ({
  488. speciesId: item?.id ?? null,
  489. containerId: item?.defaultContainerId ?? null,
  490. }));
  491. const params = {
  492. ...ruleForm,
  493. wkt: centerPoint.value,
  494. speciesContainer,
  495. agriculturalCreate: route.query.type === "client" ? 1 : 0,
  496. // 编辑时geom不是数组,新增时是数组
  497. geom:
  498. route.query.type === "edit"
  499. ? polygonArr.value && polygonArr.value.length > 0
  500. ? polygonArr.value[0]
  501. : null
  502. : polygonArr.value,
  503. };
  504. // 如果是编辑模式,添加农场ID
  505. if (route.query.type === "edit" && route.query.farmId) {
  506. params.id = route.query.farmId;
  507. }
  508. // let pageData = null;
  509. // if (route.query.miniJson) {
  510. // const json = JSON.parse(route.query.miniJson);
  511. // console.log('json', json);
  512. // // pageData = JSON.parse(json.paramsPage);
  513. // }
  514. if (route.query.type !== "edit") {
  515. // 创建模式下先弹出成熟收获时间弹窗
  516. harvestCrops.value = speciesList.map((item) => ({
  517. name: item.name || "",
  518. month: "",
  519. day: "",
  520. }));
  521. pendingCreateParams.value = {
  522. params,
  523. mainSpecies,
  524. };
  525. showHarvestPopup.value = true;
  526. return;
  527. }
  528. // const apiCall = route.query.type === "edit" ? VE_API.basic_farm.saveBasicFarmInfoByExpertV3({...params, expertMiniUserId: '81881'}) : VE_API.farm.saveFarm(params);
  529. // apiCall.then((res) => {
  530. // if (res.code === 0) {
  531. // ElMessage.success(route.query.type === "edit" ? "修改成功" : "创建成功");
  532. // // 重置表单和地块数据
  533. // ruleFormRef.value.resetFields();
  534. // store.commit("home/SET_FARM_POLYGON", null);
  535. // store.commit("home/SET_EDIT_FARM_DATA", null); // 清除编辑数据
  536. // polygonArr.value = null;
  537. // isFromEditMap.value = false;
  538. // if (route.query.type !== "edit" && curRole == 0) {
  539. // localStorage.setItem("selectedFarmId", res.data.id);
  540. // localStorage.setItem("selectedFarmName", res.data.name);
  541. // }
  542. // // 根据来源页面决定跳转目标
  543. // const fromPage = route.query.from;
  544. // if (fromPage && fromPage !== "details") {
  545. // // 如果是从monitor页面来的
  546. // router.replace(`/${fromPage}`);
  547. // } else if (fromPage === "details") {
  548. // router.go(-1);
  549. // } else {
  550. // if (route.query.miniJson) {
  551. // const json = JSON.parse(route.query.miniJson);
  552. // //上传图片
  553. // VE_API.ali
  554. // .uploadImg({
  555. // farmId: res.data.id,
  556. // images: json.images,
  557. // uploadDate: formatDate(new Date()),
  558. // })
  559. // .then(({ code, msg }) => {
  560. // if (code === 0) {
  561. // showSuccessPopup.value = true;
  562. // } else {
  563. // ElMessage.error(msg);
  564. // }
  565. // });
  566. // } else {
  567. // router.replace(`/growth_report`);
  568. // }
  569. // }
  570. // } else {
  571. // ElMessage.error(res.msg);
  572. // }
  573. // });
  574. }
  575. });
  576. };
  577. const resetForm = (formEl) => {
  578. if (!formEl) return;
  579. formEl.resetFields();
  580. // 清除地块数据
  581. store.commit("home/SET_FARM_POLYGON", null);
  582. polygonArr.value = null;
  583. isFromEditMap.value = false;
  584. hasDefaultPolygon.value = false; // 重置默认地块状态
  585. // 根据来源页面决定返回目标
  586. const fromPage = route.query.from;
  587. if (fromPage && fromPage !== "details") {
  588. router.replace(`/${fromPage}`);
  589. return;
  590. }
  591. router.go(-1);
  592. };
  593. const centerPoint = ref(null);
  594. function toSubPage() {
  595. // 如果还没有默认地块,先创建默认地块
  596. if (!hasDefaultPolygon.value) {
  597. if (centerPoint.value) {
  598. const arr = convertPointToArray(centerPoint.value);
  599. const squareData = generateSquarePolygonBySideLength(arr, 200); // 200米边长
  600. const geometryData = {
  601. geometryArr: [squareData.wkt],
  602. mianji: squareData.area,
  603. };
  604. // 绘制默认地块
  605. indexMap.setAreaGeometry(geometryData.geometryArr);
  606. // 保存地块数据
  607. polygonArr.value = geometryData.geometryArr;
  608. // 标记已创建默认地块
  609. hasDefaultPolygon.value = true;
  610. // 不跳转,停留在当前页面
  611. return;
  612. }
  613. }
  614. // 如果已有默认地块,则跳转到编辑页面
  615. // 保存到store中以便在编辑页面回显
  616. if (polygonArr.value) {
  617. const polygonData = {
  618. geometryArr: polygonArr.value,
  619. mianji: ruleForm.mu || "", // 保存用户输入的面积,如果没有输入则为空
  620. isConfirmed: false, // 标记:还未从编辑页面确认返回
  621. };
  622. store.commit("home/SET_FARM_POLYGON", polygonData);
  623. }
  624. router.push(
  625. `/edit_map?mapCenter=${centerPoint.value}&pointName=${ruleForm.address}&pointAddress=${pointAddress.value}&from=${route.query.from}&type=${route.query.type}`
  626. );
  627. }
  628. const pointAddress = ref(null);
  629. const farmCity = ref(null);
  630. function getLocationName(location) {
  631. const params = {
  632. key: MAP_KEY,
  633. location,
  634. };
  635. VE_API.old_mini_map.location(params).then(({ result }) => {
  636. // locationVal.value = result.formatted_addresses.recommend;
  637. const add = result.formatted_addresses?.recommend ? result.formatted_addresses.recommend : result.address + "";
  638. ruleForm.address = add;
  639. pointAddress.value = result.address;
  640. farmCity.value = result.address_component?.city + (result.address_component?.district || "");
  641. // 地址修改后,如果满足条件则自动更新农场名称
  642. updateFarmNameIfNeeded();
  643. });
  644. }
  645. watch(
  646. () => mapLocation.data,
  647. (newValue, oldValue) => {
  648. if (newValue) {
  649. let { latitude, longitude } = transformFromWGSToGCJ(newValue[1], newValue[0]);
  650. centerPoint.value = `POINT (${newValue[0]} ${newValue[1]})`;
  651. getLocationName(`${latitude},${longitude}`);
  652. }
  653. }
  654. );
  655. const specieList = ref([]);
  656. function getSpecieList() {
  657. return VE_API.farm.fetchSpecieList({ point: centerPoint.value }).then(({ data }) => {
  658. const list = Array.isArray(data) ? data : [];
  659. // 只保留名称包含“水稻”或“荔枝”的品类
  660. const litchiList = list.filter(
  661. (item) => item?.name && (item.name.includes("水稻") || item.name.includes("荔枝"))
  662. );
  663. specieList.value = litchiList;
  664. // 返回空列表时,重置已选品类,避免保留上一次默认项
  665. if (litchiList.length === 0) {
  666. ruleForm.speciesItem = [];
  667. return litchiList;
  668. }
  669. // //列表有值时,默认选中第一项
  670. // if (litchiList.length > 0) {
  671. // const first = { value: litchiList[0].id, ...litchiList[0] };
  672. // ruleForm.speciesItem = [first];
  673. // // 同步触发品类变更逻辑(加载品种、自动生成农场名等)
  674. // changeSpecie(first);
  675. // }
  676. return litchiList;
  677. });
  678. }
  679. const baseTypeList = ref([]);
  680. function getBaseTypeList() {
  681. return VE_API.farm.fetchBaseTypeList().then(({ data }) => {
  682. baseTypeList.value = data || [];
  683. return data;
  684. });
  685. }
  686. async function changeSpecie(v) {
  687. const current = Array.isArray(v) ? v[v.length - 1] : v;
  688. // 选择后立即更新该字段的校验状态,避免错误提示残留
  689. nextTick(() => {
  690. if (!ruleFormRef.value) return;
  691. if (Array.isArray(ruleForm.speciesItem) && ruleForm.speciesItem.length > 0) {
  692. ruleFormRef.value.clearValidate(["speciesItem"]);
  693. return;
  694. }
  695. ruleFormRef.value.validateField("speciesItem");
  696. });
  697. // 只有在创建模式下且用户没有手动修改过农场名称时,才自动设置农场名称
  698. if (route.query.type !== "edit" && !isFarmNameManuallyModified.value && farmCity.value && current) {
  699. ruleForm.name = farmCity.value + current.name + "农场";
  700. }
  701. }
  702. /**
  703. * 格式化日期为 YYYY-MM-DD 格式
  704. * @param {Date} date - 日期对象
  705. * @returns {string} 格式化后的日期字符串
  706. */
  707. function formatDate(date) {
  708. const year = date.getFullYear();
  709. const month = String(date.getMonth() + 1).padStart(2, "0");
  710. const day = String(date.getDate()).padStart(2, "0");
  711. return `${year}-${month}-${day}`;
  712. }
  713. function backgToHome() {
  714. ruleFormRef.value?.resetFields();
  715. // 根据来源页面决定返回目标
  716. const fromPage = route.query?.from;
  717. if (route.query.miniJson) {
  718. const json = JSON.parse(route.query.miniJson);
  719. if (json.isMini) {
  720. const dropdownGardenItem = ref({
  721. organId: json.farmId,
  722. periodId: json.periodId,
  723. name: json.name,
  724. page: "create_farm",
  725. showFarmSelect: true,
  726. images: json.images,
  727. });
  728. wx.miniProgram.reLaunch({
  729. url: `/pages/subPages/new_recognize/index?gardenData=${JSON.stringify(dropdownGardenItem.value)}`,
  730. });
  731. }
  732. json?.from && router.replace(`/${json.from}`);
  733. // const paramsPage = JSON.parse(json.paramsPage);
  734. // if (paramsPage.isFarmer) {
  735. // router.replace('/home');
  736. // return;
  737. // }
  738. } else {
  739. if (fromPage && fromPage !== "details") {
  740. if (route.query?.type === "farmer") {
  741. router.go(-1);
  742. } else {
  743. router.replace(`/${fromPage}`);
  744. }
  745. return;
  746. } else {
  747. router.go(-1);
  748. }
  749. }
  750. }
  751. // 处理面积按键输入 - 只允许数字和小数点
  752. function handleMianjiKeypress(event) {
  753. // 如果是从编辑地图返回的,不允许手动修改
  754. if (isFromEditMap.value) {
  755. event.preventDefault();
  756. return;
  757. }
  758. const charCode = event.which ? event.which : event.keyCode;
  759. const char = String.fromCharCode(charCode);
  760. // 允许数字 (0-9) 和小数点 (.)
  761. if (!/^[0-9.]$/.test(char)) {
  762. event.preventDefault();
  763. return;
  764. }
  765. // 如果已经有小数点,不允许再输入小数点
  766. const currentValue = ruleForm.mu || "";
  767. if (char === "." && currentValue.includes(".")) {
  768. event.preventDefault();
  769. return;
  770. }
  771. // 不允许以小数点开头
  772. if (char === "." && !currentValue) {
  773. event.preventDefault();
  774. return;
  775. }
  776. }
  777. // 处理农场名称输入
  778. function handleFarmNameInput() {
  779. // 标记用户已手动修改过农场名称
  780. isFarmNameManuallyModified.value = true;
  781. }
  782. // 根据地址更新农场名称(如果满足条件)
  783. function updateFarmNameIfNeeded() {
  784. // 只有在创建模式下且用户没有手动修改过农场名称且已选择品类时,才自动更新农场名称
  785. const mainSpecies = Array.isArray(ruleForm.speciesItem)
  786. ? ruleForm.speciesItem[0]
  787. : ruleForm.speciesItem;
  788. if (route.query.type !== "edit" && !isFarmNameManuallyModified.value && mainSpecies && farmCity.value) {
  789. ruleForm.name = farmCity.value + mainSpecies.name + "农场";
  790. }
  791. }
  792. // 回填编辑数据
  793. function populateEditData() {
  794. const editData = store.state.home.editFarmData;
  795. if (!editData) {
  796. return;
  797. }
  798. // 回填基本信息
  799. ruleForm.name = editData.name || "";
  800. ruleForm.fzr = editData.fzr || "";
  801. ruleForm.tel = editData.tel || "";
  802. ruleForm.baseType = editData.baseType || null;
  803. ruleForm.defaultFarm = editData.defaultOption || 0;
  804. ruleForm.mu = editData.mianji || "";
  805. ruleForm.address = editData.address || "";
  806. // 设置地图中心点
  807. if (editData.pointWkt) {
  808. centerPoint.value = editData.pointWkt;
  809. const arr = convertPointToArray(editData.pointWkt);
  810. indexMap.setMapPosition(arr);
  811. }
  812. // 处理地块数据
  813. if (editData.geomWkt) {
  814. polygonArr.value = [editData.geomWkt];
  815. indexMap.setAreaGeometry([editData.geomWkt]);
  816. hasDefaultPolygon.value = true;
  817. isFromEditMap.value = true; // 编辑模式下锁定面积输入
  818. }
  819. // 处理作物数据(兼容多选)
  820. if (Array.isArray(editData.regionList) && editData.regionList.length > 0) {
  821. const selected = [];
  822. const speciesIdSet = new Set();
  823. editData.regionList.forEach((region) => {
  824. const targetId = region.speciesId;
  825. if (targetId == null) return;
  826. // 去重:同一个 speciesId 只保留一条
  827. const speciesKey = String(targetId);
  828. if (speciesIdSet.has(speciesKey)) return;
  829. const match = specieList.value.find((s) => String(s.id) === String(targetId));
  830. if (match) {
  831. speciesIdSet.add(speciesKey);
  832. selected.push({
  833. value: match.id,
  834. ...match,
  835. });
  836. }
  837. });
  838. if (selected.length > 0) {
  839. ruleForm.speciesItem = selected;
  840. }
  841. } else if (editData.speciesId && editData.speciesName) {
  842. // 兼容旧数据:只有单个品类字段时,按原逻辑回显一个
  843. const species = {
  844. value: editData.speciesId,
  845. id: editData.speciesId,
  846. name: editData.speciesName,
  847. defaultContainerId: editData.containerId,
  848. };
  849. ruleForm.speciesItem = [species];
  850. }
  851. // 设置地址信息
  852. if (editData.district) {
  853. try {
  854. const districtInfo = JSON.parse(editData.district);
  855. pointAddress.value = districtInfo.province + districtInfo.city + (districtInfo?.district || '');
  856. } catch (e) {
  857. console.warn("解析地址信息失败:", e);
  858. }
  859. }
  860. }
  861. // 处理面积输入
  862. let mianjiInputTimer = null;
  863. function handleMianjiInput(value) {
  864. // 如果是从编辑地图返回的,不允许手动修改
  865. if (isFromEditMap.value) {
  866. return;
  867. }
  868. // 过滤非法字符,只保留数字和小数点
  869. let filteredValue = value.replace(/[^\d.]/g, "");
  870. // 确保只有一个小数点
  871. const parts = filteredValue.split(".");
  872. if (parts.length > 2) {
  873. filteredValue = parts[0] + "." + parts.slice(1).join("");
  874. }
  875. // 限制小数点后最多2位
  876. if (parts.length === 2 && parts[1].length > 2) {
  877. filteredValue = parts[0] + "." + parts[1].substring(0, 2);
  878. }
  879. // 更新输入框的值(如果被过滤了)
  880. if (filteredValue !== value) {
  881. ruleForm.mu = filteredValue;
  882. return;
  883. }
  884. // 清除之前的定时器
  885. if (mianjiInputTimer) {
  886. clearTimeout(mianjiInputTimer);
  887. }
  888. // 防抖处理,用户停止输入500ms后再更新地块
  889. mianjiInputTimer = setTimeout(() => {
  890. const mu = parseFloat(filteredValue);
  891. // 验证输入的有效性
  892. if (!mu || isNaN(mu) || mu <= 0) {
  893. return;
  894. }
  895. // 根据亩数重新生成地块
  896. if (centerPoint.value) {
  897. const arr = convertPointToArray(centerPoint.value);
  898. const squareData = generateSquarePolygonByMu(arr, mu);
  899. const geometryData = {
  900. geometryArr: [squareData.wkt],
  901. mianji: squareData.area,
  902. };
  903. // 清除旧地块
  904. indexMap.clearLayer();
  905. // 绘制新地块
  906. indexMap.setAreaGeometry(geometryData.geometryArr);
  907. // 更新状态
  908. polygonArr.value = geometryData.geometryArr;
  909. // 标记已创建默认地块
  910. hasDefaultPolygon.value = true;
  911. }
  912. }, 500);
  913. }
  914. </script>
  915. <style lang="scss" scoped>
  916. ::v-deep {
  917. .el-form-item--default {
  918. margin-bottom: 20px;
  919. }
  920. }
  921. .create-farm {
  922. position: relative;
  923. width: 100%;
  924. height: 100vh;
  925. overflow: hidden;
  926. .map-container {
  927. width: 100%;
  928. height: calc(100% - 320px);
  929. }
  930. .checkbox {
  931. padding: 0 12px 6px;
  932. font-size: 15px;
  933. }
  934. .farm-content {
  935. position: absolute;
  936. top: 40px;
  937. left: 0;
  938. width: 100%;
  939. height: calc(100% - 40px);
  940. pointer-events: none;
  941. z-index: 2;
  942. .top-mask {
  943. height: 100px;
  944. position: absolute;
  945. z-index: 2;
  946. top: 0;
  947. left: 0;
  948. width: 100%;
  949. background: linear-gradient(0deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.6) 100%);
  950. }
  951. }
  952. .farm-filter {
  953. pointer-events: all;
  954. margin: 12px;
  955. position: relative;
  956. z-index: 10;
  957. background: rgba(0, 0, 0, 0.3);
  958. border-radius: 20px;
  959. border: 1px solid rgba(255, 255, 255, 0.4);
  960. &::before {
  961. content: "";
  962. position: absolute;
  963. left: 12px;
  964. top: 9px;
  965. width: 14px;
  966. height: 14px;
  967. background: url("@/assets/img/home/search.png") no-repeat center center / 100% 100%;
  968. }
  969. ::v-deep {
  970. .el-select__wrapper {
  971. background: none;
  972. box-shadow: none;
  973. padding-left: 34px;
  974. font-size: 12px;
  975. .el-select__selected-item,
  976. .el-select__placeholder,
  977. .el-select__input {
  978. color: rgba(255, 255, 255, 0.6);
  979. &.is-transparent {
  980. color: #ccc;
  981. font-size: 12px;
  982. }
  983. }
  984. }
  985. .el-select {
  986. transition: all 0.3s;
  987. .el-input.is-focus .el-input__wrapper {
  988. box-shadow: none !important;
  989. }
  990. }
  991. .el-input {
  992. .el-input__wrapper {
  993. background: none;
  994. box-shadow: none;
  995. padding-left: 18px;
  996. font-size: 11px;
  997. .el-input__inner {
  998. color: rgba(255, 255, 255, 0.6);
  999. }
  1000. &.is-focus {
  1001. .el-input__inner {
  1002. color: #ccc;
  1003. font-size: 11px;
  1004. }
  1005. }
  1006. }
  1007. }
  1008. }
  1009. }
  1010. .create-wrap {
  1011. position: absolute;
  1012. bottom: 0px;
  1013. left: 0;
  1014. width: 100%;
  1015. background: linear-gradient(180deg, transparent 0%, #f5f7fb 20%);
  1016. }
  1017. .create-box {
  1018. pointer-events: all;
  1019. margin: 0 12px 10px 12px;
  1020. width: calc(100% - 24px);
  1021. background: #e0f1fe;
  1022. border-radius: 14px;
  1023. .box-content {
  1024. position: relative;
  1025. &::after {
  1026. position: absolute;
  1027. right: 10px;
  1028. top: 2px;
  1029. content: "";
  1030. width: 79px;
  1031. height: 72px;
  1032. background: url("@/assets/img/home/creat-bg.png") no-repeat center / 100% 100%;
  1033. }
  1034. }
  1035. .create-title {
  1036. display: flex;
  1037. align-items: center;
  1038. padding: 12px 6px 12px 12px;
  1039. color: #0089f5;
  1040. font-size: 18px;
  1041. font-weight: bold;
  1042. .title-icon {
  1043. width: 18px;
  1044. padding-right: 10px;
  1045. }
  1046. }
  1047. .create-content {
  1048. background: #fff;
  1049. border-radius: 14px;
  1050. padding: 12px;
  1051. position: relative;
  1052. z-index: 2;
  1053. .create-from {
  1054. .select-wrap {
  1055. display: flex;
  1056. // &.specie-wrap {
  1057. // flex: 1;
  1058. // gap: 12px;
  1059. // .specie-select {
  1060. // min-width: 56px;
  1061. // width: 56px;
  1062. // }
  1063. // }
  1064. // width: 90%;
  1065. ::v-deep {
  1066. .el-input__wrapper {
  1067. background: none;
  1068. box-shadow: none;
  1069. }
  1070. .el-input__inner {
  1071. font-size: 14px;
  1072. color: rgba(0, 0, 0, 0.5);
  1073. }
  1074. .el-select__wrapper {
  1075. background: none;
  1076. box-shadow: none;
  1077. gap: 2px;
  1078. padding: 4px 2px;
  1079. justify-content: center;
  1080. }
  1081. // .el-select__selection {
  1082. // flex: none;
  1083. // width: min-content;
  1084. // }
  1085. .el-select__placeholder {
  1086. color: #000;
  1087. position: static;
  1088. transform: none;
  1089. width: fit-content;
  1090. }
  1091. }
  1092. &.client-wrap {
  1093. ::v-deep {
  1094. .el-select__wrapper {
  1095. justify-content: flex-start;
  1096. }
  1097. }
  1098. }
  1099. // .select-item {
  1100. // min-width: 80px;
  1101. // margin-left: 10px;
  1102. // }
  1103. }
  1104. ::v-deep {
  1105. .el-form-item__label {
  1106. color: #000;
  1107. }
  1108. .el-form-item__error {
  1109. top: 117%;
  1110. }
  1111. .el-form-item {
  1112. position: relative;
  1113. &::after {
  1114. content: "";
  1115. position: absolute;
  1116. left: 60px;
  1117. bottom: -5px;
  1118. width: calc(100% - 60px);
  1119. height: 1px;
  1120. background: rgba(0, 0, 0, 0.08);
  1121. }
  1122. }
  1123. .el-input__wrapper {
  1124. box-shadow: none;
  1125. padding: 1px 6px;
  1126. }
  1127. }
  1128. .area-box {
  1129. display: flex;
  1130. align-items: center;
  1131. width: 100%;
  1132. .unit {
  1133. padding-right: 10px;
  1134. }
  1135. }
  1136. .position-wrap {
  1137. width: 100%;
  1138. display: flex;
  1139. justify-content: space-between;
  1140. align-items: center;
  1141. .draw-btn {
  1142. flex: none;
  1143. padding: 0 12px;
  1144. height: 30px;
  1145. line-height: 30px;
  1146. box-sizing: border-box;
  1147. color: #2199f8;
  1148. border: 1px solid #2199f8;
  1149. background: rgba(33, 153, 248, 0.1);
  1150. border-radius: 20px;
  1151. font-size: 12px;
  1152. }
  1153. }
  1154. }
  1155. .create-btn {
  1156. display: flex;
  1157. align-items: center;
  1158. width: 100%;
  1159. padding-top: 10px;
  1160. .btn-item {
  1161. flex: 1;
  1162. text-align: center;
  1163. padding: 0 11px;
  1164. height: 40px;
  1165. line-height: 40px;
  1166. border-radius: 34px;
  1167. font-size: 16px;
  1168. box-sizing: border-box;
  1169. &.sencond-btn {
  1170. border: 1px solid rgba(153, 153, 153, 0.5);
  1171. color: #666666;
  1172. }
  1173. &.primary-btn {
  1174. background: linear-gradient(180deg, #76c3ff, #2199f8);
  1175. color: #fff;
  1176. }
  1177. }
  1178. .btn-item+.btn-item {
  1179. margin-left: 5px;
  1180. }
  1181. }
  1182. }
  1183. }
  1184. }
  1185. </style>
  1186. <style lang="scss">
  1187. .location-search-popper {
  1188. .el-select-dropdown__list {
  1189. max-width: 96vw;
  1190. overflow-x: auto;
  1191. }
  1192. .sub-title {
  1193. padding-left: 6px;
  1194. font-size: 12px;
  1195. color: #ccc;
  1196. }
  1197. }
  1198. </style>