|
@@ -26,16 +26,23 @@
|
|
<template #header>
|
|
<template #header>
|
|
<el-row :gutter="10" class="mb8">
|
|
<el-row :gutter="10" class="mb8">
|
|
<el-col :span="1.5">
|
|
<el-col :span="1.5">
|
|
- <el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['system:gameTeam:add']">新增</el-button>
|
|
|
|
|
|
+ <el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['system:gameTeam:add']">新增 </el-button>
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="1.5">
|
|
<el-col :span="1.5">
|
|
- <el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['system:gameTeam:edit']">修改</el-button>
|
|
|
|
|
|
+ <el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['system:gameTeam:edit']"
|
|
|
|
+ >修改
|
|
|
|
+ </el-button>
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="1.5">
|
|
<el-col :span="1.5">
|
|
- <el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['system:gameTeam:remove']">删除</el-button>
|
|
|
|
|
|
+ <el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['system:gameTeam:remove']"
|
|
|
|
+ >删除
|
|
|
|
+ </el-button>
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="1.5">
|
|
<el-col :span="1.5">
|
|
- <el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['system:gameTeam:export']">导出</el-button>
|
|
|
|
|
|
+ <el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['system:gameTeam:export']">导出 </el-button>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="1.5">
|
|
|
|
+ <el-button type="info" plain icon="Upload" @click="handleImport" v-hasPermi="['system:gameTeam:import']"> 导入 </el-button>
|
|
</el-col>
|
|
</el-col>
|
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
|
</el-row>
|
|
</el-row>
|
|
@@ -110,12 +117,50 @@
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
</el-dialog>
|
|
</el-dialog>
|
|
|
|
+
|
|
|
|
+ <!-- 用户导入对话框 -->
|
|
|
|
+ <el-dialog v-model="upload.open" :title="upload.title" width="400px" append-to-body>
|
|
|
|
+ <el-upload
|
|
|
|
+ ref="uploadRef"
|
|
|
|
+ :limit="1"
|
|
|
|
+ accept=".xlsx, .xls"
|
|
|
|
+ :headers="upload.headers"
|
|
|
|
+ :action="upload.url + '?updateSupport=' + upload.updateSupport"
|
|
|
|
+ :disabled="upload.isUploading"
|
|
|
|
+ :on-progress="handleFileUploadProgress"
|
|
|
|
+ :on-success="handleFileSuccess"
|
|
|
|
+ :auto-upload="false"
|
|
|
|
+ drag
|
|
|
|
+ >
|
|
|
|
+ <el-icon class="el-icon--upload">
|
|
|
|
+ <i-ep-upload-filled />
|
|
|
|
+ </el-icon>
|
|
|
|
+ <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
|
|
|
+ <template #tip>
|
|
|
|
+ <div class="text-center el-upload__tip">
|
|
|
|
+ <div class="el-upload__tip">
|
|
|
|
+ <el-checkbox v-model="upload.updateSupport" />
|
|
|
|
+ 是否更新已经存在的用户数据
|
|
|
|
+ </div>
|
|
|
|
+ <span>仅允许导入xls、xlsx格式文件。</span>
|
|
|
|
+ <el-link type="primary" :underline="false" style="font-size: 12px; vertical-align: baseline" @click="importTemplate">下载模板</el-link>
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
|
|
+ </el-upload>
|
|
|
|
+ <template #footer>
|
|
|
|
+ <div class="dialog-footer">
|
|
|
|
+ <el-button type="primary" @click="submitFileForm">确 定</el-button>
|
|
|
|
+ <el-button @click="upload.open = false">取 消</el-button>
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
|
|
+ </el-dialog>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script setup name="GameTeam" lang="ts">
|
|
<script setup name="GameTeam" lang="ts">
|
|
import { listGameTeam, getGameTeam, delGameTeam, addGameTeam, updateGameTeam } from '@/api/system/gameTeam';
|
|
import { listGameTeam, getGameTeam, delGameTeam, addGameTeam, updateGameTeam } from '@/api/system/gameTeam';
|
|
import { GameTeamVO, GameTeamQuery, GameTeamForm } from '@/api/system/gameTeam/types';
|
|
import { GameTeamVO, GameTeamQuery, GameTeamForm } from '@/api/system/gameTeam/types';
|
|
|
|
+import { globalHeaders } from '@/utils/request';
|
|
|
|
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
|
|
|
@@ -130,12 +175,28 @@ const total = ref(0);
|
|
|
|
|
|
const queryFormRef = ref<ElFormInstance>();
|
|
const queryFormRef = ref<ElFormInstance>();
|
|
const gameTeamFormRef = ref<ElFormInstance>();
|
|
const gameTeamFormRef = ref<ElFormInstance>();
|
|
|
|
+const uploadRef = ref<ElUploadInstance>();
|
|
|
|
|
|
const dialog = reactive<DialogOption>({
|
|
const dialog = reactive<DialogOption>({
|
|
visible: false,
|
|
visible: false,
|
|
title: ''
|
|
title: ''
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+/*** 用户导入参数 */
|
|
|
|
+const upload = reactive<ImportOption>({
|
|
|
|
+ // 是否显示弹出层(用户导入)
|
|
|
|
+ open: false,
|
|
|
|
+ // 弹出层标题(用户导入)
|
|
|
|
+ title: '',
|
|
|
|
+ // 是否禁用上传
|
|
|
|
+ isUploading: false,
|
|
|
|
+ // 是否更新已经存在的用户数据
|
|
|
|
+ updateSupport: 0,
|
|
|
|
+ // 设置上传的请求头部
|
|
|
|
+ headers: globalHeaders(),
|
|
|
|
+ // 上传的地址
|
|
|
|
+ url: import.meta.env.VITE_APP_BASE_API + '/system/gameTeam/import'
|
|
|
|
+});
|
|
const initFormData: GameTeamForm = {
|
|
const initFormData: GameTeamForm = {
|
|
eventId: undefined,
|
|
eventId: undefined,
|
|
teamName: undefined,
|
|
teamName: undefined,
|
|
@@ -148,9 +209,9 @@ const initFormData: GameTeamForm = {
|
|
teamDescribe: undefined,
|
|
teamDescribe: undefined,
|
|
status: undefined,
|
|
status: undefined,
|
|
remark: undefined
|
|
remark: undefined
|
|
-}
|
|
|
|
|
|
+};
|
|
const data = reactive<PageData<GameTeamForm, GameTeamQuery>>({
|
|
const data = reactive<PageData<GameTeamForm, GameTeamQuery>>({
|
|
- form: {...initFormData},
|
|
|
|
|
|
+ form: { ...initFormData },
|
|
queryParams: {
|
|
queryParams: {
|
|
pageNum: 1,
|
|
pageNum: 1,
|
|
pageSize: 10,
|
|
pageSize: 10,
|
|
@@ -164,13 +225,10 @@ const data = reactive<PageData<GameTeamForm, GameTeamQuery>>({
|
|
numberRange: undefined,
|
|
numberRange: undefined,
|
|
teamDescribe: undefined,
|
|
teamDescribe: undefined,
|
|
status: undefined,
|
|
status: undefined,
|
|
- params: {
|
|
|
|
- }
|
|
|
|
|
|
+ params: {}
|
|
},
|
|
},
|
|
rules: {
|
|
rules: {
|
|
- teamCode: [
|
|
|
|
- { required: true, message: "队伍编号不能为空", trigger: "blur" }
|
|
|
|
- ],
|
|
|
|
|
|
+ teamCode: [{ required: true, message: '队伍编号不能为空', trigger: 'blur' }],
|
|
// leader: [
|
|
// leader: [
|
|
// { required: true, message: "领队不能为空", trigger: "blur" }
|
|
// { required: true, message: "领队不能为空", trigger: "blur" }
|
|
// ],
|
|
// ],
|
|
@@ -186,9 +244,7 @@ const data = reactive<PageData<GameTeamForm, GameTeamQuery>>({
|
|
// numberRange: [
|
|
// numberRange: [
|
|
// { required: true, message: "号码段不能为空", trigger: "blur" }
|
|
// { required: true, message: "号码段不能为空", trigger: "blur" }
|
|
// ],
|
|
// ],
|
|
- teamDescribe: [
|
|
|
|
- { required: true, message: "团队描述不能为空", trigger: "blur" }
|
|
|
|
- ],
|
|
|
|
|
|
+ teamDescribe: [{ required: true, message: '团队描述不能为空', trigger: 'blur' }]
|
|
// status: [
|
|
// status: [
|
|
// { required: true, message: "状态不能为空", trigger: "change" }
|
|
// { required: true, message: "状态不能为空", trigger: "change" }
|
|
// ],
|
|
// ],
|
|
@@ -204,55 +260,55 @@ const getList = async () => {
|
|
gameTeamList.value = res.rows;
|
|
gameTeamList.value = res.rows;
|
|
total.value = res.total;
|
|
total.value = res.total;
|
|
loading.value = false;
|
|
loading.value = false;
|
|
-}
|
|
|
|
|
|
+};
|
|
|
|
|
|
/** 取消按钮 */
|
|
/** 取消按钮 */
|
|
const cancel = () => {
|
|
const cancel = () => {
|
|
reset();
|
|
reset();
|
|
dialog.visible = false;
|
|
dialog.visible = false;
|
|
-}
|
|
|
|
|
|
+};
|
|
|
|
|
|
/** 表单重置 */
|
|
/** 表单重置 */
|
|
const reset = () => {
|
|
const reset = () => {
|
|
- form.value = {...initFormData};
|
|
|
|
|
|
+ form.value = { ...initFormData };
|
|
gameTeamFormRef.value?.resetFields();
|
|
gameTeamFormRef.value?.resetFields();
|
|
-}
|
|
|
|
|
|
+};
|
|
|
|
|
|
/** 搜索按钮操作 */
|
|
/** 搜索按钮操作 */
|
|
const handleQuery = () => {
|
|
const handleQuery = () => {
|
|
queryParams.value.pageNum = 1;
|
|
queryParams.value.pageNum = 1;
|
|
getList();
|
|
getList();
|
|
-}
|
|
|
|
|
|
+};
|
|
|
|
|
|
/** 重置按钮操作 */
|
|
/** 重置按钮操作 */
|
|
const resetQuery = () => {
|
|
const resetQuery = () => {
|
|
queryFormRef.value?.resetFields();
|
|
queryFormRef.value?.resetFields();
|
|
handleQuery();
|
|
handleQuery();
|
|
-}
|
|
|
|
|
|
+};
|
|
|
|
|
|
/** 多选框选中数据 */
|
|
/** 多选框选中数据 */
|
|
const handleSelectionChange = (selection: GameTeamVO[]) => {
|
|
const handleSelectionChange = (selection: GameTeamVO[]) => {
|
|
- ids.value = selection.map(item => item.teamId);
|
|
|
|
|
|
+ ids.value = selection.map((item) => item.teamId);
|
|
single.value = selection.length != 1;
|
|
single.value = selection.length != 1;
|
|
multiple.value = !selection.length;
|
|
multiple.value = !selection.length;
|
|
-}
|
|
|
|
|
|
+};
|
|
|
|
|
|
/** 新增按钮操作 */
|
|
/** 新增按钮操作 */
|
|
const handleAdd = () => {
|
|
const handleAdd = () => {
|
|
reset();
|
|
reset();
|
|
dialog.visible = true;
|
|
dialog.visible = true;
|
|
- dialog.title = "添加参赛队伍";
|
|
|
|
-}
|
|
|
|
|
|
+ dialog.title = '添加参赛队伍';
|
|
|
|
+};
|
|
|
|
|
|
/** 修改按钮操作 */
|
|
/** 修改按钮操作 */
|
|
const handleUpdate = async (row?: GameTeamVO) => {
|
|
const handleUpdate = async (row?: GameTeamVO) => {
|
|
reset();
|
|
reset();
|
|
- const _teamId = row?.teamId || ids.value[0]
|
|
|
|
|
|
+ const _teamId = row?.teamId || ids.value[0];
|
|
const res = await getGameTeam(_teamId);
|
|
const res = await getGameTeam(_teamId);
|
|
Object.assign(form.value, res.data);
|
|
Object.assign(form.value, res.data);
|
|
dialog.visible = true;
|
|
dialog.visible = true;
|
|
- dialog.title = "修改参赛队伍";
|
|
|
|
-}
|
|
|
|
|
|
+ dialog.title = '修改参赛队伍';
|
|
|
|
+};
|
|
|
|
|
|
/** 提交按钮 */
|
|
/** 提交按钮 */
|
|
const submitForm = () => {
|
|
const submitForm = () => {
|
|
@@ -260,33 +316,69 @@ const submitForm = () => {
|
|
if (valid) {
|
|
if (valid) {
|
|
buttonLoading.value = true;
|
|
buttonLoading.value = true;
|
|
if (form.value.teamId) {
|
|
if (form.value.teamId) {
|
|
- await updateGameTeam(form.value).finally(() => buttonLoading.value = false);
|
|
|
|
|
|
+ await updateGameTeam(form.value).finally(() => (buttonLoading.value = false));
|
|
} else {
|
|
} else {
|
|
- await addGameTeam(form.value).finally(() => buttonLoading.value = false);
|
|
|
|
|
|
+ await addGameTeam(form.value).finally(() => (buttonLoading.value = false));
|
|
}
|
|
}
|
|
- proxy?.$modal.msgSuccess("操作成功");
|
|
|
|
|
|
+ proxy?.$modal.msgSuccess('操作成功');
|
|
dialog.visible = false;
|
|
dialog.visible = false;
|
|
await getList();
|
|
await getList();
|
|
}
|
|
}
|
|
});
|
|
});
|
|
-}
|
|
|
|
|
|
+};
|
|
|
|
|
|
/** 删除按钮操作 */
|
|
/** 删除按钮操作 */
|
|
const handleDelete = async (row?: GameTeamVO) => {
|
|
const handleDelete = async (row?: GameTeamVO) => {
|
|
const _teamIds = row?.teamId || ids.value;
|
|
const _teamIds = row?.teamId || ids.value;
|
|
- await proxy?.$modal.confirm('是否确认删除参赛队伍编号为"' + _teamIds + '"的数据项?').finally(() => loading.value = false);
|
|
|
|
|
|
+ await proxy?.$modal.confirm('是否确认删除参赛队伍编号为"' + _teamIds + '"的数据项?').finally(() => (loading.value = false));
|
|
await delGameTeam(_teamIds);
|
|
await delGameTeam(_teamIds);
|
|
- proxy?.$modal.msgSuccess("删除成功");
|
|
|
|
|
|
+ proxy?.$modal.msgSuccess('删除成功');
|
|
await getList();
|
|
await getList();
|
|
-}
|
|
|
|
|
|
+};
|
|
|
|
|
|
/** 导出按钮操作 */
|
|
/** 导出按钮操作 */
|
|
const handleExport = () => {
|
|
const handleExport = () => {
|
|
- proxy?.download('system/gameTeam/export', {
|
|
|
|
- ...queryParams.value
|
|
|
|
- }, `gameTeam_${new Date().getTime()}.xlsx`)
|
|
|
|
|
|
+ proxy?.download(
|
|
|
|
+ 'system/gameTeam/export',
|
|
|
|
+ {
|
|
|
|
+ ...queryParams.value
|
|
|
|
+ },
|
|
|
|
+ `gameTeam_${new Date().getTime()}.xlsx`
|
|
|
|
+ );
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+/** 导入按钮操作 */
|
|
|
|
+const handleImport = () => {
|
|
|
|
+ upload.title = '参赛队伍导入';
|
|
|
|
+ upload.open = true;
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+/**文件上传中处理 */
|
|
|
|
+const handleFileUploadProgress = () => {
|
|
|
|
+ upload.isUploading = true;
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+/** 文件上传成功处理 */
|
|
|
|
+const handleFileSuccess = (response: any, file: UploadFile) => {
|
|
|
|
+ upload.open = false;
|
|
|
|
+ upload.isUploading = false;
|
|
|
|
+ uploadRef.value?.handleRemove(file);
|
|
|
|
+ ElMessageBox.alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + '</div>', '导入结果', {
|
|
|
|
+ dangerouslyUseHTMLString: true
|
|
|
|
+ });
|
|
|
|
+ getList();
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+/** 提交上传文件 */
|
|
|
|
+function submitFileForm() {
|
|
|
|
+ uploadRef.value?.submit();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+/** 下载模板操作 */
|
|
|
|
+const importTemplate = () => {
|
|
|
|
+ proxy?.download('system/gameTeam/importTemplate', {}, `game_event_template_${new Date().getTime()}.xlsx`);
|
|
|
|
+};
|
|
|
|
+
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
getList();
|
|
getList();
|
|
});
|
|
});
|