Browse Source

no message

xiaoxin 1 year ago
parent
commit
6e7cead736

+ 3 - 3
src/components/energy/energyLeft.vue

@@ -32,7 +32,7 @@
         <div class="energy_box_left">
           <div class="left_top">
             <img src="@/assets/images/energy-left-icon2.png" />
-            用水量总计(
+            用水量总计(
           </div>
           <div class="left_bottom" ref="waterValueDom">{{ waterValue }}</div>
         </div>
@@ -63,7 +63,7 @@
           <div class="box_right">
             <div class="right_top">
               <div ref="waterValueAvDom">{{ waterValueAv }}</div>
-              <span></span>
+              <span></span>
             </div>
             <div>人均用水量</div>
           </div>
@@ -313,7 +313,7 @@ const initBarChart = () => {
     yAxis: [
       {
         type: "value",
-        name: currentIndex.value === "水" ? "" : "kw.h",
+        name: currentIndex.value === "水" ? "" : "kw.h",
         nameTextStyle: {
           fontSize: 14,
           color: "#fff",

+ 1 - 1
src/components/energy/energyRight.vue

@@ -100,7 +100,7 @@
           />
           <el-table-column
             prop="num"
-            label="用水量()"
+            label="用水量()"
             align="center"
             width="80"
           />

+ 139 - 332
src/components/user/userRight.vue

@@ -17,8 +17,27 @@
             >人</span
           >
         </div>
-        <div class="more" @click="handleClickMore(0)">查看更多 ></div>
       </div>
+
+      <!-- 搜索区域 -->
+      <div class="sub_search">
+        <div class="search_input">
+          <input type="text" placeholder="请输入关键字" v-model="keyword" />
+        </div>
+        <div class="search_select">
+          <el-cascader
+            ref="cascader"
+            v-model="classValue"
+            :options="options_class"
+            :props="props_class"
+            placeholder="请选择年级班级"
+            clearable
+            @change="handleChangeClass"
+          />
+        </div>
+        <div class="search_btn" @click="handleSearch">查询</div>
+      </div>
+
       <!-- 学生汇总表格区域 -->
       <div class="student form">
         <el-table :data="tableDataStudent">
@@ -48,110 +67,20 @@
           </el-table-column>
         </el-table>
       </div>
-      <!-- 教师汇总区域 -->
-      <!-- <div class="sub_title">
-        <div>
-          教师汇总
-          <span
-            >/<span ref="totalTeacherDom">{{ totalTeacher }}</span
-            >人</span
-          >
-        </div>
-        <div class="more" @click="handleClickMore(1)">查看更多 ></div>
-      </div> -->
-      <!-- 教师汇总表格区域 -->
-      <!-- <div class="teacher form">
-        <el-table :data="tableDataTeacher">
-          <el-table-column
-            prop="name"
-            label="姓名"
-            align="center"
-            width="120"
-            show-overflow-tooltip
-          />
-          <el-table-column
-            prop="cardNo"
-            label="编号"
-            align="center"
-            width="120"
-          />
-          <el-table-column prop="departMent" label="部门" align="center" />
-          <el-table-column label="操作" align="center">
-            <template #default="{ row }">
-              <div class="check" @click="handleCheckMsg(1, row)">查看</div>
-            </template>
-          </el-table-column>
-        </el-table>
-      </div> -->
-    </div>
 
-    <!-- 查看更多弹窗区域 -->
-    <div v-if="showPop" class="popup">
-      <div class="pop_box">
-        <!-- 标题区域 -->
-        <div class="pop_title">
-          <span>{{ popType === 0 ? "学生" : "教师" }}汇总</span>
-        </div>
-
-        <!-- 关闭按钮区域 -->
-        <div class="pop_close" @click="handleClose">×</div>
-
-        <!-- 内容区域 -->
-        <div class="pop_content">
-          <!-- 搜索区域 -->
-          <div class="pop_search">
-            <div class="search_input">
-              <input type="text" placeholder="请输入关键字" v-model="keyword" />
-            </div>
-            <div>
-              <el-cascader
-                ref="cascader"
-                v-model="classValue"
-                :options="options_class"
-                :props="props_class"
-                placeholder="请选择年级班级"
-                clearable
-                @change="handleChangeClass"
-              />
-            </div>
-            <div class="search_btn" @click="handleSearch">查询</div>
-          </div>
-
-          <!-- 表格区域 -->
-          <div class="pop_form form">
-            <el-table :data="tableDataPop">
-              <el-table-column label="序号" align="center" width="80">
-                <template #default="{ $index }">
-                  <div>{{ ($index + 1).toString().padStart(2, 0) }}</div>
-                </template>
-              </el-table-column>
-
-              <el-table-column prop="name" label="姓名" align="center" />
-              <el-table-column prop="cardNo" label="编号" align="center" />
-              <el-table-column prop="departMent" label="部门" align="center" />
-
-              <el-table-column label="操作" align="center">
-                <template #default="{ row }">
-                  <div class="pop_check" @click="clickPopCheck(row)">查看</div>
-                </template>
-              </el-table-column>
-            </el-table>
-          </div>
-          <!-- 分页器区域 -->
-          <div class="pop_pagination">
-            <el-pagination
-              v-model:current-page="currentPage"
-              v-model:page-size="pageSize"
-              small
-              background
-              hide-on-single-page
-              layout="prev, pager, next, jumper"
-              :total="total"
-              :pager-count="5"
-              @current-change="handleCurrentChange"
-            />
-          </div>
-        </div>
+      <!-- 分页器区域 -->
+      <div class="sub_pagination">
+        <el-pagination
+          v-model:current-page="currentPage"
+          v-model:page-size="pageSize"
+          small
+          background
+          hide-on-single-page
+          layout="prev, pager, next, jumper"
+          :total="totalStudent"
+          :pager-count="5"
+          @current-change="handleCurrentChange"
+        />
       </div>
     </div>
   </div>
@@ -168,80 +97,27 @@ import { decryptDes } from "@/utils/des";
 
 // 学生总数
 const totalStudent = ref(0);
-// 教师总数
-const totalTeacher = ref(0);
-
 // DOM元素
 const totalStudentDom = ref();
-const totalTeacherDom = ref();
-
-// 是否展示弹窗
-const showPop = ref(false);
 
 // 分页器当前页
 const currentPage = ref(1);
-
 // 每页多少条数据
-const pageSize = ref(10);
-
-// 总条数
-const total = ref(1000);
-
-// 弹窗类型 0为学生弹窗 1为教师弹窗
-const popType = ref(0);
+const pageSize = ref(15);
 
 // 学生表格数据
 const tableDataStudent = ref([]);
 
-// 教师表格数据
-const tableDataTeacher = ref([]);
-
-// 弹窗表格数据
-const tableDataPop = ref([]);
-
 // 弹窗输入框绑定数据
-const keyword = ref("");
+const keyword = ref();
 // 年级id
 const graderId = ref();
 // 班级id
 const classId = ref();
 // 年级班级筛选框绑定数据
-const classValue = ref("");
+const classValue = ref();
 // 年级班级数据
-const options_class = ref([
-  {
-    value: "1",
-    label: "一年级",
-    children: [
-      {
-        value: "1-1",
-        label: "一(1)班",
-      },
-      {
-        value: "1-2",
-        label: "一(2)班",
-      },
-    ],
-  },
-  {
-    value: "2",
-    label: "二年级",
-    children: [
-      {
-        value: "2-1",
-        label: "二(1)班",
-      },
-      {
-        value: "2-2",
-        label: "二(2)班",
-      },
-      {
-        value: "2-3",
-        label: "二(3)班",
-      },
-    ],
-  },
-]);
+const options_class = ref([]);
 
 const props_class = {
   checkStrictly: true,
@@ -253,69 +129,50 @@ const cascader = ref();
 const router = useRouter();
 
 onMounted(() => {
-  // 获取学生汇总数据
-  getStudentInfo();
-  // 获取教师汇总数据
-  // getTeacherInfo();
-});
-
-// 获取学生汇总数据
-const getStudentInfo = async () => {
-  const res = await reqGetUserInfo({
-    currentPage: 1,
-    pageCount: 18,
-    identityId: 2,
-  });
-  // console.log(res);
-  if ((res as any).code == 200) {
-    tableDataStudent.value = res.data.list;
-    totalStudent.value = res.data.total;
-    // 让数字跳动
-    countUpNum(totalStudentDom.value, totalStudent.value);
+  if (sessionStorage.getItem("wanzai_currentPage")) {
+    currentPage.value = Number(sessionStorage.getItem("wanzai_currentPage"));
   }
-};
-
-// 获取教师汇总数据
-const getTeacherInfo = async () => {
-  const res = await reqGetUserInfo({
-    currentPage: 1,
-    pageCount: 8,
-    identityId: 3,
-  });
-  // console.log(res);
-  if ((res as any).code == 200) {
-    tableDataTeacher.value = res.data.list;
-    totalTeacher.value = res.data.total;
-    // 让数字跳动
-    countUpNum(totalTeacherDom.value, totalTeacher.value);
+  if (sessionStorage.getItem("wanzai_keyword")) {
+    keyword.value = sessionStorage.getItem("wanzai_keyword");
   }
-};
+  if (sessionStorage.getItem("wanzai_graderId")) {
+    graderId.value = Number(sessionStorage.getItem("wanzai_graderId"));
+  }
+  if (sessionStorage.getItem("wanzai_classId")) {
+    classId.value = Number(sessionStorage.getItem("wanzai_classId"));
+  }
+  if (
+    sessionStorage.getItem("wanzai_graderId") &&
+    sessionStorage.getItem("wanzai_classId")
+  ) {
+    classValue.value = [graderId.value, classId.value];
+  }
+
+  // 获取学生汇总数据
+  getStudentInfo(1);
 
-// 点击查看更多按钮回调 0学生 1教师
-const handleClickMore = (value: number) => {
-  keyword.value = "";
-  showPop.value = true;
-  popType.value = value;
-  // 获取弹窗表格数据
-  getPopData(popType.value);
   // 获取年级班级数据
   getClassData();
-};
+});
 
-// 获取弹窗表格数据
-const getPopData = async (type: number) => {
+// 获取学生汇总数据
+const getStudentInfo = async (type: number) => {
   const res = await reqGetUserInfo({
     currentPage: currentPage.value,
     pageCount: pageSize.value,
-    identityId: type === 0 ? 2 : 3,
+    identityId: 2,
     key: keyword.value,
     graderId: graderId.value,
     classId: classId.value,
   });
   // console.log(res);
   if ((res as any).code == 200) {
-    tableDataPop.value = res.data.list;
-    total.value = res.data.total;
+    tableDataStudent.value = res.data.list;
+    totalStudent.value = res.data.total;
+    // 让数字跳动
+    if (type == 1) {
+      countUpNum(totalStudentDom.value, totalStudent.value);
+    }
   }
 };
 
@@ -333,18 +190,18 @@ const getClassData = async () => {
 // 分页器当前页修改时的回调
 const handleCurrentChange = (value: number) => {
   currentPage.value = value;
-  getPopData(popType.value);
+  getStudentInfo(2);
 };
 
 // 年级班级筛选框切换回调
 const handleChangeClass = (v: any) => {
   // console.log(v);
-  // console.log(cascader.value.getCheckedNodes()[0].label);
-  // console.log(cascader.value.getCheckedNodes()[0].value);
 
   if (!v) {
     graderId.value = "";
     classId.value = "";
+    // sessionStorage.setItem("wanzai_graderId", "");
+    // sessionStorage.setItem("wanzai_classId", "");
     return;
   }
 
@@ -358,16 +215,30 @@ const handleChangeClass = (v: any) => {
 // 查询按钮绑定回调
 const handleSearch = () => {
   currentPage.value = 1;
-  getPopData(popType.value);
-};
-
-// 点击弹窗关闭按钮回调
-const handleClose = () => {
-  showPop.value = false;
+  getStudentInfo(2);
 };
 
 // 点击表格查看按钮回调 0学生 1教师
 const handleCheckMsg = (value: number, row: any) => {
+  sessionStorage.setItem("wanzai_currentPage", currentPage.value.toString());
+  if (keyword.value) {
+    sessionStorage.setItem("wanzai_keyword", keyword.value);
+  } else {
+    sessionStorage.setItem("wanzai_keyword", "");
+  }
+
+  if (graderId.value) {
+    sessionStorage.setItem("wanzai_graderId", graderId.value);
+  } else {
+    sessionStorage.setItem("wanzai_graderId", "");
+  }
+
+  if (classId.value) {
+    sessionStorage.setItem("wanzai_classId", classId.value);
+  } else {
+    sessionStorage.setItem("wanzai_classId", "");
+  }
+
   if (value === 0) {
     router.push({
       name: "student",
@@ -384,11 +255,6 @@ const handleCheckMsg = (value: number, row: any) => {
     });
   }
 };
-
-// 弹窗表格查看按钮回调
-const clickPopCheck = (row: any) => {
-  handleCheckMsg(popType.value, row);
-};
 </script>
 
 <style lang="scss" scoped>
@@ -448,9 +314,52 @@ const clickPopCheck = (row: any) => {
       }
     }
 
+    .sub_search {
+      display: flex;
+      justify-content: space-between;
+      margin-top: 20px;
+      height: 32px;
+
+      .search_input {
+        padding: 0 10px;
+        width: 130px;
+        border-radius: 2px;
+        border: 1px solid #9c9c9c;
+        background-color: rgba(48, 75, 95, 0.5);
+
+        input {
+          width: 100%;
+          height: 100%;
+          background-color: transparent;
+          border: none;
+          outline: none;
+          color: #fff;
+          font-size: 14px;
+        }
+      }
+
+      .search_select {
+        width: 170px;
+      }
+
+      .search_btn {
+        display: flex;
+        justify-content: center;
+        align-items: center;
+        width: 58px;
+        font-size: 14px;
+        background-image: linear-gradient(
+          rgba(29, 242, 228, 1),
+          rgba(61, 198, 239, 0.4),
+          rgba(26, 94, 232, 1)
+        );
+        cursor: pointer;
+      }
+    }
+
     .student {
       margin: 22px 0;
-      height: 800px;
+      height: 660px;
       overflow: hidden;
 
       .check {
@@ -469,115 +378,13 @@ const clickPopCheck = (row: any) => {
         cursor: pointer;
       }
     }
-  }
-
-  .popup {
-    z-index: 999;
-    position: absolute;
-    top: -83px;
-    left: 0;
-    display: flex;
-    align-items: center;
-    justify-content: center;
-    width: 1920px;
-    height: 1080px;
-    background-color: rgba(0, 0, 0, 0.6);
-
-    .pop_box {
-      position: relative;
-      padding: 15px 47px 0 24px;
-      width: 585px;
-      height: 646px;
-      border-radius: 16px;
-      border: 1px solid #8c8c8c;
-      background-color: rgba(31, 58, 87, 0.8);
-
-      .pop_title {
-        height: 34px;
-        background-image: url(@/assets/images/pop-title-bg.png);
-        background-size: 100% 100%;
-
-        span {
-          margin-left: 24px;
-          color: #bbe2fe;
-        }
-      }
-
-      .pop_close {
-        position: absolute;
-        top: 14px;
-        right: 48px;
-        width: 24px;
-        height: 24px;
-        line-height: 18px;
-        text-align: center;
-        color: #a6a6a6;
-        font-size: 25px;
-        border-radius: 2px;
-        border: 1px solid #a6a6a6;
-        cursor: pointer;
-      }
-      .pop_content {
-        padding: 37px 0 0 17px;
-        height: 580px;
-        overflow: hidden;
-
-        .pop_search {
-          display: flex;
-          justify-content: space-between;
-          height: 32px;
-          .search_input {
-            padding: 0 10px;
-            width: 130px;
-            border-radius: 2px;
-            border: 1px solid #9c9c9c;
-            background-color: rgba(48, 75, 95, 0.5);
-
-            input {
-              width: 100%;
-              height: 100%;
-              background-color: transparent;
-              border: none;
-              outline: none;
-              color: #fff;
-              font-size: 14px;
-            }
-          }
-
-          .search_btn {
-            display: flex;
-            justify-content: center;
-            align-items: center;
-            width: 58px;
-            font-size: 14px;
-            background-image: linear-gradient(
-              rgba(29, 242, 228, 1),
-              rgba(61, 198, 239, 0.4),
-              rgba(26, 94, 232, 1)
-            );
-            cursor: pointer;
-          }
-        }
 
-        .pop_form {
-          margin-top: 22px;
-          height: 445px;
-          overflow: hidden;
-
-          .pop_check {
-            color: #ede27b;
-            cursor: pointer;
-          }
-        }
-
-        .pop_pagination {
-          display: flex;
-          align-items: center;
-          justify-content: flex-end;
-          margin-top: 10px;
-          height: 35px;
-        }
-      }
+    .sub_pagination {
+      display: flex;
+      align-items: center;
+      justify-content: flex-end;
+      margin-top: 10px;
+      height: 35px;
     }
   }
 }

+ 8 - 0
src/router/index.ts

@@ -55,6 +55,14 @@ const whiteList = ["/", "/404"];
 
 // 路由全局前置守卫
 router.beforeEach(async (to, from, next) => {
+  // console.log(to.path);
+  if (to.path != "/user" && to.path != "/student") {
+    sessionStorage.setItem("wanzai_currentPage", "");
+    sessionStorage.setItem("wanzai_keyword", "");
+    sessionStorage.setItem("wanzai_graderId", "");
+    sessionStorage.setItem("wanzai_classId", "");
+  }
+
   // 判断是否为白名单页面
   if (whiteList.includes(to.path)) {
     // 白名单页面直接放行

+ 1 - 1
src/views/school.vue

@@ -26,7 +26,7 @@ const isShow = ref(false);
 
 onMounted(() => {
   let token = sessionStorage.getItem("WANZAI-TOKEN");
-  console.log(token);
+  // console.log(token);
 
   if (token) {
     handleVerify(token);