@ -1,6 +1,7 @@
< template >
< lay -container fluid = "true" class = "content-box" >
< FormulaView :teamId ="dataInfoObj.FTeamID" :dataInfoObj ="dataInfoObj" :halfId ="dataInfoObj.FMaterialHalfIDs" > < / FormulaView >
< FormulaView :teamId ="dataInfoObj.FTeamID" :dataInfoObj ="dataInfoObj" :halfId ="dataInfoObj.FMaterialHalfIDs" >
< / FormulaView >
< lay -layer area = "90%" v-model ="showFreezingColumnSettingBox" title="固定列设置" :end ="closeFreezingSetting" >
< FreezingColumnSetting v -if = " showFreezingColumnSettingBox " :columns ="originalColumns"
: freezingColumns = "freezingColumnSetting" @ cancelClick = "setFreezingColumnsSetting" > < / FreezingColumnSetting >
@ -92,6 +93,9 @@
import {
ref
} from 'vue' ;
import {
GetMaterialById
} from "/src/api/api/material" ;
import {
getListByHalfMaterialTeamId ,
updateBatchById4
@ -133,6 +137,7 @@ export default {
[ ] ,
[ ]
] ) ;
const cellStyle = function ( row , column , rowIndex , columnIndex ) {
let back = column . table == "TFS_ViewMaterial" ? "background:rgb(246, 246, 246)" : "" ;
let info = row [ "info" ] ;
@ -140,19 +145,23 @@ export default {
if ( typeof ( document . getElementsByClassName ( column . key + "_" + rowIndex + "_" + columnIndex ) [ 0 ] ) != "undefined" ) {
switch ( info [ column . key + "Type" ] ) {
case "1" :
return document . getElementsByClassName ( column . key + "_" + rowIndex + "_" + columnIndex ) [ 0 ] . classList . add ( "one" ) ;
document . getElementsByClassName ( column . key + "_" + rowIndex + "_" + columnIndex ) [ 0 ] . classList . add ( "one" ) ;
return back ;
case "2" :
return document . getElementsByClassName ( column . key + "_" + rowIndex + "_" + columnIndex ) [ 0 ] . classList . add ( "twe" ) ;
document . getElementsByClassName ( column . key + "_" + rowIndex + "_" + columnIndex ) [ 0 ] . classList . add ( "twe" ) ;
return back ;
case "3" :
return document . getElementsByClassName ( column . key + "_" + rowIndex + "_" + columnIndex ) [ 0 ] . classList . add ( "three" ) ;
document . getElementsByClassName ( column . key + "_" + rowIndex + "_" + columnIndex ) [ 0 ] . classList . add ( "three" ) ;
return back ;
case "4" :
return document . getElementsByClassName ( column . key + "_" + rowIndex + "_" + columnIndex ) [ 0 ] . classList . add ( "four" ) ;
document . getElementsByClassName ( column . key + "_" + rowIndex + "_" + columnIndex ) [ 0 ] . classList . add ( "four" ) ;
return back ;
default :
document . getElementsByClassName ( column . key + "_" + rowIndex + "_" + columnIndex ) [ 0 ] . classList . remove ( "one" ) ;
document . getElementsByClassName ( column . key + "_" + rowIndex + "_" + columnIndex ) [ 0 ] . classList . remove ( "twe" ) ;
document . getElementsByClassName ( column . key + "_" + rowIndex + "_" + columnIndex ) [ 0 ] . classList . remove ( "three" ) ;
document . getElementsByClassName ( column . key + "_" + rowIndex + "_" + columnIndex ) [ 0 ] . classList . remove ( "four" )
return "" ;
return back ;
}
}
@ -217,14 +226,14 @@ export default {
this . userPower [ 0 ] = ( await getBasicRoleList ( {
FRoleType : 84 ,
FViewType : this . dataInfoObj . FViewType ,
TeamId : this . dataInfoObj . FTeamID ,
Type : 2
TeamId : this . dataInfoObj . FTeamID ,
Type : 2
} ) || [ ] ) . map ( it => parseInt ( it . F2 ) )
this . userPower [ 1 ] = ( await getBasicRoleList ( {
FRoleType : 44 ,
FViewType : this . dataInfoObj . FViewType ,
TeamId : this . dataInfoObj . FTeamID ,
Type : 2
TeamId : this . dataInfoObj . FTeamID ,
Type : 2
} ) || [ ] ) . map ( it => parseInt ( it . F2 ) )
}
this . initPage ( layer . load ( 2 ) ) ;
@ -241,8 +250,14 @@ export default {
let freezingCols = await GetFreezingColumns ( ) ;
console . log ( '_data' , _data ) ;
if ( this . dataInfoObj . FViewType == 1 || this . dataInfoObj . FViewType == 10 ) {
this . inputCodeValue = _data . rows [ 0 ] ? _data . rows [ 0 ] . HalfCode : "" ;
this . inputDescValue = _data . rows [ 0 ] ? _data . rows [ 0 ] . HalfDesc : "" ;
let dataResult = await GetMaterialById ( {
ID : this . dataInfoObj . FMaterialHalfIDs
} )
if ( dataResult ) {
this . inputCodeValue = dataResult . Data . FCode ;
this . inputDescValue = dataResult . Data . FName ;
}
this . isShow = true ;
} else if ( this . dataInfoObj . FViewType == 2 || this . dataInfoObj . FViewType == 3 || this . dataInfoObj . FViewType == 4 ) {
this . isBomShow = true ;
@ -335,26 +350,39 @@ export default {
this . editColumn = editColumn ;
let $this = this ;
this . dataList = _data . rows . map ( function ( item ) {
item [ "info" ] = $this . materialInfoList . Data . find ( s => s . FDataID == item . FTypeID2 ) ;
let fType1 = $this . typeList [ 0 ] . find ( ( t ) => {
if ( item . FTypeID1 ) {
return t . FID == item . FTypeID1
}
} ) ;
let fType2 = $this . typeList [ 1 ] . find ( ( t ) => {
if ( item . FTypeID2 ) {
return t . FID == item . FTypeID2
}
} )
if ( $this . dataInfoObj . FCanEdit == 2 ) {
let fType1 = $this . typeList [ 0 ] . find ( ( t ) => {
if ( item . FTypeID1 ) {
return t . FID == item . FTypeID1
}
} ) ;
item . FTypeID1 = fType1 ? fType1 . FName : item . FTypeID1 ;
item . FTypeID2 = fType2 ? fType2 . FName : item . FTypeID2 ;
}
else {
let fType2 = $this . typeList [ 1 ] . find ( ( t ) => {
if ( item . FTypeID2 ) {
return t . FID == item . FTypeID2
}
let isFTypeID1 = $this . editColumn . find ( ( t ) => {
return t . key == "FTypeID1" ;
} )
let isFTypeID2 = $this . editColumn . find ( ( t ) => {
return t . key == "FTypeID2" ;
} )
item . FTypeID1 = fType1 ? fType1 . FName : item . FTypeID1 ;
item . FTypeID2 = fType2 ? fType2 . FName : item . FTypeID2 ;
if ( ! isFTypeID1 && ! isFTypeID2 ) {
item . FTypeID1 = fType1 ? fType1 . FName : item . FTypeID1 ;
item . FTypeID2 = fType2 ? fType2 . FName : item . FTypeID2 ;
}
}
item [ "info" ] = $this . materialInfoList . Data . find ( s => s . FDataID == item . FTypeID2 ) ;
return item ;
} ) ;
@ -406,13 +434,7 @@ export default {
"FType" : 1
} ) || null ;
if ( result != null && result . FID ) {
let col7 = this . dataColumn . filter ( s => s . fieldType == 7 ) || [ ] ;
console . log ( 'this.typeList[0]' , this . typeList [ 0 ] . filter ( t => t . FValue == data . FTypeID1 ) [ 0 ] ) ;
col7 . forEach ( ( item ) => {
if ( item . table == "TFS_MaterialInfo" ) {
data [ item . key ] = result [ item . key ] || data [ item . key ] || "" ;
}
} ) ;
console . log ( 'data.FTypeID1' , data . FTypeID1 ) ;
let type1 = this . typeList [ 0 ] . filter ( t => t . FValue == data . FTypeID1 ) [ 0 ] ;
@ -437,19 +459,15 @@ export default {
if ( typeName . indexOf ( "成品" ) > 0 ) {
data . FViewType = 1
}
let $this = this ;
this . dataList . map ( function ( item ) {
if ( item . FID == data . FID )
{
item . info = $this . materialInfoList . Data . find ( s => s . FDataID == data . FTypeID2 ) ;
}
return item ;
} )
data [ "info" ] = this . materialInfoList . Data . find ( s => s . FDataID == data . FTypeID2 ) ;
this . dataColumn . map ( function ( item ) {
this . dataColumn . forEach ( ( item ) => {
if ( item . key != "FTypeID1" && item . key != "FTypeID2" && result [ item . key ] ) {
data [ item . key ] = result [ item . key ]
}
/ / d a t a [ i t e m . k e y ] = r e s u l t [ i t e m . k e y ] | | d a t a [ i t e m . k e y ] | | " " ;
} ) ;
return item [ "cellClass" ] = "" ;
} )
}
}
}
@ -460,17 +478,17 @@ export default {
LogList : [ ] ,
FTeamID : this . dataInfoObj [ 'FTeamID' ] ,
FViewType : this . dataInfoObj . FViewType ,
FType : this . dataInfoObj . FType
FType : this . dataInfoObj . FType
} ;
let saveId = this . dataInfoObj . FViewType + "_" + this . dataInfoObj . FID ;
let cacheDataList = JSON . parse ( localStorage . getItem ( 'EditView' + saveId ) ) ;
console . log ( 'cacheDataList' , cacheDataList ) ;
let allTypeSelected = true ;
let allTypeSelected = true ;
this . dataList . forEach ( ( row , index ) => {
let cache = cacheDataList [ index ] ;
let dataObj = { } ;
if ( row [ "FTypeID1" ] == - 1 || row [ "FTypeID2" ] == - 1 || row [ "FTypeID1" ] == '' || row [ "FTypeID2" ] == '' ) {
layer . msg ( "请先为所有物料选择分类" , { icon : 2 , time : 1000 } ) ;
if ( row [ "FTypeID1" ] == - 1 || row [ "FTypeID2" ] == - 1 || row [ "FTypeID1" ] == '' || row [ "FTypeID2" ] == '' ) {
layer . msg ( "请先为所有物料选择分类" , { icon : 2 , time : 1000 } ) ;
layer . close ( idx ) ;
allTypeSelected = false ;
return
@ -512,31 +530,30 @@ export default {
updateObj [ key ] . push ( dataObj [ key ] ) ;
}
} ) ;
if ( ! allTypeSelected )
{
if ( ! allTypeSelected ) {
return false ;
}
let updateLog = updateObj . LogList . join ( "、" ) ;
delete updateObj . LogList
/ / 发 送 保 存 请 求
console . log ( 'updateObj' , updateObj ) ;
let _result = await updateBatchById4 ( updateObj ) ;
if ( _result . Code === 200 ) {
await commonSave ( {
teamId : updateObj . FTeamID ,
type : this . dataInfoObj [ 'FType' ] ,
desc : updateLog
} , "OperateLog" ) ;
let $this = this ;
/ / $ t h i s . i n i t P a g e ( ) ;
localStorage . setItem ( 'EditView' + saveId , JSON . stringify ( this . dataList ) ) ;
setTimeout ( function ( ) {
layer . close ( idx ) ;
layer . msg ( '保存成功' ) ;
$this . $emit ( 'cancelClick' , true , false ) ;
$this . $refs . OperateLog . _getPageList ( ) ;
} , 500 ) ;
}
/ / 发 送 保 存 请 求
console . log ( 'updateObj' , updateObj ) ;
let _result = await updateBatchById4 ( updateObj ) ;
if ( _result . Code === 200 ) {
await commonSave ( {
teamId : updateObj . FTeamID ,
type : this . dataInfoObj [ 'FType' ] ,
desc : updateLog
} , "OperateLog" ) ;
let $this = this ;
/ / $ t h i s . i n i t P a g e ( ) ;
localStorage . setItem ( 'EditView' + saveId , JSON . stringify ( this . dataList ) ) ;
setTimeout ( function ( ) {
layer . close ( idx ) ;
layer . msg ( '保存成功' ) ;
$this . $emit ( 'cancelClick' , true , false ) ;
$this . $refs . OperateLog . _getPageList ( ) ;
} , 500 ) ;
}
} ,
_clickFreezingColumnSetting ( ) {
this . dataColumn = ref ( [ ] ) ;