feat(生产物料): 添加出库记录导出功能及供应商字段
- 在出库记录模块添加导出功能,使用统一的文件下载工具 - 添加入库记录表单的供应商编码和名称字段 - 更新导入导出相关接口路径及导入结果展示格式
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import request from '@/utils/request'
|
||||
import { downFile } from '@/utils/request'
|
||||
|
||||
/**
|
||||
* 出库记录表分页查询
|
||||
@@ -55,3 +56,15 @@ export function delMmRecordOutbound(pid) {
|
||||
method: 'POST'
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出出库记录表
|
||||
*/
|
||||
export async function exportMmRecordOutbound(query) {
|
||||
// return request({
|
||||
// url: '/system/User/export',
|
||||
// method: 'get',
|
||||
// params: query
|
||||
// })
|
||||
await downFile('/mes/productionMaterial/MmRecordOutbound/export', { ...query })
|
||||
}
|
||||
|
||||
@@ -206,6 +206,18 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item label="供应商编码" prop="supplierCode">
|
||||
<el-input v-model="form.supplierCode" placeholder="请输入供应商编码" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item label="供应商名称" prop="supplierName">
|
||||
<el-input v-model="form.supplierName" placeholder="请输入供应商名称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item label="操作员" prop="operator">
|
||||
<el-input :disabled="true" v-model="form.operator" placeholder="请输入操作员" />
|
||||
|
||||
@@ -275,7 +275,7 @@ import { getLocationOption } from '@/api/materialManagement/productionMaterial/m
|
||||
import { listUser } from '@/api/system/user.js'
|
||||
import dateOptions from '@/utils/dateOptions.js'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import { exportUser } from '@/api/system/user'
|
||||
import { exportMmRecordOutbound } from '@/api/materialManagement/productionMaterial/mmrecordoutbound.js'
|
||||
import { getToken } from '@/utils/auth'
|
||||
const { proxy } = getCurrentInstance()
|
||||
const userStore = useUserStore()
|
||||
@@ -325,7 +325,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/MmRecordOutbound/importData'
|
||||
})
|
||||
|
||||
var dictParams = []
|
||||
@@ -575,7 +575,7 @@ function handleImport() {
|
||||
|
||||
/** 下载模板操作 */
|
||||
function importTemplate() {
|
||||
proxy.download('/system/user/importTemplate', '出库记录表数据导入模板')
|
||||
proxy.download('/mes/productionMaterial/MmRecordOutbound/importTemplate', '出库记录表数据导入模板')
|
||||
}
|
||||
/**文件上传中处理 */
|
||||
const handleFileUploadProgress = (event, file, fileList) => {
|
||||
@@ -587,7 +587,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()
|
||||
@@ -606,7 +622,7 @@ function handleExport() {
|
||||
type: 'warning'
|
||||
})
|
||||
.then(async () => {
|
||||
await exportUser(queryParams.value)
|
||||
await exportMmRecordOutbound(queryParams.value)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user