zs 1 рік тому
батько
коміт
ad131c524e
1 змінених файлів з 17 додано та 12 видалено
  1. 17 12
      src/views/match/course/index.vue

+ 17 - 12
src/views/match/course/index.vue

@@ -26,7 +26,7 @@
         <el-col :span="24" class="dialog_one" v-if="dialog.type == '1'">
         <el-col :span="24" class="dialog_one" v-if="dialog.type == '1'">
           <cForm :span="24" :fields="formFields" :form="form" :rules="{}" @save="toSave" label-width="auto">
           <cForm :span="24" :fields="formFields" :form="form" :rules="{}" @save="toSave" label-width="auto">
             <template #winner>
             <template #winner>
-              <el-option v-for="i in applicationList" :key="i.team_id" :label="i.team_name" :value="i.team_id"></el-option>
+              <el-option v-for="i in winnerList" :key="i._id" :label="i.name" :value="i._id"></el-option>
             </template>
             </template>
             <template #status>
             <template #status>
               <el-option v-for="i in statusList" :key="i.value" :label="i.label" :value="i.value"></el-option>
               <el-option v-for="i in statusList" :key="i.value" :label="i.label" :value="i.value"></el-option>
@@ -46,12 +46,12 @@ import { ElMessage } from 'element-plus';
 import { useRouter, useRoute } from 'vue-router';
 import { useRouter, useRoute } from 'vue-router';
 // 接口
 // 接口
 import { CourseStore } from '@/stores/match/course';
 import { CourseStore } from '@/stores/match/course';
-import { ApplicationStore } from '@/stores/match/application';
+import { TeamStore } from '@/stores/team/team';
 import { DictDataStore } from '@/stores/dict/dictData'; // 字典表
 import { DictDataStore } from '@/stores/dict/dictData'; // 字典表
 import type { IQueryResult } from '@/util/types.util';
 import type { IQueryResult } from '@/util/types.util';
 const courseAxios = CourseStore();
 const courseAxios = CourseStore();
-const applicationAxios = ApplicationStore();
 const dictAxios = DictDataStore();
 const dictAxios = DictDataStore();
+const teamAxios = TeamStore();
 const { proxy } = getCurrentInstance() as any;
 const { proxy } = getCurrentInstance() as any;
 // 路由
 // 路由
 const router = useRouter();
 const router = useRouter();
@@ -82,15 +82,15 @@ let opera: Ref<any[]> = ref([
 let searchForm: Ref<any> = ref({});
 let searchForm: Ref<any> = ref({});
 // 字典表
 // 字典表
 const statusList: Ref<any> = ref([]);
 const statusList: Ref<any> = ref([]);
-const applicationList: Ref<any> = ref([]);
+const winnerList: Ref<any> = ref([]);
 // 弹框
 // 弹框
 const dialog: Ref<any> = ref({ title: '赛程状态', show: false, type: '1' });
 const dialog: Ref<any> = ref({ title: '赛程状态', show: false, type: '1' });
 const form: Ref<any> = ref({ file: [] });
 const form: Ref<any> = ref({ file: [] });
 const formFields: Ref<any> = ref([
 const formFields: Ref<any> = ref([
+  { label: '状态', model: 'status', type: 'select' },
   { label: '红方分数', model: 'red_score' },
   { label: '红方分数', model: 'red_score' },
   { label: '蓝方分数', model: 'blue_score' },
   { label: '蓝方分数', model: 'blue_score' },
-  { label: '胜者', model: 'winner', type: 'select' },
-  { label: '状态', model: 'status', type: 'select' }
+  { label: '胜者', model: 'winner', type: 'select' }
 ]);
 ]);
 // 请求
 // 请求
 onMounted(async () => {
 onMounted(async () => {
@@ -117,16 +117,24 @@ const getDict = (e, model) => {
     if (data) return data.label;
     if (data) return data.label;
     else return '暂无';
     else return '暂无';
   } else if (model == 'winner') {
   } else if (model == 'winner') {
-    let data: any = applicationList.value.find((i: any) => i.team_id == e);
-    if (data) return data.team_name;
+    let data: any = winnerList.value.find((i: any) => i._id == e);
+    if (data) return data.name;
     else return '暂无';
     else return '暂无';
   }
   }
 };
 };
 // 赛程状态
 // 赛程状态
 const toStatus = async (data) => {
 const toStatus = async (data) => {
-  let res: IQueryResult = await courseAxios.fetch(data._id);
+  let res: any = await courseAxios.fetch(data._id);
   if (res.errcode == '0') {
   if (res.errcode == '0') {
     form.value = res.data;
     form.value = res.data;
+    // 胜者
+    const { red_team_id, blue_team_id } = res.data;
+    const red: any = await teamAxios.fetch(red_team_id);
+    const blue: any = await teamAxios.fetch(blue_team_id);
+    let list = [];
+    list.push(red.data);
+    list.push(blue.data);
+    winnerList.value = list;
     dialog.value = { title: '赛程状态', show: true, type: '1' };
     dialog.value = { title: '赛程状态', show: true, type: '1' };
   }
   }
 };
 };
@@ -152,9 +160,6 @@ const searchOther = async () => {
   // 状态
   // 状态
   res = await dictAxios.query({ type: 'course_status' });
   res = await dictAxios.query({ type: 'course_status' });
   if (res.errcode == '0') statusList.value = res.data;
   if (res.errcode == '0') statusList.value = res.data;
-  // 报名情况
-  res = await applicationAxios.query({ match_id: id.value, status: '1' });
-  if (res.errcode == '0') applicationList.value = res.data;
 };
 };
 // 提交保存
 // 提交保存
 const toSave = async (data) => {
 const toSave = async (data) => {