gaoluyang
18 小时以前 e0cb2008ffb01348b54a7370180a100f3c975877
src/views/inventoryManagement/stockReport/index.vue
@@ -48,12 +48,12 @@
          style="width: 240px;"
        />
        
        <el-button type="primary" @click="handleQuery" style="margin-left: 10px">
        <el-button type="primary" @click="onSearch" style="margin-left: 10px">
          查询
        </el-button>
        <el-button @click="handleReset">重置</el-button>
      </div>
      <div class="search_right">
<!--        <el-button type="success" @click="handleExport" icon="Download">-->
<!--          导出报表-->
@@ -166,14 +166,14 @@
             prop="createTime"
             width="200"
             show-overflow-tooltip
             v-if="!searchForm.reportType === 'inout'"
             v-if="searchForm.reportType !== 'inout'"
           />
           <el-table-column
             label="入库批次"
             prop="inboundBatches"
             width="240"
             show-overflow-tooltip
             v-if="!searchForm.reportType === 'inout'"
             v-if="searchForm.reportType !== 'inout'"
           />
           <el-table-column
             label="产品大类"
@@ -207,6 +207,7 @@
             prop="totalStockOut"
             width="100"
             align="center"
             v-if="searchForm.reportType === 'inout'"
           />
           <el-table-column
             label="现在库存"
@@ -215,7 +216,7 @@
           />
           <el-table-column label="来源"
                            prop="recordType"
                            v-if="!searchForm.reportType === 'inout'"
                            v-if="searchForm.reportType !== 'inout'"
                            show-overflow-tooltip>
             <template #default="scope">
               {{ getRecordType(scope.row.recordType) }}
@@ -225,28 +226,34 @@
             label="入库人"
             prop="createBy"
             width="80"
             v-if="!searchForm.reportType === 'inout'"
             v-if="searchForm.reportType !== 'inout'"
             show-overflow-tooltip
           />
        </el-table>
        <pagination
          :total="total"
          layout="total, sizes, prev, pager, next, jumper"
          :page="page.current"
          :limit="page.size"
          @pagination="paginationChange"
        />
      </el-card>
    </div>
  </div>
</template>
<script setup>
import { ref, reactive, onMounted, nextTick } from 'vue'
import { ref, reactive, onMounted, nextTick, getCurrentInstance } from 'vue'
import { ElMessage } from 'element-plus'
import * as echarts from 'echarts'
import {
  getStockMonthlyReport,
  getStockInOutReport,
} from '@/api/inventoryManagement/stockReport'
import pagination from '@/components/PIMTable/Pagination.vue'
import {
  getStockInventoryInAndOutReportList,
  getStockInventoryReportList
} from "@/api/inventoryManagement/stockInventory.js";
import {findAllQualifiedStockRecordTypeOptions} from "@/api/basicData/enum.js";
import {
  findAllQualifiedStockInRecordTypeOptions,findAllUnQualifiedStockInRecordTypeOptions,
} from "@/api/basicData/enum.js";
const { proxy } = getCurrentInstance()
@@ -268,6 +275,13 @@
  tableData: []
})
const page = reactive({
  current: 1,
  size: 10,
})
const total = ref(0)
const stockRecordTypeOptions = ref([])
const getRecordType = (recordType) => {
@@ -276,9 +290,13 @@
// 获取来源类型选项
const fetchStockRecordTypeOptions = () => {
  findAllQualifiedStockRecordTypeOptions()
  findAllQualifiedStockInRecordTypeOptions()
      .then(res => {
        stockRecordTypeOptions.value = res.data;
        findAllUnQualifiedStockInRecordTypeOptions()
          .then(res => {
          stockRecordTypeOptions.value = [...stockRecordTypeOptions.value,...res.data];
      })
      })
}
@@ -294,6 +312,7 @@
// 报表类型改变
const handleReportTypeChange = () => {
  page.current = 1
  reportData.value = {
    summary: null,
    chartData: null,
@@ -309,7 +328,12 @@
  
  tableLoading.value = true
  try {
    const params = getQueryParams()
    const baseParams = getQueryParams()
    const params = {
      ...baseParams,
      current: page.current,
      size: page.size,
    }
    let response
    if (searchForm.reportType === 'inout') {
@@ -318,7 +342,8 @@
      response = await getStockInventoryReportList(params)
    }
    if (response.code === 200) {
      reportData.value.tableData = response.data.records
      reportData.value.tableData = response.data.records || []
      total.value = response.data.total || 0
      // reportData.value.summary = response.data.summary
      // reportData.value.chartData = response.data.chartData
      // nextTick(() => {
@@ -331,6 +356,19 @@
  } finally {
    tableLoading.value = false
  }
}
// 查询按钮:重置到第一页并查询
const onSearch = () => {
  page.current = 1
  handleQuery()
}
// 分页变化
const paginationChange = (obj) => {
  page.current = obj.page
  page.size = obj.limit
  handleQuery()
}
// // 生成假数据
// const generateMockData = () => {
@@ -551,6 +589,8 @@
  ]
  fetchStockRecordTypeOptions()
  // 初始化加载一次数据
  handleQuery()
})
</script>