Browse Source

2023-11-23 plm报价

master
zelian_wu 2 years ago
parent
commit
2488a7f823
  1. 63
      src/api/quotation/quotationHeader.js
  2. 378
      src/components/quotation/sellForQuotation/quotationDetail.vue

63
src/api/quotation/quotationHeader.js

@ -1,5 +1,4 @@
import { createAPI } from "@/utils/httpRequest.js";
import {data} from "autoprefixer";
/**
* 报价信息列表查询 QuotationHeader
@ -28,6 +27,12 @@ export const searchQuotationTool = (data) => createAPI('/plm/quotationTool/list'
* @returns {*}
*/
export const saveQuotationTool = (data) => createAPI('/plm/quotationTool/saveQuotationTool','post',data);
/**
* 批量新增报价工具
* @param data
* @returns {*}
*/
export const batchInsertQuotationTool = (data) => createAPI('/plm/quotationTool/batchInsertQuotationTool','post',data);
/**
* 删除 报价工具 记录
* @param data
@ -35,12 +40,21 @@ export const saveQuotationTool = (data) => createAPI('/plm/quotationTool/saveQuo
*/
export const deleteQuotationTool = (data) => createAPI('/plm/quotationTool/deleteQuotationTool','post',data);
/**
* 批量删除报价工具
* @param data
* @returns {*}
*/
export const batchDeleteQuotationTool = (data) => createAPI('/plm/quotationTool/batchDeleteQuotationTool','post',data);
/**
* 分页查询QuotationDetail
* @param data
* @returns {*}
*/
export const searchQuotationDetailPageByHeaderId = (data) => createAPI('/plm/quotationDetail/searchQuotationDetailPageByHeaderId','get',data);
export const searchQuotationDetail = (data) => createAPI('/plm/quotationDetail/list','get',data);
/**
* 新增QuotationDetail
* @param data
@ -54,6 +68,8 @@ export const insertQuotationDetail = (data) => createAPI('/plm/quotationDetail/i
*/
export const updateQuotationDetail = (data) => createAPI('/plm/quotationDetail/updateQuotationDetail','post',data);
// ==========================工艺===========================================
/**
* 查询 QuotationRouting列表 by 报价明细id
* @param data
@ -68,6 +84,13 @@ export const searchQuotationRoutingByDetailId = (data) => createAPI('/plm/quotat
*/
export const insertQuotationRouting = (data) => createAPI('/plm/quotationRouting/insertQuotationRouting','post',data);
/**
* 批量新增 QuotationRouting
* @param data
* @returns {*}
*/
export const batchInsertQuotationRouting = (data) => createAPI('/plm/quotationRouting/batchInsertQuotationRouting','post',data);
/**
* 修改 QuotationRouting
* @param data
@ -82,9 +105,47 @@ export const updateQuotationRouting = (data) => createAPI('/plm/quotationRouting
*/
export const deleteQuotationRouting = (data) => createAPI('/plm/quotationRouting/deleteQuotationRouting','post',data);
/**
* 批量删除 QuotationRouting
* @param data
* @returns {*}
*/
export const batchDeleteQuotationRouting = (data) => createAPI('/plm/quotationRouting/batchDeleteQuotationRouting','post',data);
// ==========================材料===========================================
/**
* 查询 quotationPart
* @param data
* @returns {*}
*/
export const searchQuotationPart = (data) => createAPI('/plm/quotationPart/searchQuotationPart','get',data);
/**
* 新增 quotationPart
* @param data
* @returns {*}
*/
export const insertQuotationPart = (data) => createAPI('/plm/quotationPart/insertQuotationPart','post',data);
/**
* 批量新增 quotationPart
* @param data
* @returns {*}
*/
export const batchInsertQuotationPart = (data) => createAPI('/plm/quotationPart/batchInsertQuotationPart','post',data);
/**
* 删除 quotationPart
* @param data
* @returns {*}
*/
export const deleteQuotationPart = (data) => createAPI('/plm/quotationPart/deleteQuotationPart','post',data);
/**
* 批量删除 quotationPart
* @param data
* @returns {*}
*/
export const batchDeleteQuotationPart = (data) => createAPI('/plm/quotationPart/batchDeleteQuotationPart','post',data);

378
src/components/quotation/sellForQuotation/quotationDetail.vue

@ -242,7 +242,7 @@
<el-tabs v-model="activeName" style="height: 480px" border stripe>
<el-tab-pane name="index" label="材料">
<el-button type="primary" @click="quotationPartDialogFlag = true"> </el-button>
<el-button type="primary">从其他报价单复制</el-button>
<el-button type="primary" @click="clickOtherQuotationDetailsBtn(1)">从其他报价单复制</el-button>
<el-button type="primary" @click="deleteSelectionQuotationPart"> </el-button>
<el-form :model="quotationPartFormTable" :rules="quotationPartRules" ref="quotationPartTableForm">
<el-table style="margin-top: 5px" v-loading="partTableFlag"
@ -257,7 +257,7 @@
</el-table-column>
<el-table-column label="操作" width="120" align="center">
<template slot-scope="{row,$index}">
<el-link style="cursor: pointer" @click="deleteQuotationPart($index)">删除</el-link>
<el-link style="cursor: pointer" @click="deleteQuotationPart(row,$index)">删除</el-link>
</template>
</el-table-column>
<el-table-column type="index" width="50" align="center" label="序号"/>
@ -327,7 +327,7 @@
</el-tab-pane>
<el-tab-pane label="工艺">
<el-button type="primary" @click="quotationRoutingDialogFlag = true"> </el-button>
<el-button type="primary">从其他报价单复制</el-button>
<el-button type="primary" @click="clickOtherQuotationDetailsBtn(2)">从其他报价单复制</el-button>
<el-button type="primary" @click="deleteSelectionQuotationRoutingBtn"> </el-button>
<el-form ref="quotationRoutingTableForm" :model="quotationRoutingFormTable" :rules="quotationRoutingRules">
<el-table style="margin-top: 5px" :data="quotationRoutingFormTable.quotationRoutingList" height="400" @selection-change="handleSelectionChangeQuotationRoutingTable">
@ -338,7 +338,7 @@
</el-table-column>
<el-table-column label="操作" width="80" align="center">
<template slot-scope="{row,$index}">
<el-link style="cursor: pointer" @click="deleteQuotationRoutingBtn($index)">删除</el-link>
<el-link style="cursor: pointer" @click="deleteQuotationRoutingBtn(row,$index)">删除</el-link>
</template>
</el-table-column>
<el-table-column width="50" align="center" label="序号" type="index" show-overflow-tooltip/>
@ -457,7 +457,7 @@
<!--======================工具========================-->
<el-tab-pane label="工具">
<el-button type="primary" @click="saveQuotationToolFlag = true"> </el-button>
<el-button type="primary">从其他报价单复制</el-button>
<el-button type="primary" @click="clickOtherQuotationDetailsBtn(3)">从其他报价单复制</el-button>
<el-button type="primary" @click="deleteSelectionQuotationTool"> </el-button>
<!--将表格嵌套置form表单中-->
@ -730,7 +730,8 @@
</el-form>
<!--筛选的数据-->
<el-table :data="computedToolHeaderTable" ref="toolHeaderTable" :style="{marginTop:'10px'}"
height="300px" stripe border @selection-change="handleSelectionChangeToolHeaderTable">
height="300px" stripe border @selection-change="handleSelectionChangeToolHeaderTable"
@row-click="(row)=>toggleRowSelectionTable(row,'toolHeaderTable')">
<el-table-column
type="selection"
width="55" align="center">
@ -945,8 +946,9 @@
</el-row>
</el-form>
<!--筛选的数据-->
<el-table :data="computedPartTable" ref="toolHeaderTable" :style="{marginTop:'10px'}"
height="300px" stripe border width="30%" @selection-change="handleSelectionChangePartTable">
<el-table :data="computedPartTable" ref="partDataTable" :style="{marginTop:'10px'}"
height="300px" stripe border width="30%" @selection-change="handleSelectionChangePartTable"
@row-click="(row)=>toggleRowSelectionTable(row,'partDataTable')">
<el-table-column
type="selection"
width="55" align="center">
@ -975,21 +977,72 @@
<el-button type="primary" @click="savePartBtn"> </el-button>
</span>
</el-dialog>
<!-- 其他报价单弹框 -->
<el-dialog title="报价明细列表"
@close="closeOtherQuotationDetail"
:visible.sync="otherQuotationDetailDialogFlag">
<!--搜索条件-->
<el-form :model="otherDetail" ref="otherDetailForm" label-position="top">
<el-row>
<el-col :span="4">
<el-form-item label="报价单号">
<el-input v-model="otherDetail.quotationNo" @change="initOtherQuotationDetail" clearable/>
</el-form-item>
</el-col>
<el-col :span="4" :offset="1">
<el-form-item label="产品编码">
<el-input v-model="otherDetail.productNo" @change="initOtherQuotationDetail" clearable/>
</el-form-item>
</el-col>
<el-col :span="4" :offset="1">
<el-form-item label="产品名称">
<el-input v-model="otherDetail.productDesc" @change="initOtherQuotationDetail" clearable/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<!--筛选的数据-->
<el-table :data="otherQuotationDetailList" ref="otherQuotationDetailTable" :style="{marginTop:'10px'}"
height="300px" stripe border width="30%" @selection-change="handleSelectionChangeOtherDetail"
@row-click="(row)=>toggleRowSelectionTable(row,'otherQuotationDetailTable')">
<el-table-column
type="selection"
width="55" align="center">
</el-table-column>
<el-table-column label="报价单号" prop="quotationNo"/>
<el-table-column label="产品编码" prop="productNo"/>
<el-table-column label="产品名称" prop="productDesc"/>
</el-table>
<span slot="footer" class="dialog-footer" style="margin-top: 5px">
<el-button @click="otherQuotationDetailDialogFlag= false"> </el-button>
<el-button type="primary" @click="saveOtherQuotationDetailBtn"> </el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import {
saveQuotationTool,
batchInsertQuotationTool,
searchQuotationTool,
deleteQuotationTool,
batchDeleteQuotationTool,
searchQuotationDetailPageByHeaderId,
insertQuotationDetail,
updateQuotationDetail,
searchQuotationRoutingByDetailId,
insertQuotationRouting,
batchInsertQuotationRouting,
updateQuotationRouting,
deleteQuotationRouting,
batchDeleteQuotationRouting,
searchQuotationPart,
insertQuotationPart,
batchInsertQuotationPart,
deleteQuotationPart,
batchDeleteQuotationPart,
searchQuotationDetail,
} from '@/api/quotation/quotationHeader.js';
import {
searchUmInformationList, //
@ -1029,6 +1082,8 @@ export default {
},
selectionQuotationPartList:[],//
selectionPartList:[],//
otherQuotationDetailList:[],//
selectionOtherDetailList:[],//
// =========================================================================================
no: 1,//
size: 20,//
@ -1041,6 +1096,8 @@ export default {
quotationRoutingDialogFlag: false,//
quotationPartDialogFlag:false,//
partDialogFlag:false,//
otherQuotationDetailDialogFlag:false,//
options:0,//
// =======================================================================================
//
insertQuotationDetailData: {
@ -1156,6 +1213,12 @@ export default {
partNo:undefined,//
partDesc:undefined,
},
//
otherDetail:{
quotationNo:undefined,//
productNo:undefined,//
productDesc:undefined,//
},
// ======================================================================================
//
quotationDetailRules: {
@ -1463,14 +1526,16 @@ export default {
this.$refs['quotationToolForm'].validate((validate, object) => {
if (validate) {
if (this.selectionToolHeaderList.length > 0){
for (let i = 0; i < this.selectionToolHeaderList.length; i++) {
let data = this.quotationToolFormTable.quotationToolList.find(item => item.toolNo == this.selectionToolHeaderList[i].toolNo);
if (data){
data.toolQuantity = +data.toolQuantity + this.selectionToolHeaderList[i].toolQuantity;
}else {
this.quotationToolFormTable.quotationToolList.push(JSON.parse(JSON.stringify(this.selectionToolHeaderList[i])));//
}
}
//
let batchUpdateList = this.quotationToolFormTable.quotationToolList.filter((v) => this.selectionToolHeaderList.some((val) => val.toolNo == v.toolNo));
batchUpdateList.map(item => {
item.toolQuantity = +item.toolQuantity + 1;
return item;
});
//
let batchInsertList = this.selectionToolHeaderList.filter((v) => this.quotationToolFormTable.quotationToolList.every((val) => val.toolNo != v.toolNo));
let batchInsertQuotationToolList = batchUpdateList.concat(batchInsertList);
this.batchInsertQuotationToolData(batchInsertQuotationToolList);
}else {
this.quotationTool.quotationDetailId = this.quotationDetailData.quotationDetailId;
//
@ -1479,60 +1544,101 @@ export default {
this.quotationTool.unitCost = 0;
this.quotationTool.expectedServiceLife = 0;
}
this.quotationToolFormTable.quotationToolList.push(JSON.parse(JSON.stringify(this.quotationTool)));//
this.insertQuotationToolData();
}
this.$message.success("新增成功!");//
this.computeQuotationToolCost();//
this.saveQuotationToolFlag = false;//
} else {
this.rulesValidateLabel(object, this.quotationToolColumns);//
}
})
},
//
insertQuotationToolData(){
saveQuotationTool(this.quotationTool).then(({data}) => {
if (data.code == 200) {
this.initQuotationToolData();
this.$message.success(data.msg);
this.saveQuotationToolFlag = false;//
} else {
this.$message.error(data.msg);
}
})
},
//
batchInsertQuotationToolData(batchInsertQuotationToolList){
batchInsertQuotationTool(batchInsertQuotationToolList).then(({data})=>{
if (data.code == 200){
this.initQuotationToolData();
this.saveQuotationToolFlag = false;
}
this.$message.success(data.msg);
})
},
// ==================================================================================================
//
clickDeleteToolTableBtn(row,i) {
this.quotationToolFormTable.quotationToolList.splice(i,1);
this.computeQuotationToolCost();
this.$message.success("删除成功!");
deleteQuotationTool(row).then(({data})=>{
if (data.code == 200){
this.initQuotationToolData();
this.$message.success(data.msg);
}else {
this.$message.error(data.msg);
}
})
},
//
deleteSelectionQuotationTool(){
console.log(this.selectionQuotationToolList.length)
this.selectionQuotationToolList.reverse().forEach(item => {
this.quotationToolFormTable.quotationToolList.splice(item.index,1);
});
this.computeQuotationToolCost();
this.$message.success("删除成功!");
batchDeleteQuotationTool(this.selectionQuotationToolList).then(({data})=>{
if (data.code == 200){
this.initQuotationToolData();
this.$message.success(data.msg);
}else {
this.$message.error(data.msg);
}
})
},
//
deleteQuotationRoutingBtn(index){
this.quotationRoutingFormTable.quotationRoutingList.splice(index,1);
//
this.$message.success("删除成功!");
deleteQuotationRoutingBtn(row,index){
deleteQuotationRouting(row).then(({data})=>{
if (data.code == 200){
this.initQuotationRoutingData();
this.$message.success(data.msg);
}else {
this.$message.error(data.msg);
}
})
},
//
deleteSelectionQuotationRoutingBtn(){
this.selectionQuotationRoutingList.reverse().forEach(item => {
this.quotationRoutingFormTable.quotationRoutingList.splice(item.index,1);
});
//
this.$message.success("删除成功!");
batchDeleteQuotationRouting(this.selectionQuotationRoutingList).then(({data})=>{
if (data.code == 200){
this.initQuotationRoutingData();
this.$message.success(data.msg);
}else {
this.$message.error(data.msg);
}
})
},
//
deleteQuotationPart(index){
this.quotationPartFormTable.quotationPartList.splice(index,1)
this.$message.success("删除成功!")
deleteQuotationPart(row,index){
deleteQuotationPart(row).then(({data})=>{
if (data.code == 200){
this.initQuotationPart();
this.$message.success(data.msg);
}else {
this.$message.error(data.msg);
}
})
},
//
deleteSelectionQuotationPart(){
this.selectionQuotationPartList.reverse().forEach(item => {
this.quotationPartFormTable.quotationPartList.splice(item.index,1);
});
//
this.$message.success("删除成功!");
batchDeleteQuotationPart(this.selectionQuotationPartList).then(({data})=>{
if (data.code == 200){
this.initQuotationPart();
this.$message.success(data.msg);
}else {
this.$message.error(data.msg);
}
})
},
// ====================================================================================================
//
@ -1623,15 +1729,21 @@ export default {
savePartBtn(){
let quotationPartNo = "";
let quotationPartDesc = "";
let quotationPartUmId = "";
this.selectionPartList = this.selectionPartList.map(item=>{
item.quotationDetailId = this.quotationDetailData.quotationDetailId;
item.site = this.$store.state.user.site;
item.quotationPartNo = item.partNo;
item.quotationPartDesc = item.partDesc;
quotationPartNo += item.partNo + ";";
quotationPartDesc += item.partDesc + ";";
quotationPartUmId += item.umId + ";";
return item;
});
this.quotationPart.quotationPartNo = quotationPartNo.substring(0, quotationPartNo.length - 1);
this.quotationPart.quotationPartDesc = quotationPartDesc.substring(0, quotationPartDesc.length - 1);
this.quotationPart.umIdList = quotationPartUmId.substring(0, quotationPartUmId.length - 1);
this.quotationPart.umId = quotationPartUmId.substring(0, quotationPartUmId.length - 1);
this.partDialogFlag = false;
},
//
@ -1640,17 +1752,33 @@ export default {
if (!validate){
this.rulesValidateLabel(objects,this.quotationRoutingColumns);
}else {
//TODO
console.log(this.selectionPartList)
if (this.selectionPartList.length > 0){
}else {
//
this.quotationRouting.quotationDetailId = this.quotationDetailData.quotationDetailId;
this.quotationRoutingFormTable.quotationRoutingList.push(JSON.parse(JSON.stringify(this.quotationRouting)));
}
this.$message.success("新增成功!");
//
this.quotationRouting.quotationDetailId = this.quotationDetailData.quotationDetailId;
this.insertQuotationRoutingData();
}
})
},
//
insertQuotationRoutingData(){
insertQuotationRouting(this.quotationRouting).then(({data})=>{
if (data.code == 200){
this.initQuotationRoutingData();
this.$message.success(data.msg);
this.quotationRoutingDialogFlag = false;
}else {
this.$message.error(data.msg);
}
})
},
//
batchInsertQuotationRoutingData(quotationRoutingList){
batchInsertQuotationRouting(quotationRoutingList).then(({data})=>{
if (data.code == 200){
this.initQuotationRoutingData();
this.$message.success(data.msg);
this.quotationRoutingDialogFlag = false;
}else {
this.$message.error(data.msg);
}
})
},
@ -1661,12 +1789,97 @@ export default {
this.rulesValidateLabel(objects,this.quotationPartColumns);
}else {
//
this.quotationPart.quotationDetailId = this.quotationDetailData.quotationDetailId;
this.quotationPartFormTable.quotationPartList.push(JSON.parse(JSON.stringify(this.quotationPart)));
if (this.selectionPartList.length > 0){
let quotationPartList = this.selectionPartList.map(item=>{
let data = this.quotationPartFormTable.quotationPartList.find(val => val.partNo == item.partNo);
if (!data){
item.unitDosage = this.quotationPart.unitDosage;
item.attritionRate = this.quotationPart.attritionRate;
item.transferAmount = this.quotationPart.transferAmount;
item.unitCost = this.quotationPart.unitCost;
item.remark = this.quotationPart.remark;
}else {
item = data;
}
return item;
})
this.batchInsertQuotationPartData(quotationPartList);
}else {
this.quotationPart.quotationDetailId = this.quotationDetailData.quotationDetailId;
this.insertQuotationPartData();
}
}
})
},
//
batchInsertQuotationPartData(quotationPrtList){
batchInsertQuotationPart(quotationPrtList).then(({data})=>{
if (data.code == 200){
this.initQuotationPart();
this.$message.success(data.msg);
this.quotationPartDialogFlag = false;
}else {
this.$message.error(data.msg);
}
})
},
//
insertQuotationPartData(){
insertQuotationPart(this.quotationPart).then(({data})=>{
if (data.code == 200){
this.initQuotationPart();
this.$message.success(data.msg);
this.quotationPartDialogFlag = false;
}else {
this.$message.error(data.msg);
}
})
},
//
saveOtherQuotationDetailBtn(){
let otherSelectionPart = [];//
let otherSelectionRouting = [];//
let otherSelectionTool = [];//
//
for (let i = 0; i < this.selectionOtherDetailList.length; i++) {
if (this.selectionOtherDetailList[i].quotationPartList){
otherSelectionPart = otherSelectionPart.concat(this.selectionOtherDetailList[i].quotationPartList);
}
if (this.selectionOtherDetailList[i].quotationRoutingVoList){
otherSelectionRouting = otherSelectionRouting.concat(this.selectionOtherDetailList[i].quotationRoutingVoList);
}
if (this.selectionOtherDetailList[i].quotationToolList){
otherSelectionTool = otherSelectionTool.concat(this.selectionOtherDetailList[i].quotationToolList);
}
}
switch (this.options){
case 1:
otherSelectionPart = otherSelectionPart.map(item=>{
item.quotationDetailId = this.quotationDetailData.quotationDetailId;
item.quotationPartId = undefined;
return item;
})
this.batchInsertQuotationPartData(otherSelectionPart);
break;
case 2:
otherSelectionRouting = otherSelectionRouting.map(item=>{
item.quotationDetailId = this.quotationDetailData.quotationDetailId;
item.quotationRoutingId = undefined;
return item;
})
this.batchInsertQuotationRoutingData(otherSelectionRouting);
break;
case 3:
otherSelectionTool = otherSelectionTool.map(item=>{
item.quotationDetailId = this.quotationDetailData.quotationDetailId;
item.quotationToolId = undefined;
return item;
});
this.batchInsertQuotationToolData(otherSelectionTool);
break;
}
this.otherQuotationDetailDialogFlag = false;
},
// =================================================================================================
//
editQuotationDetail(row) {
@ -1794,6 +2007,8 @@ export default {
},
//
initPartList(){
this.partData.partNo = undefined;
this.partData.partDesc = undefined;
let params = {
site:this.$store.state.user.site
};
@ -1803,6 +2018,21 @@ export default {
}
})
},
//
initOtherQuotationDetail(){
let params = {
site:this.$store.state.user.site,
quotationDetailId:this.quotationDetailData.quotationDetailId,
quotationNo:this.otherDetail.quotationNo,
productNo:this.otherDetail.productNo,
productDesc:this.otherDetail.productDesc,
};
searchQuotationDetail(params).then(({data})=>{
if (data.code == 200){
this.otherQuotationDetailList = data.data;
}
})
},
// =================================================================================================
// size
detailSizeChange(val) {
@ -1845,6 +2075,7 @@ export default {
this.initQuotationToolData();
this.initQuotationRoutingData();
this.initQuotationPart();
this.initOtherQuotationDetail();
},
//
openInsertQuotationDetail() {
@ -1863,6 +2094,11 @@ export default {
this.$refs.quotationPartForm.resetFields();
}
},
//
clickOtherQuotationDetailsBtn(i){
this.otherQuotationDetailDialogFlag = true;
this.options = i;
},
// =======================================================dialog=============================================
//
closeInsertDialog() {
@ -1908,6 +2144,19 @@ export default {
//
closeQuotationPartDialog(){
this.$refs['quotationPartForm'].resetFields();
if (this.selectionPartList.length > 0){
this.$refs.partDataForm.resetFields();
}
this.selectionPartList = [];
if (this.$refs.partDataTable) {
this.$refs.partDataTable.clearSelection();
}
},
//
closeOtherQuotationDetail(){
this.options = 0;
this.$refs.otherDetailForm.resetFields();
this.$refs.otherQuotationDetailTable.clearSelection();
},
// ===============================================================================================
//
@ -1930,6 +2179,15 @@ export default {
handleSelectionChangePartTable(selection){
this.selectionPartList = selection;
},
//
handleSelectionChangeOtherDetail(selection){
this.selectionOtherDetailList = selection;
},
// ===============================================================================================
//
toggleRowSelectionTable(row,refName){
this.$refs[refName].toggleRowSelection(row);
},
// ====================================================================================================
//
inputProfitRate() {

Loading…
Cancel
Save