@ -3,7 +3,8 @@
< template # header >
< span v-text ="dialogTitle" > < / span >
< / template >
< el -form ref = "formRef" :model ="formData" :rules ="formRules" label -width = " 100px " v-loading ="formLoading" v-bind :disabled ="isShowBtnOther" >
< el -form ref = "formRef" :model ="formData" :rules ="formRules" label -width = " 100px " v -loading = " formLoading "
v - bind : disabled = "isShowBtnOther" >
<!-- 基础信息 -- >
< el -card class = "hl-card-info" >
< template # header >
@ -51,7 +52,7 @@
< / e l - c o l >
< el -col :span ="8" >
< el -row >
< el -col :span ="24" >
< el -form -item label = "单据日期" prop = "createTime" >
@ -62,7 +63,8 @@
< el -row >
< el -col :span ="24" >
< el -form -item prop = "whId" label = "出库仓库" required >
< el -select v-model ="formData.whId" placeholder="下拉选择" clearable class="!w-400px" @change="handleWh" v-bind :disabled ="btnWhClickable" >
< el -select v -model = " formData.whId " placeholder = "下拉选择" clearable class = "!w-400px" @change ="handleWh"
v - bind : disabled = "btnWhClickable" >
< el -option v -for = " dict in warehouseList " :key ="dict.id" :label ="dict.whName" :value ="dict.id" / >
< / e l - s e l e c t >
< / e l - f o r m - i t e m >
@ -95,7 +97,7 @@
v - loading = "subFormLoading" label - width = "0" >
< el -table :data ="formData.matItemDOList" class = "hl-table" >
< el -table -column prop = "cid" label = "序号" :width ="80" / >
< el -table -column prop = "matId" label = "物料名称" >
< el -table -column prop = "matId" label = "物料名称" :width ="150" >
< template # default = "scope" >
< el -form -item :prop ="`${scope.$index}.matId`" :rules ="subFormRules.matId" class = "mb-0px!" >
< el -select v -model = " scope.row.matId " placeholder = "物料编码" :remote-method ="remoteMatCodeSearch"
@ -121,10 +123,10 @@
v - if = "scope.row.matUnit ? true : false" / >
< / template >
< / e l - t a b l e - c o l u m n >
< el -table -column prop = "rgId" width = "140" label = "出库库区" required >
< el -table -column prop = "rgId" width = "140" label = "出库库区" required >
< template # default = "scope" >
< el -form -item :prop ="`${scope.$index}.rgId`" :rules ="subFormRules.rgId" class = "mb-0px!" >
< el -select v -model = " scope.row.rgId " placeholder = "" style = "width: 100%" @change ="handleRg(scope)" disabled >
< el -select v-model ="scope.row.rgId" placeholder="" style="width: 100%" @change="handleRg(scope)" >
< el -option v -for = " dict in rgList " :key ="dict.id" :label ="dict.rgName" :value ="dict.id" / >
< / e l - s e l e c t >
< / e l - f o r m - i t e m >
@ -141,7 +143,7 @@
< / template >
< / e l - t a b l e - c o l u m n >
< el -table -column prop = "matRest" label = "库存数量" / >
< el -table -column prop = " matRest " width = "120" label = "出库数量" required >
< el -table -column prop = " storageOkQty " width = "120" label = "出库数量" required >
< template # default = "scope" >
< el -input v -model = " scope.row.storageOkQty " / >
< / template >
@ -163,7 +165,8 @@
< / e l - b u t t o n >
< el -button link type = "primary" @ click = "handlefuke(scope.$index, scope.row)" > 复制 < / e l - b u t t o n > - - >
< el -button link type = "danger" size = "small" @click.prevent ="handleDelete2(scope.$index)" v -bind :disabled ="isShowBtnOther" >
< el -button link type = "danger" size = "small" @click.prevent ="handleDelete2(scope.$index)"
v - bind : disabled = "isShowBtnOther" >
删除
< / e l - b u t t o n >
< / template >
@ -465,28 +468,31 @@ const submitForm = async () => {
var matCount = 1
const onAddItem = ( ) => {
const newData = {
/ / 新 数 据 的 属 性
cid : matCount ,
stockId : 0 ,
matId : '' ,
matName : '' ,
matCode : '' ,
matType : '' ,
matSpec : '' ,
matUnit : '' ,
whId : '' ,
rgId : '' ,
pnId : '' ,
pnlist : ref ( [ ] ) ,
storageOkQty : '' ,
lotNo : '' ,
description : '' ,
productBomItemValueDOList : [ ]
if ( formData . value . whId ) {
const newData = {
/ / 新 数 据 的 属 性
cid : matCount ,
stockId : 0 ,
matId : '' ,
matName : '' ,
matCode : '' ,
matType : '' ,
matSpec : '' ,
matUnit : '' ,
whId : '' ,
rgId : '' ,
pnId : '' ,
pnlist : ref ( [ ] ) ,
storageOkQty : '' ,
lotNo : '' ,
description : '' ,
productBomItemValueDOList : [ ]
}
matCount = matCount + 1
formData . value . matItemDOList . push ( newData )
} else {
message . alertWarning ( '清选择出库仓库' )
}
matCount = matCount + 1
formData . value . matItemDOList . push ( newData )
}
/ / 删 除 新 增 物 料 信 息
@ -550,7 +556,7 @@ const remoteMatCodeSearch = async (name) => {
const dataMat = await MaterialApi . getMaterialPage ( matParams )
matList . value = [ ]
matList . value = dataMat . list . filter ( ( item ) => matLastRemoteData . find ( ( fish ) => fish . matId === item . id ) !== undefined )
matList . value = dataMat . list . filter ( ( item ) => matLastRemoteData . find ( ( fish ) => fish . matId === item . id ) !== undefined )
matSelectLoading . value = false
}
@ -558,20 +564,28 @@ const remoteMatCodeSearch = async (name) => {
const handleMatCode = async ( scope , matid ) => {
if ( matid ) {
const matVo = await MaterialApi . getMaterial ( scope . row . matI d)
scope . row . matId = matVo . i d
scope . row . matName = matVo . n ame
scope . row . matCode = matVo . c ode
scope . row . matSpec = matVo . s pec
const matVo = matLastData. value . find ( ( item ) => item . matId === mati d)
scope . row . matId = matVo . matI d
scope . row . matName = matVo . matN ame
scope . row . matCode = matVo . matC ode
scope . row . matSpec = matVo . matS pec
scope . row . matType = matVo . materialType
scope . row . matUnit = matVo . unit
scope . row . matUnit = matVo . matUnit
scope . row . rgId = matVo . rgId
scope . row . pnId = matVo . pnId
scope . row . matRest = matVo . matRest
scope . row . lotNo = matVo . lotNo
const queryParamsRPn = reactive ( {
pageNo : 1 ,
pageSize : 99 ,
rgId : scope . row . rgId ,
pnStatus : 1
} )
const dataPn = await PnApi . getPnPage ( queryParamsRPn )
scope . row . pnlist = dataPn . list
} else {
scope . row . matId = ''
scope . row . matCode = ''
scope . row . matName = ''
scope . row . matSpec = ''
scope . row . matType = ''
scope . row . matUnit = ''
scope . row = matLastData . value . find ( ( item ) => item . matId === matid )
}
}
@ -579,12 +593,13 @@ const isShowBtnGroup = ref(true)
const isShowBtnCancel = ref ( false )
const isShowBtnOther = ref ( false )
const btnWhClickable = ref ( false )
const matLastData = ref ( [ ] )
/** 初始化 **/
onMounted ( async ( ) => {
btnWhClickable . value = query . type === 'update' ? true : false
btnWhClickable . value = query . type === 'update' ? true : false
const matLastData = await StorageMatApi . getStorageMatList ( )
matLastData . value = await StorageMatApi . getStorageMatList ( )
/ / 获 得 物 料 列 表
let matParams = {
@ -626,10 +641,10 @@ onMounted(async () => {
break
}
/ / 查 看 页 面 不 可 以 编 辑
if ( query . type === 'review' ) {
isShowBtnGroup . value = false ;
isShowBtnCancel . value = false ;
isShowBtnOther . value = true ;
if ( query . type === 'review' ) {
isShowBtnGroup . value = false ;
isShowBtnCancel . value = false ;
isShowBtnOther . value = true ;
}
/ / 获 得 库 区 列 表
@ -671,15 +686,21 @@ onMounted(async () => {
const matVos = await MaterialApi . getMaterialPage ( queryParamsMat2 )
formData . value . matItemDOList . forEach ( item => {
item . cid = matCount
item . matId = matVos . list . find ( ( record ) => record . id === item . matId ) ? . id
/ / i t e m . m a t C o d e = m a t V o s . l i s t . f i n d ( ( r e c o r d ) = > r e c o r d . i d = = = i t e m . m a t I d ) ? . i d
item . matCode = matVos . list . find ( ( record ) => record . id === item . matId ) ? . code
item . matSpec = matVos . list . find ( ( record ) => record . id === item . matId ) ? . spec
item . matType = matVos . list . find ( ( record ) => record . id === item . matId ) ? . materialType
item . matUnit = matVos . list . find ( ( record ) => record . id === item . matId ) ? . unit
/ / i t e m . c i d = m a t C o u n t
/ / i t e m . m a t I d = m a t V o s . l i s t . f i n d ( ( r e c o r d ) = > r e c o r d . i d = = = i t e m . m a t I d ) ? . i d
/ / / / i t e m . m a t C o d e = m a t V o s . l i s t . f i n d ( ( r e c o r d ) = > r e c o r d . i d = = = i t e m . m a t I d ) ? . i d
/ / i t e m . m a t C o d e = m a t V o s . l i s t . f i n d ( ( r e c o r d ) = > r e c o r d . i d = = = i t e m . m a t I d ) ? . c o d e
/ / i t e m . m a t S p e c = m a t V o s . l i s t . f i n d ( ( r e c o r d ) = > r e c o r d . i d = = = i t e m . m a t I d ) ? . s p e c
/ / i t e m . m a t T y p e = m a t V o s . l i s t . f i n d ( ( r e c o r d ) = > r e c o r d . i d = = = i t e m . m a t I d ) ? . m a t e r i a l T y p e
/ / i t e m . m a t U n i t = m a t V o s . l i s t . f i n d ( ( r e c o r d ) = > r e c o r d . i d = = = i t e m . m a t I d ) ? . u n i t
/ / i t e m . p n l i s t = p n L i s t . v a l u e . f i l t e r ( ( p n ) = > p n . r g I d = = = i t e m . r g I d )
/ / i t e m . m a t R e s t = m a t L a s t D a t a . v a l u e . f i n d ( ( r e s t ) = > r e s t . r g I d = = = i t e m . r g I d & & r e s t . p n I d = = = i t e m . p n I d ) ? . m a t R e s t
/ / m a t C o u n t = m a t C o u n t + 1
item = matLastData . value . find ( ( rest ) => rest . rgId === item . rgId && rest . pnId === item . pnId )
item . pnlist = pnList . value . filter ( ( pn ) => pn . rgId === item . rgId )
item . matRest = matLastData . find ( ( rest ) => rest . rgId === item . rgId && rest . pnId === item . pnId ) ? . matRest
item . cid = matCoun t
matCount = matCount + 1
} )