refactor(接口定义): 规范JSON控件的i18n
This commit is contained in:
parent
4fb1a6319a
commit
02c99498e7
|
@ -1,13 +1,13 @@
|
|||
<template>
|
||||
<div id="app" v-loading="loading">
|
||||
<el-tabs v-model="activeName" @tab-click="handleClick">
|
||||
<el-tab-pane label="模版" name="apiTemplate">
|
||||
<el-tab-pane :label="$t('organization.message.template')" name="apiTemplate">
|
||||
<el-button type="primary" size="mini" style="margin-left: 10px" @click="openOneClickOperation">导入</el-button>
|
||||
<div style="min-height: 400px">
|
||||
<json-schema-editor class="schema" :value="schema" lang="zh_CN" custom/>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="预览" name="preview">
|
||||
<el-tab-pane :label="$t('schema.preview')" name="preview">
|
||||
<div style="min-height: 400px">
|
||||
<pre>{{this.preview}}</pre>
|
||||
</div>
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
<span v-else style="width:10px;display:inline-block"></span>
|
||||
<input class="el-input el-input__inner" style="height: 32px" :disabled="disabled || root" :value="pickKey" @blur="onInputName" size="small"/>
|
||||
</div>
|
||||
<el-tooltip v-if="root" content="全选">
|
||||
<el-tooltip v-if="root" :content="$t('schema.checked_all')" placement="top">
|
||||
<input type="checkbox" :disabled="!isObject && !isArray" class="ant-col-name-required" @change="onRootCheck"/>
|
||||
</el-tooltip>
|
||||
<el-tooltip v-else content="是否必填">
|
||||
<el-tooltip v-else :content="$t('schema.required')" placement="top">
|
||||
<input type="checkbox" :disabled="isItem" :checked="checked" class="ant-col-name-required" @change="onCheck"/>
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
|
@ -24,16 +24,16 @@
|
|||
<ms-mock :disabled="pickValue.type==='object'" :schema="pickValue"/>
|
||||
</el-col>
|
||||
<el-col>
|
||||
<el-input v-model="pickValue.description" class="ant-col-title" :placeholder="local['description']" size="small"/>
|
||||
<el-input v-model="pickValue.description" class="ant-col-title" :placeholder="$t('schema.description')" size="small"/>
|
||||
</el-col>
|
||||
<el-col :span="5" class="col-item-setting">
|
||||
<el-tooltip class="item" effect="dark" content="高级设置" placement="top">
|
||||
<el-tooltip class="item" effect="dark" :content="$t('schema.adv_setting')" placement="top">
|
||||
<i class="el-icon-setting" @click="onSetting"/>
|
||||
</el-tooltip>
|
||||
<el-tooltip v-if="isObject" content="添加子节点" placement="top">
|
||||
<el-tooltip v-if="isObject" :content="$t('schema.add_child_node')" placement="top">
|
||||
<i class="el-icon-plus" @click="addChild" style="margin-left: 10px"/>
|
||||
</el-tooltip>
|
||||
<el-tooltip v-if="!root && !isItem" content="删除节点" placement="top">
|
||||
<el-tooltip v-if="!root && !isItem" :content="$t('schema.remove_node')" placement="top">
|
||||
<i class="el-icon-close" @click="removeNode" style="margin-left: 10px"/>
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
|
@ -46,21 +46,21 @@
|
|||
<json-schema-editor :value="{items:pickValue.items}" :deep="deep+1" disabled isItem :root="false" class="children" :lang="lang" :custom="custom"/>
|
||||
</template>
|
||||
<!-- 高级设置-->
|
||||
<el-dialog :close-on-click-modal="false" :title="local['adv_setting']" :visible.sync="modalVisible" :destroy-on-close="true"
|
||||
<el-dialog :close-on-click-modal="false" :title="$t('schema.adv_setting')" :visible.sync="modalVisible" :destroy-on-close="true"
|
||||
@close="handleClose">
|
||||
<p class="tip">基础设置 </p>
|
||||
<el-form :inline="true" v-model="advancedValue" class="ant-advanced-search-form">
|
||||
<el-row :gutter="6">
|
||||
<el-col :span="8" v-for="(item,key) in advancedValue" :key="key" style="float: right">
|
||||
<el-form-item>
|
||||
<div>{{ local[key] }}</div>
|
||||
<div>{{ $t('schema.'+key)}}</div>
|
||||
<el-input-number v-model="advancedValue[key]" v-if="advancedAttr[key].type === 'integer'" style="width:100%" :placeholder="key" size="small"/>
|
||||
<el-input-number v-model="advancedValue[key]" v-else-if="advancedAttr[key].type === 'number'" style="width:100%" :placeholder="key" size="small"/>
|
||||
<span v-else-if="advancedAttr[key].type === 'boolean'" style="display:inline-block;width:100%">
|
||||
<el-switch v-model="advancedValue[key]"/>
|
||||
</span>
|
||||
<el-select v-else-if="advancedAttr[key].type === 'array'" v-model="advancedValue[key]" style="width:100%" size="small">
|
||||
<el-option value="" :label="local['nothing']"></el-option>
|
||||
<el-option value="" :label="$t('schema.nothing')"></el-option>
|
||||
<el-option :key="t" :value="t" :label="t" v-for="t in advancedAttr[key].enums"/>
|
||||
</el-select>
|
||||
<el-input v-model="advancedValue[key]" v-else style="width:100%;" :placeholder="key" size="small"/>
|
||||
|
@ -68,7 +68,7 @@
|
|||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<!--<h3 v-text="local['add_custom']" v-show="custom">添加自定义属性</h3>
|
||||
<!--<h3 v-text="$t('schema.add_custom')" v-show="custom">添加自定义属性</h3>
|
||||
<el-form class="ant-advanced-search-form" v-show="custom">
|
||||
<el-row :gutter="6">
|
||||
<el-col :span="8" v-for="item in customProps" :key="item.key">
|
||||
|
@ -86,14 +86,14 @@
|
|||
<el-col :span="8">
|
||||
<el-form-item>
|
||||
<el-button icon="check" type="link" @click="confirmAddCustomNode" v-if="customing"/>
|
||||
<el-tooltip content="local['add_custom']" v-else>
|
||||
<el-tooltip content="$t('schema.add_custom')" v-else>
|
||||
<el-button icon="el-icon-plus" type="link" @click="addCustomNode"/>
|
||||
</el-tooltip>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>-->
|
||||
<p class="tip">预览 </p>
|
||||
<p class="tip">{{$t('schema.preview')}} </p>
|
||||
<pre style="width:100%">{{completeNodeValue}}</pre>
|
||||
|
||||
<span slot="footer" class="dialog-footer">
|
||||
|
@ -107,9 +107,8 @@
|
|||
<script>
|
||||
import {isNull} from './util'
|
||||
import {TYPE_NAME, TYPE} from './type/type'
|
||||
import MsMock from './mock/index'
|
||||
import MsMock from './mock/MockComplete'
|
||||
import MsDialogFooter from '../../../components/MsDialogFooter'
|
||||
import LocalProvider from './provider/index'
|
||||
import {getUUID} from "@/common/js/utils";
|
||||
|
||||
export default {
|
||||
|
@ -199,8 +198,7 @@
|
|||
advancedValue: {},
|
||||
addProp: {},// 自定义属性
|
||||
customProps: [],
|
||||
customing: false,
|
||||
local: LocalProvider(this.lang)
|
||||
customing: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
|
|
@ -82,7 +82,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import {calculate} from "./Calculate";
|
||||
import {calculate} from "./calculate";
|
||||
import {JMETER_FUNC, MOCKJS_FUNC} from "@/common/js/constants";
|
||||
|
||||
export default {
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
|
||||
<ms-advance ref="variableAdvance" :current-item="mock"/>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
@ -67,8 +66,6 @@
|
|||
advanced() {
|
||||
this.$refs.variableAdvance.open();
|
||||
},
|
||||
|
||||
|
||||
showEdit() {
|
||||
this.$emit('showEdit')
|
||||
},
|
|
@ -1,90 +0,0 @@
|
|||
const langs = {
|
||||
en_US: {
|
||||
'title': 'Title',
|
||||
'import_json': 'Import JSON',
|
||||
'base_setting': 'Base Setting',
|
||||
'all_setting': 'Source Code',
|
||||
'default': 'Default',
|
||||
'description':'Description',
|
||||
"adv_setting": "Advanced Settings",
|
||||
"add_child_node": "Add child node",
|
||||
'add_sibling_node': 'Add sibling nodes',
|
||||
'add_node':'Add sibling/child nodes',
|
||||
'remove_node': 'Remove node',
|
||||
'child_node': 'Child node',
|
||||
'sibling_node':'Sibling node',
|
||||
'ok':'OK',
|
||||
'cancel':'Cancel',
|
||||
'minLength':'Min length',
|
||||
'maxLength': 'Max length',
|
||||
'pattern':'MUST be a valid regular expression.',
|
||||
'exclusiveMinimum': 'Value strictly less than',
|
||||
'exclusiveMaximum': 'Value strictly more than',
|
||||
'minimum': 'Min',
|
||||
'maximum': 'Max',
|
||||
'uniqueItems': 'Unique Items',
|
||||
'minItems':'MinItems',
|
||||
'maxItems': 'MaxItems',
|
||||
'minProperties':'MinProperties',
|
||||
'maxProperties': 'MaxProperties',
|
||||
'checked_all': 'Checked All',
|
||||
'valid_json': 'Not valid json',
|
||||
'enum': 'Enum',
|
||||
'enum_msg': 'One value per line',
|
||||
'enum_desc': 'desc',
|
||||
'enum_desc_msg': 'enum description',
|
||||
'required': 'Required',
|
||||
'mock': 'mock',
|
||||
'mockLink': 'Help',
|
||||
'format': 'Format',
|
||||
'nothing': 'Nothing',
|
||||
'preview': 'Preview',
|
||||
'add_custom': 'Add Custom Prop',
|
||||
},
|
||||
zh_CN: {
|
||||
'title': '标题',
|
||||
'import_json': '导入 json',
|
||||
'base_setting': '基础设置',
|
||||
'all_setting': '编辑源码',
|
||||
'default': '默认值',
|
||||
'description':'描述',
|
||||
'adv_setting': '高级设置',
|
||||
"add_child_node": "添加子节点",
|
||||
'add_sibling_node': '添加兄弟节点',
|
||||
'add_node':'添加兄弟/子节点',
|
||||
'remove_node': '删除节点',
|
||||
'child_node': '子节点',
|
||||
'sibling_node':'兄弟节点',
|
||||
'ok':'确定',
|
||||
'cancel':'取消',
|
||||
'minLength':'最小长度',
|
||||
'maxLength': '最大长度',
|
||||
'pattern': '用正则表达式约束字符串',
|
||||
'exclusiveMinimum': '开启后,数据必须大于最小值',
|
||||
'exclusiveMaximum': '开启后,数据必须小于最大值',
|
||||
'minimum': '最小值',
|
||||
'maximum': '最大值',
|
||||
'uniqueItems': '开启后,每个元素都不相同',
|
||||
'minItems':'最小元素个数',
|
||||
'maxItems': '最大元素个数',
|
||||
'minProperties':'最小元素个数',
|
||||
'maxProperties': '最大元素个数',
|
||||
'checked_all': '全选',
|
||||
'valid_json': '不是合法的json字符串',
|
||||
'enum': '枚举',
|
||||
'enum_msg': '每行只能写一个值',
|
||||
'enum_desc': '备注',
|
||||
'enum_desc_msg': '备注描述信息',
|
||||
'required': '是否必须',
|
||||
'mock': 'mock',
|
||||
'mockLink': '查看文档',
|
||||
'format': '格式化',
|
||||
'nothing': '无',
|
||||
'preview': '预览',
|
||||
'add_custom': '添加自定义属性'
|
||||
}
|
||||
}
|
||||
|
||||
export default (lang) => {
|
||||
return langs[lang]
|
||||
}
|
|
@ -489,7 +489,7 @@ export default {
|
|||
file_exist: "The name already exists in the project",
|
||||
upload_limit_size: "Upload file size cannot exceed 30MB!",
|
||||
},
|
||||
batch_menus:{
|
||||
batch_menus: {
|
||||
select_all_data: "Select all datas({0})",
|
||||
select_show_data: "Select show datas({0})",
|
||||
},
|
||||
|
@ -505,9 +505,9 @@ export default {
|
|||
api_case_status: "Ise case status",
|
||||
api_case_passing_rate: "Use case pass rate",
|
||||
create_tip: "Note: Detailed interface information can be filled out on the edit page",
|
||||
select_comp:{
|
||||
no_data:"No Data",
|
||||
add_data:"Add Data"
|
||||
select_comp: {
|
||||
no_data: "No Data",
|
||||
add_data: "Add Data"
|
||||
},
|
||||
request: {
|
||||
grade_info: "Filter by rank",
|
||||
|
@ -1363,5 +1363,47 @@ export default {
|
|||
workspace_quota_list: "Workspace quota list of {0}",
|
||||
unlimited: "Unlimited",
|
||||
clean: "Clean"
|
||||
},
|
||||
schema: {
|
||||
title: "Title",
|
||||
import_json: "Import JSON",
|
||||
base_setting: "Base Setting",
|
||||
all_setting: "Source Code",
|
||||
default: "Default",
|
||||
description: "Description",
|
||||
"adv_setting": "Advanced Settings",
|
||||
"add_child_node": "Add child node",
|
||||
add_sibling_node: "Add sibling nodes",
|
||||
add_node: "Add sibling/child nodes",
|
||||
remove_node: "Remove node",
|
||||
child_node: "Child node",
|
||||
sibling_node: "Sibling node",
|
||||
ok: "OK",
|
||||
cancel: "Cancel",
|
||||
minLength: "Min length",
|
||||
maxLength: "Max length",
|
||||
pattern: "MUST be a valid regular expression.",
|
||||
exclusiveMinimum: "Value strictly less than",
|
||||
exclusiveMaximum: "Value strictly more than",
|
||||
minimum: "Min",
|
||||
maximum: "Max",
|
||||
uniqueItems: "Unique Items",
|
||||
minItems: "MinItems",
|
||||
maxItems: "MaxItems",
|
||||
minProperties: "MinProperties",
|
||||
maxProperties: "MaxProperties",
|
||||
checked_all: "Checked All",
|
||||
valid_json: "Not valid json",
|
||||
enum: "Enum",
|
||||
enum_msg: "One value per line",
|
||||
enum_desc: "desc",
|
||||
enum_desc_msg: "enum description",
|
||||
required: "Required",
|
||||
mock: "mock",
|
||||
mockLink: "Help",
|
||||
format: "Format",
|
||||
nothing: "Nothing",
|
||||
preview: "Preview",
|
||||
add_custom: "Add Custom Prop"
|
||||
}
|
||||
};
|
||||
|
|
|
@ -487,7 +487,7 @@ export default {
|
|||
file_exist: "该项目下已存在该jar包",
|
||||
upload_limit_size: "上传文件大小不能超过 30MB!",
|
||||
},
|
||||
batch_menus:{
|
||||
batch_menus: {
|
||||
select_all_data: "选择所有数据(共{0}条)",
|
||||
select_show_data: "选择可见数据(共{0}条)",
|
||||
},
|
||||
|
@ -503,9 +503,9 @@ export default {
|
|||
api_case_status: "用例状态",
|
||||
api_case_passing_rate: "用例通过率",
|
||||
create_tip: "注: 详细的接口信息可以在编辑页面填写",
|
||||
select_comp:{
|
||||
no_data:"无数据",
|
||||
add_data:"去添加"
|
||||
select_comp: {
|
||||
no_data: "无数据",
|
||||
add_data: "去添加"
|
||||
},
|
||||
request: {
|
||||
grade_info: "按等级筛选",
|
||||
|
@ -1363,5 +1363,47 @@ export default {
|
|||
workspace_quota_list: "{0}的工作空间配额列表",
|
||||
unlimited: "无限制",
|
||||
clean: "清空"
|
||||
},
|
||||
schema: {
|
||||
title: "标题",
|
||||
import_json: "导入 json",
|
||||
base_setting: "基础设置",
|
||||
all_setting: "编辑源码",
|
||||
default: "默认值",
|
||||
description: "描述",
|
||||
adv_setting: "高级设置",
|
||||
add_child_node: "添加子节点",
|
||||
add_sibling_node: "添加兄弟节点",
|
||||
add_node: "添加兄弟/子节点",
|
||||
remove_node: "删除节点",
|
||||
child_node: "子节点",
|
||||
sibling_node: "兄弟节点",
|
||||
ok: "确定",
|
||||
cancel: "取消",
|
||||
minLength: "最小长度",
|
||||
maxLength: "最大长度",
|
||||
pattern: "用正则表达式约束字符串",
|
||||
exclusiveMinimum: "开启后,数据必须大于最小值",
|
||||
exclusiveMaximum: "开启后,数据必须小于最大值",
|
||||
minimum: "最小值",
|
||||
maximum: "最大值",
|
||||
uniqueItems: "开启后,每个元素都不相同",
|
||||
minItems: "最小元素个数",
|
||||
maxItems: "最大元素个数",
|
||||
minProperties: "最小元素个数",
|
||||
maxProperties: "最大元素个数",
|
||||
checked_all: "全选",
|
||||
valid_json: "不是合法的json字符串",
|
||||
enum: "枚举",
|
||||
enum_msg: "每行只能写一个值",
|
||||
enum_desc: "备注",
|
||||
enum_desc_msg: "备注描述信息",
|
||||
required: "是否必须",
|
||||
mock: "mock",
|
||||
mockLink: "查看文档",
|
||||
format: "格式化",
|
||||
nothing: "无",
|
||||
preview: "预览",
|
||||
add_custom: "添加自定义属性"
|
||||
}
|
||||
};
|
||||
|
|
|
@ -487,7 +487,7 @@ export default {
|
|||
file_exist: "該項目下已存在該jar包",
|
||||
upload_limit_size: "上傳文件大小不能超過 30MB!",
|
||||
},
|
||||
batch_menus:{
|
||||
batch_menus: {
|
||||
select_all_data: "選擇所有數據(共{0}條)",
|
||||
select_show_data: "選擇可見數據(共{0}條)",
|
||||
},
|
||||
|
@ -503,9 +503,9 @@ export default {
|
|||
api_case_status: "用例狀態",
|
||||
api_case_passing_rate: "用例通過率",
|
||||
create_tip: "註: 詳細的接口信息可以在編輯頁面填寫",
|
||||
select_comp:{
|
||||
no_data:"無數據",
|
||||
add_data:"去添加"
|
||||
select_comp: {
|
||||
no_data: "無數據",
|
||||
add_data: "去添加"
|
||||
},
|
||||
request: {
|
||||
grade_info: "按等級筛选",
|
||||
|
@ -1362,5 +1362,47 @@ export default {
|
|||
workspace_quota_list: "{0}的工作空間配額列表",
|
||||
unlimited: "無限制",
|
||||
clean: "清空"
|
||||
},
|
||||
schema: {
|
||||
title: "标题",
|
||||
import_json: "导入 json",
|
||||
base_setting: "基础设置",
|
||||
all_setting: "编辑源码",
|
||||
default: "默认值",
|
||||
description: "描述",
|
||||
adv_setting: "高级设置",
|
||||
add_child_node: "添加子节点",
|
||||
add_sibling_node: "添加兄弟节点",
|
||||
add_node: "添加兄弟/子节点",
|
||||
remove_node: "删除节点",
|
||||
child_node: "子节点",
|
||||
sibling_node: "兄弟节点",
|
||||
ok: "确定",
|
||||
cancel: "取消",
|
||||
minLength: "最小长度",
|
||||
maxLength: "最大长度",
|
||||
pattern: "用正则表达式约束字符串",
|
||||
exclusiveMinimum: "开启后,数据必须大于最小值",
|
||||
exclusiveMaximum: "开启后,数据必须小于最大值",
|
||||
minimum: "最小值",
|
||||
maximum: "最大值",
|
||||
uniqueItems: "开启后,每个元素都不相同",
|
||||
minItems: "最小元素个数",
|
||||
maxItems: "最大元素个数",
|
||||
minProperties: "最小元素个数",
|
||||
maxProperties: "最大元素个数",
|
||||
checked_all: "全选",
|
||||
valid_json: "不是合法的json字符串",
|
||||
enum: "枚举",
|
||||
enum_msg: "每行只能写一个值",
|
||||
enum_desc: "备注",
|
||||
enum_desc_msg: "备注描述信息",
|
||||
required: "是否必须",
|
||||
mock: "mock",
|
||||
mockLink: "查看文档",
|
||||
format: "格式化",
|
||||
nothing: "无",
|
||||
preview: "预览",
|
||||
add_custom: "添加自定义属性"
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue