feat:按钮添加loading

main
liu.tao3 2 years ago
parent d7aeb50a65
commit 9d2d794448

@ -198,8 +198,9 @@
</el-button> </el-button>
<el-button <el-button
class="bs-el-button-default" class="bs-el-button-default"
:loading="scope.row.loading"
:disabled="scope.row.editable === 1 && !appCode" :disabled="scope.row.editable === 1 && !appCode"
@click="delDataset(scope.row.id)" @click="delDataset(scope.row)"
> >
删除 删除
</el-button> </el-button>
@ -445,9 +446,10 @@ export default {
this.curRow = currentRow this.curRow = currentRow
}, },
// //
delDataset (id) { delDataset (row) {
datasetCheck(id).then((res)=>{ row.loading=true
console.log(res) datasetCheck(row.id).then((res)=>{
row.loading=false
if(res.canDelete){ if(res.canDelete){
this.$confirm('确定删除当前数据集吗?', '提示', { this.$confirm('确定删除当前数据集吗?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
@ -455,7 +457,7 @@ export default {
type: 'warning', type: 'warning',
customClass: 'bs-el-message-box' customClass: 'bs-el-message-box'
}).then(() => { }).then(() => {
datasetRemove(id).then(res => { datasetRemove(row.id).then(res => {
this.init(false) this.init(false)
this.$message.success('删除成功') this.$message.success('删除成功')
}) })
@ -575,6 +577,9 @@ export default {
datasetType: this.queryForm.datasetType === '' ? [...this.allType] : [this.queryForm.datasetType] datasetType: this.queryForm.datasetType === '' ? [...this.allType] : [this.queryForm.datasetType]
}).then((data) => { }).then((data) => {
this.tableData = data.list this.tableData = data.list
this.tableData.forEach(r => {
this.$set(r, 'loading', false)
})
if (this.isDialog) { if (this.isDialog) {
if (this.multiple && this.multipleSelection.length) { if (this.multiple && this.multipleSelection.length) {
this.toggleRowSelection() this.toggleRowSelection()

@ -96,6 +96,7 @@
</el-button> </el-button>
<el-button <el-button
class="bs-el-button-default" class="bs-el-button-default"
:loading="scope.row.loading"
:disabled="scope.row.editable == 1 && !appCode" :disabled="scope.row.editable == 1 && !appCode"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
> >
@ -188,6 +189,7 @@ export default {
reasonList:[], reasonList:[],
testBtnLoading: [], testBtnLoading: [],
loadingText: '', loadingText: '',
deling:false,
searchLoading: false, searchLoading: false,
dataSourceList: [], dataSourceList: [],
searchForm: { searchForm: {
@ -255,6 +257,7 @@ export default {
this.dataSourceList = data.list this.dataSourceList = data.list
this.dataSourceList.forEach(r => { this.dataSourceList.forEach(r => {
r.status = 0 r.status = 0
this.$set(r, 'loading', false)
if (r.id === this.sourceId) { if (r.id === this.sourceId) {
this.curRow = r this.curRow = r
} }
@ -279,7 +282,9 @@ export default {
handleDelete (row) { handleDelete (row) {
// eslint-disable-next-line eqeqeq // eslint-disable-next-line eqeqeq
if (row.editable == 1 && !this.appCode) return if (row.editable == 1 && !this.appCode) return
row.loading=true
dataSourceCheck(row.id).then((res)=>{ dataSourceCheck(row.id).then((res)=>{
row.loading=false
if(res.canDelete){ if(res.canDelete){
this.$confirm('确定删除当前数据源吗?', '提示', { this.$confirm('确定删除当前数据源吗?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',

Loading…
Cancel
Save