mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-07-30 02:45:08 +08:00
替换var 为const/let
删除未使用import 替换 == 为 ===
This commit is contained in:
@ -18,7 +18,7 @@ export function parseTime(time, pattern) {
|
||||
if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
|
||||
time = parseInt(time)
|
||||
} else if (typeof time === 'string') {
|
||||
time = time.replace(new RegExp(/-/gm), '/').replace('T', ' ').replace(new RegExp(/\.[\d]{3}/gm),'');
|
||||
time = time.replace(new RegExp(/-/gm), '/').replace('T', ' ').replace(new RegExp(/\.\d{3}/gm),'');
|
||||
}
|
||||
if ((typeof time === 'number') && (time.toString().length === 10)) {
|
||||
time = time * 1000
|
||||
@ -34,7 +34,7 @@ export function parseTime(time, pattern) {
|
||||
s: date.getSeconds(),
|
||||
a: date.getDay()
|
||||
}
|
||||
const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
|
||||
const time_str = format.replace(/{([ymdhisa])+}/g, (result, key) => {
|
||||
let value = formatObj[key]
|
||||
// Note: getDay() returns 0 on Sunday
|
||||
if (key === 'a') {
|
||||
@ -102,9 +102,11 @@ export function addBeginAndEndTime(params, dateRange, propName) {
|
||||
|
||||
// 字符串格式化(%s )
|
||||
export function sprintf(str) {
|
||||
var args = arguments, flag = true, i = 1;
|
||||
const args = arguments
|
||||
let flag = true
|
||||
const i = 1
|
||||
str = str.replace(/%s/g, function () {
|
||||
var arg = args[i++];
|
||||
const arg = args[i++]
|
||||
if (typeof arg === 'undefined') {
|
||||
flag = false;
|
||||
return '';
|
||||
@ -116,7 +118,7 @@ export function sprintf(str) {
|
||||
|
||||
// 转换字符串,undefined,null等转化为""
|
||||
export function praseStrEmpty(str) {
|
||||
if (!str || str == "undefined" || str == "null") {
|
||||
if (!str || str === "undefined" || str === "null") {
|
||||
return "";
|
||||
}
|
||||
return str;
|
||||
@ -244,7 +246,7 @@ export function getPath(path) {
|
||||
* @returns
|
||||
*/
|
||||
export function divide(divisor, dividend) {
|
||||
if(divisor == null || dividend == null || dividend == 0){
|
||||
if(divisor == null || dividend == null || dividend === 0){
|
||||
return null;
|
||||
}
|
||||
return Math.floor(divisor/dividend*100)/100;
|
||||
|
Reference in New Issue
Block a user