@ -1,8 +1,5 @@
< template >
< template >
< div class = "app-container" >
< div class = "app-container" >
< el -form ref = "form" :model ="form" label -width = " 110px " >
< el -form ref = "form" :model ="form" label -width = " 110px " >
< el -row >
< el -row >
< el -col :span ="12" >
< el -col :span ="12" >
@ -17,8 +14,6 @@
< / e l - c o l >
< / e l - c o l >
< / e l - r o w >
< / e l - r o w >
< el -row >
< el -row >
< el -col :span ="12" >
< el -col :span ="12" >
< el -form -item label = "物料编码" prop = "materialCode" >
< el -form -item label = "物料编码" prop = "materialCode" >
@ -32,6 +27,19 @@
< / e l - c o l >
< / e l - c o l >
< / e l - r o w >
< / e l - r o w >
< el -row >
< el -col :span ="12" >
< el -form -item label = "物料规格" prop = "materialSpec" >
< el -input v -model = " form.materialSpec " disabled / >
< / e l - f o r m - i t e m >
< / e l - c o l >
< el -col :span ="12" >
< el -form -item label = "规格参数" prop = "specificationParameter" >
< el -input v -model = " form.specificationParameter " disabled / >
< / e l - f o r m - i t e m >
< / e l - c o l >
< / e l - r o w >
< el -row >
< el -row >
< el -col :span ="12" >
< el -col :span ="12" >
< el -form -item label = "审核日期" prop = "approveDate" >
< el -form -item label = "审核日期" prop = "approveDate" >
@ -50,7 +58,7 @@
< el -col :span ="12" >
< el -col :span ="12" >
< el -form -item label = "订单状态" prop = "orderStatus" >
< el -form -item label = "订单状态" prop = "orderStatus" >
< template slot -scope = " scope " >
< template slot -scope = " scope " >
< dict -tag :options ="dict.type. order_status" :value ="form.orderStatus" / >
< dict -tag :options ="dict.type. mes_purchase_ order_status" :value ="form.orderStatus" / >
< / template >
< / template >
< / e l - f o r m - i t e m >
< / e l - f o r m - i t e m >
< / e l - c o l >
< / e l - c o l >
@ -91,7 +99,8 @@
< el -table -column label = "序号" align = "center" prop = "index" width = "50" / >
< el -table -column label = "序号" align = "center" prop = "index" width = "50" / >
< el -table -column label = "安全库存标识" prop = "safeFlag" width = "150" >
< el -table -column label = "安全库存标识" prop = "safeFlag" width = "150" >
< template slot -scope = " scope " >
< template slot -scope = " scope " >
< el -radio -group v-model ="scope.row.safeFlag" @input="changeSafeFlag(scope.row)" >
< el -radio -group v -model = " scope.row.safeFlag " @input ="changeSafeFlag(scope.row)"
: disabled = "scope.row.orderBindId" >
< el -radio
< el -radio
v - for = "dict in dict.type.mes_safe_flag"
v - for = "dict in dict.type.mes_safe_flag"
: key = "dict.value"
: key = "dict.value"
@ -104,19 +113,17 @@
< el -table -column label = "销售订单" prop = "saleOrderCode" >
< el -table -column label = "销售订单" prop = "saleOrderCode" >
< template slot -scope = " scope " >
< template slot -scope = " scope " >
< el -input v -model = " scope.row.saleOrderCode " placeholder = "请点击右侧选择销售订单" readonly >
< el -input v -model = " scope.row.saleOrderCode " placeholder = "请点击右侧选择销售订单" readonly >
< el -button slot = "append" icon = "el-icon-search" @click ="handleSaleOrderAdd(scope.row)" > < / el -button >
< el -button slot = "append" icon = "el-icon-search"
v - if = "!scope.row.orderBindId && scope.row.safeFlag=== SAFE_FLAG.NO"
@ click = "handleSaleOrderAdd(scope.row)" > < / e l - b u t t o n >
< / e l - i n p u t >
< / e l - i n p u t >
< / template >
< / template >
< / e l - t a b l e - c o l u m n >
< / e l - t a b l e - c o l u m n >
< el -table -column label = "成品编码" prop = "productCode" width = "150" >
< el -table -column label = "成品编码" prop = "productCode" width = "150" >
< template slot -scope = " scope " >
< el -input v -model = " scope.row.productCode " readonly / >
< / template >
< / e l - t a b l e - c o l u m n >
< / e l - t a b l e - c o l u m n >
< el -table -column label = "成品名称" prop = "productName" width = "150" >
< el -table -column label = "成品名称" prop = "productName" width = "150" >
< template slot -scope = " scope " >
< / e l - t a b l e - c o l u m n >
< el -input v -model = " scope.row.productName " readonly / >
< el -table -column label = "成品规格" prop = "productSpec" width = "150" >
< / template >
< / e l - t a b l e - c o l u m n >
< / e l - t a b l e - c o l u m n >
< el -table -column label = "绑定数量" prop = "bindAmount" width = "260" >
< el -table -column label = "绑定数量" prop = "bindAmount" width = "260" >
< template slot -scope = " scope " >
< template slot -scope = " scope " >
@ -124,6 +131,8 @@
< / e l - i n p u t - n u m b e r >
< / e l - i n p u t - n u m b e r >
< / template >
< / template >
< / e l - t a b l e - c o l u m n >
< / e l - t a b l e - c o l u m n >
< el -table -column label = "条码数量" prop = "barcodeAmount" width = "150" >
< / e l - t a b l e - c o l u m n >
< / e l - t a b l e >
< / e l - t a b l e >
< / e l - f o r m >
< / e l - f o r m >
< div slot = "footer" class = "dialog-footer" >
< div slot = "footer" class = "dialog-footer" >
@ -146,7 +155,7 @@
< / template >
< / template >
< script >
< script >
import { getPurchaseOrder , bindOrder } from "@/api/mes/purchaseOrder" ;
import { getPurchaseOrder , bindOrder , deleteOrderBind } from "@/api/mes/purchaseOrder" ;
import selectSaleOrder from '@//views/mes/purchaseOrder/selectSaleOrder.vue' ;
import selectSaleOrder from '@//views/mes/purchaseOrder/selectSaleOrder.vue' ;
@ -163,6 +172,7 @@ export default {
loading : true ,
loading : true ,
/ / 选 中 数 组
/ / 选 中 数 组
ids : [ ] ,
ids : [ ] ,
indexes : [ ] ,
/ / 子 表 选 中 数 据
/ / 子 表 选 中 数 据
checkedMesOrderBind : [ ] ,
checkedMesOrderBind : [ ] ,
/ / 非 单 个 禁 用
/ / 非 单 个 禁 用
@ -226,26 +236,80 @@ export default {
] ,
] ,
} ,
} ,
saleOrderOpen : false
saleOrderOpen : false ,
SAFE _FLAG : {
YES : '1' ,
NO : '0'
}
} ;
} ;
} ,
} ,
created ( ) {
activated ( ) {
this . getPurchaseOrder ( ) ;
} ,
methods : {
getPurchaseOrder ( ) {
const purchaseOrderId = this . $route . params && this . $route . params . purchaseOrderId ;
const purchaseOrderId = this . $route . params && this . $route . params . purchaseOrderId ;
const materialSpec = this . $route . params && this . $route . params . materialSpec ;
getPurchaseOrder ( purchaseOrderId ) . then ( response => {
getPurchaseOrder ( purchaseOrderId ) . then ( response => {
this . form = response . data ;
this . form = response . data ;
this . form . materialSpec = materialSpec ;
this . mesOrderBindList = response . data . mesOrderBindList ;
this . mesOrderBindList = response . data . mesOrderBindList ;
} ) ;
} ) ;
} ,
isPositiveInteger ( value ) {
/ / 使 用 正 则 表 达 式 匹 配 正 整 数
return /^[0-9]\d*$/ . test ( value ) ;
} ,
} ,
methods : {
/** 提交按钮 */
/** 提交按钮 */
submitForm ( ) {
submitForm ( ) {
this . loading = true ;
this . loading = true ;
let totalBindAmount = 0 ;
for ( let i = 0 ; i < this . mesOrderBindList . length ; i ++ ) {
let mob = this . mesOrderBindList [ i ] ;
let bindAmount = mob . bindAmount ? parseInt ( mob . bindAmount ) : 0 ;
let barcodeAmount = mob . barcodeAmount ? parseInt ( mob . barcodeAmount ) : 0 ;
if ( ! mob . safeFlag ) {
this . $modal . msgError ( "序号为" + ( i + 1 ) + ",请选择安全标识" ) ;
return ;
}
if ( mob . safeFlag === this . SAFE _FLAG . NO && ! mob . saleOrderId ) {
this . $modal . msgError ( "序号为" + ( i + 1 ) + ",请选择销售订单" ) ;
return ;
}
if ( ! this . isPositiveInteger ( bindAmount ) || bindAmount <= 0 ) {
this . $modal . msgError ( "序号为" + ( i + 1 ) + ",绑定数量须为大于等于0的正整数! " ) ;
return ;
}
if ( bindAmount < barcodeAmount ) {
this . $modal . msgError ( "序号为" + ( i + 1 ) + ",绑定数量不能小于条码数量" ) ;
return ;
}
totalBindAmount = totalBindAmount + bindAmount ;
}
if ( totalBindAmount > this . form . orderAmount ) {
this . $modal . msgError ( "现总绑定数量为" + totalBindAmount + ",不能大于订单计划数量" + this . form . orderAmount ) ;
return ;
}
this . form . mesOrderBindList = this . mesOrderBindList ;
this . form . mesOrderBindList = this . mesOrderBindList ;
if ( this . form . purchaseOrderId != null ) {
if ( this . form . purchaseOrderId != null ) {
bindOrder ( this . form ) . then ( response => {
bindOrder ( this . form ) . then ( response => {
this . $modal . msgSuccess ( "绑定成功" ) ;
this . $modal . msgSuccess ( "绑定成功" ) ;
this . close ( ) ;
this . close ( ) ;
} ) . catch ( error => {
this . getPurchaseOrder ( ) ;
} ) ;
} ) ;
}
}
@ -266,24 +330,40 @@ export default {
obj . productCode = "" ;
obj . productCode = "" ;
obj . productName = "" ;
obj . productName = "" ;
obj . bindAmount = "" ;
obj . bindAmount = "" ;
obj . barcodeAmount = 0 ;
obj . remark = "" ;
obj . remark = "" ;
this . mesOrderBindList . push ( obj ) ;
this . mesOrderBindList . push ( obj ) ;
} ,
} ,
/** 采购销售订单绑定信息;销售订单绑定采购订单明细信息删除按钮操作 */
/** 采购销售订单绑定信息;销售订单绑定采购订单明细信息删除按钮操作 */
handleDeleteMesOrderBind ( ) {
handleDeleteMesOrderBind ( ) {
if ( this . checkedMesOrderBind . length == 0 ) {
if ( this . checkedMesOrderBind . length == = 0 ) {
this . $modal . msgError ( "请先选择要删除的采购订单绑定信息" ) ;
this . $modal . msgError ( "请先选择要删除的采购订单绑定信息" ) ;
} else {
} else {
let ids = this . ids ;
ids = ids . filter ( item => item != null && item !== '' )
this . $modal . confirm ( '是否确认删除序号为"' + this . indexes + '"的数据项?' ) . then ( function ( ) {
if ( ids . length > 0 ) {
return deleteOrderBind ( ids ) ;
}
} ) . then ( ( ) => {
this . $modal . msgSuccess ( "删除成功" ) ;
const mesOrderBindList = this . mesOrderBindList ;
const mesOrderBindList = this . mesOrderBindList ;
const checkedMesOrderBind = this . checkedMesOrderBind ;
const checkedMesOrderBind = this . checkedMesOrderBind ;
this . mesOrderBindList = mesOrderBindList . filter ( function ( item ) {
this . mesOrderBindList = mesOrderBindList . filter ( function ( item ) {
return checkedMesOrderBind . indexOf ( item . index ) == - 1
return checkedMesOrderBind . indexOf ( item . index ) == - 1
} ) ;
} ) ;
} ) . catch ( ( ) => {
} ) ;
}
}
} ,
} ,
/** 复选框选中数据 */
/** 复选框选中数据 */
handleMesOrderBindSelectionChange ( selection ) {
handleMesOrderBindSelectionChange ( selection ) {
this . checkedMesOrderBind = selection . map ( item => item . index )
this . checkedMesOrderBind = selection . map ( item => item . index )
this . ids = selection . map ( item => item . orderBindId )
this . indexes = selection . map ( item => item . index )
} ,
} ,
@ -296,17 +376,40 @@ export default {
/** 提交选择销售订单信息按钮 */
/** 提交选择销售订单信息按钮 */
submitSaleOrderForm ( ) {
submitSaleOrderForm ( ) {
let selectedRow = this . $refs . saleOrderRef . selectedRow ;
let selectedRow = this . $refs . saleOrderRef . selectedRow ;
let filteredWithIndex = this . mesOrderBindList
. filter ( item => item . saleOrderId === selectedRow . saleOrderId )
. map ( ( item , newIndex ) => ( { value : item , originalIndex : this . mesOrderBindList . indexOf ( item ) } ) ) ; / / 映 射 为 包 含 值 和 原 索 引 的 对 象
/ / l e t s a m e S a l e O r d e r = t h i s . m e s O r d e r B i n d L i s t . f i l t e r ( i t e m = > i t e m . s a l e O r d e r I d = = = s e l e c t e d R o w . s a l e O r d e r I d )
if ( filteredWithIndex && filteredWithIndex . length > 0 ) {
this . $modal . msgError ( "序号为" + ( filteredWithIndex [ 0 ] . originalIndex + 1 ) + "已经选择此销售订单" ) ;
return ;
}
this . editedRow . saleOrderId = selectedRow . saleOrderId ;
this . editedRow . saleOrderId = selectedRow . saleOrderId ;
this . editedRow . saleOrderCode = selectedRow . saleorderCode ;
this . editedRow . saleOrderCode = selectedRow . saleorderCode ;
this . editedRow . productCode = selectedRow . materialCode ;
this . editedRow . productCode = selectedRow . materialCode ;
this . editedRow . productName = selectedRow . materialName ;
this . editedRow . productName = selectedRow . materialName ;
this . editedRow . productId = selectedRow . materialId ;
this . editedRow . productId = selectedRow . erpM aterialId;
this . saleOrderOpen = false ;
this . saleOrderOpen = false ;
} ,
} ,
changeSafeFlag ( row ) {
changeSafeFlag ( row ) {
if ( row . safeFlag == "1" ) {
if ( row . safeFlag === this . SAFE _FLAG . YES ) {
let filteredWithIndex = this . mesOrderBindList
. filter ( item => item . safeFlag === this . SAFE _FLAG . YES && item . index !== row . index )
. map ( ( item , newIndex ) => ( { value : item , originalIndex : this . mesOrderBindList . indexOf ( item ) } ) ) ; / / 映 射 为 包 含 值 和 原 索 引 的 对 象
/ / l e t s a m e S a l e O r d e r = t h i s . m e s O r d e r B i n d L i s t . f i l t e r ( i t e m = > i t e m . s a l e O r d e r I d = = = s e l e c t e d R o w . s a l e O r d e r I d )
if ( filteredWithIndex && filteredWithIndex . length > 0 ) {
row . safeFlag = this . SAFE _FLAG . NO ;
this . $modal . msgError ( "序号为" + ( filteredWithIndex [ 0 ] . originalIndex + 1 ) + "已经选择安全库存" ) ;
return ;
}
row . saleOrderId = "" ;
row . saleOrderId = "" ;
row . saleOrderCode = "" ;
row . saleOrderCode = "" ;
row . productCode = "" ;
row . productCode = "" ;