Browse Source

对接接口,页面调整

yellowtaotao 4 years ago
parent
commit
1c6852bf21

+ 1 - 1
src/api/modules/article.js

@@ -4,7 +4,7 @@ export default {
     // 文章列表
     INTERFACE_GET_ARTICLE_LIST: 'admin/materials',
     // 删除文章
-    INTERFACE_POST_ARTICLE_DELETE: '',
+    INTERFACE_POST_ARTICLE_DELETE: 'admin/materials/{materialId}',
     // 文章分类父级
     INTERFACE_GET_CATEGORIES: "categories",
     // 文章分类子集

+ 36 - 11
src/styles/components/index.less

@@ -81,19 +81,27 @@
     width: calc(60%);
     margin: 20px 0 20px calc(20% + 56px);
   }
-  .create-select-row {
+  .create-select-div {
     padding-left: 56px;
-    >span {
+    > span {
       flex-wrap: nowrap;
       white-space: nowrap;
+      color: @mainColorBlack85;
     }
-    .create-select-item {
-      // display: flex;
-      // align-items: center;
-      span {
-        flex-wrap: nowrap;
-        white-space: nowrap;
-        margin: 0 10px 0 16px;
+    .create-select-row {
+      display: flex;
+      align-items: center;
+      padding-left: 50px;
+      margin: @paddingMarginVal 0;
+      .create-select-item {
+        display: flex;
+        align-items: center;
+        > span {
+          flex-wrap: nowrap;
+          white-space: nowrap;
+          margin: 0 10px 0 @paddingMarginVal;
+          color: @mainColorBlack85;
+        }
       }
     }
   }
@@ -101,9 +109,12 @@
 // 新建试题的统一样式--------end
 
 // 试题列表中的筛选条件样式--------start
+.flexCenter {
+  align-items: center;
+}
 .filter-condition-box {
   display: flex;
-  >span {
+  > span {
     flex-wrap: nowrap;
     white-space: nowrap;
   }
@@ -126,12 +137,26 @@
       font-weight: bold;
     }
   }
+  .create-select-row {
+    display: flex;
+    align-items: center;
+    .create-select-item {
+      display: flex;
+      align-items: center;
+      > span {
+        flex-wrap: nowrap;
+        white-space: nowrap;
+        margin: 0 10px 0 @paddingMarginVal;
+        color: @mainColorBlack85;
+      }
+    }
+  }
 }
 .filter-other-box {
   width: 100%;
   display: flex;
   align-items: center;
-  >span {
+  > span {
     flex-wrap: nowrap;
     white-space: nowrap;
   }

+ 1 - 1
src/styles/index.js

@@ -12,7 +12,7 @@ import 'ant-design-vue/dist/antd.css';
 import { Icon } from 'ant-design-vue';
 import Vue from 'vue'
 const IconFont = Icon.createFromIconfontCN({
-  scriptUrl: '//at.alicdn.com/t/font_2605334_meuo7gj8ds.js',
+  scriptUrl: '//at.alicdn.com/t/font_2605334_kihiv5w4az.js',
 });
 
 Vue.use(less);

+ 43 - 31
src/views/articleManagement/articleCreate.vue

@@ -95,9 +95,9 @@
 </template>
 
 <script>
-import { formatePathParams } from "@/filters";
+import { formatePathParams } from '@/filters';
 export default {
-  name: "articleCreate",
+  name: 'articleCreate',
   props: {},
   components: {
     // components: (reslove) => {
@@ -106,17 +106,17 @@ export default {
   },
   data() {
     return {
-      content: "输入内容",
+      content: '输入内容',
       //   展示预览
       previewVisible: false,
-      form: this.$form.createForm(this, { name: "articleCreate" }),
+      form: this.$form.createForm(this, { name: 'articleCreate' }),
       articalParentClassArr: [],
       articalChildClassArr: [],
       engineerTypeArray: [],
       articalParentClass: {},
       articalChildClass: {},
-      engineerType: "",
-      learnDate: ""
+      engineerType: '',
+      learnDate: '',
     };
   },
   created() {
@@ -136,7 +136,7 @@ export default {
     getArticalParentClass() {
       this.$_http
         .get(this.$_API.INTERFACE_GET_CATEGORIES)
-        .then(res => {
+        .then((res) => {
           this.articalParentClassArr = res.data;
           this.loading = false;
         })
@@ -146,7 +146,7 @@ export default {
     },
     // 查询文章分类子集
     getArticalChildClass() {
-      let pathParamsData = { categoryId: "" };
+      let pathParamsData = { categoryId: '' };
       this.$_http
         .get(
           formatePathParams(
@@ -154,7 +154,7 @@ export default {
             pathParamsData
           )
         )
-        .then(res => {
+        .then((res) => {
           this.articalChildClassArr = res.data;
           this.loading = false;
         })
@@ -166,7 +166,7 @@ export default {
     getEngineersWork() {
       this.$_http
         .get(this.$_API.INTERFACE_GET_ENGINEERINGWORK_LIST)
-        .then(res => {
+        .then((res) => {
           this.engineerTypeArray = res.data;
         });
     },
@@ -180,7 +180,7 @@ export default {
       // 子类选项清空
       this.articalChildClassArr = [];
       this.form.setFieldsValue({
-        articalChildClass: ""
+        articalChildClass: '',
       });
     },
     // 文章分类子类变化
@@ -200,33 +200,45 @@ export default {
       e.preventDefault();
 
       this.form.setFieldsValue({
-        articalParentClass: this.articalParentClass.name
+        articalParentClass: this.articalParentClass.name,
       });
       this.form.setFieldsValue({
-        articalChildClass: this.articalChildClass.name
+        articalChildClass: this.articalChildClass.name,
       });
       this.form.setFieldsValue({
-        engineerType: this.engineerType.name
+        engineerType: this.engineerType.name,
       });
 
       this.form.validateFields((err, values) => {
         if (!err) {
           // 新建文章
-          console.log("--submit--" + JSON.stringify(values));
-          let params = {
-            name: "test",
-            description: "aaa",
-            type: "ARTICLE",
-            contents: this.content,
-            tages: [this.learnDate],
-            engineerTypes: [this.engineerType],
-            links: []
-          };
-          this.$_http
-            .post(this.$_API.INTERFACE_POST_ADMIN_MATERIALS, params)
-            .then(res => {
-              console.log("---上传文章----" + JSON.stringify(res));
-            });
+          console.log('--submit--' + JSON.stringify(values));
+          let that = this;
+          that.$confirm({
+            title: '新建文章',
+            content: `确认新建文章吗?`,
+            okText: '确认',
+            cancelText: '取消',
+            onOk() {
+              that.loading = true;
+              let params = {
+                name: 'test',
+                description: 'aaa',
+                type: 'ARTICLE',
+                contents: that.content,
+                tages: [that.learnDate],
+                engineerTypes: [that.engineerType],
+                links: [],
+              };
+              that.$_http
+                .post(that.$_API.INTERFACE_POST_ADMIN_MATERIALS, params)
+                .then((res) => {
+                  that.$message.success('新建文章成功');
+                  console.log('---上传文章----' + JSON.stringify(res));
+                });
+            },
+            onCancel() {},
+          });
         }
       });
     },
@@ -237,8 +249,8 @@ export default {
     // 关闭预览
     closepreview() {
       this.previewVisible = false;
-    }
-  }
+    },
+  },
 };
 </script>
 

+ 138 - 101
src/views/articleManagement/articleList.vue

@@ -5,32 +5,31 @@
         <!-- 过滤条件栏目 -->
         <div>
           <div class="filter-condition-box">
-            <span>所属类别:</span>
+            <span>文章类型:</span>
             <ul>
               <li
                 :class="{
-                  checkedExamQuestionType:
-                    checkedExamQuestionType === item.code,
+                  checkedExamQuestionType: articleArticleType === item.id,
                 }"
-                v-for="(item, index) in examQuestionType"
+                v-for="(item, index) in articleTypeList"
                 :key="index"
-                @click="handleExamQuestionTypeFun(item)"
+                @click="handleArticleTypeParent(item)"
               >
                 {{ item.name }}
               </li>
             </ul>
           </div>
           <div class="filter-condition-box a-card-margin-top">
-            <span>所属类:</span>
+            <span>所属类:</span>
             <ul>
               <li
                 :class="{
                   checkedExamQuestionType:
-                    checkedExamQuestionTypeCondition === item.code,
+                    checkedArticleTypeChildren === item.id,
                 }"
-                v-for="(item, index) in examQuestionTypeCondition"
+                v-for="(item, index) in articleTypeChildrenList"
                 :key="index"
-                @click="handleExamQuestionTypeConditionFun(item)"
+                @click="handleArticleTypeChildren(item)"
               >
                 {{ item.name }}
               </li>
@@ -47,7 +46,7 @@
               <a-select-option
                 v-for="(item, index) in engineeringWorkList"
                 :key="index"
-                :value="item.code"
+                :value="item.id"
                 >{{ item.name }}</a-select-option
               >
             </a-select>
@@ -74,26 +73,26 @@
               <!-- 收藏 -->
               <div class="article-list-item-info-label">
                 <icon-font type="ali-icon-shoucang-" />
-                <span class="article-list-item-info-labeltxt">{{
-                  item.collectCount
-                }}</span>
+                <span class="article-list-item-info-labeltxt">
+                  {{ item.likesCount || 0 }}
+                </span>
               </div>
               <div class="article-list-item-info-line"></div>
-              <!-- 点赞 -->
+              <!-- 阅读 -->
               <div class="article-list-item-info-label">
-                <icon-font type="ali-icon-dianzan" />
-                <span class="article-list-item-info-labeltxt">{{
-                  item.likeCount
-                }}</span>
+                <icon-font type="ali-icon-yuedu" />
+                <span class="article-list-item-info-labeltxt">
+                  {{ item.readerCount || 0 }}
+                </span>
               </div>
-              <div class="article-list-item-info-line"></div>
+              <!-- <div class="article-list-item-info-line"></div> -->
               <!-- 评论 -->
-              <div class="article-list-item-info-label">
+              <!-- <div class="article-list-item-info-label">
                 <icon-font type="ali-icon-yipinglun" />
-                <span class="article-list-item-info-labeltxt">{{
-                  item.commentCount
-                }}</span>
-              </div>
+                <span class="article-list-item-info-labeltxt">
+                  {{ item.readerCount || 0 }}
+                </span>
+              </div> -->
               <!-- 工种 -->
               <div class="article-list-item-info-engineeringWork">
                 {{ item.engineeringWork | formateEngineeringWorkTypeFun }}
@@ -123,12 +122,8 @@
 </template>
 
 <script>
-import {
-  ENGINEERING_WORK_LIST,
-  EXAM_QUESTION_TYPE,
-  EXAM_QUESTION_TYPE_CONDITION,
-} from '@/common/Constant';
-import { ARTICLELIST } from '@/common/resData';
+import { mapGetters } from 'vuex';
+import { formatePathParams } from '@/filters';
 export default {
   name: 'articleCreate',
   props: {},
@@ -136,10 +131,10 @@ export default {
   data() {
     return {
       loading: false, // 是否展示加载动画
-      examQuestionType: [], // 试题类别列表
-      checkedExamQuestionType: '', // 所选试题类别
-      examQuestionTypeCondition: [], // 试题类型列表
-      checkedExamQuestionTypeCondition: '', // 所选试题类型
+      articleTypeList: [], // 文章类型列表
+      articleArticleType: '', // 所选文章类型
+      articleTypeChildrenList: [], // 所属子类
+      checkedArticleTypeChildren: '', // 所选试题类型
       engineeringWorkList: [], // 工种数据列表
       engineeringWorkChooseValue: '', // 所选工种
       articleList: [], // 文章列表数据
@@ -156,102 +151,142 @@ export default {
   mounted() {},
   beforeDestroy() {},
   watch: {},
-  computed: {},
+  computed: {
+    ...mapGetters([
+      'screenHeight',
+      'GET_ENGINEERING_WORK_LIST',
+      'GET_EXAM_QUESTION_TYPE_CONDITION_PARENT',
+    ]),
+  },
   methods: {
     //初始化数据
     initDataFun() {
-      // 试题类别
-      this.examQuestionType = [
-        { name: '全部', code: '' },
-        ...EXAM_QUESTION_TYPE,
-      ];
-      this.checkedExamQuestionType = this.examQuestionType[0].code;
-      // 试题类型
-      this.examQuestionTypeCondition = [
-        { name: '全部', code: '' },
-        ...EXAM_QUESTION_TYPE_CONDITION,
-      ];
-      this.checkedExamQuestionTypeCondition = this.examQuestionTypeCondition[0].code;
+      this.getArticleTypeFun(); // 查询:文章分类-父类
       // 工种类别
       this.engineeringWorkList = [
-        { name: '全部', code: '' },
-        ...ENGINEERING_WORK_LIST,
+        { name: '全部', id: '' },
+        ...this.GET_ENGINEERING_WORK_LIST,
       ];
-      this.engineeringWorkChooseValue = this.engineeringWorkList[0].code;
-      this.getArticleListFun();
+      this.engineeringWorkChooseValue = this.engineeringWorkList[0].id;
+      this.getArticleListFun(); // 查询:文章列表数据
+    },
+    // 查询:文章分类-父类
+    getArticleTypeFun() {
+      this.$_http.get(this.$_API.INTERFACE_GET_CATEGORIES).then((res) => {
+        this.articleTypeList = [{ name: '全部', id: '' }, ...res.data];
+        this.articleArticleType = this.articleTypeList[0].id;
+        this.articleTypeChildrenList = [{ name: '全部', id: '' }];
+      });
+    },
+    // 查询:文章分类-子类
+    getArticleTypeChildrenFun() {
+      if (!this.articleArticleType) {
+        this.articleTypeChildrenList = [{ name: '全部', id: '' }];
+        this.checkedArticleTypeChildren = this.articleTypeChildrenList[0].id;
+        this.initPagination(); // 初始化分页参数
+        this.getArticleListFun(); // 查询:文章列表数据
+        return;
+      }
+      let params = { categoryId: this.articleArticleType };
+      this.$_http
+        .get(
+          formatePathParams(
+            this.$_API.INTERFACE_GET_CATEGORIES_CATEGROYID,
+            params
+          )
+        )
+        .then((res) => {
+          this.articleTypeChildrenList = [
+            { name: '全部', id: '' },
+            ...res.data,
+          ];
+          this.checkedArticleTypeChildren = this.articleTypeChildrenList[0].id;
+          this.loading = false;
+          this.initPagination(); // 初始化分页参数
+          this.getArticleListFun(); // 查询:文章列表数据
+        })
+        .catch(() => {
+          this.loading = false;
+        });
     },
     // 查询:文章列表数据
     getArticleListFun() {
       this.loading = true;
-      this.articleList = ARTICLELIST.data;
-      this.pagination.total = this.articleList.length;
-      setTimeout(() => {
-        this.loading = false;
-      }, 1500);
-      // let params = {
-      //   questionType: this.checkedExamQuestionType,
-      //   questionTypeCondition: this.checkedExamQuestionTypeCondition,
-      //   engineeringWork: this.engineeringWorkChooseValue,
-      //   page: this.pagination.current,
-      //   size: this.pagination.pageSize,
-      // };
-      // this.$_http
-      //   .get(this.$_API.INTERFACE_GET_ARTICLE_LIST, { params })
-      //   .then((res) => {
-      //     console.log(res);
-      //     this.articleList = res.data;
-      //     this.pagination.total = res.pagination.total;
-      //     this.loading = false;
-      //   })
-      //   .catch((err) => {
-      //     console.log(err);
-      //     this.loading = false;
-      //   });
+      let params = {
+        categoryId: this.articleArticleType, // 文章类型-父类ID
+        categoryIdChildren: this.checkedArticleTypeChildren, // 文章类型-子类ID
+        engineerType: this.engineeringWorkChooseValue, // 工种ID
+        page: this.pagination.current - 1,
+        size: this.pagination.pageSize,
+      };
+      this.$_http
+        .get(this.$_API.INTERFACE_GET_ARTICLE_LIST, { params })
+        .then((res) => {
+          this.articleList = res.data.content;
+          this.pagination.total = res.data.totalElements;
+          this.loading = false;
+        })
+        .catch(() => {
+          this.loading = false;
+        });
     },
-    // 操作:选择某个试题类别
-    handleExamQuestionTypeFun(item) {
-      if (this.checkedExamQuestionType === item.code) {
+    // 操作:选择某个文章类型-父类
+    handleArticleTypeParent(item) {
+      if (this.articleArticleType === item.id) {
         return;
       }
-      this.checkedExamQuestionType = item.code;
-      this.getArticleListFun(); // 查询:文章列表数据
+      this.articleArticleType = item.id;
+      this.getArticleTypeChildrenFun(); // 查询:文章分类-子类
     },
-    // 操作:选择某个试题类型
-    handleExamQuestionTypeConditionFun(item) {
-      if (this.checkedExamQuestionTypeCondition === item.code) {
+    // 初始化分页参数
+    initPagination() {
+      this.pagination.current = 1;
+      this.pagination.pageSize = 7;
+      this.pagination.total = 0;
+    },
+    // 操作:选择某个文章类型-子类
+    handleArticleTypeChildren(item) {
+      if (this.checkedArticleTypeChildren === item.id) {
         return;
       }
-      this.checkedExamQuestionTypeCondition = item.code;
+      this.checkedArticleTypeChildren = item.id;
+      this.initPagination(); // 初始化分页参数
       this.getArticleListFun(); // 查询:文章列表数据
     },
     // 操作:选择了某个工种
     handleChangeEngineeringWorkValue() {
+      this.initPagination(); // 初始化分页参数
       this.getArticleListFun(); // 查询:文章列表数据
     },
     // 操作:删除文章
     handleDeleteArticleItem(item) {
-      console.log('点击了删除文章', item);
-      // let that = this;
+      let that = this;
       this.$confirm({
         title: '删除文章',
-        content: `确认删除文章(${item.name})吗?`,
+        content: `确认删除文章 ${item.name} 吗?`,
         okText: '确认',
         cancelText: '取消',
         onOk() {
-          // this.loading = true;
-          // let params = {
-          //   id: item.id,
-          // };
-          // that.$_http
-          //   .post(that.$_API.INTERFACE_POST_ARTICLE_DELETE, params)
-          //   .then((res) => {
-          //     console.log(res);
-          //     this.loading = false;
-          //   })
-          //   .catch((err) => {
-          //     console.log(err);
-          //     this.loading = false;
-          //   });
+          that.loading = true;
+          let params = {
+            materialId: item.id,
+          };
+          that.$_http
+            .delete(
+              formatePathParams(
+                that.$_API.INTERFACE_POST_ARTICLE_DELETE,
+                params
+              )
+            )
+            .then(() => {
+              that.$message.success('删除文章成功');
+              that.loading = false;
+              this.initPagination(); // 初始化分页参数
+              this.getArticleListFun(); // 查询:文章列表数据
+            })
+            .catch(() => {
+              that.loading = false;
+            });
         },
         onCancel() {},
       });
@@ -319,6 +354,8 @@ export default {
       }
     }
   }
+  .articleArticleType {
+  }
   .article-list-item-paddingTop {
     padding-top: @paddingMarginVal;
   }

+ 1 - 1
src/views/examManagement/examManualVolumeFormation.vue

@@ -7,7 +7,7 @@
         <a-form
           :form="loginForm"
           @submit="handleSubmitFun"
-          style="width: 500px;"
+          style="width: 515px;"
           :loading="loading"
         >
           <a-form-item

+ 99 - 40
src/views/examQuestionManagement/examQuestionList.vue

@@ -18,21 +18,40 @@
             </li>
           </ul>
         </div>
-        <div class="filter-condition-box a-card-margin-top">
+        <div class="filter-condition-box a-card-margin-top flexCenter">
           <span>所属类型:</span>
-          <ul>
-            <li
-              :class="{
-                checkedExamQuestionType:
-                  checkedExamQuestionConditionType === item.id,
-              }"
-              v-for="(item, index) in examQuestionConditionType"
-              :key="index"
-              @click="handleExamQuestionConditionTypeFun(item)"
-            >
-              {{ item.name }}
-            </li>
-          </ul>
+          <div class="create-select-row">
+            <div class="create-select-item">
+              <span>父类</span>
+              <a-select
+                v-model="checkedQuestionConditionParentType"
+                @change="selectTypeConditionParent"
+              >
+                <a-select-option
+                  v-for="(item, index) in questionConditionParentType"
+                  :key="index"
+                  :value="item.id"
+                >
+                  {{ item.name }}
+                </a-select-option>
+              </a-select>
+            </div>
+            <div class="create-select-item">
+              <span>子类</span>
+              <a-select
+                v-model="checkedQuestionConditionChildrenType"
+                :disabled="!checkedQuestionConditionParentType"
+              >
+                <a-select-option
+                  v-for="(item, index) in questionConditionChildrenType"
+                  :key="index"
+                  :value="item.id"
+                >
+                  {{ item.name }}
+                </a-select-option>
+              </a-select>
+            </div>
+          </div>
         </div>
         <div class="border-line"></div>
         <div class="filter-other-box">
@@ -93,8 +112,8 @@
           <template slot="engineerTypes" slot-scope="text, record">
             <span>{{ record.engineerTypesTxt }}</span>
           </template>
-          <template slot="typeCondition" slot-scope="text, record">
-            <span>{{ record.typeConditionTxt }}</span>
+          <template slot="categoryid" slot-scope="text, record">
+            <span>{{ record.categoryidTxt }}</span>
           </template>
           <template slot="action" slot-scope="text, record">
             <a @click="toQuestionDetailFun(record)">详情</a>
@@ -130,8 +149,10 @@ export default {
     return {
       examQuestionType: [], // 试题类别列表
       checkedExamQuestionType: '', // 所选试题类别
-      examQuestionConditionType: [], // 试题类型列表
-      checkedExamQuestionConditionType: '', // 所选试题类型类型
+      questionConditionParentType: [], // 试题类型列表-父类
+      checkedQuestionConditionParentType: '', // 所选试题类型-父类
+      questionConditionChildrenType: [], // 试题类型列表-子类
+      checkedQuestionConditionChildrenType: '', // 所选试题类型-子类
       engineeringWorkList: [], // 工种数据列表
       engineeringWorkChooseValue: '', // 所选工种
       tableHeight: 400, // 表格高度
@@ -181,10 +202,11 @@ export default {
       // 试题类别
       this.examQuestionType = [{ name: '全部', id: '' }, ...EXAM_QUESTION_TYPE];
       // 试题类型
-      this.examQuestionConditionType = [
-        { name: '全部', id: '' },
+      this.questionConditionParentType = [
+        { name: '不限', id: '' },
         ...this.GET_EXAM_QUESTION_TYPE_CONDITION_PARENT,
       ];
+      this.checkedQuestionConditionParentType = this.questionConditionParentType[0].id;
       // 工种类别
       this.engineeringWorkList = [
         { name: '不限', id: '' },
@@ -209,10 +231,16 @@ export default {
           scopedSlots: { customRender: 'type' },
         },
         {
-          title: '试题类型',
-          dataIndex: 'typeCondition',
-          key: 'typeCondition',
-          scopedSlots: { customRender: 'typeCondition' },
+          title: '试题父类',
+          dataIndex: 'parentId',
+          key: 'parentId',
+          scopedSlots: { customRender: 'parentId' },
+        },
+        {
+          title: '试题子类',
+          dataIndex: 'categoryid',
+          key: 'categoryid',
+          scopedSlots: { customRender: 'categoryid' },
         },
         {
           title: '工种',
@@ -235,14 +263,45 @@ export default {
       this.pagination.pageSize = 7;
       this.pagination.total = 0;
     },
+    // 查询:试题类型列表-子类
+    getTableChildrenListFun() {
+      if (!this.checkedQuestionConditionParentType) {
+        this.checkedQuestionConditionChildrenType = '';
+        this.questionConditionChildrenType = [];
+        this.initPagination(); // 初始化分页参数
+        this.getQusetionsListFun(); // 查询:试题列表数据
+        return;
+      }
+      this.loading = true;
+      let params = {
+        categoryId: this.checkedQuestionConditionParentType,
+      };
+      this.$_http
+        .get(
+          formatePathParams(
+            this.$_API.INTERFACE_GET_EXAMS_QUESTION_TYPE_CONDITION_CHILDRENS,
+            params
+          )
+        )
+        .then((res) => {
+          this.questionConditionChildrenType = res.data;
+          this.checkedQuestionConditionChildrenType = this.questionConditionChildrenType[0].id;
+          this.loading = false;
+          this.initPagination(); // 初始化分页参数
+          this.getQusetionsListFun(); // 查询:试题列表数据
+        })
+        .catch(() => {
+          this.loading = false;
+        });
+    },
     // 查询:试题列表数据
     getQusetionsListFun() {
       this.loading = true;
       let params = {
-        page: this.pagination.current,
+        page: this.pagination.current - 1,
         size: this.pagination.pageSize,
         type: this.checkedExamQuestionType,
-        typeCondition: this.checkedExamQuestionConditionType,
+        categoryid: this.checkedQuestionConditionChildrenType,
         engineerTypes: this.engineeringWorkChooseValue,
       };
       this.$_http
@@ -254,18 +313,20 @@ export default {
               if (item.type === it.code) {
                 item.typeTxt = it.name;
               }
-            }); // 试题类别
-            this.examQuestionConditionType.forEach((it) => {
-              if (item.typeCondition === it.id) {
-                item.typeConditionTxt = it.name;
-              }
-            }); // 试题类型
+            }); // 试题类别---注意之后从engineertypes中拿
+            if (this.questionConditionChildrenType.length) {
+              this.questionConditionChildrenType.forEach((it) => {
+                if (item.categoryid === it.id) {
+                  item.categoryidTxt = it.name;
+                }
+              }); // 试题类型
+            }
             item.engineerTypesTxt = this.engineeringWorkList[0].name;
             this.engineeringWorkList.forEach((it) => {
               if (item.engineerTypes === it.id) {
                 item.engineerTypesTxt = it.name;
               }
-            }); // 工种
+            }); // 工种---注意之后从engineertypes中拿
           });
           this.pagination.total = res.data.totalElements; // 总条数
           this.tableData = resData;
@@ -281,18 +342,16 @@ export default {
         return;
       }
       this.checkedExamQuestionType = item.id;
+      this.initPagination(); // 初始化分页参数
       this.getQusetionsListFun(); // 查询:试题列表数据
     },
-    // 操作:选择某个试题类型
-    handleExamQuestionConditionTypeFun(item) {
-      if (this.checkedExamQuestionConditionType === item.id) {
-        return;
-      }
-      this.checkedExamQuestionConditionType = item.id;
-      this.getQusetionsListFun(); // 查询:试题列表数据
+    // 操作:选择了父类
+    selectTypeConditionParent() {
+      this.getTableChildrenListFun(); // 查询:试题类型列表-子类
     },
     // 操作:选择了某个工种
     handleChangeEngineeringWorkValue() {
+      this.initPagination(); // 初始化分页参数
       this.getQusetionsListFun(); // 查询:试题列表数据
     },
     // 操作:详情

+ 68 - 34
src/views/examQuestionManagement/examQusetionCreateGapFilling.vue

@@ -5,7 +5,7 @@
         <a-form
           :form="aquestionAddForm"
           @submit="handleSubmitForm"
-          style="width: 500px;"
+          style="width: 515px;"
           :loading="loading"
         >
           <a-form-item
@@ -59,33 +59,38 @@
               />
             </a-form-item>
           </div>
-          <a-form-item
-            label="试题类型"
-            :label-col="labelCol"
-            :wrapper-col="wrapperCol"
-          >
-            <a-select
-              v-decorator="[
-                'typeCondition',
-                {
-                  rules: [
-                    {
-                      required: false,
-                    },
-                  ],
-                  initialValue: typeCondition,
-                },
-              ]"
-            >
-              <a-select-option
-                v-for="(item, index) in typeConditionList"
-                :key="index"
-                :value="item.id"
-              >
-                {{ item.name }}
-              </a-select-option>
-            </a-select>
-          </a-form-item>
+          <div class="create-select-div">
+            <span>试题类型:</span>
+            <div class="create-select-row">
+              <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>
+          </div>
           <a-form-item
             label="工种类别"
             :label-col="labelCol"
@@ -128,7 +133,7 @@
 </template>
 
 <script>
-import { formateUrlParams } from '@/filters';
+import { formateUrlParams, formatePathParams } from '@/filters';
 import { mapGetters } from 'vuex';
 export default {
   name: 'examQusetionCreateGapFilling',
@@ -144,8 +149,10 @@ export default {
       }),
       questionType: 'TianKong', // 试题类型:填空题
       optionsList: [{ value: '' }], // 选项列表
-      typeConditionList: [], // 试题类型列表
-      typeCondition: '', // 所选试题类型
+      typeConditionParentList: [], // 试题类型-父类列表
+      typeConditionParentValue: '', // 父类所选值
+      typeConditionChildrenList: [], // 试题类型-子类列表
+      typeConditionChildrenValue: '', // 子类所选值
       engineeringWorkList: [], // 工种数据列表
       engineeringWorkChooseValue: '', // 所选工种
       finalAnswerIndexs: undefined, // 正确答案下标
@@ -167,15 +174,38 @@ export default {
     // 初始化数据
     initDataFun() {
       // 试题类型
-      this.typeConditionList = [
-        { name: '不限', id: '' },
+      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() {
@@ -185,6 +215,10 @@ export default {
     questionOptionDeleteFun(index) {
       this.optionsList.splice(index, 1);
     },
+    // 操作:选择了父类
+    selectTypeConditionParent() {
+      this.getTableChildrenListFun(); // 查询:试题类型列表-子类
+    },
     // 操作:表单提交
     handleSubmitForm(e) {
       e.preventDefault();
@@ -196,7 +230,7 @@ export default {
           ); // 获取工种信息
           // 需要拼接到请求地址后面的参数
           let urlParams = {
-            categoryid: this.questionType, // 试题类别ID
+            categoryid: this.typeConditionChildrenValue, // 试题类型ID
             engineertypeid: values.engineeringWorkChooseValue, // 工种ID
           };
           // 接口Body参数

+ 73 - 34
src/views/examQuestionManagement/examQusetionCreateMultiple.vue

@@ -5,7 +5,7 @@
         <a-form
           :form="aquestionAddForm"
           @submit="handleSubmitForm"
-          style="width: 500px;"
+          style="width: 515px;"
           :loading="loading"
         >
           <a-form-item
@@ -83,33 +83,39 @@
               </a-select-option>
             </a-select>
           </a-form-item>
-          <a-form-item
-            label="试题类型"
-            :label-col="labelCol"
-            :wrapper-col="wrapperCol"
-          >
-            <a-select
-              v-decorator="[
-                'typeCondition',
-                {
-                  rules: [
-                    {
-                      required: false,
-                    },
-                  ],
-                  initialValue: typeCondition,
-                },
-              ]"
-            >
-              <a-select-option
-                v-for="(item, index) in typeConditionList"
-                :key="index"
-                :value="item.id"
-              >
-                {{ item.name }}
-              </a-select-option>
-            </a-select>
-          </a-form-item>
+
+          <div class="create-select-div">
+            <span>试题类型:</span>
+            <div class="create-select-row">
+              <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>
+          </div>
           <a-form-item
             label="工种类别"
             :label-col="labelCol"
@@ -152,7 +158,11 @@
 </template>
 
 <script>
-import { formatQuestionIndex, formateUrlParams } from '@/filters';
+import {
+  formatQuestionIndex,
+  formateUrlParams,
+  formatePathParams,
+} from '@/filters';
 import { mapGetters } from 'vuex';
 export default {
   name: 'examQusetionCreateMultiple',
@@ -168,8 +178,10 @@ export default {
       }),
       questionType: 'DuoXuan', // 试题类型:多选题
       optionsList: [{ value: '' }, { value: '' }], // 选项列表
-      typeConditionList: [], // 试题类型列表
-      typeCondition: '', // 所选试题类型
+      typeConditionParentList: [], // 试题类型-父类列表
+      typeConditionParentValue: '', // 父类所选值
+      typeConditionChildrenList: [], // 试题类型-子类列表
+      typeConditionChildrenValue: '', // 子类所选值
       engineeringWorkList: [], // 工种数据列表
       engineeringWorkChooseValue: '', // 所选工种
       finalAnswerIndexs: undefined, // 正确答案下标
@@ -191,15 +203,38 @@ export default {
     // 初始化数据
     initDataFun() {
       // 试题类型
-      this.typeConditionList = [
-        { name: '不限', id: '' },
+      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() {
@@ -209,6 +244,10 @@ export default {
     questionOptionDeleteFun(index) {
       this.optionsList.splice(index, 1);
     },
+    // 操作:选择了父类
+    selectTypeConditionParent() {
+      this.getTableChildrenListFun(); // 查询:试题类型列表-子类
+    },
     // 操作:表单提交
     handleSubmitForm(e) {
       e.preventDefault();
@@ -220,7 +259,7 @@ export default {
           ); // 获取工种信息
           // 需要拼接到请求地址后面的参数
           let urlParams = {
-            categoryid: this.questionType, // 试题类别ID
+            categoryid: this.typeConditionChildrenValue, // 试题类型ID
             engineertypeid: values.engineeringWorkChooseValue, // 工种ID
           };
           // 接口Body参数

+ 31 - 57
src/views/examQuestionManagement/examQusetionCreateSingle.vue

@@ -5,7 +5,7 @@
         <a-form
           :form="aquestionAddForm"
           @submit="handleSubmitForm"
-          style="width: 500px;"
+          style="width: 515px;"
           :loading="loading"
         >
           <a-form-item
@@ -99,61 +99,36 @@
               ]"
             />
           </a-form-item> -->
-          <a-form-item
-            label="试题类型"
-            :label-col="labelCol"
-            :wrapper-col="wrapperCol"
-          >
-            <a-select
-              v-decorator="[
-                'typeCondition',
-                {
-                  rules: [
-                    {
-                      required: false,
-                    },
-                  ],
-                  initialValue: typeCondition,
-                },
-              ]"
-            >
-              <a-select-option
-                v-for="(item, index) in typeConditionParentList"
-                :key="index"
-                :value="item.id"
-              >
-                {{ item.name }}
-              </a-select-option>
-            </a-select>
-          </a-form-item>
-          <div class="create-select-row">
+          <div class="create-select-div">
             <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"
+            <div class="create-select-row">
+              <div class="create-select-item">
+                <span>父类</span>
+                <a-select
+                  v-model="typeConditionParentValue"
+                  @change="selectTypeConditionParent"
                 >
-                  {{ item.name }}
-                </a-select-option>
-              </a-select>
+                  <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>
           </div>
           <a-form-item
@@ -222,7 +197,6 @@ export default {
       typeConditionParentValue: '', // 父类所选值
       typeConditionChildrenList: [], // 试题类型-子类列表
       typeConditionChildrenValue: '', // 子类所选值
-      typeCondition: '', // 所选试题类型
       engineeringWorkList: [], // 工种数据列表
       engineeringWorkChooseValue: '', // 所选工种
       // answerDate: '', // 必答时间
@@ -305,10 +279,10 @@ export default {
         if (!err) {
           let engineerTypeInfo = this.formatEngineeringWorkChooseValue(
             values.engineeringWorkChooseValue
-          ); // 获取工种信息
+          ); // 获取工种信息 typeConditionParentValue
           // 需要拼接到请求地址后面的参数
           let urlParams = {
-            categoryid: this.questionType, // 试题类别ID
+            categoryid: this.typeConditionChildrenValue, // 试题类型ID
             engineertypeid: values.engineeringWorkChooseValue, // 工种ID
           };
           // 接口Body参数

+ 72 - 34
src/views/examQuestionManagement/examQusetionCreateTrueOrFalse.vue

@@ -5,7 +5,7 @@
         <a-form
           :form="aquestionAddForm"
           @submit="handleSubmitForm"
-          style="width: 500px;"
+          style="width: 515px;"
           :loading="loading"
         >
           <a-form-item
@@ -76,33 +76,38 @@
               </a-select-option>
             </a-select>
           </a-form-item>
-          <a-form-item
-            label="试题类型"
-            :label-col="labelCol"
-            :wrapper-col="wrapperCol"
-          >
-            <a-select
-              v-decorator="[
-                'typeCondition',
-                {
-                  rules: [
-                    {
-                      required: false,
-                    },
-                  ],
-                  initialValue: typeCondition,
-                },
-              ]"
-            >
-              <a-select-option
-                v-for="(item, index) in typeConditionList"
-                :key="index"
-                :value="item.id"
-              >
-                {{ item.name }}
-              </a-select-option>
-            </a-select>
-          </a-form-item>
+          <div class="create-select-div">
+            <span>试题类型:</span>
+            <div class="create-select-row">
+              <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>
+          </div>
           <a-form-item
             label="工种类别"
             :label-col="labelCol"
@@ -145,7 +150,11 @@
 </template>
 
 <script>
-import { formatQuestionIndex, formateUrlParams } from '@/filters';
+import {
+  formatQuestionIndex,
+  formateUrlParams,
+  formatePathParams,
+} from '@/filters';
 import { mapGetters } from 'vuex';
 export default {
   name: 'examQusetionCreateTrueOrFalse',
@@ -161,8 +170,10 @@ export default {
       }),
       questionType: 'PanDuan', // 试题类型:判断题
       optionsList: [{ value: '正确' }, { value: '错误' }], // 选项列表
-      typeConditionList: [], // 试题类型列表
-      typeCondition: '', // 所选试题类型
+      typeConditionParentList: [], // 试题类型-父类列表
+      typeConditionParentValue: '', // 父类所选值
+      typeConditionChildrenList: [], // 试题类型-子类列表
+      typeConditionChildrenValue: '', // 子类所选值
       engineeringWorkList: [], // 工种数据列表
       engineeringWorkChooseValue: '', // 所选工种
       finalAnswerIndexs: undefined, // 正确答案下标
@@ -184,15 +195,42 @@ export default {
     // 初始化数据
     initDataFun() {
       // 试题类型
-      this.typeConditionList = [
-        { name: '不限', id: '' },
+      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;
+        });
+    },
+    // 操作:选择了父类
+    selectTypeConditionParent() {
+      this.getTableChildrenListFun(); // 查询:试题类型列表-子类
     },
     // 操作:表单提交
     handleSubmitForm(e) {
@@ -205,7 +243,7 @@ export default {
           ); // 获取工种信息
           // 需要拼接到请求地址后面的参数
           let urlParams = {
-            categoryid: this.questionType, // 试题类别ID
+            categoryid: this.typeConditionChildrenValue, // 试题类型ID
             engineertypeid: values.engineeringWorkChooseValue, // 工种ID
           };
           // 接口Body参数