国际化不区分路由

This commit is contained in:
熊飞
2024-01-11 10:21:45 +08:00
parent 4421a1900e
commit 631f79e219
8 changed files with 322 additions and 31 deletions
+18 -16
View File
@@ -19,15 +19,15 @@
label="标签"
width="300">
</el-table-column>
<el-table-column
prop="Description"
label="路由"
show-overflow-tooltip
width="180">
<template slot-scope="scope">
{{scope.row.Description}}
</template>
</el-table-column>
<!-- <el-table-column-->
<!-- prop="Description"-->
<!-- label="路由"-->
<!-- show-overflow-tooltip-->
<!-- width="180">-->
<!-- <template slot-scope="scope">-->
<!-- {{scope.row.Description}}-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column
prop="Value"
label="英文">
@@ -71,13 +71,14 @@ export default {
this.$set(target, attr, e)
},
handleSave() {
console.log(this.tableData)
this.$confirm('确定修改当前页面国际化内容?').then(() => {
batchAddOrUpdateFrontInternationalization(this.tableData).then(res => {
var zhMessages = {}, enMessages = {}
this.tableData.forEach(v => {
zhMessages[v.Description + '_' + v.Code] = v.ValueCN
enMessages[v.Description + '_' + v.Code] = v.Value
// zhMessages[v.Description + '_' + v.Code] = v.ValueCN
// enMessages[v.Description + '_' + v.Code] = v.Value
zhMessages[v.Code] = v.ValueCN
enMessages[v.Code] = v.Value
})
i18n.mergeLocaleMessage('zh', zhMessages)
i18n.mergeLocaleMessage('en', enMessages)
@@ -91,13 +92,14 @@ export default {
this.drawer = true
let tableData = this.$tl.map(v => {
let a = {...v}
if (!a.Description) {
a.Description = this.$route.path
}
// if (!a.Description) {
// a.Description = this.$route.path
// }
return a
})
tableData = tableData.filter(v => {
return ~this.$path.indexOf(v.Description + '_' + v.Code)
// return ~this.$path.indexOf(v.Description + '_' + v.Code)
return ~this.$path.indexOf(v.Code)
})
this.tableData = Object.assign([], tableData)
console.log(this.tableData)
+11 -4
View File
@@ -167,8 +167,10 @@ async function VueInit () {
Vue.prototype.$tl = Internationalization.Result
let zhMessages = {}, enMessages = {}
Vue.prototype.$tl.forEach(v => {
zhMessages[v.Description + '_' + v.Code] = v.ValueCN
enMessages[v.Description + '_' + v.Code] = v.Value
// zhMessages[v.Description + '_' + v.Code] = v.ValueCN
// enMessages[v.Description + '_' + v.Code] = v.Value
zhMessages[v.Code] = v.ValueCN
enMessages[v.Code] = v.Value
})
i18n.mergeLocaleMessage('zh', zhMessages)
i18n.mergeLocaleMessage('en', enMessages)
@@ -238,8 +240,13 @@ async function VueInit () {
}
Vue.prototype.$path = []
var t = function (key) {
Vue.prototype.$path.push(Vue.prototype.toPath + '_' + key)
return i18n.t(Vue.prototype.toPath + '_' + key)
// if (![Vue.prototype.toPath + '_' + key].includes(Vue.prototype.$path)) {
if (![key].includes(Vue.prototype.$path)) {
// Vue.prototype.$path.push(Vue.prototype.toPath + '_' + key)
Vue.prototype.$path.push(key)
}
// return i18n.t(Vue.prototype.toPath + '_' + key)
return i18n.t(key)
}
Vue.prototype.$t = t
_vm = new Vue({
+4 -1
View File
@@ -1,4 +1,5 @@
const OSS = require('ali-oss')
import Minio from 'minio'
import Vue from 'vue'
const { GenerateSTS, GetObjectStoreToken } = require('../api/user.js')
import { getToken } from '@/utils/auth'
@@ -11,13 +12,15 @@ async function ossGenerateSTS() {
let res = await GetObjectStoreToken()
Vue.prototype.OSSclientConfig = { ...res.Result[res.Result.ObjectStoreUse] }
Vue.prototype.OSSclientConfig.basePath = Vue.prototype.OSSclientConfig.viewEndpoint
// let minioClient = new Minio.Client(Vue.prototype.OSSclientConfig);
switch (res.Result.ObjectStoreUse) {
case 'AliyunOSS':
Vue.prototype.OSSclientConfig.bucket = Vue.prototype.OSSclientConfig.bucketName
Vue.prototype.OSSclient = new OSS(Vue.prototype.OSSclientConfig)
break
case 'MinIO':
Vue.prototype.OSSclient = new OSS(Vue.prototype.OSSclientConfig)
let minioClient = new Minio.Client(Vue.prototype.OSSclientConfig);
// Vue.prototype.OSSclient = new OSS(Vue.prototype.OSSclientConfig)
break
}
return
+3 -3
View File
@@ -61,7 +61,7 @@
sortable="custom"
>
<template slot-scope="scope">
{{ dict.type.NoteType.find(v => {return v.raw.Code * 1 === scope.row.NoticeTypeEnum}) ? dict.type.NoteType.find(v => {return v.raw.Code * 1 === scope.row.NoticeTypeEnum}).label : '' }}
{{ $fd('NoteType', scope.row.NoticeTypeEnum) }}
</template>
</el-table-column>
@@ -80,7 +80,7 @@
>
<template slot-scope="scope">
<el-tag :type="scope.row.ActualNoticeStateEnum === 0 ? 'info' : scope.row.ActualNoticeStateEnum === 1 ? 'success' : 'error'">
{{ dict.type.NoticeState.find(v => {return v.raw.Code * 1 === scope.row.ActualNoticeStateEnum}) ? dict.type.NoticeState.find(v => {return v.raw.Code * 1 === scope.row.ActualNoticeStateEnum}).label : '' }}
{{ $fd('NoticeState', scope.row.ActualNoticeStateEnum) }}
</el-tag>
</template>
</el-table-column>
@@ -187,7 +187,7 @@ export default {
}).catch(() => { this.loading = false })
},
showDetail(row) {
var currentNoticeType = this.dict.type.NoteType.find(v => { return v.raw.Code * 1 === row.NoticeTypeEnum }) ? this.dict.type.NoteType.find(v => { return v.raw.Code * 1 === row.NoticeTypeEnum }).label : ''
var currentNoticeType = this.$fd('NoteType', row.NoticeTypeEnum)
if (row.IsRead || row.ActualNoticeStateEnum !== 1) {
this.$alert(row.NoticeContent, currentNoticeType, {
showConfirmButton: false
@@ -496,14 +496,22 @@
min-width="100"
:label="$t('trials:auditRecord:table:funcModule')"
show-overflow-tooltip
/>
>
<template slot-scope="scope">
{{$i18n.locale === 'zh' ? scope.row.ModuleTypeNameCN : scope.row.ModuleTypeName}}
</template>
</el-table-column>
<!-- 操作名 -->
<el-table-column
prop="Description"
min-width="140"
:label="$t('trials:auditRecord:table:operationName')"
show-overflow-tooltip
/>
>
<template slot-scope="scope">
{{$i18n.locale === 'zh' ? scope.row.DescriptionCN : scope.row.Description}}
</template>
</el-table-column>
<!-- 修改原因 -->
<el-table-column
prop="Reason"
@@ -1128,7 +1136,8 @@ export default {
GeneralId: n ? this.currentRow.GeneralId : null
})
// 查看关联操作
this.model_cfg2.title = `${this.$t('trials:auditRecord:title:viewRelationOperations')}--${this.currentRow.Description}`
this.model_cfg2.title = `${this.$t('trials:auditRecord:title:viewRelationOperations')}--${this.$i18n.locale === 'en' ? this.currentRow.Description : this.currentRow.DescriptionCN}`
this.loading = true
getInspectionList(searchData).then((res) => {
this.list2 = res.CurrentPageData
@@ -1155,7 +1164,7 @@ export default {
Value: row.SignText
})
}
this.model_cfg3.title = row.Description
this.model_cfg3.title = this.$i18n.locale === 'en' ? row.Description : row.DescriptionCN
this.model_cfg3.visible = true
})
},
@@ -1177,7 +1186,7 @@ export default {
Value: row.SignText
})
}
this.model_cfg.title = row.Description
this.model_cfg.title = this.$i18n.locale === 'en' ? row.Description : row.DescriptionCN
this.model_cfg.visible = true
})
},