11wqe1 преди 8 месеца
родител
ревизия
1e2315fa0c
променени са 1 файла, в които са добавени 56 реда и са изтрити 37 реда
  1. 56 37
      src/components/pages/test/aggregate/index.vue

+ 56 - 37
src/components/pages/test/aggregate/index.vue

@@ -1,21 +1,10 @@
 <template>
   <div class="aggregate">
-    <el-table
-      :data="tableData"
-      border
-      style="width: 100%"
-      v-loading="tabLoading"
-    >
+    <el-table :data="tableData" border style="width: 100%" v-loading="tabLoading" @header-click="handleHeaderClick">
       <el-table-column fixed align="center" type="index" width="50">
       </el-table-column>
 
-      <el-table-column
-        fixed
-        align="center"
-        prop="username"
-        label="教师姓名"
-        width="150"
-      >
+      <el-table-column fixed align="center" prop="username" label="教师姓名" width="150">
       </el-table-column>
       <el-table-column fixed align="center" label="教研室" width="130">
         <template slot-scope="scope">
@@ -26,17 +15,15 @@
 
       <div v-for="item in titList" :key="item.id">
         <el-table-column align="center" :label="item.name">
-          <div  v-for="e in allFrom" :key="e.courseId">
-            <el-table-column
-              v-if="e.typeid == item.id"
-              align="center"
-              :prop="e.courseId"
-              :label="e.title"
-              width="130"
-            >
+          <div v-for="e in allFrom" :key="e.courseId">
+            <el-table-column v-if="e.typeid == item.id" align="center" :prop="e.courseId" :label="e.title"
+              :cell-style="{ color: '#000' }" width="130">
               <template slot-scope="scope">
-                <!-- <el-button size="small" @click="lookPrize(e.courseId)">点</el-button> -->
-                {{ scope.row.works.indexOf(e.courseId) == -1 ? "○" : "●" }}
+                <div v-if="e.juri2 && arrayToArray(scope.row.teaId ? scope.row.teaId.split(',') : [],e.juri2 ? e.juri2.split(',') : []).length && scope.row.works.indexOf(e.courseId) !== -1"
+                  class="yuan blacky"></div>
+                <div v-else-if="scope.row.works.indexOf(e.courseId) !== -1" class="yuan blacky"></div>
+                <div v-else-if="e.juri2 && arrayToArray(scope.row.teaId ? scope.row.teaId.split(',') : [],e.juri2 ? e.juri2.split(',') : []).length == 0" class="yuan greyy"></div>
+                <div v-else class="yuan"></div>
               </template>
             </el-table-column>
           </div>
@@ -65,6 +52,21 @@ export default {
   },
 
   methods: {
+    arrayToArray(arrayo, arrayt) {
+      let array1 = arrayo;
+      let array2 = arrayt;
+
+      let commonElements = [];
+
+      for (let i = 0; i < array1.length; i++) {
+        for (let j = 0; j < array2.length; j++) {
+          if (array1[i] === array2[j]) {
+            commonElements.push(array1[i]);
+          }
+        }
+      }
+      return commonElements;
+    },
     getData() {
       this.tabLoading = true;
 
@@ -94,25 +96,42 @@ export default {
           console.log(error);
         });
     },
-    // 查看数据来源
-    lookPrize(val) {
+    handleHeaderClick(column, event) {
+      // console.log("表头被点击", column, event);
       this.$router.push(
         "/checkToTest?cid=" +
-          val +
-          "&oid=" +
-          this.oid +
-          "&org=" +
-          this.org +
-          "&type=" +
-          2 +
-          "&role=" +
-          this.role
+        column.property +
+        "&oid=" +
+        this.oid +
+        "&org=" +
+        this.org +
+        "&type=" +
+        2 +
+        "&role=" +
+        this.role
       );
-      // this.ifmUrl = `https://beta.pbl.cocorobo.cn/pbl-teacher-table/dist/#/
-      // checkToTest?cid=${val}&oid=${this.oid}&org=${this.org}&type=2&role=0`;
+      // 在这里处理点击事件
     }
   }
 };
 </script>
 
-<style scoped></style>
+<style scoped>
+.yuan {
+  width: 13px;
+  height: 13px;
+  border: 1px solid #000;
+  border-radius: 100%;
+  box-sizing: border-box;
+  margin: 0 auto;
+}
+
+.blacky {
+  background-color: #000;
+}
+
+.greyy {
+  background-color: #eee;
+  border: 1px solid #eee;
+}
+</style>