Explorar o código

fiex:暂存业务层级调整中

Tang %!s(int64=3) %!d(string=hai) anos
pai
achega
24ee580fde

+ 1 - 1
src/utils/methodsTool.js

@@ -345,7 +345,7 @@ export default {
 		if (this.storageGet('business')) {
 			let businessList = JSON.parse(this.storageGet('business'))
 			if (businessList.time != newTime) {
-				this.storageRemove(business)
+				this.storageRemove('business')
 				return []
 			} else {
 				return businessList.business

+ 62 - 22
src/views/resource/videoManagement/festival/add/index.vue

@@ -797,37 +797,75 @@ export default {
       this.handleCheckedCitiesChange();
     },
     hideHandle() {},
-    getDict() {
-      this.$api.inquireCourseEducationType({ status: 1 }).then((res) => {
-        this.eduTypeOptions = res.rows;
-      });
-      this.$api.inquirebusinessList({ status: 1 }).then((res) => {
-        console.log(this.$methodsTools.getBusinessList().length, "aaa");
-        this.courTypeOptions = res.rows;
-        let options = [
-          {
-            label: "最近选择",
-            options: [],
-          },
-          {
-            label: "业务层级",
-            options: [],
-          },
-        ];
+    /**
+     *
+     * @param {Bool} status true 全部 false 筛选
+     * @param {Number} id 筛选情况下 教育类型ID
+     */
+    concatList(status, id) {
+      let options = [
+        {
+          label: "最近选择",
+          options: [],
+        },
+        {
+          label: "业务层级",
+          options: [],
+        },
+      ];
+      if (status) {
+        this.$api.inquirebusinessList({ status: 1 }).then((res) => {
+          this.courTypeOptions = res.rows;
+          if (this.$methodsTools.getBusinessList().length) {
+            let arrlist = this.$methodsTools.getBusinessList();
+            res.rows.forEach((item) => {
+              if (arrlist.includes(item.id)) {
+                options[0].options.push(item);
+              } else {
+                options[1].options.push(item);
+              }
+            });
+          } else {
+            options[1].options = res.rows;
+          }
+          // let arrs = options.filter((item) => {
+          //   if (item.options.length) {
+          //     return item;
+          //   }
+          // });
+          this.newCourTypeOptions = options;
+        });
+      } else {
+        let arr = [];
         if (this.$methodsTools.getBusinessList().length) {
           let arrlist = this.$methodsTools.getBusinessList();
-          res.rows.forEach((item) => {
+          this.courTypeOptions.forEach((item) => {
             if (arrlist.includes(item.id)) {
               options[0].options.push(item);
-            } else {
-              options[1].options.push(item);
             }
           });
+          arr = this.courTypeOptions.filter((item) => {
+            return item.educationId == id && !arrlist.includes(item.id);
+          });
         } else {
-          options[1].options = res.rows;
+          arr = this.courTypeOptions.filter((item) => {
+            return item.educationId == id;
+          });
         }
+        options[1].options = arr;
+        // let arrs = options.filter((item) => {
+        //   if (item.options.length) {
+        //     return item;
+        //   }
+        // });
         this.newCourTypeOptions = options;
+      }
+    },
+    getDict() {
+      this.$api.inquireCourseEducationType({ status: 1 }).then((res) => {
+        this.eduTypeOptions = res.rows;
       });
+      this.concatList(true);
       this.$api.inquireCourseSubject({ status: 1 }).then((res) => {
         res.rows.map((item, index) => {
           var array = [];
@@ -858,7 +896,9 @@ export default {
         this.newSteamUrl2 = newarrays2;
       });
     },
-    changeEduType() {
+    changeEduType(v) {
+      this.concatList(false, v);
+      return;
       if (!(this.courType === undefined || this.courType === "")) {
         this.courType = "";
       }