upd: 编码规范

This commit is contained in:
2025-03-24 20:10:58 +08:00
parent c3afa4361e
commit 8c65ac7d16
23 changed files with 920 additions and 71 deletions
+55
View File
@@ -9,6 +9,15 @@ import Element from 'element-ui'
// 数据字典
import dict from './components/Dict'
// 防止二次提交
import { preventReClick } from '@/utils/commands'
// 一键复制插件
import VueClipboard from 'vue-clipboard2'
// 窗口分割组件
import SplitPane from 'vue-splitpane'
// 权限指令
import checkPer from '@/utils/permission'
import permission from './components/Permission'
@@ -27,10 +36,56 @@ import './router/index' // permission control
Vue.use(checkPer)
Vue.use(permission)
Vue.use(dict)
Vue.use(preventReClick)
Vue.use(VueClipboard)
Vue.use(Element, {
size: Cookies.get('size') || 'small' // set element-ui default size
})
Vue.component('split-pane', SplitPane)
/**
* 日期格式化<br/>
* 例子: <el-tag>{{ scope.row.createTime | dateFormat }}</el-tag>
*/
Vue.filter('dateFormat', function(originVal) {
if (originVal === undefined) {
return ''
}
const dt = new Date(originVal)
const y = dt.getFullYear()
const m = (dt.getMonth() + 1 + '').padStart(2, '0')
const d = (dt.getDate() + '').padStart(2, '0')
return `${y}-${m}-${d}`
})
/**
* 日期时间格式化
*/
Vue.filter('dateTimeFormat', function(originVal) {
if (originVal === undefined) {
return ''
}
const dt = new Date(originVal)
const y = dt.getFullYear()
const m = (dt.getMonth() + 1 + '').padStart(2, '0')
const d = (dt.getDate() + '').padStart(2, '0')
const hh = (dt.getHours() + '').padStart(2, '0')
const mm = (dt.getMinutes() + '').padStart(2, '0')
const ss = (dt.getSeconds() + '').padStart(2, '0')
return `${y}-${m}-${d} ${hh}:${mm}:${ss}`
})
/**
* 金额格式化
*/
Vue.filter('priceFormat', function(data) {
if (data !== undefined && data != null) {
return data.toFixed(2)
}
return 0.00
})
Vue.config.productionTip = false
new Vue({