@lambo-design/schema-paging-table 1.0.0-beta.55 → 1.0.0-beta.56
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 +2 -2
- package/src/index.vue +68 -6
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.56",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "lambo",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"devDependencies": {
|
|
13
13
|
"standard-version": "^9.5.0",
|
|
14
14
|
"@lambo-design/core": "^4.7.1-beta.156",
|
|
15
|
-
"@lambo-design/shared": "^1.0.0-beta.
|
|
15
|
+
"@lambo-design/shared": "^1.0.0-beta.248",
|
|
16
16
|
"@lambo-design/paging-table": "^1.0.0-beta.90",
|
|
17
17
|
"@lambo-design/schema-form": "^1.0.0-beta.77"
|
|
18
18
|
},
|
package/src/index.vue
CHANGED
|
@@ -51,9 +51,11 @@
|
|
|
51
51
|
:icon="item.icon"
|
|
52
52
|
v-permission="item.permission"
|
|
53
53
|
:key="index"
|
|
54
|
-
|
|
54
|
+
:loading="loading[index]"
|
|
55
|
+
@click="doClick(item, index)"
|
|
55
56
|
:class="buttonShowClass">
|
|
56
|
-
|
|
57
|
+
<span v-if="!loading[index]">{{ item.name }}</span>
|
|
58
|
+
<span v-else>{{ loadingMsg[index] }}</span>
|
|
57
59
|
</Button>
|
|
58
60
|
</Row>
|
|
59
61
|
</Col>
|
|
@@ -90,7 +92,9 @@ export default {
|
|
|
90
92
|
selectRows: [],
|
|
91
93
|
selectedKeys: [],
|
|
92
94
|
radioSelectIndex: -1,
|
|
93
|
-
selectCondition:''
|
|
95
|
+
selectCondition:'',
|
|
96
|
+
loading: {},
|
|
97
|
+
loadingMsg: {}
|
|
94
98
|
}
|
|
95
99
|
},
|
|
96
100
|
props:{
|
|
@@ -390,7 +394,7 @@ export default {
|
|
|
390
394
|
setCollapse: function() {
|
|
391
395
|
this.collapsed = !this.collapsed
|
|
392
396
|
},
|
|
393
|
-
doClick(item){
|
|
397
|
+
doClick(item, index){
|
|
394
398
|
let self = this;
|
|
395
399
|
if (item.clickEvent?.type === "route") {
|
|
396
400
|
const routeInfo = item.clickEvent.route;
|
|
@@ -449,6 +453,51 @@ export default {
|
|
|
449
453
|
self.$emit(item.clickEvent?.method?.name, param)
|
|
450
454
|
}
|
|
451
455
|
}
|
|
456
|
+
} else if (item.clickEvent?.type === "request") {
|
|
457
|
+
const requestInfo = item.clickEvent.request;
|
|
458
|
+
const keysExist = requestInfo.keys && requestInfo.keys.length !== 0;
|
|
459
|
+
let selection = self.getSelection()
|
|
460
|
+
if (keysExist && selection.length === 0) {
|
|
461
|
+
self.$Message.info('请选择一条记录!')
|
|
462
|
+
return
|
|
463
|
+
}
|
|
464
|
+
const response = item.clickEvent.response
|
|
465
|
+
let data;
|
|
466
|
+
if (self.multiSelect) {
|
|
467
|
+
data = selection.map((select, index) => {
|
|
468
|
+
if (item.clickEvent?.request?.keys) {
|
|
469
|
+
let obj = item.clickEvent?.request?.keys?.reduce((acc, sourceItem) => {
|
|
470
|
+
return Object.assign(acc, {[sourceItem]: select[sourceItem]})
|
|
471
|
+
}, {})
|
|
472
|
+
return obj
|
|
473
|
+
} else {
|
|
474
|
+
return item
|
|
475
|
+
}
|
|
476
|
+
})
|
|
477
|
+
} else {
|
|
478
|
+
if (item.clickEvent?.request?.keys) {
|
|
479
|
+
data = item.clickEvent?.request?.keys?.reduce((acc, sourceItem) => {
|
|
480
|
+
return Object.assign(acc, {[sourceItem]: selection[0][sourceItem]})
|
|
481
|
+
}, {})
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
const request = {
|
|
485
|
+
url: item.clickEvent.request.url,
|
|
486
|
+
method: item.clickEvent.request.method,
|
|
487
|
+
param: data,
|
|
488
|
+
}
|
|
489
|
+
if (item.clickEvent.tips.title) {
|
|
490
|
+
let tips = item.clickEvent.tips
|
|
491
|
+
this.$Modal.confirm({
|
|
492
|
+
title: tips.title,
|
|
493
|
+
content: '<p>' + tips.content + '</p>',
|
|
494
|
+
onOk: () => {
|
|
495
|
+
self.fetch(request, response, index)
|
|
496
|
+
}
|
|
497
|
+
});
|
|
498
|
+
} else {
|
|
499
|
+
self.fetch(request, response, index)
|
|
500
|
+
}
|
|
452
501
|
}
|
|
453
502
|
},
|
|
454
503
|
doSearch: function () {
|
|
@@ -466,23 +515,36 @@ export default {
|
|
|
466
515
|
this.queryForm = this.$options.propsData.form;
|
|
467
516
|
this.doSearch()
|
|
468
517
|
},
|
|
469
|
-
fetch: function (request,response) {
|
|
518
|
+
fetch: function (request,response,index) {
|
|
470
519
|
let self = this
|
|
471
520
|
let options = {
|
|
472
521
|
url: request.url,
|
|
473
522
|
method: request.method,
|
|
474
523
|
[request.method==='GET'?"params":"data"]:request.param
|
|
475
524
|
}
|
|
525
|
+
if (index) {
|
|
526
|
+
self.$set(self.loading, index, true)
|
|
527
|
+
self.$set(self.loadingMsg, index, response.loadingMsg || '执行中...')
|
|
528
|
+
}
|
|
476
529
|
ajax.request(options).then(function (resp) {
|
|
477
530
|
if (resp.data && resp.data.code === 1) {
|
|
478
531
|
self.$Message.success(response.successMsg)
|
|
479
|
-
|
|
532
|
+
if (index) {
|
|
533
|
+
self.$set(self.loading, index, false)
|
|
534
|
+
}
|
|
535
|
+
self.$refs.schemaPagingTable.tableRefresh()
|
|
480
536
|
} else {
|
|
481
537
|
self.$Message.error(response.errorMsg)
|
|
538
|
+
if (index) {
|
|
539
|
+
self.$set(self.loading, index, false)
|
|
540
|
+
}
|
|
482
541
|
}
|
|
483
542
|
}).catch(function (err) {
|
|
484
543
|
console.error(err)
|
|
485
544
|
self.$Message.error(response.errorMsg)
|
|
545
|
+
if (index) {
|
|
546
|
+
self.$set(self.loading, index, false)
|
|
547
|
+
}
|
|
486
548
|
})
|
|
487
549
|
},
|
|
488
550
|
/**
|