main.ts 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  1. import { App, createApp } from "vue";
  2. import MainApp from "./App.vue";
  3. // reset style sheet
  4. import "@/styles/index.scss";
  5. // CSS common style sheet
  6. import "@/styles/common.scss";
  7. // iconfont css
  8. import "@/assets/iconfont/iconfont.css";
  9. // import "@/assets/iconfont/iconfont.js";
  10. // font css
  11. import "@/assets/fonts/font.scss";
  12. // element css
  13. import "element-plus/dist/index.css";
  14. // element dark css
  15. import "element-plus/theme-chalk/dark/css-vars.css";
  16. // custom element dark css
  17. import "@/styles/theme/element-dark.scss";
  18. // custom element css
  19. import "@/styles/element.scss";
  20. import "@vue-office/docx/lib/index.css";
  21. import "@vue-office/excel/lib/index.css";
  22. // postcss-pxtorem
  23. // import "@/utils/rem";
  24. // svg icons
  25. import "virtual:svg-icons-register";
  26. // element plus
  27. // import ElementPlus from "element-plus";
  28. // element icons
  29. // import * as Icons from "@element-plus/icons-vue";
  30. // custom directives
  31. import directives from "@/directives/index";
  32. // vue Router
  33. import router from "@/routers";
  34. // vue i18n
  35. import I18n from "@/languages/index";
  36. // pinia store
  37. import pinia from "@/stores";
  38. // errorHandler
  39. import errorHandler from "@/utils/errorHandler";
  40. import Toast from "vue-toastification";
  41. // import "vue-toastification/dist/index.css";
  42. import "@/styles/var/toastification.scss";
  43. // vant css
  44. import "vant/lib/tabs/style";
  45. import "vant/lib/tab/style";
  46. import "vant/lib/cell/style";
  47. import "vant/lib/cell-group/style";
  48. import "vant/lib/empty/style";
  49. // 打印模块
  50. import { hiPrintPlugin } from "vue-plugin-hiprint";
  51. import {
  52. ElAutocomplete,
  53. ElBacktop,
  54. ElBadge,
  55. ElImage,
  56. ElImageViewer,
  57. ElInput,
  58. ElInputNumber,
  59. ElDatePicker,
  60. ElSelect,
  61. ElSelectV2,
  62. ElTreeSelect,
  63. ElSwitch,
  64. ElStatistic,
  65. ElCheckbox,
  66. ElCheckboxGroup,
  67. ElCheckboxButton,
  68. ElNotification,
  69. ElProgress,
  70. ElRadio,
  71. ElRadioButton,
  72. ElRadioGroup,
  73. ElResult,
  74. ElSpace,
  75. ElSegmented,
  76. ElText,
  77. ElTag,
  78. ElCheckTag,
  79. ElTimeline,
  80. ElTimelineItem,
  81. ElUpload
  82. } from "element-plus";
  83. // vxe-table
  84. // import XEUtils from "xe-utils";
  85. // import {
  86. // // 全局对象
  87. // VXETable,
  88. // // 表格功能
  89. // Filter,
  90. // Edit,
  91. // Menu,
  92. // Export,
  93. // Keyboard,
  94. // Validator,
  95. // // 可选组件
  96. // Icon,
  97. // Column,
  98. // Colgroup,
  99. // Grid,
  100. // Tooltip,
  101. // Toolbar,
  102. // Pager,
  103. // Form,
  104. // FormItem,
  105. // FormGather,
  106. // Checkbox,
  107. // CheckboxGroup,
  108. // Radio,
  109. // RadioGroup,
  110. // RadioButton,
  111. // Switch,
  112. // Input,
  113. // Select,
  114. // Optgroup,
  115. // Option,
  116. // Textarea,
  117. // Button,
  118. // Modal,
  119. // List,
  120. // Pulldown,
  121. // // 表格
  122. // Table
  123. // } from "vxe-table";
  124. import {
  125. VxeUI,
  126. VxeButton,
  127. VxeButtonGroup,
  128. VxeDrawer,
  129. VxeForm,
  130. VxeFormGroup,
  131. VxeFormItem,
  132. VxeIcon,
  133. VxeInput,
  134. VxeLoading,
  135. VxeModal,
  136. VxePager,
  137. VxePrint,
  138. VxeSelect,
  139. VxeTooltip,
  140. VxeUpload
  141. } from "vxe-pc-ui";
  142. import { VxeTable, VxeColumn, VxeColgroup, VxeGrid, VxeToolbar } from "vxe-table";
  143. // 导入主题变量,也可以重写主题变量
  144. import "vxe-table/styles/cssvar.scss";
  145. import "vxe-pc-ui/styles/cssvar.scss";
  146. // import "vxe-table/styles/variable.scss";
  147. // import "vxe-table/styles/cssvar.scss";
  148. // import "vxe-table/lib/style.css";
  149. import "@/styles/var/vxe-variable.scss";
  150. import "@/styles/var/vant-variable.scss";
  151. import { Tab as VanTab, Tabs as VanTabs, Cell, CellGroup, Empty as VanEmpty } from "vant";
  152. import VxeUIPluginRenderElement from "@vxe-ui/plugin-render-element";
  153. import "@vxe-ui/plugin-render-element/dist/style.css";
  154. VxeUI.use(VxeUIPluginRenderElement);
  155. // 按需加载的方式默认是不带国际化的,自定义国际化需要自行解析占位符 '{0}',例如:
  156. // VXETable.setup({
  157. // // @ts-ignore
  158. // i18n: (key, args) => I18n.global.t(key, args),
  159. // // 重置vxetable的图标
  160. // icon: {
  161. // TABLE_FILTER_NONE: "iconfont iconfilter-funnel-01",
  162. // TABLE_FILTER_MATCH: "iconfont iconfilter-funnel-01-fill"
  163. // }
  164. // });
  165. import "@/components/LjVxeTable/interface/plugins.tsx";
  166. function useTable(app: App) {
  167. app.use(lazyVxeUI).use(lazyVxeTable);
  168. // // 表格功能
  169. // app.use(Filter).use(Edit).use(Menu).use(Export).use(Keyboard).use(Validator);
  170. // // 可选组件
  171. // app
  172. // .use(Icon)
  173. // .use(Column)
  174. // .use(Colgroup)
  175. // .use(Grid)
  176. // .use(Tooltip)
  177. // .use(Toolbar)
  178. // .use(Pager)
  179. // .use(Form)
  180. // .use(FormItem)
  181. // .use(FormGather)
  182. // .use(Checkbox)
  183. // .use(CheckboxGroup)
  184. // .use(Radio)
  185. // .use(RadioGroup)
  186. // .use(RadioButton)
  187. // .use(Switch)
  188. // .use(Input)
  189. // .use(Select)
  190. // .use(Optgroup)
  191. // .use(Option)
  192. // .use(Textarea)
  193. // .use(Button)
  194. // .use(Modal)
  195. // .use(List)
  196. // .use(Pulldown)
  197. // // 安装表格
  198. // .use(Table);
  199. }
  200. // import VXETable from "vxe-table";
  201. // import "vxe-table/lib/style.css";
  202. // // 按需加载的方式默认是不带国际化的,自定义国际化需要自行解析占位符 '{0}',例如:
  203. // VXETable.setup({
  204. // i18n: (key, args) => I18n.global.t(key, args)
  205. // });
  206. // function useTable(app: App) {
  207. // app.use(VXETable);
  208. // }
  209. // 可选组件
  210. function lazyVxeUI(app: App) {
  211. app.use(VxeButton);
  212. app.use(VxeButtonGroup);
  213. app.use(VxeDrawer);
  214. app.use(VxeForm);
  215. app.use(VxeFormGroup);
  216. app.use(VxeFormItem);
  217. app.use(VxeIcon);
  218. app.use(VxeInput);
  219. app.use(VxeLoading);
  220. app.use(VxeModal);
  221. app.use(VxePager);
  222. app.use(VxePrint);
  223. app.use(VxeSelect);
  224. app.use(VxeTooltip);
  225. app.use(VxeUpload);
  226. }
  227. function lazyVxeTable(app: App) {
  228. app.use(VxeTable);
  229. app.use(VxeColumn);
  230. app.use(VxeColgroup);
  231. app.use(VxeGrid);
  232. app.use(VxeToolbar);
  233. }
  234. VxeUI.setConfig({
  235. zIndex: 3000,
  236. // 对组件内置的提示语进行国际化翻译
  237. i18n: (key: any, args: any) => I18n.global.t(key, args)
  238. });
  239. // 重置vxetable的图标
  240. VxeUI.setIcon({
  241. TABLE_FILTER_NONE: "iconfont iconfilter-funnel-01",
  242. TABLE_FILTER_MATCH: "iconfont iconfilter-funnel-01-fill"
  243. });
  244. const app = createApp(MainApp);
  245. app.config.errorHandler = errorHandler;
  246. // app.config.globalProperties.$toast = Toast;
  247. app.use(Toast, {
  248. transition: "Vue-Toastification__fade",
  249. maxToasts: 20,
  250. newestOnTop: true,
  251. position: "top-right",
  252. timeout: 5000,
  253. closeOnClick: false,
  254. pauseOnFocusLoss: true,
  255. pauseOnHover: true,
  256. draggable: true,
  257. // draggablePercent: 0.6,
  258. showCloseButtonOnHover: false,
  259. hideProgressBar: false,
  260. closeButton: "button",
  261. icon: true,
  262. rtl: false
  263. });
  264. // register the element Icons component
  265. // Object.keys(Icons).forEach(key => {
  266. // app.component(key, Icons[key as keyof typeof Icons]);
  267. // });
  268. app.use(directives).use(router).use(I18n).use(pinia).mount("#app");
  269. app.use(useTable);
  270. app.use(hiPrintPlugin);
  271. hiPrintPlugin.install(app);
  272. // hiPrintPlugin.disAutoConnect();
  273. app.use(ElAutocomplete);
  274. app.use(ElBacktop);
  275. app.use(ElBadge);
  276. app.use(ElDatePicker);
  277. app.use(ElImage);
  278. app.use(ElImageViewer);
  279. app.use(ElInput);
  280. app.use(ElInputNumber);
  281. app.use(ElSelect);
  282. app.use(ElSelectV2);
  283. app.use(ElTreeSelect);
  284. app.use(ElSwitch);
  285. app.use(ElStatistic);
  286. app.use(ElCheckbox);
  287. app.use(ElCheckboxGroup);
  288. app.use(ElCheckboxButton);
  289. app.use(ElNotification);
  290. app.use(ElProgress);
  291. app.use(ElRadio);
  292. app.use(ElRadioButton);
  293. app.use(ElRadioGroup);
  294. app.use(ElResult);
  295. app.use(ElSpace);
  296. app.use(ElSegmented);
  297. app.use(ElText);
  298. app.use(ElTag);
  299. app.use(ElCheckTag);
  300. app.use(ElTimeline);
  301. app.use(ElTimelineItem);
  302. app.use(ElUpload);
  303. // vant init
  304. app.use(VanTabs);
  305. app.use(VanTab);
  306. app.use(Cell);
  307. app.use(CellGroup);
  308. app.use(VanEmpty);
  309. // 引入函数式弹窗
  310. import Dialog from "@/utils/dialog";
  311. // 挂载到app
  312. app.config.globalProperties.$dialog = Dialog;