fix: 自定义字段国际化

This commit is contained in:
chenjianxing 2021-12-17 18:43:37 +08:00 committed by BugKing
parent 6eb1af2f06
commit 23ab8ff8a6
8 changed files with 57 additions and 33 deletions

View File

@ -7,7 +7,7 @@
<el-input v-model="form.name" autocomplete="off"></el-input> <el-input v-model="form.name" autocomplete="off"></el-input>
</el-form-item> </el-form-item>
<el-form-item v-if="platformOptions.length > 1" :label-width="labelWidth" :label="$t('集成第三方平台')" prop="platform"> <el-form-item v-if="platformOptions.length > 1" :label-width="labelWidth" :label="$t('test_track.issue.third_party_integrated')" prop="platform">
<el-select filterable v-model="form.platform"> <el-select filterable v-model="form.platform">
<el-option v-for="item in platformOptions" :key="item.value" :label="item.text" :value="item.value"> <el-option v-for="item in platformOptions" :key="item.value" :label="item.text" :value="item.value">
</el-option> </el-option>
@ -18,7 +18,7 @@
<template-select :data="form" scene="API_CASE" prop="caseTemplateId" ref="caseTemplate"/> <template-select :data="form" scene="API_CASE" prop="caseTemplateId" ref="caseTemplate"/>
</el-form-item> </el-form-item>
<el-form-item v-if="xpackEable && form.platform === 'Jira'" :label-width="labelWidth" :label="$t('使用第三方平台模板')" prop="scenarioCustomNum"> <el-form-item v-if="xpackEable && form.platform === 'Jira'" :label-width="labelWidth" :label="$t('test_track.issue.use_third_party')" prop="scenarioCustomNum">
<el-switch v-model="form.thirdPartTemplate"></el-switch> <el-switch v-model="form.thirdPartTemplate"></el-switch>
</el-form-item> </el-form-item>
@ -147,7 +147,7 @@ export default {
// issueTemplateId: [{required: true}], // issueTemplateId: [{required: true}],
}, },
screenHeight: 'calc(100vh - 195px)', screenHeight: 'calc(100vh - 195px)',
labelWidth: '150px', labelWidth: '210px',
platformOptions: [], platformOptions: [],
xpackEable: false xpackEable: false
}; };

View File

@ -4,7 +4,7 @@
<template v-slot:header> <template v-slot:header>
<ms-table-header :create-permission="['WORKSPACE_PROJECT_MANAGER:READ+CREATE']" :condition.sync="condition" <ms-table-header :create-permission="['WORKSPACE_PROJECT_MANAGER:READ+CREATE']" :condition.sync="condition"
@search="search" @create="create" @search="search" @create="create"
:create-tip="btnTips" :title="$t('commons.project')"> :create-tip="btnTips" :title="$t('project.manager')">
<template v-slot:button> <template v-slot:button>
<ms-table-button icon="el-icon-box" v-permission="['WORKSPACE_PROJECT_MANAGER:READ+UPLOAD_JAR']" <ms-table-button icon="el-icon-box" v-permission="['WORKSPACE_PROJECT_MANAGER:READ+UPLOAD_JAR']"
:content="$t('api_test.jar_config.title')" @click="openJarConfig"/> :content="$t('api_test.jar_config.title')" @click="openJarConfig"/>

View File

@ -7,7 +7,7 @@
append-to-body append-to-body
ref="msEditDialog"> ref="msEditDialog">
<el-form :model="form" :rules="rules" label-position="right" label-width="auto" size="small" ref="form"> <el-form :model="form" :rules="rules" label-position="right" size="small" ref="form">
<el-form-item :label="$t('custom_field.field_name')" prop="name" :label-width="labelWidth"> <el-form-item :label="$t('custom_field.field_name')" prop="name" :label-width="labelWidth">
<el-input v-if="isSystem" :disabled="isSystem" :value="$t(systemNameMap[form.name])" autocomplete="off"></el-input> <el-input v-if="isSystem" :disabled="isSystem" :value="$t(systemNameMap[form.name])" autocomplete="off"></el-input>
<el-input v-else v-model="form.name" autocomplete="off"></el-input> <el-input v-else v-model="form.name" autocomplete="off"></el-input>
@ -22,7 +22,7 @@
<el-option <el-option
v-for="item in (form.scene === 'PLAN' ? planSceneOptions : sceneOptions)" v-for="item in (form.scene === 'PLAN' ? planSceneOptions : sceneOptions)"
:key="item.value" :key="item.value"
:label="item.text" :label="$t(item.text)"
:value="item.value"> :value="item.value">
</el-option> </el-option>
</el-select> </el-select>
@ -33,7 +33,7 @@
<el-option <el-option
v-for="item in fieldTypeOptions" v-for="item in fieldTypeOptions"
:key="item.value" :key="item.value"
:label="item.text" :label="$t(item.text)"
:value="item.value"> :value="item.value">
</el-option> </el-option>
</el-select> </el-select>
@ -63,7 +63,15 @@ import i18n from "@/i18n/i18n";
export default { export default {
name: "CustomFieldEdit", name: "CustomFieldEdit",
components: {MsSingleHandleDrag, MsEditDialog}, components: {MsSingleHandleDrag, MsEditDialog},
props: ['scene','labelWidth'], props: {
scene: String,
labelWidth: {
Object: String,
default() {
return '100px';
}
}
},
data() { data() {
return { return {
form: { form: {

View File

@ -120,7 +120,7 @@
<script> <script>
import MsTable from "@/business/components/common/components/table/MsTable"; import MsTable from "@/business/components/common/components/table/MsTable";
import {getCurrentWorkspaceId, getDefaultTableHeight} from "@/common/js/utils"; import {getCurrentWorkspaceId, getDefaultTableHeight, getTranslateOptions} from "@/common/js/utils";
import MsTableColumn from "@/business/components/common/components/table/MsTableColumn"; import MsTableColumn from "@/business/components/common/components/table/MsTableColumn";
import MsTableOperators from "@/business/components/common/components/MsTableOperators"; import MsTableOperators from "@/business/components/common/components/MsTableOperators";
import MsTableButton from "@/business/components/common/components/MsTableButton"; import MsTableButton from "@/business/components/common/components/MsTableButton";
@ -168,18 +168,16 @@ export default {
isDisable: this.systemDisable isDisable: this.systemDisable
} }
], ],
fieldFilters: [],
sceneFilters: [],
}; };
}, },
activated() { activated() {
this.getCustomFields(); this.getCustomFields();
this.fieldFilters = getTranslateOptions(CUSTOM_FIELD_TYPE_OPTION);
this.sceneFilters = getTranslateOptions(CUSTOM_FIELD_SCENE_OPTION);
}, },
computed: { computed: {
fieldFilters() {
return CUSTOM_FIELD_TYPE_OPTION;
},
sceneFilters() {
return CUSTOM_FIELD_SCENE_OPTION;
},
fieldTypeMap() { fieldTypeMap() {
return FIELD_TYPE_MAP; return FIELD_TYPE_MAP;
}, },

View File

@ -3,25 +3,25 @@ import i18n from "@/i18n/i18n";
import {AZURE_DEVOPS, JIRA, LOCAL, TAPD, ZEN_TAO} from "@/common/js/constants"; import {AZURE_DEVOPS, JIRA, LOCAL, TAPD, ZEN_TAO} from "@/common/js/constants";
export const CUSTOM_FIELD_TYPE_OPTION = [ export const CUSTOM_FIELD_TYPE_OPTION = [
{value: 'input',text: i18n.t('workspace.custom_filed.input')}, {value: 'input',text: 'workspace.custom_filed.input'},
{value: 'textarea',text: i18n.t('workspace.custom_filed.textarea')}, {value: 'textarea',text: 'workspace.custom_filed.textarea'},
{value: 'select',text: i18n.t('workspace.custom_filed.select')}, {value: 'select',text: 'workspace.custom_filed.select'},
{value: 'multipleSelect',text: i18n.t('workspace.custom_filed.multipleSelect')}, {value: 'multipleSelect',text: 'workspace.custom_filed.multipleSelect'},
{value: 'radio',text: i18n.t('workspace.custom_filed.radio')}, {value: 'radio',text: 'workspace.custom_filed.radio'},
{value: 'checkbox',text: i18n.t('workspace.custom_filed.checkbox')}, {value: 'checkbox',text: 'workspace.custom_filed.checkbox'},
{value: 'member',text: i18n.t('workspace.custom_filed.member')}, {value: 'member',text: 'workspace.custom_filed.member'},
{value: 'multipleMember',text: i18n.t('workspace.custom_filed.multipleMember')}, {value: 'multipleMember',text: 'workspace.custom_filed.multipleMember'},
{value: 'date',text: i18n.t('workspace.custom_filed.date')}, {value: 'date',text: 'workspace.custom_filed.date'},
{value: 'datetime',text: i18n.t('workspace.custom_filed.datetime')}, {value: 'datetime',text: 'workspace.custom_filed.datetime'},
{value: 'richText',text: i18n.t('workspace.custom_filed.richText')}, {value: 'richText',text: 'workspace.custom_filed.richText'},
{value: 'int',text: i18n.t('workspace.custom_filed.int')}, {value: 'int',text: 'workspace.custom_filed.int'},
{value: 'float',text: i18n.t('workspace.custom_filed.float')}, {value: 'float',text: 'workspace.custom_filed.float'},
{value: 'multipleInput',text: i18n.t('workspace.custom_filed.multipleInput')} {value: 'multipleInput',text: 'workspace.custom_filed.multipleInput'}
]; ];
export const CUSTOM_FIELD_SCENE_OPTION = [ export const CUSTOM_FIELD_SCENE_OPTION = [
{value: 'TEST_CASE',text: i18n.t('workspace.case_template_manage')}, {value: 'TEST_CASE',text: 'workspace.case_template_manage'},
{value: 'ISSUE',text: i18n.t('workspace.issue_template_manage')}, {value: 'ISSUE',text: 'workspace.issue_template_manage'},
]; ];
export const CASE_TYPE_OPTION = [ export const CASE_TYPE_OPTION = [

View File

@ -18,6 +18,8 @@ import {
import axios from "axios"; import axios from "axios";
import {jsPDF} from "jspdf"; import {jsPDF} from "jspdf";
import JSEncrypt from 'jsencrypt'; import JSEncrypt from 'jsencrypt';
import {CUSTOM_FIELD_TYPE_OPTION} from "@/common/js/table-constants";
import i18n from "@/i18n/i18n";
export function hasRole(role) { export function hasRole(role) {
let user = getCurrentUser(); let user = getCurrentUser();
@ -503,3 +505,14 @@ export function setCurTabId(vueObj, tab, ref) {
} }
}) })
} }
export function getTranslateOptions(data) {
let options = [];
data.forEach(i => {
let option = {};
Object.assign(option, i)
option.text = i18n.t(option.text);
options.push(option);
});
return options;
}

View File

@ -626,6 +626,7 @@ export default {
successful_operation: 'Successful operation', successful_operation: 'Successful operation',
not_integrated: 'The platform is not integrated', not_integrated: 'The platform is not integrated',
choose_platform: 'Please choose an integrated platform', choose_platform: 'Please choose an integrated platform',
verified: "verified",
azure_issuetype: 'Azure issue type', azure_issuetype: 'Azure issue type',
azure_storytype: 'Azure story type', azure_storytype: 'Azure story type',
input_azure_issuetype: 'Please enter the issue type', input_azure_issuetype: 'Please enter the issue type',
@ -664,10 +665,10 @@ export default {
azureDevops_filter_id: 'AzureDevops Filter ID', azureDevops_filter_id: 'AzureDevops Filter ID',
azureDevops_info: 'AzureDevops Information', azureDevops_info: 'AzureDevops Information',
azureDevops_tip: 'This information is the user token information for submitting defects through Azure Devops. If not filled in, the default information configured in the workspace will be used', azureDevops_tip: 'This information is the user token information for submitting defects through Azure Devops. If not filled in, the default information configured in the workspace will be used',
manager: 'Manager', manager: 'Project Manager',
no_data: 'No Data', no_data: 'No Data',
select: 'Select', select: 'Select',
repeatable: 'Interface definition URL repeatable', repeatable: 'API URL Repeatable',
repeatable_info: 'After enabling, the interface definition repeatability check will not check the URL', repeatable_info: 'After enabling, the interface definition repeatability check will not check the URL',
case_public: 'Public Library', case_public: 'Public Library',
public: 'Start Public Library', public: 'Start Public Library',
@ -2175,6 +2176,8 @@ export default {
tapd_current_owner: "Tapd Current Owner", tapd_current_owner: "Tapd Current Owner",
zentao_bug_build: "Zentao Impact version", zentao_bug_build: "Zentao Impact version",
zentao_bug_assigned: "Zentao handler", zentao_bug_assigned: "Zentao handler",
third_party_integrated: "Third-party Platform Integrated",
use_third_party: "Enable Jira Issue Template",
update_third_party_bugs: "Update the defects of third-party platforms", update_third_party_bugs: "Update the defects of third-party platforms",
sync_bugs: "Synchronization Issue" sync_bugs: "Synchronization Issue"
}, },

View File

@ -2181,6 +2181,8 @@ export default {
tapd_current_owner: "Tapd 处理人", tapd_current_owner: "Tapd 处理人",
zentao_bug_build: "禅道 影响版本", zentao_bug_build: "禅道 影响版本",
zentao_bug_assigned: "禅道 处理人", zentao_bug_assigned: "禅道 处理人",
third_party_integrated: "集成第三方平台",
use_third_party: "使用第 Jira 缺陷模板",
update_third_party_bugs: "更新第三方平台的缺陷", update_third_party_bugs: "更新第三方平台的缺陷",
sync_bugs: "同步缺陷" sync_bugs: "同步缺陷"
}, },