|
@@ -115,7 +115,7 @@
|
|
type="primary"
|
|
type="primary"
|
|
@close="handleClose(content)"
|
|
@close="handleClose(content)"
|
|
>
|
|
>
|
|
- {{ content.coursePropertyName || content.courseProperty.name }}
|
|
|
|
|
|
+ {{ content.courseProperty.name }}
|
|
</el-tag>
|
|
</el-tag>
|
|
</el-tooltip>
|
|
</el-tooltip>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
@@ -123,16 +123,21 @@
|
|
<el-col :xs="6" :sm="6" :md="6" :lg="6">
|
|
<el-col :xs="6" :sm="6" :md="6" :lg="6">
|
|
<el-form-item label="属性名">
|
|
<el-form-item label="属性名">
|
|
<el-select
|
|
<el-select
|
|
- v-model="coursePropertyName"
|
|
|
|
|
|
+ v-model="coursePropertyId"
|
|
|
|
+ :remote-method="getCoursesProperty"
|
|
|
|
+ :loading="coursePropertyLoading"
|
|
|
|
+ remote
|
|
|
|
+ filterable
|
|
|
|
+ clearable
|
|
placeholder="属性名"
|
|
placeholder="属性名"
|
|
class="property_with"
|
|
class="property_with"
|
|
@change="searchFirst"
|
|
@change="searchFirst"
|
|
>
|
|
>
|
|
<el-option
|
|
<el-option
|
|
v-for="item in coursePropertyList"
|
|
v-for="item in coursePropertyList"
|
|
- :key="item.name"
|
|
|
|
|
|
+ :key="item.id"
|
|
:label="item.name"
|
|
:label="item.name"
|
|
- :value="item.name"
|
|
|
|
|
|
+ :value="item.id"
|
|
>
|
|
>
|
|
</el-option>
|
|
</el-option>
|
|
</el-select>
|
|
</el-select>
|
|
@@ -286,6 +291,7 @@ export default {
|
|
name: "EditOtherApp",
|
|
name: "EditOtherApp",
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
|
|
+ coursePropertyLoading: false,
|
|
fullscreenLoading: false,
|
|
fullscreenLoading: false,
|
|
questionTypes: QUESTION_TYPES,
|
|
questionTypes: QUESTION_TYPES,
|
|
courseName: "",
|
|
courseName: "",
|
|
@@ -336,7 +342,7 @@ export default {
|
|
{ label: "音频", value: "SINGLE_AUDIO" },
|
|
{ label: "音频", value: "SINGLE_AUDIO" },
|
|
],
|
|
],
|
|
coursePropertyList: [],
|
|
coursePropertyList: [],
|
|
- coursePropertyName: "", //课程属性名
|
|
|
|
|
|
+ coursePropertyId: "", //课程属性
|
|
firstPropertyList: [], //一级属性集合
|
|
firstPropertyList: [], //一级属性集合
|
|
firstPropertyId: "", //一级属性id
|
|
firstPropertyId: "", //一级属性id
|
|
secondPropertyList: [], //二级属性集合
|
|
secondPropertyList: [], //二级属性集合
|
|
@@ -367,7 +373,6 @@ export default {
|
|
created() {
|
|
created() {
|
|
this.paperId = this.$route.params.paperId;
|
|
this.paperId = this.$route.params.paperId;
|
|
this.paperDetailId = this.$route.params.paperDetailId;
|
|
this.paperDetailId = this.$route.params.paperDetailId;
|
|
- this.courseName = this.$route.params.courseName;
|
|
|
|
this.courseId = this.$route.params.courseId;
|
|
this.courseId = this.$route.params.courseId;
|
|
let questionType = this.$route.params.questionType;
|
|
let questionType = this.$route.params.questionType;
|
|
if (questionType) {
|
|
if (questionType) {
|
|
@@ -377,13 +382,8 @@ export default {
|
|
if (this.questionId) {
|
|
if (this.questionId) {
|
|
this.quesModel["id"] = this.questionId;
|
|
this.quesModel["id"] = this.questionId;
|
|
this.getQues(this.questionId);
|
|
this.getQues(this.questionId);
|
|
- }
|
|
|
|
- if (this.courseId) {
|
|
|
|
- this.$http
|
|
|
|
- .get(QUESTION_API + "/courseProperty/enable?courseId=" + this.courseId)
|
|
|
|
- .then((response) => {
|
|
|
|
- this.coursePropertyList = response.data;
|
|
|
|
- });
|
|
|
|
|
|
+ } else if (this.courseId) {
|
|
|
|
+ this.getCoursesProperty("");
|
|
}
|
|
}
|
|
|
|
|
|
if (isEmptyStr(this.quesModel.answerType)) {
|
|
if (isEmptyStr(this.quesModel.answerType)) {
|
|
@@ -400,6 +400,36 @@ export default {
|
|
}, 200);
|
|
}, 200);
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ getQuesPropertyKey(quesProp) {
|
|
|
|
+ if (!quesProp) {
|
|
|
|
+ return "";
|
|
|
|
+ } else if (quesProp.secondProperty.id) {
|
|
|
|
+ return (
|
|
|
|
+ quesProp.courseProperty.id +
|
|
|
|
+ "-" +
|
|
|
|
+ quesProp.firstProperty.id +
|
|
|
|
+ "-" +
|
|
|
|
+ quesProp.secondProperty.id
|
|
|
|
+ );
|
|
|
|
+ } else {
|
|
|
|
+ return quesProp.courseProperty.id + "-" + quesProp.firstProperty.id;
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ getCoursesProperty(name) {
|
|
|
|
+ this.coursePropertyLoading = true;
|
|
|
|
+ this.$httpWithMsg
|
|
|
|
+ .get(
|
|
|
|
+ QUESTION_API +
|
|
|
|
+ "/courseProperty/enable?courseId=" +
|
|
|
|
+ this.courseId +
|
|
|
|
+ "&name=" +
|
|
|
|
+ name
|
|
|
|
+ )
|
|
|
|
+ .then((response) => {
|
|
|
|
+ this.coursePropertyList = response.data;
|
|
|
|
+ this.coursePropertyLoading = false;
|
|
|
|
+ });
|
|
|
|
+ },
|
|
boolAnswerChange(val) {
|
|
boolAnswerChange(val) {
|
|
this.quesModel.quesAnswer = val ? "true" : "false";
|
|
this.quesModel.quesAnswer = val ? "true" : "false";
|
|
},
|
|
},
|
|
@@ -510,7 +540,7 @@ export default {
|
|
getQues(id) {
|
|
getQues(id) {
|
|
this.$http.get(QUESTION_API + "/question/" + id).then((response) => {
|
|
this.$http.get(QUESTION_API + "/question/" + id).then((response) => {
|
|
this.quesModel = response.data;
|
|
this.quesModel = response.data;
|
|
-
|
|
|
|
|
|
+ this.courseId = this.quesModel.course.id;
|
|
if (isEmptyStr(this.quesModel.answerType)) {
|
|
if (isEmptyStr(this.quesModel.answerType)) {
|
|
this.quesModel.answerType = "DIVERSIFIED_TEXT";
|
|
this.quesModel.answerType = "DIVERSIFIED_TEXT";
|
|
}
|
|
}
|
|
@@ -529,7 +559,7 @@ export default {
|
|
} else {
|
|
} else {
|
|
this.quesAnswer = null;
|
|
this.quesAnswer = null;
|
|
}
|
|
}
|
|
- this.initCourseProperty();
|
|
|
|
|
|
+ this.getCoursesProperty("");
|
|
});
|
|
});
|
|
},
|
|
},
|
|
backToQuesList() {
|
|
backToQuesList() {
|
|
@@ -537,30 +567,16 @@ export default {
|
|
path: "/questions/question_list/1",
|
|
path: "/questions/question_list/1",
|
|
});
|
|
});
|
|
},
|
|
},
|
|
- //查询所有课程属性名
|
|
|
|
- initCourseProperty() {
|
|
|
|
- var courseId = this.quesModel.course.courseId;
|
|
|
|
- if (!courseId) return;
|
|
|
|
- this.$http
|
|
|
|
- .get(QUESTION_API + "/courseProperty/enable?courseId=" + courseId)
|
|
|
|
- .then((response) => {
|
|
|
|
- this.coursePropertyList = response.data;
|
|
|
|
- });
|
|
|
|
- },
|
|
|
|
//查询一级属性
|
|
//查询一级属性
|
|
searchFirst() {
|
|
searchFirst() {
|
|
this.firstPropertyId = "";
|
|
this.firstPropertyId = "";
|
|
this.secondPropertyId = "";
|
|
this.secondPropertyId = "";
|
|
this.secondPropertyList = [];
|
|
this.secondPropertyList = [];
|
|
- for (let courseProperty of this.coursePropertyList) {
|
|
|
|
- if (courseProperty.name == this.coursePropertyName) {
|
|
|
|
- this.$http
|
|
|
|
- .get(QUESTION_API + "/property/first/" + courseProperty.id)
|
|
|
|
- .then((response) => {
|
|
|
|
- this.firstPropertyList = response.data;
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ this.$http
|
|
|
|
+ .get(QUESTION_API + "/property/first/" + this.coursePropertyId)
|
|
|
|
+ .then((response) => {
|
|
|
|
+ this.firstPropertyList = response.data;
|
|
|
|
+ });
|
|
},
|
|
},
|
|
//查询二级属性
|
|
//查询二级属性
|
|
searchSecond() {
|
|
searchSecond() {
|
|
@@ -577,8 +593,8 @@ export default {
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
var quesProperty = {
|
|
var quesProperty = {
|
|
- id: "",
|
|
|
|
- coursePropertyName: "",
|
|
|
|
|
|
+ key: "",
|
|
|
|
+ courseProperty: {},
|
|
firstProperty: {},
|
|
firstProperty: {},
|
|
secondProperty: {},
|
|
secondProperty: {},
|
|
};
|
|
};
|
|
@@ -589,14 +605,14 @@ export default {
|
|
) {
|
|
) {
|
|
this.quesModel.quesProperties = [];
|
|
this.quesModel.quesProperties = [];
|
|
}
|
|
}
|
|
- quesProperty.id =
|
|
|
|
- this.coursePropertyName +
|
|
|
|
|
|
+ let quesPropertyKey =
|
|
|
|
+ this.coursePropertyId +
|
|
"-" +
|
|
"-" +
|
|
this.firstPropertyId +
|
|
this.firstPropertyId +
|
|
"-" +
|
|
"-" +
|
|
this.secondPropertyId;
|
|
this.secondPropertyId;
|
|
for (let quesPro of this.quesModel.quesProperties) {
|
|
for (let quesPro of this.quesModel.quesProperties) {
|
|
- if (quesPro.id == quesProperty.id) {
|
|
|
|
|
|
+ if (quesPro.key == quesPropertyKey) {
|
|
this.$notify({
|
|
this.$notify({
|
|
message: "该属性已存在,请重新选择",
|
|
message: "该属性已存在,请重新选择",
|
|
type: "error",
|
|
type: "error",
|
|
@@ -604,7 +620,11 @@ export default {
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- quesProperty.coursePropertyName = this.coursePropertyName;
|
|
|
|
|
|
+ for (let property of this.coursePropertyList) {
|
|
|
|
+ if (property.id == this.coursePropertyId) {
|
|
|
|
+ quesProperty.courseProperty = property;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
//取到一级属性对象
|
|
//取到一级属性对象
|
|
for (let property of this.firstPropertyList) {
|
|
for (let property of this.firstPropertyList) {
|
|
if (property.id == this.firstPropertyId) {
|
|
if (property.id == this.firstPropertyId) {
|
|
@@ -630,10 +650,11 @@ export default {
|
|
quesProperty.secondProperty = property;
|
|
quesProperty.secondProperty = property;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ quesProperty.key = this.getQuesPropertyKey(quesProperty);
|
|
this.quesModel.quesProperties.push(quesProperty);
|
|
this.quesModel.quesProperties.push(quesProperty);
|
|
this.quesModel = Object.assign({}, this.quesModel);
|
|
this.quesModel = Object.assign({}, this.quesModel);
|
|
//清空下拉框
|
|
//清空下拉框
|
|
- this.coursePropertyName = "";
|
|
|
|
|
|
+ this.coursePropertyId = "";
|
|
this.firstPropertyId = "";
|
|
this.firstPropertyId = "";
|
|
this.secondPropertyId = "";
|
|
this.secondPropertyId = "";
|
|
this.firstPropertyList = [];
|
|
this.firstPropertyList = [];
|
|
@@ -649,7 +670,7 @@ export default {
|
|
},
|
|
},
|
|
//新增属性验证
|
|
//新增属性验证
|
|
checkInsertPro() {
|
|
checkInsertPro() {
|
|
- if (!this.coursePropertyName) {
|
|
|
|
|
|
+ if (!this.coursePropertyId) {
|
|
this.$notify({
|
|
this.$notify({
|
|
message: "请选择属性",
|
|
message: "请选择属性",
|
|
type: "error",
|
|
type: "error",
|