浏览代码

添加乐团

1
mo 3 年之前
父节点
当前提交
df041adca8
共有 1 个文件被更改,包括 72 次插入15 次删除
  1. 72 15
      src/views/liveClassManager/newLiveClass.vue

+ 72 - 15
src/views/liveClassManager/newLiveClass.vue

@@ -175,13 +175,16 @@
               <el-radio label="ALL">全员</el-radio>
               <el-radio label="ORGAN">分部</el-radio>
               <el-radio label="SCHOOL">合作单位</el-radio>
+              <el-radio label="TEAM">乐团</el-radio>
             </el-radio-group>
           </el-form-item>
         </el-row>
         <el-row class="row">
           <el-form-item
             v-if="
-              form.popularizeType == 'SCHOOL' || form.popularizeType == 'ORGAN'
+              form.popularizeType == 'SCHOOL' ||
+              form.popularizeType == 'ORGAN' ||
+              form.popularizeType == 'TEAM'
             "
             label="分部"
             prop="organIds"
@@ -216,6 +219,7 @@
               filterable
               clearable
               multiple
+              @change="changeSchool"
             >
               <el-option
                 v-for="(item, index) in cooperationList"
@@ -226,6 +230,29 @@
             </select-all>
           </el-form-item>
         </el-row>
+        <el-row class="row">
+          <el-form-item
+            v-if="form.popularizeType == 'TEAM'"
+            label="乐团"
+            prop="teamIds"
+            :rules="[{ required: true, message: '请选择乐团' }]"
+          >
+            <select-all
+              v-model.trim="form.teamIds"
+              :disabled="form.organIds.length <= 0"
+              filterable
+              clearable
+              multiple
+            >
+              <el-option
+                v-for="(item, index) in teamList"
+                :key="index"
+                :label="item.name"
+                :value="item.id"
+              ></el-option>
+            </select-all>
+          </el-form-item>
+        </el-row>
         <el-alert
           title="直播间信息"
           type="info"
@@ -326,6 +353,7 @@ import axios from "axios";
 import { getToken, getTenantId } from "@/utils/auth";
 import { createLiveBroadcast, resetLiveBroadcastRoomList } from "./api";
 import { queryByOrganId } from "@/api/systemManage";
+import { getTeamList } from "@/api/teamServer";
 export default {
   components: { preview },
   data() {
@@ -354,7 +382,8 @@ export default {
       teacherList: [],
       checkList: [],
       cooperationList: [],
-      isinit:true
+      teamList: [],
+      isinit: true,
     };
   },
   mounted() {
@@ -362,19 +391,36 @@ export default {
     if (this.$route.query.id) {
       this.name = "修改直播间";
       // console.log()
-      this.form = { ...this.$route.query, organIds: [],
-        schoolIds: [], };
+      this.form = { ...this.$route.query, organIds: [], schoolIds: [] };
       this.form.roomConfig = JSON.parse(this.$route.query.roomConfig);
+      if (this.$route.query.popularizeOrgIds) {
+        this.form.organIds = this.$route.query.popularizeOrgIds
+          .split(",")
+          .map((item) => {
+            return item * 1;
+          });
+      }
 
-      this.form.organIds =
-        this.$route.query.popularizeOrgIds.split(",").map(item=>{return item*1});
+      if (this.$route.query.popularizeSchoolIds) {
+        this.form.schoolIds = this.$route.query.popularizeSchoolIds
+          .split(",")
+          .map((item) => {
+            return item * 1;
+          });
+      }
 
-      this.form.schoolIds=this.$route.query.popularizeSchoolIds.split(",").map(item=>{return item*1});
+      if (this.$route.query.popularizeTeamIds) {
+        this.form.teamIds = this.$route.query.popularizeTeamIds
+          .split(",")
+
+      }
 
       // this.form.popularizeType = "SCHOOL";
-        this.changeSection(this.form.organIds)
+      this.changeSection(this.form.organIds);
       this.remoteMethod(this.$route.query.speakerName);
+
       this.checkList.push(this.form.preTemplate * 1);
+      this.isinit = false;
     }
   },
   methods: {
@@ -472,6 +518,7 @@ export default {
     async submit() {
       this.form.popularizeOrgIds = this.form.organIds.join(",");
       this.form.popularizeSchoolIds = this.form.schoolIds.join(",");
+      this.form.popularizeTeamIds = this.form.teamIds.join(",");
       if (this.$route.query.id) {
         // 修改
         try {
@@ -497,15 +544,14 @@ export default {
     changeType() {
       this.$set(this.form, "organIds", []);
       this.$set(this.form, "schoolIds", []);
+      this.$set(this.form, "teamIds", []);
     },
     async changeSection(val) {
-
-      if(!this.isinit){
-         this.form.schoolIds = [];
+      if (!this.isinit) {
+        this.form.schoolIds = [];
+        this.form.teamIds = [];
       }
-   console.log('进来了', this.form,(this.form.popularizeType == "SCHOOL" ) )
-      if (this.form.popularizeType == "SCHOOL" && val && val.length > 0) {
-
+      if (this.form.popularizeType == "SCHOOL" || (val && val.length > 0)) {
         let organId = val.join(",");
         try {
           await queryByOrganId({ organId }).then((res) => {
@@ -517,7 +563,18 @@ export default {
           console.log(e);
         }
       }
-     this.isinit = false
+      if (this.form.popularizeType == "TEAM" || (val && val.length > 0)) {
+        let organId = val.join(",");
+        try {
+          await getTeamList({ organId, page: 1, rows: 9999 }).then((res) => {
+            if (res.code == 200) {
+              this.teamList = res.data.rows;
+            }
+          });
+        } catch (e) {
+          console.log(e);
+        }
+      }
     },
   },
 };