vue2-client 1.19.70 → 1.19.71

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,6 +1,6 @@
1
1
  {
2
2
  "name": "vue2-client",
3
- "version": "1.19.70",
3
+ "version": "1.19.71",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
@@ -1,174 +1,174 @@
1
- <template>
2
- <div class="row">
3
- <div class="content">
4
- <a-skeleton :loading="loading" :paragraph="{ rows: 4 }" />
5
- <div v-show="!loading">
6
- <template v-if="!loadError">
7
- <a-descriptions v-if="realData" :column="isMobile ? 1 : column" size="small" :title="title">
8
- <a-descriptions-item
9
- v-for="(value, key) in realData"
10
- :key="key"
11
- :label="key">
12
- {{ formatText(value) }}
13
- </a-descriptions-item>
14
- </a-descriptions>
15
- </template>
16
- <template v-else>
17
- <a-empty>
18
- <span slot="description"> 页面配置不存在,请联系系统管理员 </span>
19
- </a-empty>
20
- </template>
21
- </div>
22
- </div>
23
- <div class="extra" v-if="extraShow">
24
- <slot name="addonAfter"/>
25
- </div>
26
- </div>
27
- </template>
28
- <script>
29
-
30
- import { mapState } from 'vuex'
31
- import { getRealKeyData } from '@vue2-client/utils/formatter'
32
- import { getConfigByName } from '@vue2-client/services/api/common'
33
-
34
- export default {
35
- name: 'XDescriptions',
36
- components: {
37
- },
38
- props: {
39
- // 标题
40
- title: {
41
- type: String,
42
- required: true
43
- },
44
- // 内容
45
- content: {
46
- type: Object,
47
- required: true
48
- },
49
- // 模型名
50
- model: {
51
- type: String,
52
- required: false,
53
- default: ''
54
- },
55
- // 配置名称
56
- configName: {
57
- type: String,
58
- required: true
59
- },
60
- // 配置所属命名空间
61
- serviceName: {
62
- type: String,
63
- default: undefined
64
- },
65
- env: {
66
- type: String,
67
- default: 'prod'
68
- },
69
- // 每列显示数量
70
- column: {
71
- type: Number,
72
- default: 2
73
- },
74
- // 每列显示数量
75
- getRealData: {
76
- type: Boolean,
77
- default: false
78
- },
79
- // 是否展示插槽
80
- extraShow: {
81
- type: Boolean,
82
- default: true
83
- }
84
- },
85
- created () {
86
- this.initConfig()
87
- },
88
- data () {
89
- return {
90
- // 加载状态
91
- loading: false,
92
- loadError: false,
93
- realData: undefined
94
- }
95
- },
96
- computed: {
97
- ...mapState('setting', { isMobile: 'isMobile' })
98
- },
99
- methods: {
100
- initConfig () {
101
- this.loading = true
102
- this.loadError = false
103
- if (this.configName) {
104
- this.getConfig()
105
- } else {
106
- this.loading = false
107
- this.loadError = true
108
- }
109
- },
110
- getConfig () {
111
- getConfigByName(this.configName, this.serviceName, (res) => {
112
- const mapIndex = {}
113
- const result = {}
114
- if (res.formJson) {
115
- res.formJson.filter(item => {
116
- const model = item.model
117
- return model.indexOf(this.model) > 0
118
- })[0].groupItems.forEach(item => {
119
- mapIndex[item.model.substring(item.model.indexOf('_') + 1)] = item.name
120
- })
121
- for (const key of Object.keys(this.content)) {
122
- const name = mapIndex[key]
123
- if (name) {
124
- result[name] = this.content[key]
125
- } else {
126
- result[key] = this.content[key]
127
- }
128
- }
129
- } else if (res.column) {
130
- // [{label:'标签1',filed:'字段1'}]
131
- let content = {}
132
- if (this.getRealData) {
133
- content = getRealKeyData(this.content)
134
- } else {
135
- content = this.content
136
- }
137
- if (typeof content === 'string') {
138
- content = JSON.parse(content)
139
- }
140
- res.column.forEach(item => {
141
- result[item.label] = content[item.filed]
142
- })
143
- }
144
- this.realData = result
145
- this.loading = false
146
- }, this.env === 'dev')
147
- },
148
- // 文字格式化
149
- formatText (value) {
150
- return value ?? '--'
151
- }
152
- }
153
- }
154
- </script>
155
- <style>
156
- .row {
157
- display: flex;
158
-
159
- .content {
160
- -webkit-box-flex: 1;
161
- flex: auto;
162
- -ms-flex: auto;
163
- }
164
-
165
- .extra {
166
- flex: 0 1 auto;
167
- -webkit-box-flex: 0;
168
- -ms-flex: 0 1 auto;
169
- min-width: 242px;
170
- margin-left: 88px;
171
- text-align: right;
172
- }
173
- }
174
- </style>
1
+ <template>
2
+ <div class="row">
3
+ <div class="content">
4
+ <a-skeleton :loading="loading" :paragraph="{ rows: 4 }" />
5
+ <div v-show="!loading">
6
+ <template v-if="!loadError">
7
+ <a-descriptions v-if="realData" :column="isMobile ? 1 : column" size="small" :title="title">
8
+ <a-descriptions-item
9
+ v-for="(value, key) in realData"
10
+ :key="key"
11
+ :label="key">
12
+ {{ formatText(value) }}
13
+ </a-descriptions-item>
14
+ </a-descriptions>
15
+ </template>
16
+ <template v-else>
17
+ <a-empty>
18
+ <span slot="description"> 页面配置不存在,请联系系统管理员 </span>
19
+ </a-empty>
20
+ </template>
21
+ </div>
22
+ </div>
23
+ <div class="extra" v-if="extraShow">
24
+ <slot name="addonAfter"/>
25
+ </div>
26
+ </div>
27
+ </template>
28
+ <script>
29
+
30
+ import { mapState } from 'vuex'
31
+ import { getRealKeyData } from '@vue2-client/utils/formatter'
32
+ import { getConfigByName } from '@vue2-client/services/api/common'
33
+
34
+ export default {
35
+ name: 'XDescriptions',
36
+ components: {
37
+ },
38
+ props: {
39
+ // 标题
40
+ title: {
41
+ type: String,
42
+ required: true
43
+ },
44
+ // 内容
45
+ content: {
46
+ type: Object,
47
+ required: true
48
+ },
49
+ // 模型名
50
+ model: {
51
+ type: String,
52
+ required: false,
53
+ default: ''
54
+ },
55
+ // 配置名称
56
+ configName: {
57
+ type: String,
58
+ required: true
59
+ },
60
+ // 配置所属命名空间
61
+ serviceName: {
62
+ type: String,
63
+ default: undefined
64
+ },
65
+ env: {
66
+ type: String,
67
+ default: 'prod'
68
+ },
69
+ // 每列显示数量
70
+ column: {
71
+ type: Number,
72
+ default: 2
73
+ },
74
+ // 每列显示数量
75
+ getRealData: {
76
+ type: Boolean,
77
+ default: false
78
+ },
79
+ // 是否展示插槽
80
+ extraShow: {
81
+ type: Boolean,
82
+ default: true
83
+ }
84
+ },
85
+ created () {
86
+ this.initConfig()
87
+ },
88
+ data () {
89
+ return {
90
+ // 加载状态
91
+ loading: false,
92
+ loadError: false,
93
+ realData: undefined
94
+ }
95
+ },
96
+ computed: {
97
+ ...mapState('setting', { isMobile: 'isMobile' })
98
+ },
99
+ methods: {
100
+ initConfig () {
101
+ this.loading = true
102
+ this.loadError = false
103
+ if (this.configName) {
104
+ this.getConfig()
105
+ } else {
106
+ this.loading = false
107
+ this.loadError = true
108
+ }
109
+ },
110
+ getConfig () {
111
+ getConfigByName(this.configName, this.serviceName, (res) => {
112
+ const mapIndex = {}
113
+ const result = {}
114
+ if (res.formJson) {
115
+ res.formJson.filter(item => {
116
+ const model = item.model
117
+ return model.indexOf(this.model) > 0
118
+ })[0].groupItems.forEach(item => {
119
+ mapIndex[item.model.substring(item.model.indexOf('_') + 1)] = item.name
120
+ })
121
+ for (const key of Object.keys(this.content)) {
122
+ const name = mapIndex[key]
123
+ if (name) {
124
+ result[name] = this.content[key]
125
+ } else {
126
+ result[key] = this.content[key]
127
+ }
128
+ }
129
+ } else if (res.column) {
130
+ // [{label:'标签1',filed:'字段1'}]
131
+ let content = {}
132
+ if (this.getRealData) {
133
+ content = getRealKeyData(this.content)
134
+ } else {
135
+ content = this.content
136
+ }
137
+ if (typeof content === 'string') {
138
+ content = JSON.parse(content)
139
+ }
140
+ res.column.forEach(item => {
141
+ result[item.label] = content[item.filed]
142
+ })
143
+ }
144
+ this.realData = result
145
+ this.loading = false
146
+ }, this.env === 'dev')
147
+ },
148
+ // 文字格式化
149
+ formatText (value) {
150
+ return value ?? '--'
151
+ }
152
+ }
153
+ }
154
+ </script>
155
+ <style>
156
+ .row {
157
+ display: flex;
158
+
159
+ .content {
160
+ -webkit-box-flex: 1;
161
+ flex: auto;
162
+ -ms-flex: auto;
163
+ }
164
+
165
+ .extra {
166
+ flex: 0 1 auto;
167
+ -webkit-box-flex: 0;
168
+ -ms-flex: 0 1 auto;
169
+ min-width: 242px;
170
+ margin-left: 88px;
171
+ text-align: right;
172
+ }
173
+ }
174
+ </style>
@@ -50,7 +50,19 @@
50
50
  <span v-if="isFieldRequired(item, data)" style="color: red">*</span>
51
51
  </template>
52
52
  <span :style="getFieldStyle(item, data)">
53
- {{ formatFieldValue(item.value, item, data) || '--' }}
53
+ <!-- 超链接样式兼容 -->
54
+ <template v-if="item.isLink">
55
+ <span role="link"
56
+ tabindex="0"
57
+ class="link-text"
58
+ @click="handleLinkClick(item, data, $event)"
59
+ @keyup.enter="handleLinkClick(item, data, $event)">
60
+ {{ formatFieldValue(item.value, item, data) || '--' }}
61
+ </span>
62
+ </template>
63
+ <template v-else>
64
+ {{ formatFieldValue(item.value, item, data) || '--' }}
65
+ </template>
54
66
  <a-button
55
67
  v-if="item.canEdit"
56
68
  type="link"
@@ -111,7 +123,20 @@
111
123
  <span v-if="isFieldRequired(fieldItem, data)" style="color: red">*</span>
112
124
  </template>
113
125
  <span :style="getFieldStyle(fieldItem, fieldItem.value, data)">
114
- {{ formatFieldValue(fieldItem.value, fieldItem, data) || '--' }}
126
+ <!-- 超链接样式兼容 - 修复变量引用错误 -->
127
+ <template v-if="fieldItem.isLink">
128
+ <span role="link"
129
+ tabindex="0"
130
+ class="link-text"
131
+ @click="handleLinkClick(fieldItem, data, $event)"
132
+ @keyup.enter="handleLinkClick(fieldItem, data, $event)"
133
+ >
134
+ {{ formatFieldValue(fieldItem.value, fieldItem, data) || '--' }}
135
+ </span>
136
+ </template>
137
+ <template v-else>
138
+ {{ formatFieldValue(fieldItem.value, fieldItem, data) || '--' }}
139
+ </template>
115
140
  <a-button
116
141
  v-if="fieldItem.canEdit"
117
142
  type="link"
@@ -168,7 +193,19 @@
168
193
  <span v-if="isFieldRequired(item, data)" style="color: red">*</span>
169
194
  </template>
170
195
  <span :style="getFieldStyle(item, item.value, data)">
171
- {{ formatFieldValue(item.value, item, data) || '--' }}
196
+ <template v-if="item.isLink">
197
+ <span role="link"
198
+ tabindex="0"
199
+ class="link-text"
200
+ @click="handleLinkClick(item, data, $event)"
201
+ @keyup.enter="handleLinkClick(item, data, $event)"
202
+ >
203
+ {{ formatFieldValue(item.value, item, data) || '--' }}
204
+ </span>
205
+ </template>
206
+ <template v-else>
207
+ {{ formatFieldValue(item.value, item, data) || '--' }}
208
+ </template>
172
209
  <a-button
173
210
  v-if="item.canEdit"
174
211
  type="link"
@@ -308,7 +345,8 @@ export default {
308
345
  styleFunc: field.styleFunc,
309
346
  formatFunc: field.formatFunc,
310
347
  requireFunc: field.requireFunc,
311
- canEdit: field.canEdit === true
348
+ canEdit: field.canEdit === true,
349
+ isLink: field.isLink === true
312
350
  }))
313
351
  }
314
352
 
@@ -405,6 +443,9 @@ export default {
405
443
  styleFunc: typeof fieldValue === 'object' ? fieldValue.styleFunc : undefined,
406
444
  formatFunc: typeof fieldValue === 'object' ? fieldValue.formatFunc : undefined,
407
445
  requireFunc: typeof fieldValue === 'object' ? fieldValue.requireFunc : undefined,
446
+ canEdit: typeof fieldValue === 'object' ? fieldValue.canEdit : undefined,
447
+ // 新增超链接配置
448
+ isLink: typeof fieldValue === 'object' ? fieldValue.isLink : undefined,
408
449
  ...(typeof fieldValue === 'object' ? fieldValue : {})
409
450
  }))
410
451
  }
@@ -436,6 +477,7 @@ export default {
436
477
  },
437
478
  // 格式化字段值
438
479
  formatFieldValue(value, field, data) {
480
+ console.log('formatFieldValue', value, field, data)
439
481
  if (!field.formatFunc) return value
440
482
  try {
441
483
  return executeStrFunctionByContext(this, field.formatFunc, [data, field.key])
@@ -469,6 +511,16 @@ export default {
469
511
  data: this.data
470
512
  })
471
513
  },
514
+ // 处理超链接点击
515
+ handleLinkClick(field, data, event) {
516
+ event.stopPropagation()
517
+ // 向父组件抛出事件
518
+ this.$emit('link-click', {
519
+ field,
520
+ value: field.value,
521
+ data: this.data
522
+ })
523
+ },
472
524
  onScroll() {
473
525
  // 只在 left 模式启用滚动联动
474
526
  if (this.tabMode !== 'left') return
@@ -550,6 +602,22 @@ export default {
550
602
  overflow-y: scroll;
551
603
  }
552
604
 
605
+ .link-text {
606
+ color: @primary-color;
607
+ text-decoration: none;
608
+ cursor: pointer;
609
+ outline: none;
610
+
611
+ &:hover {
612
+ text-decoration: underline;
613
+ }
614
+
615
+ &:focus {
616
+ text-decoration: underline;
617
+ box-shadow: 0 0 0 2px fade(@primary-color, 20%);
618
+ }
619
+ }
620
+
553
621
  // top 模式样式
554
622
  .tab-content-scroll {
555
623
  overflow-y: auto;