import 'babel-polyfill' import Vue from 'vue' import App from './App.vue' import store from './store' import router from './router/router' import '@/assets/css/element-custom.scss' import ElementUI from 'element-ui' import i18n from '@/lang/index.js' import moment from 'moment' //日期格式化插件 import JsonExcel from 'vue-json-excel' // 导出excle var $ = require("jquery") Vue.component('downloadExcel', JsonExcel) // 瀑布流 import {VueMasonryPlugin} from 'vue-masonry' Vue.use(VueMasonryPlugin) // 富文本编辑器 import quillEditor from 'vue-quill-editor' import 'quill/dist/quill.core.css' import 'quill/dist/quill.snow.css' import 'quill/dist/quill.bubble.css' import * as Quill from 'quill' // 引入编辑器 import {ImageDrop} from 'quill-image-drop-module' import ImageResize from 'quill-image-resize-module' Quill.register('modules/imageDrop', ImageDrop) Quill.register('modules/imageResize', ImageResize) Vue.use(quillEditor) // 地图组件 // import { loadScript, loadCss } from 'esri-loader'; // loadCss('https://t1.digitalcq.com/jsapi/Arcgis/4.26/esri/css/main.css'); // loadScript({ // dojoConfig: { // async: true // }, // url: 'https://t1.digitalcq.com/jsapi/Arcgis/4.26/init.js' // }); // import { loadScript, loadCss } from 'esri-loader'; // loadCss('http://23.213.34.22/jsapi/Arcgis/4.26/esri/css/main.css'); // loadScript({ // dojoConfig: { // async: true // }, // url: 'http://23.213.34.22/jsapi/Arcgis/4.26/init.js' // }); // import HotentUi from 'bpm_el_ui' //引入ui // import 'bpm_el_ui/lib/bpm_el_ui.css' // import 'bpm_el_ui/src/assets/css/element-variables.scss' import '@/directive.js' import req from '@/request.js' import deepmerge from 'deepmerge' import validate from '@/validate.js' import dict from '@/lang/dict.js' import ExportData from '@/components/ImportExportData/ExportData/ExportData.vue' import ImportData from '@/components/ImportExportData/ImportData/ImportData.vue' import utils from '@/utils.js' // 滚动表格 import dataV from '@jiaminghi/data-view' Vue.use(dataV) //引入字典 import DictSelect from '@/components/dict/DictSelect.vue' import dictUtils from '@/components/dict/DictSelectUtils' // 引入状态颜色组件 import StatusByColor from '@/components/common/StatusByColor.vue' // 引如查看历史审批流程组件 import RecordDialog from '@/components/dialog/RecordDialog' import RecordPopover from '@/components/dialog/RecordPopover.vue' import DeletePopover from '@/components/dialog/DeletePopover.vue' //侧边导航事件 import eventBus from './api/bus.js' Vue.use(eventBus) // 获取字典数据 Vue.prototype.getDictData = dictCode => { const arr = [] const dictItems = dictUtils.getDictItemsFromCache(dictCode) dictItems.forEach(item => { arr.push({ text: item.name, value: item.value }) }) return arr } //菜单图标 import svgIcon from '@/components/global/svgIcon.vue' Vue.config.debug = true Vue.prototype.$http = req // 字符串解析和序列化字符串 import qs from 'qs' Vue.prototype.qs = qs Vue.use(ElementUI, { i18n: (key, value) => i18n.t(key, value) // size: 'small' }) // 列头自适应 ElementUI.TableColumn.props.minWidth = { default: function() { if (this.label) { //将双字节字符替换为两个a,14为当前font-size 一个a为7.8px 一个汉字为14px 单元格左右padding为20px return this.label.replace(/[^\x00-\xff]/g, 'aa').length * 7.8 + 20 + 'px' } } } import {Icon, Form, Field, Button} from 'vant' Vue.use(Icon) Vue.use(Form) Vue.use(Field) Vue.use(Button) import 'vant/lib/icon/style' import 'vant/lib/form/style' import 'vant/lib/field/style' import 'vant/lib/button/style' // 拖拽指令 import '@/dialog' // Vue.use(HotentUi, { // i18n: (key, value) => i18n.t(key, value) // }) //弹层可拖动 import './utils/dialogdrag' // 注册全局组件 Vue.component('svgIcon', svgIcon) Vue.component('DictSelect', DictSelect) Vue.component('ExportData', ExportData) Vue.component('ImportData', ImportData) Vue.component('StatusByColor', StatusByColor) Vue.component('RecordDialog', RecordDialog) Vue.component('RecordPopover', RecordPopover) Vue.component('DeletePopover', DeletePopover) window.app = new Vue({ store, router, i18n, render: function(createElement) { if ( '-ms-scroll-limit' in document.documentElement.style && '-ms-ime-align' in document.documentElement.style ) { window.addEventListener( 'hashchange', () => { var currentPath = window.location.hash.slice(1) if (this.$route.path !== currentPath) { this.$router.push(currentPath) } }, false ) } return createElement(App) } }).$mount('#root') let validateLocal = localStorage.getItem('lang') let currentLocal = validateLocal || 'zh-CN' // app.$validator.locale = currentLocal if (app.$validator) { for (let rule in validate) { app.$validator.rules[rule] = validate[rule] } app.$validator.dictionary.container = deepmerge( dict, app.$validator.dictionary.container, {clone: true} ) } // 日期控件格式化 if ('zh-CN' == currentLocal) { moment.locale('zh-cn') } else { moment.locale('en') } moment.locale('zh-cn') // el-tooltip 默认显示 Vue.prototype.$tooltipplacement = 'bottom' // 默认获取当前时间并格式化为yyyy-MM-dd Vue.prototype.getDate = () => { const nowDate = new Date() let date = { year: nowDate.getFullYear(), month: nowDate.getMonth() + 1, date: nowDate.getDate() } const newmonth = date.month >= 10 ? date.month : '0' + date.month const day = date.date >= 10 ? date.date : '0' + date.date date = date.year + '-' + newmonth + '-' + day return date }