From 029d1d9b49f4a82567d2abab238ded2d7b53e3f2 Mon Sep 17 00:00:00 2001
From: buvta <12312540+buvta@users.noreply.github.com>
Date: Fri, 6 Nov 2020 23:11:01 +0800
Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E6=BA=90=E6=89=B9=E9=87=8F?=
=?UTF-8?q?=E6=A3=80=E6=B5=8B=E7=9A=84=E5=8A=9F=E8=83=BD=E9=99=90=E5=88=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/EditSites.vue | 56 ++++++++++++++++++++++++++++--------
1 file changed, 44 insertions(+), 12 deletions(-)
diff --git a/src/components/EditSites.vue b/src/components/EditSites.vue
index 094fab1..82adf18 100644
--- a/src/components/EditSites.vue
+++ b/src/components/EditSites.vue
@@ -6,7 +6,7 @@
新增
导出
导入
- 检测
+ 检测
清空
重置
@@ -71,7 +71,7 @@
置顶
编辑
- 检测
+ 检测
删除
@@ -146,7 +146,8 @@ export default {
batchGroupName: '',
batchIsActive: 1,
multipleSelection: [],
- checkAllSiteLoading: false,
+ checkAllSitesLoading: false,
+ stopFlag: false,
editOldkey: ''
}
},
@@ -172,6 +173,14 @@ export default {
return filters
}
},
+ watch: {
+ enableBatchEdit () {
+ if (this.checkAllSitesLoading) {
+ this.$message.info('正在检测, 请勿操作.')
+ this.enableBatchEdit = false
+ }
+ }
+ },
methods: {
...mapMutations(['SET_SETTING']),
excludeR18FilmsChangeEvent () {
@@ -187,6 +196,10 @@ export default {
this.multipleSelection = rows
},
handleSortChange (column, prop, order) {
+ if (this.checkAllSitesLoading) {
+ this.$message.info('正在检测, 请勿操作.')
+ return false
+ }
this.updateDatabase(this.sites)
},
saveBatchEdit () {
@@ -213,6 +226,10 @@ export default {
this.siteGroup = arr
},
addSite () {
+ if (this.checkAllSitesLoading) {
+ this.$message.info('正在检测, 请勿操作.')
+ return false
+ }
this.getSitesGroup()
this.dialogType = 'new'
this.dialogVisible = true
@@ -226,11 +243,11 @@ export default {
}
},
editSite (siteInfo) {
- this.getSitesGroup()
- if (this.checkAllSiteLoading) {
+ if (this.checkAllSitesLoading) {
this.$message.info('正在检测, 请勿操作.')
return false
}
+ this.getSitesGroup()
this.dialogType = 'edit'
this.dialogVisible = true
this.siteInfo = siteInfo
@@ -241,10 +258,6 @@ export default {
this.getSites()
},
removeEvent (e) {
- if (this.checkAllSiteLoading) {
- this.$message.info('正在检测, 请勿操作.')
- return false
- }
sites.remove(e.id).then(res => {
this.getSites()
}).catch(err => {
@@ -318,6 +331,10 @@ export default {
})
},
importSites () {
+ if (this.checkAllSitesLoading) {
+ this.$message.info('正在检测, 请勿操作.')
+ return false
+ }
const options = {
filters: [
{ name: 'JSON file', extensions: ['json'] },
@@ -352,11 +369,16 @@ export default {
})
},
resetSitesEvent () {
+ this.stopFlag = true
+ if (this.checkAllSitesLoading) {
+ this.$message.info('部分检测还未完全终止, 请稍等...')
+ return
+ }
sites.clear().then(sites.bulkAdd(defaultSites).then(this.getSites()))
this.$message.success('重置源成功')
},
moveToTopEvent (i) {
- if (this.checkAllSiteLoading) {
+ if (this.checkAllSitesLoading) {
this.$message.info('正在检测, 请勿操作.')
return false
}
@@ -392,9 +414,18 @@ export default {
})
},
removeAllSites () {
+ this.stopFlag = true
+ if (this.checkAllSitesLoading) {
+ this.$message.info('部分检测还未完全终止, 请稍等...')
+ return
+ }
sites.clear().then(this.getSites())
},
rowDrop () {
+ if (this.checkAllSitesLoading) {
+ this.$message.info('正在检测, 请勿操作.')
+ return false
+ }
const tbody = document.getElementById('sites-table').querySelector('.el-table__body-wrapper tbody')
var _this = this
Sortable.create(tbody, {
@@ -406,14 +437,15 @@ export default {
})
},
async checkAllSite () {
- this.checkAllSiteLoading = true
+ this.checkAllSitesLoading = true
Promise.all(this.sites.map(site => this.checkSingleSite(site))).then(res => {
- this.checkAllSiteLoading = false
+ this.checkAllSitesLoading = false
this.getSites()
})
},
async checkSingleSite (row) {
row.status = ' '
+ if (this.stopFlag) return row.status
const flag = await zy.check(row.key)
if (flag) {
row.status = '可用'