@ -299,7 +299,7 @@
<!-- NPD 信息 -- >
< el -tab -pane label = "NPD 信息" name = "npdInfo" >
< div style = "height: 635px" >
< div style = "height: 635px; overflow-y: auto; " >
< el -form :inline ="true" label -position = " top " :model ="modalData" style = "margin-top: -5px;" >
< el -form -item label = "现有材料不同规格/Same Material Diff Size" >
< el -radio -group v-model ="modalData.isSameMaterialDiffSize" style="width: 190px" >
@ -318,6 +318,24 @@
< el -input type = "textarea" :rows ="3" v-model ="modalData.npdRemark" resize="none" style="width: 802px;height: 30px" > < / el -input >
< / e l - f o r m - i t e m >
< / e l - f o r m >
< el -form :inline ="true" label -position = " top " :model ="modalData" style = "margin-top: 50px" >
< el -form -item label = "TDS属性/TDS Property" style = "display: block;" >
< oss -components
: save - visible = "authFileSave"
: download - visible = "authFileDownLoad"
: remove - visible = "authFileRemove"
: preview - visible = "authFilePreview"
: disabled = "showModalFlag || modalData.status === '已完成'"
label = "序列号"
: height = "180"
style = "margin-top: 2px"
: columns = "fileColumnList"
: order - ref1 = "modalData.site || ''"
: order - ref2 = "modalData.referenceNo || ''"
order - ref3 = "tdsProperty" >
< / o s s - c o m p o n e n t s >
< / e l - f o r m - i t e m >
< / e l - f o r m >
< / div >
< / e l - t a b - p a n e >
@ -398,6 +416,9 @@
< el -table -column label = "项目名称" prop = "projectName" / >
< / e l - t a b l e >
< / e l - f o r m >
< el -footer style = "height:35px;margin-top: 10px;text-align:center" >
< el -button type = "primary" @ click = "chooseProjectListFlag = false" > 关闭 < / e l - b u t t o n >
< / e l - f o o t e r >
< / e l - d i a l o g >
< el -dialog title = "选择项目物料" top = "15vh" width = "75%" :close-on-click-modal ="false" v -drag :visible.sync ="projectMaterialDialogFlag" >
@ -446,7 +467,7 @@
< / e l - p a g i n a t i o n >
< el -footer style = "height:35px;margin-top: 10px;text-align:center" >
< el -button type = "primary" @click ="confirmProjectMaterialSelection" > 确定 < / el -button >
< el -button type = "primary" @ click = "projectMaterialDialogFlag = false" > 取消 < / e l - b u t t o n >
< el -button type = "primary" @ click = "projectMaterialDialogFlag = false" > 关闭 < / e l - b u t t o n >
< / e l - f o o t e r >
< / e l - d i a l o g >
@ -643,16 +664,34 @@
< el -form :inline ="true" label -position = " top " :model ="currentRow" style = "margin-top: 50px" >
< el -form -item label = "备注说明/NPD Remark" style = "display: block;" > < el -input type = "textarea" :rows ="3" : value = "currentRow.npdRemark || ''" disabled resize = "none" style = "width: 802px;height: 30px" > < / e l - i n p u t > < / e l - f o r m - i t e m >
< / e l - f o r m >
< el -form :inline ="true" label -position = " top " :model ="currentRow" style = "margin-top: 50px" >
< el -form -item label = "TDS属性/TDS Property" style = "display: block;" >
< oss -components
: save - visible = "authFileSave"
: download - visible = "authFileDownLoad"
: remove - visible = "authFileRemove"
: preview - visible = "authFilePreview"
: disabled = "true"
label = "序列号"
: height = "180"
style = "margin-top: 2px"
: columns = "fileColumnList"
: order - ref1 = "currentRow.site || ''"
: order - ref2 = "currentRow.referenceNo || ''"
order - ref3 = "tdsProperty" >
< / o s s - c o m p o n e n t s >
< / e l - f o r m - i t e m >
< / e l - f o r m >
< / div >
< / e l - t a b - p a n e >
< el -tab -pane label = "材料信息" name = "materialInfo" >
< div : style = "{height: secondHeight + 'px'}" style = "margin-left: 5px;margin-top: 5px; overflow-y: auto;" >
< div : style = "{height: secondHeight + 'px'}" style = "overflow-y: auto;" >
< el -table
class = "rohs-material-table"
border
: data = "currentRow.materialList || []"
: height = "secondHeight - 10"
: height = "secondHeight"
style = "width: 100%" >
< el -table -column type = "index" label = "序号" width = "50" header -align = " center " align = "center" > < / e l - t a b l e - c o l u m n >
< el -table -column prop = "testPartNo" label = "PLM物料编码/Test Part No." min -width = " 180 " header -align = " center " align = "left" :show-overflow-tooltip ="true" > < / e l - t a b l e - c o l u m n >
@ -761,7 +800,7 @@ export default {
columnSortable : false ,
status : true ,
fixed : '' ,
columnWidth : 24 0
columnWidth : 20 0
} ,
{
columnProp : 'createDate' ,
@ -773,7 +812,7 @@ export default {
columnSortable : false ,
status : true ,
fixed : '' ,
columnWidth : 14 0
columnWidth : 15 0
} ,
{
columnProp : 'createBy' ,
@ -785,7 +824,7 @@ export default {
columnSortable : false ,
status : true ,
fixed : '' ,
columnWidth : 14 0
columnWidth : 12 0
}
] ,
@ -1296,9 +1335,9 @@ export default {
this . $set ( this . modalData , 'commGroup1Desc' , '' )
this . $set ( this . modalData , 'commGroup2Desc' , '' )
this . $set ( this . modalData , 'commGroup3Desc' , '' )
/ / 编 辑 时 允 许 重 新 选 择 客 户 和 项 目
this . $set ( this . modalData , 'endCustomerFlag' , fals e)
this . $set ( this . modalData , 'projectIdFlag' , ! this . modalData . endCustomer )
/ / 编 辑 时 不 允 许 修 改 最 终 客 户 和 项 目 编 码
this . $set ( this . modalData , 'endCustomerFlag' , tru e)
this . $set ( this . modalData , 'projectIdFlag' , true )
this . $set ( this . modalData , 'createBy2' , '' )
this . $set ( this . modalData , 'isReject' , 'Y' )
this . $set ( this . modalData , 'tpProcessControl' , 'N' )
@ -1584,18 +1623,42 @@ export default {
this . $message . warning ( '请至少选择一条项目物料' )
return
}
this . appendMaterialRows ( this . projectMaterialSelections )
this . projectMaterialDialogFlag = false
const appendResult = this . appendMaterialRows ( this . projectMaterialSelections )
if ( ! appendResult . appendedCount ) {
this . $message . warning ( '所选物料已存在,未新增数据' )
return
}
if ( ! this . shouldPersistMaterialsImmediately ( ) ) {
this . $set ( this . modalData , 'materialList' , appendResult . materialList )
this . projectMaterialDialogFlag = false
this . $message . success ( '已加入材料列表,保存单据后写入数据库' )
return
}
this . $confirm ( '确认新增选中材料?' , '提示' , {
confirmButtonText : '确定' ,
cancelButtonText : '取消' ,
type : 'warning'
} ) . then ( ( ) => {
this . persistMaterialList ( appendResult . materialList , '新增材料成功' , ( ) => {
this . projectMaterialDialogFlag = false
this . projectMaterialSelections = [ ]
if ( this . $refs . projectMaterialTable ) {
this . $refs . projectMaterialTable . clearSelection ( )
}
} )
} ) . catch ( ( ) => { } )
} ,
appendMaterialRows ( rows ) {
const materialList = Array . isArray ( this . modalData . materialList ) ? [ ... this . modalData . materialList ] : [ ]
const exists = new Set ( materialList . map ( item => item . testPartNo ) )
let appendedCount = 0
rows . forEach ( row => {
const testPartNo = row . testPartNo || row . test_part_no
if ( ! testPartNo || exists . has ( testPartNo ) ) {
return
}
exists . add ( testPartNo )
appendedCount ++
materialList . push ( {
site : this . modalData . site ,
referenceNo : this . modalData . referenceNo ,
@ -1607,11 +1670,53 @@ export default {
partSpec : row . partSpec || row . part_spec || ''
} )
} )
this . $set ( this . modalData , 'materialList' , materialList )
return {
materialList ,
appendedCount
}
} ,
materialSelectionChange ( rows ) {
this . materialSelections = rows || [ ]
} ,
shouldPersistMaterialsImmediately ( ) {
return this . modalTitle === 'RoHs 编辑' && this . modalData && this . modalData . referenceNo && ! String ( this . modalData . referenceNo ) . startsWith ( 'TEMP-' )
} ,
normalizeMaterialListForSave ( materialList ) {
return ( materialList || [ ] ) . map ( ( item , index ) => {
return {
... item ,
lineNo : index + 1 ,
projectId : item . projectId || this . modalData . projectId || ''
}
} )
} ,
persistMaterialList ( materialList , successMsg , successCallback ) {
const normalizedList = this . normalizeMaterialListForSave ( materialList )
const payload = {
site : this . modalData . site ,
referenceNo : this . modalData . referenceNo ,
projectId : this . modalData . projectId ,
materialList : normalizedList
}
api . updateRohsMaterials ( payload ) . then ( ( { data } ) => {
if ( data && data . code === 0 ) {
this . $set ( this . modalData , 'materialList' , normalizedList )
this . modalData . ifsPartNo = normalizedList . length > 0 ? normalizedList [ 0 ] . testPartNo : ''
this . materialSelections = [ ]
if ( this . currentRow && this . currentRow . referenceNo === this . modalData . referenceNo ) {
this . $set ( this . currentRow , 'materialList' , normalizedList )
}
this . $message . success ( successMsg || '保存成功' )
if ( typeof successCallback === 'function' ) {
successCallback ( )
}
} else {
this . $message . error ( ( data && data . msg ) || '保存失败' )
}
} ) . catch ( ( ) => {
this . $message . error ( '保存失败' )
} )
} ,
removeSelectedMaterialRows ( ) {
if ( this . showModalFlag ) {
return
@ -1622,8 +1727,19 @@ export default {
}
const removeSet = new Set ( this . materialSelections . map ( item => item . testPartNo ) )
const materialList = ( this . modalData . materialList || [ ] ) . filter ( item => ! removeSet . has ( item . testPartNo ) )
this . $set ( this . modalData , 'materialList' , materialList )
this . materialSelections = [ ]
if ( ! this . shouldPersistMaterialsImmediately ( ) ) {
this . $set ( this . modalData , 'materialList' , materialList )
this . materialSelections = [ ]
this . $message . success ( '已删除材料,保存单据后写入数据库' )
return
}
this . $confirm ( '确认删除选中材料?' , '提示' , {
confirmButtonText : '确定' ,
cancelButtonText : '取消' ,
type : 'warning'
} ) . then ( ( ) => {
this . persistMaterialList ( materialList , '删除材料成功' )
} ) . catch ( ( ) => { } )
} ,
/ / = = = = = = = = c h o o s e L i s t 相 关 方 法 = = = = = = = =
/ / 获 取 基 础 数 据 列 表
@ -1733,7 +1849,7 @@ export default {
if ( data . rows && data . rows . length === 1 ) {
const customer = data . rows [ 0 ]
this . modalData . endCustomerName = customer . customerDesc || customer . Customer_desc || customer . customerName || ''
this . modalData . projectIdFlag = false
this . modalData . projectIdFlag = ! ! this . modalData . endCustomerFlag
} else {
this . modalData . endCustomerName = ''
this . modalData . projectId = ''