main.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. import Vue from "vue";
  2. import Element from "element-ui";
  3. import "./assets/styles/element-variables.scss";
  4. import "@/assets/styles/index.scss"; // global css
  5. import "@/assets/styles/ruoyi.scss"; // ruoyi css
  6. import App from "./App";
  7. import store from "./store";
  8. import router from "./router";
  9. import directive from "./directive"; // directive
  10. import plugins from "./plugins"; // plugins
  11. import { download } from "@/utils/request";
  12. import "./assets/icons"; // icon
  13. import "./permission"; // permission control
  14. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  15. import { getDicts } from "@/api/system/dict/data";
  16. import { getConfigKey } from "@/api/system/config";
  17. import {
  18. parseTime,
  19. resetForm,
  20. addDateRange,
  21. selectDictLabel,
  22. selectDictLabels,
  23. handleTree,
  24. formatTime,
  25. imageUrl,
  26. } from "@/utils/ruoyi";
  27. // 分页组件
  28. import Pagination from "@/components/Pagination";
  29. // 自定义表格工具组件
  30. import RightToolbar from "@/components/RightToolbar";
  31. // 富文本组件
  32. import Editor from "@/components/Editor";
  33. // 文件上传组件
  34. import FileUpload from "@/components/FileUpload";
  35. // 图片上传组件
  36. import ImageUpload from "@/components/ImageUpload";
  37. // 图片预览组件
  38. import ImagePreview from "@/components/ImagePreview";
  39. // 图片预览组件
  40. import ImageListPreview from "@/components/ImageListPreview";
  41. // 字典标签组件
  42. import DictTag from "@/components/DictTag";
  43. // 头部标签组件
  44. import VueMeta from "vue-meta";
  45. // 字典数据组件
  46. import DictData from "@/components/DictData";
  47. // 下拉tree组件
  48. import TreeSelect from "@riophae/vue-treeselect";
  49. // elementui Dialog组件
  50. import DialogCom from "@/components/elDialog/dialog.vue";
  51. //布局容器
  52. import layoutCom from "@/components/layoutContainer/index.vue";
  53. //dialog拖拽指令
  54. import "@/utils/dialogdrag.js";
  55. // 全局方法挂载
  56. Vue.prototype.getDicts = getDicts;
  57. //根据参数键名查询参数值
  58. Vue.prototype.getConfigKey = getConfigKey;
  59. //格式化时间
  60. Vue.prototype.parseTime = parseTime;
  61. //格式化时间
  62. Vue.prototype.formatTime = formatTime;
  63. //重置表单
  64. Vue.prototype.resetForm = resetForm;
  65. //添加日期范围
  66. Vue.prototype.addDateRange = addDateRange;
  67. //回显数据字典
  68. Vue.prototype.selectDictLabel = selectDictLabel;
  69. // 回显数据字典(字符串、数组)
  70. Vue.prototype.selectDictLabels = selectDictLabels;
  71. Vue.prototype.download = download;
  72. Vue.prototype.handleTree = handleTree;
  73. Vue.prototype.imageUrl = imageUrl;
  74. // 全局组件挂载
  75. Vue.component("DictTag", DictTag);
  76. Vue.component("Pagination", Pagination);
  77. Vue.component("RightToolbar", RightToolbar);
  78. Vue.component("Editor", Editor);
  79. Vue.component("FileUpload", FileUpload);
  80. Vue.component("ImageUpload", ImageUpload);
  81. Vue.component("ImagePreview", ImagePreview);
  82. Vue.component("ImageListPreview", ImageListPreview);
  83. Vue.component("TreeSelect", TreeSelect);
  84. Vue.component("DialogCom", DialogCom);
  85. Vue.component("layoutCom", layoutCom);
  86. Vue.use(directive);
  87. Vue.use(plugins);
  88. Vue.use(VueMeta);
  89. DictData.install();
  90. /**
  91. * If you don't want to use mock-server
  92. * you want to use MockJs for mock api
  93. * you can execute: mockXHR()
  94. *
  95. * Currently MockJs will be used in the production environment,
  96. * please remove it before going online! ! !
  97. */
  98. Vue.use(Element, {
  99. size: sessionStorage.getItem("size") || "medium", // set element-ui default size
  100. });
  101. Vue.config.productionTip = false;
  102. new Vue({
  103. el: "#app",
  104. router,
  105. store,
  106. render: (h) => h(App),
  107. });