@ -111,24 +111,24 @@
< el -tabs v-model ="activeTable" style="width: 100%" type="border-card" @tab-click="refreshCurrentTabTable" class="customer-tab" >
<!-- BOM页签 -- >
< el -tab -pane label = "产品BOM管理" name = "bom_info" >
< bom -create v -loading = " bomLoading " ref = "BomCreate" @refreshNode ="refreshNode" @refreshBomLoading ="refreshBomLoading" v-drag > < / bom -create >
< bom -create v -loading = " bomLoading " ref = "BomCreate" @handleBatchUpdatePart ="handleBatchUpdatePart" @ refreshNode ="refreshNode" @refreshBomLoading ="refreshBomLoading" v-drag > < / bom -create >
< / e l - t a b - p a n e >
<!-- Routing页签 -- >
< el -tab -pane label = "工艺路线管理" name = "routing_info" >
< routing -create v -loading = " routingLoading " ref = "RoutingCreate" @refreshRoutingLoading ="refreshRoutingLoading" v-drag > < / routing -create >
< routing -create v -loading = " routingLoading " ref = "RoutingCreate" :batchUpdateFlag ="batchUpdateFlag" @refreshRoutingLoading ="refreshRoutingLoading" v-drag > < / routing -create >
< / e l - t a b - p a n e >
< / e l - t a b s >
< / e l - c o l >
< / e l - r o w >
<!-- 节点新增模态框 -- >
< el -dialog title = "节点" :close-on-click-modal ="false" v -drag :visible.sync ="nodeModalFlag" width = "4 30px" >
< el -dialog title = "节点" :close-on-click-modal ="false" v -drag :visible.sync ="nodeModalFlag" width = "36 0px" >
< el -form :inline ="true" label -position = " top " :model ="nodeData" :rules ="nodeRules" style = "margin-left: 7px;margin-top: -5px;" >
< el -form -item label = "节点编码" prop = "nodeId" :rules ="nodeRules.nodeId" >
< el -input v-model ="nodeData.nodeId" :disabled="nodeModalDisableFlag" style="width: 140px" > < / el -input >
< / e l - f o r m - i t e m >
<!-- < el -form -item label = "节点编码" prop = "nodeId" :rules ="nodeRules.nodeId" > -- >
<!-- < el -input v-model ="nodeData.nodeId" :disabled="nodeModalDisableFlag" style="width: 140px" > < / el -input > -- >
<!-- < / e l - f o r m - i t e m > - - >
< el -form -item label = "节点名称" prop = "nodeName" :rules ="nodeRules.nodeName" >
< el -input v-model ="nodeData.nodeName" style="width: 2 30px" > < / el -input >
< el -input v-model ="nodeData.nodeName" style="width: 32 0px" > < / el -input >
< / e l - f o r m - i t e m >
< el -form -item v-if ="this.nodeData.flag === '1'" label="父节点" prop="pId" :rules="nodeRules.parentNodeName" >
< el -popover
@ -230,7 +230,7 @@
< el -button style = "margin-right: 10px; height: 20px" type = "primary" @click ="handleEditInfo" > {{ attributeFlag ? ' 编辑 ' : ' 保存 ' }} < / el -button >
< el -form label -position = " top " style = "margin-top: -20px; margin-left: 65vw" >
< el -form -item label = "属性模板" >
< el -select v-model ="searchData.codeNo" placeholder="请选择属性模板 " @change="handleCodeNoChange" style="width: 235px" >
< el -select v-model ="searchData.codeNo" placeholder="请选择" @change="handleCodeNoChange" style="width: 235px" >
< el -option
v - for = "option in codeList"
: key = "option.fieldname1"
@ -262,8 +262,8 @@
width = "80"
trigger = "click" >
< a style = "cursor: pointer" @click ="queryPartList2(scope.row)" > 已有料号 < / a >
< el -divider > < / e l - d i v i d e r >
< a style = "cursor: pointer" @click ="addPartModal(scope.row)" > 新增料号 < / a >
<!-- < el -divider > < / e l - d i v i d e r >
< a style = "cursor: pointer" @click ="addPartModal(scope.row)" > 新增料号 < / a > - - >
< i style = "color:#1c92e0" slot = "reference" class = "small-operation-btn el-icon-more" / >
< / e l - p o p o v e r >
< / div >
@ -304,15 +304,13 @@
width = "80"
trigger = "click" >
< a style = "cursor: pointer" @click ="queryPartList2(scope.row)" > 已有料号 < / a >
< el -divider > < / e l - d i v i d e r >
< a style = "cursor: pointer" @click ="addPartModal(scope.row)" > 新增料号 < / a >
< i style = "color:#1c92e0" slot = "reference" class = "small-operation-btn el-icon-more" / >
< / e l - p o p o v e r >
< / div >
< / template >
< / e l - t a b l e - c o l u m n >
< el -table -column
v - for = "(item,index) in partColumnList1 " : key = "index"
v - for = "(item,index) in partColumnList2 " : key = "index"
: sortable = "item.columnSortable"
: prop = "item.columnProp"
: header - align = "item.headerAlign"
@ -323,7 +321,48 @@
: label = "item.columnLabel" >
< template slot -scope = " scope " >
< span v-show ="!item.columnHidden" >
< span v-show ="item.columnProp==='buNo'||item.columnProp==='partNo'||item.columnProp==='partDesc'||item.columnProp==='nodeName'" > {{ scope.row [ item.columnProp ] }} < / span >
< span v-show ="item.columnProp==='partNo'||item.columnProp==='nodeName'" > {{ scope.row [ item.columnProp ] }} < / span >
< span v-show ="item.columnProp==='buNo'" >
< el -select v-model ="scope.row.buNo" v-show="!scope.row.partNo||scope.row.partNo===''" clearable @change="changeBuOfNode(scope.row)" placeholder="请选择" >
< el -option
v - for = "i in userBuList"
: key = "i.buNo.split('_')[1]"
: label = "i.buNo.split('_')[1]"
: value = "i.buNo.split('_')[1]" >
< / e l - o p t i o n >
< / e l - s e l e c t >
< span v-if ="scope.row.partNo&&scope.row.partNo!==''" > {{ scope.row [ item.columnProp ] }} < / span >
< / span >
< span v-show ="item.columnProp==='partDesc'" >
< el -input v -model = " scope.row.partDesc " clearable > < / e l - i n p u t >
< / span >
< span v-if ="item.columnProp==='tempNo'" >
< el -select :loading ="buNoQueryLoading" v-model ="scope.row.tempNo" clearable @change="chooseTemplate(scope.row)" >
< el -option
v - for = "option in scope.row.tempList"
: key = "option.templateNo"
: label = "option.templateName"
: value = "option.templateNo" >
< / e l - o p t i o n >
< / e l - s e l e c t >
< / span >
< span v-if ="item.columnProp==='codeDesc'" >
< el -select v-model ="scope.row.codeNo" placeholder="请选择" clearable style="width: 200px" >
< el -option :loading ="buNoQueryLoading"
v - for = "option in scope.row.codeList"
: key = "option.fieldname1"
: label = "option.caption1"
: value = "option.fieldname1" >
< / e l - o p t i o n >
< / e l - s e l e c t >
< / span >
< span v-show ="item.columnProp==='partType2'" >
< el -select v -model = " scope.row.partType2 " clearable >
< el -option label = "成品" value = "Manufactured" > < / e l - o p t i o n >
< el -option label = "半成品" value = "Manufactured Recipe" > < / e l - o p t i o n >
< el -option label = "原材料" value = "Purchased (raw)" > < / e l - o p t i o n >
< / e l - s e l e c t >
< / span >
< span v-show ="item.columnProp==='umName'" >
< el -select
v - model = "scope.row.umId2" clearable >
@ -335,8 +374,8 @@
< / e l - o p t i o n >
< / e l - s e l e c t >
< / span >
< span v-show ="item.columnProp==='familyName'" >
< el -select
< span v-if ="item.columnProp==='familyName'" >
< el -select :loading ="buNoQueryLoading"
v - model = "scope.row.familyID" clearable >
< el -option
v - for = "option in scope.row.partFamilyList"
@ -346,8 +385,8 @@
< / e l - o p t i o n >
< / e l - s e l e c t >
< / span >
< span v-show ="item.columnProp==='productGroupName1'" >
< el -select
< span v-if ="item.columnProp==='productGroupName1'" >
< el -select :loading ="buNoQueryLoading"
v - model = "scope.row.productGroupId1" clearable >
< el -option
v - for = "option in scope.row.partProductGroupList1"
@ -357,8 +396,8 @@
< / e l - o p t i o n >
< / e l - s e l e c t >
< / span >
< span v-show ="item.columnProp==='productGroupName2'" >
< el -select
< span v-if ="item.columnProp==='productGroupName2'" >
< el -select :loading ="buNoQueryLoading"
v - model = "scope.row.productGroupId2" clearable >
< el -option
v - for = "option in scope.row.partProductGroupList2"
@ -368,8 +407,8 @@
< / e l - o p t i o n >
< / e l - s e l e c t >
< / span >
< span v-show ="item.columnProp==='productGroupName3'" >
< el -select
< span v-if ="item.columnProp==='productGroupName3'" >
< el -select :loading ="buNoQueryLoading"
v - model = "scope.row.productGroupId3" clearable >
< el -option
v - for = "option in scope.row.partProductGroupList3"
@ -379,8 +418,8 @@
< / e l - o p t i o n >
< / e l - s e l e c t >
< / span >
< span v-show ="item.columnProp==='templateName'" >
< el -select
< span v-if ="item.columnProp==='templateName'" >
< el -select :loading ="buNoQueryLoading"
v - model = "scope.row.templateNo" clearable >
< el -option
v - for = "option in scope.row.templateList"
@ -798,6 +837,9 @@ import {
getItemLists , batchSavePartInfo , addPartsItem , batchUpdateCodeNo , deletePartsItem , commitItemsValue
} from "../../../api/part/partInformation" ;
import { getChooselist1 } from "../../../api/chooselist/chooselist" ;
import { chooseTemplate , getTemplateList , savePartInfo , updatePartNoOfNode } from "../../../api/part/quicklyCreateBom" ;
import { getSiteAndBuByUserName } from "../../../api/qc/qc" ;
import Data from "lodash" ;
export default {
components : {
PartCreate ,
@ -872,12 +914,13 @@ export default {
treeData1 : [ ] ,
childrenNodeList : [ ] ,
umList : [ ] ,
userBuList : [ ] ,
partFamilyList : [ ] ,
partProductGroupList1 : [ ] ,
partProductGroupList2 : [ ] ,
partProductGroupList3 : [ ] ,
templateList : [ ] ,
/ / i g n o r e F i e l d s : [ ' s i t e ' , ' b u N o ' , ' p a r t N o ' , ' c o d e N o ' , ' n o d e N a m e ' , ' p a r t D e s c ' , ' p r o p e r t i e s V a l u e L i s t ' ] ,
tempList : [ ] ,
defaultProps : {
children : "nodeList" ,
label : "nodeName" ,
@ -1138,7 +1181,7 @@ export default {
columnImage : false ,
status : true ,
fixed : '' ,
columnWidth : 15 0
columnWidth : 22 0
} ,
{
columnProp : 'nodeName' ,
@ -1151,6 +1194,186 @@ export default {
fixed : '' ,
columnWidth : 100
} ,
{
columnProp : 'partType2' ,
headerAlign : "center" ,
align : "center" ,
columnLabel : '零件类型' ,
columnHidden : false ,
columnImage : false ,
status : true ,
fixed : '' ,
columnWidth : 100
} ,
{
columnProp : 'umName' ,
headerAlign : "center" ,
align : "center" ,
columnLabel : '计量单位' ,
columnHidden : false ,
columnImage : false ,
status : true ,
fixed : '' ,
columnWidth : 100
} ,
{
columnProp : 'familyName' ,
headerAlign : "center" ,
align : "center" ,
columnLabel : '物料分类' ,
columnHidden : false ,
columnImage : false ,
status : true ,
fixed : '' ,
columnWidth : 100
} ,
{
columnProp : 'productGroupName1' ,
headerAlign : "center" ,
align : "center" ,
columnLabel : '商品组1' ,
columnHidden : false ,
columnImage : false ,
status : true ,
fixed : '' ,
columnWidth : 250
} ,
{
columnProp : 'productGroupName2' ,
headerAlign : "center" ,
align : "center" ,
columnLabel : '商品组2' ,
columnHidden : false ,
columnImage : false ,
status : true ,
fixed : '' ,
columnWidth : 250
} ,
{
columnProp : 'productGroupName3' ,
headerAlign : "center" ,
align : "center" ,
columnLabel : '商品组3' ,
columnHidden : false ,
columnImage : false ,
status : true ,
fixed : '' ,
columnWidth : 250
} ,
/ / {
/ / c o l u m n P r o p : ' n o d e N a m e ' ,
/ / h e a d e r A l i g n : " c e n t e r " ,
/ / a l i g n : " c e n t e r " ,
/ / c o l u m n L a b e l : ' 属 性 模 板 ' ,
/ / c o l u m n H i d d e n : f a l s e ,
/ / c o l u m n I m a g e : f a l s e ,
/ / s t a t u s : t r u e ,
/ / f i x e d : ' ' ,
/ / c o l u m n W i d t h : 1 0 0
/ / } ,
{
columnProp : 'templateName' ,
headerAlign : "center" ,
align : "center" ,
columnLabel : 'BOM模板' ,
columnHidden : false ,
columnImage : false ,
status : true ,
fixed : '' ,
columnWidth : 100
} ,
{
columnProp : 'remark' ,
headerAlign : "center" ,
align : "center" ,
columnLabel : '备注' ,
columnHidden : false ,
columnImage : false ,
status : true ,
fixed : '' ,
columnWidth : 200
} ,
] ,
partColumnList2 : [
{
columnProp : 'buNo' ,
headerAlign : "center" ,
align : "center" ,
columnLabel : 'BU' ,
columnHidden : false ,
columnImage : false ,
columnSortable : false ,
sortLv : 0 ,
status : true ,
fixed : '' ,
columnWidth : 100
} ,
{
columnProp : 'partNo' ,
headerAlign : "center" ,
align : "center" ,
columnLabel : '料号' ,
columnHidden : false ,
columnImage : false ,
status : true ,
fixed : '' ,
columnWidth : 120
} ,
{
columnProp : 'partDesc' ,
headerAlign : "center" ,
align : "left" ,
columnLabel : '物料描述' ,
columnHidden : false ,
columnImage : false ,
status : true ,
fixed : '' ,
columnWidth : 320
} ,
{
columnProp : 'codeDesc' ,
headerAlign : "center" ,
align : "center" ,
columnLabel : '属性模板' ,
columnHidden : false ,
columnImage : false ,
status : true ,
fixed : '' ,
columnWidth : 220
} ,
{
columnProp : 'nodeName' ,
headerAlign : "center" ,
align : "center" ,
columnLabel : '节点' ,
columnHidden : false ,
columnImage : false ,
status : true ,
fixed : '' ,
columnWidth : 100
} ,
{
columnProp : 'partType2' ,
headerAlign : "center" ,
align : "center" ,
columnLabel : '零件类型' ,
columnHidden : false ,
columnImage : false ,
status : true ,
fixed : '' ,
columnWidth : 100
} ,
{
columnProp : 'tempNo' ,
headerAlign : "center" ,
align : "center" ,
columnLabel : '模板' ,
columnHidden : false ,
columnImage : false ,
status : true ,
fixed : '' ,
columnWidth : 100
} ,
{
columnProp : 'umName' ,
headerAlign : "center" ,
@ -1410,7 +1633,8 @@ export default {
fastAddFlag1 : false ,
loading : false ,
addItemLoading : false ,
deleteItemLoading : false
deleteItemLoading : false ,
buNoQueryLoading : false
}
} ,
created ( ) {
@ -1465,6 +1689,9 @@ export default {
if ( data && data . code === 0 ) {
this . treeData = data . rows
}
if ( this . batchUpdateFlag ) {
this . handleBatchUpdatePart ( )
}
} )
} ,
@ -1473,7 +1700,7 @@ export default {
this . nodeData = {
flag : '1' ,
site : this . $store . state . user . site ,
nodeId : '' ,
nodeId : 'NODE ' + Data . now ( ) ,
nodeName : '' ,
pId : '0' ,
createBy : this . $store . state . user . name ,
@ -1744,20 +1971,11 @@ export default {
/ / 双 击 选 中 物 料
getRowData ( row ) {
if ( this . partData . nodeFlag && row . buNo !== this . searchData . buNo ) {
this . $message . warning ( '请确保节点物料的BU与主物料BU一致!' )
return
}
if ( this . partData . flag === '1' ) {
this . getInfoByBomTemplate ( row )
} else {
this . toPartModule ( row )
}
setTimeout ( ( ) => {
if ( this . batchUpdateFlag ) {
this . handleBatchUpdatePart ( )
}
} , 0 )
} ,
/ / 获 取 物 料 的 B o m 模 板 详 情
@ -1776,7 +1994,6 @@ export default {
let tempData = {
site : row . site ,
buNo : row . buNo ,
codeNo : this . searchData . codeNo ,
mainPart : this . searchData . partNo ,
partNo : row . partNo ,
bomType : 'Manufacturing' ,
@ -2126,6 +2343,17 @@ export default {
getChooselist1 ( tempList ) . then ( ( { data } ) => {
this . $set ( this , 'codeList' , data . list [ 0 ] [ 0 ] )
} )
let tempData1 = {
username : this . $store . state . user . name ,
}
getSiteAndBuByUserName ( tempData1 ) . then ( ( { data } ) => {
if ( data . code === 0 ) {
this . userBuList = data . rows . sort ( ( a , b ) => {
return a . buNo . split ( '_' ) [ 1 ] . localeCompare ( b . buNo . split ( '_' ) [ 1 ] ) ;
} ) ;
}
} )
this . getTemplateList ( )
this . getPartItem2 ( )
this . $forceUpdate ( )
this . batchUpdateFlag = true
@ -2260,17 +2488,19 @@ export default {
this . loading = true
let list = [ ]
for ( let i = 0 ; i < this .partList1.length ; i + + ) {
let items = JSON . parse ( JSON . stringify ( this . partItemList1 ) )
for ( let j = 0 ; j < this . partItemList1 . length ; j ++ ) {
items [ j ] . site = this . partList1 [ i ] . site
items [ j ] . buNo = this . partList1 [ i ] . buNo
items [ j ] . partNo = this . partList1 [ i ] . partNo
items [ j ] . codeNo = this . partList1 [ i ] . codeNo
items [ j ] . recordType = 'IP'
if ( this . partList1 [ i ] . partNo && this . partList1 . partNo !== '' && this . partList1 [ i ] . buNo && this . partList1 [ i ] . buNo === this . searchData . buNo ) {
let items = JSON . parse ( JSON . stringify ( this . partItemList1 ) )
for ( let j = 0 ; j < this . partItemList1 . length ; j ++ ) {
items [ j ] . site = this . partList1 [ i ] . site
items [ j ] . buNo = this . partList1 [ i ] . buNo
items [ j ] . partNo = this . partList1 [ i ] . partNo
items [ j ] . codeNo = this . partList1 [ i ] . codeNo
items [ j ] . recordType = 'IP'
}
list . push ( {
itemList : items
} )
}
list . push ( {
itemList : items
} )
}
commitItemsValue ( list ) . then ( ( { data } ) => {
if ( data && data . code === 0 ) {
@ -2356,51 +2586,19 @@ export default {
this . $message . warning ( '请选择可选属性!' )
return
}
let flag = true
let codeFlag = true
for ( let i = 0 ; i < this . partList1 . length ; i ++ ) {
if ( ! ( this . partList1 [ i ] . partNo && this . partList1 [ i ] . partNo !== '' ) ) {
flag = false
break
}
if ( ! ( this . partList1 [ i ] . codeNo && this . partList1 [ i ] . codeNo !== '' ) ) {
codeFlag = false
break
}
}
if ( ! flag ) {
this . $confirm ( "当前存在未绑定料号的节点" , '提示' , {
confirmButtonText : '确定' ,
cancelButtonText : '取消' ,
type : 'warning'
} ) . then ( ( ) => {
flag = true
} )
}
if ( ! flag ) {
return
}
if ( ! codeFlag ) {
this . $confirm ( "请先维护全部节点的属性模版" , '提示' , {
confirmButtonText : '确定' ,
cancelButtonText : '取消' ,
type : 'warning'
} ) . then ( ( ) => {
codeFlag = true
} )
}
if ( ! codeFlag ) {
return
}
let partList = this . partList1 . filter ( item => item . partNo && item . partNo !== '' && item . buNo && item . buNo === this . searchData . buNo )
this . addItemLoading = true
let inDataList = [ ]
for ( let i = 0 ; i < this . partList1 . length ; i ++ ) {
for ( let i = 0 ; i < partList . length ; i ++ ) {
if ( ! partList [ i ] . codeNo || partList [ i ] . codeNo === '' ) {
continue
}
inDataList . push ( {
site : this . partList1 [ i ] . site ,
buNo : this . partList1 [ i ] . buNo ,
partNo : this . partList1 [ i ] . partNo ,
codeNo : this . partList1 [ i ] . codeNo ,
codeDesc : this . partList1 [ i ] . codeDesc ,
site : partList [ i ] . site ,
buNo : partList [ i ] . buNo ,
partNo : partList [ i ] . partNo ,
codeNo : partList [ i ] . codeNo ,
codeDesc : partList [ i ] . codeDesc ,
recordType : 'IP' ,
itemList : this . itemSelections1
} )
@ -2467,14 +2665,15 @@ export default {
} )
return false
}
let partList = this . partList1 . filter ( item => item . partNo && item . partNo !== '' && item . buNo && item . buNo === this . searchData . buNo )
let inDataList = [ ]
for ( let i = 0 ; i < this . partList1 . length ; i ++ ) {
for ( let i = 0 ; i < partList . length ; i ++ ) {
let items = JSON . parse ( JSON . stringify ( this . itemSelections2 ) )
for ( let j = 0 ; j < this . itemSelections2 . length ; j ++ ) {
items [ j ] . site = this . partList1 [ i ] . site
items [ j ] . buNo = this . partList1 [ i ] . buNo
items [ j ] . partNo = this . partList1 [ i ] . partNo
items [ j ] . codeNo = this . partList1 [ i ] . codeNo
items [ j ] . site = partList [ i ] . site
items [ j ] . buNo = partList [ i ] . buNo
items [ j ] . partNo = partList [ i ] . partNo
items [ j ] . codeNo = partList [ i ] . codeNo
items [ j ] . recordType = 'IP'
}
inDataList . push ( {
@ -2512,14 +2711,19 @@ export default {
const index = this . partCurrentRowIndex
if ( index > - 1 && index < this . partList1 . length - 1 ) {
const nextRow = this . partList1 [ index + 1 ]
const excludeFields = [ 'buNo' , 'nodeId' , 'nodeName' , 'site' , 'partDesc' , 'partNo' ] ;
for ( const key in this . partCurrentRow ) {
if ( ! excludeFields . includes ( key ) ) {
this . $set ( nextRow , key , this . partCurrentRow [ key ] ) ;
if ( nextRow . buNo !== this . partCurrentRow . buNo ) {
this . $message . warning ( "当前选择行数据的BU与下一行的不同,只会复制计量单位和BOM模板!" )
this . partList1 [ index + 1 ] . umId2 = this . partCurrentRow . umId2
this . partList1 [ index + 1 ] . templateNo = this . partCurrentRow . templateNo
} else {
const excludeFields = [ 'buNo' , 'nodeId' , 'nodeName' , 'site' , 'partDesc' , 'partNo' ] ;
for ( const key in this . partCurrentRow ) {
if ( ! excludeFields . includes ( key ) ) {
this . $set ( nextRow , key , this . partCurrentRow [ key ] ) ;
}
}
this . partList1 [ index + 1 ] = nextRow
}
this . partList1 [ index + 1 ] = nextRow
batchSavePartInfo ( this . partList1 ) . then ( ( { data } ) => {
if ( data && data . code === 0 ) {
this . handleBatchUpdatePart ( )
@ -2545,18 +2749,74 @@ export default {
}
} ,
handleEditInfo ( ) {
async handleEditInfo ( ) {
if ( this . attributeFlag === true ) {
this . getPropertiesList ( )
this . attributeFlag = false
} else {
for ( let i = 0 ; i < this . partList1 . length ; i ++ ) {
if ( this . partList1 [ i ] . buNo === null || this . partList1 [ i ] . buNo === '' ) {
this . $message . warning ( "请先选择物料再保存!" )
return
if ( ! this . partList1 [ i ] . partNo || this . partList1 [ i ] . partNo === '' ) {
/ / 没 有 物 料 编 号 就 新 增 料 号
/ / 没 有 填 写 物 料 描 述 就 认 为 用 户 暂 时 不 在 这 个 节 点 新 建 料 号
if ( this . partList1 [ i ] . partDesc === '' || this . partList1 [ i ] . partDesc == null ) {
continue
}
this . partList1 [ i ] . partNo = '*'
this . partList1 [ i ] . active = 'Y'
this . partList1 [ i ] . createBy = this . $store . state . user . name
this . partList1 [ i ] . mainPart = this . searchData . partNo
if ( this . partList1 [ i ] . buNo === '' || this . partList1 [ i ] . buNo == null ) {
this . $message . warning ( '请选择' + this . partList1 [ i ] . nodeName + '节点的BU!' )
return
}
if ( this . partList1 [ i ] . partType2 === '' || this . partList1 [ i ] . partType2 == null ) {
this . $message . warning ( '请选择' + this . partList1 [ i ] . nodeName + '节点的零件类型!' )
return
}
if ( this . partList1 [ i ] . umId2 === '' || this . partList1 [ i ] . umId2 == null ) {
this . $message . warning ( '请选择' + this . partList1 [ i ] . nodeName + '节点的计量单位!' )
return
}
if ( this . partList1 [ i ] . partType2 === 'Purchased (raw)' && ( this . partList1 [ i ] . familyID === '' || this . partList1 [ i ] . familyID == null ) ) {
this . $message . warning ( '请选择' + this . partList1 [ i ] . nodeName + '节点的物料分类!' )
return
}
if ( this . partList1 [ i ] . partType2 !== 'Purchased (raw)' && ( this . partList1 [ i ] . productGroupId1 === '' || this . partList1 [ i ] . productGroupId1 == null ) ) {
this . $message . warning ( '请选择' + this . partList1 [ i ] . nodeName + '节点的商品组1!' )
return
}
if ( this . partList1 [ i ] . partType2 !== 'Purchased (raw)' && ( this . partList1 [ i ] . productGroupId2 === '' || this . partList1 [ i ] . productGroupId2 == null ) ) {
this . $message . warning ( '请选择' + this . partList1 [ i ] . nodeName + '节点的商品组2!' )
return
}
if ( this . partList1 [ i ] . codeNo === '' || this . partList1 [ i ] . codeNo == null ) {
this . $message . warning ( '请选择' + this . partList1 [ i ] . nodeName + '节点的属性模板!' )
return
}
let flag = true
/ / 创 建 物 料
await savePartInfo ( this . partList1 [ i ] ) . then ( ( data ) => {
if ( data . data && data . data . code === 0 ) {
this . partList1 [ i ] . partNo = data . data . rows . partNo
updatePartNoOfNode ( this . partList1 [ i ] ) . then ( ( data ) => {
if ( data . data && data . data . code === 0 ) {
} else {
this . $message . error ( data . msg )
}
} )
} else {
this . $message . error ( data . msg )
flag = false
}
} )
if ( ! flag ) {
return
}
}
}
batchSavePartInfo ( this . partList1 ) . then ( ( { data } ) => {
/ / 修 改 物 料 的 属 性
batchSavePartInfo ( this . partList1 . filter ( item => item . partNo && item . partNo !== '' ) ) . then ( ( { data } ) => {
if ( data && data . code === 0 ) {
this . handleBatchUpdatePart ( )
this . $message ( {
@ -2603,6 +2863,7 @@ export default {
"select product_group_id fieldname1,product_group_name caption1 from part_product_group where active = 'Y' and type = '1' and site in (select site from eam_access_site where username = '" + this . $store . state . user . name + "') and (site + '-' + bu_no) in (select (a.site + '-' + a.bu_no) from AccessBu as a left join eam_access_site as b on a.site = b.site and a.username = b.username where a.username = '" + this . $store . state . user . name + "') and site = '" + this . $store . state . user . site + "' and bu_no = '" + this . partList1 [ i ] . buNo + "'" ,
"select product_group_id fieldname1,product_group_name caption1 from part_product_group where active = 'Y' and type = '2' and site in (select site from eam_access_site where username = '" + this . $store . state . user . name + "') and (site + '-' + bu_no) in (select (a.site + '-' + a.bu_no) from AccessBu as a left join eam_access_site as b on a.site = b.site and a.username = b.username where a.username = '" + this . $store . state . user . name + "') and site = '" + this . $store . state . user . site + "' and bu_no = '" + this . partList1 [ i ] . buNo + "'" ,
"select product_group_id fieldname1,product_group_name caption1 from part_product_group where active = 'Y' and type = '3' and site in (select site from eam_access_site where username = '" + this . $store . state . user . name + "') and (site + '-' + bu_no) in (select (a.site + '-' + a.bu_no) from AccessBu as a left join eam_access_site as b on a.site = b.site and a.username = b.username where a.username = '" + this . $store . state . user . name + "') and site = '" + this . $store . state . user . site + "' and bu_no = '" + this . partList1 [ i ] . buNo + "'" ,
"Select code_no as fieldname1, code_desc as caption1 from plm_properties_model_header where function_type = 'IP' and active = 'Y' and (code_no like '%%' OR code_desc like '%%' ) and site in (select site from eam_access_site where username = '" + this . $store . state . user . name + "') and (site + '-' + bu_no) in (select (a.site + '-' + a.bu_no) from AccessBu as a left join eam_access_site as b on a.site = b.site and a.username = b.username where a.username = '" + this . $store . state . user . name + "') and site = '" + this . $store . state . user . site + "' and bu_no = '" + this . partList1 [ i ] . buNo + "'"
]
}
}
@ -2614,6 +2875,7 @@ export default {
this . $set ( this . partList1 [ i ] , 'partProductGroupList1' , data . data . list [ i ] [ 1 ] ) ;
this . $set ( this . partList1 [ i ] , 'partProductGroupList2' , data . data . list [ i ] [ 2 ] ) ;
this . $set ( this . partList1 [ i ] , 'partProductGroupList3' , data . data . list [ i ] [ 3 ] ) ;
this . $set ( this . partList1 [ i ] , 'codeList' , data . data . list [ i ] [ 4 ] ) ;
this . $set ( this . partList1 [ i ] , 'templateList' , data . data . list [ this . partList1 . length ] [ 1 ] ) ;
}
}
@ -2622,15 +2884,9 @@ export default {
handleCodeNoChange ( value ) {
const previousValue = this . previousCodeNo ;
let flag = true
let partList = [ ]
for ( let i = 0 ; i < this . partList1 . length ; i ++ ) {
if ( ! this . partList1 [ i ] . partNo || this . partList1 [ i ] . partNo === '' ) {
flag = false
}
}
if ( flag ) {
let partList = [ ]
for ( let i = 0 ; i < this . partList1 . length ; i ++ ) {
if ( this . partList1 [ i ] . partNo && this . partList1 [ i ] . partNo !== '' && this . partList1 [ i ] . buNo && this . partList1 [ i ] . buNo === this . searchData . buNo ) {
let temp = {
site : this . $store . state . user . site ,
partNo : this . partList1 [ i ] . partNo ,
@ -2638,30 +2894,85 @@ export default {
}
partList . push ( temp )
}
batchUpdateCodeNo ( partList ) . then ( ( { data } ) => {
if ( data && data . code === 0 ) {
this . handleBatchUpdatePart ( )
this . $message ( {
message : '操作成功' ,
type : 'success' ,
duration : 1500 ,
onClose : ( ) => { }
} )
} else {
this . $set ( this . searchData , 'codeNo' , previousValue )
this . $message ( {
message : data . msg ,
type : 'error' ,
duration : 1500 ,
onClose : ( ) => { }
} )
}
batchUpdateCodeNo ( partList ) . then ( ( { data } ) => {
if ( data && data . code === 0 ) {
this . handleBatchUpdatePart ( )
this . $message ( {
message : '操作成功' ,
type : 'success' ,
duration : 1500 ,
onClose : ( ) => { }
} )
} else {
this . $set ( this . searchData , 'codeNo' , previousValue )
this . $message ( {
message : data . msg ,
type : 'error' ,
duration : 1500 ,
onClose : ( ) => { }
} )
}
} )
} ,
async changeBuOfNode ( row ) {
this . buNoQueryLoading = true
row . familyId = ''
row . productGroupId1 = ''
row . productGroupId2 = ''
row . productGroupId3 = ''
row . codeNo = ''
row . bu = this . $store . state . user . site + '_' + row . buNo
const propLists = [
[
"select family_id fieldname1, family_name caption1 from part_family where active = 'Y' and site in (select site from eam_access_site where username = '" + this . $store . state . user . name + "') and (site + '-' + bu_no) in (select (a.site + '-' + a.bu_no) from AccessBu as a left join eam_access_site as b on a.site = b.site and a.username = b.username where a.username = '" + this . $store . state . user . name + "') and site = '" + this . $store . state . user . site + "' and bu_no = '" + row . buNo + "'" ,
"select product_group_id fieldname1,product_group_name caption1 from part_product_group where active = 'Y' and type = '1' and site in (select site from eam_access_site where username = '" + this . $store . state . user . name + "') and (site + '-' + bu_no) in (select (a.site + '-' + a.bu_no) from AccessBu as a left join eam_access_site as b on a.site = b.site and a.username = b.username where a.username = '" + this . $store . state . user . name + "') and site = '" + this . $store . state . user . site + "' and bu_no = '" + row . buNo + "'" ,
"select product_group_id fieldname1,product_group_name caption1 from part_product_group where active = 'Y' and type = '2' and site in (select site from eam_access_site where username = '" + this . $store . state . user . name + "') and (site + '-' + bu_no) in (select (a.site + '-' + a.bu_no) from AccessBu as a left join eam_access_site as b on a.site = b.site and a.username = b.username where a.username = '" + this . $store . state . user . name + "') and site = '" + this . $store . state . user . site + "' and bu_no = '" + row . buNo + "'" ,
"select product_group_id fieldname1,product_group_name caption1 from part_product_group where active = 'Y' and type = '3' and site in (select site from eam_access_site where username = '" + this . $store . state . user . name + "') and (site + '-' + bu_no) in (select (a.site + '-' + a.bu_no) from AccessBu as a left join eam_access_site as b on a.site = b.site and a.username = b.username where a.username = '" + this . $store . state . user . name + "') and site = '" + this . $store . state . user . site + "' and bu_no = '" + row . buNo + "'" ,
"Select code_no as fieldname1, code_desc as caption1 from plm_properties_model_header where function_type = 'IP' and active = 'Y' and (code_no like '%%' OR code_desc like '%%' ) and site in (select site from eam_access_site where username = '" + this . $store . state . user . name + "') and (site + '-' + bu_no) in (select (a.site + '-' + a.bu_no) from AccessBu as a left join eam_access_site as b on a.site = b.site and a.username = b.username where a.username = '" + this . $store . state . user . name + "') and site = '" + this . $store . state . user . site + "' and bu_no = '" + row . buNo + "'"
]
]
await getChooselist1 ( propLists ) . then ( ( data ) => {
if ( data . data && data . data . code === 0 ) {
this . $set ( row , 'partFamilyList' , data . data . list [ 0 ] [ 0 ] )
this . $set ( row , 'partProductGroupList1' , data . data . list [ 0 ] [ 1 ] )
this . $set ( row , 'partProductGroupList2' , data . data . list [ 0 ] [ 2 ] )
this . $set ( row , 'partProductGroupList3' , data . data . list [ 0 ] [ 3 ] )
this . $set ( row , 'codeList' , data . data . list [ 0 ] [ 4 ] )
}
} )
await getTemplateList ( row ) . then ( ( { data } ) => {
if ( data && data . code === 0 ) {
this . $set ( row , 'tempList' , data . rows )
}
} )
this . buNoQueryLoading = false
} ,
chooseTemplate ( row ) {
chooseTemplate ( row ) . then ( ( { data } ) => {
if ( data && data . code === 0 ) {
Object . keys ( data . data ) . forEach ( key => {
if ( key !== 'tempNo' ) {
row [ key ] = data . data [ key ] ;
}
} ) ;
row . umId2 = data . data . umId
row . familyID = data . data . familyId
row . templateNo = data . data . bomTemplateNo
row . templateName = data . data . bomTemplateName
}
} )
} ,
getTemplateList ( ) {
for ( let i = 0 ; i < this . partList1 . length ; i ++ ) {
getTemplateList ( this . partList1 [ i ] ) . then ( ( { data } ) => {
if ( data && data . code === 0 ) {
this . partList1 [ i ] . tempList = data . rows
}
} )
} else {
this . $nextTick ( ( ) => {
this . $set ( this . searchData , 'codeNo' , previousValue )
this . $message . warning ( '请先选择所有节点的对应物料!' ) ;
} ) ;
}
} ,