Newer
Older
KaiFengPC / src / views / document / loanManagement / loanRequest / audit.vue
@鲁yixuan 鲁yixuan on 27 Aug 2 KB updata
<template>
  <div class="audit">
    <el-table :data="tableData" v-loading="loading" stripe :max-height="600">
      <el-table-column type="index" width="55" label="序号" />
      <el-table-column label="借阅人" prop="borrowUser" show-overflow-tooltip />
      <el-table-column label="文件名称" prop="fileName" show-overflow-tooltip />
      <el-table-column label="借阅方式" prop="borrowType" show-overflow-tooltip>
        <template #default="{ row }">
          <span>{{ findText(document_save_type, row.borrowType) }}</span>
        </template>
      </el-table-column>
      <el-table-column label="文件类型" prop="extension" show-overflow-tooltip />
      <el-table-column label="借阅时间" prop="borrowDate" show-overflow-tooltip />
      <el-table-column label="借阅天数" prop="borrowDays" show-overflow-tooltip />
    </el-table>
  </div>
</template>

<script setup>
import { ref, reactive, onMounted, watch } from 'vue';
import { documentBorrowRecordFileList, documentBorrowRecordApprove } from '@/api/document/loanManagement/loanRequest';
const emit = defineEmits(['close']);
const { proxy } = getCurrentInstance();
const { document_save_type } = proxy.useDict('document_save_type');
console.log(document_save_type, 'document_save_type');
const findText = (list, value) => {
  if (!value) return '';
  const items = value.split(',');
  let text = [];
  for (const item of items) {
    const cur = list.find(it => it.value === item);
    if (cur) text.push(cur.label);
  }
  return text.join();
};
const props = defineProps({
  type: {
    type: String,
    default: '',
  },
  curRow: {
    type: Object,
    default: () => ({}),
  },
});
const { type, curRow } = props;
const tableData = ref([]);
const loading = ref(false);

const submit = async () => {
  const res = await documentBorrowRecordApprove({ id: curRow.id });
  if (res?.code !== 200) return;
  proxy.$modal.msgSuccess('操作成功');
  emit('close', { isRefresh: true });
};

const getDetail = async () => {
  loading.value = true;
  try {
    const res = await documentBorrowRecordFileList({ id: curRow.id });
    if (res?.code !== 200) return;
    loading.value = false;
    tableData.value = res.data || [];
  } catch (error) {
    loading.value = false;
  }
};

onMounted(() => {
  getDetail();
});

defineExpose({
  submit,
});
</script>

<style lang="scss" scoped></style>