InboundManagement.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <!--入库管理-->
  2. <template>
  3. <div>
  4. <div v-show="!addInboundState.show && !inboundDetailsState.show" class="app-container">
  5. <div>
  6. <transition name="fade">
  7. <el-row :gutter="30" style="height: 50px">
  8. <el-col :span="10">
  9. <el-button type="primary" icon="Plus" @click="handleAdd">新增入库</el-button>
  10. </el-col>
  11. </el-row>
  12. </transition>
  13. <el-table ref="multipleTable" v-loading="loading" :data="tableData" border :max-height="maxHeight" style="width: 96%">
  14. <el-table-column label="入库单号" align="center" prop="inbound_order_number" fixed />
  15. <el-table-column label="仓库名称" align="center" prop="warehouse_name" />
  16. <el-table-column label="库房名称" align="center" prop="room_name" />
  17. <el-table-column label="类型" align="center" prop="type">
  18. <template #default="scope">
  19. <dict-tag :options="sys_store_type" :value="scope.row.type" />
  20. </template>
  21. </el-table-column>
  22. <el-table-column label="供应商名称" align="center" prop="supplier_name" />
  23. <el-table-column label="是否捐赠" align="center" prop="is_donation" >
  24. <template #default="scope">
  25. <dict-tag :options="sys_yes_no" :value="scope.row.is_donation" />
  26. </template>
  27. </el-table-column>
  28. <el-table-column label="采购单号" align="center" prop="purchase_order_number" />
  29. <el-table-column label="运单号" align="center" prop="transport_order_number" />
  30. <!-- <el-table-column label="捐赠人联系电话" align="center" prop="donator_phone" width="120" />-->
  31. <!-- <el-table-column label="捐赠人姓名" align="center" prop="donator_name" width="120" />-->
  32. <!-- <el-table-column label="审核人" align="center" prop="reviewer" width="120" />-->
  33. <!-- <el-table-column label="企业名称" align="center" prop="enterprise_name" width="120" />-->
  34. <!-- <el-table-column label="企业编号" align="center" prop="enterprise_code" width="120" />-->
  35. <!-- <el-table-column label="分级信息" align="center" prop="grading_info" width="120" />-->
  36. <!-- <el-table-column label="创建时间" align="center" prop="creation_time" width="120" />-->
  37. <!-- <el-table-column label="备注" align="center" prop="remark" width="120" />-->
  38. <!-- <el-table-column label="供应商编号" align="center" prop="supplier_code" width="120" />-->
  39. <!-- <el-table-column label="完成时间" align="center" prop="completion_time" width="120" />-->
  40. <!-- <el-table-column label="计划完成时间" align="center" prop="planned_completion_time" width="120" />-->
  41. <!-- <el-table-column label="仓库名称" align="center" prop="warehouse_name" width="120" />-->
  42. <!-- <el-table-column label="新增时间" align="center" prop="new_time" width="120" />-->
  43. <!-- <el-table-column label="入库单" align="center" fixed="right" width="88" class-name="small-padding fixed-width"/>-->
  44. <el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width">
  45. <template #default="scope">
  46. <el-button type="text" class="common-btn-text-primary" @click="handleWrite(scope.row)">查看</el-button>
  47. <el-button type="text" class="common-btn-text-primary" @click="goToInventory(scope.row.inbound_order_number)">明细</el-button>
  48. </template>
  49. </el-table-column>
  50. </el-table>
  51. <pagination
  52. v-show="total > 0"
  53. v-model:page="queryParams.page"
  54. v-model:limit="queryParams.pageSize"
  55. :total="total"
  56. @pagination="getListData"
  57. />
  58. </div>
  59. </div>
  60. <addInbound v-if="addInboundState.show" @close="handleCancel" @confirm="submitRefresh" />
  61. <InboundDetails v-if="inboundDetailsState.show" :id="detailId" @close="handleCancel" />
  62. </div>
  63. </template>
  64. <script setup lang="ts">
  65. import addInbound from "./addInbound.vue";
  66. import InboundDetails from "./InboundDetails.vue";
  67. import { ref, reactive, onMounted, onBeforeUnmount, toRefs } from 'vue';
  68. import { getWarehousingEntry } from '@/api/comprehensiveGuarantee/materialReserveManagement/InboundManagement';
  69. import { parseTime } from '@/utils/ruoyi';
  70. import InventoryDetails from '@/views/comprehensiveGuarantee/MaterialReserveManagement/InventoryDetails.vue';
  71. import router from '@/router';
  72. const { proxy } = getCurrentInstance() as ComponentInternalInstance;
  73. const { sys_store_type, sys_yes_no } = toRefs<any>(proxy?.useDict('sys_store_type','sys_yes_no'));
  74. // 定义响应式变量
  75. const loading = ref(false);
  76. const maxHeight = ref(window.innerHeight * 0.8);
  77. const total = ref();
  78. // 处理窗口大小变化
  79. const handleResize = () => {
  80. maxHeight.value = window.innerHeight * 0.8;
  81. };
  82. const queryParams = reactive({
  83. page: 1,
  84. pageSize: 10,
  85. });
  86. let detailId = ref('');
  87. const tableData = ref([]);
  88. const getListData = () => {
  89. getWarehousingEntry(queryParams).then((res) => {
  90. res.data.forEach((item) => {
  91. item.completion_time = parseTime(item.completion_time);
  92. item.creation_time = parseTime(item.creation_time);
  93. item.new_time = parseTime(item.new_time);
  94. item.planned_completion_time = parseTime(item.planned_completion_time);
  95. })
  96. tableData.value = res.data;
  97. total.value = res.total;
  98. })
  99. }
  100. const goToInventory = (id) => {
  101. router.push({ path:'/comprehensiveGuarantee/MaterialReserveManagement/InventoryDetails', query: { id } });
  102. };
  103. const submitRefresh = () => {
  104. handleCancel();
  105. queryParams.page = 1;
  106. getListData();
  107. }
  108. const addInboundState = reactive({
  109. show: false, // 初始化show为false
  110. });
  111. const inboundDetailsState = reactive({
  112. show: false, // 初始化show为false
  113. });
  114. const handleAdd = () => {
  115. addInboundState.show = true;
  116. };
  117. const upload = () => {
  118. // 这里可能需要实现上传逻辑,暂时只是显示WriteForm作为示例
  119. addInboundState.show = true;
  120. };
  121. const handleCancel = () => {
  122. addInboundState.show = false;
  123. inboundDetailsState.show = false;
  124. };
  125. const handleWrite = (item) => {
  126. inboundDetailsState.show=true;
  127. detailId = item.id;
  128. };
  129. const handleView = () => {
  130. // inboundDetailsState.show=true;
  131. };
  132. onMounted(() => {
  133. window.addEventListener('resize', handleResize);
  134. getListData();
  135. });
  136. // 在组件卸载前移除窗口大小变化监听器
  137. onBeforeUnmount(() => {
  138. window.removeEventListener('resize', handleResize);
  139. });
  140. </script>
  141. <style lang="scss" scoped></style>