ソースを参照

教材信息修改教材类型为多选

natasha 1 年間 前
コミット
f5a6573aed
1 ファイル変更25 行追加11 行削除
  1. 25 11
      src/views/courseList.vue

+ 25 - 11
src/views/courseList.vue

@@ -215,19 +215,27 @@
                 show-word-limit
               />
             </el-form-item>
-            <el-form-item label="教材类型" label-width="90px" prop="type_id">
+            <el-form-item
+              label="教材类型"
+              label-width="90px"
+              prop="type_name_list"
+            >
               <!-- -->
               <el-select
                 ref="typeSelects"
-                v-model="formDialog.type_id"
+                v-model="formDialog.type_name_list"
                 name="bookType"
                 placeholder="请选择教材类型"
+                filterable
+                multiple
+                allow-create
+                default-first-option
               >
                 <el-option
                   v-for="(item, index) in typeList"
                   :key="'type' + index"
-                  :label="item.name"
-                  :value="item.id"
+                  :label="item"
+                  :value="item"
                 />
               </el-select>
             </el-form-item>
@@ -544,7 +552,7 @@
 import Header from "@/components/Header";
 import { validNull, validPrice } from "@/utils/validate";
 // import Nav from "@/components/inputModules/common/Nav";
-import { getContent, getContentFile } from "@/api/ajax";
+import { getContent, getContentFile, TextbookAPI } from "@/api/ajax";
 import { getToken } from "@/utils/auth";
 
 export default {
@@ -608,7 +616,7 @@ export default {
         id: "",
         publisher: "",
         theme_color: "",
-        type_id: ""
+        type_name_list: []
       },
       agencyList: [
         {
@@ -648,7 +656,7 @@ export default {
           { required: true, trigger: "blur", validator: validateNull }
         ],
         org_id: [{ required: true, message: "请选择机构", trigger: "change" }],
-        type_id: [
+        type_name_list: [
           { required: true, message: "请选择教材类型", trigger: "change" }
         ],
         price: [{ required: true, validator: validatePrice }]
@@ -858,7 +866,7 @@ export default {
         id: "",
         publisher: "",
         theme_color: "",
-        type_id: ""
+        type_name_list: []
       };
       this.agency = "";
       this.fileList = [];
@@ -910,6 +918,7 @@ export default {
                 _this.getList();
                 _this.resetForm("formDialog");
               }
+              _this.getTypeList();
               _this.dialogFlag = false;
               this.loading = false;
             })
@@ -1022,9 +1031,9 @@ export default {
     },
     // 教材类型列表
     getTypeList() {
-      let MethodName = "dict_manager-GetBookTypeList";
+      let MethodName = "book-book_manager-GetBookTypeList";
       let data = {};
-      getContentFile(MethodName, data).then(res => {
+      TextbookAPI(MethodName, data).then(res => {
         this.typeList = res.type_list;
       });
     },
@@ -1235,6 +1244,7 @@ export default {
       this.fileListOtheraudio = [];
       this.fileListDoc = [];
       this.formDialog.description = "";
+      this.formDialog.type_name_list = [];
     },
     // 编辑书籍信息
     handleEdit(row, index) {
@@ -1257,6 +1267,9 @@ export default {
       };
       getContent(MethodName, data)
         .then(res => {
+          if (res.type_name && res.type_name_list.length === 0) {
+            res.type_name_list = [res.type_name];
+          }
           this.formDialog = {
             id: res.id,
             name: res.name,
@@ -1273,7 +1286,7 @@ export default {
             publisher: res.publisher,
             theme_color: res.theme_color,
             edition: res.edition,
-            type_id: res.type_id
+            type_name_list: res.type_name_list
           };
           sessionStorage.setItem("Bookdetail", JSON.stringify(this.formDialog));
           if (res.picture_url) {
@@ -1403,6 +1416,7 @@ export default {
       this.fileListOtheraudio = [];
       this.fileListDoc = [];
       this.formDialog.description = "";
+      this.formDialog.type_name_list = [];
       done();
     },
     handleSort(value) {