接口命名统一
This commit is contained in:
parent
c545c3008f
commit
b07cc98619
@ -12,6 +12,13 @@ export interface ConfigVO {
|
|||||||
createTime: Date
|
createTime: Date
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ConfigPageReqVO extends PageParam {
|
||||||
|
name?: string
|
||||||
|
key?: string
|
||||||
|
type?: number
|
||||||
|
createTime?: Date[]
|
||||||
|
}
|
||||||
|
|
||||||
export interface ConfigExportReqVO {
|
export interface ConfigExportReqVO {
|
||||||
name?: string
|
name?: string
|
||||||
key?: string
|
key?: string
|
||||||
@ -20,32 +27,32 @@ export interface ConfigExportReqVO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 查询参数列表
|
// 查询参数列表
|
||||||
export const getConfigPage = (params: PageParam) => {
|
export const getConfigPageApi = (params: ConfigPageReqVO) => {
|
||||||
return request.get({ url: '/infra/config/page', params })
|
return request.get({ url: '/infra/config/page', params })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询参数详情
|
// 查询参数详情
|
||||||
export const getConfig = (id: number) => {
|
export const getConfigApi = (id: number) => {
|
||||||
return request.get({ url: '/infra/config/get?id=' + id })
|
return request.get({ url: '/infra/config/get?id=' + id })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 根据参数键名查询参数值
|
// 根据参数键名查询参数值
|
||||||
export const getConfigKey = (configKey: string) => {
|
export const getConfigKeyApi = (configKey: string) => {
|
||||||
return request.get({ url: '/infra/config/get-value-by-key?key=' + configKey })
|
return request.get({ url: '/infra/config/get-value-by-key?key=' + configKey })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 新增参数
|
// 新增参数
|
||||||
export const createConfig = (data: ConfigVO) => {
|
export const createConfigApi = (data: ConfigVO) => {
|
||||||
return request.post({ url: '/infra/config/create', data })
|
return request.post({ url: '/infra/config/create', data })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改参数
|
// 修改参数
|
||||||
export const updateConfig = (data: ConfigVO) => {
|
export const updateConfigApi = (data: ConfigVO) => {
|
||||||
return request.put({ url: '/infra/config/update', data })
|
return request.put({ url: '/infra/config/update', data })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除参数
|
// 删除参数
|
||||||
export const deleteConfig = (id: number) => {
|
export const deleteConfigApi = (id: number) => {
|
||||||
return request.delete({ url: '/infra/config/delete?id=' + id })
|
return request.delete({ url: '/infra/config/delete?id=' + id })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,9 +20,7 @@
|
|||||||
<!-- 弹窗:表单预览 -->
|
<!-- 弹窗:表单预览 -->
|
||||||
<Dialog :title="dialogTitle" v-model="dialogVisible" max-height="600">
|
<Dialog :title="dialogTitle" v-model="dialogVisible" max-height="600">
|
||||||
<div ref="editor" v-if="dialogVisible">
|
<div ref="editor" v-if="dialogVisible">
|
||||||
<el-button style="float: right" @click="copy(formData)">
|
<XTextButton style="float: right" :title="t('common.copy')" @click="copy(formData)" />
|
||||||
{{ t('common.copy') }}
|
|
||||||
</el-button>
|
|
||||||
<el-scrollbar height="580">
|
<el-scrollbar height="580">
|
||||||
<div>
|
<div>
|
||||||
<pre><code class="hljs" v-html="highlightedCode(formData)"></code></pre>
|
<pre><code class="hljs" v-html="highlightedCode(formData)"></code></pre>
|
||||||
@ -35,7 +33,7 @@
|
|||||||
import FcDesigner from '@form-create/designer'
|
import FcDesigner from '@form-create/designer'
|
||||||
// import { useClipboard } from '@vueuse/core'
|
// import { useClipboard } from '@vueuse/core'
|
||||||
import { isString } from '@/utils/is'
|
import { isString } from '@/utils/is'
|
||||||
|
import formCreate from '@form-create/element-ui'
|
||||||
import hljs from 'highlight.js' // 导入代码高亮文件
|
import hljs from 'highlight.js' // 导入代码高亮文件
|
||||||
import 'highlight.js/styles/github.css' // 导入代码高亮样式
|
import 'highlight.js/styles/github.css' // 导入代码高亮样式
|
||||||
import xml from 'highlight.js/lib/languages/java'
|
import xml from 'highlight.js/lib/languages/java'
|
||||||
|
@ -93,8 +93,8 @@ const message = useMessage() // 消息弹窗
|
|||||||
// 列表相关的变量
|
// 列表相关的变量
|
||||||
const [registerTable, { reload, deleteData, exportList }] = useXTable({
|
const [registerTable, { reload, deleteData, exportList }] = useXTable({
|
||||||
allSchemas: allSchemas,
|
allSchemas: allSchemas,
|
||||||
getListApi: ConfigApi.getConfigPage,
|
getListApi: ConfigApi.getConfigPageApi,
|
||||||
deleteApi: ConfigApi.deleteConfig,
|
deleteApi: ConfigApi.deleteConfigApi,
|
||||||
exportListApi: ConfigApi.exportConfigApi
|
exportListApi: ConfigApi.exportConfigApi
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -117,7 +117,6 @@ const setDialogTile = (type: string) => {
|
|||||||
const handleCreate = async () => {
|
const handleCreate = async () => {
|
||||||
setDialogTile('create')
|
setDialogTile('create')
|
||||||
await nextTick()
|
await nextTick()
|
||||||
console.log(allSchemas.formSchema, 'allSchemas.formSchema')
|
|
||||||
if (allSchemas.formSchema[2].field !== 'key') {
|
if (allSchemas.formSchema[2].field !== 'key') {
|
||||||
unref(formRef)?.addSchema(
|
unref(formRef)?.addSchema(
|
||||||
{
|
{
|
||||||
@ -134,7 +133,7 @@ const handleCreate = async () => {
|
|||||||
const handleUpdate = async (rowId: number) => {
|
const handleUpdate = async (rowId: number) => {
|
||||||
setDialogTile('update')
|
setDialogTile('update')
|
||||||
// 设置数据
|
// 设置数据
|
||||||
const res = await ConfigApi.getConfig(rowId)
|
const res = await ConfigApi.getConfigApi(rowId)
|
||||||
unref(formRef)?.delSchema('key')
|
unref(formRef)?.delSchema('key')
|
||||||
unref(formRef)?.setValues(res)
|
unref(formRef)?.setValues(res)
|
||||||
}
|
}
|
||||||
@ -142,7 +141,7 @@ const handleUpdate = async (rowId: number) => {
|
|||||||
// 详情操作
|
// 详情操作
|
||||||
const handleDetail = async (rowId: number) => {
|
const handleDetail = async (rowId: number) => {
|
||||||
setDialogTile('detail')
|
setDialogTile('detail')
|
||||||
const res = await ConfigApi.getConfig(rowId)
|
const res = await ConfigApi.getConfigApi(rowId)
|
||||||
detailData.value = res
|
detailData.value = res
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,10 +156,10 @@ const submitForm = async () => {
|
|||||||
try {
|
try {
|
||||||
const data = unref(formRef)?.formModel as ConfigApi.ConfigVO
|
const data = unref(formRef)?.formModel as ConfigApi.ConfigVO
|
||||||
if (actionType.value === 'create') {
|
if (actionType.value === 'create') {
|
||||||
await ConfigApi.createConfig(data)
|
await ConfigApi.createConfigApi(data)
|
||||||
message.success(t('common.createSuccess'))
|
message.success(t('common.createSuccess'))
|
||||||
} else {
|
} else {
|
||||||
await ConfigApi.updateConfig(data)
|
await ConfigApi.updateConfigApi(data)
|
||||||
message.success(t('common.updateSuccess'))
|
message.success(t('common.updateSuccess'))
|
||||||
}
|
}
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
|
@ -12,7 +12,7 @@ const url = ref(import.meta.env.VITE_BASE_URL + '/druid/index.html')
|
|||||||
/** 初始化 */
|
/** 初始化 */
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
try {
|
try {
|
||||||
const data = await ConfigApi.getConfigKey('url.druid')
|
const data = await ConfigApi.getConfigKeyApi('url.druid')
|
||||||
if (data && data.length > 0) {
|
if (data && data.length > 0) {
|
||||||
url.value = data
|
url.value = data
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ const src = ref(import.meta.env.VITE_BASE_URL + '/admin/applications')
|
|||||||
/** 初始化 */
|
/** 初始化 */
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
try {
|
try {
|
||||||
const data = await ConfigApi.getConfigKey('url.spring-boot-admin')
|
const data = await ConfigApi.getConfigKeyApi('url.spring-boot-admin')
|
||||||
if (data && data.length > 0) {
|
if (data && data.length > 0) {
|
||||||
src.value = data
|
src.value = data
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ const src = ref('http://skywalking.shop.iocoder.cn')
|
|||||||
/** 初始化 */
|
/** 初始化 */
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
try {
|
try {
|
||||||
const data = await ConfigApi.getConfigKey('url.skywalking')
|
const data = await ConfigApi.getConfigKeyApi('url.skywalking')
|
||||||
if (data && data.length > 0) {
|
if (data && data.length > 0) {
|
||||||
src.value = data
|
src.value = data
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ const src = ref(import.meta.env.VITE_BASE_URL + '/doc.html') // Knife4j UI
|
|||||||
/** 初始化 */
|
/** 初始化 */
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
try {
|
try {
|
||||||
const data = await ConfigApi.getConfigKey('url.swagger')
|
const data = await ConfigApi.getConfigKeyApi('url.swagger')
|
||||||
if (data && data.length > 0) {
|
if (data && data.length > 0) {
|
||||||
src.value = data
|
src.value = data
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user