fix: 处理user列表状态开关的问题

This commit is contained in:
chenjinsong
2023-06-05 17:52:00 +08:00
parent 2c227c7685
commit d8c72373e7
3 changed files with 42 additions and 4 deletions

View File

@@ -50,14 +50,14 @@
</template>
</template>
<template v-else-if="item.prop === 'status'">
<!-- <el-switch
<el-switch
v-if="scope.row.id"
v-model="scope.row.status"
active-value="1"
:disabled="(scope.row.username === loginName) || (scope.row.username==='admin' && scope.row.id==1) "
inactive-value="0"
@change="()=>{statusChange(scope.row)}">
</el-switch>-->
</el-switch>
</template>
<span v-else>{{scope.row[item.prop]}}</span>
</template>

View File

@@ -63,6 +63,7 @@ import dataListMixin from '@/mixins/data-list'
import userTable from '@/components/table/administration/UserTable'
import userBox from '@/components/rightBox/settings/UserBox'
import { api } from '@/utils/api'
import {get} from '@/utils/http'
export default {
name: 'User',
@@ -88,6 +89,43 @@ export default {
},
tableId: 'userTable'
}
},
methods: {
getTableData (params, isAll, isClearType) {
if (isAll) {
this.searchLabel = null
} else if (isClearType) {
// this.searchLabel.tagType = ''
this.searchLabel.type = ''// 换新接口需要修改的属性名称
}
if (params) {
this.searchLabel = { ...this.searchLabel, ...params }
}
this.searchLabel = { ...this.searchLabel, ...this.pageObj }
this.tools.loading = true
delete this.searchLabel.total
let listUrl = this.url
if (this.listUrl) {
listUrl = this.listUrl
}
get(listUrl, this.searchLabel).then(response => {
this.tools.loading = false
if (response.code === 200) {
for (let i = 0; i < response.data.list.length; i++) {
response.data.list[i].status = response.data.list[i].status + ''
}
this.tableData = response.data.list
this.pageObj.total = response.data.total
} else {
console.error(response)
if (response.message) {
this.$message.error(response.message)
} else {
this.$message.error('Something went wrong...')
}
}
})
}
}
}
</script>

View File

@@ -157,9 +157,9 @@ export default {
mounted () {
this.timeoutFunc = setTimeout(() => {
this.handleDynamicChartHeight()
}, 400)
}, 500)
this.handleDynamicChartHeight()
this.debounceFunc = _.debounce(this.handleDynamicChartHeight, 400)
this.debounceFunc = _.debounce(this.handleDynamicChartHeight, 500)
window.addEventListener('resize', this.debounceFunc)
},
beforeUnmount () {