index.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <template>
  2. <div id="inboundRequests">
  3. <el-card shadow="never" v-loading="loading">
  4. <search @search="reload" :activeName="activeName" ref="searchRef">
  5. </search>
  6. <el-tabs type="border-card" v-model="activeName" @tab-click="handleClick">
  7. <el-tab-pane label="入库" name="入库">
  8. <tgTable v-if="activeName == '入库'" ref="tableRef" type="1" @batch-receive="$emit('batch-receive', $event)"></tgTable>
  9. </el-tab-pane>
  10. <el-tab-pane label="出库" name="出库">
  11. <tgTable v-if="activeName == '出库'" ref="tableRef" type="2"></tgTable>
  12. </el-tab-pane>
  13. <!-- <el-tab-pane label="出入库明细表" name="出入库明细表">
  14. <allTable v-if="activeName == '出入库明细表'" ref="tableRef"></allTable>
  15. </el-tab-pane> -->
  16. </el-tabs>
  17. </el-card>
  18. </div>
  19. </template>
  20. <script>
  21. import search from './components/search.vue';
  22. import tgDetails from './components/tgDetails.vue';
  23. import tgTable from './components/tgTable.vue';
  24. import allTable from './components/allTable.vue';
  25. export default {
  26. components: {
  27. search,
  28. tgDetails,
  29. tgTable,
  30. allTable
  31. },
  32. data() {
  33. return {
  34. activeName: '入库',
  35. loading: false
  36. };
  37. },
  38. created() {
  39. this.applyDashboardFilters();
  40. },
  41. watch: {
  42. '$route.query': {
  43. handler() { this.applyDashboardFilters(); },
  44. deep: true
  45. }
  46. },
  47. methods: {
  48. // 首页下钻沿用申请列表支持的筛选条件。
  49. applyDashboardFilters() {
  50. const query = this.$route.query;
  51. const direction = query.direction || query.tab;
  52. this.activeName = ['out','出库','2'].includes(String(direction)) ? '出库' : '入库';
  53. this.$nextTick(() => {
  54. if (!this.$refs.searchRef) return;
  55. this.$refs.searchRef.applyRouteFilters(query);
  56. this.$refs.searchRef.search();
  57. });
  58. },
  59. handleClick(tab) {
  60. this.activeName = tab.name;
  61. this.$nextTick(() => {
  62. if (this.$refs.tableRef) this.$refs.tableRef.reload(this.$refs.searchRef.query());
  63. });
  64. },
  65. /* 刷新表格 */
  66. reload(where) {
  67. if (this.$refs.tableRef) this.$refs.tableRef.reload(where);
  68. }
  69. }
  70. };
  71. </script>
  72. <style lang="scss" scoped>
  73. #inboundRequests {
  74. height: calc(100vh - 96px);
  75. width: 100%;
  76. :deep(.el-card) {
  77. height: 100%;
  78. .el-card__body {
  79. height: 100%;
  80. box-sizing: border-box;
  81. display: flex;
  82. flex-direction: column;
  83. .el-tabs {
  84. flex: 1;
  85. display: flex;
  86. flex-direction: column;
  87. .el-tabs__content {
  88. flex: 1;
  89. .el-tab-pane {
  90. height: 100%;
  91. }
  92. }
  93. }
  94. .el-form-item {
  95. margin-bottom: 5px !important;
  96. }
  97. }
  98. }
  99. }
  100. </style>