Commit 355b5860 authored by wangdanlei's avatar wangdanlei

Merge branch 'dev' of http://94.191.100.41/tfmom/tf-mom-web into dev

parents 6d513986 34a24f53
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
*/ */
<template> <template>
<div class="className"> <div class="className">
<dee-tools :tools="topTools" mode="normal" style="justify-content: end;" /> <!-- <dee-tools :tools="topTools" mode="normal" style="justify-content: end;" /> -->
<dee-form <dee-form
ref="form" ref="form"
label-width="120" label-width="120"
...@@ -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: 'hasParent' }
}, },
columns: [ columns: [
{ {
...@@ -254,7 +260,7 @@ export default { ...@@ -254,7 +260,7 @@ export default {
icon: '/icons/components/new/add.png', icon: '/icons/components/new/add.png',
showFun: (row) => { showFun: (row) => {
const value = row.extMaterial ? row.extMaterial.resType2.typeName : '' const value = row.extMaterial ? row.extMaterial.resType2.typeName : ''
if (!row.isRoot || row.parentId || value !== '外购成品') { if (!row.isRoot || value !== '外购成品') {
return false return false
} }
return true return true
...@@ -325,7 +331,7 @@ export default { ...@@ -325,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
} }
}, },
...@@ -333,8 +339,7 @@ export default { ...@@ -333,8 +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) => {
console.log('2123123123', { ...row }) const value = row.reqUnit ? row.reqUnit : row.extMaterial ? row.extMaterial.extUnit.unitName : ''
const value = row.extMaterial ? row.extMaterial.extUnit.unitName : row.reqUnit
return value return value
} }
}, },
...@@ -373,7 +378,10 @@ export default { ...@@ -373,7 +378,10 @@ export default {
{ title: '创建时间', key: 'createTime', headerAlign: 'center' } { title: '创建时间', key: 'createTime', headerAlign: 'center' }
], ],
tableData: [], tableData: [],
operator: null tableParam: [],
operator: null,
addData: {},
symbolKey: ''
} }
}, },
computed: { computed: {
...@@ -414,7 +422,8 @@ export default { ...@@ -414,7 +422,8 @@ export default {
}, },
methods: { methods: {
back() { back() {
this.$router.push({ this.$store.dispatch('tagsView/delView', this.$route)
this.$router.replace({
path: '/page/86a5fa19-e245-4732-aff6-c48b18e2b5c7', path: '/page/86a5fa19-e245-4732-aff6-c48b18e2b5c7',
query: { title: '采购入库', menuRootAppId: '1626781924331' } query: { title: '采购入库', menuRootAppId: '1626781924331' }
}) })
...@@ -545,6 +554,7 @@ export default { ...@@ -545,6 +554,7 @@ export default {
// 编辑采购入库明细查询InStorageRequestItem/search // 编辑采购入库明细查询InStorageRequestItem/search
searchInStorageRequestItem() { searchInStorageRequestItem() {
const param = { const param = {
'rootCondition': {
'pageFrom': 1, 'pageFrom': 1,
'pageSize': 10, 'pageSize': 10,
'searchItems': { 'searchItems': {
...@@ -560,12 +570,23 @@ export default { ...@@ -560,12 +570,23 @@ export default {
'fieldName': 'isRoot', 'fieldName': 'isRoot',
'operator': 'EQ', 'operator': 'EQ',
'value': 'true' 'value': 'true'
},
{
'fieldName': 'parentId',
'operator': 'ISNULL'
},
{
'fieldName': 'state',
'operator': 'EQ',
'value': 'Apply'
} }
], ],
'operator': 'AND' 'operator': 'AND'
} }
], ],
'items': [] 'items': [
]
}, },
'openProps': [{ 'name': 'extMaterial', 'openProps': [{ 'name': 'resType2' }, { 'name': 'extUnit' }] }, { 'name': 'extDxSipplier' }, { 'name': 'storageZone' }], 'openProps': [{ 'name': 'extMaterial', 'openProps': [{ 'name': 'resType2' }, { 'name': 'extUnit' }] }, { 'name': 'extDxSipplier' }, { 'name': 'storageZone' }],
'sortItem': [ 'sortItem': [
...@@ -575,15 +596,25 @@ export default { ...@@ -575,15 +596,25 @@ export default {
} }
] ]
} }
}
post('InStorageRequestItem/search', param).then(res => { post('InStorageRequestItem/treeSearch', param).then(res => {
console.log('res.items.content', res.items.content) const data = res.items.map(item => {
const data = res.items.content.map(item => {
return { return {
...item, ...item,
operator: 'NO_CHANGE',
rowId: item.id,
// hasChildren: item.children.length > 0,
children: item.children && item.children.map(child => {
return {
...child,
operator: 'NO_CHANGE' operator: 'NO_CHANGE'
// hasChildren: false
}
})
} }
}) })
console.log('res.items', { ...data[0] })
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
...@@ -596,64 +627,52 @@ export default { ...@@ -596,64 +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 (tableDataItem.hasParent && !item.children) { if (item.rowId === tableDataItem.parentRowId) {
item.children = [] // item.hasChildren = true
}
if (item.rowId === tableDataItem.parentId) {
item.children.push(tableDataItem) item.children.push(tableDataItem)
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()
...@@ -663,29 +682,36 @@ export default { ...@@ -663,29 +682,36 @@ export default {
delete tableData[i][key] delete tableData[i][key]
} }
} }
if (obj.children.length > 0) {
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 = { const param = {
...this.form,
'operator': this.operator, 'operator': this.operator,
'billType': this.form.billType,
'arrivalDate': this.form.arrivalDate,
'materialTypeIdType': 'ExtDxProcessResourceType', 'materialTypeIdType': 'ExtDxProcessResourceType',
'extDxProductAreaIdType': 'ExtDxProductArea', 'extDxProductAreaIdType': 'ExtDxProductArea',
'extDxSipplierIdType': 'ExtDxSipplier', 'extDxSipplierIdType': 'ExtDxSipplier',
'subTypeName': 'InStoragePurchase', 'subTypeName': 'InStoragePurchase',
'reqStatus': 'Apply', 'reqStatus': 'Apply',
'extDxProductAreaId': this.form.extDxProductAreaId,
'extDxSipplierId': this.form.extDxSipplierId,
'materialTypeId': this.form.materialTypeId,
'inStorageRequestItems': tableData 'inStorageRequestItems': tableData
} }
if (this.operator === 'MODIFY') {
// const paramTableData = [] param.id = this.form.id
// this.tableData.map(item => { }
// for (const key in item) {
// if (typeof item[key] !== 'object' && item[key] !== null) {
// item[key]
// }
// }
// })
post('/InventoryRequest/batch/recursionAdd', param).then(res => { post('/InventoryRequest/batch/recursionAdd', param).then(res => {
this.$utils.showMessageSuccess('保存成功') this.$utils.showMessageSuccess('保存成功')
this.back()
}).catch((err) => { }).catch((err) => {
console.log(err) console.log(err)
}) })
......
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