Newer
Older
KaiFengPC / src / views / document / loanManagement / loanRequest / audit.vue
@zhangdeliang zhangdeliang on 23 May 2 KB 初始化项目
  1. <template>
  2. <div class="audit">
  3. <el-table :data="tableData" v-loading="loading" stripe :max-height="600">
  4. <el-table-column type="index" width="55" label="序号" />
  5. <el-table-column label="借阅人" prop="borrowUser" show-overflow-tooltip />
  6. <el-table-column label="文件名称" prop="fileName" show-overflow-tooltip />
  7. <el-table-column label="借阅方式" prop="borrowType" show-overflow-tooltip>
  8. <template #default="{ row }">
  9. <span>{{ findText(document_save_type, row.borrowType) }}</span>
  10. </template>
  11. </el-table-column>
  12. <el-table-column label="文件类型" prop="extension" show-overflow-tooltip />
  13. <el-table-column label="借阅时间" prop="borrowDate" show-overflow-tooltip />
  14. <el-table-column label="借阅天数" prop="borrowDays" show-overflow-tooltip />
  15. </el-table>
  16. </div>
  17. </template>
  18.  
  19. <script setup>
  20. import { ref, reactive, onMounted, watch } from 'vue';
  21. import { documentBorrowRecordFileList, documentBorrowRecordApprove } from '@/api/document/loanManagement/loanRequest';
  22. const emit = defineEmits(['close']);
  23. const { proxy } = getCurrentInstance();
  24. const { document_save_type } = proxy.useDict('document_save_type');
  25. const findText = (list, value) => {
  26. if (!value) return '';
  27. const items = value.split(',');
  28. let text = [];
  29. for (const item of items) {
  30. const cur = list.find(it => it.value === item);
  31. if (cur) text.push(cur.label);
  32. }
  33. return text.join();
  34. };
  35. const props = defineProps({
  36. type: {
  37. type: String,
  38. default: '',
  39. },
  40. curRow: {
  41. type: Object,
  42. default: () => ({}),
  43. },
  44. });
  45. const { type, curRow } = props;
  46. const tableData = ref([]);
  47. const loading = ref(false);
  48.  
  49. const submit = async () => {
  50. const res = await documentBorrowRecordApprove({ id: curRow.id });
  51. if (res?.code !== 200) return;
  52. proxy.$modal.msgSuccess('操作成功');
  53. emit('close', { isRefresh: true });
  54. };
  55.  
  56. const getDetail = async () => {
  57. loading.value = true;
  58. try {
  59. const res = await documentBorrowRecordFileList({ id: curRow.id });
  60. if (res?.code !== 200) return;
  61. loading.value = false;
  62. tableData.value = res.data || [];
  63. } catch (error) {
  64. loading.value = false;
  65. }
  66. };
  67.  
  68. onMounted(() => {
  69. getDetail();
  70. });
  71.  
  72. defineExpose({
  73. submit,
  74. });
  75. </script>
  76.  
  77. <style lang="scss" scoped></style>