Kaynağa Gözat

验收修改

lrf 1 yıl önce
ebeveyn
işleme
28c63c2363
3 değiştirilmiş dosya ile 62 ekleme ve 31 silme
  1. 53 25
      components/export-range.vue
  2. 8 6
      layout/admin/admin-menu.vue
  3. 1 0
      package.json

+ 53 - 25
components/export-range.vue

@@ -14,13 +14,13 @@
         </el-select>
       </el-form-item>
       <el-form-item label="批(可选)" v-if="usebatch">
-        <el-select clearable v-model="form.batchid">
-          <el-option v-for="(i, index) in batchList" :key="index" :label="`第${i.batch}批`" :value="i._id"></el-option>
+        <el-select clearable v-model="form.batchid" :multiple="mult">
+          <el-option v-for="(i, index) in batchList" :key="index" :label="i.name" :value="i._id"></el-option>
         </el-select>
       </el-form-item>
       <el-form-item label="班(可选)" v-if="useclass">
-        <el-select clearable v-model="form.classid" @change="selectClass">
-          <el-option v-for="(c, index) in classList" :key="index" :label="`${c.name.includes('班') ? c.name : `${c.name}班`}`" :value="c._id"></el-option>
+        <el-select clearable v-model="form.classid" :multiple="mult" @change="selectClass">
+          <el-option v-for="(c, index) in classList" :key="index" :label="c.name" :value="c._id"></el-option>
         </el-select>
       </el-form-item>
       <el-form-item label="人(可选)" v-if="usestudent">
@@ -89,31 +89,59 @@ export default {
     // 找到批次列表,查询班级列表
     async selectTerm(termids = []) {
       let termid;
+      // 只要选了期,就重置后面的选项
+      this.$set(this.form, `classid`, undefined);
+      this.$set(this.form, `batchid`, undefined);
+      // 多选单选分开处理
       if (this.mult) {
-        if (termids.length != 1) {
-          this.$set(this.form, `classid`, undefined);
-          this.$set(this.form, `batchid`, undefined);
-          return;
-        }
-        termid = _.head(termids);
-      } else termid = termids;
-      const r = this.termList.find(f => f._id === termid);
-      if (!r) return;
-      const { batchnum } = r;
-      this.$set(this, `batchList`, batchnum);
-      const stures = await this.getClass({ termid });
-      if (this.$checkRes(stures)) {
-        let duplicate = _.cloneDeep(stures.data);
-        duplicate = duplicate.map(i => {
-          if (parseInt(i.name)) {
-            i.order = parseInt(i.name);
-          } else {
-            // i.order = i.name;
+        if (termids.length >= 1) {
+          // 再将选择的期下的批次提取出来,将名字改成带期数的.以便区分
+          const batchList = [];
+          const classList = [];
+          for (const tid of termids) {
+            // 找期下的批次
+            const r = this.termList.find(f => f._id === tid);
+            if (!r) continue;
+            const { batchnum = [], term } = r;
+            for (const i of batchnum) {
+              // 处理批次选项
+              i.name = `第${term}期-第${i.batch}批`;
+              batchList.push(i);
+              // 处理班级选项
+              const cRes = await this.getClass({ termid: tid, batchid: i._id });
+              if (this.$checkRes(cRes)) {
+                const cl = cRes.data;
+                for (const c of cl) {
+                  c.name = `第${c.term}期-第${c.batch}批-${c.name}班`;
+                }
+                classList.push(...cl);
+              }
+            }
           }
+          // 批次列表
+          this.$set(this, `batchList`, batchList);
+          // 班级列表
+          this.$set(this, `classList`, classList);
+        }
+      } else {
+        termid = termids;
+        // 正常找期下的批次,班级
+        const r = this.termList.find(f => f._id === termid);
+        if (!r) return;
+        const { batchnum } = r;
+        const nbn = batchnum.map(i => {
+          i.name = `第${r.term}期-第${i.batch}批`;
           return i;
         });
-        duplicate = _.orderBy(duplicate, ['order'], ['asc']);
-        this.$set(this, `classList`, duplicate);
+        this.$set(this, `batchList`, nbn);
+        const stures = await this.getClass({ termid });
+        if (this.$checkRes(stures)) {
+          const cl = stures.data;
+          for (const c of cl) {
+            c.name = `第${c.term}期-第${c.batch}批-${c.name}班`;
+          }
+          this.$set(this, `classList`, cl);
+        }
       }
     },
     async selectClass(classid) {

+ 8 - 6
layout/admin/admin-menu.vue

@@ -8,14 +8,12 @@
         </div>
       </el-col>
       <el-col :span="24">
-        <template>
+        <el-scrollbar style="height:100vh; overflow-x: hidden;">
           <el-menu mode="vertical" :show-timeout="200" background-color="#00142a" text-color="hsla(0, 0%, 100%, .65)"
             active-text-color="#409EFF" :unique-opened="true" :default-active="defualtActive">
-            <scroll-bar>
-              <menu-item :menus="menu" :level="0"></menu-item>
-            </scroll-bar>
+            <menu-item :menus="menu" :level="0"></menu-item>
           </el-menu>
-        </template>
+        </el-scrollbar>
       </el-col>
     </el-row>
   </div>
@@ -32,7 +30,7 @@ export default {
   name: 'admin-menu',
   props: {},
   components: {
-    scrollBar,
+    // scrollBar,
     menuItem,
   },
   data: () => ({
@@ -152,4 +150,8 @@ export default {
     border: none;
   }
 }
+
+/deep/ .el-scrollbar__wrap {
+    overflow-x: hidden;
+}
 </style>

+ 1 - 0
package.json

@@ -14,6 +14,7 @@
     "element-ui": "^2.13.0",
     "jsonwebtoken": "^8.5.1",
     "lodash": "^4.17.15",
+    "naf-core": "^0.1.2",
     "qrcode": "^1.4.4",
     "vue": "^2.6.10",
     "vue-router": "^3.1.3",