소스 검색

完成直接开卡

month-red-love 1 개월 전
부모
커밋
56002a38f0

+ 11 - 2
back-ui/src/api/dz/cards.js

@@ -151,10 +151,19 @@ export function refundCard(cardIds) {
   });
 }
 
+// 获取学校列表
+export function getSchoolList(query) {
+  return request({
+    url: "/dz/school/getSchoolList",
+    method: "get",
+    params: query,
+  });
+}
+
 // 获取校区列表
 export function getCampusList(query) {
   return request({
-    url: "/dz/school/getSchoolList",
+    url: "/dz/school/getCampusList",
     method: "get",
     params: query,
   });
@@ -176,7 +185,7 @@ export function associateCampus(beginCardNo, endCardNo, campusId) {
 // 申请开卡
 export function requestOpenCard(schoolId, beginCardNo, endCardNo) {
   return request({
-    url: "/dz/cards/requestOpenCard",
+    url: "/dz/cards/openCard",
     method: "post",
     params: {
       schoolId,

+ 1 - 1
back-ui/src/views/dz/cards/components/ApplyCardDialog.vue

@@ -1,6 +1,6 @@
 <template>
   <el-dialog
-    title="申请开卡"
+    title="直接申请"
     v-model="visible"
     width="500px"
     append-to-body

+ 7 - 3
back-ui/src/views/dz/cards/components/AssignCardDialog.vue

@@ -134,9 +134,13 @@
 
 <script setup>
 import { ref, computed, watch } from "vue";
-import { assignCard, getExamTypes, getAgentList } from "@/api/dz/cards";
+import {
+  assignCard,
+  getExamTypes,
+  getAgentList,
+  getSchoolList,
+} from "@/api/dz/cards";
 import { getPaperProvinces } from "@/api/dz/papers";
-import { getCampusList } from "@/api/dz/cards";
 
 const props = defineProps({
   modelValue: {
@@ -252,7 +256,7 @@ async function getSchoolListByProvince(province) {
       return;
     }
 
-    const response = await getCampusList({
+    const response = await getSchoolList({
       location: province,
       pageNum: 1,
       pageSize: 9999,

+ 29 - 2
back-ui/src/views/dz/cards/components/AssociateCampusDialog.vue

@@ -113,12 +113,39 @@ const rules = {
 // 获取校区列表
 async function getCampusListData() {
   try {
-    const response = await getCampusList({ pageNum: 1, pageSize: 1000 });
+    const response = await getCampusList({
+      pageNum: 1,
+      pageSize: 9999, // 获取所有校区
+    });
     if (response.code === 200) {
-      campusList.value = response.data || [];
+      // 处理API返回的数据结构
+      let campusData = [];
+      if (response.data) {
+        campusData = Array.isArray(response.data) ? response.data : [];
+      } else if (response.rows) {
+        campusData = response.rows;
+      } else if (response.list) {
+        campusData = response.list;
+      }
+
+      // 确保数据格式符合配置要求
+      campusData = campusData.map((item) => {
+        // 如果API返回的是 {id, name, ...} 格式,直接使用
+        if (item.id && item.name) {
+          return item;
+        }
+        // 如果是其他格式,需要转换
+        return {
+          id: item.id || item.value || item.campusId,
+          name: item.name || item.label || item.campusName || item.title,
+        };
+      });
+
+      campusList.value = campusData;
     }
   } catch (error) {
     console.error("获取校区列表失败:", error);
+    campusList.value = [];
   }
 }
 

+ 1 - 8
back-ui/src/views/dz/cards/config/form.js

@@ -57,13 +57,6 @@ const info = [
     type: "text",
     search: true,
   },
-  {
-    label: "初始密码",
-    name: "password",
-    value: "",
-    type: "text",
-    search: true,
-  },
   {
     label: "卡号段",
     name: "cardNoRange",
@@ -129,7 +122,7 @@ const info = [
     search: true,
   },
   {
-    label: "结束状态",
+    label: "结算状态image.png",
     name: "isSettlement",
     value: "",
     type: "select",

+ 53 - 7
back-ui/src/views/dz/cards/index.vue

@@ -120,7 +120,7 @@
           style="border-color: #52c41a; color: #52c41a; font-weight: 500"
         >
           <svg-icon icon-class="edit" class="mr-1" style="font-size: 16px" />
-          申请开卡
+          直接申请
         </el-button>
       </el-col>
       <el-col :span="1.5">
@@ -191,6 +191,7 @@
 
     <AssignCardDialog
       v-model="assignCardOpen"
+      :selected-cards="selectedRows"
       :school-list="schoolList"
       :card-type-options="card_type"
       @success="handleDialogSuccess"
@@ -285,7 +286,7 @@ import ApplyCardDialog from "./components/ApplyCardDialog.vue";
 import formInfo from "./config/form.js";
 import tableConfig from "./config/table.js";
 import { listUniversity } from "@/api/dz/school";
-import { assignCard, issueCard } from "@/api/dz/cards";
+import { assignCard, issueCard, getCampusList } from "@/api/dz/cards";
 import { listDept } from "@/api/system/dept";
 import { listAgent } from "@/api/dz/agent";
 
@@ -308,6 +309,7 @@ const {
 
 const cardsList = ref([]);
 const schoolList = ref([]);
+const campusList = ref([]); // 校区列表
 const classList = ref([]); // 班级列表
 const open = ref(false);
 const cardGenerationOpen = ref(false); // 制卡对话框
@@ -317,7 +319,7 @@ const closeCardOpen = ref(false); // 关卡对话框
 const reopenCardOpen = ref(false); // 重开对话框
 const refundOpen = ref(false); // 退费对话框
 const associateCampusOpen = ref(false); // 关联校区对话框
-const applyCardOpen = ref(false); // 申请开卡对话框
+const applyCardOpen = ref(false); // 直接申请对话框
 const currentCardNo = ref([]); // 当前缴费的卡号(支持数组)
 const currentCloseCardNo = ref([]); // 当前关卡的卡号(支持数组)
 const currentReopenCardNo = ref([]); // 当前重开的卡号(支持数组)
@@ -369,6 +371,9 @@ const searchConfig = computed(() => {
       case "registerSchoolId":
         item.option = schoolList.value || [];
         break;
+      case "campusId":
+        item.option = campusList.value || [];
+        break;
     }
   });
 
@@ -577,6 +582,46 @@ function getSchoolList() {
     });
 }
 
+/** 获取校区列表 */
+function getCampusListData() {
+  getCampusList({
+    pageNum: 1,
+    pageSize: 9999, // 获取所有校区
+  })
+    .then((response) => {
+      if (response.code === 200) {
+        // 处理API返回的数据结构
+        let campusData = [];
+        if (response.data) {
+          campusData = Array.isArray(response.data) ? response.data : [];
+        } else if (response.rows) {
+          campusData = response.rows;
+        } else if (response.list) {
+          campusData = response.list;
+        }
+
+        // 确保数据格式符合配置要求
+        campusData = campusData.map((item) => {
+          // 如果API返回的是 {id, name, ...} 格式,直接使用
+          if (item.id && item.name) {
+            return item;
+          }
+          // 如果是其他格式,需要转换
+          return {
+            id: item.id || item.value || item.campusId,
+            name: item.name || item.label || item.campusName || item.title,
+          };
+        });
+
+        campusList.value = campusData;
+      }
+    })
+    .catch((error) => {
+      console.error("获取校区列表失败:", error);
+      campusList.value = [];
+    });
+}
+
 // 取消按钮
 // 处理弹窗成功事件
 function handleDialogSuccess(message) {
@@ -851,7 +896,7 @@ async function getAgentListData() {
   }
 }
 
-/** 申请开卡按钮操作 */
+/** 直接申请按钮操作 */
 function handleApplyCard() {
   if (selectedRows.value.length === 0) {
     // proxy.$modal.msgWarning("请选择要申请开卡的卡片");
@@ -860,16 +905,16 @@ function handleApplyCard() {
   applyCardOpen.value = true;
 }
 
-// 处理申请开卡成功
+// 处理直接申请成功
 function handleApplyCardSuccess(message) {
   proxy.$modal.msgSuccess(message);
   getList();
 }
 
-// 处理申请开卡确认
+// 处理直接申请确认
 function handleApplyCardConfirm(data) {
   proxy.$modal.msgSuccess(
-    `申请开卡成功!卡号段:${data.beginCardNo}-${data.endCardNo}`
+    `直接申请成功!卡号段:${data.beginCardNo}-${data.endCardNo}`
   );
   getList(); // 刷新列表
 }
@@ -998,6 +1043,7 @@ function handleExport() {
 }
 
 getList();
+getCampusListData(); // 获取校区列表
 
 // 监听地址选择变化,自动获取学校列表
 watch(