|
@@ -68,7 +68,7 @@
|
|
|
</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>
|
|
@@ -91,7 +91,7 @@
|
|
|
@change="showTrueUrl">
|
|
|
</el-switch>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="真实服务url" prop="actualUrl" v-show="trueUrl">
|
|
|
+ <el-form-item label="真实服务url" prop="actualUrl" v-show="trueUrl" >
|
|
|
<el-input v-model="serviceData.actualUrl" :disabled="shouldShow" placeholder="http://10.179.1.22:8089" />
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
@@ -232,7 +232,13 @@ export default {
|
|
|
method: [{ required: true, message: 'method不能为空', trigger: 'change' }]
|
|
|
},
|
|
|
downloadLoading: false,
|
|
|
- trueUrl: 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' }]
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
@@ -240,6 +246,15 @@ export default {
|
|
|
this.mockDataTypes()
|
|
|
this.mockGetMethod()
|
|
|
},
|
|
|
+ computed: {
|
|
|
+ checkRequest: function() {
|
|
|
+ if (this.serviceData.requestForWard) {
|
|
|
+ return this.serviceRequestFoward
|
|
|
+ } else {
|
|
|
+ return this.serviceDataRules
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
methods: {
|
|
|
// 加载查询
|
|
|
getList() {
|
|
@@ -355,8 +370,8 @@ export default {
|
|
|
if (valid) {
|
|
|
this.serviceData = ele
|
|
|
this.serviceData.id = ''
|
|
|
- this.serviceData.returnDataType === '' ? this.serviceData.returnDataType = '512' : this.serviceData.returnDataType = ele.returnDataTypeStr
|
|
|
- if (this.serviceData.requestForWard) { this.serviceData.redirect = '1' } else { this.serviceData.redirect = '0' }
|
|
|
+ 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
|
|
@@ -429,6 +444,7 @@ 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
|
|
@@ -484,7 +500,8 @@ export default {
|
|
|
status: this.serviceData.status,
|
|
|
creator: this.serviceData.creator,
|
|
|
returnDataType: '512',
|
|
|
- mockUrl: this.serviceData.mockUrl
|
|
|
+ mockUrl: this.serviceData.mockUrl,
|
|
|
+ redirect: this.serviceData.redirect
|
|
|
}
|
|
|
updateService(tempData).then(response => {
|
|
|
if (response.code === 200) {
|
|
@@ -515,10 +532,13 @@ export default {
|
|
|
},
|
|
|
showTrueUrl() {
|
|
|
if (this.serviceData.requestForWard === true) {
|
|
|
- console.log('true')
|
|
|
this.trueUrl = true
|
|
|
+ this.serviceData.requestForWard = true
|
|
|
+ this.serviceData.redirect = 1
|
|
|
} else {
|
|
|
this.trueUrl = false
|
|
|
+ this.serviceData.requestForWard = false
|
|
|
+ this.serviceData.redirect = 0
|
|
|
}
|
|
|
}
|
|
|
}
|