xiaochan il y a 2 ans
Parent
commit
3bab1e44af

+ 0 - 57
src/utils/evicePixelRatio.js

@@ -1,57 +0,0 @@
-/**
- * @description 校正windows页面在系统进行缩放后导致页面被放大的问题,通常放大比例是125%、150%
- * **/
-
-class DevicePixelRatio {
-    constructor() {
-    }
-
-    //获取系统类型
-    _getSystem() {
-        let flag = false;
-        var agent = navigator.userAgent.toLowerCase();
-        if (agent.indexOf("windows") >= 0) {
-            return true;
-        }
-    }
-
-    //获取页面缩放比例
-    _addHandler(element, type, handler) {
-        if (element.addEventListener) {
-            element.addEventListener(type, handler, false);
-        } else if (element.attachEvent) {
-            element.attachEvent("on" + type, handler);
-        } else {
-            element["on" + type] = handler;
-        }
-    }
-
-    //校正浏览器缩放比例
-    _correct() {
-        let t = this;
-        //页面devicePixelRatio(设备像素比例)变化后,计算页面body标签zoom修改其大小,来抵消devicePixelRatio带来的变化。
-        document.getElementsByTagName('body')[0].style.zoom = 1 / window.devicePixelRatio;
-    }
-
-    //监听页面缩放
-    _watch() {
-        let t = this;
-        t._addHandler(window, 'resize', function () { //注意这个方法是解决全局有两个window.resize
-            //重新校正
-            t._correct()
-        })
-    }
-
-    //初始化页面比例
-    init() {
-        let t = this;
-        if (t._getSystem()) { //判断设备,目前只在windows系统下校正浏览器缩放比例
-            //初始化页面校正浏览器缩放比例
-            t._correct();
-            //开启监听页面缩放
-            t._watch();
-        }
-    }
-}
-
-export default DevicePixelRatio;

+ 8 - 5
src/utils/public.js → src/utils/public.ts

@@ -1,6 +1,8 @@
+// @ts-ignore
 import store from '@/store'
-import {stringIsBlank} from "@/utils/blank-utils";
+// @ts-ignore
 import {xcMessage} from "@/utils/xiaochan-element-plus";
+import XEUtils from "xe-utils";
 
 export function needRule(...val) {
     const userRoles = store.state.user.info.roles
@@ -19,10 +21,11 @@ export function noNeedRule(...val) {
     return !needRule(val)
 }
 
-export let isDev = import.meta.env.VITE_BASE_URL !== 'http://172.16.32.160:8077'
+// @ts-ignore
+export let isDev = import.meta.env.MODE === "development"
 
 export const nullToEmpty = (val) => {
-    if (stringIsBlank(val)) {
+    if (XEUtils.isEmpty(val)) {
         return ''
     } else {
         return val
@@ -81,13 +84,13 @@ export function compareVersion(version1, version2) {
 
 export const chineseEncrypt = {
     encrypt: (val) => {
-        if (stringIsBlank(val)) {
+        if (XEUtils.isEmpty(val)) {
             return "";
         }
         return encodeURI(JSON.stringify(val))
     },
     decrypt: (val) => {
-        if (stringIsBlank(val)) {
+        if (XEUtils.isEmpty(val)) {
             return "";
         }
         return JSON.parse(decodeURI(val))

+ 7 - 0
src/utils/request-v2.ts

@@ -0,0 +1,7 @@
+import request from './request'
+import {AxiosRequestConfig} from "axios";
+
+const requestV2 = (options: AxiosRequestConfig): Promise<any> => {
+    return request(options)
+}
+export default requestV2

+ 0 - 25
src/utils/tree-utils.js

@@ -1,25 +0,0 @@
-export function getTree(data, id, parent) {
-    let map = {};
-    let tree = []
-    if (data) {
-        for (let i = 0; i < data.length; i++) {
-            let item = data[i]
-            if (item.parent === null) {
-                tree.push(item)
-            }
-            map[item[id]] = item
-        }
-        for (let i = 0; i < data.length; i++) {
-            let child = data[i];
-            let parentList = (map[child[parent]])
-
-            if (parentList) {
-                if (!parentList['children']) {
-                    parentList['children'] = []
-                }
-                parentList.children.push(child)
-            }
-        }
-    }
-    return tree
-}

+ 6 - 6
src/utils/xiaochan-element-plus.js → src/utils/xiaochan-element-plus.ts

@@ -1,24 +1,24 @@
 import {ElMessage} from "element-plus";
 
 export const xcMessage = {
-    success: (msg, isHtml = false) => {
+    success: (msg: string, isHtml = false) => {
         return message(msg, 'success', isHtml)
     },
-    danger: (msg, isHtml = false) => {
+    danger: (msg: string, isHtml = false) => {
         return message(msg, 'danger', isHtml)
     },
-    info: (msg, isHtml = false) => {
+    info: (msg: string, isHtml = false) => {
         return message(msg, 'info', isHtml)
     },
-    warning: (msg, isHtml = false) => {
+    warning: (msg: string, isHtml = false) => {
         return message(msg, 'warning', isHtml)
     },
-    error: (msg, isHtml = false) => {
+    error: (msg: string, isHtml = false) => {
         return message(msg, 'error', isHtml)
     }
 }
 
-function message(msg, type, isHtml) {
+function message(msg: string, type: string, isHtml: boolean) {
     return ElMessage({
         type: type,
         duration: 2800,

+ 6 - 1
src/views/settings/Test.vue

@@ -2,7 +2,12 @@
   <EmrTestV2 pat-no="0420929"/>
 </template>
 
-<script setup lang="ts">
+<script setup>
 import EmrTestV2 from "@/components/zhu-yuan-yi-sheng/emr/auxiliary-tools/EmrTestV2.vue";
+import {onMounted} from "vue";
+
+
+onMounted(() => {
+})
 
 </script>