vue2-client 1.7.0 → 1.7.2

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.
Files changed (128) hide show
  1. package/.env +15 -15
  2. package/CHANGELOG.md +661 -628
  3. package/Components.md +60 -0
  4. package/index.js +31 -30
  5. package/package.json +83 -81
  6. package/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox.vue +316 -316
  7. package/src/base-client/components/common/CitySelect/CitySelect.vue +247 -247
  8. package/src/base-client/components/common/CreateQuery/CreateQuery.vue +669 -667
  9. package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +735 -733
  10. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQuery.vue +466 -468
  11. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQueryItem.vue +510 -508
  12. package/src/base-client/components/common/FormGroupEdit/FormGroupEdit.vue +144 -146
  13. package/src/base-client/components/common/FormGroupQuery/FormGroupQuery.vue +165 -165
  14. package/src/base-client/components/common/JSONToTree/jsontotree.vue +275 -275
  15. package/src/base-client/components/common/Upload/Upload.vue +168 -168
  16. package/src/base-client/components/common/XAddForm/XAddForm.vue +72 -325
  17. package/src/base-client/components/common/XAddNativeForm/XAddNativeForm.vue +369 -279
  18. package/src/base-client/components/common/XAddNativeForm/index.md +107 -17
  19. package/src/base-client/components/common/XCard/XCard.vue +64 -64
  20. package/src/base-client/components/common/XDataDrawer/XDataDrawer.vue +180 -0
  21. package/src/base-client/components/common/XDataDrawer/index.js +3 -0
  22. package/src/base-client/components/common/XDataDrawer/index.md +41 -0
  23. package/src/base-client/components/common/XForm/XForm.vue +178 -180
  24. package/src/base-client/components/common/XForm/XFormItem.vue +521 -513
  25. package/src/base-client/components/common/XForm/XTreeSelect.vue +184 -184
  26. package/src/base-client/components/common/XFormCol/XFormCol.vue +38 -38
  27. package/src/base-client/components/common/XFormTable/XFormTable.vue +356 -344
  28. package/src/base-client/components/common/XFormTable/index.md +97 -97
  29. package/src/base-client/components/common/XImportExcel/XImportExcel.vue +132 -132
  30. package/src/base-client/components/common/XTable/XTable.vue +519 -506
  31. package/src/base-client/components/common/XTreeOne/XTreeOne.vue +111 -111
  32. package/src/base-client/components/index.js +41 -0
  33. package/src/base-client/components/system/DictionaryDetailsView/DictionaryDetailsView.vue +231 -231
  34. package/src/base-client/components/system/QueryParamsDetailsView/QueryParamsDetailsView.vue +281 -281
  35. package/src/base-client/components/ticket/TicketDetailsView/TicketDetailsView.vue +807 -807
  36. package/src/base-client/components/ticket/TicketDetailsView/index.md +29 -29
  37. package/src/base-client/components/ticket/TicketDetailsView/part/TicketDetailsFlow.vue +260 -260
  38. package/src/base-client/components/ticket/TicketSubmitSuccessView/TicketSubmitSuccessView.vue +532 -532
  39. package/src/base-client/components/ticket/TicketSubmitSuccessView/index.md +29 -29
  40. package/src/base-client/plugins/AppData.js +76 -76
  41. package/src/base-client/plugins/GetLoginInfoService.js +179 -179
  42. package/src/base-client/plugins/PagedList.js +177 -177
  43. package/src/base-client/plugins/compatible/LoginServiceOA.js +20 -20
  44. package/src/base-client/plugins/i18n-extend.js +32 -32
  45. package/src/components/Ellipsis/Ellipsis.vue +65 -65
  46. package/src/components/Ellipsis/index.md +38 -38
  47. package/src/components/NumberInfo/index.md +43 -43
  48. package/src/components/STable/README.md +341 -341
  49. package/src/components/STable/index.js +318 -318
  50. package/src/components/Trend/index.md +45 -45
  51. package/src/components/checkbox/ColorCheckbox.vue +157 -157
  52. package/src/components/checkbox/ImgCheckbox.vue +163 -163
  53. package/src/components/exception/ExceptionPage.vue +70 -70
  54. package/src/components/form/FormRow.vue +52 -52
  55. package/src/components/index.js +36 -36
  56. package/src/components/menu/SideMenu.vue +75 -62
  57. package/src/components/menu/menu.js +273 -273
  58. package/src/components/page/header/index.less +40 -40
  59. package/src/components/setting/Setting.vue +235 -235
  60. package/src/components/table/StandardTable.vue +141 -141
  61. package/src/components/table/advance/ActionColumns.vue +158 -158
  62. package/src/components/table/advance/SearchArea.vue +355 -355
  63. package/src/components/tool/AStepItem.vue +60 -60
  64. package/src/components/tool/AvatarList.vue +68 -68
  65. package/src/components/tool/Drawer.vue +142 -142
  66. package/src/components/tool/TagSelect.vue +83 -83
  67. package/src/components/transition/PageToggleTransition.vue +97 -97
  68. package/src/config/CreateQueryConfig.js +307 -307
  69. package/src/config/default/admin.config.js +18 -18
  70. package/src/config/default/setting.config.js +4 -2
  71. package/src/config/replacer/resolve.config.js +67 -67
  72. package/src/layouts/CommonLayout.vue +42 -42
  73. package/src/layouts/ComponentLayoutOne.vue +47 -47
  74. package/src/layouts/PageLayout.vue +151 -151
  75. package/src/layouts/SinglePageView.vue +116 -116
  76. package/src/layouts/footer/PageFooter.vue +49 -49
  77. package/src/layouts/header/AdminHeader.vue +134 -134
  78. package/src/layouts/header/HeaderAvatar.vue +64 -64
  79. package/src/layouts/header/HeaderNotice.vue +176 -176
  80. package/src/layouts/header/HeaderSearch.vue +67 -67
  81. package/src/layouts/header/InstitutionDetail.vue +181 -181
  82. package/src/layouts/header/index.less +92 -92
  83. package/src/layouts/tabs/TabsHead.vue +190 -190
  84. package/src/layouts/tabs/TabsView.vue +379 -379
  85. package/src/lib.js +1 -0
  86. package/src/mock/goods/index.js +108 -108
  87. package/src/pages/CreateQueryPage.vue +84 -84
  88. package/src/pages/login/Login.vue +369 -369
  89. package/src/pages/report/ReportTable.js +124 -124
  90. package/src/pages/report/ReportTableHome.vue +28 -28
  91. package/src/pages/resourceManage/orgListManage.vue +98 -98
  92. package/src/pages/system/dictionary/index.vue +43 -43
  93. package/src/pages/system/file/index.vue +317 -317
  94. package/src/pages/system/monitor/loginInfor/index.vue +36 -36
  95. package/src/pages/system/monitor/operLog/index.vue +36 -36
  96. package/src/pages/system/settings/index.vue +126 -126
  97. package/src/pages/system/settings/modifyPassword.vue +109 -109
  98. package/src/router/async/config.async.js +28 -28
  99. package/src/router/async/router.map.js +66 -66
  100. package/src/router/guards.js +52 -12
  101. package/src/router/index.js +27 -27
  102. package/src/services/api/DictionaryDetailsViewApi.js +6 -6
  103. package/src/services/api/LogDetailsViewApi.js +10 -10
  104. package/src/services/api/QueryParamsDetailsViewApi.js +6 -6
  105. package/src/services/api/TicketDetailsViewApi.js +34 -34
  106. package/src/services/api/cas.js +79 -79
  107. package/src/services/api/common.js +137 -137
  108. package/src/services/api/commonTempTable.js +10 -10
  109. package/src/services/api/index.js +17 -17
  110. package/src/services/api/logininfor/index.js +6 -6
  111. package/src/services/api/manage.js +8 -8
  112. package/src/services/apiService.js +14 -14
  113. package/src/services/user.js +67 -67
  114. package/src/store/modules/index.js +4 -4
  115. package/src/theme/default/nprogress.less +76 -76
  116. package/src/theme/default/style.less +58 -58
  117. package/src/utils/EncryptUtil.js +53 -53
  118. package/src/utils/colors.js +107 -107
  119. package/src/utils/excel/Blob.js +180 -180
  120. package/src/utils/excel/Export2Excel.js +141 -141
  121. package/src/utils/formatter.js +68 -68
  122. package/src/utils/i18n.js +80 -80
  123. package/src/utils/login.js +138 -0
  124. package/src/utils/map-utils.js +37 -37
  125. package/src/utils/theme-color-replacer-extend.js +91 -91
  126. package/src/utils/themeUtil.js +100 -100
  127. package/src/utils/util.js +230 -230
  128. package/vue.config.js +106 -106
@@ -1,67 +1,67 @@
1
- /**
2
- * webpack-theme-color-replacer 插件的 resolve 配置
3
- * 为特定的 css 选择器(selector)配置 resolve 规则。
4
- *
5
- * key 为 css selector 值或合法的正则表达式字符串
6
- * 当 key 设置 css selector 值时,会匹配对应的 css
7
- * 当 key 设置为正则表达式时,会匹配所有满足此正则表达式的的 css
8
- *
9
- * value 可以设置为 boolean 值 false 或 一个对象
10
- * 当 value 为 false 时,则会忽略此 css,即此 css 不纳入 webpack-theme-color-replacer 管理
11
- * 当 value 为 对象时,会调用该对象的 resolve 函数,并传入 cssText(原始的 css文本) 和 cssObj(css对象)参数; resolve函数应该返
12
- * 回一个处理后的、合法的 css字符串(包含 selector)
13
- * 注意: value 不能设置为 true
14
- */
15
- const cssResolve = {
16
- '.ant-checkbox-checked .ant-checkbox-inner::after': {
17
- resolve (cssText, cssObj) {
18
- cssObj.rules.push('border-top:0', 'border-left:0')
19
- return cssObj.toText()
20
- }
21
- },
22
- '.ant-tree-checkbox-checked .ant-tree-checkbox-inner::after': {
23
- resolve (cssText, cssObj) {
24
- cssObj.rules.push('border-top:0', 'border-left:0')
25
- return cssObj.toText()
26
- }
27
- },
28
- '.ant-checkbox-checked .ant-checkbox-inner:after': {
29
- resolve (cssText, cssObj) {
30
- cssObj.rules.push('border-top:0', 'border-left:0')
31
- return cssObj.toText()
32
- }
33
- },
34
- '.ant-tree-checkbox-checked .ant-tree-checkbox-inner:after': {
35
- resolve (cssText, cssObj) {
36
- cssObj.rules.push('border-top:0', 'border-left:0')
37
- return cssObj.toText()
38
- }
39
- },
40
- '.ant-menu-dark .ant-menu-inline.ant-menu-sub': {
41
- resolve (cssText, cssObj) {
42
- cssObj.rules = cssObj.rules.filter(rule => rule.indexOf('box-shadow') === -1)
43
- return cssObj.toText()
44
- }
45
- },
46
- '.ant-menu-horizontal>.ant-menu-item:hover,.ant-menu-horizontal>.ant-menu-submenu:hover,.ant-menu-horizontal>.ant-menu-item-active,.ant-menu-horizontal>.ant-menu-submenu-active,.ant-menu-horizontal>.ant-menu-item-open,.ant-menu-horizontal>.ant-menu-submenu-open,.ant-menu-horizontal>.ant-menu-item-selected,.ant-menu-horizontal>.ant-menu-submenu-selected': {
47
- resolve (cssText, cssObj) {
48
- cssObj.selector = cssObj.selector.replace(/.ant-menu-horizontal/g, '.ant-menu-horizontal:not(.ant-menu-dark)')
49
- return cssObj.toText()
50
- }
51
- },
52
- '.ant-menu-horizontal>.ant-menu-item-active,.ant-menu-horizontal>.ant-menu-item-open,.ant-menu-horizontal>.ant-menu-item-selected,.ant-menu-horizontal>.ant-menu-item:hover,.ant-menu-horizontal>.ant-menu-submenu-active,.ant-menu-horizontal>.ant-menu-submenu-open,.ant-menu-horizontal>.ant-menu-submenu-selected,.ant-menu-horizontal>.ant-menu-submenu:hover': {
53
- resolve (cssText, cssObj) {
54
- cssObj.selector = cssObj.selector.replace(/.ant-menu-horizontal/g, '.ant-menu-horizontal:not(.ant-menu-dark)')
55
- return cssObj.toText()
56
- }
57
- },
58
- '.ant-layout-sider': {
59
- resolve (cssText, cssObj) {
60
- cssObj.selector = '.ant-layout-sider-dark'
61
- return cssObj.toText()
62
- }
63
- },
64
- '/keyframes/': false
65
- }
66
-
67
- module.exports = cssResolve
1
+ /**
2
+ * webpack-theme-color-replacer 插件的 resolve 配置
3
+ * 为特定的 css 选择器(selector)配置 resolve 规则。
4
+ *
5
+ * key 为 css selector 值或合法的正则表达式字符串
6
+ * 当 key 设置 css selector 值时,会匹配对应的 css
7
+ * 当 key 设置为正则表达式时,会匹配所有满足此正则表达式的的 css
8
+ *
9
+ * value 可以设置为 boolean 值 false 或 一个对象
10
+ * 当 value 为 false 时,则会忽略此 css,即此 css 不纳入 webpack-theme-color-replacer 管理
11
+ * 当 value 为 对象时,会调用该对象的 resolve 函数,并传入 cssText(原始的 css文本) 和 cssObj(css对象)参数; resolve函数应该返
12
+ * 回一个处理后的、合法的 css字符串(包含 selector)
13
+ * 注意: value 不能设置为 true
14
+ */
15
+ const cssResolve = {
16
+ '.ant-checkbox-checked .ant-checkbox-inner::after': {
17
+ resolve (cssText, cssObj) {
18
+ cssObj.rules.push('border-top:0', 'border-left:0')
19
+ return cssObj.toText()
20
+ }
21
+ },
22
+ '.ant-tree-checkbox-checked .ant-tree-checkbox-inner::after': {
23
+ resolve (cssText, cssObj) {
24
+ cssObj.rules.push('border-top:0', 'border-left:0')
25
+ return cssObj.toText()
26
+ }
27
+ },
28
+ '.ant-checkbox-checked .ant-checkbox-inner:after': {
29
+ resolve (cssText, cssObj) {
30
+ cssObj.rules.push('border-top:0', 'border-left:0')
31
+ return cssObj.toText()
32
+ }
33
+ },
34
+ '.ant-tree-checkbox-checked .ant-tree-checkbox-inner:after': {
35
+ resolve (cssText, cssObj) {
36
+ cssObj.rules.push('border-top:0', 'border-left:0')
37
+ return cssObj.toText()
38
+ }
39
+ },
40
+ '.ant-menu-dark .ant-menu-inline.ant-menu-sub': {
41
+ resolve (cssText, cssObj) {
42
+ cssObj.rules = cssObj.rules.filter(rule => rule.indexOf('box-shadow') === -1)
43
+ return cssObj.toText()
44
+ }
45
+ },
46
+ '.ant-menu-horizontal>.ant-menu-item:hover,.ant-menu-horizontal>.ant-menu-submenu:hover,.ant-menu-horizontal>.ant-menu-item-active,.ant-menu-horizontal>.ant-menu-submenu-active,.ant-menu-horizontal>.ant-menu-item-open,.ant-menu-horizontal>.ant-menu-submenu-open,.ant-menu-horizontal>.ant-menu-item-selected,.ant-menu-horizontal>.ant-menu-submenu-selected': {
47
+ resolve (cssText, cssObj) {
48
+ cssObj.selector = cssObj.selector.replace(/.ant-menu-horizontal/g, '.ant-menu-horizontal:not(.ant-menu-dark)')
49
+ return cssObj.toText()
50
+ }
51
+ },
52
+ '.ant-menu-horizontal>.ant-menu-item-active,.ant-menu-horizontal>.ant-menu-item-open,.ant-menu-horizontal>.ant-menu-item-selected,.ant-menu-horizontal>.ant-menu-item:hover,.ant-menu-horizontal>.ant-menu-submenu-active,.ant-menu-horizontal>.ant-menu-submenu-open,.ant-menu-horizontal>.ant-menu-submenu-selected,.ant-menu-horizontal>.ant-menu-submenu:hover': {
53
+ resolve (cssText, cssObj) {
54
+ cssObj.selector = cssObj.selector.replace(/.ant-menu-horizontal/g, '.ant-menu-horizontal:not(.ant-menu-dark)')
55
+ return cssObj.toText()
56
+ }
57
+ },
58
+ '.ant-layout-sider': {
59
+ resolve (cssText, cssObj) {
60
+ cssObj.selector = '.ant-layout-sider-dark'
61
+ return cssObj.toText()
62
+ }
63
+ },
64
+ '/keyframes/': false
65
+ }
66
+
67
+ module.exports = cssResolve
@@ -1,42 +1,42 @@
1
- <template>
2
- <div class="common-layout">
3
- <div class="content"><slot></slot></div>
4
- <page-footer :link-list="footerLinks" :copyright="copyright" :copyrightStyle="copyrightStyle"></page-footer>
5
- </div>
6
- </template>
7
-
8
- <script>
9
- import PageFooter from '@vue2-client/layouts/footer/PageFooter'
10
- import { mapState } from 'vuex'
11
-
12
- export default {
13
- name: 'CommonLayout',
14
- components: { PageFooter },
15
- computed: {
16
- ...mapState('setting', ['footerLinks', 'copyright', 'copyrightStyle'])
17
- }
18
- }
19
- </script>
20
-
21
- <style scoped lang="less">
22
- .common-layout{
23
- display: flex;
24
- flex-direction: column;
25
- height: 100vh;
26
- overflow: auto;
27
- background-color: @layout-body-background;
28
- background-image: url('https://gw.alipayobjects.com/zos/rmsportal/TVYTbAXWheQpRcWDaDMu.svg');
29
- background-repeat: no-repeat;
30
- background-position-x: center;
31
- background-position-y: 110px;
32
- background-size: 100%;
33
- .content{
34
- padding: 32px 0;
35
- flex: 1;
36
- @media (min-width: 768px){
37
-
38
- padding: 112px 0 24px;
39
- }
40
- }
41
- }
42
- </style>
1
+ <template>
2
+ <div class="common-layout">
3
+ <div class="content"><slot></slot></div>
4
+ <page-footer :link-list="footerLinks" :copyright="copyright" :copyrightStyle="copyrightStyle"></page-footer>
5
+ </div>
6
+ </template>
7
+
8
+ <script>
9
+ import PageFooter from '@vue2-client/layouts/footer/PageFooter'
10
+ import { mapState } from 'vuex'
11
+
12
+ export default {
13
+ name: 'CommonLayout',
14
+ components: { PageFooter },
15
+ computed: {
16
+ ...mapState('setting', ['footerLinks', 'copyright', 'copyrightStyle'])
17
+ }
18
+ }
19
+ </script>
20
+
21
+ <style scoped lang="less">
22
+ .common-layout{
23
+ display: flex;
24
+ flex-direction: column;
25
+ height: 100vh;
26
+ overflow: auto;
27
+ background-color: @layout-body-background;
28
+ background-image: url('https://gw.alipayobjects.com/zos/rmsportal/TVYTbAXWheQpRcWDaDMu.svg');
29
+ background-repeat: no-repeat;
30
+ background-position-x: center;
31
+ background-position-y: 110px;
32
+ background-size: 100%;
33
+ .content{
34
+ padding: 32px 0;
35
+ flex: 1;
36
+ @media (min-width: 768px){
37
+
38
+ padding: 112px 0 24px;
39
+ }
40
+ }
41
+ }
42
+ </style>
@@ -1,47 +1,47 @@
1
- <template>
2
- <div id="ComponentLayoutOne">
3
- <a-layout>
4
- <a-layout-sider v-bind="siderProps">
5
- <slot name="left"></slot>
6
- </a-layout-sider>
7
- <a-layout>
8
- <slot></slot>
9
- </a-layout>
10
- </a-layout>
11
- </div>
12
- </template>
13
-
14
- <script>
15
- export default {
16
- name: 'ComponentLayoutOne',
17
- props: {
18
- // Layout.Sider props对象
19
- siderProps: {
20
- type: Object,
21
- default: () => {
22
- return {}
23
- }
24
- }
25
- },
26
- data () {
27
- return {}
28
- },
29
- created () {
30
- },
31
- mounted () {
32
- },
33
- methods: {}
34
- }
35
- </script>
36
-
37
- <style lang="less">
38
- #ComponentLayoutOne {
39
- .ant-layout-sider {
40
- .ant-layout-sider-zero-width-trigger {
41
- top: 50%;
42
- background-color: @shadow-color;
43
- z-index: 2;
44
- }
45
- }
46
- }
47
- </style>
1
+ <template>
2
+ <div id="ComponentLayoutOne">
3
+ <a-layout>
4
+ <a-layout-sider v-bind="siderProps">
5
+ <slot name="left"></slot>
6
+ </a-layout-sider>
7
+ <a-layout>
8
+ <slot></slot>
9
+ </a-layout>
10
+ </a-layout>
11
+ </div>
12
+ </template>
13
+
14
+ <script>
15
+ export default {
16
+ name: 'ComponentLayoutOne',
17
+ props: {
18
+ // Layout.Sider props对象
19
+ siderProps: {
20
+ type: Object,
21
+ default: () => {
22
+ return {}
23
+ }
24
+ }
25
+ },
26
+ data () {
27
+ return {}
28
+ },
29
+ created () {
30
+ },
31
+ mounted () {
32
+ },
33
+ methods: {}
34
+ }
35
+ </script>
36
+
37
+ <style lang="less">
38
+ #ComponentLayoutOne {
39
+ .ant-layout-sider {
40
+ .ant-layout-sider-zero-width-trigger {
41
+ top: 50%;
42
+ background-color: @shadow-color;
43
+ z-index: 2;
44
+ }
45
+ }
46
+ }
47
+ </style>
@@ -1,151 +1,151 @@
1
- <template>
2
- <div class="page-layout">
3
- <page-header
4
- ref="pageHeader"
5
- :style="`margin-top: ${multiPage ? 0 : -24}px`"
6
- :breadcrumb="breadcrumb"
7
- :title="pageTitle"
8
- :logo="logo"
9
- :avatar="avatar">
10
- <slot name="action" slot="action"></slot>
11
- <slot slot="content" name="headerContent"></slot>
12
- <div slot="content" v-if="!this.$slots.headerContent && desc">
13
- <p>{{ desc }}</p>
14
- <div v-if="this.linkList" class="link">
15
- <template v-for="(link, index) in linkList">
16
- <a :key="index" :href="link.href"><a-icon :type="link.icon" />{{ link.title }}</a>
17
- </template>
18
- </div>
19
- </div>
20
- <slot v-if="this.$slots.extra" slot="extra" name="extra"></slot>
21
- </page-header>
22
- <div ref="page" :class="['page-content', layout, pageWidth]" >
23
- <slot></slot>
24
- </div>
25
- </div>
26
- </template>
27
-
28
- <script>
29
- import PageHeader from '@vue2-client/components/page/header/PageHeader'
30
- import { mapState, mapMutations } from 'vuex'
31
- import { getI18nKey } from '@vue2-client/utils/routerUtil'
32
-
33
- export default {
34
- name: 'PageLayout',
35
- components: { PageHeader },
36
- // eslint-disable-next-line vue/require-prop-types
37
- props: ['desc', 'logo', 'title', 'avatar', 'linkList', 'extraImage'],
38
- data () {
39
- return {
40
- page: {},
41
- pageHeaderHeight: 0
42
- }
43
- },
44
- watch: {
45
- $route () {
46
- this.page = this.$route.meta.page
47
- }
48
- },
49
- updated () {
50
- if (!this._inactive) {
51
- this.updatePageHeight()
52
- }
53
- },
54
- activated () {
55
- this.updatePageHeight()
56
- },
57
- deactivated () {
58
- this.updatePageHeight(0)
59
- },
60
- mounted () {
61
- this.updatePageHeight()
62
- },
63
- created () {
64
- this.page = this.$route.meta.page
65
- },
66
- beforeDestroy () {
67
- this.updatePageHeight(0)
68
- },
69
- computed: {
70
- ...mapState('setting', ['layout', 'multiPage', 'pageMinHeight', 'pageWidth', 'customTitles']),
71
- pageTitle () {
72
- const pageTitle = this.page && this.page.title
73
- return this.customTitle || (pageTitle && this.$t(pageTitle)) || this.title || this.routeName
74
- },
75
- routeName () {
76
- const route = this.$route
77
- return this.$t(getI18nKey(route.matched[route.matched.length - 1].path))
78
- },
79
- breadcrumb () {
80
- const page = this.page
81
- const breadcrumb = page && page.breadcrumb
82
- if (breadcrumb) {
83
- const i18nBreadcrumb = []
84
- breadcrumb.forEach(item => {
85
- i18nBreadcrumb.push(this.$t(item))
86
- })
87
- return i18nBreadcrumb
88
- } else {
89
- return this.getRouteBreadcrumb()
90
- }
91
- },
92
- marginCorrect () {
93
- return this.multiPage ? 24 : 0
94
- }
95
- },
96
- methods: {
97
- ...mapMutations('setting', ['correctPageMinHeight']),
98
- getRouteBreadcrumb () {
99
- const routes = this.$route.matched
100
- const path = this.$route.path
101
- const breadcrumb = []
102
- routes.filter(item => path.includes(item.path))
103
- .forEach(route => {
104
- const path = route.path.length === 0 ? '/home' : route.path
105
- breadcrumb.push(this.$t(getI18nKey(path)))
106
- })
107
- const pageTitle = this.page && this.page.title
108
- if (this.customTitle || pageTitle) {
109
- breadcrumb[breadcrumb.length - 1] = this.customTitle || pageTitle
110
- }
111
- return breadcrumb
112
- },
113
- /**
114
- * 用于计算页面内容最小高度
115
- * @param newHeight
116
- */
117
- updatePageHeight (newHeight = this.$refs.pageHeader.$el.offsetHeight + this.marginCorrect) {
118
- this.correctPageMinHeight(this.pageHeaderHeight - newHeight)
119
- this.pageHeaderHeight = newHeight
120
- }
121
- }
122
- }
123
- </script>
124
-
125
- <style lang="less">
126
- .page-header{
127
- margin: 0 -24px 0;
128
- }
129
- .link{
130
- /*margin-top: 16px;*/
131
- line-height: 24px;
132
- a{
133
- font-size: 14px;
134
- margin-right: 32px;
135
- i{
136
- font-size: 22px;
137
- margin-right: 8px;
138
- }
139
- }
140
- }
141
- .page-content{
142
- position: relative;
143
- padding: 24px 0 0;
144
- &.side{
145
- }
146
- &.head.fixed{
147
- margin: 0 auto;
148
- max-width: 100%;
149
- }
150
- }
151
- </style>
1
+ <template>
2
+ <div class="page-layout">
3
+ <page-header
4
+ ref="pageHeader"
5
+ :style="`margin-top: ${multiPage ? 0 : -24}px`"
6
+ :breadcrumb="breadcrumb"
7
+ :title="pageTitle"
8
+ :logo="logo"
9
+ :avatar="avatar">
10
+ <slot name="action" slot="action"></slot>
11
+ <slot slot="content" name="headerContent"></slot>
12
+ <div slot="content" v-if="!this.$slots.headerContent && desc">
13
+ <p>{{ desc }}</p>
14
+ <div v-if="this.linkList" class="link">
15
+ <template v-for="(link, index) in linkList">
16
+ <a :key="index" :href="link.href"><a-icon :type="link.icon" />{{ link.title }}</a>
17
+ </template>
18
+ </div>
19
+ </div>
20
+ <slot v-if="this.$slots.extra" slot="extra" name="extra"></slot>
21
+ </page-header>
22
+ <div ref="page" :class="['page-content', layout, pageWidth]" >
23
+ <slot></slot>
24
+ </div>
25
+ </div>
26
+ </template>
27
+
28
+ <script>
29
+ import PageHeader from '@vue2-client/components/page/header/PageHeader'
30
+ import { mapState, mapMutations } from 'vuex'
31
+ import { getI18nKey } from '@vue2-client/utils/routerUtil'
32
+
33
+ export default {
34
+ name: 'PageLayout',
35
+ components: { PageHeader },
36
+ // eslint-disable-next-line vue/require-prop-types
37
+ props: ['desc', 'logo', 'title', 'avatar', 'linkList', 'extraImage'],
38
+ data () {
39
+ return {
40
+ page: {},
41
+ pageHeaderHeight: 0
42
+ }
43
+ },
44
+ watch: {
45
+ $route () {
46
+ this.page = this.$route.meta.page
47
+ }
48
+ },
49
+ updated () {
50
+ if (!this._inactive) {
51
+ this.updatePageHeight()
52
+ }
53
+ },
54
+ activated () {
55
+ this.updatePageHeight()
56
+ },
57
+ deactivated () {
58
+ this.updatePageHeight(0)
59
+ },
60
+ mounted () {
61
+ this.updatePageHeight()
62
+ },
63
+ created () {
64
+ this.page = this.$route.meta.page
65
+ },
66
+ beforeDestroy () {
67
+ this.updatePageHeight(0)
68
+ },
69
+ computed: {
70
+ ...mapState('setting', ['layout', 'multiPage', 'pageMinHeight', 'pageWidth', 'customTitles']),
71
+ pageTitle () {
72
+ const pageTitle = this.page && this.page.title
73
+ return this.customTitle || (pageTitle && this.$t(pageTitle)) || this.title || this.routeName
74
+ },
75
+ routeName () {
76
+ const route = this.$route
77
+ return this.$t(getI18nKey(route.matched[route.matched.length - 1].path))
78
+ },
79
+ breadcrumb () {
80
+ const page = this.page
81
+ const breadcrumb = page && page.breadcrumb
82
+ if (breadcrumb) {
83
+ const i18nBreadcrumb = []
84
+ breadcrumb.forEach(item => {
85
+ i18nBreadcrumb.push(this.$t(item))
86
+ })
87
+ return i18nBreadcrumb
88
+ } else {
89
+ return this.getRouteBreadcrumb()
90
+ }
91
+ },
92
+ marginCorrect () {
93
+ return this.multiPage ? 24 : 0
94
+ }
95
+ },
96
+ methods: {
97
+ ...mapMutations('setting', ['correctPageMinHeight']),
98
+ getRouteBreadcrumb () {
99
+ const routes = this.$route.matched
100
+ const path = this.$route.path
101
+ const breadcrumb = []
102
+ routes.filter(item => path.includes(item.path))
103
+ .forEach(route => {
104
+ const path = route.path.length === 0 ? '/home' : route.path
105
+ breadcrumb.push(this.$t(getI18nKey(path)))
106
+ })
107
+ const pageTitle = this.page && this.page.title
108
+ if (this.customTitle || pageTitle) {
109
+ breadcrumb[breadcrumb.length - 1] = this.customTitle || pageTitle
110
+ }
111
+ return breadcrumb
112
+ },
113
+ /**
114
+ * 用于计算页面内容最小高度
115
+ * @param newHeight
116
+ */
117
+ updatePageHeight (newHeight = this.$refs.pageHeader.$el.offsetHeight + this.marginCorrect) {
118
+ this.correctPageMinHeight(this.pageHeaderHeight - newHeight)
119
+ this.pageHeaderHeight = newHeight
120
+ }
121
+ }
122
+ }
123
+ </script>
124
+
125
+ <style lang="less">
126
+ .page-header{
127
+ margin: 0 -24px 0;
128
+ }
129
+ .link{
130
+ /*margin-top: 16px;*/
131
+ line-height: 24px;
132
+ a{
133
+ font-size: 14px;
134
+ margin-right: 32px;
135
+ i{
136
+ font-size: 22px;
137
+ margin-right: 8px;
138
+ }
139
+ }
140
+ }
141
+ .page-content{
142
+ position: relative;
143
+ padding: 24px 0 0;
144
+ &.side{
145
+ }
146
+ &.head.fixed{
147
+ margin: 0 auto;
148
+ max-width: 100%;
149
+ }
150
+ }
151
+ </style>