|
@@ -2,37 +2,140 @@
|
|
|
<div id="index">
|
|
|
<el-row>
|
|
|
<el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
|
|
|
- <el-col :span="24" class="one">系统首页</el-col>
|
|
|
+ <el-col :span="24" class="one">
|
|
|
+ <cSearch :is_title="false" :is_back="true" @toBack="toBack"></cSearch>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24" class="two">
|
|
|
+ <cTable :fields="fields" :opera="opera" :list="list" @query="search" :total="total" @exam="toExam" @view="toView" @del="toDel"> </cTable>
|
|
|
+ </el-col>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
+ <cDialog :dialog="dialog" @toClose="toClose">
|
|
|
+ <template v-slot:info>
|
|
|
+ <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">
|
|
|
+ <template #status>
|
|
|
+ <el-option v-for="i in statusList" :key="i.value" :label="i.label" :value="i.value"></el-option>
|
|
|
+ </template>
|
|
|
+ </cForm>
|
|
|
+ </el-col>
|
|
|
+ </template>
|
|
|
+ </cDialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
// 基础
|
|
|
import type { Ref } from 'vue';
|
|
|
-// reactive,
|
|
|
import { onMounted, ref, getCurrentInstance } from 'vue';
|
|
|
+import { ElMessage } from 'element-plus';
|
|
|
+import { useRouter, useRoute } from 'vue-router';
|
|
|
// 接口
|
|
|
-//import { TestStore } from '@common/src/stores/test';
|
|
|
-//import type { IQueryResult } from '@/util/types.util';
|
|
|
-//const testAxios = TestStore();
|
|
|
+import { ApplicationStore } from '@/stores/match/application';
|
|
|
+import { DictDataStore } from '@/stores/dict/dictData'; // 字典表
|
|
|
+import type { IQueryResult } from '@/util/types.util';
|
|
|
+const applicationAxios = ApplicationStore();
|
|
|
+const dictAxios = DictDataStore();
|
|
|
+const route = useRoute();
|
|
|
+// 路由
|
|
|
+const router = useRouter();
|
|
|
const { proxy } = getCurrentInstance() as any;
|
|
|
// 加载中
|
|
|
const loading: Ref<any> = ref(false);
|
|
|
-// 分页数据
|
|
|
-// const skip = 0;
|
|
|
-// const limit = proxy.limit;;
|
|
|
+let id: Ref<any> = ref(route.query.id);
|
|
|
+let list: Ref<any> = ref([]);
|
|
|
+let total: Ref<number> = ref(0);
|
|
|
+let skip = 0;
|
|
|
+let limit: number = proxy.$limit;
|
|
|
+let fields: Ref<any[]> = ref([
|
|
|
+ { label: '比赛名称', model: 'match_name' },
|
|
|
+ { label: '团队名称', model: 'team_name', isSearch: true },
|
|
|
+ { label: '参赛人数', model: 'num' },
|
|
|
+ { label: '报名时间', model: 'apply_time' },
|
|
|
+ { label: '分数', model: 'score' },
|
|
|
+ { label: '状态', model: 'status', format: (i: any) => getDict(i, 'status') }
|
|
|
+]);
|
|
|
+// 操作
|
|
|
+let opera: Ref<any[]> = ref([
|
|
|
+ { label: '审核', method: 'exam', type: 'warning' },
|
|
|
+ { label: '查看', method: 'view' },
|
|
|
+ { label: '删除', method: 'del', confirm: true, type: 'danger' }
|
|
|
+]);
|
|
|
+// 字典表
|
|
|
+const statusList: Ref<any> = ref([]);
|
|
|
+// 弹框
|
|
|
+const dialog: Ref<any> = ref({ title: '审核管理', show: false, type: '1' });
|
|
|
+const form: Ref<any> = ref({ file: [] });
|
|
|
+const formFields: Ref<any> = ref([{ label: '状态', model: 'status', type: 'select' }]);
|
|
|
// 请求
|
|
|
onMounted(async () => {
|
|
|
loading.value = true;
|
|
|
- // await search({ skip, limit });
|
|
|
+ id.value = route.query.id;
|
|
|
+ await searchOther();
|
|
|
+ await search({ skip, limit });
|
|
|
loading.value = false;
|
|
|
});
|
|
|
-//const search = async (e: { skip: number; limit: number }) => {
|
|
|
-// const info = { skip: e.skip, limit: e.limit, ...searchInfo.value };
|
|
|
-// const res: IQueryResult = await testAxios.query(info);
|
|
|
-// console.log(res);
|
|
|
-//};
|
|
|
+const search = async (e: { skip: number; limit: number }) => {
|
|
|
+ const info = { skip: e.skip, limit: e.limit, match_id: id.value };
|
|
|
+ const res: IQueryResult = await applicationAxios.query(info);
|
|
|
+ if (res.errcode == '0') {
|
|
|
+ list.value = res.data;
|
|
|
+ total.value = res.total;
|
|
|
+ }
|
|
|
+};
|
|
|
+const getDict = (e, model) => {
|
|
|
+ if (model == 'status') {
|
|
|
+ let data: any = statusList.value.find((i: any) => i.value == e);
|
|
|
+ if (data) return data.label;
|
|
|
+ else return '暂无';
|
|
|
+ }
|
|
|
+};
|
|
|
+// 保存
|
|
|
+const toSave = async (data) => {
|
|
|
+ let res: IQueryResult;
|
|
|
+ if (data._id) res = await applicationAxios.update(data);
|
|
|
+ else res = await applicationAxios.create(data);
|
|
|
+ if (res.errcode == 0) {
|
|
|
+ ElMessage({ type: `success`, message: `维护信息成功` });
|
|
|
+ toClose();
|
|
|
+ }
|
|
|
+};
|
|
|
+// 审核
|
|
|
+const toExam = async (data) => {
|
|
|
+ let res: IQueryResult = await applicationAxios.fetch(data._id);
|
|
|
+ if (res.errcode == '0') {
|
|
|
+ form.value = res.data;
|
|
|
+ dialog.value = { title: '审核管理', show: true, type: '1' };
|
|
|
+ }
|
|
|
+};
|
|
|
+// 查看
|
|
|
+const toView = (data) => {
|
|
|
+ router.push({ path: '/match/enroll/detail', query: { id: data._id } });
|
|
|
+};
|
|
|
+// 删除
|
|
|
+const toDel = async (data: any) => {
|
|
|
+ let res: IQueryResult = await applicationAxios.del(data._id);
|
|
|
+ if (res.errcode == 0) {
|
|
|
+ ElMessage({ type: `success`, message: `刪除信息成功` });
|
|
|
+ search({ skip, limit });
|
|
|
+ }
|
|
|
+};
|
|
|
+// 关闭弹框
|
|
|
+const toClose = () => {
|
|
|
+ form.value = {};
|
|
|
+ dialog.value = { show: false };
|
|
|
+ search({ skip, limit });
|
|
|
+};
|
|
|
+// 查询其他信息
|
|
|
+const searchOther = async () => {
|
|
|
+ let res: IQueryResult;
|
|
|
+ // 状态
|
|
|
+ res = await dictAxios.query({ type: 'status' });
|
|
|
+ if (res.errcode == '0') statusList.value = res.data;
|
|
|
+};
|
|
|
+// 返回上一页
|
|
|
+const toBack = () => {
|
|
|
+ window.history.go(-1);
|
|
|
+};
|
|
|
</script>
|
|
|
<style scoped lang="scss"></style>
|