Commit a7c5342f authored by xioln's avatar xioln

采购入库子明细新增编辑

parent b942e565
...@@ -219,12 +219,12 @@ export default { ...@@ -219,12 +219,12 @@ export default {
// this.resetMaterial(v) // this.resetMaterial(v)
// } // }
// } // }
'basicData': { // 'basicData': {
handler: function(v) { // handler: function(v) {
console.log('vvv', v) // console.log('vvv', v)
}, // },
deep: true // deep: true
} // },
}, },
created() { created() {
// 初始化数据 // 初始化数据
...@@ -235,6 +235,7 @@ export default { ...@@ -235,6 +235,7 @@ export default {
}, },
methods: { methods: {
handleOpen(type, basicData, row) { handleOpen(type, basicData, row) {
console.log('basicData', this.parentId)
this.basicData = basicData this.basicData = basicData
this.form = { 'reqAmount': 1 } this.form = { 'reqAmount': 1 }
this.dialogVisible = true this.dialogVisible = true
...@@ -244,24 +245,47 @@ export default { ...@@ -244,24 +245,47 @@ export default {
if (type === 'NEW') { if (type === 'NEW') {
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.id ? row.id : ''
this.parentRowId = row.rowId ? row.rowId : row.id
this.$set(this.form, 'operator', 'ADD') this.$set(this.form, 'operator', 'ADD')
} else if (type === 'MODIFY') { if (basicData.materialTypeName.label === '外购成品') {
console.log('row', row) this.formFileds[0].data.push(
console.log('this.basicData', this.basicData.operator) {
title: '批次号',
key: 'lotNo',
component: {
clearable: true,
name: 'el-input',
placeholder: '请输入批次号'
}
},
)
}
delete row.id
this.form = row this.form = row
this.$set(this.form, 'operator', row.id && this.basicData.operator !== 'ADD' ? 'MODIFY' : 'ADD')
row.billType === 'AirEquipment' && this.$set(this.form, 'reqAmount', 1)
this.$set(this.form, 'resCode', row.extMaterial.resCode || '')
this.$set(this.form, 'resName', row.extMaterial.resName || '')
this.$set(this.form, 'reqUnit', row.extMaterial.extUnit.unitName || '')
this.$set(this.form, 'modelNo', row.extMaterial.modelNo || '')
this.$set(this.form, 'extMaterialId', row.extMaterialId || '')
this.$set(this.form, 'supplier', row.extDxSipplier.supplierFullName || '') this.$set(this.form, 'supplier', row.extDxSipplier.supplierFullName || '')
this.$set(this.form, 'withProductMaterial', Array.isArray(row.withProductMaterial) ? row.withProductMaterial : row.withProductMaterial.split(';')) this.$set(this.form, 'withProductMaterial', Array.isArray(row.withProductMaterial) ? row.withProductMaterial : row.withProductMaterial.split(';'))
this.resetMaterial(row.extMaterial.resCode) this.resetMaterial(row.extMaterial.resCode)
this.changeMaterial(row.extMaterial.resCode) this.changeMaterial(row.extMaterial.resCode)
} else if (type === 'MODIFY') {
this.dispalyData(row)
} }
console.log('this.o', this.form)
},
// 回显数据
dispalyData(row) {
this.form = row
this.$set(this.form, 'operator', row.id && this.basicData.operator !== 'ADD' ? 'MODIFY' : 'ADD')
row.billType === 'AirEquipment' && this.$set(this.form, 'reqAmount', 1)
this.$set(this.form, 'resCode', row.extMaterial.resCode || '')
this.$set(this.form, 'resName', row.extMaterial.resName || '')
this.$set(this.form, 'reqUnit', row.extMaterial.extUnit.unitName || '')
this.$set(this.form, 'modelNo', row.extMaterial.modelNo || '')
this.$set(this.form, 'extMaterialId', row.extMaterialId || '')
this.$set(this.form, 'supplier', row.extDxSipplier.supplierFullName || '')
this.$set(this.form, 'withProductMaterial', Array.isArray(row.withProductMaterial) ? row.withProductMaterial : row.withProductMaterial.split(';'))
this.resetMaterial(row.extMaterial.resCode)
this.changeMaterial(row.extMaterial.resCode)
}, },
handleClose() { handleClose() {
this.dialogVisible = false this.dialogVisible = false
...@@ -747,11 +771,14 @@ export default { ...@@ -747,11 +771,14 @@ export default {
clearable: true, clearable: true,
name: 'el-input-number', name: 'el-input-number',
min: 1, min: 1,
disabled: true, disabled: false,
placeholder: '请输入入库数量' placeholder: '请输入入库数量'
}, },
handler: { handler: {
change: () => this.changeComputed() change: (v) => {
console.log('123', v)
this.changeComputed()
}
} }
}, },
{ {
...@@ -784,6 +811,7 @@ export default { ...@@ -784,6 +811,7 @@ export default {
key: 'manufacturer', key: 'manufacturer',
component: { component: {
clearable: true, clearable: true,
disabled: this.operateType !== 'NEW',
name: 'el-input', name: 'el-input',
placeholder: '请输入制造商' placeholder: '请输入制造商'
} }
...@@ -1010,6 +1038,7 @@ export default { ...@@ -1010,6 +1038,7 @@ export default {
key: 'remark', key: 'remark',
component: { component: {
clearable: true, clearable: true,
disabled: this.operateType !== 'NEW',
name: 'el-input', name: 'el-input',
placeholder: '请输入备注' placeholder: '请输入备注'
} }
...@@ -1027,7 +1056,6 @@ export default { ...@@ -1027,7 +1056,6 @@ export default {
clearable: true, clearable: true,
name: 'el-select', name: 'el-select',
placeholder: '请输入物料关键词', placeholder: '请输入物料关键词',
disabled: this.operateType !== 'NEW',
remote: true, remote: true,
filterable: true, filterable: true,
'remote-method': this.resetMaterial, 'remote-method': this.resetMaterial,
...@@ -1358,6 +1386,7 @@ export default { ...@@ -1358,6 +1386,7 @@ export default {
default: default:
break break
} }
console.log('this.form', this.form)
// 设置物料类型下拉 // 设置物料类型下拉
this.resetMaterial() this.resetMaterial()
// 设置带出接收仓库 // 设置带出接收仓库
...@@ -1477,12 +1506,24 @@ export default { ...@@ -1477,12 +1506,24 @@ export default {
this.material = res.items.content this.material = res.items.content
this.formFileds[0].data[0].component.options = res.items.content.map( this.formFileds[0].data[0].component.options = res.items.content.map(
(item) => { (item) => {
return { // 新增或编辑子产品时和父产品物料类型不能一致
label: `${item.resName ? item.resName + '/' : ''}${item.modelNo ? item.modelNo + '/' : '' if (((this.operateType === 'MODIFY' && !this.form.isRoot) || this.operateType === 'ADD') && item.resCode !== this.form.extMaterial.resCode) {
}${item.techSpec ? item.techSpec + '/' : ''}${item.spec ? item.spec + '/' : '' return {
}${item.supplyStatus ? item.supplyStatus + '/' : ''}${item.supplierName ? item.supplierName + '/' : '' label: `${item.resName ? item.resName + '/' : ''}${item.modelNo ? item.modelNo + '/' : ''
}`, }${item.techSpec ? item.techSpec + '/' : ''}${item.spec ? item.spec + '/' : ''
value: item.resCode }${item.supplyStatus ? item.supplyStatus + '/' : ''}${item.supplierName ? item.supplierName + '/' : ''
}`,
value: item.resCode
}
} else {
return {
label: `${item.resName ? item.resName + '/' : ''}${item.modelNo ? item.modelNo + '/' : ''
}${item.techSpec ? item.techSpec + '/' : ''}${item.spec ? item.spec + '/' : ''
}${item.supplyStatus ? item.supplyStatus + '/' : ''}${item.supplierName ? item.supplierName + '/' : ''
}`,
value: item.resCode,
disabled: true
}
} }
} }
) )
...@@ -1749,16 +1790,14 @@ export default { ...@@ -1749,16 +1790,14 @@ export default {
save() { save() {
this.$refs.form.validate((isok) => { this.$refs.form.validate((isok) => {
if (isok) { if (isok) {
console.log('this.form.operator', this.form.operator)
console.log('this.basicData', this.basicData)
// 校验通过 // 校验通过
const newTableData = { const newTableData = {
...this.form, ...this.form,
'operator': this.form.operator, 'operator': this.form.operator,
'subTypeName': 'InStoragePurchaseItem', 'subTypeName': 'InStoragePurchaseItem',
'rowId': this.form.rowId ? this.form.rowId : this.generateUUID(), 'rowId': this.operateType !== 'MODIFY' ? this.generateUUID() : this.form.id,
'parentId': this.form.parentId ? this.form.parentId : this.parentId, 'parentId': this.form.parentId ? this.form.parentId : this.parentId,
'hasParent': this.form.hasParent ? this.form.hasParent : !!this.parentId, 'parentRowId': this.parentRowId,
'extMaterialId': this.extMaterialId ? this.extMaterialId : this.form.extMaterialId, 'extMaterialId': this.extMaterialId ? this.extMaterialId : this.form.extMaterialId,
'extMaterialIdType': 'ExtDxProcessMaterial', 'extMaterialIdType': 'ExtDxProcessMaterial',
'materialTypeName': this.basicData.materialTypeName.label, 'materialTypeName': this.basicData.materialTypeName.label,
...@@ -1789,7 +1828,7 @@ export default { ...@@ -1789,7 +1828,7 @@ export default {
'inventoryReqId': this.basicData.id, 'inventoryReqId': this.basicData.id,
'inventoryReqIdType': 'InventoryRequest', 'inventoryReqIdType': 'InventoryRequest',
'contractNo': this.form.contractNo, 'contractNo': this.form.contractNo,
'isRoot': true, 'isRoot': this.operateType !== 'ADD' || (this.operateType === 'MODIFY' && !this.form.isRoot),
'subEquipment': this.form.subEquipment, 'subEquipment': this.form.subEquipment,
'productDwawVer': this.form.productDwawVer, 'productDwawVer': this.form.productDwawVer,
'atpName': this.form.atpName, 'atpName': this.form.atpName,
......
...@@ -236,8 +236,8 @@ export default { ...@@ -236,8 +236,8 @@ export default {
], ],
optionsTree: { optionsTree: {
'row-key': 'rowId', // value值需为可以标识该对象唯一的值 'row-key': 'rowId', // value值需为可以标识该对象唯一的值
lazy: false, 'lazy': false,
'tree-props': { children: 'children', hasChildren: 'hasParent' } 'tree-props': { children: 'children', hasChildren: 'hasChildren' }
}, },
columns: [ columns: [
{ {
...@@ -253,8 +253,9 @@ export default { ...@@ -253,8 +253,9 @@ export default {
}, },
icon: '/icons/components/new/add.png', icon: '/icons/components/new/add.png',
showFun: (row) => { showFun: (row) => {
console.log('row', row)
const value = row.extMaterial ? row.extMaterial.resType2.typeName : '' const value = row.extMaterial ? row.extMaterial.resType2.typeName : ''
if (!row.isRoot || row.parentId || value === '外购成品') { if (!row.isRoot || value !== '外购成品') {
return false return false
} }
return true return true
...@@ -333,7 +334,6 @@ export default { ...@@ -333,7 +334,6 @@ export default {
{ title: '架次', key: 'sorties', headerAlign: 'center' }, { title: '架次', key: 'sorties', headerAlign: 'center' },
{ {
title: '计量单位', key: 'unitName', headerAlign: 'center', formatter: (row, column, cellValue, index) => { title: '计量单位', key: 'unitName', headerAlign: 'center', formatter: (row, column, cellValue, index) => {
console.log('2123123123', { ...row })
const value = row.extMaterial ? row.extMaterial.extUnit.unitName : row.reqUnit const value = row.extMaterial ? row.extMaterial.extUnit.unitName : row.reqUnit
return value return value
} }
...@@ -373,6 +373,7 @@ export default { ...@@ -373,6 +373,7 @@ export default {
{ title: '创建时间', key: 'createTime', headerAlign: 'center' } { title: '创建时间', key: 'createTime', headerAlign: 'center' }
], ],
tableData: [], tableData: [],
tableParam: [],
operator: null operator: null
} }
}, },
...@@ -546,56 +547,68 @@ export default { ...@@ -546,56 +547,68 @@ export default {
// 编辑采购入库明细查询InStorageRequestItem/search // 编辑采购入库明细查询InStorageRequestItem/search
searchInStorageRequestItem() { searchInStorageRequestItem() {
const param = { const param = {
'pageFrom': 1, 'rootCondition': {
'pageSize': 10, 'pageFrom': 1,
'searchItems': { 'pageSize': 10,
'children': [ 'searchItems': {
'children': [
{
'items': [
{
'fieldName': 'inventoryReq.id',
'operator': 'EQ',
'value': this.basicData.id
},
{
'fieldName': 'isRoot',
'operator': 'EQ',
'value': 'true'
},
{
'fieldName': 'parentId',
'operator': 'ISNULL'
},
{
'fieldName': 'state',
'operator': 'EQ',
'value': 'Apply'
}
],
'operator': 'AND'
}
],
'items': [
]
},
'openProps': [{ 'name': 'extMaterial', 'openProps': [{ 'name': 'resType2' }, { 'name': 'extUnit' }] }, { 'name': 'extDxSipplier' }, { 'name': 'storageZone' }],
'sortItem': [
{ {
'items': [ 'fieldName': 'modifyTime',
{ 'sortOrder': 'desc'
'fieldName': 'inventoryReq.id',
'operator': 'EQ',
'value': this.basicData.id
},
{
'fieldName': 'isRoot',
'operator': 'EQ',
'value': 'true'
},
{
'fieldName': 'parentId',
'operator': 'ISNULL'
},
{
'fieldName': 'state',
'operator': 'EQ',
'value': 'Apply'
}
],
'operator': 'AND'
} }
],
'items': [
] ]
}, }
'openProps': [{ 'name': 'extMaterial', 'openProps': [{ 'name': 'resType2' }, { 'name': 'extUnit' }] }, { 'name': 'extDxSipplier' }, { 'name': 'storageZone' }],
'sortItem': [
{
'fieldName': 'modifyTime',
'sortOrder': 'desc'
}
]
} }
post('InStorageRequestItem/treeSearch', param).then(res => { post('InStorageRequestItem/treeSearch', param).then(res => {
console.log('res.items.content', res.items.content) const data = res.items.map(item => {
const data = res.items.content.map(item => {
return { return {
...item, ...item,
operator: 'NO_CHANGE' operator: 'NO_CHANGE',
rowId: item.id,
hasChildren: item.children.length > 0,
children: item.children && item.children.map(child => {
return {
...child,
operator: 'NO_CHANGE',
hasChildren: false
}
})
} }
}) })
console.log('res.items', data)
if (data.length > 0) { if (data.length > 0) {
this.formData[0].data.forEach(item => { this.formData[0].data.forEach(item => {
item.component.disabled = true item.component.disabled = true
...@@ -634,12 +647,13 @@ export default { ...@@ -634,12 +647,13 @@ export default {
if (tableDataItem.operateType === 'ADD') { if (tableDataItem.operateType === 'ADD') {
for (let i = 0; i < this.tableData.length; i++) { for (let i = 0; i < this.tableData.length; i++) {
const item = this.tableData[i] const item = this.tableData[i]
if (tableDataItem.hasParent && !item.children) { if (item.rowId === tableDataItem.parentRowId) {
item.children = [] if (!item.hasChildren) {
} item.children = []
}
if (item.rowId === tableDataItem.parentId) { tableDataItem.hasChildren = false
item.children.push(tableDataItem) item.children.push(tableDataItem)
item.hasChildren = true
break break
} }
} }
...@@ -675,27 +689,33 @@ export default { ...@@ -675,27 +689,33 @@ export default {
delete tableData[i][key] delete tableData[i][key]
} }
} }
if (obj.hasChildren) {
obj.children.forEach((child, j) => {
for (const ckey in child) {
if (ckey === 'storageZone') {
delete tableData[i]['children'][j][ckey]
}
}
})
}
}) })
console.log('tableData', tableData)
const param = { const param = {
...this.form,
'operator': this.operator, 'operator': this.operator,
'billType': this.form.billType,
'arrivalDate': this.form.arrivalDate,
'materialTypeIdType': 'ExtDxProcessResourceType', 'materialTypeIdType': 'ExtDxProcessResourceType',
'extDxProductAreaIdType': 'ExtDxProductArea', 'extDxProductAreaIdType': 'ExtDxProductArea',
'extDxSipplierIdType': 'ExtDxSipplier', 'extDxSipplierIdType': 'ExtDxSipplier',
'subTypeName': 'InStoragePurchase', 'subTypeName': 'InStoragePurchase',
'reqStatus': 'Apply', 'reqStatus': 'Apply',
'extDxProductAreaId': this.form.extDxProductAreaId,
'extDxSipplierId': this.form.extDxSipplierId,
'materialTypeId': this.form.materialTypeId,
'inStorageRequestItems': tableData 'inStorageRequestItems': tableData
} }
if (this.operator === 'MODIFY') {
// const paramTableData = [] param.id = this.form.id
// this.tableData.map(item => { }
// for (const key in item) {
// if (typeof item[key] !== 'object' && item[key] !== null) {
// item[key]
// }
// }
// })
post('/InventoryRequest/batch/recursionAdd', param).then(res => { post('/InventoryRequest/batch/recursionAdd', param).then(res => {
this.$utils.showMessageSuccess('保存成功') this.$utils.showMessageSuccess('保存成功')
this.back() this.back()
......
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