@lambo-design/schema-paging-table 1.0.0-beta.39 → 1.0.0-beta.40
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 +5 -5
- package/src/index.vue +20 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lambo-design/schema-paging-table",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.40",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "lambo",
|
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
13
|
"standard-version": "^9.5.0",
|
|
14
|
-
"@lambo-design/core": "^4.7.1-beta.
|
|
15
|
-
"@lambo-design/
|
|
16
|
-
"@lambo-design/
|
|
17
|
-
"@lambo-design/
|
|
14
|
+
"@lambo-design/core": "^4.7.1-beta.144",
|
|
15
|
+
"@lambo-design/shared": "^1.0.0-beta.214",
|
|
16
|
+
"@lambo-design/schema-form": "^1.0.0-beta.69",
|
|
17
|
+
"@lambo-design/paging-table": "^1.0.0-beta.80"
|
|
18
18
|
},
|
|
19
19
|
"scripts": {
|
|
20
20
|
"release": "pnpm release-beta && git push --follow-tags && pnpm re-publish",
|
package/src/index.vue
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
:showTableOption="showTableOption"
|
|
11
11
|
:showOptionLayout="showOptionLayout"
|
|
12
12
|
:pageDisable="pageDisable"
|
|
13
|
+
:radioSelectIndex="radioSelectIndex"
|
|
13
14
|
@on-row-click="onRowClick"
|
|
14
15
|
@on-selection-change="onSelectionChange"
|
|
15
16
|
@on-select="onSelect"
|
|
@@ -79,10 +80,10 @@ export default {
|
|
|
79
80
|
queryForm: {},
|
|
80
81
|
tableSearchParams: {},
|
|
81
82
|
selection: [],
|
|
82
|
-
selectStore: [],
|
|
83
83
|
selectTags: [],
|
|
84
84
|
selectRows: [],
|
|
85
85
|
selectedKeys: [],
|
|
86
|
+
radioSelectIndex: -1,
|
|
86
87
|
}
|
|
87
88
|
},
|
|
88
89
|
props:{
|
|
@@ -286,10 +287,12 @@ export default {
|
|
|
286
287
|
deep: true
|
|
287
288
|
},
|
|
288
289
|
selectedKey: function () {
|
|
290
|
+
if (this.selectedKey.length === 0) return
|
|
289
291
|
this.selectedKeys = this.selectedKey
|
|
290
292
|
//重置标签
|
|
291
293
|
this.selectTags = []
|
|
292
294
|
if (this.rowKey) {
|
|
295
|
+
this.selectRows = []
|
|
293
296
|
for (let item of this.selectedKeys) {
|
|
294
297
|
this.selectRows[item[this.rowKey]] = item;
|
|
295
298
|
let tagItem = {"key": item[this.rowKey], "value": item[this.rowName]}
|
|
@@ -400,6 +403,9 @@ export default {
|
|
|
400
403
|
this.tableSearchParams = Object.assign({}, this.queryForm)
|
|
401
404
|
this.clearSelectData();
|
|
402
405
|
},
|
|
406
|
+
boxShowSearch: function () {
|
|
407
|
+
this.tableSearchParams = Object.assign({}, this.queryForm)
|
|
408
|
+
},
|
|
403
409
|
onReset() {
|
|
404
410
|
// Object.assign(this.queryForm, this.$options.propsData.form)
|
|
405
411
|
this.queryForm = this.$options.propsData.form;
|
|
@@ -431,16 +437,16 @@ export default {
|
|
|
431
437
|
},
|
|
432
438
|
//单选
|
|
433
439
|
selectOnChange: function (row, index) {
|
|
440
|
+
this.radioSelectIndex = -1
|
|
434
441
|
this.selection = Array(index).fill(false);
|
|
435
442
|
this.selection.splice(index, 1, true);
|
|
436
|
-
this.
|
|
443
|
+
this.selectRows = []
|
|
444
|
+
this.selectRows[row[this.rowKey]] = row
|
|
445
|
+
this.selectTags = [{"key": row[this.rowKey], "value": row[this.rowName]}]
|
|
437
446
|
},
|
|
438
447
|
//多选
|
|
439
448
|
onSelectionChange: function (rows) {
|
|
440
|
-
if (
|
|
441
|
-
this.selectStore = rows;
|
|
442
|
-
} else {
|
|
443
|
-
this.selectStore = rows;
|
|
449
|
+
if (this.rowKey) {
|
|
444
450
|
if (rows && rows.length > 0) {
|
|
445
451
|
for (let i = 0; i < rows.length; i++) {
|
|
446
452
|
let row = rows[i];
|
|
@@ -489,10 +495,12 @@ export default {
|
|
|
489
495
|
transformResponse: function (resp) {
|
|
490
496
|
if (this.rowKey) {
|
|
491
497
|
let self = this;
|
|
498
|
+
self.radioSelectIndex = -1
|
|
492
499
|
if (resp.code === 1 || resp.code === "000") {
|
|
493
500
|
let tableData = resp.data.rows;
|
|
494
501
|
for (let i = 0; i < tableData.length; i++) {
|
|
495
502
|
if (self.selectRows[tableData[i][self.rowKey]]) {
|
|
503
|
+
self.radioSelectIndex = i
|
|
496
504
|
tableData[i]._checked = true;
|
|
497
505
|
}
|
|
498
506
|
}
|
|
@@ -503,32 +511,31 @@ export default {
|
|
|
503
511
|
},
|
|
504
512
|
clearSelectData: function () {
|
|
505
513
|
this.selection = [];//清空已选项
|
|
506
|
-
this.selectStore = [];//清空已选数据
|
|
507
514
|
this.selectRows = [];//清空已选数据
|
|
508
515
|
this.selectTags = [];//清空所选标签
|
|
509
516
|
this.selectedKeys = [];//清空默认选择
|
|
517
|
+
this.radioSelectIndex = -1
|
|
510
518
|
},
|
|
511
519
|
tagClose: function (event, name) {
|
|
520
|
+
this.radioSelectIndex = -1
|
|
512
521
|
const selectIndex = (this.selectTags || []).findIndex((selectItem) => selectItem.key === name)
|
|
513
522
|
const dataIndex = (this.$refs.schemaPagingTable.$data.tableData || []).findIndex((selectItem) => selectItem[this.rowKey] === name)
|
|
514
523
|
if (selectIndex > -1) {
|
|
515
524
|
this.selectTags.splice(selectIndex, 1);
|
|
516
|
-
this.selectStore.splice(selectIndex, 1);
|
|
517
525
|
}
|
|
518
526
|
delete this.selectRows[name];
|
|
519
527
|
if (dataIndex > -1) {
|
|
520
528
|
this.$refs.schemaPagingTable.$refs.tableRef.toggleSelect(dataIndex);
|
|
521
529
|
}
|
|
522
530
|
},
|
|
523
|
-
getSelection(){
|
|
524
|
-
|
|
525
|
-
|
|
531
|
+
getSelection() {
|
|
532
|
+
let selectStore = [];
|
|
533
|
+
if (Object.keys(this.selectRows).length > 0 && this.rowKey) {
|
|
526
534
|
for (let item in this.selectRows) {
|
|
527
535
|
selectStore.push(this.selectRows[item]);
|
|
528
536
|
}
|
|
529
|
-
this.selectStore = selectStore;
|
|
530
537
|
}
|
|
531
|
-
return
|
|
538
|
+
return selectStore
|
|
532
539
|
}
|
|
533
540
|
}
|
|
534
541
|
}
|