作者 朱兆平

Merge remote-tracking branch 'origin/ExportOrder'

# Conflicts:
#	src/views/nav3/Way.vue
@@ -26,6 +26,15 @@ @@ -26,6 +26,15 @@
26 <el-col style="margin-left: 30px" :span="2"> 26 <el-col style="margin-left: 30px" :span="2">
27 <el-button type="warning" plain @click="cancleBtn">清空</el-button> 27 <el-button type="warning" plain @click="cancleBtn">清空</el-button>
28 </el-col> 28 </el-col>
  29 + <el-col :span="2">
  30 + <el-upload
  31 + action=""
  32 + :on-change="handleChange"
  33 + :auto-upload="false"
  34 + :show-file-list="false">
  35 + <el-button slot="trigger" type="primary">Excel文件</el-button>
  36 + </el-upload>
  37 + </el-col>
29 </el-row> 38 </el-row>
30 <!-- 发货人信息--> 39 <!-- 发货人信息-->
31 <el-row> 40 <el-row>
@@ -539,7 +548,7 @@ @@ -539,7 +548,7 @@
539 <el-col :span="12" style="border-right: 1px solid #a5a5a5;border-bottom:1px solid #a5a5a5;border-left:1px solid #a5a5a5;padding-left: 25px"> 548 <el-col :span="12" style="border-right: 1px solid #a5a5a5;border-bottom:1px solid #a5a5a5;border-left:1px solid #a5a5a5;padding-left: 25px">
540 <span style="font-size: 12px"> 549 <span style="font-size: 12px">
541 Notify Name and Address 550 Notify Name and Address
542 - <el-button type="primary" plain size="mini" style="margin-top: 5px" @click="getCneFwb()">通知人</el-button> 551 + <el-button type="primary" plain size="mini" style="margin-top: 5px" @click="getCneNfy()">通知人</el-button>
543 </span> 552 </span>
544 <el-row> 553 <el-row>
545 <el-col style="width: 38%"> 554 <el-col style="width: 38%">
@@ -799,7 +808,7 @@ Handling Information @@ -799,7 +808,7 @@ Handling Information
799 </el-row> 808 </el-row>
800 <el-row style="padding-top: 20px"> 809 <el-row style="padding-top: 20px">
801 <el-col :span="7" style="border-right: 1px solid #a5a5a5"> 810 <el-col :span="7" style="border-right: 1px solid #a5a5a5">
802 - <el-input :disabled="form.cvd.cvd_charge_prepaid=='CC'" v-model="form.ppd.ppd_weight_amount" auto-complete="off" placeholder="货重金额" size="mini"></el-input> 811 + <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>
803 </el-col> 812 </el-col>
804 <el-col :span="10" style="border-right: 1px solid #a5a5a5;text-align: center"> 813 <el-col :span="10" style="border-right: 1px solid #a5a5a5;text-align: center">
805 <span style="font-size: 12px"> 814 <span style="font-size: 12px">
@@ -807,7 +816,7 @@ Handling Information @@ -807,7 +816,7 @@ Handling Information
807 </span> 816 </span>
808 </el-col> 817 </el-col>
809 <el-col :span="7"> 818 <el-col :span="7">
810 - <el-input :disabled="form.cvd.cvd_charge_prepaid=='PP'" v-model="form.ppd.ppd_weight_amount" auto-complete="off" placeholder="货重金额" size="mini"></el-input> 819 + <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>
811 </el-col> 820 </el-col>
812 </el-row> 821 </el-row>
813 </el-col> 822 </el-col>
@@ -909,7 +918,7 @@ Handling Information @@ -909,7 +918,7 @@ Handling Information
909 <el-row> 918 <el-row>
910 <el-col style="width: 95%"> 919 <el-col style="width: 95%">
911 <el-form-item> 920 <el-form-item>
912 - <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> 921 + <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>
913 </el-form-item> 922 </el-form-item>
914 </el-col> 923 </el-col>
915 </el-row> 924 </el-row>
@@ -933,7 +942,7 @@ Handling Information @@ -933,7 +942,7 @@ Handling Information
933 <el-row> 942 <el-row>
934 <el-col style="width: 95%"> 943 <el-col style="width: 95%">
935 <el-form-item> 944 <el-form-item>
936 - <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> 945 + <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>
937 </el-form-item> 946 </el-form-item>
938 </el-col> 947 </el-col>
939 </el-row> 948 </el-row>
@@ -2066,7 +2075,13 @@ Handling Information @@ -2066,7 +2075,13 @@ Handling Information
2066 v-on:consigeerow="consigeeSelect" 2075 v-on:consigeerow="consigeeSelect"
2067 ></Consignee> 2076 ></Consignee>
2068 </el-dialog> 2077 </el-dialog>
2069 - 2078 + <!-- 列表区域 获取收货人-->
  2079 + <el-dialog :visible.sync="dialogVisible2" width="70%">
  2080 + <Consignee
  2081 + ref="consignee"
  2082 + v-on:consigeerow="notifiedSelect"
  2083 + ></Consignee>
  2084 + </el-dialog>
2070 </el-card> 2085 </el-card>
2071 </template> 2086 </template>
2072 2087
@@ -2077,6 +2092,56 @@ Handling Information @@ -2077,6 +2092,56 @@ Handling Information
2077 import {loginedUserInfo} from "../../api/user"; 2092 import {loginedUserInfo} from "../../api/user";
2078 import {getList} from "../../api/consigner/consigner"; 2093 import {getList} from "../../api/consigner/consigner";
2079 import jsutil from "@/common/js/util"; 2094 import jsutil from "@/common/js/util";
  2095 + import XLSX from 'xlsx';
  2096 + function cleanString(str, maxLength = 20) {
  2097 + return str.replace(/[^a-zA-Z0-9\s]/g, '').slice(0, maxLength);
  2098 + }
  2099 +
  2100 + /*function parseCustomDate(dateStr) {
  2101 + if (typeof dateStr !== 'string') {
  2102 + return '无效日期';
  2103 + }
  2104 +
  2105 + // 自定义日期格式正则表达式
  2106 + const regex = /(\d{1,2})\/([a-zA-Z]{3})\/(\d{4})/;
  2107 + const match = dateStr.match(regex);
  2108 +
  2109 + if (match) {
  2110 + const day = match[1];
  2111 + const month = match[2];
  2112 + const year = match[3];
  2113 +
  2114 + // 月份缩写映射
  2115 + const monthMap = {
  2116 + Jan: '01', Feb: '02', Mar: '03', Apr: '04',
  2117 + May: '05', Jun: '06', Jul: '07', Aug: '08',
  2118 + Sep: '09', Oct: '10', Nov: '11', Dec: '12'
  2119 + };
  2120 +
  2121 + const formattedMonth = monthMap[month.toUpperCase()];
  2122 + if (formattedMonth) {
  2123 + return `${year}-${formattedMonth}-${day.padStart(2, '0')}`;
  2124 + }
  2125 + }
  2126 +
  2127 + return '无效日期';
  2128 + }*/
  2129 +
  2130 + function formatAF23(value) {
  2131 + if (typeof value !== 'string') {
  2132 + return '无效值';
  2133 + }
  2134 +
  2135 + // 删除 DIMS: 行和 VOL: 行
  2136 + const cleanedValue = value.replace(/DIMS:\s*/gi, '').replace(/VOL:\s*\d+\.\d+\s*CBM/gi, '');
  2137 +
  2138 + // 将剩余内容按行分割,并去除空行
  2139 + const lines = cleanedValue.split('\n').filter(line => line.trim() !== '');
  2140 +
  2141 + // 将非空行重新组合成字符串,并用换行符分隔
  2142 + return lines.join('\n').trim();
  2143 + }
  2144 +
2080 2145
2081 export default { 2146 export default {
2082 components: { 2147 components: {
@@ -2103,7 +2168,7 @@ Handling Information @@ -2103,7 +2168,7 @@ Handling Information
2103 quantity_density:'', 2168 quantity_density:'',
2104 quantity_picecs:'', 2169 quantity_picecs:'',
2105 //体积 2170 //体积
2106 - quantity_volume:'', 2171 + quantity_volume:'0',
2107 quantity_volume_code:'MC', 2172 quantity_volume_code:'MC',
2108 quantity_weight:'', 2173 quantity_weight:'',
2109 quantity_weight_code:'K', 2174 quantity_weight_code:'K',
@@ -2391,6 +2456,9 @@ Handling Information @@ -2391,6 +2456,9 @@ Handling Information
2391 gridData:[], 2456 gridData:[],
2392 dialogVisible:false, 2457 dialogVisible:false,
2393 dialogVisible1:false, 2458 dialogVisible1:false,
  2459 + fileContent: null,
  2460 + currentDate:new Date(),
  2461 + dialogVisible2:false,
2394 } 2462 }
2395 }, 2463 },
2396 methods:{ 2464 methods:{
@@ -2511,6 +2579,11 @@ Handling Information @@ -2511,6 +2579,11 @@ Handling Information
2511 this.dialogVisible1 = true; 2579 this.dialogVisible1 = true;
2512 this.$refs.consignee.getConsignee(); 2580 this.$refs.consignee.getConsignee();
2513 }, 2581 },
  2582 + // 通知人信息
  2583 + getCneNfy() {
  2584 + this.dialogVisible2 = true;
  2585 + this.$refs.consignee.getConsignee();
  2586 + },
2514 // 分单 2587 // 分单
2515 // 获取发货人信息 2588 // 获取发货人信息
2516 getShp() { 2589 getShp() {
@@ -2592,6 +2665,23 @@ Handling Information @@ -2592,6 +2665,23 @@ Handling Information
2592 this.dialogVisible1 = false; 2665 this.dialogVisible1 = false;
2593 } 2666 }
2594 }, 2667 },
  2668 + //通知人选中事件处理方法
  2669 + notifiedSelect(row){
  2670 + if(this.activeName=='first'){
  2671 + this.form.nfy.nfy_name = row.companyName;
  2672 + this.form.nfy.nfy_contacts.contact_number=row.conPhone;
  2673 + this.form.nfy.nfy_LOC_city=row.conCity;
  2674 + this.form.nfy.nfy_country=row.country;
  2675 + this.form.nfy.nfy_ADR=row.conAddress;
  2676 + this.nfy_contact.contact_number=row.conPhone;;
  2677 + this.$refs.consignee.consignee_data();
  2678 + this.dialogVisible2 = false;
  2679 + }
  2680 + else{
  2681 + this.$refs.consignee.consignee_data();
  2682 + this.dialogVisible2 = false;
  2683 + }
  2684 + },
2595 //新增分运单 2685 //新增分运单
2596 addFhl() { 2686 addFhl() {
2597 this.shp_aeo.oci_country_code=this.addForm.shp.shp_location_iso; 2687 this.shp_aeo.oci_country_code=this.addForm.shp.shp_location_iso;
@@ -2839,6 +2929,8 @@ Handling Information @@ -2839,6 +2929,8 @@ Handling Information
2839 text = text.replaceAll("cm",""); 2929 text = text.replaceAll("cm","");
2840 text = text.replaceAll("X","x"); 2930 text = text.replaceAll("X","x");
2841 text = text.replaceAll("-","x"); 2931 text = text.replaceAll("-","x");
  2932 + text = text.replaceAll("×","x");
  2933 + text = text.replaceAll("@","x");
2842 text = text.replace(/\//g, 'x'); 2934 text = text.replace(/\//g, 'x');
2843 //去掉空白字符 2935 //去掉空白字符
2844 text = text.replaceAll("/\s/g",""); 2936 text = text.replaceAll("/\s/g","");
@@ -2909,6 +3001,165 @@ Handling Information @@ -2909,6 +3001,165 @@ Handling Information
2909 }, 3001 },
2910 cancleBtn(){ 3002 cancleBtn(){
2911 Object.assign(this.$data, this.$options.data()); 3003 Object.assign(this.$data, this.$options.data());
  3004 + },
  3005 + handleChange(file, fileList) {
  3006 + const files = file.raw;
  3007 + const reader = new FileReader();
  3008 + reader.onload = (e) => {
  3009 + const data = new Uint8Array(e.target.result);
  3010 + const workbook = XLSX.read(data, { type: 'array' });
  3011 + const worksheetName = '格式化打印'; // 指定工作表名称
  3012 + const worksheet = workbook.Sheets[worksheetName];
  3013 + if (worksheet) {
  3014 + const AF1 = (worksheet['AF1'] && worksheet['AF1'].v) || '';
  3015 + const A16 = (worksheet['A16'] && worksheet['A16'].v) || '';
  3016 + const C16 = (worksheet['C16'] && worksheet['C16'].v) || '';
  3017 + const K16 = (worksheet['K16'] && worksheet['K16'].v) || '';
  3018 + const L16 = (worksheet['L16'] && worksheet['L16'].v) || '';
  3019 + const S16 = (worksheet['S16'] && worksheet['S16'].v) || '';
  3020 + const I18 = (worksheet['I18'] && worksheet['I18'].v) || '';
  3021 + const M18 = (worksheet['M18'] && worksheet['M18'].v) || '';
  3022 + const A20 = (worksheet['A20'] && worksheet['A20'].v) || '';
  3023 + const A22 = (worksheet['A22'] && worksheet['A22'].v) || '';
  3024 + const C22 = (worksheet['C22'] && worksheet['C22'].v) || '';
  3025 + const K22 = (worksheet['K22'] && worksheet['K22'].v) || '';
  3026 + const P22 = (worksheet['P22'] && worksheet['P22'].v) || '';
  3027 + const U22 = (worksheet['U22'] && worksheet['U22'].v) || '';
  3028 + const AF22 = (worksheet['AF22'] && worksheet['AF22'].v) || '';
  3029 + const AF23 = (worksheet['AF23'] && worksheet['AF23'].v) || '';
  3030 + const O34 = (worksheet['O34'] && worksheet['O34'].v) || '';
  3031 + //const O38 = (worksheet['O38'] && worksheet['O38'].v) || '';
  3032 + const X38 = (worksheet['X38'] && worksheet['X38'].v) || '';
  3033 + const AF38 = (worksheet['AF38'] && worksheet['AF38'].v) || '';
  3034 +
  3035 + if(I18.includes("/")){
  3036 + const inFlightInfo = I18.split('/');
  3037 + const outFlightInfo = M18.split('/');
  3038 + const inFlightNumber = inFlightInfo[0];
  3039 + const inFlightDate = inFlightInfo.length > 1 ? inFlightInfo[1].split(' ')[0] : '';
  3040 + const outFlightNumber = outFlightInfo[0];
  3041 + const outFlightDate = outFlightInfo.length > 1 ? outFlightInfo[1].split(' ')[0] : '';
  3042 +
  3043 + const SSRInfo = A20.replace(/[^a-zA-Z0-9\s]/g, '');
  3044 + //const signatureDate = parseCustomDate(O38);
  3045 + const formattedAF23 = formatAF23(AF23);
  3046 +
  3047 + this.fileContent = {
  3048 + AF1: AF1,
  3049 + A16: A16,
  3050 + C16: C16,
  3051 + K16: K16,
  3052 + L16: L16,
  3053 + S16: S16,
  3054 + inFlightNumber: inFlightNumber,
  3055 + inFlightDate: inFlightDate,
  3056 + outFlightNumber: outFlightNumber,
  3057 + outFlightDate: outFlightDate,
  3058 + SSRInfo: SSRInfo,
  3059 + A22: A22,
  3060 + C22: C22,
  3061 + K22: K22,
  3062 + P22: P22,
  3063 + U22: U22,
  3064 + AF22: cleanString(AF22),
  3065 + AF23: formattedAF23,
  3066 + O34: cleanString(O34),
  3067 + //signatureDate: signatureDate,
  3068 + X38: X38,
  3069 + AF38: cleanString(AF38),
  3070 + };
  3071 + this.form.bill.waybillNum=this.fileContent.AF1;
  3072 + this.form.cvd.cvd_currency_code=this.fileContent.S16;
  3073 + this.form.rtg.destinationAirport=this.fileContent.A16;
  3074 + this.form.rtg.destinationCarrier=this.fileContent.C16;
  3075 + this.form.rtg.onwardAirport=this.fileContent.K16;
  3076 + this.form.rtg.onwardCarrier=this.fileContent.L16;
  3077 + this.form.flt.cariier=this.fileContent.inFlightNumber.substring(0,2);
  3078 + this.form.flt.day=this.fileContent.inFlightDate.substring(0,2);
  3079 + this.form.flt.flightNumber=this.fileContent.inFlightNumber.substring(2);
  3080 + this.form.flt.cariier2=this.fileContent.outFlightNumber.substring(0,2);
  3081 + this.form.flt.day2=this.fileContent.outFlightDate.substring(0,2);
  3082 + this.form.flt.flightNumber2=this.fileContent.outFlightNumber.substring(2);
  3083 + this.ssr_content=this.fileContent.SSRInfo;
  3084 + this.form.bill.quantity_picecs=this.fileContent.A22;
  3085 + this.form.bill.quantity_weight=parseFloat(this.fileContent.C22).toFixed(2);
  3086 + this.form.rtd.rtd_charge_weight=parseFloat(this.fileContent.K22).toFixed(2);
  3087 + this.form.rtd.rtd_rate_charge=this.fileContent.P22;
  3088 + this.form.rtd.rtd_total=parseFloat(this.fileContent.U22).toFixed(2);
  3089 + this.form.ppd.ppd_weight_amount=parseFloat(this.fileContent.U22).toFixed(2);
  3090 + this.form.ppd.ppd_charge_summary_total=parseFloat(this.fileContent.U22).toFixed(2);
  3091 + this.form.rtd.rtd_goods_DES=this.fileContent.AF22;
  3092 + this.form.cer.cer_signature=this.fileContent.O34;
  3093 + this.form.isu.isu_signature=this.fileContent.AF38;
  3094 + this.dimension_textarea=this.fileContent.AF23;
  3095 + this.convertAndCalculateVolume();
  3096 +
  3097 + this.form.isu.isu_day_mounth_year=this.formattedDate();
  3098 + }else{
  3099 + //const outFlightInfo = M18.split('/');
  3100 + //const outFlightDate = outFlightInfo.length > 1 ? outFlightInfo[2].split(' ')[0] : '';
  3101 +
  3102 + const SSRInfo = A20.replace(/[^a-zA-Z0-9\s]/g, '');
  3103 + //const signatureDate = parseCustomDate(O38);
  3104 + const formattedAF23 = formatAF23(AF23);
  3105 +
  3106 + this.fileContent = {
  3107 + AF1: AF1,
  3108 + A16: A16,
  3109 + C16: C16,
  3110 + K16: K16,
  3111 + L16: L16,
  3112 + S16: S16,
  3113 + //outFlightDate: outFlightDate,
  3114 + I18:I18,
  3115 + SSRInfo: SSRInfo,
  3116 + A22: A22,
  3117 + C22: C22,
  3118 + K22: K22,
  3119 + P22: P22,
  3120 + U22: U22,
  3121 + AF22: cleanString(AF22),
  3122 + AF23: formattedAF23,
  3123 + O34: cleanString(O34),
  3124 + //signatureDate: signatureDate,
  3125 + X38: X38,
  3126 + AF38: cleanString(AF38),
  3127 + };
  3128 + this.form.bill.waybillNum=this.fileContent.AF1;
  3129 + this.form.cvd.cvd_currency_code=this.fileContent.S16;
  3130 + this.form.rtg.destinationAirport=this.fileContent.A16;
  3131 + this.form.rtg.destinationCarrier=this.fileContent.C16;
  3132 + this.form.rtg.onwardAirport=this.fileContent.K16;
  3133 + this.form.rtg.onwardCarrier=this.fileContent.L16;
  3134 + this.form.flt.cariier=this.fileContent.I18.substring(0,2);
  3135 + this.form.flt.flightNumber=this.fileContent.I18.substring(2);
  3136 + this.ssr_content=this.fileContent.SSRInfo;
  3137 + this.form.bill.quantity_picecs=this.fileContent.A22;
  3138 + this.form.bill.quantity_weight=parseFloat(this.fileContent.C22).toFixed(2);
  3139 + this.form.rtd.rtd_charge_weight=parseFloat(this.fileContent.K22).toFixed(2);
  3140 + this.form.rtd.rtd_rate_charge='';
  3141 + this.form.rtd.rtd_goods_DES=this.fileContent.AF22;
  3142 + this.form.cer.cer_signature=this.fileContent.O34;
  3143 + this.form.isu.isu_signature=this.fileContent.AF38;
  3144 + this.dimension_textarea=this.fileContent.AF23;
  3145 + this.convertAndCalculateVolume();
  3146 +
  3147 + this.form.isu.isu_day_mounth_year=this.formattedDate();
  3148 + }
  3149 +
  3150 + } else {
  3151 + this.fileContent = { AF1: '工作表不存在' };
  3152 + }
  3153 + };
  3154 + reader.readAsArrayBuffer(files);
  3155 + },
  3156 + formattedDate() {
  3157 + // 格式化日期为 yyyy-MM-dd
  3158 + const date = this.currentDate;
  3159 + const year = date.getFullYear();
  3160 + const month = String(date.getMonth() + 1).padStart(2, '0');
  3161 + const day = String(date.getDate()).padStart(2, '0');
  3162 + return `${year}-${month}-${day}`;
2912 } 3163 }
2913 }, 3164 },
2914 activated(){ 3165 activated(){