Kaynağa Gözat

添加可用教材字段

lex 1 yıl önce
ebeveyn
işleme
ba2d6c348d

+ 36 - 12
src/views/categroyManager/specialSetup/branchSetting.vue

@@ -232,16 +232,6 @@
             ref="cascader"
             clearable
           ></el-cascader>
-
-          <el-tag
-            :key="tag.id"
-            v-show="isDisabled"
-            v-for="tag in dynamicTags"
-            :disable-transitions="false"
-            @close="handleClose(tag)"
-          >
-            {{ tag.name }}
-          </el-tag>
         </el-form-item>
         <el-form-item
           label="公司名称"
@@ -464,6 +454,7 @@ import { vaildStudentUrl } from "@/utils/validate";
 import { queryEmployByOrganId } from "@/api/systemManage";
 import ImageCropper from "@/components/ImageCropper";
 import { queryTree } from "../../accompaniment/api";
+import _ from "lodash";
 export default {
   name: "branchSetting",
   components: { pagination, qrCode, ImageCropper },
@@ -613,15 +604,19 @@ export default {
       this.$refs[formName].validate(valid => {
         if (!valid) return;
         this.form.areaId = this.form.city;
+        const { teachingMaterialId } = this.form;
+        let tempArr = [];
+        teachingMaterialId.forEach(ids => {
+          tempArr.push(_.last(ids));
+        });
         let obj = {
           ...this.form,
           organManager: this.form.organManager.join(","),
           educationId: this.form.educationId.join(","),
           repairId: this.form.repairId.join(","),
           joinTeacherId: this.form.joinTeacherId.join(","),
-          teachingMaterialId: this.form.teachingMaterialId.join(",")
+          teachingMaterialId: tempArr.join(",")
         };
-
         if (this.formActionTitle == "create") {
           if (obj.id) {
             // 判断有没有Id,如果有则删除
@@ -712,6 +707,15 @@ export default {
         getParentArea({ id: row.areaId }).then(res => {
           if (res.code == 200 && res.data) {
             this.getAreaList(res.data.id, () => {
+              let tempIdArr = [];
+              if (row.teachingMaterialId) {
+                const tempIds = row.teachingMaterialId
+                  .split(",")
+                  .map(i => Number(i));
+                tempIds.forEach(id => {
+                  tempIdArr.push(this.formatParentId(id, this.teachList));
+                });
+              }
               this.form = {
                 id: row.id,
                 name: row.name,
@@ -728,6 +732,7 @@ export default {
                   ? row.joinTeacherId.split(",")
                   : [],
                 educationId: row.educationId ? row.educationId.split(",") : [],
+                teachingMaterialId: tempIdArr,
                 corporateName: row.corporateName,
                 corporateCode: row.corporateCode,
                 corporateSeal: row.corporateSeal,
@@ -735,6 +740,7 @@ export default {
                 maxMusicalInstrumentsProfits: row.maxMusicalInstrumentsProfits
               };
             });
+
             this.branchStatus = true;
           }
         });
@@ -742,6 +748,24 @@ export default {
         this.branchStatus = true;
       }
     },
+    formatParentId(id, list, ids = []) {
+      for (const item of list) {
+        if (item.sysMusicScoreCategoriesList) {
+          const cIds = this.formatParentId(
+            id,
+            item.sysMusicScoreCategoriesList,
+            [...ids, item.id]
+          );
+          if (cIds.includes(id)) {
+            return cIds;
+          }
+        }
+        if (item.id === id) {
+          return [...ids, id];
+        }
+      }
+      return ids;
+    },
     showCode(row) {
       this.qrCodeUrl =
         vaildStudentUrl() + "/project/register/index.html?organId=" + row.id;