|
@@ -5,12 +5,12 @@
|
|
|
<el-input v-model="listQuery.id" placeholder="接口ID" style="width: 80px;" class="filter-item" @keyup.enter.native="handleFilter" />
|
|
|
<el-input v-model="listQuery.customName" placeholder="接口名称" style="width: 150px;" class="filter-item" @keyup.enter.native="handleFilter" />
|
|
|
<el-input v-model="listQuery.url" placeholder="url" style="width: 200px;" class="filter-item" @keyup.enter.native="handleFilter" />
|
|
|
- <el-select v-model="listQuery.method" placeholder="method" style="width: 100px;" class="filter-item" filterable clearable @change="getMethod(listQuery.method)">
|
|
|
- <el-option v-for="item in envMethod" :key="item.str" :label="item.str" :value="item.str" />
|
|
|
- </el-select>
|
|
|
- <el-select v-model="listQuery.returnDataTypeStr" placeholder="返回值data类型" style="width: 200px;" class="filter-item" filterable clearable @change="getDataType(listQuery.returnDataType)">
|
|
|
- <el-option v-for="item in envSelectDataType" :key="item.code" :label="item.msg" :value="item.code" />
|
|
|
- </el-select>
|
|
|
+ <!--<el-select v-model="listQuery.method" placeholder="method" style="width: 100px;" class="filter-item" filterable clearable @change="getMethod(listQuery.method)">-->
|
|
|
+ <!--<el-option v-for="item in envMethod" :key="item.str" :label="item.str" :value="item.str" />-->
|
|
|
+ <!--</el-select>-->
|
|
|
+ <!--<el-select v-model="listQuery.returnDataTypeStr" placeholder="返回值data类型" style="width: 200px;" class="filter-item" filterable clearable @change="getDataType(listQuery.returnDataType)">-->
|
|
|
+ <!--<el-option v-for="item in envSelectDataType" :key="item.code" :label="item.msg" :value="item.code" />-->
|
|
|
+ <!--</el-select>-->
|
|
|
<el-select v-model="listQuery.status" placeholder="状态" style="width: 100px;" class="filter-item" filterable clearable>
|
|
|
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
|
|
|
</el-select>
|
|
@@ -34,12 +34,12 @@
|
|
|
<el-table-column label="mockURL" min-width="180px" align="center">
|
|
|
<template slot-scope="scope"><span>{{ scope.row.mockUrl }}</span></template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="method" min-min-width="60px">
|
|
|
- <template slot-scope="{row}"><span>{{ row.method }}</span></template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="返回值data类型" min-width="110px" align="center">
|
|
|
- <template slot-scope="scope"><span>{{ scope.row.returnDataTypeStr }}</span></template>
|
|
|
- </el-table-column>
|
|
|
+ <!--<el-table-column label="method" min-min-width="60px">-->
|
|
|
+ <!--<template slot-scope="{row}"><span>{{ row.method }}</span></template>-->
|
|
|
+ <!--</el-table-column>-->
|
|
|
+ <!--<el-table-column label="返回值data类型" min-width="110px" align="center">-->
|
|
|
+ <!--<template slot-scope="scope"><span>{{ scope.row.returnDataTypeStr }}</span></template>-->
|
|
|
+ <!--</el-table-column>-->
|
|
|
<el-table-column label="状态" class-name="status-col" min-width="100">
|
|
|
<template slot-scope="{row}"><el-tag :type="row.status | statusFilter">{{ statusMaps.get(row.status) }}</el-tag></template>
|
|
|
</el-table-column>
|
|
@@ -68,32 +68,44 @@
|
|
|
</el-table>
|
|
|
<pagination v-show="total>0" :total="total" :page.sync="listQuery.curIndex" :limit.sync="listQuery.pageSize" @pagination="getList" />
|
|
|
<el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" width="65%">
|
|
|
- <el-form ref="serviceDataForms" :rules="serviceDataRules" :model="serviceData" label-position="left" label-width="120px" style="width: 500px; margin-left:80px;">
|
|
|
+ <el-form ref="serviceDataForms" :rules="checkRequest" :model="serviceData" label-position="left" label-width="120px" style="width: 500px; margin-left:80px;">
|
|
|
<el-form-item label="接口名称" prop="customName">
|
|
|
<el-input v-model="serviceData.customName" :disabled="shouldShow" placeholder="接口名称" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="url" prop="url">
|
|
|
- <el-input v-model="serviceData.url" :disabled="shouldShow" placeholder="url" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="method" prop="method">
|
|
|
- <el-select v-model="serviceData.method" :disabled="shouldShow" class="filter-item" filterable clearable placeholder="method">
|
|
|
- <el-option v-for="item in envMethod" :key="item.str" :label="item.str" :value="item.str" />
|
|
|
- </el-select>
|
|
|
+ <el-input v-model="serviceData.url" :disabled="shouldShow" placeholder="/getUserinfo" />
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="返回值data类型" prop="returnDataType">
|
|
|
- <el-select v-model="serviceData.returnDataTypeStr" :disabled="shouldShow" class="filter-item" filterable clearable placeholder="data类型">
|
|
|
- <el-option v-for="item in envSelectDataType" :key="item.code" :label="item.msg" :value="item.code" />
|
|
|
- </el-select>
|
|
|
+ <!--<el-form-item label="method" prop="method">-->
|
|
|
+ <!--<el-select v-model="serviceData.method" :disabled="shouldShow" class="filter-item" filterable clearable placeholder="method">-->
|
|
|
+ <!--<el-option v-for="item in envMethod" :key="item.str" :label="item.str" :value="item.str" />-->
|
|
|
+ <!--</el-select>-->
|
|
|
+ <!--</el-form-item>-->
|
|
|
+ <!--<el-form-item label="返回值data类型" prop="returnDataType">-->
|
|
|
+ <!--<el-select v-model="serviceData.returnDataTypeStr" :disabled="shouldShow" class="filter-item" filterable clearable placeholder="data类型">-->
|
|
|
+ <!--<el-option v-for="item in envSelectDataType" :key="item.code" :label="item.msg" :value="item.code" />-->
|
|
|
+ <!--</el-select>-->
|
|
|
+ <!--</el-form-item>-->
|
|
|
+ <el-form-item label="请求转发" prop="forWard">
|
|
|
+ <el-switch
|
|
|
+ v-model="serviceData.requestForWard"
|
|
|
+ @change="showTrueUrl"
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="真实服务url" prop="actualUrl">
|
|
|
- <el-input v-model="serviceData.actualUrl" :disabled="shouldShow" placeholder="真实服务url" />
|
|
|
+ <el-form-item v-show="trueUrl" label="真实服务url" prop="actualUrl">
|
|
|
+ <el-input v-model="serviceData.actualUrl" :disabled="shouldShow" placeholder="http://10.179.1.22:8089" />
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
- <span class="showBtn" @mouseover="explain" @mouseout="explain">配置指南</span>
|
|
|
- <div v-if="showexplain" class="showInfo">
|
|
|
- <div class="showZm" />
|
|
|
- <div class="showInfo">配置指南</div>
|
|
|
- </div>
|
|
|
+ <span class="showBtn">
|
|
|
+ <a href="http://wiki.intra.xiaojukeji.com/pages/viewpage.action?pageId=213729138#id-11%E6%93%8D%E4%BD%9C%E6%89%8B%E5%86%8C-11%E6%93%8D%E4%BD%9C%E6%89%8B%E5%86%8C-%E4%B8%80%E3%80%81%E6%8E%A5%E5%85%A5httpmock" target="_blank">配置指南
|
|
|
+ </a>
|
|
|
+ </span>
|
|
|
+ <!--<div v-if="showexplain" class="showInfo">-->
|
|
|
+ <!--<div class="showZm" />-->
|
|
|
+ <!--<div class="showInfo">-->
|
|
|
+ <!--<a href="http://wiki.intra.xiaojukeji.com/pages/viewpage.action?pageId=213729138#id-11%E6%93%8D%E4%BD%9C%E6%89%8B%E5%86%8C-11%E6%93%8D%E4%BD%9C%E6%89%8B%E5%86%8C-%E4%B8%80%E3%80%81%E6%8E%A5%E5%85%A5httpmock" target="_blank">配置指南-->
|
|
|
+ <!--</a>-->
|
|
|
+ <!--</div>-->
|
|
|
+ <!--</div>-->
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button @click="dialogFormVisible = false">取消</el-button>
|
|
|
<el-button v-if="showSubmitBtn" type="primary" @click="dialogStatus==='create'?createData(serviceData):updateData(serviceData)">确定</el-button>
|
|
@@ -164,7 +176,8 @@ export default {
|
|
|
curIndex: 1,
|
|
|
pageSize: 20,
|
|
|
sort: '+id',
|
|
|
- id: null
|
|
|
+ id: null,
|
|
|
+ redirect: ''
|
|
|
},
|
|
|
importanceOptions: [1, 2, 3],
|
|
|
envSelectDataType: '',
|
|
@@ -197,7 +210,10 @@ export default {
|
|
|
id: '',
|
|
|
status: 1,
|
|
|
actualUrl: '',
|
|
|
- creator: ''
|
|
|
+ creator: '',
|
|
|
+ ruleDesc: '',
|
|
|
+ redirect: '',
|
|
|
+ requestForWard: false
|
|
|
},
|
|
|
serviceDataExt: {
|
|
|
id: 0
|
|
@@ -215,7 +231,23 @@ export default {
|
|
|
url: [{ required: true, message: 'url不能为空', trigger: 'change' }],
|
|
|
method: [{ required: true, message: 'method不能为空', trigger: 'change' }]
|
|
|
},
|
|
|
- downloadLoading: false
|
|
|
+ downloadLoading: false,
|
|
|
+ trueUrl: false,
|
|
|
+ serviceRequestFoward: {
|
|
|
+ customName: [{ required: true, message: '接口名称不能为空', trigger: 'change' }],
|
|
|
+ url: [{ required: true, message: 'url不能为空', trigger: 'change' }],
|
|
|
+ method: [{ required: true, message: 'method不能为空', trigger: 'change' }],
|
|
|
+ actualUrl: [{ required: true, message: '真实服务url不能为空', trigger: 'change' }]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ checkRequest: function() {
|
|
|
+ if (this.serviceData.requestForWard) {
|
|
|
+ return this.serviceRequestFoward
|
|
|
+ } else {
|
|
|
+ return this.serviceDataRules
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
@@ -233,13 +265,13 @@ export default {
|
|
|
this.listLoading = false
|
|
|
})
|
|
|
},
|
|
|
- explain() {
|
|
|
- if (this.showexplain === false) {
|
|
|
- this.showexplain = true
|
|
|
- } else {
|
|
|
- this.showexplain = false
|
|
|
- }
|
|
|
- },
|
|
|
+ // explain() {
|
|
|
+ // if (this.showexplain === false) {
|
|
|
+ // this.showexplain = true
|
|
|
+ // } else {
|
|
|
+ // this.showexplain = false
|
|
|
+ // }
|
|
|
+ // },
|
|
|
// 获取method方法
|
|
|
mockGetMethod() {
|
|
|
this.envMethod = []
|
|
@@ -314,7 +346,9 @@ export default {
|
|
|
id: '',
|
|
|
status: 1,
|
|
|
actualUrl: '',
|
|
|
- creator: ''
|
|
|
+ creator: '',
|
|
|
+ ruleDesc: '',
|
|
|
+ requestForWard: false
|
|
|
}
|
|
|
},
|
|
|
// hearder新增时调用
|
|
@@ -324,6 +358,8 @@ export default {
|
|
|
this.dialogStatus = 'create'
|
|
|
this.dialogFormVisible = true
|
|
|
this.showSubmitBtn = true
|
|
|
+ this.serviceData.requestForWard = false
|
|
|
+ this.trueUrl = false
|
|
|
this.$nextTick(() => {
|
|
|
this.$refs['serviceDataForms'].clearValidate()
|
|
|
})
|
|
@@ -334,7 +370,8 @@ export default {
|
|
|
if (valid) {
|
|
|
this.serviceData = ele
|
|
|
this.serviceData.id = ''
|
|
|
- this.serviceData.returnDataType === '' ? this.serviceData.returnDataType = '512' : this.serviceData.returnDataType = ele.returnDataTypeStr
|
|
|
+ this.serviceData.returnDataType === 512
|
|
|
+ if (this.serviceData.requestForWard) { this.serviceData.redirect = 1 } else { this.serviceData.redirect = 0 }
|
|
|
createService(this.serviceData).then(response => {
|
|
|
if (response.code === 200) {
|
|
|
this.dialogFormVisible = false
|
|
@@ -353,12 +390,13 @@ export default {
|
|
|
id: row.id,
|
|
|
url: row.url,
|
|
|
customName: row.customName,
|
|
|
- returnDataType: row.returnDataType,
|
|
|
+ returnDataType: '512',
|
|
|
actualUrl: row.actualUrl,
|
|
|
creator: row.creator,
|
|
|
method: row.method,
|
|
|
// returnDataTypeStr: row.returnDataTypeStr,
|
|
|
- mockUrl: row.mockUrl
|
|
|
+ mockUrl: row.mockUrl,
|
|
|
+ redirect: row.redirect
|
|
|
}
|
|
|
var rowList = row
|
|
|
this.shouldShow = false
|
|
@@ -374,9 +412,14 @@ export default {
|
|
|
this.serviceData.method = rowList.method
|
|
|
this.serviceData.returnDataTypeStr = rowList.returnDataTypeStr
|
|
|
this.serviceData.mockUrl = rowList.mockUrl
|
|
|
+ this.serviceData.redirect = row.redirect
|
|
|
+ if (this.serviceData.redirect === 1) { this.serviceData.requestForWard = true } else { this.serviceData.requestForWard = false }
|
|
|
+ this.serviceData.actualUrl = row.actualUrl
|
|
|
+ this.showTrueUrl()
|
|
|
this.dialogStatus = 'update'
|
|
|
this.dialogFormVisible = true
|
|
|
this.showSubmitBtn = true
|
|
|
+ this.requestForWard = false
|
|
|
this.$nextTick(() => {
|
|
|
this.$refs['serviceDataForms'].clearValidate()
|
|
|
})
|
|
@@ -386,7 +429,7 @@ export default {
|
|
|
// 查看
|
|
|
handleCheck(row) {
|
|
|
this.shouldShow = true
|
|
|
- this.serviceData = row
|
|
|
+ // this.serviceData = row
|
|
|
// var queryData = { id: row.id }
|
|
|
// fetchServiceList(queryData).then(response => {
|
|
|
// var rowData = response.data.mockMethodList
|
|
@@ -401,9 +444,16 @@ export default {
|
|
|
// this.serviceData.method = row.method
|
|
|
// this.serviceData.returnDataTypeStr = row.returnDataTypeStr
|
|
|
// this.serviceData.mockUrl = row.mockUrl
|
|
|
+ this.serviceData.customName = row.customName
|
|
|
this.dialogStatus = 'update'
|
|
|
this.dialogFormVisible = true
|
|
|
this.showSubmitBtn = false
|
|
|
+ // this.serviceData.redirect = 1
|
|
|
+ this.serviceData.redirect = row.redirect
|
|
|
+ if (this.serviceData.redirect === 1) { this.serviceData.requestForWard = true } else { this.serviceData.requestForWard = false }
|
|
|
+ this.serviceData.actualUrl = row.actualUrl
|
|
|
+ this.showTrueUrl()
|
|
|
+ // this.serviceData.requestForWard === 'true' ? this.serviceData.redirect === 1 : this.serviceData.redirect
|
|
|
// this.$nextTick(() => {
|
|
|
// this.$refs['serviceDataForms'].clearValidate()
|
|
|
// })
|
|
@@ -427,6 +477,10 @@ export default {
|
|
|
this.dialogStatus = 'create'
|
|
|
this.dialogFormVisible = true
|
|
|
this.showSubmitBtn = true
|
|
|
+ this.serviceData.redirect = row.redirect
|
|
|
+ if (this.serviceData.redirect === 1) { this.serviceData.requestForWard = true } else { this.serviceData.requestForWard = false }
|
|
|
+ this.serviceData.actualUrl = row.actualUrl
|
|
|
+ this.showTrueUrl()
|
|
|
// this.$nextTick(() => {
|
|
|
// this.$refs['serviceDataForms'].clearValidate()
|
|
|
// })
|
|
@@ -445,8 +499,9 @@ export default {
|
|
|
actualUrl: this.serviceData.actualUrl,
|
|
|
status: this.serviceData.status,
|
|
|
creator: this.serviceData.creator,
|
|
|
- returnDataType: ele.returnDataTypeStr,
|
|
|
- mockUrl: this.serviceData.mockUrl
|
|
|
+ returnDataType: '512',
|
|
|
+ mockUrl: this.serviceData.mockUrl,
|
|
|
+ redirect: this.serviceData.redirect
|
|
|
}
|
|
|
updateService(tempData).then(response => {
|
|
|
if (response.code === 200) {
|
|
@@ -474,6 +529,17 @@ export default {
|
|
|
this.$router.push({
|
|
|
path: `/mock/httpmock/${id}`, query: { mehtodName: mehtodName, methodProtocol: methodProtocol }
|
|
|
})
|
|
|
+ },
|
|
|
+ showTrueUrl() {
|
|
|
+ if (this.serviceData.requestForWard === true) {
|
|
|
+ this.trueUrl = true
|
|
|
+ this.serviceData.requestForWard = true
|
|
|
+ this.serviceData.redirect = 1
|
|
|
+ } else {
|
|
|
+ this.trueUrl = false
|
|
|
+ this.serviceData.requestForWard = false
|
|
|
+ this.serviceData.redirect = 0
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|