查询物料

This commit is contained in:
JIAL 2024-02-20 16:55:36 +08:00
parent 727479de7a
commit b3bbed0d7d
8 changed files with 394 additions and 120 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,11 +1,13 @@
package com.JN.demo.zmquotation.controller; package com.JN.demo.zmquotation.controller;
import com.JN.common.R; import com.JN.common.R;
import com.JN.demo.zmquotation.dto.MaterialDto;
import com.JN.demo.zmquotation.dto.RegionDto; import com.JN.demo.zmquotation.dto.RegionDto;
import com.JN.demo.zmquotation.service.RegionService; import com.JN.demo.zmquotation.service.RegionService;
import lombok.experimental.PackagePrivate; import lombok.experimental.PackagePrivate;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.convert.ReadingConverter;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
@ -27,6 +29,14 @@ public class ZMController {
@Autowired @Autowired
RegionService regionService; RegionService regionService;
/**
* @title queryRegionList
* @description 查询地区列表信息
* @author JIAL
* @param: regionName
* @updateTime 2024/2/20 16:54
* @return: com.JN.common.R<java.util.List<com.JN.demo.zmquotation.dto.RegionDto>>
*/
@PostMapping("/regionList") @PostMapping("/regionList")
public R<List<RegionDto>> queryRegionList(@RequestParam("regionName") String regionName){ public R<List<RegionDto>> queryRegionList(@RequestParam("regionName") String regionName){
@ -36,4 +46,26 @@ public class ZMController {
return R.success(regionList); return R.success(regionList);
} }
/**
* @title queryMaterialList
* @description 查询物料信息
* @author JIAL
* @param: precMaterialName
* @param: vagueMaterialName
* @param: vagueModel
* @updateTime 2024/2/20 16:54
* @return: com.JN.common.R<java.util.List<com.JN.demo.zmquotation.dto.MaterialDto>>
*/
@PostMapping("/materialList")
public R<List<MaterialDto>> queryMaterialList(@RequestParam("precMaterialName") String precMaterialName,
@RequestParam("vagueMaterialName") String vagueMaterialName,
@RequestParam("vagueModel") String vagueModel) {
return null;
}
} }

View File

@ -0,0 +1,43 @@
package com.JN.demo.zmquotation.dto;
import lombok.Data;
import java.io.Serializable;
/**
* @ClassName MaterialDto
* @Description TODO
* @Author JIAL
* @Date 2024/2/20 16:42
* @Version 1.0
*/
@Data
public class MaterialDto implements Serializable {
private static final long serialVersionUID = 1L;
private String materialName; //物料名称
private String model; //型号
private String specification; //规格
private String voltage; //电压
private String standard; //标准
private String core; //线芯
private String costPrice; //成本价
private String factoryPrice; //厂价
private String netVolume; //净量
private String inventory; //盘具
private String weighInv; //盘重
}

View File

@ -14,7 +14,7 @@ import java.math.BigDecimal;
*/ */
@Data @Data
public class RegionDto implements Serializable { public class RegionDto implements Serializable {
private static final long serialVersionUID = 1L;
private String province; private String province;

View File

@ -5,3 +5,11 @@ const queryRegionListByName = (params) => {
params params
}) })
} }
const queryMaterialListByParam = (params) => {
return $axios({
url: '/zmquotation/materialList',
method: 'post',
params
})
}

View File

@ -313,10 +313,8 @@
</div> </div>
<div style="text-align: center; margin-top: 10px;"> <div style="text-align: center; margin-top: 10px;">
<el-pagination <el-pagination
@size-change="handleRegionSizeChange"
@current-change="handleRegionCurrentChange" @current-change="handleRegionCurrentChange"
:current-page.sync="regionCurrentPage" :current-page.sync="regionCurrentPage"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize" :page-size="pageSize"
:total="regionTableData.length" :total="regionTableData.length"
></el-pagination> ></el-pagination>
@ -326,20 +324,20 @@
<div slot="title" class="regionTable-title" style="margin: 0px"> <div slot="title" class="regionTable-title" style="margin: 0px">
<el-form> <el-form>
<el-form-item > <el-form-item >
<el-input style="width: 200px; " v-model="regionName" placeholder="开头精确查询"> <el-input style="width: 200px; " v-model="precMaterialName" placeholder="开头物料名称精确查询">
</el-input> </el-input>
<el-input style="width: 200px; " v-model="regionName" placeholder="模糊查询"> <el-input style="width: 200px; " v-model="vagueMaterialName" placeholder="物料名称模糊查询">
</el-input> </el-input>
<el-input style="width: 200px; " v-model="regionName" placeholder="结尾精确查询"> <el-input style="width: 200px; " v-model="vagueModel" placeholder="型号模糊查询">
</el-input> </el-input>
<el-button type="primary" size="small" @click="searchRegion">查询物料</el-button> <el-button type="primary" size="small" @click="searchMaterial">查询物料</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
<div style="display: flex; flex-direction: row;"> <div style="display: flex; flex-direction: row;">
<div style="width: 866px"> <div style="width: 866px">
<el-table <el-table
:data="materialTableData" :data="getCurrentMaterialData"
ref="materialTable" ref="materialTable"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
:header-cell-style="{ background: '#eef1f6', color: '#606266', 'text-align': 'center', 'padding': '0px'}" :header-cell-style="{ background: '#eef1f6', color: '#606266', 'text-align': 'center', 'padding': '0px'}"
@ -386,6 +384,14 @@
label="线芯"> label="线芯">
</el-table-column> </el-table-column>
</el-table> </el-table>
<div style="text-align: center; margin-top: 10px;">
<el-pagination
@current-change="handleMaterialCurrentChange"
:current-page.sync="materialCurrentPage"
:page-size="pageSize"
:total="materialTableData.length"
></el-pagination>
</div>
</div> </div>
<div style="flex-grow: 1; padding-left: 20px;"> <div style="flex-grow: 1; padding-left: 20px;">
<div <div
@ -398,6 +404,7 @@
</div> </div>
</div> </div>
</div> </div>
<div style="text-align: center; padding-top: 20px"> <div style="text-align: center; padding-top: 20px">
<el-button-group> <el-button-group>
<el-button type="primary" size="small" style="margin-right: 80px" @click="addMaterialToTable">确认</el-button> <el-button type="primary" size="small" style="margin-right: 80px" @click="addMaterialToTable">确认</el-button>
@ -467,13 +474,14 @@
dialogRegionVisible: false, dialogRegionVisible: false,
regionName: '', regionName: '',
regionCurrentPage: 1, regionCurrentPage: 1,
materialCurrentPage: 1,
pageSize: 10, pageSize: 10,
dialogMaterialVisible: false, dialogMaterialVisible: false,
materialTableData: [ materialTableData: [
{ {
materialName: 'Material 1', materialName: 'Material 1',
model: 'Model A', model: 'Model A',
district: 'Spec 1', specification: 'Spec 1',
voltage: '220V', voltage: '220V',
standard: 'Standard 1', standard: 'Standard 1',
core: 'Core X' core: 'Core X'
@ -481,7 +489,7 @@
{ {
materialName: 'Material 2', materialName: 'Material 2',
model: 'Model B', model: 'Model B',
district: 'Spec 2', specification: 'Spec 2',
voltage: '110V', voltage: '110V',
standard: 'Standard 2', standard: 'Standard 2',
core: 'Core Y' core: 'Core Y'
@ -489,6 +497,10 @@
// Add more data as needed // Add more data as needed
], ],
selectedMaterialItems: [], // 选中的数据 selectedMaterialItems: [], // 选中的数据
precMaterialName: '',
vagueMaterialName: '',
vagueModel: '',
} }
}, },
computed: { computed: {
@ -497,8 +509,10 @@
const end = start + this.pageSize; const end = start + this.pageSize;
return this.regionTableData.slice(start, end); return this.regionTableData.slice(start, end);
}, },
getCurrentMaterialData(){ getCurrentMaterialData() {
const start = (this.materialCurrentPage - 1) * this.pageSize;
const end = start + this.pageSize;
return this.materialTableData.slice(start, end);
}, },
}, },
created() { created() {
@ -562,15 +576,16 @@
} }
}, },
handleRegionSizeChange(val) {
this.pageSize = val;
this.currentPage = 1; // 切换每页显示条目数时回到第一页
},
handleRegionCurrentChange(val) { handleRegionCurrentChange(val) {
this.currentPage = val; this.currentPage = val;
}, },
handleMaterialCurrentChange(val) {
this.currentPage = val;
},
addMaterial(){ addMaterial(){
this.dialogMaterialVisible = true; this.dialogMaterialVisible = true;
}, },
@ -605,6 +620,29 @@
closeMaterialDialog() { closeMaterialDialog() {
this.dialogMaterialVisible = false; this.dialogMaterialVisible = false;
},
searchMaterial() {
if(this.precMaterialName === '' && this.vagueMaterialName === '' && this.vagueModel === '') {
this.$message({
message: '请输入你要查询的无聊条件',
type: 'warning'
});
}else {
const params = {
precMaterialName : this.precMaterialName,
vagueMaterialName : this.vagueMaterialName,
vagueModel : this.vagueModel
}
queryMaterialListByParam(params).then(res => {
this.materialTableData = res.data || []
this.materialCurrentPage = 1;
}).catch(err => {
this.$message.error('请求出错了:' + err)
})
}
} }
}, },

View File

@ -68,11 +68,11 @@
} }
.regionTable .el-dialog__header{ .regionDialogTable .el-dialog__header{
padding-bottom: 0px; padding-bottom: 0px;
} }
.regionTable .el-dialog__body{ .regionDialogTable .el-dialog__body{
padding-top: 0px; padding-top: 0px;
} }
@ -122,3 +122,18 @@
.table-box { .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>
<div class="table-box"> <div class="table-box">
<el-table <el-table
:data="tableData" :data="materialData"
border border
:cell-style="cellStyle" :cell-style="cellStyle"
:header-cell-style="{ background: '#eef1f6', color: '#606266', 'text-align': 'center' }"> :header-cell-style="{ background: '#eef1f6', color: '#606266', 'text-align': 'center' }">
@ -170,83 +170,83 @@
<el-table-column <el-table-column
fixed fixed
width="180" width="180"
prop="kunnr1" prop="materialName"
label="物料名称"> label="物料名称">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
width="180" width="180"
prop="kunnr2" prop="quantity"
label="数量"> label="数量">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.kunnr2" > <el-input v-model="scope.row.quantity" >
</el-input> </el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
width="180" width="180"
prop="kunnr3" prop="voltage"
label="电压"> label="电压">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
width="180" width="180"
prop="kunnr4" prop="standard"
label="标准"> label="标准">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
width="180" width="180"
prop="kunnr5" prop="core"
label="芯"> label="线芯">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
width="180" width="180"
prop="kunnr6" prop="costPrice"
label="成本价"> label="成本价">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
width="180" width="180"
prop="kunnr7" prop="factoryPrice"
label="厂价"> label="厂价">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
width="180" width="180"
prop="kunnr8" prop="netVolume"
label="净量"> label="净量">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
width="180" width="180"
prop="kunnr8" prop="inventory"
label="盘具"> label="盘具">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.kunnr2" > <el-input v-model="scope.row.inventory" >
</el-input> </el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
width="180" width="180"
prop="kunnr8" prop="weighInv"
label="盘重"> label="盘重">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
width="180" width="180"
prop="kunnr8" prop="totalWeight"
label="总重"> label="总重">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
fixed="right" fixed="right"
width="120" width="120"
prop="kunnr8" prop="totalCost"
label="总成本"> label="总成本">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
fixed="right" fixed="right"
width="120" width="120"
prop="kunnr8" prop="totalFacPrice"
label="总厂价"> label="总厂价">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
fixed="right" fixed="right"
width="120" width="120"
prop="kunnr8" prop="totalNetWt"
label="总净重"> label="总净重">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
@ -260,7 +260,7 @@
</el-table> </el-table>
</div> </div>
</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"> <div slot="title" class="regionTable-title" style="margin: 0px">
<el-form> <el-form>
<el-form-item > <el-form-item >
@ -270,36 +270,37 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
<el-table <div>
:data="getCurrentRegionData" <el-table
:header-cell-style="{ background: '#eef1f6', color: '#606266', 'text-align': 'center', 'padding': '0px'}" :data="getCurrentRegionData"
:cell-style="{'text-align': 'center', 'padding': '0px'}" :header-cell-style="{ background: '#eef1f6', color: '#606266', 'text-align': 'center', 'padding': '0px'}"
highlight-current-row :cell-style="{'text-align': 'center', 'padding': '0px'}"
border> highlight-current-row
border>
<el-table-column <el-table-column
label="序号" label="序号"
type="index" type="index"
width="50"> width="50">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
width="180" width="180"
prop="province" prop="province"
label="省"> label="省">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
width="180" width="180"
prop="city" prop="city"
label="市"> label="市">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
width="200" width="200"
prop="district" prop="district"
label="区"> label="区">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
width="200" width="200"
prop="kilometers" prop="kilometers"
label="公里数"> label="公里数">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
width="80" width="80"
@ -308,13 +309,12 @@
<el-button @click="chooseRegion(scope.row)" style="color: blue;" type="text">选择</el-button> <el-button @click="chooseRegion(scope.row)" style="color: blue;" type="text">选择</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</div>
<div style="text-align: center; margin-top: 10px;"> <div style="text-align: center; margin-top: 10px;">
<el-pagination <el-pagination
@size-change="handleRegionSizeChange"
@current-change="handleRegionCurrentChange" @current-change="handleRegionCurrentChange"
:current-page.sync="regionCurrentPage" :current-page.sync="regionCurrentPage"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize" :page-size="pageSize"
:total="regionTableData.length" :total="regionTableData.length"
></el-pagination> ></el-pagination>
@ -334,53 +334,73 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
<div style="width: 866px"> <div style="display: flex; flex-direction: row;">
<el-table <div style="width: 866px">
:data="materialData" <el-table
:header-cell-style="{ background: '#eef1f6', color: '#606266', 'text-align': 'center', 'padding': '0px'}" :data="materialTableData"
:cell-style="{'text-align': 'center', 'padding': '0px'}" ref="materialTable"
highlight-selection-row @selection-change="handleSelectionChange"
border> :header-cell-style="{ background: '#eef1f6', color: '#606266', 'text-align': 'center', 'padding': '0px'}"
<el-table-column :cell-style="{'text-align': 'center', 'padding': '5px 0px'}"
type="selection" highlight-selection-row
width="55"> border>
</el-table-column> <el-table-column
<el-table-column type="selection"
label="序号" width="55">
type="index" </el-table-column>
width="50"> <el-table-column
</el-table-column> label="序号"
<el-table-column type="index"
width="200" width="50">
prop="materialName" </el-table-column>
label="物料名称"> <el-table-column
</el-table-column> width="200"
<el-table-column prop="materialName"
width="120" label="物料名称">
prop="model" </el-table-column>
label="型号"> <el-table-column
</el-table-column> width="120"
<el-table-column prop="model"
width="120" label="型号">
prop="district" </el-table-column>
label="specification"> <el-table-column
</el-table-column> width="120"
<el-table-column prop="specification"
width="120" label="规格">
prop="voltage" </el-table-column>
label="电压"> <el-table-column
</el-table-column> width="120"
<el-table-column prop="voltage"
width="100" label="电压">
prop="standard" </el-table-column>
label="标准"> <el-table-column
</el-table-column> width="100"
<el-table-column prop="standard"
width="100" label="标准">
prop="core" </el-table-column>
label="线芯"> <el-table-column
</el-table-column> width="100"
</el-table> 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> </div>
</el-dialog> </el-dialog>
@ -420,12 +440,23 @@
totalFactoryAmount: '', /*厂价金额合计*/ totalFactoryAmount: '', /*厂价金额合计*/
totalActualAmount: '', /*实际金额合计*/ totalActualAmount: '', /*实际金额合计*/
}, },
tableData: [ materialData: [
{ 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 regionTableData: [
{
province: '浙江',
city: '杭州',
district: '西湖区',
kilometers: 10
},
{
province: '上海',
city: '上海',
district: '黄浦区',
kilometers: 20
},
], ],
regionTableData: [],
price_0t_5t: '', price_0t_5t: '',
price_5t_10t: '', price_5t_10t: '',
price_10t_25t: '', price_10t_25t: '',
@ -436,7 +467,7 @@
regionCurrentPage: 1, regionCurrentPage: 1,
pageSize: 10, pageSize: 10,
dialogMaterialVisible: false, dialogMaterialVisible: false,
materialData: [ materialTableData: [
{ {
materialName: 'Material 1', materialName: 'Material 1',
model: 'Model A', model: 'Model A',
@ -454,7 +485,8 @@
core: 'Core Y' core: 'Core Y'
}, },
// Add more data as needed // Add more data as needed
] ],
selectedMaterialItems: [], // 选中的数据
} }
}, },
computed: { computed: {
@ -489,7 +521,7 @@
}, },
handleDeleteClick(index){ handleDeleteClick(index){
this.tableData.splice(index, 1) this.materialData.splice(index, 1)
}, },
selectedRegion(){ selectedRegion(){
@ -528,10 +560,7 @@
} }
}, },
handleRegionSizeChange(val) {
this.pageSize = val;
this.currentPage = 1; // 切换每页显示条目数时回到第一页
},
handleRegionCurrentChange(val) { handleRegionCurrentChange(val) {
this.currentPage = val; this.currentPage = val;
@ -539,6 +568,38 @@
addMaterial(){ addMaterial(){
this.dialogMaterialVisible = true; 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;
} }
}, },