opt:越南富佳看板优化、库存增导出功能
This commit is contained in:
BIN
nladmin-ui/dist.rar
Normal file
BIN
nladmin-ui/dist.rar
Normal file
Binary file not shown.
@@ -72,6 +72,10 @@
|
||||
<div class="stat-title">在库数量</div>
|
||||
<div class="stat-value">{{ stats.inventoryCount }}</div>
|
||||
</el-card>
|
||||
<el-card class="stat-card" shadow="hover">
|
||||
<div class="stat-title">剩余库位</div>
|
||||
<div class="stat-value">{{ stats.remainingCount }}</div>
|
||||
</el-card>
|
||||
<el-card class="stat-card" shadow="hover">
|
||||
<div class="stat-title">入库数量</div>
|
||||
<div class="stat-value">{{ stats.inboundCount }}</div>
|
||||
@@ -80,11 +84,6 @@
|
||||
<div class="stat-title">出库数量</div>
|
||||
<div class="stat-value">{{ stats.outboundCount }}</div>
|
||||
</el-card>
|
||||
|
||||
<el-card class="stat-card" shadow="hover">
|
||||
<div class="stat-title">运转数量</div>
|
||||
<div class="stat-value">{{ stats.operationCount }}</div>
|
||||
</el-card>
|
||||
</div>
|
||||
|
||||
<!-- 任务统计图表 - 合并为一个组件 -->
|
||||
@@ -158,7 +157,7 @@ export default {
|
||||
monthTasks: 0,
|
||||
monthlyAvg: 0,
|
||||
locationCount: 0,
|
||||
inventoryCount: 0,
|
||||
remainingCount: 0,
|
||||
outboundCount: 0,
|
||||
operationCount: 0
|
||||
},
|
||||
|
||||
@@ -78,6 +78,14 @@
|
||||
>
|
||||
{{ $t('wms.statement.structivt.export_excel') }}
|
||||
</el-button>-->
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
type="primary"
|
||||
size="mini"
|
||||
@click="exportExcel"
|
||||
>导出excel
|
||||
</el-button>
|
||||
</crudOperation>
|
||||
<!--表格渲染-->
|
||||
<el-table
|
||||
@@ -86,6 +94,8 @@
|
||||
:data="crud.data"
|
||||
size="mini"
|
||||
style="width: 100%;"
|
||||
show-summary
|
||||
:summary-method="getSummaries"
|
||||
@selection-change="crud.selectionChangeHandler"
|
||||
>
|
||||
<el-table-column prop="struct_code" :label="$t('wms.statement.structivt.location_code')" :min-width="flexWidth('struct_code',crud.data,'仓位编码')" />
|
||||
@@ -109,7 +119,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import crudStructivt from '@/views/wms/statement/structivt/structivt'
|
||||
import crudStructivt, { exportFile } from '@/views/wms/statement/structivt/structivt'
|
||||
import CRUD, { presenter, header, crud } from '@crud/crud'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
@@ -150,6 +160,43 @@ export default {
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
// 导出Excel功能
|
||||
exportExcel() {
|
||||
// 构建文件名称:仓位管理导出yyyymmdd.xlsx
|
||||
const now = new Date()
|
||||
const year = now.getFullYear()
|
||||
const month = String(now.getMonth() + 1).padStart(2, '0')
|
||||
const day = String(now.getDate()).padStart(2, '0')
|
||||
const fileName = `入库管理导出${year}${month}${day}.xlsx`
|
||||
if (this.query.createTime) {
|
||||
this.query.start_time = this.query.createTime[0]
|
||||
this.query.begin_time = this.query.createTime[0]
|
||||
if (this.query.createTime.length > 1) {
|
||||
this.query.end_time = this.query.createTime[1]
|
||||
}
|
||||
} else {
|
||||
this.query.start_time = ''
|
||||
this.query.end_time = ''
|
||||
}
|
||||
// 使用导入的exportFile方法调用后端接口
|
||||
exportFile(this.query).then(res => {
|
||||
// 创建Blob对象
|
||||
const blob = new Blob([res], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' })
|
||||
// 创建下载链接
|
||||
const link = document.createElement('a')
|
||||
link.href = URL.createObjectURL(blob)
|
||||
link.download = fileName
|
||||
// 触发下载
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
// 清理
|
||||
document.body.removeChild(link)
|
||||
URL.revokeObjectURL(link.href)
|
||||
this.crud.notify('导出成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
}).catch(() => {
|
||||
this.crud.notify('导出失败', CRUD.NOTIFICATION_TYPE.ERROR)
|
||||
})
|
||||
},
|
||||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
return true
|
||||
@@ -185,6 +232,26 @@ export default {
|
||||
this.showDtlLoading = false
|
||||
})
|
||||
}
|
||||
},
|
||||
getSummaries(param) {
|
||||
const { columns, data } = param
|
||||
const sums = []
|
||||
columns.forEach((column, index) => {
|
||||
if (index === 0) {
|
||||
sums[index] = '合计'
|
||||
return
|
||||
}
|
||||
if (column.property === 'qty') {
|
||||
const total = data.reduce((sum, item) => {
|
||||
const qty = Number(item.qty) || 0
|
||||
return sum + qty
|
||||
}, 0)
|
||||
sums[index] = parseFloat(total).toFixed(3)
|
||||
} else {
|
||||
sums[index] = ''
|
||||
}
|
||||
})
|
||||
return sums
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,4 +62,12 @@ export function excelImport(data) {
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, getStruct, getStructById, getUnits, save, excelImport }
|
||||
export function exportFile(query) {
|
||||
return request({
|
||||
url: 'api/structivt/exportFile',
|
||||
method: 'post',
|
||||
data: query,
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
||||
export default { add, edit, del, getStruct, getStructById, getUnits, save, excelImport, exportFile }
|
||||
|
||||
Reference in New Issue
Block a user