赛事人员导入、项目复制、学生列表批量删除

master
yujialong 8 months ago
parent 072b5d9fb8
commit 108c086f7a
  1. 1
      src/pages/match/manage/index.vue
  2. 113
      src/pages/match/manage/matchSignup.vue
  3. 48
      src/pages/project/list/index.vue
  4. 21
      src/pages/student/list/index.vue
  5. 2
      src/setting.js

@ -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')

@ -25,6 +25,9 @@
</li>
</ul>
<div>
<el-button type="primary"
round
@click="batchImport">导入</el-button>
<el-button type="primary"
round
@click="add"
@ -209,6 +212,48 @@
@click="teamVisible = false">取消</el-button>
</span>
</el-dialog>
<el-dialog title="批量导入"
:visible.sync="importVisible"
width="24%"
:close-on-click-modal="false">
<div style="text-align: center">
<div style="margin-bottom: 10px;">
<el-button type="primary"
@click="download">模板下载<i class="el-icon-download el-icon--right"></i></el-button>
</div>
<el-upload ref="importStaff"
name="file"
accept=".xls,.xlsx"
:on-remove="handleRemove"
:on-error="uploadError"
:on-success="uploadSuccess"
:before-remove="beforeRemove"
:limit="1"
:data="{
competitionId: id,
platformId: 1
}"
:on-exceed="handleExceed"
:action="info.completeCompetitionSetup.competitionType ? this.api.batchImportTeamData : this.api.batchImportPersonalData"
:file-list="uploadList"
:headers="headers">
<el-button type="primary"
class="ml20">上传文件<i class="el-icon-upload2 el-icon--right"></i></el-button>
</el-upload>
<el-link v-if="uploadFaild"
type="primary"
@click="showFaild">部分数据导入失败查看失败原因</el-link>
</div>
<span slot="footer"
class="dialog-footer">
<el-button size="small"
@click="importVisible = false"> </el-button>
<el-button size="small"
type="primary"
@click="uploadSure"> </el-button>
</span>
</el-dialog>
</div>
</template>
@ -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

@ -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();

@ -715,14 +715,12 @@ export default {
this.getData();
},
delAllSelection () { //
if (this.multipleSelection.length) {
this.$confirm("确定要删除选中用户吗?", "提示", {
const len = this.multipleSelection.length
const list = len ? this.multipleSelection : this.listData
this.$confirm(len ? '确定要删除选中学生吗?' : '是否要删除当前列表所有学生?', '提示', {
type: "warning"
}).then(() => {
let ids = this.multipleSelection.map(item => {
return item.accountId;
});
this.$post(`${this.api.delStudent}?accountIds=${ids.toString()}`).then(res => {
this.$post(`${this.api.delStudent}?accountIds=${list.map(e => e.accountId).toString()}`).then(res => {
this.multipleSelection = [];
this.$refs.table.clearSelection();
util.successMsg("删除成功");
@ -731,16 +729,11 @@ export default {
} else {
this.getOrgStudentData();
}
}).catch(res => {
});
}).catch(res => { });
if (this.multipleSelection.length === this.listData.length && this.page > 1) {
this.handleCurrentChange(this.page - 1)
}
}).catch(() => {
});
} else {
util.errorMsg("请先选择数据 !");
this.currentChange(this.page - 1)
}
}).catch(() => { });
},
handleDelete (row) { //
this.$confirm("确定要删除吗?", "提示", {

@ -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`
}

Loading…
Cancel
Save