From e03c1cc18b888731130b92ad518a0dee6de2e479 Mon Sep 17 00:00:00 2001
From: liuyg <liuyg@qq.com>
Date: Tue, 22 Mar 2022 09:49:25 +0800
Subject: [PATCH] +更换经纬度的获取方式
---
src/views/tagging/tagging.vue | 461 ++--
src/views/life/life.vue | 776 ++++---
public/index.html | 5
src/views/sp/sp.vue | 473 ++--
src/styles/element-ui.scss | 21
src/store/modules/map.js | 26
src/views/mechanism/mechanism.vue | 378 ++-
src/components/mapOncePoint/Draw.js | 1280 +++++++++++++
src/components/mapOncePoint/chousePoint.vue | 59
src/components/mapOncePoint/tip.vue | 25
src/main.js | 36
src/components/mapOncePoint/chousePoint copy.vue | 46
src/views/road/road.vue | 453 ++-
src/views/architecture/architecture.vue | 277 +-
src/views/vr/vr.vue | 473 ++--
src/components/mapOncePoint/mapOncePoint.vue | 897 +++++++++
16 files changed, 4,316 insertions(+), 1,370 deletions(-)
diff --git a/public/index.html b/public/index.html
index b730d4d..b614bc0 100644
--- a/public/index.html
+++ b/public/index.html
@@ -24,6 +24,11 @@
<script src="libs/Cesium/Cesium.js"></script>
<script type="text/javascript" src="js/drawTree.js"></script>
+ <!-- Avue地图选点 -->
+ <script type="text/javascript"
+ src='https://webapi.amap.com/maps?v=1.4.11&key=7ab53b28352e55dc5754699add0ad862&plugin=AMap.PlaceSearch'></script>
+ <script src="https://webapi.amap.com/ui/1.0/main.js?v=1.0.11"></script>
+
<link rel="icon" href="<%= BASE_URL %>logos.png">
<title>智慧校园</title>
<style>
diff --git a/src/components/mapOncePoint/Draw.js b/src/components/mapOncePoint/Draw.js
new file mode 100644
index 0000000..ea28ce3
--- /dev/null
+++ b/src/components/mapOncePoint/Draw.js
@@ -0,0 +1,1280 @@
+var __extends =
+ (this && this.__extends) ||
+ (function () {
+ var extendStatics = function (d, b) {
+ extendStatics =
+ Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array &&
+ function (d, b) {
+ d.__proto__ = b;
+ }) ||
+ function (d, b) {
+ for (var p in b)
+ if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
+ };
+ return extendStatics(d, b);
+ };
+ return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError(
+ "Class extends value " + String(b) + " is not a constructor or null"
+ );
+ extendStatics(d, b);
+ function __() {
+ this.constructor = d;
+ }
+ d.prototype =
+ b === null
+ ? Object.create(b)
+ : ((__.prototype = b.prototype), new __());
+ };
+ })();
+/**
+ * @module ol/interaction/Draw
+ */
+import Circle from "ol/geom/Circle.js";
+import Event from "ol/events/Event.js";
+import EventType from "ol/events/EventType.js";
+import Feature from "ol/Feature.js";
+import GeometryType from "ol/geom/GeometryType.js";
+import InteractionProperty from "ol/interaction/Property.js";
+import LineString from "ol/geom/LineString.js";
+import MapBrowserEvent from "ol/MapBrowserEvent.js";
+import MapBrowserEventType from "ol/MapBrowserEventType.js";
+import MultiLineString from "ol/geom/MultiLineString.js";
+import MultiPoint from "ol/geom/MultiPoint.js";
+import MultiPolygon from "ol/geom/MultiPolygon.js";
+import Point from "ol/geom/Point.js";
+import PointerInteraction from "ol/interaction/Pointer.js";
+import Polygon, { fromCircle, makeRegular } from "ol/geom/Polygon.js";
+import VectorLayer from "ol/layer/Vector.js";
+import VectorSource from "ol/source/Vector.js";
+import { FALSE, TRUE } from "ol/functions.js";
+import { always, noModifierKeys, shiftKeyOnly } from "ol/events/condition.js";
+import {
+ boundingExtent,
+ getBottomLeft,
+ getBottomRight,
+ getTopLeft,
+ getTopRight,
+} from "ol/extent.js";
+import { createEditingStyle } from "ol/style/Style.js";
+import { fromUserCoordinate, getUserProjection } from "ol/proj.js";
+import { squaredDistance as squaredCoordinateDistance } from "ol/coordinate.js";
+/**
+ * @typedef {Object} Options
+ * @property {import("ol/geom/GeometryType.js").default} type Geometry type of
+ * the geometries being drawn with this instance.
+ * @property {number} [clickTolerance=6] The maximum distance in pixels between
+ * "down" and "up" for a "up" event to be considered a "click" event and
+ * actually add a point/vertex to the geometry being drawn. The default of `6`
+ * was chosen for the draw interaction to behave correctly on mouse as well as
+ * on touch devices.
+ * @property {import("ol/Collection.js").default<Feature>} [features]
+ * Destination collection for the drawn features.
+ * @property {VectorSource} [source] Destination source for
+ * the drawn features.
+ * @property {number} [dragVertexDelay=500] Delay in milliseconds after pointerdown
+ * before the current vertex can be dragged to its exact position.
+ * @property {number} [snapTolerance=12] Pixel distance for snapping to the
+ * drawing finish. Must be greater than `0`.
+ * @property {boolean} [stopClick=false] Stop click, singleclick, and
+ * doubleclick events from firing during drawing.
+ * @property {number} [maxPoints] The number of points that can be drawn before
+ * a polygon ring or line string is finished. By default there is no
+ * restriction.
+ * @property {number} [minPoints] The number of points that must be drawn
+ * before a polygon ring or line string can be finished. Default is `3` for
+ * polygon rings and `2` for line strings.
+ * @property {import("ol/events/condition.js").Condition} [finishCondition] A function
+ * that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
+ * boolean to indicate whether the drawing can be finished. Not used when drawing
+ * POINT or MULTI_POINT geometries.
+ * @property {import("ol/style/Style.js").StyleLike} [style]
+ * Style for sketch features.
+ * @property {GeometryFunction} [geometryFunction]
+ * Function that is called when a geometry's coordinates are updated.
+ * @property {string} [geometryName] Geometry name to use for features created
+ * by the draw interaction.
+ * @property {import("ol/events/condition.js").Condition} [condition] A function that
+ * takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
+ * boolean to indicate whether that event should be handled.
+ * By default {@link module:ol/events/condition.noModifierKeys}, i.e. a click,
+ * adds a vertex or deactivates freehand drawing.
+ * @property {boolean} [freehand=false] Operate in freehand mode for lines,
+ * polygons, and circles. This makes the interaction always operate in freehand
+ * mode and takes precedence over any `freehandCondition` option.
+ * @property {import("ol/events/condition.js").Condition} [freehandCondition]
+ * Condition that activates freehand drawing for lines and polygons. This
+ * function takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and
+ * returns a boolean to indicate whether that event should be handled. The
+ * default is {@link module:ol/events/condition.shiftKeyOnly}, meaning that the
+ * Shift key activates freehand drawing.
+ * @property {boolean} [wrapX=false] Wrap the world horizontally on the sketch
+ * overlay.
+ */
+/**
+ * Coordinate type when drawing points.
+ * @typedef {import("ol/coordinate.js").Coordinate} PointCoordType
+ */
+/**
+ * Coordinate type when drawing lines.
+ * @typedef {Array<import("ol/coordinate.js").Coordinate>} LineCoordType
+ */
+/**
+ * Coordinate type when drawing polygons.
+ * @typedef {Array<Array<import("ol/coordinate.js").Coordinate>>} PolyCoordType
+ */
+/**
+ * Types used for drawing coordinates.
+ * @typedef {PointCoordType|LineCoordType|PolyCoordType} SketchCoordType
+ */
+/**
+ * Function that takes an array of coordinates and an optional existing geometry
+ * and a projection as arguments, and returns a geometry. The optional existing
+ * geometry is the geometry that is returned when the function is called without
+ * a second argument.
+ * @typedef {function(!SketchCoordType, import("ol/geom/SimpleGeometry.js").default,
+ * import("ol/proj/Projection.js").default):
+ * import("ol/geom/SimpleGeometry.js").default} GeometryFunction
+ */
+/**
+ * Draw mode. This collapses multi-part geometry types with their single-part
+ * cousins.
+ * @enum {string}
+ */
+var Mode = {
+ POINT: "Point",
+ LINE_STRING: "LineString",
+ POLYGON: "Polygon",
+ CIRCLE: "Circle",
+};
+/**
+ * @enum {string}
+ */
+var DrawEventType = {
+ /**
+ * Triggered upon feature draw start
+ * @event DrawEvent#drawstart
+ * @api
+ */
+ DRAWSTART: "drawstart",
+ /**
+ * Triggered upon feature draw end
+ * @event DrawEvent#drawend
+ * @api
+ */
+ DRAWEND: "drawend",
+ /**
+ * Triggered upon feature draw abortion
+ * @event DrawEvent#drawabort
+ * @api
+ */
+ DRAWABORT: "drawabort",
+};
+/**
+ * @classdesc
+ * Events emitted by {@link module:ol/interaction/Draw~Draw} instances are
+ * instances of this type.
+ */
+var DrawEvent = /** @class */ (function (_super) {
+ __extends(DrawEvent, _super);
+ /**
+ * @param {DrawEventType} type Type.
+ * @param {Feature} feature The feature drawn.
+ */
+ function DrawEvent(type, feature) {
+ var _this = _super.call(this, type) || this;
+ /**
+ * The feature being drawn.
+ * @type {Feature}
+ * @api
+ */
+ _this.feature = feature;
+ return _this;
+ }
+ return DrawEvent;
+})(Event);
+export { DrawEvent };
+/***
+ * @template Return
+ * @typedef {import("ol/Observable").OnSignature<import("ol/Observable").EventTypes, import("ol/events/Event.js").default, Return> &
+ * import("ol/Observable").OnSignature<import("ol/ObjectEventType").Types|
+ * 'change:active', import("ol/Object").ObjectEvent, Return> &
+ * import("ol/Observable").OnSignature<'drawabort'|'drawend'|'drawstart', DrawEvent, Return> &
+ * import("ol/Observable").CombinedOnSignature<import("ol/Observable").EventTypes|import("ol/ObjectEventType").Types|
+ * 'change:active'|'drawabort'|'drawend'|'drawstart', Return>} DrawOnSignature
+ */
+/**
+ * @classdesc
+ * Interaction for drawing feature geometries.
+ *
+ * @fires DrawEvent
+ * @api
+ */
+var Draw = /** @class */ (function (_super) {
+ __extends(Draw, _super);
+ /**
+ * @param {Options} options Options.
+ */
+ function Draw(options) {
+ var _this = this;
+ var pointerOptions = /** @type {import("./Pointer.js").Options} */ (
+ options
+ );
+ if (!pointerOptions.stopDown) {
+ pointerOptions.stopDown = FALSE;
+ }
+ _this = _super.call(this, pointerOptions) || this;
+ /***
+ * @type {DrawOnSignature<import("ol/events").EventsKey>}
+ */
+ _this.coordinate = options.coordinate;
+ /***
+ * 输出坐标
+ */
+ _this.coordinateOver = options.coordinateOver;
+ /***
+ * 结束绘画
+ */
+ _this.overDraw = false;
+ /***
+ * 控制结束绘画
+ */
+ _this.isPoint = options.isPoint;
+ /***
+ * 是否是点
+ */
+ _this.coordinateOverPoint = options.coordinateOverPoint;
+ /***
+ * 输出点
+ */
+ _this.on;
+ /***
+ * @type {DrawOnSignature<import("ol/events").EventsKey>}
+ */
+ _this.once;
+ /***
+ * @type {DrawOnSignature<void>}
+ */
+ _this.un;
+ /**
+ * @type {boolean}
+ * @private
+ */
+ _this.shouldHandle_ = false;
+ /**
+ * @type {import("ol/pixel.js").Pixel}
+ * @private
+ */
+ _this.downPx_ = null;
+ /**
+ * @type {?}
+ * @private
+ */
+ _this.downTimeout_;
+ /**
+ * @type {number|undefined}
+ * @private
+ */
+ _this.lastDragTime_;
+ /**
+ * Pointer type of the last pointermove event
+ * @type {string}
+ * @private
+ */
+ _this.pointerType_;
+ /**
+ * @type {boolean}
+ * @private
+ */
+ _this.freehand_ = false;
+ /**
+ * Target source for drawn features.
+ * @type {VectorSource}
+ * @private
+ */
+ _this.source_ = options.source ? options.source : null;
+ /**
+ * Target collection for drawn features.
+ * @type {import("ol/Collection.js").default<Feature>}
+ * @private
+ */
+ _this.features_ = options.features ? options.features : null;
+ /**
+ * Pixel distance for snapping.
+ * @type {number}
+ * @private
+ */
+ _this.snapTolerance_ = options.snapTolerance ? options.snapTolerance : 12;
+ /**
+ * Geometry type.
+ * @type {import("ol/geom/GeometryType.js").default}
+ * @private
+ */
+ _this.type_ = /** @type {import("ol/geom/GeometryType.js").default} */ (
+ options.type
+ );
+ /**
+ * Drawing mode (derived from geometry type.
+ * @type {Mode}
+ * @private
+ */
+ _this.mode_ = getMode(_this.type_);
+ /**
+ * Stop click, singleclick, and doubleclick events from firing during drawing.
+ * Default is `false`.
+ * @type {boolean}
+ * @private
+ */
+ _this.stopClick_ = !!options.stopClick;
+ /**
+ * The number of points that must be drawn before a polygon ring or line
+ * string can be finished. The default is 3 for polygon rings and 2 for
+ * line strings.
+ * @type {number}
+ * @private
+ */
+ _this.minPoints_ = options.minPoints
+ ? options.minPoints
+ : _this.mode_ === Mode.POLYGON
+ ? 3
+ : 2;
+ /**
+ * The number of points that can be drawn before a polygon ring or line string
+ * is finished. The default is no restriction.
+ * @type {number}
+ * @private
+ */
+ _this.maxPoints_ =
+ _this.mode_ === Mode.CIRCLE
+ ? 2
+ : options.maxPoints
+ ? options.maxPoints
+ : Infinity;
+ /**
+ * A function to decide if a potential finish coordinate is permissible
+ * @private
+ * @type {import("ol/events/condition.js").Condition}
+ */
+ _this.finishCondition_ = options.finishCondition
+ ? options.finishCondition
+ : TRUE;
+ var geometryFunction = options.geometryFunction;
+ if (!geometryFunction) {
+ var mode_1 = _this.mode_;
+ if (mode_1 === Mode.CIRCLE) {
+ /**
+ * @param {!LineCoordType} coordinates The coordinates.
+ * @param {import("ol/geom/SimpleGeometry.js").default|undefined} geometry Optional geometry.
+ * @param {import("ol/proj/Projection.js").default} projection The view projection.
+ * @return {import("ol/geom/SimpleGeometry.js").default} A geometry.
+ */
+ geometryFunction = function (coordinates, geometry, projection) {
+ var circle = geometry
+ ? /** @type {Circle} */ (geometry)
+ : new Circle([NaN, NaN]);
+ var center = fromUserCoordinate(coordinates[0], projection);
+ var squaredLength = squaredCoordinateDistance(
+ center,
+ fromUserCoordinate(coordinates[coordinates.length - 1], projection)
+ );
+ circle.setCenterAndRadius(center, Math.sqrt(squaredLength));
+ var userProjection = getUserProjection();
+ if (userProjection) {
+ circle.transform(projection, userProjection);
+ }
+ return circle;
+ };
+ } else {
+ var Constructor_1;
+ if (mode_1 === Mode.POINT) {
+ Constructor_1 = Point;
+ } else if (mode_1 === Mode.LINE_STRING) {
+ Constructor_1 = LineString;
+ } else if (mode_1 === Mode.POLYGON) {
+ Constructor_1 = Polygon;
+ }
+ /**
+ * @param {!LineCoordType} coordinates The coordinates.
+ * @param {import("ol/geom/SimpleGeometry.js").default|undefined} geometry Optional geometry.
+ * @param {import("ol/proj/Projection.js").default} projection The view projection.
+ * @return {import("ol/geom/SimpleGeometry.js").default} A geometry.
+ */
+ geometryFunction = function (coordinates, geometry, projection) {
+ if (geometry) {
+ if (mode_1 === Mode.POLYGON) {
+ if (coordinates[0].length) {
+ // Add a closing coordinate to match the first
+ geometry.setCoordinates([
+ coordinates[0].concat([coordinates[0][0]]),
+ ]);
+ } else {
+ geometry.setCoordinates([]);
+ }
+ } else {
+ geometry.setCoordinates(coordinates);
+ }
+ } else {
+ geometry = new Constructor_1(coordinates);
+ }
+ return geometry;
+ };
+ }
+ }
+ /**
+ * @type {GeometryFunction}
+ * @private
+ */
+ _this.geometryFunction_ = geometryFunction;
+ /**
+ * @type {number}
+ * @private
+ */
+ _this.dragVertexDelay_ =
+ options.dragVertexDelay !== undefined ? options.dragVertexDelay : 500;
+ /**
+ * Finish coordinate for the feature (first point for polygons, last point for
+ * linestrings).
+ * @type {import("ol/coordinate.js").Coordinate}
+ * @private
+ */
+ _this.finishCoordinate_ = null;
+ /**
+ * Sketch feature.
+ * @type {Feature}
+ * @private
+ */
+ _this.sketchFeature_ = null;
+ /**
+ * Sketch point.
+ * @type {Feature<Point>}
+ * @private
+ */
+ _this.sketchPoint_ = null;
+ /**
+ * Sketch coordinates. Used when drawing a line or polygon.
+ * @type {SketchCoordType}
+ * @private
+ */
+ _this.sketchCoords_ = null;
+ /**
+ * Sketch line. Used when drawing polygon.
+ * @type {Feature<LineString>}
+ * @private
+ */
+ _this.sketchLine_ = null;
+ /**
+ * Sketch line coordinates. Used when drawing a polygon or circle.
+ * @type {LineCoordType}
+ * @private
+ */
+ _this.sketchLineCoords_ = null;
+ /**
+ * Squared tolerance for handling up events. If the squared distance
+ * between a down and up event is greater than this tolerance, up events
+ * will not be handled.
+ * @type {number}
+ * @private
+ */
+ _this.squaredClickTolerance_ = options.clickTolerance
+ ? options.clickTolerance * options.clickTolerance
+ : 36;
+ /**
+ * Draw overlay where our sketch features are drawn.
+ * @type {VectorLayer}
+ * @private
+ */
+ _this.overlay_ = new VectorLayer({
+ source: new VectorSource({
+ useSpatialIndex: false,
+ wrapX: options.wrapX ? options.wrapX : false,
+ }),
+ style: options.style ? options.style : getDefaultStyleFunction(),
+ updateWhileInteracting: true,
+ });
+ /**
+ * Name of the geometry attribute for newly created features.
+ * @type {string|undefined}
+ * @private
+ */
+ _this.geometryName_ = options.geometryName;
+ /**
+ * @private
+ * @type {import("ol/events/condition.js").Condition}
+ */
+ _this.condition_ = options.condition ? options.condition : noModifierKeys;
+ /**
+ * @private
+ * @type {import("ol/events/condition.js").Condition}
+ */
+ _this.freehandCondition_;
+ if (options.freehand) {
+ _this.freehandCondition_ = always;
+ } else {
+ _this.freehandCondition_ = options.freehandCondition
+ ? options.freehandCondition
+ : shiftKeyOnly;
+ }
+ _this.addChangeListener(InteractionProperty.ACTIVE, _this.updateState_);
+ return _this;
+ }
+ /**
+ * Remove the interaction from its current map and attach it to the new map.
+ * Subclasses may set up event handlers to get notified about changes to
+ * the map here.
+ * @param {import("ol/PluggableMap.js").default} map Map.
+ */
+ Draw.prototype.setMap = function (map) {
+ _super.prototype.setMap.call(this, map);
+ this.updateState_();
+ };
+ /**
+ * Get the overlay layer that this interaction renders sketch features to.
+ * @return {VectorLayer} Overlay layer.
+ * @api
+ */
+ Draw.prototype.getOverlay = function () {
+ return this.overlay_;
+ };
+ /**
+ * Handles the {@link module:ol/MapBrowserEvent map browser event} and may actually draw or finish the drawing.
+ * @param {import("ol/MapBrowserEvent.js").default} event Map browser event.
+ * @return {boolean} `false` to stop event propagation.
+ * @api
+ */
+ Draw.prototype.controlDrawing = function (val) {
+ this.overDraw = val;
+ };
+
+ Draw.prototype.handleEvent = function (event) {
+ if (event.originalEvent.type === EventType.CONTEXTMENU) {
+ // Avoid context menu for long taps when drawing on mobile
+ event.originalEvent.preventDefault();
+ }
+ this.freehand_ =
+ this.mode_ !== Mode.POINT && this.freehandCondition_(event);
+ var move = event.type === MapBrowserEventType.POINTERMOVE;
+ var pass = true;
+ if (
+ !this.freehand_ &&
+ this.lastDragTime_ &&
+ event.type === MapBrowserEventType.POINTERDRAG
+ ) {
+ var now = Date.now();
+ if (now - this.lastDragTime_ >= this.dragVertexDelay_) {
+ this.downPx_ = event.pixel;
+ this.shouldHandle_ = !this.freehand_;
+ move = true;
+ } else {
+ this.lastDragTime_ = undefined;
+ }
+ if (this.shouldHandle_ && this.downTimeout_ !== undefined) {
+ clearTimeout(this.downTimeout_);
+ this.downTimeout_ = undefined;
+ }
+ }
+ if (
+ this.freehand_ &&
+ event.type === MapBrowserEventType.POINTERDRAG &&
+ this.sketchFeature_ !== null
+ ) {
+ if (this.overDraw) {
+ return;
+ }
+ this.addToDrawing_(event.coordinate);
+ pass = false;
+ } else if (
+ this.freehand_ &&
+ event.type === MapBrowserEventType.POINTERDOWN
+ ) {
+ pass = false;
+ } else if (move && this.getPointerCount() < 2) {
+ pass = event.type === MapBrowserEventType.POINTERMOVE;
+ if (pass && this.freehand_) {
+ if (this.overDraw) {
+ return;
+ }
+ this.handlePointerMove_(event);
+ if (this.shouldHandle_) {
+ // Avoid page scrolling when freehand drawing on mobile
+ event.originalEvent.preventDefault();
+ }
+ } else if (
+ event.originalEvent.pointerType === "mouse" ||
+ (event.type === MapBrowserEventType.POINTERDRAG &&
+ this.downTimeout_ === undefined)
+ ) {
+ if (this.overDraw) {
+ return;
+ }
+ this.handlePointerMove_(event);
+ }
+ } else if (event.type === MapBrowserEventType.DBLCLICK) {
+ pass = false;
+ }
+ return _super.prototype.handleEvent.call(this, event) && pass;
+ };
+ /**
+ * Handle pointer down events.
+ * @param {import("ol/MapBrowserEvent.js").default} event Event.
+ * @return {boolean} If the event was consumed.
+ */
+ Draw.prototype.handleDownEvent = function (event) {
+ // console.log(event.coordinate_, 'handleDownEvent')
+ this.shouldHandle_ = !this.freehand_;
+ if (this.freehand_) {
+ this.downPx_ = event.pixel;
+ if (!this.finishCoordinate_) {
+ this.startDrawing_(event.coordinate);
+ }
+ return true;
+ } else if (this.condition_(event)) {
+ this.lastDragTime_ = Date.now();
+ this.downTimeout_ = setTimeout(
+ function () {
+ this.handlePointerMove_(
+ new MapBrowserEvent(
+ MapBrowserEventType.POINTERMOVE,
+ event.map,
+ event.originalEvent,
+ false,
+ event.frameState
+ )
+ );
+ }.bind(this),
+ this.dragVertexDelay_
+ );
+ this.downPx_ = event.pixel;
+ return true;
+ } else {
+ this.lastDragTime_ = undefined;
+ return false;
+ }
+ };
+ /**
+ * Handle pointer up events.
+ * @param {import("ol/MapBrowserEvent.js").default} event Event.
+ * @return {boolean} If the event was consumed.
+ */
+ Draw.prototype.handleUpEvent = function (event) {
+ // console.log(event.coordinate_, 'handleUpEvent')//获取坐标点
+ if (this.isPoint) {
+ this.coordinateOverPoint(event);
+ this.finishDrawing();
+ return;
+ }
+ var pass = true;
+ if (this.getPointerCount() === 0) {
+ if (this.downTimeout_) {
+ clearTimeout(this.downTimeout_);
+ this.downTimeout_ = undefined;
+ }
+ this.handlePointerMove_(event);
+ if (this.shouldHandle_) {
+ var startingToDraw = !this.finishCoordinate_;
+ if (startingToDraw) {
+ //开始后抬起
+ // this.coordinateOverPoint(event);
+ this.coordinate(event);
+ this.startDrawing_(event.coordinate);
+ }
+ if (!startingToDraw && this.freehand_) {
+ this.finishDrawing();
+ } else if (
+ !this.freehand_ &&
+ (!startingToDraw || this.mode_ === Mode.POINT)
+ ) {
+ //选择后抬起
+ this.coordinate(event);
+ if (this.atFinish_(event.pixel)) {
+ //结束绘画
+ this.coordinateOver("结束");
+ if (this.finishCondition_(event)) {
+ this.finishDrawing();
+ }
+ } else {
+ this.addToDrawing_(event.coordinate);
+ }
+ }
+ pass = false;
+ } else if (this.freehand_) {
+ this.abortDrawing();
+ }
+ }
+ if (!pass && this.stopClick_) {
+ event.preventDefault();
+ }
+ return pass;
+ };
+ // Draw.prototype.getCoordinate = function (fn) {
+ // this.coordinate = fn;
+ // console.log(this.coordinate)
+ // }
+ /**
+ * Handle move events.
+ * @param {import("ol/MapBrowserEvent.js").default} event A move event.
+ * @private
+ */
+ Draw.prototype.handlePointerMove_ = function (event) {
+ this.pointerType_ = event.originalEvent.pointerType;
+ if (
+ this.downPx_ &&
+ ((!this.freehand_ && this.shouldHandle_) ||
+ (this.freehand_ && !this.shouldHandle_))
+ ) {
+ var downPx = this.downPx_;
+ var clickPx = event.pixel;
+ var dx = downPx[0] - clickPx[0];
+ var dy = downPx[1] - clickPx[1];
+ var squaredDistance = dx * dx + dy * dy;
+ this.shouldHandle_ = this.freehand_
+ ? squaredDistance > this.squaredClickTolerance_
+ : squaredDistance <= this.squaredClickTolerance_;
+ if (!this.shouldHandle_) {
+ return;
+ }
+ }
+ if (this.finishCoordinate_) {
+ this.modifyDrawing_(event.coordinate);
+ } else {
+ this.createOrUpdateSketchPoint_(event.coordinate.slice());
+ }
+ };
+ /**
+ * Determine if an event is within the snapping tolerance of the start coord.
+ * @param {import("ol/pixel.js").Pixel} pixel Pixel.
+ * @return {boolean} The event is within the snapping tolerance of the start.
+ * @private
+ */
+ Draw.prototype.atFinish_ = function (pixel) {
+ // console.log(pixel, 879789)
+ var at = false;
+ if (this.sketchFeature_) {
+ var potentiallyDone = false;
+ var potentiallyFinishCoordinates = [this.finishCoordinate_];
+ var mode = this.mode_;
+ if (mode === Mode.POINT) {
+ at = true;
+ } else if (mode === Mode.CIRCLE) {
+ at = this.sketchCoords_.length === 2;
+ } else if (mode === Mode.LINE_STRING) {
+ potentiallyDone = this.sketchCoords_.length > this.minPoints_;
+ } else if (mode === Mode.POLYGON) {
+ var sketchCoords = /** @type {PolyCoordType} */ (this.sketchCoords_);
+ potentiallyDone = sketchCoords[0].length > this.minPoints_;
+ potentiallyFinishCoordinates = [
+ sketchCoords[0][0],
+ sketchCoords[0][sketchCoords[0].length - 2],
+ ];
+ }
+ if (potentiallyDone) {
+ var map = this.getMap();
+ for (var i = 0, ii = potentiallyFinishCoordinates.length; i < ii; i++) {
+ var finishCoordinate = potentiallyFinishCoordinates[i];
+ var finishPixel = map.getPixelFromCoordinate(finishCoordinate);
+ var dx = pixel[0] - finishPixel[0];
+ var dy = pixel[1] - finishPixel[1];
+ var snapTolerance = this.freehand_ ? 1 : this.snapTolerance_;
+ at = Math.sqrt(dx * dx + dy * dy) <= snapTolerance;
+ if (at) {
+ this.finishCoordinate_ = finishCoordinate;
+ break;
+ }
+ }
+ }
+ }
+ return at;
+ };
+ /**
+ * @param {import("ol/coordinate").Coordinate} coordinates Coordinate.
+ * @private
+ */
+ Draw.prototype.createOrUpdateSketchPoint_ = function (coordinates) {
+ if (!this.sketchPoint_) {
+ this.sketchPoint_ = new Feature(new Point(coordinates));
+ this.updateSketchFeatures_();
+ } else {
+ var sketchPointGeom = this.sketchPoint_.getGeometry();
+ sketchPointGeom.setCoordinates(coordinates);
+ }
+ };
+ /**
+ * @param {import("ol/geom/Polygon.js").default} geometry Polygon geometry.
+ * @private
+ */
+ Draw.prototype.createOrUpdateCustomSketchLine_ = function (geometry) {
+ if (!this.sketchLine_) {
+ this.sketchLine_ = new Feature();
+ }
+ var ring = geometry.getLinearRing(0);
+ var sketchLineGeom = this.sketchLine_.getGeometry();
+ if (!sketchLineGeom) {
+ sketchLineGeom = new LineString(
+ ring.getFlatCoordinates(),
+ ring.getLayout()
+ );
+ this.sketchLine_.setGeometry(sketchLineGeom);
+ } else {
+ sketchLineGeom.setFlatCoordinates(
+ ring.getLayout(),
+ ring.getFlatCoordinates()
+ );
+ sketchLineGeom.changed();
+ }
+ };
+ /**
+ * Start the drawing.
+ * @param {import("ol/coordinate.js").Coordinate} start Start coordinate.
+ * @private
+ */
+ Draw.prototype.startDrawing_ = function (start) {
+ if (this.overDraw) {
+ return;
+ }
+ var projection = this.getMap().getView().getProjection();
+ this.finishCoordinate_ = start;
+ if (this.mode_ === Mode.POINT) {
+ this.sketchCoords_ = start.slice();
+ } else if (this.mode_ === Mode.POLYGON) {
+ this.sketchCoords_ = [[start.slice(), start.slice()]];
+ this.sketchLineCoords_ = this.sketchCoords_[0];
+ } else {
+ this.sketchCoords_ = [start.slice(), start.slice()];
+ }
+ if (this.sketchLineCoords_) {
+ this.sketchLine_ = new Feature(new LineString(this.sketchLineCoords_));
+ }
+ var geometry = this.geometryFunction_(
+ this.sketchCoords_,
+ undefined,
+ projection
+ );
+ this.sketchFeature_ = new Feature();
+ if (this.geometryName_) {
+ this.sketchFeature_.setGeometryName(this.geometryName_);
+ }
+ this.sketchFeature_.setGeometry(geometry);
+ this.updateSketchFeatures_();
+ this.dispatchEvent(
+ new DrawEvent(DrawEventType.DRAWSTART, this.sketchFeature_)
+ );
+ };
+ /**
+ * Modify the drawing.
+ * @param {import("ol/coordinate.js").Coordinate} coordinate Coordinate.
+ * @private
+ */
+ Draw.prototype.modifyDrawing_ = function (coordinate) {
+ var map = this.getMap();
+ var geometry = this.sketchFeature_.getGeometry();
+ var projection = map.getView().getProjection();
+ var coordinates, last;
+ if (this.mode_ === Mode.POINT) {
+ last = this.sketchCoords_;
+ } else if (this.mode_ === Mode.POLYGON) {
+ coordinates = /** @type {PolyCoordType} */ (this.sketchCoords_)[0];
+ last = coordinates[coordinates.length - 1];
+ if (this.atFinish_(map.getPixelFromCoordinate(coordinate))) {
+ // snap to finish
+ coordinate = this.finishCoordinate_.slice();
+ }
+ } else {
+ coordinates = this.sketchCoords_;
+ last = coordinates[coordinates.length - 1];
+ }
+ last[0] = coordinate[0];
+ last[1] = coordinate[1];
+ this.geometryFunction_(
+ /** @type {!LineCoordType} */ (this.sketchCoords_),
+ geometry,
+ projection
+ );
+ if (this.sketchPoint_) {
+ var sketchPointGeom = this.sketchPoint_.getGeometry();
+ sketchPointGeom.setCoordinates(coordinate);
+ }
+ if (
+ geometry.getType() === GeometryType.POLYGON &&
+ this.mode_ !== Mode.POLYGON
+ ) {
+ this.createOrUpdateCustomSketchLine_(/** @type {Polygon} */ (geometry));
+ } else if (this.sketchLineCoords_) {
+ var sketchLineGeom = this.sketchLine_.getGeometry();
+ sketchLineGeom.setCoordinates(this.sketchLineCoords_);
+ }
+ this.updateSketchFeatures_();
+ };
+ /**
+ * Add a new coordinate to the drawing.
+ * @param {!PointCoordType} coordinate Coordinate
+ * @private
+ */
+ Draw.prototype.addToDrawing_ = function (coordinate) {
+ var geometry = this.sketchFeature_.getGeometry();
+ var projection = this.getMap().getView().getProjection();
+ var done;
+ var coordinates;
+ var mode = this.mode_;
+ if (mode === Mode.LINE_STRING || mode === Mode.CIRCLE) {
+ this.finishCoordinate_ = coordinate.slice();
+ coordinates = /** @type {LineCoordType} */ (this.sketchCoords_);
+ if (coordinates.length >= this.maxPoints_) {
+ if (this.freehand_) {
+ coordinates.pop();
+ } else {
+ done = true;
+ }
+ }
+ coordinates.push(coordinate.slice());
+ this.geometryFunction_(coordinates, geometry, projection);
+ } else if (mode === Mode.POLYGON) {
+ coordinates = /** @type {PolyCoordType} */ (this.sketchCoords_)[0];
+ if (coordinates.length >= this.maxPoints_) {
+ if (this.freehand_) {
+ coordinates.pop();
+ } else {
+ done = true;
+ }
+ }
+ coordinates.push(coordinate.slice());
+ if (done) {
+ this.finishCoordinate_ = coordinates[0];
+ }
+ this.geometryFunction_(this.sketchCoords_, geometry, projection);
+ }
+ this.createOrUpdateSketchPoint_(coordinate.slice());
+ this.updateSketchFeatures_();
+ if (done) {
+ this.finishDrawing();
+ }
+ };
+ /**
+ * Remove last point of the feature currently being drawn. Does not do anything when
+ * drawing POINT or MULTI_POINT geometries.
+ * @api
+ */
+ Draw.prototype.removeLastPoint = function () {
+ if (!this.sketchFeature_) {
+ return;
+ }
+ var geometry = this.sketchFeature_.getGeometry();
+ var projection = this.getMap().getView().getProjection();
+ var coordinates;
+ var mode = this.mode_;
+ if (mode === Mode.LINE_STRING || mode === Mode.CIRCLE) {
+ coordinates = /** @type {LineCoordType} */ (this.sketchCoords_);
+ coordinates.splice(-2, 1);
+ if (coordinates.length >= 2) {
+ this.finishCoordinate_ = coordinates[coordinates.length - 2].slice();
+ var finishCoordinate = this.finishCoordinate_.slice();
+ coordinates[coordinates.length - 1] = finishCoordinate;
+ this.createOrUpdateSketchPoint_(finishCoordinate);
+ }
+ this.geometryFunction_(coordinates, geometry, projection);
+ if (geometry.getType() === GeometryType.POLYGON && this.sketchLine_) {
+ this.createOrUpdateCustomSketchLine_(/** @type {Polygon} */ (geometry));
+ }
+ } else if (mode === Mode.POLYGON) {
+ coordinates = /** @type {PolyCoordType} */ (this.sketchCoords_)[0];
+ coordinates.splice(-2, 1);
+ var sketchLineGeom = this.sketchLine_.getGeometry();
+ if (coordinates.length >= 2) {
+ var finishCoordinate = coordinates[coordinates.length - 2].slice();
+ coordinates[coordinates.length - 1] = finishCoordinate;
+ this.createOrUpdateSketchPoint_(finishCoordinate);
+ }
+ sketchLineGeom.setCoordinates(coordinates);
+ this.geometryFunction_(this.sketchCoords_, geometry, projection);
+ }
+ if (coordinates.length === 1) {
+ this.abortDrawing();
+ }
+ this.updateSketchFeatures_();
+ };
+ /**
+ * Stop drawing and add the sketch feature to the target layer.
+ * The {@link module:ol/interaction/Draw~DrawEventType.DRAWEND} event is
+ * dispatched before inserting the feature.
+ * @api
+ */
+ Draw.prototype.finishDrawing = function () {
+ // console.log("finishDrawing")
+ var sketchFeature = this.abortDrawing_();
+ if (!sketchFeature) {
+ return;
+ }
+ var coordinates = this.sketchCoords_;
+ var geometry = sketchFeature.getGeometry();
+ var projection = this.getMap().getView().getProjection();
+ if (this.mode_ === Mode.LINE_STRING) {
+ // remove the redundant last point
+ coordinates.pop();
+ this.geometryFunction_(coordinates, geometry, projection);
+ } else if (this.mode_ === Mode.POLYGON) {
+ // remove the redundant last point in ring
+ /** @type {PolyCoordType} */ (coordinates)[0].pop();
+ this.geometryFunction_(coordinates, geometry, projection);
+ coordinates = geometry.getCoordinates();
+ }
+ // cast multi-part geometries
+ if (this.type_ === GeometryType.MULTI_POINT) {
+ sketchFeature.setGeometry(
+ new MultiPoint([/** @type {PointCoordType} */ (coordinates)])
+ );
+ } else if (this.type_ === GeometryType.MULTI_LINE_STRING) {
+ sketchFeature.setGeometry(
+ new MultiLineString([/** @type {LineCoordType} */ (coordinates)])
+ );
+ } else if (this.type_ === GeometryType.MULTI_POLYGON) {
+ sketchFeature.setGeometry(
+ new MultiPolygon([/** @type {PolyCoordType} */ (coordinates)])
+ );
+ }
+ // First dispatch event to allow full set up of feature
+ this.dispatchEvent(new DrawEvent(DrawEventType.DRAWEND, sketchFeature));
+ // Then insert feature
+ if (this.features_) {
+ this.features_.push(sketchFeature);
+ }
+ if (this.source_) {
+ this.source_.addFeature(sketchFeature);
+ }
+ };
+ /**
+ * Stop drawing without adding the sketch feature to the target layer.
+ * @return {Feature} The sketch feature (or null if none).
+ * @private
+ */
+ Draw.prototype.abortDrawing_ = function () {
+ this.finishCoordinate_ = null;
+ var sketchFeature = this.sketchFeature_;
+ this.sketchFeature_ = null;
+ this.sketchPoint_ = null;
+ this.sketchLine_ = null;
+ this.overlay_.getSource().clear(true);
+ return sketchFeature;
+ };
+ /**
+ * Stop drawing without adding the sketch feature to the target layer.
+ * @api
+ */
+ Draw.prototype.abortDrawing = function () {
+ var sketchFeature = this.abortDrawing_();
+ if (sketchFeature) {
+ this.dispatchEvent(new DrawEvent(DrawEventType.DRAWABORT, sketchFeature));
+ }
+ };
+ /**
+ * Append coordinates to the end of the geometry that is currently being drawn.
+ * This can be used when drawing LineStrings or Polygons. Coordinates will
+ * either be appended to the current LineString or the outer ring of the current
+ * Polygon. If no geometry is being drawn, a new one will be created.
+ * @param {!LineCoordType} coordinates Linear coordinates to be appended to
+ * the coordinate array.
+ * @api
+ */
+ Draw.prototype.appendCoordinates = function (coordinates) {
+ var mode = this.mode_;
+ var newDrawing = !this.sketchFeature_;
+ if (newDrawing) {
+ this.startDrawing_(coordinates[0]);
+ }
+ /** @type {LineCoordType} */
+ var sketchCoords;
+ if (mode === Mode.LINE_STRING || mode === Mode.CIRCLE) {
+ sketchCoords = /** @type {LineCoordType} */ (this.sketchCoords_);
+ } else if (mode === Mode.POLYGON) {
+ sketchCoords =
+ this.sketchCoords_ && this.sketchCoords_.length
+ ? /** @type {PolyCoordType} */ (this.sketchCoords_)[0]
+ : [];
+ } else {
+ return;
+ }
+ if (newDrawing) {
+ sketchCoords.shift();
+ }
+ // Remove last coordinate from sketch drawing (this coordinate follows cursor position)
+ sketchCoords.pop();
+ // Append coordinate list
+ for (var i = 0; i < coordinates.length; i++) {
+ this.addToDrawing_(coordinates[i]);
+ }
+ var ending = coordinates[coordinates.length - 1];
+ // Duplicate last coordinate for sketch drawing (cursor position)
+ this.addToDrawing_(ending);
+ this.modifyDrawing_(ending);
+ };
+ /**
+ * Initiate draw mode by starting from an existing geometry which will
+ * receive new additional points. This only works on features with
+ * `LineString` geometries, where the interaction will extend lines by adding
+ * points to the end of the coordinates array.
+ * This will change the original feature, instead of drawing a copy.
+ *
+ * The function will dispatch a `drawstart` event.
+ *
+ * @param {!Feature<LineString>} feature Feature to be extended.
+ * @api
+ */
+ Draw.prototype.extend = function (feature) {
+ var geometry = feature.getGeometry();
+ var lineString = geometry;
+ this.sketchFeature_ = feature;
+ this.sketchCoords_ = lineString.getCoordinates();
+ var last = this.sketchCoords_[this.sketchCoords_.length - 1];
+ this.finishCoordinate_ = last.slice();
+ this.sketchCoords_.push(last.slice());
+ this.sketchPoint_ = new Feature(new Point(last));
+ this.updateSketchFeatures_();
+ this.dispatchEvent(
+ new DrawEvent(DrawEventType.DRAWSTART, this.sketchFeature_)
+ );
+ };
+ /**
+ * Redraw the sketch features.
+ * @private
+ */
+ Draw.prototype.updateSketchFeatures_ = function () {
+ var sketchFeatures = [];
+ if (this.sketchFeature_) {
+ sketchFeatures.push(this.sketchFeature_);
+ }
+ if (this.sketchLine_) {
+ sketchFeatures.push(this.sketchLine_);
+ }
+ if (this.sketchPoint_) {
+ sketchFeatures.push(this.sketchPoint_);
+ }
+ var overlaySource = this.overlay_.getSource();
+ overlaySource.clear(true);
+ overlaySource.addFeatures(sketchFeatures);
+ };
+ /**
+ * @private
+ */
+ Draw.prototype.updateState_ = function () {
+ var map = this.getMap();
+ var active = this.getActive();
+ if (!map || !active) {
+ this.abortDrawing();
+ }
+ this.overlay_.setMap(active ? map : null);
+ };
+ return Draw;
+})(PointerInteraction);
+/**
+ * @return {import("ol/style/Style.js").StyleFunction} Styles.
+ */
+function getDefaultStyleFunction() {
+ var styles = createEditingStyle();
+ return function (feature, resolution) {
+ return styles[feature.getGeometry().getType()];
+ };
+}
+/**
+ * Create a `geometryFunction` for `type: 'Circle'` that will create a regular
+ * polygon with a user specified number of sides and start angle instead of a
+ * `import("ol/geom/Circle.js").Circle` geometry.
+ * @param {number} [opt_sides] Number of sides of the regular polygon.
+ * Default is 32.
+ * @param {number} [opt_angle] Angle of the first point in counter-clockwise
+ * radians. 0 means East.
+ * Default is the angle defined by the heading from the center of the
+ * regular polygon to the current pointer position.
+ * @return {GeometryFunction} Function that draws a polygon.
+ * @api
+ */
+export function createRegularPolygon(opt_sides, opt_angle) {
+ return function (coordinates, opt_geometry, projection) {
+ var center = fromUserCoordinate(
+ /** @type {LineCoordType} */ (coordinates)[0],
+ projection
+ );
+ var end = fromUserCoordinate(
+ /** @type {LineCoordType} */ (coordinates)[coordinates.length - 1],
+ projection
+ );
+ var radius = Math.sqrt(squaredCoordinateDistance(center, end));
+ var geometry = opt_geometry
+ ? /** @type {Polygon} */ (opt_geometry)
+ : fromCircle(new Circle(center), opt_sides);
+ var angle = opt_angle;
+ if (!opt_angle && opt_angle !== 0) {
+ var x = end[0] - center[0];
+ var y = end[1] - center[1];
+ angle = Math.atan2(y, x);
+ }
+ makeRegular(geometry, center, radius, angle);
+ var userProjection = getUserProjection();
+ if (userProjection) {
+ geometry.transform(projection, userProjection);
+ }
+ return geometry;
+ };
+}
+/**
+ * Create a `geometryFunction` that will create a box-shaped polygon (aligned
+ * with the coordinate system axes). Use this with the draw interaction and
+ * `type: 'Circle'` to return a box instead of a circle geometry.
+ * @return {GeometryFunction} Function that draws a box-shaped polygon.
+ * @api
+ */
+export function createBox() {
+ return function (coordinates, opt_geometry, projection) {
+ var extent = boundingExtent(
+ /** @type {LineCoordType} */ ([
+ coordinates[0],
+ coordinates[coordinates.length - 1],
+ ]).map(function (coordinate) {
+ return fromUserCoordinate(coordinate, projection);
+ })
+ );
+ var boxCoordinates = [
+ [
+ getBottomLeft(extent),
+ getBottomRight(extent),
+ getTopRight(extent),
+ getTopLeft(extent),
+ getBottomLeft(extent),
+ ],
+ ];
+ var geometry = opt_geometry;
+ if (geometry) {
+ geometry.setCoordinates(boxCoordinates);
+ } else {
+ geometry = new Polygon(boxCoordinates);
+ }
+ var userProjection = getUserProjection();
+ if (userProjection) {
+ geometry.transform(projection, userProjection);
+ }
+ return geometry;
+ };
+}
+/**
+ * Get the drawing mode. The mode for multi-part geometries is the same as for
+ * their single-part cousins.
+ * @param {import("ol/geom/GeometryType.js").default} type Geometry type.
+ * @return {Mode} Drawing mode.
+ */
+function getMode(type) {
+ switch (type) {
+ case GeometryType.POINT:
+ case GeometryType.MULTI_POINT:
+ return Mode.POINT;
+ case GeometryType.LINE_STRING:
+ case GeometryType.MULTI_LINE_STRING:
+ return Mode.LINE_STRING;
+ case GeometryType.POLYGON:
+ case GeometryType.MULTI_POLYGON:
+ return Mode.POLYGON;
+ case GeometryType.CIRCLE:
+ return Mode.CIRCLE;
+ default:
+ throw new Error("Invalid type: " + type);
+ }
+}
+export default Draw;
+//# sourceMappingURL=Draw.js.map
diff --git a/src/components/mapOncePoint/chousePoint copy.vue b/src/components/mapOncePoint/chousePoint copy.vue
new file mode 100644
index 0000000..42f2e67
--- /dev/null
+++ b/src/components/mapOncePoint/chousePoint copy.vue
@@ -0,0 +1,46 @@
+<template>
+ <div>
+ <div class="myInput" @click="openMaps" v-show="!isOpenMaps">
+ <el-input
+ placeholder="点击选择地点"
+ :disabled="true"
+ class="input-with-select"
+ >
+ <el-button
+ slot="append"
+ icon="el-icon-location"
+ style="font-size: 24px"
+ ></el-button>
+ </el-input>
+ </div>
+ <div v-show="isOpenMaps" style="mapOncePoints" class="myInputMap">
+ <mapOncePoint ref="mapOncePoint" :isOpenMaps="isOpenMaps" />
+ </div>
+ </div>
+</template>
+
+<script>
+import mapOncePoint from "./mapOncePoint.vue";
+export default {
+ components: {
+ mapOncePoint,
+ },
+ data() {
+ return {
+ isOpenMaps: false,
+ };
+ },
+ methods: {
+ openMaps() {
+ this.isOpenMaps = true;
+ },
+ },
+};
+</script>
+
+<style lang="scss" scoped>
+.myInputMap {
+ width: 100%;
+ height: 500px;
+}
+</style>
diff --git a/src/components/mapOncePoint/chousePoint.vue b/src/components/mapOncePoint/chousePoint.vue
new file mode 100644
index 0000000..2609b43
--- /dev/null
+++ b/src/components/mapOncePoint/chousePoint.vue
@@ -0,0 +1,59 @@
+<template>
+ <div>
+ <avue-input-map
+ :params="params"
+ placeholder="请选择地点"
+ v-model="chousePointData"
+ ></avue-input-map>
+ </div>
+</template>
+
+<script>
+import mapOncePoint from "./mapOncePoint.vue";
+export default {
+ components: {
+ mapOncePoint,
+ },
+ data() {
+ return {
+ params: {
+ zoom: 10,
+ // zoomEnable: false,
+ // dragEnable: false,
+ },
+ chousePointData: [115.87179386, 28.74509276, ""],
+ };
+ },
+ watch: {
+ chousePointData: {
+ handler(oldData, newData) {
+ // setTimeout(() => {
+ // if (
+ // this.chousePointData[0] &&
+ // this.chousePointData[1] &&
+ // this.chousePointData[2]
+ // ) {
+ this.$emit("setData", this.chousePointData);
+ // } else {
+ // this.$message.error("未成功选择地点");
+ // this.$emit("setData", ["", "", ""]);
+ // }
+ // }, 500);
+ },
+ deep: true,
+ },
+ },
+ methods: {
+ openMaps(data) {
+ this.chousePointData = [data.jd, data.wd, data.name];
+ },
+ },
+};
+</script>
+
+<style lang="scss" scoped>
+.myInputMap {
+ width: 100%;
+ height: 500px;
+}
+</style>
diff --git a/src/components/mapOncePoint/mapOncePoint.vue b/src/components/mapOncePoint/mapOncePoint.vue
new file mode 100644
index 0000000..69dad50
--- /dev/null
+++ b/src/components/mapOncePoint/mapOncePoint.vue
@@ -0,0 +1,897 @@
+<!--
+ * @Descripttion:
+ * @version:
+ * @Author: song
+ * @Date: 2021-04-08 15:14:57
+ * @LastEditors: song
+ * @LastEditTime: 2021-04-24 11:59:43
+-->
+<template>
+ <div id="map" style="height: calc(100% - 40px)">
+ <div class="controlMap">
+ <el-button-group id="openDrawPoiton">
+ <el-button
+ type="primary"
+ icon="el-icon-edit"
+ @click="getTypeSelectedPoint"
+ :disabled="beginDraw"
+ >{{ butTitlePoint }}</el-button
+ >
+ <!-- :disabled="!beginDraw" -->
+ <el-button type="primary" @click="stopDraw" icon="el-icon-delete"
+ >取消</el-button
+ >
+ <!-- <el-button type="primary" icon="el-icon-share"></el-button>
+ <el-button type="primary" icon="el-icon-delete"></el-button> -->
+ </el-button-group>
+ </div>
+ <el-button-group id="dataConfirm" style="display: none">
+ <!-- v-show="butTitle == '重新绘画' || butTitlePoint == '重新标点'" -->
+ <el-button type="success" icon="el-icon-check" @click="useMapData"
+ >确定选择</el-button
+ >
+ <el-button
+ type="danger"
+ @click="clearUseMapData"
+ icon="el-icon-refresh-right"
+ >清空</el-button
+ >
+ </el-button-group>
+ <!-- <el-button type="primary" icon="el-icon-share"></el-button>
+ <el-button type="primary" icon="el-icon-delete"></el-button> -->
+ <tip v-show="showTip" :title="tipTitle" :position="position"></tip>
+ </div>
+</template>
+<script>
+import OLCesium from "olcs/OLCesium.js";
+import "ol/ol.css";
+import OlView from "ol/View.js";
+import XYZ from "ol/source/XYZ";
+import OlLayerTile from "ol/layer/Tile.js";
+import OlMap from "ol/Map.js";
+import tip from "./tip.vue";
+import {
+ // eslint-disable-next-line no-unused-vars
+ defaults as OlControlDefaults,
+ defaults,
+ // 全屏控件
+ FullScreen,
+ // 比例尺控件
+ ScaleLine,
+ // 缩放滚动条控件
+ // eslint-disable-next-line no-unused-vars
+ ZoomSlider,
+ // 鼠标位置控件
+ // eslint-disable-next-line no-unused-vars
+ MousePosition,
+ // -地图属性控件
+ Attribution,
+ // 鹰眼控件
+ // eslint-disable-next-line no-unused-vars
+ OverviewMap,
+ // 缩放到范围控件
+ // eslint-disable-next-line no-unused-vars
+ ZoomToExtent,
+ Rotate,
+} from "ol/control.js";
+
+import VectorLayer from "ol/layer/Vector";
+import VectorSource from "ol/source/Vector";
+
+import { OSM, TileWMS, Vector } from "ol/source";
+// import Draw from "ol/interaction/Draw";
+import Draw from "./Draw";
+
+import Feature from "ol/Feature.js";
+import Point from "ol/geom/Point.js";
+import LineString from "ol/geom/LineString.js";
+import { Icon, Style, Fill, Stroke } from "ol/style.js";
+
+// import drawFence from "./drawFence";
+
+import OlFeature from "ol/Feature";
+import OlGeomPoint from "ol/geom/Point";
+// import OlLayerVector from "ol/layer/Vector";
+// import OlSourceVector from "ol/source/Vector";
+import OlStyleStyle from "ol/style/Style";
+import OlStyleIcon from "ol/style/Icon";
+// // 用来添加相关文字描述的
+// import Text from "ol/style/Text";
+// // import Fill from "ol/style/Fill";
+// import Cesium from "libs/Cesium/Cesium.js";
+
+export default {
+ name: "Map",
+ components: {
+ tip,
+ },
+ props: ["isOpenMaps"],
+ data() {
+ return {
+ // gunAddlayer: new VectorLayer({
+ // // 图标图层
+ // zIndex: 22,
+ // source: new VectorSource(),
+ // }),
+ // peopleAddlayer: new VectorLayer({
+ // // 图标图层
+ // zIndex: 22,
+ // source: new VectorSource(),
+ // }),
+ // carAddlayer: new VectorLayer({
+ // // 图标图层
+ // zIndex: 22,
+ // source: new VectorSource(),
+ // }),
+ // peopleLineAddlayer: new VectorLayer({
+ // // 图标图层
+ // zIndex: 22,
+ // source: new VectorSource(),
+ // }),
+ // beginsPoint: new VectorLayer({
+ // // 图标图层
+ // zIndex: 22,
+ // source: new VectorSource(),
+ // }),
+
+ // 存储新增点,线,面,数据的地方
+ // polygonData: [],
+ // polygonFlag: false,
+ // editToolbar: null,
+ // addPolygonEntitys: null,
+
+ typeSelected: "LineString",
+ drawLayer: null,
+ draw: null,
+ coordinates: [],
+ coordinatesStr: "",
+ beginDraw: false,
+ butTitle: "开始绘画",
+ view: "",
+ // map: null,
+
+ showTip: false,
+ tipTitle: "",
+ position: {
+ w: 200,
+ h: 10,
+ },
+ // openDrawChiose: "", //openDrawPoint openDrawLine
+ openDrawLine: false,
+ openDrawPoint: false,
+
+ butTitlePoint: "选择标点",
+ olLayer: null, //点图层
+
+ nowIndex: "", //返回第几个
+
+ fromView: false, //若是查看 不显示更改按钮
+ };
+ },
+ computed: {
+ openDrawChiose() {
+ if (this.openDrawLine) {
+ return "openDrawLine";
+ } else if (this.openDrawPoint) {
+ return "openDrawPoint";
+ } else {
+ return "";
+ }
+ },
+ },
+ watch: {
+ isOpenMaps() {
+ if (this.isOpenMaps) {
+ this.createMap();
+ }
+ },
+ },
+ mounted() {
+ // const ol2dOncePoint = new OlMap({
+ // layers: [
+ // // new OlLayerTile({
+ // // zIndex: 4,
+ // // title: "影像",
+ // // source: new XYZ({
+ // // url: "https://webmap-tile.sf-express.com/MapTileService/rt?fetchtype=static&x={x}&y={y}&z={z}&project=sfmap&pic_size=256&pic_type=png8&data_name=361100&data_format=merged-dat&data_type=normal", // 行政区划
+ // // }),
+ // // }),
+ // // new OlLayerTile({
+ // // zIndex: 5,
+ // // title: "道路+中文注记",
+ // // source: new XYZ({
+ // // url: "http://t3.tianditu.com/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=e9533f5acb2ac470b07f406a4d24b4f0", // 注记
+ // // }),
+ // // }),
+ // new OlLayerTile({
+ // zIndex: 4,
+ // title: "矢量",
+ // source: new XYZ({
+ // url: "http://t3.tianditu.com/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=e9533f5acb2ac470b07f406a4d24b4f0", // 行政区划
+ // // url: "/localData/sl/{z}/{x}/{y}.png",
+ // tileUrlFunction: function (tileCoord) {
+ // var z = tileCoord[0];
+ // var x = tileCoord[1];
+ // var y = Math.pow(2, z) + tileCoord[2];
+ // return "../assets/sl/" + z + "/" + x + "/" + y + ".png";
+ // },
+ // }),
+ // }),
+ // new OlLayerTile({
+ // zIndex: 5,
+ // title: "中文注记",
+ // source: new XYZ({
+ // url: "http://t3.tianditu.com/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=e9533f5acb2ac470b07f406a4d24b4f0", // 注记
+ // }),
+ // }),
+ // ],
+
+ // // 注意地图控件的写法
+ // controls: defaults().extend([
+ // // new FullScreen(),
+ // // new ScaleLine(),
+ // // new MousePosition(),
+ // // new Rotate(),
+ // // new Attribution()
+ // ]),
+ // target: "map",
+ // view: new OlView({
+ // center: [0, 0],
+ // zoom: 2,
+ // projection: "EPSG:4326",
+ // }),
+ // });
+ // window.ol2dOncePoint = ol2dOncePoint;
+
+ // var view = ol2dOncePoint.getView();
+ // console.log(ol2dOncePoint);
+ // // let provider = new Cesium.UrlTemplateImageryProvider({
+ // // url: "/wp/{z}/{x}/{y}.png",
+ // // fileExtension: "png",
+ // // });
+ // // view.imageryLayers.addImageryProvider(provider);
+
+ // // view.setCenter([115.85883507433789, 28.708432053474827])
+ // view.setCenter([114.03858862, 27.63088262]);
+
+ // //
+ // view.setZoom(18);
+ // this.view = view;
+ // const ol3d = new OLCesium({ map: window.ol2dOncePoint });
+ // window.ol3d = ol3d;
+
+ // ol2dOncePoint.addLayer(this.gunAddlayer);
+ // ol2dOncePoint.addLayer(this.peopleAddlayer);
+ // ol2dOncePoint.addLayer(this.carAddlayer);
+ // ol2dOncePoint.addLayer(this.peopleLineAddlayer);
+ // ol2dOncePoint.addLayer(this.beginsPoint);
+ // this.addLines()
+ // let that = this;
+ // that.addNewLine();
+
+ return;
+ that.beginsPoint.getSource().clear();
+ let iconFeature = new OlFeature({
+ geometry: new OlGeomPoint([114.03928791, 27.62954732]), //绘制图形(点)
+ });
+ iconFeature.setStyle(
+ new OlStyleStyle({
+ image: new OlStyleIcon({
+ scale: 0.5,
+ offset: [0, 5],
+ offsetOrigin: "bottom",
+ //透明度
+ opacity: 1,
+ //图片路径
+ src: "img/dingwei/dingwei4.png",
+ }),
+ })
+ );
+ that.beginsPoint.getSource().addFeature(iconFeature);
+
+ //监听鼠标位置
+ //
+ },
+ methods: {
+ createMap() {
+ const ol2dOncePoint = new OlMap({
+ layers: [
+ // new OlLayerTile({
+ // zIndex: 4,
+ // title: "影像",
+ // source: new XYZ({
+ // url: "https://webmap-tile.sf-express.com/MapTileService/rt?fetchtype=static&x={x}&y={y}&z={z}&project=sfmap&pic_size=256&pic_type=png8&data_name=361100&data_format=merged-dat&data_type=normal", // 行政区划
+ // }),
+ // }),
+ // new OlLayerTile({
+ // zIndex: 5,
+ // title: "道路+中文注记",
+ // source: new XYZ({
+ // url: "http://t3.tianditu.com/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=e9533f5acb2ac470b07f406a4d24b4f0", // 注记
+ // }),
+ // }),
+ new OlLayerTile({
+ zIndex: 4,
+ title: "矢量",
+ source: new XYZ({
+ url: "http://t3.tianditu.com/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=e9533f5acb2ac470b07f406a4d24b4f0", // 行政区划
+ // url: "/localData/sl/{z}/{x}/{y}.png",
+ tileUrlFunction: function (tileCoord) {
+ var z = tileCoord[0];
+ var x = tileCoord[1];
+ var y = Math.pow(2, z) + tileCoord[2];
+ return "../assets/sl/" + z + "/" + x + "/" + y + ".png";
+ },
+ }),
+ }),
+ new OlLayerTile({
+ zIndex: 5,
+ title: "中文注记",
+ source: new XYZ({
+ url: "http://t3.tianditu.com/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=e9533f5acb2ac470b07f406a4d24b4f0", // 注记
+ }),
+ }),
+ ],
+
+ // 注意地图控件的写法
+ controls: defaults().extend([
+ // new FullScreen(),
+ // new ScaleLine(),
+ // new MousePosition(),
+ // new Rotate(),
+ // new Attribution()
+ ]),
+ target: "map",
+ view: new OlView({
+ center: [0, 0],
+ zoom: 2,
+ projection: "EPSG:4326",
+ }),
+ });
+ window.ol2dOncePoint = ol2dOncePoint;
+
+ var view = ol2dOncePoint.getView();
+ // console.log(ol2dOncePoint);
+ // let provider = new Cesium.UrlTemplateImageryProvider({
+ // url: "/wp/{z}/{x}/{y}.png",
+ // fileExtension: "png",
+ // });
+ // view.imageryLayers.addImageryProvider(provider);
+
+ // view.setCenter([115.85883507433789, 28.708432053474827])
+ view.setCenter([114.03858862, 27.63088262]);
+
+ //
+ view.setZoom(18);
+ this.view = view;
+ },
+ init(val, num, value, fromView) {
+ if (fromView) {
+ this.fromView = fromView;
+ }
+ //若是查看 不显示更改按钮
+ //初始化
+ // console.log(val, "地图初始化", "第:" + num);
+ this.nowIndex = num;
+ if (val.indexOf("路径") != -1) {
+ // console.log("加载路径");
+ if (!fromView) {
+ this.openDrawLineMethod();
+ }
+ if (value) {
+ //有数据就加载
+ this.addLinesDraw(value);
+ }
+ } else {
+ // console.log("加载标点");
+ if (!fromView) {
+ this.openDrawPointMethod();
+ }
+ if (value) {
+ //有数据就加载
+ let intlat = value;
+ if (typeof value == "string") {
+ intlat = value.split(","); //改为数组
+ intlat = [+intlat[0], +intlat[1]]; //改为数字
+ }
+ this.addIconMarker(intlat);
+ }
+ }
+ },
+ useMapData() {
+ //返回用数据
+ this.$parent.MapDataShow = false;
+ let val;
+ if (this.openDrawPoint) {
+ val = "point";
+ } else if (this.openDrawLine) {
+ val = "line";
+ }
+ this.$parent.backMapData(val, this.nowIndex);
+ },
+ clearUseMapData() {
+ if (this.openDrawPoint) {
+ this.$store.commit("setPointData", ""); //用vuex清空最终数据
+ } else if (this.openDrawLine) {
+ this.$store.commit("setRotesData", ""); //用vuex清空最终数据
+ }
+ this.useMapData();
+ },
+ openDrawLineMethod() {
+ if (this.openDrawPoint) {
+ this.openDrawPoint = false;
+ // $("#openDrawPoiton").hide();
+ }
+ //打开画路径
+ $("#openDrawLine").toggle(100);
+ this.openDrawLine = !this.openDrawLine;
+ },
+ openDrawPointMethod() {
+ if (this.openDrawLine) {
+ this.openDrawLine = false;
+ $("#openDrawLine").hide();
+ }
+ //打开画点
+ // $("#openDrawPoiton").toggle(100);
+ this.openDrawPoint = !this.openDrawPoint;
+ },
+ getTypeSelectedPoint() {
+ this.tipTitle = "单击左键选择位置";
+ let that = this;
+ let isHaveOne = false;
+ $("#map")
+ .off("mousemove")
+ .mousemove(function (e) {
+ if (!that.showTip) {
+ that.showTip = true;
+ }
+ that.setTipPosition(e.offsetX, e.offsetY, 10, 10);
+ // console.log(e.clientX);
+ // console.log(e.offsetX);
+ // console.log(e.pageX);
+ // console.log(e.screenX);
+ // console.log("================================");
+ });
+
+ if (this.typeSelected !== "None") {
+ this.draw = new Draw({
+ source: this.drawLayer.getSource(),
+ type: this.typeSelected,
+ style: new Style({
+ stroke: new Stroke({
+ color: "red",
+ width: 3,
+ }),
+ }),
+ isPoint: true,
+ coordinate: function (res) {},
+ coordinateOverPoint: function (res) {
+ if (isHaveOne) {
+ return;
+ }
+ that.$store.commit("setPointData", res.coordinate); //用vuex传最终数据
+ // console.log(res.coordinate);//输出点
+ that.addIconMarker(res.coordinate);
+ isHaveOne = true;
+ },
+ });
+ this.map.addInteraction(this.draw);
+ }
+
+ // 选点
+ // this.addIconMarker([115.9111272006128, 28.699307185841562]);
+ },
+ addIconMarker(intlat) {
+ let that = this;
+ that.carAddlayer.getSource().clear();
+ // if (this.olLayer) {
+ // window.ol2dOncePoint.removeLayer(this.olLayer);
+ // }
+ // let iconFeatures;
+
+ // this.olLayer = new VectorLayer({
+ // // 图标图层
+ // zIndex: 22,
+ // source: new VectorSource(),
+ // });
+ let iconFeature = new OlFeature({
+ geometry: new OlGeomPoint(intlat), //绘制图形(点)
+ });
+ iconFeature.setStyle(
+ new OlStyleStyle({
+ image: new OlStyleIcon({
+ scale: 0.5,
+ //控制标注图片和文字之间的距离
+ // anchor: [0.2, 1],
+ //标注样式的起点位置
+ // anchorOrigin: "top-right",
+ //X方向单位:分数
+ // anchorXUnits: "10px",
+ //Y方向单位:像素
+ // anchorYUnits: "-10px",
+ //偏移起点位置的方向
+ offset: [0, 5],
+ offsetOrigin: "bottom",
+ //透明度
+ opacity: 1,
+ //图片路径
+ // src: require("img/logos.png"),
+ src: "img/dingwei/dingwei5.png",
+ }),
+ })
+ );
+
+ // 加载多个点用addFeatures,一个点用addFeature
+ // this.olLayer.getSource().addFeature(iconFeature);
+ that.carAddlayer.getSource().addFeature(iconFeature);
+ // window.ol2dOncePoint.addLayer(this.olLayer);
+
+ // var startMarker = new OlFeature({
+ // type: "icon",
+ // // geometry: new OlGeomPoint([118.10131072998047, 36.819305419921875]),
+ // geometry: new OlGeomPoint(intlat),
+ // });
+
+ // var vectorLayer = new OlLayerVector({
+ // source: new OlSourceVector({
+ // features: [startMarker],
+ // }),
+ // style: new OlStyleStyle({
+ // image: new OlStyleIcon({
+ // anchor: [0.5, 1],
+ // src: "img/logos.png",
+ // // src: http://192.168.4.61:9527/static/mapMoniter/0.png
+ // // 说明下,因为vue项目打包之后,我这张图片放到了static目录下,直接给相对路径是无法访问到,
+ // // 可以通过js原生的API拿到对应的前台服务器ip和端口,还有项目名称,就可以访问到,下面附了对应帖子链接
+ // }),
+ // // 设置图片下面显示字体的样式和内容
+ // text: new Text({
+ // text: "文字描述", // 添加文字描述
+ // font: "14px font-size", // 设置字体大小
+ // // fill: new Fill({
+ // // // 设置字体颜色
+ // // color: "#1CAF9A",
+ // // }),
+ // offsetY: 10, // 设置文字偏移量
+ // }),
+ // }),
+ // });
+ // window.ol2dOncePoint.addLayer(vectorLayer);
+
+ this.butTitlePoint = "重新标点";
+ if (!this.fromView) {
+ $("#dataConfirm").show(100);
+ }
+ if (this.draw != null) {
+ this.draw.controlDrawing(true);
+ $("#map").unbind("mousemove");
+ this.tipTitle = "";
+ this.showTip = false;
+ }
+ },
+ goTudefault(x, y) {
+ this.view.setCenter([x, y]);
+ this.view.setZoom(14.5);
+ },
+ init3D(val) {
+ window.ol3d.setEnabled(val);
+ },
+ addEntitys(item, icon, scale, name, type) {
+ const iconFeature = new Feature({
+ geometry: new Point([Number(item.LGTD), Number(item.LTTD)]),
+ name: name,
+ attributes: item,
+ });
+
+ const iconStyle = new Style({
+ // text: new Text({ // 字体, 未成功, 浪费许多时间
+ // font: 'Normal ' + 12 + 'px ' + 'iconfont',
+ // text: "\e645",
+ // fill: new Fill({ color: "green" }),
+ // }),
+
+ image: new Icon({
+ scale: scale,
+ opacity: 1,
+ src: icon,
+ // src: require('../../assets/Mark.png')
+ }),
+
+ // new CircleStyle({ // 普通样式
+ // radius: 6,
+ // fill: new Fill({
+ // color: 'rgba(200, 155, 155, 0.8)'
+ // }),
+ // stroke: new Stroke({
+ // color: 'black',
+ // width: 0.3,
+ // })
+ // }),
+ });
+
+ iconFeature.setStyle(iconStyle);
+
+ this[type].getSource().addFeature(iconFeature);
+ },
+
+ addLines(ringId) {
+ var that = this;
+ if (ringId != null && ringId != "") {
+ $.ajax({
+ url: "api/routeIn/routein/selectList",
+ type: "post",
+ data: {
+ id: ringId,
+ },
+ dataType: "JSON",
+ success: function (data) {
+ that.peopleLineAddlayer.getSource().clear();
+ var entityData = "";
+ var entityArr = [];
+ entityData = data.data[0].routeInfo.match(/\(([^)]*)\)/);
+
+ // 此时result=["(dsfasjfj3124123)", "dsfasjfj3124123"];
+ if (entityData && entityData != "") {
+ entityData = entityData[1].split(",");
+
+ for (var j = 0; j < entityData.length; j++) {
+ entityArr.push([
+ Number(entityData[j].split(" ")[0]),
+ Number(entityData[j].split(" ")[1]),
+ ]);
+ }
+ }
+
+ var lineCoords = entityArr; // 线里点的集合
+
+ var view = ol2dOncePoint.getView();
+ view.setCenter([
+ lineCoords[Math.ceil(entityArr.length / 2)][0],
+ lineCoords[Math.ceil(entityArr.length / 2)][1],
+ ]);
+ view.setZoom(14.5);
+
+ // 要素
+ // var lineCoords = [[featureInfo.lineString[0][0],featureInfo.lineString[0][0]],[featureInfo.lineString(0),featureInfo.lineString(0)]];
+ var feature_LineString = new Feature({
+ geometry: new LineString(lineCoords),
+ });
+
+ feature_LineString.setStyle(
+ new Style({
+ //填充色
+ fill: new Fill({
+ color: "rgba(255, 255, 255, 0.2)",
+ }),
+ //边线颜色
+ stroke: new Stroke({
+ color: "rgb(252, 94, 32)",
+ width: 5,
+ }),
+ })
+ );
+ that.peopleLineAddlayer.getSource().addFeature(feature_LineString);
+ that.butTitle = "修改绘画";
+ },
+ error: function (data) {
+ // 请求失败函数
+ console.log(data);
+ },
+ });
+ }
+ },
+ addNewLine() {
+ this.map = ol2dOncePoint;
+ // console.log(ol2dOncePoint, 1);
+ // console.log(drawFence, 2);
+ // var d = new drawFence(ol2dOncePoint);
+ // console.log(d);
+
+ // 添加一个绘制的线使用的layer
+ this.drawLayer = new VectorLayer({
+ //layer所对应的source
+ source: new Vector(),
+ });
+ //把layer加入到地图中
+ this.map.addLayer(this.drawLayer);
+ },
+ getTypeSelected() {
+ this.beginDraw = true;
+ this.draw && this.map.removeInteraction(this.draw);
+ this.peopleLineAddlayer.getSource().clear();
+ //再根据typeSelect的值绘制新的Interaction
+ this.addInteraction();
+ },
+ stopDraw() {
+ this.$parent.isOpenMaps = false;
+ return;
+ this.showTip = false;
+ this.draw && this.map.removeInteraction(this.draw);
+ this.beginDraw = false;
+ this.tipTitle = "";
+ this.$store.commit("setRotesData", ""); //用vuex传最终数据
+ },
+ setTipPosition(x, y, n, m) {
+ this.position.w = x + n;
+ this.position.h = y + m;
+ },
+ addInteraction() {
+ this.tipTitle = "单击左键或右键开始绘画";
+ $("#map")
+ .off("mousemove")
+ .mousemove(function (e) {
+ if (!that.showTip) {
+ that.showTip = true;
+ }
+ that.setTipPosition(e.offsetX, e.offsetY, 10, 10);
+ // console.log(e.clientX);
+ // console.log(e.offsetX);
+ // console.log(e.pageX);
+ // console.log(e.screenX);
+ // console.log("================================");
+ });
+
+ this.coordinates = [];
+ let value = this.typeSelected,
+ that = this;
+ if (value !== "None") {
+ this.draw = new Draw({
+ source: this.drawLayer.getSource(),
+ type: this.typeSelected,
+ style: new Style({
+ stroke: new Stroke({
+ color: "red",
+ width: 3,
+ }),
+ }),
+ coordinate: function (res) {
+ //画线中的点
+ that.coordinates.push(res.coordinate_);
+ that.tipTitle = "可继续,或选择最终位置双击结束";
+ // console.log(res.coordinate_, 123456);
+ },
+ coordinateOver: function (res) {
+ // 结束绘画 处理数据
+ // console.log(that.doData(that.coordinates));
+ let d = that.doData(that.coordinates);
+ that.addLinesDraw(d);
+ // console.log(d);
+ // console.log(that.$store);
+ that.$store.commit("setRotesData", d); //用vuex传最终数据
+ // that.coordinatesStr = that.doData(that.coordinates);
+ },
+ });
+ this.map.addInteraction(this.draw);
+ }
+ },
+ doData(val) {
+ // ` routeInfo: "
+ // LINESTRING(
+ // 115.875489096939 28.7179278611352
+ // ,115.8794051221 28.7176267680684
+ // ,115.879340749084 28.7143052776491
+ // ,115.878879409134 28.7140324026424
+ // ,115.875220876038 28.7150580325974
+ // ,115.875489096939 28.7179466794231
+ // ,115.875489096939 28.7179466794231
+ // )"
+ // `
+ let str = "LINESTRING(";
+ for (let k = 0; k < val.length; k++) {
+ str += `${val[k][0]} ${val[k][1]}`;
+ if (k != val.length - 1) {
+ str += ",";
+ }
+ }
+ str += ")";
+ return str;
+ },
+ addLinesDraw(val) {
+ var that = this;
+ // if (ringId != null && ringId != "") {
+ // $.ajax({
+ // url: "api/routeIn/routein/selectList",
+ // type: "post",
+ // data: {
+ // id: ringId,
+ // },
+ // dataType: "JSON",
+ // success: function (data) {
+ that.peopleLineAddlayer.getSource().clear();
+ var entityData = "";
+ var entityArr = [];
+ entityData = val.match(/\(([^)]*)\)/);
+
+ // 此时result=["(dsfasjfj3124123)", "dsfasjfj3124123"];
+ if (entityData && entityData != "") {
+ entityData = entityData[1].split(",");
+
+ for (var j = 0; j < entityData.length; j++) {
+ entityArr.push([
+ Number(entityData[j].split(" ")[0]),
+ Number(entityData[j].split(" ")[1]),
+ ]);
+ }
+ }
+
+ var lineCoords = entityArr; // 线里点的集合
+
+ var view = ol2dOncePoint.getView();
+ view.setCenter([
+ lineCoords[Math.ceil(entityArr.length / 2)][0],
+ lineCoords[Math.ceil(entityArr.length / 2)][1],
+ ]);
+ view.setZoom(14.5);
+
+ // 要素
+ // var lineCoords = [[featureInfo.lineString[0][0],featureInfo.lineString[0][0]],[featureInfo.lineString(0),featureInfo.lineString(0)]];
+ var feature_LineString = new Feature({
+ geometry: new LineString(lineCoords),
+ });
+
+ feature_LineString.setStyle(
+ new Style({
+ //填充色
+ fill: new Fill({
+ color: "rgba(255, 255, 255, 0.2)",
+ }),
+ //边线颜色
+ stroke: new Stroke({
+ color: "rgb(252, 94, 32)",
+ width: 5,
+ }),
+ })
+ );
+ that.peopleLineAddlayer.getSource().addFeature(feature_LineString);
+ that.butTitle = "重新绘画";
+ if (!this.fromView) {
+ $("#dataConfirm").show(100);
+ }
+ if (that.draw != null) {
+ that.beginDraw = false;
+ that.draw.controlDrawing(true);
+ that.tipTitle = "已结束绘画,点击重新绘画清除上次内容并开始绘画";
+ $("#map").unbind("mousemove");
+ // setTimeout(() => {
+ this.tipTitle = "";
+ this.showTip = false;
+ }
+ },
+ },
+};
+</script>
+
+<style scoped lang="scss">
+#map {
+ position: relative;
+ .controlMap {
+ position: absolute;
+ top: 10px;
+ left: calc(50% - 97px);
+ z-index: 2 !important;
+ #openDrawLine,
+ #openDrawPoiton {
+ width: 174px;
+ position: absolute;
+ // top: 43px;
+ top: 10px;
+ // left: calc(50% - 96px);
+ left: 50%;
+ }
+ .openDrawsb {
+ background-color: #fff;
+ color: black;
+ }
+ .activeDraw {
+ background-color: #409eff;
+ color: #fff;
+ }
+ }
+ #dataConfirm {
+ position: absolute;
+ top: 20px;
+ left: calc(50% + 82px);
+ z-index: 3 !important;
+ }
+}
+</style>
diff --git a/src/components/mapOncePoint/tip.vue b/src/components/mapOncePoint/tip.vue
new file mode 100644
index 0000000..d9006f8
--- /dev/null
+++ b/src/components/mapOncePoint/tip.vue
@@ -0,0 +1,25 @@
+<template>
+ <div
+ class="mapTip"
+ :style="{ top: position.h + 'px', left: position.w + 'px' }"
+ >
+ {{ title }}
+ </div>
+</template>
+
+<script>
+export default {
+ props: ["title", "position"],
+};
+</script>
+
+<style lang="scss" scoped>
+.mapTip {
+ background-color: rgb(168, 168, 168);
+ padding: 5px;
+ border: 1px solid #000;
+ position: absolute;
+ z-index: 10 !important;
+ border-radius: 5px;
+}
+</style>
\ No newline at end of file
diff --git a/src/main.js b/src/main.js
index fb0138d..0a50d44 100644
--- a/src/main.js
+++ b/src/main.js
@@ -5,14 +5,16 @@
import router from './router/router'
import './permission' // 权限
import './error' // 日志
-import './cache'//页面缓存
+import './cache' //页面缓存
import store from './store'
-import { loadStyle } from './util/util'
+import {
+ loadStyle
+} from './util/util'
import * as urls from '@/config/env'
import Element from 'element-ui'
import {
- iconfontUrl,
- iconfontVersion
+ iconfontUrl,
+ iconfontVersion
} from '@/config/env'
import i18n from './lang' // Internationalization
import './styles/common.scss'
@@ -28,13 +30,13 @@
Vue.use(router)
Vue.use(VueAxios, axios)
Vue.use(Element, {
- i18n: (key, value) => i18n.t(key, value)
+ i18n: (key, value) => i18n.t(key, value)
})
Vue.use(window.AVUE, {
- size: 'small',
- tableSize: 'small',
- calcHeight: 65,
- i18n: (key, value) => i18n.t(key, value)
+ size: 'small',
+ tableSize: 'small',
+ calcHeight: 65,
+ i18n: (key, value) => i18n.t(key, value)
})
// 注册全局容器
Vue.component('basicContainer', basicContainer)
@@ -43,20 +45,24 @@
Vue.component('avueUeditor', avueUeditor)
// 加载相关url地址
Object.keys(urls).forEach(key => {
- Vue.prototype[key] = urls[key]
+ Vue.prototype[key] = urls[key]
})
// 加载website
Vue.prototype.website = website
// 动态加载阿里云字体库
iconfontVersion.forEach(ele => {
- loadStyle(iconfontUrl.replace('$key', ele))
+ loadStyle(iconfontUrl.replace('$key', ele))
})
Vue.config.productionTip = false
+//加载全局组件选地图定位点,每个页面都要使用
+import chousePoint from './components/mapOncePoint/chousePoint'
+Vue.component("chousePoint", chousePoint);
+
new Vue({
- router,
- store,
- i18n,
- render: h => h(App)
+ router,
+ store,
+ i18n,
+ render: h => h(App)
}).$mount('#app')
diff --git a/src/store/modules/map.js b/src/store/modules/map.js
index ac828a7..4031a66 100644
--- a/src/store/modules/map.js
+++ b/src/store/modules/map.js
@@ -1,6 +1,11 @@
-import { getStore, setStore } from "@/util/store";
+import {
+ getStore,
+ setStore
+} from "@/util/store";
-import { getDictionary } from "@/api/system/dict";
+import {
+ getDictionary
+} from "@/api/system/dict";
const map = {
state: {
@@ -26,6 +31,23 @@
setPointData(state, data) {
state.pointData = data;
},
+ readDom(state, data) {
+ //时间
+ let time = null;
+ //判断dom
+ let checkDom = () => {
+ let dom = data.this.$refs[data.refName];
+ if (dom) {
+ if (data.fn) {
+ data.fn(dom);
+ }
+ return;
+ } else {
+ time = setTimeout(checkDom, 100); //自我调用
+ }
+ }
+ checkDom(); //首次运行
+ },
},
};
diff --git a/src/styles/element-ui.scss b/src/styles/element-ui.scss
index 54c3e92..40321ef 100644
--- a/src/styles/element-ui.scss
+++ b/src/styles/element-ui.scss
@@ -25,7 +25,6 @@
display: none;
}
-
.el-message__icon,
.el-message__content {
display: inline-block;
@@ -49,12 +48,19 @@
padding: 0 !important;
}
-.el-dropdown-menu__item--divided:before, .el-menu, .el-menu--horizontal > .el-menu-item:not(.is-disabled):focus, .el-menu--horizontal > .el-menu-item:not(.is-disabled):hover, .el-menu--horizontal > .el-submenu .el-submenu__title:hover {
+.el-dropdown-menu__item--divided:before,
+.el-menu,
+.el-menu--horizontal > .el-menu-item:not(.is-disabled):focus,
+.el-menu--horizontal > .el-menu-item:not(.is-disabled):hover,
+.el-menu--horizontal > .el-submenu .el-submenu__title:hover {
background-color: transparent;
}
-
-.el-dropdown-menu__item--divided:before, .el-menu, .el-menu--horizontal > .el-menu-item:not(.is-disabled):focus, .el-menu--horizontal > .el-menu-item:not(.is-disabled):hover, .el-menu--horizontal > .el-submenu .el-submenu__title:hover {
+.el-dropdown-menu__item--divided:before,
+.el-menu,
+.el-menu--horizontal > .el-menu-item:not(.is-disabled):focus,
+.el-menu--horizontal > .el-menu-item:not(.is-disabled):hover,
+.el-menu--horizontal > .el-submenu .el-submenu__title:hover {
background-color: transparent !important;
}
@@ -69,3 +75,10 @@
.el-divider--horizontal {
margin: 12px 0 !important;
}
+
+.myInput {
+ cursor: pointer !important;
+ .el-input.is-disabled .el-input__inner {
+ cursor: pointer !important;
+ }
+}
diff --git a/src/views/architecture/architecture.vue b/src/views/architecture/architecture.vue
index 299520d..8a1b33e 100644
--- a/src/views/architecture/architecture.vue
+++ b/src/views/architecture/architecture.vue
@@ -1,39 +1,52 @@
<template>
<basic-container>
- <avue-crud :option="option"
- :table-loading="loading"
- :data="data"
- :page.sync="page"
- :permission="permissionList"
- :before-open="beforeOpen"
- v-model="form"
- ref="crud"
- @row-update="rowUpdate"
- @row-save="rowSave"
- @row-del="rowDel"
- @search-change="searchChange"
- @search-reset="searchReset"
- @selection-change="selectionChange"
- @current-change="currentChange"
- @size-change="sizeChange"
- @refresh-change="refreshChange"
- @on-load="onLoad">
+ <avue-crud
+ :option="option"
+ :table-loading="loading"
+ :data="data"
+ :page.sync="page"
+ :permission="permissionList"
+ :before-open="beforeOpen"
+ v-model="form"
+ ref="crud"
+ @row-update="rowUpdate"
+ @row-save="rowSave"
+ @row-del="rowDel"
+ @search-change="searchChange"
+ @search-reset="searchReset"
+ @selection-change="selectionChange"
+ @current-change="currentChange"
+ @size-change="sizeChange"
+ @refresh-change="refreshChange"
+ @on-load="onLoad"
+ >
<template slot="menuLeft">
- <el-button type="danger"
- size="small"
- icon="el-icon-delete"
- plain
- v-if="permission.architecture_delete"
- @click="handleDelete">删 除
+ <el-button
+ type="danger"
+ size="small"
+ icon="el-icon-delete"
+ plain
+ v-if="permission.architecture_delete"
+ @click="handleDelete"
+ >删 除
</el-button>
+ </template>
+ <template slot-scope="{ type, disabled }" slot="chouseJdWdForm">
+ <chousePoint @setData="getMapDatas" ref="chousePointRef"></chousePoint>
</template>
</avue-crud>
</basic-container>
</template>
<script>
-import {getList, getDetail, add, update, remove} from "@/api/architecture/architecture";
-import {mapGetters} from "vuex";
+import {
+ getList,
+ getDetail,
+ add,
+ update,
+ remove,
+} from "@/api/architecture/architecture";
+import { mapGetters } from "vuex";
export default {
data() {
@@ -44,20 +57,20 @@
page: {
pageSize: 10,
currentPage: 1,
- total: 0
+ total: 0,
},
selectionList: [],
option: {
- height: 'auto',
+ height: "auto",
calcHeight: 30,
tip: false,
searchShow: true,
- align: 'center',
+ align: "center",
searchMenuSpan: 6,
border: true,
index: true,
viewBtn: true,
- indexLabel: '序号',
+ indexLabel: "序号",
selection: true,
dialogClickModal: false,
column: [
@@ -78,16 +91,18 @@
dicUrl: "/api/blade-system/dict-biz/dictionary?code=building",
props: {
label: "dictValue",
- value: "dictKey"
+ value: "dictKey",
},
dataType: "number",
slot: true,
search: true,
- rules: [{
- required: true,
- message: "请输入所属建筑",
- trigger: "blur"
- }]
+ rules: [
+ {
+ required: true,
+ message: "请输入所属建筑",
+ trigger: "blur",
+ },
+ ],
},
{
label: "所属校区",
@@ -96,35 +111,73 @@
type: "tree",
dicUrl: "/api/blade-system/dict-biz/dictionary?code=campus",
props: {
- label: 'dictValue',
- value: 'dictKey'
+ label: "dictValue",
+ value: "dictKey",
},
- rules: [{
- required: true,
- message: "请输入所属校区",
- trigger: "blur"
- }],
+ rules: [
+ {
+ required: true,
+ message: "请输入所属校区",
+ trigger: "blur",
+ },
+ ],
slot: true,
searchSpan: 5,
search: true,
},
{
+ label: "选择地点",
+ prop: "chouseJdWd",
+ hide: true,
+ viewDisplay: false,
+ span: 24,
+ // rules: [
+ // {
+ // required: true,
+ // message: "请选择地点",
+ // trigger: "blur",
+ // },
+ // ],
+ },
+ {
+ label: "详细地点",
+ prop: "addressName",
+ hide: true,
+ // overHidden: true,
+ editDisplay: false,
+ addDisplay: false,
+ span: 24,
+ // rules: [
+ // {
+ // required: true,
+ // message: "请选择地点",
+ // trigger: "blur",
+ // },
+ // ],
+ },
+ {
label: "经度",
prop: "jd",
- rules: [{
- required: true,
- message: "请输入经度",
- trigger: "blur"
- }]
+ disabled: true,
+ rules: [
+ {
+ required: true,
+ message: "请输入经度",
+ trigger: "blur",
+ },
+ ],
},
{
label: "纬度",
prop: "wd",
- rules: [{
- required: true,
- message: "请输入纬度",
- trigger: "blur"
- }]
+ disabled: true,
+ rules: [
+ {
+ required: true,
+ message: "请输入纬度",
+ trigger: "blur",
+ },
+ ],
},
{
label: "偏航角",
@@ -187,8 +240,8 @@
// dataType: 'string',
type: "upload",
propsHttp: {
- res: 'data',
- url: 'link',
+ res: "data",
+ url: "link",
},
span: 10,
listType: "picture-card",
@@ -198,21 +251,21 @@
{
label: "介绍",
prop: "introduce",
- component: 'AvueUeditor',
+ component: "AvueUeditor",
options: {
- action: '/api/blade-resource/oss/endpoint/put-file',
+ action: "/api/blade-resource/oss/endpoint/put-file",
props: {
res: "data",
url: "link",
- }
+ },
},
hide: true,
minRows: 5,
span: 24,
},
- ]
+ ],
},
- data: []
+ data: [],
};
},
computed: {
@@ -222,18 +275,29 @@
addBtn: this.vaildData(this.permission.architecture_add, false),
viewBtn: this.vaildData(this.permission.architecture_view, false),
delBtn: this.vaildData(this.permission.architecture_delete, false),
- editBtn: this.vaildData(this.permission.architecture_edit, false)
+ editBtn: this.vaildData(this.permission.architecture_edit, false),
};
},
ids() {
let ids = [];
- this.selectionList.forEach(ele => {
+ this.selectionList.forEach((ele) => {
ids.push(ele.id);
});
return ids.join(",");
- }
+ },
},
methods: {
+ getMapDatas(res) {
+ this.form["jd"] = res[0];
+ this.form["wd"] = res[1];
+ this.form["addressName"] = res[2];
+ },
+ initData() {
+ getDeptTree().then((res) => {
+ const column = this.findObject(this.option.column, "type");
+ column.dicData = res.data.data;
+ });
+ },
rowSave(row, done, loading) {
var d = [];
//var dk = [];
@@ -245,36 +309,42 @@
// }
row.tpurl = d.join(",");
//row.codeurl = dk.join(",");
- add(row).then(() => {
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- done();
- }, error => {
- loading();
- window.console.log(error);
- });
+ add(row).then(
+ () => {
+ this.onLoad(this.page);
+ this.$message({
+ type: "success",
+ message: "操作成功!",
+ });
+ done();
+ },
+ (error) => {
+ loading();
+ window.console.log(error);
+ }
+ );
},
rowUpdate(row, index, done, loading) {
- update(row).then(() => {
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- done();
- }, error => {
- loading();
- console.log(error);
- });
+ update(row).then(
+ () => {
+ this.onLoad(this.page);
+ this.$message({
+ type: "success",
+ message: "操作成功!",
+ });
+ done();
+ },
+ (error) => {
+ loading();
+ console.log(error);
+ }
+ );
},
rowDel(row) {
this.$confirm("确定将选择数据删除?", {
confirmButtonText: "确定",
cancelButtonText: "取消",
- type: "warning"
+ type: "warning",
})
.then(() => {
return remove(row.id);
@@ -283,7 +353,7 @@
this.onLoad(this.page);
this.$message({
type: "success",
- message: "操作成功!"
+ message: "操作成功!",
});
});
},
@@ -295,7 +365,7 @@
this.$confirm("确定将选择数据删除?", {
confirmButtonText: "确定",
cancelButtonText: "取消",
- type: "warning"
+ type: "warning",
})
.then(() => {
return remove(this.ids);
@@ -304,15 +374,29 @@
this.onLoad(this.page);
this.$message({
type: "success",
- message: "操作成功!"
+ message: "操作成功!",
});
this.$refs.crud.toggleSelection();
});
},
beforeOpen(done, type) {
if (["edit", "view"].includes(type)) {
- getDetail(this.form.id).then(res => {
+ getDetail(this.form.id).then((res) => {
this.form = res.data.data;
+ if (type == "edit") {
+ let that = this;
+ this.$store.commit("readDom", {
+ this: that,
+ refName: "chousePointRef",
+ fn: (dom) => {
+ dom.openMaps({
+ jd: this.form.jd,
+ wd: this.form.wd,
+ name: this.form.addressName,
+ });
+ },
+ });
+ }
});
}
done();
@@ -345,17 +429,20 @@
},
onLoad(page, params = {}) {
this.loading = true;
- getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
+ getList(
+ page.currentPage,
+ page.pageSize,
+ Object.assign(params, this.query)
+ ).then((res) => {
const data = res.data.data;
this.page.total = data.total;
this.data = data.records;
this.loading = false;
this.selectionClear();
});
- }
- }
+ },
+ },
};
</script>
-<style>
-</style>
+<style></style>
diff --git a/src/views/life/life.vue b/src/views/life/life.vue
index c6ac585..cfcf94a 100644
--- a/src/views/life/life.vue
+++ b/src/views/life/life.vue
@@ -1,401 +1,491 @@
<template>
<basic-container>
- <avue-crud :option="option"
- :table-loading="loading"
- :data="data"
- :page.sync="page"
- :permission="permissionList"
- :before-open="beforeOpen"
- v-model="form"
- ref="crud"
- @row-update="rowUpdate"
- @row-save="rowSave"
- @row-del="rowDel"
- @search-change="searchChange"
- @search-reset="searchReset"
- @selection-change="selectionChange"
- @current-change="currentChange"
- @size-change="sizeChange"
- @refresh-change="refreshChange"
- @on-load="onLoad">
+ <avue-crud
+ :option="option"
+ :table-loading="loading"
+ :data="data"
+ :page.sync="page"
+ :permission="permissionList"
+ :before-open="beforeOpen"
+ v-model="form"
+ ref="crud"
+ @row-update="rowUpdate"
+ @row-save="rowSave"
+ @row-del="rowDel"
+ @search-change="searchChange"
+ @search-reset="searchReset"
+ @selection-change="selectionChange"
+ @current-change="currentChange"
+ @size-change="sizeChange"
+ @refresh-change="refreshChange"
+ @on-load="onLoad"
+ >
<template slot="menuLeft">
- <el-button type="danger"
- size="small"
- icon="el-icon-delete"
- plain
- v-if="permission.life_delete"
- @click="handleDelete">删 除
+ <el-button
+ type="danger"
+ size="small"
+ icon="el-icon-delete"
+ plain
+ v-if="permission.life_delete"
+ @click="handleDelete"
+ >删 除
</el-button>
+ </template>
+ <template slot-scope="{ type, disabled }" slot="chouseJdWdForm">
+ <chousePoint @setData="getMapDatas" ref="chousePointRef"></chousePoint>
</template>
</avue-crud>
</basic-container>
</template>
<script>
- import {getList, getDetail, add, update, remove} from "@/api/life/life";
- import {mapGetters} from "vuex";
+import { getList, getDetail, add, update, remove } from "@/api/life/life";
+import { mapGetters } from "vuex";
- export default {
- data() {
- return {
- form: {},
- query: {},
- loading: true,
- page: {
- pageSize: 10,
- currentPage: 1,
- total: 0
- },
- selectionList: [],
- option: {
- height:'auto',
- calcHeight: 30,
- tip: false,
- searchShow: true,
- searchMenuSpan: 6,
- border: true,
- index: true,
- viewBtn: true,
- align: 'center',
- indexLabel: '序号',
- selection: true,
- dialogClickModal: false,
- column: [
- {
- label: "名称",
- searchSpan:5,
- prop: "mechanismname",
- searchLabelwidth: 50,
- search: true,
- rules: [{
+export default {
+ data() {
+ return {
+ form: {},
+ query: {},
+ loading: true,
+ page: {
+ pageSize: 10,
+ currentPage: 1,
+ total: 0,
+ },
+ selectionList: [],
+ option: {
+ height: "auto",
+ calcHeight: 30,
+ tip: false,
+ searchShow: true,
+ searchMenuSpan: 6,
+ border: true,
+ index: true,
+ viewBtn: true,
+ align: "center",
+ indexLabel: "序号",
+ selection: true,
+ dialogClickModal: false,
+ column: [
+ {
+ label: "名称",
+ searchSpan: 5,
+ prop: "mechanismname",
+ searchLabelwidth: 50,
+ search: true,
+ rules: [
+ {
required: true,
message: "请输入名称",
- trigger: "blur"
- }]
- },
- {
- label: "所属设施",
- searchLabelWidth: "110",
- prop: "lifetype",
- type: "tree",
- dicUrl: "/api/blade-system/dict-biz/dictionary?code=life",
- props: {
- label: 'dictValue',
- value: 'dictKey'
+ trigger: "blur",
},
- slot: true,
- searchSpan: 5,
- search: true,
- rules: [{
+ ],
+ },
+ {
+ label: "所属设施",
+ searchLabelWidth: "110",
+ prop: "lifetype",
+ type: "tree",
+ dicUrl: "/api/blade-system/dict-biz/dictionary?code=life",
+ props: {
+ label: "dictValue",
+ value: "dictKey",
+ },
+ slot: true,
+ searchSpan: 5,
+ search: true,
+ rules: [
+ {
required: true,
message: "请输入所属设施",
- trigger: "blur"
- }]
- },
- {
- label: "经度",
- prop: "jd",
- rules: [{
+ trigger: "blur",
+ },
+ ],
+ },
+ {
+ label: "选择地点",
+ prop: "chouseJdWd",
+ hide: true,
+ viewDisplay: false,
+ span: 24,
+ // rules: [
+ // {
+ // required: true,
+ // message: "请选择地点",
+ // trigger: "blur",
+ // },
+ // ],
+ },
+ {
+ label: "详细地点",
+ prop: "addressName",
+ hide: true,
+ // overHidden: true,
+ editDisplay: false,
+ addDisplay: false,
+ span: 24,
+ // rules: [
+ // {
+ // required: true,
+ // message: "请选择地点",
+ // trigger: "blur",
+ // },
+ // ],
+ },
+ {
+ label: "经度",
+ disabled: true,
+ prop: "jd",
+ rules: [
+ {
required: true,
message: "请输入经度",
- trigger: "blur"
- }]
- },
- {
- label: "纬度",
- prop: "wd",
- rules: [{
+ trigger: "blur",
+ },
+ ],
+ },
+ {
+ label: "纬度",
+ prop: "wd",
+ disabled: true,
+ rules: [
+ {
required: true,
message: "请输入纬度",
- trigger: "blur"
- }]
- },
- {
- label: '所属建筑',
- prop: 'mtype',
- hide: true,
- type: 'select',
- props: {
- label: 'dictValue',
- value: 'dictKey'
+ trigger: "blur",
},
- cascaderItem: ['campus', 'loutype'],
- dataType: "number",
- cell: true,
- dicUrl: "/api/blade-system/dict-biz/dictionary?code=building",
- rules: [{
+ ],
+ },
+ {
+ label: "所属建筑",
+ prop: "mtype",
+ hide: true,
+ type: "select",
+ props: {
+ label: "dictValue",
+ value: "dictKey",
+ },
+ cascaderItem: ["campus", "loutype"],
+ dataType: "number",
+ cell: true,
+ dicUrl: "/api/blade-system/dict-biz/dictionary?code=building",
+ rules: [
+ {
required: true,
message: "请输入所属建筑",
- trigger: "blur"
- }]
- },
- {
- label: "所属校区",
- searchLabelWidth: "110",
- prop: "campus",
- type: "tree",
- dicUrl: "/api/blade-system/dict-biz/dictionary?code=campus",
- props: {
- label: 'dictValue',
- value: 'dictKey'
+ trigger: "blur",
},
- slot: true,
- searchSpan: 5,
- search: true,
- rules: [{
+ ],
+ },
+ {
+ label: "所属校区",
+ searchLabelWidth: "110",
+ prop: "campus",
+ type: "tree",
+ dicUrl: "/api/blade-system/dict-biz/dictionary?code=campus",
+ props: {
+ label: "dictValue",
+ value: "dictKey",
+ },
+ slot: true,
+ searchSpan: 5,
+ search: true,
+ rules: [
+ {
required: true,
message: "请输入所属校区",
- trigger: "blur"
- }]
- },
- {
- label: '所属楼',
- prop: 'loutype',
- hide: true,
- type: 'tree',
- cell: true,
- props: {
- label: 'dictValue',
- value: 'dictKey'
+ trigger: "blur",
},
- dicUrl: "/api/blade-architecture/architecture/selectType?campus={{key}}&type={{mtype}}",
- rules: [{
+ ],
+ },
+ {
+ label: "所属楼",
+ prop: "loutype",
+ hide: true,
+ type: "tree",
+ cell: true,
+ props: {
+ label: "dictValue",
+ value: "dictKey",
+ },
+ dicUrl:
+ "/api/blade-architecture/architecture/selectType?campus={{key}}&type={{mtype}}",
+ rules: [
+ {
required: true,
message: "请输入所属楼",
- trigger: "blur"
- }]
- },
- {
- label: "偏航角",
- addDisplay: false,
- hide: true,
- prop: "heading",
- },
- {
- label: "俯仰角",
- addDisplay: false,
- hide: true,
- prop: "pitch",
- },
- {
- label: "翻转角",
- addDisplay: false,
- hide: true,
- prop: "roll",
- },
- {
- label: "高度",
- hide: true,
- addDisplay: false,
- prop: "gd",
- },
- {
- label: "网站地址",
- prop: "websiteurl",
- },
- {
- label: "地址",
- prop: "address",
- hide: true,
- },
- {
- label: "监控地址",
- hide: true,
- prop: "videourl",
- },
- {
- label: "图片",
- prop: "tpurl",
- // dataType: 'string',
- type: "upload",
- propsHttp: {
- res: 'data',
- url: 'link',
+ trigger: "blur",
},
- rules: [{
- required: true,
- message: "请输入图片",
- trigger: "blur"
- }],
- span: 10,
- listType: "picture-card",
- tip: "只能上传jpg/png文件,且不超过500kb",
- action: "/api/blade-resource/oss/endpoint/put-file",
+ ],
+ },
+ {
+ label: "偏航角",
+ addDisplay: false,
+ hide: true,
+ prop: "heading",
+ },
+ {
+ label: "俯仰角",
+ addDisplay: false,
+ hide: true,
+ prop: "pitch",
+ },
+ {
+ label: "翻转角",
+ addDisplay: false,
+ hide: true,
+ prop: "roll",
+ },
+ {
+ label: "高度",
+ hide: true,
+ addDisplay: false,
+ prop: "gd",
+ },
+ {
+ label: "网站地址",
+ prop: "websiteurl",
+ },
+ {
+ label: "地址",
+ prop: "address",
+ hide: true,
+ },
+ {
+ label: "监控地址",
+ hide: true,
+ prop: "videourl",
+ },
+ {
+ label: "图片",
+ prop: "tpurl",
+ // dataType: 'string',
+ type: "upload",
+ propsHttp: {
+ res: "data",
+ url: "link",
},
- // {
- // label: "二维码",
- // prop: "codeurl",
- // type: 'upload',
- // listType: 'picture-card',
- // //dataType: 'string',
- // action: '/api/blade-resource/oss/endpoint/put-file',
- // propsHttp: {
- // res: 'data',
- // url: 'link',
+ // rules: [
+ // {
+ // required: true,
+ // message: "请输入图片",
+ // trigger: "blur",
// },
- // span: 10,
- // },
- {
- label: "介绍",
- prop: "introduce",
- component: 'AvueUeditor',
- options: {
- action: '/api/blade-resource/oss/endpoint/put-file',
- props: {
- res: "data",
- url: "link",
- }
+ // ],
+ span: 10,
+ listType: "picture-card",
+ tip: "只能上传jpg/png文件,且不超过500kb",
+ action: "/api/blade-resource/oss/endpoint/put-file",
+ },
+ // {
+ // label: "二维码",
+ // prop: "codeurl",
+ // type: 'upload',
+ // listType: 'picture-card',
+ // //dataType: 'string',
+ // action: '/api/blade-resource/oss/endpoint/put-file',
+ // propsHttp: {
+ // res: 'data',
+ // url: 'link',
+ // },
+ // span: 10,
+ // },
+ {
+ label: "介绍",
+ prop: "introduce",
+ component: "AvueUeditor",
+ options: {
+ action: "/api/blade-resource/oss/endpoint/put-file",
+ props: {
+ res: "data",
+ url: "link",
},
- hide: true,
- minRows: 5,
- span: 24,
},
- ]
- },
- data: []
+ hide: true,
+ minRows: 5,
+ span: 24,
+ },
+ ],
+ },
+ data: [],
+ };
+ },
+ computed: {
+ ...mapGetters(["permission"]),
+ permissionList() {
+ return {
+ addBtn: this.vaildData(this.permission.life_add, false),
+ viewBtn: this.vaildData(this.permission.life_view, false),
+ delBtn: this.vaildData(this.permission.life_delete, false),
+ editBtn: this.vaildData(this.permission.life_edit, false),
};
},
- computed: {
- ...mapGetters(["permission"]),
- permissionList() {
- return {
- addBtn: this.vaildData(this.permission.life_add, false),
- viewBtn: this.vaildData(this.permission.life_view, false),
- delBtn: this.vaildData(this.permission.life_delete, false),
- editBtn: this.vaildData(this.permission.life_edit, false)
- };
- },
- ids() {
- let ids = [];
- this.selectionList.forEach(ele => {
- ids.push(ele.id);
- });
- return ids.join(",");
- }
+ ids() {
+ let ids = [];
+ this.selectionList.forEach((ele) => {
+ ids.push(ele.id);
+ });
+ return ids.join(",");
},
- methods: {
- rowSave(row, done, loading) {
- var d = [];
- // var dk = [];
- for (var k in row.tpurl) {
- d.push(row.tpurl[k].value);
- }
- // for (var ks in row.codeurl) {
- // dk.push(row.codeurl[ks].value);
- // }
- row.tpurl = d.join(",");
- //row.codeurl = dk.join(",");
- add(row).then(() => {
+ },
+ methods: {
+ getMapDatas(res) {
+ this.form["jd"] = res[0];
+ this.form["wd"] = res[1];
+ this.form["addressName"] = res[2];
+ },
+ initData() {
+ getDeptTree().then((res) => {
+ const column = this.findObject(this.option.column, "type");
+ column.dicData = res.data.data;
+ });
+ },
+ rowSave(row, done, loading) {
+ var d = [];
+ // var dk = [];
+ for (var k in row.tpurl) {
+ d.push(row.tpurl[k].value);
+ }
+ // for (var ks in row.codeurl) {
+ // dk.push(row.codeurl[ks].value);
+ // }
+ row.tpurl = d.join(",");
+ //row.codeurl = dk.join(",");
+ add(row).then(
+ () => {
this.onLoad(this.page);
this.$message({
type: "success",
- message: "操作成功!"
+ message: "操作成功!",
});
done();
- }, error => {
+ },
+ (error) => {
loading();
window.console.log(error);
- });
- },
- rowUpdate(row, index, done, loading) {
- update(row).then(() => {
+ }
+ );
+ },
+ rowUpdate(row, index, done, loading) {
+ update(row).then(
+ () => {
this.onLoad(this.page);
this.$message({
type: "success",
- message: "操作成功!"
+ message: "操作成功!",
});
done();
- }, error => {
+ },
+ (error) => {
loading();
console.log(error);
+ }
+ );
+ },
+ rowDel(row) {
+ this.$confirm("确定将选择数据删除?", {
+ confirmButtonText: "确定",
+ cancelButtonText: "取消",
+ type: "warning",
+ })
+ .then(() => {
+ return remove(row.id);
+ })
+ .then(() => {
+ this.onLoad(this.page);
+ this.$message({
+ type: "success",
+ message: "操作成功!",
+ });
});
- },
- rowDel(row) {
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
+ },
+ handleDelete() {
+ if (this.selectionList.length === 0) {
+ this.$message.warning("请选择至少一条数据");
+ return;
+ }
+ this.$confirm("确定将选择数据删除?", {
+ confirmButtonText: "确定",
+ cancelButtonText: "取消",
+ type: "warning",
+ })
+ .then(() => {
+ return remove(this.ids);
})
- .then(() => {
- return remove(row.id);
- })
- .then(() => {
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!"
+ .then(() => {
+ this.onLoad(this.page);
+ this.$message({
+ type: "success",
+ message: "操作成功!",
+ });
+ this.$refs.crud.toggleSelection();
+ });
+ },
+ beforeOpen(done, type) {
+ if (["edit", "view"].includes(type)) {
+ getDetail(this.form.id).then((res) => {
+ this.form = res.data.data;
+ if (type == "edit") {
+ let that = this;
+ this.$store.commit("readDom", {
+ this: that,
+ refName: "chousePointRef",
+ fn: (dom) => {
+ dom.openMaps({
+ jd: this.form.jd,
+ wd: this.form.wd,
+ name: this.form.addressName,
+ });
+ },
});
- });
- },
- handleDelete() {
- if (this.selectionList.length === 0) {
- this.$message.warning("请选择至少一条数据");
- return;
- }
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- })
- .then(() => {
- return remove(this.ids);
- })
- .then(() => {
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.$refs.crud.toggleSelection();
- });
- },
- beforeOpen(done, type) {
- if (["edit", "view"].includes(type)) {
- getDetail(this.form.id).then(res => {
- this.form = res.data.data;
- });
- }
- done();
- },
- searchReset() {
- this.query = {};
- this.onLoad(this.page);
- },
- searchChange(params, done) {
- this.query = params;
- this.page.currentPage = 1;
- this.onLoad(this.page, params);
- done();
- },
- selectionChange(list) {
- this.selectionList = list;
- },
- selectionClear() {
- this.selectionList = [];
- this.$refs.crud.toggleSelection();
- },
- currentChange(currentPage){
- this.page.currentPage = currentPage;
- },
- sizeChange(pageSize){
- this.page.pageSize = pageSize;
- },
- refreshChange() {
- this.onLoad(this.page, this.query);
- },
- onLoad(page, params = {}) {
- this.loading = true;
- getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
- const data = res.data.data;
- this.page.total = data.total;
- this.data = data.records;
- this.loading = false;
- this.selectionClear();
+ }
});
}
- }
- };
+ done();
+ },
+ searchReset() {
+ this.query = {};
+ this.onLoad(this.page);
+ },
+ searchChange(params, done) {
+ this.query = params;
+ this.page.currentPage = 1;
+ this.onLoad(this.page, params);
+ done();
+ },
+ selectionChange(list) {
+ this.selectionList = list;
+ },
+ selectionClear() {
+ this.selectionList = [];
+ this.$refs.crud.toggleSelection();
+ },
+ currentChange(currentPage) {
+ this.page.currentPage = currentPage;
+ },
+ sizeChange(pageSize) {
+ this.page.pageSize = pageSize;
+ },
+ refreshChange() {
+ this.onLoad(this.page, this.query);
+ },
+ onLoad(page, params = {}) {
+ this.loading = true;
+ getList(
+ page.currentPage,
+ page.pageSize,
+ Object.assign(params, this.query)
+ ).then((res) => {
+ const data = res.data.data;
+ this.page.total = data.total;
+ this.data = data.records;
+ this.loading = false;
+ this.selectionClear();
+ });
+ },
+ },
+};
</script>
-<style>
-</style>
+<style></style>
diff --git a/src/views/mechanism/mechanism.vue b/src/views/mechanism/mechanism.vue
index 60ae51a..95b1e88 100644
--- a/src/views/mechanism/mechanism.vue
+++ b/src/views/mechanism/mechanism.vue
@@ -1,40 +1,53 @@
<template>
<basic-container>
- <avue-crud :option="option"
- :table-loading="loading"
- :data="data"
- :page.sync="page"
- :permission="permissionList"
- :before-open="beforeOpen"
- v-model="form"
- ref="crud"
- @row-update="rowUpdate"
- @row-save="rowSave"
- @row-del="rowDel"
- @search-change="searchChange"
- @search-reset="searchReset"
- @selection-change="selectionChange"
- @current-change="currentChange"
- @size-change="sizeChange"
- @refresh-change="refreshChange"
- @on-load="onLoad">
+ <avue-crud
+ :option="option"
+ :table-loading="loading"
+ :data="data"
+ :page.sync="page"
+ :permission="permissionList"
+ :before-open="beforeOpen"
+ v-model="form"
+ ref="crud"
+ @row-update="rowUpdate"
+ @row-save="rowSave"
+ @row-del="rowDel"
+ @search-change="searchChange"
+ @search-reset="searchReset"
+ @selection-change="selectionChange"
+ @current-change="currentChange"
+ @size-change="sizeChange"
+ @refresh-change="refreshChange"
+ @on-load="onLoad"
+ >
<template slot="menuLeft">
- <el-button type="danger"
- size="small"
- icon="el-icon-delete"
- plain
- v-if="permission.mechanism_delete"
- @click="handleDelete">删 除
+ <el-button
+ type="danger"
+ size="small"
+ icon="el-icon-delete"
+ plain
+ v-if="permission.mechanism_delete"
+ @click="handleDelete"
+ >删 除
</el-button>
+ </template>
+ <template slot-scope="{ type, disabled }" slot="chouseJdWdForm">
+ <chousePoint @setData="getMapDatas" ref="chousePointRef"></chousePoint>
</template>
</avue-crud>
</basic-container>
</template>
<script>
-import {getList, getDetail, add, update, remove} from "@/api/mechanism/mechanism";
-import {mapGetters} from "vuex";
-import {getDeptTree} from "@/api/system/dept";
+import {
+ getList,
+ getDetail,
+ add,
+ update,
+ remove,
+} from "@/api/mechanism/mechanism";
+import { mapGetters } from "vuex";
+import { getDeptTree } from "@/api/system/dept";
export default {
data() {
@@ -46,11 +59,11 @@
page: {
pageSize: 10,
currentPage: 1,
- total: 0
+ total: 0,
},
selectionList: [],
option: {
- height: 'auto',
+ height: "auto",
calcHeight: 30,
tip: false,
searchShow: true,
@@ -58,8 +71,8 @@
border: true,
index: true,
viewBtn: true,
- align: 'center',
- indexLabel: '序号',
+ align: "center",
+ indexLabel: "序号",
selection: true,
dialogClickModal: false,
column: [
@@ -67,20 +80,24 @@
label: "名称",
prop: "mechanismname",
search: true,
- rules: [{
- required: true,
- message: "请输入名称",
- trigger: "blur"
- }]
+ rules: [
+ {
+ required: true,
+ message: "请输入名称",
+ trigger: "blur",
+ },
+ ],
},
{
label: "电话",
prop: "telephone",
- rules: [{
- required: true,
- message: "请输入电话",
- trigger: "blur"
- }]
+ rules: [
+ {
+ required: true,
+ message: "请输入电话",
+ trigger: "blur",
+ },
+ ],
},
{
label: "所属机构",
@@ -88,88 +105,133 @@
dicUrl: "/api/blade-system/dict-biz/dictionary?code=mechanism",
props: {
label: "dictValue",
- value: "dictKey"
+ value: "dictKey",
},
dataType: "number",
slot: true,
prop: "type",
search: true,
- rules: [{
- required: true,
- message: "请输入所属机构",
- trigger: "blur"
- }]
+ rules: [
+ {
+ required: true,
+ message: "请输入所属机构",
+ trigger: "blur",
+ },
+ ],
},
{
- label: '所属建筑',
- prop: 'mtype',
+ label: "所属建筑",
+ prop: "mtype",
hide: true,
- type: 'select',
+ type: "select",
props: {
- label: 'dictValue',
- value: 'dictKey'
+ label: "dictValue",
+ value: "dictKey",
},
dataType: "number",
cell: true,
- cascaderItem: ['xtype', 'loutype'],
+ cascaderItem: ["xtype", "loutype"],
dicUrl: "/api/blade-system/dict-biz/dictionary?code=building",
- rules: [{
- required: true,
- message: "请输入所属建筑",
- trigger: "blur"
- }]
+ rules: [
+ {
+ required: true,
+ message: "请输入所属建筑",
+ trigger: "blur",
+ },
+ ],
},
{
- label: '所属校区',
+ label: "所属校区",
hide: true,
- prop: 'xtype',
- type: 'select',
+ prop: "xtype",
+ type: "select",
cell: true,
props: {
- label: 'dictValue',
- value: 'dictKey'
+ label: "dictValue",
+ value: "dictKey",
},
dicUrl: "/api/blade-system/dict-biz/dictionary?code=campus",
- rules: [{
- required: true,
- message: "请输入所属校区",
- trigger: "blur"
- }]
+ rules: [
+ {
+ required: true,
+ message: "请输入所属校区",
+ trigger: "blur",
+ },
+ ],
},
{
- label: '所属楼',
- prop: 'loutype',
+ label: "所属楼",
+ prop: "loutype",
hide: true,
- type: 'tree',
+ type: "tree",
cell: true,
props: {
- label: 'dictValue',
- value: 'dictKey'
+ label: "dictValue",
+ value: "dictKey",
},
- dicUrl: "/api/blade-architecture/architecture/selectType?campus={{key}}&type={{mtype}}",
- rules: [{
- required: true,
- message: "请输入所属楼",
- trigger: "blur"
- }]
+ dicUrl:
+ "/api/blade-architecture/architecture/selectType?campus={{key}}&type={{mtype}}",
+ rules: [
+ {
+ required: true,
+ message: "请输入所属楼",
+ trigger: "blur",
+ },
+ ],
+ },
+ {
+ label: "选择地点",
+ prop: "chouseJdWd",
+ hide: true,
+ viewDisplay: false,
+ span: 24,
+ // rules: [
+ // {
+ // required: true,
+ // message: "请选择地点",
+ // trigger: "blur",
+ // },
+ // ],
+ },
+ {
+ label: "详细地点",
+ prop: "addressName",
+ hide: true,
+ // overHidden: true,
+ editDisplay: false,
+ addDisplay: false,
+ span: 24,
+ // rules: [
+ // {
+ // required: true,
+ // message: "请选择地点",
+ // trigger: "blur",
+ // },
+ // ],
},
{
label: "经度",
prop: "jd",
- rules: [{
- required: true,
- message: "请输入经度",
- trigger: "blur"
- }]
+ disabled: true,
+ rules: [
+ {
+ required: true,
+ message: "请选择地点",
+ trigger: "blur",
+ },
+ ],
},
{
label: "纬度",
prop: "wd",
- rules: [{
- required: true,
- message: "请输入纬度",
- trigger: "blur"
- }]
+ disabled: true,
+ rules: [
+ {
+ required: true,
+ message: "请选择地点",
+ trigger: "blur",
+ },
+ ],
},
{
label: "偏航角",
@@ -203,22 +265,24 @@
{
label: "网站地址",
prop: "websiteurl",
- rules: [{
- required: true,
- message: "请输入网站地址",
- trigger: "blur"
- }]
+ rules: [
+ {
+ required: true,
+ message: "请输入网站地址",
+ trigger: "blur",
+ },
+ ],
},
{
label: "图片",
prop: "tpurl",
- type: 'upload',
- listType: 'picture-card',
+ type: "upload",
+ listType: "picture-card",
//dataType: 'string',
- action: '/api/blade-resource/oss/endpoint/put-file',
+ action: "/api/blade-resource/oss/endpoint/put-file",
propsHttp: {
- res: 'data',
- url: 'link',
+ res: "data",
+ url: "link",
},
span: 12,
},
@@ -238,13 +302,13 @@
{
label: "介绍",
prop: "introduce",
- component: 'AvueUeditor',
+ component: "AvueUeditor",
options: {
- action: '/api/blade-resource/oss/endpoint/put-file',
+ action: "/api/blade-resource/oss/endpoint/put-file",
props: {
res: "data",
url: "link",
- }
+ },
},
hide: true,
minRows: 6,
@@ -255,9 +319,9 @@
hide: true,
prop: "videourl",
},
- ]
+ ],
},
- data: []
+ data: [],
};
},
computed: {
@@ -267,26 +331,34 @@
addBtn: this.vaildData(this.permission.mechanism_add, false),
viewBtn: this.vaildData(this.permission.mechanism_view, false),
delBtn: this.vaildData(this.permission.mechanism_delete, false),
- editBtn: this.vaildData(this.permission.mechanism_edit, false)
+ editBtn: this.vaildData(this.permission.mechanism_edit, false),
};
},
ids() {
let ids = [];
- this.selectionList.forEach(ele => {
+ this.selectionList.forEach((ele) => {
ids.push(ele.id);
});
return ids.join(",");
- }
+ },
},
methods: {
+ getMapDatas(res) {
+ this.form["jd"] = res[0];
+ this.form["wd"] = res[1];
+ this.form["addressName"] = res[2];
+ },
initData() {
- getDeptTree().then(res => {
+ getDeptTree().then((res) => {
const column = this.findObject(this.option.column, "type");
column.dicData = res.data.data;
});
},
rowSave(row, done, loading) {
- console.log(row)
+ row["addressName"] = this.form.addressName;
+ // console.log(row);
+ // loading();
+ // return;
var d = [];
//var dk = [];
for (var k in row.tpurl) {
@@ -297,36 +369,42 @@
// }
row.tpurl = d.join(",");
//row.codeurl = dk.join(",");
- add(row).then(() => {
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- done();
- }, error => {
- loading();
- window.console.log(error);
- });
+ add(row).then(
+ () => {
+ this.onLoad(this.page);
+ this.$message({
+ type: "success",
+ message: "操作成功!",
+ });
+ done();
+ },
+ (error) => {
+ loading();
+ window.console.log(error);
+ }
+ );
},
rowUpdate(row, index, done, loading) {
- update(row).then(() => {
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- done();
- }, error => {
- loading();
- console.log(error);
- });
+ update(row).then(
+ () => {
+ this.onLoad(this.page);
+ this.$message({
+ type: "success",
+ message: "操作成功!",
+ });
+ done();
+ },
+ (error) => {
+ loading();
+ console.log(error);
+ }
+ );
},
rowDel(row) {
this.$confirm("确定将选择数据删除?", {
confirmButtonText: "确定",
cancelButtonText: "取消",
- type: "warning"
+ type: "warning",
})
.then(() => {
return remove(row.id);
@@ -335,7 +413,7 @@
this.onLoad(this.page);
this.$message({
type: "success",
- message: "操作成功!"
+ message: "操作成功!",
});
});
},
@@ -347,7 +425,7 @@
this.$confirm("确定将选择数据删除?", {
confirmButtonText: "确定",
cancelButtonText: "取消",
- type: "warning"
+ type: "warning",
})
.then(() => {
return remove(this.ids);
@@ -356,7 +434,7 @@
this.onLoad(this.page);
this.$message({
type: "success",
- message: "操作成功!"
+ message: "操作成功!",
});
this.$refs.crud.toggleSelection();
});
@@ -366,8 +444,23 @@
this.initData();
}
if (["edit", "view"].includes(type)) {
- getDetail(this.form.id).then(res => {
+ getDetail(this.form.id).then((res) => {
+ // console.log(res.data.data);
this.form = res.data.data;
+ if (type == "edit") {
+ let that = this;
+ this.$store.commit("readDom", {
+ this: that,
+ refName: "chousePointRef",
+ fn: (dom) => {
+ dom.openMaps({
+ jd: this.form.jd,
+ wd: this.form.wd,
+ name: this.form.addressName,
+ });
+ },
+ });
+ }
});
}
done();
@@ -400,17 +493,20 @@
},
onLoad(page, params = {}) {
this.loading = true;
- getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
+ getList(
+ page.currentPage,
+ page.pageSize,
+ Object.assign(params, this.query)
+ ).then((res) => {
const data = res.data.data;
this.page.total = data.total;
this.data = data.records;
this.loading = false;
this.selectionClear();
});
- }
- }
+ },
+ },
};
</script>
-<style>
-</style>
+<style></style>
diff --git a/src/views/road/road.vue b/src/views/road/road.vue
index cbd9b8f..9a77fe1 100644
--- a/src/views/road/road.vue
+++ b/src/views/road/road.vue
@@ -1,228 +1,307 @@
<template>
<basic-container>
- <avue-crud :option="option"
- :table-loading="loading"
- :data="data"
- :page.sync="page"
- :permission="permissionList"
- :before-open="beforeOpen"
- v-model="form"
- ref="crud"
- @row-update="rowUpdate"
- @row-save="rowSave"
- @row-del="rowDel"
- @search-change="searchChange"
- @search-reset="searchReset"
- @selection-change="selectionChange"
- @current-change="currentChange"
- @size-change="sizeChange"
- @refresh-change="refreshChange"
- @on-load="onLoad">
+ <avue-crud
+ :option="option"
+ :table-loading="loading"
+ :data="data"
+ :page.sync="page"
+ :permission="permissionList"
+ :before-open="beforeOpen"
+ v-model="form"
+ ref="crud"
+ @row-update="rowUpdate"
+ @row-save="rowSave"
+ @row-del="rowDel"
+ @search-change="searchChange"
+ @search-reset="searchReset"
+ @selection-change="selectionChange"
+ @current-change="currentChange"
+ @size-change="sizeChange"
+ @refresh-change="refreshChange"
+ @on-load="onLoad"
+ >
<template slot="menuLeft">
- <el-button type="danger"
- size="small"
- icon="el-icon-delete"
- plain
- v-if="permission.road_delete"
- @click="handleDelete">删 除
+ <el-button
+ type="danger"
+ size="small"
+ icon="el-icon-delete"
+ plain
+ v-if="permission.road_delete"
+ @click="handleDelete"
+ >删 除
</el-button>
+ </template>
+ <template slot-scope="{ type, disabled }" slot="chouseJdWdForm">
+ <chousePoint @setData="getMapDatas" ref="chousePointRef"></chousePoint>
</template>
</avue-crud>
</basic-container>
</template>
<script>
- import {getList, getDetail, add, update, remove} from "@/api/road/road";
- import {mapGetters} from "vuex";
+import { getList, getDetail, add, update, remove } from "@/api/road/road";
+import { mapGetters } from "vuex";
- export default {
- data() {
- return {
- form: {},
- query: {},
- loading: true,
- page: {
- pageSize: 10,
- currentPage: 1,
- total: 0
- },
- selectionList: [],
- option: {
- height:'auto',
- calcHeight: 30,
- tip: false,
- searchShow: true,
- searchMenuSpan: 6,
- border: true,
- index: true,
- viewBtn: true,
- selection: true,
- dialogClickModal: false,
- column: [
- {
- label: "名称",
- search: true,
- prop: "roadname",
- rules: [{
+export default {
+ data() {
+ return {
+ form: {},
+ query: {},
+ loading: true,
+ page: {
+ pageSize: 10,
+ currentPage: 1,
+ total: 0,
+ },
+ selectionList: [],
+ option: {
+ height: "auto",
+ calcHeight: 30,
+ tip: false,
+ searchShow: true,
+ searchMenuSpan: 6,
+ border: true,
+ index: true,
+ viewBtn: true,
+ selection: true,
+ dialogClickModal: false,
+ column: [
+ {
+ label: "名称",
+ search: true,
+ prop: "roadname",
+ rules: [
+ {
required: true,
message: "请输入名称",
- trigger: "blur"
- }]
- },
- {
- label: "经度",
- prop: "jd",
- rules: [{
+ trigger: "blur",
+ },
+ ],
+ },
+ {
+ label: "选择地点",
+ prop: "chouseJdWd",
+ hide: true,
+ viewDisplay: false,
+ span: 24,
+ // rules: [
+ // {
+ // required: true,
+ // message: "请选择地点",
+ // trigger: "blur",
+ // },
+ // ],
+ },
+ {
+ label: "详细地点",
+ prop: "addressName",
+ hide: true,
+ // overHidden: true,
+ editDisplay: false,
+ addDisplay: false,
+ span: 24,
+ // rules: [
+ // {
+ // required: true,
+ // message: "请选择地点",
+ // trigger: "blur",
+ // },
+ // ],
+ },
+ {
+ label: "经度",
+ prop: "jd",
+ disabled: true,
+ rules: [
+ {
required: true,
message: "请输入经度",
- trigger: "blur"
- }]
- },
- {
- label: "纬度",
- prop: "wd",
- rules: [{
+ trigger: "blur",
+ },
+ ],
+ },
+ {
+ label: "纬度",
+ disabled: true,
+ prop: "wd",
+ rules: [
+ {
required: true,
message: "请输入纬度",
- trigger: "blur"
- }]
- },
- ]
- },
- data: []
+ trigger: "blur",
+ },
+ ],
+ },
+ ],
+ },
+ data: [],
+ };
+ },
+ computed: {
+ ...mapGetters(["permission"]),
+ permissionList() {
+ return {
+ addBtn: this.vaildData(this.permission.road_add, false),
+ viewBtn: this.vaildData(this.permission.road_view, false),
+ delBtn: this.vaildData(this.permission.road_delete, false),
+ editBtn: this.vaildData(this.permission.road_edit, false),
};
},
- computed: {
- ...mapGetters(["permission"]),
- permissionList() {
- return {
- addBtn: this.vaildData(this.permission.road_add, false),
- viewBtn: this.vaildData(this.permission.road_view, false),
- delBtn: this.vaildData(this.permission.road_delete, false),
- editBtn: this.vaildData(this.permission.road_edit, false)
- };
- },
- ids() {
- let ids = [];
- this.selectionList.forEach(ele => {
- ids.push(ele.id);
- });
- return ids.join(",");
- }
+ ids() {
+ let ids = [];
+ this.selectionList.forEach((ele) => {
+ ids.push(ele.id);
+ });
+ return ids.join(",");
},
- methods: {
- rowSave(row, done, loading) {
- add(row).then(() => {
+ },
+ methods: {
+ getMapDatas(res) {
+ this.form["jd"] = res[0];
+ this.form["wd"] = res[1];
+ this.form["addressName"] = res[2];
+ },
+ initData() {
+ getDeptTree().then((res) => {
+ const column = this.findObject(this.option.column, "type");
+ column.dicData = res.data.data;
+ });
+ },
+ rowSave(row, done, loading) {
+ add(row).then(
+ () => {
this.onLoad(this.page);
this.$message({
type: "success",
- message: "操作成功!"
+ message: "操作成功!",
});
done();
- }, error => {
+ },
+ (error) => {
loading();
window.console.log(error);
- });
- },
- rowUpdate(row, index, done, loading) {
- update(row).then(() => {
+ }
+ );
+ },
+ rowUpdate(row, index, done, loading) {
+ update(row).then(
+ () => {
this.onLoad(this.page);
this.$message({
type: "success",
- message: "操作成功!"
+ message: "操作成功!",
});
done();
- }, error => {
+ },
+ (error) => {
loading();
console.log(error);
+ }
+ );
+ },
+ rowDel(row) {
+ this.$confirm("确定将选择数据删除?", {
+ confirmButtonText: "确定",
+ cancelButtonText: "取消",
+ type: "warning",
+ })
+ .then(() => {
+ return remove(row.id);
+ })
+ .then(() => {
+ this.onLoad(this.page);
+ this.$message({
+ type: "success",
+ message: "操作成功!",
+ });
});
- },
- rowDel(row) {
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
+ },
+ handleDelete() {
+ if (this.selectionList.length === 0) {
+ this.$message.warning("请选择至少一条数据");
+ return;
+ }
+ this.$confirm("确定将选择数据删除?", {
+ confirmButtonText: "确定",
+ cancelButtonText: "取消",
+ type: "warning",
+ })
+ .then(() => {
+ return remove(this.ids);
})
- .then(() => {
- return remove(row.id);
- })
- .then(() => {
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!"
+ .then(() => {
+ this.onLoad(this.page);
+ this.$message({
+ type: "success",
+ message: "操作成功!",
+ });
+ this.$refs.crud.toggleSelection();
+ });
+ },
+ beforeOpen(done, type) {
+ if (["edit", "view"].includes(type)) {
+ getDetail(this.form.id).then((res) => {
+ this.form = res.data.data;
+ if (type == "edit") {
+ let that = this;
+ this.$store.commit("readDom", {
+ this: that,
+ refName: "chousePointRef",
+ fn: (dom) => {
+ dom.openMaps({
+ jd: this.form.jd,
+ wd: this.form.wd,
+ name: this.form.addressName,
+ });
+ },
});
- });
- },
- handleDelete() {
- if (this.selectionList.length === 0) {
- this.$message.warning("请选择至少一条数据");
- return;
- }
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- })
- .then(() => {
- return remove(this.ids);
- })
- .then(() => {
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.$refs.crud.toggleSelection();
- });
- },
- beforeOpen(done, type) {
- if (["edit", "view"].includes(type)) {
- getDetail(this.form.id).then(res => {
- this.form = res.data.data;
- });
- }
- done();
- },
- searchReset() {
- this.query = {};
- this.onLoad(this.page);
- },
- searchChange(params, done) {
- this.query = params;
- this.page.currentPage = 1;
- this.onLoad(this.page, params);
- done();
- },
- selectionChange(list) {
- this.selectionList = list;
- },
- selectionClear() {
- this.selectionList = [];
- this.$refs.crud.toggleSelection();
- },
- currentChange(currentPage){
- this.page.currentPage = currentPage;
- },
- sizeChange(pageSize){
- this.page.pageSize = pageSize;
- },
- refreshChange() {
- this.onLoad(this.page, this.query);
- },
- onLoad(page, params = {}) {
- this.loading = true;
- getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
- const data = res.data.data;
- this.page.total = data.total;
- this.data = data.records;
- this.loading = false;
- this.selectionClear();
+ }
});
}
- }
- };
+ done();
+ },
+ searchReset() {
+ this.query = {};
+ this.onLoad(this.page);
+ },
+ searchChange(params, done) {
+ this.query = params;
+ this.page.currentPage = 1;
+ this.onLoad(this.page, params);
+ done();
+ },
+ selectionChange(list) {
+ this.selectionList = list;
+ },
+ selectionClear() {
+ this.selectionList = [];
+ this.$refs.crud.toggleSelection();
+ },
+ currentChange(currentPage) {
+ this.page.currentPage = currentPage;
+ },
+ sizeChange(pageSize) {
+ this.page.pageSize = pageSize;
+ },
+ refreshChange() {
+ this.onLoad(this.page, this.query);
+ },
+ onLoad(page, params = {}) {
+ this.loading = true;
+ getList(
+ page.currentPage,
+ page.pageSize,
+ Object.assign(params, this.query)
+ ).then((res) => {
+ const data = res.data.data;
+ this.page.total = data.total;
+ this.data = data.records;
+ this.loading = false;
+ this.selectionClear();
+ });
+ },
+ },
+};
</script>
-<style>
-</style>
+<style></style>
diff --git a/src/views/sp/sp.vue b/src/views/sp/sp.vue
index af0efcf..41e6e53 100644
--- a/src/views/sp/sp.vue
+++ b/src/views/sp/sp.vue
@@ -1,239 +1,320 @@
<template>
<basic-container>
- <avue-crud :option="option"
- :table-loading="loading"
- :data="data"
- :page.sync="page"
- :permission="permissionList"
- :before-open="beforeOpen"
- v-model="form"
- ref="crud"
- @row-update="rowUpdate"
- @row-save="rowSave"
- @row-del="rowDel"
- @search-change="searchChange"
- @search-reset="searchReset"
- @selection-change="selectionChange"
- @current-change="currentChange"
- @size-change="sizeChange"
- @refresh-change="refreshChange"
- @on-load="onLoad">
+ <avue-crud
+ :option="option"
+ :table-loading="loading"
+ :data="data"
+ :page.sync="page"
+ :permission="permissionList"
+ :before-open="beforeOpen"
+ v-model="form"
+ ref="crud"
+ @row-update="rowUpdate"
+ @row-save="rowSave"
+ @row-del="rowDel"
+ @search-change="searchChange"
+ @search-reset="searchReset"
+ @selection-change="selectionChange"
+ @current-change="currentChange"
+ @size-change="sizeChange"
+ @refresh-change="refreshChange"
+ @on-load="onLoad"
+ >
<template slot="menuLeft">
- <el-button type="danger"
- size="small"
- icon="el-icon-delete"
- plain
- v-if="permission.sp_delete"
- @click="handleDelete">删 除
+ <el-button
+ type="danger"
+ size="small"
+ icon="el-icon-delete"
+ plain
+ v-if="permission.sp_delete"
+ @click="handleDelete"
+ >删 除
</el-button>
+ </template>
+ <template slot-scope="{ type, disabled }" slot="chouseJdWdForm">
+ <chousePoint @setData="getMapDatas" ref="chousePointRef"></chousePoint>
</template>
</avue-crud>
</basic-container>
</template>
<script>
- import {getList, getDetail, add, update, remove} from "@/api/sp/sp";
- import {mapGetters} from "vuex";
+import { getList, getDetail, add, update, remove } from "@/api/sp/sp";
+import { mapGetters } from "vuex";
- export default {
- data() {
- return {
- form: {},
- query: {},
- loading: true,
- page: {
- pageSize: 10,
- currentPage: 1,
- total: 0
- },
- selectionList: [],
- option: {
- height:'auto',
- calcHeight: 30,
- tip: false,
- searchShow: true,
- searchMenuSpan: 6,
- border: true,
- index: true,
- viewBtn: true,
- selection: true,
- align: 'center',
- indexLabel: '序号',
- dialogClickModal: false,
- column: [
- {
- label: "视频名称",
- prop: "vrname",
- search: true,
- rules: [{
+export default {
+ data() {
+ return {
+ form: {},
+ query: {},
+ loading: true,
+ page: {
+ pageSize: 10,
+ currentPage: 1,
+ total: 0,
+ },
+ selectionList: [],
+ option: {
+ height: "auto",
+ calcHeight: 30,
+ tip: false,
+ searchShow: true,
+ searchMenuSpan: 6,
+ border: true,
+ index: true,
+ viewBtn: true,
+ selection: true,
+ align: "center",
+ indexLabel: "序号",
+ dialogClickModal: false,
+ column: [
+ {
+ label: "视频名称",
+ prop: "vrname",
+ search: true,
+ rules: [
+ {
required: true,
message: "请输入视频名称",
- trigger: "blur"
- }]
- },
- {
- label: "视频地址",
- prop: "vrurl",
- rules: [{
+ trigger: "blur",
+ },
+ ],
+ },
+ {
+ label: "视频地址",
+ prop: "vrurl",
+ rules: [
+ {
required: true,
message: "请输入视频地址",
- trigger: "blur"
- }]
- },
- {
- label: "经度",
- prop: "jd",
- rules: [{
+ trigger: "blur",
+ },
+ ],
+ },
+ {
+ label: "选择地点",
+ prop: "chouseJdWd",
+ hide: true,
+ viewDisplay: false,
+ span: 24,
+ // rules: [
+ // {
+ // required: true,
+ // message: "请选择地点",
+ // trigger: "blur",
+ // },
+ // ],
+ },
+ {
+ label: "详细地点",
+ prop: "addressName",
+ hide: true,
+ // overHidden: true,
+ editDisplay: false,
+ addDisplay: false,
+ span: 24,
+ // rules: [
+ // {
+ // required: true,
+ // message: "请选择地点",
+ // trigger: "blur",
+ // },
+ // ],
+ },
+ {
+ label: "经度",
+ disabled: true,
+ prop: "jd",
+ rules: [
+ {
required: true,
message: "请输入经度",
- trigger: "blur"
- }]
- },
- {
- label: "纬度",
- prop: "wd",
- rules: [{
+ trigger: "blur",
+ },
+ ],
+ },
+ {
+ label: "纬度",
+ prop: "wd",
+ disabled: true,
+ rules: [
+ {
required: true,
message: "请输入纬度",
- trigger: "blur"
- }]
- },
- ]
- },
- data: []
+ trigger: "blur",
+ },
+ ],
+ },
+ ],
+ },
+ data: [],
+ };
+ },
+ computed: {
+ ...mapGetters(["permission"]),
+ permissionList() {
+ return {
+ addBtn: this.vaildData(this.permission.sp_add, false),
+ viewBtn: this.vaildData(this.permission.sp_view, false),
+ delBtn: this.vaildData(this.permission.sp_delete, false),
+ editBtn: this.vaildData(this.permission.sp_edit, false),
};
},
- computed: {
- ...mapGetters(["permission"]),
- permissionList() {
- return {
- addBtn: this.vaildData(this.permission.sp_add, false),
- viewBtn: this.vaildData(this.permission.sp_view, false),
- delBtn: this.vaildData(this.permission.sp_delete, false),
- editBtn: this.vaildData(this.permission.sp_edit, false)
- };
- },
- ids() {
- let ids = [];
- this.selectionList.forEach(ele => {
- ids.push(ele.id);
- });
- return ids.join(",");
- }
+ ids() {
+ let ids = [];
+ this.selectionList.forEach((ele) => {
+ ids.push(ele.id);
+ });
+ return ids.join(",");
},
- methods: {
- rowSave(row, done, loading) {
- add(row).then(() => {
+ },
+ methods: {
+ getMapDatas(res) {
+ this.form["jd"] = res[0];
+ this.form["wd"] = res[1];
+ this.form["addressName"] = res[2];
+ },
+ initData() {
+ getDeptTree().then((res) => {
+ const column = this.findObject(this.option.column, "type");
+ column.dicData = res.data.data;
+ });
+ },
+ rowSave(row, done, loading) {
+ add(row).then(
+ () => {
this.onLoad(this.page);
this.$message({
type: "success",
- message: "操作成功!"
+ message: "操作成功!",
});
done();
- }, error => {
+ },
+ (error) => {
loading();
window.console.log(error);
- });
- },
- rowUpdate(row, index, done, loading) {
- update(row).then(() => {
+ }
+ );
+ },
+ rowUpdate(row, index, done, loading) {
+ update(row).then(
+ () => {
this.onLoad(this.page);
this.$message({
type: "success",
- message: "操作成功!"
+ message: "操作成功!",
});
done();
- }, error => {
+ },
+ (error) => {
loading();
console.log(error);
+ }
+ );
+ },
+ rowDel(row) {
+ this.$confirm("确定将选择数据删除?", {
+ confirmButtonText: "确定",
+ cancelButtonText: "取消",
+ type: "warning",
+ })
+ .then(() => {
+ return remove(row.id);
+ })
+ .then(() => {
+ this.onLoad(this.page);
+ this.$message({
+ type: "success",
+ message: "操作成功!",
+ });
});
- },
- rowDel(row) {
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
+ },
+ handleDelete() {
+ if (this.selectionList.length === 0) {
+ this.$message.warning("请选择至少一条数据");
+ return;
+ }
+ this.$confirm("确定将选择数据删除?", {
+ confirmButtonText: "确定",
+ cancelButtonText: "取消",
+ type: "warning",
+ })
+ .then(() => {
+ return remove(this.ids);
})
- .then(() => {
- return remove(row.id);
- })
- .then(() => {
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!"
+ .then(() => {
+ this.onLoad(this.page);
+ this.$message({
+ type: "success",
+ message: "操作成功!",
+ });
+ this.$refs.crud.toggleSelection();
+ });
+ },
+ beforeOpen(done, type) {
+ if (["edit", "view"].includes(type)) {
+ getDetail(this.form.id).then((res) => {
+ this.form = res.data.data;
+ if (type == "edit") {
+ let that = this;
+ this.$store.commit("readDom", {
+ this: that,
+ refName: "chousePointRef",
+ fn: (dom) => {
+ dom.openMaps({
+ jd: this.form.jd,
+ wd: this.form.wd,
+ name: this.form.addressName,
+ });
+ },
});
- });
- },
- handleDelete() {
- if (this.selectionList.length === 0) {
- this.$message.warning("请选择至少一条数据");
- return;
- }
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- })
- .then(() => {
- return remove(this.ids);
- })
- .then(() => {
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.$refs.crud.toggleSelection();
- });
- },
- beforeOpen(done, type) {
- if (["edit", "view"].includes(type)) {
- getDetail(this.form.id).then(res => {
- this.form = res.data.data;
- });
- }
- done();
- },
- searchReset() {
- this.query = {};
- this.onLoad(this.page);
- },
- searchChange(params, done) {
- this.query = params;
- this.page.currentPage = 1;
- this.onLoad(this.page, params);
- done();
- },
- selectionChange(list) {
- this.selectionList = list;
- },
- selectionClear() {
- this.selectionList = [];
- this.$refs.crud.toggleSelection();
- },
- currentChange(currentPage){
- this.page.currentPage = currentPage;
- },
- sizeChange(pageSize){
- this.page.pageSize = pageSize;
- },
- refreshChange() {
- this.onLoad(this.page, this.query);
- },
- onLoad(page, params = {}) {
- this.loading = true;
- getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
- const data = res.data.data;
- this.page.total = data.total;
- this.data = data.records;
- this.loading = false;
- this.selectionClear();
+ }
});
}
- }
- };
+ done();
+ },
+ searchReset() {
+ this.query = {};
+ this.onLoad(this.page);
+ },
+ searchChange(params, done) {
+ this.query = params;
+ this.page.currentPage = 1;
+ this.onLoad(this.page, params);
+ done();
+ },
+ selectionChange(list) {
+ this.selectionList = list;
+ },
+ selectionClear() {
+ this.selectionList = [];
+ this.$refs.crud.toggleSelection();
+ },
+ currentChange(currentPage) {
+ this.page.currentPage = currentPage;
+ },
+ sizeChange(pageSize) {
+ this.page.pageSize = pageSize;
+ },
+ refreshChange() {
+ this.onLoad(this.page, this.query);
+ },
+ onLoad(page, params = {}) {
+ this.loading = true;
+ getList(
+ page.currentPage,
+ page.pageSize,
+ Object.assign(params, this.query)
+ ).then((res) => {
+ const data = res.data.data;
+ this.page.total = data.total;
+ this.data = data.records;
+ this.loading = false;
+ this.selectionClear();
+ });
+ },
+ },
+};
</script>
-<style>
-</style>
+<style></style>
diff --git a/src/views/tagging/tagging.vue b/src/views/tagging/tagging.vue
index 70094b8..8106d4b 100644
--- a/src/views/tagging/tagging.vue
+++ b/src/views/tagging/tagging.vue
@@ -1,227 +1,306 @@
<template>
<basic-container>
- <avue-crud :option="option"
- :table-loading="loading"
- :data="data"
- :page.sync="page"
- :permission="permissionList"
- :before-open="beforeOpen"
- v-model="form"
- ref="crud"
- @row-update="rowUpdate"
- @row-save="rowSave"
- @row-del="rowDel"
- @search-change="searchChange"
- @search-reset="searchReset"
- @selection-change="selectionChange"
- @current-change="currentChange"
- @size-change="sizeChange"
- @refresh-change="refreshChange"
- @on-load="onLoad">
+ <avue-crud
+ :option="option"
+ :table-loading="loading"
+ :data="data"
+ :page.sync="page"
+ :permission="permissionList"
+ :before-open="beforeOpen"
+ v-model="form"
+ ref="crud"
+ @row-update="rowUpdate"
+ @row-save="rowSave"
+ @row-del="rowDel"
+ @search-change="searchChange"
+ @search-reset="searchReset"
+ @selection-change="selectionChange"
+ @current-change="currentChange"
+ @size-change="sizeChange"
+ @refresh-change="refreshChange"
+ @on-load="onLoad"
+ >
<template slot="menuLeft">
- <el-button type="danger"
- size="small"
- icon="el-icon-delete"
- plain
- v-if="permission.tagging_delete"
- @click="handleDelete">删 除
+ <el-button
+ type="danger"
+ size="small"
+ icon="el-icon-delete"
+ plain
+ v-if="permission.tagging_delete"
+ @click="handleDelete"
+ >删 除
</el-button>
+ </template>
+ <template slot-scope="{ type, disabled }" slot="chouseJdWdForm">
+ <chousePoint @setData="getMapDatas" ref="chousePointRef"></chousePoint>
</template>
</avue-crud>
</basic-container>
</template>
<script>
- import {getList, getDetail, add, update, remove} from "@/api/tagging/tagging";
- import {mapGetters} from "vuex";
+import { getList, getDetail, add, update, remove } from "@/api/tagging/tagging";
+import { mapGetters } from "vuex";
- export default {
- data() {
+export default {
+ data() {
+ return {
+ form: {},
+ query: {},
+ loading: true,
+ page: {
+ pageSize: 10,
+ currentPage: 1,
+ total: 0,
+ },
+ selectionList: [],
+ option: {
+ height: "auto",
+ calcHeight: 30,
+ tip: false,
+ searchShow: true,
+ searchMenuSpan: 6,
+ border: true,
+ index: true,
+ viewBtn: true,
+ selection: true,
+ dialogClickModal: false,
+ column: [
+ {
+ label: "名称",
+ prop: "name",
+ rules: [
+ {
+ required: true,
+ message: "请输入",
+ trigger: "blur",
+ },
+ ],
+ },
+ {
+ label: "选择地点",
+ prop: "chouseJdWd",
+ hide: true,
+ viewDisplay: false,
+ span: 24,
+ // rules: [
+ // {
+ // required: true,
+ // message: "请选择地点",
+ // trigger: "blur",
+ // },
+ // ],
+ },
+ {
+ label: "详细地点",
+ prop: "addressName",
+ hide: true,
+ // overHidden: true,
+ editDisplay: false,
+ addDisplay: false,
+ span: 24,
+ // rules: [
+ // {
+ // required: true,
+ // message: "请选择地点",
+ // trigger: "blur",
+ // },
+ // ],
+ },
+ {
+ label: "经度",
+ disabled: true,
+ prop: "jd",
+ rules: [
+ {
+ required: true,
+ message: "请输入",
+ trigger: "blur",
+ },
+ ],
+ },
+ {
+ label: "纬度",
+ disabled: true,
+ prop: "wd",
+ rules: [
+ {
+ required: true,
+ message: "请输入",
+ trigger: "blur",
+ },
+ ],
+ },
+ ],
+ },
+ data: [],
+ };
+ },
+ computed: {
+ ...mapGetters(["permission"]),
+ permissionList() {
return {
- form: {},
- query: {},
- loading: true,
- page: {
- pageSize: 10,
- currentPage: 1,
- total: 0
- },
- selectionList: [],
- option: {
- height:'auto',
- calcHeight: 30,
- tip: false,
- searchShow: true,
- searchMenuSpan: 6,
- border: true,
- index: true,
- viewBtn: true,
- selection: true,
- dialogClickModal: false,
- column: [
- {
- label: "名称",
- prop: "name",
- rules: [{
- required: true,
- message: "请输入",
- trigger: "blur"
- }]
- },
- {
- label: "经度",
- prop: "jd",
- rules: [{
- required: true,
- message: "请输入",
- trigger: "blur"
- }]
- },
- {
- label: "纬度",
- prop: "wd",
- rules: [{
- required: true,
- message: "请输入",
- trigger: "blur"
- }]
- },
- ]
- },
- data: []
+ addBtn: this.vaildData(this.permission.tagging_add, false),
+ viewBtn: this.vaildData(this.permission.tagging_view, false),
+ delBtn: this.vaildData(this.permission.tagging_delete, false),
+ editBtn: this.vaildData(this.permission.tagging_edit, false),
};
},
- computed: {
- ...mapGetters(["permission"]),
- permissionList() {
- return {
- addBtn: this.vaildData(this.permission.tagging_add, false),
- viewBtn: this.vaildData(this.permission.tagging_view, false),
- delBtn: this.vaildData(this.permission.tagging_delete, false),
- editBtn: this.vaildData(this.permission.tagging_edit, false)
- };
- },
- ids() {
- let ids = [];
- this.selectionList.forEach(ele => {
- ids.push(ele.id);
- });
- return ids.join(",");
- }
+ ids() {
+ let ids = [];
+ this.selectionList.forEach((ele) => {
+ ids.push(ele.id);
+ });
+ return ids.join(",");
},
- methods: {
- rowSave(row, done, loading) {
- add(row).then(() => {
+ },
+ methods: {
+ getMapDatas(res) {
+ this.form["jd"] = res[0];
+ this.form["wd"] = res[1];
+ this.form["addressName"] = res[2];
+ },
+ initData() {
+ getDeptTree().then((res) => {
+ const column = this.findObject(this.option.column, "type");
+ column.dicData = res.data.data;
+ });
+ },
+ rowSave(row, done, loading) {
+ add(row).then(
+ () => {
this.onLoad(this.page);
this.$message({
type: "success",
- message: "操作成功!"
+ message: "操作成功!",
});
done();
- }, error => {
+ },
+ (error) => {
loading();
window.console.log(error);
- });
- },
- rowUpdate(row, index, done, loading) {
- update(row).then(() => {
+ }
+ );
+ },
+ rowUpdate(row, index, done, loading) {
+ update(row).then(
+ () => {
this.onLoad(this.page);
this.$message({
type: "success",
- message: "操作成功!"
+ message: "操作成功!",
});
done();
- }, error => {
+ },
+ (error) => {
loading();
console.log(error);
+ }
+ );
+ },
+ rowDel(row) {
+ this.$confirm("确定将选择数据删除?", {
+ confirmButtonText: "确定",
+ cancelButtonText: "取消",
+ type: "warning",
+ })
+ .then(() => {
+ return remove(row.id);
+ })
+ .then(() => {
+ this.onLoad(this.page);
+ this.$message({
+ type: "success",
+ message: "操作成功!",
+ });
});
- },
- rowDel(row) {
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
+ },
+ handleDelete() {
+ if (this.selectionList.length === 0) {
+ this.$message.warning("请选择至少一条数据");
+ return;
+ }
+ this.$confirm("确定将选择数据删除?", {
+ confirmButtonText: "确定",
+ cancelButtonText: "取消",
+ type: "warning",
+ })
+ .then(() => {
+ return remove(this.ids);
})
- .then(() => {
- return remove(row.id);
- })
- .then(() => {
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!"
+ .then(() => {
+ this.onLoad(this.page);
+ this.$message({
+ type: "success",
+ message: "操作成功!",
+ });
+ this.$refs.crud.toggleSelection();
+ });
+ },
+ beforeOpen(done, type) {
+ if (["edit", "view"].includes(type)) {
+ getDetail(this.form.id).then((res) => {
+ this.form = res.data.data;
+ if (type == "edit") {
+ let that = this;
+ this.$store.commit("readDom", {
+ this: that,
+ refName: "chousePointRef",
+ fn: (dom) => {
+ dom.openMaps({
+ jd: this.form.jd,
+ wd: this.form.wd,
+ name: this.form.addressName,
+ });
+ },
});
- });
- },
- handleDelete() {
- if (this.selectionList.length === 0) {
- this.$message.warning("请选择至少一条数据");
- return;
- }
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- })
- .then(() => {
- return remove(this.ids);
- })
- .then(() => {
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.$refs.crud.toggleSelection();
- });
- },
- beforeOpen(done, type) {
- if (["edit", "view"].includes(type)) {
- getDetail(this.form.id).then(res => {
- this.form = res.data.data;
- });
- }
- done();
- },
- searchReset() {
- this.query = {};
- this.onLoad(this.page);
- },
- searchChange(params, done) {
- this.query = params;
- this.page.currentPage = 1;
- this.onLoad(this.page, params);
- done();
- },
- selectionChange(list) {
- this.selectionList = list;
- },
- selectionClear() {
- this.selectionList = [];
- this.$refs.crud.toggleSelection();
- },
- currentChange(currentPage){
- this.page.currentPage = currentPage;
- },
- sizeChange(pageSize){
- this.page.pageSize = pageSize;
- },
- refreshChange() {
- this.onLoad(this.page, this.query);
- },
- onLoad(page, params = {}) {
- this.loading = true;
- getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
- const data = res.data.data;
- this.page.total = data.total;
- this.data = data.records;
- this.loading = false;
- this.selectionClear();
+ }
});
}
- }
- };
+ done();
+ },
+ searchReset() {
+ this.query = {};
+ this.onLoad(this.page);
+ },
+ searchChange(params, done) {
+ this.query = params;
+ this.page.currentPage = 1;
+ this.onLoad(this.page, params);
+ done();
+ },
+ selectionChange(list) {
+ this.selectionList = list;
+ },
+ selectionClear() {
+ this.selectionList = [];
+ this.$refs.crud.toggleSelection();
+ },
+ currentChange(currentPage) {
+ this.page.currentPage = currentPage;
+ },
+ sizeChange(pageSize) {
+ this.page.pageSize = pageSize;
+ },
+ refreshChange() {
+ this.onLoad(this.page, this.query);
+ },
+ onLoad(page, params = {}) {
+ this.loading = true;
+ getList(
+ page.currentPage,
+ page.pageSize,
+ Object.assign(params, this.query)
+ ).then((res) => {
+ const data = res.data.data;
+ this.page.total = data.total;
+ this.data = data.records;
+ this.loading = false;
+ this.selectionClear();
+ });
+ },
+ },
+};
</script>
-<style>
-</style>
+<style></style>
diff --git a/src/views/vr/vr.vue b/src/views/vr/vr.vue
index 59d84c5..5bcf535 100644
--- a/src/views/vr/vr.vue
+++ b/src/views/vr/vr.vue
@@ -1,239 +1,320 @@
<template>
<basic-container>
- <avue-crud :option="option"
- :table-loading="loading"
- :data="data"
- :page.sync="page"
- :permission="permissionList"
- :before-open="beforeOpen"
- v-model="form"
- ref="crud"
- @row-update="rowUpdate"
- @row-save="rowSave"
- @row-del="rowDel"
- @search-change="searchChange"
- @search-reset="searchReset"
- @selection-change="selectionChange"
- @current-change="currentChange"
- @size-change="sizeChange"
- @refresh-change="refreshChange"
- @on-load="onLoad">
+ <avue-crud
+ :option="option"
+ :table-loading="loading"
+ :data="data"
+ :page.sync="page"
+ :permission="permissionList"
+ :before-open="beforeOpen"
+ v-model="form"
+ ref="crud"
+ @row-update="rowUpdate"
+ @row-save="rowSave"
+ @row-del="rowDel"
+ @search-change="searchChange"
+ @search-reset="searchReset"
+ @selection-change="selectionChange"
+ @current-change="currentChange"
+ @size-change="sizeChange"
+ @refresh-change="refreshChange"
+ @on-load="onLoad"
+ >
<template slot="menuLeft">
- <el-button type="danger"
- size="small"
- icon="el-icon-delete"
- plain
- v-if="permission.vr_delete"
- @click="handleDelete">删 除
+ <el-button
+ type="danger"
+ size="small"
+ icon="el-icon-delete"
+ plain
+ v-if="permission.vr_delete"
+ @click="handleDelete"
+ >删 除
</el-button>
+ </template>
+ <template slot-scope="{ type, disabled }" slot="chouseJdWdForm">
+ <chousePoint @setData="getMapDatas" ref="chousePointRef"></chousePoint>
</template>
</avue-crud>
</basic-container>
</template>
<script>
- import {getList, getDetail, add, update, remove} from "@/api/vr/vr";
- import {mapGetters} from "vuex";
+import { getList, getDetail, add, update, remove } from "@/api/vr/vr";
+import { mapGetters } from "vuex";
- export default {
- data() {
- return {
- form: {},
- query: {},
- loading: true,
- page: {
- pageSize: 10,
- currentPage: 1,
- total: 0
- },
- selectionList: [],
- option: {
- height:'auto',
- calcHeight: 30,
- tip: false,
- searchShow: true,
- searchMenuSpan: 6,
- border: true,
- index: true,
- viewBtn: true,
- selection: true,
- align: 'center',
- indexLabel: '序号',
- dialogClickModal: false,
- column: [
- {
- label: "VR名称",
- search: true,
- prop: "vrname",
- rules: [{
+export default {
+ data() {
+ return {
+ form: {},
+ query: {},
+ loading: true,
+ page: {
+ pageSize: 10,
+ currentPage: 1,
+ total: 0,
+ },
+ selectionList: [],
+ option: {
+ height: "auto",
+ calcHeight: 30,
+ tip: false,
+ searchShow: true,
+ searchMenuSpan: 6,
+ border: true,
+ index: true,
+ viewBtn: true,
+ selection: true,
+ align: "center",
+ indexLabel: "序号",
+ dialogClickModal: false,
+ column: [
+ {
+ label: "VR名称",
+ search: true,
+ prop: "vrname",
+ rules: [
+ {
required: true,
message: "请输入VR名称",
- trigger: "blur"
- }]
- },
- {
- label: "VR地址",
- prop: "vrurl",
- rules: [{
+ trigger: "blur",
+ },
+ ],
+ },
+ {
+ label: "VR地址",
+ prop: "vrurl",
+ rules: [
+ {
required: true,
message: "请输入VR地址",
- trigger: "blur"
- }]
- },
- {
- label: "经度",
- prop: "jd",
- rules: [{
+ trigger: "blur",
+ },
+ ],
+ },
+ {
+ label: "选择地点",
+ prop: "chouseJdWd",
+ hide: true,
+ viewDisplay: false,
+ span: 24,
+ // rules: [
+ // {
+ // required: true,
+ // message: "请选择地点",
+ // trigger: "blur",
+ // },
+ // ],
+ },
+ {
+ label: "详细地点",
+ prop: "addressName",
+ hide: true,
+ // overHidden: true,
+ editDisplay: false,
+ addDisplay: false,
+ span: 24,
+ // rules: [
+ // {
+ // required: true,
+ // message: "请选择地点",
+ // trigger: "blur",
+ // },
+ // ],
+ },
+ {
+ label: "经度",
+ disabled: true,
+ prop: "jd",
+ rules: [
+ {
required: true,
message: "请输入经度",
- trigger: "blur"
- }]
- },
- {
- label: "纬度",
- prop: "wd",
- rules: [{
+ trigger: "blur",
+ },
+ ],
+ },
+ {
+ label: "纬度",
+ disabled: true,
+ prop: "wd",
+ rules: [
+ {
required: true,
message: "请输入纬度",
- trigger: "blur"
- }]
- },
- ]
- },
- data: []
+ trigger: "blur",
+ },
+ ],
+ },
+ ],
+ },
+ data: [],
+ };
+ },
+ computed: {
+ ...mapGetters(["permission"]),
+ permissionList() {
+ return {
+ addBtn: this.vaildData(this.permission.vr_add, false),
+ viewBtn: this.vaildData(this.permission.vr_view, false),
+ delBtn: this.vaildData(this.permission.vr_delete, false),
+ editBtn: this.vaildData(this.permission.vr_edit, false),
};
},
- computed: {
- ...mapGetters(["permission"]),
- permissionList() {
- return {
- addBtn: this.vaildData(this.permission.vr_add, false),
- viewBtn: this.vaildData(this.permission.vr_view, false),
- delBtn: this.vaildData(this.permission.vr_delete, false),
- editBtn: this.vaildData(this.permission.vr_edit, false)
- };
- },
- ids() {
- let ids = [];
- this.selectionList.forEach(ele => {
- ids.push(ele.id);
- });
- return ids.join(",");
- }
+ ids() {
+ let ids = [];
+ this.selectionList.forEach((ele) => {
+ ids.push(ele.id);
+ });
+ return ids.join(",");
},
- methods: {
- rowSave(row, done, loading) {
- add(row).then(() => {
+ },
+ methods: {
+ getMapDatas(res) {
+ this.form["jd"] = res[0];
+ this.form["wd"] = res[1];
+ this.form["addressName"] = res[2];
+ },
+ initData() {
+ getDeptTree().then((res) => {
+ const column = this.findObject(this.option.column, "type");
+ column.dicData = res.data.data;
+ });
+ },
+ rowSave(row, done, loading) {
+ add(row).then(
+ () => {
this.onLoad(this.page);
this.$message({
type: "success",
- message: "操作成功!"
+ message: "操作成功!",
});
done();
- }, error => {
+ },
+ (error) => {
loading();
window.console.log(error);
- });
- },
- rowUpdate(row, index, done, loading) {
- update(row).then(() => {
+ }
+ );
+ },
+ rowUpdate(row, index, done, loading) {
+ update(row).then(
+ () => {
this.onLoad(this.page);
this.$message({
type: "success",
- message: "操作成功!"
+ message: "操作成功!",
});
done();
- }, error => {
+ },
+ (error) => {
loading();
console.log(error);
+ }
+ );
+ },
+ rowDel(row) {
+ this.$confirm("确定将选择数据删除?", {
+ confirmButtonText: "确定",
+ cancelButtonText: "取消",
+ type: "warning",
+ })
+ .then(() => {
+ return remove(row.id);
+ })
+ .then(() => {
+ this.onLoad(this.page);
+ this.$message({
+ type: "success",
+ message: "操作成功!",
+ });
});
- },
- rowDel(row) {
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
+ },
+ handleDelete() {
+ if (this.selectionList.length === 0) {
+ this.$message.warning("请选择至少一条数据");
+ return;
+ }
+ this.$confirm("确定将选择数据删除?", {
+ confirmButtonText: "确定",
+ cancelButtonText: "取消",
+ type: "warning",
+ })
+ .then(() => {
+ return remove(this.ids);
})
- .then(() => {
- return remove(row.id);
- })
- .then(() => {
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!"
+ .then(() => {
+ this.onLoad(this.page);
+ this.$message({
+ type: "success",
+ message: "操作成功!",
+ });
+ this.$refs.crud.toggleSelection();
+ });
+ },
+ beforeOpen(done, type) {
+ if (["edit", "view"].includes(type)) {
+ getDetail(this.form.id).then((res) => {
+ this.form = res.data.data;
+ if (type == "edit") {
+ let that = this;
+ this.$store.commit("readDom", {
+ this: that,
+ refName: "chousePointRef",
+ fn: (dom) => {
+ dom.openMaps({
+ jd: this.form.jd,
+ wd: this.form.wd,
+ name: this.form.addressName,
+ });
+ },
});
- });
- },
- handleDelete() {
- if (this.selectionList.length === 0) {
- this.$message.warning("请选择至少一条数据");
- return;
- }
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- })
- .then(() => {
- return remove(this.ids);
- })
- .then(() => {
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.$refs.crud.toggleSelection();
- });
- },
- beforeOpen(done, type) {
- if (["edit", "view"].includes(type)) {
- getDetail(this.form.id).then(res => {
- this.form = res.data.data;
- });
- }
- done();
- },
- searchReset() {
- this.query = {};
- this.onLoad(this.page);
- },
- searchChange(params, done) {
- this.query = params;
- this.page.currentPage = 1;
- this.onLoad(this.page, params);
- done();
- },
- selectionChange(list) {
- this.selectionList = list;
- },
- selectionClear() {
- this.selectionList = [];
- this.$refs.crud.toggleSelection();
- },
- currentChange(currentPage){
- this.page.currentPage = currentPage;
- },
- sizeChange(pageSize){
- this.page.pageSize = pageSize;
- },
- refreshChange() {
- this.onLoad(this.page, this.query);
- },
- onLoad(page, params = {}) {
- this.loading = true;
- getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
- const data = res.data.data;
- this.page.total = data.total;
- this.data = data.records;
- this.loading = false;
- this.selectionClear();
+ }
});
}
- }
- };
+ done();
+ },
+ searchReset() {
+ this.query = {};
+ this.onLoad(this.page);
+ },
+ searchChange(params, done) {
+ this.query = params;
+ this.page.currentPage = 1;
+ this.onLoad(this.page, params);
+ done();
+ },
+ selectionChange(list) {
+ this.selectionList = list;
+ },
+ selectionClear() {
+ this.selectionList = [];
+ this.$refs.crud.toggleSelection();
+ },
+ currentChange(currentPage) {
+ this.page.currentPage = currentPage;
+ },
+ sizeChange(pageSize) {
+ this.page.pageSize = pageSize;
+ },
+ refreshChange() {
+ this.onLoad(this.page, this.query);
+ },
+ onLoad(page, params = {}) {
+ this.loading = true;
+ getList(
+ page.currentPage,
+ page.pageSize,
+ Object.assign(params, this.query)
+ ).then((res) => {
+ const data = res.data.data;
+ this.page.total = data.total;
+ this.data = data.records;
+ this.loading = false;
+ this.selectionClear();
+ });
+ },
+ },
+};
</script>
-<style>
-</style>
+<style></style>
--
Gitblit v1.9.3