lw-cdp-ui 1.2.45 → 1.2.47

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.
@@ -168,7 +168,7 @@
168
168
  :disabled="item?.options.disabled">
169
169
  <el-radio v-for="_item in item?.options.items"
170
170
  :key="_item.value"
171
- :value="_item.value">{{ _item.label }}</el-radio>
171
+ :value="_item.value" :label="_item.label">{{ _item.label }}</el-radio>
172
172
  </el-radio-group>
173
173
  </template>
174
174
  <!-- color -->
@@ -191,7 +191,7 @@
191
191
  <div class="tags-list">
192
192
  <el-tag v-for="tag in objItem.value"
193
193
  :key="tag"
194
- closable
194
+ :closable="!item?.options?.disabled || item?.options?.closable"
195
195
  :disable-transitions="false"
196
196
  @close="tagClose(tag, objItem.value)">
197
197
  {{ tag }}
@@ -202,7 +202,7 @@
202
202
  size="small"
203
203
  @keyup.enter="tagInputConfirm(item, objItem.value)"
204
204
  @blur="tagInputConfirm(item, objItem.value)" />
205
- <el-button v-else
205
+ <el-button v-if="!tagVisible[item.name] && !item?.options?.disabled"
206
206
  class="button-new-tag"
207
207
  size="small"
208
208
  @click="tagVisible[item.name] = true">
@@ -51,8 +51,10 @@ export default {
51
51
 
52
52
  }
53
53
 
54
+ //判断是否当前路由,否的话跳转
54
55
  this.$store.commit('clearKeepLive')
55
- this.$store.commit('setRouteShow', false)
56
+ this.$store.commit("setRouteShow", false)
57
+
56
58
  }
57
59
  },
58
60
  async created() {
@@ -1,273 +1,286 @@
1
+ import { VueSelecto } from 'vue3-selecto'
1
2
  export default {
2
- name: 'lwTable',
3
- props: {
4
- // 表格基础配置
5
- refName: { type: String, default: 'multipleTableRef' }, // 表格的 ref 名称
6
- tableName: { type: String, default: '' }, // 表格名称
7
- tableData: { type: Array, default: () => [] }, // 表格数据
8
- tableColumns: { type: Array, default: () => [] }, // 表格列配置
9
- loading: { type: Boolean, default: false }, // 加载状态
10
- tableSize: { type: String, default: 'large' }, // 表格尺寸
11
-
12
- // 表格样式配置
13
- bordered: { type: Boolean, default: true }, // 是否显示边框
14
- stripe: { type: Boolean, default: false }, // 是否显示斑马纹
15
- hoverable: { type: Boolean, default: true }, // 是否启用鼠标悬停效果
16
- maxHeight: { type: String, default: 'calc(100vh - 270px)' }, // 表格最大高度
17
-
18
- // 选择功能配置
19
- rowSelection: { type: Boolean, default: false }, // 是否可选择行
20
- isRadio: { type: Boolean, default: false }, // 是否为单选模式
21
- rowKey: { type: String, default: 'id' }, // 行数据的唯一标识字段
22
- defaultSelectData: { type: Array, default: () => [] }, // 默认选中的数据
23
- selectedKeys: { type: Array }, // 选中的行 key 值
24
- selectDatas: { type: Array }, // 选中的行数据
25
- selectStatus: { type: Function, default: () => true }, // 选择状态回调
26
-
27
- // 分页配置
28
- isShowPagination: { type: Boolean, default: true }, // 是否显示分页
29
- searchParams: { type: Object, default: () => ({ page: 1, size: 20 }) }, // 查询参数
30
- totalCount: { type: Number, default: 0 }, // 总数据条数
31
- pageSizes: { type: Array, default: () => [10, 20, 30, 40, 50] }, // 分页可选条数
32
-
33
- // 高级功能配置
34
- defaultExpandAll: { type: Boolean, default: false }, // 是否默认展开所有行
35
- virtualListProps: { type: Object, default: undefined }, // 虚拟滚动配置
36
- summaryMethod: { type: Function, default: () => [] }, // 自定义合计方法
37
- hideTool: { type: Boolean, default: true }, // 是否隐藏工具栏
38
- isSetting: { type: Boolean, default: false }, // 是否显示列设置
39
- saveKey: { type: String, default: '' }, // 本地存储 key,用于保存表格配置
40
- draggable: { type: Object } // 是否可拖拽列配置
41
- },
42
-
43
- data() {
44
- return {
45
- // 表格基础状态
46
- tableHeaders: [], // 表格列配置
47
- localTableSize: this.tableSize, // 表格大小
48
-
49
- // 列设置相关
50
- checkedKeys: [], // 选中的列
51
- treeData: [], // 所有列数据
52
- allCheck: true, // 是否全选
53
- fixNum: 0, // 固定列数量
54
-
55
- // 选择相关
56
- selectedKeysForm: [], // 选中的键
57
- selectGoodsDatas: [], // 选中的数据
58
- selectAllGoods: [], // 所有可选数据
59
-
60
- // 全屏相关
61
- isFullscreen: false
62
- }
63
- },
64
-
65
- watch: {
66
- tableColumns: {
67
- handler() {
68
- this.filterData()
69
- },
70
- deep: true,
71
- immediate: true
72
- },
73
-
74
- tableData: {
75
- handler(newVal) {
76
- // 合并去重数据
77
- const mergedData = [...newVal, ...this.selectAllGoods]
78
- const uniqueData = Array.from(new Set(mergedData.map(item => item[this.rowKey])))
79
- .map(id => mergedData.find(item => item[this.rowKey] === id))
80
- this.selectAllGoods = uniqueData
81
- },
82
- deep: true,
83
- immediate: true
84
- },
85
-
86
- selectedKeys: {
87
- handler(newVal) {
88
- if (!newVal) return
89
-
90
- this.selectedKeysForm = newVal
91
- this.selectGoodsDatas = []
92
-
93
- if (this.selectAllGoods.length) {
94
- const selectedData = this.selectAllGoods.filter(item => newVal.includes(item[this.rowKey]))
95
- const mergedData = [...selectedData, ...this.selectGoodsDatas]
96
- const uniqueData = Array.from(new Set(mergedData.map(item => item[this.rowKey])))
97
- .map(id => mergedData.find(item => item[this.rowKey] === id))
98
-
99
- this.selectGoodsDatas = uniqueData
100
- this.$emit('update:selectDatas', uniqueData)
101
- }
102
- },
103
- deep: true,
104
- immediate: true
105
- }
106
- },
107
-
108
- created() {
109
- // 监听窗口大小变化
110
- window.addEventListener('resize', this.handleResize)
111
- },
112
-
113
- beforeDestroy() {
114
- // 移除事件监听
115
- window.removeEventListener('resize', this.handleResize)
116
- },
117
-
118
- methods: {
119
- /**
120
- * 过滤和处理表格列配置
121
- */
122
- filterData() {
123
- const columns = this.tableColumns
124
- this.checkedKeys = []
125
- const visibleColumns = []
126
-
127
- columns.forEach(column => {
128
- if (!column.key) {
129
- column.key = this.$tool.getUUID()
130
- }
131
-
132
- if (column.checked === undefined || column.checked) {
133
- this.checkedKeys.push(column.key)
134
- visibleColumns.push(column)
135
- }
136
- })
137
-
138
- this.treeData = columns
139
- this.tableHeaders = visibleColumns
140
- },
141
-
142
- /**
143
- * 全选/取消全选所有列
144
- */
145
- checkAll(selected) {
146
- if (selected) {
147
- this.tableHeaders = JSON.parse(JSON.stringify(this.tableColumns))
148
- this.checkedKeys = this.tableHeaders.map(col => {
149
- if (!col.key) {
150
- col.key = this.$tool.getUUID()
151
- }
152
- return col.key
153
- })
154
- } else {
155
- this.tableHeaders = []
156
- this.checkedKeys = []
157
- }
158
-
159
- this.treeData.forEach(col => {
160
- col.checked = selected
161
- })
162
- },
163
-
164
- /**
165
- * 更新列的选中状态
166
- */
167
- treeCheck() {
168
- this.tableHeaders = this.treeData.filter(col =>
169
- this.checkedKeys.includes(col.key)
170
- )
171
- },
172
-
173
- /**
174
- * 处理行变化
175
- */
176
- handleChange(currentData) {
177
- this.$emit('draggable', currentData)
178
- },
179
-
180
- /**
181
- * 处理选择变化
182
- */
183
- handleSelectionChange(val) {
184
- this.$emit('multipleSelection', val)
185
- },
186
-
187
- /**
188
- * 处理当前行变化
189
- */
190
- handleCurrentChange(val) {
191
- this.$emit('currentChange', val)
192
- },
193
-
194
- /**
195
- * 处理每页条数变化
196
- */
197
- sizeChange(val) {
198
- this.searchParams.size = val
199
- this.$emit('getTableData')
200
- },
201
-
202
- /**
203
- * 处理页码变化
204
- */
205
- currentChange(page) {
206
- this.searchParams.page = page - 1
207
- this.$emit('getTableData', this.searchParams.page)
208
- },
209
-
210
- /**
211
- * 刷新表格数据
212
- */
213
- refresh() {
214
- this.currentChange(1)
215
- },
216
-
217
- /**
218
- * 处理表格大小变化
219
- */
220
- handleSelect(v) {
221
- this.localTableSize = v
222
- },
223
-
224
- /**
225
- * 切换全屏显示
226
- */
227
- tableToggleFullScreen() {
228
- this.$bus.$emit('tableFullScreen', !this.isFullscreen)
229
- this.isFullscreen = !this.isFullscreen
230
- // 这里需要实现具体的全屏切换逻辑
231
- },
232
-
233
- /**
234
- * 处理窗口大小变化
235
- */
236
- handleResize() {
237
- const isFull = document.fullscreenElement ||
238
- document.mozFullScreenElement ||
239
- document.webkitFullscreenElement ||
240
- document.msFullscreenElement
241
-
242
- if (!isFull) {
243
- this.$bus.$emit('tableFullScreen', false)
244
- this.isFullscreen = false
245
- }
246
- },
247
-
248
- /**
249
- * 过滤列表操作按钮
250
- */
251
- filterOperations(operations, row) {
252
- return operations?.filter(o => {
253
- const hasAuth = !o.auth || this.checkAuth(o.auth)
254
- const isVisible = !o.isShow || o.isShow(row)
255
- return hasAuth && isVisible
256
- }) || []
257
- },
258
-
259
- /**
260
- * 检查权限
261
- */
262
- checkAuth(auth) {
263
- const { menus = [], authorities = [] } = JSON.parse(localStorage.getItem('userAuthInfo') || '{}')
264
- const allPermissions = [...menus, ...authorities]
265
-
266
- if (!auth) return true
267
- if (Array.isArray(auth)) {
268
- return auth.some(permission => allPermissions.includes(permission))
269
- }
270
- return allPermissions.includes(auth)
271
- }
272
- }
273
- }
3
+ name: 'lwTable',
4
+ components: { VueSelecto },
5
+ props: {
6
+ // 表格基础配置
7
+ refName: { type: String, default: 'multipleTableRef' }, // 表格的 ref 名称
8
+ tableName: { type: String, default: '' }, // 表格名称
9
+ tableData: { type: Array, default: () => [] }, // 表格数据
10
+ tableColumns: { type: Array, default: () => [] }, // 表格列配置
11
+ loading: { type: Boolean, default: false }, // 加载状态
12
+ tableSize: { type: String, default: 'large' }, // 表格尺寸
13
+
14
+ // 表格样式配置
15
+ bordered: { type: Boolean, default: true }, // 是否显示边框
16
+ stripe: { type: Boolean, default: false }, // 是否显示斑马纹
17
+ hoverable: { type: Boolean, default: true }, // 是否启用鼠标悬停效果
18
+ maxHeight: { type: String, default: 'calc(100vh - 270px)' }, // 表格最大高度
19
+
20
+ // 选择功能配置
21
+ rowSelection: { type: Boolean, default: false }, // 是否可选择行
22
+ isRadio: { type: Boolean, default: false }, // 是否为单选模式
23
+ rowKey: { type: String, default: 'id' }, // 行数据的唯一标识字段
24
+ defaultSelectData: { type: Array, default: () => [] }, // 默认选中的数据
25
+ selectedKeys: { type: Array }, // 选中的行 key 值
26
+ selectDatas: { type: Array }, // 选中的行数据
27
+ selectStatus: { type: Function, default: () => true }, // 选择状态回调
28
+
29
+ // 分页配置
30
+ isShowPagination: { type: Boolean, default: true }, // 是否显示分页
31
+ searchParams: { type: Object, default: () => ({ page: 1, size: 20 }) }, // 查询参数
32
+ totalCount: { type: Number, default: 0 }, // 总数据条数
33
+ pageSizes: { type: Array, default: () => [10, 20, 30, 40, 50] }, // 分页可选条数
34
+
35
+ // 高级功能配置
36
+ defaultExpandAll: { type: Boolean, default: false }, // 是否默认展开所有行
37
+ virtualListProps: { type: Object, default: undefined }, // 虚拟滚动配置
38
+ summaryMethod: { type: Function, default: () => [] }, // 自定义合计方法
39
+ hideTool: { type: Boolean, default: true }, // 是否隐藏工具栏
40
+ hideCard: { type: Boolean, default: true }, // 是否显示卡片
41
+ isSetting: { type: Boolean, default: false }, // 是否显示列设置
42
+ saveKey: { type: String, default: '' }, // 本地存储 key,用于保存表格配置
43
+ draggable: { type: Object } // 是否可拖拽列配置
44
+ },
45
+
46
+ data() {
47
+ return {
48
+ // 表格基础状态
49
+ tableHeaders: [], // 表格列配置
50
+ localTableSize: this.tableSize, // 表格大小
51
+
52
+ // 列设置相关
53
+ checkedKeys: [], // 选中的列
54
+ treeData: [], // 所有列数据
55
+ allCheck: true, // 是否全选
56
+ fixNum: 0, // 固定列数量
57
+
58
+ // 选择相关
59
+ selectedKeysForm: [], // 选中的键
60
+ selectGoodsDatas: [], // 选中的数据
61
+ selectAllGoods: [], // 所有可选数据
62
+
63
+ // 全屏相关
64
+ isFullscreen: false,
65
+ isCard: !this.hideCard // 是否显示卡片
66
+ }
67
+ },
68
+
69
+ watch: {
70
+ tableColumns: {
71
+ handler() {
72
+ this.filterData()
73
+ },
74
+ deep: true,
75
+ immediate: true
76
+ },
77
+
78
+ tableData: {
79
+ handler(newVal) {
80
+ // 合并去重数据
81
+ const mergedData = [...newVal, ...this.selectAllGoods]
82
+ const uniqueData = Array.from(new Set(mergedData.map((item) => item[this.rowKey]))).map((id) => mergedData.find((item) => item[this.rowKey] === id))
83
+ this.selectAllGoods = uniqueData
84
+ },
85
+ deep: true,
86
+ immediate: true
87
+ },
88
+
89
+ selectedKeys: {
90
+ handler(newVal) {
91
+ if (!newVal) return
92
+
93
+ this.selectedKeysForm = newVal
94
+ this.selectGoodsDatas = []
95
+
96
+ if (this.selectAllGoods.length) {
97
+ const selectedData = this.selectAllGoods.filter((item) => newVal.includes(item[this.rowKey]))
98
+ const mergedData = [...selectedData, ...this.selectGoodsDatas]
99
+ const uniqueData = Array.from(new Set(mergedData.map((item) => item[this.rowKey]))).map((id) => mergedData.find((item) => item[this.rowKey] === id))
100
+
101
+ this.selectGoodsDatas = uniqueData
102
+ this.$emit('update:selectDatas', uniqueData)
103
+ }
104
+ },
105
+ deep: true,
106
+ immediate: true
107
+ }
108
+ },
109
+
110
+ created() {
111
+ // 监听窗口大小变化
112
+ window.addEventListener('resize', this.handleResize)
113
+ },
114
+
115
+ beforeDestroy() {
116
+ // 移除事件监听
117
+ window.removeEventListener('resize', this.handleResize)
118
+ },
119
+
120
+ methods: {
121
+ /**
122
+ * 过滤和处理表格列配置
123
+ */
124
+ filterData() {
125
+ const columns = this.tableColumns
126
+ this.checkedKeys = []
127
+ const visibleColumns = []
128
+
129
+ columns.forEach((column) => {
130
+ if (!column.key) {
131
+ column.key = this.$tool.getUUID()
132
+ }
133
+
134
+ if (column.checked === undefined || column.checked) {
135
+ this.checkedKeys.push(column.key)
136
+ visibleColumns.push(column)
137
+ }
138
+ })
139
+
140
+ this.treeData = columns
141
+ this.tableHeaders = visibleColumns
142
+ },
143
+
144
+ /**
145
+ * 全选/取消全选所有列
146
+ */
147
+ checkAll(selected) {
148
+ if (selected) {
149
+ this.tableHeaders = JSON.parse(JSON.stringify(this.tableColumns))
150
+ this.checkedKeys = this.tableHeaders.map((col) => {
151
+ if (!col.key) {
152
+ col.key = this.$tool.getUUID()
153
+ }
154
+ return col.key
155
+ })
156
+ } else {
157
+ this.tableHeaders = []
158
+ this.checkedKeys = []
159
+ }
160
+
161
+ this.treeData.forEach((col) => {
162
+ col.checked = selected
163
+ })
164
+ },
165
+
166
+ /**
167
+ * 更新列的选中状态
168
+ */
169
+ treeCheck() {
170
+ this.tableHeaders = this.treeData.filter((col) => this.checkedKeys.includes(col.key))
171
+ },
172
+
173
+ /**
174
+ * 处理行变化
175
+ */
176
+ handleChange(currentData) {
177
+ this.$emit('draggable', currentData)
178
+ },
179
+
180
+ /**
181
+ * 处理选择变化
182
+ */
183
+ handleSelectionChange(val) {
184
+ this.$emit('multipleSelection', val)
185
+ },
186
+
187
+ /**
188
+ * 处理当前行变化
189
+ */
190
+ handleCurrentChange(val) {
191
+ this.$emit('currentChange', val)
192
+ },
193
+
194
+ /**
195
+ * 处理每页条数变化
196
+ */
197
+ sizeChange(val) {
198
+ this.searchParams.size = val
199
+ this.$emit('getTableData')
200
+ },
201
+
202
+ /**
203
+ * 处理页码变化
204
+ */
205
+ currentChange(page) {
206
+ this.searchParams.page = page - 1
207
+ this.$emit('getTableData', this.searchParams.page)
208
+ },
209
+
210
+ /**
211
+ * 刷新表格数据
212
+ */
213
+ refresh() {
214
+ this.currentChange(1)
215
+ },
216
+
217
+ /**
218
+ * 处理表格大小变化
219
+ */
220
+ handleSelect(v) {
221
+ this.localTableSize = v
222
+ },
223
+
224
+ /**
225
+ * 切换全屏显示
226
+ */
227
+ tableToggleFullScreen() {
228
+ this.$bus.$emit('tableFullScreen', !this.isFullscreen)
229
+ this.isFullscreen = !this.isFullscreen
230
+ // 这里需要实现具体的全屏切换逻辑
231
+ },
232
+
233
+ /**
234
+ * 处理窗口大小变化
235
+ */
236
+ handleResize() {
237
+ const isFull = document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement
238
+
239
+ if (!isFull) {
240
+ this.$bus.$emit('tableFullScreen', false)
241
+ this.isFullscreen = false
242
+ }
243
+ },
244
+
245
+ /**
246
+ * 过滤列表操作按钮
247
+ */
248
+ filterOperations(operations, row) {
249
+ return (
250
+ operations?.filter((o) => {
251
+ const hasAuth = !o.auth || this.checkAuth(o.auth)
252
+ const isVisible = !o.isShow || o.isShow(row)
253
+ return hasAuth && isVisible
254
+ }) || []
255
+ )
256
+ },
257
+
258
+ /**
259
+ * 检查权限
260
+ */
261
+ checkAuth(auth) {
262
+ const { menus = [], authorities = [] } = JSON.parse(localStorage.getItem('userAuthInfo') || '{}')
263
+ const allPermissions = [...menus, ...authorities]
264
+
265
+ if (!auth) return true
266
+ if (Array.isArray(auth)) {
267
+ return auth.some((permission) => allPermissions.includes(permission))
268
+ }
269
+ return allPermissions.includes(auth)
270
+ },
271
+ // 拖动选中
272
+ onSelect({ selected }) {
273
+ let list = []
274
+ selected.forEach((node) => {
275
+ // 获取 data-item 属性的值
276
+ const item = node.getAttribute('data-item')
277
+
278
+ if (item) {
279
+ const itemData = JSON.parse(item)
280
+ list.push(itemData)
281
+ }
282
+ })
283
+ this.$emit('multipleSelection', list)
284
+ }
285
+ }
286
+ }
@@ -1,6 +1,6 @@
1
1
  .baseTablePage-wrap {
2
2
  position: relative;
3
-
3
+ user-select: none;
4
4
  .icon-more {
5
5
  margin-top: 3px;
6
6
  cursor: pointer;
@@ -232,3 +232,7 @@
232
232
  margin-top: 10px;
233
233
  gap: 5px;
234
234
  }
235
+
236
+ .table-card-list{
237
+
238
+ }