正在显示
5 个修改的文件
包含
572 行增加
和
42 行删除
@@ -36,6 +36,15 @@ module.exports = { | @@ -36,6 +36,15 @@ module.exports = { | ||
36 | '^/api/static': '/static', //这里理解成用‘/api’代替target里面的地址,后面组件中我们掉接口时直接用api代替 比如我要调用'http://40.00.100.100:3002/user/add',直接写‘/api/user/add’即可 | 36 | '^/api/static': '/static', //这里理解成用‘/api’代替target里面的地址,后面组件中我们掉接口时直接用api代替 比如我要调用'http://40.00.100.100:3002/user/add',直接写‘/api/user/add’即可 |
37 | } | 37 | } |
38 | }, | 38 | }, |
39 | + '/api/ai-agent':{ | ||
40 | + target: 'http://192.168.1.78',//设置你调用的接口域名和端口号 别忘了加http | ||
41 | + // target: 'http://192.168.1.189:12343',//设置你调用的接口域名和端口号 别忘了加http | ||
42 | + // target: 'http://localhost:12343',//设置你调用的接口域名和端口号 别忘了加http | ||
43 | + changeOrigin: true, | ||
44 | + pathRewrite: { | ||
45 | + '^/api/ai-agent': '/', //这里理解成用‘/api’代替target里面的地址,后面组件中我们掉接口时直接用api代替 比如我要调用'http://40.00.100.100:3002/user/add',直接写‘/api/user/add’即可 | ||
46 | + } | ||
47 | + }, | ||
39 | '/api':{ | 48 | '/api':{ |
40 | target: 'http://192.168.1.63:12343',//设置你调用的接口域名和端口号 别忘了加http | 49 | target: 'http://192.168.1.63:12343',//设置你调用的接口域名和端口号 别忘了加http |
41 | // target: 'http://192.168.1.189:12343',//设置你调用的接口域名和端口号 别忘了加http | 50 | // target: 'http://192.168.1.189:12343',//设置你调用的接口域名和端口号 别忘了加http |
src/api/dify/SHP_CNE_info_API.js
0 → 100644
@@ -14,6 +14,18 @@ export default { | @@ -14,6 +14,18 @@ export default { | ||
14 | } | 14 | } |
15 | }) | 15 | }) |
16 | }, | 16 | }, |
17 | + postToDify(url, data, token) { | ||
18 | + return axios({ | ||
19 | + method: 'POST', // 请求协议 | ||
20 | + url: url, // 请求的地址 | ||
21 | + data: data, // post 请求的实体类数据 | ||
22 | + timeout: 30000, // 超时时间, 单位毫秒 | ||
23 | + headers: { | ||
24 | + 'Content-Type': 'application/json;charset=UTF-8', | ||
25 | + 'Authorization':'Bearer '+token | ||
26 | + } | ||
27 | + }) | ||
28 | + }, | ||
17 | postWithFrom(url, data) { | 29 | postWithFrom(url, data) { |
18 | return axios({ | 30 | return axios({ |
19 | method: 'POST', // 请求协议 | 31 | method: 'POST', // 请求协议 |
@@ -35,6 +35,10 @@ | @@ -35,6 +35,10 @@ | ||
35 | <el-button slot="trigger" type="primary">Excel文件</el-button> | 35 | <el-button slot="trigger" type="primary">Excel文件</el-button> |
36 | </el-upload> | 36 | </el-upload> |
37 | </el-col> | 37 | </el-col> |
38 | + | ||
39 | + <el-col style="margin-left: 30px" :span="2"> | ||
40 | + <el-button type="success" icon="el-icon-s-opportunity" @click="batchFile">AI批量</el-button> | ||
41 | + </el-col> | ||
38 | </el-row> | 42 | </el-row> |
39 | <!-- 发货人信息--> | 43 | <!-- 发货人信息--> |
40 | <el-row> | 44 | <el-row> |
@@ -2089,6 +2093,47 @@ Handling Information | @@ -2089,6 +2093,47 @@ Handling Information | ||
2089 | v-on:consigerrow="consigerSelect" | 2093 | v-on:consigerrow="consigerSelect" |
2090 | ></Consigner> | 2094 | ></Consigner> |
2091 | </el-dialog> | 2095 | </el-dialog> |
2096 | + <el-drawer | ||
2097 | + title="批量处理" | ||
2098 | + :visible.sync="drawer" | ||
2099 | + direction="rtl"> | ||
2100 | + <!-- 进度提示 --> | ||
2101 | + <div v-if="uploadProgress.total > 0"> | ||
2102 | + <el-progress | ||
2103 | + :percentage="uploadProgress.percent" | ||
2104 | + :status="uploadProgress.percent === 100 ? 'success' : 'exception'" | ||
2105 | + striped | ||
2106 | + /> | ||
2107 | + <div class="progress-text"> | ||
2108 | + {{ uploadProgress.currentFile }} | ||
2109 | + ({{ uploadProgress.processed }}/{{ uploadProgress.total }}) | ||
2110 | + </div> | ||
2111 | + </div> | ||
2112 | + <div style="height: 100%; padding: 20px;"> | ||
2113 | + <!-- 通过 text-align 实现水平居中 --> | ||
2114 | + <el-row :gutter="10" style="text-align: center;"> | ||
2115 | + <el-col :span="24"> | ||
2116 | + <el-upload | ||
2117 | + action="" | ||
2118 | + multiple | ||
2119 | + drag | ||
2120 | + style="display: inline-block;" | ||
2121 | + :file-list="uploadFileList" | ||
2122 | + :on-change="batchFileUpload" | ||
2123 | + :auto-upload="false" | ||
2124 | + :show-file-list="false"> | ||
2125 | + <el-button slot="trigger" type="primary">Excel文件</el-button> | ||
2126 | + </el-upload> | ||
2127 | + </el-col> | ||
2128 | + </el-row> | ||
2129 | + <!-- 下方其他内容保持原布局 --> | ||
2130 | + <el-row style="margin-top: 20px;"> | ||
2131 | + <el-col :span="24"> | ||
2132 | + <todo-list :uploadFileList="batchFileListResult" /> | ||
2133 | + </el-col> | ||
2134 | + </el-row> | ||
2135 | + </div> | ||
2136 | + </el-drawer> | ||
2092 | <!-- 列表区域 获取收货人--> | 2137 | <!-- 列表区域 获取收货人--> |
2093 | <el-dialog :visible.sync="dialogVisible1" width="70%"> | 2138 | <el-dialog :visible.sync="dialogVisible1" width="70%"> |
2094 | <Consignee | 2139 | <Consignee |
@@ -2112,8 +2157,10 @@ Handling Information | @@ -2112,8 +2157,10 @@ Handling Information | ||
2112 | import Consignee from "../consigner/consignee" | 2157 | import Consignee from "../consigner/consignee" |
2113 | import {loginedUserInfo} from "../../api/user"; | 2158 | import {loginedUserInfo} from "../../api/user"; |
2114 | import {getList} from "../../api/consigner/consigner"; | 2159 | import {getList} from "../../api/consigner/consigner"; |
2160 | + import {getInfo} from "@/api/dify/SHP_CNE_info_API"; | ||
2115 | import jsutil from "@/common/js/util"; | 2161 | import jsutil from "@/common/js/util"; |
2116 | import XLSX from 'xlsx'; | 2162 | import XLSX from 'xlsx'; |
2163 | + import TodoList from "@/views/nav3/components/TodoList.vue"; | ||
2117 | function cleanString(str, maxLength = 20) { | 2164 | function cleanString(str, maxLength = 20) { |
2118 | return str.replace(/[^a-zA-Z0-9\s]/g, '').slice(0, maxLength); | 2165 | return str.replace(/[^a-zA-Z0-9\s]/g, '').slice(0, maxLength); |
2119 | } | 2166 | } |
@@ -2166,10 +2213,14 @@ Handling Information | @@ -2166,10 +2213,14 @@ Handling Information | ||
2166 | 2213 | ||
2167 | export default { | 2214 | export default { |
2168 | components: { | 2215 | components: { |
2216 | + TodoList, | ||
2169 | Consigner,Consignee | 2217 | Consigner,Consignee |
2170 | }, | 2218 | }, |
2171 | data(){ | 2219 | data(){ |
2172 | return { | 2220 | return { |
2221 | + drawer: false, | ||
2222 | + uploadFileList: [], | ||
2223 | + batchFileListResult:[], | ||
2173 | hidden: ['a1', 'a2', 'a3', 'a4', 'a5','a6'], | 2224 | hidden: ['a1', 'a2', 'a3', 'a4', 'a5','a6'], |
2174 | // 主单 | 2225 | // 主单 |
2175 | activeName: 'first', | 2226 | activeName: 'first', |
@@ -2484,9 +2535,18 @@ Handling Information | @@ -2484,9 +2535,18 @@ Handling Information | ||
2484 | fileContent: null, | 2535 | fileContent: null, |
2485 | currentDate:new Date(), | 2536 | currentDate:new Date(), |
2486 | dialogVisible2:false, | 2537 | dialogVisible2:false, |
2538 | + uploadProgress: { | ||
2539 | + total: 0, // 总文件数 | ||
2540 | + processed: 0, // 已处理文件数 | ||
2541 | + percent: 0, // 进度百分比 | ||
2542 | + currentFile: '' // 当前处理的文件名 | ||
2543 | + }, | ||
2487 | } | 2544 | } |
2488 | }, | 2545 | }, |
2489 | methods:{ | 2546 | methods:{ |
2547 | + batchFile(){ | ||
2548 | + this.drawer = true; | ||
2549 | + }, | ||
2490 | handlePaste(event, maxLength) { | 2550 | handlePaste(event, maxLength) { |
2491 | // 阻止默认的粘贴行为 | 2551 | // 阻止默认的粘贴行为 |
2492 | event.preventDefault(); | 2552 | event.preventDefault(); |
@@ -2792,8 +2852,8 @@ Handling Information | @@ -2792,8 +2852,8 @@ Handling Information | ||
2792 | 2852 | ||
2793 | }) | 2853 | }) |
2794 | }, | 2854 | }, |
2795 | - //新增主运单 | ||
2796 | - addFwb() { | 2855 | + //新增FWB主运单的属性设置方法 |
2856 | + addFwbWithSet(){ | ||
2797 | this.form.rtd.rtd_gross_weight=this.form.bill.quantity_weight; | 2857 | this.form.rtd.rtd_gross_weight=this.form.bill.quantity_weight; |
2798 | this.form.rtd.rtd_number_pieces=this.form.bill.quantity_picecs; | 2858 | this.form.rtd.rtd_number_pieces=this.form.bill.quantity_picecs; |
2799 | this.form.rtd.rtd_volume=this.form.bill.quantity_volume; | 2859 | this.form.rtd.rtd_volume=this.form.bill.quantity_volume; |
@@ -2811,6 +2871,10 @@ Handling Information | @@ -2811,6 +2871,10 @@ Handling Information | ||
2811 | this.form.oci.push(this.cne_oci); | 2871 | this.form.oci.push(this.cne_oci); |
2812 | this.form.cne.cne_contacts.push(this.cne_contact); | 2872 | this.form.cne.cne_contacts.push(this.cne_contact); |
2813 | this.form.nfy.nfy_contacts.push(this.nfy_contact); | 2873 | this.form.nfy.nfy_contacts.push(this.nfy_contact); |
2874 | + }, | ||
2875 | + //新增主运单 | ||
2876 | + addFwb() { | ||
2877 | + this.addFwbWithSet(); | ||
2814 | /*进行表单的预验证*/ | 2878 | /*进行表单的预验证*/ |
2815 | this.$refs.apply_formRef.validate(valid => { | 2879 | this.$refs.apply_formRef.validate(valid => { |
2816 | // 未通过,表单预校验 | 2880 | // 未通过,表单预校验 |
@@ -2820,10 +2884,10 @@ Handling Information | @@ -2820,10 +2884,10 @@ Handling Information | ||
2820 | //添加调度记录信息,失败 | 2884 | //添加调度记录信息,失败 |
2821 | if (res.code !== '200'){ | 2885 | if (res.code !== '200'){ |
2822 | return this.$message.error(res.msg); | 2886 | return this.$message.error(res.msg); |
2823 | - } | 2887 | + }else { |
2824 | this.$message.success(res.msg); | 2888 | this.$message.success(res.msg); |
2889 | + } | ||
2825 | Object.assign(this.$data, this.$options.data()); | 2890 | Object.assign(this.$data, this.$options.data()); |
2826 | - | ||
2827 | }).catch(error => { | 2891 | }).catch(error => { |
2828 | this.form.oci=[]; | 2892 | this.form.oci=[]; |
2829 | this.$message.error(error.toString()); | 2893 | this.$message.error(error.toString()); |
@@ -2944,11 +3008,22 @@ Handling Information | @@ -2944,11 +3008,22 @@ Handling Information | ||
2944 | //批量尺寸信息识别 | 3008 | //批量尺寸信息识别 |
2945 | convertAndCalculateVolume() { | 3009 | convertAndCalculateVolume() { |
2946 | let _this= this; | 3010 | let _this= this; |
2947 | - this.$confirm('是否需要根据录入的尺寸信息生成详细的尺寸计算数据表,此操作会往表里面添加新的尺寸数据', '提示', { | 3011 | + return this.$confirm('是否需要根据录入的尺寸信息生成详细的尺寸计算数据表,此操作会往表里面添加新的尺寸数据', '提示', { |
2948 | confirmButtonText: '确定', | 3012 | confirmButtonText: '确定', |
2949 | cancelButtonText: '取消', | 3013 | cancelButtonText: '取消', |
2950 | type: 'warning' | 3014 | type: 'warning' |
2951 | }).then(() => { | 3015 | }).then(() => { |
3016 | + _this.convertAndCalculateVolumeTool(); | ||
3017 | + }).catch((e) => { | ||
3018 | + this.$message({ | ||
3019 | + type: 'error', | ||
3020 | + message: '已取消'+e | ||
3021 | + }); | ||
3022 | + }); | ||
3023 | + }, | ||
3024 | + // 尺寸识别方法 | ||
3025 | + convertAndCalculateVolumeTool(){ | ||
3026 | + let _this= this; | ||
2952 | let text = this.dimension_textarea.trim().replaceAll("*","x"); | 3027 | let text = this.dimension_textarea.trim().replaceAll("*","x"); |
2953 | text = text.replaceAll("CM",""); | 3028 | text = text.replaceAll("CM",""); |
2954 | text = text.replaceAll("cm",""); | 3029 | text = text.replaceAll("cm",""); |
@@ -3006,7 +3081,7 @@ Handling Information | @@ -3006,7 +3081,7 @@ Handling Information | ||
3006 | type: 'error', | 3081 | type: 'error', |
3007 | message: '行:'+ line +'尺寸格式错误! 录入信息支持 数字和Xx*- ' | 3082 | message: '行:'+ line +'尺寸格式错误! 录入信息支持 数字和Xx*- ' |
3008 | }); | 3083 | }); |
3009 | - return ; | 3084 | + throw new Error('行:'+ line +'尺寸格式错误! 录入信息支持 数字和Xx*- '); |
3010 | } | 3085 | } |
3011 | } | 3086 | } |
3012 | if (totalVolume>0){ | 3087 | if (totalVolume>0){ |
@@ -3017,12 +3092,6 @@ Handling Information | @@ -3017,12 +3092,6 @@ Handling Information | ||
3017 | converted: output.trim(), | 3092 | converted: output.trim(), |
3018 | totalVolume: totalVolume | 3093 | totalVolume: totalVolume |
3019 | }; | 3094 | }; |
3020 | - }).catch((e) => { | ||
3021 | - this.$message({ | ||
3022 | - type: 'error', | ||
3023 | - message: '已取消'+e.message | ||
3024 | - }); | ||
3025 | - }); | ||
3026 | }, | 3095 | }, |
3027 | cancleBtn(){ | 3096 | cancleBtn(){ |
3028 | Object.assign(this.$data, this.$options.data()); | 3097 | Object.assign(this.$data, this.$options.data()); |
@@ -3079,20 +3148,12 @@ Handling Information | @@ -3079,20 +3148,12 @@ Handling Information | ||
3079 | const AF38 = (worksheet['AF38'] && worksheet['AF38'].v) || ''; | 3148 | const AF38 = (worksheet['AF38'] && worksheet['AF38'].v) || ''; |
3080 | //判定acc 中是否包含COU 特殊操作代码 | 3149 | //判定acc 中是否包含COU 特殊操作代码 |
3081 | const S10 = (worksheet['S10'] && worksheet['S10'].v) || ''; | 3150 | const S10 = (worksheet['S10'] && worksheet['S10'].v) || ''; |
3082 | - | ||
3083 | if (S10.includes("COU")){ | 3151 | if (S10.includes("COU")){ |
3084 | this.sphCodes += "COU" | 3152 | this.sphCodes += "COU" |
3085 | } | 3153 | } |
3086 | 3154 | ||
3087 | - | ||
3088 | - if(I18.includes("/")){ | ||
3089 | - const inFlightInfo = I18.split('/'); | ||
3090 | - const outFlightInfo = M18.split('/'); | ||
3091 | - const inFlightNumber = inFlightInfo[0]; | ||
3092 | - const inFlightDate = inFlightInfo.length > 1 ? inFlightInfo[1].split(' ')[0] : ''; | ||
3093 | - const outFlightNumber = outFlightInfo[0]; | ||
3094 | - const outFlightDate = outFlightInfo.length > 1 ? outFlightInfo[1].split(' ')[0] : ''; | ||
3095 | - | 3155 | + const tempDate=this.NumberToDate(M18); |
3156 | + const outFlightDate=tempDate.split('/')[2]; | ||
3096 | const SSRInfo = A20.replace(/[^a-zA-Z0-9\s]/g, ''); | 3157 | const SSRInfo = A20.replace(/[^a-zA-Z0-9\s]/g, ''); |
3097 | //const signatureDate = parseCustomDate(O38); | 3158 | //const signatureDate = parseCustomDate(O38); |
3098 | const formattedAF23 = formatAF23(AF23); | 3159 | const formattedAF23 = formatAF23(AF23); |
@@ -3104,16 +3165,15 @@ Handling Information | @@ -3104,16 +3165,15 @@ Handling Information | ||
3104 | K16: K16, | 3165 | K16: K16, |
3105 | L16: L16, | 3166 | L16: L16, |
3106 | S16: S16, | 3167 | S16: S16, |
3107 | - inFlightNumber: inFlightNumber, | ||
3108 | - inFlightDate: inFlightDate, | ||
3109 | - outFlightNumber: outFlightNumber, | ||
3110 | - outFlightDate: outFlightDate, | 3168 | + //outFlightDate: outFlightDate, |
3169 | + I18:I18, | ||
3111 | SSRInfo: SSRInfo, | 3170 | SSRInfo: SSRInfo, |
3112 | A22: A22, | 3171 | A22: A22, |
3113 | C22: C22, | 3172 | C22: C22, |
3114 | K22: K22, | 3173 | K22: K22, |
3115 | P22: P22, | 3174 | P22: P22, |
3116 | U22: U22, | 3175 | U22: U22, |
3176 | + M18: outFlightDate, | ||
3117 | AF22: cleanString(AF22), | 3177 | AF22: cleanString(AF22), |
3118 | AF23: formattedAF23, | 3178 | AF23: formattedAF23, |
3119 | O34: cleanString(O34), | 3179 | O34: cleanString(O34), |
@@ -3121,42 +3181,169 @@ Handling Information | @@ -3121,42 +3181,169 @@ Handling Information | ||
3121 | X38: X38, | 3181 | X38: X38, |
3122 | AF38: cleanString(AF38), | 3182 | AF38: cleanString(AF38), |
3123 | }; | 3183 | }; |
3184 | + | ||
3124 | this.form.bill.waybillNum=this.fileContent.AF1; | 3185 | this.form.bill.waybillNum=this.fileContent.AF1; |
3125 | this.form.cvd.cvd_currency_code=this.fileContent.S16; | 3186 | this.form.cvd.cvd_currency_code=this.fileContent.S16; |
3126 | this.form.rtg.destinationAirport=this.fileContent.A16; | 3187 | this.form.rtg.destinationAirport=this.fileContent.A16; |
3127 | this.form.rtg.destinationCarrier=this.fileContent.C16; | 3188 | this.form.rtg.destinationCarrier=this.fileContent.C16; |
3128 | this.form.rtg.onwardAirport=this.fileContent.K16; | 3189 | this.form.rtg.onwardAirport=this.fileContent.K16; |
3129 | this.form.rtg.onwardCarrier=this.fileContent.L16; | 3190 | this.form.rtg.onwardCarrier=this.fileContent.L16; |
3130 | - this.form.flt.cariier=this.fileContent.inFlightNumber.substring(0,2); | ||
3131 | - this.form.flt.day=this.fileContent.inFlightDate.substring(0,2); | ||
3132 | - this.form.flt.flightNumber=this.fileContent.inFlightNumber.substring(2); | ||
3133 | - this.form.flt.cariier2=this.fileContent.outFlightNumber.substring(0,2); | ||
3134 | - this.form.flt.day2=this.fileContent.outFlightDate.substring(0,2); | ||
3135 | - this.form.flt.flightNumber2=this.fileContent.outFlightNumber.substring(2); | 3191 | + this.form.flt.cariier=this.fileContent.I18.substring(0,2); |
3192 | + this.form.flt.day=this.fileContent.M18; | ||
3193 | + this.form.flt.flightNumber=this.fileContent.I18.substring(2); | ||
3136 | this.ssr_content=this.fileContent.SSRInfo; | 3194 | this.ssr_content=this.fileContent.SSRInfo; |
3137 | this.form.bill.quantity_picecs=this.fileContent.A22; | 3195 | this.form.bill.quantity_picecs=this.fileContent.A22; |
3138 | this.form.bill.quantity_weight=parseFloat(this.fileContent.C22).toFixed(2); | 3196 | this.form.bill.quantity_weight=parseFloat(this.fileContent.C22).toFixed(2); |
3139 | this.form.rtd.rtd_charge_weight=parseFloat(this.fileContent.K22).toFixed(2); | 3197 | this.form.rtd.rtd_charge_weight=parseFloat(this.fileContent.K22).toFixed(2); |
3140 | - this.form.rtd.rtd_rate_charge=this.fileContent.P22; | ||
3141 | - this.form.rtd.rtd_total=parseFloat(this.fileContent.U22).toFixed(2); | ||
3142 | - this.form.ppd.ppd_weight_amount=parseFloat(this.fileContent.U22).toFixed(2); | ||
3143 | - this.form.ppd.ppd_charge_summary_total=parseFloat(this.fileContent.U22).toFixed(2); | 3198 | + this.form.rtd.rtd_rate_charge=''; |
3144 | this.form.rtd.rtd_goods_DES=this.fileContent.AF22; | 3199 | this.form.rtd.rtd_goods_DES=this.fileContent.AF22; |
3145 | this.form.cer.cer_signature=this.fileContent.O34; | 3200 | this.form.cer.cer_signature=this.fileContent.O34; |
3146 | this.form.isu.isu_signature=this.fileContent.AF38; | 3201 | this.form.isu.isu_signature=this.fileContent.AF38; |
3147 | this.dimension_textarea=this.fileContent.AF23; | 3202 | this.dimension_textarea=this.fileContent.AF23; |
3148 | - //this.convertAndCalculateVolume(); | ||
3149 | 3203 | ||
3150 | this.form.isu.isu_day_mounth_year=this.formattedDate(); | 3204 | this.form.isu.isu_day_mounth_year=this.formattedDate(); |
3151 | - }else{ | ||
3152 | - console.log(M18) | 3205 | + |
3206 | + //尺寸处理 | ||
3207 | + this.convertAndCalculateVolumeTool(); | ||
3208 | + | ||
3209 | + | ||
3210 | + //发货人信息 | ||
3211 | + const A3_ShipInfo = (worksheet['A3'] && worksheet['A3'].v) || ''; | ||
3212 | + //收货人信息 | ||
3213 | + const A7_CNEInfo = (worksheet['A7'] && worksheet['A7'].v) || ''; | ||
3214 | + //收发货人处理 | ||
3215 | + const dify_para_ship = { | ||
3216 | + "inputs": { | ||
3217 | + "logisticsInformation": A3_ShipInfo | ||
3218 | + }, | ||
3219 | + "response_mode": "blocking", | ||
3220 | + "user": "C6" | ||
3221 | + } | ||
3222 | + const dify_api_token = 'app-1jFyrO64582meeymRG219FdK' | ||
3223 | + return getInfo(dify_para_ship, dify_api_token) | ||
3224 | + .then(response => { | ||
3225 | + let response_data = response.data; | ||
3226 | + let CompletionResponse = response_data.data; | ||
3227 | + // 获取dify 执行状态结果 | ||
3228 | + let excute_result = CompletionResponse.status; | ||
3229 | + | ||
3230 | + if ("succeeded" === excute_result) { | ||
3231 | + // 获取返回信息 | ||
3232 | + let result = CompletionResponse.outputs.text; | ||
3233 | + // 返回的json字符串转换成JSON对象,todo:后续对收发货人内容进行字符串过滤,或者在dify后端过滤 | ||
3234 | + let shipOrCneInfo = JSON.parse(result); | ||
3235 | + this.form.shp.shp_adr = shipOrCneInfo.address; | ||
3236 | + this.form.shp.shp_name = shipOrCneInfo.name; | ||
3237 | + this.form.shp.shp_country = shipOrCneInfo.country; | ||
3238 | + this.form.shp.shp_loc_place = shipOrCneInfo.city; | ||
3239 | + this.shp_contact.contact_number = shipOrCneInfo.phoneNum; | ||
3240 | + this.shp_oci.oci_csrc_info = shipOrCneInfo.enterpriseRegistrationCode; | ||
3241 | + | ||
3242 | + // 构建下一个请求参数 | ||
3243 | + const dify_para_cne = { | ||
3244 | + "inputs": { | ||
3245 | + "logisticsInformation": A7_CNEInfo | ||
3246 | + }, | ||
3247 | + "response_mode": "blocking", | ||
3248 | + "user": "C6" | ||
3249 | + }; | ||
3250 | + | ||
3251 | + // 返回下一个 API 调用的 Promise | ||
3252 | + return getInfo(dify_para_cne, dify_api_token); | ||
3253 | + } else { | ||
3254 | + throw new Error("人工智能助手执行错误"); | ||
3255 | + } | ||
3256 | + }) | ||
3257 | + .then(response => { | ||
3258 | + let response_data = response.data; | ||
3259 | + let CompletionResponse = response_data.data; | ||
3260 | + // 获取dify 执行状态结果 | ||
3261 | + let excute_result = CompletionResponse.status; | ||
3262 | + | ||
3263 | + if ("succeeded" === excute_result) { | ||
3264 | + // 获取返回信息 | ||
3265 | + let result = CompletionResponse.outputs.text; | ||
3266 | + // 返回的json字符串转换成JSON对象,todo:后续对收发货人内容进行字符串过滤,或者在dify后端过滤 | ||
3267 | + let cneInfo = JSON.parse(result); | ||
3268 | + this.form.cne.cne_adr = cneInfo.address; | ||
3269 | + this.form.cne.cne_name = cneInfo.name; | ||
3270 | + this.form.cne.cne_country = cneInfo.country; | ||
3271 | + this.form.cne.cne_loc_place = cneInfo.city; | ||
3272 | + this.cne_contact.contact_number = cneInfo.phoneNum; | ||
3273 | + this.cne_oci.oci_csrc_info = cneInfo.enterpriseRegistrationCode; | ||
3274 | + } else { | ||
3275 | + throw new Error("人工智能助手执行错误"); | ||
3276 | + } | ||
3277 | + | ||
3278 | + //返回下个promise | ||
3279 | + return new Promise((resolve, reject) => { | ||
3280 | + resolve({success:true,code:'200'}); | ||
3281 | + }); | ||
3282 | + }) | ||
3283 | + .then(response=>{ | ||
3284 | + alert('执行提交'+JSON.stringify(response)) | ||
3285 | + //导入后提交 | ||
3286 | + // this.addFwb(); | ||
3287 | + return {success:true,code:'200'}; | ||
3288 | + }) | ||
3289 | + .catch(e => { | ||
3290 | + this.$message({ | ||
3291 | + type: 'error', | ||
3292 | + message: e.message | ||
3293 | + }); | ||
3294 | + return {success:false,code:'400'}; | ||
3295 | + }); | ||
3296 | + | ||
3297 | + } else { | ||
3298 | + this.fileContent = { AF1: '工作表不存在' }; | ||
3299 | + } | ||
3300 | + }; | ||
3301 | + reader.readAsArrayBuffer(files); | ||
3302 | + }, | ||
3303 | + // 异步处理 | ||
3304 | + fileBatchHandle(file){ | ||
3305 | + return new Promise((resolve, reject) => { | ||
3306 | + const files = file.raw; | ||
3307 | + const reader = new FileReader(); | ||
3308 | + reader.onload = (e) => { | ||
3309 | + try { | ||
3310 | + const data = new Uint8Array(e.target.result); | ||
3311 | + const workbook = XLSX.read(data, { type: 'array' }); | ||
3312 | + const worksheetName = '格式化打印'; // 指定工作表名称 | ||
3313 | + const worksheet = workbook.Sheets[worksheetName]; | ||
3314 | + if (worksheet) { | ||
3315 | + const AF1 = (worksheet['AF1'] && worksheet['AF1'].v) || ''; | ||
3316 | + const A16 = (worksheet['A16'] && worksheet['A16'].v) || ''; | ||
3317 | + const C16 = (worksheet['C16'] && worksheet['C16'].v) || ''; | ||
3318 | + const K16 = (worksheet['K16'] && worksheet['K16'].v) || ''; | ||
3319 | + const L16 = (worksheet['L16'] && worksheet['L16'].v) || ''; | ||
3320 | + const S16 = (worksheet['S16'] && worksheet['S16'].v) || ''; | ||
3321 | + const I18 = (worksheet['I18'] && worksheet['I18'].v) || ''; | ||
3322 | + const M18 = (worksheet['M18'] && worksheet['M18'].v) || ''; | ||
3323 | + const A20 = (worksheet['A20'] && worksheet['A20'].v) || ''; | ||
3324 | + const A22 = (worksheet['A22'] && worksheet['A22'].v) || ''; | ||
3325 | + const C22 = (worksheet['C22'] && worksheet['C22'].v) || ''; | ||
3326 | + const K22 = (worksheet['K22'] && worksheet['K22'].v) || ''; | ||
3327 | + const P22 = (worksheet['P22'] && worksheet['P22'].v) || ''; | ||
3328 | + const U22 = (worksheet['U22'] && worksheet['U22'].v) || ''; | ||
3329 | + const AF22 = (worksheet['AF22'] && worksheet['AF22'].v) || ''; | ||
3330 | + const AF23 = (worksheet['AF23'] && worksheet['AF23'].v) || ''; | ||
3331 | + const O34 = (worksheet['O34'] && worksheet['O34'].v) || ''; | ||
3332 | + //const O38 = (worksheet['O38'] && worksheet['O38'].v) || ''; | ||
3333 | + const X38 = (worksheet['X38'] && worksheet['X38'].v) || ''; | ||
3334 | + const AF38 = (worksheet['AF38'] && worksheet['AF38'].v) || ''; | ||
3335 | + //判定acc 中是否包含COU 特殊操作代码 | ||
3336 | + const S10 = (worksheet['S10'] && worksheet['S10'].v) || ''; | ||
3337 | + if (S10.includes("COU")){ | ||
3338 | + this.sphCodes += "COU" | ||
3339 | + } | ||
3340 | + | ||
3153 | const tempDate=this.NumberToDate(M18); | 3341 | const tempDate=this.NumberToDate(M18); |
3154 | const outFlightDate=tempDate.split('/')[2]; | 3342 | const outFlightDate=tempDate.split('/')[2]; |
3155 | const SSRInfo = A20.replace(/[^a-zA-Z0-9\s]/g, ''); | 3343 | const SSRInfo = A20.replace(/[^a-zA-Z0-9\s]/g, ''); |
3156 | //const signatureDate = parseCustomDate(O38); | 3344 | //const signatureDate = parseCustomDate(O38); |
3157 | const formattedAF23 = formatAF23(AF23); | 3345 | const formattedAF23 = formatAF23(AF23); |
3158 | 3346 | ||
3159 | - | ||
3160 | this.fileContent = { | 3347 | this.fileContent = { |
3161 | AF1: AF1, | 3348 | AF1: AF1, |
3162 | A16: A16, | 3349 | A16: A16, |
@@ -3180,7 +3367,7 @@ Handling Information | @@ -3180,7 +3367,7 @@ Handling Information | ||
3180 | X38: X38, | 3367 | X38: X38, |
3181 | AF38: cleanString(AF38), | 3368 | AF38: cleanString(AF38), |
3182 | }; | 3369 | }; |
3183 | - //this.convertAndCalculateVolume(); | 3370 | + |
3184 | this.form.bill.waybillNum=this.fileContent.AF1; | 3371 | this.form.bill.waybillNum=this.fileContent.AF1; |
3185 | this.form.cvd.cvd_currency_code=this.fileContent.S16; | 3372 | this.form.cvd.cvd_currency_code=this.fileContent.S16; |
3186 | this.form.rtg.destinationAirport=this.fileContent.A16; | 3373 | this.form.rtg.destinationAirport=this.fileContent.A16; |
@@ -3201,14 +3388,172 @@ Handling Information | @@ -3201,14 +3388,172 @@ Handling Information | ||
3201 | this.dimension_textarea=this.fileContent.AF23; | 3388 | this.dimension_textarea=this.fileContent.AF23; |
3202 | 3389 | ||
3203 | this.form.isu.isu_day_mounth_year=this.formattedDate(); | 3390 | this.form.isu.isu_day_mounth_year=this.formattedDate(); |
3391 | + | ||
3392 | + //尺寸处理 | ||
3393 | + this.convertAndCalculateVolumeTool(); | ||
3394 | + | ||
3395 | + | ||
3396 | + //发货人信息 | ||
3397 | + const A3_ShipInfo = (worksheet['A3'] && worksheet['A3'].v) || ''; | ||
3398 | + //收货人信息 | ||
3399 | + const A7_CNEInfo = (worksheet['A7'] && worksheet['A7'].v) || ''; | ||
3400 | + //收发货人处理 | ||
3401 | + const dify_para_ship = { | ||
3402 | + "inputs": { | ||
3403 | + "logisticsInformation": A3_ShipInfo | ||
3404 | + }, | ||
3405 | + "response_mode": "blocking", | ||
3406 | + "user": "C6" | ||
3407 | + } | ||
3408 | + const dify_api_token = 'app-1jFyrO64582meeymRG219FdK' | ||
3409 | + getInfo(dify_para_ship, dify_api_token) | ||
3410 | + .then(response => { | ||
3411 | + let response_data = response.data; | ||
3412 | + let CompletionResponse = response_data.data; | ||
3413 | + // 获取dify 执行状态结果 | ||
3414 | + let excute_result = CompletionResponse.status; | ||
3415 | + | ||
3416 | + if ("succeeded" === excute_result) { | ||
3417 | + // 获取返回信息 | ||
3418 | + let result = CompletionResponse.outputs.text; | ||
3419 | + // 返回的json字符串转换成JSON对象,todo:后续对收发货人内容进行字符串过滤,或者在dify后端过滤 | ||
3420 | + let shipOrCneInfo = JSON.parse(result); | ||
3421 | + this.form.shp.shp_adr = shipOrCneInfo.address; | ||
3422 | + this.form.shp.shp_name = shipOrCneInfo.name; | ||
3423 | + this.form.shp.shp_country = shipOrCneInfo.country; | ||
3424 | + this.form.shp.shp_loc_place = shipOrCneInfo.city; | ||
3425 | + this.shp_contact.contact_number = shipOrCneInfo.phoneNum; | ||
3426 | + this.shp_oci.oci_csrc_info = shipOrCneInfo.enterpriseRegistrationCode; | ||
3427 | + | ||
3428 | + // 构建下一个请求参数 | ||
3429 | + const dify_para_cne = { | ||
3430 | + "inputs": { | ||
3431 | + "logisticsInformation": A7_CNEInfo | ||
3432 | + }, | ||
3433 | + "response_mode": "blocking", | ||
3434 | + "user": "C6" | ||
3435 | + }; | ||
3436 | + | ||
3437 | + // 返回下一个 API 调用的 Promise | ||
3438 | + return getInfo(dify_para_cne, dify_api_token); | ||
3439 | + } else { | ||
3440 | + throw new Error("人工智能助手执行错误"); | ||
3441 | + } | ||
3442 | + }) | ||
3443 | + .then(response => { | ||
3444 | + let response_data = response.data; | ||
3445 | + let CompletionResponse = response_data.data; | ||
3446 | + // 获取dify 执行状态结果 | ||
3447 | + let excute_result = CompletionResponse.status; | ||
3448 | + | ||
3449 | + if ("succeeded" === excute_result) { | ||
3450 | + // 获取返回信息 | ||
3451 | + let result = CompletionResponse.outputs.text; | ||
3452 | + // 返回的json字符串转换成JSON对象,todo:后续对收发货人内容进行字符串过滤,或者在dify后端过滤 | ||
3453 | + let cneInfo = JSON.parse(result); | ||
3454 | + this.form.cne.cne_adr = cneInfo.address; | ||
3455 | + this.form.cne.cne_name = cneInfo.name; | ||
3456 | + this.form.cne.cne_country = cneInfo.country; | ||
3457 | + this.form.cne.cne_loc_place = cneInfo.city; | ||
3458 | + this.cne_contact.contact_number = cneInfo.phoneNum; | ||
3459 | + this.cne_oci.oci_csrc_info = cneInfo.enterpriseRegistrationCode; | ||
3460 | + } else { | ||
3461 | + throw new Error("人工智能助手执行错误"); | ||
3462 | + } | ||
3463 | + | ||
3464 | + //主单提交 | ||
3465 | + this.addFwbWithSet(); | ||
3466 | + /*进行表单的预验证*/ | ||
3467 | + this.$refs.apply_formRef.validate(valid => { | ||
3468 | + // 未通过,表单预校验 | ||
3469 | + if (!valid) { | ||
3470 | + this.form.oci=[]; | ||
3471 | + throw new Error("表单未通过校验"); | ||
3472 | + } | ||
3473 | + }) | ||
3474 | + // return {data:{ success: true, code: '200',message:'testOK' }} | ||
3475 | + return fwb(this.form); | ||
3476 | + }) | ||
3477 | + .then(response=>{ | ||
3478 | + let res = response.data; | ||
3479 | + //添加调度记录信息,失败 | ||
3480 | + if (res.code === '200'){ | ||
3481 | + this.$message.success(res.msg); | ||
3482 | + // 返回成功结果 | ||
3483 | + resolve({ success: true, code: '200' }); | ||
3484 | + }else { | ||
3485 | + this.$message.error(res.msg); | ||
3486 | + throw new Error("后端报错"+res.msg); | ||
3204 | } | 3487 | } |
3488 | + }) | ||
3489 | + .catch(error => { | ||
3490 | + this.$message({ | ||
3491 | + type: 'error', | ||
3492 | + message: '接口访问报错' + error.message | ||
3493 | + }); | ||
3494 | + reject(error); | ||
3495 | + }); | ||
3205 | 3496 | ||
3206 | } else { | 3497 | } else { |
3207 | this.fileContent = { AF1: '工作表不存在' }; | 3498 | this.fileContent = { AF1: '工作表不存在' }; |
3208 | } | 3499 | } |
3500 | + }catch (error){ | ||
3501 | + reject(error); | ||
3502 | + } | ||
3503 | + }; | ||
3504 | + reader.onerror = (error) => { | ||
3505 | + reject(error); | ||
3209 | }; | 3506 | }; |
3210 | reader.readAsArrayBuffer(files); | 3507 | reader.readAsArrayBuffer(files); |
3211 | - this.convertAndCalculateVolume(); | 3508 | + }); // 返回 Promise |
3509 | + }, | ||
3510 | + async batchFileUpload(file,fileList){ | ||
3511 | + // alert(JSON.stringify(file)) | ||
3512 | + // alert(JSON.stringify(fileList)) | ||
3513 | + // alert(JSON.stringify(this.uploadFileList)) | ||
3514 | + let _this = this; | ||
3515 | + if (fileList && fileList.length === this.uploadFileList.length + 1){ | ||
3516 | + this.uploadFileList = fileList; | ||
3517 | + // 初始化进度 | ||
3518 | + this.uploadProgress = { | ||
3519 | + total: fileList.length, | ||
3520 | + processed: 0, | ||
3521 | + percent: 0, | ||
3522 | + currentFile: '' | ||
3523 | + }; | ||
3524 | + | ||
3525 | + for(const [index, item] of fileList.entries()){ | ||
3526 | + try { | ||
3527 | + // 更新当前处理文件名 | ||
3528 | + this.uploadProgress.currentFile = `正在处理第 ${index + 1} 个文件: ${item.name}`; | ||
3529 | + | ||
3530 | + const result = await this.fileBatchHandle(item);//等待异步结果 | ||
3531 | + _this.$message.success(JSON.stringify(result)); | ||
3532 | + if (result.code === '200'){ | ||
3533 | + item.done = true; | ||
3534 | + //文件处理状态 | ||
3535 | + }else{ | ||
3536 | + item.done = false; | ||
3537 | + _this.$message.error(item.name+ ' 发送报文失败:'); | ||
3538 | + } | ||
3539 | + this.batchFileListResult.push(item) | ||
3540 | + }catch (error){ | ||
3541 | + _this.$message.error(item.name+ ' 处理文件失败:',error); | ||
3542 | + item.done = false; | ||
3543 | + this.batchFileListResult.push(item); | ||
3544 | + }finally { | ||
3545 | + // 更新进度 | ||
3546 | + this.uploadProgress.processed += 1; | ||
3547 | + this.uploadProgress.percent = Math.round( | ||
3548 | + (this.uploadProgress.processed / this.uploadProgress.total) * 100 | ||
3549 | + ); | ||
3550 | + alert('总进度:'+this.uploadProgress.percent+'/当前已处理:'+this.uploadProgress.processed +"/总文件数量:"+ this.uploadProgress.total) | ||
3551 | + } | ||
3552 | + | ||
3553 | + // 清空当前处理文件名 | ||
3554 | + this.uploadProgress.currentFile = ''; | ||
3555 | + } | ||
3556 | + } | ||
3212 | }, | 3557 | }, |
3213 | formattedDate() { | 3558 | formattedDate() { |
3214 | // 格式化日期为 yyyy-MM-dd | 3559 | // 格式化日期为 yyyy-MM-dd |
@@ -3387,5 +3732,10 @@ Handling Information | @@ -3387,5 +3732,10 @@ Handling Information | ||
3387 | display: inline-block; | 3732 | display: inline-block; |
3388 | margin-left: 40px; | 3733 | margin-left: 40px; |
3389 | } | 3734 | } |
3735 | + .progress-text { | ||
3736 | + margin-top: 8px; | ||
3737 | + color: #666; | ||
3738 | + font-size: 14px; | ||
3739 | + } | ||
3390 | </style> | 3740 | </style> |
3391 | 3741 |
src/views/nav3/components/TodoList.vue
0 → 100644
1 | +<template> | ||
2 | + <section class="todoapp"> | ||
3 | + <!-- header --> | ||
4 | + <header class="header"> | ||
5 | + <input class="new-todo" autocomplete="off" placeholder="处理文件列表" @keyup.enter="addTodo"> | ||
6 | + </header> | ||
7 | + <!-- main section --> | ||
8 | + <section v-show="todos.length" class="main"> | ||
9 | + <input id="toggle-all" :checked="allChecked" class="toggle-all" type="checkbox" @change="toggleAll({ done: !allChecked })"> | ||
10 | + <label for="toggle-all" /> | ||
11 | + <ul class="todo-list"> | ||
12 | + <todo | ||
13 | + v-for="(todo, index) in filteredTodos" | ||
14 | + :key="index" | ||
15 | + :todo="todo" | ||
16 | + @toggleTodo="toggleTodo" | ||
17 | + @editTodo="editTodo" | ||
18 | + @deleteTodo="deleteTodo" | ||
19 | + /> | ||
20 | + </ul> | ||
21 | + </section> | ||
22 | + <!-- footer --> | ||
23 | + <footer v-show="todos.length" class="footer"> | ||
24 | + <span class="todo-count"> | ||
25 | + <strong>{{ remaining }}</strong> | ||
26 | + {{ remaining | pluralize('个文件') }} 处理失败 | ||
27 | + </span> | ||
28 | + <ul class="filters"> | ||
29 | + <li v-for="(val, key) in filters" :key="key"> | ||
30 | + <a :class="{ selected: visibility === key }" @click.prevent="visibility = key">{{ key | capitalize }}</a> | ||
31 | + </li> | ||
32 | + </ul> | ||
33 | + <!-- <button class="clear-completed" v-show="todos.length > remaining" @click="clearCompleted"> | ||
34 | + Clear completed | ||
35 | + </button> --> | ||
36 | + </footer> | ||
37 | + </section> | ||
38 | +</template> | ||
39 | + | ||
40 | +<script> | ||
41 | +import Todo from '@/views/dashboard/components/TodoList/Todo.vue' | ||
42 | + | ||
43 | +const STORAGE_KEY = 'todos' | ||
44 | +const filters = { | ||
45 | + all: todos => todos, | ||
46 | + active: todos => todos.filter(todo => !todo.done), | ||
47 | + completed: todos => todos.filter(todo => todo.done) | ||
48 | +} | ||
49 | +const defalutList = [ | ||
50 | + { text: '78406346432', done: false }, | ||
51 | + { text: '78406305165_JHJ42194', done: false }, | ||
52 | + { text: '78406347272', done: false }, | ||
53 | + { text: '78406346782_DIM896002168', done: true }, | ||
54 | + { text: 'vue', done: true }, | ||
55 | + { text: 'element-ui', done: true }, | ||
56 | + { text: 'axios', done: true }, | ||
57 | + { text: 'webpack', done: true } | ||
58 | +] | ||
59 | +export default { | ||
60 | + components: { Todo }, | ||
61 | + props: { | ||
62 | + uploadFileList: { | ||
63 | + type: Array, | ||
64 | + default: () => [] | ||
65 | + } | ||
66 | + }, | ||
67 | + filters: { | ||
68 | + pluralize: (n, w) => n === 1 ? w : w + ' ', | ||
69 | + capitalize: s => s.charAt(0).toUpperCase() + s.slice(1) | ||
70 | + }, | ||
71 | + data() { | ||
72 | + return { | ||
73 | + visibility: 'all', | ||
74 | + filters, | ||
75 | + // todos: JSON.parse(window.localStorage.getItem(STORAGE_KEY)) || defalutList | ||
76 | + todos: [], | ||
77 | + initialLoad: true | ||
78 | + } | ||
79 | + }, | ||
80 | + watch: { | ||
81 | + uploadFileList(newVal) { | ||
82 | + this.initialLoad = false; | ||
83 | + if (!this.initialLoad && newVal.length > this.todos.length) { | ||
84 | + const newItems = newVal.map(file => ({ | ||
85 | + text: file.name, | ||
86 | + done: file.done | ||
87 | + })); | ||
88 | + this.todos = newItems; | ||
89 | + } | ||
90 | + // this.$message.success('任务组件初始化成功'); | ||
91 | + } | ||
92 | + }, | ||
93 | + computed: { | ||
94 | + allChecked() { | ||
95 | + return this.todos.every(todo => todo.done) | ||
96 | + }, | ||
97 | + filteredTodos() { | ||
98 | + return filters[this.visibility](this.todos) | ||
99 | + }, | ||
100 | + remaining() { | ||
101 | + return this.todos.filter(todo => !todo.done).length | ||
102 | + } | ||
103 | + }, | ||
104 | + mounted:function () { | ||
105 | + }, | ||
106 | + methods: { | ||
107 | + setLocalStorage() { | ||
108 | + window.localStorage.setItem(STORAGE_KEY, JSON.stringify(this.todos)) | ||
109 | + }, | ||
110 | + addTodo(e) { | ||
111 | + const text = e.target.value | ||
112 | + if (text.trim()) { | ||
113 | + this.todos.push({ | ||
114 | + text, | ||
115 | + done: false | ||
116 | + }) | ||
117 | + this.setLocalStorage() | ||
118 | + } | ||
119 | + e.target.value = '' | ||
120 | + }, | ||
121 | + toggleTodo(val) { | ||
122 | + val.done = !val.done | ||
123 | + this.setLocalStorage() | ||
124 | + }, | ||
125 | + deleteTodo(todo) { | ||
126 | + this.todos.splice(this.todos.indexOf(todo), 1) | ||
127 | + this.setLocalStorage() | ||
128 | + }, | ||
129 | + editTodo({ todo, value }) { | ||
130 | + todo.text = value | ||
131 | + this.setLocalStorage() | ||
132 | + }, | ||
133 | + clearCompleted() { | ||
134 | + this.todos = this.todos.filter(todo => !todo.done) | ||
135 | + this.setLocalStorage() | ||
136 | + }, | ||
137 | + toggleAll({ done }) { | ||
138 | + this.todos.forEach(todo => { | ||
139 | + todo.done = done | ||
140 | + this.setLocalStorage() | ||
141 | + }) | ||
142 | + } | ||
143 | + } | ||
144 | +} | ||
145 | +</script> | ||
146 | + | ||
147 | +<style lang="scss"> | ||
148 | + @import '~@/views/dashboard/components/TodoList/index.scss'; | ||
149 | +</style> |
-
请 注册 或 登录 后发表评论