|
|
@ -146,7 +146,6 @@ export default { |
|
|
|
components: { CategorySelectTree, CategoryTree }, |
|
|
|
components: { CategorySelectTree, CategoryTree }, |
|
|
|
data() { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
return { |
|
|
|
title: '添加分类', |
|
|
|
|
|
|
|
formType: 'create', |
|
|
|
formType: 'create', |
|
|
|
categories: [], |
|
|
|
categories: [], |
|
|
|
categoryToCreate: {}, |
|
|
|
categoryToCreate: {}, |
|
|
@ -154,6 +153,14 @@ export default { |
|
|
|
columns |
|
|
|
columns |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
computed: { |
|
|
|
|
|
|
|
title() { |
|
|
|
|
|
|
|
if (this.categoryToCreate.id) { |
|
|
|
|
|
|
|
return '修改分类' |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return '添加分类' |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
created() { |
|
|
|
created() { |
|
|
|
this.loadCategories() |
|
|
|
this.loadCategories() |
|
|
|
}, |
|
|
|
}, |
|
|
@ -169,14 +176,12 @@ export default { |
|
|
|
this.createOrUpdateCategory() |
|
|
|
this.createOrUpdateCategory() |
|
|
|
}, |
|
|
|
}, |
|
|
|
handleAddCategory() { |
|
|
|
handleAddCategory() { |
|
|
|
this.title = '添加分类' |
|
|
|
|
|
|
|
this.formType = 'create' |
|
|
|
this.formType = 'create' |
|
|
|
this.categoryToCreate = {} |
|
|
|
this.categoryToCreate = {} |
|
|
|
}, |
|
|
|
}, |
|
|
|
handleEditCategory(id) { |
|
|
|
handleEditCategory(id) { |
|
|
|
categoryApi.get(id).then(response => { |
|
|
|
categoryApi.get(id).then(response => { |
|
|
|
this.categoryToCreate = response.data.data |
|
|
|
this.categoryToCreate = response.data.data |
|
|
|
this.title = '编辑分类' |
|
|
|
|
|
|
|
this.formType = 'update' |
|
|
|
this.formType = 'update' |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|