mooho-base-admin-plus 0.4.82 → 0.4.84

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": "0.4.82",
4
+ "version": "0.4.84",
5
5
  "author": "jinyifan <jinyifan@mooho.com.cn>",
6
6
  "dotnetVersion": "1.4.0",
7
7
  "license": "MIT",
@@ -10,9 +10,7 @@
10
10
  "scripts": {
11
11
  "dev": "vite --open",
12
12
  "build": "vite build",
13
- "package": "vite build --mode lib",
14
- "styleguide": "vue-styleguidist server",
15
- "styleguide:build": "vue-styleguidist build"
13
+ "package": "vite build --mode lib"
16
14
  },
17
15
  "dependencies": {
18
16
  "@fortawesome/fontawesome-free": "^5.13.0",
package/public/setting.js CHANGED
@@ -16,14 +16,61 @@ window.setting = {
16
16
  siderTheme: 'dark',
17
17
  // 顶栏风格,可选值为 light、dark 或 primary
18
18
  headerTheme: 'light',
19
- // 是否根据操作系统缩放比例,自动调整比例
20
- autoFixRatio: true,
21
- // 是否显示多语言
22
- showI18n: true,
23
- // 是否显示通知
24
- showNotice: true,
19
+ // 顶栏是否置顶,开启后会覆盖侧边栏,需开启 headerFix
20
+ headerStick: false,
25
21
  // 是否开启多 Tabs 页签
26
22
  tabs: true,
23
+ // 多 Tabs 页签是否显示图标,开启 tabs 时有效
24
+ showTabsIcon: true,
25
+ // 是否固定多 Tabs 多页签
26
+ tabsFix: true,
27
+ // 再次点击 Tabs 页签时,是否重载当前页面
28
+ tabsReload: false,
29
+ // 页签是否支持拖拽排序
30
+ tabsOrder: true,
31
+ // 是否固定侧边栏
32
+ siderFix: true,
33
+ // 是否固定顶栏
34
+ headerFix: true,
35
+ // 是否在下滑时隐藏顶栏,需开启 headerFix,如果开启了 tabsFix,Tabs 也会被隐藏
36
+ headerHide: true,
37
+ // 是否显示顶部菜单栏
38
+ // 一般来说,侧边的菜单栏足以满足大部分业务,如需动态切换侧边栏,可开启此选项启用顶部一级菜单,此时侧边栏将作为二级菜单
39
+ headerMenu: false,
40
+ // 侧边菜单栏是否开启手风琴模式
41
+ menuAccordion: true,
42
+ // 是否显示折叠侧边栏按钮,移动端下会自动强制开启
43
+ showSiderCollapse: true,
44
+ // 侧边菜单栏是否默认折起
45
+ menuCollapse: false,
46
+ // 再次点击当前侧边菜单时,是否重载当前页面
47
+ menuSiderReload: false,
48
+ // 再次点击当前顶部菜单时,是否重载当前页面
49
+ menuHeaderReload: false,
50
+ // 侧边菜单折起时,是否在子菜单前显示父级菜单名称
51
+ showCollapseMenuTitle: false,
52
+ // 是否显示重载按钮
53
+ showReload: false,
54
+ // 是否显示搜索
55
+ showSearch: false,
56
+ // 是否显示通知
57
+ showNotice: false,
58
+ // 是否显示全屏
59
+ showFullscreen: true,
60
+ // 在手机访问时,是否在顶部显示小尺寸 logo
61
+ showMobileLogo: true,
62
+ // 是否显示全局面包屑,开启 headerMenu 时不可用
63
+ showBreadcrumb: true,
64
+ // 全局面包屑是否显示图标,开启 showBreadcrumb 时有效
65
+ showBreadcrumbIcon: false,
66
+ // 是否显示多语言
67
+ showI18n: true,
68
+ // 是否支持动态修改布局配置,移动端下会自动强制关闭
69
+ enableSetting: false,
70
+ // 退出登录时,是否二次确认
71
+ logoutConfirm: true,
72
+ // 是否根据操作系统缩放比例,自动调整比例
73
+ autoFixRatio: true,
27
74
  // 是否允许点击遮罩层关闭
28
75
  maskClosable: true,
29
76
  // 是否允许拖动
package/src/api/model.js CHANGED
@@ -218,14 +218,12 @@ export default {
218
218
  result = await request({
219
219
  url: `api/Model/group`,
220
220
  method: 'post',
221
- responseType: 'blob',
222
221
  data
223
222
  });
224
223
  } else {
225
224
  result = await request({
226
225
  url: `api/${tableView.model}/${path}`,
227
226
  method: method,
228
- responseType: 'blob',
229
227
  data
230
228
  });
231
229
  }
@@ -1,47 +1,49 @@
1
1
  <template>
2
2
  <div>
3
3
  <Form ref="form" :model="data" label-position="top" label-colon=":" class="ivu-mt draggable">
4
- <draggable v-model="columns" item-key="index" :animation="500" :scroll="true" group="sort" ghostClass="ghost-style">
4
+ <draggable v-model="columns" item-key="index" :animation="500" :scroll="true" group="sort" @start="start" @end="end" style="display: flex; flex-flow: row wrap">
5
5
  <template #item="{ element: column, index }">
6
- <div :style="'width:' + getWidth(column) + '%; float:left;'" @mouseover="mouseover(column)" @mouseleave="mouseleave(column)">
7
- <div style="float: right; margin-right: 20px">
8
- <Button
9
- size="small"
10
- v-show="column.showButton"
11
- @click="edit(column, index)"
12
- icon="md-cog"
13
- type="primary"
14
- style="margin-right: 4px; width: 22px; height: 22px"
15
- ></Button>
16
- <Button
17
- size="small"
18
- v-show="column.showButton"
19
- @click="remove(column, index)"
20
- icon="md-close"
21
- type="warning"
22
- style="margin-right: 4px; width: 22px; height: 22px"
23
- ></Button>
6
+ <div
7
+ style="position: relative; min-height: 1px"
8
+ :style="
9
+ 'flex: 0 0 ' +
10
+ getWidth(column) +
11
+ '%; max-width:' +
12
+ getWidth(column) +
13
+ '%;' +
14
+ (column._actived ? 'border: dashed #ddd 1px; background-color: #ffefd5;' : '') +
15
+ (index < columns.length - 1 && columns[index + 1].newLine ? 'margin-right: ' + getRightWidth(index) + '%' : '')
16
+ "
17
+ @mouseover="mouseover(column)"
18
+ @mouseleave="mouseleave(column)"
19
+ >
20
+ <div style="position: absolute; z-index: 100; top: 4px; right: 4px">
21
+ <Button size="small" v-if="column._editable" @click="edit(column, index)" icon="md-cog" type="primary" style="margin-right: 4px; width: 22px; height: 22px"></Button>
22
+ <Button size="small" v-show="column._editable" @click="remove(column, index)" icon="md-close" type="warning" style="width: 22px; height: 22px"></Button>
24
23
  </div>
25
24
  <div :key="column.code" v-if="column.controlType === 'Placeholder'" style="margin-bottom: 0px"></div>
26
25
  <div :key="column.code" v-if="column.controlType === 'Title'">
27
- <div class="form-title" :style="{ width: column.controlWidth == null ? null : column.controlWidth + 'px' }" v-html="column.name"></div>
26
+ <div class="form-title" :style="{ width: column.controlWidth == null ? null : column.controlWidth + 'px' }">
27
+ {{ getNameI18n(column) }} {{ showData(data, column) }}
28
+ </div>
28
29
  </div>
29
30
  <div v-if="column.controlType === 'Table'">
30
31
  <Divider :plain="true" dashed orientation="left" size="small">
31
- <span class="title">{{ column.name }}</span>
32
+ <span class="title">{{ getNameI18n(column) }}</span>
32
33
  </Divider>
33
34
  <view-table :static="true" :view-code="column.source" :readonly="column.isReadonly" :embedded="true"></view-table>
34
35
  </div>
35
36
  <div v-if="column.controlType === 'List'">
36
37
  <Divider :plain="true" dashed orientation="left" size="small">
37
- <span class="title">{{ column.name }}</span>
38
+ <span class="title">{{ getNameI18n(column) }}</span>
38
39
  </Divider>
39
40
  <view-table :static="true" :view-code="column.source" :readonly="true" :embedded="true"></view-table>
40
41
  </div>
41
42
  <FormItem
42
- :label="column.name"
43
+ :label="getNameI18n(column)"
43
44
  :prop="column.code"
44
45
  :key="column.code"
46
+ :rules="getRules(column)"
45
47
  :error="column.code == null ? $t('Front_Label_Column_Not_Bind') : null"
46
48
  v-if="column.controlType !== 'Placeholder' && column.controlType !== 'Title' && column.controlType !== 'Table' && column.controlType !== 'List'"
47
49
  >
@@ -52,7 +54,7 @@
52
54
  </div>
53
55
  </template>
54
56
  <template v-if="column.controlType === 'Hyperlink'">
55
- <a :href="getHyperlink(data, column.hyperlink)" :target="column.isNewWindow ? '_blank' : ''">
57
+ <a href="#" :target="column.isNewWindow ? '_blank' : ''">
56
58
  <span v-html="showData(data, column)"></span>
57
59
  </a>
58
60
  </template>
@@ -394,7 +396,9 @@
394
396
  tabName: '',
395
397
  rules: {},
396
398
  data: null,
397
- compareData: null
399
+ compareData: null,
400
+ dragging: false,
401
+ draggingColumn: null
398
402
  };
399
403
  },
400
404
  async created() {},
@@ -421,6 +425,101 @@
421
425
  return (100 * 4) / 24;
422
426
  }
423
427
  },
428
+ getRules(column) {
429
+ if (!column.isShow) {
430
+ return [];
431
+ }
432
+
433
+ let rules = [];
434
+
435
+ if (column.isRequired) {
436
+ if (
437
+ column.controlType == 'Date' ||
438
+ column.controlType == 'DateTime' ||
439
+ column.controlType == 'Year' ||
440
+ column.controlType == 'Month' ||
441
+ column.controlType == 'DateRange'
442
+ ) {
443
+ rules.push({
444
+ pattern: /.+/,
445
+ required: true,
446
+ message: this.$t('Front_Msg_Please_Input'),
447
+ trigger: 'blur,change'
448
+ });
449
+ } else {
450
+ rules.push({
451
+ type: this.getDataType(column),
452
+ required: true,
453
+ message: this.$t('Front_Msg_Please_Input'),
454
+ trigger: 'blur,change'
455
+ });
456
+ }
457
+ }
458
+
459
+ if (column.pattern && column.controlType == 'TextInput') {
460
+ rules.push({
461
+ type: this.getDataType(column),
462
+ pattern: column.pattern,
463
+ message: this.$t('Front_Msg_Validation_Pattern'),
464
+ trigger: 'blur,change'
465
+ });
466
+ }
467
+
468
+ if (column.maxValue != null) {
469
+ rules.push({
470
+ type: this.getDataType(column),
471
+ max: column.maxValue,
472
+ message: this.$t('Front_Msg_Validation_Max_Value|' + column.maxValue),
473
+ trigger: 'blur,change'
474
+ });
475
+ }
476
+
477
+ if (column.minValue != null) {
478
+ rules.push({
479
+ type: this.getDataType(column),
480
+ min: column.minValue,
481
+ message: this.$t('Front_Msg_Validation_Min_Value|' + column.minValue),
482
+ trigger: 'blur,change'
483
+ });
484
+ }
485
+
486
+ if (column.maxLength != null) {
487
+ rules.push({
488
+ type: this.getDataType(column),
489
+ length: column.maxLength,
490
+ message: this.$t('Front_Msg_Validation_Max_Length|' + column.maxLength),
491
+ trigger: 'blur,change'
492
+ });
493
+ }
494
+
495
+ return rules;
496
+ },
497
+ // 获取数据类型
498
+ getDataType(column) {
499
+ if (!(column.dataType || '').trim()) {
500
+ return null;
501
+ }
502
+ if (column.dataType.indexOf('Enum:') === 0) {
503
+ return 'string';
504
+ }
505
+
506
+ switch (column.dataType) {
507
+ case 'String':
508
+ case 'BigInteger':
509
+ return 'string';
510
+ case 'Boolean':
511
+ return 'boolean';
512
+ case 'DateTime':
513
+ return 'date';
514
+ case 'Float':
515
+ case 'Double':
516
+ case 'Decimal':
517
+ return 'number';
518
+ case 'Short':
519
+ case 'Integer':
520
+ return 'integer';
521
+ }
522
+ },
424
523
  // 根据选项卡序号返回列
425
524
  tabColumns(index) {
426
525
  return this.columns.filter(item => {
@@ -604,7 +703,7 @@
604
703
  },
605
704
  // 获取数据源
606
705
  getDataSource(data, column) {
607
- if (!column.isStaticItem && column.dataType.indexOf('Enum:') === 0) {
706
+ if (!column.isStaticItem && column.dataType && column.dataType.indexOf('Enum:') === 0) {
608
707
  // 枚举
609
708
  return this.getEnumList(column.dataType.split(':')[1]);
610
709
  } else {
@@ -784,16 +883,6 @@
784
883
 
785
884
  return data;
786
885
  },
787
- // 鼠标移入
788
- mouseover(column) {
789
- column.showButton = true;
790
- //this.$forceUpdate();
791
- },
792
- // 鼠标移出
793
- mouseleave(column) {
794
- column.showButton = false;
795
- //this.$forceUpdate();
796
- },
797
886
  // 编辑
798
887
  edit(column, index) {
799
888
  this.$emit('edit', { column, index });
@@ -843,6 +932,94 @@
843
932
  } else {
844
933
  return value;
845
934
  }
935
+ },
936
+ // 获取多语言名称
937
+ getNameI18n(column) {
938
+ if (this.layout.showI18n) {
939
+ if (column.code) {
940
+ let key = 'DataView_' + this.formView.code + '_' + column.code;
941
+ let text = this.$t(key);
942
+ if (text == key) {
943
+ return column.name;
944
+ } else {
945
+ return text;
946
+ }
947
+ } else {
948
+ return column.name;
949
+ }
950
+ } else {
951
+ return column.name;
952
+ }
953
+ },
954
+ getRightWidth(index) {
955
+ let current = 0;
956
+
957
+ for (let i = 0; i <= index; i++) {
958
+ let width = 0;
959
+
960
+ switch (this.columns[i].columnWidth) {
961
+ case 'Column12':
962
+ width = 24;
963
+ break;
964
+ case 'Column9':
965
+ width = 18;
966
+ break;
967
+ case 'Column8':
968
+ width = 16;
969
+ break;
970
+ case 'Column6':
971
+ width = 12;
972
+ break;
973
+ case 'Column4':
974
+ width = 8;
975
+ break;
976
+ case 'Column3':
977
+ width = 6;
978
+ break;
979
+ case 'Column2':
980
+ width = 4;
981
+ break;
982
+ }
983
+
984
+ if (width == 24) {
985
+ current = 0;
986
+ } else if (this.columns[i].newLine || current + width > 24) {
987
+ current = width;
988
+ } else if (current + width == 24) {
989
+ current = 0;
990
+ } else {
991
+ current = current + width;
992
+ }
993
+ }
994
+
995
+ return current == 0 ? 0 : (100 * (24 - current)) / 24;
996
+ },
997
+ // 鼠标移入
998
+ mouseover(column) {
999
+ if (!this.dragging) {
1000
+ column._editable = true;
1001
+ }
1002
+
1003
+ //this.$forceUpdate();
1004
+ },
1005
+ // 鼠标移出
1006
+ mouseleave(column) {
1007
+ if (!this.dragging) {
1008
+ column._editable = false;
1009
+ }
1010
+ //this.$forceUpdate();
1011
+ },
1012
+ start(evt) {
1013
+ this.draggingColumn = this.columns[evt.oldIndex];
1014
+ this.draggingColumn._actived = true;
1015
+ this.draggingColumn._editable = false;
1016
+
1017
+ this.dragging = true;
1018
+ },
1019
+ end(evt) {
1020
+ this.draggingColumn._actived = false;
1021
+
1022
+ this.dragging = false;
846
1023
  }
847
1024
  }
848
1025
  };
@@ -860,14 +860,14 @@
860
860
  pattern: /.+/,
861
861
  required: true,
862
862
  message: this.$t('Front_Msg_Please_Input'),
863
- trigger: this.getTrigger(column)
863
+ trigger: 'blur,change'
864
864
  });
865
865
  } else {
866
866
  rules.push({
867
867
  type: this.getDataType(column),
868
868
  required: true,
869
869
  message: this.$t('Front_Msg_Please_Input'),
870
- trigger: this.getTrigger(column)
870
+ trigger: 'blur,change'
871
871
  });
872
872
  }
873
873
  }
@@ -877,7 +877,7 @@
877
877
  type: this.getDataType(column),
878
878
  pattern: column.pattern,
879
879
  message: this.$t('Front_Msg_Validation_Pattern'),
880
- trigger: this.getTrigger(column)
880
+ trigger: 'blur,change'
881
881
  });
882
882
  }
883
883
 
@@ -886,7 +886,7 @@
886
886
  type: this.getDataType(column),
887
887
  max: column.maxValue,
888
888
  message: this.$t('Front_Msg_Validation_Max_Value|' + column.maxValue),
889
- trigger: this.getTrigger(column)
889
+ trigger: 'blur,change'
890
890
  });
891
891
  }
892
892
 
@@ -895,7 +895,7 @@
895
895
  type: this.getDataType(column),
896
896
  min: column.minValue,
897
897
  message: this.$t('Front_Msg_Validation_Min_Value|' + column.minValue),
898
- trigger: this.getTrigger(column)
898
+ trigger: 'blur,change'
899
899
  });
900
900
  }
901
901
 
@@ -904,7 +904,7 @@
904
904
  type: this.getDataType(column),
905
905
  length: column.maxLength,
906
906
  message: this.$t('Front_Msg_Validation_Max_Length|' + column.maxLength),
907
- trigger: this.getTrigger(column)
907
+ trigger: 'blur,change'
908
908
  });
909
909
  }
910
910
 
@@ -1414,14 +1414,6 @@
1414
1414
  return 'integer';
1415
1415
  }
1416
1416
  },
1417
- // 获取触发器
1418
- getTrigger(column) {
1419
- if (column.controlType === 'TextInput' || column.controlType === 'NumberInput') {
1420
- return 'blur,change';
1421
- } else {
1422
- return 'blur,change';
1423
- }
1424
- },
1425
1417
  // 根据表达式取值(带其他)
1426
1418
  parseDataWithOther(model, column) {
1427
1419
  let expression = column.code;
package/src/i18n/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { createI18n } from 'vue-i18n/index';
1
+ import { createI18n } from 'vue-i18n';
2
2
  //import store from '../store/index';
3
3
  //import messages from './locale';
4
4
 
package/src/index.js CHANGED
@@ -178,7 +178,7 @@ const created = async app => {
178
178
  }
179
179
 
180
180
  // 加载多语言
181
- await store.dispatch('admin/i18n/load', app);
181
+ store.dispatch('admin/i18n/load', app);
182
182
  // 初始化动态路由
183
183
  //let dynamicRoutes = await dynamicRouter.init(router, pages, layout);
184
184
  // 处理路由 得到每一级的路由设置
@@ -1,22 +0,0 @@
1
- module.exports = {
2
- title: 'mooho-base-admin-plus',
3
- components: [
4
- 'src/components/view/modal-form.vue',
5
- 'src/components/view/modal-table.vue',
6
- 'src/components/view/view-form.vue',
7
- 'src/components/view/view-table.vue',
8
- 'src/components/view/view-chart.vue',
9
- 'src/components/input/*.vue'
10
- ],
11
- styleguideDir: 'styleguide-dist',
12
- // 在编辑器的右上角添加一个小按钮,用于将编辑器的内容复制到剪贴板
13
- copyCodeButton: true,
14
- // 是否每个章节是一个独立的页面. 默认:false
15
- pagePerSection: false,
16
- // props/events/slot的说明默认是展开还是收缩: expand / collapse / hide
17
- usageMode: 'expand',
18
- // 左侧导航默认是展开还是收缩: expand / collapse / hide
19
- tocMode: 'expand',
20
- // 显示 prop、事件、槽或方法是否来自当前文件或在 mixin 或扩展组件中配置。如果它是外部的,它会显示组件的名称,并在悬停时显示文件的相对路径。
21
- displayOrigins: true
22
- };