fix:审批中心 - 添加loading效果

This commit is contained in:
weifashi 2023-08-02 18:36:19 +08:00
parent b16b214099
commit 7582727753

View File

@ -7,7 +7,7 @@
<div class="approve-nav"> <div class="approve-nav">
<h1>{{$L('审批中心')}}</h1> <h1>{{$L('审批中心')}}</h1>
</div> </div>
<Button type="primary" @click="addApply">{{$L("添加申请")}}</Button> <Button :loading="addLoadIng" type="primary" @click="addApply">{{$L("添加申请")}}</Button>
</div> </div>
<Tabs :value="tabsValue" @on-click="tabsClick" style="margin: 0 20px;height: 100%;" size="small"> <Tabs :value="tabsValue" @on-click="tabsClick" style="margin: 0 20px;height: 100%;" size="small">
@ -19,7 +19,7 @@
</Select> </Select>
</div> </div>
</div> </div>
<div class="noData" v-if="unreadList.length==0">{{$L('暂无数据')}}</div> <div v-if="unreadList.length==0" class="noData" >{{$L('暂无数据')}}</div>
<div v-else class="approve-mains"> <div v-else class="approve-mains">
<div class="approve-main-left"> <div class="approve-main-left">
<div class="approve-main-list"> <div class="approve-main-list">
@ -65,7 +65,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="noData" v-if="notifyList.length==0">{{$L('暂无数据')}}</div> <div v-if="notifyList.length==0" class="noData">{{$L('暂无数据')}}</div>
<div v-else class="approve-mains"> <div v-else class="approve-mains">
<div class="approve-main-left"> <div class="approve-main-left">
<div class="approve-main-list"> <div class="approve-main-list">
@ -90,7 +90,7 @@
</Select> </Select>
</div> </div>
</div> </div>
<div class="noData" v-if="initiatedList.length==0">{{$L('暂无数据')}}</div> <div v-if="notifyList.length==0" class="noData">{{$L('暂无数据')}}</div>
<div v-else class="approve-mains"> <div v-else class="approve-mains">
<div class="approve-main-left"> <div class="approve-main-left">
<div class="approve-main-list"> <div class="approve-main-list">
@ -205,6 +205,7 @@ export default {
total: 0, total: 0,
noText: '', noText: '',
loadIng: false, loadIng: false,
addLoadIng: false,
tabsValue: "", tabsValue: "",
// //
@ -320,7 +321,9 @@ export default {
return; return;
} }
this.__tabsClick = setTimeout(() => { this.__tabsClick =null; },time) this.__tabsClick = setTimeout(() => { this.__tabsClick =null; },time)
if(time == 0){
this.loadIng = true;
}
this.tabsValue = val || this.tabsValue this.tabsValue = val || this.tabsValue
if(val!=""){ if(val!=""){
this.approvalType = this.searchState = "all" this.approvalType = this.searchState = "all"
@ -392,7 +395,7 @@ export default {
}).catch(({msg}) => { }).catch(({msg}) => {
$A.modalError(msg); $A.modalError(msg);
}).finally(_ => { }).finally(_ => {
this.loadIng--; this.loadIng = false;
}); });
}, },
@ -425,7 +428,7 @@ export default {
}).catch(({msg}) => { }).catch(({msg}) => {
$A.modalError(msg); $A.modalError(msg);
}).finally(_ => { }).finally(_ => {
this.loadIng--; this.loadIng = false;
}); });
}, },
@ -458,7 +461,7 @@ export default {
}).catch(({msg}) => { }).catch(({msg}) => {
$A.modalError(msg); $A.modalError(msg);
}).finally(_ => { }).finally(_ => {
this.loadIng--; this.loadIng = false;
}); });
}, },
@ -492,12 +495,13 @@ export default {
}).catch(({msg}) => { }).catch(({msg}) => {
$A.modalError(msg); $A.modalError(msg);
}).finally(_ => { }).finally(_ => {
this.loadIng--; this.loadIng = false;
}); });
}, },
// //
addApply(){ addApply(){
this.addLoadIng = true;
this.$store.dispatch("call", { this.$store.dispatch("call", {
url: 'users/basic', url: 'users/basic',
data: { data: {
@ -516,12 +520,11 @@ export default {
}).catch(({msg}) => { }).catch(({msg}) => {
$A.modalError(msg); $A.modalError(msg);
}).finally(_ => { }).finally(_ => {
this.loadIng--; this.addLoadIng = false;
}); });
}).catch(({msg}) => { }).catch(({msg}) => {
this.addLoadIng = false;
$A.modalError(msg); $A.modalError(msg);
}).finally(_ => {
this.loadIng--;
}); });
}, },
@ -529,7 +532,7 @@ export default {
onInitiate(){ onInitiate(){
this.$refs.initiateRef.validate((valid) => { this.$refs.initiateRef.validate((valid) => {
if (valid) { if (valid) {
this.loadIng = 1; this.loadIng = true;
var obj = JSON.parse(JSON.stringify(this.addData)) var obj = JSON.parse(JSON.stringify(this.addData))
obj.startTime = obj.startTime +" "+ obj.startTimeHour + ":" + obj.startTimeMinute; obj.startTime = obj.startTime +" "+ obj.startTimeHour + ":" + obj.startTimeMinute;
@ -557,14 +560,12 @@ export default {
}).catch(({msg}) => { }).catch(({msg}) => {
$A.modalError(msg); $A.modalError(msg);
}).finally(_ => { }).finally(_ => {
this.loadIng--; this.loadIng = false;
}); });
} }
}); });
} }
}
},
} }
</script> </script>