vue2-client 1.16.69 → 1.16.70
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 +112 -112
- package/src/assets/svg/female.svg +1 -1
- package/src/assets/svg/male.svg +1 -1
- package/src/base-client/components/common/HIS/HFormGroup/index.js +3 -3
- package/src/base-client/components/common/HIS/HFormTable/HFormTable.vue +379 -379
- package/src/base-client/components/common/HIS/HTab/HTab.vue +413 -413
- package/src/base-client/components/common/XCalendar/XCalendar.vue +399 -399
- package/src/base-client/components/common/XCollapse/XCollapse.vue +833 -833
- package/src/base-client/components/common/XDescriptions/XDescriptions.vue +174 -174
- package/src/base-client/components/common/XInput/XInput.vue +170 -170
- package/src/base-client/components/common/XSimpleDescriptions/XSimpleDescriptions.vue +166 -166
- package/src/base-client/components/common/XTable/XTable.vue +1610 -1610
- package/src/base-client/components/common/XTimeline/XTimeline.vue +454 -454
- package/src/base-client/components/his/XHDescriptions/XHDescriptions.vue +919 -919
- package/src/base-client/components/his/XHisEditor/XHisEditor.vue +705 -705
- package/src/base-client/components/his/XList/XList.vue +829 -829
- package/src/base-client/components/his/XRadio/XRadio.vue +305 -305
- package/src/base-client/components/his/XSimpleTable/XSimpleTable.vue +159 -159
- package/src/base-client/components/his/XTreeRows/XTreeRows.vue +341 -341
- package/src/base-client/components/his/threeTestOrders/editor.vue +113 -113
- package/src/config/CreateQueryConfig.js +325 -325
- package/src/pages/WorkflowDetail/WorkflowDetail.vue +5 -0
- package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkFlowHandle.vue +3 -0
- package/src/pages/XTreeOneProExample/index.vue +67 -67
- package/src/pages/userInfoDetailManage/ExceptionRecordQuery/index.vue +45 -45
- package/src-base-client/components/common/XCollapse/XCollapse.vue +0 -0
|
@@ -1,399 +1,399 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="calendar-wrapper" :style="config.styles?.wrapper">
|
|
3
|
-
<!-- 顶部标题栏 -->
|
|
4
|
-
<div v-if="config.header.show" class="header-bar" :style="config.styles?.header">
|
|
5
|
-
<div class="left">
|
|
6
|
-
<svg v-if="config.header.showIcon" class="calendar-icon" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
7
|
-
<rect x="3"
|
|
8
|
-
y="4"
|
|
9
|
-
width="18"
|
|
10
|
-
height="18"
|
|
11
|
-
rx="2"
|
|
12
|
-
ry="2"
|
|
13
|
-
stroke="#0057FE"
|
|
14
|
-
stroke-width="2"/>
|
|
15
|
-
<line x1="16"
|
|
16
|
-
y1="2"
|
|
17
|
-
x2="16"
|
|
18
|
-
y2="6"
|
|
19
|
-
stroke="#0057FE"
|
|
20
|
-
stroke-width="2"/>
|
|
21
|
-
<line x1="8"
|
|
22
|
-
y1="2"
|
|
23
|
-
x2="8"
|
|
24
|
-
y2="6"
|
|
25
|
-
stroke="#0057FE"
|
|
26
|
-
stroke-width="2"/>
|
|
27
|
-
<line x1="3"
|
|
28
|
-
y1="10"
|
|
29
|
-
x2="21"
|
|
30
|
-
y2="10"
|
|
31
|
-
stroke="#0057FE"
|
|
32
|
-
stroke-width="2"/>
|
|
33
|
-
</svg>
|
|
34
|
-
<input type="text" :value="config.header.title" class="title-input" :style="config.styles?.titleInput"/>
|
|
35
|
-
</div>
|
|
36
|
-
<div class="right">
|
|
37
|
-
<a-button v-if="config.header.showBackToToday" type="link" @click="backToToday">{{
|
|
38
|
-
config.header.backToTodayText
|
|
39
|
-
}}
|
|
40
|
-
</a-button>
|
|
41
|
-
<a-button v-if="config.header.showMonth" type="link" :disabled="!config.header.monthClickable">{{
|
|
42
|
-
todayMonth
|
|
43
|
-
}}
|
|
44
|
-
</a-button>
|
|
45
|
-
<a-button v-if="config.header.showDay" type="link" :disabled="!config.header.dayClickable">{{
|
|
46
|
-
todayDay
|
|
47
|
-
}}
|
|
48
|
-
</a-button>
|
|
49
|
-
</div>
|
|
50
|
-
</div>
|
|
51
|
-
|
|
52
|
-
<!-- 日历内容 -->
|
|
53
|
-
<div class="calendar-content" :style="config.styles?.calendarContent">
|
|
54
|
-
<!-- 子标题栏 -->
|
|
55
|
-
<div v-if="config.subHeader.show" class="sub-header" :style="config.styles?.subHeader">
|
|
56
|
-
<div class="title">
|
|
57
|
-
<span class="current-date" :style="config.styles?.currentDate">{{ currentDateText }}</span>
|
|
58
|
-
<span class="year" :style="config.styles?.year">{{ currentYearText }}</span>
|
|
59
|
-
</div>
|
|
60
|
-
<div class="actions">
|
|
61
|
-
<span
|
|
62
|
-
v-for="(action, index) in config.actions"
|
|
63
|
-
:key="index"
|
|
64
|
-
class="action-item"
|
|
65
|
-
:style="config.styles?.actionItem"
|
|
66
|
-
@click="handleAction(action)">
|
|
67
|
-
{{ action.text }}
|
|
68
|
-
</span>
|
|
69
|
-
<a-button v-if="config.subHeader.showNavigation" type="link" @click="prevMonth">
|
|
70
|
-
{{ config.subHeader.prevMonthText }}
|
|
71
|
-
</a-button>
|
|
72
|
-
<a-button v-if="config.subHeader.showNavigation" type="link" @click="nextMonth">
|
|
73
|
-
{{ config.subHeader.nextMonthText }}
|
|
74
|
-
</a-button>
|
|
75
|
-
</div>
|
|
76
|
-
</div>
|
|
77
|
-
|
|
78
|
-
<a-calendar
|
|
79
|
-
ref="calendar"
|
|
80
|
-
:value="currentDate"
|
|
81
|
-
:fullscreen="config.calendar.fullscreen"
|
|
82
|
-
@select="handleSelect"
|
|
83
|
-
/>
|
|
84
|
-
</div>
|
|
85
|
-
</div>
|
|
86
|
-
</template>
|
|
87
|
-
|
|
88
|
-
<script>
|
|
89
|
-
import { Calendar, Button } from 'ant-design-vue'
|
|
90
|
-
import moment from 'moment'
|
|
91
|
-
import 'moment/locale/zh-cn'
|
|
92
|
-
import { getConfigByName } from '@vue2-client/services/api/common'
|
|
93
|
-
|
|
94
|
-
// 设置中文
|
|
95
|
-
moment.locale('zh-cn')
|
|
96
|
-
|
|
97
|
-
// 默认配置
|
|
98
|
-
const defaultConfig = {
|
|
99
|
-
header: {
|
|
100
|
-
show: true,
|
|
101
|
-
title: '我的日程',
|
|
102
|
-
showIcon: true,
|
|
103
|
-
showBackToToday: true,
|
|
104
|
-
backToTodayText: '返回当天',
|
|
105
|
-
showMonth: true,
|
|
106
|
-
showDay: true,
|
|
107
|
-
monthClickable: false,
|
|
108
|
-
dayClickable: false
|
|
109
|
-
},
|
|
110
|
-
subHeader: {
|
|
111
|
-
show: true,
|
|
112
|
-
showNavigation: true,
|
|
113
|
-
prevMonthText: '←',
|
|
114
|
-
nextMonthText: '→'
|
|
115
|
-
},
|
|
116
|
-
calendar: {
|
|
117
|
-
fullscreen: false,
|
|
118
|
-
locale: 'zh-cn'
|
|
119
|
-
},
|
|
120
|
-
// 操作按钮
|
|
121
|
-
actions: [
|
|
122
|
-
{
|
|
123
|
-
text: '+ 新增日程',
|
|
124
|
-
type: 'add',
|
|
125
|
-
handler: 'handleAdd'
|
|
126
|
-
}
|
|
127
|
-
],
|
|
128
|
-
// 自定义样式
|
|
129
|
-
styles: {
|
|
130
|
-
wrapper: {},
|
|
131
|
-
header: {},
|
|
132
|
-
titleInput: {},
|
|
133
|
-
subHeader: {},
|
|
134
|
-
currentDate: {},
|
|
135
|
-
year: {},
|
|
136
|
-
actionItem: {},
|
|
137
|
-
calendarContent: {}
|
|
138
|
-
},
|
|
139
|
-
// 事件配置
|
|
140
|
-
events: {
|
|
141
|
-
select: 'select',
|
|
142
|
-
backToToday: 'back-to-today',
|
|
143
|
-
action: 'action',
|
|
144
|
-
add: 'add',
|
|
145
|
-
monthChange: 'month-change',
|
|
146
|
-
init: 'init'
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
export default {
|
|
151
|
-
name: 'XCalendar',
|
|
152
|
-
components: {
|
|
153
|
-
ACalendar: Calendar,
|
|
154
|
-
AButton: Button
|
|
155
|
-
},
|
|
156
|
-
props: {
|
|
157
|
-
// 接收配置
|
|
158
|
-
configName: {
|
|
159
|
-
type: String,
|
|
160
|
-
default: ''
|
|
161
|
-
}
|
|
162
|
-
},
|
|
163
|
-
data () {
|
|
164
|
-
const today = moment()
|
|
165
|
-
return {
|
|
166
|
-
currentDate: moment(),
|
|
167
|
-
todayMonth: today.month() + 1,
|
|
168
|
-
todayDay: today.date(),
|
|
169
|
-
// 合并默认配置和传入的配置
|
|
170
|
-
mergedConfig: {}
|
|
171
|
-
}
|
|
172
|
-
},
|
|
173
|
-
created () {
|
|
174
|
-
this.getData(this.configName)
|
|
175
|
-
},
|
|
176
|
-
computed: {
|
|
177
|
-
// 使用计算属性访问合并后的配置
|
|
178
|
-
config () {
|
|
179
|
-
return this.mergedConfig
|
|
180
|
-
},
|
|
181
|
-
currentDateText () {
|
|
182
|
-
const month = this.currentDate.month() + 1
|
|
183
|
-
const day = this.currentDate.date()
|
|
184
|
-
return `${this.numberToChinese(month)}月${this.numberToChinese(day)}日`
|
|
185
|
-
},
|
|
186
|
-
currentYearText () {
|
|
187
|
-
return this.currentDate.format('YYYY')
|
|
188
|
-
}
|
|
189
|
-
},
|
|
190
|
-
methods: {
|
|
191
|
-
// 获取配置
|
|
192
|
-
getData (config) {
|
|
193
|
-
console.warn(config)
|
|
194
|
-
getConfigByName(config, 'af-his', res => {
|
|
195
|
-
// 深度合并配置
|
|
196
|
-
this.mergedConfig = this.mergeConfig(defaultConfig, res)
|
|
197
|
-
this.$emit(this.mergedConfig.events.init, this.currentDate)
|
|
198
|
-
})
|
|
199
|
-
},
|
|
200
|
-
// 深度合并配置
|
|
201
|
-
mergeConfig (defaultConfig, userConfig) {
|
|
202
|
-
const result = { ...defaultConfig }
|
|
203
|
-
|
|
204
|
-
for (const key in userConfig) {
|
|
205
|
-
if (typeof userConfig[key] === 'object' && userConfig[key] !== null &&
|
|
206
|
-
typeof defaultConfig[key] === 'object' && defaultConfig[key] !== null) {
|
|
207
|
-
result[key] = this.mergeConfig(defaultConfig[key], userConfig[key])
|
|
208
|
-
} else if (userConfig[key] !== undefined) {
|
|
209
|
-
result[key] = userConfig[key]
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
return result
|
|
214
|
-
},
|
|
215
|
-
numberToChinese (num) {
|
|
216
|
-
const chineseNums = ['零', '一', '二', '三', '四', '五', '六', '七', '八', '九', '十']
|
|
217
|
-
if (num <= 10) return chineseNums[num]
|
|
218
|
-
if (num < 20) return '十' + (num % 10 === 0 ? '' : chineseNums[num % 10])
|
|
219
|
-
return chineseNums[Math.floor(num / 10)] + '十' + (num % 10 === 0 ? '' : chineseNums[num % 10])
|
|
220
|
-
},
|
|
221
|
-
handleSelect (date) {
|
|
222
|
-
this.currentDate = date
|
|
223
|
-
// 触发选择事件,使用配置的事件名
|
|
224
|
-
this.$emit(this.config.events.select, date)
|
|
225
|
-
},
|
|
226
|
-
prevMonth () {
|
|
227
|
-
// 使用moment API直接操作日期
|
|
228
|
-
this.currentDate = moment(this.currentDate).subtract(1, 'month')
|
|
229
|
-
// 触发月份变化事件
|
|
230
|
-
this.$emit(this.config.events.monthChange, this.currentDate)
|
|
231
|
-
},
|
|
232
|
-
nextMonth () {
|
|
233
|
-
// 使用moment API直接操作日期
|
|
234
|
-
this.currentDate = moment(this.currentDate).add(1, 'month')
|
|
235
|
-
// 触发月份变化事件
|
|
236
|
-
this.$emit(this.config.events.monthChange, this.currentDate)
|
|
237
|
-
},
|
|
238
|
-
backToToday () {
|
|
239
|
-
// 返回当天
|
|
240
|
-
this.currentDate = moment()
|
|
241
|
-
// 触发返回今天事件
|
|
242
|
-
this.$emit(this.config.events.backToToday, this.currentDate)
|
|
243
|
-
},
|
|
244
|
-
// 处理操作按钮点击
|
|
245
|
-
handleAction (action) {
|
|
246
|
-
// 检查是否有注册的处理方法
|
|
247
|
-
if (action.type && typeof this[`handle${action.type.charAt(0).toUpperCase() + action.type.slice(1)}`] === 'function') {
|
|
248
|
-
// 调用对应的处理方法
|
|
249
|
-
this[`handle${action.type.charAt(0).toUpperCase() + action.type.slice(1)}`](action)
|
|
250
|
-
} else if (action.handler && typeof this.$parent[action.handler] === 'function') {
|
|
251
|
-
// 调用父组件的方法
|
|
252
|
-
this.$parent[action.handler](this.currentDate, action)
|
|
253
|
-
}
|
|
254
|
-
// 触发点击事件
|
|
255
|
-
this.$emit(this.config.events.action, this.currentDate)
|
|
256
|
-
},
|
|
257
|
-
// 默认的新增处理方法
|
|
258
|
-
handleAdd (action) {
|
|
259
|
-
this.$emit(this.config.events.add, this.currentDate)
|
|
260
|
-
}
|
|
261
|
-
},
|
|
262
|
-
watch: {
|
|
263
|
-
// 监听配置参数名称变化
|
|
264
|
-
queryParamsName: {
|
|
265
|
-
handler (newValue) {
|
|
266
|
-
this.getData(newValue)
|
|
267
|
-
},
|
|
268
|
-
deep: true,
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
</script>
|
|
273
|
-
|
|
274
|
-
<style scoped lang="less">
|
|
275
|
-
.calendar-wrapper {
|
|
276
|
-
background: #fff;
|
|
277
|
-
border-radius: 8px;
|
|
278
|
-
padding: 3px;
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
/* 顶部标题栏样式 */
|
|
282
|
-
.header-bar {
|
|
283
|
-
display: flex;
|
|
284
|
-
justify-content: space-between;
|
|
285
|
-
align-items: center;
|
|
286
|
-
padding-bottom: 16px;
|
|
287
|
-
border-bottom: 2px solid #0057FE;
|
|
288
|
-
margin-bottom: 16px;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
.header-bar .left {
|
|
292
|
-
display: flex;
|
|
293
|
-
align-items: center;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
.calendar-icon {
|
|
297
|
-
display: inline-block;
|
|
298
|
-
width: 20px;
|
|
299
|
-
height: 20px;
|
|
300
|
-
margin-right: 8px;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
.title-input {
|
|
304
|
-
border: none;
|
|
305
|
-
font-size: 16px;
|
|
306
|
-
font-weight: 500;
|
|
307
|
-
outline: none;
|
|
308
|
-
color: #000;
|
|
309
|
-
background-color: transparent;
|
|
310
|
-
width: 200px;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
.header-bar .right {
|
|
314
|
-
display: flex;
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
.sub-header {
|
|
318
|
-
display: flex;
|
|
319
|
-
justify-content: space-between;
|
|
320
|
-
align-items: center;
|
|
321
|
-
margin-bottom: 16px;
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
.title {
|
|
325
|
-
display: flex;
|
|
326
|
-
gap: 8px;
|
|
327
|
-
align-items: baseline;
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
.current-date {
|
|
331
|
-
font-size: 24px;
|
|
332
|
-
font-weight: 500;
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
.year {
|
|
336
|
-
color: #999;
|
|
337
|
-
font-size: 16px;
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
.actions {
|
|
341
|
-
display: flex;
|
|
342
|
-
align-items: center;
|
|
343
|
-
gap: 16px;
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
.action-item {
|
|
347
|
-
color: #666;
|
|
348
|
-
cursor: pointer;
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
.calendar-content {
|
|
352
|
-
border: 1px solid #f0f0f0;
|
|
353
|
-
border-radius: 4px;
|
|
354
|
-
padding: 16px;
|
|
355
|
-
|
|
356
|
-
:deep(.ant-fullcalendar-header) {
|
|
357
|
-
display: none;
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
:deep(.ant-fullcalendar) {
|
|
361
|
-
border: none;
|
|
362
|
-
border-radius: 0;
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
:deep(.ant-fullcalendar-calendar-body) {
|
|
366
|
-
padding: 8px 12px;
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
:deep(.ant-fullcalendar-column-header) {
|
|
370
|
-
text-align: center;
|
|
371
|
-
padding: 12px 0;
|
|
372
|
-
|
|
373
|
-
.ant-fullcalendar-column-header-inner {
|
|
374
|
-
display: inline-block;
|
|
375
|
-
font-weight: normal;
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
:deep(.ant-fullcalendar-cell) {
|
|
380
|
-
padding: 4px 0;
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
:deep(.ant-fullcalendar-date) {
|
|
384
|
-
height: 24px;
|
|
385
|
-
margin: 0 4px;
|
|
386
|
-
padding: 4px;
|
|
387
|
-
border-radius: 2px;
|
|
388
|
-
border: none;
|
|
389
|
-
width: auto;
|
|
390
|
-
text-align: center;
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
:deep(.ant-fullcalendar-selected-day .ant-fullcalendar-value) {
|
|
394
|
-
background: #000;
|
|
395
|
-
color: #fff;
|
|
396
|
-
border-radius: 50%;
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="calendar-wrapper" :style="config.styles?.wrapper">
|
|
3
|
+
<!-- 顶部标题栏 -->
|
|
4
|
+
<div v-if="config.header.show" class="header-bar" :style="config.styles?.header">
|
|
5
|
+
<div class="left">
|
|
6
|
+
<svg v-if="config.header.showIcon" class="calendar-icon" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
7
|
+
<rect x="3"
|
|
8
|
+
y="4"
|
|
9
|
+
width="18"
|
|
10
|
+
height="18"
|
|
11
|
+
rx="2"
|
|
12
|
+
ry="2"
|
|
13
|
+
stroke="#0057FE"
|
|
14
|
+
stroke-width="2"/>
|
|
15
|
+
<line x1="16"
|
|
16
|
+
y1="2"
|
|
17
|
+
x2="16"
|
|
18
|
+
y2="6"
|
|
19
|
+
stroke="#0057FE"
|
|
20
|
+
stroke-width="2"/>
|
|
21
|
+
<line x1="8"
|
|
22
|
+
y1="2"
|
|
23
|
+
x2="8"
|
|
24
|
+
y2="6"
|
|
25
|
+
stroke="#0057FE"
|
|
26
|
+
stroke-width="2"/>
|
|
27
|
+
<line x1="3"
|
|
28
|
+
y1="10"
|
|
29
|
+
x2="21"
|
|
30
|
+
y2="10"
|
|
31
|
+
stroke="#0057FE"
|
|
32
|
+
stroke-width="2"/>
|
|
33
|
+
</svg>
|
|
34
|
+
<input type="text" :value="config.header.title" class="title-input" :style="config.styles?.titleInput"/>
|
|
35
|
+
</div>
|
|
36
|
+
<div class="right">
|
|
37
|
+
<a-button v-if="config.header.showBackToToday" type="link" @click="backToToday">{{
|
|
38
|
+
config.header.backToTodayText
|
|
39
|
+
}}
|
|
40
|
+
</a-button>
|
|
41
|
+
<a-button v-if="config.header.showMonth" type="link" :disabled="!config.header.monthClickable">{{
|
|
42
|
+
todayMonth
|
|
43
|
+
}}
|
|
44
|
+
</a-button>
|
|
45
|
+
<a-button v-if="config.header.showDay" type="link" :disabled="!config.header.dayClickable">{{
|
|
46
|
+
todayDay
|
|
47
|
+
}}
|
|
48
|
+
</a-button>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
<!-- 日历内容 -->
|
|
53
|
+
<div class="calendar-content" :style="config.styles?.calendarContent">
|
|
54
|
+
<!-- 子标题栏 -->
|
|
55
|
+
<div v-if="config.subHeader.show" class="sub-header" :style="config.styles?.subHeader">
|
|
56
|
+
<div class="title">
|
|
57
|
+
<span class="current-date" :style="config.styles?.currentDate">{{ currentDateText }}</span>
|
|
58
|
+
<span class="year" :style="config.styles?.year">{{ currentYearText }}</span>
|
|
59
|
+
</div>
|
|
60
|
+
<div class="actions">
|
|
61
|
+
<span
|
|
62
|
+
v-for="(action, index) in config.actions"
|
|
63
|
+
:key="index"
|
|
64
|
+
class="action-item"
|
|
65
|
+
:style="config.styles?.actionItem"
|
|
66
|
+
@click="handleAction(action)">
|
|
67
|
+
{{ action.text }}
|
|
68
|
+
</span>
|
|
69
|
+
<a-button v-if="config.subHeader.showNavigation" type="link" @click="prevMonth">
|
|
70
|
+
{{ config.subHeader.prevMonthText }}
|
|
71
|
+
</a-button>
|
|
72
|
+
<a-button v-if="config.subHeader.showNavigation" type="link" @click="nextMonth">
|
|
73
|
+
{{ config.subHeader.nextMonthText }}
|
|
74
|
+
</a-button>
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
|
|
78
|
+
<a-calendar
|
|
79
|
+
ref="calendar"
|
|
80
|
+
:value="currentDate"
|
|
81
|
+
:fullscreen="config.calendar.fullscreen"
|
|
82
|
+
@select="handleSelect"
|
|
83
|
+
/>
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
</template>
|
|
87
|
+
|
|
88
|
+
<script>
|
|
89
|
+
import { Calendar, Button } from 'ant-design-vue'
|
|
90
|
+
import moment from 'moment'
|
|
91
|
+
import 'moment/locale/zh-cn'
|
|
92
|
+
import { getConfigByName } from '@vue2-client/services/api/common'
|
|
93
|
+
|
|
94
|
+
// 设置中文
|
|
95
|
+
moment.locale('zh-cn')
|
|
96
|
+
|
|
97
|
+
// 默认配置
|
|
98
|
+
const defaultConfig = {
|
|
99
|
+
header: {
|
|
100
|
+
show: true,
|
|
101
|
+
title: '我的日程',
|
|
102
|
+
showIcon: true,
|
|
103
|
+
showBackToToday: true,
|
|
104
|
+
backToTodayText: '返回当天',
|
|
105
|
+
showMonth: true,
|
|
106
|
+
showDay: true,
|
|
107
|
+
monthClickable: false,
|
|
108
|
+
dayClickable: false
|
|
109
|
+
},
|
|
110
|
+
subHeader: {
|
|
111
|
+
show: true,
|
|
112
|
+
showNavigation: true,
|
|
113
|
+
prevMonthText: '←',
|
|
114
|
+
nextMonthText: '→'
|
|
115
|
+
},
|
|
116
|
+
calendar: {
|
|
117
|
+
fullscreen: false,
|
|
118
|
+
locale: 'zh-cn'
|
|
119
|
+
},
|
|
120
|
+
// 操作按钮
|
|
121
|
+
actions: [
|
|
122
|
+
{
|
|
123
|
+
text: '+ 新增日程',
|
|
124
|
+
type: 'add',
|
|
125
|
+
handler: 'handleAdd'
|
|
126
|
+
}
|
|
127
|
+
],
|
|
128
|
+
// 自定义样式
|
|
129
|
+
styles: {
|
|
130
|
+
wrapper: {},
|
|
131
|
+
header: {},
|
|
132
|
+
titleInput: {},
|
|
133
|
+
subHeader: {},
|
|
134
|
+
currentDate: {},
|
|
135
|
+
year: {},
|
|
136
|
+
actionItem: {},
|
|
137
|
+
calendarContent: {}
|
|
138
|
+
},
|
|
139
|
+
// 事件配置
|
|
140
|
+
events: {
|
|
141
|
+
select: 'select',
|
|
142
|
+
backToToday: 'back-to-today',
|
|
143
|
+
action: 'action',
|
|
144
|
+
add: 'add',
|
|
145
|
+
monthChange: 'month-change',
|
|
146
|
+
init: 'init'
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export default {
|
|
151
|
+
name: 'XCalendar',
|
|
152
|
+
components: {
|
|
153
|
+
ACalendar: Calendar,
|
|
154
|
+
AButton: Button
|
|
155
|
+
},
|
|
156
|
+
props: {
|
|
157
|
+
// 接收配置
|
|
158
|
+
configName: {
|
|
159
|
+
type: String,
|
|
160
|
+
default: ''
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
data () {
|
|
164
|
+
const today = moment()
|
|
165
|
+
return {
|
|
166
|
+
currentDate: moment(),
|
|
167
|
+
todayMonth: today.month() + 1,
|
|
168
|
+
todayDay: today.date(),
|
|
169
|
+
// 合并默认配置和传入的配置
|
|
170
|
+
mergedConfig: {}
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
created () {
|
|
174
|
+
this.getData(this.configName)
|
|
175
|
+
},
|
|
176
|
+
computed: {
|
|
177
|
+
// 使用计算属性访问合并后的配置
|
|
178
|
+
config () {
|
|
179
|
+
return this.mergedConfig
|
|
180
|
+
},
|
|
181
|
+
currentDateText () {
|
|
182
|
+
const month = this.currentDate.month() + 1
|
|
183
|
+
const day = this.currentDate.date()
|
|
184
|
+
return `${this.numberToChinese(month)}月${this.numberToChinese(day)}日`
|
|
185
|
+
},
|
|
186
|
+
currentYearText () {
|
|
187
|
+
return this.currentDate.format('YYYY')
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
methods: {
|
|
191
|
+
// 获取配置
|
|
192
|
+
getData (config) {
|
|
193
|
+
console.warn(config)
|
|
194
|
+
getConfigByName(config, 'af-his', res => {
|
|
195
|
+
// 深度合并配置
|
|
196
|
+
this.mergedConfig = this.mergeConfig(defaultConfig, res)
|
|
197
|
+
this.$emit(this.mergedConfig.events.init, this.currentDate)
|
|
198
|
+
})
|
|
199
|
+
},
|
|
200
|
+
// 深度合并配置
|
|
201
|
+
mergeConfig (defaultConfig, userConfig) {
|
|
202
|
+
const result = { ...defaultConfig }
|
|
203
|
+
|
|
204
|
+
for (const key in userConfig) {
|
|
205
|
+
if (typeof userConfig[key] === 'object' && userConfig[key] !== null &&
|
|
206
|
+
typeof defaultConfig[key] === 'object' && defaultConfig[key] !== null) {
|
|
207
|
+
result[key] = this.mergeConfig(defaultConfig[key], userConfig[key])
|
|
208
|
+
} else if (userConfig[key] !== undefined) {
|
|
209
|
+
result[key] = userConfig[key]
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
return result
|
|
214
|
+
},
|
|
215
|
+
numberToChinese (num) {
|
|
216
|
+
const chineseNums = ['零', '一', '二', '三', '四', '五', '六', '七', '八', '九', '十']
|
|
217
|
+
if (num <= 10) return chineseNums[num]
|
|
218
|
+
if (num < 20) return '十' + (num % 10 === 0 ? '' : chineseNums[num % 10])
|
|
219
|
+
return chineseNums[Math.floor(num / 10)] + '十' + (num % 10 === 0 ? '' : chineseNums[num % 10])
|
|
220
|
+
},
|
|
221
|
+
handleSelect (date) {
|
|
222
|
+
this.currentDate = date
|
|
223
|
+
// 触发选择事件,使用配置的事件名
|
|
224
|
+
this.$emit(this.config.events.select, date)
|
|
225
|
+
},
|
|
226
|
+
prevMonth () {
|
|
227
|
+
// 使用moment API直接操作日期
|
|
228
|
+
this.currentDate = moment(this.currentDate).subtract(1, 'month')
|
|
229
|
+
// 触发月份变化事件
|
|
230
|
+
this.$emit(this.config.events.monthChange, this.currentDate)
|
|
231
|
+
},
|
|
232
|
+
nextMonth () {
|
|
233
|
+
// 使用moment API直接操作日期
|
|
234
|
+
this.currentDate = moment(this.currentDate).add(1, 'month')
|
|
235
|
+
// 触发月份变化事件
|
|
236
|
+
this.$emit(this.config.events.monthChange, this.currentDate)
|
|
237
|
+
},
|
|
238
|
+
backToToday () {
|
|
239
|
+
// 返回当天
|
|
240
|
+
this.currentDate = moment()
|
|
241
|
+
// 触发返回今天事件
|
|
242
|
+
this.$emit(this.config.events.backToToday, this.currentDate)
|
|
243
|
+
},
|
|
244
|
+
// 处理操作按钮点击
|
|
245
|
+
handleAction (action) {
|
|
246
|
+
// 检查是否有注册的处理方法
|
|
247
|
+
if (action.type && typeof this[`handle${action.type.charAt(0).toUpperCase() + action.type.slice(1)}`] === 'function') {
|
|
248
|
+
// 调用对应的处理方法
|
|
249
|
+
this[`handle${action.type.charAt(0).toUpperCase() + action.type.slice(1)}`](action)
|
|
250
|
+
} else if (action.handler && typeof this.$parent[action.handler] === 'function') {
|
|
251
|
+
// 调用父组件的方法
|
|
252
|
+
this.$parent[action.handler](this.currentDate, action)
|
|
253
|
+
}
|
|
254
|
+
// 触发点击事件
|
|
255
|
+
this.$emit(this.config.events.action, this.currentDate)
|
|
256
|
+
},
|
|
257
|
+
// 默认的新增处理方法
|
|
258
|
+
handleAdd (action) {
|
|
259
|
+
this.$emit(this.config.events.add, this.currentDate)
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
watch: {
|
|
263
|
+
// 监听配置参数名称变化
|
|
264
|
+
queryParamsName: {
|
|
265
|
+
handler (newValue) {
|
|
266
|
+
this.getData(newValue)
|
|
267
|
+
},
|
|
268
|
+
deep: true,
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
</script>
|
|
273
|
+
|
|
274
|
+
<style scoped lang="less">
|
|
275
|
+
.calendar-wrapper {
|
|
276
|
+
background: #fff;
|
|
277
|
+
border-radius: 8px;
|
|
278
|
+
padding: 3px;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/* 顶部标题栏样式 */
|
|
282
|
+
.header-bar {
|
|
283
|
+
display: flex;
|
|
284
|
+
justify-content: space-between;
|
|
285
|
+
align-items: center;
|
|
286
|
+
padding-bottom: 16px;
|
|
287
|
+
border-bottom: 2px solid #0057FE;
|
|
288
|
+
margin-bottom: 16px;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
.header-bar .left {
|
|
292
|
+
display: flex;
|
|
293
|
+
align-items: center;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
.calendar-icon {
|
|
297
|
+
display: inline-block;
|
|
298
|
+
width: 20px;
|
|
299
|
+
height: 20px;
|
|
300
|
+
margin-right: 8px;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
.title-input {
|
|
304
|
+
border: none;
|
|
305
|
+
font-size: 16px;
|
|
306
|
+
font-weight: 500;
|
|
307
|
+
outline: none;
|
|
308
|
+
color: #000;
|
|
309
|
+
background-color: transparent;
|
|
310
|
+
width: 200px;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
.header-bar .right {
|
|
314
|
+
display: flex;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
.sub-header {
|
|
318
|
+
display: flex;
|
|
319
|
+
justify-content: space-between;
|
|
320
|
+
align-items: center;
|
|
321
|
+
margin-bottom: 16px;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
.title {
|
|
325
|
+
display: flex;
|
|
326
|
+
gap: 8px;
|
|
327
|
+
align-items: baseline;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
.current-date {
|
|
331
|
+
font-size: 24px;
|
|
332
|
+
font-weight: 500;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
.year {
|
|
336
|
+
color: #999;
|
|
337
|
+
font-size: 16px;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
.actions {
|
|
341
|
+
display: flex;
|
|
342
|
+
align-items: center;
|
|
343
|
+
gap: 16px;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
.action-item {
|
|
347
|
+
color: #666;
|
|
348
|
+
cursor: pointer;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
.calendar-content {
|
|
352
|
+
border: 1px solid #f0f0f0;
|
|
353
|
+
border-radius: 4px;
|
|
354
|
+
padding: 16px;
|
|
355
|
+
|
|
356
|
+
:deep(.ant-fullcalendar-header) {
|
|
357
|
+
display: none;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
:deep(.ant-fullcalendar) {
|
|
361
|
+
border: none;
|
|
362
|
+
border-radius: 0;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
:deep(.ant-fullcalendar-calendar-body) {
|
|
366
|
+
padding: 8px 12px;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
:deep(.ant-fullcalendar-column-header) {
|
|
370
|
+
text-align: center;
|
|
371
|
+
padding: 12px 0;
|
|
372
|
+
|
|
373
|
+
.ant-fullcalendar-column-header-inner {
|
|
374
|
+
display: inline-block;
|
|
375
|
+
font-weight: normal;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
:deep(.ant-fullcalendar-cell) {
|
|
380
|
+
padding: 4px 0;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
:deep(.ant-fullcalendar-date) {
|
|
384
|
+
height: 24px;
|
|
385
|
+
margin: 0 4px;
|
|
386
|
+
padding: 4px;
|
|
387
|
+
border-radius: 2px;
|
|
388
|
+
border: none;
|
|
389
|
+
width: auto;
|
|
390
|
+
text-align: center;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
:deep(.ant-fullcalendar-selected-day .ant-fullcalendar-value) {
|
|
394
|
+
background: #000;
|
|
395
|
+
color: #fff;
|
|
396
|
+
border-radius: 50%;
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
</style>
|