import Vue from 'vue' import Element from 'element-ui' import '../styles/element-variables.scss' import enLang from 'element-ui/lib/locale/lang/zh-CN' // 如果使用中文语言包请默认支持,无需额外引入,请删除该依赖 import Cookies from 'js-cookie' //Cookies import * as eCharts from 'echarts' //echarts import Plugin from 'v-fit-columns' //table自适应宽高 import AFTableColumn from 'af-table-column' import '../icons' // icon import '../permission' // permission control import '../utils/error-log' // error log import { default as staticOptions } from '@/filters/statusType' // 全局静态变量 Vue.prototype.$staticOptions = staticOptions import * as isTableColumns from "@/utils/tableColumns/index" //全局table表头 Vue.prototype.$isTableColumns = isTableColumns import * as isDetailsTableColumns from "@/utils/detailsTableColumns/index" //全局table表头 Vue.prototype.$isDetailsTableColumns = isDetailsTableColumns import * as isSummaryTableColumns from "@/utils/summaryTableColumns/index" //全局table表头——汇总 Vue.prototype.$isSummaryTableColumns = isSummaryTableColumns import * as isTabsDesTions from "@/utils/tabsDesTions/index" //全局table表头——汇总 Vue.prototype.$isTabsDesTions = isTabsDesTions import * as isQuicklySearchOption from "@/utils/quicklySearchOption/index" //主表查询-快速搜索数据配置 Vue.prototype.$isQuicklySearchOption = isQuicklySearchOption import * as isPrimarySearchOption from "@/utils/primarySearchOption/index" //主表查询-初级搜索数据配置 Vue.prototype.$isPrimarySearchOption = isPrimarySearchOption //axios序列化插件 import qs from 'qs' Vue.prototype.$qs = qs import currenForm from "@/components/currenForm"; //form表单 import currenDrawer from "@/components/commonTabel-drawer"; //抽屉 import currenButton from "@/components/currenButton" //按钮 import currenTable from "@/components/currenTable" //table import tablePagination from "@/components/tablePagination"; //第一视图集成 import importFile from "@/components/importFile" //导出 import pagination from "@/components/Pagination" //分页器 import conditionFilters from "@/components/conditionFilters" //高级筛选 import searchPage from '@/components/searchPage' //autocomplete拉取数据探弹窗 import newAndEdiDialog from '@/components/newAndEdiDialog' //普通新增与编辑 import stepsForm from '@/components/StepsForm' //步骤新增 import handelFrom from '@/components/handelFrom' //执行表单 import umyTable from '@/components/umyTable' // 用于数据量过大table // Mixins // import { tableMixins } from "@/mixins/TableMixins" // import { LoadingMixins } from "@/mixins/LoadingMixins" // import { drawerMixins } from "@/mixins/drawerMixins" // import { TableHeaderMixins } from "@/mixins/TableHeaderMixins" // import { mixins } from "@/mixins/mixins" // 注册全局MIxins // Vue.mixin(tableMixins) // Vue.mixin(LoadingMixins) // Vue.mixin(drawerMixins) // Vue.mixin(TableHeaderMixins) // Vue.mixin(mixins) // Vue.mixin(autoCompleteSelectMixins) const fontRate = { CHAR_RATE: 1.0, // 汉字比率 NUM_RATE: 0.65, // 数字 OTHER_RATE: 0.8 // 除汉字和数字以外的字符的比率 } const fontSize = 20 Vue.use(Plugin) Vue.use(AFTableColumn, { fontRate, fontSize }) // Element引用 Vue.use(Element, { size: Cookies.get('size') || 'medium', // set element-ui default size locale: enLang // 如果使用中文,无需设置,请删除 }) Element.Dialog.props.closeOnClickModal.default = false Element.Dialog.props.closeOnPressEscape.default = false Element.Dialog.props.showClose.default = false // 注册成为全局的组件 Vue.component('currenForm', currenForm) Vue.component('currenDrawer', currenDrawer) Vue.component('currenButton', currenButton) Vue.component('currenTable', currenTable) Vue.component('tablePagination', tablePagination) Vue.component('importFile', importFile) Vue.component('pagination', pagination) Vue.component('conditionFilters', conditionFilters) Vue.component('searchPage', searchPage) Vue.component('newAndEdiDialog', newAndEdiDialog) Vue.component('stepsForm', stepsForm) Vue.component('handelFrom', handelFrom) Vue.component('umyTable', umyTable) Vue.prototype.$echarts = eCharts Vue.prototype.$isMobile = navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i) Vue.prototype.$isAndroid = navigator.userAgent.indexOf('Android') > -1 || navigator.userAgent.indexOf('Adr') > -1 Vue.prototype.$successMsg = function (message = '') { this.$message({ message, type: 'success', duration: 5000 }) } Vue.prototype.$errorMsg = function (message = '') { this.$message({ message, type: 'error', duration: 5000 }) } Vue.prototype.$warningMsg = function (message = '') { this.$message({ message, type: 'warning', duration: 5000 }) } Vue.prototype.$showConfirmDialog = function (message = '') { return this.$confirm(message, '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }) } Vue.prototype.publishEvent = function (eventName, payload) { if (!eventName) return const fun = this[eventName] fun && fun(payload) } Vue.prototype.registeEvent = function (events) { for (const item in events) { const handle = events[item] if (handle instanceof Function) { this[item] = handle.bind(this) } } } Vue.prototype.isInited = function (prop) { return this[prop] && this[prop].init } Vue.prototype.$listAssign = function (arrA, arrB) { Object.keys(arrA).forEach(key => { arrA[key] = arrB[key] || arrA[key] }) } Vue.prototype.$CopeListAssign = function (arrA, arrB) { Object.keys(arrA).forEach(key => { arrA[key] = arrB[key] }) }