2023-01-13 16:54:26 +08:00
|
|
|
/*
|
|
|
|
* @Descripttion:
|
|
|
|
* @version:
|
|
|
|
* @Author: fzq
|
|
|
|
* @Date: 2022-11-25 09:51:46
|
|
|
|
* @LastEditors: fzq
|
|
|
|
* @LastEditTime: 2023-01-11 20:52:35
|
|
|
|
*/
|
2022-08-10 10:58:21 +08:00
|
|
|
/** filters */
|
2022-09-01 09:16:51 +08:00
|
|
|
import moment from 'moment'
|
2022-08-10 10:58:21 +08:00
|
|
|
|
|
|
|
export const dictFilter = dictTypeId => {
|
|
|
|
return val => {
|
|
|
|
return JSON.parse(localStorage.getItem('dictList'))[dictTypeId].find(item => item.dictValue === val)?.dictLabel || '-'
|
|
|
|
}
|
2022-09-01 09:16:51 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
export const timeFilter = (val) => {
|
|
|
|
return moment(val).format('YYYY-MM-DD HH:mm:ss')
|
|
|
|
}
|
2022-10-09 11:31:54 +08:00
|
|
|
|
|
|
|
export const pick = (obj, paths) => {
|
|
|
|
let result = {}
|
|
|
|
paths.forEach(key => {
|
|
|
|
if (obj.hasOwnProperty(key)) {
|
|
|
|
result[key] = obj[key];
|
|
|
|
} else {
|
|
|
|
result[key] = null
|
|
|
|
}
|
|
|
|
})
|
|
|
|
return result
|
2023-01-13 16:54:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// export function timeFormatter(timeObj) {
|
|
|
|
// if (timeObj) {
|
|
|
|
// return moment(timeObj).format('YYYY-MM-DD HH:mm:ss')
|
|
|
|
// } else {
|
|
|
|
// return '-'
|
|
|
|
// }
|
|
|
|
// }
|