浏览代码

完成按钮功能

month-red-love 1 月之前
父节点
当前提交
d748264ec3

+ 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

+ 38 - 0
back-ui/src/views/dz/cards/components/AssignCardDialog.vue

@@ -147,6 +147,10 @@ const props = defineProps({
     type: Boolean,
     default: false,
   },
+  selectedCards: {
+    type: Array,
+    default: () => [],
+  },
   schoolList: {
     type: Array,
     default: () => [],
@@ -300,6 +304,36 @@ async function getSchoolListByProvince(province) {
   }
 }
 
+// 自动填充卡号段
+function autoFillCardRange() {
+  console.log("autoFillCardRange called, selectedCards:", props.selectedCards);
+  if (props.selectedCards && props.selectedCards.length > 0) {
+    const cardNos = props.selectedCards
+      .map((card) => card.cardNo || card.id)
+      .filter((cardNo) => cardNo && cardNo !== "未知")
+      .sort();
+
+    console.log("cardNos:", cardNos);
+    if (cardNos.length > 0) {
+      const minCardNo = cardNos[0];
+      const maxCardNo = cardNos[cardNos.length - 1];
+
+      // 开始卡号段是最小卡号段的整十数部分
+      const minCardNoNum = parseInt(minCardNo);
+      const beginCardNo = Math.floor(minCardNoNum / 10) * 10;
+
+      console.log(
+        "Setting card range:",
+        beginCardNo.toString(),
+        "to",
+        maxCardNo
+      );
+      form.value.beginCardNo = beginCardNo.toString();
+      form.value.endCardNo = maxCardNo;
+    }
+  }
+}
+
 // 取消
 function handleCancel() {
   visible.value = false;
@@ -399,15 +433,19 @@ async function handleReassign() {
 
 // 监听弹窗关闭,重置表单
 watch(visible, (newVal) => {
+  console.log("AssignCardDialog visible changed to:", newVal);
   if (!newVal) {
     resetForm();
   } else {
+    console.log("AssignCardDialog opened, selectedCards:", props.selectedCards);
     // 弹窗打开时获取省份列表
     getProvinceList();
     // 获取默认考生类型列表(可以根据需要调整)
     getExamTypeList("湖南省"); // 默认获取湖南省的考生类型
     // 获取代理商列表
     getAgentListData();
+    // 自动填充卡号段
+    autoFillCardRange();
   }
 });
 

+ 8 - 6
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">
@@ -319,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([]); // 当前重开的卡号(支持数组)
@@ -748,6 +748,7 @@ function handleSearchFormUpdate(newData) {
 
 // 多选框选中数据
 function handleSelectionChange(selection) {
+  console.log("Selection changed:", selection);
   selectedRows.value = selection;
   ids.value = selection.map((item) => item.cardId);
   single.value = selection.length != 1;
@@ -896,7 +897,7 @@ async function getAgentListData() {
   }
 }
 
-/** 直接申请按钮操作 */
+/** 直接开卡按钮操作 */
 function handleApplyCard() {
   if (selectedRows.value.length === 0) {
     // proxy.$modal.msgWarning("请选择要申请开卡的卡片");
@@ -905,22 +906,23 @@ 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(); // 刷新列表
 }
 
 /** 分配卡按钮操作 */
 function handleAssignCard() {
+  console.log("分配卡按钮点击,当前选中的行:", selectedRows.value);
   assignCardOpen.value = true;
   getInstitutionList(); // 获取机构列表
   getAgentList(); // 获取代理商列表