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)) { if(!(this.wait !== 999)) {
this.active = index; this.active = index;
}else { }else {
EventBus.$emit("tabClickWait", this.wait); EventBus.$emit(`tabClickWait${this.wait}`, );
this.$store.commit("match/setWait", 999); this.$store.commit("match/setWait", 999);
} }
}, },

@ -1,6 +1,6 @@
<template> <template>
<!-- 大赛详情 --> <!-- 大赛详情 -->
<div style="padding: 24px"> <div style="padding: 24px" @click="test">
<div class="page-content"> <div class="page-content">
<el-form label-width="170px" label-suffix=":" size="small"> <el-form label-width="170px" label-suffix=":" size="small">
<el-form-item label="竞赛封面(选填)"> <el-form-item label="竞赛封面(选填)">
@ -107,6 +107,7 @@ import quill from "@/components/quill";
import util from "@/libs/util"; import util from "@/libs/util";
import Setting from "@/setting"; import Setting from "@/setting";
import { mapActions } from "vuex"; import { mapActions } from "vuex";
import EventBus from "@/libs/bus.js";
export default { export default {
name: "matchDetail", name: "matchDetail",
@ -136,6 +137,8 @@ export default {
touchTime:0, touchTime:0,
}; };
}, },
created() {
},
components: { components: {
quill quill
}, },
@ -162,11 +165,34 @@ export default {
mounted() { mounted() {
this.getData(); this.getData();
this.commitId(); this.commitId();
EventBus.$on("tabClickWait0", () => this.waitSave());
}, },
methods: { methods: {
test() {
this.$store.commit("match/setWait", 0);
// console.log(this.$store.state.match.waitIndex)
console.log('testClick')
},
...mapActions("match", [ ...mapActions("match", [
"setMatchId" "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) { save(status) {
this.touchTime = 0 this.touchTime = 0
this.sponsor = this.sponsorList.filter(d => d).join(); this.sponsor = this.sponsorList.filter(d => d).join();

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

Loading…
Cancel
Save