| | |
| | | range-separator="至" |
| | | start-placeholder="开始月份" |
| | | end-placeholder="结束月份" |
| | | format="YYYY-MM" |
| | | value-format="YYYY-MM" |
| | | format="YYYY-MM-DD" |
| | | value-format="YYYY-MM-DD" |
| | | style="width: 240px;" |
| | | /> |
| | | <el-date-picker |
| | |
| | | <el-table-column |
| | | v-if="searchForm.reportType === 'daily'" |
| | | label="日期" |
| | | prop="date" |
| | | prop="createTime" |
| | | width="100" |
| | | align="center" |
| | | /> |
| | | <el-table-column |
| | | v-if="searchForm.reportType === 'monthly'" |
| | | label="月份" |
| | | prop="month" |
| | | prop="createTime" |
| | | width="100" |
| | | align="center" |
| | | /> |
| | |
| | | width="70" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | <!-- <el-table-column |
| | | label="期初库存" |
| | | prop="beginStock" |
| | | width="100" |
| | | align="center" |
| | | /> |
| | | /> --> |
| | | <el-table-column |
| | | label="入库数量" |
| | | prop="inboundNum" |
| | | width="100" |
| | | align="center" |
| | | /> |
| | | <el-table-column |
| | | <!-- <el-table-column |
| | | label="出库数量" |
| | | prop="outboundNum" |
| | | prop="" |
| | | width="100" |
| | | align="center" |
| | | /> |
| | | /> --> |
| | | <el-table-column |
| | | label="期末库存" |
| | | prop="endStock" |
| | | label="现在库存" |
| | | prop="inboundNum0" |
| | | width="100" |
| | | align="center" |
| | | /> |
| | |
| | | exportStockReport |
| | | } from '@/api/inventoryManagement/stockReport' |
| | | |
| | | |
| | | const { proxy } = getCurrentInstance() |
| | | // 响应式数据 |
| | | const tableLoading = ref(false) |
| | | const trendChart = ref(null) |
| | |
| | | } |
| | | |
| | | if (response.code === 200) { |
| | | reportData.value = response.data |
| | | // generateMockData() |
| | | reportData.value.tableData = response.data.tableData |
| | | reportData.value.summary = response.data.summary |
| | | reportData.value.chartData = response.data.chartData |
| | | nextTick(() => { |
| | | initCharts() |
| | | }) |
| | | |
| | | } |
| | | } catch (error) { |
| | | ElMessage.error('查询失败:' + error.message) |
| | |
| | | tableLoading.value = false |
| | | } |
| | | } |
| | | // // 生成假数据 |
| | | // const generateMockData = () => { |
| | | // // 生成统计卡片假数据 |
| | | // const summary = { |
| | | // totalIn: 1000, |
| | | // totalOut: 600, |
| | | // currentStock: 400, |
| | | // turnoverRate: 30 |
| | | // } |
| | | |
| | | // // 生成图表假数据 |
| | | // const trendDates = ['2025-09-15', '2025-09-16', '2025-09-17', '2025-09-18', '2025-09-19'] |
| | | // const trendValues = [300, 350, 400, 380, 420] |
| | | // const comparisonDates = ['2025-09-15', '2025-09-16', '2025-09-17'] |
| | | // const inValues = [100, 150, 200] |
| | | // const outValues = [80, 120, 100] |
| | | |
| | | // const chartData = { |
| | | // trendDates, |
| | | // trendValues, |
| | | // comparisonDates, |
| | | // inValues, |
| | | // outValues |
| | | // } |
| | | |
| | | // reportData.value = { |
| | | // summary, |
| | | // chartData, |
| | | // tableData: [] |
| | | // } |
| | | // } |
| | | // 验证搜索表单 |
| | | const validateSearchForm = () => { |
| | | if (searchForm.reportType === 'daily') { |
| | |
| | | // 获取查询参数 |
| | | const getQueryParams = () => { |
| | | const params = { |
| | | reportType: searchForm.reportType |
| | | reportType: searchForm.reportType, |
| | | reportDate: "", |
| | | startMonth: "", |
| | | endMonth: "", |
| | | startDate: "", |
| | | endDate: "" |
| | | } |
| | | |
| | | if (searchForm.reportType === 'daily') { |
| | |
| | | |
| | | try { |
| | | const params = getQueryParams() |
| | | const response = await exportStockReport(params) |
| | | |
| | | // const response = await exportStockReport(params) |
| | | proxy.download("/stockin/exportCopy", params, '库存报表.xlsx') |
| | | // 创建下载链接 |
| | | const blob = new Blob([response], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' }) |
| | | const url = window.URL.createObjectURL(blob) |
| | | const link = document.createElement('a') |
| | | link.href = url |
| | | link.download = `${getTableTitle()}_${new Date().getTime()}.xlsx` |
| | | document.body.appendChild(link) |
| | | link.click() |
| | | document.body.removeChild(link) |
| | | window.URL.revokeObjectURL(url) |
| | | // const blob = new Blob([response], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' }) |
| | | // const url = window.URL.createObjectURL(blob) |
| | | // const link = document.createElement('a') |
| | | // link.href = url |
| | | // link.download = `${getTableTitle()}_${new Date().getTime()}.xlsx` |
| | | // document.body.appendChild(link) |
| | | // link.click() |
| | | // document.body.removeChild(link) |
| | | // window.URL.revokeObjectURL(url) |
| | | |
| | | ElMessage.success('导出成功') |
| | | // ElMessage.success('导出成功') |
| | | } catch (error) { |
| | | ElMessage.error('导出失败:' + error.message) |
| | | } |