|
@@ -23,258 +23,107 @@
|
|
|
</div>
|
|
|
<div class="btn">
|
|
|
<!-- <el-button @click="deleteApp" class="r24" type="danger">删除</el-button> -->
|
|
|
- <el-button
|
|
|
- type="primary"
|
|
|
- @click="onSubmit"
|
|
|
- >保存</el-button>
|
|
|
+ <el-button type="primary" @click="onSubmit">保存</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="addApp-form-content dialog-public-background">
|
|
|
- <el-form
|
|
|
- ref="form"
|
|
|
- class="form"
|
|
|
- :rules="rules"
|
|
|
- :model="form"
|
|
|
- label-position="right"
|
|
|
- label-width="80px"
|
|
|
- >
|
|
|
+ <el-form ref="form" class="form" :rules="rules" :model="form" label-position="right" label-width="80px">
|
|
|
<div class="flex">
|
|
|
- <el-form-item
|
|
|
- label="应用名称"
|
|
|
- prop="name"
|
|
|
- >
|
|
|
- <el-input
|
|
|
- v-model.trim="form.name"
|
|
|
- placeholder="请输入应用名称"
|
|
|
- />
|
|
|
+ <el-form-item label="应用名称" prop="name">
|
|
|
+ <el-input v-model.trim="form.name" placeholder="请输入应用名称" />
|
|
|
</el-form-item>
|
|
|
- <el-form-item
|
|
|
- label="请求类型"
|
|
|
- prop="type"
|
|
|
- :rules="{ required: domains.length, message: '选择请求类型', trigger: ['change', 'blur'] }"
|
|
|
- >
|
|
|
- <el-select
|
|
|
- v-model="form.type"
|
|
|
- placeholder="请求类型"
|
|
|
- @change="typeChange"
|
|
|
- >
|
|
|
- <el-option
|
|
|
- label="get"
|
|
|
- :value="1"
|
|
|
- />
|
|
|
- <el-option
|
|
|
- label="post"
|
|
|
- :value="2"
|
|
|
- />
|
|
|
+ <el-form-item label="请求类型" prop="type" :rules="{ required: domains.length, message: '选择请求类型', trigger: ['change', 'blur'] }">
|
|
|
+ <el-select v-model="form.type" placeholder="请求类型" @change="typeChange">
|
|
|
+ <el-option label="get" :value="1" />
|
|
|
+ <el-option label="post" :value="2" />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
- <el-form-item
|
|
|
- label="参数类型"
|
|
|
- prop="app"
|
|
|
- :rules="{ required: form.type === 2 && domains.length, message: '请选择参数类型', trigger: ['change', 'blur'] }"
|
|
|
- >
|
|
|
- <el-select
|
|
|
- v-model="form.app"
|
|
|
- :disabled="typeFlag"
|
|
|
- placeholder="参数类型"
|
|
|
- >
|
|
|
- <el-option
|
|
|
- label="application/json"
|
|
|
- value="application/json"
|
|
|
- />
|
|
|
- <el-option
|
|
|
- label="application/text"
|
|
|
- value="application/text"
|
|
|
- />
|
|
|
+ <el-form-item label="参数类型" prop="app" :rules="{ required: form.type === 2 && domains.length, message: '请选择参数类型', trigger: ['change', 'blur'] }">
|
|
|
+ <el-select v-model="form.app" :disabled="typeFlag" placeholder="参数类型">
|
|
|
+ <el-option label="application/json" value="application/json" />
|
|
|
+ <el-option label="application/text" value="application/text" />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</div>
|
|
|
- <el-form-item
|
|
|
- label="应用地址"
|
|
|
- prop="url"
|
|
|
- class="url"
|
|
|
- >
|
|
|
- <el-input
|
|
|
- v-model.trim="form.url"
|
|
|
- placeholder="请输入应用地址"
|
|
|
- />
|
|
|
+ <el-form-item label="应用地址" prop="url" class="url">
|
|
|
+ <el-input v-model.trim="form.url" placeholder="请输入应用地址" />
|
|
|
</el-form-item>
|
|
|
- <el-form-item
|
|
|
- prop="desc"
|
|
|
- class="desc"
|
|
|
- label="描述"
|
|
|
- >
|
|
|
- <el-input
|
|
|
- v-model.trim="form.desc"
|
|
|
- type="textarea"
|
|
|
- rows="3"
|
|
|
- placeholder="请输入描述"
|
|
|
- />
|
|
|
+ <div class="flex-wrap">
|
|
|
+ <el-form-item label="加密类型" prop="algorithm">
|
|
|
+ <el-select v-model="form.algorithm" placeholder="加密类型">
|
|
|
+ <el-option v-for="(item,index) in algorithmDatas" :key="index" :label="item" :value="item" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <div style="margin-left:50px" class="flex1">
|
|
|
+ <el-form-item label="公匙" prop="publicKey">
|
|
|
+ <el-input v-model.trim="form.publicKey" placeholder="请输入公匙" />
|
|
|
+ </el-form-item>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <el-form-item prop="desc" class="desc" label="描述">
|
|
|
+ <el-input v-model.trim="form.desc" type="textarea" rows="3" placeholder="请输入描述" />
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<div class="addApp-form-title domain-title flex">
|
|
|
<div class="title">入参管理</div>
|
|
|
<div class="btn">
|
|
|
- <el-button
|
|
|
- type="primary"
|
|
|
- @click="addDomain"
|
|
|
- >新增</el-button>
|
|
|
+ <el-button type="primary" @click="addDomain">新增</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="addApp-form-content domain">
|
|
|
- <el-form
|
|
|
- ref="dynamicValidateForm"
|
|
|
- :model="dynamicValidateForm"
|
|
|
- label-width="80px"
|
|
|
- class="demo-dynamic"
|
|
|
- >
|
|
|
- <el-row
|
|
|
- v-for="(domain, index) in domains"
|
|
|
- :key="index"
|
|
|
- >
|
|
|
- <el-col
|
|
|
- :lg="{ span: '1-9' }"
|
|
|
- :sm="12"
|
|
|
- :xs="12"
|
|
|
- >
|
|
|
- <el-form-item
|
|
|
- label="入参名称"
|
|
|
- :prop="'domains.' + index + '.AppInputName'"
|
|
|
- :rules="[
|
|
|
+ <el-form ref="dynamicValidateForm" :model="dynamicValidateForm" label-width="80px" class="demo-dynamic">
|
|
|
+ <el-row v-for="(domain, index) in domains" :key="index">
|
|
|
+ <el-col :lg="{ span: '1-9' }" :sm="12" :xs="12">
|
|
|
+ <el-form-item label="入参名称" :prop="'domains.' + index + '.AppInputName'" :rules="[
|
|
|
{ required: true, message: '请输入入参名称', trigger: ['change', 'blur'] },
|
|
|
{ validator: lengthValidator, max: 64, message: '长度在 1 到 64 个字符', trigger: ['change', 'blur'] }
|
|
|
- ]"
|
|
|
- >
|
|
|
- <el-input
|
|
|
- v-model.trim="domain.AppInputName"
|
|
|
- placeholder="请输入最大64位入参名称"
|
|
|
- />
|
|
|
+ ]">
|
|
|
+ <el-input v-model.trim="domain.AppInputName" placeholder="请输入最大64位入参名称" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col
|
|
|
- :lg="{ span: '1-9' }"
|
|
|
- :sm="12"
|
|
|
- :xs="12"
|
|
|
- >
|
|
|
- <el-form-item
|
|
|
- label="入参描述"
|
|
|
- :prop="'domains.' + index + '.InputComment'"
|
|
|
- :rules="[
|
|
|
+ <el-col :lg="{ span: '1-9' }" :sm="12" :xs="12">
|
|
|
+ <el-form-item label="入参描述" :prop="'domains.' + index + '.InputComment'" :rules="[
|
|
|
{ required: true, message: '请输入入参描述', trigger: ['change', 'blur'] },
|
|
|
{ validator: lengthValidator, max: 64, message: '长度在 1 到 64 个字符', trigger: ['change', 'blur'] }
|
|
|
- ]"
|
|
|
- >
|
|
|
- <el-input
|
|
|
- v-model.trim="domain.InputComment"
|
|
|
- placeholder="请输入最大64位入参描述"
|
|
|
- />
|
|
|
+ ]">
|
|
|
+ <el-input v-model.trim="domain.InputComment" placeholder="请输入最大64位入参描述" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col
|
|
|
- :lg="{ span: '1-9' }"
|
|
|
- :sm="12"
|
|
|
- :xs="12"
|
|
|
- >
|
|
|
- <el-form-item
|
|
|
- label="入参类型"
|
|
|
- :prop="'domains.' + index + '.AppInputType'"
|
|
|
- :rules="{ required: form.type === 2, message: '请选择入参类型', trigger: ['change', 'blur'] }"
|
|
|
- >
|
|
|
- <el-select
|
|
|
- v-model="domain.AppInputType"
|
|
|
- :disabled="typeFlag"
|
|
|
- placeholder="入参类型"
|
|
|
- @change="value => inputTypeChange(value, index)"
|
|
|
- >
|
|
|
- <el-option
|
|
|
- label="string"
|
|
|
- value="string"
|
|
|
- />
|
|
|
- <el-option
|
|
|
- label="int"
|
|
|
- value="int"
|
|
|
- />
|
|
|
+ <el-col :lg="{ span: '1-9' }" :sm="12" :xs="12">
|
|
|
+ <el-form-item label="入参类型" :prop="'domains.' + index + '.AppInputType'" :rules="{ required: form.type === 2, message: '请选择入参类型', trigger: ['change', 'blur'] }">
|
|
|
+ <el-select v-model="domain.AppInputType" :disabled="typeFlag" placeholder="入参类型" @change="value => inputTypeChange(value, index)">
|
|
|
+ <el-option label="string" value="string" />
|
|
|
+ <el-option label="int" value="int" />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col
|
|
|
- :lg="{ span: '1-9' }"
|
|
|
- :sm="12"
|
|
|
- :xs="12"
|
|
|
- >
|
|
|
- <el-form-item
|
|
|
- label="入参位置"
|
|
|
- :prop="'domains.' + index + '.AppInputSite'"
|
|
|
- :rules="{ required: true, message: '请选择入参位置', trigger: ['change', 'blur'] }"
|
|
|
- >
|
|
|
- <el-select
|
|
|
- v-model="domain.AppInputSite"
|
|
|
- placeholder="入参位置"
|
|
|
- >
|
|
|
- <el-option
|
|
|
- v-if="form.type === 2"
|
|
|
- label="header"
|
|
|
- value="header"
|
|
|
- />
|
|
|
- <el-option
|
|
|
- v-if="form.type === 2"
|
|
|
- label="url"
|
|
|
- value="url"
|
|
|
- />
|
|
|
- <el-option
|
|
|
- label="body"
|
|
|
- value="body"
|
|
|
- />
|
|
|
+ <el-col :lg="{ span: '1-9' }" :sm="12" :xs="12">
|
|
|
+ <el-form-item label="入参位置" :prop="'domains.' + index + '.AppInputSite'" :rules="{ required: true, message: '请选择入参位置', trigger: ['change', 'blur'] }">
|
|
|
+ <el-select v-model="domain.AppInputSite" placeholder="入参位置">
|
|
|
+ <el-option v-if="form.type === 2" label="header" value="header" />
|
|
|
+ <el-option v-if="form.type === 2" label="url" value="url" />
|
|
|
+ <el-option label="body" value="body" />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col
|
|
|
- :lg="{ span: '1-9' }"
|
|
|
- :sm="12"
|
|
|
- :xs="12"
|
|
|
- >
|
|
|
- <el-form-item
|
|
|
- label="入参值"
|
|
|
- :prop="'domains.' + index + '.InputValue'"
|
|
|
- :rules="[
|
|
|
+ <el-col :lg="{ span: '1-9' }" :sm="12" :xs="12">
|
|
|
+ <el-form-item label="入参值" :prop="'domains.' + index + '.InputValue'" :rules="[
|
|
|
{ required: true, message: '请输入入参值', trigger: ['change', 'blur'] },
|
|
|
{ pattern: domain.AppInputType === 'int' ? /^[1-9][0-9]*$/ : /[\S]+/, message: domain.AppInputType === 'int' ? '请输入纯数字' : '请勿输入空格', trigger: ['change', 'blur'] },
|
|
|
{ validator: lengthValidator, max: 64, message: '长度在 1 到 64 个字符', trigger: ['change', 'blur'] }
|
|
|
- ]"
|
|
|
- >
|
|
|
+ ]">
|
|
|
<template v-if="domain.AppInputType === 'int'">
|
|
|
- <el-input
|
|
|
- v-model.trim="domain.InputValue"
|
|
|
- placeholder="请输入最大64位入参值"
|
|
|
- />
|
|
|
+ <el-input v-model.trim="domain.InputValue" placeholder="请输入最大64位入参值" />
|
|
|
</template>
|
|
|
<template v-else>
|
|
|
- <el-autocomplete
|
|
|
- ref="inputValue"
|
|
|
- v-model.trim="domain.InputValue"
|
|
|
- placeholder="请输入最大64位入参值"
|
|
|
- :fetch-suggestions="querySearch"
|
|
|
- >
|
|
|
- <i
|
|
|
- slot="suffix"
|
|
|
- class="el-icon-edit el-input__icon"
|
|
|
- @click="handleIconClick(index)"
|
|
|
- />
|
|
|
+ <el-autocomplete ref="inputValue" v-model.trim="domain.InputValue" placeholder="请输入最大64位入参值" :fetch-suggestions="querySearch">
|
|
|
+ <i slot="suffix" class="el-icon-edit el-input__icon" @click="handleIconClick(index)" />
|
|
|
</el-autocomplete>
|
|
|
</template>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col
|
|
|
- class="button-wrap"
|
|
|
- :lg="{ span: '0-5' }"
|
|
|
- :sm="12"
|
|
|
- :xs="12"
|
|
|
- >
|
|
|
- <el-button
|
|
|
- size="small"
|
|
|
- type="danger"
|
|
|
- @click.prevent="removeDomain(index)"
|
|
|
- >删除</el-button>
|
|
|
+ <el-col class="button-wrap" :lg="{ span: '0-5' }" :sm="12" :xs="12">
|
|
|
+ <el-button size="small" type="danger" @click.prevent="removeDomain(index)">删除</el-button>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
</el-form>
|
|
@@ -286,12 +135,7 @@
|
|
|
<div class="flex-wrap">
|
|
|
<div class="upload">
|
|
|
<div class="title">上传Logo</div>
|
|
|
- <el-upload
|
|
|
- action="https://jsonplaceholder.typicode.com/posts/"
|
|
|
- list-type="picture-card"
|
|
|
- :on-preview="handlePictureCardPreview"
|
|
|
- :on-remove="handleRemove"
|
|
|
- >
|
|
|
+ <el-upload action="https://jsonplaceholder.typicode.com/posts/" list-type="picture-card" :on-preview="handlePictureCardPreview" :on-remove="handleRemove">
|
|
|
<i class="el-icon-plus" />
|
|
|
</el-upload>
|
|
|
</div>
|
|
@@ -309,7 +153,7 @@ import { GetAppDetails, EditApp, DeleteApp } from '@/api/apiAuthority'
|
|
|
import { lengthValidator, regular } from '@/utils/validate'
|
|
|
export default {
|
|
|
name: 'Addapp',
|
|
|
- data() {
|
|
|
+ data () {
|
|
|
return {
|
|
|
form: {
|
|
|
// 应用表单
|
|
@@ -317,7 +161,9 @@ export default {
|
|
|
type: '',
|
|
|
app: '',
|
|
|
url: '',
|
|
|
- desc: ''
|
|
|
+ desc: '',
|
|
|
+ algorithm: '',
|
|
|
+ publicKey: ''
|
|
|
},
|
|
|
rules: {
|
|
|
// 表单验证
|
|
@@ -339,6 +185,7 @@ export default {
|
|
|
dialogImageUrl: '',
|
|
|
dialogVisible: false,
|
|
|
domains: [],
|
|
|
+ algorithmDatas: ['RS256', 'RS512', 'HS256', 'HS512', 'ES256', 'ES512', 'PS256', 'PS512'],
|
|
|
AppValues: [
|
|
|
{
|
|
|
value: 'token'
|
|
@@ -352,13 +199,13 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
- dynamicValidateForm() {
|
|
|
+ dynamicValidateForm () {
|
|
|
return {
|
|
|
domains: this.domains
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- created() {
|
|
|
+ created () {
|
|
|
const { AuthId, Status } = this.$route.query
|
|
|
this.radio = Status
|
|
|
this.AppId = AuthId
|
|
@@ -366,7 +213,7 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
lengthValidator,
|
|
|
- querySearch(queryString, callback) {
|
|
|
+ querySearch (queryString, callback) {
|
|
|
const AppValues = this.AppValues
|
|
|
const results = queryString
|
|
|
? AppValues.filter(AppValue => AppValue.value.toLowerCase().includes(queryString.toLowerCase()))
|
|
@@ -374,30 +221,32 @@ export default {
|
|
|
// 调用 callback 返回建议列表的数据
|
|
|
callback(results)
|
|
|
},
|
|
|
- handleIconClick(index) {
|
|
|
+ handleIconClick (index) {
|
|
|
this.$refs['inputValue'][index].focus()
|
|
|
},
|
|
|
- handleRemove(file, fileList) {
|
|
|
+ handleRemove (file, fileList) {
|
|
|
console.log(file, fileList)
|
|
|
},
|
|
|
- handlePictureCardPreview(file) {
|
|
|
+ handlePictureCardPreview (file) {
|
|
|
this.dialogImageUrl = file.url
|
|
|
this.dialogVisible = true
|
|
|
},
|
|
|
// 获取应用详情
|
|
|
- async getAppDetails(id) {
|
|
|
+ async getAppDetails (id) {
|
|
|
try {
|
|
|
const res = await GetAppDetails({
|
|
|
AppId: id
|
|
|
})
|
|
|
if (res.code === 0) {
|
|
|
- const { AppName, AppDesc, AppUrl, Inputs, RequestType, BodyType } = res.returnData
|
|
|
+ const { AppName, AppDesc, AppUrl, Inputs, RequestType, BodyType, PublicKey, Algorithm } = res.returnData
|
|
|
this.form.name = AppName
|
|
|
this.form.type = Number(RequestType) || ''
|
|
|
this.form.app = BodyType
|
|
|
this.form.desc = AppDesc
|
|
|
this.form.url = AppUrl
|
|
|
this.domains = Inputs
|
|
|
+ this.form.publicKey = PublicKey
|
|
|
+ this.form.algorithm = Algorithm
|
|
|
this.typeFlag = this.form.type === 1
|
|
|
} else {
|
|
|
this.$message.error(res.message)
|
|
@@ -422,7 +271,7 @@ export default {
|
|
|
// console.log('出错了', error)
|
|
|
// }
|
|
|
// },
|
|
|
- onSubmit() {
|
|
|
+ onSubmit () {
|
|
|
let submitEnable = true
|
|
|
this.$refs['form'].validate(valid => {
|
|
|
if (!valid) {
|
|
@@ -439,7 +288,7 @@ export default {
|
|
|
submitEnable && this.editApp()
|
|
|
},
|
|
|
// 应用状态变更
|
|
|
- async editApp() {
|
|
|
+ async editApp () {
|
|
|
try {
|
|
|
const res = await EditApp({
|
|
|
AppId: this.AppId,
|
|
@@ -449,7 +298,9 @@ export default {
|
|
|
RequestType: this.form.type,
|
|
|
BodyType: this.form.app,
|
|
|
Inputs: this.domains,
|
|
|
- DeleteInputs: this.deleteInputs
|
|
|
+ DeleteInputs: this.deleteInputs,
|
|
|
+ publicKey: this.form.publicKey,
|
|
|
+ algorithm: this.form.algorithm
|
|
|
})
|
|
|
if (res.code === 0) {
|
|
|
this.$message.success(res.message)
|
|
@@ -480,12 +331,12 @@ export default {
|
|
|
// console.log('出错了', error)
|
|
|
// }
|
|
|
// },
|
|
|
- removeDomain(index) {
|
|
|
+ removeDomain (index) {
|
|
|
const deleteInputs = this.domains.splice(index, 1)
|
|
|
const appInputId = deleteInputs[0].AppInputId
|
|
|
!this.deleteInputs.includes(appInputId) && this.deleteInputs.push(appInputId)
|
|
|
},
|
|
|
- addDomain() {
|
|
|
+ addDomain () {
|
|
|
const { type } = this.form
|
|
|
if (type === 1) {
|
|
|
this.domains.push({
|
|
@@ -516,7 +367,7 @@ export default {
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
- typeChange(val) {
|
|
|
+ typeChange (val) {
|
|
|
const datas = this.domains
|
|
|
if (val === 1) {
|
|
|
this.typeFlag = true
|
|
@@ -534,7 +385,7 @@ export default {
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
- inputTypeChange(value, index) {
|
|
|
+ inputTypeChange (value, index) {
|
|
|
this.$refs['dynamicValidateForm'].validateField('domains.' + index + '.InputValue')
|
|
|
}
|
|
|
}
|