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
......@@ -212,19 +212,20 @@ export default {
operateType: null
}
},
computed: {},
computed: {
},
watch: {
// 'form.resCode': {
// handler: function(v) {
// this.resetMaterial(v)
// }
// }
'basicData': {
handler: function(v) {
console.log('vvv', v)
},
deep: true
}
// 'basicData': {
// handler: function(v) {
// console.log('vvv', v)
// },
// deep: true
// },
},
created() {
// 初始化数据
......@@ -235,20 +236,36 @@ export default {
},
methods: {
handleOpen(type, basicData, row) {
console.log('basicData', this.parentId)
this.basicData = basicData
this.form = { 'reqAmount': 1 }
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.rowId
this.parentId = row.id ? row.id : ''
this.parentRowId = row.rowId ? row.rowId : row.id
this.$set(this.form, 'operator', 'ADD')
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') {
console.log('row', row)
console.log('this.basicData', this.basicData.operator)
this.dispalyData(row)
}
this.resetForm()
console.log('this.o', this.form)
},
// 回显数据
dispalyData(row) {
this.form = row
this.$set(this.form, 'operator', row.id && this.basicData.operator !== 'ADD' ? 'MODIFY' : 'ADD')
row.billType === 'AirEquipment' && this.$set(this.form, 'reqAmount', 1)
......@@ -261,7 +278,6 @@ export default {
this.$set(this.form, 'withProductMaterial', Array.isArray(row.withProductMaterial) ? row.withProductMaterial : row.withProductMaterial.split(';'))
this.resetMaterial(row.extMaterial.resCode)
this.changeMaterial(row.extMaterial.resCode)
}
},
handleClose() {
this.dialogVisible = false
......@@ -295,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':
......@@ -711,6 +728,7 @@ export default {
component: {
clearable: true,
name: 'el-input',
disabled: childrenAddOrEdit,
placeholder: '请输入系列号'
}
},
......@@ -719,6 +737,7 @@ export default {
key: 'airModel',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-select',
placeholder: '请输入机型',
options: []
......@@ -732,6 +751,7 @@ export default {
key: 'sorties',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-select',
placeholder: '请输入架次',
options: []
......@@ -744,11 +764,14 @@ export default {
clearable: true,
name: 'el-input-number',
min: 1,
disabled: true,
disabled: false,
placeholder: '请输入入库数量'
},
handler: {
change: () => this.changeComputed()
change: (v) => {
console.log('123', v)
this.changeComputed()
}
}
},
{
......@@ -781,6 +804,7 @@ export default {
key: 'manufacturer',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-input',
placeholder: '请输入制造商'
}
......@@ -802,6 +826,7 @@ export default {
key: 'producedTime',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-date-picker',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd hh:mm:ss',
......@@ -813,6 +838,7 @@ export default {
key: 'productDwawVer',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-input',
placeholder: '请输入产品图号/版本'
}
......@@ -822,6 +848,7 @@ export default {
key: 'atpName',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-input',
placeholder: '请输入ATP名称'
}
......@@ -831,6 +858,7 @@ export default {
key: 'atpNo',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-input',
placeholder: '请输入ATP编号及版次'
}
......@@ -840,6 +868,7 @@ export default {
key: 'softConfPieceNo',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-input',
placeholder: '请输入软件构型件号/版次',
type: 'textarea',
......@@ -851,6 +880,7 @@ export default {
key: 'elecHardwareConfPieceNo',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-input',
placeholder: '请输入电子硬件构型件号/版本',
type: 'textarea',
......@@ -862,6 +892,7 @@ export default {
key: 'approvalCert',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-input',
placeholder: '请输入适航批准标签/批准放行证书'
}
......@@ -871,6 +902,7 @@ export default {
key: 'withProductMaterial',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-select',
multiple: true,
placeholder: '请选择随产品资料',
......@@ -882,6 +914,7 @@ export default {
key: 'urgency',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-select',
placeholder: '请选择紧急程度',
options: [
......@@ -895,6 +928,7 @@ export default {
key: 'isNewlyProduct',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-select',
placeholder: '请选择是否新研产品',
options: [
......@@ -918,6 +952,7 @@ export default {
key: 'taxRate',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-input-number',
min: 0,
placeholder: '请输入税率'
......@@ -941,6 +976,7 @@ export default {
key: 'taxUnitPrice',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-input-number',
placeholder: '请输入含税单价'
},
......@@ -964,6 +1000,7 @@ export default {
key: 'storageZone',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-select',
placeholder: '请输入接收仓库',
options: []
......@@ -983,6 +1020,7 @@ export default {
key: 'contractNo',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-input',
placeholder: '请输入合同号/框架协议号'
}
......@@ -993,6 +1031,7 @@ export default {
key: 'remark',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-input',
placeholder: '请输入备注'
}
......@@ -1069,6 +1108,7 @@ export default {
key: 'serialNo',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-input',
placeholder: '请输入生产序列号'
}
......@@ -1078,6 +1118,7 @@ export default {
key: 'airModel',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-select',
placeholder: '请输入机型',
options: []
......@@ -1091,6 +1132,7 @@ export default {
key: 'sorties',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-select',
placeholder: '请输入架次',
options: []
......@@ -1101,6 +1143,7 @@ export default {
key: 'reqAmount',
component: {
name: 'el-input-number',
disabled: childrenAddOrEdit,
min: 0,
placeholder: '请输入入库数量'
},
......@@ -1138,6 +1181,7 @@ export default {
key: 'manufacturer',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-input',
placeholder: '请输入制造商'
}
......@@ -1159,6 +1203,7 @@ export default {
key: 'producedTime',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-date-picker',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd hh:mm:ss',
......@@ -1170,6 +1215,7 @@ export default {
key: 'arrivedDrawNo',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-input',
placeholder: '请输入到货图号'
}
......@@ -1179,6 +1225,7 @@ export default {
key: 'arrivalVer',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-input',
placeholder: '请输入到货版次'
}
......@@ -1188,6 +1235,7 @@ export default {
key: 'deliverySpec',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-input',
placeholder: '请输入交付规范及版次'
}
......@@ -1197,6 +1245,7 @@ export default {
key: 'approvalCert',
component: {
name: 'el-input',
disabled: childrenAddOrEdit,
placeholder: '请输入适航批准标签/批准放行证书'
}
},
......@@ -1205,6 +1254,7 @@ export default {
key: 'withProductMaterial',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-select',
multiple: true,
placeholder: '请选择随产品资料',
......@@ -1216,6 +1266,7 @@ export default {
key: 'urgency',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-select',
placeholder: '请选择紧急程度',
options: [
......@@ -1239,6 +1290,7 @@ export default {
key: 'taxRate',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-input-number',
min: 0,
placeholder: '请输入税率'
......@@ -1262,6 +1314,7 @@ export default {
key: 'taxUnitPrice',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-input-number',
placeholder: '请输入含税单价'
},
......@@ -1285,6 +1338,7 @@ export default {
key: 'storageZone',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-select',
placeholder: '请输入接收仓库',
options: []
......@@ -1304,6 +1358,7 @@ export default {
key: 'contractNo',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-input',
placeholder: '请输入合同号'
}
......@@ -1314,6 +1369,7 @@ export default {
key: 'remark',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-input',
placeholder: '请输入备注'
}
......@@ -1323,6 +1379,19 @@ export default {
default:
break
}
if (childrenAddOrEdit) {
this.formFileds[0].data.push(
{
title: '批次号',
key: 'lotNo',
component: {
clearable: true,
name: 'el-input',
placeholder: '请输入批次号'
}
},
)
}
// 设置物料类型下拉
this.resetMaterial()
// 设置带出接收仓库
......@@ -1442,6 +1511,17 @@ export default {
this.material = res.items.content
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) {
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,
disabled: true
}
} else {
return {
label: `${item.resName ? item.resName + '/' : ''}${item.modelNo ? item.modelNo + '/' : ''
}${item.techSpec ? item.techSpec + '/' : ''}${item.spec ? item.spec + '/' : ''
......@@ -1450,6 +1530,7 @@ export default {
value: item.resCode
}
}
}
)
})
.catch((err) => {
......@@ -1713,19 +1794,19 @@ export default {
},
save() {
this.$refs.form.validate((isok) => {
console.log('validate', this.form)
if (isok) {
console.log('this.form.operator', this.form.operator)
// 校验通过
const newTableData = {
...this.form,
'operator': this.form.operator,
'subTypeName': 'InStoragePurchaseItem',
'rowId': this.form.rowId ? this.form.rowId : this.generateUUID(),
'rowId': this.operateType !== 'MODIFY' ? this.generateUUID() : this.form.id,
'parentId': this.form.parentId ? this.form.parentId : this.parentId,
'hasParent': this.form.hasParent ? this.form.hasParent : !!this.parentId,
'parentRowId': this.parentRowId,
'extMaterialId': this.extMaterialId ? this.extMaterialId : this.form.extMaterialId,
'extMaterialIdType': 'ExtDxProcessMaterial',
'materialTypeName': this.basicData.materialType.typeName || (this.basicData.materialTypeName || {}).label,
'materialTypeName': this.basicData.materialTypeName.label,
'purchaseUnitId': this.extUnitId,
'purchaseUnitIdType': 'ExtUnit',
'lotNo': this.form.lotNo,
......@@ -1753,7 +1834,7 @@ export default {
'inventoryReqId': this.basicData.id,
'inventoryReqIdType': 'InventoryRequest',
'contractNo': this.form.contractNo,
'isRoot': true,
'isRoot': this.operateType !== 'ADD' || (this.operateType === 'MODIFY' && !this.form.isRoot),
'subEquipment': this.form.subEquipment,
'productDwawVer': this.form.productDwawVer,
'atpName': this.form.atpName,
......
......@@ -6,7 +6,7 @@
*/
<template>
<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
ref="form"
label-width="120"
......@@ -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: 'hasParent' }
rowKey: 'rowId',
'tree-props': { children: 'children' }
},
columns: [
{
......@@ -254,7 +260,7 @@ export default {
icon: '/icons/components/new/add.png',
showFun: (row) => {
const value = row.extMaterial ? row.extMaterial.resType2.typeName : ''
if (!row.isRoot || row.parentId || value !== '外购成品') {
if (!row.isRoot || value !== '外购成品') {
return false
}
return true
......@@ -325,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
}
},
......@@ -333,8 +339,7 @@ export default {
{ title: '架次', key: 'sorties', headerAlign: 'center' },
{
title: '计量单位', key: 'unitName', headerAlign: 'center', formatter: (row, column, cellValue, index) => {
console.log('2123123123', { ...row })
const value = row.extMaterial ? row.extMaterial.extUnit.unitName : row.reqUnit
const value = row.reqUnit ? row.reqUnit : row.extMaterial ? row.extMaterial.extUnit.unitName : ''
return value
}
},
......@@ -373,7 +378,10 @@ export default {
{ title: '创建时间', key: 'createTime', headerAlign: 'center' }
],
tableData: [],
operator: null
tableParam: [],
operator: null,
addData: {},
symbolKey: ''
}
},
computed: {
......@@ -414,7 +422,8 @@ export default {
},
methods: {
back() {
this.$router.push({
this.$store.dispatch('tagsView/delView', this.$route)
this.$router.replace({
path: '/page/86a5fa19-e245-4732-aff6-c48b18e2b5c7',
query: { title: '采购入库', menuRootAppId: '1626781924331' }
})
......@@ -545,6 +554,7 @@ export default {
// 编辑采购入库明细查询InStorageRequestItem/search
searchInStorageRequestItem() {
const param = {
'rootCondition': {
'pageFrom': 1,
'pageSize': 10,
'searchItems': {
......@@ -560,12 +570,23 @@ export default {
'fieldName': 'isRoot',
'operator': 'EQ',
'value': 'true'
},
{
'fieldName': 'parentId',
'operator': 'ISNULL'
},
{
'fieldName': 'state',
'operator': 'EQ',
'value': 'Apply'
}
],
'operator': 'AND'
}
],
'items': []
'items': [
]
},
'openProps': [{ 'name': 'extMaterial', 'openProps': [{ 'name': 'resType2' }, { 'name': 'extUnit' }] }, { 'name': 'extDxSipplier' }, { 'name': 'storageZone' }],
'sortItem': [
......@@ -575,15 +596,25 @@ export default {
}
]
}
}
post('InStorageRequestItem/search', param).then(res => {
console.log('res.items.content', res.items.content)
const data = res.items.content.map(item => {
post('InStorageRequestItem/treeSearch', param).then(res => {
const data = res.items.map(item => {
return {
...item,
operator: 'NO_CHANGE',
rowId: item.id,
// hasChildren: item.children.length > 0,
children: item.children && item.children.map(child => {
return {
...child,
operator: 'NO_CHANGE'
// hasChildren: false
}
})
}
})
console.log('res.items', { ...data[0] })
if (data.length > 0) {
this.formData[0].data.forEach(item => {
item.component.disabled = true
......@@ -596,64 +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]
if (tableDataItem.hasParent && !item.children) {
item.children = []
}
if (item.rowId === tableDataItem.parentId) {
for (let i = 0; i < tableData.length; i++) {
const item = tableData[i]
if (item.rowId === tableDataItem.parentRowId) {
// item.hasChildren = true
item.children.push(tableDataItem)
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()
......@@ -663,29 +682,36 @@ export default {
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 = {
...this.form,
'operator': this.operator,
'billType': this.form.billType,
'arrivalDate': this.form.arrivalDate,
'materialTypeIdType': 'ExtDxProcessResourceType',
'extDxProductAreaIdType': 'ExtDxProductArea',
'extDxSipplierIdType': 'ExtDxSipplier',
'subTypeName': 'InStoragePurchase',
'reqStatus': 'Apply',
'extDxProductAreaId': this.form.extDxProductAreaId,
'extDxSipplierId': this.form.extDxSipplierId,
'materialTypeId': this.form.materialTypeId,
'inStorageRequestItems': tableData
}
// const paramTableData = []
// this.tableData.map(item => {
// for (const key in item) {
// if (typeof item[key] !== 'object' && item[key] !== null) {
// item[key]
// }
// }
// })
if (this.operator === 'MODIFY') {
param.id = this.form.id
}
post('/InventoryRequest/batch/recursionAdd', param).then(res => {
this.$utils.showMessageSuccess('保存成功')
this.back()
}).catch((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