qin
2024-04-01 d1a50163e4d445bc8451cf68cf0791caf7c410e0
IStation.Web.LargeScreen/Scripts/common.js
@@ -1,6 +1,6 @@
/*和业务有关的辅助类*/
class IStationCommon {
    static getCorpID() {
        var corpID = "";
@@ -31,17 +31,17 @@
            return themeType;
        }
    }
}
/*和业务无关的辅助类*/
class Utils {
    constructor() {
    }
    /*检测类名*/
    static  hasClassStyle(ele, name) {
    static hasClassStyle(ele, name) {
        return ele.className.match(new RegExp('(\\s|^)' + name + '(\\s|$)'));
    }
@@ -75,7 +75,7 @@
        }
        return eleMatch;
    }
    //创建存储唯一键名的函数
    static createUniqueKey() {
        return new Date().getTime() + Math.random();
@@ -134,7 +134,7 @@
            return false
        }
    }
    static  isPC() { //是否为PC端
    static isPC() { //是否为PC端
        var userAgentInfo = navigator.userAgent;
        var Agents = ["Android", "iPhone",
            "SymbianOS", "Windows Phone",
@@ -220,7 +220,13 @@
    /**
     * 格式化数字 解决小数精度 解决一般问题
     * @param {any} n
     */
    static formatNumber(n) {
        return parseFloat(parseFloat(n).toFixed(12))
    }
@@ -345,7 +351,7 @@
    *
    * @example formatTime('2018-1-29', 'yyyy-MM-dd hh:mm:ss') // -> 2018/01/29 00:00:00
    */
    static  formatTime(template, date) {
    static formatTime(template, date) {
        var today = date ? new Date(date) : new Date();
        var o = {
            "M+": today.getMonth() + 1,                 //月份
@@ -377,7 +383,7 @@
    *
    * @example formatTime('2018-1-29', '{y}/{m}/{d} {h}:{i}:{s}') // -> 2018/01/29 00:00:00
    */
    static  formatTime2(time, cFormat) {
    static formatTime2(time, cFormat) {
        if (arguments.length === 0) return null
        if ((time + '').length === 10) {
            time = +time * 1000
@@ -538,7 +544,7 @@
    static containsInArray(arr, val) {
        return arr.indexOf(val) != -1 ? true : false;
    }
    /**
     * @param {arr} 数组
     * @param {type} 1:从小到大  2:从大到小  3:随机
@@ -599,7 +605,7 @@
        return arr;
    }
    /*最大值*/
    static maxInArray(arr) {
@@ -707,7 +713,7 @@
    }
    /*过滤html代码(把<>转换)*/
    static  filterHtmlTag(str) {
    static filterHtmlTag(str) {
        str = str.replace(/&/ig, "&");
        str = str.replace(/</ig, "<");
        str = str.replace(/>/ig, ">");
@@ -749,7 +755,7 @@
            return 0;
        if (value > 100)
            return  value.toFixed(1);
            return value.toFixed(1);
        else if (value > 10)
            return value.toFixed(2);
        else
@@ -995,7 +1001,7 @@
    }
    /*删除cookie*/
    static  removeCookie(name) {
    static removeCookie(name) {
        this.setCookie(name, 1, -1);
    }
@@ -1024,7 +1030,7 @@
    }
    /*移除所有localStorage*/
    static  clearLocalStorage() {
    static clearLocalStorage() {
        window.localStorage.clear()
    }
@@ -1060,7 +1066,7 @@
    }
    //获取客户端ip地址需创建id为address的标签
    static getYourIP() {
@@ -1170,7 +1176,7 @@
    //Other
    /*获取网址参数,name为网址中的参数键值*/
    static  getURL(name) {
    static getURL(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);
        if (r != null) return r[2]; return null;
@@ -1195,7 +1201,7 @@
    }
    /*删除url指定参数,返回url*/
    static  delParamsUrl(url, name) {
    static delParamsUrl(url, name) {
        var baseUrl = url.split('?')[0] + '?';
        var query = url.split('?')[1];
        if (query.indexOf(name) > -1) {