Commit 34a24f53 authored by xioln's avatar xioln

采购入库新增子产品

parent bf7a7a26
......@@ -212,7 +212,8 @@ export default {
operateType: null
}
},
computed: {},
computed: {
},
watch: {
// 'form.resCode': {
// handler: function(v) {
......@@ -241,35 +242,26 @@ export default {
this.dialogVisible = true
this.operateType = type
this.getBasicData()
this.resetForm()
if (type === 'NEW') {
this.$set(this.form, 'operator', 'ADD')
} else if (type === 'ADD') {
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)
this.$set(this.form, 'resCode', '')
this.$set(this.form, 'resName', '')
this.$set(this.form, 'reqUnit', '')
this.$set(this.form, 'modelNo', '')
} else if (type === 'MODIFY') {
this.dispalyData(row)
}
this.resetForm()
console.log('this.o', this.form)
},
// 回显数据
......@@ -319,6 +311,7 @@ export default {
if (!this.header) return
this.$set(this.form, 'supplier', this.header.supplierFullName.label || '')
this.$set(this.form, 'arrivalDate', this.header.arrivalDate)
const childrenAddOrEdit = this.operateType === 'ADD' || (this.operateType === 'MODIFY' && !this.form.isRoot)
switch (this.header.billType) {
case '器材':
case 'Material':
......@@ -735,7 +728,7 @@ export default {
component: {
clearable: true,
name: 'el-input',
disabled: this.operateType !== 'NEW',
disabled: childrenAddOrEdit,
placeholder: '请输入系列号'
}
},
......@@ -744,7 +737,7 @@ export default {
key: 'airModel',
component: {
clearable: true,
disabled: this.operateType !== 'NEW',
disabled: childrenAddOrEdit,
name: 'el-select',
placeholder: '请输入机型',
options: []
......@@ -758,7 +751,7 @@ export default {
key: 'sorties',
component: {
clearable: true,
disabled: this.operateType !== 'NEW',
disabled: childrenAddOrEdit,
name: 'el-select',
placeholder: '请输入架次',
options: []
......@@ -811,7 +804,7 @@ export default {
key: 'manufacturer',
component: {
clearable: true,
disabled: this.operateType !== 'NEW',
disabled: childrenAddOrEdit,
name: 'el-input',
placeholder: '请输入制造商'
}
......@@ -833,7 +826,7 @@ export default {
key: 'producedTime',
component: {
clearable: true,
disabled: this.operateType !== 'NEW',
disabled: childrenAddOrEdit,
name: 'el-date-picker',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd hh:mm:ss',
......@@ -845,7 +838,7 @@ export default {
key: 'productDwawVer',
component: {
clearable: true,
disabled: this.operateType !== 'NEW',
disabled: childrenAddOrEdit,
name: 'el-input',
placeholder: '请输入产品图号/版本'
}
......@@ -855,7 +848,7 @@ export default {
key: 'atpName',
component: {
clearable: true,
disabled: this.operateType !== 'NEW',
disabled: childrenAddOrEdit,
name: 'el-input',
placeholder: '请输入ATP名称'
}
......@@ -865,7 +858,7 @@ export default {
key: 'atpNo',
component: {
clearable: true,
disabled: this.operateType !== 'NEW',
disabled: childrenAddOrEdit,
name: 'el-input',
placeholder: '请输入ATP编号及版次'
}
......@@ -875,7 +868,7 @@ export default {
key: 'softConfPieceNo',
component: {
clearable: true,
disabled: this.operateType !== 'NEW',
disabled: childrenAddOrEdit,
name: 'el-input',
placeholder: '请输入软件构型件号/版次',
type: 'textarea',
......@@ -887,7 +880,7 @@ export default {
key: 'elecHardwareConfPieceNo',
component: {
clearable: true,
disabled: this.operateType !== 'NEW',
disabled: childrenAddOrEdit,
name: 'el-input',
placeholder: '请输入电子硬件构型件号/版本',
type: 'textarea',
......@@ -899,7 +892,7 @@ export default {
key: 'approvalCert',
component: {
clearable: true,
disabled: this.operateType !== 'NEW',
disabled: childrenAddOrEdit,
name: 'el-input',
placeholder: '请输入适航批准标签/批准放行证书'
}
......@@ -909,7 +902,7 @@ export default {
key: 'withProductMaterial',
component: {
clearable: true,
disabled: this.operateType !== 'NEW',
disabled: childrenAddOrEdit,
name: 'el-select',
multiple: true,
placeholder: '请选择随产品资料',
......@@ -921,7 +914,7 @@ export default {
key: 'urgency',
component: {
clearable: true,
disabled: this.operateType !== 'NEW',
disabled: childrenAddOrEdit,
name: 'el-select',
placeholder: '请选择紧急程度',
options: [
......@@ -935,7 +928,7 @@ export default {
key: 'isNewlyProduct',
component: {
clearable: true,
disabled: this.operateType !== 'NEW',
disabled: childrenAddOrEdit,
name: 'el-select',
placeholder: '请选择是否新研产品',
options: [
......@@ -959,7 +952,7 @@ export default {
key: 'taxRate',
component: {
clearable: true,
disabled: this.operateType !== 'NEW',
disabled: childrenAddOrEdit,
name: 'el-input-number',
min: 0,
placeholder: '请输入税率'
......@@ -983,7 +976,7 @@ export default {
key: 'taxUnitPrice',
component: {
clearable: true,
disabled: this.operateType !== 'NEW',
disabled: childrenAddOrEdit,
name: 'el-input-number',
placeholder: '请输入含税单价'
},
......@@ -1007,7 +1000,7 @@ export default {
key: 'storageZone',
component: {
clearable: true,
disabled: this.operateType !== 'NEW',
disabled: childrenAddOrEdit,
name: 'el-select',
placeholder: '请输入接收仓库',
options: []
......@@ -1027,7 +1020,7 @@ export default {
key: 'contractNo',
component: {
clearable: true,
disabled: this.operateType !== 'NEW',
disabled: childrenAddOrEdit,
name: 'el-input',
placeholder: '请输入合同号/框架协议号'
}
......@@ -1038,7 +1031,7 @@ export default {
key: 'remark',
component: {
clearable: true,
disabled: this.operateType !== 'NEW',
disabled: childrenAddOrEdit,
name: 'el-input',
placeholder: '请输入备注'
}
......@@ -1115,7 +1108,7 @@ export default {
key: 'serialNo',
component: {
clearable: true,
disabled: this.operateType !== 'NEW',
disabled: childrenAddOrEdit,
name: 'el-input',
placeholder: '请输入生产序列号'
}
......@@ -1125,7 +1118,7 @@ export default {
key: 'airModel',
component: {
clearable: true,
disabled: this.operateType !== 'NEW',
disabled: childrenAddOrEdit,
name: 'el-select',
placeholder: '请输入机型',
options: []
......@@ -1139,7 +1132,7 @@ export default {
key: 'sorties',
component: {
clearable: true,
disabled: this.operateType !== 'NEW',
disabled: childrenAddOrEdit,
name: 'el-select',
placeholder: '请输入架次',
options: []
......@@ -1150,7 +1143,7 @@ export default {
key: 'reqAmount',
component: {
name: 'el-input-number',
disabled: this.operateType !== 'NEW',
disabled: childrenAddOrEdit,
min: 0,
placeholder: '请输入入库数量'
},
......@@ -1188,7 +1181,7 @@ export default {
key: 'manufacturer',
component: {
clearable: true,
disabled: this.operateType !== 'NEW',
disabled: childrenAddOrEdit,
name: 'el-input',
placeholder: '请输入制造商'
}
......@@ -1210,7 +1203,7 @@ export default {
key: 'producedTime',
component: {
clearable: true,
disabled: this.operateType !== 'NEW',
disabled: childrenAddOrEdit,
name: 'el-date-picker',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd hh:mm:ss',
......@@ -1222,7 +1215,7 @@ export default {
key: 'arrivedDrawNo',
component: {
clearable: true,
disabled: this.operateType !== 'NEW',
disabled: childrenAddOrEdit,
name: 'el-input',
placeholder: '请输入到货图号'
}
......@@ -1232,7 +1225,7 @@ export default {
key: 'arrivalVer',
component: {
clearable: true,
disabled: this.operateType !== 'NEW',
disabled: childrenAddOrEdit,
name: 'el-input',
placeholder: '请输入到货版次'
}
......@@ -1242,7 +1235,7 @@ export default {
key: 'deliverySpec',
component: {
clearable: true,
disabled: this.operateType !== 'NEW',
disabled: childrenAddOrEdit,
name: 'el-input',
placeholder: '请输入交付规范及版次'
}
......@@ -1252,7 +1245,7 @@ export default {
key: 'approvalCert',
component: {
name: 'el-input',
disabled: this.operateType !== 'NEW',
disabled: childrenAddOrEdit,
placeholder: '请输入适航批准标签/批准放行证书'
}
},
......@@ -1261,7 +1254,7 @@ export default {
key: 'withProductMaterial',
component: {
clearable: true,
disabled: this.operateType !== 'NEW',
disabled: childrenAddOrEdit,
name: 'el-select',
multiple: true,
placeholder: '请选择随产品资料',
......@@ -1273,7 +1266,7 @@ export default {
key: 'urgency',
component: {
clearable: true,
disabled: this.operateType !== 'NEW',
disabled: childrenAddOrEdit,
name: 'el-select',
placeholder: '请选择紧急程度',
options: [
......@@ -1297,7 +1290,7 @@ export default {
key: 'taxRate',
component: {
clearable: true,
disabled: this.operateType !== 'NEW',
disabled: childrenAddOrEdit,
name: 'el-input-number',
min: 0,
placeholder: '请输入税率'
......@@ -1321,7 +1314,7 @@ export default {
key: 'taxUnitPrice',
component: {
clearable: true,
disabled: this.operateType !== 'NEW',
disabled: childrenAddOrEdit,
name: 'el-input-number',
placeholder: '请输入含税单价'
},
......@@ -1345,7 +1338,7 @@ export default {
key: 'storageZone',
component: {
clearable: true,
disabled: this.operateType !== 'NEW',
disabled: childrenAddOrEdit,
name: 'el-select',
placeholder: '请输入接收仓库',
options: []
......@@ -1365,7 +1358,7 @@ export default {
key: 'contractNo',
component: {
clearable: true,
disabled: this.operateType !== 'NEW',
disabled: childrenAddOrEdit,
name: 'el-input',
placeholder: '请输入合同号'
}
......@@ -1376,7 +1369,7 @@ export default {
key: 'remark',
component: {
clearable: true,
disabled: this.operateType !== 'NEW',
disabled: childrenAddOrEdit,
name: 'el-input',
placeholder: '请输入备注'
}
......@@ -1386,7 +1379,19 @@ export default {
default:
break
}
console.log('this.form', this.form)
if (childrenAddOrEdit) {
this.formFileds[0].data.push(
{
title: '批次号',
key: 'lotNo',
component: {
clearable: true,
name: 'el-input',
placeholder: '请输入批次号'
}
},
)
}
// 设置物料类型下拉
this.resetMaterial()
// 设置带出接收仓库
......@@ -1507,13 +1512,14 @@ export default {
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) {
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 + '/' : ''
}${item.supplyStatus ? item.supplyStatus + '/' : ''}${item.supplierName ? item.supplierName + '/' : ''
}`,
value: item.resCode
value: item.resCode,
disabled: true
}
} else {
return {
......@@ -1521,8 +1527,7 @@ export default {
}${item.techSpec ? item.techSpec + '/' : ''}${item.spec ? item.spec + '/' : ''
}${item.supplyStatus ? item.supplyStatus + '/' : ''}${item.supplierName ? item.supplierName + '/' : ''
}`,
value: item.resCode,
disabled: false
value: item.resCode
}
}
}
......@@ -1789,6 +1794,7 @@ export default {
},
save() {
this.$refs.form.validate((isok) => {
console.log('validate', this.form)
if (isok) {
// 校验通过
const newTableData = {
......
......@@ -17,7 +17,14 @@
@on-cancel="cancel"
/>
<div class="sub-title"> 采购入库申请明细 </div>
<dee-table :data="tableData" :columns="columns" :options="optionsTree" :index-row="{ title: '序号', width: '70' }">
<dee-table
ref="treeTable"
:key="symbolKey"
:data="tableData"
:columns="columns"
:options="optionsTree"
:index-row="{ title: '序号', width: '70' , align: 'center'}"
>
<div slot="header" class="table-title-wrap">
<dee-tools :tools="tools" mode="normal" />
</div>
......@@ -235,9 +242,8 @@ export default {
}
],
optionsTree: {
'row-key': 'rowId', // value值需为可以标识该对象唯一的值
'lazy': false,
'tree-props': { children: 'children', hasChildren: 'hasChildren' }
rowKey: 'rowId',
'tree-props': { children: 'children' }
},
columns: [
{
......@@ -253,7 +259,6 @@ 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 || value !== '外购成品') {
return false
......@@ -326,7 +331,7 @@ export default {
},
{
title: '编码', key: 'typeCode', headerAlign: 'center', formatter: (row, column, cellValue, index) => {
const value = row.extMaterial ? row.extMaterial.resCode : row.resCode
const value = row.resCode ? row.resCode : row.extMaterial ? row.extMaterial.resCode : ''
return value
}
},
......@@ -334,7 +339,7 @@ export default {
{ title: '架次', key: 'sorties', headerAlign: 'center' },
{
title: '计量单位', key: 'unitName', headerAlign: 'center', formatter: (row, column, cellValue, index) => {
const value = row.extMaterial ? row.extMaterial.extUnit.unitName : row.reqUnit
const value = row.reqUnit ? row.reqUnit : row.extMaterial ? row.extMaterial.extUnit.unitName : ''
return value
}
},
......@@ -374,7 +379,9 @@ export default {
],
tableData: [],
tableParam: [],
operator: null
operator: null,
addData: {},
symbolKey: ''
}
},
computed: {
......@@ -597,18 +604,17 @@ export default {
...item,
operator: 'NO_CHANGE',
rowId: item.id,
hasChildren: item.children.length > 0,
// hasChildren: item.children.length > 0,
children: item.children && item.children.map(child => {
return {
...child,
operator: 'NO_CHANGE',
hasChildren: false
operator: 'NO_CHANGE'
// hasChildren: false
}
})
}
})
console.log('res.items', data)
console.log('res.items', { ...data[0] })
if (data.length > 0) {
this.formData[0].data.forEach(item => {
item.component.disabled = true
......@@ -621,65 +627,52 @@ export default {
},
// 组装表格数据
addTableData(formData) {
const tableData = Array.from(this.tableData)
this.tableData = []
console.log('ffff', { ...formData })
this.addData = formData
console.log('formData', formData)
const tableDataItem = {
...formData,
// subEquipment: formData.materialTypeName,
// extMaterial: {
// resType2: {
// typeCode: formData.materialTypeName,
// typeName: formData.materialTypeName
// }
// },
// purchaseUnit: { unitName: formData.reqUnit },
// extDxSipplier: {
// supplierFullName: formData.supplier
// },
// inventory: {
// applyUserName: formData.supplier
// },
// storageZone: {
// extname: formData.storageZone
// },
children: []
}
// 根据父子关系添加数据
if (tableDataItem.operateType === 'ADD') {
for (let i = 0; i < this.tableData.length; i++) {
const item = this.tableData[i]
for (let i = 0; i < tableData.length; i++) {
const item = tableData[i]
if (item.rowId === tableDataItem.parentRowId) {
if (!item.hasChildren) {
item.children = []
}
tableDataItem.hasChildren = false
// item.hasChildren = true
item.children.push(tableDataItem)
item.hasChildren = true
break
}
}
}
if (tableDataItem.operateType === 'MODIFY') {
for (const item of this.tableData) {
for (const item of tableData) {
// 父类修改
if (item.id === tableDataItem.id) {
// console.log('item', tableDataItem)
this.tableData.splice(this.tableData.indexOf(item), 1, tableDataItem)
tableData.splice(tableData.indexOf(item), 1, tableDataItem)
break
}
// 子类修改
for (const child of item.children) {
if (child.id === tableDataItem.id) {
this.tableData[this.tableData.indexOf(item)].children.splice(item.children.indexOf(child), 1, tableDataItem)
tableData[tableData.indexOf(item)].children.splice(item.children.indexOf(child), 1, tableDataItem)
break
}
}
}
}
if (tableDataItem.operateType === 'NEW') {
this.tableData.push(tableDataItem)
tableData.push(tableDataItem)
}
console.log('this.tableData', this.tableData)
console.log('tableData', tableData)
tableData.forEach(item => {
this.tableData.push(item)
})
this.symbolKey = Symbol(new Date().toString())
console.log('this.symbolKey', this.symbolKey)
},
submit() {
const tableData = this.tableData.slice()
......@@ -689,7 +682,7 @@ export default {
delete tableData[i][key]
}
}
if (obj.hasChildren) {
if (obj.children.length > 0) {
obj.children.forEach((child, j) => {
for (const ckey in child) {
if (ckey === 'storageZone') {
......
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