123456789101112131415161718192021222324252627282930313233343536 |
- import Vue from 'vue'
- import moment from 'moment'
- import { Constant } from '@/constant'
- import 'moment/locale/zh-cn'
- import DictCache from '@/utils/dict'
- moment.locale('zh-cn')
- Vue.filter('NumberFormat', function (value) {
- if (!value) {
- return '0'
- }
- const intPartFormat = value.toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') // 将整数部分逢三一断
- return intPartFormat
- })
- Vue.filter('dayjs', function (dataStr, pattern = 'YYYY-MM-DD HH:mm:ss') {
- return moment(dataStr).format(pattern)
- })
- Vue.filter('moment', function (dataStr, pattern = 'YYYY-MM-DD HH:mm:ss') {
- return moment(dataStr).format(pattern)
- })
- Vue.filter('statusConstantText', function (val, type) {
- return Constant[type][val].text
- })
- Vue.filter('statusConstantStatus', function (val, type) {
- return Constant[type][val].status
- })
- Vue.filter('statusDictText', function (val, type) {
- // return '成功'
- return DictCache.getLabelByValue(type, val)
- })
- Vue.filter('statusDictStatus', function (val, color) {
- return DictCache.COLOR[color][val]
- })
|