InventoryStatistics.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <script setup lang="ts">
  2. import {
  3. Storehouse_Stock_List,
  4. Storehouse_Depot_List,
  5. Storehouse_Stock_Detail_List,
  6. Storehouse_Stock_Detail_Excel
  7. } from '@/api/storehouse/index'
  8. import { ref, reactive, nextTick, onMounted } from 'vue'
  9. import { List, Picture, ArrowUpBold, ArrowDownBold } from '@element-plus/icons-vue'
  10. import { GlobalStore } from '@/stores/index'
  11. import TableBase from '@/components/TableBase/index.vue'
  12. import type { ColumnProps } from '@/components/TableBase/interface/index'
  13. const globalStore = GlobalStore()
  14. const TableRef = ref<InstanceType<typeof TableBase> | null>(null)
  15. const searchShow = ref(false)
  16. const initParam = reactive({
  17. User_tokey: globalStore.GET_User_tokey,
  18. T_depot_id: '',
  19. T_product_class: '',
  20. T_product_name: '',
  21. T_product_model: ''
  22. })
  23. const columns: ColumnProps[] = [
  24. { type: 'index', label: '序号', width: 80 },
  25. { prop: 'T_iccid', label: '仓库名称', ellipsis: true },
  26. { prop: 'T_product_img', label: '产品图片', name: 'T_product_img' },
  27. { prop: 'T_product_name', label: '产品名称' },
  28. { prop: 'T_product_class_name', label: '产品分类' },
  29. { prop: 'T_product_model', label: '产品型号', ellipsis: true },
  30. { prop: 'T_product_spec', label: '产品规格' },
  31. { prop: 'T_total', label: '库存数量' },
  32. { prop: 'operation', label: '操作', width: 200, fixed: 'right' }
  33. ]
  34. const searchShowHandle = () => {
  35. searchShow.value = !searchShow.value
  36. }
  37. // 拿到仓库列表
  38. interface ItemType {
  39. T_name: string
  40. Id: number
  41. }
  42. const options = ref<ItemType[]>([])
  43. const getDepotList = async () => {
  44. if (globalStore.GET_depotList.length) return
  45. const res: any = await Storehouse_Depot_List({ User_tokey: globalStore.GET_User_tokey, page: 1, page_z: 999 })
  46. options.value = res.Data.Data
  47. globalStore.SET_depotList(options.value)
  48. }
  49. onMounted(() => {
  50. getDepotList()
  51. })
  52. </script>
  53. <template>
  54. <div class="inventory-statistics">
  55. <TableBase ref="TableRef" :columns="columns" :requestApi="Storehouse_Stock_List" :initParam="initParam">
  56. <template #table-header>
  57. <div class="head-search" :class="searchShow ? 'active' : ''">
  58. <el-form :model="initParam" class="result-form" label-width="100px">
  59. <el-row>
  60. <el-col :span="6"
  61. ><el-form-item label="产品分类" :inline-message="true"> <el-input /> </el-form-item
  62. ></el-col>
  63. <el-col :span="6"
  64. ><el-form-item label="产品名称"> <el-input /> </el-form-item
  65. ></el-col>
  66. <el-col :span="6"
  67. ><el-form-item label="产品型号"> <el-input /> </el-form-item
  68. ></el-col>
  69. <el-col :span="6">
  70. <el-button :icon="ArrowDownBold" @click="searchShowHandle" />
  71. <el-button type="primary">搜索</el-button>
  72. <el-button type="success">导出</el-button>
  73. </el-col>
  74. </el-row>
  75. <el-row class="search-bottom">
  76. <el-col :span="6"
  77. ><el-form-item label="仓库列表" :inline-message="true"> <el-input /> </el-form-item
  78. ></el-col>
  79. </el-row>
  80. </el-form>
  81. </div>
  82. </template>
  83. <template #T_product_img="{ row }">
  84. <el-image
  85. fit="cover"
  86. style="width: 50px; height: 50px"
  87. :src="row.T_product_img"
  88. :preview-src-list="[row.T_product_img]"
  89. :preview-teleported="true"
  90. >
  91. <template #error>
  92. <div class="image-slot">
  93. <el-icon><Picture /></el-icon>
  94. </div>
  95. </template>
  96. </el-image>
  97. </template>
  98. <template #right="{ row }">
  99. <el-button link type="primary" size="small" :icon="List">明细</el-button>
  100. </template>
  101. </TableBase>
  102. </div>
  103. </template>
  104. <style scoped lang="scss">
  105. @import '@/styles/var.scss';
  106. .inventory-statistics {
  107. @include f-direction;
  108. .head-search {
  109. width: 100%;
  110. height: 32px;
  111. overflow: hidden;
  112. transition: all 0.5s ease-in-out;
  113. .result-form.el-form .el-form-item {
  114. margin-bottom: 0 !important;
  115. }
  116. .search-bottom {
  117. margin-top: 18px;
  118. }
  119. }
  120. .head-search.active {
  121. height: 82px;
  122. }
  123. .image-slot {
  124. display: flex;
  125. justify-content: center;
  126. align-items: center;
  127. width: 100%;
  128. height: 100%;
  129. background: var(--el-fill-color-light);
  130. color: var(--el-text-color-secondary);
  131. font-size: 30px;
  132. }
  133. .image-slot .el-icon {
  134. font-size: 30px;
  135. }
  136. }
  137. </style>