diff --git a/.eslintrc.js b/.eslintrc.js index bbe07d664..94bda2b8f 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -10,7 +10,6 @@ module.exports = { es6: true, }, extends: ['plugin:vue/recommended', 'eslint:recommended'], - // add your custom rules here //it is base on https://github.com/vuejs/eslint-config-vue rules: { @@ -26,10 +25,7 @@ module.exports = { "vue/name-property-casing": ["error", "PascalCase"], "vue/no-v-html": "off", 'accessor-pairs': 2, - 'arrow-spacing': [2, { - 'before': true, - 'after': true - }], + "arrow-spacing": 0,//=>的前/后括号 'block-spacing': [2, 'always'], 'brace-style': [2, '1tbs', { 'allowSingleLine': true @@ -47,7 +43,7 @@ module.exports = { 'curly': [2, 'multi-line'], 'dot-location': [2, 'property'], 'eol-last': 2, - 'eqeqeq': ["error", "always", { "null": "ignore" }], + // 'eqeqeq': ["error", "always", { "null": "ignore" }], // 全等 'generator-star-spacing': [2, { 'before': true, 'after': true @@ -63,10 +59,7 @@ module.exports = { 'before': true, 'after': true }], - 'new-cap': [2, { - 'newIsCap': true, - 'capIsNew': false - }], + "new-cap": 2,//函数名首行大写必须使用new方式调用,首行小写必须用不带new方式调用 'new-parens': 2, 'no-array-constructor': 2, 'no-caller': 2, @@ -94,7 +87,7 @@ module.exports = { 'no-implied-eval': 2, 'no-inner-declarations': [2, 'functions'], 'no-invalid-regexp': 2, - 'no-irregular-whitespace': 2, + 'no-irregular-whitespace': 2, //不能有不规则的空格 'no-iterator': 2, 'no-label-var': 2, 'no-labels': [2, { @@ -102,8 +95,8 @@ module.exports = { 'allowSwitch': false }], 'no-lone-blocks': 2, - 'no-mixed-spaces-and-tabs': 2, - 'no-multi-spaces': 2, + "no-mixed-spaces-and-tabs": [2, false],//禁止混用tab和空格 + "no-multi-spaces": 1,//不能用多余的空格 'no-multi-str': 2, 'no-multiple-empty-lines': [2, { 'max': 1 @@ -126,11 +119,11 @@ module.exports = { 'no-self-compare': 2, 'no-sequences': 2, 'no-shadow-restricted-names': 2, - 'no-spaced-func': 2, + 'no-spaced-func': 2,//函数调用时 函数名与()之间不能有空格 'no-sparse-arrays': 2, 'no-this-before-super': 2, 'no-throw-literal': 2, - 'no-trailing-spaces': 2, + "no-trailing-spaces": 1,//一行结束后面不要有空格 'no-undef': 2, 'no-undef-init': 2, 'no-unexpected-multiline': 2, @@ -159,38 +152,37 @@ module.exports = { ':': 'before' } }], - 'padded-blocks': [2, 'never'], + "padded-blocks": 0,//块语句内行首行尾是否要空行 'quotes': [2, 'single', { 'avoidEscape': true, 'allowTemplateLiterals': true }], - 'semi': [2, 'never'], + 'semi': [2, 'always'], //语句强制分号结尾 'semi-spacing': [2, { 'before': false, 'after': true }], - 'space-before-blocks': [2, 'always'], - 'space-before-function-paren': [2, 'never'], - 'space-in-parens': [2, 'never'], - 'space-infix-ops': 2, + "strict": 2,//使用严格模式 + 'space-before-blocks': [2, 'always'], //不以新行开始的块{前面要不要有空格 + "space-before-function-paren": [0, "always"],//函数定义时括号前面要不要有空格 + "space-in-parens": [0, "never"],//小括号里面要不要有空格 + "space-infix-ops": 0,//中缀操作符周围要不要有空格 'space-unary-ops': [2, { 'words': true, 'nonwords': false - }], + }], //一元运算符的前/后要要加空格 'spaced-comment': [2, 'always', { 'markers': ['global', 'globals', 'eslint', 'eslint-disable', '*package', '!', ','] - }], + }], //注释风格要不要有空格什么的 'template-curly-spacing': [2, 'never'], - 'use-isnan': 2, - 'valid-typeof': 2, - 'wrap-iife': [2, 'any'], + 'use-isnan': 2, //禁止比较时使用NaN,只能用isNaN() + 'valid-typeof': 2, //必须使用合法的typeof的值 + "wrap-iife": [2, "inside"],//立即执行函数表达式的小括号风格 'yield-star-spacing': [2, 'both'], - 'yoda': [2, 'never'], + 'yoda': [2, 'never'], //禁止尤达条件 'prefer-const': 2, 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0, - 'object-curly-spacing': [2, 'always', { - objectsInObjects: false - }], - 'array-bracket-spacing': [2, 'never'] + "object-curly-spacing": [0, "never"],//大括号内是否允许不必要的空格 + "array-bracket-spacing": [2, "never"], //是否允许非空数组里面有多余的空格 } } diff --git a/src/jmap/config/deviceModel.js b/src/jmap/config/deviceModel.js index b7bb516e1..28c23d3bf 100644 --- a/src/jmap/config/deviceModel.js +++ b/src/jmap/config/deviceModel.js @@ -1,9 +1,9 @@ -import deviceType from "./deviceType"; +import deviceType from './deviceType'; const deviceModel = {}; /** link字段配置*/ deviceModel[deviceType.Link] = { -} +}; -export default deviceModel; \ No newline at end of file +export default deviceModel; diff --git a/src/jmap/config/deviceState.js b/src/jmap/config/deviceState.js index 6678b92cb..30b2a3f1b 100644 --- a/src/jmap/config/deviceState.js +++ b/src/jmap/config/deviceState.js @@ -1,14 +1,14 @@ import deviceType from './deviceType'; -const deviceState = {} +const deviceState = {}; /** link状态配置*/ deviceState[deviceType.Link] = { - status: { - Default: '01', //01默认状态 - State01: '01', //01状态 - State02: '02', //02状态 - } -} + status: { + Default: '01', // 01默认状态 + State01: '01', // 01状态 + State02: '02' // 02状态 + } +}; -export default deviceState; \ No newline at end of file +export default deviceState; diff --git a/src/jmap/config/deviceStyle.js b/src/jmap/config/deviceStyle.js index 7c8beb10c..afd02591b 100644 --- a/src/jmap/config/deviceStyle.js +++ b/src/jmap/config/deviceStyle.js @@ -1,17 +1,17 @@ import deviceType from './deviceType'; const deviceStyle = { - Global: { - textFontSize: '8.2', - backgroundColor: '#000000', - } -} + Global: { + textFontSize: '8.2', + backgroundColor: '#000000' + } +}; /** link风格配置*/ deviceStyle[deviceType.Link] = { - linkColor: 'red', - linkWidth: 8, - linkTextColor: '#FFFFFF', -} + linkColor: 'red', + linkWidth: 8, + linkTextColor: '#FFFFFF' +}; -export default deviceStyle; \ No newline at end of file +export default deviceStyle; diff --git a/src/jmap/config/deviceType.js b/src/jmap/config/deviceType.js index bc36d0a32..be865826b 100644 --- a/src/jmap/config/deviceType.js +++ b/src/jmap/config/deviceType.js @@ -1,10 +1,10 @@ const deviceType = { - Link: 'Link', - Section: 'Section', - Signal: 'Signal', - Station: 'Station', - StationControl: 'StationControl', - StationStand: 'StationStand', -} + Link: 'Link', + Section: 'Section', + Signal: 'Signal', + Station: 'Station', + StationControl: 'StationControl', + StationStand: 'StationStand' +}; -export default deviceType; \ No newline at end of file +export default deviceType; diff --git a/src/jmap/map.js b/src/jmap/map.js index 6ededf43b..0b994445c 100644 --- a/src/jmap/map.js +++ b/src/jmap/map.js @@ -4,78 +4,78 @@ import parser from './utils/parser'; import deviceState from './config/deviceState'; class Jmap { - constructor(opts) { - // 挂载的dom节点 - this.$dom = opts.dom; + constructor(opts) { + // 挂载的dom节点 + this.$dom = opts.dom; - // 原始数据 - this.data = {}; + // 原始数据 + this.data = {}; - // 默认初始状态 - this.defaultStateDict = this.loaddefaultState(); + // 默认初始状态 + this.defaultStateDict = this.loaddefaultState(); - // 皮肤参数 - this.skinStyle = ''; + // 皮肤参数 + this.skinStyle = ''; - // 皮肤风格 - this.styleDict = {}; + // 皮肤风格 + this.styleDict = {}; - // 设备数据 - this.mapDevice = {}; + // 设备数据 + this.mapDevice = {}; - // 设备代理数据 - this.proxyData = {}; + // 设备代理数据 + this.proxyData = {}; - // 绘图模块 - this.$painter = new Painter(this, opts); - } + // 绘图模块 + this.$painter = new Painter(this, opts); + } - /** + /** * 加载数据 - * @param {*} data + * @param {*} data */ - loadData(skinStyle, data) { - // 保存原始数据 - this.data = data; + loadData(skinStyle, data) { + // 保存原始数据 + this.data = data; - // 解析地图数据 - this.mapDevice = parser(data, this.defaultStateDict); + // 解析地图数据 + this.mapDevice = parser(data, this.defaultStateDict); - // 生成代理对象 - this.proxyData = new Proxy(this.mapDevice, new ProxyHandle(this)); + // 生成代理对象 + this.proxyData = new Proxy(this.mapDevice, new ProxyHandle(this)); - // 初次渲染视图 - this.$painter.render(this.mapDevice); - } + // 初次渲染视图 + this.$painter.render(this.mapDevice); + } - loaddefaultState() { - let defaultStateDict = {}; + loaddefaultState() { + const defaultStateDict = {}; - Object.keys(deviceState).forEach(type => { - defaultStateDict[type] = {}; - Object.keys(deviceState[type] || {}).forEach(state => { - defaultStateDict[type][state] = deviceState[type][state].Default; - }) - }) + Object.keys(deviceState).forEach(type => { + defaultStateDict[type] = {}; + Object.keys(deviceState[type] || {}).forEach(state => { + defaultStateDict[type][state] = deviceState[type][state].Default; + }); + }); - return defaultStateDict; - } + return defaultStateDict; + } - getPainter() { - return this.$painter; - } + getPainter() { + return this.$painter; + } - clear() { - this.$painter.clear(); - } + clear() { + this.$painter.clear(); + } - dispose() { - this.skinStyle = ''; - this.styleDict = {}; - this.mapDevice = {}; - this.proxyData = {}; - this.$painter.dispose(); - } + dispose() { + this.skinStyle = ''; + this.styleDict = {}; + this.mapDevice = {}; + this.proxyData = {}; + this.$painter.dispose(); + } } -export default Jmap; \ No newline at end of file +export default Jmap; diff --git a/src/jmap/maps.js b/src/jmap/maps.js index 1a91a1601..342b86091 100644 --- a/src/jmap/maps.js +++ b/src/jmap/maps.js @@ -7,97 +7,94 @@ import { getAttribute, setAttribute } from './utils/attribute'; const DOM_ATTRIBUTE_KEY = '_emaps_instance_'; class Jmaps { - constructor() { - this._version = '4.2.1'; + constructor() { + this._version = '4.2.1'; - this._dependencies = { zrender: '4.0.6' }; + this._dependencies = { zrender: '4.0.6' }; - this.instances = {} - } + this.instances = {}; + } - init(opts) { - if (!opts) { - throw new Error('Initialize failed: invalid params.'); - } + init(opts) { + if (!opts) { + throw new Error('Initialize failed: invalid params.'); + } - if (__DEV__) { - if ((zrender.version.replace('.', '') - 0) < (this._dependencies.zrender.replace('.', '') - 0)) { - throw new Error( - 'zrender/src ' + zrender.version - + ' is too old for ECharts ' + version - + '. Current version need ZRender ' - + this._dependencies.zrender + '+' - ); - } + if (__DEV__) { + // 判断版本 + if ((zrender.version.replace('.', '') - 0) < (this._dependencies.zrender.replace('.', '') - 0)) { + throw new Error( + 'zrender/src ' + zrender.version + + ' is too old for ECharts ' + zrender.version + + '. Current version need ZRender ' + + this._dependencies.zrender + '+' + ); + } - if (!opts.dom && opts.id) { - opts['dom'] = document.getElementById(opts.id); - } + if (!opts.dom && opts.id) { + opts['dom'] = document.getElementById(opts.id); + } - if (!opts.dom) { - throw new Error('Initialize failed: invalid dom and id.'); - } - } + if (!opts.dom) { + throw new Error('Initialize failed: invalid dom and id.'); + } + } - let existInstance = this.getInstanceByDom(opts.dom); - if (existInstance) { - if (__DEV__) { - console.warn('There is a chart instance already initialized on the dom.'); - } - return existInstance; - } + const existInstance = this.getInstanceByDom(opts.dom); + if (existInstance) { + if (__DEV__) { + console.warn('There is a chart instance already initialized on the dom.'); + } + return existInstance; + } - if (__DEV__) { - if (zrUtil.isDom(opts.dom) - && opts.dom.nodeName.toUpperCase() !== 'CANVAS' - && ( - (!opts.dom.clientWidth && (!opts || opts.width == null)) - || (!opts.dom.clientHeight && (!opts || opts.height == null)) - ) - ) { - console.warn('Can\'t get DOM width or height. Please check ' - + 'dom.clientWidth and dom.clientHeight. They should not be 0.' - + 'For example, you may need to call this in the callback ' - + 'of window.onload.'); - } - } + if (__DEV__) { + if (zrUtil.isDom(opts.dom) && + opts.dom.nodeName.toUpperCase() !== 'CANVAS' && + ((!opts.dom.clientWidth && (!opts || opts.width == null)) || (!opts.dom.clientHeight && (!opts || opts.height == null))) + ) { + console.warn('Can\'t get DOM width or height. Please check ' + + 'dom.clientWidth and dom.clientHeight. They should not be 0.' + + 'For example, you may need to call this in the callback ' + + 'of window.onload.'); + } + } - let jmap = new Jmap(opts); + const jmap = new Jmap(opts); - this.instances[opts.id] = jmap; + this.instances[opts.id] = jmap; - setAttribute(opts.dom, DOM_ATTRIBUTE_KEY, opts.id); + setAttribute(opts.dom, DOM_ATTRIBUTE_KEY, opts.id); - return jmap; - } + return jmap; + } - getVersion() { - return this._version; - } + getVersion() { + return this._version; + } - getDependencies() { - return this._dependencies; - } + getDependencies() { + return this._dependencies; + } - getInstanceByDom(dom) { - return this.instances[getAttribute(dom, DOM_ATTRIBUTE_KEY)]; - } + getInstanceByDom(dom) { + return this.instances[getAttribute(dom, DOM_ATTRIBUTE_KEY)]; + } - getInstanceById(id) { - return this.instances[id]; - } + getInstanceById(id) { + return this.instances[id]; + } - dispose(jmap) { - if (typeof jmap === 'string') { - jmap = instances[jmap]; - } - else if (!(jmap instanceof Jmap)) { - jmap = this.getInstanceByDom(jmap); - } - if ((jmap instanceof Jmap) && !jmap.isDisposed()) { - jmap.dispose(); - } - } + dispose(jmap) { + if (typeof jmap === 'string') { + jmap = this.instances[jmap]; + } else if (!(jmap instanceof Jmap)) { + jmap = this.getInstanceByDom(jmap); + } + if ((jmap instanceof Jmap) && !jmap.isDisposed()) { + jmap.dispose(); + } + } } -export default Jmaps; \ No newline at end of file +export default Jmaps; diff --git a/src/jmap/painter.js b/src/jmap/painter.js index d002ce423..d421bcb69 100644 --- a/src/jmap/painter.js +++ b/src/jmap/painter.js @@ -8,135 +8,135 @@ const renderer = 'svg'; const devicePixelRatio = 2; class Painter { - constructor(jamp, opts) { - // 父级实例 - this.$jamp = jamp; + constructor(jamp, opts) { + // 父级实例 + this.$jamp = jamp; - // zrender实例 - this.$zr = null; + // zrender实例 + this.$zr = null; - // 皮肤配置 - this.styleMap = {}; + // 皮肤配置 + this.styleMap = {}; - // 图层数据 - this.viewLevelMap = {}; + // 图层数据 + this.viewLevelMap = {}; - // 视图数据 - this.viewInstance = {}; + // 视图数据 + this.viewInstance = {}; - // 父级图层 - this.parentLevel = new Group({ name: '__parent__' }); + // 父级图层 + this.parentLevel = new Group({ name: '__parent__' }); - // 挂载视图 - this.mount(opts.dom, Object.assign({ renderer, devicePixelRatio, width: opts.dom.width, height: opts.dom.clientHeight }, opts.config)); - } + // 挂载视图 + this.mount(opts.dom, Object.assign({ renderer, devicePixelRatio, width: opts.dom.width, height: opts.dom.clientHeight }, opts.config)); + } - /** + /** * 挂载视图 - * @param {*} dom - * @param {*} config + * @param {*} dom + * @param {*} config */ - mount(dom, config) { - // 挂载页面视图 - this.$zr = zrender.init(dom, config); + mount(dom, config) { + // 挂载页面视图 + this.$zr = zrender.init(dom, config); - // 添加父级图层 - this.$zr.add(this.parentLevel); + // 添加父级图层 + this.$zr.add(this.parentLevel); - // 添加子级图层 - Object.values(deviceType).forEach(type => { - let level = new Group({ name: `__${type}__` }) - this.viewLevelMap[type] = level; - this.parentLevel.add(level); - }) - } + // 添加子级图层 + Object.values(deviceType).forEach(type => { + const level = new Group({ name: `__${type}__` }); + this.viewLevelMap[type] = level; + this.parentLevel.add(level); + }); + } - /** + /** * 初次渲染视图 - * @param {*} mapDevice + * @param {*} mapDevice */ - render(mapDevice, skinStyle) { - // 清空视图 - this.viewInstance = {}; + render(mapDevice, skinStyle) { + // 清空视图 + this.viewInstance = {}; - // 加载皮肤 - this.styleMap = this.loadStyle(skinStyle); + // 加载皮肤 + this.styleMap = this.loadStyle(skinStyle); - // 清空图层 - Object.values(this.viewLevelMap).forEach(level => { - level && level.removeAll(); - }) + // 清空图层 + Object.values(this.viewLevelMap).forEach(level => { + level && level.removeAll(); + }); - // 创建视图 - Object.values(mapDevice).forEach(device => { - device && this.add(device); - }) - } + // 创建视图 + Object.values(mapDevice).forEach(device => { + device && this.add(device); + }); + } - /** + /** * 加载皮肤 - * @param {*} skinStyle + * @param {*} skinStyle */ - loadStyle(skinStyle) { - return deviceStyle; - } + loadStyle(skinStyle) { + return deviceStyle; + } - /** + /** * 添加视图 - * @param {*} device + * @param {*} device */ - add(device) { - let type = device._type; - let code = device._code; - let view = shapefactory(type, device, this.styleMap); - if (view) { - this.viewInstance[code] = view; - this.viewLevelMap[type].add(view); - } - } + add(device) { + const type = device._type; + const code = device._code; + const view = shapefactory(type, device, this.styleMap); + if (view) { + this.viewInstance[code] = view; + this.viewLevelMap[type].add(view); + } + } - /** + /** * 删除视图 - * @param {*} device + * @param {*} device */ - delete(device) { - let code = device._code; - let type = device._type; - let view = this.viewInstance[code]; - if (view) { - this.viewLevelMap[type].remove(view); - delete this.viewInstance[code]; - } - } + delete(device) { + const code = device._code; + const type = device._type; + const view = this.viewInstance[code]; + if (view) { + this.viewLevelMap[type].remove(view); + delete this.viewInstance[code]; + } + } - /** + /** * 更新视图 - * @param {*} device + * @param {*} device */ - update(device) { - let code = device._code; - let view = this.viewInstance[code]; - if (view) { - view.setStatus(device); - } - } + update(device) { + const code = device._code; + const view = this.viewInstance[code]; + if (view) { + view.setStatus(device); + } + } - /** + /** * 清除所有对象和画布 */ - clear() { - this.$zr && this.$zr.clear(); - } + clear() { + this.$zr && this.$zr.clear(); + } - /** + /** * 销毁 ZRender 实例 */ - dispose() { - this.$zr && zrender.dispose(this.$zr); - this.$zr = null; - this.viewInstance = {}; - this.viewLevelMap = {}; - } + dispose() { + this.$zr && zrender.dispose(this.$zr); + this.$zr = null; + this.viewInstance = {}; + this.viewLevelMap = {}; + } } -export default Painter; \ No newline at end of file +export default Painter; diff --git a/src/jmap/proxyHandle.js b/src/jmap/proxyHandle.js index b6f3c263d..f908ac49a 100644 --- a/src/jmap/proxyHandle.js +++ b/src/jmap/proxyHandle.js @@ -1,31 +1,31 @@ class ProxyHandle { - constructor(jmap) { - this.$jmap = jmap || {}; - this.$painter = this.$jmap.$painter; - } + constructor(jmap) { + this.$jmap = jmap || {}; + this.$painter = this.$jmap.$painter; + } - set(target, code, device) { - let reflect = Reflect.set(target, code, device); - this.$painter.update(device); - return reflect; - } + set(target, code, device) { + const reflect = Reflect.set(target, code, device); + this.$painter.update(device); + return reflect; + } - get(target, code) { - let reflect = Reflect.get(target, code); - return reflect; - } + get(target, code) { + const reflect = Reflect.get(target, code); + return reflect; + } - has(target, code) { - let reflect = Reflect.has(target, code); - this.$painter.add(device); - return reflect; - } + has(target, code) { + const reflect = Reflect.has(target, code); + this.$painter.add(device); + return reflect; + } - deletecodeerty(target, code) { - let reflect = Reflect.deletecodeerty(target, code); - this.$painter.delete(device); - return reflect; - } + deletecodeerty(target, code) { + const reflect = Reflect.deletecodeerty(target, code); + this.$painter.delete(device); + return reflect; + } } -export default ProxyHandle; \ No newline at end of file +export default ProxyHandle; diff --git a/src/jmap/shape/Link.js b/src/jmap/shape/Link.js index 53f648603..22280b96f 100644 --- a/src/jmap/shape/Link.js +++ b/src/jmap/shape/Link.js @@ -1,61 +1,61 @@ import Line from 'zrender/src/graphic/shape/Line'; import Group from 'zrender/src/container/Group'; -import { stat } from 'fs'; +// import { stat } from 'fs'; class Link extends Group { - constructor({ _code, _type, zlevel, model, state }, style) { - super(); - this._code = _code; - this._type = _type; - this.zlevel = zlevel; - this.model = model; - this.state = state; - this.style = style; - this.create(); - } + constructor({ _code, _type, zlevel, model, state }, style) { + super(); + this._code = _code; + this._type = _type; + this.zlevel = zlevel; + this.model = model; + this.state = state; + this.style = style; + this.create(); + } - create() { - let model = this.model; - let style = this.style; - let textPosition = 'insideBottom'; + create() { + const model = this.model; + const style = this.style; + let textPosition = 'insideBottom'; - if (model.beg.x !== model.end.x && model.beg.y !== model.end.y) { - textPosition = model.beg.y > model.end.y ? 'insideLeft' : 'insideRight'; - } + if (model.beg.x !== model.end.x && model.beg.y !== model.end.y) { + textPosition = model.beg.y > model.end.y ? 'insideLeft' : 'insideRight'; + } - this.link = new Line({ - zlevel: this.zlevel, - shape: { - x1: model.beg.x, - y1: model.beg.y, - x2: model.end.x, - y2: model.end.y, - }, - style: { - lineWidth: style.Link.linkWidth, - stroke: style.Link.linkColor, - text: model.code, - textDistance: style.Link.linkWidth * 2, - textPosition: textPosition, - textAlign: 'middle', - fontSize: style.Global.textFontSize, - textFill: style.Link.linkTextColor, - textStroke: style.Global.backgroundColor, - } - }); + this.link = new Line({ + zlevel: this.zlevel, + shape: { + x1: model.beg.x, + y1: model.beg.y, + x2: model.end.x, + y2: model.end.y + }, + style: { + lineWidth: style.Link.linkWidth, + stroke: style.Link.linkColor, + text: model.code, + textDistance: style.Link.linkWidth * 2, + textPosition: textPosition, + textAlign: 'middle', + fontSize: style.Global.textFontSize, + textFill: style.Link.linkTextColor, + textStroke: style.Global.backgroundColor + } + }); - this.add(this.link); - } + this.add(this.link); + } - setStatus() { - } + setStatus() { + } - tipBasePoint() { - return { - x: (this.link.shape.x1 + this.link.shape.x2) / 2, - y: (this.link.shape.y1 + this.link.shape.y2) / 2 - }; - } + tipBasePoint() { + return { + x: (this.link.shape.x1 + this.link.shape.x2) / 2, + y: (this.link.shape.y1 + this.link.shape.y2) / 2 + }; + } } -export default Link; \ No newline at end of file +export default Link; diff --git a/src/jmap/shape/factory.js b/src/jmap/shape/factory.js index be5fab8a5..7e00000f3 100644 --- a/src/jmap/shape/factory.js +++ b/src/jmap/shape/factory.js @@ -6,10 +6,11 @@ const mapShape = {}; mapShape[deviceType.Link] = Link; function shapefactory(type, device, style) { - let shape = mapShape[type]; - if (shape instanceof Function) { - return new shape(device, style); - } + const shape = mapShape[type]; + if (shape instanceof Function) { + return new shape(device, style); + } } -export default shapefactory \ No newline at end of file +export default shapefactory +; diff --git a/src/jmap/utils/attribute.js b/src/jmap/utils/attribute.js index 58d9ae361..4979c143e 100644 --- a/src/jmap/utils/attribute.js +++ b/src/jmap/utils/attribute.js @@ -1,11 +1,11 @@ export function setAttribute(dom, key, value) { - dom.setAttribute - ? dom.setAttribute(key, value) - : (dom[key] = value); + dom.setAttribute + ? dom.setAttribute(key, value) + : (dom[key] = value); } export function getAttribute(dom, key) { - return dom.getAttribute - ? dom.getAttribute(key) - : dom[key]; -} \ No newline at end of file + return dom.getAttribute + ? dom.getAttribute(key) + : dom[key]; +} diff --git a/src/jmap/utils/dev.js b/src/jmap/utils/dev.js index f6b5aca6d..94c00a3d4 100644 --- a/src/jmap/utils/dev.js +++ b/src/jmap/utils/dev.js @@ -2,15 +2,14 @@ var dev; // In browser if (typeof window !== 'undefined') { - dev = window.__DEV__; -} -// In node -else if (typeof global !== 'undefined') { - dev = global.__DEV__; + dev = window.__DEV__; +} else if (typeof global !== 'undefined') { + // In node + dev = global.__DEV__; } if (typeof dev === 'undefined') { - dev = true; + dev = true; } -export var __DEV__ = dev; \ No newline at end of file +export var __DEV__ = dev; diff --git a/src/jmap/utils/parser.js b/src/jmap/utils/parser.js index cabc36517..6e0bba3b6 100644 --- a/src/jmap/utils/parser.js +++ b/src/jmap/utils/parser.js @@ -1,25 +1,25 @@ import deviceType from '../config/deviceType'; function deviceFactory(type, defaultStateDict, elem, zlevel) { - return { - zlevel: zlevel, - _type: type, - _code: elem.code, - model: elem, - state: Object.assign({}, defaultStateDict[type]) - } + return { + zlevel: zlevel, + _type: type, + _code: elem.code, + model: elem, + state: Object.assign({}, defaultStateDict[type]) + }; } function parser(data, defaultStateDict) { - let mapDevice = {}; + const mapDevice = {}; - if (data) { - (data.linkList || []).forEach(elem => { - mapDevice[elem.code] = deviceFactory(deviceType.Link, defaultStateDict, elem, 1); - }); - } + if (data) { + (data.linkList || []).forEach(elem => { + mapDevice[elem.code] = deviceFactory(deviceType.Link, defaultStateDict, elem, 1); + }); + } - return mapDevice; + return mapDevice; } export default parser; diff --git a/src/layout1/components/AppMain.vue b/src/layout1/components/AppMain.vue index 5a48b7ba0..00336406e 100644 --- a/src/layout1/components/AppMain.vue +++ b/src/layout1/components/AppMain.vue @@ -11,10 +11,10 @@ export default { name: 'AppMain', computed: { key() { - return this.$route.fullPath + return this.$route.fullPath; } } -} +}; \ No newline at end of file + diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 3a7629bf2..6dcd9c867 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -1,26 +1,38 @@ \ No newline at end of file + diff --git a/src/views/login/loginNew.vue b/src/views/login/loginNew.vue index 49b26caf5..d14265f48 100644 --- a/src/views/login/loginNew.vue +++ b/src/views/login/loginNew.vue @@ -1,120 +1,127 @@ \ No newline at end of file + diff --git a/src/views/login/loginNewPlan.vue b/src/views/login/loginNewPlan.vue index 9e92fab48..b60bd806f 100644 --- a/src/views/login/loginNewPlan.vue +++ b/src/views/login/loginNewPlan.vue @@ -1,121 +1,127 @@ \ No newline at end of file + diff --git a/src/views/login/loginNewScreen.vue b/src/views/login/loginNewScreen.vue index 96c7dce2a..eaf7f09c2 100644 --- a/src/views/login/loginNewScreen.vue +++ b/src/views/login/loginNewScreen.vue @@ -1,121 +1,127 @@ \ No newline at end of file + diff --git a/src/views/login/loginPlan.vue b/src/views/login/loginPlan.vue index 835bc2a61..422506c6c 100644 --- a/src/views/login/loginPlan.vue +++ b/src/views/login/loginPlan.vue @@ -1,110 +1,127 @@ \ No newline at end of file + diff --git a/src/views/login/loginScreen.vue b/src/views/login/loginScreen.vue index 01ee17457..c68dc3361 100644 --- a/src/views/login/loginScreen.vue +++ b/src/views/login/loginScreen.vue @@ -1,110 +1,127 @@ \ No newline at end of file +