| | |
| | | |
| | | |
| | | /** |
| | | * 通用js方法封装处理 |
| | | * Copyright (c) 2019 ruoyi |
| | |
| | | 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 |
| | | } |
| | |
| | | |
| | | // 回显数据字典(字符串、数组) |
| | | export function selectDictLabels(datas, value, separator) { |
| | | if (value === undefined || value.length ===0) { |
| | | if (value === undefined || value.length === 0) { |
| | | return ""; |
| | | } |
| | | if (Array.isArray(value)) { |
| | |
| | | |
| | | // 字符串格式化(%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') { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 参数处理 |
| | | * @param {*} params 参数 |
| | | */ |
| | | * 参数处理 |
| | | * @param {*} params 参数 |
| | | */ |
| | | export function tansParams(params) { |
| | | let result = '' |
| | | for (const propName of Object.keys(params)) { |
| | |
| | | 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; |
| | | } |