inStorageDetails.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <script setup lang="ts">
  2. import { useRouter } from 'vue-router'
  3. import { GlobalStore } from '@/stores/index'
  4. import { View } from '@element-plus/icons-vue'
  5. import { ref, reactive } from 'vue'
  6. import TableBase from '@/components/TableBase/index.vue'
  7. import type { ColumnProps } from '@/components/TableBase/interface/index'
  8. import { StockIn_ListProducts,StockinExcel } from '@/api/storehouse/index'
  9. import { depotHooks } from '@/hooks/useDepot'
  10. const router = useRouter()
  11. const globalStore = GlobalStore()
  12. const TableRef = ref<InstanceType<typeof TableBase> | null>(null)
  13. const columns: ColumnProps[] = [
  14. { type: 'index', label: '序号', width: 80 },
  15. { prop: 'T_number', label: '入库单号' },
  16. { prop: 'T_submit_name', label: '经办人' },
  17. { prop: 'T_date', label: '入库日期' },
  18. { prop: 'T_depot_name', label: '入库仓库' },
  19. { prop: 'T_product_name', label: '产品名称' },
  20. { prop: 'T_product_model', label: '产品型号' },
  21. { prop: 'T_num', label: '数量' },
  22. { prop: 'T_product_relation_sn', label: '是否关联SN', name: 'T_product_relation_sn' },
  23. { prop: 'T_remark', label: '备注' },
  24. { prop: 'operation', label: '操作', width: 260, fixed: 'right' }
  25. ]
  26. /**
  27. * 查看详情
  28. */
  29. const dialogTableVisible = ref(false)
  30. const gridData:any = ref([])
  31. const preview = (list:any) => {
  32. let arr = [...list] || []
  33. gridData.value = arr.map((item:any)=>({sn:item}))
  34. dialogTableVisible.value = true
  35. }
  36. // 搜索
  37. const T_date = ref<string[]>([])
  38. const initParam = reactive({
  39. User_tokey: globalStore.GET_User_tokey,
  40. T_end_date: '',
  41. T_start_date: '',
  42. T_depot_id: '',
  43. T_product_name: '',
  44. T_product_model: '',
  45. T_name: '',
  46. })
  47. const searchHandle = () => {
  48. initParam.T_end_date = T_date.value ? T_date.value[1] : ''
  49. initParam.T_start_date = T_date.value ? T_date.value[0] : ''
  50. TableRef.value?.searchTable()
  51. }
  52. // 拿到仓库列表
  53. const { options } = depotHooks()
  54. /**
  55. * Excel
  56. */
  57. const onclickExcel = async ()=>{
  58. const result:any = await StockinExcel(initParam)
  59. console.log('导出',result)
  60. if (result.Code === 200)window.open(result.Data)
  61. }
  62. </script>
  63. <template>
  64. <div class="inStorageDetails">
  65. <TableBase ref="TableRef" :columns="columns" :requestApi="StockIn_ListProducts"
  66. :initParam="initParam">
  67. <template #table-header>
  68. <div class="input-suffix">
  69. <el-row :gutter="20" style="margin-bottom: 0">
  70. <el-col :xl="4" :lg="4" :md="4" style="display: flex">
  71. <span class="inline-flex items-center">关键字:</span>
  72. <el-input v-model="initParam.T_name" placeholder="入库单号,备注搜索" />
  73. </el-col>
  74. <el-col :xl="4" :lg="4" :md="4" style="display: flex">
  75. <span class="inline-flex items-center">入库日期:</span>
  76. <el-date-picker v-model="T_date" type="daterange" range-separator="~"
  77. start-placeholder="开始时间" end-placeholder="结束时间" format="YYYY-MM-DD"
  78. value-format="YYYY-MM-DD" />
  79. </el-col>
  80. <el-col :xl="4" :lg="4" :md="4" style="display: flex">
  81. <span class="inline-flex items-center">产品名称:</span>
  82. <el-input v-model="initParam.T_product_name" placeholder="产品名称" />
  83. </el-col>
  84. <el-col :xl="4" :lg="4" :md="4" style="display: flex">
  85. <span class="inline-flex items-center">产品型号:</span>
  86. <el-input v-model="initParam.T_product_model" placeholder="产品型号" />
  87. </el-col>
  88. <el-col :xl="4" :lg="4" :md="4" style="display: flex">
  89. <span class="inline-flex items-center">仓库:</span>
  90. <el-select v-model="initParam.T_depot_id" clearable placeholder="请选择仓库~">
  91. <el-option v-for="item in options" :key="item.Id" :label="item.T_name"
  92. :value="item.Id" />
  93. </el-select>
  94. <el-button type="primary" @click="searchHandle">搜索</el-button>
  95. </el-col>
  96. <el-col :xl="4" :lg="4" :md="4" style="display: flex">
  97. <el-button type="primary" icon="Download" @click="onclickExcel">导出</el-button>
  98. </el-col>
  99. </el-row>
  100. </div>
  101. </template>
  102. <template #T_product_relation_sn="{ row }">
  103. <el-text class="mx-1" :type="row.T_product_relation_sn==1?'primary':'danger'">
  104. {{row.T_product_relation_sn==1?'是':'否'}}
  105. </el-text>
  106. </template>
  107. <template #right="{ row }">
  108. <el-button type="primary" size="small" v-show="row.T_product_relation_sn == 1" :icon="View"
  109. @click="preview(row.T_device_list)">查看SN</el-button>
  110. </template>
  111. </TableBase>
  112. <el-dialog v-model="dialogTableVisible" title="查看SN" draggable>
  113. <el-table :data="gridData" border max-height="500">
  114. <el-table-column type="index" label="序号" width="100" />
  115. <el-table-column property="sn" label="SN" />
  116. </el-table>
  117. </el-dialog>
  118. </div>
  119. </template>
  120. <style scoped lang="scss">
  121. @import '@/styles/var.scss';
  122. .inStorageDetails {
  123. @include f-direction;
  124. .input-suffix {
  125. width: 100%;
  126. .inline-flex {
  127. white-space: nowrap;
  128. }
  129. .w-50 {
  130. width: 12.5rem;
  131. }
  132. .btn {
  133. display: flex;
  134. justify-content: end;
  135. .el-button {
  136. padding: 0 20px;
  137. }
  138. }
  139. }
  140. }
  141. </style>