@lambo-design/schema-paging-table 1.0.0-beta.55 → 1.0.0-beta.57
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 +4 -4
- package/src/index.vue +70 -7
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.57",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "lambo",
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
"devDependencies": {
|
|
13
13
|
"standard-version": "^9.5.0",
|
|
14
14
|
"@lambo-design/core": "^4.7.1-beta.156",
|
|
15
|
-
"@lambo-design/
|
|
16
|
-
"@lambo-design/
|
|
17
|
-
"@lambo-design/
|
|
15
|
+
"@lambo-design/schema-form": "^1.0.0-beta.77",
|
|
16
|
+
"@lambo-design/shared": "^1.0.0-beta.248",
|
|
17
|
+
"@lambo-design/paging-table": "^1.0.0-beta.90"
|
|
18
18
|
},
|
|
19
19
|
"scripts": {
|
|
20
20
|
"release": "pnpm release-beta && git push --follow-tags && pnpm re-publish",
|
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:{
|
|
@@ -338,7 +342,8 @@ export default {
|
|
|
338
342
|
this.tableSearchParams = val
|
|
339
343
|
this.queryForm = val
|
|
340
344
|
},
|
|
341
|
-
deep: true
|
|
345
|
+
deep: true,
|
|
346
|
+
immediate: true
|
|
342
347
|
},
|
|
343
348
|
selectedKey: {
|
|
344
349
|
handler: function () {
|
|
@@ -390,7 +395,7 @@ export default {
|
|
|
390
395
|
setCollapse: function() {
|
|
391
396
|
this.collapsed = !this.collapsed
|
|
392
397
|
},
|
|
393
|
-
doClick(item){
|
|
398
|
+
doClick(item, index){
|
|
394
399
|
let self = this;
|
|
395
400
|
if (item.clickEvent?.type === "route") {
|
|
396
401
|
const routeInfo = item.clickEvent.route;
|
|
@@ -449,6 +454,51 @@ export default {
|
|
|
449
454
|
self.$emit(item.clickEvent?.method?.name, param)
|
|
450
455
|
}
|
|
451
456
|
}
|
|
457
|
+
} else if (item.clickEvent?.type === "request") {
|
|
458
|
+
const requestInfo = item.clickEvent.request;
|
|
459
|
+
const keysExist = requestInfo.keys && requestInfo.keys.length !== 0;
|
|
460
|
+
let selection = self.getSelection()
|
|
461
|
+
if (keysExist && selection.length === 0) {
|
|
462
|
+
self.$Message.info('请选择一条记录!')
|
|
463
|
+
return
|
|
464
|
+
}
|
|
465
|
+
const response = item.clickEvent.response
|
|
466
|
+
let data;
|
|
467
|
+
if (self.multiSelect) {
|
|
468
|
+
data = selection.map((select, index) => {
|
|
469
|
+
if (item.clickEvent?.request?.keys) {
|
|
470
|
+
let obj = item.clickEvent?.request?.keys?.reduce((acc, sourceItem) => {
|
|
471
|
+
return Object.assign(acc, {[sourceItem]: select[sourceItem]})
|
|
472
|
+
}, {})
|
|
473
|
+
return obj
|
|
474
|
+
} else {
|
|
475
|
+
return item
|
|
476
|
+
}
|
|
477
|
+
})
|
|
478
|
+
} else {
|
|
479
|
+
if (item.clickEvent?.request?.keys) {
|
|
480
|
+
data = item.clickEvent?.request?.keys?.reduce((acc, sourceItem) => {
|
|
481
|
+
return Object.assign(acc, {[sourceItem]: selection[0][sourceItem]})
|
|
482
|
+
}, {})
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
const request = {
|
|
486
|
+
url: item.clickEvent.request.url,
|
|
487
|
+
method: item.clickEvent.request.method,
|
|
488
|
+
param: data,
|
|
489
|
+
}
|
|
490
|
+
if (item.clickEvent.tips.title) {
|
|
491
|
+
let tips = item.clickEvent.tips
|
|
492
|
+
this.$Modal.confirm({
|
|
493
|
+
title: tips.title,
|
|
494
|
+
content: '<p>' + tips.content + '</p>',
|
|
495
|
+
onOk: () => {
|
|
496
|
+
self.fetch(request, response, index)
|
|
497
|
+
}
|
|
498
|
+
});
|
|
499
|
+
} else {
|
|
500
|
+
self.fetch(request, response, index)
|
|
501
|
+
}
|
|
452
502
|
}
|
|
453
503
|
},
|
|
454
504
|
doSearch: function () {
|
|
@@ -466,23 +516,36 @@ export default {
|
|
|
466
516
|
this.queryForm = this.$options.propsData.form;
|
|
467
517
|
this.doSearch()
|
|
468
518
|
},
|
|
469
|
-
fetch: function (request,response) {
|
|
519
|
+
fetch: function (request,response,index) {
|
|
470
520
|
let self = this
|
|
471
521
|
let options = {
|
|
472
522
|
url: request.url,
|
|
473
523
|
method: request.method,
|
|
474
524
|
[request.method==='GET'?"params":"data"]:request.param
|
|
475
525
|
}
|
|
526
|
+
if (index) {
|
|
527
|
+
self.$set(self.loading, index, true)
|
|
528
|
+
self.$set(self.loadingMsg, index, response.loadingMsg || '执行中...')
|
|
529
|
+
}
|
|
476
530
|
ajax.request(options).then(function (resp) {
|
|
477
531
|
if (resp.data && resp.data.code === 1) {
|
|
478
532
|
self.$Message.success(response.successMsg)
|
|
479
|
-
|
|
533
|
+
if (index) {
|
|
534
|
+
self.$set(self.loading, index, false)
|
|
535
|
+
}
|
|
536
|
+
self.$refs.schemaPagingTable.tableRefresh()
|
|
480
537
|
} else {
|
|
481
538
|
self.$Message.error(response.errorMsg)
|
|
539
|
+
if (index) {
|
|
540
|
+
self.$set(self.loading, index, false)
|
|
541
|
+
}
|
|
482
542
|
}
|
|
483
543
|
}).catch(function (err) {
|
|
484
544
|
console.error(err)
|
|
485
545
|
self.$Message.error(response.errorMsg)
|
|
546
|
+
if (index) {
|
|
547
|
+
self.$set(self.loading, index, false)
|
|
548
|
+
}
|
|
486
549
|
})
|
|
487
550
|
},
|
|
488
551
|
/**
|