优化 产品导入

This commit is contained in:
袁锋 2025-11-05 21:01:10 +08:00
parent 42616da7e8
commit 9db1775917
2 changed files with 34 additions and 9 deletions

View File

@ -307,6 +307,8 @@ public class ProductInfoServiceImpl implements ProductInfoService {
continue;
}
ProductInfoDO productInfo = new ProductInfoDO();
productInfo.setName(excelVO.getName());
String code = excelVO.getCode();
if(FuncUtil.isNotEmpty(code)){
try {
@ -317,18 +319,20 @@ public class ProductInfoServiceImpl implements ProductInfoService {
lambdaQueryWrapper.last("limit 1");
ProductInfoDO dos = productInfoMapper.selectOne(lambdaQueryWrapper);
if(FuncUtil.isNotEmpty(dos)){
// 合并属性
BeanUtil.copyProperties(dos, productInfo);
productInfo.setName(excelVO.getName());
productInfo.setSummary(excelVO.getIntroduction());
productInfo.setId(dos.getId());
String brandName = excelVO.getBrandName();
productInfo.setCode(code);
productInfo.setTemplateType("2");
productInfo.setSpecSizeWidth(FuncUtil.toDouble(excelVO.getSpecWidth()));
productInfo.setSpecSizeHeight(FuncUtil.toDouble(excelVO.getSpecHeight()));
productInfo.setSpecSizeThk(FuncUtil.toDouble(excelVO.getSpecThickness()));
productInfo.setSpecMaterial(excelVO.getMaterial());
productInfo.setRemark(excelVO.getRemarks());
productInfo.setSpecSizeWidth(FuncUtil.toDouble(excelVO.getSpecWidth(),null));
productInfo.setSpecSizeHeight(FuncUtil.toDouble(excelVO.getSpecHeight(),null));
productInfo.setSpecSizeThk(FuncUtil.toDouble(excelVO.getSpecThickness(),null));
productInfo.setSpecMaterial(FuncUtil.toStr(excelVO.getMaterial(),null));
productInfo.setRemark(FuncUtil.toStr(excelVO.getRemarks(),null));
Long productTypeId = toProductTypeId(excelVO.getProductType());
productInfo.setProductTypeId(productTypeId);
@ -358,7 +362,6 @@ public class ProductInfoServiceImpl implements ProductInfoService {
if(FuncUtil.isEmpty(code)){
return ""+(i+1)+"行编码为空:"+code;
}
productInfo.setName(excelVO.getName());
String brandName = excelVO.getBrandName();
productInfo.setCode(code);
productInfo.setTemplateType("2");

View File

@ -122,6 +122,9 @@
<Icon icon="ep:download" class="mr-5px"/>
下载产品导入模版
</el-button>
<div class="ml-2">
<el-checkbox v-model="multiplyRow" @change="changeRowSetting">多行显示</el-checkbox>
</div>
</el-form-item>
</el-form>
@ -130,7 +133,8 @@
<!-- 列表 -->
<ContentWrap>
<DesignPreviewDialog ref="designPreviewDialogRef"/>
<el-table border v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table border v-loading="loading" :data="list" :stripe="true" v-if="showTable" :show-overflow-tooltip="!multiplyRow">
<el-table-column label="产品编码" align="center" prop="code" width="200"/>
<el-table-column label="产品名称" align="center" prop="name" min-width="200"/>
<el-table-column label="封面" align="center" prop="cover">
@ -211,6 +215,7 @@ import ProductInfoForm from './ProductInfoForm.vue'
import ProductInfoExcelImport from './ProductInfoExcelImport.vue'
import {ProductTypeApi} from "@/api/base/producttype";
import {buildQuery} from "@/utils/queryUtil";
import {multiply} from "lodash-es";
/** 产品资料 列表 */
defineOptions({name: 'ProductInfo'})
@ -313,6 +318,9 @@ const that = reactive({
productTypeOptions: [],
})
const init = async () => {
multiplyRow.value = localStorage.getItem('prod_list_multiplyRow') !== '0'
ProductTypeApi.getProductTypePage({
pageNo: 1,
pageSize: 100
@ -360,4 +368,18 @@ const downloadTemplate = ()=>{
const handleImport = () => {
excelImportRef.value.open()
}
const multiplyRow = ref(true)
const showTable = ref(true)
const changeRowSetting = ()=>{
localStorage.setItem('prod_list_multiplyRow', multiplyRow.value ? "1" : "0")
showTable.value = false;
setTimeout(()=>{
showTable.value = true;
},300)
}
</script>
<style scoped lang="scss">
.el-table .cell {
white-space: pre-line;
}
</style>