| | |
| | | import 'virtual:svg-icons-register' |
| | | import SvgIcon from '@/components/SvgIcon' |
| | | import elementIcons from '@/components/SvgIcon/svgicon' |
| | | import LimsIcon from '@/components/LimsIcon' |
| | | import { getLimsIcon } from '@/utils/lims-icon' |
| | | |
| | | // 业务字典插件(组件选项 dicts: [...] → this.dict) |
| | | import DictData from '@/components/DictData' |
| | | |
| | | import './permission' // permission control |
| | | |
| | | import { useDict } from '@/utils/dict' |
| | | import { getConfigKey } from "@/api/system/config" |
| | | import { getDicts } from "@/api/system/dict/data" |
| | | import { parseTime, resetForm, addDateRange, handleTree, selectDictLabel, selectDictLabels } from '@/utils/ruoyi' |
| | | import { dictToValue } from '@/utils/index' |
| | | import { checkPermi } from '@/utils/permission' |
| | | import { getToken } from '@/utils/auth' |
| | | import { getJavaApi } from '@/utils/java-api' |
| | | import Big from 'big.js' |
| | | |
| | | // 分页组件 |
| | | import Pagination from '@/components/Pagination' |
| | |
| | | import ImagePreview from "@/components/ImagePreview" |
| | | // 字典标签组件 |
| | | import DictTag from '@/components/DictTag' |
| | | // 条形码组件(旧 vue-barcode 的 Vue3 版本) |
| | | import VueBarcode from '@chenfengyuan/vue-barcode' |
| | | // 源码用 moment 挂 $moment,只有 3 处调用(都是 .format),换 dayjs:体积小得多,格式串兼容 |
| | | import dayjs from 'dayjs' |
| | | // element-ui 的日期令牌 `WW`(ISO 周次,两位补零)dayjs 默认不认。 |
| | | // advancedFormat 负责把 `WW` 解释成 isoWeek(),isoWeek 提供该方法;两者一起装才等价于 element-ui。 |
| | | import advancedFormat from 'dayjs/plugin/advancedFormat' |
| | | import isoWeek from 'dayjs/plugin/isoWeek' |
| | | dayjs.extend(advancedFormat) |
| | | dayjs.extend(isoWeek) |
| | | |
| | | const app = createApp(App) |
| | | |
| | |
| | | app.config.globalProperties.handleTree = handleTree |
| | | app.config.globalProperties.addDateRange = addDateRange |
| | | app.config.globalProperties.getConfigKey = getConfigKey |
| | | app.config.globalProperties.getDicts = getDicts |
| | | app.config.globalProperties.selectDictLabel = selectDictLabel |
| | | app.config.globalProperties.selectDictLabels = selectDictLabels |
| | | // 业务全局量 |
| | | app.config.globalProperties.$Big = Big |
| | | app.config.globalProperties.dictToValue = dictToValue |
| | | app.config.globalProperties.checkPermi = checkPermi |
| | | app.config.globalProperties.HaveJson = (val) => JSON.parse(JSON.stringify(val)) |
| | | // 旧版图标名 → EP 图标组件,供 :icon="$icon('el-icon-x')" 使用 |
| | | app.config.globalProperties.$icon = getLimsIcon |
| | | app.config.globalProperties.$moment = dayjs |
| | | |
| | | // javaApi:业务拼接静态资源/附件地址用。源码在加载时一次性求值,此处改为 getter 实时求值, |
| | | // 避免域名或环境切换后拿到失效快照。求值规则在 utils/java-api.js,普通 js 模块也从那里取。 |
| | | Object.defineProperty(app.config.globalProperties, 'javaApi', { |
| | | get: getJavaApi |
| | | }) |
| | | // uploadHeader:源码同样是快照,改为 getter,保证登录/刷新 token 后上传仍带对凭证。 |
| | | Object.defineProperty(app.config.globalProperties, 'uploadHeader', { |
| | | get() { |
| | | return { Authorization: 'Bearer ' + getToken() } |
| | | } |
| | | }) |
| | | |
| | | // 全局组件挂载 |
| | | app.component('DictTag', DictTag) |
| | |
| | | app.component('ImagePreview', ImagePreview) |
| | | app.component('RightToolbar', RightToolbar) |
| | | app.component('Editor', Editor) |
| | | app.component('lims-icon', LimsIcon) |
| | | app.component('barcode', VueBarcode) |
| | | |
| | | app.use(router) |
| | | app.use(store) |
| | |
| | | |
| | | directive(app) |
| | | |
| | | // 业务字典插件安装 |
| | | app.use(DictData) |
| | | |
| | | // 使用element-plus 并且设置全局的大小 |
| | | app.use(ElementPlus, { |
| | | locale: locale, |