dev_2022-05-11
yujialong 3 years ago
parent 5b6ab91ffa
commit e84f049fe7
  1. 2
      src/pages/achievement/show/index.vue
  2. 7
      src/pages/achievement/teach/index.vue
  3. 30
      src/pages/match/manage/index.vue
  4. 175
      src/pages/match/manage/matchProgress.vue
  5. 4
      src/store/modules/match.js

@ -166,7 +166,7 @@ export default {
getData() { getData() {
if (this.type) { if (this.type) {
let data = { let data = {
recordId: this.id reportId: this.reportId
}; };
this.$get(this.api.experimentOverview, data).then(res => { this.$get(this.api.experimentOverview, data).then(res => {
this.form = res.report; this.form = res.report;

@ -114,8 +114,6 @@ export default {
}, },
created() { created() {
this.classList = JSON.parse(this.$route.query.classList); this.classList = JSON.parse(this.$route.query.classList);
// console.log(this.classList);
const activeName = sessionStorage.getItem('activeName') const activeName = sessionStorage.getItem('activeName')
if(activeName) { if(activeName) {
this.classId = activeName this.classId = activeName
@ -147,8 +145,9 @@ export default {
}, },
show(row) { // show(row) { //
if (this.permissions) { if (this.permissions) {
// row.recordId row.studentId // row.recordId row.studentId ???
this.$router.push(`show?id=${row.recordId}&projectId=${row.projectId}&reportId=${row.reportId}&studentId=${row.studentId}`); // this.$router.push(`show?id=${row.recordId}&projectId=${row.projectId}&reportId=${row.reportId}&studentId=${row.studentId}`);
this.$router.push(`show?reportId=${row.reportId}`);
} else { } else {
this.$router.push(`show?id=${row.recordId}&type=1`); this.$router.push(`show?id=${row.recordId}&type=1`);
} }

@ -8,7 +8,7 @@
</el-card> </el-card>
<div class="page" style="margin-bottom: 24px"> <div class="page" style="margin-bottom: 24px">
<div class="tabs"> <div class="tabs">
<a class="item" v-for="(item,index) in tabs" :key="index" :class="{active: index == active}" @click="tabChange(index)">{{ item }}</a> <a class="item" v-for="(item,index) in tabs" @waitChange="tabChangeWait()" :key="index" :class="{active: index == active}" @click="tabChange(index)">{{ item }}</a>
</div> </div>
<!-- 大赛详情 --> <!-- 大赛详情 -->
<MatchDetail v-if="active == 'first'" /> <MatchDetail v-if="active == 'first'" />
@ -51,7 +51,33 @@ export default {
this.$router.back(); this.$router.back();
}, },
tabChange(index) { tabChange(index) {
this.active = index; console.log('changewait?')
console.log(this.wait)
// this.active = index;
if(!this.wait) {
this.active = index;
}else {
sessionStorage.setItem('tabIndex', index)
}
},
tabChangeWait() {
tabChange(sessionStorage.setItem('tabIndex', index))
},
beforeLeave(newTab, oldTab) {
console.log(newTab)
console.log(oldTab)
// if(sessionStorage.getItem('wait')) {
// this.$confirm('?', '', {
// confirmButtonText: '',
// cancelButtonText: '',
// type: 'warning'
// })
// }
}
},
computed: {
wait() {
return this.$store.state.match.wait
} }
} }
}; };

@ -9,24 +9,25 @@
</el-table-column> </el-table-column>
<el-table-column prop="name" label="标题"> <el-table-column prop="name" label="标题">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input placeholder="请输入标题" v-model="scope.row.title"></el-input> <el-input placeholder="请输入标题" :disabled="!scope.row.operate" @blur="blur(scope.row)" @focus="focus()" v-model="scope.row.title"></el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="name" label="详情描述"> <el-table-column prop="name" label="详情描述">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input placeholder="请输入详情描述" type="textarea" v-model="scope.row.description"></el-input> <el-input placeholder="请输入详情描述" :disabled="!scope.row.operate" @blur="blur(scope.row)" @focus="focus()" type="textarea" v-model="scope.row.description"></el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="name" label="状态" width="150"> <el-table-column prop="name" label="状态" width="150">
<template slot-scope="scope"> <template slot-scope="scope">
<el-select v-model="scope.row.status" clearable placeholder="请选择状态"> <el-select v-model="scope.row.status" :disabled="!scope.row.operate" clearable placeholder="请选择状态">
<el-option v-for="(item,index) in statusList" :key="index" :label="item.name" :value="item.value"></el-option> <el-option v-for="(item,index) in statusList" :key="index" @blur="blur(scope.row)" @focus="focus()" :label="item.name" :value="item.value"></el-option>
</el-select> </el-select>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" width="170"> <el-table-column label="操作" align="center" width="170">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="saveData(scope.row)">保存</el-button> <el-button v-if="!scope.row.operate" type="text" @click="operateIt(scope.row)">编辑</el-button>
<el-button v-else type="text" @click="saveData(scope.row)">保存</el-button>
<el-button type="text" @click="handleDelete(scope.row)">删除</el-button> <el-button type="text" @click="handleDelete(scope.row)">删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
@ -44,6 +45,7 @@ export default {
name: "matchProgress", name: "matchProgress",
data() { data() {
return { return {
save: false,
id: this.$route.query.id, id: this.$route.query.id,
statusList: [ statusList: [
{ {
@ -65,19 +67,58 @@ export default {
pageSize: 10, pageSize: 10,
totals: 0, totals: 0,
touchTime:0, touchTime:0,
timeOut: {}
}; };
}, },
mounted() { mounted() {
this.getData(); this.getData();
console.log(this.listData)
}, },
methods: { methods: {
operateIt(row) {
this.$store.commit("match/setWait", true);
row.operate = true
},
blur(row) {
// if(this.save) {
// console.log('are you save?')
// }
this.timeOut = setTimeout(() => {
this.$confirm('暂未保存,是否保存本次编辑?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.saveData(row)
}).catch(() => {
this.$message({
type: 'success',
message: '已取消保存'
});
});
}, 500)
},
focus() {
clearInterval(this.timeOut)
// this.save = false
},
getData() { getData() {
this.$get(`${this.api.getContestProgress}/${this.id}`).then(res => { this.$get(`${this.api.getContestProgress}/${this.id}`).then(res => {
this.listData = res.contestProgressList; this.listData = res.contestProgressList;
for(let index=0; index<this.listData.length; index++) {
//
this.$set(this.listData, index, { operate: false, ...this.listData[index]})
}
console.log(this.listData)
}).catch(res => { }).catch(res => {
}); });
}, },
saveData(row) { saveData(row) {
//
this.$store.commit("match/setWait", false);
let data = row; let data = row;
if (data.title.length) { if (data.title.length) {
if (row.id) { if (row.id) {
@ -132,7 +173,8 @@ export default {
id: "", id: "",
title: "", title: "",
description: "", description: "",
status: 0 status: 0,
operate: true
}); });
console.log(this.listData) console.log(this.listData)
} else { } else {
@ -144,53 +186,108 @@ export default {
id: "", id: "",
title: "", title: "",
description: "", description: "",
status: 0 status: 1, // status1
operate: true
}); });
} }
}, },
}, waitSave() {
beforeDestroy() { if(this.hasEdit) {
if (this.touchTime>0){ this.$confirm('暂未保存,是否保存本次编辑?', '提示', {
this.$confirm('暂未保存,是否保存本次编辑?', '提示', { confirmButtonText: '确定',
confirmButtonText: '确定', cancelButtonText: '取消',
cancelButtonText: '取消', type: 'warning'
type: 'warning' }).then(() => {
}).then(() => { let num = 0;
let num = 0; for(var i=0;i<this.listData.length;i++){
for(var i=0;i<this.listData.length;i++){ let data = this.listData[i];
let data = this.listData[i]; if (data.title) {
if (data.title) { if (this.listData[i].id) {
if (this.listData[i].id) { this.$put(this.api.editContestProgress, data).then(res => {
this.$put(this.api.editContestProgress, data).then(res => {
}).catch(res => { }).catch(res => {
}); });
}else{
num = num+1
}
}else{ }else{
num = num+1 num = num+1
} }
}
if (num >0){
this.$message({
type: 'error',
message: '保存失败,有未填项目'
});
}else{ }else{
num = num+1 this.$message({
type: 'success',
message: '保存成功!'
});
} }
} this.$store.commit("match/setWait", false);
if (num >0){ this.$emit('waitChange')
}).catch(() => {
this.$message({ this.$message({
type: 'error', type: 'info',
message: '保存失败,有未填项目' message: '已取消保存'
}); });
}else{ this.$store.commit("match/setWait", false);
this.$message({ this.$emit('waitChange')
type: 'success',
message: '保存成功!'
});
}
}).catch(() => {
this.$message({
type: 'info',
message: '已取消保存'
}); });
}); }
} }
}, },
computed: {
hasEdit() {
const judge = this.listData.some(item => item.operate)
return judge
}
},
beforeDestroy() {
// if (this.touchTime>0){
// if (this.hasEdit){
// this.$confirm('?', '', {
// confirmButtonText: '',
// cancelButtonText: '',
// type: 'warning'
// }).then(() => {
// let num = 0;
// for(var i=0;i<this.listData.length;i++){
// let data = this.listData[i];
// if (data.title) {
// if (this.listData[i].id) {
// this.$put(this.api.editContestProgress, data).then(res => {
// }).catch(res => {
// });
// }else{
// num = num+1
// }
// }else{
// num = num+1
// }
// }
// if (num >0){
// this.$message({
// type: 'error',
// message: ''
// });
// }else{
// this.$message({
// type: 'success',
// message: '!'
// });
// }
// }).catch(() => {
// this.$message({
// type: 'info',
// message: ''
// });
// });
// }
},
}; };
</script> </script>

@ -5,10 +5,14 @@ export default {
namespaced: true, namespaced: true,
state: { state: {
matchId: "", matchId: "",
wait: false
}, },
mutations: { mutations: {
SET_MATCH_ID: (state, id) => { SET_MATCH_ID: (state, id) => {
state.matchId = id; state.matchId = id;
},
setWait: (state, wait) => {
state.wait = wait;
} }
}, },
actions: { actions: {

Loading…
Cancel
Save