mooho-base-admin-plus 2.7.6 → 2.7.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mooho-base-admin-plus",
3
3
  "description": "MOOHO basic framework for admin by Vue3",
4
- "version": "2.7.6",
4
+ "version": "2.7.7",
5
5
  "author": "jinyifan <jinyifan@mooho.com.cn>",
6
6
  "license": "MIT",
7
7
  "private": false,
package/src/index.js CHANGED
@@ -32,6 +32,9 @@ import i18n from './i18n';
32
32
  // 路由工厂
33
33
  import router, { initRouter } from './router';
34
34
 
35
+ // 数据显示格式
36
+ import showFormat from './libs/showFormat';
37
+
35
38
  // API
36
39
  import modelApi from './api/model';
37
40
  import customModelApi from './api/customModel';
@@ -195,6 +198,7 @@ export {
195
198
  applicationApi,
196
199
  util,
197
200
  router,
201
+ showFormat,
198
202
  initRouter,
199
203
  created
200
204
  };
@@ -0,0 +1 @@
1
+ export default {};
@@ -5,6 +5,7 @@ import { mapState, mapActions, mapMutations } from 'vuex';
5
5
  import dateFormat from 'date-fns/format';
6
6
  import Setting from '../setting';
7
7
  import sweetalert2 from 'sweetalert2';
8
+ import showFormat from '../libs/showFormat';
8
9
 
9
10
  /**
10
11
  * 页面公共混合
@@ -74,6 +75,7 @@ export default {
74
75
  ...mapState('admin/user', ['info']),
75
76
  ...mapState('admin/cache', ['userNames', 'enums', 'dicts', 'caches']),
76
77
  ...mapState('admin/menu', ['userPermissions']),
78
+ ...mapState('admin/displayFormat', ['defaultFormat']),
77
79
  rootPath() {
78
80
  return !(import.meta.env.VITE_APP_BASE_PATH || '').trim() ? '/static/' : '/' + import.meta.env.VITE_APP_BASE_PATH + '/static/';
79
81
  },
@@ -254,6 +256,14 @@ export default {
254
256
  return null;
255
257
  }
256
258
 
259
+ if (showFormat.customFormat) {
260
+ let result = showFormat.customFormat(model, column);
261
+
262
+ if (result != null) {
263
+ return result;
264
+ }
265
+ }
266
+
257
267
  if (dataType === 'DateTime') {
258
268
  // 日期
259
269
  if (!!(format || '').trim()) {
package/test/main.js CHANGED
@@ -5,7 +5,7 @@ if (!!window.ActiveXObject || 'ActiveXObject' in window) {
5
5
  import { createApp, h } from 'vue';
6
6
 
7
7
  // 基础框架
8
- import { App, created } from '../src';
8
+ import { App, created, showFormat } from '../src';
9
9
 
10
10
  // 固定路由
11
11
  import routes from './router/routes';
@@ -24,4 +24,8 @@ const app = createApp({
24
24
  created: () => created(app, routes, files)
25
25
  });
26
26
 
27
+ showFormat.customFormat = (model, column) => {
28
+ console.log('customFormat', model, column);
29
+ };
30
+
27
31
  app.mount('#app');