| | |
| | | <el-icon><Plus /></el-icon> |
| | | 新增借阅 |
| | | </el-button> |
| | | <el-button @click="handleOut"> |
| | | 导出 |
| | | </el-button> |
| | | <el-button |
| | | type="danger" |
| | | @click="handleBatchDelete" |
| | |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="借阅书籍:" prop="documentationId"> |
| | | <!-- <el-select v-model="borrowForm.documentationId" placeholder="请选择借阅书籍" style="width: 100%" @change="handleScanContent"> |
| | | <el-option |
| | | v-for="item in documentList" |
| | | :key="item.id" |
| | | :label="item.docName || item.name" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> --> |
| | | <div style="display: flex; gap: 10px;"> |
| | | <el-select v-model="borrowForm.documentationId" placeholder="请选择借阅书籍" style="flex: 1;width: 100px;" @change="handleSelectChange"> |
| | | <el-select |
| | | v-if="borrowOperationType !== 'edit'" |
| | | v-model="borrowForm.documentationId" |
| | | placeholder="请选择借阅书籍" |
| | | style="flex: 1;width: 100px;" |
| | | @change="handleSelectChange" |
| | | > |
| | | <el-option |
| | | v-for="item in documentList" |
| | | :key="item.id" |
| | |
| | | /> |
| | | </el-select> |
| | | <el-input |
| | | v-else |
| | | v-model="currentEditDocName" |
| | | style="flex: 1;width: 100px;" |
| | | disabled |
| | | /> |
| | | <el-input |
| | | v-if="borrowOperationType !== 'edit'" |
| | | v-model="scanContent" |
| | | placeholder="扫码输入" |
| | | style="width: 100px;" |
| | |
| | | const selectedRows = ref([]); |
| | | const documentList = ref([]); // 文档列表,用于借阅书籍选择 |
| | | const scanContent = ref() // 扫码内容 |
| | | const currentEditDocName = ref(''); // 编辑时存储的文档名称 |
| | | // 分页相关 |
| | | const pagination = reactive({ |
| | | currentPage: 1, |
| | |
| | | { |
| | | name: "编辑", |
| | | type: "text", |
| | | disabled: (row) => row.borrowStatus === '归还', |
| | | clickFun: (row) => { |
| | | openBorrowDia('edit', row) |
| | | }, |
| | |
| | | if (type === "edit") { |
| | | // 编辑模式,加载现有数据 |
| | | Object.assign(borrowForm, data); |
| | | // 存储文档名称用于显示 |
| | | currentEditDocName.value = data.docName || ''; |
| | | } else { |
| | | // 新增模式,清空表单 |
| | | Object.keys(borrowForm).forEach(key => { |
| | | borrowForm[key] = ""; |
| | | }); |
| | | // 设置默认状态 |
| | | borrowForm.borrowStatus = "借阅"; |
| | | currentEditDocName.value = ''; // 清空编辑时的文档名称 |
| | | // 设置默认状态 |
| | | borrowForm.borrowStatus = "借阅"; |
| | | // 设置当前日期为借阅日期 |
| | | borrowForm.borrowDate = new Date().toISOString().split('T')[0]; |
| | | } |
| | |
| | | proxy.$refs.borrowFormRef.resetFields(); |
| | | borrowDia.value = false; |
| | | scanContent.value = ''; // 清空扫码内容 |
| | | currentEditDocName.value = ''; // 清空编辑时的文档名称 |
| | | }; |
| | | |
| | | // 提交借阅表单 |
| | |
| | | }); |
| | | }; |
| | | |
| | | // 导出 |
| | | const handleOut = () => { |
| | | ElMessageBox.confirm("选中的内容将被导出,是否确认导出?", "导出", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | proxy.download("/documentationBorrowManagement/export", {}, "借阅登记.xlsx"); |
| | | }) |
| | | .catch(() => { |
| | | ElMessage.info("已取消"); |
| | | }); |
| | | }; |
| | | |
| | | // 选择变化事件 |
| | | const handleSelectionChange = (selection) => { |
| | | selectedRows.value = selection; |
| | |
| | | } |
| | | |
| | | .dialog-footer { |
| | | text-align: right; |
| | | text-align: center; |
| | | } |
| | | |
| | | :deep(.el-form-item__label) { |