main.js 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. import Vue from 'vue';
  2. import Cookies from 'js-cookie';
  3. import Element from 'element-ui';
  4. import './assets/styles/element-variables.scss';
  5. import '@/assets/styles/index.scss'; // global css
  6. import '@/assets/styles/ruoyi.scss'; // ruoyi css
  7. import '@/assets/styles/cust-global.scss'; // 定制全局公共 css
  8. import App from './App';
  9. import store from './store';
  10. import router from './router';
  11. import permission from './directive/permission';
  12. import './assets/icons'; // icon
  13. import './permission'; // permission control
  14. import { getDicts } from "@/api/system/dict/data";
  15. import { getConfigKey } from "@/api/system/config";
  16. import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, download, handleTree } from "@/utils/ruoyi";
  17. import Pagination from "@/components/Pagination";
  18. // 自定义表格工具扩展
  19. import RightToolbar from "@/components/RightToolbar";
  20. // 全局方法挂载
  21. Vue.prototype.getDicts = getDicts;
  22. Vue.prototype.getConfigKey = getConfigKey;
  23. Vue.prototype.parseTime = parseTime;
  24. Vue.prototype.resetForm = resetForm;
  25. Vue.prototype.addDateRange = addDateRange;
  26. Vue.prototype.selectDictLabel = selectDictLabel;
  27. Vue.prototype.selectDictLabels = selectDictLabels;
  28. Vue.prototype.download = download;
  29. Vue.prototype.handleTree = handleTree;
  30. // 成功消息提示框
  31. Vue.prototype.msgSuccess = function (msg) {
  32. this.$message({ showClose: true, message: msg, type: "success" });
  33. };
  34. // 警告消息提示框
  35. Vue.prototype.msgWarning = function (msg) {
  36. this.$message({ showClose: true, message: msg, type: "warning" });
  37. };
  38. // 错误消息提示框
  39. Vue.prototype.msgError = function (msg) {
  40. this.$message({ showClose: true, message: msg, type: "error" });
  41. };
  42. // 默认消息提示框
  43. Vue.prototype.msgInfo = function (msg) {
  44. this.$message.info(msg);
  45. };
  46. // 全局组件挂载
  47. Vue.component('Pagination', Pagination);
  48. Vue.component('RightToolbar', RightToolbar);
  49. Vue.use(permission);
  50. /**
  51. * If you don't want to use mock-server
  52. * you want to use MockJs for mock api
  53. * you can execute: mockXHR()
  54. *
  55. * Currently MockJs will be used in the production environment,
  56. * please remove it before going online! ! !
  57. */
  58. Vue.use(Element, {
  59. size: Cookies.get(process.env.VUE_APP_PROJECT_KEY + '-size') || 'medium' // set element-ui default size
  60. });
  61. Vue.config.productionTip = false;
  62. new Vue({
  63. el: '#app',
  64. router,
  65. store,
  66. render: h => h(App)
  67. });