Commit 34a24f53 authored by xioln's avatar xioln

采购入库新增子产品

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