feat(project): add venue selection for project management
- Add venueId field to project form - Load venue list when competition is selected - Allow assigning projects to specific venues Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
This commit is contained in:
@@ -235,6 +235,7 @@
|
||||
placeholder="请选择赛事"
|
||||
filterable
|
||||
style="width: 100%"
|
||||
@change="handleCompetitionChangeInForm"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in competitionList"
|
||||
@@ -245,6 +246,25 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="所属场地" prop="venueId">
|
||||
<el-select
|
||||
v-model="form.venueId"
|
||||
placeholder="请选择场地"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in venueList"
|
||||
:key="item.id"
|
||||
:label="item.venueName"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="项目编码" prop="projectCode">
|
||||
<el-input
|
||||
@@ -461,6 +481,7 @@ import {
|
||||
exportProjects
|
||||
} from '@/api/martial/project'
|
||||
import { getCompetitionList } from '@/api/martial/competition'
|
||||
import { getVenuesByCompetition } from '@/api/martial/venue'
|
||||
import { getToken } from '@/utils/auth'
|
||||
import dayjs from 'dayjs'
|
||||
|
||||
@@ -471,6 +492,7 @@ const tableData = ref([])
|
||||
const total = ref(0)
|
||||
const selection = ref([])
|
||||
const competitionList = ref([])
|
||||
const venueList = ref([])
|
||||
const dialogVisible = ref(false)
|
||||
const detailVisible = ref(false)
|
||||
const dialogTitle = ref('')
|
||||
@@ -492,6 +514,7 @@ const queryParams = reactive({
|
||||
const form = reactive({
|
||||
id: null,
|
||||
competitionId: '',
|
||||
venueId: null,
|
||||
projectCode: '',
|
||||
projectName: '',
|
||||
category: null,
|
||||
@@ -560,6 +583,20 @@ const loadCompetitionList = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
// 表单中赛事变更时加载场地列表
|
||||
const handleCompetitionChangeInForm = async (competitionId) => {
|
||||
form.venueId = null
|
||||
venueList.value = []
|
||||
if (competitionId) {
|
||||
try {
|
||||
const res = await getVenuesByCompetition(competitionId)
|
||||
venueList.value = res.data?.data?.records || []
|
||||
} catch (error) {
|
||||
console.error('加载场地列表失败:', error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 查询数据
|
||||
const fetchData = async () => {
|
||||
loading.value = true
|
||||
@@ -617,7 +654,7 @@ const handleAdd = () => {
|
||||
}
|
||||
|
||||
// 编辑
|
||||
const handleEdit = (row) => {
|
||||
const handleEdit = async (row) => {
|
||||
dialogTitle.value = '编辑项目'
|
||||
Object.keys(form).forEach((key) => {
|
||||
form[key] = row[key]
|
||||
@@ -626,6 +663,15 @@ const handleEdit = (row) => {
|
||||
if (row.price !== undefined) {
|
||||
form.registrationFee = row.price
|
||||
}
|
||||
// 加载该赛事的场地列表
|
||||
if (row.competitionId) {
|
||||
try {
|
||||
const res = await getVenuesByCompetition(row.competitionId)
|
||||
venueList.value = res.data?.data?.records || []
|
||||
} catch (error) {
|
||||
console.error('加载场地列表失败:', error)
|
||||
}
|
||||
}
|
||||
dialogVisible.value = true
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user