Commit 8b8b7b74 authored by “yiyousong”'s avatar “yiyousong”

pref:修改新增接口可以搜索限流策略

parent eaa4a276
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
:columns="tableHeaders" :columns="tableHeaders"
:dataSource="tableSourceData" :dataSource="tableSourceData"
> >
<template slot="network" slot-scope="text, record, index"> <template slot="network" slot-scope="text">
<span <span
v-for="(item, idx) of dict.network" v-for="(item, idx) of dict.network"
v-show="text.indexOf(idx) != -1" v-show="text.indexOf(idx) != -1"
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
</span> </span>
</template> </template>
<template slot="operation" slot-scope="text, record, index"> <template slot="operation" slot-scope="text, record">
<a-button type="link" @click="openDetails(record)">编辑</a-button> <a-button type="link" @click="openDetails(record)">编辑</a-button>
<a-popconfirm <a-popconfirm
title="确定要删除此应用吗?" title="确定要删除此应用吗?"
......
<template> <template>
<a-drawer :destroyOnClose="true" :title="modalInfo.title" :width="modalInfo.width" :visible="modalInfo.visible" <a-drawer
@close="resetForm"> :destroyOnClose="true"
<a-form-model ref="ruleForm" :model="detailsForm" :rules="detailsRules" :label-col="{ span: 4 }" :title="modalInfo.title"
:wrapper-col="{ span: 20 }"> :width="modalInfo.width"
<a-row :gutter="16"> :visible="modalInfo.visible"
<a-col :span="12"> @close="resetForm"
<a-form-model-item label="接口名称" prop="interfaceName"> >
<a-input v-model="detailsForm.interfaceName" placeholder="请输入" allowClear /> <a-form-model
</a-form-model-item> ref="ruleForm"
</a-col> :model="detailsForm"
<a-col :span="12"> :rules="detailsRules"
<a-form-model-item label="版本号" prop="versionNumber"> :label-col="{ span: 4 }"
<a-input v-model="detailsForm.versionNumber" placeholder="请输入" allowClear /> :wrapper-col="{ span: 20 }"
</a-form-model-item> >
</a-col> <a-row :gutter="16">
<a-col :span="12"> <a-col :span="12">
<a-form-model-item label="请求类型" prop="requestType"> <a-form-model-item label="接口名称" prop="interfaceName">
<a-select v-model="detailsForm.requestType" placeholder="请选择" allowClear> <a-input
<a-select-option value="1"> POST </a-select-option> v-model="detailsForm.interfaceName"
<a-select-option value="2"> GET </a-select-option> placeholder="请输入"
</a-select> allowClear
</a-form-model-item> />
</a-col> </a-form-model-item>
<a-col :span="12"> </a-col>
<a-form-model-item label="请求协议" prop="requestProtocol"> <a-col :span="12">
<a-select v-model="detailsForm.requestProtocol" placeholder="请选择" allowClear> <a-form-model-item label="版本号" prop="versionNumber">
<a-select-option value="1"> HTTP </a-select-option> <a-input
<a-select-option value="2"> HTTPS </a-select-option> v-model="detailsForm.versionNumber"
</a-select> placeholder="请输入"
</a-form-model-item> allowClear
</a-col> />
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="请求类型" prop="requestType">
<a-select
v-model="detailsForm.requestType"
placeholder="请选择"
allowClear
>
<a-select-option value="1"> POST </a-select-option>
<a-select-option value="2"> GET </a-select-option>
</a-select>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="请求协议" prop="requestProtocol">
<a-select
v-model="detailsForm.requestProtocol"
placeholder="请选择"
allowClear
>
<a-select-option value="1"> HTTP </a-select-option>
<a-select-option value="2"> HTTPS </a-select-option>
</a-select>
</a-form-model-item>
</a-col>
<a-col :span="12"> <a-col :span="12">
<a-form-model-item label="content-type" prop="contentType"> <a-form-model-item label="content-type" prop="contentType">
<a-select v-model="detailsForm.contentType" placeholder="请选择" allowClear> <a-select
<a-select-option v-for="item, index in ctList" :key="index" :value="item">{{ item v-model="detailsForm.contentType"
}}</a-select-option> placeholder="请选择"
</a-select> allowClear
</a-form-model-item> >
</a-col> <a-select-option
<a-col :span="12"> v-for="(item, index) in ctList"
<a-form-model-item label="超时时长" prop="timeoutValue"> :key="index"
<a-input v-model="detailsForm.timeoutValue" placeholder="请输入" allowClear> :value="item"
<template slot="suffix"></template> >{{ item }}</a-select-option
</a-input> >
</a-form-model-item> </a-select>
</a-col> </a-form-model-item>
<a-col :span="12"> </a-col>
<a-form-model-item label="限流策略" prop="limitStrategy"> <a-col :span="12">
<a-select v-model="detailsForm.limitStrategy" placeholder="请选择" allowClear> <a-form-model-item label="超时时长" prop="timeoutValue">
<a-select-option value="1"> 分钟 </a-select-option> <a-input
<a-select-option value="2"> 小时 </a-select-option> v-model="detailsForm.timeoutValue"
</a-select> placeholder="请输入"
</a-form-model-item> allowClear
</a-col> >
<a-col :span="12"> <template slot="suffix"></template>
<a-form-model-item label="访问网络" prop="network"> </a-input>
<a-checkbox-group v-model="detailsForm.network" :options="options" /> </a-form-model-item>
</a-form-model-item> </a-col>
</a-col> <a-col :span="12">
<a-col :span="12"> <a-form-model-item label="限流策略" prop="limitStrategy">
<a-form-model-item label="接口标签" prop="interfaceTag"> <a-select
<a-select v-model="detailsForm.interfaceTag" placeholder="请选择" allowClear> v-model="detailsForm.limitStrategy"
<a-select-option v-for="(item, index) of dict.interfaceTag" :key="index" :value="index"> placeholder="请选择"
{{ item }} allowClear
</a-select-option> showSearch
</a-select> optionFilterProp="label"
</a-form-model-item> >
</a-col> <a-select-option value="1" label="分钟"> 分钟 </a-select-option>
<a-select-option value="2" label="小时"> 小时 </a-select-option>
</a-select>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="访问网络" prop="network">
<a-checkbox-group
v-model="detailsForm.network"
:options="options"
/>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="接口标签" prop="interfaceTag">
<a-select
v-model="detailsForm.interfaceTag"
placeholder="请选择"
allowClear
>
<a-select-option
v-for="(item, index) of dict.interfaceTag"
:key="index"
:value="index"
>
{{ item }}
</a-select-option>
</a-select>
</a-form-model-item>
</a-col>
<a-col :span="12"> <a-col :span="12">
<a-form-model-item label="接口来源" prop="interfaceSource"> <a-form-model-item label="接口来源" prop="interfaceSource">
<a-select v-model="detailsForm.interfaceSource" placeholder="请选择" allowClear> <a-select
<a-select-option value="1"> 自建发布 </a-select-option> v-model="detailsForm.interfaceSource"
<a-select-option value="2"> 对接转化 </a-select-option> placeholder="请选择"
</a-select> allowClear
</a-form-model-item> >
</a-col> <a-select-option value="1"> 自建发布 </a-select-option>
<a-col :span="12"> <a-select-option value="2"> 对接转化 </a-select-option>
<a-form-model-item label="请求路径" prop="requestUrl"> </a-select>
<a-input v-model="detailsForm.requestUrl" placeholder="请输入" allowClear /> </a-form-model-item>
</a-form-model-item> </a-col>
</a-col> <a-col :span="12">
<a-col :span="12"> <a-form-model-item label="请求路径" prop="requestUrl">
<a-form-model-item label="描述" prop="description"> <a-input
<a-textarea v-model="detailsForm.description" placeholder="请输入" :rows="4" /> v-model="detailsForm.requestUrl"
</a-form-model-item> placeholder="请输入"
</a-col> allowClear
/>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="描述" prop="description">
<a-textarea
v-model="detailsForm.description"
placeholder="请输入"
:rows="4"
/>
</a-form-model-item>
</a-col>
</a-row>
</a-row> <h1 class="title_">请求参数</h1>
<div class="flex aic jcb mb10">
<a-radio-group
v-model="requestPam.type"
button-style="solid"
@change="onReqType('new')"
>
<a-radio-button value="path"> 路径参数 </a-radio-button>
<a-radio-button value="headers"> headers </a-radio-button>
<a-radio-button value="query"> query </a-radio-button>
<a-radio-button value="body"> body </a-radio-button>
</a-radio-group>
<div class="flex aic">
<div class="mr10">入参是否加密</div>
<a-radio-group v-model="detailsForm.inEncrypt">
<a-radio :value="0">不加密</a-radio>
<a-radio :value="1">加密</a-radio>
</a-radio-group>
</div>
</div>
<h1 class="title_">请求参数</h1> <a-table
<div class="flex aic jcb mb10"> size="middle"
<a-radio-group v-model="requestPam.type" button-style="solid" @change="onReqType('new')"> bordered
<a-radio-button value="path"> 路径参数 </a-radio-button> :row-key="(record) => record.id"
<a-radio-button value="headers"> headers </a-radio-button> :locale="{ emptyText: '无' }"
<a-radio-button value="query"> query </a-radio-button> :pagination="false"
<a-radio-button value="body"> body </a-radio-button> :columns="table_columns"
</a-radio-group> :dataSource="requestPam.table"
<div class="flex aic"> >
<div class="mr10">入参是否加密</div> <template slot="参数名" slot-scope="text, record">
<a-radio-group v-model="detailsForm.inEncrypt"> <a-input v-model="record.name" placeholder="请输入" allowClear />
<a-radio :value="0">不加密</a-radio> </template>
<a-radio :value="1">加密</a-radio> <template slot="参数值类型" slot-scope="text, record">
</a-radio-group> <a-select
</div> v-model="record.type"
</div> placeholder="请选择"
allowClear
:disabled="record.isType"
>
<a-select-option value="String"> String </a-select-option>
<a-select-option value="Int"> Int </a-select-option>
<a-select-option value="Object"> Object </a-select-option>
<a-select-option value="[String]"> [String] </a-select-option>
<a-select-option value="[Int]"> [Int] </a-select-option>
<a-select-option value="[Object]"> [Object] </a-select-option>
</a-select>
</template>
<template slot="默认值" slot-scope="text, record">
<a-input v-model="record.default" placeholder="请输入" allowClear />
</template>
<template slot="是否必填" slot-scope="text, record">
<a-select v-model="record.isMust" placeholder="请选择" allowClear>
<a-select-option value="1"></a-select-option>
<a-select-option value="0"></a-select-option>
</a-select>
</template>
<template slot="描述" slot-scope="text, record">
<a-input v-model="record.describe" placeholder="请输入" allowClear />
</template>
<a-table size="middle" bordered :row-key="(record) => record.id" :locale="{ emptyText: '无' }" <template slot="operation" slot-scope="text, record, index">
:pagination="false" :columns="table_columns" :dataSource="requestPam.table"> <a-button
<template slot="参数名" slot-scope="text, record, index"> type="link"
<a-input v-model="record.name" placeholder="请输入" allowClear /> @click="delTabRow('requestPam', index)"
</template> style="color: #ff4420"
<template slot="参数值类型" slot-scope="text, record, index"> >删除</a-button
<a-select v-model="record.type" placeholder="请选择" allowClear :disabled="record.isType"> >
<a-select-option value="String"> String </a-select-option> </template>
<a-select-option value="Int"> Int </a-select-option> </a-table>
<a-select-option value="Object"> Object </a-select-option> <div class="table_footer" v-if="requestPam.type != 'path'">
<a-select-option value="[String]"> [String] </a-select-option> <a-button type="primary" class="addclass" @click="onReqType('add')">
<a-select-option value="[Int]"> [Int] </a-select-option> 添加参数
<a-select-option value="[Object]"> [Object] </a-select-option> </a-button>
</a-select> </div>
</template>
<template slot="默认值" slot-scope="text, record, index">
<a-input v-model="record.default" placeholder="请输入" allowClear />
</template>
<template slot="是否必填" slot-scope="text, record, index">
<a-select v-model="record.isMust" placeholder="请选择" allowClear>
<a-select-option value="1"></a-select-option>
<a-select-option value="0"></a-select-option>
</a-select>
</template>
<template slot="描述" slot-scope="text, record, index">
<a-input v-model="record.describe" placeholder="请输入" allowClear />
</template>
<template slot="operation" slot-scope="text, record, index"> <div class="flex aic jcb mt20">
<a-button type="link" @click="delTabRow('requestPam', index)" style="color: #ff4420">删除</a-button> <h1 class="title_">响应数据</h1>
</template> <div class="flex aic">
</a-table> <div class="mr10">出参是否加密</div>
<div class="table_footer" v-if="requestPam.type != 'path'"> <a-radio-group v-model="detailsForm.outEncrypt">
<a-button type="primary" class="addclass" @click="onReqType('add')"> 添加参数 </a-button> <a-radio :value="0">不加密</a-radio>
</div> <a-radio :value="1">加密</a-radio>
</a-radio-group>
</div>
</div>
<div class="flex aic jcb mt20"> <a-table
<h1 class="title_">响应数据</h1> size="middle"
<div class="flex aic"> bordered
<div class="mr10">出参是否加密</div> :row-key="(record) => record.id"
<a-radio-group v-model="detailsForm.outEncrypt"> :locale="{ emptyText: '无' }"
<a-radio :value="0">不加密</a-radio> :pagination="false"
<a-radio :value="1">加密</a-radio> :columns="table_columns"
</a-radio-group> :dataSource="responsePam.table"
</div> >
</div> <template slot="参数名" slot-scope="text, record">
<a-input v-model="record.name" placeholder="请输入" allowClear />
</template>
<template slot="参数值类型" slot-scope="text, record">
<a-select v-model="record.type" placeholder="请选择" allowClear>
<a-select-option value="String"> String </a-select-option>
<a-select-option value="Int"> Int </a-select-option>
<a-select-option value="Object"> Object </a-select-option>
<a-select-option value="[String]"> [String] </a-select-option>
<a-select-option value="[Int]"> [Int] </a-select-option>
<a-select-option value="[Object]"> [Object] </a-select-option>
</a-select>
</template>
<template slot="默认值" slot-scope="text, record">
<a-input v-model="record.default" placeholder="请输入" allowClear />
</template>
<template slot="是否必填" slot-scope="text, record">
<a-select v-model="record.isMust" placeholder="请选择" allowClear>
<a-select-option value="1"></a-select-option>
<a-select-option value="0"></a-select-option>
</a-select>
</template>
<template slot="描述" slot-scope="text, record">
<a-input v-model="record.describe" placeholder="请输入" allowClear />
</template>
<a-table size="middle" bordered :row-key="(record) => record.id" :locale="{ emptyText: '无' }" <template slot="operation" slot-scope="text, record, index">
:pagination="false" :columns="table_columns" :dataSource="responsePam.table"> <a-button
<template slot="参数名" slot-scope="text, record, index"> type="link"
<a-input v-model="record.name" placeholder="请输入" allowClear /> @click="delTabRow('responsePam', index)"
</template> style="color: #ff4420"
<template slot="参数值类型" slot-scope="text, record, index"> >删除</a-button
<a-select v-model="record.type" placeholder="请选择" allowClear> >
<a-select-option value="String"> String </a-select-option> </template>
<a-select-option value="Int"> Int </a-select-option> </a-table>
<a-select-option value="Object"> Object </a-select-option> <div class="table_footer">
<a-select-option value="[String]"> [String] </a-select-option> <a-button type="primary" class="addclass" @click="addResPam">
<a-select-option value="[Int]"> [Int] </a-select-option> 添加参数
<a-select-option value="[Object]"> [Object] </a-select-option> </a-button>
</a-select> </div>
</template> <div class="drawer_footer">
<template slot="默认值" slot-scope="text, record, index"> <a-button type="primary" class="addclass" @click="modalSubmit">
<a-input v-model="record.default" placeholder="请输入" allowClear /> 保存
</template> </a-button>
<template slot="是否必填" slot-scope="text, record, index"> <a-button @click="resetForm"> 取消 </a-button>
<a-select v-model="record.isMust" placeholder="请选择" allowClear> </div>
<a-select-option value="1"></a-select-option> </a-form-model>
<a-select-option value="0"></a-select-option> </a-drawer>
</a-select>
</template>
<template slot="描述" slot-scope="text, record, index">
<a-input v-model="record.describe" placeholder="请输入" allowClear />
</template>
<template slot="operation" slot-scope="text, record, index">
<a-button type="link" @click="delTabRow('responsePam', index)" style="color: #ff4420">删除</a-button>
</template>
</a-table>
<div class="table_footer">
<a-button type="primary" class="addclass" @click="addResPam"> 添加参数 </a-button>
</div>
<div class="drawer_footer">
<a-button type="primary" class="addclass" @click="modalSubmit"> 保存 </a-button>
<a-button @click="resetForm"> 取消 </a-button>
</div>
</a-form-model>
</a-drawer>
</template> </template>
<script> <script>
import modal from "../mixins/modal"; import modal from "../mixins/modal";
import { import { getInterfaceSave, getInterfaceInfo } from "@/api/thePlatformIsSet.js";
getInterfaceSave, getInterfaceInfo
} from '@/api/thePlatformIsSet.js'
export default { export default {
mixins: [modal], mixins: [modal],
name: "PortalAdminVuePicWorks", name: "PortalAdminVuePicWorks",
props: ["dict"], props: ["dict"],
data() { data() {
return { return {
detailsForm: { detailsForm: {
productId: this.$route.query.id, productId: this.$route.query.id,
interfaceName: undefined, interfaceName: undefined,
versionNumber: undefined, versionNumber: undefined,
requestType: undefined, requestType: undefined,
requestProtocol: undefined, requestProtocol: undefined,
requestUrl: undefined, requestUrl: undefined,
timeoutValue: undefined, timeoutValue: undefined,
timeoutValue: undefined, timeoutValue: undefined,
network: undefined, network: undefined,
description: undefined, description: undefined,
flowControl: undefined, flowControl: undefined,
authorizeInfo: undefined, authorizeInfo: undefined,
contentType: undefined, contentType: undefined,
interfaceTag: undefined, interfaceTag: undefined,
inEncrypt: 0, inEncrypt: 0,
outEncrypt: 0 outEncrypt: 0,
}, },
detailsRules: { detailsRules: {
interfaceName: [{ required: true, message: "请输入", trigger: "blur" }], interfaceName: [{ required: true, message: "请输入", trigger: "blur" }],
versionNumber: [{ required: true, message: "请输入", trigger: "blur" }], versionNumber: [{ required: true, message: "请输入", trigger: "blur" }],
requestType: [{ required: true, message: "请选择", trigger: "change" }], requestType: [{ required: true, message: "请选择", trigger: "change" }],
requestProtocol: [{ required: true, message: "请选择", trigger: "change" }], requestProtocol: [
requestUrl: [{ required: true, message: "请输入", trigger: "blur" }], { required: true, message: "请选择", trigger: "change" },
timeoutValue: [{ required: true, message: "请输入", trigger: "blur" }], ],
}, requestUrl: [{ required: true, message: "请输入", trigger: "blur" }],
options: [{ timeoutValue: [{ required: true, message: "请输入", trigger: "blur" }],
label: "互联网", },
value: "1", options: [
}, {
{ label: "互联网",
label: "政务网", value: "1",
value: "2", },
}, {
], label: "政务网",
table_columns: [{ value: "2",
title: "参数名", },
align: "center", ],
dataIndex: "name", table_columns: [
scopedSlots: { {
customRender: "参数名", title: "参数名",
}, align: "center",
}, dataIndex: "name",
{ scopedSlots: {
title: "参数值类型", customRender: "参数名",
align: "center", },
dataIndex: "type", },
scopedSlots: { {
customRender: "参数值类型", title: "参数值类型",
}, align: "center",
}, dataIndex: "type",
{ scopedSlots: {
title: "默认值", customRender: "参数值类型",
align: "center", },
dataIndex: "default", },
scopedSlots: { {
customRender: "默认值", title: "默认值",
}, align: "center",
}, dataIndex: "default",
{ scopedSlots: {
title: "是否必填", customRender: "默认值",
align: "center", },
dataIndex: "isMust", },
scopedSlots: { {
customRender: "是否必填", title: "是否必填",
}, align: "center",
}, dataIndex: "isMust",
{ scopedSlots: {
title: "描述", customRender: "是否必填",
align: "center", },
dataIndex: "describe", },
scopedSlots: { {
customRender: "描述", title: "描述",
}, align: "center",
width: 200 dataIndex: "describe",
}, scopedSlots: {
customRender: "描述",
},
width: 200,
},
{ {
title: "操作", title: "操作",
align: "center", align: "center",
width: "60px", width: "60px",
dataIndex: "operation", dataIndex: "operation",
scopedSlots: { scopedSlots: {
customRender: "operation", customRender: "operation",
}, },
}, },
], ],
requestPam: { requestPam: {
type: 'path', type: "path",
table: [] table: [],
}, },
responsePam: { responsePam: {
table: [{ table: [
name: ``, {
type: undefined, name: ``,
default: ``, type: undefined,
isMust: undefined, default: ``,
describe: ``, isMust: undefined,
}] describe: ``,
}, },
errorCode_columns: [{ ],
title: "Http Code", },
align: "center", errorCode_columns: [
dataIndex: "httpCode", {
scopedSlots: { title: "Http Code",
customRender: "Http Code", align: "center",
} dataIndex: "httpCode",
}, scopedSlots: {
{ customRender: "Http Code",
title: "Error Code", },
align: "center", },
dataIndex: "errorCode", {
scopedSlots: { title: "Error Code",
customRender: "Error Code", align: "center",
}, dataIndex: "errorCode",
}, scopedSlots: {
{ customRender: "Error Code",
title: "错误信息", },
align: "center", },
dataIndex: "errorMessage", {
scopedSlots: { title: "错误信息",
customRender: "错误信息", align: "center",
}, dataIndex: "errorMessage",
}, scopedSlots: {
{ customRender: "错误信息",
title: "操作", },
align: "center", },
width: "60px", {
dataIndex: "operation", title: "操作",
scopedSlots: { align: "center",
customRender: "operation", width: "60px",
}, dataIndex: "operation",
} scopedSlots: {
], customRender: "operation",
errorCode: [{ },
httpCode: ``, },
errorCode: ``, ],
errorMessage: `` errorCode: [
}], {
changeHistory_columns: [{ httpCode: ``,
title: "变更时间", errorCode: ``,
align: "center", errorMessage: ``,
dataIndex: "time", },
scopedSlots: { ],
customRender: "变更时间", changeHistory_columns: [
} {
}, title: "变更时间",
{ align: "center",
title: "变更内容概要", dataIndex: "time",
align: "center", scopedSlots: {
dataIndex: "content", customRender: "变更时间",
scopedSlots: { },
customRender: "变更内容概要", },
}, {
} title: "变更内容概要",
], align: "center",
changeHistory: [{ dataIndex: "content",
time: '', scopedSlots: {
content: '' customRender: "变更内容概要",
}], },
ctList: ["text/html", "text/xml", "application/json", "application/xml", "application/x-www-form-urlencoded", "multipart/form-data"] },
}; ],
}, changeHistory: [
{
time: "",
content: "",
},
],
ctList: [
"text/html",
"text/xml",
"application/json",
"application/xml",
"application/x-www-form-urlencoded",
"multipart/form-data",
],
};
},
mounted() { }, mounted() {},
methods: { methods: {
getInfo(id) { getInfo(id) {
getInterfaceInfo({ id: id }).then(res => { getInterfaceInfo({ id: id }).then((res) => {
res.data.network = res.data.network.split(',') res.data.network = res.data.network.split(",");
this.detailsForm = res.data this.detailsForm = res.data;
this.requestPam = JSON.parse(res.data.requestParameters) this.requestPam = JSON.parse(res.data.requestParameters);
this.responsePam = JSON.parse(res.data.responseParameters) this.responsePam = JSON.parse(res.data.responseParameters);
}) });
}, },
modalSubmit() { modalSubmit() {
this.$refs.ruleForm.validate(valid => { this.$refs.ruleForm.validate((valid) => {
if (valid) { if (valid) {
let json = JSON.parse(JSON.stringify(this.detailsForm)) let json = JSON.parse(JSON.stringify(this.detailsForm));
if (json.network.length) json.network = json.network.join(',') if (json.network.length) json.network = json.network.join(",");
json.requestParameters = JSON.stringify(this.requestPam) json.requestParameters = JSON.stringify(this.requestPam);
json.responseParameters = JSON.stringify(this.responsePam) json.responseParameters = JSON.stringify(this.responsePam);
getInterfaceSave(json).then(res => { getInterfaceSave(json).then((res) => {
let { code, msg } = res let { code, msg } = res;
if (code == 1) { if (code == 1) {
this.$message.success('保存成功'); this.$message.success("保存成功");
this.resetForm(); this.resetForm();
this.modalInfo.visible = false this.modalInfo.visible = false;
this.$parent.getList() this.$parent.getList();
} else { } else {
this.$message.error(msg); this.$message.error(msg);
} }
}) });
} else { } else {
return false; return false;
} }
}); });
}, },
//type //type
onReqType(type) { onReqType(type) {
let index = this.requestPam.type let index = this.requestPam.type;
if (index == 'path') { if (index == "path") {
this.requestPam.table = [] this.requestPam.table = [];
} else { } else {
let obj = { let obj = {
name: ``, name: ``,
type: 'String', type: "String",
default: ``, default: ``,
isMust: undefined, isMust: undefined,
describe: ``, describe: ``,
isType: true isType: true,
} };
if (index == 'body') { if (index == "body") {
obj.isType = false obj.isType = false;
} }
if (type == 'new') { if (type == "new") {
this.requestPam.table = [obj] this.requestPam.table = [obj];
} else { } else {
this.requestPam.table.push(obj) this.requestPam.table.push(obj);
} }
} }
}, },
addResPam() { addResPam() {
this.responsePam.table.push({ this.responsePam.table.push({
name: ``, name: ``,
type: undefined, type: undefined,
default: ``, default: ``,
isMust: undefined, isMust: undefined,
describe: ``, describe: ``,
}) });
}, },
delTabRow(key, index) { delTabRow(key, index) {
this[key].table.splice(index, 1) this[key].table.splice(index, 1);
}, },
resetForm() { resetForm() {
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.ruleForm.resetFields(); this.$refs.ruleForm.resetFields();
this.detailsForm.id="" this.detailsForm.id = "";
this.requestPam = { this.requestPam = {
type: 'path', type: "path",
table: [] table: [],
} };
this.responsePam = { this.responsePam = {
table: [{ table: [
name: ``, {
type: undefined, name: ``,
default: ``, type: undefined,
isMust: undefined, default: ``,
describe: ``, isMust: undefined,
}] describe: ``,
} },
this.modalInfo.visible = false; ],
}); };
} this.modalInfo.visible = false;
}, });
},
},
}; };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
/deep/.ant-drawer-content { /deep/.ant-drawer-content {
overflow-x: hidden !important; overflow-x: hidden !important;
} }
.drawer_footer { .drawer_footer {
z-index: 1; z-index: 1;
text-align: left; text-align: left;
background: #fff; background: #fff;
padding: 10px 16px; padding: 10px 16px;
border-top: 1px solid #e9e9e9; border-top: 1px solid #e9e9e9;
width: 100%; width: 100%;
bottom: 0; bottom: 0;
right: 0; right: 0;
position: absolute; position: absolute;
} }
.title_ { .title_ {
font-size: 16px; font-size: 16px;
font-weight: bold; font-weight: bold;
color: #333; color: #333;
margin-bottom: 10px; margin-bottom: 10px;
} }
.table_footer { .table_footer {
text-align: center; text-align: center;
padding-top: 10px; padding-top: 10px;
} }
/deep/.ant-drawer-body { /deep/.ant-drawer-body {
margin-bottom: 100px; margin-bottom: 100px;
} }
</style> </style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment