Commit 5505c443 authored by hzl's avatar hzl

feat: 处理资源组需求

parent 0ddc5d15
<template>
<div class="resource-group-selector">
<el-select
v-model="selectedGroups"
multiple
filterable
placeholder="请选择资源组"
@change="handleChange"
style="width: 100%">
<el-option
v-for="group in resourceGroups"
:key="group.id"
:label="group.name"
:value="group.id">
<span style="float: left">{{ group.name }}</span>
<span style="float: right; color: #8492a6; font-size: 13px">{{ group.id }}</span>
</el-option>
</el-select>
</div>
</template>
<script>
import { getAllResourceGroups } from '@/api/resourceGroup'
export default {
name: 'ResourceGroupSelector',
props: {
value: {
type: Array,
default: () => []
}
},
data() {
return {
resourceGroups: [],
selectedGroups: []
}
},
watch: {
value: {
immediate: true,
handler(newVal) {
this.selectedGroups = Array.isArray(newVal) ? [...newVal] : []
}
}
},
created() {
this.fetchResourceGroups()
},
methods: {
async fetchResourceGroups() {
try {
const response = await getAllResourceGroups()
if (response.status === 200 && response.result && response.result.data) {
this.resourceGroups = response.result.data
} else {
this.$message.error('获取资源组列表失败')
}
} catch (error) {
console.error('获取资源组列表失败:', error)
this.$message.error('获取资源组列表失败')
}
},
handleChange(value) {
this.selectedGroups = value
this.$emit('input', value)
this.$emit('change', value)
}
}
}
</script>
<style scoped>
.resource-group-selector {
width: 100%;
}
</style>
......@@ -162,6 +162,12 @@ export const constantRouterMap = [
component: () => import('@/views/materialGroup'),
meta: { title: '素材组管理' }
},
{
path: '/assetManagement/resource-group',
name: 'assetManagement.resource-group',
component: () => import('@/views/resourceGroup'),
meta: { title: '资源组管理' }
},
{
path: "/assetManagement/materialManage",
......
......@@ -27,6 +27,7 @@
<el-submenu index="4">
<template slot="title">资产管理</template>
<el-menu-item index="/assetManagement/material-group">素材组管理</el-menu-item>
<el-menu-item index="/assetManagement/resource-group">资源组管理</el-menu-item>
<el-menu-item index="/assetManagement/copywritingLibrary">文案管理</el-menu-item>
<el-menu-item index="/assetManagement/app-group">产品组管理</el-menu-item>
<el-menu-item index="/assetManagement/location-group">地域组管理</el-menu-item>
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment