vue2-client 1.4.36 → 1.4.38

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 (97) hide show
  1. package/CHANGELOG.md +442 -434
  2. package/index.js +30 -30
  3. package/package.json +78 -78
  4. package/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox.vue +225 -225
  5. package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +777 -777
  6. package/src/base-client/components/common/FormGroupQuery/FormGroupQuery.vue +165 -165
  7. package/src/base-client/components/common/JSONToTree/jsontotree.vue +275 -275
  8. package/src/base-client/components/common/XAddForm/XAddForm.vue +354 -354
  9. package/src/base-client/components/common/XAddNativeForm/XAddNativeForm.vue +327 -327
  10. package/src/base-client/components/common/XCard/XCard.vue +64 -64
  11. package/src/base-client/components/common/XForm/XForm.vue +274 -274
  12. package/src/base-client/components/common/XFormTable/index.md +96 -96
  13. package/src/base-client/components/system/QueryParamsDetailsView/QueryParamsDetailsView.vue +281 -281
  14. package/src/base-client/components/ticket/TicketDetailsView/TicketDetailsView.vue +807 -807
  15. package/src/base-client/components/ticket/TicketDetailsView/index.md +29 -29
  16. package/src/base-client/components/ticket/TicketDetailsView/part/TicketDetailsFlow.vue +260 -260
  17. package/src/base-client/components/ticket/TicketSubmitSuccessView/TicketSubmitSuccessView.vue +532 -532
  18. package/src/base-client/components/ticket/TicketSubmitSuccessView/index.md +29 -29
  19. package/src/base-client/plugins/AppData.js +73 -73
  20. package/src/base-client/plugins/GetLoginInfoService.js +179 -179
  21. package/src/base-client/plugins/PagedList.js +177 -177
  22. package/src/base-client/plugins/compatible/LoginServiceOA.js +20 -20
  23. package/src/base-client/plugins/i18n-extend.js +32 -32
  24. package/src/components/Ellipsis/index.md +38 -38
  25. package/src/components/FileImageItem/FileItem.vue +60 -0
  26. package/src/components/FileImageItem/ImageItem.vue +78 -0
  27. package/src/components/FileImageItem/index.js +4 -0
  28. package/src/components/FilePreview/FilePreview.vue +110 -0
  29. package/src/components/FilePreview/index.js +3 -0
  30. package/src/components/NumberInfo/index.md +43 -43
  31. package/src/components/STable/README.md +341 -341
  32. package/src/components/STable/index.js +318 -318
  33. package/src/components/Trend/index.md +45 -45
  34. package/src/components/checkbox/ColorCheckbox.vue +157 -157
  35. package/src/components/checkbox/ImgCheckbox.vue +163 -163
  36. package/src/components/form/FormRow.vue +52 -52
  37. package/src/components/index.js +36 -36
  38. package/src/components/menu/SideMenu.vue +62 -62
  39. package/src/components/menu/menu.js +273 -273
  40. package/src/components/page/header/index.less +40 -40
  41. package/src/components/setting/Setting.vue +235 -235
  42. package/src/components/table/StandardTable.vue +141 -141
  43. package/src/components/table/advance/ActionColumns.vue +158 -158
  44. package/src/components/table/advance/SearchArea.vue +355 -355
  45. package/src/components/tool/AStepItem.vue +60 -60
  46. package/src/components/tool/AvatarList.vue +68 -68
  47. package/src/components/tool/Drawer.vue +142 -142
  48. package/src/components/tool/TagSelect.vue +83 -83
  49. package/src/components/transition/PageToggleTransition.vue +97 -97
  50. package/src/config/replacer/resolve.config.js +67 -67
  51. package/src/layouts/AdminLayout.vue +174 -174
  52. package/src/layouts/PageLayout.vue +151 -151
  53. package/src/layouts/SinglePageView.vue +105 -105
  54. package/src/layouts/header/AdminHeader.vue +104 -104
  55. package/src/layouts/header/HeaderNotice.vue +167 -167
  56. package/src/layouts/header/HeaderSearch.vue +67 -67
  57. package/src/layouts/header/InstitutionDetail.vue +181 -181
  58. package/src/layouts/header/index.less +92 -92
  59. package/src/layouts/tabs/TabsHead.vue +190 -190
  60. package/src/layouts/tabs/TabsView.vue +379 -379
  61. package/src/mock/goods/index.js +108 -108
  62. package/src/pages/CreateQueryPage.vue +65 -65
  63. package/src/pages/login/Login.vue +345 -345
  64. package/src/pages/report/ReportTable.js +124 -124
  65. package/src/pages/report/ReportTableHome.vue +28 -28
  66. package/src/pages/resourceManage/orgListManage.vue +98 -98
  67. package/src/pages/system/dictionary/index.vue +43 -43
  68. package/src/pages/system/file/index.vue +317 -317
  69. package/src/pages/system/monitor/loginInfor/index.vue +36 -36
  70. package/src/pages/system/monitor/operLog/index.vue +36 -36
  71. package/src/pages/system/queryParams/index.vue +43 -43
  72. package/src/pages/system/ticket/submitTicketSuccess.vue +46 -3
  73. package/src/router/async/config.async.js +27 -27
  74. package/src/router/async/router.map.js +65 -65
  75. package/src/router/index.js +27 -27
  76. package/src/services/api/DictionaryDetailsViewApi.js +6 -6
  77. package/src/services/api/LogDetailsViewApi.js +10 -10
  78. package/src/services/api/QueryParamsDetailsViewApi.js +6 -6
  79. package/src/services/api/TicketDetailsViewApi.js +34 -34
  80. package/src/services/api/cas.js +79 -79
  81. package/src/services/api/commonTempTable.js +10 -10
  82. package/src/services/api/index.js +17 -17
  83. package/src/services/api/manage.js +8 -8
  84. package/src/services/apiService.js +13 -13
  85. package/src/services/user.js +53 -53
  86. package/src/store/modules/index.js +4 -4
  87. package/src/theme/default/nprogress.less +76 -76
  88. package/src/theme/default/style.less +47 -47
  89. package/src/utils/colors.js +103 -103
  90. package/src/utils/excel/Blob.js +180 -180
  91. package/src/utils/excel/Export2Excel.js +141 -141
  92. package/src/utils/formatter.js +68 -68
  93. package/src/utils/i18n.js +80 -80
  94. package/src/utils/routerUtil.js +364 -364
  95. package/src/utils/theme-color-replacer-extend.js +91 -91
  96. package/src/utils/themeUtil.js +100 -100
  97. package/src/utils/util.js +230 -230
@@ -1,174 +1,174 @@
1
- <template>
2
- <a-layout :class="['admin-layout', 'beauty-scroll']">
3
- <drawer v-if="isMobile" v-model="drawerOpen">
4
- <side-menu :theme="theme.mode" :menuData="menuData" :collapsed="false" :collapsible="false" @menuSelect="onMenuSelect"/>
5
- </drawer>
6
- <side-menu
7
- :class="[fixedSideBar ? 'fixed-side' : '']"
8
- :theme="theme.mode"
9
- v-else-if="layout === 'side' || layout === 'mix'"
10
- :menuData="sideMenuData"
11
- :collapsed="collapsed"
12
- :collapsible="true" />
13
- <div v-if="fixedSideBar && !isMobile" :style="`width: ${sideMenuWidth}; min-width: ${sideMenuWidth};max-width: ${sideMenuWidth};`" class="virtual-side"></div>
14
- <drawer v-if="!hideSetting" v-model="showSetting" placement="right">
15
- <div class="setting" slot="handler">
16
- <a-icon :type="showSetting ? 'close' : 'setting'"/>
17
- </div>
18
- <setting />
19
- </drawer>
20
- <a-layout class="admin-layout-main beauty-scroll">
21
- <admin-header :class="[{'fixed-tabs': fixedTabs, 'fixed-header': fixedHeader, 'multi-page': multiPage}]" :style="headerStyle" :menuData="headMenuData" :collapsed="collapsed" @toggleCollapse="toggleCollapse"/>
22
- <a-layout-header :class="['virtual-header', {'fixed-tabs' : fixedTabs, 'fixed-header': fixedHeader, 'multi-page': multiPage}]" v-show="fixedHeader"></a-layout-header>
23
- <a-layout-content class="admin-layout-content" :style="`min-height: ${minHeight}px;`">
24
- <div style="position: relative">
25
- <slot></slot>
26
- </div>
27
- </a-layout-content>
28
- <a-layout-footer style="padding: 0">
29
- <page-footer :link-list="footerLinks" :copyright="copyright" />
30
- </a-layout-footer>
31
- </a-layout>
32
- </a-layout>
33
- </template>
34
-
35
- <script>
36
- import AdminHeader from './header/AdminHeader'
37
- import PageFooter from './footer/PageFooter'
38
- import Drawer from '../components/tool/Drawer'
39
- import SideMenu from '../components/menu/SideMenu'
40
- import Setting from '../components/setting/Setting'
41
- import { mapState, mapMutations, mapGetters } from 'vuex'
42
-
43
- // const minHeight = window.innerHeight - 64 - 122
44
-
45
- export default {
46
- name: 'AdminLayout',
47
- components: { Setting, SideMenu, Drawer, PageFooter, AdminHeader },
48
- data () {
49
- return {
50
- minHeight: window.innerHeight - 64 - 1,
51
- collapsed: false,
52
- showSetting: false,
53
- drawerOpen: false
54
- }
55
- },
56
- provide () {
57
- return {
58
- adminLayout: this
59
- }
60
- },
61
- watch: {
62
- $route (val) {
63
- this.setActivated(val)
64
- },
65
- layout () {
66
- this.setActivated(this.$route)
67
- },
68
- isMobile (val) {
69
- if (!val) {
70
- this.drawerOpen = false
71
- }
72
- }
73
- },
74
- computed: {
75
- ...mapState('setting', ['isMobile', 'theme', 'layout', 'footerLinks', 'copyright', 'fixedHeader', 'fixedSideBar',
76
- 'fixedTabs', 'hideSetting', 'multiPage']),
77
- ...mapGetters('setting', ['firstMenu', 'subMenu', 'menuData']),
78
- sideMenuWidth () {
79
- return this.collapsed ? '80px' : '256px'
80
- },
81
- headerStyle () {
82
- const width = (this.fixedHeader && this.layout !== 'head' && !this.isMobile) ? `calc(100% - ${this.sideMenuWidth})` : '100%'
83
- const position = this.fixedHeader ? 'fixed' : 'static'
84
- return `width: ${width}; position: ${position};`
85
- },
86
- headMenuData () {
87
- const { layout, menuData, firstMenu } = this
88
- return layout === 'mix' ? firstMenu : menuData
89
- },
90
- sideMenuData () {
91
- const { layout, menuData, subMenu } = this
92
- return layout === 'mix' ? subMenu : menuData
93
- }
94
- },
95
- methods: {
96
- ...mapMutations('setting', ['correctPageMinHeight', 'setActivatedFirst']),
97
- toggleCollapse () {
98
- this.collapsed = !this.collapsed
99
- },
100
- onMenuSelect () {
101
- this.toggleCollapse()
102
- },
103
- setActivated (route) {
104
- if (this.layout === 'mix') {
105
- let matched = route.matched
106
- matched = matched.slice(0, matched.length - 1)
107
- const { firstMenu } = this
108
- for (const menu of firstMenu) {
109
- if (matched.findIndex(item => item.path === menu.fullPath) !== -1) {
110
- this.setActivatedFirst(menu.fullPath)
111
- break
112
- }
113
- }
114
- }
115
- }
116
- },
117
- created () {
118
- this.correctPageMinHeight(this.minHeight - 24)
119
- this.setActivated(this.$route)
120
- },
121
- beforeDestroy () {
122
- this.correctPageMinHeight(-this.minHeight + 24)
123
- }
124
- }
125
- </script>
126
-
127
- <style lang="less" scoped>
128
- .admin-layout{
129
- .side-menu{
130
- &.fixed-side{
131
- position: fixed;
132
- height: 100vh;
133
- left: 0;
134
- top: 0;
135
- }
136
- }
137
- .virtual-side{
138
- transition: all 0.2s;
139
- }
140
- .virtual-header{
141
- transition: all 0.2s;
142
- opacity: 0;
143
- &.fixed-tabs.multi-page:not(.fixed-header){
144
- height: 0;
145
- }
146
- }
147
- .admin-layout-main{
148
- .admin-header{
149
- top: 0;
150
- right: 0;
151
- overflow: hidden;
152
- transition: all 0.2s;
153
- &.fixed-tabs.multi-page:not(.fixed-header){
154
- height: 0;
155
- }
156
- }
157
- }
158
- .admin-layout-content{
159
- padding: 24px;
160
- /*overflow-x: hidden;*/
161
- /*min-height: calc(100vh - 64px - 122px);*/
162
- }
163
- .setting{
164
- background-color: @primary-color;
165
- color: @base-bg-color;
166
- border-radius: 5px 0 0 5px;
167
- line-height: 40px;
168
- font-size: 22px;
169
- width: 40px;
170
- height: 40px;
171
- box-shadow: -2px 0 8px @shadow-color;
172
- }
173
- }
174
- </style>
1
+ <template>
2
+ <a-layout :class="['admin-layout', 'beauty-scroll']">
3
+ <drawer v-if="isMobile" v-model="drawerOpen">
4
+ <side-menu :theme="theme.mode" :menuData="menuData" :collapsed="false" :collapsible="false" @menuSelect="onMenuSelect"/>
5
+ </drawer>
6
+ <side-menu
7
+ :class="[fixedSideBar ? 'fixed-side' : '']"
8
+ :theme="theme.mode"
9
+ v-else-if="layout === 'side' || layout === 'mix'"
10
+ :menuData="sideMenuData"
11
+ :collapsed="collapsed"
12
+ :collapsible="true" />
13
+ <div v-if="fixedSideBar && !isMobile" :style="`width: ${sideMenuWidth}; min-width: ${sideMenuWidth};max-width: ${sideMenuWidth};`" class="virtual-side"></div>
14
+ <drawer v-if="!hideSetting" v-model="showSetting" placement="right">
15
+ <div class="setting" slot="handler">
16
+ <a-icon :type="showSetting ? 'close' : 'setting'"/>
17
+ </div>
18
+ <setting />
19
+ </drawer>
20
+ <a-layout class="admin-layout-main beauty-scroll">
21
+ <admin-header :class="[{'fixed-tabs': fixedTabs, 'fixed-header': fixedHeader, 'multi-page': multiPage}]" :style="headerStyle" :menuData="headMenuData" :collapsed="collapsed" @toggleCollapse="toggleCollapse"/>
22
+ <a-layout-header :class="['virtual-header', {'fixed-tabs' : fixedTabs, 'fixed-header': fixedHeader, 'multi-page': multiPage}]" v-show="fixedHeader"></a-layout-header>
23
+ <a-layout-content class="admin-layout-content" :style="`min-height: ${minHeight}px;`">
24
+ <div style="position: relative">
25
+ <slot></slot>
26
+ </div>
27
+ </a-layout-content>
28
+ <a-layout-footer style="padding: 0">
29
+ <page-footer :link-list="footerLinks" :copyright="copyright" />
30
+ </a-layout-footer>
31
+ </a-layout>
32
+ </a-layout>
33
+ </template>
34
+
35
+ <script>
36
+ import AdminHeader from './header/AdminHeader'
37
+ import PageFooter from './footer/PageFooter'
38
+ import Drawer from '../components/tool/Drawer'
39
+ import SideMenu from '../components/menu/SideMenu'
40
+ import Setting from '../components/setting/Setting'
41
+ import { mapState, mapMutations, mapGetters } from 'vuex'
42
+
43
+ // const minHeight = window.innerHeight - 64 - 122
44
+
45
+ export default {
46
+ name: 'AdminLayout',
47
+ components: { Setting, SideMenu, Drawer, PageFooter, AdminHeader },
48
+ data () {
49
+ return {
50
+ minHeight: window.innerHeight - 64 - 1,
51
+ collapsed: false,
52
+ showSetting: false,
53
+ drawerOpen: false
54
+ }
55
+ },
56
+ provide () {
57
+ return {
58
+ adminLayout: this
59
+ }
60
+ },
61
+ watch: {
62
+ $route (val) {
63
+ this.setActivated(val)
64
+ },
65
+ layout () {
66
+ this.setActivated(this.$route)
67
+ },
68
+ isMobile (val) {
69
+ if (!val) {
70
+ this.drawerOpen = false
71
+ }
72
+ }
73
+ },
74
+ computed: {
75
+ ...mapState('setting', ['isMobile', 'theme', 'layout', 'footerLinks', 'copyright', 'fixedHeader', 'fixedSideBar',
76
+ 'fixedTabs', 'hideSetting', 'multiPage']),
77
+ ...mapGetters('setting', ['firstMenu', 'subMenu', 'menuData']),
78
+ sideMenuWidth () {
79
+ return this.collapsed ? '80px' : '256px'
80
+ },
81
+ headerStyle () {
82
+ const width = (this.fixedHeader && this.layout !== 'head' && !this.isMobile) ? `calc(100% - ${this.sideMenuWidth})` : '100%'
83
+ const position = this.fixedHeader ? 'fixed' : 'static'
84
+ return `width: ${width}; position: ${position};`
85
+ },
86
+ headMenuData () {
87
+ const { layout, menuData, firstMenu } = this
88
+ return layout === 'mix' ? firstMenu : menuData
89
+ },
90
+ sideMenuData () {
91
+ const { layout, menuData, subMenu } = this
92
+ return layout === 'mix' ? subMenu : menuData
93
+ }
94
+ },
95
+ methods: {
96
+ ...mapMutations('setting', ['correctPageMinHeight', 'setActivatedFirst']),
97
+ toggleCollapse () {
98
+ this.collapsed = !this.collapsed
99
+ },
100
+ onMenuSelect () {
101
+ this.toggleCollapse()
102
+ },
103
+ setActivated (route) {
104
+ if (this.layout === 'mix') {
105
+ let matched = route.matched
106
+ matched = matched.slice(0, matched.length - 1)
107
+ const { firstMenu } = this
108
+ for (const menu of firstMenu) {
109
+ if (matched.findIndex(item => item.path === menu.fullPath) !== -1) {
110
+ this.setActivatedFirst(menu.fullPath)
111
+ break
112
+ }
113
+ }
114
+ }
115
+ }
116
+ },
117
+ created () {
118
+ this.correctPageMinHeight(this.minHeight - 24)
119
+ this.setActivated(this.$route)
120
+ },
121
+ beforeDestroy () {
122
+ this.correctPageMinHeight(-this.minHeight + 24)
123
+ }
124
+ }
125
+ </script>
126
+
127
+ <style lang="less" scoped>
128
+ .admin-layout{
129
+ .side-menu{
130
+ &.fixed-side{
131
+ position: fixed;
132
+ height: 100vh;
133
+ left: 0;
134
+ top: 0;
135
+ }
136
+ }
137
+ .virtual-side{
138
+ transition: all 0.2s;
139
+ }
140
+ .virtual-header{
141
+ transition: all 0.2s;
142
+ opacity: 0;
143
+ &.fixed-tabs.multi-page:not(.fixed-header){
144
+ height: 0;
145
+ }
146
+ }
147
+ .admin-layout-main{
148
+ .admin-header{
149
+ top: 0;
150
+ right: 0;
151
+ overflow: hidden;
152
+ transition: all 0.2s;
153
+ &.fixed-tabs.multi-page:not(.fixed-header){
154
+ height: 0;
155
+ }
156
+ }
157
+ }
158
+ .admin-layout-content{
159
+ padding: 24px;
160
+ /*overflow-x: hidden;*/
161
+ /*min-height: calc(100vh - 64px - 122px);*/
162
+ }
163
+ .setting{
164
+ background-color: @primary-color;
165
+ color: @base-bg-color;
166
+ border-radius: 5px 0 0 5px;
167
+ line-height: 40px;
168
+ font-size: 22px;
169
+ width: 40px;
170
+ height: 40px;
171
+ box-shadow: -2px 0 8px @shadow-color;
172
+ }
173
+ }
174
+ </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>