| | |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="文档:" prop="borrowId"> |
| | | <!-- <el-select v-model="returnForm.borrowId" placeholder="请选择文档" style="flex: 1;" @change="handleDocumentChange"> |
| | | <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="returnForm.borrowId" placeholder="请选择文档" style="width: 120px;" @change="handleDocumentChange"> |
| | | <el-select |
| | | v-if="returnOperationType !== 'edit'" |
| | | v-model="returnForm.borrowId" |
| | | placeholder="请选择文档" |
| | | style="width: 120px;" |
| | | @change="handleDocumentChange" |
| | | > |
| | | <el-option |
| | | v-for="item in documentList" |
| | | :key="item.id" |
| | |
| | | /> |
| | | </el-select> |
| | | <el-input |
| | | v-else |
| | | v-model="currentEditDocName" |
| | | style="width: 120px;" |
| | | disabled |
| | | /> |
| | | <el-input |
| | | v-if="returnOperationType !== 'edit'" |
| | | v-model="scanContent" |
| | | placeholder="扫码输入" |
| | | style="flex: 1;" |
| | |
| | | const documentList = ref([]); // 文档列表 |
| | | const borrowInfoList = ref([]); // 借阅信息列表 |
| | | const scanContent = ref(); // 扫码内容 |
| | | const currentEditDocName = ref(''); // 编辑时存储的文档名称 |
| | | |
| | | // 分页相关 |
| | | const pagination = reactive({ |
| | |
| | | { |
| | | name: "编辑", |
| | | type: "text", |
| | | disabled: (row) => row.borrowStatus === '归还', |
| | | clickFun: (row) => { |
| | | openReturnDia('edit', row) |
| | | }, |
| | |
| | | if (type === "edit") { |
| | | // 编辑模式,加载现有数据 |
| | | Object.assign(returnForm, data); |
| | | // 编辑模式下,文档选择后自动填充借阅人和应归还日期 |
| | | if (returnForm.borrowId) { |
| | | handleDocumentChange(returnForm.borrowId); |
| | | } |
| | | // 存储文档名称用于显示 |
| | | currentEditDocName.value = data.docName || ''; |
| | | } else { |
| | | // 新增模式,清空表单 |
| | | Object.keys(returnForm).forEach(key => { |
| | | returnForm[key] = ""; |
| | | }); |
| | | currentEditDocName.value = ''; // 清空编辑时的文档名称 |
| | | // 设置默认状态 |
| | | returnForm.borrowStatus = "归还"; |
| | | // 设置当前日期为归还日期 |
| | |
| | | returnDia.value = false; |
| | | scanContent.value = ''; // 清空扫码内容 |
| | | borrowInfoList.value = []; // 清空借阅信息列表 |
| | | currentEditDocName.value = ''; // 清空编辑时的文档名称 |
| | | }; |
| | | |
| | | // 提交归还表单 |