add:新增需求

This commit is contained in:
2024-03-13 09:08:53 +08:00
parent 036bc71e08
commit 83d45da5c3
35 changed files with 1386 additions and 91 deletions

View File

@@ -152,6 +152,16 @@
>
添加库存物料
</el-button>
<el-button
slot="left"
class="filter-item"
type="primary"
icon="el-icon-arrow-down"
size="mini"
@click="Import"
>
物料信息导入
</el-button>
</span>
</div>
@@ -217,6 +227,7 @@
</el-table>
<AddDtl :dialog-show.sync="dtlShow" :stor-id="storId" @tableChanged="tableChanged"/>
<StructDiv ref="child" :dialog-show.sync="structShow" @tableChanged="structChanged"/>
<UploadDialog :dialog-show.sync="viewShow" :stor-id="paramViewShow" @tableChanged="tableChanged"/>
</el-dialog>
</template>
@@ -226,6 +237,7 @@ import AddDtl from '@/views/wms/st/inStor/productscrap/AddDtl'
import productscrap from '@/views/wms/st/inStor/productscrap/productscrap'
import StructDiv from '@/views/wms/pub/StructDialog'
import crudUserStor from '@/views/wms/basedata/st/userStor/userStor'
import UploadDialog from '@/views/wms/st/inStor/productscrap/UploadDialog'
const defaultForm = {
bill_code: '',
@@ -243,7 +255,7 @@ const defaultForm = {
}
export default {
name: 'AddDialog',
components: { AddDtl, StructDiv },
components: { AddDtl, StructDiv, UploadDialog },
mixins: [crud(), form(defaultForm)],
props: {
dialogShow: {
@@ -255,12 +267,14 @@ export default {
data() {
return {
dialogVisible: false,
viewShow: false,
dtlShow: false,
structShow: false,
structShow2: false,
flagnow: false,
nowrow: {},
nowindex: '',
paramViewShow: '',
storlist: [],
invtypelist: [],
storId: null,
@@ -461,6 +475,13 @@ export default {
this.form.tableData.splice(i, 1, this.form.tableData[i])
}
}
},
Import() {
if (!this.form.stor_id) {
return this.crud.notify('请先选择仓库!', CRUD.NOTIFICATION_TYPE.INFO)
}
this.paramViewShow = this.form.stor_id
this.viewShow = true
}
}
}

View File

@@ -0,0 +1,120 @@
<template>
<el-dialog
title="导入Excel文件"
append-to-body
:visible.sync="dialogVisible"
destroy-on-close
width="400px"
:show-close="true"
@close="close"
@open="open"
>
<el-upload
ref="upload"
class="upload-demo"
action=""
drag
:on-exceed="is_one"
:limit="1"
:auto-upload="false"
:multiple="false"
:show-file-list="true"
:on-change="uploadByJsqd"
:file-list="fileList"
accept=".xlsx,.xls"
>
<i class="el-icon-upload" />
<div class="el-upload__text">
将文件拖到此处
<em>点击上传</em>
</div>
<div slot="tip" class="el-upload__tip">只能上传Excel文件且不超过10MB</div>
</el-upload>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary" @click="submit"> </el-button>
</span>
</el-dialog>
</template>
<script>
import productscrap from '@/views/wms/st/inStor/productscrap/productscrap'
import CRUD, { crud } from '@crud/crud'
export default {
name: 'UploadDialog',
mixins: [crud()],
components: {},
props: {
dialogShow: {
type: Boolean,
default: false
},
openParam: {
type: String
},
storId: {
type: String
}
},
data() {
return {
dialogVisible: false,
fileList: [],
file1: ''
}
},
watch: {
dialogShow: {
handler(newValue, oldValue) {
this.dialogVisible = newValue
}
},
openParam: {
handler(newValue, oldValue) {
this.opendtlParam = newValue
}
}
},
methods: {
open() {
},
close() {
this.$emit('update:dialogShow', false)
},
is_one() {
this.crud.notify('只能上传一个excel文件', CRUD.NOTIFICATION_TYPE.WARNING)
},
// 文件校验方法
beforeAvatarUpload(file) {
// 不能导入大小超过2Mb的文件
if (file.size > 10 * 1024 * 1024) {
return false
}
return true
},
// 文件发生改变就会触发的事件
uploadByJsqd(file) {
this.file1 = file
},
submit() {
if (this.beforeAvatarUpload(this.file1)) {
this.fileList.name = this.file1.name
this.fileList.url = ''
var formdata = new FormData()
formdata.append('file', this.file1.raw)
formdata.set('stor_id', this.storId)
// excelImport请求接口 formdata传递参数
productscrap.excelImport(formdata).then((res) => {
this.crud.notify('导入成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
this.$emit('tableChanged', res)
this.$emit('update:dialogShow', false)
})
} else {
this.crud.notify('文件过大请上传小于10MB的文件〜', CRUD.NOTIFICATION_TYPE.WARNING)
}
}
}
}
</script>

View File

@@ -159,6 +159,7 @@
<el-table-column prop="biz_date" label="业务日期" :min-width="flexWidth('biz_date',crud.data,'业务日期')"/>
<el-table-column label="明细数" prop="detail_count" :min-width="flexWidth('detail_count',crud.data,'明细数')"/>
<el-table-column label="总重量" prop="total_qty" :min-width="flexWidth('total_qty',crud.data,'总重量')"/>
<el-table-column prop="ext_code" label="外部标识" :min-width="flexWidth('ext_code',crud.data,'外部标识')"/>
<el-table-column prop="input_optname" label="创建人" :min-width="flexWidth('input_optname',crud.data,'创建人')"/>
<el-table-column prop="input_time" label="创建日期" :min-width="flexWidth('input_time',crud.data,'创建日期')"/>
<el-table-column prop="confirm_optname" label="确认人" :min-width="flexWidth('confirm_optname',crud.data,'确认人')"/>

View File

@@ -59,4 +59,11 @@ export function onSubmit(data) {
data
})
}
export default { add, edit, del, getOutBillDtl, auditPass, auditOut, onSubmit }
export function excelImport(data) {
return request({
url: 'api/productscrap/importExcel',
method: 'post',
data
})
}
export default { add, edit, del, getOutBillDtl, auditPass, auditOut, onSubmit, excelImport }