From c7566bba45e6f90594d36ec4b80ac4ff89f577ee Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期四, 08 十月 2026 14:19:36 +0800
Subject: [PATCH] 项目重构
---
src/main.js | 47 +++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 47 insertions(+), 0 deletions(-)
diff --git a/src/main.js b/src/main.js
index f1f6fe2..2132b05 100644
--- a/src/main.js
+++ b/src/main.js
@@ -22,12 +22,23 @@
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'
@@ -43,6 +54,16 @@
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`锛圛SO 鍛ㄦ锛屼袱浣嶈ˉ闆讹級dayjs 榛樿涓嶈銆�
+// advancedFormat 璐熻矗鎶� `WW` 瑙i噴鎴� isoWeek()锛宨soWeek 鎻愪緵璇ユ柟娉曪紱涓よ�呬竴璧疯鎵嶇瓑浠蜂簬 element-ui銆�
+import advancedFormat from 'dayjs/plugin/advancedFormat'
+import isoWeek from 'dayjs/plugin/isoWeek'
+dayjs.extend(advancedFormat)
+dayjs.extend(isoWeek)
const app = createApp(App)
@@ -54,8 +75,29 @@
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 妯″潡涔熶粠閭i噷鍙栥��
+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)
@@ -65,6 +107,8 @@
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)
@@ -74,6 +118,9 @@
directive(app)
+// 涓氬姟瀛楀吀鎻掍欢瀹夎
+app.use(DictData)
+
// 浣跨敤element-plus 骞朵笖璁剧疆鍏ㄥ眬鐨勫ぇ灏�
app.use(ElementPlus, {
locale: locale,
--
Gitblit v1.9.3