[add] ASMS接口管理
This commit is contained in:
@@ -0,0 +1,148 @@
|
||||
<template>
|
||||
<j-modal
|
||||
:title="title"
|
||||
:width="drawerWidth"
|
||||
:visible="visible"
|
||||
:confirmLoading="confirmLoading"
|
||||
switchFullscreen
|
||||
@ok="handleOk"
|
||||
@cancel="handleCancel"
|
||||
:cancelText="$t('close')">
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<a-form-model ref="form" :model="model" :rules="validatorRules">
|
||||
<a-form-model-item
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
prop="apiName"
|
||||
label="api名称">
|
||||
<a-input placeholder="请输入api名称" v-model="model.apiName"/>
|
||||
</a-form-model-item>
|
||||
<a-form-model-item
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
prop="apiType"
|
||||
label="接口类型">
|
||||
<j-dict-select-tag v-model="model.apiType" placeholder="请选择接口类型" dict-code="asms_open_api_type">
|
||||
</j-dict-select-tag>
|
||||
</a-form-model-item>
|
||||
<a-form-model-item
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
prop="apiUrl"
|
||||
label="api路径">
|
||||
<a-input placeholder="请输入api路径" v-model="model.apiUrl"/>
|
||||
</a-form-model-item>
|
||||
<a-form-model-item
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
prop="apiType"
|
||||
label="数据字典id">
|
||||
<a-select v-model="model.dictId" placeholder="请选择数据字典id">
|
||||
<a-select-option v-for="item in dictList" :value="item.id" :key="item.id">{{ item.dictName }}</a-select-option>
|
||||
</a-select>
|
||||
</a-form-model-item>
|
||||
<a-form-model-item
|
||||
:labelCol="labelCol"
|
||||
:wrapperCol="wrapperCol"
|
||||
prop="queryParamJson"
|
||||
label="参数">
|
||||
<a-textarea :rows="10" placeholder="请输入参数" v-model="model.queryParamJson"/>
|
||||
</a-form-model-item>
|
||||
</a-form-model>
|
||||
</a-spin>
|
||||
</j-modal>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { addAsmsInterface, editAsmsInterface } from '@api/api'
|
||||
import { getAction } from '@api/manage'
|
||||
|
||||
export default {
|
||||
name: 'AsmsInterfaceModal',
|
||||
data () {
|
||||
return {
|
||||
title: this.$t('add'),
|
||||
drawerWidth: 600,
|
||||
visible: false,
|
||||
model: {},
|
||||
labelCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 7 }
|
||||
},
|
||||
wrapperCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 16 }
|
||||
},
|
||||
confirmLoading: false,
|
||||
validatorRules: {},
|
||||
dictList: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
add () {
|
||||
this.edit({})
|
||||
},
|
||||
edit (record) {
|
||||
this.visiblekey = !!record.id
|
||||
this.model = Object.assign({}, record)
|
||||
this.visible = true
|
||||
},
|
||||
// 确定
|
||||
handleOk () {
|
||||
const that = this
|
||||
// 触发表单验证
|
||||
this.$refs.form.validate(valid => {
|
||||
if (valid) {
|
||||
that.confirmLoading = true
|
||||
let obj
|
||||
const formData = Object.assign({}, this.model)
|
||||
if (!this.model.id) {
|
||||
obj = addAsmsInterface
|
||||
} else {
|
||||
obj = editAsmsInterface
|
||||
}
|
||||
obj(formData).then((res) => {
|
||||
if (res.success) {
|
||||
that.$message.success(res.message)
|
||||
that.$emit('ok')
|
||||
} else {
|
||||
that.$message.warning(res.message)
|
||||
}
|
||||
}).finally(() => {
|
||||
that.confirmLoading = false
|
||||
that.close()
|
||||
})
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
},
|
||||
// 关闭
|
||||
handleCancel () {
|
||||
this.close()
|
||||
},
|
||||
close () {
|
||||
this.$emit('close')
|
||||
this.visible = false
|
||||
this.$refs.form.resetFields()
|
||||
},
|
||||
getDictList () {
|
||||
getAction('/sys/dict/page', {
|
||||
pageNo: -1,
|
||||
pageSize: -1
|
||||
}).then(res => {
|
||||
if (res.success) {
|
||||
this.dictList = (res.result && res.result.records) || []
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.getDictList()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
Reference in New Issue
Block a user