dev_2022-05-11
luoJunYong.123 3 years ago
parent 82fb4e6514
commit c5908e81bf
  1. 2
      src/pages/match/manage/index.vue
  2. 28
      src/pages/match/manage/matchDetail.vue
  3. 56
      src/pages/match/manage/matchProgress.vue

@ -62,7 +62,7 @@ export default {
if(!(this.wait !== 999)) {
this.active = index;
}else {
EventBus.$emit("tabClickWait", this.wait);
EventBus.$emit(`tabClickWait${this.wait}`, );
this.$store.commit("match/setWait", 999);
}
},

@ -1,6 +1,6 @@
<template>
<!-- 大赛详情 -->
<div style="padding: 24px">
<div style="padding: 24px" @click="test">
<div class="page-content">
<el-form label-width="170px" label-suffix=":" size="small">
<el-form-item label="竞赛封面(选填)">
@ -107,6 +107,7 @@ import quill from "@/components/quill";
import util from "@/libs/util";
import Setting from "@/setting";
import { mapActions } from "vuex";
import EventBus from "@/libs/bus.js";
export default {
name: "matchDetail",
@ -136,6 +137,8 @@ export default {
touchTime:0,
};
},
created() {
},
components: {
quill
},
@ -162,11 +165,34 @@ export default {
mounted() {
this.getData();
this.commitId();
EventBus.$on("tabClickWait0", () => this.waitSave());
},
methods: {
test() {
this.$store.commit("match/setWait", 0);
// console.log(this.$store.state.match.waitIndex)
console.log('testClick')
},
...mapActions("match", [
"setMatchId"
]),
waitSave() {
this.$confirm('暂未保存,是否保存本次编辑?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.save(1)
EventBus.$emit('tabChangeWait', this.$store.state.match.waitIndex)
}).catch(() => {
this.$message({
type: 'success',
message: '已取消保存'
});
EventBus.$emit('tabChangeWait', this.$store.state.match.waitIndex)
});
},
save(status) {
this.touchTime = 0
this.sponsor = this.sponsorList.filter(d => d).join();

@ -28,7 +28,7 @@
<template slot-scope="scope">
<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, scope.$index)">删除</el-button>
</template>
</el-table-column>
</el-table>
@ -74,39 +74,13 @@ export default {
mounted() {
this.getData();
console.log(this.listData)
EventBus.$on("tabClickWait", () => this.waitSave());
EventBus.$on("tabClickWait1", () => this.waitSave());
},
methods: {
operateIt(row) {
this.$store.commit("match/setWait", 1);
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;
@ -152,20 +126,29 @@ export default {
this.pageNo = val;
this.getData();
},
handleDelete(row) {
handleDelete(row, index) {
this.$confirm("此删除操作不可逆,是否确认删除选中项?", "提示", {
type: "warning"
}).then(() => {
this.touchTime = this.touchTime+1
this.$del(`${this.api.deleteContestProgress}/${row.id}`).then(res => {
if(row.id === "") {
this.listData.splice(index, 1)
util.successMsg("删除成功");
this.getData();
}).catch(res => {
});
console.log(this.listData)
console.log(this.hasEdit)
}else {
this.touchTime = this.touchTime+1
this.$del(`${this.api.deleteContestProgress}/${row.id}`).then(res => {
util.successMsg("删除成功");
this.getData();
}).catch(res => {
});
}
}).catch(() => {
});
},
addData() {
// this.$store.commit("match/setWait", 1);
this.touchTime = this.touchTime+1
if (this.listData.length) {
if (this.listData[this.listData.length - 1].id) {
@ -177,7 +160,7 @@ export default {
status: 0,
operate: true
});
console.log(this.listData)
this.operateIt(this.listData[this.listData.length - 1])
} else {
util.warningMsg("请先保存新数据");
}
@ -240,8 +223,7 @@ export default {
},
computed: {
hasEdit() {
const judge = this.listData.some(item => item.operate)
return judge
return this.listData.some(item => item.operate)
}
},
beforeDestroy() {

Loading…
Cancel
Save