Просмотр исходного кода

feat(certsManage): 优化证书列表查询功能

- 修改当月、下月按钮的类型值和显示文本
- 新增下下月和下下下月的查询按钮
- 实现动态生成月份名称的功能
wzg 11 месяцев назад
Родитель
Сommit
bd04c9e08a
1 измененных файлов с 35 добавлено и 6 удалено
  1. 35 6
      src/views/workStation/certsManage.vue

+ 35 - 6
src/views/workStation/certsManage.vue

@@ -15,16 +15,22 @@
           已过期
         </el-button>
         <el-button
-          :type="type == 1 ? 'primary' : ''"
-          @click="(currentPage = 1), (type = 1), getCertList()"
+          :type="type == 7 ? 'primary' : ''"
+          @click="(currentPage = 1), (type = 2), getCertList()"
         >
-          当月
+          {{ nextMonthStr }}
         </el-button>
         <el-button
-          :type="type == 2 ? 'primary' : ''"
-          @click="(currentPage = 1), (type = 2), getCertList()"
+          :type="type == 8 ? 'primary' : ''"
+          @click="(currentPage = 1), (type = 8), getCertList()"
         >
-          下月
+          {{ nextNextMonthStr }}
+        </el-button>
+        <el-button
+          :type="type == 9 ? 'primary' : ''"
+          @click="(currentPage = 1), (type = 9), getCertList()"
+        >
+          {{ nextNextNextMonthStr }}
         </el-button>
       </el-button-group>
     </div>
@@ -178,7 +184,30 @@ let certType = ref(1);
 let tableData = ref([]);
 let total = ref(0);
 let currentPage = ref(1);
+const monthNames = [
+  "一月",
+  "二月",
+  "三月",
+  "四月",
+  "五月",
+  "六月",
+  "七月",
+  "八月",
+  "九月",
+  "十月",
+  "十一月",
+  "十二月",
+];
+
+function getMonthName(monthOffset) {
+  const currentMonth = new Date().getMonth();
+  const newMonth = (currentMonth + monthOffset) % 12;
+  return monthNames[newMonth] + "过期";
+}
 
+const nextMonthStr = ref(getMonthName(1));
+const nextNextMonthStr = ref(getMonthName(2));
+const nextNextNextMonthStr = ref(getMonthName(3));
 async function getCertList() {
   let { data } = await api.getCertList({
     type: type.value,