66 <v-icon class =" pointer" @click =" showTip=false" >mdi-close</v-icon >
77 </v-card >
88 <div class =" cycle-bin-list" >
9- <v-skeleton-loader type =" list-item-two-line" v-show =" loading" v-for =" item in 10 " :key =" item" ></v-skeleton-loader >
10- <v-card elevation =" 0" color =" #272727" class =" instance d- flex flex -ai" v-show =" !loading" v-for = " item in list "
11- :key =" item.exampleId" >
9+ <v-skeleton-loader type =" list-item-two-line" v-show =" loading" v-for =" item in 12 " :key =" item" ></v-skeleton-loader >
10+ <v-card elevation =" 0" color =" #272727" class =" instance flex-ai" v-show =" !loading"
11+ v-for = " (item, index) in list " :key =" item.exampleId" >
1212 <div class =" d-flex flex-clo" >
1313 <span class =" instance-title" >{{item.exampleName}}</span >
1414 <span class =" delete-time text-describe text-sm" >删除日期:{{item.updateTime}}</span >
1515 </div >
1616 <v-spacer ></v-spacer >
17- <v-btn color =" #333333" class =" restore-btn" @click =" restore(item.exampleId)" :loading =" restoreLoading" >恢复</v-btn >
18- <v-btn color =" error" class =" delete-btn" @click =" perDelete(item.exampleId)" :loading =" deleteLoading" >永久删除</v-btn >
17+ <v-btn color =" #333333" class =" restore-btn" @click =" restore(item.exampleId,index)"
18+ :loading =" restoreLoading&&curIndex===index" >恢复</v-btn >
19+ <v-btn color =" error" class =" delete-btn" @click =" perDelete(item.exampleId,index)"
20+ :loading =" deleteLoading&&curIndex===index" >永久删除</v-btn >
1921 </v-card >
2022 </div >
2123 <div class =" cycle-tip" v-show =" showNothing" >
2224 <div class =" d-flex flex-clo flex-jcc flex-ai" >
23- <span class =" title-xl " >🗑</span >
25+ <span class =" icon-cycle " >🗑</span >
2426 <span class =" text-describe text-sm" >回收站空空如也</span >
2527 </div >
2628 </div >
@@ -36,6 +38,7 @@ export default {
3638 loading: true ,
3739 deleteLoading: false ,
3840 restoreLoading: false ,
41+ curIndex: null ,
3942 list: [],
4043 showNothing: false ,
4144 }
@@ -46,7 +49,7 @@ export default {
4649 ! this .loginState ||
4750 this .curUserDetail .username !== this .loginInfo .username
4851 ) {
49- // this.$router.replace({ name: ' 404' } )
52+ this .$router .replace (' / 404' )
5053 }
5154 this .getRecycle ()
5255 },
@@ -57,19 +60,22 @@ export default {
5760 async getRecycle () {
5861 this .loading = true
5962 try {
60- const res = await this .$http .searchCycleBin ()
61- if (res .state ) {
62- this .list = res .data
63- this .showNothing = res .data .length === 0
63+ const { state , data } = await this .$http .searchCycleBin ()
64+ if (state) {
65+ this .list = data
66+ this .showNothing = data .length === 0
67+ this .$emit (' setPageConn' , true , true )
68+ this .$emit (' updateNum' , ' cycleBin' , data .length )
6469 this .$message .success (' 查询成功!' )
6570 } else {
6671 this .$message .error (' 查询失败!' )
6772 }
6873 } catch (err) {}
6974 this .loading = false
7075 },
71- async restore (exampleId ) {
76+ async restore (exampleId , index ) {
7277 this .restoreLoading = true
78+ this .curIndex = index
7379 try {
7480 const res = await this .$http .resumeDelWork ({
7581 username: this .loginInfo .username ,
@@ -82,15 +88,17 @@ export default {
8288 this .$message .error (' 恢复失败!' )
8389 }
8490 } catch (err) {}
91+ this .curIndex = null
8592 this .restoreLoading = false
8693 },
87- async perDelete (exampleId ) {
94+ async perDelete (exampleId , index ) {
8895 const confRes = await this .$alert ({
8996 content: ' 该实例永久删除后将不可恢复!' ,
9097 okText: ' 确认并继续' ,
9198 okColor: ' error' ,
9299 })
93100 if (confRes) {
101+ this .curIndex = index
94102 this .deleteLoading = true
95103 try {
96104 const res = await this .$http .permanentDelWork ({
@@ -106,6 +114,7 @@ export default {
106114 } catch (err) {
107115 console .log (err)
108116 }
117+ this .curIndex = null
109118 this .deleteLoading = false
110119 }
111120 },
@@ -135,6 +144,7 @@ export default {
135144 grid-gap : 15px ;
136145 grid-template-columns : repeat (auto-fill , minmax (450px , 1fr ));
137146 .instance {
147+ display : flex ;
138148 padding : 10px ;
139149 margin-bottom : 15px ;
140150 .restore-btn {
@@ -144,6 +154,9 @@ export default {
144154 }
145155 .cycle-tip {
146156 margin : 50px 0 100px ;
157+ .icon-cycle {
158+ font-size : 48px ;
159+ }
147160 }
148161}
149162 </style >
0 commit comments