| | |
| | | <el-icon><Plus /></el-icon> |
| | | 新增借阅 |
| | | </el-button> |
| | | <el-button @click="handleOut"> |
| | | 导出 |
| | | </el-button> |
| | | <el-button |
| | | type="danger" |
| | | @click="handleBatchDelete" |
| | |
| | | const borrowList = ref([]); |
| | | const selectedRows = ref([]); |
| | | const documentList = ref([]); // 文档列表,用于借阅书籍选择 |
| | | const scanContent = ref('') // 扫码内容 |
| | | const scanContent = ref() // 扫码内容 |
| | | // 分页相关 |
| | | const pagination = reactive({ |
| | | currentPage: 1, |
| | |
| | | |
| | | // 表单验证规则 |
| | | const borrowRules = reactive({ |
| | | documentationId: [{ required: true, message: "请选择借阅书籍", trigger: "change" }], |
| | | |
| | | borrower: [{ required: true, message: "请输入借阅人", trigger: "blur" }], |
| | | borrowPurpose: [{ required: true, message: "请输入借阅目的", trigger: "blur" }], |
| | | borrowDate: [{ required: true, message: "请选择借阅日期", trigger: "change" }], |
| | |
| | | const res = await getDocumentList(); |
| | | if (res.code === 200) { |
| | | documentList.value = res.data || []; |
| | | console.log("shuju",documentList.value) |
| | | } else { |
| | | ElMessage.error(res.msg || "获取文档列表失败"); |
| | | documentList.value = []; |
| | |
| | | |
| | | // 处理扫码内容 |
| | | const handleScanContent = async (value) => { |
| | | if (!value) return; |
| | | |
| | | if (!value) return; |
| | | try { |
| | | // 查找扫描内容对应的文档 |
| | | // 假设二维码包含的是文档ID或文档名称 |
| | | const matchedDoc = documentList.value.find(item => |
| | | item.documentationId === value |
| | | item.id == value |
| | | ); |
| | | console.log("matchedDoc", matchedDoc); |
| | | |
| | | |
| | | if (matchedDoc) { |
| | | |
| | | // 找到匹配的文档,设置表单值 |
| | | borrowForm.documentationId = matchedDoc.documentationId; |
| | | borrowForm.documentationId = matchedDoc.id; |
| | | ElMessage.success(`已选择: ${matchedDoc.docName || matchedDoc.name}`); |
| | | } else { |
| | | // 未找到匹配的文档,提示用户 |
| | |
| | | }); |
| | | }; |
| | | |
| | | // 导出 |
| | | const handleOut = () => { |
| | | ElMessageBox.confirm("选中的内容将被导出,是否确认导出?", "导出", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | proxy.download("/documentationBorrowManagement/export", {}, "借阅登记.xlsx"); |
| | | }) |
| | | .catch(() => { |
| | | ElMessage.info("已取消"); |
| | | }); |
| | | }; |
| | | |
| | | // 选择变化事件 |
| | | const handleSelectionChange = (selection) => { |
| | | selectedRows.value = selection; |