feat: 参数添加长度描述

This commit is contained in:
chenjianxing 2021-06-24 16:37:34 +08:00 committed by jianxing
parent b07097dcc3
commit d57ea30f0e
7 changed files with 89 additions and 12 deletions

View File

@ -18,6 +18,8 @@ public class KeyValue {
private boolean enable = true;
private boolean encode = true;
private boolean required;
private Integer min;
private Integer max;
public KeyValue() {
this(null, null);

View File

@ -105,9 +105,6 @@ public class ProjectService {
long createTime = System.currentTimeMillis();
project.setCreateTime(createTime);
project.setUpdateTime(createTime);
// set workspace id
project.setWorkspaceId(project.getWorkspaceId());
project.setCreateUser(project.getCreateUser());
project.setSystemId(systemId);
projectMapper.insertSelective(project);

View File

@ -74,17 +74,26 @@
</el-input>
</el-col>
<el-col v-if="withMorSetting" class="item kv-setting">
<el-tooltip effect="dark" :content="$t('schema.adv_setting')" placement="top">
<i class="el-icon-setting" @click="openApiVariableSetting(item)"/>
</el-tooltip>
</el-col>
<el-col class="item kv-delete">
<el-button size="mini" class="el-icon-delete-solid" circle @click="remove(index)"
:disabled="isDisable(index) || isReadOnly"/>
</el-col>
</el-row>
</div>
<ms-api-variable-advance ref="variableAdvance" :environment="environment" :scenario="scenario"
:parameters="parameters"
:current-item="currentItem"/>
<api-variable-setting
ref="apiVariableSetting"/>
</div>
</template>
@ -95,10 +104,11 @@
import MsApiBodyFileUpload from "./body/ApiBodyFileUpload";
import {REQUIRED} from "../model/JsonData";
import Vue from 'vue';
import ApiVariableSetting from "@/business/components/api/definition/components/ApiVariableSetting";
export default {
name: "MsApiVariable",
components: {MsApiBodyFileUpload, MsApiVariableAdvance},
components: {ApiVariableSetting, MsApiBodyFileUpload, MsApiVariableAdvance},
props: {
keyPlaceholder: String,
valuePlaceholder: String,
@ -119,7 +129,8 @@
type: Boolean,
default: true
},
suggestions: Array
suggestions: Array,
withMorSetting: Boolean
},
data() {
return {
@ -249,6 +260,9 @@
this.$nextTick(() => {
this.isActive = true;
});
},
openApiVariableSetting(item) {
this.$refs.apiVariableSetting.open(item);
}
},
created() {
@ -307,4 +321,9 @@
cursor: pointer;
color: #1E90FF;
}
.kv-setting {
width: 40px;
padding: 0px !important;
}
</style>

View File

@ -0,0 +1,49 @@
<template>
<ms-edit-dialog
:visible.sync="visible"
width="30%"
:title="$t('run_mode.other_config')"
:with-footer="false"
:close-on-click-modal="true">
<el-form>
<el-row>
<el-col :span="12">
<el-form-item :label="$t('schema.minLength')">
<el-input-number :min="0" v-model="data.min" :placeholder="$t('schema.minLength')" size="small"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('schema.maxLength')">
<el-input-number :min="0" v-model="data.max" :placeholder="$t('schema.maxLength')" size="small"/>
</el-form-item>
</el-col>
</el-row>
</el-form>
</ms-edit-dialog>
</template>
<script>
import MsEditDialog from "@/business/components/common/components/MsEditDialog";
export default {
name: "ApiVariableSetting",
components: {MsEditDialog},
data() {
return {
visible: false,
data: {}
}
},
methods: {
open(item) {
this.visible = true;
this.data = item;
}
}
}
</script>
<style scoped>
</style>

View File

@ -29,7 +29,7 @@
<el-row v-if="body.type == 'Form Data' || body.type == 'WWW_FORM'">
<el-link class="ms-el-link" @click="batchAdd"> {{$t("commons.batch_add")}}</el-link>
</el-row>
<ms-api-variable :is-read-only="isReadOnly"
<ms-api-variable :with-mor-setting="true" :is-read-only="isReadOnly"
:parameters="body.kvs"
:isShowEnable="isShowEnable" type="body"/>
</div>

View File

@ -31,7 +31,7 @@
<el-row>
<el-link class="ms-el-link" @click="batchAdd" style="color: #783887"> {{$t("commons.batch_add")}}</el-link>
</el-row>
<ms-api-variable :is-read-only="isReadOnly" :isShowEnable="isShowEnable" :parameters="request.arguments"/>
<ms-api-variable :with-mor-setting="true" :is-read-only="isReadOnly" :isShowEnable="isShowEnable" :parameters="request.arguments"/>
</el-tab-pane>
<!--REST 参数-->
@ -47,7 +47,7 @@
<el-row>
<el-link class="ms-el-link" @click="batchAdd" style="color: #783887"> {{$t("commons.batch_add")}}</el-link>
</el-row>
<ms-api-variable :is-read-only="isReadOnly" :isShowEnable="isShowEnable" :parameters="request.rest"/>
<ms-api-variable :with-mor-setting="true" :is-read-only="isReadOnly" :isShowEnable="isShowEnable" :parameters="request.rest"/>
</el-tab-pane>
<!--请求体-->

View File

@ -1,5 +1,5 @@
<template>
<el-dialog :close-on-click-modal="false"
<el-dialog :close-on-click-modal="closeOnClickModal"
:title="title"
:width="width"
:visible="visible"
@ -13,7 +13,7 @@
<template v-slot:footer>
<slot name="footer">
<div class="dialog-footer">
<div v-if="withFooter" class="dialog-footer">
<ms-dialog-footer
@cancel="handleCancel"
@confirm="handleConfirm"/>
@ -53,7 +53,17 @@ export default {
default() {
return "50%";
}
}
},
withFooter: {
type: Boolean,
default() {
return true;
}
},
closeOnClickModal: {
type: Boolean,
default: false
},
},
methods: {
handleConfirm() {