@@ -1,352 +0,0 @@
< template >
< el-dialog
title = "重新盘点"
append -to -body
fullscreen
:visible.sync = "dialogVisible"
@open ="open"
@close ="close"
>
< el-card class = "box-card" shadow = "never" >
< el-form ref = "form" :inline = "true" :model = "form" :rules = "rules" size = "mini" label -width = " 80px " >
< el-form-item label = "盘点单号" prop = "check_code" >
< el-input v-model = "form.check_code" placeholder="盘点单号" disabled / >
< / el-form-item >
< el-form-item label = "盘点仓位" prop = "struct_name" >
< el-input v-model = "form.struct_name" placeholder="盘点仓位" disabled / >
< / el-form-item >
< el-form-item label = "盘点载具" prop = "storagevehicle_code" >
< el-input v-model = "form.storagevehicle_code" placeholder="盘点单号" disabled / >
< / el-form-item >
< el-form-item label = "明细数" prop = "dtl_num" >
< el-input v-model = "form.dtl_num" style="width: 200px" :disabled="true" / >
< / el-form-item >
< / el-form >
< / el-card >
< div class = "crud-opts2" >
< span class = "role-span" > 盘点明细 < / span >
< span class = "crud-opts-right2" >
<!-- 左侧插槽 -- >
< slot name = "left" / >
< el-button
slot = "left"
class = "filter-item"
type = "primary"
icon = "el-icon-plus"
size = "mini"
:disabled = "add_flag"
@click ="addrow"
>
新增一行
< / el-button >
< / span >
< / div >
<!-- 表格渲染 -- >
< el-table
ref = "table"
:data = "tableData"
style = "width: 100%;"
max -height = " 300 "
border
:highlight-current-row = "true"
:header-cell-style = "{background:'#f5f7fa',color:'#606266'}"
@ current -change = " handleCurrentChange "
>
< el-table-column type = "index" label = "序号" width = "50" align = "center" / >
< el-table-column show -overflow -tooltip prop = "storagevehicle_code" label = "载具号" / >
< el-table-column show -overflow -tooltip prop = "bucketunique" label = "桶号" width = "190" align = "center" >
< template scope = "scope" >
< el-input v-show = "isCanDel(scope.$index, scope.row,'3')" v-model="scope.row.bucketunique" disabled class="input-with-select" >
< el -button slot = "append" icon = "el-icon-search" @click ="queryBucket(scope.$index, scope.row)" / >
< / el-input >
< span v-show = "isCanDel(scope.$index, scope.row,'2')" > {{ scope.row.bucketunique }} < / span >
< / template >
< / el -table -column >
< el-table-column prop = "material_code" label = "物料编码" align = "center" / >
< el-table-column prop = "material_name" label = "物料名称" align = "center" / >
< el-table-column prop = "quality_scode" label = "品质类型" align = "center" width = "110px" >
< template slot -scope = " scope " >
< el-select
v-model = "scope.row.quality_scode"
class = "filter-item"
disabled
>
< el-option
v-for = "item in dict.ST_QUALITY_SCODE"
:key = "item.value"
:label = "item.label"
:value = "item.value"
/ >
< / el-select >
< / template >
< / el-table-column >
< el-table-column prop = "ivt_level" label = "库存等级" align = "center" width = "100px" >
< template slot -scope = " scope " >
< el-select
v-model = "scope.row.ivt_level"
class = "filter-item"
disabled
>
< el-option
v-for = "item in dict.ST_IVT_LEVEL"
:key = "item.value"
:label = "item.label"
:value = "item.value"
/ >
< / el-select >
< / template >
< / el-table-column >
< el-table-column prop = "is_active" label = "是否可用" align = "center" width = "110px" >
< template slot -scope = " scope " >
< el-select
v-model = "scope.row.is_active"
class = "filter-item"
disabled
>
< el-option
v-for = "item in dict.is_used"
:key = "item.value"
:label = "item.label"
:value = "item.value"
/ >
< / el-select >
< / template >
< / el-table-column >
< el-table-column prop = "pcsn" label = "批次" align = "center" / >
< el-table-column prop = "ivt_qty" label = "库存重量" :formatter = "crud.formatNum3" align = "center" / >
< el-table-column show -overflow -tooltip prop = "ivt_qty_ck" label = "盘点重量" width = "160" align = "center" >
< template scope = "scope" >
< el-input-number v-show = "!scope.row.edit" v-model="scope.row.ivt_qty_ck" :precision="3" :min="0" / >
< span v-show = "scope.row.edit" > {{ scope.row.ivt_qty_ck }} < / span >
< / template >
< / el -table -column >
< el-table-column prop = "qty_unit_name" label = "计量单位" align = "center" / >
< el-table-column align = "center" label = "操作" width = "160" fixed = "right" >
< template scope = "scope" >
< el-button :disabled = "scope.row.new_edit" type = "danger" class = "filter-item" size = "mini" icon = "el-icon-delete" @click.native.prevent ="deleteRow(scope.$index, tableData)" / >
< el-button v-show = "!scope.row.edit" type="primary" class="filter-item" size="mini" icon="el-icon-edit" @click="handleEdit(scope.$index, scope.row)" > 编辑 < / el -button >
< el-button v-show = "scope.row.edit" type="success" class="filter-item" size="mini" icon="el-icon-check" @click="handleEdit(scope.$index, scope.row)" > 完成 < / el -button >
< / template >
< / el-table-column >
< / el-table >
< span slot = "footer" class = "dialog-footer" >
< el-button @click ="dialogVisible = false" > 取 消 < / el -button >
< el-button type = "primary" @click ="process1" > 确认 < / el -button >
< / span >
< MaterDialog :dialog-show.sync = "materShow" @tableChanged2 ="tableChanged2" / >
< BucketDialog :dialog-show.sync = "bucketShow" @bucketChange ="tableChanged2" />
< / el -dialog >
< / template >
< script >
import CRUD , { crud } from '@crud/crud'
import check from '@/api/wms/st/inStor/check'
import BucketDialog from '@/views/wms/st/inStor/moreOrless/NewBucketDialog'
import MaterDialog from '@/views/wms/pub/MaterDialog'
export default {
name : 'ReCheckDialog' ,
components : { MaterDialog , BucketDialog } ,
mixins : [ crud ( ) ] ,
props : {
dialogShow : {
type : Boolean ,
default : false
} ,
bussConfig : {
type : Object
} ,
openParam : {
type : Object
}
} ,
dicts : [ 'check_bill_status' , 'ST_INV_TYPE_CK' , 'ST_QUALITY_SCODE' , 'ST_IVT_LEVEL' , 'is_used' ] ,
data ( ) {
return {
dialogVisible : false ,
materShow : false ,
bucketShow : false ,
add _flag : true ,
nowrow : null ,
nowindex : '' ,
form : { } ,
tableData : [ ] ,
rules : {
}
}
} ,
watch : {
dialogShow : {
handler ( newValue ) {
this . dialogVisible = newValue
}
}
} ,
methods : {
open ( ) {
check . getOutBillDis ( { 'storagevehicle_code' : this . form . storagevehicle _code } ) . then ( res => {
this . tableData = res
// 将明细变成不可编辑
for ( let i = 0 ; i < this . tableData . length ; i ++ ) {
const row = this . tableData [ i ]
row . new _edit = true
this . tableData . splice ( i , 1 , row )
}
this . form . dtl _num = this . tableData . length
} )
} ,
close ( ) {
this . $emit ( 'ReCheckChanged' )
} ,
handleCurrentChange ( current ) {
if ( current !== null ) {
this . nowrow = current
this . add _flag = false
} else {
this . nowrow = null
this . add _flag = true
}
} ,
setReForm ( row ) {
this . dialogVisible = true
this . form = row
} ,
addrow ( ) {
if ( this . nowrow === null ) {
this . crud . notify ( '请先选中一条已存在的盘点明细!' , CRUD . NOTIFICATION _TYPE . INFO )
return false
}
this . tableData . push ( { bucketunique : '' , storagevehicle _id : this . nowrow . storagevehicle _id , storagevehicle _type : this . nowrow . storagevehicle _type , storagevehicle _code : this . nowrow . storagevehicle _code , material _id : '' , material _name : '' , ivt _qty : '0' , qty _unit _id : '' , qty _unit _name : '' , pcsn : '' , quality _scode : '00' , ivt _level : '01' , is _active : '1' , ivt _qty _ck : '0' , edit : false , new _edit : false } )
this . form . dtl _num = this . tableData . length
} ,
async queryMater ( index , row ) {
this . materShow = true
this . nowindex = index
this . nowrow = row
} ,
async queryBucket ( index , row ) {
this . bucketShow = true
this . nowindex = index
this . nowrow = row
} ,
tableChanged2 ( row ) {
this . nowrow . material _code = row . material _code
this . nowrow . material _id = row . material _id
this . nowrow . material _name = row . material _name
this . nowrow . qty _unit _id = row . qty _unit _id
this . nowrow . qty _unit _name = row . qty _unit _name
this . nowrow . quality _scode = row . quality _scode
this . nowrow . is _active = row . is _active
this . nowrow . ivt _level = row . ivt _level
this . nowrow . pcsn = row . pcsn
this . nowrow . ivt _qty _ck = row . storage _qty
this . nowrow . bucketunique = row . bucketunique
this . tableData . splice ( this . nowindex , 1 , this . nowrow ) // 通过splice 替换数据 触发视图更新
} ,
isCanDel ( index , row , type ) {
if ( type === '1' ) {
if ( row . new _edit ) {
return true
} else {
if ( row . edit ) {
return true
} else {
return false
}
}
} else if ( type === '2' ) {
if ( row . new _edit ) {
return true
} else {
if ( row . edit ) {
return true
} else {
return false
}
}
} else if ( type === '3' ) {
if ( row . new _edit ) {
return false
} else {
if ( row . edit ) {
return false
} else {
return true
}
}
}
} ,
handleEdit ( index , row ) {
// 判断是否可以关闭编辑状态
if ( ! row . edit ) {
const num = parseFloat ( row . ivt _qty )
const fac _qty = parseFloat ( row . ivt _qty _ck )
if ( num <= 0 && fac _qty <= 0 ) {
this . crud . notify ( '不允许新增明细,盘点数量为0! ' , CRUD . NOTIFICATION _TYPE . INFO )
return false
}
if ( ! row . material _id ) {
this . crud . notify ( '物料不可为空!' , CRUD . NOTIFICATION _TYPE . INFO )
return false
}
if ( ! row . pcsn ) {
this . crud . notify ( '物料批次不可为空!' , CRUD . NOTIFICATION _TYPE . INFO )
return false
}
if ( ! row . bucketunique ) {
this . crud . notify ( '桶号不可为空!' , CRUD . NOTIFICATION _TYPE . INFO )
return false
}
for ( let i = 0 ; i < this . tableData . length ; i ++ ) {
if ( ( this . tableData [ i ] . bucketunique === row . bucketunique ) && ( index !== i ) ) {
this . crud . notify ( '不允许桶号同时相同!' , CRUD . NOTIFICATION _TYPE . INFO )
return false
}
}
}
row . edit = ! row . edit
this . tableData . splice ( index , 1 , row ) // 通过splice 替换数据 触发视图更新
} ,
deleteRow ( index , rows ) {
rows . splice ( index , 1 )
this . nowindex = ''
this . nowrow = null
this . form . detail _count = this . tableData . length
} ,
process1 ( ) {
if ( this . tableData . length === 0 ) {
this . crud . notify ( '请至少选择一条明细' , CRUD . NOTIFICATION _TYPE . INFO )
return false
}
for ( let i = 0 ; i < this . tableData . length ; i ++ ) {
if ( ! this . tableData [ i ] . edit ) {
this . crud . notify ( '尚有未完成编辑的物料明细序号' + ( i + 1 ) + ',请检查!' )
return false
}
}
check . process1 ( { 'row' : this . form , 'rows' : this . tableData } ) . then ( res => {
this . dialogVisible = false
} )
}
}
}
< / script >
< style >
. crud - opts2 {
padding : 0 0 ;
display : - webkit - flex ;
display : flex ;
align - items : center ;
}
. crud - opts2 . crud - opts - right2 {
margin - left : auto ;
padding : 4 px 4 px ;
}
. input - with - select {
background - color : # fff ;
}
< / style >