|
|
@@ -250,24 +250,22 @@ function getList() {
|
|
|
tableLoading.value = true
|
|
|
getMainList({ systemCode: 10001 }).then(res => {
|
|
|
tableLoading.value = false
|
|
|
- if (res.code === 200) {
|
|
|
- if (res.data.length && res.data[0].children) {
|
|
|
- const array = []
|
|
|
- res.data[0].children.forEach((item) => {
|
|
|
- if (item.menuType === 3) {
|
|
|
- array.push(item)
|
|
|
- }
|
|
|
- })
|
|
|
- res.data = array
|
|
|
- }
|
|
|
- allTableData.value = res.data || []
|
|
|
- tableData.value = JSON.parse(JSON.stringify(res.data)).map(item => {
|
|
|
+ if (res.data.length && res.data[0].children) {
|
|
|
+ const array = []
|
|
|
+ res.data[0].children.forEach((item) => {
|
|
|
+ if (item.menuType === 3) {
|
|
|
+ array.push(item)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ res.data = array
|
|
|
+ }
|
|
|
+ allTableData.value = res.data || []
|
|
|
+ tableData.value = JSON.parse(JSON.stringify(res.data)).map(item => {
|
|
|
item.hasChildren = item.children && item.children.length > 0
|
|
|
item.children = null
|
|
|
item.idList = [item.id]
|
|
|
return item
|
|
|
})
|
|
|
- }
|
|
|
}).catch(() => {
|
|
|
tableLoading.value = false
|
|
|
})
|
|
|
@@ -275,22 +273,18 @@ function getList() {
|
|
|
|
|
|
function getSubList() {
|
|
|
getPowerList({ menuId: currentRow.value.id, ...params.value }).then(res => {
|
|
|
- if (res.code === 200) {
|
|
|
- powerData.value = res.data.records
|
|
|
- total.value = res.data.total
|
|
|
- drawerShow.value = true
|
|
|
- }
|
|
|
+ powerData.value = res.data.records
|
|
|
+ total.value = res.data.total
|
|
|
+ drawerShow.value = true
|
|
|
})
|
|
|
}
|
|
|
|
|
|
function currentChange(e) {
|
|
|
params.value.page = e
|
|
|
getPowerList({ menuId: currentRow.value.id, ...params.value }).then(res => {
|
|
|
- if (res.code === 200) {
|
|
|
- powerData.value = res.data.records
|
|
|
- total.value = res.data.total
|
|
|
- drawerShow.value = true
|
|
|
- }
|
|
|
+ powerData.value = res.data.records
|
|
|
+ total.value = res.data.total
|
|
|
+ drawerShow.value = true
|
|
|
})
|
|
|
}
|
|
|
|
|
|
@@ -298,11 +292,9 @@ function editItem(row) {
|
|
|
console.log(row)
|
|
|
currentRow.value = row
|
|
|
getPowerList({ menuId: row.id, current: params.value.page, size: params.value.size }).then(res => {
|
|
|
- if (res.code === 200) {
|
|
|
- powerData.value = res.data.records
|
|
|
- total.value = res.data.total
|
|
|
- drawerShow.value = true
|
|
|
- }
|
|
|
+ powerData.value = res.data.records
|
|
|
+ total.value = res.data.total
|
|
|
+ drawerShow.value = true
|
|
|
})
|
|
|
}
|
|
|
|
|
|
@@ -364,15 +356,13 @@ function submitForm() {
|
|
|
...form.value
|
|
|
}
|
|
|
scopeUpdate(params).then(res => {
|
|
|
- if (res.code === 200) {
|
|
|
- ElMessage({
|
|
|
- message: '修改成功',
|
|
|
- type: 'success'
|
|
|
- })
|
|
|
- dialogShow.value = false
|
|
|
- resetForm()
|
|
|
- getSubList()
|
|
|
- }
|
|
|
+ ElMessage({
|
|
|
+ message: '修改成功',
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ dialogShow.value = false
|
|
|
+ resetForm()
|
|
|
+ getSubList()
|
|
|
})
|
|
|
} else {
|
|
|
console.log('新增表单')
|
|
|
@@ -381,15 +371,13 @@ function submitForm() {
|
|
|
...form.value
|
|
|
}
|
|
|
scopeSave(params).then(res => {
|
|
|
- if (res.code === 200) {
|
|
|
- ElMessage({
|
|
|
- message: '新增成功',
|
|
|
- type: 'success'
|
|
|
- })
|
|
|
- dialogShow.value = false
|
|
|
- resetForm()
|
|
|
- getSubList()
|
|
|
- }
|
|
|
+ ElMessage({
|
|
|
+ message: '新增成功',
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ dialogShow.value = false
|
|
|
+ resetForm()
|
|
|
+ getSubList()
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
@@ -408,18 +396,11 @@ function deletePower(row) {
|
|
|
type: 'warning'
|
|
|
}).then(() => {
|
|
|
scopeRemove({ ids: row.id }).then(res => {
|
|
|
- if (res.code === 200) {
|
|
|
- ElMessage({
|
|
|
- message: '删除成功',
|
|
|
- type: 'success'
|
|
|
- })
|
|
|
- getSubList()
|
|
|
- } else {
|
|
|
- ElMessage({
|
|
|
- message: res.msg,
|
|
|
- type: 'warning'
|
|
|
- })
|
|
|
- }
|
|
|
+ ElMessage({
|
|
|
+ message: '删除成功',
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ getSubList()
|
|
|
})
|
|
|
})
|
|
|
}
|