text: import Vue from 'vue'
  import ElementUI from 'element-ui'
  import 'element-ui/lib/theme-chalk/index.css'
  // import locale from 'element-ui/lib/locale/lang/en'
  import App from './App'
  import router from './router'
  import store from './store'
  import '@/icons' // icon
  import '@/permission'
  import { del, fetch, patch, post, put } from "./utils/http"
  
  // import socketio from 'socket.io-client';
  // import VueSocketio from 'vue-socket.io';
  
  // const io = new socketio(process.env.SOCKET_BASE_URL+"/alarm", {
  //   transports: ['websocket'],
  //   reconnectionAttempts: 20
  // })
  // Vue.use(VueSocketio, io, store);
  
  
  // Vue.use(ElementUI, { locale })
  Vue.use(ElementUI)
  
  Vue.config.productionTip = false
  Vue.prototype.$fetch = fetch
  Vue.prototype.$post = post
  Vue.prototype.$patch = patch
  Vue.prototype.$put = put
  Vue.prototype.$del = del
  
  Vue.filter('formatterBytes', function(bytes, unit) {
    if (bytes === 0) return '0 B';
    if (bytes < 1) return `${bytes.toFixed(2)}B`;
    let k = unit || 1000, // or 1024
      sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],
      i = Math.floor(Math.log(bytes) / Math.log(k));
    return (bytes / Math.pow(k, i)).toFixed(2) + sizes[i];
  })
  
  Vue.filter('formatJson', function(json, options) {
    var reg = null,
      formatted = '',
      pad = 0,
      PADDING = '    ';
    options = options || {};
    options.newlineAfterColonIfBeforeBraceOrBracket = (options.newlineAfterColonIfBeforeBraceOrBracket === true) ? true : false;
    options.spaceAfterColon = (options.spaceAfterColon === false) ? false : true;
    if (typeof json !== 'string') {
      json = JSON.stringify(json);
    } else {
      json = JSON.parse(json);
      json = JSON.stringify(json);
    }
    reg = /([\{\}])/g;
    json = json.replace(reg, '\r\n$1\r\n');
    reg = /([\[\]])/g;
    json = json.replace(reg, '\r\n$1\r\n');
    reg = /(\,)/g;
    json = json.replace(reg, '$1\r\n');
    reg = /(\r\n\r\n)/g;
    json = json.replace(reg, '\r\n');
    reg = /\r\n\,/g;
    json = json.replace(reg, ',');
    if (!options.newlineAfterColonIfBeforeBraceOrBracket) {
      reg = /\:\r\n\{/g;
      json = json.replace(reg, ':{');
      reg = /\:\r\n\[/g;
      json = json.replace(reg, ':[');
    }
    if (options.spaceAfterColon) {
      reg = /\:/g;
      json = json.replace(reg, ':');
    }
    (json.split('\r\n')).forEach(function (node, index) {
      //console.log(node);
      var i = 0,
        indent = 0,
        padding = '';
  
      if (node.match(/\{$/) || node.match(/\[$/)) {
        indent = 1;
      } else if (node.match(/\}/) || node.match(/\]/)) {
        if (pad !== 0) {
          pad -= 1;
        }
      } else {
        indent = 0;
      }
  
      for (i = 0; i < pad; i++) {
        padding += PADDING;
      }
  
      formatted += padding + node + '\r\n';
      pad += indent;
    });
    return formatted;
  })
  
  Vue.filter('formatTime', function (timestamp) {
    if(!timestamp) {
      return 'N/A';
    }
    return Vue.prototype.myDateFormat(new Date(timestamp*1000), "yyyy-MM-dd hh:mm:ss");
  })
  
  Vue.prototype.myDateFormat = function (date, fmt) {
    var o = {
      "y+": date.getFullYear(),
      "M+": date.getMonth() + 1,                 //月份
      "d+": date.getDate(),                    //日
      "h+": date.getHours(),                   //小时
      "m+": date.getMinutes(),                 //分
      "s+": date.getSeconds(),                 //秒
      "q+": Math.floor((date.getMonth() + 3) / 3), //季度
      "S+": date.getMilliseconds()             //毫秒
    };
    for (var k in o) {
      if (new RegExp("(" + k + ")").test(fmt)) {
        if (k === "y+") {
          fmt = fmt.replace(RegExp.$1, ("" + o[k]).substr(4 - RegExp.$1.length));
        }
        else if (k === "S+") {
          var lens = RegExp.$1.length;
          lens = lens === 1 ? 3 : lens;
          fmt = fmt.replace(RegExp.$1, ("00" + o[k]).substr(("" + o[k]).length - 1, lens));
        }
        else {
          fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
        }
      }
    }
    return fmt;
  };
  
  
  new Vue({
    el: '#app',
    router,
    store,
    template: '<App/>',
    components: { App }
  })
  