|
@@ -118,7 +118,7 @@
|
|
|
]"
|
|
|
>
|
|
|
<a-select-option
|
|
|
- v-for="(item, index) in typeConditionList"
|
|
|
+ v-for="(item, index) in typeConditionParentList"
|
|
|
:key="index"
|
|
|
:value="item.id"
|
|
|
>
|
|
@@ -126,6 +126,36 @@
|
|
|
</a-select-option>
|
|
|
</a-select>
|
|
|
</a-form-item>
|
|
|
+ <div class="create-select-row">
|
|
|
+ <span>试题类型:</span>
|
|
|
+ <div class="create-select-item">
|
|
|
+ <span>父类</span>
|
|
|
+ <a-select
|
|
|
+ v-model="typeConditionParentValue"
|
|
|
+ @change="selectTypeConditionParent"
|
|
|
+ >
|
|
|
+ <a-select-option
|
|
|
+ v-for="(item, index) in typeConditionParentList"
|
|
|
+ :key="index"
|
|
|
+ :value="item.id"
|
|
|
+ >
|
|
|
+ {{ item.name }}
|
|
|
+ </a-select-option>
|
|
|
+ </a-select>
|
|
|
+ </div>
|
|
|
+ <div class="create-select-item">
|
|
|
+ <span>子类</span>
|
|
|
+ <a-select v-model="typeConditionChildrenValue">
|
|
|
+ <a-select-option
|
|
|
+ v-for="(item, index) in typeConditionChildrenList"
|
|
|
+ :key="index"
|
|
|
+ :value="item.id"
|
|
|
+ >
|
|
|
+ {{ item.name }}
|
|
|
+ </a-select-option>
|
|
|
+ </a-select>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
<a-form-item
|
|
|
label="工种类别"
|
|
|
:label-col="labelCol"
|
|
@@ -168,7 +198,11 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { formatQuestionIndex, formateUrlParams } from '@/filters';
|
|
|
+import {
|
|
|
+ formatQuestionIndex,
|
|
|
+ formateUrlParams,
|
|
|
+ formatePathParams,
|
|
|
+} from '@/filters';
|
|
|
import { mapGetters } from 'vuex';
|
|
|
export default {
|
|
|
name: 'examQusetionCreateSingle',
|
|
@@ -184,7 +218,10 @@ export default {
|
|
|
}),
|
|
|
questionType: 'DanXuan', // 试题类别:单选题
|
|
|
optionsList: [{ value: '' }, { value: '' }], // 选项列表
|
|
|
- typeConditionList: [], // 试题类型列表
|
|
|
+ typeConditionParentList: [], // 试题类型-父类列表
|
|
|
+ typeConditionParentValue: '', // 父类所选值
|
|
|
+ typeConditionChildrenList: [], // 试题类型-子类列表
|
|
|
+ typeConditionChildrenValue: '', // 子类所选值
|
|
|
typeCondition: '', // 所选试题类型
|
|
|
engineeringWorkList: [], // 工种数据列表
|
|
|
engineeringWorkChooseValue: '', // 所选工种
|
|
@@ -201,22 +238,45 @@ export default {
|
|
|
computed: {
|
|
|
...mapGetters([
|
|
|
'GET_ENGINEERING_WORK_LIST',
|
|
|
- 'GET_EXAM_QUESTION_TYPE_CONDITION',
|
|
|
+ 'GET_EXAM_QUESTION_TYPE_CONDITION_PARENT',
|
|
|
]),
|
|
|
},
|
|
|
methods: {
|
|
|
// 初始化数据
|
|
|
initDataFun() {
|
|
|
// 试题类型
|
|
|
- this.typeConditionList = [
|
|
|
- { name: '不限', id: '' },
|
|
|
- ...this.GET_EXAM_QUESTION_TYPE_CONDITION,
|
|
|
+ this.typeConditionParentList = [
|
|
|
+ ...this.GET_EXAM_QUESTION_TYPE_CONDITION_PARENT,
|
|
|
];
|
|
|
+ this.typeConditionParentValue = this.typeConditionParentList[0].id;
|
|
|
// 工种类别
|
|
|
this.engineeringWorkList = [
|
|
|
{ name: '不限', id: '' },
|
|
|
...this.GET_ENGINEERING_WORK_LIST,
|
|
|
];
|
|
|
+ this.getTableChildrenListFun(); // 查询:试题类型列表-子类
|
|
|
+ },
|
|
|
+ // 查询:试题类型列表-子类
|
|
|
+ getTableChildrenListFun() {
|
|
|
+ this.loading = true;
|
|
|
+ let params = {
|
|
|
+ categoryId: this.typeConditionParentValue,
|
|
|
+ };
|
|
|
+ this.$_http
|
|
|
+ .get(
|
|
|
+ formatePathParams(
|
|
|
+ this.$_API.INTERFACE_GET_EXAMS_QUESTION_TYPE_CONDITION_CHILDRENS,
|
|
|
+ params
|
|
|
+ )
|
|
|
+ )
|
|
|
+ .then((res) => {
|
|
|
+ this.typeConditionChildrenList = res.data;
|
|
|
+ this.typeConditionChildrenValue = this.typeConditionChildrenList[0].id;
|
|
|
+ this.loading = false;
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
},
|
|
|
// 操作:新增选项
|
|
|
questionOptionAddFun() {
|
|
@@ -234,6 +294,10 @@ export default {
|
|
|
// this.answerDate = '';
|
|
|
// }
|
|
|
// },
|
|
|
+ // 操作:选择了父类
|
|
|
+ selectTypeConditionParent() {
|
|
|
+ this.getTableChildrenListFun(); // 查询:试题类型列表-子类
|
|
|
+ },
|
|
|
// 操作:表单提交
|
|
|
handleSubmitForm(e) {
|
|
|
e.preventDefault();
|