This commit is contained in:
linfso 2024-07-18 21:24:03 +08:00
parent c4b64a8abe
commit 88af779cad
4 changed files with 104 additions and 40 deletions

View File

@ -579,6 +579,12 @@ export default {
immediate: true
},
},
beforeMount() {
window.addEventListener('keydown', this.keyDown)
},
beforeDestroy() {
window.removeEventListener('keydown', this.keyDown)
},
mounted() {
if(this.saveStorageName&&this.saveStorageName!=undefined&&this.saveStorageName!=''){
this.isNeedDbSaveTpl=true;
@ -602,16 +608,49 @@ export default {
return Math.random().toString(36).substring(3,10);
},
initKeyDown(){
// initKeyDown(){
// let that=this;
// document.addEventListener('keydown', function(e) {
// e = e||window.event;
// if(e.ctrlKey&&e.code=="KeyC"){
// that.handleCopySelect(e);
// return false;
// }
// });
// },
keyDown(e) {
let that=this;
document.addEventListener('keydown', function(e) {
e = e||window.event;
if(e.ctrlKey&&e.code=="KeyC"){
that.handleCopySelect(e);
return false;
if (e || window.e) {
const { key, target } = e
const deleteKeyArr = ['Backspace', 'Delete']
// 使用this.$el.querySelector('#efContainer')而不使用document.getElementById,是因为我们获取元素,尽量用this.$el去一级级获取,用document,单页面应用总会出些意外
// js的contains方法用来查看dom元素的包含关系-用来限定键盘事件只局限于当前dom范围内
const efContainerId = this.$el.querySelector('#'+this.tableId)
console.log("====>efContainerId==>",efContainerId);
if (e.ctrlKey&&e.code=="KeyC" && target.contains(efContainerId)) {
this.handleCopySelect(e)
}
});
// const efContainerId = this.$el.querySelector('#'+this.tableId)
// console.log("====>efContainerId==>",efContainerId);
// console.log("====>efContainerId==>",efContainerId);
// if(e.ctrlKey&&e.code=="KeyC"){
// that.handleCopySelect(e);
// return false;
// }
// if (deleteKeyArr.includes(key) && !this.delBtnDisabled && this.clickedBackSpace && target.contains(efContainerId)) {
// this.deleteElement()
// }
}
},
keyDownOld(e) {
if(e.ctrlKey && e.keyCode==13) { //用户点击了ctrl+enter触发
}
// this.textarea += '\n';
// }else { //用户点击了enter触发
// this.sendMessage();
},
onTplSelectInputBlur(e) {
if (e.target.value.trim()!== '') {
//e.target.value就是录入的内容
@ -1031,14 +1070,7 @@ export default {
}))
this.storageList = list
},
keyDown(e) {
if(e.ctrlKey && e.keyCode==13) { //用户点击了ctrl+enter触发
}
// this.textarea += '\n';
// }else { //用户点击了enter触发
// this.sendMessage();
},
// 根据缓存的数组进行渲染表格
updateTable() {
// 特殊类型

View File

@ -47,7 +47,7 @@
from:this.from,
to:this.to
};
getValidExchangeRate(this.queryParams).then(response => {
getValidExchangeRate(queryParams).then(response => {
this.value = response.data;
});
},

View File

@ -642,7 +642,6 @@
</el-table-column>
<el-table-column prop="realFee" :label="$t('实收')" align="center" width="50">
<template slot-scope="scope">
<el-input-number v-if="form.blSpecialQuote==1" v-model="scope.row.realFee" @input="(val)=>handleCalcFeeItem(scope.row)" size="mini" placeholder="" :min="0.00" :controls="false" :precision="2"></el-input-number>
<div v-else> {{scope.row.realFee}} </div>
</template>
@ -688,9 +687,16 @@
</el-col>
<el-col :span="24">
<el-form-item :label="$t('总运费')" prop="freight" label-width="70px">
<el-input-number v-if="form.calcFeeType == 3" :min="0.00" v-model="form.freight" placeholder="" :controls="false" :precision="2"> </el-input-number>
<el-input v-else v-model="form.freight" disabled placeholder="" > </el-input>
<el-input-number v-if="form.calcFeeType == 3" :min="0.00" v-model="form.freight" placeholder="" :controls="false" :precision="2">
<span slot="suffix">(CNY)</span>
</el-input-number>
<el-input v-else v-model="form.freight" disabled placeholder="" >
<span slot="suffix">(CNY)</span>
</el-input>
</el-form-item>
<!-- <el-form-item :label="$t('汇率')" prop="exchangeRate" label-width="70px">
<ExchangeRatePanel from="USD" to="CNY" v-model="exchangeRate"></ExchangeRatePanel>
</el-form-item> -->
<el-form-item :label="$t('费用备注')" prop="feeRemark" label-width="70px">
<el-input v-model="form.feeRemark" type="textarea" maxlength="150"
show-word-limit placeholder="" oninput="value=value.replace(/[\r|\n]/g,'')" >
@ -746,6 +752,8 @@ import { checkWaybillIsExists,getWaybillDetail,realSubmitOrder,calcWaybillFee,ca
import { parseTime } from "@/utils/custom";
import { debounce } from 'throttle-debounce'
import { getDestSite } from "@/api/emis/emisDestination";
import { getValidExchangeRate } from "@/api/emis/emisExchangeRate";
import DestinationPicker from '@/views/emis/EmisBaseTools/DestinationPicker.vue';
@ -783,6 +791,9 @@ import WarehouseInNoPicker from '@/views/emis/EmisBaseTools/WarehouseInNoPicker.
import PayeePicker from '@/views/emis/EmisBaseTools/PayeePicker.vue';
import SalemanPicker from '@/views/emis/EmisBaseTools/SalemanPicker.vue';
import ExchangeRatePanel from '@/views/emis/EmisBaseTools/ExchangeRatePanel.vue';
import TransProductCasPicker from '@/views/emis/EmisBaseTools/TransProductCasPicker.vue';
@ -829,6 +840,7 @@ components: {
ProvincePicker2,
CityPicker2,
DistrictPicker2,
ExchangeRatePanel
},
dicts: ['emis_qujian_fangshi','emis_declare_mode','emis_customs_clear',
'emis_tab_packing_type','emis_tab_dispatch_mode','emis_payment_type',
@ -836,6 +848,7 @@ dicts: ['emis_qujian_fangshi','emis_declare_mode','emis_customs_clear',
data() {
return {
activeNames:['1','2','3','4'],
exchangeRate:null,
billCode:null,
emisWaybillOptions: [],
addressType:null,
@ -1299,6 +1312,7 @@ methods: {
}).then(() => {
let newList = this.form.feeItems.filter(item => item.feeCode !== row.feeCode);
this.form.feeItems=newList;
this.handleCalcFeeItem();
}).catch(() => {
})
@ -1735,31 +1749,37 @@ methods: {
},
handleCalcFeeItem(row){
async handleCalcFeeItem(row){
console.log("===>handleCalcFeeItem==>",row);
if(row!=null){
if(row.calcExp){
let expr=row.calcExp;
expr=expr.replace("s",row.initialWeightFee);
expr=expr.replace("d",row.addWeightPrice);
expr=expr.replace("w",this.form.settlementWeight);
console.log("===>eval(expr):",eval(expr));
row.realFee=parseFloat(eval(expr)).toFixed(2);
console.log("===>row.calcExp==>expr==>row.realFee:",row.calcExp,expr,row.realFee);
}
}
let feeRemark="";
let totalFee=0;
if(this.form.feeItems&&this.form.feeItems.length>0){
this.form.feeItems.forEach(item=>{
totalFee=parseFloat(totalFee)+parseFloat(item.realFee);
console.log("===>totalFee==>:",totalFee);
});
let len=this.form.feeItems.length;
for(let i=0;i<len;i++){
let item=this.form.feeItems[i];
let newFee=item.realFee;
if(item.currency&&item.currency !='CNY'){
let res= await getValidExchangeRate({from:item.currency,to:'CNY'});
if(res.code==200){
newFee=newFee*parseFloat(res.data);
}
}
feeRemark= feeRemark+item.feeName+":" + newFee+",";
totalFee=parseFloat(totalFee)+parseFloat(newFee);
}
}
this.form.feeRemark=feeRemark;
this.form.freight = totalFee;
},
// 计算体积重量

View File

@ -642,7 +642,6 @@
</el-table-column>
<el-table-column prop="realFee" :label="$t('实收')" align="center" width="50">
<template slot-scope="scope">
<el-input-number v-if="form.blSpecialQuote==1" v-model="scope.row.realFee" @input="(val)=>handleCalcFeeItem(scope.row)" size="mini" placeholder="" :min="0.00" :controls="false" :precision="2"></el-input-number>
<div v-else> {{scope.row.realFee}} </div>
</template>
@ -695,9 +694,9 @@
<span slot="suffix">(CNY)</span>
</el-input>
</el-form-item>
<el-form-item :label="$t('汇率')" prop="exchangeRate" label-width="70px">
<!-- <el-form-item :label="$t('汇率')" prop="exchangeRate" label-width="70px">
<ExchangeRatePanel from="USD" to="CNY" v-model="exchangeRate"></ExchangeRatePanel>
</el-form-item>
</el-form-item> -->
<el-form-item :label="$t('费用备注')" prop="feeRemark" label-width="70px">
<el-input v-model="form.feeRemark" type="textarea" maxlength="150"
show-word-limit placeholder="" oninput="value=value.replace(/[\r|\n]/g,'')" >
@ -753,6 +752,8 @@ import { checkWaybillIsExists,getWaybillDetail,realSubmitOrder,calcWaybillFee,ca
import { parseTime } from "@/utils/custom";
import { debounce } from 'throttle-debounce'
import { getDestSite } from "@/api/emis/emisDestination";
import { getValidExchangeRate } from "@/api/emis/emisExchangeRate";
import DestinationPicker from '@/views/emis/EmisBaseTools/DestinationPicker.vue';
@ -847,6 +848,7 @@ dicts: ['emis_qujian_fangshi','emis_declare_mode','emis_customs_clear',
data() {
return {
activeNames:['1','2','3','4'],
exchangeRate:null,
billCode:null,
emisWaybillOptions: [],
addressType:null,
@ -1310,6 +1312,7 @@ methods: {
}).then(() => {
let newList = this.form.feeItems.filter(item => item.feeCode !== row.feeCode);
this.form.feeItems=newList;
this.handleCalcFeeItem();
}).catch(() => {
})
@ -1746,7 +1749,7 @@ methods: {
},
handleCalcFeeItem(row){
async handleCalcFeeItem(row){
if(row!=null){
if(row.calcExp){
@ -1754,20 +1757,29 @@ methods: {
expr=expr.replace("s",row.initialWeightFee);
expr=expr.replace("d",row.addWeightPrice);
expr=expr.replace("w",this.form.settlementWeight);
// console.log("===>eval(expr):",eval(expr));
row.realFee=parseFloat(eval(expr)).toFixed(2);
// console.log("===>row.calcExp==>expr==>row.realFee:",row.calcExp,expr,row.realFee);
}
}
let feeRemark="";
let totalFee=0;
if(this.form.feeItems&&this.form.feeItems.length>0){
this.form.feeItems.forEach(item=>{
totalFee=parseFloat(totalFee)+parseFloat(item.realFee);
});
let len=this.form.feeItems.length;
for(let i=0;i<len;i++){
let item=this.form.feeItems[i];
let newFee=item.realFee;
if(item.currency&&item.currency !='CNY'){
let res= await getValidExchangeRate({from:item.currency,to:'CNY'});
if(res.code==200){
newFee=newFee*parseFloat(res.data);
}
}
feeRemark= feeRemark+item.feeName+":" + newFee+",";
totalFee=parseFloat(totalFee)+parseFloat(newFee);
}
}
this.form.feeRemark=feeRemark;
this.form.freight = totalFee;
},
// 计算体积重量