10 changed files with 508 additions and 75 deletions
-
7src/api/quotation/quoteProperties.js
-
72src/views/modules/quotation/inquiry/inquiryQuoteDetail.vue
-
36src/views/modules/quotation/requestForQuote.vue
-
17src/views/modules/quotation/sellForQuotation.vue
-
419src/views/modules/quotation/sellForQuotation/quotationDetail/quoteDetailProperties.vue
-
4src/views/modules/quotation/sellForQuotation/quotationDetail/toolQuotation.vue
-
18src/views/modules/quotation/sellForQuotation/quoteDetail.vue
-
4src/views/modules/sys/dict-data.vue
-
4src/views/modules/sys/dict.vue
-
2src/views/modules/test/testSoRouting/testRoutingTable.vue
@ -0,0 +1,419 @@ |
|||
<script> |
|||
import { |
|||
deleteQuoteDetailProperties, |
|||
editQuoteDetailProperties, newQuoteDetailProperties, |
|||
queryQuoteDetailProperties, |
|||
queryQuoteDetailPropertiesItem |
|||
} from "../../../../../api/quotation/quoteProperties"; |
|||
import {Decimal} from "decimal.js"; |
|||
import item from "../../../code/item.vue"; |
|||
|
|||
export default { |
|||
name: "quoteDetailProperties", |
|||
props:{ |
|||
quotationDetail: { |
|||
type: Object, |
|||
required: true |
|||
}, |
|||
height:{ |
|||
type: [String, Number], |
|||
default: 400 |
|||
}, |
|||
packCost:{ |
|||
type:Number, |
|||
default:0, |
|||
}, |
|||
shippingCost:{ |
|||
type:Number, |
|||
default:0, |
|||
}, |
|||
}, |
|||
data(){ |
|||
return{ |
|||
propertyVisible:false, |
|||
dataList:[], |
|||
propertyList:[], |
|||
selectionPropertyList:[], |
|||
property:{ |
|||
itemNo:'', |
|||
itemDesc:'', |
|||
}, |
|||
selectionDataList:[], |
|||
columns: [ |
|||
{ |
|||
userId: this.$store.state.user.name, |
|||
functionId: 102003, |
|||
serialNumber: '102003Table7ItemNo', |
|||
tableId: "102003Table7", |
|||
tableName: "物料属性项目表", |
|||
columnProp: 'itemNo', |
|||
headerAlign: "center", |
|||
align: "left", |
|||
columnLabel: '属性编码', |
|||
columnHidden: false, |
|||
columnImage: false, |
|||
columnSortable: false, |
|||
sortLv: 0, |
|||
status: true, |
|||
fixed: '', |
|||
columnWidth: 90, |
|||
}, |
|||
{ |
|||
userId: this.$store.state.user.name, |
|||
functionId: 102003, |
|||
serialNumber: '102003Table7PropertiesItemDesc', |
|||
tableId: "102003Table7", |
|||
tableName: "物料属性项目表", |
|||
columnProp: 'itemDesc', |
|||
headerAlign: "center", |
|||
align: "left", |
|||
columnLabel: '属性名称', |
|||
columnHidden: false, |
|||
columnImage: false, |
|||
columnSortable: false, |
|||
sortLv: 0, |
|||
status: true, |
|||
fixed: '', |
|||
columnWidth: 90, |
|||
}, |
|||
{ |
|||
userId: this.$store.state.user.name, |
|||
functionId: 102003, |
|||
serialNumber: '102003Table7ValueType', |
|||
tableId: "102003Table7", |
|||
tableName: "物料属性项目表", |
|||
columnProp: 'valueType', |
|||
headerAlign: "center", |
|||
align: "center", |
|||
columnLabel: '属性类型', |
|||
columnHidden: false, |
|||
columnImage: false, |
|||
columnSortable: false, |
|||
sortLv: 0, |
|||
status: true, |
|||
fixed: '', |
|||
columnWidth: 70, |
|||
}, |
|||
{ |
|||
userId: this.$store.state.user.name, |
|||
functionId: 100002001, |
|||
serialNumber: '100002001TableTextValue', |
|||
tableId: "100002001Table", |
|||
tableName: "属性表", |
|||
columnProp: 'textValue', |
|||
headerAlign: "center", |
|||
align: "left", |
|||
columnLabel: '属性值', |
|||
columnHidden: false, |
|||
columnImage: false, |
|||
columnSortable: false, |
|||
sortLv: 0, |
|||
status: true, |
|||
fixed: '', |
|||
columnWidth:120, |
|||
}, |
|||
], |
|||
saveFlag: false, |
|||
saveLoading: false, |
|||
} |
|||
}, |
|||
methods:{ |
|||
handleQuery(){ |
|||
let params = { |
|||
quotationDetailId: this.quotationDetail.quotationDetailId, |
|||
site: this.quotationDetail.site, |
|||
} |
|||
this.dataList = [] |
|||
queryQuoteDetailProperties(params).then(({data}) => { |
|||
if (data && data.code === 0){ |
|||
this.dataList = data.rows; |
|||
this.$emit("update:packCost",this.getPackInfoCost()) |
|||
this.$emit("update:shippingCost",this.getShippingInfoCost()) |
|||
}else { |
|||
this.$message.warning(data.msg); |
|||
} |
|||
}).catch((error)=>{ |
|||
this.$message.error(error); |
|||
}) |
|||
}, |
|||
handleEdit(){ |
|||
if (this.dataList.length === 0){ |
|||
this.$message.warning("没有属性信息,请先新增属性信息"); |
|||
return; |
|||
} |
|||
if (this.saveFlag){ |
|||
let params = this.dataList.map(item => { |
|||
return { |
|||
quotationDetailId: this.quotationDetail.quotationDetailId, |
|||
site: this.quotationDetail.site, |
|||
orderNo: item.orderNo, |
|||
textValue: item.textValue, |
|||
numValue: item.numValue, |
|||
subCodeSeqNo: item.subCodeSeqNo, |
|||
codeNo: item.codeNo, |
|||
functionType: item.functionType, |
|||
} |
|||
}) |
|||
this.saveLoading = true; |
|||
editQuoteDetailProperties(params).then(({data})=>{ |
|||
if (data && data.code === 0){ |
|||
this.$message.success(data.msg); |
|||
this.saveFlag = false; |
|||
this.handleQuery(); |
|||
}else { |
|||
this.$message.warning(data.msg); |
|||
} |
|||
this.saveLoading = false; |
|||
}).catch((error)=>{ |
|||
this.saveLoading = false; |
|||
this.$message.error(error); |
|||
}) |
|||
}else { |
|||
this.saveFlag = true; |
|||
} |
|||
}, |
|||
getPackInfoCost(){ |
|||
let boxOfBags = this.dataList.find((item)=>item.itemNo.toUpperCase() === 'PACK-BAGS/BOX'); |
|||
let boxCost = this.dataList.find((item)=>item.itemNo.toUpperCase() === 'PACK-BOX-COST'); |
|||
let packOtherCost = this.dataList.find((item)=>item.itemNo.toUpperCase() === 'PACK-OTHER-COST'); |
|||
let numOfBag = this.dataList.find((item)=>item.itemNo.toUpperCase() === 'PACK-PCS/PE-BAG'); |
|||
let bagCost = this.dataList.find((item)=>item.itemNo.toUpperCase() === 'PACK-PE-BAG-COST'); |
|||
if (!boxCost || !boxOfBags || !numOfBag || !bagCost){ |
|||
// this.$message.warning("缺少包装信息") |
|||
return 0; |
|||
} |
|||
if (boxCost.numValue === null || boxCost.numValue === undefined || boxOfBags.numValue === null || boxOfBags.numValue === undefined |
|||
|| numOfBag.numValue === null || numOfBag.numValue === undefined || bagCost.numValue === null || bagCost.numValue === undefined){ |
|||
// this.$message.warning("缺少包装信息") |
|||
return 0; |
|||
} |
|||
let num1 = new Decimal(bagCost.numValue).div(new Decimal(numOfBag.numValue)); |
|||
let num2 = new Decimal(boxCost.numValue).div(new Decimal(boxOfBags.numValue)); |
|||
return num1.add(num2).toSignificantDigits().toNumber() |
|||
}, |
|||
getShippingInfoCost(){ |
|||
let shippingCost = this.dataList.find((item)=>item.itemNo.toUpperCase() === 'SHIPPING-COST'); |
|||
let shippingDeliverQuantity = this.dataList.find((item)=>item.itemNo.toUpperCase() === 'SHIPPING-DELIVER-QUANTITY'); |
|||
let shippingOtherCost = this.dataList.find((item)=>item.itemNo.toUpperCase() === 'SHIPPING-OTHER-COST'); |
|||
if (!shippingCost || !shippingDeliverQuantity){ |
|||
// this.$message.warning("缺少交付/运输信息") |
|||
return 0; |
|||
} |
|||
if (shippingCost.numValue === null || shippingCost.numValue === undefined || shippingDeliverQuantity.numValue === null || shippingDeliverQuantity.numValue === undefined){ |
|||
// this.$message.warning("缺少交付/运输信息") |
|||
return 0; |
|||
} |
|||
return new Decimal(shippingCost.numValue).div(new Decimal(shippingDeliverQuantity.numValue)).toSignificantDigits().toNumber() |
|||
}, |
|||
handleQueryAllProperty(){ |
|||
let params = { |
|||
site: this.$store.state.user.site, |
|||
quotationDetailId: this.quotationDetail.quotationDetailId, |
|||
itemNo: this.property.itemNo, |
|||
itemDesc: this.property.itemDesc, |
|||
} |
|||
this.propertyList = []; |
|||
queryQuoteDetailPropertiesItem(params).then(({data})=>{ |
|||
if (data && data.code === 0){ |
|||
this.propertyList = data.rows; |
|||
this.propertyVisible = true; |
|||
}else { |
|||
this.$message.warning(data.msg); |
|||
} |
|||
}).catch((error)=>{ |
|||
this.$message.error(error); |
|||
}) |
|||
}, |
|||
handleAdd(){ |
|||
if (this.selectionPropertyList.length === 0){ |
|||
this.$message.warning("请先选择要添加的属性"); |
|||
return; |
|||
} |
|||
newQuoteDetailProperties(this.selectionPropertyList).then(({data})=>{ |
|||
if (data && data.code === 0){ |
|||
this.$message.success(data.msg); |
|||
this.handleQuery(); |
|||
this.handleQueryAllProperty(); |
|||
}else { |
|||
this.$message.warning(data.msg); |
|||
} |
|||
}).catch((error)=>{ |
|||
this.$message.error(error); |
|||
}) |
|||
}, |
|||
handleDelete(){ |
|||
if (this.selectionDataList.length === 0){ |
|||
this.$message.warning("请先选择要删除的属性"); |
|||
return; |
|||
} |
|||
let params = this.selectionDataList.map(item => { |
|||
return { |
|||
quotationDetailId: this.quotationDetail.quotationDetailId, |
|||
site: this.quotationDetail.site, |
|||
orderNo: item.orderNo, |
|||
subCodeSeqNo: item.subCodeSeqNo, |
|||
codeNo: item.codeNo, |
|||
recordType: item.functionType, |
|||
} |
|||
}) |
|||
deleteQuoteDetailProperties(params).then(({data})=>{ |
|||
if (data && data.code === 0){ |
|||
this.$message.success(data.msg); |
|||
this.handleQuery(); |
|||
this.handleQueryAllProperty(); |
|||
}else { |
|||
this.$message.warning(data.msg); |
|||
} |
|||
}).catch((error)=>{ |
|||
this.$message.error(error); |
|||
}) |
|||
}, |
|||
selectionChangeDataList(val){ |
|||
this.selectionDataList = val; |
|||
}, |
|||
selectionChangePropertyList(val){ |
|||
this.selectionPropertyList = val; |
|||
} |
|||
}, |
|||
created() { |
|||
this.saveFlag = false; |
|||
this.handleQuery(); |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<template> |
|||
<div> |
|||
<div> |
|||
<el-button type="primary" @click="handleQueryAllProperty">新增</el-button> |
|||
<el-button type="primary" @click="handleEdit">{{saveFlag?'保存':'编辑'}}</el-button> |
|||
</div> |
|||
<div class="rq"> |
|||
<el-table |
|||
:height="height" |
|||
:data="dataList" |
|||
border |
|||
style="width: 100%;margin-top: 5px"> |
|||
<el-table-column |
|||
v-for="(item,index) in columns" :key="index" |
|||
:sortable="item.columnSortable" |
|||
:prop="item.columnProp" |
|||
:header-align="item.headerAlign" |
|||
:show-overflow-tooltip="item.showOverflowTooltip" |
|||
:align="item.align" |
|||
:fixed="item.fixed===''?false:item.fixed" |
|||
:min-width="item.columnWidth" |
|||
:label="item.columnLabel"> |
|||
<template slot-scope="scope"> |
|||
<div v-if="item.columnProp !== 'textValue' && item.columnProp !== 'numValue'"> |
|||
<span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span> |
|||
<span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span> |
|||
</div> |
|||
<div v-else-if="saveFlag"> |
|||
<span v-if="scope.row.valueType === '文本'"> |
|||
<el-input v-model="scope.row.textValue"></el-input> |
|||
</span> |
|||
<span v-if="scope.row.valueType === '数字'"> |
|||
<el-input-number v-model="scope.row.numValue" :controls="false" :step="0"></el-input-number> |
|||
</span> |
|||
</div> |
|||
<div v-else> |
|||
<span v-if="scope.row.valueType === '文本'"> |
|||
{{scope.row.textValue}} |
|||
</span> |
|||
<span v-if="scope.row.valueType === '数字'" style="float: right"> |
|||
{{scope.row.numValue}} |
|||
</span> |
|||
</div> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
</div> |
|||
|
|||
<el-dialog title="属性信息" :visible.sync="propertyVisible" append-to-body width="1000px"> |
|||
<el-form :model="property" label-position="top" :inline="true"> |
|||
<el-form-item label="属性编码"> |
|||
<el-input v-model="property.itemNo"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="属性名称"> |
|||
<el-input v-model="property.itemDesc"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label=" "> |
|||
<el-button type="primary" @click="handleQueryAllProperty">查询</el-button> |
|||
</el-form-item> |
|||
</el-form> |
|||
<el-row :gutter="20"> |
|||
<el-col :span="11"> |
|||
<span style="font-size: 12px">可选属性:</span> |
|||
<el-table |
|||
height="400px" |
|||
:data="propertyList" |
|||
ref="searchTable" |
|||
@selection-change="selectionChangePropertyList" |
|||
@row-click="" |
|||
border> |
|||
<el-table-column |
|||
type="selection" |
|||
header-align="center" |
|||
align="center" |
|||
width="50"> |
|||
</el-table-column> |
|||
<el-table-column |
|||
prop="itemNo" |
|||
header-align="center" |
|||
align="left" |
|||
label="属性编码"> |
|||
</el-table-column> |
|||
<el-table-column |
|||
prop="itemDesc" |
|||
header-align="center" |
|||
align="left" |
|||
label="属性名称"> |
|||
</el-table-column> |
|||
</el-table> |
|||
</el-col> |
|||
<!--按钮--> |
|||
<el-col :span="2"> |
|||
<div style="text-align: center;display: flex;flex-direction: column;align-items: center;justify-content: center;height: 400px"> |
|||
<div><el-button type="primary" @click="handleAdd">新增<i class="el-icon-d-arrow-right el-icon--right"></i></el-button></div> |
|||
<div><el-button type="primary" @click="handleDelete" icon="el-icon-d-arrow-left" style="margin-top: 10px">删除</el-button></div> |
|||
</div> |
|||
</el-col> |
|||
<!--表格2--> |
|||
<el-col :span="11"> |
|||
<span style="font-size: 12px">已有属性:</span> |
|||
<el-table |
|||
height="400px" |
|||
:data="dataList" |
|||
ref="dataTable" |
|||
@selection-change="selectionChangeDataList" |
|||
@row-click="" |
|||
border> |
|||
<el-table-column |
|||
type="selection" |
|||
header-align="center" |
|||
align="center" |
|||
width="50"> |
|||
</el-table-column> |
|||
<el-table-column |
|||
prop="itemNo" |
|||
header-align="center" |
|||
align="left" |
|||
label="属性编码"> |
|||
</el-table-column> |
|||
<el-table-column |
|||
prop="itemDesc" |
|||
header-align="center" |
|||
align="left" |
|||
label="属性名称"> |
|||
</el-table-column> |
|||
</el-table> |
|||
</el-col> |
|||
</el-row> |
|||
</el-dialog> |
|||
</div> |
|||
</template> |
|||
|
|||
<style scoped> |
|||
|
|||
</style> |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue