This commit is contained in:
JIAL 2024-02-21 16:55:04 +08:00
parent b3bbed0d7d
commit 0be39d74a1
18 changed files with 954 additions and 208 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -3,6 +3,7 @@ package com.JN.demo.zmquotation.controller;
import com.JN.common.R;
import com.JN.demo.zmquotation.dto.MaterialDto;
import com.JN.demo.zmquotation.dto.RegionDto;
import com.JN.demo.zmquotation.service.MaterialService;
import com.JN.demo.zmquotation.service.RegionService;
import lombok.experimental.PackagePrivate;
import lombok.extern.slf4j.Slf4j;
@ -29,6 +30,9 @@ public class ZMController {
@Autowired
RegionService regionService;
@Autowired
MaterialService materialService;
/**
* @title queryRegionList
* @description 查询地区列表信息
@ -61,10 +65,9 @@ public class ZMController {
public R<List<MaterialDto>> queryMaterialList(@RequestParam("precMaterialName") String precMaterialName,
@RequestParam("vagueMaterialName") String vagueMaterialName,
@RequestParam("vagueModel") String vagueModel) {
List<MaterialDto> materialList = materialService.queryMaterialListByParam(precMaterialName, vagueMaterialName, vagueModel);
return null;
return R.success(materialList);
}

View File

@ -25,19 +25,25 @@ public class MaterialDto implements Serializable {
private String standard; //标准
private String core; //线芯
private String costPrice; //成本价
private String factoryPrice; //厂价
private String netVolume; //
private String netVolume; //(物料重量)
private String inventory; //盘具
private String weighInv; //盘重
private String matPrice; //材料价格(去掉铜铝后的价格)
private String totalCopperConsume; //铜导体总消耗
private String totalAluminumConsume; //铝导体总消耗
private String totalLHCost; //人工水电费合计
private String steamFee; //蒸汽费
private int quantity = 1; //数量默认为1
}

View File

@ -0,0 +1,37 @@
package com.JN.demo.zmquotation.mapper;
import com.JN.demo.zmquotation.dto.MaterialDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/**
* @ClassName MaterialMapper
* @Description TODO
* @Author JIAL
* @Date 2024/2/21 8:16
* @Version 1.0
*/
@Mapper
public interface MaterialMapper {
@Select("SELECT [cb_name] as material_name\n" +
" ,[cb_cj] as factory_price\n" +
" ,[cb_cbj] as cost_price\n" +
" ,[cb_zl] as net_volume\n" +
" ,[cb_gspj] as inventory\n" +
" ,[cbpj_zl] as weigh_inv\n" +
" ,[CB_bz] as standard\n" +
" ,[cb_xx] as model\n" +
" ,[cb_gg] as specification\n" +
" ,[cb_dy] as voltage\n" +
" ,[cb_cljg] as mat_price\n" +
" ,[tdtjg] as total_copper_consume\n" +
" ,[ldtjg] as total_aluminum_consume\n" +
" ,[rgsdf] as total_l_h_cost\n" +
" ,[cb_zqf]as steam_fee\n" +
" FROM [zm_erp2].[dbo].[view_cb_material]\n" +
" WHERE [cb_name] like '${precMaterialName}%' and [cb_name] like '%${vagueMaterialName}%' and [cb_gg] like '%${vagueModel}%'")
List<MaterialDto> queryMaterialListByParam(String precMaterialName, String vagueMaterialName, String vagueModel);
}

View File

@ -0,0 +1,17 @@
package com.JN.demo.zmquotation.service;
import com.JN.demo.zmquotation.dto.MaterialDto;
import java.util.List;
/**
* @ClassName MaterialService
* @Description TODO
* @Author JIAL
* @Date 2024/2/21 8:15
* @Version 1.0
*/
public interface MaterialService {
List<MaterialDto> queryMaterialListByParam(String precMaterialName, String vagueMaterialName, String vagueModel);
}

View File

@ -0,0 +1,37 @@
package com.JN.demo.zmquotation.service.impl;
import com.JN.demo.zmquotation.dto.MaterialDto;
import com.JN.demo.zmquotation.mapper.MaterialMapper;
import com.JN.demo.zmquotation.service.MaterialService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @ClassName MaterialServiceImpl
* @Description TODO
* @Author JIAL
* @Date 2024/2/21 8:15
* @Version 1.0
*/
@Service
public class MaterialServiceImpl implements MaterialService {
@Autowired
MaterialMapper materialMapper;
/**
* @title queryMaterialListByParam
* @description 通过开头精确模糊查询型号三个参数来查询物料列表
* @author JIAL
* @param: precMaterialName
* @param: vagueMaterialName
* @param: vagueModel
* @updateTime 2024/2/21 8:23
* @return: java.util.List<com.JN.demo.zmquotation.dto.MaterialDto>
*/
@Override
public List<MaterialDto> queryMaterialListByParam(String precMaterialName, String vagueMaterialName, String vagueModel) {
return materialMapper.queryMaterialListByParam(precMaterialName, vagueMaterialName, vagueModel);
}
}

View File

@ -86,16 +86,17 @@
}
.el-table .el-table__cell {
.materialDialogTable .el-table__header-wrapper .el-table__header .el-checkbox {
display: none;
}
.el-row {
.el-table .cell {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.el-col {
height: 42px;
}

View File

@ -192,11 +192,6 @@
prop="standard"
label="标准">
</el-table-column>
<el-table-column
width="180"
prop="core"
label="线芯">
</el-table-column>
<el-table-column
width="180"
prop="costPrice"
@ -210,7 +205,7 @@
<el-table-column
width="180"
prop="netVolume"
label="净量">
label="净量">
</el-table-column>
<el-table-column
width="180"
@ -254,7 +249,7 @@
width="80"
label="操作">
<template slot-scope="scope">
<el-button @click="handleDeleteClick(scope.row)" style="color: red;" type="text">删除</el-button>
<el-button @click="handleDeleteClick(scope.$index)" style="color: red;" type="text">删除</el-button>
</template>
</el-table-column>
</el-table>
@ -320,7 +315,7 @@
></el-pagination>
</div>
</el-dialog>
<el-dialog class="materialDialogTable" :visible.sync="dialogMaterialVisible" width="1300px">
<el-dialog class="materialDialogTable" :visible.sync="dialogMaterialVisible" width="1200px">
<div slot="title" class="regionTable-title" style="margin: 0px">
<el-form>
<el-form-item >
@ -335,7 +330,7 @@
</el-form>
</div>
<div style="display: flex; flex-direction: row;">
<div style="width: 866px">
<div style="width: 766px">
<el-table
:data="getCurrentMaterialData"
ref="materialTable"
@ -343,6 +338,8 @@
:header-cell-style="{ background: '#eef1f6', color: '#606266', 'text-align': 'center', 'padding': '0px'}"
:cell-style="{'text-align': 'center', 'padding': '5px 0px'}"
highlight-selection-row
:row-key="row => row.materialName"
:reserve-selection="true"
border>
<el-table-column
type="selection"
@ -378,11 +375,6 @@
prop="standard"
label="标准">
</el-table-column>
<el-table-column
width="100"
prop="core"
label="线芯">
</el-table-column>
</el-table>
<div style="text-align: center; margin-top: 10px;">
<el-pagination
@ -478,25 +470,33 @@
pageSize: 10,
dialogMaterialVisible: false,
materialTableData: [
{
materialName: 'Material 1',
model: 'Model A',
specification: 'Spec 1',
voltage: '220V',
standard: 'Standard 1',
core: 'Core X'
},
{
materialName: 'Material 2',
model: 'Model B',
specification: 'Spec 2',
voltage: '110V',
standard: 'Standard 2',
core: 'Core Y'
},
// Add more data as needed
{ materialName: 'Material 1', model: 'Model A', specification: 'Spec 1', voltage: '220V', standard: 'Standard 1' },
{ materialName: 'Material 2', model: 'Model B', specification: 'Spec 2', voltage: '110V', standard: 'Standard 2' },
// ... (previous data)
// Additional test data
{ materialName: 'Material 3', model: 'Model C', specification: 'Spec 3', voltage: '120V', standard: 'Standard 3' },
{ materialName: 'Material 4', model: 'Model D', specification: 'Spec 4', voltage: '230V', standard: 'Standard 4' },
{ materialName: 'Material 5', model: 'Model E', specification: 'Spec 5', voltage: '240V', standard: 'Standard 5' },
{ materialName: 'Material 6', model: 'Model F', specification: 'Spec 6', voltage: '110V', standard: 'Standard 6' },
{ materialName: 'Material 7', model: 'Model G', specification: 'Spec 7', voltage: '220V', standard: 'Standard 7' },
{ materialName: 'Material 8', model: 'Model H', specification: 'Spec 8', voltage: '120V', standard: 'Standard 8' },
{ materialName: 'Material 9', model: 'Model I', specification: 'Spec 9', voltage: '230V', standard: 'Standard 9' },
{ materialName: 'Material 10', model: 'Model J', specification: 'Spec 10', voltage: '240V', standard: 'Standard 10' },
// ... (repeat similar structure for more data)
{ materialName: 'Material 11', model: 'Model K', specification: 'Spec 11', voltage: '120V', standard: 'Standard 11' },
{ materialName: 'Material 12', model: 'Model L', specification: 'Spec 12', voltage: '230V', standard: 'Standard 12' },
{ materialName: 'Material 13', model: 'Model M', specification: 'Spec 13', voltage: '240V', standard: 'Standard 13' },
{ materialName: 'Material 14', model: 'Model N', specification: 'Spec 14', voltage: '110V', standard: 'Standard 14' },
{ materialName: 'Material 15', model: 'Model O', specification: 'Spec 15', voltage: '220V', standard: 'Standard 15' },
{ materialName: 'Material 16', model: 'Model P', specification: 'Spec 16', voltage: '120V', standard: 'Standard 16' },
{ materialName: 'Material 17', model: 'Model Q', specification: 'Spec 17', voltage: '230V', standard: 'Standard 17' },
{ materialName: 'Material 18', model: 'Model R', specification: 'Spec 18', voltage: '240V', standard: 'Standard 18' },
{ materialName: 'Material 19', model: 'Model S', specification: 'Spec 19', voltage: '110V', standard: 'Standard 19' },
{ materialName: 'Material 20', model: 'Model T', specification: 'Spec 20', voltage: '220V', standard: 'Standard 20' },
],
selectedMaterialItems: [], // 选中的数据
savedSelectedMaterials: [], // 保存选中的数据
precMaterialName: '',
vagueMaterialName: '',
vagueModel: '',
@ -519,7 +519,9 @@
},
mounted() {
this.$nextTick(() => {
this.$refs.materialTable.setSelection(this.selectedMaterialItems);
});
},
methods: {
async init () {
@ -576,35 +578,42 @@
}
},
handleRegionCurrentChange(val) {
this.currentPage = val;
},
handleMaterialCurrentChange(val) {
this.currentPage = val;
},
addMaterial(){
this.dialogMaterialVisible = true;
},
handleSelectionChange(selection) {
// 当选择发生变化时更新选中数据
this.selectedMaterialItems = selection;
selection.forEach(item => {
// 判断是否已经存在于已选列表中,避免重复添加
if (!this.selectedMaterialItems.some(selectedItem => selectedItem.materialName === item.materialName)) {
this.selectedMaterialItems.push(item);
}
});
},
removeSelectedItem(selectedItem) {
// 移除选中的记录
const index = this.selectedMaterialItems.indexOf(selectedItem);
// 判断当前数据是否被选择
const isSelected = this.$refs.materialTable.selection.includes(selectedItem);
// 从已选列表中移除该项
const index = this.selectedMaterialItems.findIndex(item => item.materialName === selectedItem.materialName);
if (index !== -1) {
this.selectedMaterialItems.splice(index, 1);
}
// 同步取消左侧表格中对应项的选择
const tableIndex = this.materialTableData.indexOf(selectedItem);
if (tableIndex !== -1) {
this.$refs.materialTable.toggleRowSelection(this.materialTableData[tableIndex]);
// 如果当前数据被选择,则取消 el-table 中该项的选择状态
if (isSelected) {
this.$refs.materialTable.toggleRowSelection(selectedItem, false);
}
},
addMaterialToTable() {
@ -625,7 +634,7 @@
searchMaterial() {
if(this.precMaterialName === '' && this.vagueMaterialName === '' && this.vagueModel === '') {
this.$message({
message: '请输入你要查询的无聊条件',
message: '请输入你要查询的物料条件',
type: 'warning'
});
}else {

View File

@ -86,16 +86,17 @@
}
.el-table .el-table__cell {
.materialDialogTable .el-table__header-wrapper .el-table__header .el-checkbox {
display: none;
}
.el-row {
.el-table .cell {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.el-col {
height: 42px;
}

View File

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

View File

@ -192,11 +192,6 @@
prop="standard"
label="标准">
</el-table-column>
<el-table-column
width="180"
prop="core"
label="线芯">
</el-table-column>
<el-table-column
width="180"
prop="costPrice"
@ -210,7 +205,7 @@
<el-table-column
width="180"
prop="netVolume"
label="净量">
label="净量">
</el-table-column>
<el-table-column
width="180"
@ -254,7 +249,7 @@
width="80"
label="操作">
<template slot-scope="scope">
<el-button @click="handleDeleteClick(scope.row)" style="color: red;" type="text">删除</el-button>
<el-button @click="handleDeleteClick(scope.$index)" style="color: red;" type="text">删除</el-button>
</template>
</el-table-column>
</el-table>
@ -320,29 +315,31 @@
></el-pagination>
</div>
</el-dialog>
<el-dialog class="materialDialogTable" :visible.sync="dialogMaterialVisible" width="1300px">
<el-dialog class="materialDialogTable" :visible.sync="dialogMaterialVisible" width="1200px">
<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="precMaterialName" placeholder="开头物料名称精确查询">
</el-input>
<el-input style="width: 200px; " v-model="regionName" placeholder="模糊查询">
<el-input style="width: 200px; " v-model="vagueMaterialName" placeholder="物料名称模糊查询">
</el-input>
<el-input style="width: 200px; " v-model="regionName" placeholder="结尾精确查询">
<el-input style="width: 200px; " v-model="vagueModel" placeholder="型号模糊查询">
</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>
</div>
<div style="display: flex; flex-direction: row;">
<div style="width: 866px">
<div style="width: 766px">
<el-table
:data="materialTableData"
:data="getCurrentMaterialData"
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
:row-key="row => row.materialName"
:reserve-selection="true"
border>
<el-table-column
type="selection"
@ -378,12 +375,15 @@
prop="standard"
label="标准">
</el-table-column>
<el-table-column
width="100"
prop="core"
label="线芯">
</el-table-column>
</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 style="flex-grow: 1; padding-left: 20px;">
<div
@ -396,6 +396,7 @@
</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>
@ -465,28 +466,41 @@
dialogRegionVisible: false,
regionName: '',
regionCurrentPage: 1,
materialCurrentPage: 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
{ materialName: 'Material 1', model: 'Model A', specification: 'Spec 1', voltage: '220V', standard: 'Standard 1' },
{ materialName: 'Material 2', model: 'Model B', specification: 'Spec 2', voltage: '110V', standard: 'Standard 2' },
// ... (previous data)
// Additional test data
{ materialName: 'Material 3', model: 'Model C', specification: 'Spec 3', voltage: '120V', standard: 'Standard 3' },
{ materialName: 'Material 4', model: 'Model D', specification: 'Spec 4', voltage: '230V', standard: 'Standard 4' },
{ materialName: 'Material 5', model: 'Model E', specification: 'Spec 5', voltage: '240V', standard: 'Standard 5' },
{ materialName: 'Material 6', model: 'Model F', specification: 'Spec 6', voltage: '110V', standard: 'Standard 6' },
{ materialName: 'Material 7', model: 'Model G', specification: 'Spec 7', voltage: '220V', standard: 'Standard 7' },
{ materialName: 'Material 8', model: 'Model H', specification: 'Spec 8', voltage: '120V', standard: 'Standard 8' },
{ materialName: 'Material 9', model: 'Model I', specification: 'Spec 9', voltage: '230V', standard: 'Standard 9' },
{ materialName: 'Material 10', model: 'Model J', specification: 'Spec 10', voltage: '240V', standard: 'Standard 10' },
// ... (repeat similar structure for more data)
{ materialName: 'Material 11', model: 'Model K', specification: 'Spec 11', voltage: '120V', standard: 'Standard 11' },
{ materialName: 'Material 12', model: 'Model L', specification: 'Spec 12', voltage: '230V', standard: 'Standard 12' },
{ materialName: 'Material 13', model: 'Model M', specification: 'Spec 13', voltage: '240V', standard: 'Standard 13' },
{ materialName: 'Material 14', model: 'Model N', specification: 'Spec 14', voltage: '110V', standard: 'Standard 14' },
{ materialName: 'Material 15', model: 'Model O', specification: 'Spec 15', voltage: '220V', standard: 'Standard 15' },
{ materialName: 'Material 16', model: 'Model P', specification: 'Spec 16', voltage: '120V', standard: 'Standard 16' },
{ materialName: 'Material 17', model: 'Model Q', specification: 'Spec 17', voltage: '230V', standard: 'Standard 17' },
{ materialName: 'Material 18', model: 'Model R', specification: 'Spec 18', voltage: '240V', standard: 'Standard 18' },
{ materialName: 'Material 19', model: 'Model S', specification: 'Spec 19', voltage: '110V', standard: 'Standard 19' },
{ materialName: 'Material 20', model: 'Model T', specification: 'Spec 20', voltage: '220V', standard: 'Standard 20' },
],
selectedMaterialItems: [], // 选中的数据
savedSelectedMaterials: [], // 保存选中的数据
precMaterialName: '',
vagueMaterialName: '',
vagueModel: '',
}
},
computed: {
@ -495,15 +509,19 @@
const end = start + this.pageSize;
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() {
},
mounted() {
this.$nextTick(() => {
this.$refs.materialTable.setSelection(this.selectedMaterialItems);
});
},
methods: {
async init () {
@ -560,31 +578,42 @@
}
},
handleRegionCurrentChange(val) {
this.currentPage = val;
},
handleMaterialCurrentChange(val) {
this.currentPage = val;
},
addMaterial(){
this.dialogMaterialVisible = true;
},
handleSelectionChange(selection) {
// 当选择发生变化时更新选中数据
this.selectedMaterialItems = selection;
selection.forEach(item => {
// 判断是否已经存在于已选列表中,避免重复添加
if (!this.selectedMaterialItems.some(selectedItem => selectedItem.materialName === item.materialName)) {
this.selectedMaterialItems.push(item);
}
});
},
removeSelectedItem(selectedItem) {
// 移除选中的记录
const index = this.selectedMaterialItems.indexOf(selectedItem);
// 判断当前数据是否被选择
const isSelected = this.$refs.materialTable.selection.includes(selectedItem);
// 从已选列表中移除该项
const index = this.selectedMaterialItems.findIndex(item => item.materialName === selectedItem.materialName);
if (index !== -1) {
this.selectedMaterialItems.splice(index, 1);
}
// 同步取消左侧表格中对应项的选择
const tableIndex = this.materialTableData.indexOf(selectedItem);
if (tableIndex !== -1) {
this.$refs.materialTable.toggleRowSelection(this.materialTableData[tableIndex]);
// 如果当前数据被选择,则取消 el-table 中该项的选择状态
if (isSelected) {
this.$refs.materialTable.toggleRowSelection(selectedItem, false);
}
},
addMaterialToTable() {
@ -600,6 +629,29 @@
closeMaterialDialog() {
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)
})
}
}
},