feat(生产物料): 添加库存表和入库记录表的导出功能
- 在mminventory.js和mmrecordinbound.js中添加导出API - 更新MmInventory.vue和MmRecordInbound.vue中的导出逻辑 - 改进导入结果提示信息的展示格式 - 修正导入模板和导入数据的API路径
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import request from '@/utils/request'
|
||||
import { downFile } from '@/utils/request'
|
||||
|
||||
/**
|
||||
* 库存表分页查询
|
||||
@@ -112,3 +113,15 @@ export function createOutboundReceipt(data) {
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出库存表
|
||||
*/
|
||||
export async function exportMmInventory(query) {
|
||||
// return request({
|
||||
// url: '/system/User/export',
|
||||
// method: 'get',
|
||||
// params: query
|
||||
// })
|
||||
await downFile('/mes/productionMaterial/MmInventory/export', { ...query })
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import request from '@/utils/request'
|
||||
import { downFile } from '@/utils/request'
|
||||
|
||||
/**
|
||||
* 入库记录表分页查询
|
||||
@@ -55,3 +56,15 @@ export function delMmRecordInbound(pid) {
|
||||
method: 'POST'
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出库存表
|
||||
*/
|
||||
export async function exportMmRecordInbound(query) {
|
||||
// return request({
|
||||
// url: '/system/User/export',
|
||||
// method: 'get',
|
||||
// params: query
|
||||
// })
|
||||
await downFile('/mes/productionMaterial/MmRecordInbound/export', { ...query })
|
||||
}
|
||||
|
||||
@@ -430,7 +430,7 @@ import {
|
||||
import { listMmTransactionType } from '@/api/materialManagement/productionMaterial/mmtransactiontype.js'
|
||||
import { warehouseOptions } from '@/utils/warehouse.js'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import { exportUser } from '@/api/system/user'
|
||||
import { exportMmInventory } from '@/api/materialManagement/productionMaterial/mminventory.js'
|
||||
import { getToken } from '@/utils/auth'
|
||||
const { proxy } = getCurrentInstance()
|
||||
const userStore = useUserStore()
|
||||
@@ -481,7 +481,7 @@ const upload = reactive({
|
||||
// 设置上传的请求头部
|
||||
headers: { Authorization: 'Bearer ' + getToken() },
|
||||
// 上传的地址
|
||||
url: import.meta.env.VITE_APP_BASE_API + '/system/user/importData'
|
||||
url: import.meta.env.VITE_APP_BASE_API + '/mes/productionMaterial/MmInventory/importData'
|
||||
})
|
||||
|
||||
var dictParams = []
|
||||
@@ -746,19 +746,36 @@ function handleImport() {
|
||||
|
||||
/** 下载模板操作 */
|
||||
function importTemplate() {
|
||||
proxy.download('/system/user/importTemplate', '库存数据导入模板')
|
||||
proxy.download('/mes/productionMaterial/MmInventory/importTemplate', '库存数据导入模板')
|
||||
}
|
||||
/**文件上传中处理 */
|
||||
const handleFileUploadProgress = (event, file, fileList) => {
|
||||
upload.isUploading = true
|
||||
}
|
||||
/** 文件上传成功处理 */
|
||||
/** 文件上传成功处理 */
|
||||
const handleFileSuccess = (response, file, fileList) => {
|
||||
const { code, msg, data } = response
|
||||
upload.open = false
|
||||
upload.isUploading = false
|
||||
proxy.$refs['uploadRef'].clearFiles()
|
||||
proxy.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + data.item1 + '</div>', '导入结果', {
|
||||
|
||||
// 构建导入结果提示信息
|
||||
const resultHtml = `
|
||||
<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>
|
||||
<p><strong>导入结果:${data.message}</strong></p>
|
||||
<p>总记录数:${data.total}</p>
|
||||
<p>新增记录:${data.inserted}</p>
|
||||
<p>更新记录:${data.updated}</p>
|
||||
<p>删除记录:${data.deleted}</p>
|
||||
<p>错误记录:${data.errorCount}</p>
|
||||
<p>忽略记录:${data.ignoredCount}</p>
|
||||
${data.errorCount > 0 ? `<p><strong>错误信息:</strong></p><ul>${data.errors.map((error) => `<li>${error}</li>`).join('')}</ul>` : ''}
|
||||
${data.ignoredCount > 0 ? `<p><strong>忽略信息:</strong></p><ul>${data.ignored.map((ignore) => `<li>${ignore}</li>`).join('')}</ul>` : ''}
|
||||
</div>
|
||||
`
|
||||
|
||||
proxy.$alert(resultHtml, '导入结果', {
|
||||
dangerouslyUseHTMLString: true
|
||||
})
|
||||
getList()
|
||||
@@ -777,7 +794,7 @@ function handleExport() {
|
||||
type: 'warning'
|
||||
})
|
||||
.then(async () => {
|
||||
await exportUser(queryParams.value)
|
||||
await exportMmInventory(queryParams.value)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -293,7 +293,7 @@ import { listMmTransactionType } from '@/api/materialManagement/productionMateri
|
||||
import { getMaterialOption, getLocationOption } from '@/api/materialManagement/productionMaterial/mminventory.js'
|
||||
import { listUser } from '@/api/system/user.js'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import { exportUser } from '@/api/system/user'
|
||||
import { exportMmRecordInbound } from '@/api/materialManagement/productionMaterial/mmrecordinbound.js'
|
||||
import { getToken } from '@/utils/auth'
|
||||
const { proxy } = getCurrentInstance()
|
||||
const userStore = useUserStore()
|
||||
@@ -349,7 +349,7 @@ const upload = reactive({
|
||||
// 设置上传的请求头部
|
||||
headers: { Authorization: 'Bearer ' + getToken() },
|
||||
// 上传的地址
|
||||
url: import.meta.env.VITE_APP_BASE_API + '/system/user/importData'
|
||||
url: import.meta.env.VITE_APP_BASE_API + '/mes/productionMaterial/MmRecordInbound/importData'
|
||||
})
|
||||
|
||||
var dictParams = []
|
||||
@@ -594,13 +594,13 @@ function getOperatorList() {
|
||||
|
||||
/** 导入按钮操作 */
|
||||
function handleImport() {
|
||||
upload.title = '出入库记录表导入'
|
||||
upload.title = '入库记录表导入'
|
||||
upload.open = true
|
||||
}
|
||||
|
||||
/** 下载模板操作 */
|
||||
function importTemplate() {
|
||||
proxy.download('/system/user/importTemplate', '出入库记录表数据导入模板')
|
||||
proxy.download('/mes/productionMaterial/MmRecordInbound/importTemplate', '入库记录表数据导入模板')
|
||||
}
|
||||
/**文件上传中处理 */
|
||||
const handleFileUploadProgress = (event, file, fileList) => {
|
||||
@@ -612,7 +612,23 @@ const handleFileSuccess = (response, file, fileList) => {
|
||||
upload.open = false
|
||||
upload.isUploading = false
|
||||
proxy.$refs['uploadRef'].clearFiles()
|
||||
proxy.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + data.item1 + '</div>', '导入结果', {
|
||||
|
||||
// 构建导入结果提示信息
|
||||
const resultHtml = `
|
||||
<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>
|
||||
<p><strong>导入结果:${data.message}</strong></p>
|
||||
<p>总记录数:${data.total}</p>
|
||||
<p>新增记录:${data.inserted}</p>
|
||||
<p>更新记录:${data.updated}</p>
|
||||
<p>删除记录:${data.deleted}</p>
|
||||
<p>错误记录:${data.errorCount}</p>
|
||||
<p>忽略记录:${data.ignoredCount}</p>
|
||||
${data.errorCount > 0 ? `<p><strong>错误信息:</strong></p><ul>${data.errors.map((error) => `<li>${error}</li>`).join('')}</ul>` : ''}
|
||||
${data.ignoredCount > 0 ? `<p><strong>忽略信息:</strong></p><ul>${data.ignored.map((ignore) => `<li>${ignore}</li>`).join('')}</ul>` : ''}
|
||||
</div>
|
||||
`
|
||||
|
||||
proxy.$alert(resultHtml, '导入结果', {
|
||||
dangerouslyUseHTMLString: true
|
||||
})
|
||||
getList()
|
||||
@@ -625,13 +641,13 @@ function submitFileForm() {
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.$modal
|
||||
.confirm('是否确认导出所有出入库记录表数据项?', '警告', {
|
||||
.confirm('是否确认导出所有入库记录表数据项?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(async () => {
|
||||
await exportUser(queryParams.value)
|
||||
await exportMmRecordInbound(queryParams.value)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user