派生自 wuyushui/SewerAndRainNetwork

YANGDL
2021-01-05 d6157c06771caadcaa09a11d25ddfa144d7fe9f5
Merge remote-tracking branch 'origin/master'
7个文件已添加
1个文件已修改
1519 ■■■■■ 已修改文件
.idea/jsLinters/eslint.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/enterprise.js 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/panel/TopEnterprisePanel.vue 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/mock/modules/enterprise.js 124 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/mock/modules/regionType.js 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/axios.js 214 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/constant.js 65 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/tools.js 1044 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.idea/jsLinters/eslint.xml
New file
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="EslintConfiguration">
    <option name="fix-on-save" value="true" />
  </component>
</project>
src/api/enterprise.js
New file
@@ -0,0 +1,12 @@
import $http from '@/utils/axios'
let $HOST = ''
// 如果不是开发版本指定url地址
if (process.env.NODE_ENV !== 'development') {
  $HOST = process.env.VUE_APP_API_HOST
}
export const EnterpriseList = $HOST + '/enterprise/list'
export function listEnterprise (data) {
  return $http.get(EnterpriseList, data)
}
src/components/panel/TopEnterprisePanel.vue
@@ -1,6 +1,6 @@
<template>
  <div class="top-enterprise-panel">
    <el-form :inline="true" :model="formInline" ref="form" style="margin-left:5px">
    <el-form :inline="true" ref="form" style="margin-left:5px" size="mini">
      <el-form-item label="分类:">
        <el-select v-model="form.regionType" @change="handlePipelineType">
          <el-option
@@ -12,9 +12,9 @@
        </el-select>
      </el-form-item>
      <el-form-item label="企业名称:">
        <el-select v-model="form.pipelineType" @change="handlePipelineType">
        <el-select v-model="form.enterprise">
          <el-option
              v-for="item in pipelineTypeOptions"
              v-for="item in enterpriseOptions"
              :key="item.value"
              :label="item.label"
              :value="item.value">
@@ -22,7 +22,7 @@
        </el-select>
      </el-form-item>
      <el-form-item label="模糊搜索:">
        <el-input v-model="form.name" placeholder="在此输入载具号"></el-input>
        <el-input v-model="form.name" placeholder="请输入关键字搜索"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmit">查询</el-button>
@@ -32,6 +32,8 @@
</template>
<script>
import { listEnterprise } from '@/api/enterprise'
export default {
  name: 'TopEnterprisePanel',
  components: {},
@@ -79,7 +81,8 @@
        label: '茂名润滑油'
      }],
      form: {
        regionType: ''
        regionType: '',
        enterprise: ''
      }
    }
  },
@@ -90,15 +93,20 @@
    handleClick (tab, event) {
      console.log(tab, event)
    },
    handleSearch () {
    handlePipelineType (item) {
    },
    loadData () {
      listEnterprise({}).then((res) => {
        console.log(res)
      })
    },
    onSubmit () {
    }
  },
  mounted () {
    this.handleSearch()
    this.loadData()
  }
}
</script>
src/mock/modules/enterprise.js
New file
@@ -0,0 +1,124 @@
// modules/user.js
const listEnterprise = {
  url: '/enterprise/list',
  type: 'get',
  response: () => {
    return {
      code: 200,
      data: {
        1: [{
          value: '1',
          label: '金陵石化'
        }, {
          value: '2',
          label: '扬子石化(泰州)'
        }, {
          value: '3',
          label: '扬子石化(清江)'
        }, {
          value: '4',
          label: '长岭炼化'
        }, {
          value: '5',
          label: '仪征化纤'
        }, {
          value: '6',
          label: '南化公司'
        }, {
          value: '7',
          label: '荆门石化'
        }, {
          value: '8',
          label: '湖北化肥'
        }, {
          value: '9',
          label: '巴陵石化'
        }, {
          value: '10',
          label: '九江石化'
        }, {
          value: '11',
          label: '中韩石化(武汉)'
        }, {
          value: '12',
          label: '四川维尼纶'
        }, {
          value: '13',
          label: '上海润滑油公司'
        }, {
          value: '14',
          label: '荆门润滑油公司'
        }],
        2: [{
          value: '2',
          label: '洛阳石化'
        }, {
          value: '2',
          label: '中原石化'
        }],
        3: [{
          value: '1',
          label: '北海炼化'
        }, {
          value: '2',
          label: '茂名石化'
        }, {
          value: '3',
          label: '湛江东兴'
        }, {
          value: '4',
          label: '广州石化'
        }, {
          value: '5',
          label: '海南炼化'
        }, {
          value: '6',
          label: '茂名润滑油'
        }],
        4: [{
          value: '1',
          label: '天津石化'
        }, {
          value: '2',
          label: '济南炼化'
        }, {
          value: '3',
          label: '齐鲁石化'
        }],
        5: [{
          value: '1',
          label: '燕山石化'
        }],
        6: [{
          value: '1',
          label: '催化剂上海公司'
        }, {
          value: '2',
          label: '催化剂上海立得公司'
        }, {
          value: '3',
          label: '催化剂长岭公司'
        }, {
          value: '4',
          label: '催化剂南京公司'
        }, {
          value: '5',
          label: '催化剂齐鲁公司'
        }, {
          value: '6',
          label: '催化剂抚顺公司'
        }, {
          value: '7',
          label: '催化剂北京公司'
        }, {
          value: '8',
          label: '催化剂北京奥达公司'
        }]
      }
    }
  }
}
module.exports = [
  listEnterprise
]
src/mock/modules/regionType.js
New file
@@ -0,0 +1,32 @@
const listRegion = {
  url: '/region/list',
  type: 'get',
  response: () => {
    return {
      code: 200,
      data: [{
        value: '1',
        label: '长江流域'
      }, {
        value: '2',
        label: '黄河流域'
      }, {
        value: '3',
        label: '南部沿海水域'
      }, {
        value: '4',
        label: '环渤海水域'
      }, {
        value: '5',
        label: '其他地域'
      }, {
        value: '6',
        label: '催化剂公司'
      }]
    }
  }
}
module.exports = [
  listRegion
]
src/utils/axios.js
New file
@@ -0,0 +1,214 @@
import Vue from 'vue'
import axios from 'axios'
import * as $CONST from '@/utils/constant'
import * as $T from '@/utils/tools'
// import $store from '@/store'
/**
 * 定义传入参数数据格式
 *
 * === 删除数据 ===
 * {
 *    key:['dataId1','dataId2']
 * }
 *
 */
/**
 * 定义返回的json数据格式
 *
 * === 分页数据 ===
 * {
 *    code:200,            --- 目前框架认为0和200都是成功状态
 *    message:'按业务自定义',
 *    data:{
 *      records:[{...},{...}],   --- 可按自己业务替换属性
 *      total:xx,          --- 可按自己业务替换属性
 *      size:xx,           --- 可按自己业务替换属性
 *      current:xx,        --- 可按自己业务替换属性
 *      pages:xx           --- 可按自己业务替换属性
 *    },
 * }
 *
 * === 列表数据 ===
 *
 * {
 *    code:200,
 *    message:'按业务自定义',
 *    data:[{..},{..}...]
 * }
 *
 * === 一条数据 ===
 *
 * {
 *    code:200,
 *    message:'按业务自定义',
 *    data:{...}
 * }
 *
 * === 无返回数据 ===
 *
 * {
 *    code:200,
 *    message:'按业务自定义',
 *    data: null
 * }
 *
 * === 树形结构 ===
 *
 * {
 *    code:200,
 *    message:'按业务自定义'
 *    data:[{
 *      prop:xx,
 *      ...
 *      children: [
 *         prop:xx,
 *         ...
 *         children:[...]
 *      ]
 *    },
 *    {
 *      prop:xx,
 *      ...
 *      children: [
 *         prop:xx,
 *         ...
 *         children:[...]
 *      ]
 *    }]
 * }
 *
 */
// 创建axios实例
const Service = axios.create({
  timeout: 1000
})
const CancelToken = axios.CancelToken
/*
 function showDebugInfo(config) {
 console.group('%cMethod::' + config.method + '::Url::' + config.url, 'color:red;font-size:12px;')
 console.log('%c保存/更新/查看场合,传入的参数::', 'font-size:12px;')
 console.log(config.hasOwnProperty('params') ? JSON.stringify(config.params) : JSON.stringify(config.data))
 console.groupEnd()
 }
 function filterOauthData(config) {
 let url = config.url
 if (config.method === 'post' && $t.isExistOauthApi(url)) {
 // post请求的场合下,追加角色名称
 }
 if (config.method === 'get' && $t.isExistOauthApi(url)) {
 // get请求的场合下,追加角色名称
 if (config.hasOwnProperty('params')) {
 config.params['userCode'] = ''
 } else {
 config['params'] = {}
 config.params['userCode'] = ''
 }
 }
 return config
 } */
// request拦截器
Service.interceptors.request.use(
  config => {
  // 临时追加
  //   if ($store.state.user.account) {
  //     config.headers.account = $store.state.user.account
  //   }
    const copyConfig = Object.assign({}, config)
    // copyConfig = filterOauthData(copyConfig)
    // showDebugInfo(copyConfig)
    copyConfig.cancelToken = new CancelToken((c) => {
      // 页面失效场景,取消padding中请求
      Vue.prototype.$cancels.push(c)
      // todo 快速双击取消重复请求
      // 重复请求场景,取消掉上一个未padding中请求
    })
    return copyConfig
  },
  error => {
    Promise.reject(error)
  })
// respone拦截器
Service.interceptors.response.use(
  response => {
    const res = response.data
    if (Number(res.code) !== 200 && Number(res.code) !== 0) {
      $T.warning(res.message)
      return Promise.reject(res.message)
    } else {
      return res
    }
  },
  error => {
    if (error.message && error.message.includes('timeout')) {
      $T.fail($CONST.MSG_SYS_TIME_OUT)
      return Promise.reject(error)
    }
    if (!error.response) {
      $T.fail($CONST.MSG_SYS_ERR)
      return Promise.reject(error)
    }
    switch (error.response.status) {
      // http status handler
      case 404:
        $T.fail($CONST.MSG_SYS_404)
        break
      case 500:
        $T.fail($CONST.MSG_SYS_ERR)
        break
      case 503:
        $T.fail($CONST.MSG_SYS_503)
        break
    }
    return Promise.reject(error)
  }
)
const $http = {}
$http.$service = Service
$http.$axios = axios
$http.get = function (url, params = {}) {
  if ($T.isInlineParams(url)) {
    // 严格遵循restful标准的url的场景
    url = $T.replaceUrlParams(url, params)
    params = {}
  }
  return Service({
    url: url,
    method: 'get',
    params: $T.filterParams(params)
  })
}
$http.post = function (url, data = {}) {
  return Service({
    url: url,
    method: 'post',
    data: data
  })
}
$http.put = function (url, data = {}) {
  return Service({
    url: url,
    method: 'put',
    data: data
  })
}
$http.delete = function (url, data = {}) {
  return Service({
    url: url,
    method: 'delete',
    data: data
  })
}
export default $http
src/utils/constant.js
New file
@@ -0,0 +1,65 @@
/* 日期设置
 -------------------------- */
export const PICKER_OPTIONS_SHORTCUTS = [
  {
    text: '今天',
    onClick (picker) {
      const end = new Date()
      const start = new Date(new Date().toDateString())
      end.setTime(start.getTime())
      picker.$emit('pick', [start, end])
    }
  }, {
    text: '最近一周',
    onClick (picker) {
      const end = new Date(new Date().toDateString())
      const start = new Date()
      start.setTime(end.getTime() - 3600 * 1000 * 24 * 7)
      picker.$emit('pick', [start, end])
    }
  }, {
    text: '最近一个月',
    onClick (picker) {
      const end = new Date(new Date().toDateString())
      const start = new Date()
      start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
      picker.$emit('pick', [start, end])
    }
  }, {
    text: '最近三个月',
    onClick (picker) {
      const end = new Date(new Date().toDateString())
      const start = new Date()
      start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
      picker.$emit('pick', [start, end])
    }
  }]
/* 系统错误消息
 -------------------------- */
export const MSG_SYS_ERR = '服务器内部运行错误,请稍后重试!'
export const MSG_SYS_TIME_OUT = '当前网络环境较差,访问超时,请刷新重试!'
export const MSG_SYS_404 = '请求的资源不存在!'
export const MSG_SYS_503 = '服务器正在维护,请稍等!'
export const MSG_SYS_SUCCESS = '操作成功!'
export const MSG_SYS_FAIL = '操作失败!'
export const MSG_SYS_CANCELED = '操作已取消!'
export const MSG_SYS_WARNING = '警告,未按规则操作!'
export const MSG_RULES_NUMBER = '必须为数字值!'
export const MSG_RULES_REQUIRED = '不能为空!'
export const MSG_BUSINESS_DELETE = '删除该数据, 是否继续?'
export const MSG_BUSINESS_SUBMIT = '提交该数据, 是否继续?'
export const MSG_BUSINESS_SELECTED = '请选择要操作的数据!'
export const MSG_BUSINESS_START = '启用该数据, 是否继续?'
export const MSG_BUSINESS_STOP = '停用该数据, 是否继续?'
export const MSG_BUSINESS_IMPORT = '请耐心等待,数据导入中...'
export const MSG_BUSINESS_EXPORT = '请耐心等待,数据导出中...'
export const MSG_BUSINESS_EXPORT_ALL = '导出条件筛选出的全部数据'
export const MSG_BUSINESS_UPLOAD = '请耐心等待,文件上传中...'
export const MSG_BUSINESS_UPLOAD_SUCCESS = '上传成功!'
export const MSG_BUSINESS_UPLOAD_FAIL = '上传失败!'
export const MSG_BUSINESS_UPLOAD_IMG = '上传图片只能是 JPG/PNG 格式!'
export const MSG_BUSINESS_UPLOAD_SIZE_2M = '上传图片大小不能超过 2MB!'
export const MSG_BUSINESS_UPLOAD_SIZE_10M = '上传图片大小不能超过 10MB!'
src/utils/tools.js
New file
@@ -0,0 +1,1044 @@
import * as $CONST from './constant'
// import { notify } from '@nutui/nutui'
export const _ = require('lodash')
const notify = window.vm.$notify
/**
 * 集合转换为JSON
 * @param obj collection数据
 * @author TJ 2019/03/11
 * @example 略
 */
export function collectionToJson (collection) {
  if (!_.isArray(collection)) return []
  const arr = []
  // 数据体
  _.forEach(collection, function (item) {
    const tempObj = {}
    if (Object.prototype.hasOwnProperty.call(item, 'data') && _.isArray(item.data)) {
      _.forEach(item.data, function (obj) {
        tempObj[_.trim(obj.name)] = _.trim(obj.value)
      })
    }
    arr.push(tempObj)
  })
  return arr
}
/**
 * collection数据转换为标准JSON
 * @param obj collection数据
 * @author TJ 2019/03/11
 * @example 略
 */
export function transformStandardJson (obj) {
  let body = {}
  let data = null
  let pages = null
  const collection = obj.collection
  if (_.isObject(collection)) {
    // 错误的场景
    if (Object.prototype.hasOwnProperty.call(collection, 'items')) {
      return {
        code: 300,
        body: null,
        msg: collection.error
      }
    }
    // 数据体
    if (Object.prototype.hasOwnProperty.call(collection, 'items') && _.isArray(collection.items)) {
      data = collectionToJson(collection.items)
    }
    // 分页信息
    if (Object.prototype.hasOwnProperty.call(collection, 'page') && _.isArray(collection.data)) {
      pages = collectionToJson([collection.page])
    }
    // 组装body数据
    body = {
      data: data
    }
    if (pages) {
      _.extend(body, {
        total: pages[0].totalElements,
        pageIndex: 0,
        pageSize: pages[0].size,
        pages: pages[0].totalPages
      })
    }
    return {
      code: 200,
      body: body,
      msg: '操作成功'
    }
  }
}
/**
 * POST PUT等请求参数转换成集合
 * @param json object
 * @returns collection
 * @author TJ 2019/03/11
 * @example 略
 */
export function transformParams (obj) {
  const collection = {
    version: '1.0',
    href: '',
    items: [],
    templates: []
  }
  if (_.isObject(obj)) {
    const arr = []
    _.each(obj, function (val, key) {
      let newVal = val
      if (_.isArray(val)) {
        newVal = val.join(',')
      }
      arr.push({
        name: key,
        value: newVal
      })
    })
    const o = {
      data: arr
    }
    collection.templates.push(o)
  }
  return {
    collection: collection
  }
}
/**
 * 将内容存储到sessionStorage
 * @param key {string} key
 * @param content {Object} 存储json对象
 * @author TJ 2018/05/28
 * @example 略
 */
export function setSessionStorage (key, content) {
  if (!key) return false
  const jsonContent = JSON.stringify(content)
  jsonContent ? sessionStorage.setItem(key, jsonContent) : sessionStorage.setItem(key, content)
}
/**
 * 获取存储到sessionStorage的内容
 * @param key {string} key
 * @return {object} 返回json对象
 * @author TJ 2018/05/28
 * @example 略
 */
export function getSessionStorage (key) {
  const item = sessionStorage.getItem(key)
  if (!item) return false
  const result = JSON.parse(sessionStorage.getItem(key))
  return result || item
}
/**
 * 删除存储到sessionStorage的内容
 * @param key {string} key
 * @author TJ 2018/05/28
 * @example 略
 */
export function removeSessionStorage (key) {
  sessionStorage.removeItem(key)
}
/**
 * 将内容存储到localStorage
 * @param key {string} key
 * @param content {Object} 存储json对象
 * @author TJ 2018/05/28
 * @example 略
 */
export function setLocalStorage (key, content) {
  if (!key) return false
  const jsonContent = JSON.stringify(content)
  jsonContent ? localStorage.setItem(key, jsonContent) : localStorage.setItem(key, content)
}
/**
 * 获取存储到localStorage的内容
 * @param key {string} key
 * @return {object} 返回json对象
 * @author TJ 2018/05/28
 * @example 略
 */
export function getLocalStorage (key) {
  const item = localStorage.getItem(key)
  if (!item) return false
  const result = JSON.parse(localStorage.getItem(key))
  return result || item
}
/**
 * localStorage
 * @param key {string} key
 * @author TJ 2018/05/28
 * @example 略
 */
export function removeLocalStorage (key) {
  localStorage.removeItem(key)
}
/**
 * 判断json对象是否为空对象
 * @param obj {object} json对象
 * @return {boolean} 空对象返回 true 否则返回 false
 * @author TJ 2018/05/28
 * @example 略
 */
export function isEmptyObject (obj) {
  if (obj === null) return true
  return Object.keys(obj).length === 0
}
/**
 * 过滤参数
 * @param params {object} 需要格式化的时间
 * @return {object} 格式化后的时间
 * @author TJ 2017/05/28
 * @example 略
 */
export function filterParams (params) {
  if (!_.isObject(params)) {
    return params
  }
  const newParams = {}
  _.each(params, function (v, k) {
    // 过滤掉条件是空的项
    if (typeof v === 'string' && (v.length === 0 || v === '*全*部*')) {
    } else {
      newParams[k] = v
    }
  })
  return newParams
}
/**
 * 将null转换为空对象
 * @param params {obj}
 * @author TJ 2018/05/31
 */
export function emptyObjectWrapper (obj) {
  return obj === null ? {} : obj
}
/**
 * 格式化时间
 * @param time {string} 需要格式化的时间
 * @param cFormat {string} 时间格式
 * @return {string} 格式化后的时间
 * @author TJ 2017/07/21
 * @example 略
 */
export function parseTime (time, cFormat) {
  if (!time) return false
  if (arguments.length === 0) {
    return false
  }
  const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'
  let date
  if (typeof time === 'object') {
    date = time
  } else {
    if (('' + time).length === 10) time = parseInt(time) * 1000
    if (('' + time).length === 8 && ('' + time).indexOf('-') === -1 && ('' + time).indexOf('/') === -1) {
      time = time.substring(0, 4) + '-' + time.substring(4, 6) + '-' + time.substring(6, 8)
    }
    date = new Date(time)
  }
  const formatObj = {
    y: date.getFullYear(),
    m: date.getMonth() + 1,
    d: date.getDate(),
    h: date.getHours(),
    i: date.getMinutes(),
    s: date.getSeconds(),
    a: date.getDay()
  }
  const timeStr = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
    let value = formatObj[key]
    if (key === 'a') return ['一', '二', '三', '四', '五', '六', '日'][value - 1]
    if (result.length > 0 && value < 10) {
      value = '0' + value
    }
    return value || 0
  })
  return timeStr
}
/**
 * 将时间数组分割成开始时间和结束时间
 * @param time {array}
 * @return {object}
 * @author TJ 2017/08/01
 * @example 略
 */
export function formatTime (time) {
  if (Array.isArray(time)) {
    if (!time[0] || !time[1]) return false
    var start = parseTime(time[0], '{y}-{m}-{d}')
    var end = parseTime(time[1], '{y}-{m}-{d}')
    return {
      start: start,
      end: end
    }
  }
  return false
}
/**
 * 权限API拼接用户名
 * @param api {String}
 * @return {boolean}
 * @author TJ 2017/08/01
 * @example 略
 */
export function getJoinOauthApi (url) {
  const name = window._loginName ? window._loginName : ''
  if (url.includes('?')) {
    url += '&createId=' + name
  } else {
    url += 'createId=' + name
  }
  return url
}
/**
 * 拼接查询URL
 * @param url {String}
 * @param obj {obj}
 * @return {String}
 * @author TJ 2017/08/01
 * @example 略
 */
export function joinQueryUrl (url, obj) {
  let str = ''
  let fullUrl = ''
  for (const key in obj) {
    if (!Object.prototype.hasOwnProperty.call(obj, key)) return
    if (str) {
      str += '&'
    }
    str += key + '=' + obj[key]
  }
  if (url.includes('?')) {
    fullUrl = url + '&' + str
  } else {
    fullUrl = url + '?' + str
  }
  return fullUrl
}
/**
 * 判断参数是否嵌入在url中
 * @param url {String}
 * @return {Boolean}
 * @author TJ 2018/08/27
 */
export function isInlineParams (url) {
  const splitChar = '{$'
  if (url && url.indexOf(splitChar) > -1) {
    return true
  } else {
    return false
  }
}
/**
 * 替换url里的参数
 * @param url {String}
 * @param params {obj}
 * @author TJ 2018/05/31
 */
export function replaceUrlParams (url, params) {
  if (url) {
    if (!isInlineParams(url)) {
      return url
    }
    // 正则匹配{},生成数组
    const patt = /\{.*?\}/g
    const arr = url.match(patt) ? url.match(patt) : []
    arr.forEach(function (item) {
      const key = item.replace('{', '').replace('}', '').replace('$', '')
      url = url.replace(item, params[key])
    })
  }
  return url
}
/**
 * 配置Echart主题颜色
 * @param {obj} echart 实例
 * @author TJ 2017/10/17
 * @return 无返回结果
 */
export function resgisterTheme (echart) {
  /* eslint-disable */
  let theme = {
    'color': [
      '#29d0b0',
      '#2d99ed',
      '#fd8667',
      '#72ccff',
      '#f7c5a0',
      '#d4a4eb',
      '#fdc547',
      '#76f2f2',
      '#da4d00',
      '#b0419e'
    ],
    'backgroundColor': 'transparents',
    'textStyle': {
      'itemStyle': {
        'normal': {
          'color': '#fff'
        }
      }
    },
    'title': {
      'textStyle': {
        'color': '#ffffff'
      },
      'subtextStyle': {
        'color': '#dddddd'
      }
    },
    'line': {
      'itemStyle': {
        'normal': {
          'borderWidth': '1'
        }
      },
      'lineStyle': {
        'normal': {
          'width': '1'
        }
      },
      'symbolSize': '4',
      'symbol': 'circle',
      'smooth': false
    },
    'radar': {
      'itemStyle': {
        'normal': {
          'borderWidth': '4'
        }
      },
      'lineStyle': {
        'normal': {
          'width': '3'
        }
      },
      'symbolSize': '1',
      'symbol': 'circle',
      'smooth': true
    },
    'bar': {
      'itemStyle': {
        'normal': {
          'barBorderWidth': 0,
          'barBorderColor': '#ccc'
        },
        'emphasis': {
          'barBorderWidth': 0,
          'barBorderColor': '#ccc'
        }
      }
    },
    'pie': {
      'itemStyle': {
        'normal': {
          'borderWidth': 0,
          'borderColor': '#ccc'
        },
        'emphasis': {
          'borderWidth': 0,
          'borderColor': '#ccc'
        }
      }
    },
    'scatter': {
      'itemStyle': {
        'normal': {
          'borderWidth': 0,
          'borderColor': '#ccc'
        },
        'emphasis': {
          'borderWidth': 0,
          'borderColor': '#ccc'
        }
      }
    },
    'boxplot': {
      'itemStyle': {
        'normal': {
          'borderWidth': 0,
          'borderColor': '#ccc'
        },
        'emphasis': {
          'borderWidth': 0,
          'borderColor': '#ccc'
        }
      }
    },
    'parallel': {
      'itemStyle': {
        'normal': {
          'borderWidth': 0,
          'borderColor': '#ccc'
        },
        'emphasis': {
          'borderWidth': 0,
          'borderColor': '#ccc'
        }
      }
    },
    'sankey': {
      'itemStyle': {
        'normal': {
          'borderWidth': 0,
          'borderColor': '#ccc'
        },
        'emphasis': {
          'borderWidth': 0,
          'borderColor': '#ccc'
        }
      }
    },
    'funnel': {
      'itemStyle': {
        'normal': {
          'borderWidth': 0,
          'borderColor': '#ccc'
        },
        'emphasis': {
          'borderWidth': 0,
          'borderColor': '#ccc'
        }
      }
    },
    'gauge': {
      'itemStyle': {
        'normal': {
          'borderWidth': 1,
          'borderColor': '#fff'
        },
        'emphasis': {
          'borderWidth': 1,
          'borderColor': '#fff'
        }
      }
    },
    'candlestick': {
      'itemStyle': {
        'normal': {
          'color': '#fc97af',
          'color0': 'transparent',
          'borderColor': '#fc97af',
          'borderColor0': '#87f7cf',
          'borderWidth': '2'
        }
      }
    },
    'graph': {
      'itemStyle': {
        'normal': {
          'borderWidth': 0,
          'borderColor': '#ccc'
        }
      },
      'lineStyle': {
        'normal': {
          'width': '1',
          'color': '#ffffff'
        }
      },
      'symbolSize': '5',
      'symbol': 'circle',
      'smooth': true,
      'color': [
        '#29d0b0',
        '#2d99ed',
        '#fd8667',
        '#72ccff',
        '#f7c5a0',
        '#d4a4eb',
        '#fdc547',
        '#76f2f2',
        '#da4d00',
        '#b0419e'
      ],
      'label': {
        'normal': {
          'textStyle': {
            'color': '#293441'
          }
        }
      }
    },
    'map': {
      'itemStyle': {
        'normal': {
          'areaColor': '#f3f3f3',
          'borderColor': '#999999',
          'borderWidth': 0.5
        },
        'emphasis': {
          'areaColor': 'rgba(255,178,72,1)',
          'borderColor': '#eb8146',
          'borderWidth': 1
        }
      },
      'label': {
        'normal': {
          'textStyle': {
            'color': '#893448'
          }
        },
        'emphasis': {
          'textStyle': {
            'color': 'rgb(137,52,72)'
          }
        }
      }
    },
    'geo': {
      'itemStyle': {
        'normal': {
          'areaColor': '#f3f3f3',
          'borderColor': '#999999',
          'borderWidth': 0.5
        },
        'emphasis': {
          'areaColor': 'rgba(255,178,72,1)',
          'borderColor': '#eb8146',
          'borderWidth': 1
        }
      },
      'label': {
        'normal': {
          'textStyle': {
            'color': '#893448'
          }
        },
        'emphasis': {
          'textStyle': {
            'color': 'rgb(137,52,72)'
          }
        }
      }
    },
    'categoryAxis': {
      'axisLine': {
        'show': true,
        'lineStyle': {
          'color': '#fff'
        }
      },
      'axisTick': {
        'show': false,
        'lineStyle': {
          'color': '#fff'
        }
      },
      'axisLabel': {
        'show': true,
        'textStyle': {
          'color': '#fff'
        }
      },
      'splitLine': {
        'show': false,
        'lineStyle': {
          'color': [
            '#e6e6e6'
          ]
        }
      },
      'splitArea': {
        'show': false,
        'areaStyle': {
          'color': [
            'rgba(250,250,250,0.05)',
            'rgba(200,200,200,0.02)'
          ]
        }
      }
    },
    'valueAxis': {
      'axisLine': {
        'show': true,
        'lineStyle': {
          'color': '#fff'
        }
      },
      'axisTick': {
        'show': false,
        'lineStyle': {
          'color': '#fff'
        }
      },
      'axisLabel': {
        'show': true,
        'textStyle': {
          'color': '#fff'
        }
      },
      'splitLine': {
        'show': false,
        'lineStyle': {
          'color': [
            '#e6e6e6'
          ]
        }
      },
      'splitArea': {
        'show': false,
        'areaStyle': {
          'color': [
            'rgba(250,250,250,0.05)',
            'rgba(200,200,200,0.02)'
          ]
        }
      }
    },
    'logAxis': {
      'axisLine': {
        'show': true,
        'lineStyle': {
          'color': '#fff'
        }
      },
      'axisTick': {
        'show': false,
        'lineStyle': {
          'color': '#333'
        }
      },
      'axisLabel': {
        'show': true,
        'textStyle': {
          'color': '#fff'
        }
      },
      'splitLine': {
        'show': false,
        'lineStyle': {
          'color': [
            '#e6e6e6'
          ]
        }
      },
      'splitArea': {
        'show': false,
        'areaStyle': {
          'color': [
            'rgba(250,250,250,0.05)',
            'rgba(200,200,200,0.02)'
          ]
        }
      }
    },
    'timeAxis': {
      'axisLine': {
        'show': true,
        'lineStyle': {
          'color': '#fff'
        }
      },
      'axisTick': {
        'show': false,
        'lineStyle': {
          'color': '#fff'
        }
      },
      'axisLabel': {
        'show': true,
        'textStyle': {
          'color': '#fff'
        }
      },
      'splitLine': {
        'show': false,
        'lineStyle': {
          'color': [
            '#fff'
          ]
        }
      },
      'splitArea': {
        'show': false,
        'areaStyle': {
          'color': [
            'rgba(250,250,250,0.05)',
            'rgba(200,200,200,0.02)'
          ]
        }
      }
    },
    'toolbox': {
      'iconStyle': {
        'normal': {
          'borderColor': '#999999'
        },
        'emphasis': {
          'borderColor': '#666666'
        }
      }
    },
    'legend': {
      'textStyle': {
        'color': '#e0e0e0'
      }
    },
    'tooltip': {
      'axisPointer': {
        'lineStyle': {
          'color': '#cccccc',
          'width': 1
        },
        'crossStyle': {
          'color': '#cccccc',
          'width': 1
        }
      }
    },
    'timeline': {
      'lineStyle': {
        'color': '#87f7cf',
        'width': 1
      },
      'itemStyle': {
        'normal': {
          'color': '#87f7cf',
          'borderWidth': 1
        },
        'emphasis': {
          'color': '#f7f494'
        }
      },
      'controlStyle': {
        'normal': {
          'color': '#87f7cf',
          'borderColor': '#87f7cf',
          'borderWidth': 0.5
        },
        'emphasis': {
          'color': '#87f7cf',
          'borderColor': '#87f7cf',
          'borderWidth': 0.5
        }
      },
      'checkpointStyle': {
        'color': '#fc97af',
        'borderColor': 'rgba(252,151,175,0.3)'
      },
      'label': {
        'normal': {
          'textStyle': {
            'color': '#87f7cf'
          }
        },
        'emphasis': {
          'textStyle': {
            'color': '#87f7cf'
          }
        }
      }
    },
    'visualMap': {
      'color': [
        '#fc97af',
        '#87f7cf'
      ]
    },
    'dataZoom': {
      'backgroundColor': 'rgba(255,255,255,0)',
      'dataBackgroundColor': 'rgba(114,204,255,1)',
      'fillerColor': 'rgba(114,204,255,0.2)',
      'handleColor': '#72ccff',
      'handleSize': '100%',
      'textStyle': {
        'color': '#fff'
      }
    },
    'markPoint': {
      'label': {
        'normal': {
          'textStyle': {
            'color': '#293441'
          }
        },
        'emphasis': {
          'textStyle': {
            'color': '#293441'
          }
        }
      }
    }
  }
  echart.registerTheme('dark', theme)
  /* eslint-enable */
}
/**
 * 根据路由切换皮肤标识,默认皮肤未蓝色
 * @author TJ 2019/05/29
 */
export function changeThemeClass (toRouterName) {
  const darkSkinRouterName = []
  if (darkSkinRouterName.includes(toRouterName)) {
    document.body.className = 'dark'
  } else {
    document.body.className = 'blue'
  }
}
/**
 * 判断要查询的数组是否至少有一个元素包含在目标数组中
 * @param {Array} target 目标数组
 * @param {Array} arr 需要查询的数组
 */
export const hasOneOf = (targetarr, arr) => {
  return targetarr.some(_ => arr.indexOf(_) > -1)
}
/**
 * 判断两个对象是否相等,这两个对象的值只能是数字或字符串
 * @param {Object} obj1 对象
 * @param {Object} obj2 对象
 */
export const objEqual = (obj1, obj2) => {
  const keysArr1 = Object.keys(obj1)
  const keysArr2 = Object.keys(obj2)
  if (keysArr1.length !== keysArr2.length) return false
  else if (keysArr1.length === 0 && keysArr2.length === 0) return true
  /* eslint-disable-next-line */
  else return !keysArr1.some(key => obj1[key] != obj2[key])
}
/**
 * 判断值是否为真,不包括对0的判断
 * @param {String} val 字符
 */
export function isTrue (val) {
  return !_.isNull(val) && !_.isUndefined(val) && val !== ''
}
/**
 * 解析URL参数
 *
 * @param {String} url
 * @return {object}
 */
export function getQueryObject (url = window.location.href) {
  if (!url) return
  const search = url.substring(url.lastIndexOf('?') + 1)
  const obj = {}
  const reg = /([^?&=]+)=([^?&=]*)/g
  search.replace(reg, function (rs, $1, $2) {
    const name = decodeURIComponent($1)
    let val = decodeURIComponent($2)
    val = String(val)
    obj[name] = val
    // return rs
  })
  return obj
}
/**
 * 递归查询树节点
 *
 * @param {object} treeData 树结构数据集合
 * @param {string} prop 属性字段
 * @param {string} propValue 属性对应的值
 * @return {object} 节点对象
 */
export function recursion (tree, prop, propValue) {
  if (!tree || !Array.isArray(tree)) return false
  let result = {}
  function handelTree (tree) {
    for (const o of tree) {
      if (o.children && Array.isArray(o.children) && o.children.length) {
        if (o[prop] !== propValue) {
          // 递归
          handelTree(o.children)
        } else {
          result = o
          break
        }
      } else {
        if (o[prop] === propValue) {
          result = o
        }
      }
    }
    return result
  }
  return handelTree(tree)
}
export function success (msg = $CONST.MSG_SYS_SUCCESS) {
  notify.success(msg)
}
export function fail (msg = $CONST.MSG_SYS_FAIL) {
  notify.warn(msg)
}
export function error (msg = $CONST.MSG_SYS_ERR) {
  notify.danger(msg)
}
export function warning (msg = $CONST.MSG_SYS_WARNING) {
  notify.warn(msg)
}
export function info (msg = $CONST.MSG_SYS_CANCELED) {
  notify.primary(msg)
}
/**
 * 异步加载组件
 * @author TJ 2019/05/30
 */
/* eslint-disable */
export function lazyLoadView(AsyncView) {
  const AsyncComponent = () => ({
    // 需要加载的组件 (应该是一个 `Promise` 对象)
    component: AsyncView,
    // 异步组件加载时使用的组件
    loading: '',
    // 加载失败时使用的组件
    error: '',
    // 展示加载时组件的延时时间。默认值是 200 (毫秒)
    delay: 200,
    // 如果提供了超时时间且组件加载也超时了,
    // 则使用加载失败时使用的组件。默认值是:`Infinity`
    timeout: 3000
  })
  return Promise.resolve({
    functional: true,
    render(h, { data, children }) {
      // Transparently pass any props or children
      // to the view component.
      return h(AsyncComponent, data, children)
    }
  })
}