zengyicheng 1 year ago
parent
commit
20cd54bf63

+ 1 - 1
src/components/pages/kindStudentEva/index.vue

@@ -5,7 +5,7 @@
       <panelA :userid="suid" :oid="oid" :org="org"></panelA>
     </div>
     <div class="tp_right">
-      <testA :userid="suid" :oid="oid" :org="org"></testA>
+      <testA :userid="suid" :oid="oid" :org="org" :cid="cid"></testA>
     </div>
   </div>
 </template>

+ 118 - 169
src/components/pages/kindStudentEva/test/diary.vue

@@ -1,44 +1,38 @@
 <template>
   <div class="diary">
     <div
-      style="background-color: #fff;width: 100%;height: 100%;box-sizing: border-box; padding: 15px;"
+      style="
+        background-color: #fff;
+        width: 100%;
+        height: 100%;
+        box-sizing: border-box;
+        padding: 15px;
+      "
     >
       <!-- 分类与导出 -->
       <div class="top">
         <div class="oneType">
-          <div
-            v-for="(i, index) in VeidooList"
-            :key="index + 'a'"
-            :class="Veidoo == i.id ? 'onTypeTxt' : 'onTypeTxt2'"
-            @click="changeType(i)"
-          >
-            {{ i.name }}
-            <div
-              class="line"
-              :style="{ display: Veidoo == i.id ? 'block' : 'none' }"
-            ></div>
-          </div>
-        </div>
-        <div class="wordBtn" @click="judgeExport">
-          导出Excel
-        </div>
-        <div class="twoType">
-          <div
-            v-for="(i, index) in VeidooListChild"
-            :key="index + 'b'"
-            :class="VeidooChild == i.id ? 'twoTypeTxt' : 'twoTypeTxt2'"
-            @click="changeTypeChild(i)"
-          >
-            {{ i.name }}
+          <div class="all_choose" v-for="(item, index) in VeidooList" :key="index"
+            :style="{ margin: !VeidooJson[item.id].length && 0 }">
+            <!-- 大分类 -->
+            <span v-if="VeidooJson[item.id].length" @click="点击赋值ftypeId(item.id)" :class="ftypeId == item.id ? '被点击的样式' : '没被点击的样坏死' "><span>{{ item.name }}</span></span>
+            <!-- 子分类 -->
+            <div class="typeCss" v-if="VeidooJson[item.id].length">
+              <div v-for="(item1, index1) in VeidooJson[item.id]" :key="index + '-' + index1" :label="item1.id">
+                <div class="cName"  @click="点击赋值stypeId(item.id)" :class="stypeId == item.id ? '被点击的样式' : '没被点击的样坏死' ">
+                  {{ item1.name }}
+                </div>
+              </div>
+            </div>
           </div>
         </div>
+        <div class="wordBtn" @click="judgeExport">导出Excel</div>
       </div>
       <div class="selectSty">
-        <div style="margin-right: 10px;">时间筛选</div>
-        <el-select v-model="termId" placeholder="请选择">
+        <div style="margin-right: 10px">学期</div>
+        <el-select v-model="termId" placeholder="请选择" @change="getData">
           <el-option
-            label="全部"
-            @click.native="changeTerm('')"
+            label="所有学期"
             value=""
           ></el-option>
           <el-option
@@ -46,7 +40,6 @@
             :key="item.id"
             :label="item.name"
             :value="item.id"
-            @click.native="changeTerm(item.id)"
           >
           </el-option>
         </el-select>
@@ -60,7 +53,7 @@
         header-align="center"
         :header-cell-style="{
           background: '#E0EAFB',
-          color: 'rgba(0, 0, 0, 0.90)'
+          color: 'rgba(0, 0, 0, 0.90)',
         }"
         @selection-change="handleSelectionChange"
       >
@@ -118,21 +111,21 @@
             <div class="evaluate">
               <div
                 class="TableBtn"
-                style="color: #3681FC;"
-                @click="lookRecord(scope.row)"
+                style="color: #3681fc"
+                @click="lookRecord(scope.row,0)"
               >
                 查看
               </div>
               <div
                 class="TableBtn"
-                style="color: #3681FC;"
-                @click="updateCred(scope.row)"
+                style="color: #3681fc"
+                @click="updateCred(scope.row,1)"
               >
                 修改
               </div>
               <div
                 class="TableBtn"
-                style="color: #EE3E3E;"
+                style="color: #ee3e3e"
                 @click="delRecord(scope.row)"
               >
                 删除
@@ -171,12 +164,27 @@
 import popbox from "./component/popbox";
 export default {
   components: {
-    popbox
+    popbox,
+  },
+  props: {
+    userid: {
+      type: String,
+    },
+    oid: {
+      type: String,
+    },
+    org: {
+      type: String,
+    },
+    cid: {
+      type: String,
+    },
   },
   data() {
     return {
       // 筛选数据
       VeidooList: [],
+      VeidooJson:{},
       VeidooListChild: [],
       // 默认选择项
       // VeidooValue:{},
@@ -203,7 +211,9 @@ export default {
       recordDataCopy: {},
       weiList: [],
       studentList: [],
-      judgeNum: 0
+      judgeNum: 0,
+      ftypeId: "",
+      stypeId: "",
     };
   },
   methods: {
@@ -220,25 +230,21 @@ export default {
       this.Page = val;
       this.selectData();
     },
-    // 获取数据
-    getData() {
-      // 获取筛选框数据
+    //获取分类
+    getVeidooType() {
       let params = {
-        uid: this.$route.query.userid,
-        cid: this.$route.query.cid,
-        org: this.$route.query.org,
-        cu: ""
+        org: this.org,
+        oid: this.oid,
       };
       this.ajax
-        .get(this.$store.state.api + "selectSETable", params)
-        .then(res => {
-          this.isLoading = false;
-          var ftype = res.data[1]; //公共父级分类
-          var stype = res.data[2]; //公共子级分类
-          var sctype = res.data[3]; //该学校子级分类
-          var fctype = res.data[4]; //该学校父级分类
-          var fotype = res.data[5]; //组织父级分类
-          var sotype = res.data[6]; //组织子级分类
+        .get(this.$store.state.api + "selectSTEType", params)
+        .then((res) => {
+          var ftype = res.data[0]; //公共父级分类
+          var stype = res.data[1]; //公共子级分类
+          var sctype = res.data[2]; //该学校子级分类
+          var fctype = res.data[3]; //该学校父级分类
+          var fotype = res.data[4]; //组织父级分类
+          var sotype = res.data[5]; //组织子级分类
           var allfType = [];
           var allsType = [];
           if (fotype.length == 0 && sotype.length == 0) {
@@ -265,133 +271,59 @@ export default {
               allsType.push(sctysotypepe[[i]]);
             }
           }
-
-          allfType.forEach((e, index) => {
-            allfType[index][e.id] = [];
-          });
-
-          // 大数组套小数组循环,进行push操作,最后手动添加艺术
-          allfType.forEach((e, w) => {
-            allsType.forEach((k, index) => {
-              if (e.id == k.pid) {
-                // console.log("e.id", ftype[w][e.id]);
-                allfType[w][e.id].push(k);
+          var VeidooJson = {};
+          for (var i = 0; i < allfType.length; i++) {
+            this.ftypeId = allfType[0].id;
+            if (!VeidooJson[allfType[i].id]) {
+              VeidooJson[allfType[i].id] = [];
+            }
+            for (var j = 0; j < allsType.length; j++) {
+              if (allfType[i].id == allsType[j].pid) {
+                VeidooJson[allfType[i].id].push(allsType[j]); // 去除公共分类
               }
-            });
-          });
-          this.VeidooList = allfType;
-
-          // 渲染完数据后立即查询一次默认筛选项
-          this.changeType(this.VeidooList[0]);
-
-          // 学期数据
-          this.ajax
-            .get(this.$store.state.api + "selectTerm", {})
-            .then(res => {
-              this.isLoading = false;
-              console.log("学期数据", res.data[0]);
-              this.termList = res.data[0];
-              this.termList.forEach(e => {
-                if (e.defaultC == 1) {
-                  this.termId = e.id;
-                  // this.termValue = e.name;
-                }
-              });
+            }
+          }
 
-              // 调用获取数据方法
-              this.selectData();
-            })
-            .catch(err => {
-              this.isLoading = false;
-              console.error(err);
-            });
-          // console.log("ftype1", ftype);
+          this.VeidooList = allfType;
+          this.VeidooJson = VeidooJson;
         })
-        .catch(err => {
+        .catch((err) => {
           this.isLoading = false;
           console.error(err);
         });
-
-      // 获取纬度筛选框
-      const data = {
-        oid: this.$route.query.org,
-        cla: 0
-      };
-
-      this.ajax.get(this.$store.state.api + "selectVeiDoo", data).then(res => {
-        // console.log(res);
-        this.weiList = res.data[0];
-        console.log("this.weiList", res);
-      });
-      // 获取班学生列表
-      const data2 = {
-        cid: this.$route.query.cid,
-        uid: this.$route.query.suid
-      };
-      this.ajax
-        .get(this.$store.state.api + "selectManyClassStudent", data2)
-        .then(res => {
-          // console.log(res);
-          this.studentList = res.data[0];
-          console.log("this.studentList", res);
-        });
-    },
-    // 选择导出哪些记录
-    handleSelectionChange(val) {
-      this.multipleSelection = val;
-      console.log(this.multipleSelection);
-    },
-    // 点击大筛选项
-    changeType(e) {
-      // console.log(e[e.id]);
-      // 点击大筛选项,清除小筛选项
-      this.VeidooChild = "";
-
-      this.Veidoo = e.id;
-      this.VeidooListChild = e[e.id];
-      this.selectData();
     },
-    // 点击小选项
-    changeTypeChild(e) {
-      // 重复点击取消选择
-      if (this.VeidooChild == e.id) {
-        this.VeidooChild = "";
-      } else {
-        this.VeidooChild = e.id;
-      }
-      this.selectData();
-    },
-    // 点击学期
-    changeTerm(e) {
-      console.log(e);
-      this.termId = e;
-      this.selectData();
-    },
-    // 获取筛选数据
-    selectData() {
-      let data = {
-        uid: this.$route.query.suid,
-        cid: this.$route.query.cid,
+    // 获取数据
+    getData() {
+      // 获取筛选框数据
+      let params = {
+        uid: this.userid,
+        cid: this.cid,
         cu: this.Veidoo,
-        cn: this.VeidooChild,
+        cn: this.VeidooListChild,
         cm: this.termId,
         page: this.page,
-        lim: 8
       };
-      // return console.log("selectData", data);
       this.ajax
-        .get(this.$store.state.api + "selectVeidooType", data)
-        .then(res => {
+        .get(this.$store.state.api + "selectVeidooType", params)
+        .then((res) => {
           this.isLoading = false;
           this.tableData = res.data[0];
           this.total = res.data[0].length > 0 ? res.data[0][0].num : 0;
           console.log(" 获取筛选数据", res);
+        })
+        .catch((err) => {
+          this.isLoading = false;
+          console.error(err);
         });
     },
+    // 选择导出哪些记录
+    handleSelectionChange(val) {
+      this.multipleSelection = val;
+      console.log(this.multipleSelection);
+    },
     // 修改记录
-    updateCred(e) {
-      this.judgeNum = 1;
-      this.isPop = true;
+    updateCred(e,t) {
+      this.judgeNum = t;
       if (!Array.isArray(e.type)) {
         if (!e.type) {
           e.type = [];
@@ -414,6 +346,22 @@ export default {
         }
       }
       this.recordData = e;
+      this.getClassStudent();
+    },
+    getClassStudent(){
+      // 获取班学生列表
+      const data2 = {
+        cid: this.cid,
+        uid: this.userid,
+      };
+      this.ajax
+        .get(this.$store.state.api + "selectManyClassStudent", data2)
+        .then((res) => {
+          // console.log(res);
+          this.studentList = res.data[0];
+          console.log("this.studentList", res);
+          this.isPop = true;
+        });
     },
     // 判断导出数据
     judgeExport() {
@@ -480,25 +428,25 @@ export default {
       // FileSaver.saveAs(new Blob([wbout], { type: "application/octet-stream" }), `${title} demo.xlsx`);//保存文件
       this.$message({
         message: "导出成功",
-        type: "success"
+        type: "success",
       });
     },
     // 删除记录
     delRecord(e) {
       this.$confirm("是否删除?", "提示", {
         confirmButtonText: "确定",
-        cancelButtonText: "取消"
+        cancelButtonText: "取消",
       })
         .then(() => {
           this.ajax
             .post(this.$store.state.api + "updateRecord", [{ rid: e.rid }])
-            .then(res => {
+            .then((res) => {
               console.log(res);
               this.selectData();
 
               this.$message({
                 type: "success",
-                message: "已删除"
+                message: "已删除",
               });
               // this.isLoading = false; updateRecord
             });
@@ -506,7 +454,7 @@ export default {
         .catch(() => {
           this.$message({
             type: "info",
-            message: "已取消删除"
+            message: "已取消删除",
           });
         });
       // return console.log(e);
@@ -537,16 +485,17 @@ export default {
         }
       }
       this.recordData = e;
-    }
+    },
   },
   created() {
+    this.getVeidooType();
     this.getData();
   },
   mounted() {
     // this.$nextTick(() => {
     //   this.selectData();
     // });
-  }
+  },
 };
 </script>
 

+ 4 - 1
src/components/pages/kindStudentEva/test/index.vue

@@ -29,7 +29,7 @@
       </div>
     </div>
     <div class="i_body_contant">
-      <Diary v-if="type == 1" :oid="oid" :userid="userid" :org="org"></Diary>
+      <Diary v-if="type == 1" :oid="oid" :userid="userid" :org="org" :cid="cid"></Diary>
       <Score v-if="type == 2" :oid="oid" :userid="userid" :org="org"></Score>
       <Report v-if="type == 3" :oid="oid" :userid="userid" :org="org"></Report>
     </div>
@@ -51,6 +51,9 @@ export default {
     org: {
       type: String,
     },
+    cid: {
+      type: String,
+    },
   },
   components: {
     Diary,