|
@@ -27,10 +27,10 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- <div class="part-box part-box-pad mb-0">
|
|
|
+ <div class="part-box part-box-pad structure-body">
|
|
|
<div class="box-justify mb-2">
|
|
|
<div>
|
|
|
- <el-button v-if="structureEditable" type="primary" @click="toAddMain"
|
|
|
+ <el-button v-if="editOpen" type="primary" @click="toAddMain"
|
|
|
>新增大题</el-button
|
|
|
>
|
|
|
</div>
|
|
@@ -45,6 +45,7 @@
|
|
|
border
|
|
|
:row-class-name="getRowClassName"
|
|
|
:key="tableKey"
|
|
|
+ :height="tableHeight"
|
|
|
>
|
|
|
<el-table-column width="50" align="center">
|
|
|
<template slot-scope="scope" v-if="scope.row.mainFirstSub">
|
|
@@ -61,7 +62,7 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <template v-if="structureEditable">
|
|
|
+ <template v-if="editOpen">
|
|
|
<el-table-column prop="mainTitle" label="大题名称">
|
|
|
<span slot-scope="scope" v-if="scope.row.mainFirstSub">
|
|
|
<el-input
|
|
@@ -230,7 +231,7 @@
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
- v-if="structureEditable"
|
|
|
+ v-if="editOpen"
|
|
|
class-name="action-column"
|
|
|
label="操作"
|
|
|
width="140px"
|
|
@@ -293,12 +294,12 @@ export default {
|
|
|
editOpen: false,
|
|
|
tableKey: "",
|
|
|
hasMarkerQuestions: [],
|
|
|
+ tableHeight: 200,
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
...mapState("markParam", [
|
|
|
"basicInfo",
|
|
|
- "structureCanEdit",
|
|
|
"paperStructureInfo",
|
|
|
"subjectiveTaskList",
|
|
|
]),
|
|
@@ -326,23 +327,21 @@ export default {
|
|
|
objectiveQuestionCount: questionCount - subjectiveQuestionCount,
|
|
|
};
|
|
|
},
|
|
|
- structureEditable() {
|
|
|
- return this.structureCanEdit || this.editOpen;
|
|
|
- },
|
|
|
},
|
|
|
watch: {
|
|
|
- structureEditable() {
|
|
|
+ editOpen() {
|
|
|
this.tableKey = this.$randomCode();
|
|
|
+ this.updateTableHeight();
|
|
|
},
|
|
|
},
|
|
|
mounted() {
|
|
|
this.initData();
|
|
|
+ this.registResize();
|
|
|
},
|
|
|
methods: {
|
|
|
...mapMutations("markParam", ["setPaperStructureInfo"]),
|
|
|
initData() {
|
|
|
this.tableKey = this.$randomCode();
|
|
|
- this.editOpen = this.structureCanEdit;
|
|
|
this.hasMarkerQuestions = this.subjectiveTaskList
|
|
|
.filter((item) => item.markers.length)
|
|
|
.map((item) => `${item.mainNumber}-${item.subNumber}`);
|
|
@@ -384,10 +383,12 @@ export default {
|
|
|
this.scoresPerTopic = scoresPerTopic;
|
|
|
this.intervalScorePerTopic = intervalScorePerTopic;
|
|
|
|
|
|
- if (!this.tableData.length && this.structureEditable) {
|
|
|
+ if (!this.tableData.length && this.editOpen) {
|
|
|
this.createMain();
|
|
|
}
|
|
|
this.cacheDataMd5 = this.getSubmitDataMd5();
|
|
|
+
|
|
|
+ this.updateTableHeight();
|
|
|
},
|
|
|
getSubmitDataMd5() {
|
|
|
return MD5(JSON.stringify(this.getData()));
|
|
@@ -690,6 +691,21 @@ export default {
|
|
|
}
|
|
|
this.$emit("next", step);
|
|
|
},
|
|
|
+ // table height
|
|
|
+ updateTableHeight() {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ if (!this.$refs.TableList) return;
|
|
|
+ const tableOffsetTop = this.$refs.TableList.$el.offsetTop;
|
|
|
+ this.tableHeight = window.innerHeight - tableOffsetTop - 115;
|
|
|
+ // console.log(this.tableHeight);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ registResize() {
|
|
|
+ window.addEventListener("resize", this.updateTableHeight);
|
|
|
+ },
|
|
|
+ },
|
|
|
+ beforeDestroy() {
|
|
|
+ window.removeEventListener("resize", this.updateTableHeight);
|
|
|
},
|
|
|
};
|
|
|
</script>
|