This commit is contained in:
JIAL 2024-02-22 16:51:58 +08:00
parent 0be39d74a1
commit 237fef6b6a
20 changed files with 1620 additions and 692 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

@ -1,8 +1,10 @@
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.InventoryDto;
import com.JN.demo.zmquotation.dto.MaterialDto; 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.InventoryService;
import com.JN.demo.zmquotation.service.MaterialService; import com.JN.demo.zmquotation.service.MaterialService;
import com.JN.demo.zmquotation.service.RegionService; import com.JN.demo.zmquotation.service.RegionService;
import lombok.experimental.PackagePrivate; import lombok.experimental.PackagePrivate;
@ -33,6 +35,9 @@ public class ZMController {
@Autowired @Autowired
MaterialService materialService; MaterialService materialService;
@Autowired
InventoryService inventoryService;
/** /**
* @title queryRegionList * @title queryRegionList
* @description 查询地区列表信息 * @description 查询地区列表信息
@ -70,5 +75,19 @@ public class ZMController {
return R.success(materialList); return R.success(materialList);
} }
/**
* @title queryInventoryList
* @description 获取盘具列表
* @author JIAL
* @updateTime 2024/2/22 10:09
* @return: com.JN.common.R<java.util.List<com.JN.demo.zmquotation.dto.InventoryDto>>
*/
@PostMapping("/inventoryList")
public R<List<InventoryDto>> queryInventoryList() {
List<InventoryDto> inventoryList = inventoryService.queryInventoryList();
return R.success(inventoryList);
}
} }

View File

@ -0,0 +1,23 @@
package com.JN.demo.zmquotation.dto;
import lombok.Data;
import java.io.Serializable;
/**
* @ClassName InventoryDto
* @Description TODO
* @Author JIAL
* @Date 2024/2/22 9:48
* @Version 1.0
*/
@Data
public class InventoryDto implements Serializable {
private static final long serialVersionUID = 1L;
private String inventory; //盘具名称
private String invDesc; //盘具描述
private String weighInv; //盘重
}

View File

@ -46,4 +46,6 @@ public class MaterialDto implements Serializable {
private String steamFee; //蒸汽费 private String steamFee; //蒸汽费
private int quantity = 1; //数量默认为1 private int quantity = 1; //数量默认为1
private int invItemCount = 1; //盘具数量默认1
} }

View File

@ -0,0 +1,24 @@
package com.JN.demo.zmquotation.mapper;
import com.JN.demo.zmquotation.dto.InventoryDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
* @ClassName InventoryMapper
* @Description TODO
* @Author JIAL
* @Date 2024/2/22 9:56
* @Version 1.0
*/
@Mapper
public interface InventoryMapper {
@Select("SELECT [cbpj_mc] as inventory,\n" +
" [cbpj_pzjd1] as inv_desc,\n" +
" [cbpj_zl] as weigh_inv\n" +
"FROM [zm_erp2].[dbo].[cb_cbpj]")
List<InventoryDto> queryInventoryList();
}

View File

@ -0,0 +1,16 @@
package com.JN.demo.zmquotation.service;
import com.JN.demo.zmquotation.dto.InventoryDto;
import java.util.List;
/**
* @ClassName InventoryService
* @Description TODO
* @Author JIAL
* @Date 2024/2/22 9:55
* @Version 1.0
*/
public interface InventoryService {
List<InventoryDto> queryInventoryList();
}

View File

@ -0,0 +1,35 @@
package com.JN.demo.zmquotation.service.impl;
import com.JN.demo.zmquotation.dto.InventoryDto;
import com.JN.demo.zmquotation.mapper.InventoryMapper;
import com.JN.demo.zmquotation.service.InventoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @ClassName InventoryServiceImpl
* @Description TODO
* @Author JIAL
* @Date 2024/2/22 9:55
* @Version 1.0
*/
@Service
public class InventoryServiceImpl implements InventoryService {
@Autowired
InventoryMapper inventoryMapper;
/**
* @title queryInventoryList
* @description 获取盘具列表
* @author JIAL
* @updateTime 2024/2/22 10:06
* @return: java.util.List<com.JN.demo.zmquotation.dto.InventoryDto>
*/
@Override
public List<InventoryDto> queryInventoryList() {
return inventoryMapper.queryInventoryList();
}
}

View File

@ -86,6 +86,18 @@
} }
.inventoryDialogTable .el-dialog__header{
padding-bottom: 0px;
}
.inventoryDialogTable .el-dialog__body{
padding-top: 0px;
}
.materialDialogTable .el-table__header-wrapper .el-table__header .el-checkbox { .materialDialogTable .el-table__header-wrapper .el-table__header .el-checkbox {
display: none; display: none;
} }

View File

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

View File

@ -152,7 +152,7 @@
<div class="button-box"> <div class="button-box">
<el-button type="text" @click="selectedRegion">选择地区</el-button> <el-button type="text" @click="selectedRegion">选择地区</el-button>
<el-button type="text" @click="addMaterial">添加物料</el-button> <el-button type="text" @click="addMaterial">添加物料</el-button>
<el-button type="text">刷新界面</el-button> <el-button type="text" @click="calculatedData">刷新界面</el-button>
<el-button type="text"></el-button> <el-button type="text"></el-button>
</div> </div>
<div class="table-box"> <div class="table-box">
@ -183,12 +183,12 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
width="180" width="120"
prop="voltage" prop="voltage"
label="电压"> label="电压">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
width="180" width="80"
prop="standard" prop="standard"
label="标准"> label="标准">
</el-table-column> </el-table-column>
@ -208,16 +208,24 @@
label="净重量"> label="净重量">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
width="180" width="120"
prop="inventory" prop="inventory"
label="盘具"> label="盘具">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.inventory" > <el-link @click="handleInventoryClick(scope.row, scope.$index)" type="primary">{{ scope.row.inventory }}</el-link>
</el-input> </template>
</template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
width="180" width="180"
prop="invItemCount"
label="盘具数量">
<template slot-scope="scope">
<el-input v-model="scope.row.invItemCount" >
</el-input>
</template>
</el-table-column>
<el-table-column
width="100"
prop="weighInv" prop="weighInv"
label="盘重"> label="盘重">
</el-table-column> </el-table-column>
@ -256,7 +264,7 @@
</div> </div>
</div> </div>
<el-dialog class="regionDialogTable" :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" style="margin: 0px">
<el-form> <el-form>
<el-form-item > <el-form-item >
<el-input style="width: 300px; " v-model="regionName" placeholder="请输入地区名称"> <el-input style="width: 300px; " v-model="regionName" placeholder="请输入地区名称">
@ -316,14 +324,14 @@
</div> </div>
</el-dialog> </el-dialog>
<el-dialog class="materialDialogTable" :visible.sync="dialogMaterialVisible" width="1200px"> <el-dialog class="materialDialogTable" :visible.sync="dialogMaterialVisible" width="1200px">
<div slot="title" class="regionTable-title" style="margin: 0px"> <div slot="title" style="margin: 0px">
<el-form> <el-form>
<el-form-item > <el-form-item >
<el-input style="width: 200px; " v-model="precMaterialName" placeholder="开头物料名称精确查询"> <el-input style="width: 200px; " v-model="precMaterialName" placeholder="开头物料名称精确查询">
</el-input> </el-input>
<el-input style="width: 200px; " v-model="vagueMaterialName" placeholder="物料名称模糊查询"> <el-input style="width: 200px; " v-model="vagueMaterialName" placeholder="物料名称模糊查询">
</el-input> </el-input>
<el-input style="width: 200px; " v-model="vagueModel" placeholder="型号模糊查询"> <el-input style="width: 200px; " v-model="vagueModel" placeholder="规格模糊查询">
</el-input> </el-input>
<el-button type="primary" size="small" @click="searchMaterial">查询物料</el-button> <el-button type="primary" size="small" @click="searchMaterial">查询物料</el-button>
</el-form-item> </el-form-item>
@ -403,7 +411,52 @@
<el-button type="warning" size="small" @click="closeMaterialDialog">取消</el-button> <el-button type="warning" size="small" @click="closeMaterialDialog">取消</el-button>
</el-button-group> </el-button-group>
</div> </div>
</el-dialog>
<el-dialog class="inventoryDialogTable" :visible.sync="dialogInventoryVisible" width="792px" >
<div>
<el-table
:data="getCurrentInventoryData"
: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">
</el-table-column>
<el-table-column
width="200"
prop="inventory"
label="盘具名称">
</el-table-column>
<el-table-column
width="200"
prop="invDesc"
label="盘具描述">
</el-table-column>
<el-table-column
width="200"
prop="weighInv"
label="盘重">
</el-table-column>
<el-table-column
width="100"
label="操作">
<template slot-scope="scope">
<el-button @click="chooseInventory(scope.row)" style="color: blue;" type="text">选择</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div style="text-align: center; margin-top: 10px;">
<el-pagination
@current-change="handleInventoryCurrentChange"
:current-page.sync="inventoryCurrentPage"
:page-size="pageSize"
:total="inventoryTableData.length"
></el-pagination>
</div>
</el-dialog> </el-dialog>
</div> </div>
@ -444,20 +497,7 @@
materialData: [ materialData: [
], ],
regionTableData: [ regionTableData: [],
{
province: '浙江',
city: '杭州',
district: '西湖区',
kilometers: 10
},
{
province: '上海',
city: '上海',
district: '黄浦区',
kilometers: 20
},
],
price_0t_5t: '', price_0t_5t: '',
price_5t_10t: '', price_5t_10t: '',
price_10t_25t: '', price_10t_25t: '',
@ -466,41 +506,19 @@
dialogRegionVisible: false, dialogRegionVisible: false,
regionName: '', regionName: '',
regionCurrentPage: 1, regionCurrentPage: 1,
inventoryCurrentPage : 1,
materialCurrentPage: 1, materialCurrentPage: 1,
pageSize: 10, pageSize: 10,
dialogMaterialVisible: false, dialogMaterialVisible: false,
materialTableData: [ materialTableData: [],
{ 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: [], // 选中的数据 selectedMaterialItems: [], // 选中的数据
savedSelectedMaterials: [], // 保存选中的数据 savedSelectedMaterials: [], // 保存选中的数据
precMaterialName: '', precMaterialName: '',
vagueMaterialName: '', vagueMaterialName: '',
vagueModel: '', vagueModel: '',
dialogInventoryVisible: false,
inventoryTableData: [],
clickedRowIndex: null, // 用于记录点击的行的索引
} }
}, },
computed: { computed: {
@ -514,14 +532,17 @@
const end = start + this.pageSize; const end = start + this.pageSize;
return this.materialTableData.slice(start, end); return this.materialTableData.slice(start, end);
}, },
getCurrentInventoryData() {
const start = (this.inventoryCurrentPage - 1) * this.pageSize;
const end = start + this.pageSize;
return this.inventoryTableData.slice(start, end);
},
}, },
created() { created() {
this.getInventoryData();
}, },
mounted() { mounted() {
this.$nextTick(() => {
this.$refs.materialTable.setSelection(this.selectedMaterialItems);
});
}, },
methods: { methods: {
async init () { async init () {
@ -587,6 +608,10 @@
}, },
handleInventoryCurrentChange(val) {
this.currentPage = val;
},
addMaterial(){ addMaterial(){
this.dialogMaterialVisible = true; this.dialogMaterialVisible = true;
}, },
@ -652,7 +677,35 @@
}) })
} }
} },
handleInventoryClick(row, index) {
this.clickedRowIndex = index; // 记录点击的行的索引
this.dialogInventoryVisible = true; // 打开选择盘具的 dialog
},
getInventoryData() {
queryInventoryList().then(res => {
this.inventoryTableData = res.data || []
}).catch(err => {
this.$message.error('请求出错了:' + err)
})
},
chooseInventory(row) {
// 在选择盘具的逻辑中,将选择的盘具信息赋值给之前点击的行的数据
if (this.clickedRowIndex !== null) {
// 假设选择盘具后的数据存储在 this.selectedInventory 中
const updatedRow = {
...this.materialData[this.clickedRowIndex],
inventory: row.inventory, // 盘具名称
weighInv: row.weighInv, // 盘重信息
};
this.$set(this.materialData, this.clickedRowIndex, updatedRow);
}
this.dialogInventoryVisible = false; // 打开选择盘具的 dialog
// 其他逻辑...
},
}, },
}) })

View File

@ -86,6 +86,18 @@
} }
.inventoryDialogTable .el-dialog__header{
padding-bottom: 0px;
}
.inventoryDialogTable .el-dialog__body{
padding-top: 0px;
}
.materialDialogTable .el-table__header-wrapper .el-table__header .el-checkbox { .materialDialogTable .el-table__header-wrapper .el-table__header .el-checkbox {
display: none; display: none;
} }

View File

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

View File

@ -183,12 +183,12 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
width="180" width="120"
prop="voltage" prop="voltage"
label="电压"> label="电压">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
width="180" width="80"
prop="standard" prop="standard"
label="标准"> label="标准">
</el-table-column> </el-table-column>
@ -208,16 +208,24 @@
label="净重量"> label="净重量">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
width="180" width="120"
prop="inventory" prop="inventory"
label="盘具"> label="盘具">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.inventory" > <el-link @click="handleInventoryClick(scope.row, scope.$index)" type="primary">{{ scope.row.inventory }}</el-link>
</el-input> </template>
</template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
width="180" width="180"
prop="invItemCount"
label="盘具数量">
<template slot-scope="scope">
<el-input v-model="scope.row.invItemCount" >
</el-input>
</template>
</el-table-column>
<el-table-column
width="100"
prop="weighInv" prop="weighInv"
label="盘重"> label="盘重">
</el-table-column> </el-table-column>
@ -256,7 +264,7 @@
</div> </div>
</div> </div>
<el-dialog class="regionDialogTable" :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" style="margin: 0px">
<el-form> <el-form>
<el-form-item > <el-form-item >
<el-input style="width: 300px; " v-model="regionName" placeholder="请输入地区名称"> <el-input style="width: 300px; " v-model="regionName" placeholder="请输入地区名称">
@ -316,14 +324,14 @@
</div> </div>
</el-dialog> </el-dialog>
<el-dialog class="materialDialogTable" :visible.sync="dialogMaterialVisible" width="1200px"> <el-dialog class="materialDialogTable" :visible.sync="dialogMaterialVisible" width="1200px">
<div slot="title" class="regionTable-title" style="margin: 0px"> <div slot="title" style="margin: 0px">
<el-form> <el-form>
<el-form-item > <el-form-item >
<el-input style="width: 200px; " v-model="precMaterialName" placeholder="开头物料名称精确查询"> <el-input style="width: 200px; " v-model="precMaterialName" placeholder="开头物料名称精确查询">
</el-input> </el-input>
<el-input style="width: 200px; " v-model="vagueMaterialName" placeholder="物料名称模糊查询"> <el-input style="width: 200px; " v-model="vagueMaterialName" placeholder="物料名称模糊查询">
</el-input> </el-input>
<el-input style="width: 200px; " v-model="vagueModel" placeholder="型号模糊查询"> <el-input style="width: 200px; " v-model="vagueModel" placeholder="规格模糊查询">
</el-input> </el-input>
<el-button type="primary" size="small" @click="searchMaterial">查询物料</el-button> <el-button type="primary" size="small" @click="searchMaterial">查询物料</el-button>
</el-form-item> </el-form-item>
@ -403,7 +411,52 @@
<el-button type="warning" size="small" @click="closeMaterialDialog">取消</el-button> <el-button type="warning" size="small" @click="closeMaterialDialog">取消</el-button>
</el-button-group> </el-button-group>
</div> </div>
</el-dialog>
<el-dialog class="inventoryDialogTable" :visible.sync="dialogInventoryVisible" width="792px" >
<div>
<el-table
:data="getCurrentInventoryData"
: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">
</el-table-column>
<el-table-column
width="200"
prop="inventory"
label="盘具名称">
</el-table-column>
<el-table-column
width="200"
prop="invDesc"
label="盘具描述">
</el-table-column>
<el-table-column
width="200"
prop="weighInv"
label="盘重">
</el-table-column>
<el-table-column
width="100"
label="操作">
<template slot-scope="scope">
<el-button @click="chooseInventory(scope.row)" style="color: blue;" type="text">选择</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div style="text-align: center; margin-top: 10px;">
<el-pagination
@current-change="handleInventoryCurrentChange"
:current-page.sync="inventoryCurrentPage"
:page-size="pageSize"
:total="inventoryTableData.length"
></el-pagination>
</div>
</el-dialog> </el-dialog>
</div> </div>
@ -444,20 +497,7 @@
materialData: [ materialData: [
], ],
regionTableData: [ regionTableData: [],
{
province: '浙江',
city: '杭州',
district: '西湖区',
kilometers: 10
},
{
province: '上海',
city: '上海',
district: '黄浦区',
kilometers: 20
},
],
price_0t_5t: '', price_0t_5t: '',
price_5t_10t: '', price_5t_10t: '',
price_10t_25t: '', price_10t_25t: '',
@ -466,41 +506,19 @@
dialogRegionVisible: false, dialogRegionVisible: false,
regionName: '', regionName: '',
regionCurrentPage: 1, regionCurrentPage: 1,
inventoryCurrentPage : 1,
materialCurrentPage: 1, materialCurrentPage: 1,
pageSize: 10, pageSize: 10,
dialogMaterialVisible: false, dialogMaterialVisible: false,
materialTableData: [ materialTableData: [],
{ 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: [], // 选中的数据 selectedMaterialItems: [], // 选中的数据
savedSelectedMaterials: [], // 保存选中的数据 savedSelectedMaterials: [], // 保存选中的数据
precMaterialName: '', precMaterialName: '',
vagueMaterialName: '', vagueMaterialName: '',
vagueModel: '', vagueModel: '',
dialogInventoryVisible: false,
inventoryTableData: [],
clickedRowIndex: null, // 用于记录点击的行的索引
} }
}, },
computed: { computed: {
@ -514,14 +532,17 @@
const end = start + this.pageSize; const end = start + this.pageSize;
return this.materialTableData.slice(start, end); return this.materialTableData.slice(start, end);
}, },
getCurrentInventoryData() {
const start = (this.inventoryCurrentPage - 1) * this.pageSize;
const end = start + this.pageSize;
return this.inventoryTableData.slice(start, end);
},
}, },
created() { created() {
this.getInventoryData();
}, },
mounted() { mounted() {
this.$nextTick(() => {
this.$refs.materialTable.setSelection(this.selectedMaterialItems);
});
}, },
methods: { methods: {
async init () { async init () {
@ -587,6 +608,10 @@
}, },
handleInventoryCurrentChange(val) {
this.currentPage = val;
},
addMaterial(){ addMaterial(){
this.dialogMaterialVisible = true; this.dialogMaterialVisible = true;
}, },
@ -652,7 +677,35 @@
}) })
} }
} },
handleInventoryClick(row, index) {
this.clickedRowIndex = index; // 记录点击的行的索引
this.dialogInventoryVisible = true; // 打开选择盘具的 dialog
},
getInventoryData() {
queryInventoryList().then(res => {
this.inventoryTableData = res.data || []
}).catch(err => {
this.$message.error('请求出错了:' + err)
})
},
chooseInventory(row) {
// 在选择盘具的逻辑中,将选择的盘具信息赋值给之前点击的行的数据
if (this.clickedRowIndex !== null) {
// 假设选择盘具后的数据存储在 this.selectedInventory 中
const updatedRow = {
...this.materialData[this.clickedRowIndex],
inventory: row.inventory, // 盘具名称
weighInv: row.weighInv, // 盘重信息
};
this.$set(this.materialData, this.clickedRowIndex, updatedRow);
}
this.dialogInventoryVisible = false; // 打开选择盘具的 dialog
// 其他逻辑...
},
}, },
}) })