fuliqi
2024-11-22 88e29ed5854ed9e62b719e4804958206c5fd9db1
src/utils/ruoyi.js
@@ -1,5 +1,3 @@
/**
 * 通用js方法封装处理
 * Copyright (c) 2019 ruoyi
@@ -37,7 +35,9 @@
  const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
    let value = formatObj[key]
    // Note: getDay() returns 0 on Sunday
    if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value] }
    if (key === 'a') {
      return ['日', '一', '二', '三', '四', '五', '六'][value]
    }
    if (result.length > 0 && value < 10) {
      value = '0' + value
    }
@@ -88,7 +88,7 @@
// 回显数据字典(字符串、数组)
export function selectDictLabels(datas, value, separator) {
  if (value === undefined || value.length ===0) {
  if (value === undefined || value.length === 0) {
    return "";
  }
  if (Array.isArray(value)) {
@@ -114,7 +114,9 @@
// 字符串格式化(%s )
export function sprintf(str) {
  var args = arguments, flag = true, i = 1;
  var args = arguments,
    flag = true,
    i = 1;
  str = str.replace(/%s/g, function () {
    var arg = args[i++];
    if (typeof arg === 'undefined') {
@@ -202,9 +204,9 @@
}
/**
* 参数处理
* @param {*} params  参数
*/
 * 参数处理
 * @param {*} params  参数
 */
export function tansParams(params) {
  let result = ''
  for (const propName of Object.keys(params)) {
@@ -231,3 +233,15 @@
export function blobValidate(data) {
  return data.type !== 'application/json'
}
export function getNormalPath(p) {
  if (p.length === 0 || !p || p === 'undefined') {
    return p;
  }
  const res = p.replace('//', '/');
  if (res[res.length - 1] === '/') {
    return res.slice(0, res.length - 1);
  }
  return res;
}