vue2-client 1.16.21 → 1.16.23
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
CHANGED
@@ -1,164 +1,192 @@
|
|
1
|
-
<template>
|
2
|
-
<div class="x-time-select">
|
3
|
-
<div class="time-select-container">
|
4
|
-
<
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
:
|
10
|
-
|
11
|
-
:
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
:
|
20
|
-
:
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
}
|
125
|
-
|
126
|
-
.
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
.
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
.
|
138
|
-
|
139
|
-
}
|
140
|
-
|
141
|
-
.
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
}
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
.x-time-select
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
}
|
164
|
-
|
1
|
+
<template>
|
2
|
+
<div class="x-time-select">
|
3
|
+
<div class="time-select-container">
|
4
|
+
<div v-if="type === 'range'" class="picker-wrapper">
|
5
|
+
<a-range-picker
|
6
|
+
:value="dateRange"
|
7
|
+
:placeholder="['开始日期', '结束日期']"
|
8
|
+
separator="至"
|
9
|
+
:disabled="disabled"
|
10
|
+
:allowClear="allowClear"
|
11
|
+
:format="format"
|
12
|
+
@change="handleDateChange"
|
13
|
+
/>
|
14
|
+
</div>
|
15
|
+
<div v-if="type === 'date'" class="picker-wrapper">
|
16
|
+
<a-date-picker
|
17
|
+
:value="dateRange[0]"
|
18
|
+
:format="format"
|
19
|
+
:disabled="disabled"
|
20
|
+
:allowClear="allowClear"
|
21
|
+
@change="handleDateChange"
|
22
|
+
/>
|
23
|
+
</div>
|
24
|
+
|
25
|
+
</div>
|
26
|
+
</div>
|
27
|
+
</template>
|
28
|
+
|
29
|
+
<script>
|
30
|
+
import moment from 'moment'
|
31
|
+
import { getConfigByName } from '@vue2-client/services/api/common'
|
32
|
+
|
33
|
+
export default {
|
34
|
+
name: 'XTimeSelect',
|
35
|
+
inject: ['getComponentByName'],
|
36
|
+
props: {
|
37
|
+
queryParamsName: {
|
38
|
+
type: String,
|
39
|
+
default: null
|
40
|
+
},
|
41
|
+
value: {
|
42
|
+
type: Array,
|
43
|
+
default: () => []
|
44
|
+
},
|
45
|
+
defaultTime: {
|
46
|
+
type: Array,
|
47
|
+
default: () => []
|
48
|
+
},
|
49
|
+
disabled: {
|
50
|
+
type: Boolean,
|
51
|
+
default: false
|
52
|
+
},
|
53
|
+
allowClear: {
|
54
|
+
type: Boolean,
|
55
|
+
default: true
|
56
|
+
},
|
57
|
+
format: {
|
58
|
+
type: String,
|
59
|
+
default: 'YYYY/MM/DD'
|
60
|
+
}
|
61
|
+
},
|
62
|
+
data () {
|
63
|
+
return {
|
64
|
+
dateRange: [],
|
65
|
+
type: 'range'
|
66
|
+
}
|
67
|
+
},
|
68
|
+
watch: {
|
69
|
+
value: {
|
70
|
+
handler (newVal) {
|
71
|
+
this.convertValueToMoment(newVal)
|
72
|
+
},
|
73
|
+
immediate: true,
|
74
|
+
deep: true
|
75
|
+
},
|
76
|
+
defaultTime: {
|
77
|
+
handler (newVal) {
|
78
|
+
// 只有在没有传入value时才使用defaultTime
|
79
|
+
if (!this.value || this.value.length === 0) {
|
80
|
+
this.convertValueToMoment(newVal)
|
81
|
+
}
|
82
|
+
},
|
83
|
+
immediate: true,
|
84
|
+
deep: true
|
85
|
+
},
|
86
|
+
type () {
|
87
|
+
this.convertValueToMoment(this.value)
|
88
|
+
}
|
89
|
+
|
90
|
+
},
|
91
|
+
created () {
|
92
|
+
this.getData(this.queryParamsName)
|
93
|
+
},
|
94
|
+
methods: {
|
95
|
+
convertValueToMoment (value) {
|
96
|
+
// 如果没有传入value或value为空,则使用defaultTime
|
97
|
+
const timeToUse = (value && value.length > 0) ? value : this.defaultTime
|
98
|
+
if (this.type === 'range' && timeToUse?.length === 2) {
|
99
|
+
this.dateRange = [
|
100
|
+
timeToUse[0] ? moment(timeToUse[0]) : null,
|
101
|
+
timeToUse[1] ? moment(timeToUse[1]) : null
|
102
|
+
]
|
103
|
+
} else if (this.type === 'date' && timeToUse?.length === 1) {
|
104
|
+
this.dateRange = [timeToUse[0] ? moment(timeToUse[0]) : null]
|
105
|
+
} else {
|
106
|
+
this.dateRange = []
|
107
|
+
}
|
108
|
+
},
|
109
|
+
handleDateChange (dates, dateStrings) {
|
110
|
+
if (this.type === 'date') {
|
111
|
+
// 单个日期选择器,dates是一个moment对象或null
|
112
|
+
this.dateRange = [dates]
|
113
|
+
} else {
|
114
|
+
// 范围选择器,dates是一个数组
|
115
|
+
this.dateRange = dates
|
116
|
+
}
|
117
|
+
this.$emit('change', dateStrings)
|
118
|
+
},
|
119
|
+
async getData (data) {
|
120
|
+
if (data) {
|
121
|
+
getConfigByName(data, 'af-his', res => {
|
122
|
+
if (['date', 'range'].includes(res.type)) {
|
123
|
+
this.type = res.type
|
124
|
+
}
|
125
|
+
// 处理format配置
|
126
|
+
if (res.format !== undefined) {
|
127
|
+
this.format = res.format
|
128
|
+
}
|
129
|
+
// 处理defaultTime配置
|
130
|
+
if (res.defaultTime !== undefined) {
|
131
|
+
if (res.defaultTime === 'now') {
|
132
|
+
// 如果配置为'now',设置当前时间
|
133
|
+
const now = moment().format(this.format)
|
134
|
+
if (this.type === 'range') {
|
135
|
+
this.defaultTime = [now, now]
|
136
|
+
} else if (this.type === 'date') {
|
137
|
+
this.defaultTime = [now]
|
138
|
+
}
|
139
|
+
} else if (Array.isArray(res.defaultTime)) {
|
140
|
+
// 如果配置为数组,直接使用
|
141
|
+
this.defaultTime = res.defaultTime
|
142
|
+
}
|
143
|
+
}
|
144
|
+
this.convertValueToMoment(this.value)
|
145
|
+
})
|
146
|
+
}
|
147
|
+
}
|
148
|
+
}
|
149
|
+
}
|
150
|
+
</script>
|
151
|
+
|
152
|
+
<style scoped>
|
153
|
+
.x-time-select {
|
154
|
+
position: relative;
|
155
|
+
width: 100%;
|
156
|
+
box-sizing: border-box;
|
157
|
+
display: block;
|
158
|
+
}
|
159
|
+
|
160
|
+
.time-select-container {
|
161
|
+
display: flex;
|
162
|
+
align-items: center;
|
163
|
+
}
|
164
|
+
|
165
|
+
.picker-wrapper {
|
166
|
+
flex: 1;
|
167
|
+
}
|
168
|
+
|
169
|
+
.x-time-select :deep(.ant-picker-range),
|
170
|
+
.x-time-select :deep(.ant-picker) {
|
171
|
+
width: 100%;
|
172
|
+
height: 30px;
|
173
|
+
border-radius: 7px;
|
174
|
+
background: #FFFFFF;
|
175
|
+
border: 1px solid #E5E9F0;
|
176
|
+
}
|
177
|
+
.x-time-select :deep(.ant-calendar-picker) {
|
178
|
+
width: 100%;
|
179
|
+
display: block;
|
180
|
+
}
|
181
|
+
.x-time-select :deep(.ant-calendar-picker-input) {
|
182
|
+
width: 100%;
|
183
|
+
height: 30px;
|
184
|
+
border-radius: 7px;
|
185
|
+
background: #FFFFFF;
|
186
|
+
border: 1px solid #E5E9F0;
|
187
|
+
}
|
188
|
+
|
189
|
+
.x-time-select :deep(.ant-input) {
|
190
|
+
width: 100%;
|
191
|
+
}
|
192
|
+
</style>
|
@@ -2,7 +2,8 @@
|
|
2
2
|
<!-- <Source src="/code/VitalSigns.vue"></Source>-->
|
3
3
|
<div>
|
4
4
|
<a-row class="box">
|
5
|
-
|
5
|
+
<!-- 病历号输入框已隐藏,通过setMedicalRecordId方法设置vitalSignsId -->
|
6
|
+
<!-- 病历号 <a-input v-model="vitalSignsId" style="width: 160px"></a-input> -->
|
6
7
|
<a-button-group style="margin-left: 20px;">
|
7
8
|
<a-button
|
8
9
|
v-if="showCreateButton"
|
@@ -400,7 +401,7 @@ function mergeAndTransformData (records, patientInfo, id, date, operateDate) {
|
|
400
401
|
// 设置病历号的方法
|
401
402
|
function setMedicalRecordId (id) {
|
402
403
|
vitalSignsId.value = id
|
403
|
-
console.log('病历号已设置为:', vitalSignsId.value)
|
404
|
+
// console.log('病历号已设置为:', vitalSignsId.value)
|
404
405
|
}
|
405
406
|
// 生命周期钩子
|
406
407
|
onMounted(() => {
|