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