|
@@ -1,17 +1,17 @@
|
|
|
<template>
|
|
|
<div class="question-group-struct">
|
|
|
<div class="struct-set">
|
|
|
- <el-checkbox v-model="isClassify" @change="setChange"
|
|
|
+ <el-checkbox v-model="useClassify" @change="setChange"
|
|
|
>指定文件夹抽题</el-checkbox
|
|
|
>
|
|
|
- <el-checkbox v-model="isDifficult" @change="setChange"
|
|
|
+ <el-checkbox v-model="useDifficult" @change="setChange"
|
|
|
>按难度抽题</el-checkbox
|
|
|
>
|
|
|
- <el-checkbox v-model="isProperty" @change="setChange"
|
|
|
+ <el-checkbox v-model="useProperty" @change="setChange"
|
|
|
>按课程属性抽题</el-checkbox
|
|
|
>
|
|
|
<el-select
|
|
|
- v-if="isProperty"
|
|
|
+ v-if="useProperty"
|
|
|
v-model="curCoursePropertyId"
|
|
|
class="margin-left-10"
|
|
|
size="small"
|
|
@@ -24,8 +24,8 @@
|
|
|
></el-option>
|
|
|
</el-select>
|
|
|
</div>
|
|
|
- <div v-if="!IS_NONE_SET" class="struct-box">
|
|
|
- <div v-if="isClassify" class="struct-folder">
|
|
|
+ <div v-if="!USE_NONE_SET" class="struct-box">
|
|
|
+ <div v-if="useClassify" class="struct-folder">
|
|
|
<el-tree
|
|
|
ref="folderTree"
|
|
|
class="folder-tree"
|
|
@@ -58,7 +58,7 @@
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
- v-if="!isDifficult || IS_ONLY_DIFFICULT"
|
|
|
+ v-if="!useDifficult || USE_ONLY_DIFFICULT"
|
|
|
label="数量"
|
|
|
width="150"
|
|
|
>
|
|
@@ -86,7 +86,7 @@
|
|
|
<template
|
|
|
v-if="
|
|
|
scope.row.difficultDistributeInfo &&
|
|
|
- !(scope.row.isClassify && isProperty)
|
|
|
+ !(scope.row.useClassify && useProperty)
|
|
|
"
|
|
|
slot-scope="scope"
|
|
|
>
|
|
@@ -117,6 +117,7 @@
|
|
|
<script>
|
|
|
import folderTree from "../datas/folderTree.json";
|
|
|
import { questionGroupStructListApi } from "../api";
|
|
|
+import { deepCopy } from "@/plugins/utils";
|
|
|
|
|
|
export default {
|
|
|
name: "QuestionGroupStruct",
|
|
@@ -133,9 +134,9 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
- isClassify: false,
|
|
|
- isDifficult: false,
|
|
|
- isProperty: false,
|
|
|
+ useClassify: false,
|
|
|
+ useDifficult: false,
|
|
|
+ useProperty: false,
|
|
|
checkedSet: [],
|
|
|
selectedFolderIds: [],
|
|
|
classifyTree: folderTree,
|
|
@@ -156,14 +157,14 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
- IS_ONLY_DIFFICULT() {
|
|
|
- return !this.isClassify && this.isDifficult && !this.isProperty;
|
|
|
+ USE_ONLY_DIFFICULT() {
|
|
|
+ return !this.useClassify && this.useDifficult && !this.useProperty;
|
|
|
},
|
|
|
- IS_ONLY_PROPERTY() {
|
|
|
- return !this.isClassify && !this.isDifficult && this.isProperty;
|
|
|
+ USE_ONLY_PROPERTY() {
|
|
|
+ return !this.useClassify && !this.useDifficult && this.useProperty;
|
|
|
},
|
|
|
- IS_NONE_SET() {
|
|
|
- return !this.isClassify && !this.isDifficult && !this.isProperty;
|
|
|
+ USE_NONE_SET() {
|
|
|
+ return !this.useClassify && !this.useDifficult && !this.useProperty;
|
|
|
},
|
|
|
},
|
|
|
watch: {
|
|
@@ -180,7 +181,7 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
setChange() {
|
|
|
- if (!this.isClassify) this.selectedFolderIds = [];
|
|
|
+ if (!this.useClassify) this.selectedFolderIds = [];
|
|
|
this.resetDataList();
|
|
|
},
|
|
|
checkChange() {
|
|
@@ -190,29 +191,29 @@ export default {
|
|
|
async resetDataList() {
|
|
|
await this.getOriginList();
|
|
|
|
|
|
- if (this.isProperty) {
|
|
|
+ if (this.useProperty) {
|
|
|
this.parsePropertyInfo();
|
|
|
}
|
|
|
this.buildDataList();
|
|
|
},
|
|
|
async getOriginList() {
|
|
|
- if (this.isClassify && !this.selectedFolderIds.length) {
|
|
|
+ if (this.useClassify && !this.selectedFolderIds.length) {
|
|
|
this.$message.error("请选择选择文件夹!");
|
|
|
return;
|
|
|
}
|
|
|
let data = {
|
|
|
...this.filterData,
|
|
|
- isDifficult: this.isDifficult,
|
|
|
- isProperty: this.isProperty,
|
|
|
+ useDifficult: this.useDifficult,
|
|
|
+ useProperty: this.useProperty,
|
|
|
};
|
|
|
- if (this.isClassify && this.selectedFolderIds.length)
|
|
|
+ if (this.useClassify && this.selectedFolderIds.length)
|
|
|
data.classifyIdList = this.selectedFolderIds.join();
|
|
|
|
|
|
const res = await questionGroupStructListApi(data);
|
|
|
this.originList = res.data || [];
|
|
|
},
|
|
|
parsePropertyInfo() {
|
|
|
- if (!this.isProperty) {
|
|
|
+ if (!this.useProperty) {
|
|
|
this.propertyInfo = [];
|
|
|
return;
|
|
|
}
|
|
@@ -266,10 +267,13 @@ export default {
|
|
|
data.difficultDistributeInfo
|
|
|
);
|
|
|
}
|
|
|
- if (!data.propertyDistributeInfo || !data.propertyDistributeInfo.length)
|
|
|
+ if (
|
|
|
+ !data.coursePropertyDistributeInfo ||
|
|
|
+ !data.coursePropertyDistributeInfo.length
|
|
|
+ )
|
|
|
return classifyData;
|
|
|
|
|
|
- const curCourseProp = data.propertyDistributeInfo.find(
|
|
|
+ const curCourseProp = data.coursePropertyDistributeInfo.find(
|
|
|
(item) => item.coursePropertyId === _this.curCoursePropertyId
|
|
|
);
|
|
|
if (!curCourseProp) {
|
|
@@ -325,27 +329,63 @@ export default {
|
|
|
this.dataList = this.originList.map((item) => buildClassifyData(item));
|
|
|
this.tableData = this.dataList;
|
|
|
|
|
|
- if (this.IS_ONLY_DIFFICULT) {
|
|
|
+ if (this.USE_ONLY_DIFFICULT) {
|
|
|
this.tableData = this.dataList[0].difficultDistributeInfo;
|
|
|
this.tableData.map((item) => {
|
|
|
let nitem = { ...item };
|
|
|
- (item.id = item.difficultLevel), (item.name = item.difficultLevel);
|
|
|
+ nitem.id = item.difficultLevel;
|
|
|
+ nitem.name = item.difficultLevel;
|
|
|
return nitem;
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
- if (this.isClassify && !this.isProperty) {
|
|
|
+ if (this.useClassify && !this.useProperty) {
|
|
|
this.tableData = this.dataList.map((item) => {
|
|
|
let nitem = { ...item };
|
|
|
- nitem.propertyDistributeInfo = [];
|
|
|
+ nitem.propertyDistributeInfo = null;
|
|
|
return nitem;
|
|
|
});
|
|
|
}
|
|
|
- if (!this.isClassify && this.isProperty) {
|
|
|
+ if (!this.useClassify && this.useProperty) {
|
|
|
this.tableData = this.dataList[0].propertyDistributeInfo;
|
|
|
return;
|
|
|
}
|
|
|
},
|
|
|
+ getDataList() {
|
|
|
+ let dataList = deepCopy(this.dataList);
|
|
|
+
|
|
|
+ if (this.USE_ONLY_DIFFICULT) {
|
|
|
+ dataList[0].difficultDistributeInfo = this.tableData.map((item) => {
|
|
|
+ return {
|
|
|
+ difficultLevel: item.difficultLevel,
|
|
|
+ questionCount: item.questionCount,
|
|
|
+ selectCount: item.selectCount,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ return dataList;
|
|
|
+ } else if (this.useClassify && !this.useProperty) {
|
|
|
+ dataList = deepCopy(this.tableData);
|
|
|
+ return dataList;
|
|
|
+ } else if (!this.useClassify && this.useProperty) {
|
|
|
+ dataList[0].propertyDistributeInfo = this.tableData;
|
|
|
+ }
|
|
|
+
|
|
|
+ const curCourseProp = this.propertyInfo.find(
|
|
|
+ (item) => item.id === this.curCoursePropertyId
|
|
|
+ );
|
|
|
+ dataList = dataList.map((item) => {
|
|
|
+ item.coursePropertyDistributeInfo = [
|
|
|
+ {
|
|
|
+ coursePropertyId: curCourseProp.id,
|
|
|
+ coursePropertyName: curCourseProp.name,
|
|
|
+ propertyDistributeInfo: item.propertyDistributeInfo,
|
|
|
+ },
|
|
|
+ ];
|
|
|
+ return item;
|
|
|
+ });
|
|
|
+
|
|
|
+ return dataList;
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|