Authored by 李奇

unix时间格式过滤器添加

import Vue from 'vue';
import moneyShort from './money-short';
import timeFormat from './time-format';
Vue.filter('moneyShort', moneyShort);
Vue.filter('timeFormat', timeFormat);
... ...
import _ from 'lodash';
import moment from 'moment';
export default (value) => {
let format;
let unixStamp;
const isNum = _.isFinite(value);
const isObj = _.isPlainObject(value);
const defaultFmt = 'YYYY-MM-DD HH:mm:ss';
if (isNum) {
unixStamp = value;
format = defaultFmt;
} else if (isObj) {
unixStamp = value.time;
format = value.format || defaultFmt;
} else {
unixStamp = 'Invalid value.';
}
return moment.unix(unixStamp).format(format);
};
... ...
... ... @@ -4,6 +4,8 @@
* @date: 2017/06/01
*/
import timeFormat from 'filters/time-format';
export default function() {
return {
filters: {
... ... @@ -95,7 +97,12 @@ export default function() {
},
{
title: '请退/退库时间',
align: 'center'
align: 'center',
render: (h, params) => {
return (
<span>{timeFormat(params.row.createTime)}</span>
);
}
},
{
title: '申请人',
... ...