huminmin
2 天以前 fb1276b796c5212c18141fe2c732fb07d71fa31e
src/views/fileManagement/borrow/index.vue
@@ -44,6 +44,9 @@
            <el-icon><Plus /></el-icon>
            新增借阅
          </el-button>
          <el-button @click="handleOut">
            导出
          </el-button>
          <el-button
            type="danger"
            @click="handleBatchDelete"
@@ -97,16 +100,14 @@
           </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" 
@@ -115,6 +116,13 @@
                  />
                </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;"
@@ -202,6 +210,7 @@
const selectedRows = ref([]);
const documentList = ref([]); // 文档列表,用于借阅书籍选择
const scanContent = ref() // 扫码内容
const currentEditDocName = ref(''); // 编辑时存储的文档名称
// 分页相关
const pagination = reactive({
  currentPage: 1,
@@ -279,6 +288,7 @@
      {
        name: "编辑",
        type: "text",
        disabled: (row) => row.borrowStatus === '归还',
        clickFun: (row) => {
          openBorrowDia('edit', row)
        },
@@ -425,13 +435,16 @@
  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];
  }
@@ -442,6 +455,7 @@
  proxy.$refs.borrowFormRef.resetFields();
  borrowDia.value = false;
  scanContent.value = ''; // 清空扫码内容
  currentEditDocName.value = ''; // 清空编辑时的文档名称
};
// 提交借阅表单
@@ -557,6 +571,21 @@
  });
};
// 导出
const handleOut = () => {
  ElMessageBox.confirm("选中的内容将被导出,是否确认导出?", "导出", {
    confirmButtonText: "确认",
    cancelButtonText: "取消",
    type: "warning",
  })
    .then(() => {
      proxy.download("/documentationBorrowManagement/export", {}, "借阅登记.xlsx");
    })
    .catch(() => {
      ElMessage.info("已取消");
    });
};
// 选择变化事件
const handleSelectionChange = (selection) => {
  selectedRows.value = selection;
@@ -607,7 +636,7 @@
}
.dialog-footer {
  text-align: right;
  text-align: center;
}
:deep(.el-form-item__label) {