mirror of https://github.com/halo-dev/halo
Support select team when create menu/link/photo.
parent
4079a9002a
commit
6e522faa20
|
@ -41,4 +41,11 @@ linkApi.delete = linkId => {
|
|||
})
|
||||
}
|
||||
|
||||
linkApi.listTeams = () => {
|
||||
return service({
|
||||
url: `${baseUrl}/teams`,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export default linkApi
|
||||
|
|
|
@ -48,4 +48,11 @@ menuApi.update = (menuId, menu) => {
|
|||
})
|
||||
}
|
||||
|
||||
menuApi.listTeams = () => {
|
||||
return service({
|
||||
url: `${baseUrl}/teams`,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export default menuApi
|
||||
|
|
|
@ -49,7 +49,11 @@
|
|||
label="分组:"
|
||||
:style="{ display: fieldExpand ? 'block' : 'none' }"
|
||||
>
|
||||
<a-input v-model="menuToCreate.team" />
|
||||
<a-auto-complete
|
||||
:dataSource="teams"
|
||||
v-model="menuToCreate.team"
|
||||
allowClear
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
label="打开方式:"
|
||||
|
@ -243,7 +247,8 @@ export default {
|
|||
menuToCreate: {
|
||||
target: '_self'
|
||||
},
|
||||
fieldExpand: false
|
||||
fieldExpand: false,
|
||||
teams: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
@ -256,6 +261,7 @@ export default {
|
|||
},
|
||||
created() {
|
||||
this.loadMenus()
|
||||
this.loadTeams()
|
||||
},
|
||||
methods: {
|
||||
loadMenus() {
|
||||
|
@ -265,6 +271,11 @@ export default {
|
|||
this.loading = false
|
||||
})
|
||||
},
|
||||
loadTeams() {
|
||||
menuApi.listTeams().then(response => {
|
||||
this.teams = response.data.data
|
||||
})
|
||||
},
|
||||
handleSaveClick() {
|
||||
this.createOrUpdateMenu()
|
||||
},
|
||||
|
@ -280,18 +291,35 @@ export default {
|
|||
menuApi.delete(id).then(response => {
|
||||
this.$message.success('删除成功!')
|
||||
this.loadMenus()
|
||||
this.loadTeams()
|
||||
})
|
||||
},
|
||||
createOrUpdateMenu() {
|
||||
if (!this.menuToCreate.name) {
|
||||
this.$notification['error']({
|
||||
message: '提示',
|
||||
description: '菜单名称不能为空!'
|
||||
})
|
||||
return
|
||||
}
|
||||
if (!this.menuToCreate.url) {
|
||||
this.$notification['error']({
|
||||
message: '提示',
|
||||
description: '菜单地址不能为空!'
|
||||
})
|
||||
return
|
||||
}
|
||||
if (this.menuToCreate.id) {
|
||||
menuApi.update(this.menuToCreate.id, this.menuToCreate).then(response => {
|
||||
this.$message.success('更新成功!')
|
||||
this.loadMenus()
|
||||
this.loadTeams()
|
||||
})
|
||||
} else {
|
||||
menuApi.create(this.menuToCreate).then(response => {
|
||||
this.$message.success('保存成功!')
|
||||
this.loadMenus()
|
||||
this.loadTeams()
|
||||
})
|
||||
}
|
||||
this.handleAddMenu()
|
||||
|
|
|
@ -26,11 +26,12 @@
|
|||
<a-form-item label="Logo:">
|
||||
<a-input v-model="link.logo" />
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
label="分组:"
|
||||
help="* 非必填"
|
||||
>
|
||||
<a-input v-model="link.team" />
|
||||
<a-form-item label="分组:">
|
||||
<a-auto-complete
|
||||
:dataSource="teams"
|
||||
v-model="link.team"
|
||||
allowClear
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="排序编号:">
|
||||
<a-input
|
||||
|
@ -226,7 +227,8 @@ export default {
|
|||
loading: false,
|
||||
columns,
|
||||
links: [],
|
||||
link: {}
|
||||
link: {},
|
||||
teams: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
@ -239,6 +241,7 @@ export default {
|
|||
},
|
||||
created() {
|
||||
this.loadLinks()
|
||||
this.loadTeams()
|
||||
},
|
||||
methods: {
|
||||
loadLinks() {
|
||||
|
@ -248,6 +251,11 @@ export default {
|
|||
this.loading = false
|
||||
})
|
||||
},
|
||||
loadTeams() {
|
||||
linkApi.listTeams().then(response => {
|
||||
this.teams = response.data.data
|
||||
})
|
||||
},
|
||||
handleSaveClick() {
|
||||
this.createOrUpdateLink()
|
||||
},
|
||||
|
@ -265,18 +273,35 @@ export default {
|
|||
linkApi.delete(id).then(response => {
|
||||
this.$message.success('删除成功!')
|
||||
this.loadLinks()
|
||||
this.loadTeams()
|
||||
})
|
||||
},
|
||||
createOrUpdateLink() {
|
||||
if (!this.link.name) {
|
||||
this.$notification['error']({
|
||||
message: '提示',
|
||||
description: '网站名称不能为空!'
|
||||
})
|
||||
return
|
||||
}
|
||||
if (!this.link.url) {
|
||||
this.$notification['error']({
|
||||
message: '提示',
|
||||
description: '网站地址不能为空!'
|
||||
})
|
||||
return
|
||||
}
|
||||
if (this.link.id) {
|
||||
linkApi.update(this.link.id, this.link).then(response => {
|
||||
this.$message.success('更新成功!')
|
||||
this.loadLinks()
|
||||
this.loadTeams()
|
||||
})
|
||||
} else {
|
||||
linkApi.create(this.link).then(response => {
|
||||
this.$message.success('保存成功!')
|
||||
this.loadLinks()
|
||||
this.loadTeams()
|
||||
})
|
||||
}
|
||||
this.handleAddLink()
|
||||
|
|
|
@ -216,7 +216,12 @@
|
|||
slot="description"
|
||||
v-if="editable"
|
||||
>
|
||||
<a-input v-model="photo.team" />
|
||||
<a-auto-complete
|
||||
:dataSource="teams"
|
||||
v-model="photo.team"
|
||||
allowClear
|
||||
style="width:100%"
|
||||
/>
|
||||
</template>
|
||||
<span
|
||||
slot="description"
|
||||
|
@ -343,11 +348,13 @@ export default {
|
|||
photoApi.update(this.photo.id, this.photo).then(response => {
|
||||
this.$message.success('照片更新成功!')
|
||||
this.loadPhotos()
|
||||
this.loadTeams()
|
||||
})
|
||||
} else {
|
||||
photoApi.create(this.photo).then(response => {
|
||||
this.$message.success('照片添加成功!')
|
||||
this.loadPhotos()
|
||||
this.loadTeams()
|
||||
this.photo = response.data.data
|
||||
})
|
||||
}
|
||||
|
@ -375,6 +382,7 @@ export default {
|
|||
this.$message.success('删除成功!')
|
||||
this.onDrawerClose()
|
||||
this.loadPhotos()
|
||||
this.loadTeams()
|
||||
})
|
||||
},
|
||||
showThumbDrawer() {
|
||||
|
|
Loading…
Reference in New Issue