@ -1,17 +1,30 @@
< script >
import { getSiteAndBuByUserName } from "../../../api/qc/qc" ;
import { queryQuoteDetailReport } from "../../../api/quote/quoteDetail" ;
import { queryQuoteDetailById , queryQuoteDetail Report , updateQuoteDetail } from "../../../api/quote/quoteDetail" ;
import { getItemListByInquiryPartAndCodeNo } from "../../../api/inquiry/inquiryDetail" ;
import BreakdownCost from "./detail/breakdownCost.vue" ;
import BuSelect from "../../../components/selector/select/BuSelect.vue" ;
import { queryPropertyTemplate } from "../../../api/property/template" ;
import { queryPropertyTemplateDetailAvailableList } from "../../../api/property/templateDetail" ;
import { againQuote } from "../../../api/quote/quote" ;
import QuoteDetailTool from "./detail/primary/quoteDetailTool.vue" ;
import QuoteDetailBom from "./detail/primary/quoteDetailBom.vue" ;
import QuoteDetailOther from "./detail/primary/quoteDetailOther.vue" ;
import QuoteDetailCost from "./detail/primary/quoteDetailCost.vue" ;
import QuoteDetailRouting from "./detail/primary/quoteDetailRouting.vue" ;
export default {
name : "quoteDetailReport" ,
components : { BuSelect , BreakdownCost } ,
components : {
QuoteDetailRouting ,
QuoteDetailCost ,
QuoteDetailOther ,
QuoteDetailBom ,
QuoteDetailTool ,
BuSelect ,
BreakdownCost
} ,
props : {
height : {
type : [ String , Number ] ,
@ -263,6 +276,15 @@ export default {
codeDesc : '' ,
} ,
propertyItemList : [ ] ,
saveQuoteDetailRules : {
partNo : [ { required : true , message : '请输入物料编码' , trigger : [ 'blur' , 'change' ] } ] ,
partDesc : [ { required : true , message : '请输入物料名称' , trigger : [ 'blur' , 'change' ] } ] ,
qty : [ { required : true , message : '请输入数量' , trigger : [ 'blur' , 'change' ] } ] ,
} ,
quoteDetail : { } ,
quoteDetailVisible : false ,
quoteDetailActiveName : 'bom' ,
saveLoading : false ,
}
} ,
methods : {
@ -278,14 +300,14 @@ export default {
} ,
handleQuery ( ) {
let list = [ ] ;
if ( this . propertyItemList . length > 0 ) {
list = this . propertyItemList . filter ( item => item . textValue || item . numValue ) ;
if ( this . propertyItemList . length > 0 ) {
list = this . propertyItemList . filter ( item => item . textValue || item . numValue ) ;
}
let params = {
... this . queryForm ,
no : this . no ,
size : this . size ,
codeNo : this . currentProperty . codeNo ,
codeNo : this . currentProperty . codeNo ,
list ,
}
this . queryLoading = true
@ -394,27 +416,79 @@ export default {
this . $message . error ( error )
} )
} ,
handleAgainQuote ( row ) {
this . $confirm ( '确定重新报价该报价单吗?' ) . then ( ( ) => {
let params = {
id : row . quoteId ,
createBy : this . $store . state . user . name ,
}
this . queryLoading = true
againQuote ( params ) . then ( ( { data } ) => {
if ( data && data . code === 0 ) {
this . $message . success ( data . msg )
this . handleQuery ( ) ;
} else {
this . $message . warning ( data . msg )
this . queryLoading = false
handleAgainQuote ( row ) {
this . quoteDetail = { } ;
this . $confirm ( '确定重新报价该报价单吗?' ) . then ( ( ) => {
this . handleAgainQuoteOption ( row ) ;
} )
} ,
handleAgainQuoteOption ( row ) {
let params = {
id : row . quoteId ,
createBy : this . $store . state . user . name ,
}
this . queryLoading = true
againQuote ( params ) . then ( ( { data } ) => {
if ( data && data . code === 0 ) {
this . $message . success ( data . msg )
this . handleQuery ( ) ;
let params = {
id : data . id ,
}
} ) . catch ( ( error ) => {
this . $message . error ( error )
this . handleQueryQuoteDetailById ( params ) ;
} else {
this . $message . warning ( data . msg )
this . queryLoading = false
} )
}
} ) . catch ( ( error ) => {
this . $message . error ( error )
this . queryLoading = false
} )
}
} ,
handleQueryQuoteDetailById ( row ) {
let params = {
id : row . id ,
}
queryQuoteDetailById ( params ) . then ( ( { data } ) => {
if ( data && data . code === 0 ) {
this . quoteDetail = data . row ;
this . quoteDetailVisible = true ;
this . quoteDetailActiveName = 'bom' ;
} else {
this . $message . warning ( data . msg )
}
} ) . catch ( ( error ) => {
this . $message . error ( error )
} )
} ,
handleClickTab ( tab ) {
if ( this . activeName === 'routing' ) {
this . $refs . routing . handleQueryQuoteDetailBomTree ( )
}
} ,
handleSaveQuoteDetailClick ( ) {
this . $refs . saveQuoteDetailForm . validate ( ( valid , obj ) => {
if ( valid ) {
this . handleUpdate ( ) ;
}
} )
} ,
handleUpdate ( ) {
let params = {
... this . quoteDetail ,
updateBy : this . $store . state . user . name ,
}
updateQuoteDetail ( params ) . then ( ( { data } ) => {
if ( data && data . code === 0 ) {
this . $message . success ( data . msg ) ;
this . quoteDetailVisible = false ;
} else {
this . $message . warning ( data . msg ) ;
}
} ) . catch ( ( error ) => {
this . $message . error ( error ) ;
} )
} ,
} ,
created ( ) {
this . getSiteAndBuByUserName ( ) ;
@ -528,7 +602,7 @@ export default {
< el -tabs v-model ="activeName" >
< el -tab -pane label = "详情" name = "detail" >
< el -form :model ="currentRow" label -position = " top " style = "width: 1000px" >
< el -row :gutter ="2 0" >
< el -row :gutter ="1 0" >
< el -col :span ="4" >
< el -form -item label = "报价单号" >
< el -input v -model = " currentRow.quoteVersionNo " readonly > < / e l - i n p u t >
@ -545,7 +619,7 @@ export default {
< / e l - f o r m - i t e m >
< / e l - c o l >
< / e l - r o w >
< el -row :gutter ="2 0" >
< el -row :gutter ="1 0" >
< el -col :span ="4" >
< el -form -item label = "客户编码" >
< el -input v -model = " currentRow.customerNo " readonly > < / e l - i n p u t >
@ -556,7 +630,7 @@ export default {
< el -input v -model = " currentRow.customerDesc " readonly > < / e l - i n p u t >
< / e l - f o r m - i t e m >
< / e l - c o l >
< el -col :span ="4" :offset ="2" >
< el -col :span ="4" >
< el -form -item label = "状态" >
< el -input v -model = " currentRow.status " readonly > < / e l - i n p u t >
< / e l - f o r m - i t e m >
@ -572,7 +646,7 @@ export default {
< / e l - f o r m - i t e m >
< / e l - c o l >
< / e l - r o w >
< el -row :gutter ="2 0" >
< el -row :gutter ="1 0" >
< el -col :span ="4" >
< el -form -item label = "创建人" >
< el -input v -model = " currentRow.createBy " readonly > < / e l - i n p u t >
@ -598,7 +672,7 @@ export default {
< / e l - t a b - p a n e >
< el -tab -pane name = "inquiry" label = "询价单信息" >
< el -form :model ="currentRow" label -position = " top " style = "width: 1000px" >
< el -row :gutter ="2 0" >
< el -row :gutter ="1 0" >
< el -col :span ="5" >
< el -form -item label = "询价单号" >
< el -input v -model = " currentRow.internalInquiryNo " readonly > < / e l - i n p u t >
@ -615,7 +689,7 @@ export default {
< / e l - f o r m - i t e m >
< / e l - c o l >
< / e l - r o w >
< el -row :gutter ="2 0" >
< el -row :gutter ="1 0" >
< el -col :span ="5" >
< el -form -item label = "客户询价单号" >
< el -input v -model = " currentRow.customerInquiryNo " readonly > < / e l - i n p u t >
@ -690,19 +764,22 @@ export default {
< template slot -scope = " scope " >
< template v-if ="scope.row.valueTypeDb==='T' && scope.row.valueChooseFlag==='Y'" >
< el -select v -model = " scope.row [ ' textValue ' ] " placeholder = "请选择" style = "width: 100%" clearable >
< el -option :label ="available.availableValue" :value ="available.availableValue" :key ="available.id" v-for ="(available) in scope.row.availableList" > < / el -option >
< el -option :label ="available.availableValue" :value ="available.availableValue" :key ="available.id"
v - for = "(available) in scope.row.availableList" > < / e l - o p t i o n >
< / e l - s e l e c t >
< / template >
< template v -else -if = " scope.row.valueTypeDb = = = ' N ' & & scope.row.valueChooseFlag = = = ' Y ' " >
< el -select v -model = " scope.row [ ' numValue ' ] " placeholder = "请选择" style = "width: 100%" clearable >
< el -option :label ="available.availableValue" :value ="available.availableValue" :key ="available.id" v-for ="(available) in scope.row.availableList" > < / el -option >
< el -option :label ="available.availableValue" :value ="available.availableValue" :key ="available.id"
v - for = "(available) in scope.row.availableList" > < / e l - o p t i o n >
< / e l - s e l e c t >
< / template >
< template v -else -if = " scope.row.valueTypeDb = = = ' T ' " >
< el -input v-model ="scope.row['textValue']" > < / el -input >
< / template >
< template v -else -if = " scope.row.valueTypeDb = = = ' N ' " >
< el -input -number style = "width: 100%" :controls ="false" :step ="0" v-model ="scope.row['numValue']" > < / el -input -number >
< el -input -number style = "width: 100%" :controls ="false" :step ="0"
v - model = "scope.row['numValue']" > < / 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 >
@ -712,6 +789,59 @@ export default {
< el -button @ click = "propertyVisible = false" > 取 消 < / e l - b u t t o n >
< / div >
< / e l - d i a l o g >
< el -dialog :title ="`报价明细`" top = "10vh" v -drag :visible.sync ="quoteDetailVisible" append -to -body
: width = "`${quoteDetail.id?1200:600}px`" : close - on - click - modal = "false" >
< el -form :model ="quoteDetail" ref = "saveQuoteDetailForm" :rules ="saveQuoteDetailRules" label -position = " top " >
< el -row :gutter ="20" >
< el -col :span ="4" >
< el -form -item label = "物料名称" prop = "partNo" :show-message ="false" >
< el -input v -model = " quoteDetail.partNo " disabled > < / e l - i n p u t >
< / e l - f o r m - i t e m >
< / e l - c o l >
< el -col :span ="6" >
< el -form -item label = "物料描述" prop = "partDesc" :show-message ="false" >
< el -input v -model = " quoteDetail.partDesc " disabled > < / e l - i n p u t >
< / e l - f o r m - i t e m >
< / e l - c o l >
< el -col :span ="3" >
< el -form -item label = "报价数量" prop = "qty" :show-message ="false" >
< el -input -number v -model = " quoteDetail.qty " style = "width: 100%;" :controls ="false" disabled > < / e l - i n p u t - n u m b e r >
< / e l - f o r m - i t e m >
< / e l - c o l >
< / e l - r o w >
< el -row :gutter ="20" >
< el -col :span ="16" >
< el -form -item label = "备注" class = "auto" :show-message ="false" >
< el -input type = "textarea" resize = "none" : autosize = "{minRows: 3, maxRows: 3}" v -model = " quoteDetail.remark " disabled > < / e l - i n p u t >
< / e l - f o r m - i t e m >
< / e l - c o l >
< / e l - r o w >
< / e l - f o r m >
< el -tabs v-model ="quoteDetailActiveName" @tab-click="handleClickTab" >
< el -tab -pane label = "材料" name = "bom" >
< quote -detail -bom v-if ="quoteDetailVisible" v-model :quoteDetail ="quoteDetail" > < / quote -detail -bom >
< / e l - t a b - p a n e >
< el -tab -pane label = "工艺" name = "routing" >
< quote -detail -routing ref = "routing" v -if = " quoteDetailVisible "
v - model : quoteDetail = "quoteDetail" > < / q u o t e - d e t a i l - r o u t i n g >
< / e l - t a b - p a n e >
< el -tab -pane label = "工具" name = "tool" >
< quote -detail -tool v-if ="quoteDetailVisible" v-model :quoteDetail ="quoteDetail" > < / quote -detail -tool >
< / e l - t a b - p a n e >
< el -tab -pane label = "其他成本" name = "other" >
< quote -detail -other v-if ="quoteDetailVisible" v-model :quoteDetail ="quoteDetail" > < / quote -detail -other >
< / e l - t a b - p a n e >
< el -tab -pane label = "成本&价格" name = "cost" >
< quote -detail -cost v -model :quoteDetail ="quoteDetail" > < / q u o t e - d e t a i l - c o s t >
< / e l - t a b - p a n e >
< / e l - t a b s >
< div slot = "footer" class = "dialog-footer" >
< el -button type = "primary" :loading ="saveLoading" @click ="handleSaveQuoteDetailClick" > 确 定 < / el -button >
< el -button @ click = "quoteDetailVisible = false" > 取 消 < / e l - b u t t o n >
< / div >
< / e l - d i a l o g >
< / div >
< / template >