|
@@ -1,7 +1,7 @@
|
|
|
<!--
|
|
|
* @Author: your name
|
|
|
* @Date: 2021-11-29 09:18:04
|
|
|
- * @LastEditTime: 2022-03-17 14:09:47
|
|
|
+ * @LastEditTime: 2022-03-25 16:38:03
|
|
|
* @LastEditors: your name
|
|
|
* @Description: 新增/编辑应用
|
|
|
* @FilePath: \Foshan4A2.0\src\views\authorityManagement\components\addApp.vue
|
|
@@ -23,72 +23,245 @@
|
|
|
</div>
|
|
|
<div class="btn">
|
|
|
<!-- <el-button @click="deleteApp" class="r24" type="danger">删除</el-button> -->
|
|
|
- <el-button @click="onSubmit('form')" type="primary">保存</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 prop="name" label="应用名称">
|
|
|
- <el-input placeholder="请输入应用名称" v-model.trim="form.name"></el-input>
|
|
|
+ <el-form-item
|
|
|
+ label="应用名称"
|
|
|
+ prop="name"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-model.trim="form.name"
|
|
|
+ placeholder="请输入应用名称"
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="请求类型">
|
|
|
- <el-select @change="typeChange" v-model="form.id" placeholder="请求类型">
|
|
|
- <el-option label="get" :value="1"></el-option>
|
|
|
- <el-option label="post" :value="2"></el-option>
|
|
|
+ <el-form-item
|
|
|
+ label="请求类型"
|
|
|
+ prop="type"
|
|
|
+ :required="true"
|
|
|
+ >
|
|
|
+ <el-select
|
|
|
+ v-model="form.type"
|
|
|
+ placeholder="请求类型"
|
|
|
+ @change="typeChange"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ label="get"
|
|
|
+ :value="1"
|
|
|
+ />
|
|
|
+ <el-option
|
|
|
+ label="post"
|
|
|
+ :value="2"
|
|
|
+ />
|
|
|
</el-select>
|
|
|
- <!-- <el-input placeholder="请输入APPID" disabled v-model="form.id"></el-input> -->
|
|
|
</el-form-item>
|
|
|
- <el-form-item prop="app" label="参数类型">
|
|
|
- <el-select :disabled="typeFlag" v-model="form.app" placeholder="参数类型">
|
|
|
- <el-option label="application/json" value="application/json"></el-option>
|
|
|
- <el-option label="application/text" value="application/text"></el-option>
|
|
|
+ <el-form-item
|
|
|
+ label="参数类型"
|
|
|
+ prop="app"
|
|
|
+ :required="form.type === 2"
|
|
|
+ >
|
|
|
+ <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-input placeholder="请输入参数类型" v-model.trim="form.app"></el-input> -->
|
|
|
</el-form-item>
|
|
|
</div>
|
|
|
- <el-form-item class="url" prop="url" label="应用地址">
|
|
|
- <el-input placeholder="请输入应用地址" v-model.trim="form.url"></el-input>
|
|
|
+ <el-form-item
|
|
|
+ class="url"
|
|
|
+ prop="url"
|
|
|
+ label="应用地址"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-model.trim="form.url"
|
|
|
+ placeholder="请输入应用地址"
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
- <el-form-item prop="desc" class="desc" label="描述">
|
|
|
- <el-input type="textarea" rows="3" placeholder="请输入描述" v-model.trim="form.desc"></el-input>
|
|
|
+ <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 @click="addDomain" type="primary">新增</el-button>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ @click="addDomain"
|
|
|
+ >新增</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="addApp-form-content domain">
|
|
|
- <el-form :model="dynamicValidateForm" ref="dynamicValidateForm" label-width="85px" class="demo-dynamic">
|
|
|
- <div class="flex" v-for="(domain, index) in dynamicValidateForm.domains" :key="index">
|
|
|
- <div class="flex-wrap">
|
|
|
- <el-form-item label="入参名称" :prop="'domains.' + index + '.name'">
|
|
|
- <el-input placeholder="请输入最大64位参数名称" maxlength="64" v-model.trim="domain.AppInputName"></el-input>
|
|
|
+ <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'] }"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-model.trim="domain.AppInputName"
|
|
|
+ placeholder="请输入最大64位参数名称"
|
|
|
+ maxlength="64"
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="入参值" :prop="'domains.' + index + '.value'">
|
|
|
- <el-input placeholder="请输入最大64位参数值" maxlength="64" v-model.trim="domain.AppInputValue"></el-input>
|
|
|
+ </el-col>
|
|
|
+ <el-col
|
|
|
+ :lg="{ span: '1-9' }"
|
|
|
+ :sm="12"
|
|
|
+ :xs="12"
|
|
|
+ >
|
|
|
+ <el-form-item
|
|
|
+ label="参数描述"
|
|
|
+ :prop="'domains.' + index + '.InputComment'"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-model.trim="domain.InputComment"
|
|
|
+ placeholder="请输入最大64位参数描述"
|
|
|
+ maxlength="64"
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="入参类型" :prop="'domains.' + index + '.type'">
|
|
|
- <el-select v-model="domain.AppInputType" :disabled="typeFlag" placeholder="参数类型">
|
|
|
- <el-option label="string" value="string"></el-option>
|
|
|
- <el-option label="int" value="int"></el-option>
|
|
|
+ </el-col>
|
|
|
+ <el-col
|
|
|
+ :lg="{ span: '1-9' }"
|
|
|
+ :sm="12"
|
|
|
+ :xs="12"
|
|
|
+ >
|
|
|
+ <el-form-item
|
|
|
+ label="参数类型"
|
|
|
+ :prop="'domains.' + index + '.AppInputType'"
|
|
|
+ >
|
|
|
+ <el-select
|
|
|
+ v-model="domain.AppInputType"
|
|
|
+ :disabled="typeFlag"
|
|
|
+ placeholder="参数类型"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ label="string"
|
|
|
+ value="string"
|
|
|
+ />
|
|
|
+ <el-option
|
|
|
+ label="int"
|
|
|
+ value="int"
|
|
|
+ />
|
|
|
</el-select>
|
|
|
<!-- <el-input placeholder="请输入最大8位参数类型" maxlength="8" v-model.trim="domain.AppInputType"></el-input> -->
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="入参位置" :prop="'domains.' + index + '.place'">
|
|
|
- <el-select v-model="domain.AppInputSite" placeholder="参数位置">
|
|
|
- <el-option label="header" value="header"></el-option>
|
|
|
- <el-option label="body" value="body"></el-option>
|
|
|
+ </el-col>
|
|
|
+ <el-col
|
|
|
+ :lg="{ span: '1-9' }"
|
|
|
+ :sm="12"
|
|
|
+ :xs="12"
|
|
|
+ >
|
|
|
+ <el-form-item
|
|
|
+ label="参数位置"
|
|
|
+ :prop="'domains.' + index + '.AppInputSite'"
|
|
|
+ >
|
|
|
+ <el-select
|
|
|
+ v-model="domain.AppInputSite"
|
|
|
+ placeholder="参数位置"
|
|
|
+ :disabled="typeFlag"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-if="form.type === 1"
|
|
|
+ label="url"
|
|
|
+ value="url"
|
|
|
+ />
|
|
|
+ <el-option
|
|
|
+ v-if="form.type === 2"
|
|
|
+ label="header"
|
|
|
+ value="header"
|
|
|
+ />
|
|
|
+ <el-option
|
|
|
+ v-if="form.type === 2"
|
|
|
+ label="body"
|
|
|
+ value="body"
|
|
|
+ />
|
|
|
</el-select>
|
|
|
<!-- <el-input placeholder="请输入最大8位参数位置" maxlength="8" v-model.trim="domain.AppInputSite"></el-input> -->
|
|
|
</el-form-item>
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- <el-button size="small" type="danger" @click.prevent="removeDomain(domain)">删除</el-button>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+ </el-col>
|
|
|
+ <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'] }"
|
|
|
+ >
|
|
|
+ <el-autocomplete
|
|
|
+ ref="inputValue"
|
|
|
+ v-model.trim="domain.InputValue"
|
|
|
+ placeholder="请输入参数值"
|
|
|
+ :fetch-suggestions="querySearch"
|
|
|
+ >
|
|
|
+ <i
|
|
|
+ slot="suffix"
|
|
|
+ class="el-icon-edit el-input__icon"
|
|
|
+ @click="handleIconClick(index)"
|
|
|
+ />
|
|
|
+ </el-autocomplete>
|
|
|
+ </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>
|
|
|
+ </el-row>
|
|
|
</el-form>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -98,8 +271,13 @@
|
|
|
<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">
|
|
|
- <i class="el-icon-plus"></i>
|
|
|
+ <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>
|
|
|
<div class="preview">
|
|
@@ -112,29 +290,24 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import {
|
|
|
- GetAppDetails,
|
|
|
- EditApp,
|
|
|
- UpdateAppStatus,
|
|
|
- DeleteApp,
|
|
|
-} from "@/api/apiAuthority";
|
|
|
+import { GetAppDetails, EditApp, DeleteApp } from '@/api/apiAuthority'
|
|
|
import { lengthValidator } from '@/utils/validate'
|
|
|
export default {
|
|
|
- name: "Addapp",
|
|
|
- data () {
|
|
|
+ name: 'Addapp',
|
|
|
+ data() {
|
|
|
return {
|
|
|
form: {
|
|
|
- //应用表单
|
|
|
- name: "",
|
|
|
- id: "",
|
|
|
- app: "",
|
|
|
- url: "",
|
|
|
- desc: "",
|
|
|
+ // 应用表单
|
|
|
+ name: '',
|
|
|
+ type: '',
|
|
|
+ app: '',
|
|
|
+ url: '',
|
|
|
+ desc: ''
|
|
|
},
|
|
|
rules: {
|
|
|
- //表单验证
|
|
|
+ // 表单验证
|
|
|
name: [
|
|
|
- { required: true, message: "请输入应用名称", trigger: "blur" },
|
|
|
+ { required: true, message: '请输入应用名称', trigger: 'blur' },
|
|
|
{ validator: lengthValidator, max: 128, message: '长度在 1 到 128 个字符', trigger: ['change', 'blur'] }
|
|
|
],
|
|
|
url: [{ validator: lengthValidator, max: 512, message: '长度在 1 到 512 个字符', trigger: ['change', 'blur'] }],
|
|
@@ -144,156 +317,200 @@ export default {
|
|
|
],
|
|
|
app: [{ validator: lengthValidator, max: 32, message: '长度在 1 到 32 个字符', trigger: ['change', 'blur'] }]
|
|
|
},
|
|
|
- radio: 1,
|
|
|
+ // radio: 1,
|
|
|
AppId: null,
|
|
|
- type: null, //参数类型
|
|
|
- dialogImageUrl: "",
|
|
|
+ dialogImageUrl: '',
|
|
|
dialogVisible: false,
|
|
|
- dynamicValidateForm: {
|
|
|
- domains: [{
|
|
|
+ domains: [
|
|
|
+ {
|
|
|
AppInputName: '',
|
|
|
+ InputComment: '',
|
|
|
AppInputType: '',
|
|
|
AppInputSite: '',
|
|
|
- AppInputValue: ''
|
|
|
- }]
|
|
|
- },
|
|
|
+ InputValue: ''
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ AppValues: [
|
|
|
+ {
|
|
|
+ value: 'token'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: 'loginName'
|
|
|
+ }
|
|
|
+ ],
|
|
|
typeFlag: false
|
|
|
- };
|
|
|
+ }
|
|
|
},
|
|
|
- created () {
|
|
|
- const { AuthId, Status } = this.$route.query;
|
|
|
- this.radio = Status;
|
|
|
- this.AppId = AuthId;
|
|
|
- this.getAppDetails(AuthId);
|
|
|
+ computed: {
|
|
|
+ dynamicValidateForm() {
|
|
|
+ return {
|
|
|
+ domains: this.domains
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ const { AuthId, Status } = this.$route.query
|
|
|
+ this.radio = Status
|
|
|
+ this.AppId = AuthId
|
|
|
+ this.getAppDetails(AuthId)
|
|
|
},
|
|
|
methods: {
|
|
|
- handleRemove (file, fileList) {
|
|
|
- console.log(file, fileList);
|
|
|
+ querySearch(queryString, callback) {
|
|
|
+ const AppValues = this.AppValues
|
|
|
+ const results = queryString
|
|
|
+ ? AppValues.filter(AppValue => AppValue.value.toLowerCase().includes(queryString.toLowerCase()))
|
|
|
+ : AppValues
|
|
|
+ // 调用 callback 返回建议列表的数据
|
|
|
+ callback(results)
|
|
|
+ },
|
|
|
+ handleIconClick(index) {
|
|
|
+ this.$refs['inputValue'][index].focus()
|
|
|
+ },
|
|
|
+ handleRemove(file, fileList) {
|
|
|
+ console.log(file, fileList)
|
|
|
},
|
|
|
- handlePictureCardPreview (file) {
|
|
|
- this.dialogImageUrl = file.url;
|
|
|
- this.dialogVisible = true;
|
|
|
+ handlePictureCardPreview(file) {
|
|
|
+ this.dialogImageUrl = file.url
|
|
|
+ this.dialogVisible = true
|
|
|
},
|
|
|
- //获取应用详情
|
|
|
- async getAppDetails (id) {
|
|
|
+ // 获取应用详情
|
|
|
+ async getAppDetails(id) {
|
|
|
try {
|
|
|
const res = await GetAppDetails({
|
|
|
- AppId: id,
|
|
|
- });
|
|
|
+ AppId: id
|
|
|
+ })
|
|
|
if (res.code === 0) {
|
|
|
- const { AppName, AppShowId, AppShowSecret, AppDesc, AppUrl, Inputs, RequestType, BodyType } =
|
|
|
- res.returnData;
|
|
|
- this.form.name = AppName;
|
|
|
- // this.form.id = AppShowId;
|
|
|
- // this.form.app = AppShowSecret;
|
|
|
- this.form.id = Number(RequestType) || '';
|
|
|
- this.form.app = BodyType;
|
|
|
- this.form.desc = AppDesc;
|
|
|
- this.form.url = AppUrl;
|
|
|
- this.dynamicValidateForm.domains = Inputs;
|
|
|
- this.typeFlag = this.form.id ? true : false;
|
|
|
+ const { AppName, AppDesc, AppUrl, Inputs, RequestType, BodyType } = 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.typeFlag = this.form.type === 1
|
|
|
} else {
|
|
|
- this.$message.error(res.message);
|
|
|
+ this.$message.error(res.message)
|
|
|
}
|
|
|
} catch (error) {
|
|
|
- console.log("出错了", error);
|
|
|
+ console.log('出错了', error)
|
|
|
}
|
|
|
},
|
|
|
- //应用状态变更
|
|
|
- async handleChange (val) {
|
|
|
- try {
|
|
|
- const res = await UpdateAppStatus({
|
|
|
- AppId: this.AppId,
|
|
|
- Status: val,
|
|
|
- });
|
|
|
- if (res.code === 0) {
|
|
|
- this.$message.success(res.message);
|
|
|
- } else {
|
|
|
- this.$message.error(res.message);
|
|
|
+ // 应用状态变更
|
|
|
+ // async handleChange(val) {
|
|
|
+ // try {
|
|
|
+ // const res = await UpdateAppStatus({
|
|
|
+ // AppId: this.AppId,
|
|
|
+ // Status: val
|
|
|
+ // })
|
|
|
+ // if (res.code === 0) {
|
|
|
+ // this.$message.success(res.message)
|
|
|
+ // } else {
|
|
|
+ // this.$message.error(res.message)
|
|
|
+ // }
|
|
|
+ // } catch (error) {
|
|
|
+ // console.log('出错了', error)
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ onSubmit() {
|
|
|
+ let submitEnable = true
|
|
|
+ this.$refs['form'].validate(valid => {
|
|
|
+ if (!valid) {
|
|
|
+ submitEnable = false
|
|
|
+ return false
|
|
|
}
|
|
|
- } catch (error) {
|
|
|
- console.log("出错了", error);
|
|
|
- }
|
|
|
- },
|
|
|
- onSubmit (formName) {
|
|
|
- this.$refs[formName].validate((valid) => {
|
|
|
- if (valid) {
|
|
|
- this.editApp();
|
|
|
- } else {
|
|
|
- return false;
|
|
|
+ })
|
|
|
+ this.$refs['dynamicValidateForm'].validate(valid => {
|
|
|
+ if (!valid) {
|
|
|
+ submitEnable = false
|
|
|
+ return false
|
|
|
}
|
|
|
- });
|
|
|
+ })
|
|
|
+ submitEnable && this.editApp()
|
|
|
},
|
|
|
- //应用状态变更
|
|
|
- async editApp () {
|
|
|
+ // 应用状态变更
|
|
|
+ async editApp() {
|
|
|
try {
|
|
|
const res = await EditApp({
|
|
|
AppId: this.AppId,
|
|
|
AppDesc: this.form.desc,
|
|
|
AppName: this.form.name,
|
|
|
AppUrl: this.form.url,
|
|
|
- RequestType: this.form.id,
|
|
|
+ RequestType: this.form.type,
|
|
|
BodyType: this.form.app,
|
|
|
- Inputs: this.dynamicValidateForm.domains
|
|
|
- });
|
|
|
+ Inputs: this.domains
|
|
|
+ })
|
|
|
if (res.code === 0) {
|
|
|
- this.$message.success(res.message);
|
|
|
- this.$store.dispatch("tagsView/delView", this.$route);
|
|
|
- this.$router.push("/authority");
|
|
|
+ this.$message.success(res.message)
|
|
|
+ this.$store.dispatch('tagsView/delView', this.$route)
|
|
|
+ this.$router.push('/authority')
|
|
|
} else {
|
|
|
- this.$message.error(res.message);
|
|
|
+ this.$message.error(res.message)
|
|
|
}
|
|
|
} catch (error) {
|
|
|
- console.log("出错了", error);
|
|
|
+ console.log('出错了', error)
|
|
|
}
|
|
|
},
|
|
|
- //应用删除
|
|
|
- async deleteApp () {
|
|
|
+ // 应用删除
|
|
|
+ async deleteApp() {
|
|
|
try {
|
|
|
const res = await DeleteApp({
|
|
|
- AppId: this.AppId,
|
|
|
- });
|
|
|
+ AppId: this.AppId
|
|
|
+ })
|
|
|
if (res.code === 0) {
|
|
|
- this.$message.success(res.message);
|
|
|
+ this.$message.success(res.message)
|
|
|
setTimeout(() => {
|
|
|
- this.$router.push("/authority");
|
|
|
- }, 2000);
|
|
|
+ this.$router.push('/authority')
|
|
|
+ }, 2000)
|
|
|
} else {
|
|
|
- this.$message.error(res.message);
|
|
|
+ this.$message.error(res.message)
|
|
|
}
|
|
|
} catch (error) {
|
|
|
- console.log("出错了", error);
|
|
|
+ console.log('出错了', error)
|
|
|
}
|
|
|
},
|
|
|
- removeDomain (item) {
|
|
|
- var index = this.dynamicValidateForm.domains.indexOf(item)
|
|
|
- if (index !== -1) {
|
|
|
- this.dynamicValidateForm.domains.splice(index, 1)
|
|
|
- }
|
|
|
+ removeDomain(index) {
|
|
|
+ this.domains.splice(index, 1)
|
|
|
},
|
|
|
- addDomain () {
|
|
|
- this.dynamicValidateForm.domains.push({
|
|
|
- AppInputName: '',
|
|
|
- AppInputType: '',
|
|
|
- AppInputSite: '',
|
|
|
- AppInputValue: '',
|
|
|
- AppId: this.AppId
|
|
|
- });
|
|
|
+ addDomain() {
|
|
|
+ const { type } = this.form
|
|
|
+ if (type === 1) {
|
|
|
+ this.domains.push({
|
|
|
+ AppInputName: '',
|
|
|
+ InputComment: '',
|
|
|
+ AppInputType: 'string',
|
|
|
+ AppInputSite: 'url',
|
|
|
+ InputValue: ''
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.domains.push({
|
|
|
+ AppInputName: '',
|
|
|
+ InputComment: '',
|
|
|
+ AppInputType: 'string',
|
|
|
+ AppInputSite: 'body',
|
|
|
+ InputValue: '',
|
|
|
+ AppId: this.AppId
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
- typeChange (val) {
|
|
|
- const datas = this.dynamicValidateForm.domains
|
|
|
- if (val == 1) {
|
|
|
- this.typeFlag = true;
|
|
|
- this.form.app = '';
|
|
|
+ typeChange(val) {
|
|
|
+ const datas = this.domains
|
|
|
+ if (val === 1) {
|
|
|
+ this.typeFlag = true
|
|
|
+ this.form.app = ''
|
|
|
datas.forEach(item => {
|
|
|
- item.AppInputType = 'string';
|
|
|
+ item.AppInputType = 'string'
|
|
|
+ item.AppInputSite = 'url'
|
|
|
})
|
|
|
} else {
|
|
|
- this.typeFlag = false;
|
|
|
+ this.typeFlag = false
|
|
|
+ this.form.app = 'application/json'
|
|
|
+ datas.forEach(item => {
|
|
|
+ item.AppInputSite = 'body'
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
- },
|
|
|
-};
|
|
|
+ }
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
@@ -349,6 +566,20 @@ export default {
|
|
|
position: relative;
|
|
|
top: 4px;
|
|
|
}
|
|
|
+ @media (min-width: 1200px) {
|
|
|
+ .el-col-lg-1-9 {
|
|
|
+ width: 19%;
|
|
|
+ }
|
|
|
+ .el-col-lg-0-5 {
|
|
|
+ width: 5%;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .button-wrap {
|
|
|
+ text-align: right;
|
|
|
+ }
|
|
|
+ .el-icon-edit {
|
|
|
+ cursor: text;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
.domain-title {
|