mooho-base-admin-plus 2.7.7 → 2.8.0

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.7",
4
+ "version": "2.8.0",
5
5
  "author": "jinyifan <jinyifan@mooho.com.cn>",
6
6
  "license": "MIT",
7
7
  "private": false,
package/public/setting.js CHANGED
@@ -66,7 +66,7 @@ window.setting = {
66
66
  // 全局面包屑是否显示图标,开启 showBreadcrumb 时有效
67
67
  showBreadcrumbIcon: false,
68
68
  // 是否显示多语言
69
- showI18n: true,
69
+ showI18n: false,
70
70
  // 是否支持动态修改布局配置,移动端下会自动强制关闭
71
71
  enableSetting: false,
72
72
  // 退出登录时,是否二次确认
@@ -56,21 +56,26 @@ export default {
56
56
  }
57
57
  });
58
58
  },
59
- query(modelName, filter) {
59
+ query(modelName, filter, columns, tableView) {
60
60
  let path = filter.isGroupBy ? 'group' : 'query';
61
+
62
+ let data = {
63
+ modelName,
64
+ ...filter,
65
+ columns,
66
+ viewCode: tableView ? tableView.code : null
67
+ };
68
+
61
69
  return request({
62
70
  url: `api/${res}/${path}`,
63
71
  method: 'post',
64
- data: {
65
- ...filter,
66
- modelName
67
- }
72
+ data
68
73
  });
69
74
  },
70
75
  async exportExcel(tableView, filter) {
71
76
  let data = {
72
- ...filter,
73
77
  modelName: tableView.model,
78
+ ...filter,
74
79
  per: tableView.maxExportCount == null ? 1000000 : tableView.maxExportCount,
75
80
  returnType: 1,
76
81
  viewCode: !!(tableView.exportDataViewCode || '').trim() ? tableView.exportDataViewCode : tableView.code
@@ -104,8 +109,8 @@ export default {
104
109
  },
105
110
  async exportPdf(tableView, filter) {
106
111
  let data = {
107
- ...filter,
108
112
  modelName: tableView.model,
113
+ ...filter,
109
114
  per: 100000,
110
115
  returnType: 3,
111
116
  viewCode: !!(tableView.exportDataViewCode || '').trim() ? tableView.exportDataViewCode : tableView.code
@@ -7,22 +7,24 @@ const res = 'DataSource';
7
7
 
8
8
  export default {
9
9
  query(dataSource, filter) {
10
+ let data = {
11
+ dataSource,
12
+ ...filter
13
+ };
14
+
10
15
  return request({
11
16
  url: `api/${res}/query`,
12
17
  method: 'post',
13
- data: {
14
- ...filter,
15
- dataSource
16
- }
18
+ data
17
19
  });
18
20
  },
19
21
  async exportExcel(tableView, filter, path = 'query') {
20
22
  let data = {
23
+ dataSource: tableView.dataSource,
21
24
  ...filter,
22
25
  per: tableView.maxExportCount == null ? 1000000 : tableView.maxExportCount,
23
26
  returnType: 1,
24
- viewCode: !!(tableView.exportDataViewCode || '').trim() ? tableView.exportDataViewCode : tableView.code,
25
- dataSource: tableView.dataSource
27
+ viewCode: !!(tableView.exportDataViewCode || '').trim() ? tableView.exportDataViewCode : tableView.code
26
28
  };
27
29
 
28
30
  const result = await request({
@@ -39,11 +41,11 @@ export default {
39
41
  },
40
42
  async exportPdf(tableView, filter, path = 'query') {
41
43
  let data = {
44
+ dataSource: tableView.dataSource,
42
45
  ...filter,
43
46
  per: 100000,
44
47
  returnType: 3,
45
- viewCode: !!(tableView.exportDataViewCode || '').trim() ? tableView.exportDataViewCode : tableView.code,
46
- dataSource: tableView.dataSource
48
+ viewCode: !!(tableView.exportDataViewCode || '').trim() ? tableView.exportDataViewCode : tableView.code
47
49
  };
48
50
 
49
51
  const result = await request({
package/src/api/model.js CHANGED
@@ -60,7 +60,7 @@ export default {
60
60
  }
61
61
  });
62
62
  },
63
- query(res, filter, path, method) {
63
+ query(res, filter, columns, tableView, path, method) {
64
64
  if (path == null || path == '') {
65
65
  path = 'query';
66
66
  }
@@ -69,19 +69,25 @@ export default {
69
69
  method = 'post';
70
70
  }
71
71
 
72
+ let data = {
73
+ ...filter,
74
+ columns,
75
+ viewCode: tableView ? tableView.code : null
76
+ };
77
+
72
78
  if (filter.isGroupBy) {
73
- filter.modelName = res;
79
+ data.modelName = res;
74
80
 
75
81
  return request({
76
82
  url: `api/Model/group`,
77
83
  method: 'post',
78
- data: filter
84
+ data
79
85
  });
80
86
  } else {
81
87
  return request({
82
88
  url: `api/${res}/${path}`,
83
89
  method: method,
84
- data: filter
90
+ data
85
91
  });
86
92
  }
87
93
  },
@@ -164,9 +164,9 @@
164
164
  let res;
165
165
 
166
166
  if (this.column.isSourceCustom) {
167
- res = await customModelApi.query(this.column.source, param);
167
+ res = await customModelApi.query(this.column.source, param, [this.column.sourceDataCode, this.column.sourceDisplayCode]);
168
168
  } else {
169
- res = await modelApi.query(this.column.source, param);
169
+ res = await modelApi.query(this.column.source, param, [this.column.sourceDataCode, this.column.sourceDisplayCode]);
170
170
  }
171
171
 
172
172
  res.data.forEach(item => {
@@ -140,7 +140,7 @@
140
140
 
141
141
  this.loadDataView(this.source).then(async view => {
142
142
  if (view.dataView.isCustom) {
143
- let res = await customModelApi.query(view.dataView.model, filter);
143
+ let res = await customModelApi.query(view.dataView.model, filter, [this.sourceDataCode, this.sourceDisplayCode]);
144
144
  if (res.data.length > 0) {
145
145
  this.selected = res.data
146
146
  .map(item => {
@@ -164,7 +164,7 @@
164
164
  //this.$forceUpdate();
165
165
  }
166
166
  } else {
167
- let res = await modelApi.query(view.dataView.model, filter);
167
+ let res = await modelApi.query(view.dataView.model, filter, [this.sourceDataCode, this.sourceDisplayCode]);
168
168
  if (res.data.length > 0) {
169
169
  this.selected = res.data
170
170
  .map(item => {
@@ -473,9 +473,9 @@
473
473
  this.disableLoader();
474
474
  let res;
475
475
  if (column.isSourceCustom) {
476
- res = await customModelApi.query(column.source, param);
476
+ res = await customModelApi.query(column.source, param, [column.sourceDataCode, column.sourceDisplayCode]);
477
477
  } else {
478
- res = await modelApi.query(column.source, param);
478
+ res = await modelApi.query(column.source, param, [column.sourceDataCode, column.sourceDisplayCode]);
479
479
  }
480
480
  this.enableLoader();
481
481
 
@@ -208,7 +208,7 @@
208
208
  this.total = res.totalCount;
209
209
  this.data = res.table;
210
210
  } else {
211
- let res = await modelApi.query(this.tableView.model, filter, this.tableView.functionName, this.tableView.functionType);
211
+ let res = await modelApi.query(this.tableView.model, filter, null, null, this.tableView.functionName, this.tableView.functionType);
212
212
 
213
213
  this.total = res.totalCount;
214
214
  this.data = res.data;
@@ -647,9 +647,9 @@
647
647
  this.disableLoader();
648
648
  let res;
649
649
  if (column.isSourceCustom) {
650
- res = await customModelApi.query(column.source, param);
650
+ res = await customModelApi.query(column.source, param, [column.sourceDataCode, column.sourceDisplayCode]);
651
651
  } else {
652
- res = await modelApi.query(column.source, param);
652
+ res = await modelApi.query(column.source, param, [column.sourceDataCode, column.sourceDisplayCode]);
653
653
  }
654
654
  this.enableLoader();
655
655
 
@@ -836,9 +836,9 @@
836
836
  }
837
837
 
838
838
  if (column.isSourceCustom) {
839
- res = await customModelApi.query(column.sourceModel, param);
839
+ res = await customModelApi.query(column.sourceModel, param, null, tableView.isReturnSimple ? tableView : null);
840
840
  } else {
841
- res = await modelApi.query(column.sourceModel, param, tableView.functionName, tableView.functionType);
841
+ res = await modelApi.query(column.sourceModel, param, null, tableView.isReturnSimple ? tableView : null, tableView.functionName, tableView.functionType);
842
842
  }
843
843
 
844
844
  this.$refs['list_' + column.code][0].loadData(res.data);
@@ -1119,9 +1119,9 @@
1119
1119
  let res;
1120
1120
 
1121
1121
  if (column.isSourceCustom) {
1122
- res = await customModelApi.query(column.source, param);
1122
+ res = await customModelApi.query(column.source, param, [column.sourceDataCode, column.sourceDisplayCode]);
1123
1123
  } else {
1124
- res = await modelApi.query(column.source, param);
1124
+ res = await modelApi.query(column.source, param, [column.sourceDataCode, column.sourceDisplayCode]);
1125
1125
  }
1126
1126
 
1127
1127
  res.data.forEach(item => {
@@ -606,9 +606,9 @@
606
606
  param[column.sourceDataCode] = this.data.id;
607
607
 
608
608
  if (column.isSourceCustom) {
609
- res = await customModelApi.query(column.sourceModel, param);
609
+ res = await customModelApi.query(column.sourceModel, param, null, tableView.isReturnSimple ? tableView : null);
610
610
  } else {
611
- res = await modelApi.query(column.sourceModel, param, tableView.functionName, tableView.functionType);
611
+ res = await modelApi.query(column.sourceModel, param, null, tableView.isReturnSimple ? tableView : null, tableView.functionName, tableView.functionType);
612
612
  }
613
613
 
614
614
  this.$refs['table_' + column.code][0].loadData(res.data);
@@ -1166,9 +1166,9 @@
1166
1166
  this.disableLoader();
1167
1167
  let res;
1168
1168
  if (column.isSourceCustom) {
1169
- res = await customModelApi.query(column.source, param);
1169
+ res = await customModelApi.query(column.source, param, [column.sourceDataCode, column.sourceDisplayCode]);
1170
1170
  } else {
1171
- res = await modelApi.query(column.source, param);
1171
+ res = await modelApi.query(column.source, param, [column.sourceDataCode, column.sourceDisplayCode]);
1172
1172
  }
1173
1173
  this.enableLoader();
1174
1174
 
@@ -1284,7 +1284,7 @@
1284
1284
  }
1285
1285
 
1286
1286
  if (this.tableView.isCustom) {
1287
- let res = await customModelApi.query(this.tableView.model, data);
1287
+ let res = await customModelApi.query(this.tableView.model, data, null, this.tableView.isReturnSimple ? this.tableView : null);
1288
1288
 
1289
1289
  this.total = res.totalCount;
1290
1290
  this.data = res.data;
@@ -1294,7 +1294,14 @@
1294
1294
  this.total = res.totalCount;
1295
1295
  this.data = res.table;
1296
1296
  } else {
1297
- let res = await modelApi.query(this.tableView.model, data, this.tableView.functionName, this.tableView.functionType);
1297
+ let res = await modelApi.query(
1298
+ this.tableView.model,
1299
+ data,
1300
+ null,
1301
+ this.tableView.isReturnSimple ? this.tableView : null,
1302
+ this.tableView.functionName,
1303
+ this.tableView.functionType
1304
+ );
1298
1305
 
1299
1306
  this.total = res.totalCount;
1300
1307
  this.data = res.data;
@@ -1412,12 +1419,19 @@
1412
1419
  * @param {int} index 行序号
1413
1420
  * @public
1414
1421
  */
1415
- edit(row, index) {
1422
+ async edit(row, index) {
1423
+ let data = row;
1424
+ if (this.tableView.isCustom) {
1425
+ data = await customModelApi.get(this.tableView.model, row.id);
1426
+ } else if (!this.tableView.isDataSource) {
1427
+ data = await modelApi.get(this.tableView.model, row.id);
1428
+ }
1429
+
1416
1430
  /**
1417
1431
  * 编辑事件
1418
1432
  * @property {object} args { row 行对象, index 行序号 }
1419
1433
  */
1420
- this.$emit('edit', { row, index });
1434
+ this.$emit('edit', { row: data, index });
1421
1435
  },
1422
1436
  /**
1423
1437
  * 查看项
@@ -1426,12 +1440,19 @@
1426
1440
  * @param {int} index 行序号
1427
1441
  * @public
1428
1442
  */
1429
- show(row, index) {
1443
+ async show(row, index) {
1444
+ let data = row;
1445
+ if (this.tableView.isCustom) {
1446
+ data = await customModelApi.get(this.tableView.model, row.id);
1447
+ } else if (!this.tableView.isDataSource) {
1448
+ data = await modelApi.get(this.tableView.model, row.id);
1449
+ }
1450
+
1430
1451
  /**
1431
1452
  * 查看事件
1432
1453
  * @property {object} args { row 行对象, index 行序号 }
1433
1454
  */
1434
- this.$emit('show', { row, index });
1455
+ this.$emit('show', { row: data, index });
1435
1456
  },
1436
1457
  /**
1437
1458
  * 删除项
@@ -1897,9 +1918,9 @@
1897
1918
  this.disableLoader();
1898
1919
  let res;
1899
1920
  if (column.isSourceCustom) {
1900
- res = await customModelApi.query(column.source, param);
1921
+ res = await customModelApi.query(column.source, param, [column.sourceDataCode, column.sourceDisplayCode]);
1901
1922
  } else {
1902
- res = await modelApi.query(column.source, param);
1923
+ res = await modelApi.query(column.source, param, [column.sourceDataCode, column.sourceDisplayCode]);
1903
1924
  }
1904
1925
  this.enableLoader();
1905
1926
 
@@ -2833,9 +2854,9 @@
2833
2854
  let res;
2834
2855
 
2835
2856
  if (column.isSourceCustom) {
2836
- res = await customModelApi.query(column.source, param);
2857
+ res = await customModelApi.query(column.source, param, [column.sourceDataCode, column.sourceDisplayCode]);
2837
2858
  } else {
2838
- res = await modelApi.query(column.source, param);
2859
+ res = await modelApi.query(column.source, param, [column.sourceDataCode, column.sourceDisplayCode]);
2839
2860
  }
2840
2861
 
2841
2862
  res.data.forEach(item => {
@@ -75,7 +75,6 @@ export default {
75
75
  ...mapState('admin/user', ['info']),
76
76
  ...mapState('admin/cache', ['userNames', 'enums', 'dicts', 'caches']),
77
77
  ...mapState('admin/menu', ['userPermissions']),
78
- ...mapState('admin/displayFormat', ['defaultFormat']),
79
78
  rootPath() {
80
79
  return !(import.meta.env.VITE_APP_BASE_PATH || '').trim() ? '/static/' : '/' + import.meta.env.VITE_APP_BASE_PATH + '/static/';
81
80
  },
@@ -154,9 +154,9 @@
154
154
  // 参数完整,查询数据
155
155
  let res;
156
156
  if (data.isSourceCustom) {
157
- res = await customModelApi.query(data.source, param);
157
+ res = await customModelApi.query(data.source, param, [data.sourceDataCode, data.sourceDisplayCode]);
158
158
  } else {
159
- res = await modelApi.query(data.source, param);
159
+ res = await modelApi.query(data.source, param, [data.sourceDataCode, data.sourceDisplayCode]);
160
160
  }
161
161
  res.data.forEach(item => {
162
162
  data._dataSource.push({
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, showFormat } from '../src';
8
+ import { App, created } from '../src';
9
9
 
10
10
  // 固定路由
11
11
  import routes from './router/routes';
@@ -24,8 +24,4 @@ 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
-
31
27
  app.mount('#app');