Commit 8f7575d3 authored by 邓春圆's avatar 邓春圆

Merge remote-tracking branch 'origin/dev' into dev

parents 53af9519 fea7e719
const fs = require('fs');
const root = "./src"
const savePath = "./src/i18n/languages/en_US.json"
let allFiles = []
const savePath = "./src/i18n/languages/en_US.json"
const crypto = require('crypto');
const https = require('https');
const querystring = require('querystring');
// 你的百度翻译API的App ID和密钥
const appId = "20230911001813245"
const appKey = "lJlOnktUO0pn8G_MZ10O"
const translateText = (text, fromLang = 'zh', toLang = 'en') => {
return new Promise((resolve, reject) => {
// 百度翻译API的接口地址
const apiUrl = "https://fanyi-api.baidu.com/api/trans/vip/translate";
// 构建请求参数
const params = {
q: text,
from: fromLang,
to: toLang,
appid: appId,
salt: Math.random().toString().slice(2),
sign: ''
};
// 生成签名
const signStr = appId + text + params.salt + appKey;
params.sign = require('crypto').createHash('md5').update(signStr).digest('hex');
// 发送HTTP POST请求
const options = {
hostname: 'fanyi-api.baidu.com',
port: 443,
path: '/api/trans/vip/translate',
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': querystring.stringify(params).length
}
};
const req = https.request(options, (res) => {
let data = '';
res.on('data', (chunk) => {
data += chunk;
});
res.on('end', () => {
console.log('翻译结果:', data);
resolve(JSON.parse(data).trans_result[0].dst)
});
});
req.on('error', (err) => {
console.error(err);
});
req.write(querystring.stringify(params));
req.end();
})
};
function getFiles(dir){
let files = fs.readdirSync(dir)
files.forEach(file => {
let path = dir + '/' + file
if(fs.lstatSync(path).isDirectory()){
getFiles(path)
}else allFiles.push(path)
})
let files = fs.readdirSync(dir)
files.forEach(file => {
let path = dir + '/' + file
if(fs.lstatSync(path).isDirectory()){
getFiles(path)
}else allFiles.push(path)
})
}
getFiles(root)
/* allFiles = [
'src/views/ecw/box/shippingSea/utils.js',
'src/components/bpmnProcessDesigner/package/designer/plugins/content-pad/contentPadProvider.js'
]
console.log(allFiles) */
let messages = new Set()
allFiles.forEach(file => {
let data = fs.readFileSync(file, {encoding: 'utf-8'})
let matched = data.matchAll(/\$t\([\'\"]{1}([^\"\']+)[\'\"]{1}/g)
let i = 0
for(let item of matched){
i ++
messages.add(item[1])
}
let data = fs.readFileSync(file, {encoding: 'utf-8'})
let matched = data.matchAll(/\$t\([\'\"]{1}([^\"\']+)[\'\"]{1}/g)
let i = 0
for(let item of matched){
i ++
messages.add(item[1])
}
})
let obj = require(savePath)
Array.from(messages).forEach(word => {
if(!obj[word])obj[word] = ""
if(!obj[word])obj[word] = ""
})
let autoTransCnt = 0
async function translate(obj){
// 对未翻译内容调用百度翻译进行翻译操作,有变量的不做处理
for(let text in obj){
if(obj[text] || text.includes('{'))continue
const textEn = await translateText(text)
console.log(`${text} => ${textEn}\n`)
obj[text] = textEn
autoTransCnt ++
// 账号请求频率限制1ps
await new Promise(resolve => setTimeout(resolve, 1000))
}
}
translate(obj).then(res => {
fs.writeFileSync(savePath, JSON.stringify(obj, null, 4))
console.log(messages)
console.warn(`本次共提取 ${messages.size} 个待翻译内容,保存于${savePath}`)
console.log(`已调用百度api自动翻译 ${autoTransCnt} 个内容\n`)
console.log("done!")
})
fs.writeFileSync(savePath, JSON.stringify(obj, null, 4))
console.log(messages)
console.warn(`本次共提取 ${messages.size} 个待翻译内容,保存于${savePath}`)
\ No newline at end of file
This diff is collapsed.
......@@ -12,7 +12,7 @@
</el-form-item> -->
<el-form-item :label="$t('实际二程起飞时间')" prop="actSecondTime" v-show="this.$attrs.shipmentObj.bookAirInfo.voyage">
<el-form-item v-if="dtRealHeadTimeFlag" :label="$t('实际二程起飞时间')" prop="actSecondTime">
<el-date-picker type="datetime" :placeholder="$t('请选择日期')" v-model="airArrivalInfo.actSecondTime" value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker>
</el-form-item>
<el-form-item :label="$t('预计到港时间')" prop="estTime">
......@@ -73,6 +73,7 @@ export default {
inspectionTimeArrival: this.getDictDatas(
this.DICT_TYPE.BOX_INSPECTION_TIME_ARRIVAL
)[0].value,
dtRealHeadTimeFlag: false
};
},
created() {
......@@ -84,6 +85,9 @@ export default {
"YYYY-MM-DD HH:mm:ss"
);
this.airArrivalInfo = oldData;
if(this.$attrs.shipmentObj['bookAirInfo'].voyage && this.$attrs.shipmentObj['bookAirInfo'].voyage == 2){
this.dtRealHeadTimeFlag = true
}
},
watch: {
// 实际二程起飞时间
......
......@@ -67,6 +67,14 @@ export default {
onSubmit(operateType) {
this.$refs["unloadingForm"].validate((valid) => {
if (valid) {
if (operateType === 2) {
const { keyName } = this.$attrs.currNode;
const ulStatus = this.$attrs.shipmentObj[keyName];
if (ulStatus !== 185) {
this.$message.error(this.$t("请先通过完成到仓审核"));
return;
}
}
unloadCreate({
...this.unloadingObj,
shipmentId: this.$attrs.shipmentObj.id,
......
......@@ -126,11 +126,11 @@
</div>
<!-- 操作 -->
<div v-if="!isUnderReview">
<el-button type="success" @click="onSubmit">{{$t('完成到仓')}}</el-button>
<el-button type="success" @click="onSubmit">{{$t('提交完成到仓审核')}}</el-button>
<el-button plain type="primary" @click="$emit('closeStart')">{{$t('返回')}}</el-button>
</div>
<div v-if="isUnderReview">
<el-button type="primary" @click="jumpReviewDetail">{{$t('卸柜审核中')}}</el-button>
<el-button type="primary" @click="jumpReviewDetail">{{$t('到仓审核中')}}</el-button>
<el-button plain type="primary" @click="canclAudit">{{$t('取消审核')}}</el-button>
<el-button plain type="primary" @click="$emit('closeStart')">{{$t('返回')}}</el-button>
</div>
......
......@@ -143,6 +143,12 @@ export default {
this.$message.error(this.$t("没有此操作的权限"));
return;
}
if(node.type == 'checkout'){
if(this.shipmentObj.airShipmentStatus != 175){
this.$message.error(this.$t("请先完成出货操作"));
return;
}
}
if (currIndex > this.currIndex) {
console.log(currIndex,this.currIndex)
this.$message.error(this.errorMsg);
......@@ -215,7 +221,7 @@ export default {
if ([186].includes(unStatus)) {
this.currentComponent = `reviewWidget`;
this.$set(this.dialogConfig, "width", "700px");
this.$set(this.dialogConfig, "title", this.$t("卸柜反审"));
this.$set(this.dialogConfig, "title", this.$t("到仓反审"));
}
break;
}
......
......@@ -58,9 +58,9 @@
<span class="ml-5">{{orderSummary.sumWeight}}kg</span>
<span class="ml-5" v-if="orderSummary.sumQuantity">{{orderSummary.sumQuantity}}{{$t('')}}</span>
</el-descriptions-item>
<el-descriptions-item :label="$t('是否重货')">
<el-descriptions-item :label="$t('是否重货/泡货')">
<!--1 普货 2 重货 3 泡货-->
<dict-tag :type="DICT_TYPE.ECW_YESNO" :value="orderSummary.orderType != 1 ? '1' : '0'"></dict-tag>
<dict-tag :type="DICT_TYPE.ORDER_TYPE" :value="orderSummary.orderType"></dict-tag>
</el-descriptions-item>
<el-descriptions-item :label="$t('原重货标准')" v-if="[1,2].indexOf(orderSummary.transportId) > -1">
{{orderSummary.orgWeightUnit}}KG/m³
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment