main.js 4.9 KB

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