Commit a7c5342f authored by xioln's avatar xioln

采购入库子明细新增编辑

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