作者 朱兆平

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

... ... @@ -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,7 +1844,9 @@ Handling Information
</el-tab-pane>
</el-tabs>
<!-- 主单获取尺寸信息-->
<el-dialog title="尺寸信息" :visible.sync="dialogTableVisible">
<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
... ... @@ -1893,6 +1895,24 @@ Handling Information
<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());
}
... ...