刘洋 há 9 meses atrás
pai
commit
91f15d973a

+ 13 - 0
src/render/ap/baseDataConfig.ts

@@ -81,3 +81,16 @@ export const importCard = async (params: {
     },
   });
 };
+
+export const deleteCard = (params: { examId: number; number: number }) =>
+  request({
+    url: "/api/admin/card/delete",
+    params,
+    loading: true,
+  });
+
+export const getStuList = (params: { examId: number }) =>
+  request({
+    url: "/api/admin/student/count",
+    params,
+  });

+ 20 - 0
src/render/ap/mock/baseDataConfig.ts

@@ -75,3 +75,23 @@ Mock.mock(/\/api\/admin\/card\/page/, "post", {
   totalCount: 3,
   pageCount: 1,
 });
+Mock.mock(/\/api\/admin\/card\/delete/, "post", {
+  updateTime: 1,
+});
+Mock.mock(/\/api\/admin\/student\/count/, "post", [
+  {
+    subjectCode: 1,
+    subjectName: "科目1",
+    studentCount: 1,
+  },
+  {
+    subjectCode: 2,
+    subjectName: "科目2",
+    studentCount: 10,
+  },
+  {
+    subjectCode: 3,
+    subjectName: "科目3",
+    studentCount: 5,
+  },
+]);

+ 0 - 39
src/render/views/BaseDataConfig/AddCardDialog.vue

@@ -1,39 +0,0 @@
-<template>
-  <my-modal v-model:open="visible" title="导入卡格式">
-    <qm-low-form :params="params" :fields="fields" :label-width="80">
-    </qm-low-form>
-  </my-modal>
-</template>
-<script name="AddCardDialog" lang="ts" setup>
-import { ref } from "vue";
-import { setValueFromObj } from "@/utils/tool";
-const visible = defineModel();
-const props = defineProps<{ curRow: any }>();
-
-//todo 入参名
-const params = ref({
-  a: "1",
-  b: "",
-  c: "",
-});
-params.value = setValueFromObj(params.value, props.curRow);
-const fields = ref([
-  {
-    prop: "a",
-    label: "科目题卡",
-    colSpan: 24,
-  },
-  {
-    prop: "b",
-    label: "备注",
-    colSpan: 24,
-    type: "textarea",
-  },
-  {
-    cell: "c",
-    label: "选择卡格式",
-    colSpan: 24,
-  },
-]);
-</script>
-<style lang="less" scoped></style>

+ 9 - 18
src/render/views/BaseDataConfig/CardImport.vue

@@ -17,11 +17,7 @@
         </template>
       </template>
     </a-table>
-    <AddCardDialog
-      v-model="showAddDialog"
-      v-if="showAddDialog"
-      :cur-row="curRow"
-    ></AddCardDialog>
+
     <ImportCardDialog
       v-model="showImportCardDialog"
       v-if="showImportCardDialog"
@@ -33,18 +29,16 @@ import { ref, computed, reactive } from "vue";
 import AddCardDialog from "./AddCardDialog.vue";
 import type { TableColumnsType } from "@qmth/ui";
 import useTable from "@/hooks/useTable";
-import { getCardList } from "@/ap/baseDataConfig";
+import { getCardList, deleteCard } from "@/ap/baseDataConfig";
 import { useUserStore } from "@/store";
 import ImportCardDialog from "./ImportCardDialog.vue";
 
 const userStore = useUserStore();
 
 const showImportCardDialog = ref(false);
-const showAddDialog = ref(false);
 const curRow = ref(null);
 const editRow = (row: any) => {
   curRow.value = row;
-  showAddDialog.value = true;
 };
 const fields = ref([
   {
@@ -59,15 +53,6 @@ const fields = ref([
           },
         },
       },
-      {
-        text: "新增卡格式",
-        attrs: {
-          type: "default",
-          onClick: () => {
-            showAddDialog.value = true;
-          },
-        },
-      },
     ],
   },
 ]);
@@ -115,7 +100,13 @@ const deleteRow = (row: any) => {
     title: () => "系统通知",
     content: () => "请确认是否立即删除?",
     onOk() {
-      //todo 执行删除接口
+      deleteCard({
+        examId: userStore.curExam?.id as number,
+        number: row.number,
+      }).then(() => {
+        window.$message.success("操作成功");
+        getList();
+      });
     },
   });
 };

+ 11 - 3
src/render/views/BaseDataConfig/StuImport.vue

@@ -5,7 +5,7 @@
         <div class="tip">导入参数设置为:考试年度 - 2024;考次 - 1</div>
       </template>
     </qm-low-form>
-    <a-table :data-source="tableData" :columns="columns" size="middle" bordered>
+    <a-table :data-source="dataList" :columns="columns" size="middle" bordered>
       <template #bodyCell="{ column, record }">
         <template v-if="column.key === 'operation'">
           <qm-button type="link" @click="">导入</qm-button>
@@ -22,8 +22,12 @@
 <script name="StuImport" lang="ts" setup>
 import { ref } from "vue";
 import SetImportParamsDialog from "./SetImportParamsDialog.vue";
+import useTable from "@/hooks/useTable";
+import { getStuList } from "@/ap/baseDataConfig";
+import { useUserStore } from "@/store";
 import type { TableColumnsType } from "@qmth/ui";
 
+const userStore = useUserStore();
 const showSetParamsDialog = ref(false);
 const fields = ref([
   {
@@ -39,7 +43,6 @@ const fields = ref([
     cell: "tip",
   },
 ]);
-const tableData = ref([{ a: 1, b: 2, c: 3, d: 4, e: 5 }]);
 const columns: TableColumnsType = [
   {
     title: "序号",
@@ -66,7 +69,12 @@ const columns: TableColumnsType = [
     width: 300,
   },
 ];
-const deleteRow = (row: any) => {
+const { dataList, pagination, loading, getList, toPage } = useTable(
+  getStuList,
+  { examId: userStore.curExam?.id },
+  true
+);
+const clear = (row: any) => {
   window.$confirm({
     title: () => "系统通知",
     content: () => "请确认是否立即删除?",

+ 3 - 1
src/render/views/BaseDataConfig/index.vue

@@ -2,7 +2,7 @@
   <div class="base-data-config h-full">
     <a-tabs v-model:activeKey="activeKey">
       <a-tab-pane key="1" tab="扫描参数配置">
-        <ScanParams></ScanParams>
+        <ScanParams />
       </a-tab-pane>
       <a-tab-pane key="2" tab="用户管理">
         <UserManage />
@@ -14,6 +14,7 @@
         <StuImport />
       </a-tab-pane>
     </a-tabs>
+    <router-view />
   </div>
 </template>
 <script name="BaseDataConfig" lang="ts" setup>
@@ -26,6 +27,7 @@ const activeKey = ref("1");
 </script>
 <style lang="less" scoped>
 .base-data-config {
+  position: relative;
   :deep(.ant-tabs) {
     height: 100%;
     .ant-tabs-nav {