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() {
if (this.type) {
let data = {
recordId: this.id
reportId: this.reportId
};
this.$get(this.api.experimentOverview, data).then(res => {
this.form = res.report;

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

@ -8,7 +8,7 @@
</el-card>
<div class="page" style="margin-bottom: 24px">
<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>
<!-- 大赛详情 -->
<MatchDetail v-if="active == 'first'" />
@ -51,7 +51,33 @@ export default {
this.$router.back();
},
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 prop="name" label="标题">
<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>
</el-table-column>
<el-table-column prop="name" label="详情描述">
<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>
</el-table-column>
<el-table-column prop="name" label="状态" width="150">
<template slot-scope="scope">
<el-select v-model="scope.row.status" clearable placeholder="请选择状态">
<el-option v-for="(item,index) in statusList" :key="index" :label="item.name" :value="item.value"></el-option>
<el-select v-model="scope.row.status" :disabled="!scope.row.operate" clearable placeholder="请选择状态">
<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>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="170">
<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>
</template>
</el-table-column>
@ -44,6 +45,7 @@ export default {
name: "matchProgress",
data() {
return {
save: false,
id: this.$route.query.id,
statusList: [
{
@ -65,19 +67,58 @@ export default {
pageSize: 10,
totals: 0,
touchTime:0,
timeOut: {}
};
},
mounted() {
this.getData();
console.log(this.listData)
},
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() {
this.$get(`${this.api.getContestProgress}/${this.id}`).then(res => {
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 => {
});
},
saveData(row) {
//
this.$store.commit("match/setWait", false);
let data = row;
if (data.title.length) {
if (row.id) {
@ -132,7 +173,8 @@ export default {
id: "",
title: "",
description: "",
status: 0
status: 0,
operate: true
});
console.log(this.listData)
} else {
@ -144,53 +186,108 @@ export default {
id: "",
title: "",
description: "",
status: 0
status: 1, // status1
operate: true
});
}
},
},
beforeDestroy() {
if (this.touchTime>0){
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 => {
waitSave() {
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 => {
});
}).catch(res => {
});
}else{
num = num+1
}
}else{
num = num+1
}
}
if (num >0){
this.$message({
type: 'error',
message: '保存失败,有未填项目'
});
}else{
num = num+1
this.$message({
type: 'success',
message: '保存成功!'
});
}
}
if (num >0){
this.$store.commit("match/setWait", false);
this.$emit('waitChange')
}).catch(() => {
this.$message({
type: 'error',
message: '保存失败,有未填项目'
type: 'info',
message: '已取消保存'
});
}else{
this.$message({
type: 'success',
message: '保存成功!'
});
}
}).catch(() => {
this.$message({
type: 'info',
message: '已取消保存'
this.$store.commit("match/setWait", false);
this.$emit('waitChange')
});
});
}
}
},
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>

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

Loading…
Cancel
Save