|
@@ -8,17 +8,31 @@
|
|
>按难度抽题</el-checkbox
|
|
>按难度抽题</el-checkbox
|
|
>
|
|
>
|
|
<el-checkbox v-model="isProperty" @change="setChange"
|
|
<el-checkbox v-model="isProperty" @change="setChange"
|
|
- >按课程抽题</el-checkbox
|
|
|
|
|
|
+ >按课程属性抽题</el-checkbox
|
|
>
|
|
>
|
|
|
|
+ <el-select
|
|
|
|
+ v-if="isProperty"
|
|
|
|
+ v-model="curCoursePropertyId"
|
|
|
|
+ class="margin-left-10"
|
|
|
|
+ size="small"
|
|
|
|
+ >
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="item in propertyInfo"
|
|
|
|
+ :key="item.id"
|
|
|
|
+ :label="item.name"
|
|
|
|
+ :value="item.id"
|
|
|
|
+ ></el-option>
|
|
|
|
+ </el-select>
|
|
</div>
|
|
</div>
|
|
<div class="struct-box">
|
|
<div class="struct-box">
|
|
- <div class="struct-folder">
|
|
|
|
|
|
+ <div v-if="isClassify" class="struct-folder">
|
|
<el-tree
|
|
<el-tree
|
|
class="folder-tree"
|
|
class="folder-tree"
|
|
:data="folderTree"
|
|
:data="folderTree"
|
|
node-key="id"
|
|
node-key="id"
|
|
default-expand-all
|
|
default-expand-all
|
|
:expand-on-click-node="false"
|
|
:expand-on-click-node="false"
|
|
|
|
+ check-on-click-node
|
|
show-checkbox
|
|
show-checkbox
|
|
check-strictly
|
|
check-strictly
|
|
:props="treeProps"
|
|
:props="treeProps"
|
|
@@ -26,20 +40,32 @@
|
|
></el-tree>
|
|
></el-tree>
|
|
</div>
|
|
</div>
|
|
<div class="struct-prop">
|
|
<div class="struct-prop">
|
|
- <el-table :data="tableData" :tree-props="tableTreeProps" row-key="id">
|
|
|
|
- <el-table-column label="分类" prop="name"></el-table-column>
|
|
|
|
|
|
+ <el-table
|
|
|
|
+ :data="tableData"
|
|
|
|
+ :tree-props="tableTreeProps"
|
|
|
|
+ row-key="id"
|
|
|
|
+ border
|
|
|
|
+ >
|
|
|
|
+ <el-table-column label="分类" prop="name">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <i
|
|
|
|
+ v-if="scope.row.isClassify"
|
|
|
|
+ class="icon icon-files-act margin-right-5"
|
|
|
|
+ ></i>
|
|
|
|
+ <span class="inline-middle">{{ scope.row.name }}</span>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
<el-table-column
|
|
<el-table-column
|
|
- v-if="!isDifficult"
|
|
|
|
|
|
+ v-if="!isDifficult || IS_ONLY_DIFFICULT"
|
|
label="数量"
|
|
label="数量"
|
|
- width="200"
|
|
|
|
- align="center"
|
|
|
|
|
|
+ width="150"
|
|
>
|
|
>
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
<el-input-number
|
|
<el-input-number
|
|
v-model="scope.row.selectCount"
|
|
v-model="scope.row.selectCount"
|
|
- class="search_width_80px"
|
|
|
|
|
|
+ size="mini"
|
|
:step="1"
|
|
:step="1"
|
|
- :min="1"
|
|
|
|
|
|
+ :min="0"
|
|
:max="scope.row.questionCount"
|
|
:max="scope.row.questionCount"
|
|
:controls="false"
|
|
:controls="false"
|
|
:precision="0"
|
|
:precision="0"
|
|
@@ -53,13 +79,20 @@
|
|
v-else
|
|
v-else
|
|
:key="dindex"
|
|
:key="dindex"
|
|
:label="dinfo"
|
|
:label="dinfo"
|
|
|
|
+ width="150"
|
|
>
|
|
>
|
|
- <template slot-scope="scope">
|
|
|
|
|
|
+ <template
|
|
|
|
+ v-if="
|
|
|
|
+ scope.row.difficultDistributeInfo &&
|
|
|
|
+ !(scope.row.isClassify && isProperty)
|
|
|
|
+ "
|
|
|
|
+ slot-scope="scope"
|
|
|
|
+ >
|
|
<el-input-number
|
|
<el-input-number
|
|
v-model="scope.row.difficultDistributeInfo[dindex].selectCount"
|
|
v-model="scope.row.difficultDistributeInfo[dindex].selectCount"
|
|
- class="search_width_80px"
|
|
|
|
|
|
+ size="mini"
|
|
:step="1"
|
|
:step="1"
|
|
- :min="1"
|
|
|
|
|
|
+ :min="0"
|
|
:max="scope.row.difficultDistributeInfo[dindex].questionCount"
|
|
:max="scope.row.difficultDistributeInfo[dindex].questionCount"
|
|
:controls="false"
|
|
:controls="false"
|
|
:precision="0"
|
|
:precision="0"
|
|
@@ -116,13 +149,11 @@ export default {
|
|
hasChildren: "hasChildren",
|
|
hasChildren: "hasChildren",
|
|
},
|
|
},
|
|
difficultDistributeInfo: [],
|
|
difficultDistributeInfo: [],
|
|
- curCoursePropertyName: "",
|
|
|
|
|
|
+ curCoursePropertyId: "",
|
|
|
|
+ propertyInfo: [],
|
|
};
|
|
};
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
- IS_ONLY_FOLDER() {
|
|
|
|
- return this.isClassify && !this.isDifficult && !this.isProperty;
|
|
|
|
- },
|
|
|
|
IS_ONLY_DIFFICULT() {
|
|
IS_ONLY_DIFFICULT() {
|
|
return !this.isClassify && this.isDifficult && !this.isProperty;
|
|
return !this.isClassify && this.isDifficult && !this.isProperty;
|
|
},
|
|
},
|
|
@@ -139,6 +170,9 @@ export default {
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
|
|
+ mounted() {
|
|
|
|
+ this.resetDataList();
|
|
|
|
+ },
|
|
methods: {
|
|
methods: {
|
|
setChange() {
|
|
setChange() {
|
|
if (!this.isClassify) this.selectedFolderIds = [];
|
|
if (!this.isClassify) this.selectedFolderIds = [];
|
|
@@ -152,21 +186,15 @@ export default {
|
|
await this.getOriginList();
|
|
await this.getOriginList();
|
|
|
|
|
|
if (this.isProperty) {
|
|
if (this.isProperty) {
|
|
- const curCourseProp = this.originList.find(
|
|
|
|
- (item) => item.coursePropertyName === this.curCoursePropertyName
|
|
|
|
- );
|
|
|
|
- if (!curCourseProp) {
|
|
|
|
- this.curCoursePropertyName =
|
|
|
|
- this.originList[0] && this.originList[0].coursePropertyName;
|
|
|
|
- }
|
|
|
|
|
|
+ this.parsePropertyInfo();
|
|
}
|
|
}
|
|
this.buildDataList();
|
|
this.buildDataList();
|
|
},
|
|
},
|
|
async getOriginList() {
|
|
async getOriginList() {
|
|
let data = {
|
|
let data = {
|
|
...this.filterData,
|
|
...this.filterData,
|
|
- difficult: this.isDifficult,
|
|
|
|
- property: this.isProperty,
|
|
|
|
|
|
+ isDifficult: this.isDifficult,
|
|
|
|
+ isProperty: this.isProperty,
|
|
};
|
|
};
|
|
if (this.isClassify && this.selectedFolderIds.length)
|
|
if (this.isClassify && this.selectedFolderIds.length)
|
|
data.folderIds = this.selectedFolderIds;
|
|
data.folderIds = this.selectedFolderIds;
|
|
@@ -174,14 +202,49 @@ export default {
|
|
const res = await questionGroupStructListApi(data);
|
|
const res = await questionGroupStructListApi(data);
|
|
this.originList = res.data || [];
|
|
this.originList = res.data || [];
|
|
},
|
|
},
|
|
|
|
+ parsePropertyInfo() {
|
|
|
|
+ if (!this.isProperty) {
|
|
|
|
+ this.propertyInfo = [];
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ let coursePropertyIds = [],
|
|
|
|
+ propertyInfo = [];
|
|
|
|
+ this.originList.forEach((item) => {
|
|
|
|
+ if (!item.propertyDistributeInfo || !item.propertyDistributeInfo.length)
|
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
+ item.propertyDistributeInfo.forEach((prop) => {
|
|
|
|
+ if (coursePropertyIds.includes(prop.coursePropertyId)) return;
|
|
|
|
+ coursePropertyIds.push(prop.coursePropertyId);
|
|
|
|
+ propertyInfo.push({
|
|
|
|
+ id: prop.coursePropertyId,
|
|
|
|
+ name: prop.coursePropertyName,
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ this.propertyInfo = propertyInfo;
|
|
|
|
+
|
|
|
|
+ if (!propertyInfo.length) {
|
|
|
|
+ this.curCourseProp = {};
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ const curCourseProp = propertyInfo.find(
|
|
|
|
+ (item) => item.coursePropertyId === this.curCoursePropertyId
|
|
|
|
+ );
|
|
|
|
+ if (!curCourseProp) {
|
|
|
|
+ this.curCoursePropertyId = propertyInfo[0].id;
|
|
|
|
+ }
|
|
|
|
+ },
|
|
buildDataList() {
|
|
buildDataList() {
|
|
|
|
+ let _this = this;
|
|
function buildClassifyData(data) {
|
|
function buildClassifyData(data) {
|
|
let classifyData = {
|
|
let classifyData = {
|
|
id: data.classifyId,
|
|
id: data.classifyId,
|
|
name: data.classifyName,
|
|
name: data.classifyName,
|
|
classifyId: data.classifyId,
|
|
classifyId: data.classifyId,
|
|
classifyName: data.classifyName,
|
|
classifyName: data.classifyName,
|
|
- isFolder: true,
|
|
|
|
|
|
+ isClassify: true,
|
|
questionCount: data.questionCount,
|
|
questionCount: data.questionCount,
|
|
selectCount: undefined,
|
|
selectCount: undefined,
|
|
difficultDistributeInfo: null,
|
|
difficultDistributeInfo: null,
|
|
@@ -198,7 +261,7 @@ export default {
|
|
return classifyData;
|
|
return classifyData;
|
|
|
|
|
|
const curCourseProp = data.propertyDistributeInfo.find(
|
|
const curCourseProp = data.propertyDistributeInfo.find(
|
|
- (item) => item.coursePropertyName === this.curCoursePropertyName
|
|
|
|
|
|
+ (item) => item.coursePropertyId === _this.curCoursePropertyId
|
|
);
|
|
);
|
|
if (!curCourseProp) {
|
|
if (!curCourseProp) {
|
|
return classifyData;
|
|
return classifyData;
|
|
@@ -212,8 +275,8 @@ export default {
|
|
}
|
|
}
|
|
|
|
|
|
function parseQuestionDistributeInfo(data) {
|
|
function parseQuestionDistributeInfo(data) {
|
|
- if (!this.difficultDistributeInfo.length) {
|
|
|
|
- this.difficultDistributeInfo = data.map(
|
|
|
|
|
|
+ if (!_this.difficultDistributeInfo.length) {
|
|
|
|
+ _this.difficultDistributeInfo = data.map(
|
|
(item) => item.difficultLevel
|
|
(item) => item.difficultLevel
|
|
);
|
|
);
|
|
}
|
|
}
|
|
@@ -254,13 +317,22 @@ export default {
|
|
|
|
|
|
if (this.IS_ONLY_DIFFICULT) {
|
|
if (this.IS_ONLY_DIFFICULT) {
|
|
this.tableData = this.dataList[0].difficultDistributeInfo;
|
|
this.tableData = this.dataList[0].difficultDistributeInfo;
|
|
- this.tableData.forEach((elem) => {
|
|
|
|
- elem.id = elem.name;
|
|
|
|
|
|
+ this.tableData.map((item) => {
|
|
|
|
+ let nitem = { ...item };
|
|
|
|
+ (item.id = item.difficultLevel), (item.name = item.difficultLevel);
|
|
|
|
+ return nitem;
|
|
});
|
|
});
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- if (this.IS_ONLY_PROPERTY) {
|
|
|
|
- this.tableData = this.dataList[0].children;
|
|
|
|
|
|
+ if (this.isClassify && !this.isProperty) {
|
|
|
|
+ this.tableData = this.dataList.map((item) => {
|
|
|
|
+ let nitem = { ...item };
|
|
|
|
+ nitem.propertyDistributeInfo = [];
|
|
|
|
+ return nitem;
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ if (!this.isClassify && this.isProperty) {
|
|
|
|
+ this.tableData = this.dataList[0].propertyDistributeInfo;
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
},
|
|
},
|