Tang 3 éve
szülő
commit
280de3720b

+ 44 - 0
src/utils/methodsTool.js

@@ -309,5 +309,49 @@ export default {
 	 */
 	storageRemove(name) {
 		return window.localStorage.removeItem(name)
+	},
+	/**
+	 * 
+	 * @param {Number} ids 
+	 * @returns 缓存业务层级
+	 */
+	cacheBusinessList(ids) {
+		let newTime = new Date(new Date().toLocaleDateString()).getTime() // 获取当天时间戳
+		if (this.storageGet('business')) {
+			let businessList = JSON.parse(this.storageGet('business'))
+			if (businessList.time != newTime) {
+				this.storageRemove(business)
+				this.cacheBusinessList(ids)
+			} else {
+				if (!businessList.business.includes(ids)) {
+					businessList.business.push(ids)
+					this.storageSet('business', JSON.stringify(businessList))
+				}
+			}
+		} else {
+			let businessList = {
+				time: newTime,
+				business: [ids]
+			}
+			this.storageSet('business', JSON.stringify(businessList))
+		}
+	},
+	/**
+	 * 
+	 * @returns 获取缓存业务层级
+	 */
+	getBusinessList() {
+		let newTime = new Date(new Date().toLocaleDateString()).getTime() // 获取当天时间戳
+		if (this.storageGet('business')) {
+			let businessList = JSON.parse(this.storageGet('business'))
+			if (businessList.time != newTime) {
+				this.storageRemove(business)
+				return []
+			} else {
+				return businessList.business
+			}
+		} else {
+			return []
+		}
 	}
 }

+ 46 - 7
src/views/resource/videoManagement/festival/add/index.vue

@@ -22,7 +22,7 @@
             >
             </el-option>
           </el-select>
-          <el-select
+          <!-- <el-select
             v-model="courType"
             placeholder="请选择业务层次"
             @change="changecourseType"
@@ -34,6 +34,25 @@
               :value="item.id"
             >
             </el-option>
+          </el-select> -->
+          <el-select
+            v-model="courType"
+            placeholder="请选择业务层次"
+            @change="changecourseType"
+          >
+            <el-option-group
+              v-for="(item, index) in newCourTypeOptions"
+              :key="index"
+              :label="item.label"
+            >
+              <el-option
+                v-for="(items, indexs) in item.options"
+                :key="indexs"
+                :label="items.projectName + '-' + items.businessName"
+                :value="items.id"
+              >
+              </el-option>
+            </el-option-group>
           </el-select>
           <el-popover
             ref="popovers"
@@ -416,7 +435,6 @@ export default {
       newActiveRecordingUrl2: "",
       newSteamUrl2: [], //回放流地址
       eduTypeOptions: [], //教育类型数据
-      projectTypeOptions: [], //项目类型数据
       courTypeOptions: [], //业务层次数据
       newCourTypeOptions: [], //当前业务层次数据
       sujectOption: [], //科目数据
@@ -783,12 +801,32 @@ export default {
       this.$api.inquireCourseEducationType({ status: 1 }).then((res) => {
         this.eduTypeOptions = res.rows;
       });
-      this.$api.inquireCourseProjectType({ status: 1 }).then((res) => {
-        this.projectTypeOptions = res.rows;
-      });
       this.$api.inquirebusinessList({ status: 1 }).then((res) => {
+        console.log(this.$methodsTools.getBusinessList().length, "aaa");
         this.courTypeOptions = res.rows;
-        this.newCourTypeOptions = res.rows;
+        let options = [
+          {
+            label: "最近选择",
+            options: [],
+          },
+          {
+            label: "业务层级",
+            options: [],
+          },
+        ];
+        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;
+        }
+        this.newCourTypeOptions = options;
       });
       this.$api.inquireCourseSubject({ status: 1 }).then((res) => {
         res.rows.map((item, index) => {
@@ -832,7 +870,8 @@ export default {
       });
       this.newCourTypeOptions = arrays;
     },
-    changecourseType() {
+    changecourseType(ids) {
+      this.$methodsTools.cacheBusinessList(ids);
       this.newCourTypeOptions.map((item, index) => {
         if (item.id === this.courType) {
           this.eduType = item.educationId;