qa-regulatory-gwj-vue/src/main.js

122 lines
2.9 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import Cookies from 'js-cookie'
import App from './App'
import store from './store'
import router from './router'
import './asyncRouter'
import './icons' // icon
import BaiduMap from 'vue-baidu-map'
import Element from 'element-ui'
import './styles/element-variables.scss'
import 'animate.css'
Element.Dialog.props.closeOnClickModal.default = false // 禁用遮罩关闭
import VueParticles from 'vue-particles'
Vue.use(VueParticles)
import Viewer from 'v-viewer'
import 'viewerjs/dist/viewer.css'
Vue.use(Viewer, {
defaultOptions: {
zIndex: 9999// 解决图片放大的层级问题
}})
Vue.use(Viewer)
Viewer.setDefaults({
Options: {
'inline': true,
'button': true,
'navbar': true,
'title': true,
'toolbar': true,
'tooltip': true,
'movable': true,
'zoomable': true,
'rotatable': true,
'scalable': true,
'transition': true,
'fullscreen': true,
'keyboard': true,
'url': 'data-source'
}
})
Vue.use(BaiduMap, {
ak: 'OElqFYoKiAH8KFtph8ftLKF5NlNrbCUr'
})
import Print from 'vue-print-nb'// 打印
Vue.use(Print) // 注册
import '@/styles/index.scss' // global css
Vue.config.productionTip = false
Vue.use(Element, {
size: Cookies.get('size') || 'small' // set element-ui default size
})
/*
* 字符串非空验证
* @param {str} 字符串数据
* @return boolean 有值true无值false
*/
Vue.prototype.validStr = function(str) {
if (str != null && str != '' && typeof (str) != 'undefined' && str != 'undefined' && str != 0) { return true }
return false
}
/*
* json格式转树状结构
* @param {json} json数据
* @param {String} id的字符串
* @param {String} 父id的字符串
* @param {String} children的字符串
* @return {Array} 数组
*/
Vue.prototype.listTransTree = function(json, idStr, pidStr, chindrenStr) {
// eslint-disable-next-line one-var
var r = [], hash = {}, id = idStr, pid = pidStr, children = chindrenStr, i = 0, j = 0, len = json.length
for (; i < len; i++) {
hash[json[i][id]] = json[i]
}
for (; j < len; j++) {
// eslint-disable-next-line one-var
var aVal = json[j], hashVP = hash[aVal[pid]]
if (hashVP) {
!hashVP[children] && (hashVP[children] = [])
hashVP[children].push(aVal)
} else {
r.push(aVal)
}
}
return r
}
// 树数据结构去除空子级
Vue.prototype.removeEmptyChildren = function(data) {
for (let i = 0; i < data.length; i++) {
if (data[i].nodes && data[i].nodes.length > 0) {
this.removeEmptyChildren(data[i].nodes)
} else {
delete data[i].nodes
}
}
return data
}
// vue手写签名
import vueEsign from 'vue-esign'
Vue.use(vueEsign)
/* eslint-disable no-new */
new Vue({
el: '#app',
router,
store,
components: { App },
template: '<App/>'
})