Commit 2b729934 authored by jingnan's avatar jingnan 👀

采购入库问题修改

parent 5ec31432
...@@ -67,6 +67,7 @@ export default { ...@@ -67,6 +67,7 @@ export default {
], ],
material: [], material: [],
suppliers: [], suppliers: [],
isChild: false,
// 表单校验 // 表单校验
rules: { rules: {
resCode: [ resCode: [
...@@ -252,8 +253,43 @@ export default { ...@@ -252,8 +253,43 @@ export default {
// deep: true // deep: true
// }, // },
'form.airModel': { 'form.airModel': {
handler: function(v) { handler: function(val) {
this.changeSorties() val && this.changeSorties()
}
},
// 1.父级明细不是虚拟件时,含税单价及税率必填,子明细非必填,如果添加子明细时,子明细税率及单价禁用,取值取父级上的
// 2.父级明细是虚拟件时,含税单价及税率为0且禁用,子明细必填,子明细上的税率及单价也必填
// 3.子明细添加时查询物料不作限制
'form.isVirtual': {
immediate: true,
handler: function(val) {
if (this.isChild) return
let isVirtualFlag = false
if (val) { // 父级明细是虚拟件时,含税单价及税率为0且禁用
isVirtualFlag = true
this.$set(this.form, 'taxRate', 0)
this.$set(this.form, 'taxUnitPrice', 0)
} else {
isVirtualFlag = false
}
const targetArr = this.formFileds[0].data.filter(item => item.title === '税率' || item.title === '含税单价')
targetArr.forEach(item => (item.component.disabled = isVirtualFlag))
}
},
isChild: {
immediate: true,
handler(val) {
if (val) return
let isVirtualFlag = false
if (this.form.isVirtual) { // 父级明细是虚拟件时,含税单价及税率为0且禁用
isVirtualFlag = true
this.$set(this.form, 'taxRate', 0)
this.$set(this.form, 'taxUnitPrice', 0)
} else {
isVirtualFlag = false
}
const targetArr = this.formFileds[0].data.filter(item => item.title === '税率' || item.title === '含税单价')
targetArr.forEach(item => (item.component.disabled = isVirtualFlag))
} }
} }
}, },
...@@ -273,11 +309,11 @@ export default { ...@@ -273,11 +309,11 @@ 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.id ? row.id : '' this.parentId = row.id || null
this.parentRowId = row.rowId ? row.rowId : row.id this.parentRowId = row.rowId ? row.rowId : row.id
this.$set(this.form, 'operator', 'ADD') this.$set(this.form, 'operator', 'ADD')
delete row.id delete row.id
this.form = row this.form = JSON.parse(JSON.stringify(row))
this.$set(this.form, 'supplier', row.extDxSipplierId) this.$set(this.form, 'supplier', row.extDxSipplierId)
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 ? row.extMaterial.resCode : '') this.resetMaterial(row.extMaterial ? row.extMaterial.resCode : '')
...@@ -290,25 +326,25 @@ export default { ...@@ -290,25 +326,25 @@ export default {
this.dispalyData(row) this.dispalyData(row)
} }
this.resetForm() this.resetForm()
console.log('this.o', this.form)
}, },
// 回显数据 // 回显数据
dispalyData(row) { dispalyData(row) {
this.form = row this.form = JSON.parse(JSON.stringify(row))
this.$set(this.form, 'operator', row.id && this.basicData.operator !== 'ADD' ? 'MODIFY' : 'ADD') this.$set(this.form, 'operator', row.id && this.basicData.operator !== 'ADD' ? 'MODIFY' : 'ADD')
row.billType === 'AirEquipment' && this.$set(this.form, 'reqAmount', 1) row.billType === 'AirEquipment' && this.$set(this.form, 'reqAmount', 1)
this.$set(this.form, 'resCode', row.extMaterial.resCode || '') this.$set(this.form, 'resCode', row.extMaterial && row.extMaterial.resCode || row.resCode || '')
this.$set(this.form, 'resName', row.extMaterial.resName || '') this.$set(this.form, 'resName', row.extMaterial && row.extMaterial.resName || row.resName || '')
this.$set(this.form, 'reqUnit', row.extMaterial.extUnit.unitName || '') this.$set(this.form, 'reqUnit', row.extMaterial && row.extMaterial.extUnit.unitName || row.reqUnit || '')
this.$set(this.form, 'modelNo', row.extMaterial.modelNo || '') this.$set(this.form, 'modelNo', row.extMaterial && row.extMaterial.modelNo || row.modelNo || '')
this.$set(this.form, 'extMaterialId', row.extMaterialId || '') this.$set(this.form, 'extMaterialId', row.extMaterialId || '')
this.$set(this.form, 'supplier', row.extDxSipplier.supplierFullName || '') this.$set(this.form, 'supplier', row.extDxSipplier && row.extDxSipplier.supplierFullName || row.supplier || '')
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 ? row.extMaterial.resCode : row.resCode || '')
this.changeMaterial(row.extMaterial.resCode) this.changeMaterial(row.extMaterial ? row.extMaterial.resCode : row.resCode || '')
}, },
handleClose() { handleClose() {
this.dialogVisibleDetails = false this.dialogVisibleDetails = false
this.form = {}
}, },
getBasicData() { getBasicData() {
const v = this.basicData const v = this.basicData
...@@ -342,6 +378,7 @@ export default { ...@@ -342,6 +378,7 @@ export default {
this.$set(this.form, 'supplier', this.header.supplierFullName.label || '') this.$set(this.form, 'supplier', this.header.supplierFullName.label || '')
this.$set(this.form, 'arrivalDate', this.header.arrivalDate) this.$set(this.form, 'arrivalDate', this.header.arrivalDate)
const childrenAddOrEdit = this.header.materialTypeName.label === '外购成品' && (this.operateType === 'ADD' || (this.operateType === 'MODIFY' && !this.form.isRoot)) const childrenAddOrEdit = this.header.materialTypeName.label === '外购成品' && (this.operateType === 'ADD' || (this.operateType === 'MODIFY' && !this.form.isRoot))
const parentIsVirtual = this.form.isVirtual
switch (this.header.billType) { switch (this.header.billType) {
case '器材': case '器材':
case 'Material': case 'Material':
...@@ -455,8 +492,7 @@ export default { ...@@ -455,8 +492,7 @@ export default {
options: [] options: []
}, },
change: (v) => { change: (v) => {
console.log('v', v) v && this.changeSorties()
this.changeSorties()
} }
}, },
{ {
...@@ -774,8 +810,7 @@ export default { ...@@ -774,8 +810,7 @@ export default {
options: [] options: []
}, },
change: (v) => { change: (v) => {
console.log('v', v) v && this.changeSorties()
this.changeSorties()
} }
}, },
{ {
...@@ -982,7 +1017,7 @@ export default { ...@@ -982,7 +1017,7 @@ export default {
key: 'taxRate', key: 'taxRate',
component: { component: {
clearable: true, clearable: true,
disabled: childrenAddOrEdit, disabled: childrenAddOrEdit && !parentIsVirtual,
name: 'el-input-number', name: 'el-input-number',
min: 0, min: 0,
placeholder: '请输入税率' placeholder: '请输入税率'
...@@ -1006,7 +1041,7 @@ export default { ...@@ -1006,7 +1041,7 @@ export default {
key: 'taxUnitPrice', key: 'taxUnitPrice',
component: { component: {
clearable: true, clearable: true,
disabled: childrenAddOrEdit, disabled: childrenAddOrEdit && !parentIsVirtual,
name: 'el-input-number', name: 'el-input-number',
placeholder: '请输入含税单价' placeholder: '请输入含税单价'
}, },
...@@ -1155,8 +1190,7 @@ export default { ...@@ -1155,8 +1190,7 @@ export default {
}, },
handler: { handler: {
change: (v) => { change: (v) => {
console.log('v', v) v && this.changeSorties()
this.changeSorties()
} }
} }
}, },
...@@ -1322,7 +1356,7 @@ export default { ...@@ -1322,7 +1356,7 @@ export default {
key: 'taxRate', key: 'taxRate',
component: { component: {
clearable: true, clearable: true,
disabled: childrenAddOrEdit, disabled: childrenAddOrEdit && !parentIsVirtual,
name: 'el-input-number', name: 'el-input-number',
min: 0, min: 0,
placeholder: '请输入税率' placeholder: '请输入税率'
...@@ -1346,7 +1380,7 @@ export default { ...@@ -1346,7 +1380,7 @@ export default {
key: 'taxUnitPrice', key: 'taxUnitPrice',
component: { component: {
clearable: true, clearable: true,
disabled: childrenAddOrEdit, disabled: childrenAddOrEdit && !parentIsVirtual,
name: 'el-input-number', name: 'el-input-number',
placeholder: '请输入含税单价' placeholder: '请输入含税单价'
}, },
...@@ -1413,7 +1447,8 @@ export default { ...@@ -1413,7 +1447,8 @@ export default {
} }
// 外购成品添加明细时 // 外购成品添加明细时
if (this.header.materialTypeName.label === '外购成品' && !childrenAddOrEdit) { if (this.header.materialTypeName.label === '外购成品' && !childrenAddOrEdit) {
this.formFileds[0].data.push( this.isChild = false
this.formFileds[0].data.unshift(
{ {
title: '是否虚拟件', title: '是否虚拟件',
key: 'isVirtual', key: 'isVirtual',
...@@ -1431,6 +1466,7 @@ export default { ...@@ -1431,6 +1466,7 @@ export default {
} }
// 添加子明细时 // 添加子明细时
if (childrenAddOrEdit) { if (childrenAddOrEdit) {
this.isChild = true
this.formFileds[0].data.push( this.formFileds[0].data.push(
{ {
title: '批次号', title: '批次号',
...@@ -1476,7 +1512,7 @@ export default { ...@@ -1476,7 +1512,7 @@ export default {
`/ExtDxProcessResourceType/search`, `/ExtDxProcessResourceType/search`,
{ {
'pageFrom': 1, 'pageFrom': 1,
'pageSize': 100, 'pageSize': 20,
'searchItems': { 'searchItems': {
'children': [ 'children': [
{ {
...@@ -1511,21 +1547,27 @@ export default { ...@@ -1511,21 +1547,27 @@ export default {
.catch((err) => { .catch((err) => {
console.log(err) console.log(err)
}) })
let parentIdItems = []
if (!this.isChild) {
parentIdItems = [
{
'fieldName': 'resType2.id',
'operator': 'IN',
'value': paramsArr
}
]
} else {
parentIdItems = []
}
await post( await post(
`/ExtDxProcessMaterial/search`, `/ExtDxProcessMaterial/search`,
{ {
'pageFrom': 1, 'pageFrom': 1,
'pageSize': 9999, 'pageSize': 20,
'searchItems': { 'searchItems': {
'children': [ 'children': [
{ {
'items': [ 'items': parentIdItems,
{
'fieldName': 'resType2.id',
'operator': 'IN',
'value': paramsArr
}
],
'operator': 'AND' 'operator': 'AND'
}, },
{ {
...@@ -1660,7 +1702,6 @@ export default { ...@@ -1660,7 +1702,6 @@ export default {
}, },
// 根据机型带出架次 // 根据机型带出架次
changeSorties() { changeSorties() {
console.log('13123123',)
const params = { const params = {
searchItems: { searchItems: {
'operator': 'AND', 'operator': 'AND',
...@@ -1902,13 +1943,12 @@ export default { ...@@ -1902,13 +1943,12 @@ export default {
this.$set(this.formButtons[0].component, 'loading', true) this.$set(this.formButtons[0].component, 'loading', true)
this.$refs.form.validate((isok) => { this.$refs.form.validate((isok) => {
if (isok) { if (isok) {
this.handleClose()
// 校验通过 // 校验通过
const newTableData = { const newTableData = {
...this.form, ...this.form,
'operator': this.form.operator, 'operator': this.form.operator,
'subTypeName': 'InStoragePurchaseItem', 'subTypeName': 'InStoragePurchaseItem',
'rowId': this.operateType !== 'MODIFY' ? this.generateUUID() : this.form.id, 'rowId': this.form.id || this.generateUUID(),
'parentId': this.form.parentId ? this.form.parentId : this.parentId, 'parentId': this.form.parentId ? this.form.parentId : this.parentId,
'parentRowId': this.parentRowId, 'parentRowId': this.parentRowId,
'extMaterialId': this.extMaterialId ? this.extMaterialId : this.form.extMaterialId, 'extMaterialId': this.extMaterialId ? this.extMaterialId : this.form.extMaterialId,
...@@ -1941,7 +1981,7 @@ export default { ...@@ -1941,7 +1981,7 @@ export default {
'inventoryReqId': this.basicData.id, 'inventoryReqId': this.basicData.id,
'inventoryReqIdType': 'InventoryRequest', 'inventoryReqIdType': 'InventoryRequest',
'contractNo': this.form.contractNo, 'contractNo': this.form.contractNo,
'isRoot': this.operateType !== 'ADD' || (this.operateType === 'MODIFY' && !this.form.isRoot), 'isRoot': !this.isChild,
'subEquipment': this.form.subEquipment, 'subEquipment': this.form.subEquipment,
'productDwawVer': this.form.productDwawVer, 'productDwawVer': this.form.productDwawVer,
'atpName': this.form.atpName, 'atpName': this.form.atpName,
...@@ -1956,6 +1996,7 @@ export default { ...@@ -1956,6 +1996,7 @@ export default {
'MaterialResCode': this.form.resCode 'MaterialResCode': this.form.resCode
} }
this.$emit('addTableData', newTableData) this.$emit('addTableData', newTableData)
this.handleClose()
} }
this.$set(this.formButtons[0].component, 'loading', false) this.$set(this.formButtons[0].component, 'loading', false)
}) })
......
...@@ -289,7 +289,7 @@ export default { ...@@ -289,7 +289,7 @@ export default {
num: 1, num: 1,
childNum: 1, childNum: 1,
columns: [ columns: [
{ title: '序号', key: 'parentIndex', align: 'center', headerAlign: 'center' }, { title: '序号', minWidth: 90, key: 'parentIndex', align: 'center', headerAlign: 'center' },
{ {
title: '操作', minWidth: 120, align: 'center', component: { title: '操作', minWidth: 120, align: 'center', component: {
name: 'EditTableRow', name: 'EditTableRow',
...@@ -349,6 +349,7 @@ export default { ...@@ -349,6 +349,7 @@ export default {
type: 'success', type: 'success',
message: '删除成功!' message: '删除成功!'
}) })
this.treeTableNoArrange(this.tableData)
}).catch((err) => { }).catch((err) => {
console.log(err) console.log(err)
}) })
...@@ -743,7 +744,7 @@ export default { ...@@ -743,7 +744,7 @@ export default {
this.addData = formData this.addData = formData
const tableDataItem = { const tableDataItem = {
...formData, ...formData,
children: [] children: formData.isRoot && formData.children || []
} }
// 根据父子关系添加数据 // 根据父子关系添加数据
if (tableDataItem.operateType === 'ADD') { if (tableDataItem.operateType === 'ADD') {
...@@ -795,6 +796,8 @@ export default { ...@@ -795,6 +796,8 @@ export default {
}) })
} }
}) })
const isVirtualHasChild = tableData.find(item => item.isVirtual && (!item.children || !item.children.length))
if (isVirtualHasChild) return this.$utils.showMessageWarning('父件为虚拟件时,必须添加子件!')
const param = { const param = {
'operator': this.operator, 'operator': this.operator,
'billType': this.form.billType, 'billType': this.form.billType,
......
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