InStorage.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <script setup lang="ts">
  2. import { ref, reactive, onMounted } from 'vue'
  3. import { GlobalStore } from '@/stores/index'
  4. import Dialog from '@/components/dialog/Dialog.vue'
  5. import TableBase from '@/components/TableBase/index.vue'
  6. import type { ColumnProps } from '@/components/TableBase/interface/index'
  7. import { Storehouse_StockIn_List, Storehouse_Depot_List } from '@/api/storehouse/index'
  8. import { View } from '@element-plus/icons-vue'
  9. import InStorageForm from './InStorageForm.vue'
  10. const globalStore = GlobalStore()
  11. const TableRef = ref<InstanceType<typeof TableBase> | null>(null)
  12. const columns: ColumnProps[] = [
  13. { type: 'index', label: '序号', width: 80 },
  14. { prop: 'T_number', label: '入库单号' },
  15. { prop: 'T_submit_name', label: '经办人' },
  16. { prop: 'T_depot_name', label: '入库仓库' },
  17. { prop: 'T_date', label: '入库日期' },
  18. { prop: 'operation', label: '操作', width: 260, fixed: 'right' }
  19. ]
  20. // 查看图片
  21. const url = ref('')
  22. const srcList = ref<any[]>([])
  23. const dialog = ref<InstanceType<typeof Dialog> | null>(null)
  24. const previewImg = (str: string) => {
  25. dialog.value?.DialogOpen()
  26. url.value = str
  27. srcList.value.push(str)
  28. }
  29. // 搜索
  30. const initParam = reactive({
  31. User_tokey: globalStore.GET_User_tokey,
  32. T_date: '',
  33. T_state: ''
  34. })
  35. const searchHandle = () => {
  36. console.log(initParam)
  37. // TableRef.value?.searchTable()
  38. }
  39. // 拿到仓库列表
  40. const options = ref()
  41. const getDepotList = async () => {
  42. const res: any = await Storehouse_Depot_List({ User_tokey: globalStore.GET_User_tokey, page: 1, page_z: 999 })
  43. options.value = res.Data.Data
  44. }
  45. onMounted(() => {
  46. getDepotList()
  47. })
  48. </script>
  49. <template>
  50. <div class="InStorage">
  51. <TableBase ref="TableRef" :columns="columns" :requestApi="Storehouse_StockIn_List" :initParam="initParam">
  52. <template #table-header>
  53. <div class="input-suffix">
  54. <el-row :gutter="20" style="margin-bottom: 0">
  55. <el-col :xl="7" :lg="9" :md="11">
  56. <span class="inline-flex items-center">入库日期:</span>
  57. <el-date-picker
  58. v-model="initParam.T_date"
  59. type="daterange"
  60. range-separator="~"
  61. start-placeholder="开始时间"
  62. end-placeholder="结束时间"
  63. format="YYYY-MM-DD"
  64. value-format="YYYY-MM-DD"
  65. class="w-50 m-2"
  66. />
  67. </el-col>
  68. <el-col :xl="14" :lg="12" :md="11">
  69. <span class="inline-flex items-center">仓库:</span>
  70. <el-select v-model="initParam.T_state" class="w-50" clearable placeholder="请选择仓库~">
  71. <el-option v-for="item in options" :key="item.T_State" :label="item.T_name" :value="item.T_State" />
  72. </el-select>
  73. <el-button type="primary" @click="searchHandle">搜索</el-button>
  74. </el-col>
  75. <el-col :xl="3" :lg="3" :md="4" class="btn"><el-button type="primary">入库</el-button></el-col>
  76. </el-row>
  77. </div>
  78. </template>
  79. <template #T_State="{ row }">
  80. <el-tag v-if="row.T_State === 1" type="success" effect="dark"> 已出库 </el-tag>
  81. <el-tag v-else type="danger" effect="dark"> 未出库 </el-tag>
  82. </template>
  83. <template #T_product_img="{ row }">
  84. <el-image
  85. v-if="row.T_product_img"
  86. style="height: 50px"
  87. :src="row.T_product_img"
  88. fit="cover"
  89. @click="previewImg(row.T_product_img)"
  90. />
  91. </template>
  92. <template #right="{ row }">
  93. <el-button link type="success" size="small" :icon="View">详情</el-button>
  94. </template>
  95. </TableBase>
  96. <Dialog ref="dialog" width="50%">
  97. <el-image :src="url" :zoom-rate="1.2" :preview-src-list="srcList" fit="cover" />
  98. </Dialog>
  99. <InStorageForm />
  100. </div>
  101. </template>
  102. <style scoped lang="scss">
  103. .InStorage {
  104. .input-suffix {
  105. width: 100%;
  106. .inline-flex {
  107. white-space: nowrap;
  108. }
  109. .w-50 {
  110. width: 12.5rem;
  111. }
  112. .btn {
  113. .el-button {
  114. padding: 0 20px;
  115. }
  116. }
  117. }
  118. }
  119. </style>