lrf402788946 4 년 전
부모
커밋
2181cd3383
1개의 변경된 파일40개의 추가작업 그리고 1개의 파일을 삭제
  1. 40 1
      src/views/task/index.vue

+ 40 - 1
src/views/task/index.vue

@@ -16,7 +16,15 @@
       <data-table :fields="fields" :data="tableData" :opera="opera" @view="toTaskList"></data-table>
     </list-frame>
     <el-dialog :visible.sync="eDialog" title="导出" width="30%">
-      <export-range :usestudent="false" @toExport="toExport" @close="eDialog = false"></export-range>
+      <export-range :usestudent="false" @toExport="toExport" @close="eDialog = false">
+        <el-form :model="subid" size="small">
+          <el-form-item label="科目(可选)">
+            <el-select v-model="subid" placeholder="请选择要导出的科目">
+              <el-option v-for="(i, index) in subjectList" :key="`sub${index}`" :label="i.name" :value="i._id"></el-option>
+            </el-select>
+          </el-form-item>
+        </el-form>
+      </export-range>
     </el-dialog>
   </div>
 </template>
@@ -31,6 +39,8 @@ const { mapActions: lesson } = createNamespacedHelpers('lesson');
 const { mapActions: util } = createNamespacedHelpers('util');
 const { mapActions: classes } = createNamespacedHelpers('classes');
 const { mapActions: task } = createNamespacedHelpers('task');
+const { mapActions: subject } = createNamespacedHelpers('subject');
+const { mapActions: classtype } = createNamespacedHelpers('classtype');
 export default {
   name: 'index',
   props: {},
@@ -54,6 +64,10 @@ export default {
     searchInfo: {},
     // 班级列表
     classList: [],
+    // 导出的科目id
+    subid: undefined,
+    subjectList: [],
+    ctList: [],
   }),
   created() {
     this.getOtherList();
@@ -71,6 +85,8 @@ export default {
     return { title: this.$route.meta.title };
   },
   methods: {
+    ...subject({ getSubject: 'query' }),
+    ...classtype({ getCtList: 'query' }),
     ...task(['export']),
     ...classes({ getClass: 'query' }),
     ...lesson({ lessionInfo: 'fetch', lessionList: 'query' }),
@@ -114,6 +130,29 @@ export default {
         duplicate = _.orderBy(duplicate, ['order'], ['asc']);
         this.$set(this, `classList`, duplicate);
       }
+      const subres = await this.getSubject();
+      if (this.$checkRes(subres)) {
+        this.$set(this, `subjectList`, subres.data);
+      }
+      const ctres = await this.getCtList();
+      if (this.$checkRes(ctres)) {
+        this.$set(this, `ctList`, ctres.data);
+      }
+      this.toSetSubjectList();
+    },
+    toSetSubjectList() {
+      let dupsub = _.cloneDeep(this.subjectList);
+      let dupct = _.cloneDeep(this.ctList);
+      dupsub = dupsub.map(i => {
+        const { type } = i;
+        const r = dupct.find(f => f.code === type);
+        if (r) {
+          const { name } = r;
+          if (name) i.name = `${i.name}(${name})`;
+        }
+        return i;
+      });
+      this.$set(this, `subjectList`, dupsub);
     },
     // 导出作业
     async toExport(range) {