fix: 修复高级搜索国际化bug
This commit is contained in:
parent
97bdb3f5e1
commit
4b83f68b6a
|
@ -1,10 +1,10 @@
|
|||
<template>
|
||||
<div>
|
||||
<div class="search-label">{{component.label}}:</div>
|
||||
<div class="search-label">{{$t(component.label)}}</div>
|
||||
|
||||
<el-select class="search-operator" v-model="operator" :placeholder="$t('commons.please_select')" size="small"
|
||||
@change="change" @input="input" v-bind="component.operator.props">
|
||||
<el-option v-for="o in operators" :key="o.value" :label="o.label" :value="o.value"/>
|
||||
<el-option v-for="o in operators" :key="o.value" :label="$t(o.label)" :value="o.value"/>
|
||||
</el-select>
|
||||
|
||||
<div class="search-content" v-if="showContent(operator)">
|
||||
|
@ -57,7 +57,7 @@
|
|||
<style scoped>
|
||||
.search-label {
|
||||
display: inline-block;
|
||||
width: 80px;
|
||||
width: 120px;
|
||||
box-sizing: border-box;
|
||||
padding-left: 5px;
|
||||
}
|
||||
|
@ -70,7 +70,7 @@
|
|||
.search-content {
|
||||
display: inline-block;
|
||||
padding: 0 5px 0 10px;
|
||||
width: calc(100% - 200px);
|
||||
width: calc(100% - 240px);
|
||||
min-width: 400px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
if (this.component.options.showLabel) {
|
||||
return this.component.options.showLabel(op);
|
||||
}
|
||||
return op.label;
|
||||
return this.$t(op.label);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ import MsTableSearchInput from "./MsTableSearchInput";
|
|||
import MsTableSearchDateTimePicker from "./MsTableSearchDateTimePicker";
|
||||
import MsTableSearchDatePicker from "./MsTableSearchDatePicker";
|
||||
import MsTableSearchSelect from "./MsTableSearchSelect";
|
||||
import i18n from "../../../../../i18n/i18n";
|
||||
import _ from "lodash"
|
||||
|
||||
export default {
|
||||
|
@ -11,47 +10,47 @@ export default {
|
|||
|
||||
export const OPERATORS = {
|
||||
LIKE: {
|
||||
label: i18n.t("commons.adv_search.operators.like"),
|
||||
label: "commons.adv_search.operators.like",
|
||||
value: "like"
|
||||
},
|
||||
NOT_LIKE: {
|
||||
label: i18n.t("commons.adv_search.operators.not_like"),
|
||||
label: "commons.adv_search.operators.not_like",
|
||||
value: "not like"
|
||||
},
|
||||
IN: {
|
||||
label: i18n.t("commons.adv_search.operators.in"),
|
||||
label: "commons.adv_search.operators.in",
|
||||
value: "in"
|
||||
},
|
||||
NOT_IN: {
|
||||
label: i18n.t("commons.adv_search.operators.not_in"),
|
||||
label: "commons.adv_search.operators.not_in",
|
||||
value: "not in"
|
||||
},
|
||||
GT: {
|
||||
label: i18n.t("commons.adv_search.operators.gt"),
|
||||
label: "commons.adv_search.operators.gt",
|
||||
value: "gt"
|
||||
},
|
||||
GE: {
|
||||
label: i18n.t("commons.adv_search.operators.ge"),
|
||||
label: "commons.adv_search.operators.ge",
|
||||
value: "ge"
|
||||
},
|
||||
LT: {
|
||||
label: i18n.t("commons.adv_search.operators.lt"),
|
||||
label: "commons.adv_search.operators.lt",
|
||||
value: "lt"
|
||||
},
|
||||
LE: {
|
||||
label: i18n.t("commons.adv_search.operators.le"),
|
||||
label: "commons.adv_search.operators.le",
|
||||
value: "le"
|
||||
},
|
||||
EQ: {
|
||||
label: i18n.t("commons.adv_search.operators.equals"),
|
||||
label: "commons.adv_search.operators.equals",
|
||||
value: "eq"
|
||||
},
|
||||
BETWEEN: {
|
||||
label: i18n.t("commons.adv_search.operators.between"),
|
||||
label: "commons.adv_search.operators.between",
|
||||
value: "between"
|
||||
},
|
||||
CURRENT_USER: {
|
||||
label: i18n.t("commons.adv_search.operators.current_user"),
|
||||
label: "commons.adv_search.operators.current_user",
|
||||
value: "current user"
|
||||
},
|
||||
}
|
||||
|
@ -59,7 +58,7 @@ export const OPERATORS = {
|
|||
export const NAME = {
|
||||
key: "name", // 返回结果Map的key
|
||||
name: 'MsTableSearchInput', // Vue控件名称
|
||||
label: i18n.t('commons.name'), // 显示名称
|
||||
label: 'commons.name', // 显示名称
|
||||
operator: { // 运算符设置
|
||||
value: OPERATORS.LIKE.value, // 如果未设置value初始值,则value初始值为options[0]
|
||||
options: [OPERATORS.LIKE, OPERATORS.NOT_LIKE] // 运算符候选项
|
||||
|
@ -69,7 +68,7 @@ export const NAME = {
|
|||
export const UPDATE_TIME = {
|
||||
key: "updateTime",
|
||||
name: 'MsTableSearchDateTimePicker',
|
||||
label: i18n.t('commons.update_time'),
|
||||
label: 'commons.update_time',
|
||||
operator: {
|
||||
options: [OPERATORS.BETWEEN, OPERATORS.GT, OPERATORS.GE, OPERATORS.LT, OPERATORS.LE, OPERATORS.EQ]
|
||||
},
|
||||
|
@ -77,7 +76,7 @@ export const UPDATE_TIME = {
|
|||
export const PROJECT_NAME = {
|
||||
key: "projectName",
|
||||
name: 'MsTableSearchInput',
|
||||
label: i18n.t('commons.adv_search.project'),
|
||||
label: 'commons.adv_search.project',
|
||||
operator: {
|
||||
options: [OPERATORS.LIKE, OPERATORS.NOT_LIKE]
|
||||
},
|
||||
|
@ -85,7 +84,7 @@ export const PROJECT_NAME = {
|
|||
export const TEST_NAME = {
|
||||
key: "testName",
|
||||
name: 'MsTableSearchInput',
|
||||
label: i18n.t('commons.adv_search.test'),
|
||||
label: 'commons.adv_search.test',
|
||||
operator: {
|
||||
options: [OPERATORS.LIKE, OPERATORS.NOT_LIKE]
|
||||
},
|
||||
|
@ -93,7 +92,7 @@ export const TEST_NAME = {
|
|||
export const CREATE_TIME = {
|
||||
key: "createTime",
|
||||
name: 'MsTableSearchDateTimePicker',
|
||||
label: i18n.t('commons.create_time'),
|
||||
label: 'commons.create_time',
|
||||
operator: {
|
||||
options: [OPERATORS.BETWEEN, OPERATORS.GT, OPERATORS.GE, OPERATORS.LT, OPERATORS.LE, OPERATORS.EQ]
|
||||
},
|
||||
|
@ -102,7 +101,7 @@ export const CREATE_TIME = {
|
|||
export const STATUS = {
|
||||
key: "status",
|
||||
name: 'MsTableSearchSelect',
|
||||
label: i18n.t('commons.status'),
|
||||
label: 'commons.status',
|
||||
operator: {
|
||||
options: [OPERATORS.IN, OPERATORS.NOT_IN]
|
||||
},
|
||||
|
@ -119,7 +118,7 @@ export const STATUS = {
|
|||
export const CREATOR = {
|
||||
key: "creator",
|
||||
name: 'MsTableSearchSelect',
|
||||
label: i18n.t('api_test.creator'),
|
||||
label: 'api_test.creator',
|
||||
operator: {
|
||||
options: [OPERATORS.IN, OPERATORS.NOT_IN, OPERATORS.CURRENT_USER],
|
||||
change: function (component, value) { // 运算符change事件
|
||||
|
@ -147,14 +146,14 @@ export const CREATOR = {
|
|||
export const TRIGGER_MODE = {
|
||||
key: "triggerMode",
|
||||
name: 'MsTableSearchSelect',
|
||||
label: i18n.t('commons.trigger_mode.name'),
|
||||
label: 'commons.trigger_mode.name',
|
||||
operator: {
|
||||
options: [OPERATORS.IN, OPERATORS.NOT_IN]
|
||||
},
|
||||
options: [
|
||||
{label: i18n.t("commons.trigger_mode.manual"), value: "MANUAL"},
|
||||
{label: i18n.t("commons.trigger_mode.schedule"), value: "SCHEDULE"},
|
||||
{label: i18n.t("commons.trigger_mode.api"), value: "API"}
|
||||
{label: "commons.trigger_mode.manual", value: "MANUAL"},
|
||||
{label: "commons.trigger_mode.schedule", value: "SCHEDULE"},
|
||||
{label: "commons.trigger_mode.api", value: "API"}
|
||||
],
|
||||
props: {
|
||||
multiple: true
|
||||
|
|
|
@ -104,12 +104,12 @@ export default {
|
|||
input_name: 'Please enter name',
|
||||
formatErr: 'Format Error',
|
||||
date: {
|
||||
select_date:'Select date',
|
||||
start_date:'Start date',
|
||||
end_date:'End date',
|
||||
select_date_time:'Select date and time',
|
||||
start_date_time:'Start date and time',
|
||||
end_date_time:'End date time',
|
||||
select_date: 'Select date',
|
||||
start_date: 'Start date',
|
||||
end_date: 'End date',
|
||||
select_date_time: 'Select date and time',
|
||||
start_date_time: 'Start date and time',
|
||||
end_date_time: 'End date time',
|
||||
range_separator: "To",
|
||||
},
|
||||
trigger_mode: {
|
||||
|
@ -119,25 +119,25 @@ export default {
|
|||
api: "API call"
|
||||
},
|
||||
adv_search: {
|
||||
title:'Advanced Search',
|
||||
combine:'Combined query',
|
||||
test: "Affiliated Test",
|
||||
project: "Affiliated Project",
|
||||
title: 'Advanced Search',
|
||||
combine: 'Combined query',
|
||||
test: "Test",
|
||||
project: "Project",
|
||||
search: "Query",
|
||||
and:'All',
|
||||
or:'any one',
|
||||
and: 'All',
|
||||
or: 'any one',
|
||||
operators: {
|
||||
like: "Contains",
|
||||
not_like: "Not included",
|
||||
in: "Belong to",
|
||||
not_in: "Not belonging",
|
||||
gt: "Greater than",
|
||||
ge: "Greater than or equal to",
|
||||
lt: "Less than",
|
||||
le: "Less than or equal to",
|
||||
equals: "Equal",
|
||||
gt: ">",
|
||||
ge: ">=",
|
||||
lt: "<",
|
||||
le: "<=",
|
||||
equals: "=",
|
||||
between: "Between",
|
||||
current_user: "current user"
|
||||
current_user: "Current user"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue