| | |
| | | } |
| | | }, |
| | | created () { |
| | | this.inputMapShowDefaultCenter = null |
| | | |
| | | this.loadAMapScripts() |
| | | this.fetchDropdownData() |
| | | console.log('permission.tickets_processing_btn', this.permission.tickets_processing_btn) |
| | |
| | | |
| | | // 直接从返回对象中获取正确的路径 |
| | | const center = adcodeObj?.payload?.objects?.collection?.geometries?.[0]?.properties?.center |
| | | |
| | | if (Array.isArray(center) && center.length === 2) { |
| | | this.mapParams.center = center |
| | | this.inputMapShowDefaultCenter = center |
| | | } else { |
| | | // 如果找不到中心点,尝试使用 bbox 的中心点 |
| | | const bbox = adcodeObj?.payload?.bbox |
| | | if (Array.isArray(bbox) && bbox.length === 4) { |
| | | const centerX = (bbox[0] + bbox[2]) / 2 |
| | | const centerY = (bbox[1] + bbox[3]) / 2 |
| | | this.mapParams.center = [centerX, centerY] |
| | | this.inputMapShowDefaultCenter = [centerX, centerY] |
| | | } else { |
| | | this.mapParams.center = [115.861365, 28.621311] |
| | | this.inputMapShowDefaultCenter = [115.861365, 28.621311] |
| | | } |
| | | } |
| | | this.mapParams.center = [...this.inputMapShowDefaultCenter] |
| | | |
| | | this.mapLoaded = true |
| | | } catch (error) { |
| | |
| | | }, |
| | | |
| | | handleAdd () { |
| | | |
| | | this.createoredit = 1 |
| | | this.dialogVisible = true |
| | | this.mapParams.center = null |
| | | this.mapParams.center = [...this.inputMapShowDefaultCenter] |
| | | this.form.location = [] |
| | | }, |
| | | |
| | |
| | | if (Array.isArray(this.form.location) && this.form.location.length >= 2) { |
| | | this.mapParams.center = [Number(this.form.location[0]), Number(this.form.location[1])] |
| | | } else { |
| | | this.mapParams.center = null // 没有经纬度时用默认 |
| | | this.mapParams.center = [...this.inputMapShowDefaultCenter] |
| | | } |
| | | // 如果有图片,添加到表单中 |
| | | if (row.photo_url) { |