vue2-client 1.8.200 → 1.8.201

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.
@@ -0,0 +1,214 @@
1
+ <template>
2
+ <a-drawer
3
+ :visible="visible"
4
+ :width="isMobile ? screenWidth : screenWidth * 0.85"
5
+ placement="right"
6
+ :title="mainTitle"
7
+ @close="onClose"
8
+ >
9
+ <a-spin :spinning="loadDetails">
10
+ <a-page-header :title="title">
11
+ <!-- 详情区域 -->
12
+ <div class="row">
13
+ <div class="content">
14
+ <a-descriptions :column="isMobile ? 1 : 2" size="small">
15
+ <slot name="descriptionsContent" :details="details"/>
16
+ </a-descriptions>
17
+ </div>
18
+ <!-- 状态区域 -->
19
+ <div class="extra">
20
+ <slot name="statusContent" :details="details"/>
21
+ <!-- example is: -->
22
+ <!-- <a-row class="status-list">-->
23
+ <!-- <a-col :sm="24" :xs="12">-->
24
+ <!-- </a-col>-->
25
+ <!-- </a-row>-->
26
+ <!-- or many is: -->
27
+ <!-- <a-row class="status-list">-->
28
+ <!-- <a-col :sm="24" :xs="12">-->
29
+ <!-- </a-col>-->
30
+ <!-- </a-row>-->
31
+ <!-- <p></p>-->
32
+ <!-- <a-row class="status-list">-->
33
+ <!-- <a-col :sm="24" :xs="12">-->
34
+ <!-- </a-col>-->
35
+ <!-- </a-row>-->
36
+ </div>
37
+ </div>
38
+ <!-- 操作区域 -->
39
+ <template #extra>
40
+ <a-button-group style="margin-right: 4px;" v-show="buttonState.refresh">
41
+ <a-button :loading="loadDetails" type="dashed" @click="initView('1')">刷新</a-button>
42
+ </a-button-group>
43
+ <a-button-group style="margin-right: 4px;">
44
+ <slot name="actionContent"/>
45
+ </a-button-group>
46
+ </template>
47
+ <!-- 扩展区域 -->
48
+ <slot name="extraContent"/>
49
+ <!-- 页签区域 -->
50
+ <a-tabs default-active-key="1">
51
+ <slot name="actionTabs"/>
52
+ </a-tabs>
53
+ </a-page-header>
54
+ </a-spin>
55
+ </a-drawer>
56
+ </template>
57
+
58
+ <script>
59
+ import { formatDate } from '@vue2-client/utils/util'
60
+ import { mapState } from 'vuex'
61
+ import XBadge from '@vue2-client/base-client/components/common/XBadge/XBadge'
62
+ import { post } from 'vue2-client/src/services/api/restTools'
63
+
64
+ export default {
65
+ name: 'XDetailsView',
66
+ components: {
67
+ XBadge
68
+ },
69
+ data () {
70
+ return {
71
+ // 页面宽度
72
+ screenWidth: document.documentElement.clientWidth,
73
+ // 数据详情
74
+ details: {},
75
+ // 详情加载
76
+ loadDetails: false
77
+ }
78
+ },
79
+ mounted () {
80
+ this.initView()
81
+ },
82
+ computed: {
83
+ ...mapState('account', { currUser: 'user' }),
84
+ ...mapState('setting', ['isMobile'])
85
+ },
86
+ props: {
87
+ id: {
88
+ type: [String, Number],
89
+ required: false
90
+ },
91
+ mainTitle: {
92
+ type: String,
93
+ required: true
94
+ },
95
+ title: {
96
+ type: String,
97
+ required: true
98
+ },
99
+ visible: {
100
+ type: Boolean,
101
+ default: false
102
+ },
103
+ api: {
104
+ type: String,
105
+ required: false
106
+ },
107
+ // 按钮状态
108
+ buttonState: {
109
+ type: Object,
110
+ default: () => {
111
+ return {
112
+ // 刷新按钮显示状态
113
+ refresh: true
114
+ }
115
+ }
116
+ }
117
+ },
118
+ methods: {
119
+ // 初始化组件
120
+ initView () {
121
+ this.getDetails()
122
+ },
123
+ // 关闭抽屉时回调
124
+ onClose () {
125
+ this.$emit('update:visible', false)
126
+ },
127
+ // 获取详情信息
128
+ getDetails () {
129
+ if (this.api && this.id) {
130
+ this.loadDetails = true
131
+ post(this.api, {
132
+ id: this.id
133
+ }).then(res => {
134
+ this.details = res
135
+ }, err => {
136
+ console.error(err)
137
+ }).finally(() => {
138
+ this.loadDetails = false
139
+ })
140
+ }
141
+ },
142
+ // 日期格式化
143
+ format (date, format) {
144
+ return formatDate(date, format)
145
+ }
146
+ },
147
+ watch: {
148
+ 'visible' (val) {
149
+ if (val) {
150
+ this.initView()
151
+ }
152
+ }
153
+ }
154
+ }
155
+ </script>
156
+
157
+ <style lang="less" scoped>
158
+ .detail-layout {
159
+ margin-left: 44px;
160
+ }
161
+ .text {
162
+ color: rgba(0, 0, 0, .45);
163
+ }
164
+
165
+ .heading {
166
+ color: rgba(0, 0, 0, .85);
167
+ font-size: 20px;
168
+ }
169
+
170
+ .no-data {
171
+ color: rgba(0, 0, 0, .25);
172
+ text-align: center;
173
+ line-height: 64px;
174
+ font-size: 16px;
175
+
176
+ i {
177
+ font-size: 24px;
178
+ margin-right: 16px;
179
+ position: relative;
180
+ top: 3px;
181
+ }
182
+ }
183
+
184
+ .mobile {
185
+ .detail-layout {
186
+ margin-left: unset;
187
+ }
188
+ .text {
189
+
190
+ }
191
+ .status-list {
192
+ text-align: left;
193
+ }
194
+ }
195
+
196
+ .row {
197
+ display: flex;
198
+
199
+ .content {
200
+ -webkit-box-flex: 1;
201
+ flex: auto;
202
+ -ms-flex: auto;
203
+ }
204
+
205
+ .extra {
206
+ flex: 0 1 auto;
207
+ -webkit-box-flex: 0;
208
+ -ms-flex: 0 1 auto;
209
+ min-width: 242px;
210
+ margin-left: 88px;
211
+ text-align: right;
212
+ }
213
+ }
214
+ </style>
@@ -0,0 +1,3 @@
1
+ import XDetailsView from './XDetailsView'
2
+
3
+ export default XDetailsView