vue2-client 1.14.11 → 1.14.13

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.14.11",
3
+ "version": "1.14.13",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
@@ -100,6 +100,7 @@
100
100
  :dropdownStyle="{ position: 'absolute'}"
101
101
  :placeholder="attr.placeholder ? attr.placeholder : '请选择'"
102
102
  show-search
103
+ :allowClear="true"
103
104
  >
104
105
  <a-select-option
105
106
  v-if="mode === '查询'"
@@ -85,6 +85,7 @@
85
85
  </a-modal></div>
86
86
  </template>
87
87
 
88
+
88
89
  <script>
89
90
 
90
91
  import { runLogic } from '@vue2-client/services/api/common'
@@ -132,14 +132,14 @@ export default {
132
132
  currentCol = currentCol.parentNode
133
133
  }
134
134
  if (currentCol) {
135
- // 更新当前列的宽度
135
+ // 更新当前列的宽度
136
136
  const drawerWidth = isOpen ? 33.3 : 2
137
137
  // 强制更新样式
138
138
  currentCol.style.cssText = `
139
139
  flex: 0 0 ${drawerWidth}% !important;
140
140
  max-width: ${drawerWidth}% !important;
141
141
  transition: all 0.3s;`
142
- // 触发XTab组件重新计算宽度
142
+ // 触发XTab组件重新计算宽度
143
143
  this.$nextTick(() => {
144
144
  const tabComponent = this.$el.querySelector('.ant-tabs')
145
145
  if (tabComponent) {
@@ -147,7 +147,7 @@ export default {
147
147
  window.dispatchEvent(new Event('resize'))
148
148
  }
149
149
  })
150
- // 更新其他列宽度
150
+ // 更新其他列宽度
151
151
  otherCols.forEach((col, index) => {
152
152
  if (index < this.mainWithData.length) {
153
153
  const widthValue = isOpen ? this.mainWithData[index].min : this.mainWithData[index].max
@@ -0,0 +1,113 @@
1
+ # XTitle 组件
2
+
3
+ ## 概述
4
+
5
+ XTitle 是一个多功能的标题组件,可以显示标题文本或按钮,支持自定义下划线样式、颜色和宽度。
6
+
7
+ ## 功能特点
8
+
9
+ - 支持显示标题或按钮
10
+ - 支持为标题添加下划线
11
+ - 支持自定义下划线颜色
12
+ - 支持自定义宽度
13
+ - 支持点击事件触发
14
+
15
+ ## 使用方法
16
+
17
+ ### 基本用法
18
+
19
+ ```vue
20
+ <x-title query-params-name="我的标题-title"></x-title>
21
+ ```
22
+
23
+ ### 配置参数格式
24
+
25
+ XTitle 组件通过一个字符串参数进行配置
26
+
27
+ 各部分说明:
28
+
29
+ 1. `标题文本`: 显示的文本内容
30
+ 2. `类型`: 可选值为 `title` 或 `button`
31
+ 3. `点击事件名`: 点击时触发的事件名称
32
+ 4. `线条`: 设置为 `line` 时显示下划线
33
+ 5. `颜色`: 下划线的颜色(如 `red`、`#FF0000`)
34
+ 6. `宽度`: 组件宽度,单位为像素(如 `800`)
35
+
36
+ ## 使用示例
37
+
38
+ ### 1. 基本标题
39
+
40
+ ```vue
41
+ <x-title query-params-name="患者信息-title"></x-title>
42
+ ```
43
+
44
+ ### 2. 带下划线的标题
45
+
46
+ ```vue
47
+ <x-title query-params-name="患者信息-title--line"></x-title>
48
+ ```
49
+
50
+ ### 3. 自定义下划线颜色和宽度
51
+
52
+ ```vue
53
+ <x-title query-params-name="患者信息-title--line-red-800"></x-title>
54
+ ```
55
+
56
+ ### 4. 带点击事件的标题
57
+
58
+ ```vue
59
+ <x-title query-params-name="患者信息-title-showPatient-line" @showPatient="handleShowPatient"></x-title>
60
+ ```
61
+
62
+ ### 5. 按钮模式
63
+
64
+ ```vue
65
+ <x-title query-params-name="提交-button-submit" @submit="handleSubmit"></x-title>
66
+ ```
67
+
68
+ ## 事件
69
+
70
+ 当组件类型为 `button` 或在标题配置中设置了点击事件名时,点击组件会触发相应的事件。
71
+
72
+ ```vue
73
+ <template>
74
+ <x-title query-params-name="提交-button-submit" @submit="handleSubmit"></x-title>
75
+ </template>
76
+
77
+ <script>
78
+ export default {
79
+ methods: {
80
+ handleSubmit() {
81
+ // 处理提交逻辑
82
+ console.log('提交按钮被点击');
83
+ }
84
+ }
85
+ }
86
+ </script>
87
+ ```
88
+
89
+ ## 样式自定义
90
+
91
+ 组件内部样式已预设,但可以通过父级样式或特定类名进行覆盖:
92
+
93
+ ```vue
94
+ <template>
95
+ <div class="custom-container">
96
+ <x-title query-params-name="自定义标题-title"></x-title>
97
+ </div>
98
+ </template>
99
+
100
+ <style scoped>
101
+ .custom-container :deep(.x-title) {
102
+ font-size: 20px;
103
+ color: blue;
104
+ }
105
+ </style>
106
+ ```
107
+
108
+ ## 注意事项
109
+
110
+ 1. 当未指定类型时,默认为 `title` 类型
111
+ 2. 线条颜色需要是合法的 CSS 颜色值
112
+ 3. 宽度值必须是数字,单位为像素
113
+ 4. 组件默认宽度为 100%,设置自定义宽度时会覆盖此值
@@ -1,62 +1,180 @@
1
1
  <template>
2
- <div class="x-title" :class="{ 'with-underline': hasUnderline, 'only-line': isOnlyLine }">
3
- <span v-show="!isOnlyLine">{{ processedTitle }}</span>
2
+ <div class="x-title-container">
3
+ <div
4
+ v-if="config.type === 'title'"
5
+ class="x-title"
6
+ :class="{ 'with-underline': config.line === 'line' }">
7
+ <span>{{ config.label }}</span>
8
+ <div
9
+ v-if="config.line === 'line'"
10
+ class="underline"
11
+ :style="getLineStyle()">
12
+ </div>
4
13
  </div>
14
+ <div v-else-if="config.type === 'button'" class="x-button-container">
15
+ <a-button type="primary" @click="handleClick">{{ config.label }}</a-button>
16
+ </div>
17
+ </div>
5
18
  </template>
6
19
 
7
20
  <script>
8
21
  export default {
9
- name: 'XTitle',
10
- props: {
11
- queryParamsName: {
12
- type: String,
13
- default: null
14
- }
15
- },
16
- data () {
17
- return {
18
- title: ''
22
+ name: 'XTitle',
23
+ props: {
24
+ queryParamsName: {
25
+ type: String,
26
+ default: ''
27
+ }
28
+ },
29
+ data () {
30
+ return {
31
+ config: {
32
+ label: '',
33
+ type: 'title',
34
+ clickName: '',
35
+ line: '',
36
+ color: '',
37
+ lineLength: ''
19
38
  }
20
- },
21
- computed: {
22
- processedTitle () {
23
- return this.title.replace('</br>', '')
24
- },
25
- hasUnderline () {
26
- return this.title.includes('</br>')
27
- },
28
- isOnlyLine () {
29
- return this.title === '</br>'
39
+ }
40
+ },
41
+ created () {
42
+ this.getData(this.queryParamsName)
43
+ },
44
+ methods: {
45
+ getData (data) {
46
+ if (!data) return
47
+
48
+ // 检查是否包含分隔符
49
+ if (data.includes('-')) {
50
+ const parts = data.split('-')
51
+
52
+ // 根据部分数量设置配置
53
+ if (parts.length >= 6) {
54
+ // 包含颜色和线长度
55
+ this.config = {
56
+ label: parts[0],
57
+ type: parts[1],
58
+ clickName: parts[2],
59
+ line: parts[3],
60
+ color: parts[4],
61
+ lineLength: parts[5]
62
+ }
63
+ } else if (parts.length === 5) {
64
+ // 只包含颜色
65
+ this.config = {
66
+ label: parts[0],
67
+ type: parts[1],
68
+ clickName: parts[2],
69
+ line: parts[3],
70
+ color: parts[4],
71
+ lineLength: ''
72
+ }
73
+ } else if (parts.length === 4) {
74
+ this.config = {
75
+ label: parts[0],
76
+ type: parts[1],
77
+ clickName: parts[2],
78
+ line: parts[3],
79
+ color: '',
80
+ lineLength: ''
81
+ }
82
+ } else if (parts.length === 3) {
83
+ this.config = {
84
+ label: parts[0],
85
+ type: parts[1],
86
+ clickName: parts[2],
87
+ line: '',
88
+ color: '',
89
+ lineLength: ''
90
+ }
91
+ } else if (parts.length === 2) {
92
+ this.config = {
93
+ label: parts[0],
94
+ type: parts[1],
95
+ clickName: '',
96
+ line: '',
97
+ color: '',
98
+ lineLength: ''
99
+ }
100
+ } else {
101
+ this.config = {
102
+ label: data,
103
+ type: 'title',
104
+ clickName: '',
105
+ line: '',
106
+ color: '',
107
+ lineLength: ''
108
+ }
109
+ }
110
+ } else {
111
+ // 没有分隔符,按原来的方式处理
112
+ this.config = {
113
+ label: data,
114
+ type: 'title',
115
+ clickName: '',
116
+ line: '',
117
+ color: '',
118
+ lineLength: ''
30
119
  }
120
+ }
31
121
  },
32
- created () {
33
- this.getData(this.queryParamsName)
122
+ handleClick () {
123
+ if (this.config.clickName) {
124
+ this.$emit(this.config.clickName)
125
+ }
34
126
  },
35
- methods: {
36
- getData (data) {
37
- this.title = data
38
- }
127
+ getLineStyle () {
128
+ const style = {}
129
+
130
+ // 设置线条颜色
131
+ if (this.config.color) {
132
+ style.backgroundColor = this.config.color
133
+ } else {
134
+ style.backgroundColor = '#5D5C5C'
135
+ }
136
+
137
+ // 设置线条宽度
138
+ if (this.config.lineLength) {
139
+ style.width = this.config.lineLength + 'px'
140
+ } else {
141
+ style.width = '800'
142
+ }
143
+
144
+ return style
39
145
  }
40
146
  }
147
+ }
41
148
  </script>
149
+
42
150
  <style scoped>
151
+ .x-title-container {
152
+ display: flex;
153
+ align-items: center;
154
+ justify-content: space-between;
155
+ }
156
+
43
157
  .x-title {
44
- font-size: 18px;
45
- font-weight: bold;
46
- height: 26px;
47
- width: 100%;
48
- text-align: left;
49
- font-family: "Source Han Sans", sans-serif;
50
- color: #5D5C5C;
158
+ font-size: 18px;
159
+ font-weight: bold;
160
+ height: 26px;
161
+ width: 100%;
162
+ text-align: left;
163
+ font-family: "Source Han Sans", sans-serif;
164
+ color: #5D5C5C;
165
+ position: relative;
51
166
  }
52
167
 
53
- .with-underline {
54
- border-bottom: 1px solid #5D5C5C;
168
+ .underline {
169
+ position: absolute;
170
+ bottom: 0;
171
+ left: 0;
172
+ height: 1px;
173
+ width: 100%;
174
+ background-color: #5D5C5C;
55
175
  }
56
176
 
57
- .only-line {
58
- height: 1px;
59
- background-color: #5D5C5C;
60
- margin: 13px 0;
177
+ .x-button-container {
178
+ text-align: right;
61
179
  }
62
180
  </style>
@@ -59,7 +59,7 @@ routerResource.example = {
59
59
  // component: () => import('@vue2-client/base-client/components/common/XAddNativeForm/demo.vue'),
60
60
  // component: () => import('@vue2-client/base-client/components/common/XFormGroup/demo.vue'),
61
61
  // component: () => import('@vue2-client/base-client/components/common/XReport/XReportDemo.vue'),
62
- component: () => import('@vue2-client/base-client/components/common/XFormTable/demo.vue'),
62
+ // component: () => import('@vue2-client/base-client/components/common/XFormTable/demo.vue'),
63
63
  // component: () => import('@vue2-client/base-client/components/common/XDatePicker/demo.vue'),
64
64
  // component: () => import('@vue2-client/base-client/components/common/XTab/XTabDemo.vue'),
65
65
  // component: () => import('@vue2-client/base-client/components/common/XRate/demo.vue'),
@@ -74,7 +74,7 @@ routerResource.example = {
74
74
  // component: () => import('@vue2-client/components/g2Charts/demo.vue'),
75
75
  // component: () => import('@vue2-client/pages/LogicCallExample/index.vue'),
76
76
  // component: () => import('@vue2-client/components/FilePreview/FilePreviewDemo.vue'),
77
- // component: () => import('@vue2-client/pages/ReportGrid/index.vue'),
77
+ component: () => import('@vue2-client/pages/ReportGrid/index.vue'),
78
78
  }
79
79
  // routerResource.example = () =>
80
80
  // import('@vue2-client/pages/Example')