main.js 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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 App from "./App";
  8. import store from "./store";
  9. import router from "./router";
  10. import directive from "./directive"; // directive
  11. import plugins from "./plugins"; // plugins
  12. import { download } from "@/utils/request";
  13. // 时间格式化方法挂载
  14. import "@/views/marketing/utils/date";
  15. import "./assets/icons"; // icon
  16. import "./permission"; // permission control
  17. import { getDicts } from "@/api/system/dict/data";
  18. import { getConfigKey } from "@/api/system/config";
  19. import {
  20. parseTime,
  21. resetForm,
  22. addDateRange,
  23. selectDictLabel,
  24. selectDictLabels,
  25. handleTree,
  26. } from "@/utils/ruoyi";
  27. import { initParams, initRules, initDicts, initPage } from "@/utils/init.js";
  28. // 分页组件
  29. import Pagination from "@/components/Pagination";
  30. // 自定义表格工具组件
  31. import RightToolbar from "@/components/RightToolbar";
  32. // 富文本组件
  33. import Editor from "@/components/Editor";
  34. // 文件上传组件
  35. import FileUpload from "@/components/FileUpload";
  36. // 图片上传组件
  37. import ImageUpload from "@/components/ImageUpload";
  38. // 图片预览组件
  39. import ImagePreview from "@/components/ImagePreview";
  40. // 字典标签组件
  41. import DictTag from "@/components/DictTag";
  42. // 头部标签组件
  43. import VueMeta from "vue-meta";
  44. // 字典数据组件
  45. import DictData from "@/components/DictData";
  46. //
  47. import PopoverSelect from "@/components/popover-select";
  48. import PopoverSelectV2 from "@/components/popover-select-v2";
  49. //
  50. import PopoverTreeSelect from "@/components/popover-tree-select";
  51. //
  52. import ComputedInput from "@/components/computed-input";
  53. // 附件标签组件
  54. import FilePreview from "@/components/file-preview";
  55. //打印
  56. import Print from "vue-print-nb";
  57. // 引入umy-ui
  58. import UmyUi from 'umy-ui'
  59. import 'umy-ui/lib/theme-chalk/index.css';// 引入样式
  60. // 引入vxe-table
  61. import VXETable from 'vxe-table'
  62. import 'vxe-table/lib/style.css'
  63. //底部横拉条
  64. import horizontalScroll from 'el-table-horizontal-scroll';
  65. //自定义全局指令
  66. import onlyNumber from '@/views/business/ehr/directive/el-input';
  67. // 全局方法挂载
  68. Vue.prototype.getDicts = getDicts;
  69. Vue.prototype.getConfigKey = getConfigKey;
  70. Vue.prototype.parseTime = parseTime;
  71. Vue.prototype.resetForm = resetForm;
  72. Vue.prototype.addDateRange = addDateRange;
  73. Vue.prototype.selectDictLabel = selectDictLabel;
  74. Vue.prototype.selectDictLabels = selectDictLabels;
  75. Vue.prototype.download = download;
  76. Vue.prototype.handleTree = handleTree;
  77. Vue.prototype.$init = {
  78. params: initParams,
  79. dicts: initDicts,
  80. rules: initRules,
  81. page: initPage,
  82. };
  83. // 全局组件挂载
  84. Vue.component("DictTag", DictTag);
  85. Vue.component("Pagination", Pagination);
  86. Vue.component("RightToolbar", RightToolbar);
  87. Vue.component("Editor", Editor);
  88. Vue.component("FileUpload", FileUpload);
  89. Vue.component("ImageUpload", ImageUpload);
  90. Vue.component("ImagePreview", ImagePreview);
  91. Vue.component("DrPopoverSelect", PopoverSelect);
  92. Vue.component("DrPopoverSelectV2", PopoverSelectV2);
  93. Vue.component("DrPopoverTreeSelect", PopoverTreeSelect);
  94. Vue.component("DrComputedInput", ComputedInput);
  95. Vue.component("DrFilePreview", FilePreview);
  96. Vue.use(directive);
  97. Vue.use(plugins);
  98. Vue.use(VueMeta);
  99. Vue.use(Print); //注册
  100. Vue.use(UmyUi);
  101. Vue.use(VXETable)
  102. Vue.use(horizontalScroll);//底部横拉条
  103. DictData.install();
  104. // el-table无限滚动解决页面渲染卡死
  105. // Vue.directive("myscroll", {
  106. // bind(el, bind, vnode) {
  107. // const self = vnode.context;
  108. // let target = el.querySelector('.el-table__body-wrapper');
  109. // target.addEventListener("scroll", () => {
  110. // // 检测触底
  111. // if (target.scrollTop + target.clientHeight >= target.scrollHeight) {
  112. // if (self.over >= self.basicForm.puDemandItemList) {
  113. // return;
  114. // }
  115. // self.over +=15
  116. // }
  117. // })
  118. // }
  119. // })
  120. // Vue.mixin({
  121. // data() {
  122. // return {
  123. // // scrollTop: 0,
  124. // // tableHeight: 300
  125. // start: 0,
  126. // over: 15
  127. // }
  128. // }
  129. // })
  130. /**
  131. * If you don't want to use mock-server
  132. * you want to use MockJs for mock api
  133. * you can execute: mockXHR()
  134. *
  135. * Currently MockJs will be used in the production environment,
  136. * please remove it before going online! ! !
  137. */
  138. Vue.use(Element, {
  139. size: Cookies.get("size") || "medium", // set element-ui default size
  140. });
  141. //使用该全局指令
  142. Vue.use(onlyNumber);
  143. Vue.config.productionTip = false;
  144. new Vue({
  145. el: "#app",
  146. router,
  147. store,
  148. render: (h) => h(App),
  149. });