|
@@ -5,6 +5,7 @@
|
|
|
<el-button
|
|
|
v-if="baseInfo.useExamCloudStruct"
|
|
|
type="primary"
|
|
|
+ :loading="updating"
|
|
|
@click="toUpdateExamCloudStruct"
|
|
|
>更新试卷结构</el-button
|
|
|
>
|
|
@@ -91,9 +92,13 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { mapState, mapActions } from "vuex";
|
|
|
+import { mapState, mapMutations, mapActions } from "vuex";
|
|
|
import ImportFile from "@/components/ImportFile";
|
|
|
-import { updatePaperStruct, paperStructExport } from "../../api";
|
|
|
+import {
|
|
|
+ updatePaperStruct,
|
|
|
+ paperStructExport,
|
|
|
+ syncPaperStruct
|
|
|
+} from "../../api";
|
|
|
import { downloadByApi } from "@/plugins/download";
|
|
|
|
|
|
export default {
|
|
@@ -105,6 +110,7 @@ export default {
|
|
|
knowledgeList: [],
|
|
|
abilityList: [],
|
|
|
loading: false,
|
|
|
+ updating: false,
|
|
|
// upload
|
|
|
uploadUrl: "/api/admin/grade/paper/struct/import",
|
|
|
uploadData: {},
|
|
@@ -119,6 +125,7 @@ export default {
|
|
|
this.initData();
|
|
|
},
|
|
|
methods: {
|
|
|
+ ...mapMutations("baseConfigs", ["setBaseInfo"]),
|
|
|
...mapActions("baseConfigs", ["fetchStructList"]),
|
|
|
initDimensions() {
|
|
|
this.knowledgeList = this.dimensionList
|
|
@@ -171,6 +178,17 @@ export default {
|
|
|
this.$refs.ImportFile.open();
|
|
|
},
|
|
|
async toUpdateExamCloudStruct() {
|
|
|
+ if (this.updating) return;
|
|
|
+ this.updating = true;
|
|
|
+
|
|
|
+ const res = await syncPaperStruct({
|
|
|
+ paperNumber: this.baseInfo.paperNumber,
|
|
|
+ paperType: this.baseInfo.paperType
|
|
|
+ }).catch(() => {});
|
|
|
+ this.updating = false;
|
|
|
+ if (!res) return;
|
|
|
+
|
|
|
+ this.setBaseInfo({ ...this.baseInfo, useExamCloudStruct: false });
|
|
|
await this.fetchStructList();
|
|
|
this.initData();
|
|
|
},
|