作者 朱兆平

增加尺寸信息批量录入及智能识别

... ... @@ -681,7 +681,7 @@ Handling Information
</el-row>
<el-row style="padding-top: 20px">
<el-col :span="7" style="border-right: 1px solid #a5a5a5">
<el-input :disabled="form.cvd.cvd_charge_prepaid=='CC'" v-model="form.ppd.ppd_weight_amount" auto-complete="off" placeholder="计费重量" size="mini"></el-input>
<el-input :disabled="form.cvd.cvd_charge_prepaid=='CC'" v-model="form.ppd.ppd_weight_amount" auto-complete="off" placeholder="毛重" size="mini"></el-input>
</el-col>
<el-col :span="10" style="border-right: 1px solid #a5a5a5;text-align: center">
<span style="font-size: 12px">
... ... @@ -689,7 +689,7 @@ Handling Information
</span>
</el-col>
<el-col :span="7">
<el-input :disabled="form.cvd.cvd_charge_prepaid=='PP'" v-model="form.ppd.ppd_weight_amount" auto-complete="off" placeholder="计费重量" size="mini"></el-input>
<el-input :disabled="form.cvd.cvd_charge_prepaid=='PP'" v-model="form.ppd.ppd_weight_amount" auto-complete="off" placeholder="毛重" size="mini"></el-input>
</el-col>
</el-row>
</el-col>
... ... @@ -1844,55 +1844,75 @@ Handling Information
</el-tab-pane>
</el-tabs>
<!-- 主单获取尺寸信息-->
<el-dialog title="尺寸信息" :visible.sync="dialogTableVisible">
<el-table :data="gridData" :cell-style="{textAlign:'center'}" show-summary
:summary-method="getSummaries"
style="border-radius: 10px 10px 0px 0px;line-height: 25px" border
:header-cell-style="{background:'#6F8294',color:'#FFFFFF',textAlign:'center'}">
<el-table-column label="长(CM)" width="" prop="long">
<template slot-scope="scope">
<el-input v-model="scope.row.long" placeholder="" @input="handleEdit(scope.$index, scope.row)"/>
</template>
</el-table-column>
<el-table-column label="宽(CM)" width="" prop="wide">
<template slot-scope="scope">
<el-input v-model="scope.row.wide" placeholder="" @input="handleEdit(scope.$index, scope.row)"/>
</template>
</el-table-column>
<el-table-column label="高(CM)" prop="height">
<template slot-scope="scope">
<el-input v-model="scope.row.height" placeholder="" @input="handleEdit(scope.$index, scope.row)"/>
</template>
</el-table-column>
<el-table-column label="件数" width="" prop="pic">
<template slot-scope="scope">
<el-input v-model="scope.row.pic" placeholder="" @input="handleEdit(scope.$index, scope.row)"/>
</template>
</el-table-column>
<el-table-column label="体积(M³)" width="" prop="vol">
<template slot-scope="scope">
<el-input v-model="scope.row.vol" placeholder="" :disabled="true"/>
</template>
</el-table-column>
<el-table-column label="重量" prop="weight">
<template slot-scope="scope">
<el-input v-model="scope.row.weight" placeholder=""/>
</template>
</el-table-column>
<el-table-column fixed="right" label="操作">
<template slot-scope="scope">
<!-- v-if="scope.$index < gridData.length - 1"-->
<el-button type="danger" plain @click="deleteRows(scope)">删 除</el-button>
</template>
</el-table-column>
</el-table>
<div align="center" style="margin: 10px">
<el-button @click="addRows()" size="mini" plain style="width: 100%">+添 加</el-button>
</div>
<div align="center" style="margin: 15px">
<el-button type="primary" size="small" @click="dialogTableVisible = false">取 消</el-button>
<el-button type="success" size="small" @click="addVol()">保 存</el-button>
</div>
<el-dialog title="尺寸信息" :visible.sync="dialogTableVisible" width="80%">
<el-row :gutter="10">
<el-col :span="18">
<el-table :data="gridData" :cell-style="{textAlign:'center'}" show-summary
:summary-method="getSummaries"
style="border-radius: 10px 10px 0px 0px;line-height: 25px" border
:header-cell-style="{background:'#6F8294',color:'#FFFFFF',textAlign:'center'}">
<el-table-column label="长(CM)" width="" prop="long">
<template slot-scope="scope">
<el-input v-model="scope.row.long" placeholder="" @input="handleEdit(scope.$index, scope.row)"/>
</template>
</el-table-column>
<el-table-column label="宽(CM)" width="" prop="wide">
<template slot-scope="scope">
<el-input v-model="scope.row.wide" placeholder="" @input="handleEdit(scope.$index, scope.row)"/>
</template>
</el-table-column>
<el-table-column label="高(CM)" prop="height">
<template slot-scope="scope">
<el-input v-model="scope.row.height" placeholder="" @input="handleEdit(scope.$index, scope.row)"/>
</template>
</el-table-column>
<el-table-column label="件数" width="" prop="pic">
<template slot-scope="scope">
<el-input v-model="scope.row.pic" placeholder="" @input="handleEdit(scope.$index, scope.row)"/>
</template>
</el-table-column>
<el-table-column label="体积(M³)" width="" prop="vol">
<template slot-scope="scope">
<el-input v-model="scope.row.vol" placeholder="" :disabled="true"/>
</template>
</el-table-column>
<el-table-column label="重量" prop="weight">
<template slot-scope="scope">
<el-input v-model="scope.row.weight" placeholder=""/>
</template>
</el-table-column>
<el-table-column fixed="right" label="操作">
<template slot-scope="scope">
<!-- v-if="scope.$index < gridData.length - 1"-->
<el-button type="danger" plain @click="deleteRows(scope)">删 除</el-button>
</template>
</el-table-column>
</el-table>
<div align="center" style="margin: 10px">
<el-button @click="addRows()" size="mini" plain style="width: 100%">+添 加</el-button>
</div>
<div align="center" style="margin: 15px">
<el-button type="primary" size="small" @click="dialogTableVisible = false">取 消</el-button>
<el-button type="success" size="small" @click="addVol()">保 存</el-button>
</div>
</el-col>
<el-col :span="6">
<el-tooltip class="item" effect="dark" content="可以将整体的尺寸信息复制进来,一行一个尺寸信息,系统会自动识别" placement="top-start">
<el-input
rows="6"
resize = "vertical"
type="textarea"
placeholder="快速尺寸信息录入生成"
v-model="dimension_textarea"
@change="convertAndCalculateVolume"
>
</el-input>
</el-tooltip>
</el-col>
</el-row>
<el-row>&nbsp; </el-row>
</el-dialog>
<!-- 列表区域 获取发货人-->
<el-dialog :visible.sync="dialogVisible" width="70%">
... ... @@ -1929,6 +1949,7 @@ Handling Information
hidden: ['a1', 'a2', 'a3', 'a4', 'a5','a6'],
// 主单
activeName: 'first',
dimension_textarea: '',
form:{
acc:[],
agt:{
... ... @@ -2239,11 +2260,11 @@ Handling Information
const value = Number(curr)
if (!isNaN(value)) {
// 保存了两位小数点
return Math.round((prev + curr) * 1000) / 1000;
return Math.round((prev + curr) * 100) / 100;
} else {
// 保存了两位小数点
return Math.round(prev * 1000) / 1000;
return Math.round(prev * 100) / 100;
}
}, 0)
sums[index] += '';
... ... @@ -2689,6 +2710,76 @@ Handling Information
})
// console.log("获取分单的方法执行了")
},
//批量尺寸信息识别
convertAndCalculateVolume() {
let _this= this;
this.$confirm('是否需要根据录入的尺寸信息生成详细的尺寸计算数据表,此操作会往表里面添加新的尺寸数据', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let text = this.dimension_textarea.trim().replaceAll("*","x");
text = text.replaceAll("CM","");
text = text.replaceAll("cm","");
text = text.replaceAll("X","x");
text = text.replaceAll("-","x");
//去掉空白字符
text = text.replaceAll("/\s/g","");
const lines = text.split('\n');
let output = '';
let totalVolume = 0;
for (const line of lines) {
//正则校验每行格式
const regex = /^([\d\.]+)x([\d\.]+)x([\d\.]+)x([\d\.]+)$/;
let l = line.replace(/\s/g, "");
if (regex.test(l)) {
let dim_form = {
long:"",
wide:"",
height:"",
pic:"",
vol:"",
weight:""
};
const dimensions = l.trim().split('x');
dim_form.long = Number(dimensions[0]);
dim_form.wide = Number(dimensions[1]);
dim_form.height = Number(dimensions[2]);
dim_form.pic = Number(dimensions[3]);
dim_form.vol = dim_form.long * dim_form.wide * dim_form.height * dim_form.pic / 1000000;
_this.gridData.push(dim_form)
totalVolume += dim_form.vol;
const formattedDimensions = `${dim_form.long}-${dim_form.wide}-${dim_form.height }/${dim_form.pic}`;
output += formattedDimensions + '\n';
} else {
this.$message({
type: 'error',
message: '行:'+ line +'尺寸格式错误! 录入信息支持 数字和Xx*- '
});
return ;
}
}
if (totalVolume>0){
totalVolume = Math.floor(totalVolume * 100) / 100;
}
return {
converted: output.trim(),
totalVolume: totalVolume
};
}).catch(() => {
this.$message({
type: 'info',
message: '已取消'
});
});
},
cancleBtn(){
Object.assign(this.$data, this.$options.data());
}
... ...