|
|
@ -1,7 +1,7 @@ |
|
|
import { parseTime } from './ruoyi' |
|
|
import { parseTime } from './ruoyi' |
|
|
import { encrypt, decrypt } from '@/utils/encryptUtil' |
|
|
import { encrypt, decrypt } from '@/utils/encryptUtil' |
|
|
import moment from 'moment' |
|
|
import moment from 'moment' |
|
|
import {EventBus} from './eventBus' |
|
|
|
|
|
|
|
|
import { EventBus } from './eventBus' |
|
|
/** |
|
|
/** |
|
|
* 表格时间格式化 |
|
|
* 表格时间格式化 |
|
|
*/ |
|
|
*/ |
|
|
@ -419,8 +419,8 @@ export const getExpireDate = ( |
|
|
effectivePeriod, |
|
|
effectivePeriod, |
|
|
effectivePeriodUnit |
|
|
effectivePeriodUnit |
|
|
) => { |
|
|
) => { |
|
|
if(effectivePeriod === "NA" || effectivePeriodUnit === "NA"){ |
|
|
|
|
|
return "NA"; |
|
|
|
|
|
|
|
|
if (effectivePeriod === 'NA' || effectivePeriodUnit === 'NA') { |
|
|
|
|
|
return 'NA' |
|
|
} |
|
|
} |
|
|
const start = moment(startDate) |
|
|
const start = moment(startDate) |
|
|
const unit = effectivePeriodUnit === '天' ? 'days' : 'hours' |
|
|
const unit = effectivePeriodUnit === '天' ? 'days' : 'hours' |
|
|
@ -436,7 +436,12 @@ export function getuuid() { |
|
|
|
|
|
|
|
|
// 判断值是否为空
|
|
|
// 判断值是否为空
|
|
|
export function isValueEmpty(value) { |
|
|
export function isValueEmpty(value) { |
|
|
if (value === null || value === undefined || value === '' || value === false) { |
|
|
|
|
|
|
|
|
if ( |
|
|
|
|
|
value === null || |
|
|
|
|
|
value === undefined || |
|
|
|
|
|
value === '' || |
|
|
|
|
|
value === false |
|
|
|
|
|
) { |
|
|
return true |
|
|
return true |
|
|
} |
|
|
} |
|
|
if (typeof value === 'string' && value.trim() === '') { |
|
|
if (typeof value === 'string' && value.trim() === '') { |
|
|
@ -446,7 +451,7 @@ export function isValueEmpty(value) { |
|
|
return true |
|
|
return true |
|
|
} |
|
|
} |
|
|
if (Object.keys(value).length === 0 && typeof value == 'object') { |
|
|
if (Object.keys(value).length === 0 && typeof value == 'object') { |
|
|
return true; |
|
|
|
|
|
|
|
|
return true |
|
|
} |
|
|
} |
|
|
return false |
|
|
return false |
|
|
} |
|
|
} |
|
|
@ -591,31 +596,31 @@ export function getStringWidth(str) { |
|
|
|
|
|
|
|
|
//根据选项获取默认值,为了
|
|
|
//根据选项获取默认值,为了
|
|
|
export const getDefaultValueByOptions = (options = []) => { |
|
|
export const getDefaultValueByOptions = (options = []) => { |
|
|
const arr = []; |
|
|
|
|
|
options.forEach(item => { |
|
|
|
|
|
const { children = [], label } = item; |
|
|
|
|
|
|
|
|
const arr = [] |
|
|
|
|
|
options.forEach((item) => { |
|
|
|
|
|
const { children = [], label } = item |
|
|
//目前只考虑2层,也不考虑label值重复的问题;
|
|
|
//目前只考虑2层,也不考虑label值重复的问题;
|
|
|
if (children.length > 0) { |
|
|
if (children.length > 0) { |
|
|
children.forEach(child => { |
|
|
|
|
|
|
|
|
children.forEach((child) => { |
|
|
arr.push({ label: child.label, checked: undefined }) |
|
|
arr.push({ label: child.label, checked: undefined }) |
|
|
}) |
|
|
}) |
|
|
} else { |
|
|
} else { |
|
|
arr.push({ label, checked: undefined }) |
|
|
arr.push({ label, checked: undefined }) |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
return arr; |
|
|
|
|
|
|
|
|
return arr |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 只是更新已填写的表单数据,不触发其他事件
|
|
|
// 只是更新已填写的表单数据,不触发其他事件
|
|
|
export const justUpdateFilledFormData = () => { |
|
|
export const justUpdateFilledFormData = () => { |
|
|
const params = { |
|
|
const params = { |
|
|
type: "fieldChanged", |
|
|
|
|
|
|
|
|
type: 'fieldChanged', |
|
|
newRecord: null, |
|
|
newRecord: null, |
|
|
resourceList: null, |
|
|
|
|
|
|
|
|
resourceList: null |
|
|
} |
|
|
} |
|
|
EventBus.$emit('onModifyRecord', params,) |
|
|
|
|
|
|
|
|
EventBus.$emit('onModifyRecord', params) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
export const formatNumberByDigits =(num, digits = 3)=> { |
|
|
|
|
|
return num.toString().padStart(digits, '0'); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
export const formatNumberByDigits = (num, digits = 3) => { |
|
|
|
|
|
return num.toString().padStart(digits, '0') |
|
|
|
|
|
} |