Commit 2b729934 authored by jingnan's avatar jingnan 👀

采购入库问题修改

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