|
@@ -50,6 +50,9 @@
|
|
<el-col :span="1.5">
|
|
<el-col :span="1.5">
|
|
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['system:gameAthlete:export']">导出 </el-button>
|
|
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['system:gameAthlete:export']">导出 </el-button>
|
|
</el-col>
|
|
</el-col>
|
|
|
|
+ <el-col :span="1.5">
|
|
|
|
+ <el-button type="info" plain icon="Upload" @click="handleImport" v-hasPermi="['system:gameAthlete:import']"> 导入 </el-button>
|
|
|
|
+ </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>
|
|
</template>
|
|
</template>
|
|
@@ -119,11 +122,7 @@
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="性别" prop="gender">
|
|
<el-form-item label="性别" prop="gender">
|
|
<el-radio-group v-model="form.gender">
|
|
<el-radio-group v-model="form.gender">
|
|
- <el-radio
|
|
|
|
- v-for="dict in sys_user_sex"
|
|
|
|
- :key="dict.value"
|
|
|
|
- :value="dict.value"
|
|
|
|
- >{{dict.label}}</el-radio>
|
|
|
|
|
|
+ <el-radio v-for="dict in sys_user_sex" :key="dict.value" :value="dict.value">{{ dict.label }}</el-radio>
|
|
</el-radio-group>
|
|
</el-radio-group>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="年龄" prop="age">
|
|
<el-form-item label="年龄" prop="age">
|
|
@@ -150,6 +149,42 @@
|
|
</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>
|
|
|
|
|
|
@@ -162,13 +197,12 @@ import { getDefaultEvent } from '@/api/system/gameEvent';
|
|
import { GameAthleteVO, GameAthleteQuery, GameAthleteForm } from '@/api/system/gameAthlete/types';
|
|
import { GameAthleteVO, GameAthleteQuery, GameAthleteForm } from '@/api/system/gameAthlete/types';
|
|
import { GameTeamVO } from '@/api/system/gameTeam/types';
|
|
import { GameTeamVO } from '@/api/system/gameTeam/types';
|
|
import { GameEventVO } from '@/api/system/gameEvent/types';
|
|
import { GameEventVO } from '@/api/system/gameEvent/types';
|
|
-import { GameEventProjectVO } from '@/api/system/gameEventProject/types';
|
|
|
|
|
|
+import { globalHeaders } from '@/utils/request';
|
|
|
|
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
const { sys_user_sex } = toRefs<any>(proxy?.useDict('sys_user_sex'));
|
|
const { sys_user_sex } = toRefs<any>(proxy?.useDict('sys_user_sex'));
|
|
const defaultEvent = ref<GameEventVO | null>(null); // 默认赛事信息
|
|
const defaultEvent = ref<GameEventVO | null>(null); // 默认赛事信息
|
|
|
|
|
|
-
|
|
|
|
const gameTeamList = ref<GameTeamVO[]>([]); // 队伍列表
|
|
const gameTeamList = ref<GameTeamVO[]>([]); // 队伍列表
|
|
const gameAthleteList = ref<GameAthleteVO[]>([]);
|
|
const gameAthleteList = ref<GameAthleteVO[]>([]);
|
|
const gameEventProjectList = ref<Array<{ key: string; label: string }>>([]); // 赛事项目列表(用于穿梭框)
|
|
const gameEventProjectList = ref<Array<{ key: string; label: string }>>([]); // 赛事项目列表(用于穿梭框)
|
|
@@ -182,12 +216,29 @@ const total = ref(0);
|
|
|
|
|
|
const queryFormRef = ref<ElFormInstance>();
|
|
const queryFormRef = ref<ElFormInstance>();
|
|
const gameAthleteFormRef = ref<ElFormInstance>();
|
|
const gameAthleteFormRef = 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/gameAthlete/import'
|
|
|
|
+});
|
|
|
|
+
|
|
const initFormData: GameAthleteForm = {
|
|
const initFormData: GameAthleteForm = {
|
|
athleteId: undefined,
|
|
athleteId: undefined,
|
|
userId: undefined,
|
|
userId: undefined,
|
|
@@ -214,7 +265,7 @@ const data = reactive<PageData<GameAthleteForm, GameAthleteQuery>>({
|
|
queryParams: {
|
|
queryParams: {
|
|
pageNum: 1,
|
|
pageNum: 1,
|
|
pageSize: 10,
|
|
pageSize: 10,
|
|
- eventId: undefined, // 会自动设置为默认赛事ID
|
|
|
|
|
|
+ eventId: undefined, // 会自动设置为默认赛事ID
|
|
eventName: undefined,
|
|
eventName: undefined,
|
|
teamId: undefined,
|
|
teamId: undefined,
|
|
teamName: undefined,
|
|
teamName: undefined,
|
|
@@ -297,7 +348,7 @@ const getList = async () => {
|
|
loading.value = false;
|
|
loading.value = false;
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
loading.value = true;
|
|
loading.value = true;
|
|
const res = await listGameAthlete(queryParams.value);
|
|
const res = await listGameAthlete(queryParams.value);
|
|
gameAthleteList.value = res.rows;
|
|
gameAthleteList.value = res.rows;
|
|
@@ -431,6 +482,38 @@ const handleExport = () => {
|
|
);
|
|
);
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+/** 导入按钮操作 */
|
|
|
|
+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/gameAthlete/importTemplate', {}, `game_athlete_template_${new Date().getTime()}.xlsx`);
|
|
|
|
+};
|
|
|
|
+
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
getDefaultEventInfo().then(() => {
|
|
getDefaultEventInfo().then(() => {
|
|
getList();
|
|
getList();
|