|
@@ -112,7 +112,7 @@ export default {
|
|
|
sysMusicScore: {
|
|
|
name: '',
|
|
|
url: '',
|
|
|
- musicScoreCategoriesId: '',
|
|
|
+ musicScoreCategoriesId: [],
|
|
|
},
|
|
|
sysMusicScoreAccompaniments: [
|
|
|
{
|
|
@@ -128,22 +128,33 @@ export default {
|
|
|
value: 'id',
|
|
|
label: 'name',
|
|
|
children: 'sysMusicScoreCategoriesList',
|
|
|
- checkStrictly: true
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- mounted() {
|
|
|
+ async mounted() {
|
|
|
this.$store.dispatch('setSubjects')
|
|
|
+ await this.FetchTree()
|
|
|
if (this.detail) {
|
|
|
this.$set(this.form, 'sysMusicScore', {
|
|
|
name: this.detail.name,
|
|
|
url: this.detail.url,
|
|
|
+ musicScoreCategoriesId: this.detail.categoriesId ? this.formatParentId(this.detail.categoriesId, this.tree) : [],
|
|
|
})
|
|
|
this.FeatchDetailList()
|
|
|
}
|
|
|
- this.FetchTree()
|
|
|
},
|
|
|
methods: {
|
|
|
+ formatParentId(id, list, ids = []) {
|
|
|
+ for (const item of list) {
|
|
|
+ if (item.sysMusicScoreCategoriesList) {
|
|
|
+ return this.formatParentId(id, item.sysMusicScoreCategoriesList, [...ids, item.id])
|
|
|
+ }
|
|
|
+ if (item.id === id) {
|
|
|
+ return [...ids, id]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return ids
|
|
|
+ },
|
|
|
async FetchTree() {
|
|
|
try {
|
|
|
const res = await queryTree()
|