guhongwei 4 years ago
parent
commit
d5d31e0ed7
2 changed files with 33 additions and 10 deletions
  1. 2 3
      src/views/classes/lesson.vue
  2. 31 7
      src/views/classes/parts/class-info.vue

+ 2 - 3
src/views/classes/lesson.vue

@@ -51,8 +51,8 @@ export default {
       result: [],
     };
   },
-  created() {
-    this.getClassInfo();
+  async created() {
+    await this.getClassInfo();
   },
   methods: {
     ...classes(['fetch']),
@@ -67,7 +67,6 @@ export default {
       if (classid) {
         let res = await this.fetch(classid);
         if (this.$checkRes(res)) {
-          console.log(res.data);
           this.$set(this, `classInfo`, res.data);
           this.getSettingLists(this.classInfo);
         }

+ 31 - 7
src/views/classes/parts/class-info.vue

@@ -1,7 +1,7 @@
 <template>
   <div id="class-info">
     <data-form ref="form" :inline="true" :needSave="false" :data="form" :fields="fields" :rules="{}" @save="handleSave" :reset="false">
-      <template #options="{item, form}">
+      <!-- <template #options="{item, form}">
         <template v-if="item.model == 'headteacherid'">
           <el-option-group v-for="(dept, index) in headTeacherList" :label="dept.name" :key="index">
             <el-option v-for="(i, tIndex) in dept.list" :key="`${index}-${tIndex}`" :label="i.name" :value="i._id"></el-option>
@@ -22,6 +22,26 @@
         <template v-if="item.model == 'yclocationid'">
           <el-option v-for="(place, index) in locationList" :key="`${item.model}${index}`" :label="place.name" :value="place.id"></el-option>
         </template>
+      </template> -->
+      <template #custom="{item, form}">
+        <template v-if="item.model == 'headteacherid'">
+          {{ classInfo.headteacher || '暂无' }}
+        </template>
+        <template v-else-if="item.model == 'lyteacherid'">
+          {{ getly(form.lyteacherid) || '暂无' }}
+        </template>
+        <template v-else-if="item.model == 'jslocationid'">
+          {{ classInfo.jslocation || '暂无' }}
+        </template>
+        <template v-else-if="item.model == 'kbyslocationid'">
+          {{ classInfo.kbyslocation || '暂无' }}
+        </template>
+        <template v-else-if="item.model == 'kzjhlocationid'">
+          {{ classInfo.kzjhlocation || '暂无' }}
+        </template>
+        <template v-else-if="item.model == 'yclocationid'">
+          {{ classInfo.yclocation || '暂无' }}
+        </template>
       </template>
     </data-form>
   </div>
@@ -48,12 +68,12 @@ export default {
       fields: [
         // { label: '', model: 'name', type: 'text' },
         // { label: '人数', model: 'number', type: 'text' },
-        { label: '班主任', model: 'headteacherid', type: 'select', options: { disabled: true } },
-        { label: '礼仪课教师', model: 'lyteacherid', type: 'select', options: { disabled: true } },
-        { label: '教室地点', model: 'jslocationid', type: 'select', options: { disabled: true } },
-        { label: '开班地点', model: 'kbyslocationid', type: 'select', options: { disabled: true } },
-        { label: '拓展训练地点', model: 'kzjhlocationid', type: 'select', options: { disabled: true } },
-        { label: '用餐地点', model: 'yclocationid', type: 'select', options: { disabled: true } },
+        { label: '班主任', model: 'headteacherid', type: 'text', custom: true },
+        { label: '礼仪课教师', model: 'lyteacherid', type: 'text', custom: true },
+        { label: '教室地点', model: 'jslocationid', type: 'text', custom: true },
+        { label: '开班地点', model: 'kbyslocationid', type: 'text', custom: true },
+        { label: '拓展训练地点', model: 'kzjhlocationid', type: 'text', custom: true },
+        { label: '用餐地点', model: 'yclocationid', type: 'text', custom: true },
       ],
     };
   },
@@ -69,6 +89,10 @@ export default {
         this.$emit('saveResult', { from: 'info', result: true });
       }
     },
+    getly(id) {
+      let res = this.lyTeacherList.find(i => (i.id = id));
+      if (res) return res.name;
+    },
   },
   computed: {
     ...mapState(['user']),