This commit is contained in:
2025-11-07 01:35:43 +08:00
parent 92d29fe73f
commit 0dde8db6fd

View File

@@ -201,8 +201,11 @@ export default {
watch: { watch: {
value(val) { value(val) {
if (val) { if (val) {
this.loading = false // 重置loading状态
this.initData() this.initData()
this.getList() this.getList()
} else {
this.loading = false // 关闭时也重置loading
} }
} }
}, },
@@ -213,23 +216,28 @@ export default {
}, },
/** 查询日志列表 */ /** 查询日志列表 */
async getList() { getList() {
this.loading = true this.loading = true
try { getOperationLogs(this.queryParams).then(res => {
const res = await getOperationLogs(this.queryParams)
if (res.code === 200) { if (res.code === 200) {
this.logList = res.data || [] this.logList = res.data || []
this.total = this.logList.length this.total = this.logList.length
this.calculateStatistics() this.calculateStatistics()
} else { } else {
this.$message.error(res.msg || '查询失败') this.$message.error(res.msg || '查询失败')
this.logList = []
this.total = 0
this.calculateStatistics()
} }
} catch (e) { }).catch(e => {
this.$message.error('查询失败: ' + (e.message || '未知错误')) this.$message.error('查询失败: ' + (e.message || '未知错误'))
console.error('查询操作日志失败', e) console.error('查询操作日志失败', e)
} finally { this.logList = []
this.total = 0
this.calculateStatistics()
}).finally(() => {
this.loading = false this.loading = false
} })
}, },
/** 计算统计数据 */ /** 计算统计数据 */
@@ -285,6 +293,7 @@ export default {
/** 关闭对话框 */ /** 关闭对话框 */
handleClose() { handleClose() {
this.loading = false // 确保关闭loading状态
this.visible = false this.visible = false
} }
} }