Commit 6d8dfbaa authored by xioln's avatar xioln

采购入库导入

parent ac181cc8
/**
* @Description: 采购入库导入
* @author xioln
* @date 2023-06-21
* @FilePath: applications/dee-mes/src/privateComponents/components/ProcurementWarehousingImport/index.vue
*/
<template>
<div class="procurement-Warehousing-import">
<dee-dialog
:dialog-visible="dialogVisible"
title="导入"
width="40%"
>
<el-form ref="fileForm" label-width="100px">
<el-form-item label="选择文件">
<el-upload
ref="upload"
class="upload-demo"
accept=".xlsx, .xlsm, .xls"
:auto-upload="false"
action="#"
:limit="1"
:file-list="fileList"
:on-change="handleChange"
:on-exceed="handleExceed"
:on-remove="handleRemove"
>
<el-button size="small" style="width: 400px; text-align: right">
<i class="fa fa-folder-open-o" />
</el-button>
</el-upload>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button
type="primary"
:disabled="uploading"
@click="handleImportExcel"
>确定导入</el-button>
</div>
</dee-dialog>
</div>
</template>
<script>
import { post } from '@/utils/http'
export default {
componentName: '导入',
name: 'ProcurementWarehousingImport', // name写在组件的最前方,自定义组件为必填
components: {},
props: {
param: {
type: Object,
required: true
}
// baseComInfo: {
// type: Object,
// default: () => { }
// }
},
data() {
return {
dialogVisible: false,
fileList: [], // 文件列表
file: {},
uploading: true // 默认置灰确定导入按钮
}
},
computed: {},
created() {
// 初始化数据
},
mounted() {
this.$nextTick(() => {
// this.handleExcel()
})
},
methods: {
open() {
this.dialogVisible = true
},
close() {
this.dialogVisible = false
},
// 文件状态改变触发
handleChange(file) { // (file,fileList)参数
this.uploading = false
this.file = file
},
// 文件超出个数限制
handleExceed() {
this.$message.warning('仅允许上传一个文件!')
},
// 移除文件
handleRemove() {
this.uploading = true
},
// 导入excel
handleImportExcel() {
if (!this.file.size) {
this.$message.warning('请选择上传的文件')
return
}
this.uploading = true
if (this.param.id) {
this.upLoadExcel(this.param.id)
} else {
post('/InventoryRequest/batch/recursionAdd', this.param).then(res => {
if (res.items.id) {
this.upLoadExcel(res.items.id)
}
}).catch((err) => {
console.log(err)
})
}
},
// 上传excel
upLoadExcel(id) {
const formData = new FormData()
formData.append('file', this.file.raw)
this.$api.apiUploadFile(`/InStorageRequestItem/importByExcel?id=${id}`, formData).then(res => { // 调用接口
this.uploading = false
if (res.code === '0') {
this.$message.success(res.message)
this.close()
} else {
this.$message.error(res.message)
}
}).catch(err => {
this.$message.error(err)
})
}
}
}
</script>
<style lang='scss'>
.procurement-Warehousing-import {
.dialog-footer{
float: right;
}
}
</style>
...@@ -163,6 +163,13 @@ export default { ...@@ -163,6 +163,13 @@ export default {
trigger: ['blur', 'change'] trigger: ['blur', 'change']
} }
], ],
sorties: [
{
required: true,
message: '请填写表单信息',
trigger: ['blur', 'change']
}
],
serialNo: [ serialNo: [
{ {
required: true, required: true,
...@@ -238,6 +245,7 @@ export default { ...@@ -238,6 +245,7 @@ export default {
this.$set(this.form, 'operator', 'ADD') this.$set(this.form, 'operator', 'ADD')
} else if (type === 'ADD') { } else if (type === 'ADD') {
this.parentId = row.rowId this.parentId = row.rowId
this.$set(this.form, 'operator', 'ADD')
} else if (type === 'MODIFY') { } else if (type === 'MODIFY') {
console.log('row', row) console.log('row', row)
console.log('this.basicData', this.basicData.operator) console.log('this.basicData', this.basicData.operator)
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
*/ */
<template> <template>
<div class="className"> <div class="className">
<dee-tools :tools="topTools" mode="normal" style="justify-content: end;" />
<dee-form <dee-form
ref="form" ref="form"
label-width="120" label-width="120"
...@@ -16,29 +17,27 @@ ...@@ -16,29 +17,27 @@
@on-cancel="cancel" @on-cancel="cancel"
/> />
<div class="sub-title"> 采购入库申请明细 </div> <div class="sub-title"> 采购入库申请明细 </div>
<dee-table <dee-table :data="tableData" :columns="columns" :options="optionsTree" :index-row="{ title: '序号', width: '70' }">
:data="tableData"
:columns="columns"
:options="optionsTree"
:index-row="{ title: '序号', width: '70' }"
>
<div slot="header" class="table-title-wrap"> <div slot="header" class="table-title-wrap">
<dee-tools :tools="tools" mode="normal" /> <dee-tools :tools="tools" mode="normal" />
</div> </div>
</dee-table> </dee-table>
<span style="position: absolute;top: calc(100% - 70px);left: calc(50% + 30px);}"> <span style="position: absolute;top: calc(100% - 70px);left: calc(50% - 70px);}">
<el-button type="primary" class="searchBtn" @click="submit">保存</el-button> <el-button type="primary" class="searchBtn" @click="submit">完成</el-button>
<el-button type="primary" class="searchBtn" @click="back">取消</el-button>
</span> </span>
<storage-details ref="storageDetailsCreatOrEdit" :basic-data="detailsPropData" @addTableData="addTableData" /> <storage-details ref="storageDetailsCreatOrEdit" :basic-data="detailsPropData" @addTableData="addTableData" />
<import-file ref="importFile" :param="importParam" />
</div> </div>
</template> </template>
<script> <script>
import { post, del, get } from '@/utils/http' import { post, del, get } from '@/utils/http'
import StorageDetails from './component/storageDetailsCreateCom' import StorageDetails from './component/storageDetailsCreateCom'
import ImportFile from './component/importFile'
export default { export default {
componentName: '采购入库申请创建编辑', componentName: '采购入库申请创建编辑',
name: 'PurchasingWarehousingNewOrEdit', // name写在组件的最前方,自定义组件为必填 name: 'PurchasingWarehousingNewOrEdit', // name写在组件的最前方,自定义组件为必填
components: { StorageDetails }, components: { StorageDetails, ImportFile },
props: { props: {
// basicData: { // basicData: {
// type: Object, // type: Object,
...@@ -190,22 +189,51 @@ export default { ...@@ -190,22 +189,51 @@ export default {
} }
] ]
}, },
tools: [{ tools: [
name: '添加入库物料', {
icon: '/icons/components/new/add.png', name: '添加入库物料',
handler: { icon: '/icons/components/new/add.png',
click: () => { handler: {
this.$refs.form.validate((isok) => { click: () => {
if (isok) { this.$refs.form.validate((isok) => {
// 校验通过 if (isok) {
this.$refs.storageDetailsCreatOrEdit.handleOpen('NEW', this.detailsPropData) // 校验通过
} else { this.$refs.storageDetailsCreatOrEdit.handleOpen('NEW', this.detailsPropData)
this.$utils.showMessageWarning('请填写基本信息!') } else {
} this.$utils.showMessageWarning('请填写基本信息!')
}) }
})
}
}
},
{
name: '导入',
icon: '/icons/components/new/addAffectedData.png',
handler: {
click: () => {
this.$refs.form.validate((isok) => {
if (isok) {
// 校验通过
this.$refs.importFile.open()
} else {
this.$utils.showMessageWarning('请填写基本信息!')
}
})
}
} }
} }
}], ],
topTools: [
{
name: '返回',
icon: '/icons/toleft.png',
handler: {
click: () => {
that.back()
}
}
}
],
optionsTree: { optionsTree: {
'row-key': 'rowId', // value值需为可以标识该对象唯一的值 'row-key': 'rowId', // value值需为可以标识该对象唯一的值
lazy: false, lazy: false,
...@@ -225,7 +253,8 @@ export default { ...@@ -225,7 +253,8 @@ export default {
}, },
icon: '/icons/components/new/add.png', icon: '/icons/components/new/add.png',
showFun: (row) => { showFun: (row) => {
if (row.parentId || this.detailsPropData.materialTypeName.label === '外购成品') { const value = row.extMaterial ? row.extMaterial.resType2.typeName : ''
if (!row.isRoot || row.parentId || value !== '外购成品') {
return false return false
} }
return true return true
...@@ -252,7 +281,7 @@ export default { ...@@ -252,7 +281,7 @@ export default {
const id = row.id const id = row.id
del(`InStorageRequestItem/batch/${id}`).then(res => { del(`InStorageRequestItem/batch/${id}`).then(res => {
for (const item of this.tableData) { for (const item of this.tableData) {
// 父类修改 // 父类修改
if (item.rowId === row.rowId) { if (item.rowId === row.rowId) {
this.tableData.splice(this.tableData.indexOf(item), 1) this.tableData.splice(this.tableData.indexOf(item), 1)
break break
...@@ -288,31 +317,43 @@ export default { ...@@ -288,31 +317,43 @@ export default {
} }
}, },
{ title: '所属设备', key: 'subEquipment', headerAlign: 'center' }, { title: '所属设备', key: 'subEquipment', headerAlign: 'center' },
{ title: '物料类型', key: 'typeName', headerAlign: 'center', formatter: (row, column, cellValue, index) => { {
const value = row.extMaterial ? row.extMaterial.resType2.typeName : row.materialTypeName title: '物料类型', key: 'typeName', headerAlign: 'center', formatter: (row, column, cellValue, index) => {
return value const value = row.extMaterial ? row.extMaterial.resType2.typeName : row.materialTypeName
} }, return value
{ title: '编码', key: 'typeCode', headerAlign: 'center', formatter: (row, column, cellValue, index) => { }
const value = row.extMaterial ? row.extMaterial.resCode : row.resCode },
return value {
} }, title: '编码', key: 'typeCode', headerAlign: 'center', formatter: (row, column, cellValue, index) => {
const value = row.extMaterial ? row.extMaterial.resCode : row.resCode
return value
}
},
{ title: '机型', key: 'airModel', headerAlign: 'center' }, { title: '机型', key: 'airModel', headerAlign: 'center' },
{ title: '架次', key: 'sorties', headerAlign: 'center' }, { title: '架次', key: 'sorties', headerAlign: 'center' },
{ title: '计量单位', key: 'unitName', headerAlign: 'center', formatter: (row, column, cellValue, index) => { {
console.log('2123123123', { ...row }) title: '计量单位', key: 'unitName', headerAlign: 'center', formatter: (row, column, cellValue, index) => {
const value = row.extMaterial ? row.extMaterial.extUnit.unitName : row.reqUnit console.log('2123123123', { ...row })
return value const value = row.extMaterial ? row.extMaterial.extUnit.unitName : row.reqUnit
} }, return value
}
},
{ title: '入库数量', key: 'reqAmount', headerAlign: 'center' }, { title: '入库数量', key: 'reqAmount', headerAlign: 'center' },
{ title: '供应商', key: 'supplierFullName', headerAlign: 'center', formatter: (row, column, cellValue, index) => { {
const value = row.extDxSipplier ? row.extDxSipplier.supplierFullName : row.supplier title: '供应商', key: 'supplierFullName', headerAlign: 'center', formatter: (row, column, cellValue, index) => {
return value const value = row.extDxSipplier ? row.extDxSipplier.supplierFullName : row.supplier
} }, return value
}
},
// { title: '是否合格供应商', key: 'extDxSipplier.isValid', headerAlign: 'center' }, // { title: '是否合格供应商', key: 'extDxSipplier.isValid', headerAlign: 'center' },
{ title: '制造商', key: 'manufacturer', headerAlign: 'center' }, { title: '制造商', key: 'manufacturer', headerAlign: 'center' },
{ title: '到货日期', key: 'arrivalDate', headerAlign: 'center' }, { title: '到货日期', key: 'arrivalDate', headerAlign: 'center' },
{ title: '生产日期', key: 'producedTime', headerAlign: 'center' }, { title: '生产日期', key: 'producedTime', headerAlign: 'center' },
{ title: '随产品资料', key: 'withProductMaterial', headerAlign: 'center' }, {
title: '随产品资料', key: 'withProductMaterial', headerAlign: 'center', formatter: (row, column, cellValue, index) => {
return Array.isArray(row.withProductMaterial) ? row.withProductMaterial.join(';') : row.withProductMaterial
}
},
{ title: '紧急程度', key: 'urgency', headerAlign: 'center' }, { title: '紧急程度', key: 'urgency', headerAlign: 'center' },
{ title: '入库单价', key: 'stockUnitPrice', headerAlign: 'center' }, { title: '入库单价', key: 'stockUnitPrice', headerAlign: 'center' },
{ title: '入库金额', key: 'stockPrice', headerAlign: 'center' }, { title: '入库金额', key: 'stockPrice', headerAlign: 'center' },
...@@ -320,10 +361,12 @@ export default { ...@@ -320,10 +361,12 @@ export default {
{ title: '含税金额', key: 'taxPrice', headerAlign: 'center' }, { title: '含税金额', key: 'taxPrice', headerAlign: 'center' },
{ title: '税率', key: 'taxRate', headerAlign: 'center' }, { title: '税率', key: 'taxRate', headerAlign: 'center' },
{ title: '报检人', key: 'applyUserName', headerAlign: 'center' }, { title: '报检人', key: 'applyUserName', headerAlign: 'center' },
{ title: '接受仓库', key: 'extname', headerAlign: 'center', formatter: (row, column, cellValue, index) => { {
const value = row.storageZone ? row.storageZone.extname : row.storageZoneName title: '接受仓库', key: 'extname', headerAlign: 'center', formatter: (row, column, cellValue, index) => {
return value const value = row.storageZone ? row.storageZone.extname : row.storageZoneName
} }, return value
}
},
{ title: '合同号', key: 'contractNo', headerAlign: 'center' }, { title: '合同号', key: 'contractNo', headerAlign: 'center' },
{ title: '备注', key: 'remark', headerAlign: 'center' }, { title: '备注', key: 'remark', headerAlign: 'center' },
{ title: '状态', key: 'state', headerAlign: 'center' }, { title: '状态', key: 'state', headerAlign: 'center' },
...@@ -340,6 +383,27 @@ export default { ...@@ -340,6 +383,27 @@ export default {
supplierFullName: this.formData[0].data.find(item => item.key === 'extDxSipplierId').component.options.find(item => item.value === this.form.extDxSipplierId), supplierFullName: this.formData[0].data.find(item => item.key === 'extDxSipplierId').component.options.find(item => item.value === this.form.extDxSipplierId),
...this.form ...this.form
} }
},
importParam: function() {
if (this.form.id) {
return {
'id': this.form.id
}
} else {
return {
'operator': 'ADD',
'materialTypeIdType': 'ExtDxProcessResourceType',
'extDxProductAreaIdType': 'ExtDxProductArea',
'extDxSipplierIdType': 'ExtDxSipplier',
'subTypeName': 'InStoragePurchase',
'reqStatus': 'Apply',
'billType': this.form.billType,
'arrivalDate': this.form.arrivalDate,
'materialTypeId': this.form.materialTypeId,
'extDxProductAreaId': this.form.extDxProductAreaId,
'extDxSipplierId': this.form.extDxSipplierId
}
}
} }
}, },
created() { created() {
...@@ -349,6 +413,12 @@ export default { ...@@ -349,6 +413,12 @@ export default {
this.form.operator = 'ADD' this.form.operator = 'ADD'
}, },
methods: { methods: {
back() {
this.$router.push({
path: '/page/86a5fa19-e245-4732-aff6-c48b18e2b5c7',
query: { title: '采购入库', menuRootAppId: '1626781924331' }
})
},
initData() { initData() {
this.getInventoryRequest() this.getInventoryRequest()
this.getDictData() this.getDictData()
...@@ -526,6 +596,7 @@ export default { ...@@ -526,6 +596,7 @@ export default {
}, },
// 组装表格数据 // 组装表格数据
addTableData(formData) { addTableData(formData) {
console.log('formData', formData)
const tableDataItem = { const tableDataItem = {
...formData, ...formData,
subEquipment: formData.materialTypeName, subEquipment: formData.materialTypeName,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment