作者 朱兆平

Merge remote-tracking branch 'origin/ExportOrder'

# Conflicts:
#	src/views/nav3/Way.vue
... ... @@ -26,6 +26,15 @@
<el-col style="margin-left: 30px" :span="2">
<el-button type="warning" plain @click="cancleBtn">清空</el-button>
</el-col>
<el-col :span="2">
<el-upload
action=""
:on-change="handleChange"
:auto-upload="false"
:show-file-list="false">
<el-button slot="trigger" type="primary">Excel文件</el-button>
</el-upload>
</el-col>
</el-row>
<!-- 发货人信息-->
<el-row>
... ... @@ -539,7 +548,7 @@
<el-col :span="12" style="border-right: 1px solid #a5a5a5;border-bottom:1px solid #a5a5a5;border-left:1px solid #a5a5a5;padding-left: 25px">
<span style="font-size: 12px">
Notify Name and Address
<el-button type="primary" plain size="mini" style="margin-top: 5px" @click="getCneFwb()">通知人</el-button>
<el-button type="primary" plain size="mini" style="margin-top: 5px" @click="getCneNfy()">通知人</el-button>
</span>
<el-row>
<el-col style="width: 38%">
... ... @@ -799,7 +808,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" oninput="this.value=this.value.replace(/[^0-9\.]/g,'');" 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">
... ... @@ -807,7 +816,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" oninput="this.value=this.value.replace(/[^0-9\.]/g,'');" placeholder="货重金额" size="mini"></el-input>
</el-col>
</el-row>
</el-col>
... ... @@ -909,7 +918,7 @@ Handling Information
<el-row>
<el-col style="width: 95%">
<el-form-item>
<el-input :disabled="form.cvd.cvd_charge_prepaid=='CC'" v-model="form.ppd.ppd_charge_summary_total" auto-complete="off" placeholder="预付总计" size="mini"></el-input>
<el-input :disabled="form.cvd.cvd_charge_prepaid=='CC'" v-model="form.ppd.ppd_charge_summary_total" oninput="this.value=this.value.replace(/[^0-9\.]/g,'');" auto-complete="off" placeholder="预付总计" size="mini"></el-input>
</el-form-item>
</el-col>
</el-row>
... ... @@ -933,7 +942,7 @@ Handling Information
<el-row>
<el-col style="width: 95%">
<el-form-item>
<el-input :disabled="form.cvd.cvd_charge_prepaid=='PP'" v-model="form.ppd.ppd_charge_summary_total" auto-complete="off" placeholder="到付费用总额" size="mini"></el-input>
<el-input :disabled="form.cvd.cvd_charge_prepaid=='PP'" v-model="form.ppd.ppd_charge_summary_total" oninput="this.value=this.value.replace(/[^0-9\.]/g,'');" auto-complete="off" placeholder="到付费用总额" size="mini"></el-input>
</el-form-item>
</el-col>
</el-row>
... ... @@ -2066,7 +2075,13 @@ Handling Information
v-on:consigeerow="consigeeSelect"
></Consignee>
</el-dialog>
<!-- 列表区域 获取收货人-->
<el-dialog :visible.sync="dialogVisible2" width="70%">
<Consignee
ref="consignee"
v-on:consigeerow="notifiedSelect"
></Consignee>
</el-dialog>
</el-card>
</template>
... ... @@ -2077,6 +2092,56 @@ Handling Information
import {loginedUserInfo} from "../../api/user";
import {getList} from "../../api/consigner/consigner";
import jsutil from "@/common/js/util";
import XLSX from 'xlsx';
function cleanString(str, maxLength = 20) {
return str.replace(/[^a-zA-Z0-9\s]/g, '').slice(0, maxLength);
}
/*function parseCustomDate(dateStr) {
if (typeof dateStr !== 'string') {
return '无效日期';
}
// 自定义日期格式正则表达式
const regex = /(\d{1,2})\/([a-zA-Z]{3})\/(\d{4})/;
const match = dateStr.match(regex);
if (match) {
const day = match[1];
const month = match[2];
const year = match[3];
// 月份缩写映射
const monthMap = {
Jan: '01', Feb: '02', Mar: '03', Apr: '04',
May: '05', Jun: '06', Jul: '07', Aug: '08',
Sep: '09', Oct: '10', Nov: '11', Dec: '12'
};
const formattedMonth = monthMap[month.toUpperCase()];
if (formattedMonth) {
return `${year}-${formattedMonth}-${day.padStart(2, '0')}`;
}
}
return '无效日期';
}*/
function formatAF23(value) {
if (typeof value !== 'string') {
return '无效值';
}
// 删除 DIMS: 行和 VOL: 行
const cleanedValue = value.replace(/DIMS:\s*/gi, '').replace(/VOL:\s*\d+\.\d+\s*CBM/gi, '');
// 将剩余内容按行分割,并去除空行
const lines = cleanedValue.split('\n').filter(line => line.trim() !== '');
// 将非空行重新组合成字符串,并用换行符分隔
return lines.join('\n').trim();
}
export default {
components: {
... ... @@ -2103,7 +2168,7 @@ Handling Information
quantity_density:'',
quantity_picecs:'',
//体积
quantity_volume:'',
quantity_volume:'0',
quantity_volume_code:'MC',
quantity_weight:'',
quantity_weight_code:'K',
... ... @@ -2391,6 +2456,9 @@ Handling Information
gridData:[],
dialogVisible:false,
dialogVisible1:false,
fileContent: null,
currentDate:new Date(),
dialogVisible2:false,
}
},
methods:{
... ... @@ -2511,6 +2579,11 @@ Handling Information
this.dialogVisible1 = true;
this.$refs.consignee.getConsignee();
},
// 通知人信息
getCneNfy() {
this.dialogVisible2 = true;
this.$refs.consignee.getConsignee();
},
// 分单
// 获取发货人信息
getShp() {
... ... @@ -2592,6 +2665,23 @@ Handling Information
this.dialogVisible1 = false;
}
},
//通知人选中事件处理方法
notifiedSelect(row){
if(this.activeName=='first'){
this.form.nfy.nfy_name = row.companyName;
this.form.nfy.nfy_contacts.contact_number=row.conPhone;
this.form.nfy.nfy_LOC_city=row.conCity;
this.form.nfy.nfy_country=row.country;
this.form.nfy.nfy_ADR=row.conAddress;
this.nfy_contact.contact_number=row.conPhone;;
this.$refs.consignee.consignee_data();
this.dialogVisible2 = false;
}
else{
this.$refs.consignee.consignee_data();
this.dialogVisible2 = false;
}
},
//新增分运单
addFhl() {
this.shp_aeo.oci_country_code=this.addForm.shp.shp_location_iso;
... ... @@ -2839,6 +2929,8 @@ Handling Information
text = text.replaceAll("cm","");
text = text.replaceAll("X","x");
text = text.replaceAll("-","x");
text = text.replaceAll("×","x");
text = text.replaceAll("@","x");
text = text.replace(/\//g, 'x');
//去掉空白字符
text = text.replaceAll("/\s/g","");
... ... @@ -2909,6 +3001,165 @@ Handling Information
},
cancleBtn(){
Object.assign(this.$data, this.$options.data());
},
handleChange(file, fileList) {
const files = file.raw;
const reader = new FileReader();
reader.onload = (e) => {
const data = new Uint8Array(e.target.result);
const workbook = XLSX.read(data, { type: 'array' });
const worksheetName = '格式化打印'; // 指定工作表名称
const worksheet = workbook.Sheets[worksheetName];
if (worksheet) {
const AF1 = (worksheet['AF1'] && worksheet['AF1'].v) || '';
const A16 = (worksheet['A16'] && worksheet['A16'].v) || '';
const C16 = (worksheet['C16'] && worksheet['C16'].v) || '';
const K16 = (worksheet['K16'] && worksheet['K16'].v) || '';
const L16 = (worksheet['L16'] && worksheet['L16'].v) || '';
const S16 = (worksheet['S16'] && worksheet['S16'].v) || '';
const I18 = (worksheet['I18'] && worksheet['I18'].v) || '';
const M18 = (worksheet['M18'] && worksheet['M18'].v) || '';
const A20 = (worksheet['A20'] && worksheet['A20'].v) || '';
const A22 = (worksheet['A22'] && worksheet['A22'].v) || '';
const C22 = (worksheet['C22'] && worksheet['C22'].v) || '';
const K22 = (worksheet['K22'] && worksheet['K22'].v) || '';
const P22 = (worksheet['P22'] && worksheet['P22'].v) || '';
const U22 = (worksheet['U22'] && worksheet['U22'].v) || '';
const AF22 = (worksheet['AF22'] && worksheet['AF22'].v) || '';
const AF23 = (worksheet['AF23'] && worksheet['AF23'].v) || '';
const O34 = (worksheet['O34'] && worksheet['O34'].v) || '';
//const O38 = (worksheet['O38'] && worksheet['O38'].v) || '';
const X38 = (worksheet['X38'] && worksheet['X38'].v) || '';
const AF38 = (worksheet['AF38'] && worksheet['AF38'].v) || '';
if(I18.includes("/")){
const inFlightInfo = I18.split('/');
const outFlightInfo = M18.split('/');
const inFlightNumber = inFlightInfo[0];
const inFlightDate = inFlightInfo.length > 1 ? inFlightInfo[1].split(' ')[0] : '';
const outFlightNumber = outFlightInfo[0];
const outFlightDate = outFlightInfo.length > 1 ? outFlightInfo[1].split(' ')[0] : '';
const SSRInfo = A20.replace(/[^a-zA-Z0-9\s]/g, '');
//const signatureDate = parseCustomDate(O38);
const formattedAF23 = formatAF23(AF23);
this.fileContent = {
AF1: AF1,
A16: A16,
C16: C16,
K16: K16,
L16: L16,
S16: S16,
inFlightNumber: inFlightNumber,
inFlightDate: inFlightDate,
outFlightNumber: outFlightNumber,
outFlightDate: outFlightDate,
SSRInfo: SSRInfo,
A22: A22,
C22: C22,
K22: K22,
P22: P22,
U22: U22,
AF22: cleanString(AF22),
AF23: formattedAF23,
O34: cleanString(O34),
//signatureDate: signatureDate,
X38: X38,
AF38: cleanString(AF38),
};
this.form.bill.waybillNum=this.fileContent.AF1;
this.form.cvd.cvd_currency_code=this.fileContent.S16;
this.form.rtg.destinationAirport=this.fileContent.A16;
this.form.rtg.destinationCarrier=this.fileContent.C16;
this.form.rtg.onwardAirport=this.fileContent.K16;
this.form.rtg.onwardCarrier=this.fileContent.L16;
this.form.flt.cariier=this.fileContent.inFlightNumber.substring(0,2);
this.form.flt.day=this.fileContent.inFlightDate.substring(0,2);
this.form.flt.flightNumber=this.fileContent.inFlightNumber.substring(2);
this.form.flt.cariier2=this.fileContent.outFlightNumber.substring(0,2);
this.form.flt.day2=this.fileContent.outFlightDate.substring(0,2);
this.form.flt.flightNumber2=this.fileContent.outFlightNumber.substring(2);
this.ssr_content=this.fileContent.SSRInfo;
this.form.bill.quantity_picecs=this.fileContent.A22;
this.form.bill.quantity_weight=parseFloat(this.fileContent.C22).toFixed(2);
this.form.rtd.rtd_charge_weight=parseFloat(this.fileContent.K22).toFixed(2);
this.form.rtd.rtd_rate_charge=this.fileContent.P22;
this.form.rtd.rtd_total=parseFloat(this.fileContent.U22).toFixed(2);
this.form.ppd.ppd_weight_amount=parseFloat(this.fileContent.U22).toFixed(2);
this.form.ppd.ppd_charge_summary_total=parseFloat(this.fileContent.U22).toFixed(2);
this.form.rtd.rtd_goods_DES=this.fileContent.AF22;
this.form.cer.cer_signature=this.fileContent.O34;
this.form.isu.isu_signature=this.fileContent.AF38;
this.dimension_textarea=this.fileContent.AF23;
this.convertAndCalculateVolume();
this.form.isu.isu_day_mounth_year=this.formattedDate();
}else{
//const outFlightInfo = M18.split('/');
//const outFlightDate = outFlightInfo.length > 1 ? outFlightInfo[2].split(' ')[0] : '';
const SSRInfo = A20.replace(/[^a-zA-Z0-9\s]/g, '');
//const signatureDate = parseCustomDate(O38);
const formattedAF23 = formatAF23(AF23);
this.fileContent = {
AF1: AF1,
A16: A16,
C16: C16,
K16: K16,
L16: L16,
S16: S16,
//outFlightDate: outFlightDate,
I18:I18,
SSRInfo: SSRInfo,
A22: A22,
C22: C22,
K22: K22,
P22: P22,
U22: U22,
AF22: cleanString(AF22),
AF23: formattedAF23,
O34: cleanString(O34),
//signatureDate: signatureDate,
X38: X38,
AF38: cleanString(AF38),
};
this.form.bill.waybillNum=this.fileContent.AF1;
this.form.cvd.cvd_currency_code=this.fileContent.S16;
this.form.rtg.destinationAirport=this.fileContent.A16;
this.form.rtg.destinationCarrier=this.fileContent.C16;
this.form.rtg.onwardAirport=this.fileContent.K16;
this.form.rtg.onwardCarrier=this.fileContent.L16;
this.form.flt.cariier=this.fileContent.I18.substring(0,2);
this.form.flt.flightNumber=this.fileContent.I18.substring(2);
this.ssr_content=this.fileContent.SSRInfo;
this.form.bill.quantity_picecs=this.fileContent.A22;
this.form.bill.quantity_weight=parseFloat(this.fileContent.C22).toFixed(2);
this.form.rtd.rtd_charge_weight=parseFloat(this.fileContent.K22).toFixed(2);
this.form.rtd.rtd_rate_charge='';
this.form.rtd.rtd_goods_DES=this.fileContent.AF22;
this.form.cer.cer_signature=this.fileContent.O34;
this.form.isu.isu_signature=this.fileContent.AF38;
this.dimension_textarea=this.fileContent.AF23;
this.convertAndCalculateVolume();
this.form.isu.isu_day_mounth_year=this.formattedDate();
}
} else {
this.fileContent = { AF1: '工作表不存在' };
}
};
reader.readAsArrayBuffer(files);
},
formattedDate() {
// 格式化日期为 yyyy-MM-dd
const date = this.currentDate;
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
}
},
activated(){
... ...