提交 37f1ea21 authored 作者: lhh's avatar lhh

update

上级 7cea37bb
......@@ -210,3 +210,13 @@ export function bindExperiment(data: { id: string; experiment_id: any }) {
export function unbindExperiment(data: { id: string, experiment_id: string }) {
return httpRequest.post('/api/resource/v1/backend/competition/unbind-experiment', data)
}
// 获取赛项列表
export function getClassList(params?: { id: string }) {
return httpRequest.get('/api/resource/v1/backend/competition/classes', { params })
}
// 评分专家绑定班级
export function bindClass(data: { id: string; expert_id: string; class_id: string }) {
return httpRequest.post('/api/resource/v1/backend/competition/expert-bind-class', data)
}
<script setup lang="ts">
import type { FormInstance, FormRules } from 'element-plus'
import type { ContestItem } from '../types'
import { getContestUnbindExpertList, getExpert } from '../api'
import { getContestUnbindExpertList, getExpert, getClassList } from '../api'
import { useMapStore } from '@/stores/map'
const emit = defineEmits<{
......@@ -29,7 +29,13 @@ function fetchInfo(id: string) {
info = undefined
}
}
const classes: any = $ref([])
let classList: any = $ref()
onMounted(() => {
getClassList({ id: detail.id }).then(res => {
classList = res.data
})
fetchList()
})
......@@ -46,7 +52,16 @@ const rules = ref<FormRules>({
// 添加
function handleSubmit() {
formRef?.validate().then(() => {
emit('add', Object.assign(info, { info: { role: form.role, id: '0' }, expert_id: form.id, id: '0' }))
const classesList = classList.filter((item: { id: string }) => classes.includes(item.id))
emit(
'add',
Object.assign(info, {
info: { role: form.role, id: '0', class_id: classes.toString() },
expert_id: form.id,
id: '0',
class_info: classesList
})
)
emit('update:modelValue', false)
})
}
......@@ -66,6 +81,11 @@ function handleSubmit() {
<el-option v-for="item in list" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item label="添加班级">
<el-select multiple v-model="classes" style="width: 100%">
<el-option v-for="item in classList" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select>
</el-form-item>
<template v-if="info">
<el-form-item label="联系电话">{{ info.mobile }}</el-form-item>
<el-form-item label="所在单位">{{ info.company }}</el-form-item>
......
......@@ -40,6 +40,7 @@ const listOptions = $computed(() => {
return {
hasPagination: false,
columns: [
{ type: 'expand', slots: 'class' },
{ label: '序号', type: 'index', width: 60 },
{ label: '专家姓名', prop: 'name' },
{ label: '所在单位', prop: 'company' },
......@@ -71,13 +72,15 @@ const listOptions = $computed(() => {
})
const dialogVisible = $ref(false)
// const classIds: any = ref()
function handleAdd(data: any) {
// classIds.value = class_ids
list.push(data)
}
// 保存
function handleSubmit() {
const experts = list.map((item: any) => {
return { id: item.id, expert_id: item.expert_id, role: item.info.role }
return { id: item.id, expert_id: item.expert_id, role: item.info.role, class_id: item.info.class_id }
})
const expertsLeader = experts.filter((item: any) => item.role === '1')
if (expertsLeader.length !== 1) {
......@@ -100,7 +103,13 @@ function handleRemoveClass(index: number) {
</script>
<template>
<el-dialog title="评分专家列表" :close-on-click-modal="false" @update:modelValue="value => $emit('update:modelValue', value)">
<el-dialog
width="1000px"
title="评分专家列表"
:close-on-click-modal="false"
@update:modelValue="value => $emit('update:modelValue', value)"
>
<!-- <el-form :disabled="false"> -->
<el-form :disabled="disabled">
<AppList v-bind="listOptions" ref="appList">
<template #header-buttons>
......@@ -109,6 +118,15 @@ function handleRemoveClass(index: number) {
<p>赛项名称: {{ detail.name }}</p>
</el-row>
</template>
<template #class="{ row }">
<div style="padding-left: 20px">
<h3>班级信息</h3>
<el-table :data="row.class_info" :border="false">
<el-table-column width="200" label="班级id" prop="id" />
<el-table-column label="班级名称" prop="name" />
</el-table>
</div>
</template>
<template #table-x="{ $index }">
<el-button link round type="danger" @click="handleRemoveClass($index)">移除</el-button>
</template>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论