You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

161 lines
4.4 KiB

import Vue from 'vue'
import Cookies from 'js-cookie'
import 'normalize.css/normalize.css' // a modern alternative to CSS resets
import './base.css'
import Element from 'element-ui'
import './assets/styles/element-variables.scss'
import $ from 'jquery'
import '@/assets/styles/index.scss' // global css
import '@/assets/styles/ruoyi.scss' // ruoyi css
import '../theme/index.css'
import App from './App'
import store from './store'
import router from './router'
import permission from './directive/permission'
import './assets/icons' // icon
import './permission' // permission control
import { getDicts } from "@/api/system/dict/data";
import { getConfigKey } from "@/api/system/config";
import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, download, handleTree } from "@/utils/ruoyi";
import Pagination from "@/components/Pagination";
//自定义表格工具扩展
import RightToolbar from "@/components/RightToolbar"
// 自定义文件上传组件
import UploadFile from "@/components/UploadFile"
//分片上传
import uploader from 'vue-simple-uploader'
// 树组件
import ParagraphTree from "@/components/ParagraphTree"
// 文字高亮
import TextHighlight from "vue-text-highlight";
Vue.component("text-highlight", TextHighlight);
import Vue2OrgTree from 'vue2-org-tree'
// 字典数据组件
import DictData from '@/components/DictData'
// import 'vue2-org-tree/dist/style.css'
// import { detectZoom } from "@/utils/detectZoom";
// const m = detectZoom()
// document.body.style.zoom = 100 / Number(m);
import DevicePixelRatio from "@/utils/deviceRatio";
new DevicePixelRatio().init();
// 全局下载文件方法
import {downloadFile,showFile} from '@/api/common'
import Viewer from 'v-viewer'
import 'viewerjs/dist/viewer.css'
import echarts from 'echarts'
Vue.prototype.$echarts = echarts
import { regionData, codeToText, TextToCode } from "element-china-area-data";
Vue.prototype.$formatAdcd=function(row) {
if (row.adcd) {
let provinceCode = row.adcd.slice(0, 2);
let cityCode = row.adcd.slice(2, 4);
let areaCode = row.adcd.slice(4, 6);
if (areaCode != "00") {
return (
codeToText[provinceCode] +
"-" +
codeToText[provinceCode + cityCode] +
"-" +
codeToText[provinceCode + cityCode + areaCode]
);
} else if (cityCode != "00") {
return (
codeToText[provinceCode] + "-" + codeToText[provinceCode + cityCode]
);
} else {
return codeToText[provinceCode];
}
}
}
// 全局方法挂载
Vue.prototype.getDicts = getDicts
Vue.prototype.getConfigKey = getConfigKey
Vue.prototype.parseTime = parseTime
Vue.prototype.resetForm = resetForm
Vue.prototype.addDateRange = addDateRange
Vue.prototype.selectDictLabel = selectDictLabel
Vue.prototype.selectDictLabels = selectDictLabels
Vue.prototype.download = download
Vue.prototype.handleTree = handleTree
Vue.prototype.downloadFile = downloadFile
Vue.prototype.$showFile = showFile
Vue.prototype.msgSuccess = function (msg) {
this.$message({ showClose: true, message: msg, type: "success" });
}
Vue.prototype.msgError = function (msg) {
this.$message({ showClose: true, message: msg, type: "error" });
}
Vue.prototype.msgInfo = function (msg) {
this.$message.info(msg);
}
Vue.prototype.$timePick = function (date) {
let min =
date != null ? parseTime(date[0], '{y}-{m}-{d}') : "";
let max =
date != null ? parseTime(date[1], '{y}-{m}-{d}') : "";
return [min, max]
}
Vue.use(Viewer);
// 全局组件挂载
Vue.component('Pagination', Pagination)
Vue.component('RightToolbar', RightToolbar)
// 上传文件组件
Vue.component('UploadFile', UploadFile)
// 树组件
Vue.component('ParagraphTree', ParagraphTree)
Vue.use(permission)
Vue.use(uploader)
Vue.use(Vue2OrgTree)
// Vue.use(downloadFile)
DictData.install()
/**
* If you don't want to use mock-server
* you want to use MockJs for mock api
* you can execute: mockXHR()
*
* Currently MockJs will be used in the production environment,
* please remove it before going online! ! !
*/
Vue.use(Element, {
size: Cookies.get('size') || 'medium' // set element-ui default size
})
Vue.config.productionTip = false
new Vue({
el: '#app',
router,
store,
components: {UploadFile, ParagraphTree},
render: h => h(App)
})
router.beforeEach((to,from,next)=>{
window._axiosPromiseArr.forEach((el,index)=>{
el.cancel()
delete window._axiosPromiseArr[index]
})
next()
})