添加物料功能

This commit is contained in:
JIAL 2024-02-20 13:39:33 +08:00
parent a57320e9e0
commit 727479de7a
7 changed files with 1345 additions and 1103 deletions

View File

@ -2,5 +2,6 @@
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
</component>
</project>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -68,11 +68,20 @@
}
.regionTable .el-dialog__header{
.regionDialogTable .el-dialog__header{
padding-bottom: 0px;
}
.regionTable .el-dialog__body{
.regionDialogTable .el-dialog__body{
padding-top: 0px;
}
.materialDialogTable .el-dialog__header{
padding-bottom: 0px;
}
.materialDialogTable .el-dialog__body{
padding-top: 0px;
}
@ -113,3 +122,18 @@
.table-box {
}
.selected-item {
background-color: #f0f0f0;
border: 1px solid #ccc;
border-radius: 5px;
padding: 5px;
margin-bottom: 5px;
display: flex;
justify-content: space-between;
}
.remove-btn {
padding: 0px;
color: red;
}

View File

@ -157,7 +157,7 @@
</div>
<div class="table-box">
<el-table
:data="tableData"
:data="materialData"
border
:cell-style="cellStyle"
:header-cell-style="{ background: '#eef1f6', color: '#606266', 'text-align': 'center' }">
@ -170,83 +170,83 @@
<el-table-column
fixed
width="180"
prop="kunnr1"
prop="materialName"
label="物料名称">
</el-table-column>
<el-table-column
width="180"
prop="kunnr2"
prop="quantity"
label="数量">
<template slot-scope="scope">
<el-input v-model="scope.row.kunnr2" >
<el-input v-model="scope.row.quantity" >
</el-input>
</template>
</el-table-column>
<el-table-column
width="180"
prop="kunnr3"
prop="voltage"
label="电压">
</el-table-column>
<el-table-column
width="180"
prop="kunnr4"
prop="standard"
label="标准">
</el-table-column>
<el-table-column
width="180"
prop="kunnr5"
label="芯">
prop="core"
label="线芯">
</el-table-column>
<el-table-column
width="180"
prop="kunnr6"
prop="costPrice"
label="成本价">
</el-table-column>
<el-table-column
width="180"
prop="kunnr7"
prop="factoryPrice"
label="厂价">
</el-table-column>
<el-table-column
width="180"
prop="kunnr8"
prop="netVolume"
label="净量">
</el-table-column>
<el-table-column
width="180"
prop="kunnr8"
prop="inventory"
label="盘具">
<template slot-scope="scope">
<el-input v-model="scope.row.kunnr2" >
<el-input v-model="scope.row.inventory" >
</el-input>
</template>
</el-table-column>
<el-table-column
width="180"
prop="kunnr8"
prop="weighInv"
label="盘重">
</el-table-column>
<el-table-column
width="180"
prop="kunnr8"
prop="totalWeight"
label="总重">
</el-table-column>
<el-table-column
fixed="right"
width="120"
prop="kunnr8"
prop="totalCost"
label="总成本">
</el-table-column>
<el-table-column
fixed="right"
width="120"
prop="kunnr8"
prop="totalFacPrice"
label="总厂价">
</el-table-column>
<el-table-column
fixed="right"
width="120"
prop="kunnr8"
prop="totalNetWt"
label="总净重">
</el-table-column>
<el-table-column
@ -260,7 +260,7 @@
</el-table>
</div>
</div>
<el-dialog class="regionTable" :visible.sync="dialogRegionVisible" width="932px" >
<el-dialog class="regionDialogTable" :visible.sync="dialogRegionVisible" width="932px" >
<div slot="title" class="regionTable-title" style="margin: 0px">
<el-form>
<el-form-item >
@ -270,36 +270,37 @@
</el-form-item>
</el-form>
</div>
<el-table
:data="getCurrentRegionData"
:header-cell-style="{ background: '#eef1f6', color: '#606266', 'text-align': 'center', 'padding': '0px'}"
:cell-style="{'text-align': 'center', 'padding': '0px'}"
highlight-current-row
border>
<div>
<el-table
:data="getCurrentRegionData"
:header-cell-style="{ background: '#eef1f6', color: '#606266', 'text-align': 'center', 'padding': '0px'}"
:cell-style="{'text-align': 'center', 'padding': '0px'}"
highlight-current-row
border>
<el-table-column
label="序号"
type="index"
width="50">
label="序号"
type="index"
width="50">
</el-table-column>
<el-table-column
width="180"
prop="province"
label="省">
width="180"
prop="province"
label="省">
</el-table-column>
<el-table-column
width="180"
prop="city"
label="市">
width="180"
prop="city"
label="市">
</el-table-column>
<el-table-column
width="200"
prop="district"
label="区">
width="200"
prop="district"
label="区">
</el-table-column>
<el-table-column
width="200"
prop="kilometers"
label="公里数">
width="200"
prop="kilometers"
label="公里数">
</el-table-column>
<el-table-column
width="80"
@ -308,7 +309,8 @@
<el-button @click="chooseRegion(scope.row)" style="color: blue;" type="text">选择</el-button>
</template>
</el-table-column>
</el-table>
</el-table>
</div>
<div style="text-align: center; margin-top: 10px;">
<el-pagination
@size-change="handleRegionSizeChange"
@ -320,56 +322,89 @@
></el-pagination>
</div>
</el-dialog>
<el-dialog class="materialDialogTable" :visible.sync="dialogMaterialVisible" width="932px">
<el-dialog class="materialDialogTable" :visible.sync="dialogMaterialVisible" width="1300px">
<div slot="title" class="regionTable-title" style="margin: 0px">
<el-form>
<el-form-item >
<el-input style="width: 200px; " v-model="regionName" placeholder="请输入地区名称">
<el-input style="width: 200px; " v-model="regionName" placeholder="开头精确查询">
</el-input>
<el-input style="width: 200px; " v-model="regionName" placeholder="请输入地区名称">
<el-input style="width: 200px; " v-model="regionName" placeholder="模糊查询">
</el-input>
<el-input style="width: 200px; " v-model="regionName" placeholder="请输入地区名称">
<el-input style="width: 200px; " v-model="regionName" placeholder="结尾精确查询">
</el-input>
<el-button type="primary" size="small" @click="searchRegion">查询地区</el-button>
<el-button type="primary" size="small" @click="searchRegion">查询物料</el-button>
</el-form-item>
</el-form>
</div>
<el-table
:data="getCurrentRegionData"
:header-cell-style="{ background: '#eef1f6', color: '#606266', 'text-align': 'center', 'padding': '0px'}"
:cell-style="{'text-align': 'center', 'padding': '0px'}"
highlight-current-row
border>
<el-table-column
type="selection"
width="55">
</el-table-column>
<el-table-column
label="序号"
type="index"
width="50">
</el-table-column>
<el-table-column
width="180"
prop="province"
label="省">
</el-table-column>
<el-table-column
width="180"
prop="city"
label="市">
</el-table-column>
<el-table-column
width="200"
prop="district"
label="区">
</el-table-column>
<el-table-column
width="200"
prop="kilometers"
label="公里数">
</el-table-column>
</el-table>
<div style="display: flex; flex-direction: row;">
<div style="width: 866px">
<el-table
:data="materialTableData"
ref="materialTable"
@selection-change="handleSelectionChange"
:header-cell-style="{ background: '#eef1f6', color: '#606266', 'text-align': 'center', 'padding': '0px'}"
:cell-style="{'text-align': 'center', 'padding': '5px 0px'}"
highlight-selection-row
border>
<el-table-column
type="selection"
width="55">
</el-table-column>
<el-table-column
label="序号"
type="index"
width="50">
</el-table-column>
<el-table-column
width="200"
prop="materialName"
label="物料名称">
</el-table-column>
<el-table-column
width="120"
prop="model"
label="型号">
</el-table-column>
<el-table-column
width="120"
prop="specification"
label="规格">
</el-table-column>
<el-table-column
width="120"
prop="voltage"
label="电压">
</el-table-column>
<el-table-column
width="100"
prop="standard"
label="标准">
</el-table-column>
<el-table-column
width="100"
prop="core"
label="线芯">
</el-table-column>
</el-table>
</div>
<div style="flex-grow: 1; padding-left: 20px;">
<div
v-for="(selectedItem, index) in selectedMaterialItems"
:key="index"
class="selected-item"
>
{{ selectedItem.materialName }} - {{ selectedItem.voltage }}
<el-button @click="removeSelectedItem(selectedItem)" type="text" class="remove-btn">&#10006;</el-button>
</div>
</div>
</div>
<div style="text-align: center; padding-top: 20px">
<el-button-group>
<el-button type="primary" size="small" style="margin-right: 80px" @click="addMaterialToTable">确认</el-button>
<el-button type="warning" size="small" @click="closeMaterialDialog">取消</el-button>
</el-button-group>
</div>
</el-dialog>
</div>
@ -407,12 +442,23 @@
totalFactoryAmount: '', /*厂价金额合计*/
totalActualAmount: '', /*实际金额合计*/
},
tableData: [
{ kunnr1: '001', kunnr2: '002', kunnr3: '003', kunnr4: '004', kunnr5: '005', kunnr6: '006', kunnr7: '007', kunnr8: '008' },
{ kunnr1: '101', kunnr2: '102', kunnr3: '103', kunnr4: '104', kunnr5: '105', kunnr6: '106', kunnr7: '107', kunnr8: '108' },
// Add more rows as needed
materialData: [
],
regionTableData: [
{
province: '浙江',
city: '杭州',
district: '西湖区',
kilometers: 10
},
{
province: '上海',
city: '上海',
district: '黄浦区',
kilometers: 20
},
],
regionTableData: [],
price_0t_5t: '',
price_5t_10t: '',
price_10t_25t: '',
@ -423,6 +469,26 @@
regionCurrentPage: 1,
pageSize: 10,
dialogMaterialVisible: false,
materialTableData: [
{
materialName: 'Material 1',
model: 'Model A',
district: 'Spec 1',
voltage: '220V',
standard: 'Standard 1',
core: 'Core X'
},
{
materialName: 'Material 2',
model: 'Model B',
district: 'Spec 2',
voltage: '110V',
standard: 'Standard 2',
core: 'Core Y'
},
// Add more data as needed
],
selectedMaterialItems: [], // 选中的数据
}
},
computed: {
@ -431,6 +497,9 @@
const end = start + this.pageSize;
return this.regionTableData.slice(start, end);
},
getCurrentMaterialData(){
},
},
created() {
@ -445,16 +514,16 @@
cellStyle({row, column, rowIndex, columnIndex}) {
if(columnIndex === 0) {
return 'color : black; text-align : center; background : #E0E0E0; padding: 2px 0px 1px 0px';
return 'color : black; text-align : center; background : #E0E0E0; padding: 0px';
} else if (columnIndex === 8) {
return 'text-align : center; background : #F5F5F5; padding: 2px 0px 1px 0px';
return 'text-align : center; background : #F5F5F5; padding: 0px';
} else {
return ' text-align : center; height : 10px; padding: 2px 0px 1px 0px';
return ' text-align : center; padding: 0px';
}
},
handleDeleteClick(index){
this.tableData.splice(index, 1)
this.materialData.splice(index, 1)
},
selectedRegion(){
@ -504,6 +573,38 @@
addMaterial(){
this.dialogMaterialVisible = true;
},
handleSelectionChange(selection) {
// 当选择发生变化时更新选中数据
this.selectedMaterialItems = selection;
},
removeSelectedItem(selectedItem) {
// 移除选中的记录
const index = this.selectedMaterialItems.indexOf(selectedItem);
if (index !== -1) {
this.selectedMaterialItems.splice(index, 1);
}
// 同步取消左侧表格中对应项的选择
const tableIndex = this.materialTableData.indexOf(selectedItem);
if (tableIndex !== -1) {
this.$refs.materialTable.toggleRowSelection(this.materialTableData[tableIndex]);
}
},
addMaterialToTable() {
// 将选中的物料信息添加到表格中
this.materialData = this.materialData.concat(this.selectedMaterialItems);
// 清空选中的物料信息
this.selectedMaterialItems = [];
this.$refs.materialTable.clearSelection();
this.dialogMaterialVisible = false;
},
closeMaterialDialog() {
this.dialogMaterialVisible = false;
}
},

View File

@ -77,6 +77,15 @@
}
.materialDialogTable .el-dialog__header{
padding-bottom: 0px;
}
.materialDialogTable .el-dialog__body{
padding-top: 0px;
}
.el-table .el-table__cell {

View File

@ -151,7 +151,7 @@
</div>
<div class="button-box">
<el-button type="text" @click="selectedRegion">选择地区</el-button>
<el-button type="text">添加物料</el-button>
<el-button type="text" @click="addMaterial">添加物料</el-button>
<el-button type="text">刷新界面</el-button>
<el-button type="text"></el-button>
</div>
@ -171,7 +171,7 @@
fixed
width="180"
prop="kunnr1"
label="品名">
label="物料名称">
</el-table-column>
<el-table-column
width="180"
@ -320,6 +320,70 @@
></el-pagination>
</div>
</el-dialog>
<el-dialog class="materialDialogTable" :visible.sync="dialogMaterialVisible" width="1300px">
<div slot="title" class="regionTable-title" style="margin: 0px">
<el-form>
<el-form-item >
<el-input style="width: 200px; " v-model="regionName" placeholder="开头精确查询">
</el-input>
<el-input style="width: 200px; " v-model="regionName" placeholder="模糊查询">
</el-input>
<el-input style="width: 200px; " v-model="regionName" placeholder="结尾精确查询">
</el-input>
<el-button type="primary" size="small" @click="searchRegion">查询物料</el-button>
</el-form-item>
</el-form>
</div>
<div style="width: 866px">
<el-table
:data="materialData"
:header-cell-style="{ background: '#eef1f6', color: '#606266', 'text-align': 'center', 'padding': '0px'}"
:cell-style="{'text-align': 'center', 'padding': '0px'}"
highlight-selection-row
border>
<el-table-column
type="selection"
width="55">
</el-table-column>
<el-table-column
label="序号"
type="index"
width="50">
</el-table-column>
<el-table-column
width="200"
prop="materialName"
label="物料名称">
</el-table-column>
<el-table-column
width="120"
prop="model"
label="型号">
</el-table-column>
<el-table-column
width="120"
prop="district"
label="specification">
</el-table-column>
<el-table-column
width="120"
prop="voltage"
label="电压">
</el-table-column>
<el-table-column
width="100"
prop="standard"
label="标准">
</el-table-column>
<el-table-column
width="100"
prop="core"
label="线芯">
</el-table-column>
</el-table>
</div>
</el-dialog>
</div>
@ -371,6 +435,26 @@
regionName: '',
regionCurrentPage: 1,
pageSize: 10,
dialogMaterialVisible: false,
materialData: [
{
materialName: 'Material 1',
model: 'Model A',
district: 'Spec 1',
voltage: '220V',
standard: 'Standard 1',
core: 'Core X'
},
{
materialName: 'Material 2',
model: 'Model B',
district: 'Spec 2',
voltage: '110V',
standard: 'Standard 2',
core: 'Core Y'
},
// Add more data as needed
]
}
},
computed: {
@ -379,6 +463,9 @@
const end = start + this.pageSize;
return this.regionTableData.slice(start, end);
},
getCurrentMaterialData(){
},
},
created() {
@ -393,11 +480,11 @@
cellStyle({row, column, rowIndex, columnIndex}) {
if(columnIndex === 0) {
return 'color : black; text-align : center; background : #E0E0E0; padding: 2px 0px 1px 0px';
return 'color : black; text-align : center; background : #E0E0E0; padding: 0px';
} else if (columnIndex === 8) {
return 'text-align : center; background : #F5F5F5; padding: 2px 0px 1px 0px';
return 'text-align : center; background : #F5F5F5; padding: 0px';
} else {
return ' text-align : center; height : 10px; padding: 2px 0px 1px 0px';
return ' text-align : center; padding: 0px';
}
},
@ -420,8 +507,6 @@
this.price_10t_25t = row.price03
this.price_25t_100t = row.price04
this.price_100t = row.price05
},
searchRegion(){
if(this.regionName === ''){
@ -443,7 +528,6 @@
}
},
handleRegionSizeChange(val) {
this.pageSize = val;
this.currentPage = 1; // 切换每页显示条目数时回到第一页
@ -453,7 +537,9 @@
this.currentPage = val;
},
addMaterial(){
this.dialogMaterialVisible = true;
}
},
})