materialsDeclarationView.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <template>
  2. <div class="common-dialog">
  3. <div class="common-dialog-content">
  4. <div class="common-dialog-title-box">
  5. <i class="common-dialog-title-icon" />
  6. <div>物资申报详情</div>
  7. </div>
  8. <div class="common-dialog-box">
  9. <el-row :gutter="20" style="width: 100%">
  10. <el-col :span="12">
  11. <div class="text-box">
  12. <div class="text1">申报金额:</div>
  13. <div v-show="!!detailData.declaration_amount" class="text2">{{ formatToTwoDecimalPlaces(detailData.declaration_amount) }}元</div>
  14. </div>
  15. </el-col>
  16. <el-col :span="12">
  17. <div class="text-box">
  18. <div class="text1">审批状态:</div>
  19. <div class="text2">
  20. <dict-tag :options="material_approval_status" :value="detailData.declaration_details" />
  21. </div>
  22. </div>
  23. </el-col>
  24. </el-row>
  25. <el-table :data="detailData.detail" border :height="height">
  26. <el-table-column label="序号" width="80" align="center">
  27. <template #default="{ $index }">
  28. <span>{{ $index + 1 }}</span>
  29. </template>
  30. </el-table-column>
  31. <el-table-column label="物资名称" prop="material_name" align="center" />
  32. <el-table-column label="仓库" prop="warehouse_name" align="center" />
  33. <el-table-column label="物资类型" prop="material_category_name" align="center" />
  34. <el-table-column label="物资数量(件)" prop="material_quantity" align="center" />
  35. <el-table-column label="物资单价(元)" prop="material_unit_price" align="center" />
  36. <el-table-column label="物资用途" prop="material_purpose" align="center" />
  37. </el-table>
  38. <div class="common-dialog-footer" style="margin-top: 18px">
  39. <el-row :span="24" :gutter="10" class="mb8">
  40. <el-col :span="1.5">
  41. <el-button type="primary" @click="handleReturn">返回</el-button>
  42. </el-col>
  43. </el-row>
  44. </div>
  45. </div>
  46. </div>
  47. </div>
  48. </template>
  49. <script setup lang="ts">
  50. import { getDeclarationDetail } from '@/api/comprehensiveGuarantee/materialReserveManagement/materialsDeclaration';
  51. import { formatToTwoDecimalPlaces } from '@/utils';
  52. const props = defineProps({
  53. id: String
  54. });
  55. const { proxy } = getCurrentInstance() as ComponentInternalInstance;
  56. const { material_approval_status } = toRefs<any>(proxy?.useDict('material_approval_status'));
  57. const emits = defineEmits(['close']);
  58. let detailData = reactive({
  59. declaration_amount: '',
  60. declaration_details: '',
  61. detail: []
  62. });
  63. const handleReturn = () => {
  64. emits('close');
  65. };
  66. let height = ref(300);
  67. // 计算表格高度
  68. const calcHeight = () => {
  69. const el = document.getElementsByClassName('common-dialog-content')[0];
  70. height.value = el && el.clientHeight - 173 > 400 ? el.clientHeight - 173 : 300;
  71. };
  72. onMounted(() => {
  73. getDeclarationDetail(props.id).then((res) => {
  74. detailData.declaration_amount = res.data.declaration_amount;
  75. detailData.declaration_details = res.data.declaration_details;
  76. detailData.detail = res.data.detail;
  77. });
  78. calcHeight();
  79. window.addEventListener('resize', calcHeight);
  80. });
  81. onUnmounted(() => {
  82. window.removeEventListener('resize', calcHeight);
  83. });
  84. </script>
  85. <style lang="scss" scoped>
  86. .text-box {
  87. display: flex;
  88. align-items: center;
  89. padding-bottom: 10px;
  90. color: rgba(0, 0, 0, 0.85);
  91. .text1 {
  92. font-size: 18px;
  93. font-weight: bold;
  94. }
  95. .text2 {
  96. font-size: 18px;
  97. }
  98. }
  99. </style>