zhangjie 2 سال پیش
والد
کامیت
992995e7a0
4فایلهای تغییر یافته به همراه57 افزوده شده و 54 حذف شده
  1. 8 2
      src/api/taskManagement.ts
  2. 8 0
      src/components/Layout.vue
  3. 26 46
      src/features/taskManagement/TaskManagement.vue
  4. 15 6
      src/router/index.ts

+ 8 - 2
src/api/taskManagement.ts

@@ -1,7 +1,7 @@
 import { httpApp } from "@/plugins/axiosApp";
 import { TaskItem, ServerPageResponse } from "@/types";
 
-/** 试卷特征数分页查询 */
+/** 任务分页查询 */
 export function getTaskList(params: {
   pageNo: number;
   pageSize: number;
@@ -9,6 +9,12 @@ export function getTaskList(params: {
 }) {
   return httpApp.post<any, ServerPageResponse<TaskItem>>(
     "/api/ess/operate/task/page",
-    params
+    {},
+    { params }
   );
 }
+
+/** 删除任务 */
+export function deleteTask(id: number) {
+  return httpApp.post(`/api/ess/operate/task/remove`, {}, { params: { id } });
+}

+ 8 - 0
src/components/Layout.vue

@@ -58,6 +58,14 @@
               关联分析
             </router-link>
           </a-menu-item>
+          <a-menu-item key="23">
+            <router-link
+              activeClass="active-route"
+              to="/project/taskManagement"
+            >
+              任务管理
+            </router-link>
+          </a-menu-item>
         </a-sub-menu>
       </a-menu>
     </div>

+ 26 - 46
src/features/taskManagement/TaskManagement.vue

@@ -23,6 +23,7 @@
       >
         <template #action="{ record }">
           <span>
+            <a-button @click="toDownload(record)">下载文件</a-button>
             <a-button @click="toDelete(record)">编辑</a-button>
           </span>
         </template>
@@ -32,15 +33,14 @@
 </template>
 
 <script setup lang="ts">
-import { getTaskList } from "@/api/taskManagement";
+import { getTaskList, deleteTask } from "@/api/taskManagement";
 import { useMainStore } from "@/store";
 import { TaskItem } from "@/types";
-// import { downloadFileURL } from "@/utils/utils";
-// import { message } from "ant-design-vue";
+import { message, Modal } from "ant-design-vue";
 import { watch, onMounted } from "vue";
 
 const store = useMainStore();
-store.currentLocation = "基础管理 / 用户管理";
+store.currentLocation = "项目管理 / 任务管理";
 
 let data = $ref<TaskItem[]>([]);
 let pageSize = $ref(10);
@@ -71,59 +71,26 @@ async function fetchData() {
 
 const columns = [
   {
-    title: "学校",
-    dataIndex: "rootOrgName",
-    width: 200,
-    slots: { customRender: "rootOrgName" },
+    title: "任务类型",
+    dataIndex: "taskTypeName",
     ellipses: true,
   },
-  {
-    title: "姓名",
-    dataIndex: "name",
-    width: 80,
-  },
-  {
-    title: "登录名",
-    dataIndex: "loginName",
-    width: 100,
-  },
-  {
-    title: "角色",
-    dataIndex: "roleName",
-    width: 120,
-  },
   {
     title: "状态",
-    dataIndex: "enable",
-    slots: { customRender: "enable" },
-    width: 60,
-  },
-  {
-    title: "创建时间",
-    dataIndex: "createTime",
-    width: 180,
-  },
-  {
-    title: "创建人",
-    dataIndex: "creator",
-    width: 80,
-  },
-  {
-    title: "更新时间",
-    dataIndex: "updateTime",
-    width: 180,
+    dataIndex: "statusMsg",
+    width: 100,
   },
   {
-    title: "更新人",
-    dataIndex: "updater",
-    width: 80,
+    title: "用时",
+    dataIndex: "spentTime",
+    width: 140,
   },
   {
     title: "操作",
     key: "action",
     slots: { customRender: "action" },
     fixed: "right",
-    width: 270,
+    width: 200,
   },
 ];
 
@@ -131,7 +98,20 @@ onMounted(async () => {
   await search();
 });
 
+function toDownload(row: TaskItem) {
+  if (row.filePath) window.open(row.filePath);
+}
 function toDelete(row: TaskItem) {
-  console.log(row);
+  Modal.confirm({
+    title: "提示",
+    content: "确认删除?",
+    cancelText: "取消",
+    okText: "确定",
+    onOk: async () => {
+      await deleteTask(row.id);
+      await search();
+      void message.success({ content: "操作成功" });
+    },
+  });
 }
 </script>

+ 15 - 6
src/router/index.ts

@@ -7,7 +7,7 @@ import { isNil } from "lodash-es";
 import { useMainStore } from "@/store";
 
 // components
-import RoutOrg from '@/features/rootOrg/RootOrg.vue';
+import RoutOrg from "@/features/rootOrg/RootOrg.vue";
 import AuthManagement from "@/features/authManagement/AuthManagement.vue";
 import RootOrgEdit from "@/features/rootOrg/RootOrgEdit.vue";
 import SubOrg from "@/features/subOrg/SubOrg.vue";
@@ -24,8 +24,9 @@ import PaperAnalysis from "@/features/paperAnalysis/PaperAnalysis.vue";
 import AllAnalysis2 from "@/features/allAnalysis/AllAnalysis2.vue";
 import ProjectCompareManagement from "@/features/projectCompareManagement/ProjectCompareManagement.vue";
 import ProjectCompareDetail2 from "@/features/projectCompareDetail/ProjectCompareDetail2.vue";
+import TaskManagement from "@/features/taskManagement/TaskManagement.vue";
 // report
-import ReportMain from '@/features/report/ReportMain.vue';
+import ReportMain from "@/features/report/ReportMain.vue";
 
 const routes = [
   { path: "/", redirect: "/login" },
@@ -103,13 +104,17 @@ const routes = [
         path: "projectCompareDetail",
         component: ProjectCompareDetail2,
       },
+      {
+        path: "taskManagement",
+        component: TaskManagement,
+      },
     ],
     component: Layout,
   },
   {
-    path:'/report/:viewType/:projectId/:paperId/:compareProjectId?',
-    name:'PaperReport',
-    component:ReportMain
+    path: "/report/:viewType/:projectId/:paperId/:compareProjectId?",
+    name: "PaperReport",
+    component: ReportMain,
   },
   {
     path: "/:pathMatch(.*)*",
@@ -141,7 +146,11 @@ export async function routeLogout(params: {
 
 router.beforeEach((to, from, next) => {
   const token = getToken();
-  if (isNil(token) && !to.path.includes("/login") && !to.path.includes('/report')) {
+  if (
+    isNil(token) &&
+    !to.path.includes("/login") &&
+    !to.path.includes("/report")
+  ) {
     routeLogout({ cause: "missingToken", redirectTo: to.fullPath })
       .then(() => next(false))
       .catch((e) => console.log(e));