|
|
@ -8,8 +8,8 @@ |
|
|
|
<el-form-item label="描述"> |
|
|
|
<el-input placeholder="描述" v-model="searchInfo.description"></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="请求"> |
|
|
|
<el-select placeholder="请选择" clearable v-model="searchInfo.method"> |
|
|
|
<el-form-item label="请求"> |
|
|
|
<el-select clearable placeholder="请选择" v-model="searchInfo.method"> |
|
|
|
<el-option |
|
|
|
:key="item.value" |
|
|
|
:label="`${item.label}(${item.value})`" |
|
|
@ -26,12 +26,12 @@ |
|
|
|
</el-form-item> |
|
|
|
</el-form> |
|
|
|
</div> |
|
|
|
<el-table @sort-change="sortChange" :data="tableData" border stripe> |
|
|
|
<el-table-column sortable="custom" label="id" min-width="60" prop="ID"></el-table-column> |
|
|
|
<el-table-column sortable="custom" label="api路径" min-width="150" prop="path"></el-table-column> |
|
|
|
<el-table-column sortable="custom" label="api分组" min-width="150" prop="apiGroup"></el-table-column> |
|
|
|
<el-table-column sortable="custom" label="api简介" min-width="150" prop="description"></el-table-column> |
|
|
|
<el-table-column sortable="custom" label="请求" min-width="150" prop="method"> |
|
|
|
<el-table :data="tableData" @sort-change="sortChange" border stripe> |
|
|
|
<el-table-column label="id" min-width="60" prop="ID" sortable="custom"></el-table-column> |
|
|
|
<el-table-column label="api路径" min-width="150" prop="path" sortable="custom"></el-table-column> |
|
|
|
<el-table-column label="api分组" min-width="150" prop="apiGroup" sortable="custom"></el-table-column> |
|
|
|
<el-table-column label="api简介" min-width="150" prop="description" sortable="custom"></el-table-column> |
|
|
|
<el-table-column label="请求" min-width="150" prop="method" sortable="custom"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<div> |
|
|
|
{{scope.row.method}} |
|
|
@ -64,7 +64,7 @@ |
|
|
|
layout="total, sizes, prev, pager, next, jumper" |
|
|
|
></el-pagination> |
|
|
|
|
|
|
|
<el-dialog :before-close="closeDialog" :visible.sync="dialogFormVisible" title="新增Api"> |
|
|
|
<el-dialog :before-close="closeDialog" :title="dialogTitle" :visible.sync="dialogFormVisible"> |
|
|
|
<el-form :inline="true" :model="form" :rules="rules" label-width="80px" ref="apiForm"> |
|
|
|
<el-form-item label="路径" prop="path"> |
|
|
|
<el-input autocomplete="off" v-model="form.path"></el-input> |
|
|
@ -107,7 +107,7 @@ import { |
|
|
|
deleteApi |
|
|
|
} from '@/api/api' |
|
|
|
import infoList from '@/components/mixins/infoList' |
|
|
|
import {toSQLLine} from '@/utils/stringFun' |
|
|
|
import { toSQLLine } from '@/utils/stringFun' |
|
|
|
const methodOptions = [ |
|
|
|
{ |
|
|
|
value: 'POST', |
|
|
@ -138,6 +138,7 @@ export default { |
|
|
|
return { |
|
|
|
listApi: getApiList, |
|
|
|
dialogFormVisible: false, |
|
|
|
dialogTitle: '新增Api', |
|
|
|
form: { |
|
|
|
path: '', |
|
|
|
apiGroup: '', |
|
|
@ -148,7 +149,9 @@ export default { |
|
|
|
type: '', |
|
|
|
rules: { |
|
|
|
path: [{ required: true, message: '请输入api路径', trigger: 'blur' }], |
|
|
|
apiGroup: [{ required: true, message: '请输入组名称', trigger: 'blur' }], |
|
|
|
apiGroup: [ |
|
|
|
{ required: true, message: '请输入组名称', trigger: 'blur' } |
|
|
|
], |
|
|
|
method: [ |
|
|
|
{ required: true, message: '请选择请求方式', trigger: 'blur' } |
|
|
|
], |
|
|
@ -160,12 +163,12 @@ export default { |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
// 排序 |
|
|
|
sortChange({prop,order}){ |
|
|
|
if(prop){ |
|
|
|
sortChange({ prop, order }) { |
|
|
|
if (prop) { |
|
|
|
this.searchInfo.orderKey = toSQLLine(prop) |
|
|
|
this.searchInfo.desc = order=="descending" |
|
|
|
this.searchInfo.desc = order == 'descending' |
|
|
|
} |
|
|
|
this.getTableData() |
|
|
|
this.getTableData() |
|
|
|
}, |
|
|
|
//条件搜索前端看此方法 |
|
|
|
onSubmit() { |
|
|
@ -181,6 +184,16 @@ export default { |
|
|
|
this.dialogFormVisible = false |
|
|
|
}, |
|
|
|
openDialog(type) { |
|
|
|
switch (type) { |
|
|
|
case 'addApi': |
|
|
|
this.dialogTitlethis = '新增Api' |
|
|
|
break |
|
|
|
case 'edit': |
|
|
|
this.dialogTitlethis = '编辑Api' |
|
|
|
break |
|
|
|
default: |
|
|
|
break |
|
|
|
} |
|
|
|
this.type = type |
|
|
|
this.dialogFormVisible = true |
|
|
|
}, |
|
|
|