浏览代码

🎨 增加状态筛选

快乐的梦鱼 6 小时之前
父节点
当前提交
108db7fcf6
共有 4 个文件被更改,包括 64 次插入23 次删除
  1. 49 12
      src/pages/admin.vue
  2. 6 3
      src/pages/components/AdminItemState.vue
  3. 3 8
      src/pages/forms/form.vue
  4. 6 0
      src/stores/auth.ts

+ 49 - 12
src/pages/admin.vue

@@ -16,11 +16,18 @@
               :showTotal="true"
               :rowCount="1"
               :rowType="5"
-              :dropDownNames="[{
-                options: categoryData.content.value ?? [],
-                label: '分类',
-                defaultSelectedValue: 0,
-              }]"
+              :dropDownNames="[
+                {
+                  options: categoryData.content.value ?? [],
+                  label: '分类',
+                  defaultSelectedValue: 0,
+                },
+                {
+                  options: computedCategoryOptions,
+                  label: '状态',
+                  defaultSelectedValue: -10,
+                },
+              ]"
               :load="(page: number, pageSize: number, _, searchText: string, dropDownValues: number[]) => loadInheritorData(page, pageSize, dropDownValues, searchText)"  
               :showDetail="(item) => router.push({ name: 'FormInheritor', query: { id: item.id } })"
             >
@@ -36,11 +43,18 @@
               :showTotal="true"
               :rowCount="1"
               :rowType="5"
-              :dropDownNames="[{
-                options: categoryData.content.value ?? [],
-                label: '分类',
-                defaultSelectedValue: 0,
-              }]"
+              :dropDownNames="[
+                {
+                  options: categoryData.content.value ?? [],
+                  label: '分类',
+                  defaultSelectedValue: 0,
+                },
+                {
+                  options: computedCategoryOptions,
+                  label: '状态',
+                  defaultSelectedValue: -10,
+                },
+              ]"
               :load="(page: number, pageSize: number, _, searchText: string, dropDownValues: number[]) => loadIchData(page, pageSize, dropDownValues, searchText)"
               :showDetail="(item) => router.push({ name: 'FormIch', query: { id: item.id } })"
               >
@@ -98,7 +112,7 @@
 </template>
 
 <script setup lang="ts">
-import { h, ref, watch } from 'vue';
+import { computed, h, ref, watch } from 'vue';
 import { useRoute, useRouter } from 'vue-router';
 import { useAuthStore } from '@/stores/auth';
 import { useSimpleDataLoader } from '@/composeable/SimpleDataLoader';
@@ -106,7 +120,7 @@ import { message, Modal } from 'ant-design-vue';
 import type { GetContentListItem } from '@/api/CommonContent';
 import useClipboard from 'vue-clipboard3';
 import CommonContent, { GetContentListParams } from '@/api/CommonContent';
-import CommonListBlock from '@/components/content/CommonListBlock.vue';
+import CommonListBlock, { type DropdownCommonItem } from '@/components/content/CommonListBlock.vue';
 import InheritorContent from '@/api/inheritor/InheritorContent';
 import AdminItemState from './components/AdminItemState.vue';
 
@@ -117,6 +131,27 @@ const authStore = useAuthStore();
 const activeKey = ref(route.query.tab as string || '1');
 const inheritorData = ref<GetContentListItem[]>([]);
 
+const computedCategoryOptions = computed<DropdownCommonItem[]>(() => {
+  if (authStore.isReviewer) {
+    return [
+      { name: '全部状态', id: -10 },
+      { name: '待审核', id: 1 },
+      { name: '已通过', id: 2 },
+    ]
+  }
+  if (authStore.isAdmin) {
+    return [
+      { name: '全部状态', id: -10 },
+      { name: '保存未审核', id: -2 },
+      { name: '审核退回', id: -1 },
+      { name: '待初审', id: 0 },
+      { name: '初审通过待专家审核', id: 1 },
+      { name: '专家审核通过', id: 2 },
+    ]
+  }
+  return [];
+})
+
 watch(activeKey, (newValue) => {
   router.replace({ query: { tab: newValue } });
 })
@@ -142,6 +177,7 @@ async function loadInheritorData(page: number, pageSize: number, dropDownValues:
       .setKeywords(searchText)
       .setSelfValues({
         ichType: dropDownValues[0] == 0 ? undefined: dropDownValues[0],
+        progress: dropDownValues[1] <= -5 ? undefined: dropDownValues[1],
         region: authStore.userInfo?.regionId,
       }), 
     page,
@@ -169,6 +205,7 @@ async function loadIchData(page: number, pageSize: number, dropDownValues: numbe
       .setKeywords(searchText)
       .setSelfValues({
         ichType: dropDownValues[0] == 0 ? undefined: dropDownValues[0],
+        progress: dropDownValues[1] <= -5 ? undefined: dropDownValues[1],
         region: authStore.userInfo?.regionId,
       }), 
     page,

+ 6 - 3
src/pages/components/AdminItemState.vue

@@ -3,9 +3,9 @@
 
     <div class="d-flex flex-column">
       <a-badge v-if="item.progress === -1" status="error" text="已退回" />
-      <a-badge v-else-if="item.progress === 0" status="processing" text="待审" />
-      <a-badge v-else-if="item.progress === 1" status="processing" text="初审" />
-      <a-badge v-else-if="item.progress === 2" status="warning" text="专家审核" />
+      <a-badge v-else-if="item.progress === 0" status="processing" text="待审" />
+      <a-badge v-else-if="item.progress === 1" status="processing" text="初审通过待专家审核" />
+      <a-badge v-else-if="item.progress === 2" status="warning" text="专家审核通过" />
       <a-badge v-else-if="item.progress === 3" status="success" text="审核通过" />
 
       <span v-if="item.logintime" class="text-secondary">传承人上次登录:{{ item.logintime }}</span>
@@ -21,6 +21,9 @@
 <script setup lang="ts">
 import { ref } from 'vue';
 import type { GetContentListItem } from '@/api/CommonContent';
+import { useAuthStore } from '@/stores/auth';
+
+const authStore = useAuthStore();
 
 const props = defineProps({
   item: {

+ 3 - 8
src/pages/forms/form.vue

@@ -198,13 +198,8 @@ const readonly = ref(false);
 const showHistory = ref(false);
 const showHistoryLoading = ref(false);
 const showHistoryModel = ref<any>(null);
-
-const isAdmin = computed(() => {
-  return authStore.loginType === 1;
-});
-const isReviewer = computed(() => {
-  return authStore.userInfo?.isReviewer ?? false;
-});
+const isAdmin = computed(() => authStore.isAdmin);
+const isReviewer = computed(() => authStore.isReviewer);
 const finalFormOptions = computed(() => {
   
   return {
@@ -274,7 +269,7 @@ const finalFormOptions = computed(() => {
                   { text: '审核退回', value: -1 },
                   { text: '暂未审核', value: 0 },
                   { text: '初审通过', value: 1 },
-                  { text: '审核通过', value: 2 },
+                  { text: '专家审核通过', value: 2 },
                 ]
               }
             },

+ 6 - 0
src/stores/auth.ts

@@ -83,6 +83,12 @@ export const useAuthStore = defineStore('auth', {
     }
   },
   getters: {
+    isAdmin(state) {
+      return state.loginType === 1;
+    },
+    isReviewer(state) {
+      return state.userInfo?.isReviewer ?? false;
+    },  
     isLogged(state) {
       return state.token != '' && state.userId != 0
     },