vue2-client 1.16.39 → 1.16.41

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.
@@ -1,166 +1,166 @@
1
- <template>
2
- <div>
3
- <a-row type="flex" justfy="space-around">
4
- <template v-for="(item, index) in config">
5
- <!-- 展示项 -->
6
- <a-col :key="'col' + index" :span="Math.floor(24 / config.length)">
7
- <div class="item">
8
- <!-- 标题 -->
9
- <p class="label">{{ item.label }}</p>
10
- <!-- 内容 - 进度条 -->
11
- <template v-if="item.type === 'percent'">
12
- <p class="value" :style="'color: ' + determineColor(data[item.key])">{{ data[item.key] }}%</p>
13
- </template>
14
- <!-- 内容 - 非进度条 -->
15
- <template v-else>
16
- <p class="value" :style="item.style ? item.style : ''">{{ data[item.key] }}</p>
17
- </template>
18
- </div>
19
- </a-col>
20
- <!-- 分割线 -->
21
- <a-col :key="'col' + index + 'after'" :span="1" v-if="index !== config.length - 1" class="divider-col">
22
- <a-divider type="vertical" class="divider"/>
23
- </a-col>
24
- </template>
25
- </a-row>
26
- </div>
27
- </template>
28
-
29
- <script>
30
-
31
- import { getConfigByName } from '@vue2-client/services/api/common'
32
-
33
- export default {
34
- name: 'XSimpleDescriptions',
35
- props: {
36
- // 配置
37
- dataConfig: {
38
- type: Array,
39
- default: undefined
40
- },
41
- // 数据
42
- dataContent: {
43
- type: Object,
44
- default: undefined
45
- },
46
- // 配置名
47
- dataConfigName: {
48
- type: String,
49
- default: undefined
50
- },
51
- // 服务名
52
- serviceName: {
53
- type: String,
54
- default: process.env.VUE_APP_SYSTEM_NAME
55
- }
56
- },
57
- data () {
58
- return {
59
- // 配置
60
- config: [],
61
- // 数据
62
- data: {},
63
- }
64
- },
65
- mounted () {
66
- // 初始化配置
67
- if (this.dataConfig) {
68
- this.config = this.dataConfig
69
- } else if (this.dataConfigName) {
70
- getConfigByName(this.dataConfigName, this.serviceName, (res) => {
71
- this.config = res.config
72
- })
73
- } else {
74
- this.config = [
75
- {
76
- label: '未能正确获取配置',
77
- key: 'totalUser'
78
- },
79
- {
80
- label: '未能正确获取配置',
81
- key: 'totalResidentArea'
82
- },
83
- {
84
- label: '未能正确获取配置',
85
- key: 'doneNum'
86
- },
87
- {
88
- label: '未能正确获取配置',
89
- key: 'todoNum'
90
- },
91
- {
92
- label: '未能正确获取配置',
93
- key: 'ratio',
94
- type: 'percent'
95
- }
96
- ]
97
- }
98
-
99
- // 初始化数据
100
- if (this.dataContent) {
101
- this.data = this.dataContent
102
- } else {
103
- this.data = {
104
- totalUser: 0,
105
- totalResidentArea: 0,
106
- doneNum: 0,
107
- todoNum: 0,
108
- ratio: 20
109
- }
110
- }
111
- },
112
- methods: {
113
- // 根据完成率决定颜色
114
- determineColor (ratio) {
115
- let result
116
- if (ratio >= 90) {
117
- result = 'rgb( 1,245, 38 )'
118
- } else if (ratio >= 75) {
119
- result = 'rgb( 139,245, 0)'
120
- } else if (ratio >= 40) {
121
- result = 'rgb(245,163, 0)'
122
- } else if (ratio >= 20) {
123
- result = 'rgb(244, 96, 0)'
124
- } else {
125
- result = 'rgb(255, 0, 0)'
126
- }
127
- return result
128
- }
129
- },
130
- watch: {
131
- dataContent: {
132
- handler (newValue) {
133
- this.data = newValue
134
- },
135
- deep: true
136
- }
137
- }
138
- }
139
- </script>
140
-
141
- <style lang="less" scoped>
142
- .item {
143
- padding: 5%;
144
-
145
- .label {
146
- color: rgba(117, 117, 117, 0.8);
147
- text-align: center;
148
- }
149
-
150
- .value {
151
- color: rgb( 51,157,255 );
152
- font-size: 1.6em;
153
- text-align: center;
154
- }
155
- }
156
-
157
- .divider-col {
158
- display: flex;
159
- justify-content: center;
160
-
161
- .divider {
162
- margin-top: 35%;
163
- height: 40px;
164
- }
165
- }
166
- </style>
1
+ <template>
2
+ <div>
3
+ <a-row type="flex" justfy="space-around">
4
+ <template v-for="(item, index) in config">
5
+ <!-- 展示项 -->
6
+ <a-col :key="'col' + index" :span="Math.floor(24 / config.length)">
7
+ <div class="item">
8
+ <!-- 标题 -->
9
+ <p class="label">{{ item.label }}</p>
10
+ <!-- 内容 - 进度条 -->
11
+ <template v-if="item.type === 'percent'">
12
+ <p class="value" :style="'color: ' + determineColor(data[item.key])">{{ data[item.key] }}%</p>
13
+ </template>
14
+ <!-- 内容 - 非进度条 -->
15
+ <template v-else>
16
+ <p class="value" :style="item.style ? item.style : ''">{{ data[item.key] }}</p>
17
+ </template>
18
+ </div>
19
+ </a-col>
20
+ <!-- 分割线 -->
21
+ <a-col :key="'col' + index + 'after'" :span="1" v-if="index !== config.length - 1" class="divider-col">
22
+ <a-divider type="vertical" class="divider"/>
23
+ </a-col>
24
+ </template>
25
+ </a-row>
26
+ </div>
27
+ </template>
28
+
29
+ <script>
30
+
31
+ import { getConfigByName } from '@vue2-client/services/api/common'
32
+
33
+ export default {
34
+ name: 'XSimpleDescriptions',
35
+ props: {
36
+ // 配置
37
+ dataConfig: {
38
+ type: Array,
39
+ default: undefined
40
+ },
41
+ // 数据
42
+ dataContent: {
43
+ type: Object,
44
+ default: undefined
45
+ },
46
+ // 配置名
47
+ dataConfigName: {
48
+ type: String,
49
+ default: undefined
50
+ },
51
+ // 服务名
52
+ serviceName: {
53
+ type: String,
54
+ default: process.env.VUE_APP_SYSTEM_NAME
55
+ }
56
+ },
57
+ data () {
58
+ return {
59
+ // 配置
60
+ config: [],
61
+ // 数据
62
+ data: {},
63
+ }
64
+ },
65
+ mounted () {
66
+ // 初始化配置
67
+ if (this.dataConfig) {
68
+ this.config = this.dataConfig
69
+ } else if (this.dataConfigName) {
70
+ getConfigByName(this.dataConfigName, this.serviceName, (res) => {
71
+ this.config = res.config
72
+ })
73
+ } else {
74
+ this.config = [
75
+ {
76
+ label: '未能正确获取配置',
77
+ key: 'totalUser'
78
+ },
79
+ {
80
+ label: '未能正确获取配置',
81
+ key: 'totalResidentArea'
82
+ },
83
+ {
84
+ label: '未能正确获取配置',
85
+ key: 'doneNum'
86
+ },
87
+ {
88
+ label: '未能正确获取配置',
89
+ key: 'todoNum'
90
+ },
91
+ {
92
+ label: '未能正确获取配置',
93
+ key: 'ratio',
94
+ type: 'percent'
95
+ }
96
+ ]
97
+ }
98
+
99
+ // 初始化数据
100
+ if (this.dataContent) {
101
+ this.data = this.dataContent
102
+ } else {
103
+ this.data = {
104
+ totalUser: 0,
105
+ totalResidentArea: 0,
106
+ doneNum: 0,
107
+ todoNum: 0,
108
+ ratio: 20
109
+ }
110
+ }
111
+ },
112
+ methods: {
113
+ // 根据完成率决定颜色
114
+ determineColor (ratio) {
115
+ let result
116
+ if (ratio >= 90) {
117
+ result = 'rgb( 1,245, 38 )'
118
+ } else if (ratio >= 75) {
119
+ result = 'rgb( 139,245, 0)'
120
+ } else if (ratio >= 40) {
121
+ result = 'rgb(245,163, 0)'
122
+ } else if (ratio >= 20) {
123
+ result = 'rgb(244, 96, 0)'
124
+ } else {
125
+ result = 'rgb(255, 0, 0)'
126
+ }
127
+ return result
128
+ }
129
+ },
130
+ watch: {
131
+ dataContent: {
132
+ handler (newValue) {
133
+ this.data = newValue
134
+ },
135
+ deep: true
136
+ }
137
+ }
138
+ }
139
+ </script>
140
+
141
+ <style lang="less" scoped>
142
+ .item {
143
+ padding: 5%;
144
+
145
+ .label {
146
+ color: rgba(117, 117, 117, 0.8);
147
+ text-align: center;
148
+ }
149
+
150
+ .value {
151
+ color: rgb( 51,157,255 );
152
+ font-size: 1.6em;
153
+ text-align: center;
154
+ }
155
+ }
156
+
157
+ .divider-col {
158
+ display: flex;
159
+ justify-content: center;
160
+
161
+ .divider {
162
+ margin-top: 35%;
163
+ height: 40px;
164
+ }
165
+ }
166
+ </style>
@@ -22,11 +22,10 @@
22
22
  <template v-if="data">
23
23
  <!-- 显示前N个标签 -->
24
24
  <a-descriptions-item
25
- v-for="(item) in visibleItems"
25
+ v-for="(item) in visibleItemsFiltered"
26
26
  :key="item.field"
27
27
  :colon="item.colon !== false"
28
- :class="{ 'with-divider': item.isLine }"
29
- v-if="data[item.field] !== null && data[item.field] !== undefined && (!showAllItems || showAllItems && !hiddenItems.some(i => i.field === item.field))">
28
+ :class="{ 'with-divider': item.isLine }">
30
29
  <template #label>
31
30
  <div :class="['label-wrapper', { 'with-avatar': item.showAvatar }]">
32
31
  <a-avatar
@@ -46,10 +45,9 @@
46
45
  <!-- 展开后显示剩余标签 -->
47
46
  <template v-if="showAllItems">
48
47
  <a-descriptions-item
49
- v-for="item in hiddenItems"
48
+ v-for="item in hiddenItemsFiltered"
50
49
  :key="item.field"
51
- :colon="item.colon !== false"
52
- v-if="data[item.field] !== null && data[item.field] !== undefined">
50
+ :colon="item.colon !== false">
53
51
  <template #label>
54
52
  <div :class="['label-wrapper', { 'with-avatar': item.showAvatar }]">
55
53
  <a-avatar
@@ -76,10 +74,9 @@
76
74
  <template v-if="data">
77
75
  <!-- 显示可见的标签 -->
78
76
  <div
79
- v-for="(item) in visibleItems"
77
+ v-for="(item) in visibleItemsFiltered"
80
78
  :key="item.field"
81
79
  :class="['description-item', { 'with-divider': item.isLine }]"
82
- v-if="data[item.field] !== null && data[item.field] !== undefined"
83
80
  >
84
81
  <div :class="['label-wrapper', { 'with-avatar': item.showAvatar }]">
85
82
  <a-avatar
@@ -98,10 +95,9 @@
98
95
  <!-- 展开后显示的内容 -->
99
96
  <template v-if="showAllItems">
100
97
  <div
101
- v-for="item in hiddenItems"
98
+ v-for="item in hiddenItemsFiltered"
102
99
  :key="item.field"
103
100
  class="description-item"
104
- v-if="data[item.field] !== null && data[item.field] !== undefined"
105
101
  >
106
102
  <div :class="['label-wrapper', { 'with-avatar': item.showAvatar }]">
107
103
  <a-avatar
@@ -157,9 +153,6 @@ export default {
157
153
  const classes = {}
158
154
 
159
155
  const booleanStyleKeys = [
160
- 'query-conditions',
161
- 'padding-50',
162
- 'label-text-horizontal',
163
156
  'description'
164
157
  ]
165
158
  booleanStyleKeys.forEach(key => {
@@ -201,6 +194,21 @@ export default {
201
194
  if (!(this.config && this.config.items)) return []
202
195
  if (!(this.config && this.config.detailsConfig)) return []
203
196
  return this.config.items.slice(this.detailsAfterIndex)
197
+ },
198
+ // 过滤后可直接渲染的可见项
199
+ visibleItemsFiltered () {
200
+ const list = this.visibleItems || []
201
+ if (!this.data) return []
202
+ const res = list.filter(item => this.data[item.field] !== null && this.data[item.field] !== undefined)
203
+ if (!this.showAllItems) return res
204
+ const hiddenFields = new Set((this.hiddenItems || []).map(i => i.field))
205
+ return res.filter(item => !hiddenFields.has(item.field))
206
+ },
207
+ // 过滤后可直接渲染的隐藏项(仅展开时使用)
208
+ hiddenItemsFiltered () {
209
+ const list = this.hiddenItems || []
210
+ if (!this.data) return []
211
+ return list.filter(item => this.data[item.field] !== null && this.data[item.field] !== undefined)
204
212
  }
205
213
  },
206
214
  created () {
@@ -250,7 +258,7 @@ export default {
250
258
  }
251
259
  </script>
252
260
 
253
- <style scoped>
261
+ <style scoped lang="less">
254
262
  .patient-info-descriptions {
255
263
  background: #fff;
256
264
  padding: 12px;