vue2-client 1.12.93 → 1.12.95

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.
@@ -42,12 +42,11 @@
42
42
  </template>
43
43
 
44
44
  <script>
45
- import dayjs from 'dayjs'
46
- import 'dayjs/locale/zh-cn'
45
+ import moment from 'moment'
47
46
  import { getConfigByName, runLogic } from '@vue2-client/services/api/common'
48
47
 
49
- // 设置 dayjs 为中文语言环境
50
- dayjs.locale('zh-cn')
48
+ // 设置 moment 为中文语言环境
49
+ moment.locale('zh-cn')
51
50
 
52
51
  export default {
53
52
  name: 'XTimeline',
@@ -62,7 +61,7 @@ export default {
62
61
  // 配置参数名称,用于获取时间轴配置
63
62
  queryParamsName: {
64
63
  type: String,
65
- default: ''
64
+ default: 'XTimelineExampleConfig'
66
65
  }
67
66
  },
68
67
 
@@ -72,7 +71,7 @@ export default {
72
71
  data () {
73
72
  return {
74
73
  currentDate: this.modelValue, // 当前选中日期
75
- baseDate: dayjs().format('YYYY-MM-DD'), // 基准日期,默认今天,用于计算显示范围
74
+ baseDate: moment().format('YYYY-MM-DD'), // 基准日期,默认今天,用于计算显示范围
76
75
  config: null,
77
76
  disabledDates: [] // 禁用日期列表
78
77
  }
@@ -82,18 +81,15 @@ export default {
82
81
  displayDates () {
83
82
  const dates = []
84
83
  // 计算当前日期所在周的周一
85
- const currentDay = dayjs(this.baseDate)
84
+ const currentDay = moment(this.baseDate)
86
85
  const dayOfWeek = currentDay.day() || 7 // 获取星期几,将周日的0转换为7
87
- const mondayOfWeek = currentDay.subtract(dayOfWeek - 1, 'day') // 减去相应的天数得到周一
86
+ const mondayOfWeek = currentDay.clone().subtract(dayOfWeek - 1, 'day') // 减去相应的天数得到周一
88
87
 
89
88
  // 从周一开始,生成一周的日期
90
89
  dates.push(mondayOfWeek.format('YYYY-MM-DD')) // 周一
91
- dates.push(dayjs(mondayOfWeek).add(1, 'day').format('YYYY-MM-DD')) // 周二
92
- dates.push(dayjs(mondayOfWeek).add(2, 'day').format('YYYY-MM-DD')) // 周三
93
- dates.push(dayjs(mondayOfWeek).add(3, 'day').format('YYYY-MM-DD')) // 周四
94
- dates.push(dayjs(mondayOfWeek).add(4, 'day').format('YYYY-MM-DD')) // 周五
95
- dates.push(dayjs(mondayOfWeek).add(5, 'day').format('YYYY-MM-DD')) // 周六
96
- dates.push(dayjs(mondayOfWeek).add(6, 'day').format('YYYY-MM-DD')) // 周日
90
+ for (let i = 1; i <= 6; i++) {
91
+ dates.push(mondayOfWeek.clone().add(i, 'day').format('YYYY-MM-DD'))
92
+ }
97
93
 
98
94
  return dates
99
95
  }
@@ -167,28 +163,28 @@ export default {
167
163
  // 格式化日期显示
168
164
  formatDate (date) {
169
165
  const format = this.config?.dateFormat || 'MM/DD'
170
- return dayjs(date).format(format)
166
+ return moment(date).format(format)
171
167
  },
172
168
 
173
169
  // 获取星期显示
174
170
  getWeekDay (date) {
175
171
  const format = this.config?.weekFormat || '周dd'
176
- return dayjs(date).format(format)
172
+ return moment(date).format(format)
177
173
  },
178
174
 
179
175
  // 判断是否为周末
180
176
  isWeekend (date) {
181
177
  if (!this.config?.highlightWeekend) return false
182
- const day = dayjs(date).day()
178
+ const day = moment(date).day()
183
179
  return day === 0 || day === 6
184
180
  },
185
181
 
186
182
  // 判断日期是否禁用
187
183
  isDisabled (date) {
188
- if (this.config?.minDate && dayjs(date).isBefore(this.config.minDate)) {
184
+ if (this.config?.minDate && moment(date).isBefore(this.config.minDate)) {
189
185
  return true
190
186
  }
191
- if (this.config?.maxDate && dayjs(date).isAfter(this.config.maxDate)) {
187
+ if (this.config?.maxDate && moment(date).isAfter(this.config.maxDate)) {
192
188
  return true
193
189
  }
194
190
  return this.disabledDates.includes(date)
@@ -197,7 +193,7 @@ export default {
197
193
  // 判断是否为当前选中日期
198
194
  isCurrentDate (date) {
199
195
  if (!this.currentDate) return false
200
- return dayjs(date).format('YYYY-MM-DD') === dayjs(this.currentDate).format('YYYY-MM-DD')
196
+ return moment(date).format('YYYY-MM-DD') === moment(this.currentDate).format('YYYY-MM-DD')
201
197
  },
202
198
 
203
199
  // 选择日期
@@ -210,7 +206,7 @@ export default {
210
206
 
211
207
  // 前一天
212
208
  goToPrevDay () {
213
- const newDate = dayjs(this.baseDate).subtract(1, 'day')
209
+ const newDate = moment(this.baseDate).subtract(1, 'day')
214
210
  if (this.config?.minDate && newDate.isBefore(this.config.minDate)) {
215
211
  return
216
212
  }
@@ -227,7 +223,7 @@ export default {
227
223
 
228
224
  // 后一天
229
225
  goToNextDay () {
230
- const newDate = dayjs(this.baseDate).add(1, 'day')
226
+ const newDate = moment(this.baseDate).add(1, 'day')
231
227
  if (this.config?.maxDate && newDate.isAfter(this.config.maxDate)) {
232
228
  return
233
229
  }
@@ -241,12 +237,13 @@ export default {
241
237
  // 触发变更事件
242
238
  this.$emit('change', this.currentDate)
243
239
  },
240
+
244
241
  // 前一周
245
242
  goToPrevWeek () {
246
243
  // 计算当前日期所在周的周一
247
- const currentDay = dayjs(this.baseDate)
244
+ const currentDay = moment(this.baseDate)
248
245
  const dayOfWeek = currentDay.day() || 7 // 获取星期几,将周日的0转换为7
249
- const mondayOfWeek = currentDay.subtract(dayOfWeek - 1, 'day') // 减去相应的天数得到周一
246
+ const mondayOfWeek = currentDay.clone().subtract(dayOfWeek - 1, 'day') // 减去相应的天数得到周一
250
247
 
251
248
  // 前一周的周一
252
249
  const newDate = mondayOfWeek.subtract(7, 'day')
@@ -261,9 +258,9 @@ export default {
261
258
  // 后一周
262
259
  goToNextWeek () {
263
260
  // 计算当前日期所在周的周一
264
- const currentDay = dayjs(this.baseDate)
261
+ const currentDay = moment(this.baseDate)
265
262
  const dayOfWeek = currentDay.day() || 7 // 获取星期几,将周日的0转换为7
266
- const mondayOfWeek = currentDay.subtract(dayOfWeek - 1, 'day') // 减去相应的天数得到周一
263
+ const mondayOfWeek = currentDay.clone().subtract(dayOfWeek - 1, 'day') // 减去相应的天数得到周一
267
264
  // 后一周的周一
268
265
  const newDate = mondayOfWeek.add(7, 'day')
269
266
  if (this.config?.maxDate && newDate.isAfter(this.config.maxDate)) {
@@ -1,128 +1,137 @@
1
- <template>
2
- <div class="list-wrapper">
3
- <a-list size="large" :data-source="data" itemLayout="horizontal" class="list-container" ref="listRef">
4
- <a-list-item slot="renderItem" slot-scope="item, index" class="list-item" @click="handleClick(index)">
5
- <i
6
- v-if="icon"
7
- class="icon-menu"
8
- :style="getIconStyle(item)"
9
- ></i>
10
- <span
11
- class="item-text">
12
- {{ item.number }} {{ item.name }}
13
- </span>
14
- <a-button v-if="button" type="link" class="confirm-btn" @click.stop="click(index)">{{ buttonName }}</a-button>
15
- </a-list-item>
16
- </a-list>
17
- </div>
18
- </template>
19
-
20
- <script>
21
-
22
- import { getConfigByName, runLogic } from '@vue2-client/services/api/common'
23
-
24
- export default {
25
- name: 'XList',
26
- props: {
27
- queryParamsName: {
28
- type: Object,
29
- default: 'outpatientWaitConfig'
30
- }
31
- },
32
- inject: ['getComponentByName'],
33
- data () {
34
- return {
35
- data: [],
36
- button: false,
37
- icon: false,
38
- buttonName: ''
39
- }
40
- },
41
- created () {
42
- this.getData(this.queryParamsName)
43
- },
44
- methods: {
45
- async getData (config) {
46
- getConfigByName(config, 'af-his', res => {
47
- this.button = res.button
48
- this.icon = res.icon
49
- this.buttonName = res.buttonName
50
- runLogic(res.mainSource, {}, 'af-his').then(resData => {
51
- this.data = resData
52
- })
53
- })
54
- },
55
- handleClick (index) {
56
- this.$emit('listClick', this.data[index])
57
- },
58
- refreshList () {
59
- this.getData(this.queryParamsName)
60
- },
61
- click (index) {
62
- this.$emit('click', this.data[index + 1])
63
- },
64
- getIconStyle (item) {
65
- return item.picture
66
- ? { backgroundImage: `url(${item.picture})` }
67
- : {}
68
- }
69
- }
70
- }
71
- </script>
72
-
73
- <style scoped>
74
- .list-wrapper {
75
- max-height: 240px;
76
- overflow-y: auto;
77
- padding-right: 2px;
78
- }
79
-
80
- .list-container {
81
- width: 100%;
82
- }
83
-
84
- .list-item {
85
- height: 35px;
86
- border-radius: 6px;
87
- background-color: #F4F4F4;
88
- padding: 8px 15px;
89
- font-size: 16px;
90
- display: flex;
91
- align-items: center;
92
- width: 100%;
93
- border: 1px solid #D9D9D9;
94
- box-sizing: border-box;
95
- margin-bottom: 8px !important;
96
- }
97
-
98
- .icon-menu {
99
- display: inline-block;
100
- width: 20px;
101
- height: 20px;
102
- background-color: #ccc;
103
- margin-right: 8px;
104
- }
105
-
106
- .item-text {
107
- flex: 1;
108
- }
109
-
110
- .confirm-btn {
111
- margin-left: auto;
112
- padding: 0 8px;
113
- }
114
-
115
- /* 自定义滚动条样式 */
116
- .list-wrapper::-webkit-scrollbar {
117
- width: 6px;
118
- }
119
-
120
- .list-wrapper::-webkit-scrollbar-thumb {
121
- background-color: #d9d9d9;
122
- border-radius: 3px;
123
- }
124
-
125
- .list-wrapper::-webkit-scrollbar-track {
126
- background-color: #f0f0f0;
127
- }
128
- </style>
1
+ <template>
2
+ <div class="list-wrapper">
3
+ <a-list size="large" :data-source="data" itemLayout="horizontal" class="list-container" ref="listRef">
4
+ <a-list-item slot="renderItem" slot-scope="item, index" class="list-item" @click="handleClick(index)">
5
+ <i
6
+ v-if="icon"
7
+ class="icon-menu"
8
+ :style="getIconStyle(item)"
9
+ ></i>
10
+ <span
11
+ class="item-text">
12
+ {{ item.number }} {{ item.name }}
13
+ </span>
14
+ <a-button v-if="button" type="link" class="confirm-btn" @click.stop="click(index)">{{ buttonName }}</a-button>
15
+ </a-list-item>
16
+ </a-list>
17
+ </div>
18
+ </template>
19
+
20
+ <script>
21
+
22
+ import { runLogic } from '@vue2-client/services/api/common'
23
+
24
+ export default {
25
+ name: 'XList',
26
+ props: {
27
+ queryParamsName: {
28
+ type: Object,
29
+ default: null
30
+ }
31
+ },
32
+ inject: ['getComponentByName'],
33
+ data () {
34
+ return {
35
+ data: [],
36
+ button: false,
37
+ icon: false,
38
+ buttonName: ''
39
+ }
40
+ },
41
+ created () {
42
+ this.getData(this.queryParamsName)
43
+ },
44
+ methods: {
45
+ async getData (config) {
46
+ runLogic(config, {}, 'af-his').then(res => {
47
+ this.button = res.button
48
+ this.icon = res.icon
49
+ this.buttonName = res.buttonName
50
+ this.data = res.data
51
+ })
52
+ },
53
+ handleClick (index) {
54
+ this.$emit('listClick', this.data[index])
55
+ },
56
+ refreshList () {
57
+ this.getData(this.queryParamsName)
58
+ },
59
+ click (index) {
60
+ this.$emit('click', this.data[index + 1])
61
+ },
62
+ getIconStyle (item) {
63
+ return item.picture
64
+ ? { backgroundImage: `url(${item.picture})` }
65
+ : {}
66
+ },
67
+ filterDataById (id) {
68
+ const filteredData = this.data.filter(item => item.id === id)
69
+ this.data = filteredData
70
+ }
71
+ }
72
+ }
73
+ </script>
74
+
75
+ <style scoped>
76
+ .list-wrapper {
77
+ max-height: 240px;
78
+ overflow-y: auto;
79
+ padding-right: 2px;
80
+ }
81
+
82
+ .list-container {
83
+ width: 100%;
84
+ }
85
+
86
+ .list-item {
87
+ height: 35px;
88
+ border-radius: 6px;
89
+ background-color: #F4F4F4;
90
+ padding: 8px 15px;
91
+ font-size: 16px;
92
+ display: flex;
93
+ align-items: center;
94
+ width: 100%;
95
+ border: 1px solid #D9D9D9;
96
+ box-sizing: border-box;
97
+ margin-bottom: 8px !important;
98
+ }
99
+
100
+ .icon-menu {
101
+ display: inline-block;
102
+ width: 20px;
103
+ height: 20px;
104
+ background-color: #ccc;
105
+ margin-right: 8px;
106
+ }
107
+
108
+ .item-text {
109
+ flex: 1;
110
+ }
111
+
112
+ .confirm-btn {
113
+ margin-left: auto;
114
+ padding: 0 8px;
115
+ }
116
+
117
+ /* 高亮样式 */
118
+ .highlight-item {
119
+ background-color: #e6f7ff;
120
+ border: 1px solid #1890ff;
121
+ transition: all 0.3s;
122
+ }
123
+
124
+ /* 自定义滚动条样式 */
125
+ .list-wrapper::-webkit-scrollbar {
126
+ width: 6px;
127
+ }
128
+
129
+ .list-wrapper::-webkit-scrollbar-thumb {
130
+ background-color: #d9d9d9;
131
+ border-radius: 3px;
132
+ }
133
+
134
+ .list-wrapper::-webkit-scrollbar-track {
135
+ background-color: #f0f0f0;
136
+ }
137
+ </style>
@@ -1,99 +1,99 @@
1
- <template>
2
- <div class="x-time-select">
3
- <a-range-picker
4
- :value="dateRange"
5
- :placeholder="['开始日期', '结束日期']"
6
- separator="至"
7
- :disabled="disabled"
8
- :allowClear="allowClear"
9
- :format="format"
10
- @change="handleDateChange"
11
- />
12
- </div>
13
- </template>
14
-
15
- <script>
16
- import dayjs from 'dayjs'
17
-
18
- export default {
19
- name: 'XTimeSelect',
20
- props: {
21
- value: {
22
- type: Array,
23
- default: () => []
24
- },
25
- disabled: {
26
- type: Boolean,
27
- default: false
28
- },
29
- allowClear: {
30
- type: Boolean,
31
- default: true
32
- },
33
- format: {
34
- type: String,
35
- default: 'YYYY/MM/DD'
36
- }
37
- },
38
- data () {
39
- return {
40
- dateRange: []
41
- }
42
- },
43
- watch: {
44
- value: {
45
- handler (newVal) {
46
- if (newVal && newVal.length === 2) {
47
- this.dateRange = [
48
- newVal[0] ? dayjs(newVal[0]) : null,
49
- newVal[1] ? dayjs(newVal[1]) : null
50
- ]
51
- } else {
52
- this.dateRange = []
53
- }
54
- },
55
- immediate: true,
56
- deep: true
57
- }
58
- },
59
- methods: {
60
- handleDateChange (dates, dateStrings) {
61
- this.dateRange = dates
62
- console.warn(dateStrings)
63
- this.$emit('change', dateStrings)
64
- }
65
- }
66
- }
67
- </script>
68
-
69
- <style scoped>
70
- .x-time-select {
71
- position: relative;
72
- width: 100%;
73
- box-sizing: border-box;
74
- display: block;
75
- }
76
- .x-time-select :deep(.ant-picker-range),
77
- .x-time-select :deep(.ant-picker) {
78
- width: 100%;
79
- height: 30px;
80
- border-radius: 7px;
81
- background: #FFFFFF;
82
- border: 1px solid #E5E9F0;
83
- }
84
- .x-time-select :deep(.ant-calendar-picker) {
85
- width: 100%;
86
- display: block;
87
- }
88
- .x-time-select :deep(.ant-calendar-picker-input) {
89
- width: 100%;
90
- height: 30px;
91
- border-radius: 7px;
92
- background: #FFFFFF;
93
- border: 1px solid #E5E9F0;
94
- }
95
-
96
- .x-time-select :deep(.ant-input) {
97
- width: 100%;
98
- }
99
- </style>
1
+ <template>
2
+ <div class="x-time-select">
3
+ <a-range-picker
4
+ :value="dateRange"
5
+ :placeholder="['开始日期', '结束日期']"
6
+ separator="至"
7
+ :disabled="disabled"
8
+ :allowClear="allowClear"
9
+ :format="format"
10
+ @change="handleDateChange"
11
+ />
12
+ </div>
13
+ </template>
14
+
15
+ <script>
16
+ import moment from 'moment'
17
+
18
+ export default {
19
+ name: 'XTimeSelect',
20
+ props: {
21
+ value: {
22
+ type: Array,
23
+ default: () => []
24
+ },
25
+ disabled: {
26
+ type: Boolean,
27
+ default: false
28
+ },
29
+ allowClear: {
30
+ type: Boolean,
31
+ default: true
32
+ },
33
+ format: {
34
+ type: String,
35
+ default: 'YYYY/MM/DD'
36
+ }
37
+ },
38
+ data () {
39
+ return {
40
+ dateRange: []
41
+ }
42
+ },
43
+ watch: {
44
+ value: {
45
+ handler (newVal) {
46
+ if (newVal && newVal.length === 2) {
47
+ this.dateRange = [
48
+ newVal[0] ? moment(newVal[0]) : null,
49
+ newVal[1] ? moment(newVal[1]) : null
50
+ ]
51
+ } else {
52
+ this.dateRange = []
53
+ }
54
+ },
55
+ immediate: true,
56
+ deep: true
57
+ }
58
+ },
59
+ methods: {
60
+ handleDateChange (dates, dateStrings) {
61
+ this.dateRange = dates
62
+ console.warn(dateStrings)
63
+ this.$emit('change', dateStrings)
64
+ }
65
+ }
66
+ }
67
+ </script>
68
+
69
+ <style scoped>
70
+ .x-time-select {
71
+ position: relative;
72
+ width: 100%;
73
+ box-sizing: border-box;
74
+ display: block;
75
+ }
76
+ .x-time-select :deep(.ant-picker-range),
77
+ .x-time-select :deep(.ant-picker) {
78
+ width: 100%;
79
+ height: 30px;
80
+ border-radius: 7px;
81
+ background: #FFFFFF;
82
+ border: 1px solid #E5E9F0;
83
+ }
84
+ .x-time-select :deep(.ant-calendar-picker) {
85
+ width: 100%;
86
+ display: block;
87
+ }
88
+ .x-time-select :deep(.ant-calendar-picker-input) {
89
+ width: 100%;
90
+ height: 30px;
91
+ border-radius: 7px;
92
+ background: #FFFFFF;
93
+ border: 1px solid #E5E9F0;
94
+ }
95
+
96
+ .x-time-select :deep(.ant-input) {
97
+ width: 100%;
98
+ }
99
+ </style>
@@ -223,6 +223,9 @@ export default {
223
223
  })
224
224
  }
225
225
  },
226
+ setLocalDataSource (data) {
227
+ this.localDataSource = data
228
+ },
226
229
  initTotalList (columns) {
227
230
  const totalList = []
228
231
  columns && columns instanceof Array && columns.forEach(column => {
@@ -52,10 +52,10 @@ routerResource.newDynamicStatistics = () => import('@vue2-client/pages/NewDynami
52
52
  routerResource.example = {
53
53
  path: 'example',
54
54
  name: '示例主页面',
55
- component: () => import('@vue2-client/base-client/components/his/XTimeSelect/XTimeSelect.vue'),
55
+ // component: () => import('@vue2-client/base-client/components/his/XTimeSelect/XTimeSelect.vue'),
56
56
  // component: () => import('@vue2-client/base-client/components/his/XRadio/XRadio.vue'),
57
57
  // component: () => import('@vue2-client/base-client/components/his/XList/XList.vue'),
58
- // component: () => import('@vue2-client/base-client/components/common/XCollapse/XCollapse.vue'),
58
+ component: () => import('@vue2-client/base-client/components/common/XCollapse/XCollapse.vue'),
59
59
  // component: () => import('@vue2-client/base-client/components/common/XDataCard/XDataCard.vue'),
60
60
  // component: () => import('@vue2-client/base-client/components/common/XDescriptions/demo.vue'),
61
61
  // component: () => import('@vue2-client/base-client/components/common/XAddNativeForm/demo.vue'),