diff --git a/main.js b/main.js index ab2c781..a2ec641 100644 --- a/main.js +++ b/main.js @@ -2,19 +2,23 @@ import Vue from 'vue' import App from './App' import store from './store' // store import plugins from './plugins' // plugins +import { + formatNumber +} from './utils/filters.js' //数据过滤 import './permission' // permission -import { getDicts } from "@/api/system/dict/data" +import { + getDicts +} from "@/api/system/dict/data" Vue.use(plugins) - Vue.config.productionTip = false Vue.prototype.$store = store Vue.prototype.getDicts = getDicts - +Vue.filter('formatNumber', formatNumber) App.mpType = 'app' const app = new Vue({ - ...App + ...App }) -app.$mount() +app.$mount() \ No newline at end of file diff --git a/pages/work/bmsdcc/index.vue b/pages/work/bmsdcc/index.vue index cb89342..ab2e4cb 100644 --- a/pages/work/bmsdcc/index.vue +++ b/pages/work/bmsdcc/index.vue @@ -34,7 +34,7 @@ :key="infoDataIndex+'infoData'"> {{infoDataItem.label}} - {{item[infoDataItem.attr]}} + {{item[infoDataItem.attr] | formatNumber}} diff --git a/pages/work/bmszl/index.vue b/pages/work/bmszl/index.vue index 692b090..02ec050 100644 --- a/pages/work/bmszl/index.vue +++ b/pages/work/bmszl/index.vue @@ -34,7 +34,7 @@ :key="infoDataIndex+'infoData'"> {{infoDataItem.label}} - {{item[infoDataItem.attr]}} + {{item[infoDataItem.attr] | formatNumber}} diff --git a/pages/work/db/index.vue b/pages/work/db/index.vue index e0bfdec..3444d47 100644 --- a/pages/work/db/index.vue +++ b/pages/work/db/index.vue @@ -188,6 +188,10 @@ // 运行状态颜色区分 .running { + .uni-group__title { + background-color: #05AEA3; + } + .uni-collapse-item__title-text { color: #05AEA3; } @@ -199,6 +203,10 @@ } .danger { + .uni-group__title { + background-color: #FC6B69; + } + .uni-collapse-item__title-text { color: #FC6B69; } diff --git a/pages/work/pcs/index.vue b/pages/work/pcs/index.vue index f70a2f6..6aee6c5 100644 --- a/pages/work/pcs/index.vue +++ b/pages/work/pcs/index.vue @@ -5,7 +5,7 @@ {{item.title}} - {{runningHeadInfo[item.attr] || '-'}} + {{runningHeadInfo[item.attr] | formatNumber}} @@ -61,7 +61,7 @@ :key="infoDataIndex+'infoData'"> {{infoDataItem.label}} - {{item[infoDataItem.attr]}} + {{item[infoDataItem.attr] | formatNumber}} diff --git a/utils/filters.js b/utils/filters.js new file mode 100644 index 0000000..b8da6a1 --- /dev/null +++ b/utils/filters.js @@ -0,0 +1,27 @@ +export const formatNumber = (val) => { + if (val || [0, '0'].includes(val)) { + return val + } else { + return '-' + } +} + + +export const formatDate = (val, toSeconds = false, onlyTime = false) => { + if (!val) return '' + const date = new Date(val) + const month = date.getMonth() + 1, + day = date.getDate() + const hours = date.getHours(), + minuets = date.getMinutes(), + seconds = date.getSeconds(); + const front = `${date.getFullYear()}-${month<10?'0'+month : month}-${day<10 ? '0'+day : day}` + const back = + `${hours<10 ? '0'+hours : hours}:${minuets<10 ? '0'+minuets : minuets}:${seconds<10 ? '0'+seconds : seconds}` + if (onlyTime) return back + if (!toSeconds) { + return front + } else { + return front + '' + back + } +} \ No newline at end of file