diff --git a/config/index.js b/config/index.js index 0d96846..52762df 100644 --- a/config/index.js +++ b/config/index.js @@ -56,10 +56,10 @@ build: { // Template for index.html - index: path.resolve(__dirname, '../smartwell/index.html'), + index: path.resolve(__dirname, '../dist/index.html'), // Paths - assetsRoot: path.resolve(__dirname, '../smartwell'), + assetsRoot: path.resolve(__dirname, '../dist'), assetsSubDirectory: 'static', /** diff --git a/config/index.js b/config/index.js index 0d96846..52762df 100644 --- a/config/index.js +++ b/config/index.js @@ -56,10 +56,10 @@ build: { // Template for index.html - index: path.resolve(__dirname, '../smartwell/index.html'), + index: path.resolve(__dirname, '../dist/index.html'), // Paths - assetsRoot: path.resolve(__dirname, '../smartwell'), + assetsRoot: path.resolve(__dirname, '../dist'), assetsSubDirectory: 'static', /** diff --git a/favicon.ico b/favicon.ico index 34b63ac..586e43b 100644 --- a/favicon.ico +++ b/favicon.ico Binary files differ diff --git a/config/index.js b/config/index.js index 0d96846..52762df 100644 --- a/config/index.js +++ b/config/index.js @@ -56,10 +56,10 @@ build: { // Template for index.html - index: path.resolve(__dirname, '../smartwell/index.html'), + index: path.resolve(__dirname, '../dist/index.html'), // Paths - assetsRoot: path.resolve(__dirname, '../smartwell'), + assetsRoot: path.resolve(__dirname, '../dist'), assetsSubDirectory: 'static', /** diff --git a/favicon.ico b/favicon.ico index 34b63ac..586e43b 100644 --- a/favicon.ico +++ b/favicon.ico Binary files differ diff --git a/package.json b/package.json index db879d6..4b9d52d 100644 --- a/package.json +++ b/package.json @@ -15,18 +15,26 @@ "svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml" }, "dependencies": { - "animate.css": "^3.7.2", - "axios": "0.18.0", + "animate.css": "^4.1.1", + "axios": "^0.19.0", "babel-polyfill": "^6.26.0", "cesium": "^1.81.0", - "echarts": "^4.2.1", - "element-ui": "2.13.0", + "echarts": "^4.3.0", + "element-ui": "^2.14.1", + "esri": "0.0.1-security", + "esri-leaflet": "^3.0.1", + "esri-leaflet-renderers": "^2.1.2", + "esri-loader": "^3.0.0", "event-source-polyfill": "^1.0.5", + "jquery": "1.11.3", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", "leaflet-draw": "^1.0.4", - "mars3d": "^3.0.26", + "leaflet-rotatedmarker": "^0.2.0", + "leaflet.markercluster": "^1.5.3", + "mars3d": "^3.0.30", + "mars3d-cesium": "1.83.0", "mockjs": "1.0.1-beta3", "normalize.css": "7.0.0", "nprogress": "0.2.0", @@ -35,12 +43,12 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vuex": "^3.1.1" }, "devDependencies": { "autoprefixer": "8.5.0", "babel-core": "6.26.0", - "babel-eslint": "8.2.6", + "babel-eslint": "7.2.3", "babel-helper-vue-jsx-merge-props": "2.0.3", "babel-loader": "7.1.5", "babel-plugin-syntax-jsx": "6.18.0", diff --git a/config/index.js b/config/index.js index 0d96846..52762df 100644 --- a/config/index.js +++ b/config/index.js @@ -56,10 +56,10 @@ build: { // Template for index.html - index: path.resolve(__dirname, '../smartwell/index.html'), + index: path.resolve(__dirname, '../dist/index.html'), // Paths - assetsRoot: path.resolve(__dirname, '../smartwell'), + assetsRoot: path.resolve(__dirname, '../dist'), assetsSubDirectory: 'static', /** diff --git a/favicon.ico b/favicon.ico index 34b63ac..586e43b 100644 --- a/favicon.ico +++ b/favicon.ico Binary files differ diff --git a/package.json b/package.json index db879d6..4b9d52d 100644 --- a/package.json +++ b/package.json @@ -15,18 +15,26 @@ "svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml" }, "dependencies": { - "animate.css": "^3.7.2", - "axios": "0.18.0", + "animate.css": "^4.1.1", + "axios": "^0.19.0", "babel-polyfill": "^6.26.0", "cesium": "^1.81.0", - "echarts": "^4.2.1", - "element-ui": "2.13.0", + "echarts": "^4.3.0", + "element-ui": "^2.14.1", + "esri": "0.0.1-security", + "esri-leaflet": "^3.0.1", + "esri-leaflet-renderers": "^2.1.2", + "esri-loader": "^3.0.0", "event-source-polyfill": "^1.0.5", + "jquery": "1.11.3", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", "leaflet-draw": "^1.0.4", - "mars3d": "^3.0.26", + "leaflet-rotatedmarker": "^0.2.0", + "leaflet.markercluster": "^1.5.3", + "mars3d": "^3.0.30", + "mars3d-cesium": "1.83.0", "mockjs": "1.0.1-beta3", "normalize.css": "7.0.0", "nprogress": "0.2.0", @@ -35,12 +43,12 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vuex": "^3.1.1" }, "devDependencies": { "autoprefixer": "8.5.0", "babel-core": "6.26.0", - "babel-eslint": "8.2.6", + "babel-eslint": "7.2.3", "babel-helper-vue-jsx-merge-props": "2.0.3", "babel-loader": "7.1.5", "babel-plugin-syntax-jsx": "6.18.0", diff --git a/src/api/common.js b/src/api/common.js index 4c38684..4d989f8 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -5,7 +5,7 @@ // 模板下载 export function downloadTemplate(fileName) { return request({ - url: 'template/download', + url: '/smartwell/template/download', method: 'get', params: { filename: fileName diff --git a/config/index.js b/config/index.js index 0d96846..52762df 100644 --- a/config/index.js +++ b/config/index.js @@ -56,10 +56,10 @@ build: { // Template for index.html - index: path.resolve(__dirname, '../smartwell/index.html'), + index: path.resolve(__dirname, '../dist/index.html'), // Paths - assetsRoot: path.resolve(__dirname, '../smartwell'), + assetsRoot: path.resolve(__dirname, '../dist'), assetsSubDirectory: 'static', /** diff --git a/favicon.ico b/favicon.ico index 34b63ac..586e43b 100644 --- a/favicon.ico +++ b/favicon.ico Binary files differ diff --git a/package.json b/package.json index db879d6..4b9d52d 100644 --- a/package.json +++ b/package.json @@ -15,18 +15,26 @@ "svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml" }, "dependencies": { - "animate.css": "^3.7.2", - "axios": "0.18.0", + "animate.css": "^4.1.1", + "axios": "^0.19.0", "babel-polyfill": "^6.26.0", "cesium": "^1.81.0", - "echarts": "^4.2.1", - "element-ui": "2.13.0", + "echarts": "^4.3.0", + "element-ui": "^2.14.1", + "esri": "0.0.1-security", + "esri-leaflet": "^3.0.1", + "esri-leaflet-renderers": "^2.1.2", + "esri-loader": "^3.0.0", "event-source-polyfill": "^1.0.5", + "jquery": "1.11.3", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", "leaflet-draw": "^1.0.4", - "mars3d": "^3.0.26", + "leaflet-rotatedmarker": "^0.2.0", + "leaflet.markercluster": "^1.5.3", + "mars3d": "^3.0.30", + "mars3d-cesium": "1.83.0", "mockjs": "1.0.1-beta3", "normalize.css": "7.0.0", "nprogress": "0.2.0", @@ -35,12 +43,12 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vuex": "^3.1.1" }, "devDependencies": { "autoprefixer": "8.5.0", "babel-core": "6.26.0", - "babel-eslint": "8.2.6", + "babel-eslint": "7.2.3", "babel-helper-vue-jsx-merge-props": "2.0.3", "babel-loader": "7.1.5", "babel-plugin-syntax-jsx": "6.18.0", diff --git a/src/api/common.js b/src/api/common.js index 4c38684..4d989f8 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -5,7 +5,7 @@ // 模板下载 export function downloadTemplate(fileName) { return request({ - url: 'template/download', + url: '/smartwell/template/download', method: 'get', params: { filename: fileName diff --git a/src/assets/map/marker-icon-2x.png b/src/assets/map/marker-icon-2x.png new file mode 100644 index 0000000..88f9e50 --- /dev/null +++ b/src/assets/map/marker-icon-2x.png Binary files differ diff --git a/config/index.js b/config/index.js index 0d96846..52762df 100644 --- a/config/index.js +++ b/config/index.js @@ -56,10 +56,10 @@ build: { // Template for index.html - index: path.resolve(__dirname, '../smartwell/index.html'), + index: path.resolve(__dirname, '../dist/index.html'), // Paths - assetsRoot: path.resolve(__dirname, '../smartwell'), + assetsRoot: path.resolve(__dirname, '../dist'), assetsSubDirectory: 'static', /** diff --git a/favicon.ico b/favicon.ico index 34b63ac..586e43b 100644 --- a/favicon.ico +++ b/favicon.ico Binary files differ diff --git a/package.json b/package.json index db879d6..4b9d52d 100644 --- a/package.json +++ b/package.json @@ -15,18 +15,26 @@ "svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml" }, "dependencies": { - "animate.css": "^3.7.2", - "axios": "0.18.0", + "animate.css": "^4.1.1", + "axios": "^0.19.0", "babel-polyfill": "^6.26.0", "cesium": "^1.81.0", - "echarts": "^4.2.1", - "element-ui": "2.13.0", + "echarts": "^4.3.0", + "element-ui": "^2.14.1", + "esri": "0.0.1-security", + "esri-leaflet": "^3.0.1", + "esri-leaflet-renderers": "^2.1.2", + "esri-loader": "^3.0.0", "event-source-polyfill": "^1.0.5", + "jquery": "1.11.3", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", "leaflet-draw": "^1.0.4", - "mars3d": "^3.0.26", + "leaflet-rotatedmarker": "^0.2.0", + "leaflet.markercluster": "^1.5.3", + "mars3d": "^3.0.30", + "mars3d-cesium": "1.83.0", "mockjs": "1.0.1-beta3", "normalize.css": "7.0.0", "nprogress": "0.2.0", @@ -35,12 +43,12 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vuex": "^3.1.1" }, "devDependencies": { "autoprefixer": "8.5.0", "babel-core": "6.26.0", - "babel-eslint": "8.2.6", + "babel-eslint": "7.2.3", "babel-helper-vue-jsx-merge-props": "2.0.3", "babel-loader": "7.1.5", "babel-plugin-syntax-jsx": "6.18.0", diff --git a/src/api/common.js b/src/api/common.js index 4c38684..4d989f8 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -5,7 +5,7 @@ // 模板下载 export function downloadTemplate(fileName) { return request({ - url: 'template/download', + url: '/smartwell/template/download', method: 'get', params: { filename: fileName diff --git a/src/assets/map/marker-icon-2x.png b/src/assets/map/marker-icon-2x.png new file mode 100644 index 0000000..88f9e50 --- /dev/null +++ b/src/assets/map/marker-icon-2x.png Binary files differ diff --git a/src/assets/map/marker.png b/src/assets/map/marker.png new file mode 100644 index 0000000..fea9fe9 --- /dev/null +++ b/src/assets/map/marker.png Binary files differ diff --git a/config/index.js b/config/index.js index 0d96846..52762df 100644 --- a/config/index.js +++ b/config/index.js @@ -56,10 +56,10 @@ build: { // Template for index.html - index: path.resolve(__dirname, '../smartwell/index.html'), + index: path.resolve(__dirname, '../dist/index.html'), // Paths - assetsRoot: path.resolve(__dirname, '../smartwell'), + assetsRoot: path.resolve(__dirname, '../dist'), assetsSubDirectory: 'static', /** diff --git a/favicon.ico b/favicon.ico index 34b63ac..586e43b 100644 --- a/favicon.ico +++ b/favicon.ico Binary files differ diff --git a/package.json b/package.json index db879d6..4b9d52d 100644 --- a/package.json +++ b/package.json @@ -15,18 +15,26 @@ "svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml" }, "dependencies": { - "animate.css": "^3.7.2", - "axios": "0.18.0", + "animate.css": "^4.1.1", + "axios": "^0.19.0", "babel-polyfill": "^6.26.0", "cesium": "^1.81.0", - "echarts": "^4.2.1", - "element-ui": "2.13.0", + "echarts": "^4.3.0", + "element-ui": "^2.14.1", + "esri": "0.0.1-security", + "esri-leaflet": "^3.0.1", + "esri-leaflet-renderers": "^2.1.2", + "esri-loader": "^3.0.0", "event-source-polyfill": "^1.0.5", + "jquery": "1.11.3", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", "leaflet-draw": "^1.0.4", - "mars3d": "^3.0.26", + "leaflet-rotatedmarker": "^0.2.0", + "leaflet.markercluster": "^1.5.3", + "mars3d": "^3.0.30", + "mars3d-cesium": "1.83.0", "mockjs": "1.0.1-beta3", "normalize.css": "7.0.0", "nprogress": "0.2.0", @@ -35,12 +43,12 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vuex": "^3.1.1" }, "devDependencies": { "autoprefixer": "8.5.0", "babel-core": "6.26.0", - "babel-eslint": "8.2.6", + "babel-eslint": "7.2.3", "babel-helper-vue-jsx-merge-props": "2.0.3", "babel-loader": "7.1.5", "babel-plugin-syntax-jsx": "6.18.0", diff --git a/src/api/common.js b/src/api/common.js index 4c38684..4d989f8 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -5,7 +5,7 @@ // 模板下载 export function downloadTemplate(fileName) { return request({ - url: 'template/download', + url: '/smartwell/template/download', method: 'get', params: { filename: fileName diff --git a/src/assets/map/marker-icon-2x.png b/src/assets/map/marker-icon-2x.png new file mode 100644 index 0000000..88f9e50 --- /dev/null +++ b/src/assets/map/marker-icon-2x.png Binary files differ diff --git a/src/assets/map/marker.png b/src/assets/map/marker.png new file mode 100644 index 0000000..fea9fe9 --- /dev/null +++ b/src/assets/map/marker.png Binary files differ diff --git a/src/assets/map/markerAlarm.png b/src/assets/map/markerAlarm.png new file mode 100644 index 0000000..9b3ecb8 --- /dev/null +++ b/src/assets/map/markerAlarm.png Binary files differ diff --git a/config/index.js b/config/index.js index 0d96846..52762df 100644 --- a/config/index.js +++ b/config/index.js @@ -56,10 +56,10 @@ build: { // Template for index.html - index: path.resolve(__dirname, '../smartwell/index.html'), + index: path.resolve(__dirname, '../dist/index.html'), // Paths - assetsRoot: path.resolve(__dirname, '../smartwell'), + assetsRoot: path.resolve(__dirname, '../dist'), assetsSubDirectory: 'static', /** diff --git a/favicon.ico b/favicon.ico index 34b63ac..586e43b 100644 --- a/favicon.ico +++ b/favicon.ico Binary files differ diff --git a/package.json b/package.json index db879d6..4b9d52d 100644 --- a/package.json +++ b/package.json @@ -15,18 +15,26 @@ "svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml" }, "dependencies": { - "animate.css": "^3.7.2", - "axios": "0.18.0", + "animate.css": "^4.1.1", + "axios": "^0.19.0", "babel-polyfill": "^6.26.0", "cesium": "^1.81.0", - "echarts": "^4.2.1", - "element-ui": "2.13.0", + "echarts": "^4.3.0", + "element-ui": "^2.14.1", + "esri": "0.0.1-security", + "esri-leaflet": "^3.0.1", + "esri-leaflet-renderers": "^2.1.2", + "esri-loader": "^3.0.0", "event-source-polyfill": "^1.0.5", + "jquery": "1.11.3", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", "leaflet-draw": "^1.0.4", - "mars3d": "^3.0.26", + "leaflet-rotatedmarker": "^0.2.0", + "leaflet.markercluster": "^1.5.3", + "mars3d": "^3.0.30", + "mars3d-cesium": "1.83.0", "mockjs": "1.0.1-beta3", "normalize.css": "7.0.0", "nprogress": "0.2.0", @@ -35,12 +43,12 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vuex": "^3.1.1" }, "devDependencies": { "autoprefixer": "8.5.0", "babel-core": "6.26.0", - "babel-eslint": "8.2.6", + "babel-eslint": "7.2.3", "babel-helper-vue-jsx-merge-props": "2.0.3", "babel-loader": "7.1.5", "babel-plugin-syntax-jsx": "6.18.0", diff --git a/src/api/common.js b/src/api/common.js index 4c38684..4d989f8 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -5,7 +5,7 @@ // 模板下载 export function downloadTemplate(fileName) { return request({ - url: 'template/download', + url: '/smartwell/template/download', method: 'get', params: { filename: fileName diff --git a/src/assets/map/marker-icon-2x.png b/src/assets/map/marker-icon-2x.png new file mode 100644 index 0000000..88f9e50 --- /dev/null +++ b/src/assets/map/marker-icon-2x.png Binary files differ diff --git a/src/assets/map/marker.png b/src/assets/map/marker.png new file mode 100644 index 0000000..fea9fe9 --- /dev/null +++ b/src/assets/map/marker.png Binary files differ diff --git a/src/assets/map/markerAlarm.png b/src/assets/map/markerAlarm.png new file mode 100644 index 0000000..9b3ecb8 --- /dev/null +++ b/src/assets/map/markerAlarm.png Binary files differ diff --git a/src/components/mapWindow/base/mixins/abstract.js b/src/components/mapWindow/base/mixins/abstract.js new file mode 100644 index 0000000..9cf6d52 --- /dev/null +++ b/src/components/mapWindow/base/mixins/abstract.js @@ -0,0 +1,13 @@ +class Mixin { + constructor({ component, props, events, extraProps, exceptProps }) { + this.render = function(h) { + return h(component, { + props: props.reduce((obj, key) => Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/config/index.js b/config/index.js index 0d96846..52762df 100644 --- a/config/index.js +++ b/config/index.js @@ -56,10 +56,10 @@ build: { // Template for index.html - index: path.resolve(__dirname, '../smartwell/index.html'), + index: path.resolve(__dirname, '../dist/index.html'), // Paths - assetsRoot: path.resolve(__dirname, '../smartwell'), + assetsRoot: path.resolve(__dirname, '../dist'), assetsSubDirectory: 'static', /** diff --git a/favicon.ico b/favicon.ico index 34b63ac..586e43b 100644 --- a/favicon.ico +++ b/favicon.ico Binary files differ diff --git a/package.json b/package.json index db879d6..4b9d52d 100644 --- a/package.json +++ b/package.json @@ -15,18 +15,26 @@ "svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml" }, "dependencies": { - "animate.css": "^3.7.2", - "axios": "0.18.0", + "animate.css": "^4.1.1", + "axios": "^0.19.0", "babel-polyfill": "^6.26.0", "cesium": "^1.81.0", - "echarts": "^4.2.1", - "element-ui": "2.13.0", + "echarts": "^4.3.0", + "element-ui": "^2.14.1", + "esri": "0.0.1-security", + "esri-leaflet": "^3.0.1", + "esri-leaflet-renderers": "^2.1.2", + "esri-loader": "^3.0.0", "event-source-polyfill": "^1.0.5", + "jquery": "1.11.3", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", "leaflet-draw": "^1.0.4", - "mars3d": "^3.0.26", + "leaflet-rotatedmarker": "^0.2.0", + "leaflet.markercluster": "^1.5.3", + "mars3d": "^3.0.30", + "mars3d-cesium": "1.83.0", "mockjs": "1.0.1-beta3", "normalize.css": "7.0.0", "nprogress": "0.2.0", @@ -35,12 +43,12 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vuex": "^3.1.1" }, "devDependencies": { "autoprefixer": "8.5.0", "babel-core": "6.26.0", - "babel-eslint": "8.2.6", + "babel-eslint": "7.2.3", "babel-helper-vue-jsx-merge-props": "2.0.3", "babel-loader": "7.1.5", "babel-plugin-syntax-jsx": "6.18.0", diff --git a/src/api/common.js b/src/api/common.js index 4c38684..4d989f8 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -5,7 +5,7 @@ // 模板下载 export function downloadTemplate(fileName) { return request({ - url: 'template/download', + url: '/smartwell/template/download', method: 'get', params: { filename: fileName diff --git a/src/assets/map/marker-icon-2x.png b/src/assets/map/marker-icon-2x.png new file mode 100644 index 0000000..88f9e50 --- /dev/null +++ b/src/assets/map/marker-icon-2x.png Binary files differ diff --git a/src/assets/map/marker.png b/src/assets/map/marker.png new file mode 100644 index 0000000..fea9fe9 --- /dev/null +++ b/src/assets/map/marker.png Binary files differ diff --git a/src/assets/map/markerAlarm.png b/src/assets/map/markerAlarm.png new file mode 100644 index 0000000..9b3ecb8 --- /dev/null +++ b/src/assets/map/markerAlarm.png Binary files differ diff --git a/src/components/mapWindow/base/mixins/abstract.js b/src/components/mapWindow/base/mixins/abstract.js new file mode 100644 index 0000000..9cf6d52 --- /dev/null +++ b/src/components/mapWindow/base/mixins/abstract.js @@ -0,0 +1,13 @@ +class Mixin { + constructor({ component, props, events, extraProps, exceptProps }) { + this.render = function(h) { + return h(component, { + props: props.reduce((obj, key) => Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/config/index.js b/config/index.js index 0d96846..52762df 100644 --- a/config/index.js +++ b/config/index.js @@ -56,10 +56,10 @@ build: { // Template for index.html - index: path.resolve(__dirname, '../smartwell/index.html'), + index: path.resolve(__dirname, '../dist/index.html'), // Paths - assetsRoot: path.resolve(__dirname, '../smartwell'), + assetsRoot: path.resolve(__dirname, '../dist'), assetsSubDirectory: 'static', /** diff --git a/favicon.ico b/favicon.ico index 34b63ac..586e43b 100644 --- a/favicon.ico +++ b/favicon.ico Binary files differ diff --git a/package.json b/package.json index db879d6..4b9d52d 100644 --- a/package.json +++ b/package.json @@ -15,18 +15,26 @@ "svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml" }, "dependencies": { - "animate.css": "^3.7.2", - "axios": "0.18.0", + "animate.css": "^4.1.1", + "axios": "^0.19.0", "babel-polyfill": "^6.26.0", "cesium": "^1.81.0", - "echarts": "^4.2.1", - "element-ui": "2.13.0", + "echarts": "^4.3.0", + "element-ui": "^2.14.1", + "esri": "0.0.1-security", + "esri-leaflet": "^3.0.1", + "esri-leaflet-renderers": "^2.1.2", + "esri-loader": "^3.0.0", "event-source-polyfill": "^1.0.5", + "jquery": "1.11.3", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", "leaflet-draw": "^1.0.4", - "mars3d": "^3.0.26", + "leaflet-rotatedmarker": "^0.2.0", + "leaflet.markercluster": "^1.5.3", + "mars3d": "^3.0.30", + "mars3d-cesium": "1.83.0", "mockjs": "1.0.1-beta3", "normalize.css": "7.0.0", "nprogress": "0.2.0", @@ -35,12 +43,12 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vuex": "^3.1.1" }, "devDependencies": { "autoprefixer": "8.5.0", "babel-core": "6.26.0", - "babel-eslint": "8.2.6", + "babel-eslint": "7.2.3", "babel-helper-vue-jsx-merge-props": "2.0.3", "babel-loader": "7.1.5", "babel-plugin-syntax-jsx": "6.18.0", diff --git a/src/api/common.js b/src/api/common.js index 4c38684..4d989f8 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -5,7 +5,7 @@ // 模板下载 export function downloadTemplate(fileName) { return request({ - url: 'template/download', + url: '/smartwell/template/download', method: 'get', params: { filename: fileName diff --git a/src/assets/map/marker-icon-2x.png b/src/assets/map/marker-icon-2x.png new file mode 100644 index 0000000..88f9e50 --- /dev/null +++ b/src/assets/map/marker-icon-2x.png Binary files differ diff --git a/src/assets/map/marker.png b/src/assets/map/marker.png new file mode 100644 index 0000000..fea9fe9 --- /dev/null +++ b/src/assets/map/marker.png Binary files differ diff --git a/src/assets/map/markerAlarm.png b/src/assets/map/markerAlarm.png new file mode 100644 index 0000000..9b3ecb8 --- /dev/null +++ b/src/assets/map/markerAlarm.png Binary files differ diff --git a/src/components/mapWindow/base/mixins/abstract.js b/src/components/mapWindow/base/mixins/abstract.js new file mode 100644 index 0000000..9cf6d52 --- /dev/null +++ b/src/components/mapWindow/base/mixins/abstract.js @@ -0,0 +1,13 @@ +class Mixin { + constructor({ component, props, events, extraProps, exceptProps }) { + this.render = function(h) { + return h(component, { + props: props.reduce((obj, key) => Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..4ec7b61 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,270 @@ + + + + + + + diff --git a/config/index.js b/config/index.js index 0d96846..52762df 100644 --- a/config/index.js +++ b/config/index.js @@ -56,10 +56,10 @@ build: { // Template for index.html - index: path.resolve(__dirname, '../smartwell/index.html'), + index: path.resolve(__dirname, '../dist/index.html'), // Paths - assetsRoot: path.resolve(__dirname, '../smartwell'), + assetsRoot: path.resolve(__dirname, '../dist'), assetsSubDirectory: 'static', /** diff --git a/favicon.ico b/favicon.ico index 34b63ac..586e43b 100644 --- a/favicon.ico +++ b/favicon.ico Binary files differ diff --git a/package.json b/package.json index db879d6..4b9d52d 100644 --- a/package.json +++ b/package.json @@ -15,18 +15,26 @@ "svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml" }, "dependencies": { - "animate.css": "^3.7.2", - "axios": "0.18.0", + "animate.css": "^4.1.1", + "axios": "^0.19.0", "babel-polyfill": "^6.26.0", "cesium": "^1.81.0", - "echarts": "^4.2.1", - "element-ui": "2.13.0", + "echarts": "^4.3.0", + "element-ui": "^2.14.1", + "esri": "0.0.1-security", + "esri-leaflet": "^3.0.1", + "esri-leaflet-renderers": "^2.1.2", + "esri-loader": "^3.0.0", "event-source-polyfill": "^1.0.5", + "jquery": "1.11.3", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", "leaflet-draw": "^1.0.4", - "mars3d": "^3.0.26", + "leaflet-rotatedmarker": "^0.2.0", + "leaflet.markercluster": "^1.5.3", + "mars3d": "^3.0.30", + "mars3d-cesium": "1.83.0", "mockjs": "1.0.1-beta3", "normalize.css": "7.0.0", "nprogress": "0.2.0", @@ -35,12 +43,12 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vuex": "^3.1.1" }, "devDependencies": { "autoprefixer": "8.5.0", "babel-core": "6.26.0", - "babel-eslint": "8.2.6", + "babel-eslint": "7.2.3", "babel-helper-vue-jsx-merge-props": "2.0.3", "babel-loader": "7.1.5", "babel-plugin-syntax-jsx": "6.18.0", diff --git a/src/api/common.js b/src/api/common.js index 4c38684..4d989f8 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -5,7 +5,7 @@ // 模板下载 export function downloadTemplate(fileName) { return request({ - url: 'template/download', + url: '/smartwell/template/download', method: 'get', params: { filename: fileName diff --git a/src/assets/map/marker-icon-2x.png b/src/assets/map/marker-icon-2x.png new file mode 100644 index 0000000..88f9e50 --- /dev/null +++ b/src/assets/map/marker-icon-2x.png Binary files differ diff --git a/src/assets/map/marker.png b/src/assets/map/marker.png new file mode 100644 index 0000000..fea9fe9 --- /dev/null +++ b/src/assets/map/marker.png Binary files differ diff --git a/src/assets/map/markerAlarm.png b/src/assets/map/markerAlarm.png new file mode 100644 index 0000000..9b3ecb8 --- /dev/null +++ b/src/assets/map/markerAlarm.png Binary files differ diff --git a/src/components/mapWindow/base/mixins/abstract.js b/src/components/mapWindow/base/mixins/abstract.js new file mode 100644 index 0000000..9cf6d52 --- /dev/null +++ b/src/components/mapWindow/base/mixins/abstract.js @@ -0,0 +1,13 @@ +class Mixin { + constructor({ component, props, events, extraProps, exceptProps }) { + this.render = function(h) { + return h(component, { + props: props.reduce((obj, key) => Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..4ec7b61 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,270 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/config/index.js b/config/index.js index 0d96846..52762df 100644 --- a/config/index.js +++ b/config/index.js @@ -56,10 +56,10 @@ build: { // Template for index.html - index: path.resolve(__dirname, '../smartwell/index.html'), + index: path.resolve(__dirname, '../dist/index.html'), // Paths - assetsRoot: path.resolve(__dirname, '../smartwell'), + assetsRoot: path.resolve(__dirname, '../dist'), assetsSubDirectory: 'static', /** diff --git a/favicon.ico b/favicon.ico index 34b63ac..586e43b 100644 --- a/favicon.ico +++ b/favicon.ico Binary files differ diff --git a/package.json b/package.json index db879d6..4b9d52d 100644 --- a/package.json +++ b/package.json @@ -15,18 +15,26 @@ "svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml" }, "dependencies": { - "animate.css": "^3.7.2", - "axios": "0.18.0", + "animate.css": "^4.1.1", + "axios": "^0.19.0", "babel-polyfill": "^6.26.0", "cesium": "^1.81.0", - "echarts": "^4.2.1", - "element-ui": "2.13.0", + "echarts": "^4.3.0", + "element-ui": "^2.14.1", + "esri": "0.0.1-security", + "esri-leaflet": "^3.0.1", + "esri-leaflet-renderers": "^2.1.2", + "esri-loader": "^3.0.0", "event-source-polyfill": "^1.0.5", + "jquery": "1.11.3", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", "leaflet-draw": "^1.0.4", - "mars3d": "^3.0.26", + "leaflet-rotatedmarker": "^0.2.0", + "leaflet.markercluster": "^1.5.3", + "mars3d": "^3.0.30", + "mars3d-cesium": "1.83.0", "mockjs": "1.0.1-beta3", "normalize.css": "7.0.0", "nprogress": "0.2.0", @@ -35,12 +43,12 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vuex": "^3.1.1" }, "devDependencies": { "autoprefixer": "8.5.0", "babel-core": "6.26.0", - "babel-eslint": "8.2.6", + "babel-eslint": "7.2.3", "babel-helper-vue-jsx-merge-props": "2.0.3", "babel-loader": "7.1.5", "babel-plugin-syntax-jsx": "6.18.0", diff --git a/src/api/common.js b/src/api/common.js index 4c38684..4d989f8 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -5,7 +5,7 @@ // 模板下载 export function downloadTemplate(fileName) { return request({ - url: 'template/download', + url: '/smartwell/template/download', method: 'get', params: { filename: fileName diff --git a/src/assets/map/marker-icon-2x.png b/src/assets/map/marker-icon-2x.png new file mode 100644 index 0000000..88f9e50 --- /dev/null +++ b/src/assets/map/marker-icon-2x.png Binary files differ diff --git a/src/assets/map/marker.png b/src/assets/map/marker.png new file mode 100644 index 0000000..fea9fe9 --- /dev/null +++ b/src/assets/map/marker.png Binary files differ diff --git a/src/assets/map/markerAlarm.png b/src/assets/map/markerAlarm.png new file mode 100644 index 0000000..9b3ecb8 --- /dev/null +++ b/src/assets/map/markerAlarm.png Binary files differ diff --git a/src/components/mapWindow/base/mixins/abstract.js b/src/components/mapWindow/base/mixins/abstract.js new file mode 100644 index 0000000..9cf6d52 --- /dev/null +++ b/src/components/mapWindow/base/mixins/abstract.js @@ -0,0 +1,13 @@ +class Mixin { + constructor({ component, props, events, extraProps, exceptProps }) { + this.render = function(h) { + return h(component, { + props: props.reduce((obj, key) => Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..4ec7b61 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,270 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/icons/svg/icon-order.svg b/src/icons/svg/icon-order.svg new file mode 100644 index 0000000..62d7666 --- /dev/null +++ b/src/icons/svg/icon-order.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/config/index.js b/config/index.js index 0d96846..52762df 100644 --- a/config/index.js +++ b/config/index.js @@ -56,10 +56,10 @@ build: { // Template for index.html - index: path.resolve(__dirname, '../smartwell/index.html'), + index: path.resolve(__dirname, '../dist/index.html'), // Paths - assetsRoot: path.resolve(__dirname, '../smartwell'), + assetsRoot: path.resolve(__dirname, '../dist'), assetsSubDirectory: 'static', /** diff --git a/favicon.ico b/favicon.ico index 34b63ac..586e43b 100644 --- a/favicon.ico +++ b/favicon.ico Binary files differ diff --git a/package.json b/package.json index db879d6..4b9d52d 100644 --- a/package.json +++ b/package.json @@ -15,18 +15,26 @@ "svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml" }, "dependencies": { - "animate.css": "^3.7.2", - "axios": "0.18.0", + "animate.css": "^4.1.1", + "axios": "^0.19.0", "babel-polyfill": "^6.26.0", "cesium": "^1.81.0", - "echarts": "^4.2.1", - "element-ui": "2.13.0", + "echarts": "^4.3.0", + "element-ui": "^2.14.1", + "esri": "0.0.1-security", + "esri-leaflet": "^3.0.1", + "esri-leaflet-renderers": "^2.1.2", + "esri-loader": "^3.0.0", "event-source-polyfill": "^1.0.5", + "jquery": "1.11.3", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", "leaflet-draw": "^1.0.4", - "mars3d": "^3.0.26", + "leaflet-rotatedmarker": "^0.2.0", + "leaflet.markercluster": "^1.5.3", + "mars3d": "^3.0.30", + "mars3d-cesium": "1.83.0", "mockjs": "1.0.1-beta3", "normalize.css": "7.0.0", "nprogress": "0.2.0", @@ -35,12 +43,12 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vuex": "^3.1.1" }, "devDependencies": { "autoprefixer": "8.5.0", "babel-core": "6.26.0", - "babel-eslint": "8.2.6", + "babel-eslint": "7.2.3", "babel-helper-vue-jsx-merge-props": "2.0.3", "babel-loader": "7.1.5", "babel-plugin-syntax-jsx": "6.18.0", diff --git a/src/api/common.js b/src/api/common.js index 4c38684..4d989f8 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -5,7 +5,7 @@ // 模板下载 export function downloadTemplate(fileName) { return request({ - url: 'template/download', + url: '/smartwell/template/download', method: 'get', params: { filename: fileName diff --git a/src/assets/map/marker-icon-2x.png b/src/assets/map/marker-icon-2x.png new file mode 100644 index 0000000..88f9e50 --- /dev/null +++ b/src/assets/map/marker-icon-2x.png Binary files differ diff --git a/src/assets/map/marker.png b/src/assets/map/marker.png new file mode 100644 index 0000000..fea9fe9 --- /dev/null +++ b/src/assets/map/marker.png Binary files differ diff --git a/src/assets/map/markerAlarm.png b/src/assets/map/markerAlarm.png new file mode 100644 index 0000000..9b3ecb8 --- /dev/null +++ b/src/assets/map/markerAlarm.png Binary files differ diff --git a/src/components/mapWindow/base/mixins/abstract.js b/src/components/mapWindow/base/mixins/abstract.js new file mode 100644 index 0000000..9cf6d52 --- /dev/null +++ b/src/components/mapWindow/base/mixins/abstract.js @@ -0,0 +1,13 @@ +class Mixin { + constructor({ component, props, events, extraProps, exceptProps }) { + this.render = function(h) { + return h(component, { + props: props.reduce((obj, key) => Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..4ec7b61 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,270 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/icons/svg/icon-order.svg b/src/icons/svg/icon-order.svg new file mode 100644 index 0000000..62d7666 --- /dev/null +++ b/src/icons/svg/icon-order.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/icon-overview.svg b/src/icons/svg/icon-overview.svg index a2f9449..9dc3936 100644 --- a/src/icons/svg/icon-overview.svg +++ b/src/icons/svg/icon-overview.svg @@ -1 +1 @@ - \ No newline at end of file + diff --git a/config/index.js b/config/index.js index 0d96846..52762df 100644 --- a/config/index.js +++ b/config/index.js @@ -56,10 +56,10 @@ build: { // Template for index.html - index: path.resolve(__dirname, '../smartwell/index.html'), + index: path.resolve(__dirname, '../dist/index.html'), // Paths - assetsRoot: path.resolve(__dirname, '../smartwell'), + assetsRoot: path.resolve(__dirname, '../dist'), assetsSubDirectory: 'static', /** diff --git a/favicon.ico b/favicon.ico index 34b63ac..586e43b 100644 --- a/favicon.ico +++ b/favicon.ico Binary files differ diff --git a/package.json b/package.json index db879d6..4b9d52d 100644 --- a/package.json +++ b/package.json @@ -15,18 +15,26 @@ "svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml" }, "dependencies": { - "animate.css": "^3.7.2", - "axios": "0.18.0", + "animate.css": "^4.1.1", + "axios": "^0.19.0", "babel-polyfill": "^6.26.0", "cesium": "^1.81.0", - "echarts": "^4.2.1", - "element-ui": "2.13.0", + "echarts": "^4.3.0", + "element-ui": "^2.14.1", + "esri": "0.0.1-security", + "esri-leaflet": "^3.0.1", + "esri-leaflet-renderers": "^2.1.2", + "esri-loader": "^3.0.0", "event-source-polyfill": "^1.0.5", + "jquery": "1.11.3", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", "leaflet-draw": "^1.0.4", - "mars3d": "^3.0.26", + "leaflet-rotatedmarker": "^0.2.0", + "leaflet.markercluster": "^1.5.3", + "mars3d": "^3.0.30", + "mars3d-cesium": "1.83.0", "mockjs": "1.0.1-beta3", "normalize.css": "7.0.0", "nprogress": "0.2.0", @@ -35,12 +43,12 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vuex": "^3.1.1" }, "devDependencies": { "autoprefixer": "8.5.0", "babel-core": "6.26.0", - "babel-eslint": "8.2.6", + "babel-eslint": "7.2.3", "babel-helper-vue-jsx-merge-props": "2.0.3", "babel-loader": "7.1.5", "babel-plugin-syntax-jsx": "6.18.0", diff --git a/src/api/common.js b/src/api/common.js index 4c38684..4d989f8 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -5,7 +5,7 @@ // 模板下载 export function downloadTemplate(fileName) { return request({ - url: 'template/download', + url: '/smartwell/template/download', method: 'get', params: { filename: fileName diff --git a/src/assets/map/marker-icon-2x.png b/src/assets/map/marker-icon-2x.png new file mode 100644 index 0000000..88f9e50 --- /dev/null +++ b/src/assets/map/marker-icon-2x.png Binary files differ diff --git a/src/assets/map/marker.png b/src/assets/map/marker.png new file mode 100644 index 0000000..fea9fe9 --- /dev/null +++ b/src/assets/map/marker.png Binary files differ diff --git a/src/assets/map/markerAlarm.png b/src/assets/map/markerAlarm.png new file mode 100644 index 0000000..9b3ecb8 --- /dev/null +++ b/src/assets/map/markerAlarm.png Binary files differ diff --git a/src/components/mapWindow/base/mixins/abstract.js b/src/components/mapWindow/base/mixins/abstract.js new file mode 100644 index 0000000..9cf6d52 --- /dev/null +++ b/src/components/mapWindow/base/mixins/abstract.js @@ -0,0 +1,13 @@ +class Mixin { + constructor({ component, props, events, extraProps, exceptProps }) { + this.render = function(h) { + return h(component, { + props: props.reduce((obj, key) => Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..4ec7b61 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,270 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/icons/svg/icon-order.svg b/src/icons/svg/icon-order.svg new file mode 100644 index 0000000..62d7666 --- /dev/null +++ b/src/icons/svg/icon-order.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/icon-overview.svg b/src/icons/svg/icon-overview.svg index a2f9449..9dc3936 100644 --- a/src/icons/svg/icon-overview.svg +++ b/src/icons/svg/icon-overview.svg @@ -1 +1 @@ - \ No newline at end of file + diff --git a/src/layout/components/AppHeader.vue b/src/layout/components/AppHeader.vue index 8d8912e..375c71c 100644 --- a/src/layout/components/AppHeader.vue +++ b/src/layout/components/AppHeader.vue @@ -2,7 +2,7 @@

{{ title }}

- + {{ currentSystem.name }} diff --git a/config/index.js b/config/index.js index 0d96846..52762df 100644 --- a/config/index.js +++ b/config/index.js @@ -56,10 +56,10 @@ build: { // Template for index.html - index: path.resolve(__dirname, '../smartwell/index.html'), + index: path.resolve(__dirname, '../dist/index.html'), // Paths - assetsRoot: path.resolve(__dirname, '../smartwell'), + assetsRoot: path.resolve(__dirname, '../dist'), assetsSubDirectory: 'static', /** diff --git a/favicon.ico b/favicon.ico index 34b63ac..586e43b 100644 --- a/favicon.ico +++ b/favicon.ico Binary files differ diff --git a/package.json b/package.json index db879d6..4b9d52d 100644 --- a/package.json +++ b/package.json @@ -15,18 +15,26 @@ "svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml" }, "dependencies": { - "animate.css": "^3.7.2", - "axios": "0.18.0", + "animate.css": "^4.1.1", + "axios": "^0.19.0", "babel-polyfill": "^6.26.0", "cesium": "^1.81.0", - "echarts": "^4.2.1", - "element-ui": "2.13.0", + "echarts": "^4.3.0", + "element-ui": "^2.14.1", + "esri": "0.0.1-security", + "esri-leaflet": "^3.0.1", + "esri-leaflet-renderers": "^2.1.2", + "esri-loader": "^3.0.0", "event-source-polyfill": "^1.0.5", + "jquery": "1.11.3", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", "leaflet-draw": "^1.0.4", - "mars3d": "^3.0.26", + "leaflet-rotatedmarker": "^0.2.0", + "leaflet.markercluster": "^1.5.3", + "mars3d": "^3.0.30", + "mars3d-cesium": "1.83.0", "mockjs": "1.0.1-beta3", "normalize.css": "7.0.0", "nprogress": "0.2.0", @@ -35,12 +43,12 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vuex": "^3.1.1" }, "devDependencies": { "autoprefixer": "8.5.0", "babel-core": "6.26.0", - "babel-eslint": "8.2.6", + "babel-eslint": "7.2.3", "babel-helper-vue-jsx-merge-props": "2.0.3", "babel-loader": "7.1.5", "babel-plugin-syntax-jsx": "6.18.0", diff --git a/src/api/common.js b/src/api/common.js index 4c38684..4d989f8 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -5,7 +5,7 @@ // 模板下载 export function downloadTemplate(fileName) { return request({ - url: 'template/download', + url: '/smartwell/template/download', method: 'get', params: { filename: fileName diff --git a/src/assets/map/marker-icon-2x.png b/src/assets/map/marker-icon-2x.png new file mode 100644 index 0000000..88f9e50 --- /dev/null +++ b/src/assets/map/marker-icon-2x.png Binary files differ diff --git a/src/assets/map/marker.png b/src/assets/map/marker.png new file mode 100644 index 0000000..fea9fe9 --- /dev/null +++ b/src/assets/map/marker.png Binary files differ diff --git a/src/assets/map/markerAlarm.png b/src/assets/map/markerAlarm.png new file mode 100644 index 0000000..9b3ecb8 --- /dev/null +++ b/src/assets/map/markerAlarm.png Binary files differ diff --git a/src/components/mapWindow/base/mixins/abstract.js b/src/components/mapWindow/base/mixins/abstract.js new file mode 100644 index 0000000..9cf6d52 --- /dev/null +++ b/src/components/mapWindow/base/mixins/abstract.js @@ -0,0 +1,13 @@ +class Mixin { + constructor({ component, props, events, extraProps, exceptProps }) { + this.render = function(h) { + return h(component, { + props: props.reduce((obj, key) => Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..4ec7b61 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,270 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/icons/svg/icon-order.svg b/src/icons/svg/icon-order.svg new file mode 100644 index 0000000..62d7666 --- /dev/null +++ b/src/icons/svg/icon-order.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/icon-overview.svg b/src/icons/svg/icon-overview.svg index a2f9449..9dc3936 100644 --- a/src/icons/svg/icon-overview.svg +++ b/src/icons/svg/icon-overview.svg @@ -1 +1 @@ - \ No newline at end of file + diff --git a/src/layout/components/AppHeader.vue b/src/layout/components/AppHeader.vue index 8d8912e..375c71c 100644 --- a/src/layout/components/AppHeader.vue +++ b/src/layout/components/AppHeader.vue @@ -2,7 +2,7 @@

{{ title }}

- + {{ currentSystem.name }} diff --git a/src/main.js b/src/main.js index 9f6c3ec..852dfe5 100644 --- a/src/main.js +++ b/src/main.js @@ -42,10 +42,10 @@ import 'leaflet-draw/dist/leaflet.draw.css' // 在main.js中加入下面代码 -import 'mars3d/dist/mars3d.css' +// import 'mars3d/dist/mars3d.css' // import 'mars3d-esri/dist/mars3d-esri.js' -import * as mars3d from 'mars3d' -Vue.prototype.mars3d = mars3d +// import * as mars3d from 'mars3d' +// Vue.prototype.mars3d = mars3d /** * This project originally used easy-mock to simulate data, diff --git a/config/index.js b/config/index.js index 0d96846..52762df 100644 --- a/config/index.js +++ b/config/index.js @@ -56,10 +56,10 @@ build: { // Template for index.html - index: path.resolve(__dirname, '../smartwell/index.html'), + index: path.resolve(__dirname, '../dist/index.html'), // Paths - assetsRoot: path.resolve(__dirname, '../smartwell'), + assetsRoot: path.resolve(__dirname, '../dist'), assetsSubDirectory: 'static', /** diff --git a/favicon.ico b/favicon.ico index 34b63ac..586e43b 100644 --- a/favicon.ico +++ b/favicon.ico Binary files differ diff --git a/package.json b/package.json index db879d6..4b9d52d 100644 --- a/package.json +++ b/package.json @@ -15,18 +15,26 @@ "svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml" }, "dependencies": { - "animate.css": "^3.7.2", - "axios": "0.18.0", + "animate.css": "^4.1.1", + "axios": "^0.19.0", "babel-polyfill": "^6.26.0", "cesium": "^1.81.0", - "echarts": "^4.2.1", - "element-ui": "2.13.0", + "echarts": "^4.3.0", + "element-ui": "^2.14.1", + "esri": "0.0.1-security", + "esri-leaflet": "^3.0.1", + "esri-leaflet-renderers": "^2.1.2", + "esri-loader": "^3.0.0", "event-source-polyfill": "^1.0.5", + "jquery": "1.11.3", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", "leaflet-draw": "^1.0.4", - "mars3d": "^3.0.26", + "leaflet-rotatedmarker": "^0.2.0", + "leaflet.markercluster": "^1.5.3", + "mars3d": "^3.0.30", + "mars3d-cesium": "1.83.0", "mockjs": "1.0.1-beta3", "normalize.css": "7.0.0", "nprogress": "0.2.0", @@ -35,12 +43,12 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vuex": "^3.1.1" }, "devDependencies": { "autoprefixer": "8.5.0", "babel-core": "6.26.0", - "babel-eslint": "8.2.6", + "babel-eslint": "7.2.3", "babel-helper-vue-jsx-merge-props": "2.0.3", "babel-loader": "7.1.5", "babel-plugin-syntax-jsx": "6.18.0", diff --git a/src/api/common.js b/src/api/common.js index 4c38684..4d989f8 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -5,7 +5,7 @@ // 模板下载 export function downloadTemplate(fileName) { return request({ - url: 'template/download', + url: '/smartwell/template/download', method: 'get', params: { filename: fileName diff --git a/src/assets/map/marker-icon-2x.png b/src/assets/map/marker-icon-2x.png new file mode 100644 index 0000000..88f9e50 --- /dev/null +++ b/src/assets/map/marker-icon-2x.png Binary files differ diff --git a/src/assets/map/marker.png b/src/assets/map/marker.png new file mode 100644 index 0000000..fea9fe9 --- /dev/null +++ b/src/assets/map/marker.png Binary files differ diff --git a/src/assets/map/markerAlarm.png b/src/assets/map/markerAlarm.png new file mode 100644 index 0000000..9b3ecb8 --- /dev/null +++ b/src/assets/map/markerAlarm.png Binary files differ diff --git a/src/components/mapWindow/base/mixins/abstract.js b/src/components/mapWindow/base/mixins/abstract.js new file mode 100644 index 0000000..9cf6d52 --- /dev/null +++ b/src/components/mapWindow/base/mixins/abstract.js @@ -0,0 +1,13 @@ +class Mixin { + constructor({ component, props, events, extraProps, exceptProps }) { + this.render = function(h) { + return h(component, { + props: props.reduce((obj, key) => Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..4ec7b61 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,270 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/icons/svg/icon-order.svg b/src/icons/svg/icon-order.svg new file mode 100644 index 0000000..62d7666 --- /dev/null +++ b/src/icons/svg/icon-order.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/icon-overview.svg b/src/icons/svg/icon-overview.svg index a2f9449..9dc3936 100644 --- a/src/icons/svg/icon-overview.svg +++ b/src/icons/svg/icon-overview.svg @@ -1 +1 @@ - \ No newline at end of file + diff --git a/src/layout/components/AppHeader.vue b/src/layout/components/AppHeader.vue index 8d8912e..375c71c 100644 --- a/src/layout/components/AppHeader.vue +++ b/src/layout/components/AppHeader.vue @@ -2,7 +2,7 @@

{{ title }}

- + {{ currentSystem.name }} diff --git a/src/main.js b/src/main.js index 9f6c3ec..852dfe5 100644 --- a/src/main.js +++ b/src/main.js @@ -42,10 +42,10 @@ import 'leaflet-draw/dist/leaflet.draw.css' // 在main.js中加入下面代码 -import 'mars3d/dist/mars3d.css' +// import 'mars3d/dist/mars3d.css' // import 'mars3d-esri/dist/mars3d-esri.js' -import * as mars3d from 'mars3d' -Vue.prototype.mars3d = mars3d +// import * as mars3d from 'mars3d' +// Vue.prototype.mars3d = mars3d /** * This project originally used easy-mock to simulate data, diff --git a/src/router/index.js b/src/router/index.js index 254f077..063e508 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -8,6 +8,7 @@ /* Layout */ import Layout from '../views/layout/Layout' +import { systemRouters } from './modules/system' /** * hidden: true if `hidden:true` will not show in the sidebar(default is false) @@ -86,9 +87,9 @@ children: [ { path: '/overview', - component: () => import('@/views/overview/overview'), + component: () => import('@/views/overview/overviewSmartwell'), // component: () => import('@/views/overview/oo'), - name: 'overview', + name: 'OverviewSmartWell', meta: { title: '运行状态总览', icon: 'icon-config', permission: ['/overview/wellList'] } } ] @@ -117,26 +118,26 @@ component: () => import('@/views/alarmManage/listAlarmRecords'), meta: { title: '告警记录', icon: 'icon-config', keepAlive: true, permission: ['/alarm/list'] } }, + // { + // path: '/listJob', + // name: 'ListJob', + // component: () => import('@/views/jobManage/listJobs'), + // meta: { title: '告警工单', icon: 'icon-config', keepAlive: true, permission: ['/job/list'] } + // }, + // { + // path: '/listOvertimeGetJob', + // name: 'ListJobOvertimeGet', + // component: () => import('@/views/jobManage/listJobsOvertimeGet'), + // meta: { title: '超时未接收工单', icon: 'icon-config', keepAlive: true, permission: ['/job/overtimeGetList'] } + // }, + // { + // path: '/listOvertimeHandleJob', + // name: 'ListJobOvertimeHandle', + // component: () => import('@/views/jobManage/listJobsOvertimeHandle'), + // meta: { title: '超时未处理工单', icon: 'icon-config', keepAlive: true, permission: ['/job/overtimeHandleList'] } + // }, { - path: '/listJob', - name: 'ListJob', - component: () => import('@/views/jobManage/listJobs'), - meta: { title: '告警工单', icon: 'icon-config', keepAlive: true, permission: ['/job/list'] } - }, - { - path: '/listOvertimeGetJob', - name: 'ListJobOvertimeGet', - component: () => import('@/views/jobManage/listJobsOvertimeGet'), - meta: { title: '超时未接收工单', icon: 'icon-config', keepAlive: true, permission: ['/job/overtimeGetList'] } - }, - { - path: '/listOvertimeHandleJob', - name: 'ListJobOvertimeHandle', - component: () => import('@/views/jobManage/listJobsOvertimeHandle'), - meta: { title: '超时未处理工单', icon: 'icon-config', keepAlive: true, permission: ['/job/overtimeHandleList'] } - }, - { - path: '/detailJob/:id(\\d+)', + path: '/detailJob/:id', name: 'DetailJob', component: () => import('@/views/jobManage/detailJob'), hidden: true, @@ -232,25 +233,25 @@ path: '/dataManage', name: 'DataManage', component: () => import('@/views/dataManage/dataManage'), - meta: { title: '历史数据', icon: 'icon-config' } //, permission: ['/datalist'] + meta: { title: '历史数据', icon: 'icon-config', permission: ['/datalist'] } }, { path: '/dataAnalyse', name: 'DataAnalyse', component: () => import('@/views/dataStatics/dataStatics'), - meta: { title: '数据分析', icon: 'icon-config' } // , permission: ['/dataAnalyse'] + meta: { title: '数据分析', icon: 'icon-config' , permission: ['/dataAnalyse'] } }, { path: '/deviceStatics', name: 'DeviceStatics', component: () => import('@/views/deviceStatics/deviceStatics'), - meta: { title: '设备统计', icon: 'icon-config' } // , permission: ['/deviceStatics'] + meta: { title: '设备统计', icon: 'icon-config' , permission: ['/deviceStatics'] } }, { path: '/alarmStatics', name: 'AlarmStatics', component: () => import('@/views/alarmStatics/alarmStatics'), - meta: { title: '报警统计', icon: 'icon-config' } //, permission: ['/alarm/statics'] + meta: { title: '报警统计', icon: 'icon-config', permission: ['/alarm/statics'] } } ] }, diff --git a/config/index.js b/config/index.js index 0d96846..52762df 100644 --- a/config/index.js +++ b/config/index.js @@ -56,10 +56,10 @@ build: { // Template for index.html - index: path.resolve(__dirname, '../smartwell/index.html'), + index: path.resolve(__dirname, '../dist/index.html'), // Paths - assetsRoot: path.resolve(__dirname, '../smartwell'), + assetsRoot: path.resolve(__dirname, '../dist'), assetsSubDirectory: 'static', /** diff --git a/favicon.ico b/favicon.ico index 34b63ac..586e43b 100644 --- a/favicon.ico +++ b/favicon.ico Binary files differ diff --git a/package.json b/package.json index db879d6..4b9d52d 100644 --- a/package.json +++ b/package.json @@ -15,18 +15,26 @@ "svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml" }, "dependencies": { - "animate.css": "^3.7.2", - "axios": "0.18.0", + "animate.css": "^4.1.1", + "axios": "^0.19.0", "babel-polyfill": "^6.26.0", "cesium": "^1.81.0", - "echarts": "^4.2.1", - "element-ui": "2.13.0", + "echarts": "^4.3.0", + "element-ui": "^2.14.1", + "esri": "0.0.1-security", + "esri-leaflet": "^3.0.1", + "esri-leaflet-renderers": "^2.1.2", + "esri-loader": "^3.0.0", "event-source-polyfill": "^1.0.5", + "jquery": "1.11.3", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", "leaflet-draw": "^1.0.4", - "mars3d": "^3.0.26", + "leaflet-rotatedmarker": "^0.2.0", + "leaflet.markercluster": "^1.5.3", + "mars3d": "^3.0.30", + "mars3d-cesium": "1.83.0", "mockjs": "1.0.1-beta3", "normalize.css": "7.0.0", "nprogress": "0.2.0", @@ -35,12 +43,12 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vuex": "^3.1.1" }, "devDependencies": { "autoprefixer": "8.5.0", "babel-core": "6.26.0", - "babel-eslint": "8.2.6", + "babel-eslint": "7.2.3", "babel-helper-vue-jsx-merge-props": "2.0.3", "babel-loader": "7.1.5", "babel-plugin-syntax-jsx": "6.18.0", diff --git a/src/api/common.js b/src/api/common.js index 4c38684..4d989f8 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -5,7 +5,7 @@ // 模板下载 export function downloadTemplate(fileName) { return request({ - url: 'template/download', + url: '/smartwell/template/download', method: 'get', params: { filename: fileName diff --git a/src/assets/map/marker-icon-2x.png b/src/assets/map/marker-icon-2x.png new file mode 100644 index 0000000..88f9e50 --- /dev/null +++ b/src/assets/map/marker-icon-2x.png Binary files differ diff --git a/src/assets/map/marker.png b/src/assets/map/marker.png new file mode 100644 index 0000000..fea9fe9 --- /dev/null +++ b/src/assets/map/marker.png Binary files differ diff --git a/src/assets/map/markerAlarm.png b/src/assets/map/markerAlarm.png new file mode 100644 index 0000000..9b3ecb8 --- /dev/null +++ b/src/assets/map/markerAlarm.png Binary files differ diff --git a/src/components/mapWindow/base/mixins/abstract.js b/src/components/mapWindow/base/mixins/abstract.js new file mode 100644 index 0000000..9cf6d52 --- /dev/null +++ b/src/components/mapWindow/base/mixins/abstract.js @@ -0,0 +1,13 @@ +class Mixin { + constructor({ component, props, events, extraProps, exceptProps }) { + this.render = function(h) { + return h(component, { + props: props.reduce((obj, key) => Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..4ec7b61 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,270 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/icons/svg/icon-order.svg b/src/icons/svg/icon-order.svg new file mode 100644 index 0000000..62d7666 --- /dev/null +++ b/src/icons/svg/icon-order.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/icon-overview.svg b/src/icons/svg/icon-overview.svg index a2f9449..9dc3936 100644 --- a/src/icons/svg/icon-overview.svg +++ b/src/icons/svg/icon-overview.svg @@ -1 +1 @@ - \ No newline at end of file + diff --git a/src/layout/components/AppHeader.vue b/src/layout/components/AppHeader.vue index 8d8912e..375c71c 100644 --- a/src/layout/components/AppHeader.vue +++ b/src/layout/components/AppHeader.vue @@ -2,7 +2,7 @@

{{ title }}

- + {{ currentSystem.name }} diff --git a/src/main.js b/src/main.js index 9f6c3ec..852dfe5 100644 --- a/src/main.js +++ b/src/main.js @@ -42,10 +42,10 @@ import 'leaflet-draw/dist/leaflet.draw.css' // 在main.js中加入下面代码 -import 'mars3d/dist/mars3d.css' +// import 'mars3d/dist/mars3d.css' // import 'mars3d-esri/dist/mars3d-esri.js' -import * as mars3d from 'mars3d' -Vue.prototype.mars3d = mars3d +// import * as mars3d from 'mars3d' +// Vue.prototype.mars3d = mars3d /** * This project originally used easy-mock to simulate data, diff --git a/src/router/index.js b/src/router/index.js index 254f077..063e508 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -8,6 +8,7 @@ /* Layout */ import Layout from '../views/layout/Layout' +import { systemRouters } from './modules/system' /** * hidden: true if `hidden:true` will not show in the sidebar(default is false) @@ -86,9 +87,9 @@ children: [ { path: '/overview', - component: () => import('@/views/overview/overview'), + component: () => import('@/views/overview/overviewSmartwell'), // component: () => import('@/views/overview/oo'), - name: 'overview', + name: 'OverviewSmartWell', meta: { title: '运行状态总览', icon: 'icon-config', permission: ['/overview/wellList'] } } ] @@ -117,26 +118,26 @@ component: () => import('@/views/alarmManage/listAlarmRecords'), meta: { title: '告警记录', icon: 'icon-config', keepAlive: true, permission: ['/alarm/list'] } }, + // { + // path: '/listJob', + // name: 'ListJob', + // component: () => import('@/views/jobManage/listJobs'), + // meta: { title: '告警工单', icon: 'icon-config', keepAlive: true, permission: ['/job/list'] } + // }, + // { + // path: '/listOvertimeGetJob', + // name: 'ListJobOvertimeGet', + // component: () => import('@/views/jobManage/listJobsOvertimeGet'), + // meta: { title: '超时未接收工单', icon: 'icon-config', keepAlive: true, permission: ['/job/overtimeGetList'] } + // }, + // { + // path: '/listOvertimeHandleJob', + // name: 'ListJobOvertimeHandle', + // component: () => import('@/views/jobManage/listJobsOvertimeHandle'), + // meta: { title: '超时未处理工单', icon: 'icon-config', keepAlive: true, permission: ['/job/overtimeHandleList'] } + // }, { - path: '/listJob', - name: 'ListJob', - component: () => import('@/views/jobManage/listJobs'), - meta: { title: '告警工单', icon: 'icon-config', keepAlive: true, permission: ['/job/list'] } - }, - { - path: '/listOvertimeGetJob', - name: 'ListJobOvertimeGet', - component: () => import('@/views/jobManage/listJobsOvertimeGet'), - meta: { title: '超时未接收工单', icon: 'icon-config', keepAlive: true, permission: ['/job/overtimeGetList'] } - }, - { - path: '/listOvertimeHandleJob', - name: 'ListJobOvertimeHandle', - component: () => import('@/views/jobManage/listJobsOvertimeHandle'), - meta: { title: '超时未处理工单', icon: 'icon-config', keepAlive: true, permission: ['/job/overtimeHandleList'] } - }, - { - path: '/detailJob/:id(\\d+)', + path: '/detailJob/:id', name: 'DetailJob', component: () => import('@/views/jobManage/detailJob'), hidden: true, @@ -232,25 +233,25 @@ path: '/dataManage', name: 'DataManage', component: () => import('@/views/dataManage/dataManage'), - meta: { title: '历史数据', icon: 'icon-config' } //, permission: ['/datalist'] + meta: { title: '历史数据', icon: 'icon-config', permission: ['/datalist'] } }, { path: '/dataAnalyse', name: 'DataAnalyse', component: () => import('@/views/dataStatics/dataStatics'), - meta: { title: '数据分析', icon: 'icon-config' } // , permission: ['/dataAnalyse'] + meta: { title: '数据分析', icon: 'icon-config' , permission: ['/dataAnalyse'] } }, { path: '/deviceStatics', name: 'DeviceStatics', component: () => import('@/views/deviceStatics/deviceStatics'), - meta: { title: '设备统计', icon: 'icon-config' } // , permission: ['/deviceStatics'] + meta: { title: '设备统计', icon: 'icon-config' , permission: ['/deviceStatics'] } }, { path: '/alarmStatics', name: 'AlarmStatics', component: () => import('@/views/alarmStatics/alarmStatics'), - meta: { title: '报警统计', icon: 'icon-config' } //, permission: ['/alarm/statics'] + meta: { title: '报警统计', icon: 'icon-config', permission: ['/alarm/statics'] } } ] }, diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index 587fa28..d424962 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -120,17 +120,23 @@ }) }, // 获取用户权限 - GetMenus({ commit, state }) { - console.log('in store.permission.js:GetMenus:') + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + const params = { + parentCode: currentSystem.code // 传入该子系统的code,获取子系统的权限 + } return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + // 此处获取用户所有权限 + getMenus(params).then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -142,11 +148,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + // accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/config/index.js b/config/index.js index 0d96846..52762df 100644 --- a/config/index.js +++ b/config/index.js @@ -56,10 +56,10 @@ build: { // Template for index.html - index: path.resolve(__dirname, '../smartwell/index.html'), + index: path.resolve(__dirname, '../dist/index.html'), // Paths - assetsRoot: path.resolve(__dirname, '../smartwell'), + assetsRoot: path.resolve(__dirname, '../dist'), assetsSubDirectory: 'static', /** diff --git a/favicon.ico b/favicon.ico index 34b63ac..586e43b 100644 --- a/favicon.ico +++ b/favicon.ico Binary files differ diff --git a/package.json b/package.json index db879d6..4b9d52d 100644 --- a/package.json +++ b/package.json @@ -15,18 +15,26 @@ "svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml" }, "dependencies": { - "animate.css": "^3.7.2", - "axios": "0.18.0", + "animate.css": "^4.1.1", + "axios": "^0.19.0", "babel-polyfill": "^6.26.0", "cesium": "^1.81.0", - "echarts": "^4.2.1", - "element-ui": "2.13.0", + "echarts": "^4.3.0", + "element-ui": "^2.14.1", + "esri": "0.0.1-security", + "esri-leaflet": "^3.0.1", + "esri-leaflet-renderers": "^2.1.2", + "esri-loader": "^3.0.0", "event-source-polyfill": "^1.0.5", + "jquery": "1.11.3", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", "leaflet-draw": "^1.0.4", - "mars3d": "^3.0.26", + "leaflet-rotatedmarker": "^0.2.0", + "leaflet.markercluster": "^1.5.3", + "mars3d": "^3.0.30", + "mars3d-cesium": "1.83.0", "mockjs": "1.0.1-beta3", "normalize.css": "7.0.0", "nprogress": "0.2.0", @@ -35,12 +43,12 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vuex": "^3.1.1" }, "devDependencies": { "autoprefixer": "8.5.0", "babel-core": "6.26.0", - "babel-eslint": "8.2.6", + "babel-eslint": "7.2.3", "babel-helper-vue-jsx-merge-props": "2.0.3", "babel-loader": "7.1.5", "babel-plugin-syntax-jsx": "6.18.0", diff --git a/src/api/common.js b/src/api/common.js index 4c38684..4d989f8 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -5,7 +5,7 @@ // 模板下载 export function downloadTemplate(fileName) { return request({ - url: 'template/download', + url: '/smartwell/template/download', method: 'get', params: { filename: fileName diff --git a/src/assets/map/marker-icon-2x.png b/src/assets/map/marker-icon-2x.png new file mode 100644 index 0000000..88f9e50 --- /dev/null +++ b/src/assets/map/marker-icon-2x.png Binary files differ diff --git a/src/assets/map/marker.png b/src/assets/map/marker.png new file mode 100644 index 0000000..fea9fe9 --- /dev/null +++ b/src/assets/map/marker.png Binary files differ diff --git a/src/assets/map/markerAlarm.png b/src/assets/map/markerAlarm.png new file mode 100644 index 0000000..9b3ecb8 --- /dev/null +++ b/src/assets/map/markerAlarm.png Binary files differ diff --git a/src/components/mapWindow/base/mixins/abstract.js b/src/components/mapWindow/base/mixins/abstract.js new file mode 100644 index 0000000..9cf6d52 --- /dev/null +++ b/src/components/mapWindow/base/mixins/abstract.js @@ -0,0 +1,13 @@ +class Mixin { + constructor({ component, props, events, extraProps, exceptProps }) { + this.render = function(h) { + return h(component, { + props: props.reduce((obj, key) => Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..4ec7b61 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,270 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/icons/svg/icon-order.svg b/src/icons/svg/icon-order.svg new file mode 100644 index 0000000..62d7666 --- /dev/null +++ b/src/icons/svg/icon-order.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/icon-overview.svg b/src/icons/svg/icon-overview.svg index a2f9449..9dc3936 100644 --- a/src/icons/svg/icon-overview.svg +++ b/src/icons/svg/icon-overview.svg @@ -1 +1 @@ - \ No newline at end of file + diff --git a/src/layout/components/AppHeader.vue b/src/layout/components/AppHeader.vue index 8d8912e..375c71c 100644 --- a/src/layout/components/AppHeader.vue +++ b/src/layout/components/AppHeader.vue @@ -2,7 +2,7 @@

{{ title }}

- + {{ currentSystem.name }} diff --git a/src/main.js b/src/main.js index 9f6c3ec..852dfe5 100644 --- a/src/main.js +++ b/src/main.js @@ -42,10 +42,10 @@ import 'leaflet-draw/dist/leaflet.draw.css' // 在main.js中加入下面代码 -import 'mars3d/dist/mars3d.css' +// import 'mars3d/dist/mars3d.css' // import 'mars3d-esri/dist/mars3d-esri.js' -import * as mars3d from 'mars3d' -Vue.prototype.mars3d = mars3d +// import * as mars3d from 'mars3d' +// Vue.prototype.mars3d = mars3d /** * This project originally used easy-mock to simulate data, diff --git a/src/router/index.js b/src/router/index.js index 254f077..063e508 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -8,6 +8,7 @@ /* Layout */ import Layout from '../views/layout/Layout' +import { systemRouters } from './modules/system' /** * hidden: true if `hidden:true` will not show in the sidebar(default is false) @@ -86,9 +87,9 @@ children: [ { path: '/overview', - component: () => import('@/views/overview/overview'), + component: () => import('@/views/overview/overviewSmartwell'), // component: () => import('@/views/overview/oo'), - name: 'overview', + name: 'OverviewSmartWell', meta: { title: '运行状态总览', icon: 'icon-config', permission: ['/overview/wellList'] } } ] @@ -117,26 +118,26 @@ component: () => import('@/views/alarmManage/listAlarmRecords'), meta: { title: '告警记录', icon: 'icon-config', keepAlive: true, permission: ['/alarm/list'] } }, + // { + // path: '/listJob', + // name: 'ListJob', + // component: () => import('@/views/jobManage/listJobs'), + // meta: { title: '告警工单', icon: 'icon-config', keepAlive: true, permission: ['/job/list'] } + // }, + // { + // path: '/listOvertimeGetJob', + // name: 'ListJobOvertimeGet', + // component: () => import('@/views/jobManage/listJobsOvertimeGet'), + // meta: { title: '超时未接收工单', icon: 'icon-config', keepAlive: true, permission: ['/job/overtimeGetList'] } + // }, + // { + // path: '/listOvertimeHandleJob', + // name: 'ListJobOvertimeHandle', + // component: () => import('@/views/jobManage/listJobsOvertimeHandle'), + // meta: { title: '超时未处理工单', icon: 'icon-config', keepAlive: true, permission: ['/job/overtimeHandleList'] } + // }, { - path: '/listJob', - name: 'ListJob', - component: () => import('@/views/jobManage/listJobs'), - meta: { title: '告警工单', icon: 'icon-config', keepAlive: true, permission: ['/job/list'] } - }, - { - path: '/listOvertimeGetJob', - name: 'ListJobOvertimeGet', - component: () => import('@/views/jobManage/listJobsOvertimeGet'), - meta: { title: '超时未接收工单', icon: 'icon-config', keepAlive: true, permission: ['/job/overtimeGetList'] } - }, - { - path: '/listOvertimeHandleJob', - name: 'ListJobOvertimeHandle', - component: () => import('@/views/jobManage/listJobsOvertimeHandle'), - meta: { title: '超时未处理工单', icon: 'icon-config', keepAlive: true, permission: ['/job/overtimeHandleList'] } - }, - { - path: '/detailJob/:id(\\d+)', + path: '/detailJob/:id', name: 'DetailJob', component: () => import('@/views/jobManage/detailJob'), hidden: true, @@ -232,25 +233,25 @@ path: '/dataManage', name: 'DataManage', component: () => import('@/views/dataManage/dataManage'), - meta: { title: '历史数据', icon: 'icon-config' } //, permission: ['/datalist'] + meta: { title: '历史数据', icon: 'icon-config', permission: ['/datalist'] } }, { path: '/dataAnalyse', name: 'DataAnalyse', component: () => import('@/views/dataStatics/dataStatics'), - meta: { title: '数据分析', icon: 'icon-config' } // , permission: ['/dataAnalyse'] + meta: { title: '数据分析', icon: 'icon-config' , permission: ['/dataAnalyse'] } }, { path: '/deviceStatics', name: 'DeviceStatics', component: () => import('@/views/deviceStatics/deviceStatics'), - meta: { title: '设备统计', icon: 'icon-config' } // , permission: ['/deviceStatics'] + meta: { title: '设备统计', icon: 'icon-config' , permission: ['/deviceStatics'] } }, { path: '/alarmStatics', name: 'AlarmStatics', component: () => import('@/views/alarmStatics/alarmStatics'), - meta: { title: '报警统计', icon: 'icon-config' } //, permission: ['/alarm/statics'] + meta: { title: '报警统计', icon: 'icon-config', permission: ['/alarm/statics'] } } ] }, diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index 587fa28..d424962 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -120,17 +120,23 @@ }) }, // 获取用户权限 - GetMenus({ commit, state }) { - console.log('in store.permission.js:GetMenus:') + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + const params = { + parentCode: currentSystem.code // 传入该子系统的code,获取子系统的权限 + } return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + // 此处获取用户所有权限 + getMenus(params).then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -142,11 +148,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + // accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/utils/formatDate.js b/src/utils/formatDate.js new file mode 100644 index 0000000..3846f28 --- /dev/null +++ b/src/utils/formatDate.js @@ -0,0 +1,63 @@ +export function formatDateYMD (time) { + let date = new Date(time * 1000) + let m = (date.getMonth() + 1) < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1 + let d = date.getDate() < 10 ? '0' + date.getDate() : date.getDate() + return date.getFullYear() + '-' + m + '-' + d +} +// new Date() 格式化为 ’2018-10-11‘ +export function dateToString (date, format) { + if (!date) return '' + format = format || 'y-m-d' + switch (format) { + case 'y-m': + return date.getFullYear() + '-' + datePad(date.getMonth() + 1, 2) + case 'y-m-d': + return date.getFullYear() + '-' + datePad(date.getMonth() + 1, 2) + '-' + datePad(date.getDate(), 2) + case 'h-m-s': + return datePad(date.getHours(), 2) + ':' + datePad(date.getMinutes(), 2) + ':' + datePad(date.getSeconds(), 2) + case 'y-m-d-h-m-s': + return date.getFullYear() + '-' + datePad(date.getMonth() + 1, 2) + '-' + datePad(date.getDate(), 2) + ' ' + datePad(date.getHours(), 2) + ':' + datePad(date.getMinutes(), 2) + ':' + datePad(date.getSeconds(), 2) + } +} +function datePad (num, n) { + if ((num + '').length >= n) { return num } // 一位数 + return '0' + num // 两位数 +} + +export function getYesterDay () { // 默认显示昨天 + const ctmonth = new Date() + ctmonth.setTime(ctmonth.getTime() - 3600 * 1000 * 24) + return ctmonth +} + +export function getToday () { + var date = new Date() + var year = date.getFullYear() + var month = date.getMonth() + 1 + var day = date.getDate() + if (month < 10) { + month = '0' + month + } + if (day < 10) { + day = '0' + day + } + var nowDate = year + '-' + month + '-' + day + return nowDate +} + +export function getLastWeek () { // 默认显示上周 + const ctmonth = new Date() + ctmonth.setTime(ctmonth.getTime() - 3600 * 1000 * 24 * 7) + return ctmonth +} +export function getLastMonth () { // 默认显示上个月 + const ctmonth = new Date() + ctmonth.setTime(ctmonth.getTime() - 3600 * 1000 * 24 * 30) + return ctmonth +} + +export function getYear () { + const year = new Date().getFullYear() + return year + // return 2020 +} diff --git a/config/index.js b/config/index.js index 0d96846..52762df 100644 --- a/config/index.js +++ b/config/index.js @@ -56,10 +56,10 @@ build: { // Template for index.html - index: path.resolve(__dirname, '../smartwell/index.html'), + index: path.resolve(__dirname, '../dist/index.html'), // Paths - assetsRoot: path.resolve(__dirname, '../smartwell'), + assetsRoot: path.resolve(__dirname, '../dist'), assetsSubDirectory: 'static', /** diff --git a/favicon.ico b/favicon.ico index 34b63ac..586e43b 100644 --- a/favicon.ico +++ b/favicon.ico Binary files differ diff --git a/package.json b/package.json index db879d6..4b9d52d 100644 --- a/package.json +++ b/package.json @@ -15,18 +15,26 @@ "svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml" }, "dependencies": { - "animate.css": "^3.7.2", - "axios": "0.18.0", + "animate.css": "^4.1.1", + "axios": "^0.19.0", "babel-polyfill": "^6.26.0", "cesium": "^1.81.0", - "echarts": "^4.2.1", - "element-ui": "2.13.0", + "echarts": "^4.3.0", + "element-ui": "^2.14.1", + "esri": "0.0.1-security", + "esri-leaflet": "^3.0.1", + "esri-leaflet-renderers": "^2.1.2", + "esri-loader": "^3.0.0", "event-source-polyfill": "^1.0.5", + "jquery": "1.11.3", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", "leaflet-draw": "^1.0.4", - "mars3d": "^3.0.26", + "leaflet-rotatedmarker": "^0.2.0", + "leaflet.markercluster": "^1.5.3", + "mars3d": "^3.0.30", + "mars3d-cesium": "1.83.0", "mockjs": "1.0.1-beta3", "normalize.css": "7.0.0", "nprogress": "0.2.0", @@ -35,12 +43,12 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vuex": "^3.1.1" }, "devDependencies": { "autoprefixer": "8.5.0", "babel-core": "6.26.0", - "babel-eslint": "8.2.6", + "babel-eslint": "7.2.3", "babel-helper-vue-jsx-merge-props": "2.0.3", "babel-loader": "7.1.5", "babel-plugin-syntax-jsx": "6.18.0", diff --git a/src/api/common.js b/src/api/common.js index 4c38684..4d989f8 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -5,7 +5,7 @@ // 模板下载 export function downloadTemplate(fileName) { return request({ - url: 'template/download', + url: '/smartwell/template/download', method: 'get', params: { filename: fileName diff --git a/src/assets/map/marker-icon-2x.png b/src/assets/map/marker-icon-2x.png new file mode 100644 index 0000000..88f9e50 --- /dev/null +++ b/src/assets/map/marker-icon-2x.png Binary files differ diff --git a/src/assets/map/marker.png b/src/assets/map/marker.png new file mode 100644 index 0000000..fea9fe9 --- /dev/null +++ b/src/assets/map/marker.png Binary files differ diff --git a/src/assets/map/markerAlarm.png b/src/assets/map/markerAlarm.png new file mode 100644 index 0000000..9b3ecb8 --- /dev/null +++ b/src/assets/map/markerAlarm.png Binary files differ diff --git a/src/components/mapWindow/base/mixins/abstract.js b/src/components/mapWindow/base/mixins/abstract.js new file mode 100644 index 0000000..9cf6d52 --- /dev/null +++ b/src/components/mapWindow/base/mixins/abstract.js @@ -0,0 +1,13 @@ +class Mixin { + constructor({ component, props, events, extraProps, exceptProps }) { + this.render = function(h) { + return h(component, { + props: props.reduce((obj, key) => Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..4ec7b61 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,270 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/icons/svg/icon-order.svg b/src/icons/svg/icon-order.svg new file mode 100644 index 0000000..62d7666 --- /dev/null +++ b/src/icons/svg/icon-order.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/icon-overview.svg b/src/icons/svg/icon-overview.svg index a2f9449..9dc3936 100644 --- a/src/icons/svg/icon-overview.svg +++ b/src/icons/svg/icon-overview.svg @@ -1 +1 @@ - \ No newline at end of file + diff --git a/src/layout/components/AppHeader.vue b/src/layout/components/AppHeader.vue index 8d8912e..375c71c 100644 --- a/src/layout/components/AppHeader.vue +++ b/src/layout/components/AppHeader.vue @@ -2,7 +2,7 @@

{{ title }}

- + {{ currentSystem.name }} diff --git a/src/main.js b/src/main.js index 9f6c3ec..852dfe5 100644 --- a/src/main.js +++ b/src/main.js @@ -42,10 +42,10 @@ import 'leaflet-draw/dist/leaflet.draw.css' // 在main.js中加入下面代码 -import 'mars3d/dist/mars3d.css' +// import 'mars3d/dist/mars3d.css' // import 'mars3d-esri/dist/mars3d-esri.js' -import * as mars3d from 'mars3d' -Vue.prototype.mars3d = mars3d +// import * as mars3d from 'mars3d' +// Vue.prototype.mars3d = mars3d /** * This project originally used easy-mock to simulate data, diff --git a/src/router/index.js b/src/router/index.js index 254f077..063e508 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -8,6 +8,7 @@ /* Layout */ import Layout from '../views/layout/Layout' +import { systemRouters } from './modules/system' /** * hidden: true if `hidden:true` will not show in the sidebar(default is false) @@ -86,9 +87,9 @@ children: [ { path: '/overview', - component: () => import('@/views/overview/overview'), + component: () => import('@/views/overview/overviewSmartwell'), // component: () => import('@/views/overview/oo'), - name: 'overview', + name: 'OverviewSmartWell', meta: { title: '运行状态总览', icon: 'icon-config', permission: ['/overview/wellList'] } } ] @@ -117,26 +118,26 @@ component: () => import('@/views/alarmManage/listAlarmRecords'), meta: { title: '告警记录', icon: 'icon-config', keepAlive: true, permission: ['/alarm/list'] } }, + // { + // path: '/listJob', + // name: 'ListJob', + // component: () => import('@/views/jobManage/listJobs'), + // meta: { title: '告警工单', icon: 'icon-config', keepAlive: true, permission: ['/job/list'] } + // }, + // { + // path: '/listOvertimeGetJob', + // name: 'ListJobOvertimeGet', + // component: () => import('@/views/jobManage/listJobsOvertimeGet'), + // meta: { title: '超时未接收工单', icon: 'icon-config', keepAlive: true, permission: ['/job/overtimeGetList'] } + // }, + // { + // path: '/listOvertimeHandleJob', + // name: 'ListJobOvertimeHandle', + // component: () => import('@/views/jobManage/listJobsOvertimeHandle'), + // meta: { title: '超时未处理工单', icon: 'icon-config', keepAlive: true, permission: ['/job/overtimeHandleList'] } + // }, { - path: '/listJob', - name: 'ListJob', - component: () => import('@/views/jobManage/listJobs'), - meta: { title: '告警工单', icon: 'icon-config', keepAlive: true, permission: ['/job/list'] } - }, - { - path: '/listOvertimeGetJob', - name: 'ListJobOvertimeGet', - component: () => import('@/views/jobManage/listJobsOvertimeGet'), - meta: { title: '超时未接收工单', icon: 'icon-config', keepAlive: true, permission: ['/job/overtimeGetList'] } - }, - { - path: '/listOvertimeHandleJob', - name: 'ListJobOvertimeHandle', - component: () => import('@/views/jobManage/listJobsOvertimeHandle'), - meta: { title: '超时未处理工单', icon: 'icon-config', keepAlive: true, permission: ['/job/overtimeHandleList'] } - }, - { - path: '/detailJob/:id(\\d+)', + path: '/detailJob/:id', name: 'DetailJob', component: () => import('@/views/jobManage/detailJob'), hidden: true, @@ -232,25 +233,25 @@ path: '/dataManage', name: 'DataManage', component: () => import('@/views/dataManage/dataManage'), - meta: { title: '历史数据', icon: 'icon-config' } //, permission: ['/datalist'] + meta: { title: '历史数据', icon: 'icon-config', permission: ['/datalist'] } }, { path: '/dataAnalyse', name: 'DataAnalyse', component: () => import('@/views/dataStatics/dataStatics'), - meta: { title: '数据分析', icon: 'icon-config' } // , permission: ['/dataAnalyse'] + meta: { title: '数据分析', icon: 'icon-config' , permission: ['/dataAnalyse'] } }, { path: '/deviceStatics', name: 'DeviceStatics', component: () => import('@/views/deviceStatics/deviceStatics'), - meta: { title: '设备统计', icon: 'icon-config' } // , permission: ['/deviceStatics'] + meta: { title: '设备统计', icon: 'icon-config' , permission: ['/deviceStatics'] } }, { path: '/alarmStatics', name: 'AlarmStatics', component: () => import('@/views/alarmStatics/alarmStatics'), - meta: { title: '报警统计', icon: 'icon-config' } //, permission: ['/alarm/statics'] + meta: { title: '报警统计', icon: 'icon-config', permission: ['/alarm/statics'] } } ] }, diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index 587fa28..d424962 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -120,17 +120,23 @@ }) }, // 获取用户权限 - GetMenus({ commit, state }) { - console.log('in store.permission.js:GetMenus:') + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + const params = { + parentCode: currentSystem.code // 传入该子系统的code,获取子系统的权限 + } return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + // 此处获取用户所有权限 + getMenus(params).then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -142,11 +148,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + // accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/utils/formatDate.js b/src/utils/formatDate.js new file mode 100644 index 0000000..3846f28 --- /dev/null +++ b/src/utils/formatDate.js @@ -0,0 +1,63 @@ +export function formatDateYMD (time) { + let date = new Date(time * 1000) + let m = (date.getMonth() + 1) < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1 + let d = date.getDate() < 10 ? '0' + date.getDate() : date.getDate() + return date.getFullYear() + '-' + m + '-' + d +} +// new Date() 格式化为 ’2018-10-11‘ +export function dateToString (date, format) { + if (!date) return '' + format = format || 'y-m-d' + switch (format) { + case 'y-m': + return date.getFullYear() + '-' + datePad(date.getMonth() + 1, 2) + case 'y-m-d': + return date.getFullYear() + '-' + datePad(date.getMonth() + 1, 2) + '-' + datePad(date.getDate(), 2) + case 'h-m-s': + return datePad(date.getHours(), 2) + ':' + datePad(date.getMinutes(), 2) + ':' + datePad(date.getSeconds(), 2) + case 'y-m-d-h-m-s': + return date.getFullYear() + '-' + datePad(date.getMonth() + 1, 2) + '-' + datePad(date.getDate(), 2) + ' ' + datePad(date.getHours(), 2) + ':' + datePad(date.getMinutes(), 2) + ':' + datePad(date.getSeconds(), 2) + } +} +function datePad (num, n) { + if ((num + '').length >= n) { return num } // 一位数 + return '0' + num // 两位数 +} + +export function getYesterDay () { // 默认显示昨天 + const ctmonth = new Date() + ctmonth.setTime(ctmonth.getTime() - 3600 * 1000 * 24) + return ctmonth +} + +export function getToday () { + var date = new Date() + var year = date.getFullYear() + var month = date.getMonth() + 1 + var day = date.getDate() + if (month < 10) { + month = '0' + month + } + if (day < 10) { + day = '0' + day + } + var nowDate = year + '-' + month + '-' + day + return nowDate +} + +export function getLastWeek () { // 默认显示上周 + const ctmonth = new Date() + ctmonth.setTime(ctmonth.getTime() - 3600 * 1000 * 24 * 7) + return ctmonth +} +export function getLastMonth () { // 默认显示上个月 + const ctmonth = new Date() + ctmonth.setTime(ctmonth.getTime() - 3600 * 1000 * 24 * 30) + return ctmonth +} + +export function getYear () { + const year = new Date().getFullYear() + return year + // return 2020 +} diff --git a/src/utils/request.js b/src/utils/request.js index eb45e3f..24de475 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -44,7 +44,6 @@ location.reload() // 为了重新实例化vue-router对象 避免bug }) } else { - debugger console.log(res) Message({ showClose: true, diff --git a/config/index.js b/config/index.js index 0d96846..52762df 100644 --- a/config/index.js +++ b/config/index.js @@ -56,10 +56,10 @@ build: { // Template for index.html - index: path.resolve(__dirname, '../smartwell/index.html'), + index: path.resolve(__dirname, '../dist/index.html'), // Paths - assetsRoot: path.resolve(__dirname, '../smartwell'), + assetsRoot: path.resolve(__dirname, '../dist'), assetsSubDirectory: 'static', /** diff --git a/favicon.ico b/favicon.ico index 34b63ac..586e43b 100644 --- a/favicon.ico +++ b/favicon.ico Binary files differ diff --git a/package.json b/package.json index db879d6..4b9d52d 100644 --- a/package.json +++ b/package.json @@ -15,18 +15,26 @@ "svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml" }, "dependencies": { - "animate.css": "^3.7.2", - "axios": "0.18.0", + "animate.css": "^4.1.1", + "axios": "^0.19.0", "babel-polyfill": "^6.26.0", "cesium": "^1.81.0", - "echarts": "^4.2.1", - "element-ui": "2.13.0", + "echarts": "^4.3.0", + "element-ui": "^2.14.1", + "esri": "0.0.1-security", + "esri-leaflet": "^3.0.1", + "esri-leaflet-renderers": "^2.1.2", + "esri-loader": "^3.0.0", "event-source-polyfill": "^1.0.5", + "jquery": "1.11.3", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", "leaflet-draw": "^1.0.4", - "mars3d": "^3.0.26", + "leaflet-rotatedmarker": "^0.2.0", + "leaflet.markercluster": "^1.5.3", + "mars3d": "^3.0.30", + "mars3d-cesium": "1.83.0", "mockjs": "1.0.1-beta3", "normalize.css": "7.0.0", "nprogress": "0.2.0", @@ -35,12 +43,12 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vuex": "^3.1.1" }, "devDependencies": { "autoprefixer": "8.5.0", "babel-core": "6.26.0", - "babel-eslint": "8.2.6", + "babel-eslint": "7.2.3", "babel-helper-vue-jsx-merge-props": "2.0.3", "babel-loader": "7.1.5", "babel-plugin-syntax-jsx": "6.18.0", diff --git a/src/api/common.js b/src/api/common.js index 4c38684..4d989f8 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -5,7 +5,7 @@ // 模板下载 export function downloadTemplate(fileName) { return request({ - url: 'template/download', + url: '/smartwell/template/download', method: 'get', params: { filename: fileName diff --git a/src/assets/map/marker-icon-2x.png b/src/assets/map/marker-icon-2x.png new file mode 100644 index 0000000..88f9e50 --- /dev/null +++ b/src/assets/map/marker-icon-2x.png Binary files differ diff --git a/src/assets/map/marker.png b/src/assets/map/marker.png new file mode 100644 index 0000000..fea9fe9 --- /dev/null +++ b/src/assets/map/marker.png Binary files differ diff --git a/src/assets/map/markerAlarm.png b/src/assets/map/markerAlarm.png new file mode 100644 index 0000000..9b3ecb8 --- /dev/null +++ b/src/assets/map/markerAlarm.png Binary files differ diff --git a/src/components/mapWindow/base/mixins/abstract.js b/src/components/mapWindow/base/mixins/abstract.js new file mode 100644 index 0000000..9cf6d52 --- /dev/null +++ b/src/components/mapWindow/base/mixins/abstract.js @@ -0,0 +1,13 @@ +class Mixin { + constructor({ component, props, events, extraProps, exceptProps }) { + this.render = function(h) { + return h(component, { + props: props.reduce((obj, key) => Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..4ec7b61 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,270 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/icons/svg/icon-order.svg b/src/icons/svg/icon-order.svg new file mode 100644 index 0000000..62d7666 --- /dev/null +++ b/src/icons/svg/icon-order.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/icon-overview.svg b/src/icons/svg/icon-overview.svg index a2f9449..9dc3936 100644 --- a/src/icons/svg/icon-overview.svg +++ b/src/icons/svg/icon-overview.svg @@ -1 +1 @@ - \ No newline at end of file + diff --git a/src/layout/components/AppHeader.vue b/src/layout/components/AppHeader.vue index 8d8912e..375c71c 100644 --- a/src/layout/components/AppHeader.vue +++ b/src/layout/components/AppHeader.vue @@ -2,7 +2,7 @@

{{ title }}

- + {{ currentSystem.name }} diff --git a/src/main.js b/src/main.js index 9f6c3ec..852dfe5 100644 --- a/src/main.js +++ b/src/main.js @@ -42,10 +42,10 @@ import 'leaflet-draw/dist/leaflet.draw.css' // 在main.js中加入下面代码 -import 'mars3d/dist/mars3d.css' +// import 'mars3d/dist/mars3d.css' // import 'mars3d-esri/dist/mars3d-esri.js' -import * as mars3d from 'mars3d' -Vue.prototype.mars3d = mars3d +// import * as mars3d from 'mars3d' +// Vue.prototype.mars3d = mars3d /** * This project originally used easy-mock to simulate data, diff --git a/src/router/index.js b/src/router/index.js index 254f077..063e508 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -8,6 +8,7 @@ /* Layout */ import Layout from '../views/layout/Layout' +import { systemRouters } from './modules/system' /** * hidden: true if `hidden:true` will not show in the sidebar(default is false) @@ -86,9 +87,9 @@ children: [ { path: '/overview', - component: () => import('@/views/overview/overview'), + component: () => import('@/views/overview/overviewSmartwell'), // component: () => import('@/views/overview/oo'), - name: 'overview', + name: 'OverviewSmartWell', meta: { title: '运行状态总览', icon: 'icon-config', permission: ['/overview/wellList'] } } ] @@ -117,26 +118,26 @@ component: () => import('@/views/alarmManage/listAlarmRecords'), meta: { title: '告警记录', icon: 'icon-config', keepAlive: true, permission: ['/alarm/list'] } }, + // { + // path: '/listJob', + // name: 'ListJob', + // component: () => import('@/views/jobManage/listJobs'), + // meta: { title: '告警工单', icon: 'icon-config', keepAlive: true, permission: ['/job/list'] } + // }, + // { + // path: '/listOvertimeGetJob', + // name: 'ListJobOvertimeGet', + // component: () => import('@/views/jobManage/listJobsOvertimeGet'), + // meta: { title: '超时未接收工单', icon: 'icon-config', keepAlive: true, permission: ['/job/overtimeGetList'] } + // }, + // { + // path: '/listOvertimeHandleJob', + // name: 'ListJobOvertimeHandle', + // component: () => import('@/views/jobManage/listJobsOvertimeHandle'), + // meta: { title: '超时未处理工单', icon: 'icon-config', keepAlive: true, permission: ['/job/overtimeHandleList'] } + // }, { - path: '/listJob', - name: 'ListJob', - component: () => import('@/views/jobManage/listJobs'), - meta: { title: '告警工单', icon: 'icon-config', keepAlive: true, permission: ['/job/list'] } - }, - { - path: '/listOvertimeGetJob', - name: 'ListJobOvertimeGet', - component: () => import('@/views/jobManage/listJobsOvertimeGet'), - meta: { title: '超时未接收工单', icon: 'icon-config', keepAlive: true, permission: ['/job/overtimeGetList'] } - }, - { - path: '/listOvertimeHandleJob', - name: 'ListJobOvertimeHandle', - component: () => import('@/views/jobManage/listJobsOvertimeHandle'), - meta: { title: '超时未处理工单', icon: 'icon-config', keepAlive: true, permission: ['/job/overtimeHandleList'] } - }, - { - path: '/detailJob/:id(\\d+)', + path: '/detailJob/:id', name: 'DetailJob', component: () => import('@/views/jobManage/detailJob'), hidden: true, @@ -232,25 +233,25 @@ path: '/dataManage', name: 'DataManage', component: () => import('@/views/dataManage/dataManage'), - meta: { title: '历史数据', icon: 'icon-config' } //, permission: ['/datalist'] + meta: { title: '历史数据', icon: 'icon-config', permission: ['/datalist'] } }, { path: '/dataAnalyse', name: 'DataAnalyse', component: () => import('@/views/dataStatics/dataStatics'), - meta: { title: '数据分析', icon: 'icon-config' } // , permission: ['/dataAnalyse'] + meta: { title: '数据分析', icon: 'icon-config' , permission: ['/dataAnalyse'] } }, { path: '/deviceStatics', name: 'DeviceStatics', component: () => import('@/views/deviceStatics/deviceStatics'), - meta: { title: '设备统计', icon: 'icon-config' } // , permission: ['/deviceStatics'] + meta: { title: '设备统计', icon: 'icon-config' , permission: ['/deviceStatics'] } }, { path: '/alarmStatics', name: 'AlarmStatics', component: () => import('@/views/alarmStatics/alarmStatics'), - meta: { title: '报警统计', icon: 'icon-config' } //, permission: ['/alarm/statics'] + meta: { title: '报警统计', icon: 'icon-config', permission: ['/alarm/statics'] } } ] }, diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index 587fa28..d424962 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -120,17 +120,23 @@ }) }, // 获取用户权限 - GetMenus({ commit, state }) { - console.log('in store.permission.js:GetMenus:') + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + const params = { + parentCode: currentSystem.code // 传入该子系统的code,获取子系统的权限 + } return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + // 此处获取用户所有权限 + getMenus(params).then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -142,11 +148,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + // accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/utils/formatDate.js b/src/utils/formatDate.js new file mode 100644 index 0000000..3846f28 --- /dev/null +++ b/src/utils/formatDate.js @@ -0,0 +1,63 @@ +export function formatDateYMD (time) { + let date = new Date(time * 1000) + let m = (date.getMonth() + 1) < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1 + let d = date.getDate() < 10 ? '0' + date.getDate() : date.getDate() + return date.getFullYear() + '-' + m + '-' + d +} +// new Date() 格式化为 ’2018-10-11‘ +export function dateToString (date, format) { + if (!date) return '' + format = format || 'y-m-d' + switch (format) { + case 'y-m': + return date.getFullYear() + '-' + datePad(date.getMonth() + 1, 2) + case 'y-m-d': + return date.getFullYear() + '-' + datePad(date.getMonth() + 1, 2) + '-' + datePad(date.getDate(), 2) + case 'h-m-s': + return datePad(date.getHours(), 2) + ':' + datePad(date.getMinutes(), 2) + ':' + datePad(date.getSeconds(), 2) + case 'y-m-d-h-m-s': + return date.getFullYear() + '-' + datePad(date.getMonth() + 1, 2) + '-' + datePad(date.getDate(), 2) + ' ' + datePad(date.getHours(), 2) + ':' + datePad(date.getMinutes(), 2) + ':' + datePad(date.getSeconds(), 2) + } +} +function datePad (num, n) { + if ((num + '').length >= n) { return num } // 一位数 + return '0' + num // 两位数 +} + +export function getYesterDay () { // 默认显示昨天 + const ctmonth = new Date() + ctmonth.setTime(ctmonth.getTime() - 3600 * 1000 * 24) + return ctmonth +} + +export function getToday () { + var date = new Date() + var year = date.getFullYear() + var month = date.getMonth() + 1 + var day = date.getDate() + if (month < 10) { + month = '0' + month + } + if (day < 10) { + day = '0' + day + } + var nowDate = year + '-' + month + '-' + day + return nowDate +} + +export function getLastWeek () { // 默认显示上周 + const ctmonth = new Date() + ctmonth.setTime(ctmonth.getTime() - 3600 * 1000 * 24 * 7) + return ctmonth +} +export function getLastMonth () { // 默认显示上个月 + const ctmonth = new Date() + ctmonth.setTime(ctmonth.getTime() - 3600 * 1000 * 24 * 30) + return ctmonth +} + +export function getYear () { + const year = new Date().getFullYear() + return year + // return 2020 +} diff --git a/src/utils/request.js b/src/utils/request.js index eb45e3f..24de475 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -44,7 +44,6 @@ location.reload() // 为了重新实例化vue-router对象 避免bug }) } else { - debugger console.log(res) Message({ showClose: true, diff --git a/src/views/alarmManage/components/HandlePrompt.vue b/src/views/alarmManage/components/HandlePrompt.vue index d802514..cfd1b21 100644 --- a/src/views/alarmManage/components/HandlePrompt.vue +++ b/src/views/alarmManage/components/HandlePrompt.vue @@ -67,7 +67,6 @@ methods: { // 初始化对话框 initDialog: function(dialogFormVisible, jobId, isBatch, params) { - debugger this.dialogVisible = dialogFormVisible this.isBatch = isBatch if (isBatch) { diff --git a/config/index.js b/config/index.js index 0d96846..52762df 100644 --- a/config/index.js +++ b/config/index.js @@ -56,10 +56,10 @@ build: { // Template for index.html - index: path.resolve(__dirname, '../smartwell/index.html'), + index: path.resolve(__dirname, '../dist/index.html'), // Paths - assetsRoot: path.resolve(__dirname, '../smartwell'), + assetsRoot: path.resolve(__dirname, '../dist'), assetsSubDirectory: 'static', /** diff --git a/favicon.ico b/favicon.ico index 34b63ac..586e43b 100644 --- a/favicon.ico +++ b/favicon.ico Binary files differ diff --git a/package.json b/package.json index db879d6..4b9d52d 100644 --- a/package.json +++ b/package.json @@ -15,18 +15,26 @@ "svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml" }, "dependencies": { - "animate.css": "^3.7.2", - "axios": "0.18.0", + "animate.css": "^4.1.1", + "axios": "^0.19.0", "babel-polyfill": "^6.26.0", "cesium": "^1.81.0", - "echarts": "^4.2.1", - "element-ui": "2.13.0", + "echarts": "^4.3.0", + "element-ui": "^2.14.1", + "esri": "0.0.1-security", + "esri-leaflet": "^3.0.1", + "esri-leaflet-renderers": "^2.1.2", + "esri-loader": "^3.0.0", "event-source-polyfill": "^1.0.5", + "jquery": "1.11.3", "js-cookie": "2.2.0", "jsencrypt": "^3.0.0-rc.1", "leaflet": "^1.7.1", "leaflet-draw": "^1.0.4", - "mars3d": "^3.0.26", + "leaflet-rotatedmarker": "^0.2.0", + "leaflet.markercluster": "^1.5.3", + "mars3d": "^3.0.30", + "mars3d-cesium": "1.83.0", "mockjs": "1.0.1-beta3", "normalize.css": "7.0.0", "nprogress": "0.2.0", @@ -35,12 +43,12 @@ "vue-amap": "^0.5.9", "vue-baidu-map": "^0.21.22", "vue-router": "3.0.1", - "vuex": "3.0.1" + "vuex": "^3.1.1" }, "devDependencies": { "autoprefixer": "8.5.0", "babel-core": "6.26.0", - "babel-eslint": "8.2.6", + "babel-eslint": "7.2.3", "babel-helper-vue-jsx-merge-props": "2.0.3", "babel-loader": "7.1.5", "babel-plugin-syntax-jsx": "6.18.0", diff --git a/src/api/common.js b/src/api/common.js index 4c38684..4d989f8 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -5,7 +5,7 @@ // 模板下载 export function downloadTemplate(fileName) { return request({ - url: 'template/download', + url: '/smartwell/template/download', method: 'get', params: { filename: fileName diff --git a/src/assets/map/marker-icon-2x.png b/src/assets/map/marker-icon-2x.png new file mode 100644 index 0000000..88f9e50 --- /dev/null +++ b/src/assets/map/marker-icon-2x.png Binary files differ diff --git a/src/assets/map/marker.png b/src/assets/map/marker.png new file mode 100644 index 0000000..fea9fe9 --- /dev/null +++ b/src/assets/map/marker.png Binary files differ diff --git a/src/assets/map/markerAlarm.png b/src/assets/map/markerAlarm.png new file mode 100644 index 0000000..9b3ecb8 --- /dev/null +++ b/src/assets/map/markerAlarm.png Binary files differ diff --git a/src/components/mapWindow/base/mixins/abstract.js b/src/components/mapWindow/base/mixins/abstract.js new file mode 100644 index 0000000..9cf6d52 --- /dev/null +++ b/src/components/mapWindow/base/mixins/abstract.js @@ -0,0 +1,13 @@ +class Mixin { + constructor({ component, props, events, extraProps, exceptProps }) { + this.render = function(h) { + return h(component, { + props: props.reduce((obj, key) => Object.assign(obj, { [key]: this[key] }), {}), + on: events.reduce((obj, key) => Object.assign(obj, { [key]: this.transmitEvent }), {}) + }) + } + this.props = [...extraProps, ...props.filter(prop => exceptProps.indexOf(prop))] + } +} + +export default prop => new Mixin(prop) diff --git a/src/components/mapWindow/base/mixins/common.js b/src/components/mapWindow/base/mixins/common.js new file mode 100644 index 0000000..2fd1a28 --- /dev/null +++ b/src/components/mapWindow/base/mixins/common.js @@ -0,0 +1,82 @@ +const types = { + map: { + unload: 'clearMap' + }, + control: { + unload: 'removeControl' + }, + layer: { + unload: 'removeLayer' + }, + features: { + unload: 'removeFeatures' + }, + listener: { + unload: 'removeListener' + } +} + +const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component + +function destroyInstance () { + const { unload, renderByParent, $parent } = this + if (renderByParent) { + $parent.reload() + } + unload() +} + +class Mixin { + constructor (prop) { + this.methods = { + ready () { + const $parent = getParent(this.$parent) + const map = this.map = $parent.map + this.load() + this.$emit('ready', { + map + }) + }, + transmitEvent (e) { + this.$emit(e.type.replace(/^on/, ''), e) + }, + reload () { + this && this.$nextTick(() => { + this.unload() + this.$nextTick(this.load) + }) + }, + unload () { + const { map, originInstance } = this + try { + switch (prop.type) { + case 'search': + return originInstance.clearResults() + case 'autoComplete': + case 'lushu': + return originInstance.dispose() + case 'markerClusterer': + return originInstance.clearMarkers() + default: + map[types[prop.type].unload](originInstance) + } + } catch (e) {} + } + } + this.computed = { + renderByParent () { + return this.$parent.preventChildrenRender + } + } + this.mounted = function () { + console.log('common mounted') + const $parent = getParent(this.$parent) + const map = $parent.map + const { ready } = this + console.log(map) + map ? ready() : $parent.$on('onload', ready) + } + } +} + +export default type => new Mixin({ type }) diff --git a/src/components/mapWindow/leafletMap.vue b/src/components/mapWindow/leafletMap.vue new file mode 100644 index 0000000..4ec7b61 --- /dev/null +++ b/src/components/mapWindow/leafletMap.vue @@ -0,0 +1,270 @@ + + + + + + + diff --git a/src/components/mapWindow/mapWindow.vue b/src/components/mapWindow/mapWindow.vue new file mode 100644 index 0000000..9ced291 --- /dev/null +++ b/src/components/mapWindow/mapWindow.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/icons/svg/icon-order.svg b/src/icons/svg/icon-order.svg new file mode 100644 index 0000000..62d7666 --- /dev/null +++ b/src/icons/svg/icon-order.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/icon-overview.svg b/src/icons/svg/icon-overview.svg index a2f9449..9dc3936 100644 --- a/src/icons/svg/icon-overview.svg +++ b/src/icons/svg/icon-overview.svg @@ -1 +1 @@ - \ No newline at end of file + diff --git a/src/layout/components/AppHeader.vue b/src/layout/components/AppHeader.vue index 8d8912e..375c71c 100644 --- a/src/layout/components/AppHeader.vue +++ b/src/layout/components/AppHeader.vue @@ -2,7 +2,7 @@

{{ title }}

- + {{ currentSystem.name }} diff --git a/src/main.js b/src/main.js index 9f6c3ec..852dfe5 100644 --- a/src/main.js +++ b/src/main.js @@ -42,10 +42,10 @@ import 'leaflet-draw/dist/leaflet.draw.css' // 在main.js中加入下面代码 -import 'mars3d/dist/mars3d.css' +// import 'mars3d/dist/mars3d.css' // import 'mars3d-esri/dist/mars3d-esri.js' -import * as mars3d from 'mars3d' -Vue.prototype.mars3d = mars3d +// import * as mars3d from 'mars3d' +// Vue.prototype.mars3d = mars3d /** * This project originally used easy-mock to simulate data, diff --git a/src/router/index.js b/src/router/index.js index 254f077..063e508 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -8,6 +8,7 @@ /* Layout */ import Layout from '../views/layout/Layout' +import { systemRouters } from './modules/system' /** * hidden: true if `hidden:true` will not show in the sidebar(default is false) @@ -86,9 +87,9 @@ children: [ { path: '/overview', - component: () => import('@/views/overview/overview'), + component: () => import('@/views/overview/overviewSmartwell'), // component: () => import('@/views/overview/oo'), - name: 'overview', + name: 'OverviewSmartWell', meta: { title: '运行状态总览', icon: 'icon-config', permission: ['/overview/wellList'] } } ] @@ -117,26 +118,26 @@ component: () => import('@/views/alarmManage/listAlarmRecords'), meta: { title: '告警记录', icon: 'icon-config', keepAlive: true, permission: ['/alarm/list'] } }, + // { + // path: '/listJob', + // name: 'ListJob', + // component: () => import('@/views/jobManage/listJobs'), + // meta: { title: '告警工单', icon: 'icon-config', keepAlive: true, permission: ['/job/list'] } + // }, + // { + // path: '/listOvertimeGetJob', + // name: 'ListJobOvertimeGet', + // component: () => import('@/views/jobManage/listJobsOvertimeGet'), + // meta: { title: '超时未接收工单', icon: 'icon-config', keepAlive: true, permission: ['/job/overtimeGetList'] } + // }, + // { + // path: '/listOvertimeHandleJob', + // name: 'ListJobOvertimeHandle', + // component: () => import('@/views/jobManage/listJobsOvertimeHandle'), + // meta: { title: '超时未处理工单', icon: 'icon-config', keepAlive: true, permission: ['/job/overtimeHandleList'] } + // }, { - path: '/listJob', - name: 'ListJob', - component: () => import('@/views/jobManage/listJobs'), - meta: { title: '告警工单', icon: 'icon-config', keepAlive: true, permission: ['/job/list'] } - }, - { - path: '/listOvertimeGetJob', - name: 'ListJobOvertimeGet', - component: () => import('@/views/jobManage/listJobsOvertimeGet'), - meta: { title: '超时未接收工单', icon: 'icon-config', keepAlive: true, permission: ['/job/overtimeGetList'] } - }, - { - path: '/listOvertimeHandleJob', - name: 'ListJobOvertimeHandle', - component: () => import('@/views/jobManage/listJobsOvertimeHandle'), - meta: { title: '超时未处理工单', icon: 'icon-config', keepAlive: true, permission: ['/job/overtimeHandleList'] } - }, - { - path: '/detailJob/:id(\\d+)', + path: '/detailJob/:id', name: 'DetailJob', component: () => import('@/views/jobManage/detailJob'), hidden: true, @@ -232,25 +233,25 @@ path: '/dataManage', name: 'DataManage', component: () => import('@/views/dataManage/dataManage'), - meta: { title: '历史数据', icon: 'icon-config' } //, permission: ['/datalist'] + meta: { title: '历史数据', icon: 'icon-config', permission: ['/datalist'] } }, { path: '/dataAnalyse', name: 'DataAnalyse', component: () => import('@/views/dataStatics/dataStatics'), - meta: { title: '数据分析', icon: 'icon-config' } // , permission: ['/dataAnalyse'] + meta: { title: '数据分析', icon: 'icon-config' , permission: ['/dataAnalyse'] } }, { path: '/deviceStatics', name: 'DeviceStatics', component: () => import('@/views/deviceStatics/deviceStatics'), - meta: { title: '设备统计', icon: 'icon-config' } // , permission: ['/deviceStatics'] + meta: { title: '设备统计', icon: 'icon-config' , permission: ['/deviceStatics'] } }, { path: '/alarmStatics', name: 'AlarmStatics', component: () => import('@/views/alarmStatics/alarmStatics'), - meta: { title: '报警统计', icon: 'icon-config' } //, permission: ['/alarm/statics'] + meta: { title: '报警统计', icon: 'icon-config', permission: ['/alarm/statics'] } } ] }, diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index 587fa28..d424962 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -120,17 +120,23 @@ }) }, // 获取用户权限 - GetMenus({ commit, state }) { - console.log('in store.permission.js:GetMenus:') + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + const params = { + parentCode: currentSystem.code // 传入该子系统的code,获取子系统的权限 + } return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + // 此处获取用户所有权限 + getMenus(params).then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -142,11 +148,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + // accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/utils/formatDate.js b/src/utils/formatDate.js new file mode 100644 index 0000000..3846f28 --- /dev/null +++ b/src/utils/formatDate.js @@ -0,0 +1,63 @@ +export function formatDateYMD (time) { + let date = new Date(time * 1000) + let m = (date.getMonth() + 1) < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1 + let d = date.getDate() < 10 ? '0' + date.getDate() : date.getDate() + return date.getFullYear() + '-' + m + '-' + d +} +// new Date() 格式化为 ’2018-10-11‘ +export function dateToString (date, format) { + if (!date) return '' + format = format || 'y-m-d' + switch (format) { + case 'y-m': + return date.getFullYear() + '-' + datePad(date.getMonth() + 1, 2) + case 'y-m-d': + return date.getFullYear() + '-' + datePad(date.getMonth() + 1, 2) + '-' + datePad(date.getDate(), 2) + case 'h-m-s': + return datePad(date.getHours(), 2) + ':' + datePad(date.getMinutes(), 2) + ':' + datePad(date.getSeconds(), 2) + case 'y-m-d-h-m-s': + return date.getFullYear() + '-' + datePad(date.getMonth() + 1, 2) + '-' + datePad(date.getDate(), 2) + ' ' + datePad(date.getHours(), 2) + ':' + datePad(date.getMinutes(), 2) + ':' + datePad(date.getSeconds(), 2) + } +} +function datePad (num, n) { + if ((num + '').length >= n) { return num } // 一位数 + return '0' + num // 两位数 +} + +export function getYesterDay () { // 默认显示昨天 + const ctmonth = new Date() + ctmonth.setTime(ctmonth.getTime() - 3600 * 1000 * 24) + return ctmonth +} + +export function getToday () { + var date = new Date() + var year = date.getFullYear() + var month = date.getMonth() + 1 + var day = date.getDate() + if (month < 10) { + month = '0' + month + } + if (day < 10) { + day = '0' + day + } + var nowDate = year + '-' + month + '-' + day + return nowDate +} + +export function getLastWeek () { // 默认显示上周 + const ctmonth = new Date() + ctmonth.setTime(ctmonth.getTime() - 3600 * 1000 * 24 * 7) + return ctmonth +} +export function getLastMonth () { // 默认显示上个月 + const ctmonth = new Date() + ctmonth.setTime(ctmonth.getTime() - 3600 * 1000 * 24 * 30) + return ctmonth +} + +export function getYear () { + const year = new Date().getFullYear() + return year + // return 2020 +} diff --git a/src/utils/request.js b/src/utils/request.js index eb45e3f..24de475 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -44,7 +44,6 @@ location.reload() // 为了重新实例化vue-router对象 避免bug }) } else { - debugger console.log(res) Message({ showClose: true, diff --git a/src/views/alarmManage/components/HandlePrompt.vue b/src/views/alarmManage/components/HandlePrompt.vue index d802514..cfd1b21 100644 --- a/src/views/alarmManage/components/HandlePrompt.vue +++ b/src/views/alarmManage/components/HandlePrompt.vue @@ -67,7 +67,6 @@ methods: { // 初始化对话框 initDialog: function(dialogFormVisible, jobId, isBatch, params) { - debugger this.dialogVisible = dialogFormVisible this.isBatch = isBatch if (isBatch) { diff --git a/src/views/alarmManage/listAlarmNow.vue b/src/views/alarmManage/listAlarmNow.vue index f280c51..7234b37 100644 --- a/src/views/alarmManage/listAlarmNow.vue +++ b/src/views/alarmManage/listAlarmNow.vue @@ -1,44 +1,45 @@