diff --git a/src/pages/match/manage/index.vue b/src/pages/match/manage/index.vue index 1f3f689..a9a5a90 100644 --- a/src/pages/match/manage/index.vue +++ b/src/pages/match/manage/index.vue @@ -112,7 +112,6 @@ export default { tab1 || this.$delete(this.tabs, 'tab1') if (!tab2 || !this.releaseType) this.$delete(this.tabs, 'tab2') - console.log("🚀 ~ initTabs ~ this.releaseType:", (!tab2 || !this.releaseType)) tab3 || this.$delete(this.tabs, 'tab3') tab4 || this.$delete(this.tabs, 'tab4') tab5 || this.$delete(this.tabs, 'tab5') diff --git a/src/pages/match/manage/matchSignup.vue b/src/pages/match/manage/matchSignup.vue index fbd02e3..950e422 100644 --- a/src/pages/match/manage/matchSignup.vue +++ b/src/pages/match/manage/matchSignup.vue @@ -25,6 +25,9 @@
+ 导入 取消 + + +
+
+ 模板下载 +
+ + 上传文件 + + 部分数据导入失败,查看失败原因 +
+ + 取 消 + 确 定 + +
@@ -294,7 +339,15 @@ export default { originForm: {}, exitMember: 0, notExit: 0, - schoolDisable: false + schoolDisable: false, + + importVisible: false, + uploadList: [], + uploadFaild: false, + exportCode: '', + headers: { + token: util.local.get(Setting.tokenKey) + }, }; }, watch: { @@ -362,6 +415,64 @@ export default { if (column.prop === 'teamName') this.teamOrder = column.order ? column.order === 'ascending' ? 2 : 1 : '' this.getData() }, + + + // 批量导入 + batchImport () { + this.importVisible = true + this.uploadList = [] + this.uploadFaild = false + }, + // 模板下载 + download () { + location.href = this.api[this.info.completeCompetitionSetup.competitionType ? 'competionTeamTemplate' : 'competionPersonTemplate'] + }, + // 上传文件 + handleExceed (files, fileList) { + util.warningMsg( + `当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!` + ) + }, + // 下载失败文件 + showFaild () { + axios.get(`${this.api.TeamDataExportFailure}?exportCode=${this.exportCode}&platformId=1&type=${this.info.completeCompetitionSetup.competitionType ? 1 : 2}`, { + headers: this.headers, + responseType: 'blob' + }).then((res) => { + console.log("🚀 ~ showFaild ~ res:", res) + util.downloadFileDirect(decodeURI(res.headers['content-disposition']), new Blob([res.data])) + }).catch(res => { }) + }, + uploadSuccess ({ data, status }) { + this.uploadFaild = false + if (status === 200) { + if (data.exportCode) { + this.exportCode = data.exportCode + this.uploadFaild = true + util.errorMsg(data.tip) + } + } else { + res.message ? util.errorMsg(res.message) : util.errorMsg("上传失败,请检查数据") + } + }, + uploadError (err, file, fileList) { + this.$message({ + message: "上传出错,请重试!", + type: "error", + center: true + }) + }, + beforeRemove (file, fileList) { + return this.$confirm(`确定移除 ${file.name}?`) + }, + handleRemove (file, fileList) { + this.uploadList = fileList + this.uploadFaild = false + }, + uploadSure () { + this.importVisible = false + this.keyWord = '' + }, // 新增 add () { this.notExit = 0 diff --git a/src/pages/project/list/index.vue b/src/pages/project/list/index.vue index ca9e626..bac9c62 100644 --- a/src/pages/project/list/index.vue +++ b/src/pages/project/list/index.vue @@ -385,18 +385,6 @@ export default { } }).catch(err => { }) }, - // 课程选择回调 - curChange (val) { - const mallId = val[0] - if (val.length === 1) { - // 如果选择的是课程,则默认选中下面第一个系统 - this.cid = [mallId, this.curs.find(e => e.id === mallId).children[0].id] - } - this.queryData.mallId = mallId - this.queryData.cid = this.curs.find(e => e.id === mallId).cid - this.systemId = this.cid[1] - this.initData() - }, // 创建人选择回调 founderChange (val) { this.$router.push({ @@ -482,17 +470,34 @@ export default { console.log(err); }); }, + // 课程选择回调 + curChange (val) { + const mallId = val[0] + if (val.length === 1) { + // 如果选择的是课程,则默认选中下面第一个系统 + this.cid = [mallId, this.curs.find(e => e.id === mallId).children[0].id] + } + this.queryData.mallId = mallId + this.queryData.cid = this.curs.find(e => e.id === mallId).cid + this.systemId = this.cid[1] + this.initData() + }, copyData (projectId) { // 复制,根据项目id查询详情 this.copyVisible = true; this.$get(`${this.api.getProjectDetail}?projectId=${projectId}`).then(res => { const { systemId } = res.projectManage // 沙盘、银行、众筹只能选各自的系统,因此如果是这3个系统的话,要把其他系统都过滤掉 - this.copyCurs = this.lc.includes(systemId) ? this.curs.filter(e => e.systemId == systemId) : this.curs.filter(e => !this.lc.includes(+e.systemId)) - console.log("🚀 ~ this.$get ~ this.curs:", this.copyCurs) - this.copyMallId = [] + const curs = this.lc.includes(systemId) ? this.curs.filter(e => e.systemId == systemId) : this.curs.filter(e => !this.lc.includes(+e.systemId)) + curs.map(e => { + if (e.children && e.children.length) { + e.children = this.lc.includes(systemId) ? e.children.filter(n => n.id === systemId) : e.children.filter(n => !this.lc.includes(n.id)) + } + }) + this.copyCurs = curs + this.copyMallId = [this.queryData.mallId, this.systemId] this.copyForm = { projectName: res.projectManage.projectName, - mallId: '' + mallId: this.queryData.mallId } this.curRow = { projectManage: JSON.parse(JSON.stringify(res.projectManage)), @@ -516,17 +521,20 @@ export default { return; } // 系统创建的才需要选择系统 - if (fromSystem && !form.mallId) { + if (fromSystem && !this.copyMallId.length) { util.warningMsg("请选择课程"); return; } this.submiting = true row.projectManage.projectName = form.projectName - if (fromSystem) row.projectManage.mallId = form.mallId - row.projectManage.projectId = ""; + if (fromSystem) { + row.projectManage.mallId = this.copyMallId[0] + row.projectManage.systemId = this.copyMallId[1] + } + row.projectManage.projectId = '' row.projectManage.founder = 1 row.projectJudgmentList.forEach(i => { - i.projectId = ""; + i.projectId = '' }); this.$post(`${this.api.copyProjectManage}`, row).then(res => { this.initData(); diff --git a/src/pages/student/list/index.vue b/src/pages/student/list/index.vue index c87161a..e42a0ae 100644 --- a/src/pages/student/list/index.vue +++ b/src/pages/student/list/index.vue @@ -715,32 +715,25 @@ export default { this.getData(); }, delAllSelection () { // 批量删除 - if (this.multipleSelection.length) { - this.$confirm("确定要删除选中用户吗?", "提示", { - type: "warning" - }).then(() => { - let ids = this.multipleSelection.map(item => { - return item.accountId; - }); - this.$post(`${this.api.delStudent}?accountIds=${ids.toString()}`).then(res => { - this.multipleSelection = []; - this.$refs.table.clearSelection(); - util.successMsg("删除成功"); - if (this.studentType) { - this.getData(); - } else { - this.getOrgStudentData(); - } - }).catch(res => { - }); - if (this.multipleSelection.length === this.listData.length && this.page > 1) { - this.handleCurrentChange(this.page - 1) + const len = this.multipleSelection.length + const list = len ? this.multipleSelection : this.listData + this.$confirm(len ? '确定要删除选中学生吗?' : '是否要删除当前列表所有学生?', '提示', { + type: "warning" + }).then(() => { + this.$post(`${this.api.delStudent}?accountIds=${list.map(e => e.accountId).toString()}`).then(res => { + this.multipleSelection = []; + this.$refs.table.clearSelection(); + util.successMsg("删除成功"); + if (this.studentType) { + this.getData(); + } else { + this.getOrgStudentData(); } - }).catch(() => { - }); - } else { - util.errorMsg("请先选择数据 !"); - } + }).catch(res => { }); + if (this.multipleSelection.length === this.listData.length && this.page > 1) { + this.currentChange(this.page - 1) + } + }).catch(() => { }); }, handleDelete (row) { // 删除 this.$confirm("确定要删除吗?", "提示", { diff --git a/src/setting.js b/src/setting.js index 44e6744..202bf28 100644 --- a/src/setting.js +++ b/src/setting.js @@ -32,7 +32,7 @@ if (isPro) { uploadURL = `http://121.37.12.51/` host = "http://121.37.12.51/"; // 中台测试服 // host = 'https://www.occupationlab.com/' // 正式服 - host = "http://192.168.31.217:9000/"; + host = "http://192.168.31.51:9000/"; } else if (isSq) { zcPath = `10.20.100.204:8883` }