mirror of
				https://github.com/pure-admin/vue-pure-admin.git
				synced 2025-11-03 13:44:47 +08:00 
			
		
		
		
	perf: fix some types and delete some redundant
This commit is contained in:
		
							parent
							
								
									8cb2d896ad
								
							
						
					
					
						commit
						89162dee1e
					
				
										
											Binary file not shown.
										
									
								
							| 
		 Before Width: | Height: | Size: 112 KiB  | 
										
											Binary file not shown.
										
									
								
							| 
		 Before Width: | Height: | Size: 127 KiB  | 
@ -59,12 +59,6 @@ export default defineComponent({
 | 
				
			|||||||
      () => getBreadcrumb()
 | 
					      () => getBreadcrumb()
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // const pathCompile = (path: string): string | Object => {
 | 
					 | 
				
			||||||
    // const { params } = route;
 | 
					 | 
				
			||||||
    // var toPath = pathToRegexp.compile(path);
 | 
					 | 
				
			||||||
    // return toPath(params);
 | 
					 | 
				
			||||||
    // };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    const handleLink = (item: RouteLocationMatched): any => {
 | 
					    const handleLink = (item: RouteLocationMatched): any => {
 | 
				
			||||||
      const { redirect, path } = item;
 | 
					      const { redirect, path } = item;
 | 
				
			||||||
      if (redirect) {
 | 
					      if (redirect) {
 | 
				
			||||||
 | 
				
			|||||||
@ -13,20 +13,20 @@ export default defineComponent({
 | 
				
			|||||||
    // 前牌文字
 | 
					    // 前牌文字
 | 
				
			||||||
    frontText: {
 | 
					    frontText: {
 | 
				
			||||||
      type: [Number, String],
 | 
					      type: [Number, String],
 | 
				
			||||||
      default: 0,
 | 
					      default: 0
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    // back paper text
 | 
					    // back paper text
 | 
				
			||||||
    // 后牌文字
 | 
					    // 后牌文字
 | 
				
			||||||
    backText: {
 | 
					    backText: {
 | 
				
			||||||
      type: [Number, String],
 | 
					      type: [Number, String],
 | 
				
			||||||
      default: 1,
 | 
					      default: 1
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    // flipping duration, please be consistent with the CSS animation-duration value.
 | 
					    // flipping duration, please be consistent with the CSS animation-duration value.
 | 
				
			||||||
    // 翻牌动画时间,与CSS中设置的animation-duration保持一致
 | 
					    // 翻牌动画时间,与CSS中设置的animation-duration保持一致
 | 
				
			||||||
    duration: {
 | 
					    duration: {
 | 
				
			||||||
      type: Number,
 | 
					      type: Number,
 | 
				
			||||||
      default: 600,
 | 
					      default: 600
 | 
				
			||||||
    },
 | 
					    }
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  setup(props) {
 | 
					  setup(props) {
 | 
				
			||||||
    const { frontText, backText, duration } = props;
 | 
					    const { frontText, backText, duration } = props;
 | 
				
			||||||
@ -86,9 +86,9 @@ export default defineComponent({
 | 
				
			|||||||
      flipDown,
 | 
					      flipDown,
 | 
				
			||||||
      flipUp,
 | 
					      flipUp,
 | 
				
			||||||
      setFront,
 | 
					      setFront,
 | 
				
			||||||
      setBack,
 | 
					      setBack
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
  },
 | 
					  }
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -31,16 +31,16 @@ import { templateRef } from "@vueuse/core";
 | 
				
			|||||||
export default defineComponent({
 | 
					export default defineComponent({
 | 
				
			||||||
  name: "Control",
 | 
					  name: "Control",
 | 
				
			||||||
  props: {
 | 
					  props: {
 | 
				
			||||||
    lf: Object || String,
 | 
					    lf: <ElRef>Object,
 | 
				
			||||||
    catTurboData: Boolean
 | 
					    catTurboData: Boolean
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  emits: ["catData"],
 | 
					  emits: ["catData"],
 | 
				
			||||||
  setup(props, { emit }) {
 | 
					  setup(props, { emit }) {
 | 
				
			||||||
    const controlButton3 = templateRef<HTMLElement | null>(
 | 
					    const controlButton3 = templateRef<HTMLElement | any>(
 | 
				
			||||||
      "controlButton3",
 | 
					      "controlButton3",
 | 
				
			||||||
      null
 | 
					      null
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
    const controlButton4 = templateRef<HTMLElement | null>(
 | 
					    const controlButton4 = templateRef<HTMLElement | any>(
 | 
				
			||||||
      "controlButton4",
 | 
					      "controlButton4",
 | 
				
			||||||
      null
 | 
					      null
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
 | 
				
			|||||||
@ -16,24 +16,24 @@ import {
 | 
				
			|||||||
  toRefs,
 | 
					  toRefs,
 | 
				
			||||||
  defineComponent,
 | 
					  defineComponent,
 | 
				
			||||||
  onBeforeMount,
 | 
					  onBeforeMount,
 | 
				
			||||||
  getCurrentInstance,
 | 
					  getCurrentInstance
 | 
				
			||||||
} from "vue";
 | 
					} from "vue";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { mapJson } from "/@/api/mock";
 | 
					import { mapJson } from "/@/api/mock";
 | 
				
			||||||
import { deviceDetection } from "/@/utils/deviceDetection"
 | 
					import { deviceDetection } from "/@/utils/deviceDetection";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import greenCar from "/@/assets/green.png";
 | 
					import greenCar from "/@/assets/green.png";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
let MarkerCluster = null;
 | 
					let MarkerCluster = <ElRef>null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface MapConfigureInter {
 | 
					export interface MapConfigureInter {
 | 
				
			||||||
  on: any;
 | 
					  on: Fn;
 | 
				
			||||||
  destroy?: any;
 | 
					  destroy?: Fn;
 | 
				
			||||||
  clearEvents?: any;
 | 
					  clearEvents?: Fn;
 | 
				
			||||||
  plugin?: any;
 | 
					  addControl?: Fn;
 | 
				
			||||||
  addControl?: any;
 | 
					  setCenter?: Fn;
 | 
				
			||||||
  setCenter?: any;
 | 
					  setZoom?: Fn;
 | 
				
			||||||
  setZoom?: any;
 | 
					  plugin?: Fn;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface mapInter {
 | 
					export interface mapInter {
 | 
				
			||||||
@ -47,7 +47,7 @@ export default defineComponent({
 | 
				
			|||||||
    let map: MapConfigureInter;
 | 
					    let map: MapConfigureInter;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const mapSet: mapInter = reactive({
 | 
					    const mapSet: mapInter = reactive({
 | 
				
			||||||
      loading: deviceDetection() ? false : true,
 | 
					      loading: deviceDetection() ? false : true
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // 地图创建完成(动画关闭)
 | 
					    // 地图创建完成(动画关闭)
 | 
				
			||||||
@ -71,18 +71,18 @@ export default defineComponent({
 | 
				
			|||||||
      if (!vm) return;
 | 
					      if (!vm) return;
 | 
				
			||||||
      let {
 | 
					      let {
 | 
				
			||||||
        MapConfigure,
 | 
					        MapConfigure,
 | 
				
			||||||
        options,
 | 
					        options
 | 
				
			||||||
      } = vm.appContext.config.globalProperties.$config;
 | 
					      } = vm.appContext.config.globalProperties.$config;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      AMapLoader.load({
 | 
					      AMapLoader.load({
 | 
				
			||||||
        key: MapConfigure.amapKey,
 | 
					        key: MapConfigure.amapKey,
 | 
				
			||||||
        version: "2.0",
 | 
					        version: "2.0",
 | 
				
			||||||
        plugins: ["AMap.MarkerCluster"],
 | 
					        plugins: ["AMap.MarkerCluster"]
 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
        .then((AMap) => {
 | 
					        .then(AMap => {
 | 
				
			||||||
          // 创建地图实例
 | 
					          // 创建地图实例
 | 
				
			||||||
          map = new AMap.Map(vm.refs.mapview, {
 | 
					          map = new AMap.Map(vm.refs.mapview, {
 | 
				
			||||||
            options,
 | 
					            options
 | 
				
			||||||
          });
 | 
					          });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          //地图中添加地图操作ToolBar插件
 | 
					          //地图中添加地图操作ToolBar插件
 | 
				
			||||||
@ -91,7 +91,7 @@ export default defineComponent({
 | 
				
			|||||||
            //地图类型切换
 | 
					            //地图类型切换
 | 
				
			||||||
            map.addControl(
 | 
					            map.addControl(
 | 
				
			||||||
              new AMap.MapType({
 | 
					              new AMap.MapType({
 | 
				
			||||||
                defaultType: 0,
 | 
					                defaultType: 0
 | 
				
			||||||
              })
 | 
					              })
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
          });
 | 
					          });
 | 
				
			||||||
@ -103,14 +103,13 @@ export default defineComponent({
 | 
				
			|||||||
              let { marker, data } = ctx;
 | 
					              let { marker, data } = ctx;
 | 
				
			||||||
              if (Array.isArray(data) && data[0]) {
 | 
					              if (Array.isArray(data) && data[0]) {
 | 
				
			||||||
                var { driver, plateNumber, orientation } = data[0];
 | 
					                var { driver, plateNumber, orientation } = data[0];
 | 
				
			||||||
                var content = `<img style="transform: scale(1) rotate(${
 | 
					                var content = `<img style="transform: scale(1) rotate(${360 -
 | 
				
			||||||
                360 - Number(orientation)
 | 
					                  Number(orientation)}deg);" src='${greenCar}' />`;
 | 
				
			||||||
              }deg);" src='${greenCar}' />`;
 | 
					 | 
				
			||||||
                marker.setContent(content);
 | 
					                marker.setContent(content);
 | 
				
			||||||
                marker.setLabel({
 | 
					                marker.setLabel({
 | 
				
			||||||
                  direction: "bottom",
 | 
					                  direction: "bottom",
 | 
				
			||||||
                  offset: new AMap.Pixel(-4, 0), //设置文本标注偏移量
 | 
					                  offset: new AMap.Pixel(-4, 0), //设置文本标注偏移量
 | 
				
			||||||
                  content: `<div> ${plateNumber}(${driver})</div>`, //设置文本标注内容
 | 
					                  content: `<div> ${plateNumber}(${driver})</div>` //设置文本标注内容
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
                marker.setOffset(new AMap.Pixel(-18, -10));
 | 
					                marker.setOffset(new AMap.Pixel(-18, -10));
 | 
				
			||||||
                marker.on("click", ({ lnglat }) => {
 | 
					                marker.on("click", ({ lnglat }) => {
 | 
				
			||||||
@ -118,27 +117,27 @@ export default defineComponent({
 | 
				
			|||||||
                  map.setCenter(lnglat);
 | 
					                  map.setCenter(lnglat);
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
              }
 | 
					              }
 | 
				
			||||||
            },
 | 
					            }
 | 
				
			||||||
          });
 | 
					          });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          // 获取模拟车辆信息
 | 
					          // 获取模拟车辆信息
 | 
				
			||||||
          mapJson()
 | 
					          mapJson()
 | 
				
			||||||
            .then((res) => {
 | 
					            .then(res => {
 | 
				
			||||||
              let points: object = res.info.map((v: any) => {
 | 
					              let points: object = res.info.map((v: any) => {
 | 
				
			||||||
                return {
 | 
					                return {
 | 
				
			||||||
                  lnglat: [v.lng, v.lat],
 | 
					                  lnglat: [v.lng, v.lat],
 | 
				
			||||||
                  ...v,
 | 
					                  ...v
 | 
				
			||||||
                };
 | 
					                };
 | 
				
			||||||
              });
 | 
					              });
 | 
				
			||||||
              if (MarkerCluster) MarkerCluster.setData(points);
 | 
					              if (MarkerCluster) MarkerCluster.setData(points);
 | 
				
			||||||
            })
 | 
					            })
 | 
				
			||||||
            .catch((err) => {
 | 
					            .catch(err => {
 | 
				
			||||||
              console.log("err:", err);
 | 
					              console.log("err:", err);
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          complete();
 | 
					          complete();
 | 
				
			||||||
        })
 | 
					        })
 | 
				
			||||||
        .catch((err) => {
 | 
					        .catch(err => {
 | 
				
			||||||
          mapSet.loading = false;
 | 
					          mapSet.loading = false;
 | 
				
			||||||
          throw "地图加载失败,请重新加载";
 | 
					          throw "地图加载失败,请重新加载";
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
@ -148,9 +147,9 @@ export default defineComponent({
 | 
				
			|||||||
      ...toRefs(mapSet),
 | 
					      ...toRefs(mapSet),
 | 
				
			||||||
      complete,
 | 
					      complete,
 | 
				
			||||||
      destroyMap,
 | 
					      destroyMap,
 | 
				
			||||||
      greenCar,
 | 
					      greenCar
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
  },
 | 
					  }
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,11 +1,12 @@
 | 
				
			|||||||
// 延迟函数
 | 
					// 延迟函数
 | 
				
			||||||
export const delay = (timeout: number) => new Promise(resolve => setTimeout(resolve, timeout))
 | 
					export const delay = (timeout: number) =>
 | 
				
			||||||
 | 
					  new Promise((resolve) => setTimeout(resolve, timeout));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 防抖函数
 | 
					// 防抖函数
 | 
				
			||||||
export const debounce = (fn: () => any, timeout: number) => {
 | 
					export const debounce = (fn: () => Fn, timeout: number) => {
 | 
				
			||||||
  let timmer: any
 | 
					  let timmer: TimeoutHandle;
 | 
				
			||||||
  return () => {
 | 
					  return () => {
 | 
				
			||||||
    timmer ? clearTimeout(timmer) : null
 | 
					    timmer ? clearTimeout(timmer) : null;
 | 
				
			||||||
    timmer = setTimeout(fn, timeout)
 | 
					    timmer = setTimeout(fn, timeout);
 | 
				
			||||||
  }
 | 
					  };
 | 
				
			||||||
}
 | 
					};
 | 
				
			||||||
 | 
				
			|||||||
@ -1,18 +1,18 @@
 | 
				
			|||||||
interface deviceInter {
 | 
					interface deviceInter {
 | 
				
			||||||
  match: any
 | 
					  match: Fn;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 检测设备类型(手机返回true,反之)
 | 
					// 检测设备类型(手机返回true,反之)
 | 
				
			||||||
export const deviceDetection = () => {
 | 
					export const deviceDetection = () => {
 | 
				
			||||||
  let sUserAgent: deviceInter = navigator.userAgent.toLowerCase()
 | 
					  let sUserAgent: deviceInter = navigator.userAgent.toLowerCase();
 | 
				
			||||||
  let bIsIpad = sUserAgent.match(/ipad/i) == "ipad"
 | 
					  let bIsIpad = sUserAgent.match(/ipad/i) == "ipad";
 | 
				
			||||||
  let bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os"
 | 
					  let bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os";
 | 
				
			||||||
  let bIsMidp = sUserAgent.match(/midp/i) == "midp"
 | 
					  let bIsMidp = sUserAgent.match(/midp/i) == "midp";
 | 
				
			||||||
  let bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4"
 | 
					  let bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";
 | 
				
			||||||
  let bIsUc = sUserAgent.match(/ucweb/i) == "ucweb"
 | 
					  let bIsUc = sUserAgent.match(/ucweb/i) == "ucweb";
 | 
				
			||||||
  let bIsAndroid = sUserAgent.match(/android/i) == "android"
 | 
					  let bIsAndroid = sUserAgent.match(/android/i) == "android";
 | 
				
			||||||
  let bIsCE = sUserAgent.match(/windows ce/i) == "windows ce"
 | 
					  let bIsCE = sUserAgent.match(/windows ce/i) == "windows ce";
 | 
				
			||||||
  let bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile"
 | 
					  let bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";
 | 
				
			||||||
  return bIsIphoneOs ||
 | 
					  return bIsIphoneOs ||
 | 
				
			||||||
    bIsMidp ||
 | 
					    bIsMidp ||
 | 
				
			||||||
    bIsUc7 ||
 | 
					    bIsUc7 ||
 | 
				
			||||||
@ -21,5 +21,5 @@ export const deviceDetection = () => {
 | 
				
			|||||||
    bIsCE ||
 | 
					    bIsCE ||
 | 
				
			||||||
    bIsWM
 | 
					    bIsWM
 | 
				
			||||||
    ? true
 | 
					    ? true
 | 
				
			||||||
    : false
 | 
					    : false;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
				
			|||||||
@ -39,7 +39,7 @@ export default {
 | 
				
			|||||||
    SeamlessScroll
 | 
					    SeamlessScroll
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  setup() {
 | 
					  setup() {
 | 
				
			||||||
    const scroll = templateRef<HTMLElement | null>("scroll", null);
 | 
					    const scroll = templateRef<ElRef | null>("scroll", null);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let listData = ref([
 | 
					    let listData = ref([
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
@ -76,8 +76,8 @@ export default {
 | 
				
			|||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    function changeDirection(val) {
 | 
					    function changeDirection(val) {
 | 
				
			||||||
      scroll.value.reset();
 | 
					      unref(scroll).reset();
 | 
				
			||||||
      classOption.value.direction = val;
 | 
					      unref(classOption).direction = val;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return {
 | 
					    return {
 | 
				
			||||||
 | 
				
			|||||||
@ -30,7 +30,7 @@ import demoData from "./dataTurbo.json";
 | 
				
			|||||||
export default {
 | 
					export default {
 | 
				
			||||||
  components: { NodePanel, Control, DataDialog },
 | 
					  components: { NodePanel, Control, DataDialog },
 | 
				
			||||||
  setup() {
 | 
					  setup() {
 | 
				
			||||||
    let lf = ref(null);
 | 
					    let lf = ref<ElRef>(null);
 | 
				
			||||||
    let graphData = ref(null);
 | 
					    let graphData = ref(null);
 | 
				
			||||||
    let dataVisible = ref(false);
 | 
					    let dataVisible = ref(false);
 | 
				
			||||||
    let config = ref({
 | 
					    let config = ref({
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user