Browse Source

接口命名统一

周建 2 years ago
parent
commit
b07cc98619

+ 13 - 6
src/api/infra/config/index.ts

@@ -12,6 +12,13 @@ export interface ConfigVO {
   createTime: Date
 }
 
+export interface ConfigPageReqVO extends PageParam {
+  name?: string
+  key?: string
+  type?: number
+  createTime?: Date[]
+}
+
 export interface ConfigExportReqVO {
   name?: 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 })
 }
 
 // 查询参数详情
-export const getConfig = (id: number) => {
+export const getConfigApi = (id: number) => {
   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 })
 }
 
 // 新增参数
-export const createConfig = (data: ConfigVO) => {
+export const createConfigApi = (data: ConfigVO) => {
   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 })
 }
 
 // 删除参数
-export const deleteConfig = (id: number) => {
+export const deleteConfigApi = (id: number) => {
   return request.delete({ url: '/infra/config/delete?id=' + id })
 }
 

+ 2 - 4
src/views/infra/build/index.vue

@@ -20,9 +20,7 @@
   <!-- 弹窗:表单预览 -->
   <Dialog :title="dialogTitle" v-model="dialogVisible" max-height="600">
     <div ref="editor" v-if="dialogVisible">
-      <el-button style="float: right" @click="copy(formData)">
-        {{ t('common.copy') }}
-      </el-button>
+      <XTextButton style="float: right" :title="t('common.copy')" @click="copy(formData)" />
       <el-scrollbar height="580">
         <div>
           <pre><code class="hljs" v-html="highlightedCode(formData)"></code></pre>
@@ -35,7 +33,7 @@
 import FcDesigner from '@form-create/designer'
 // import { useClipboard } from '@vueuse/core'
 import { isString } from '@/utils/is'
-
+import formCreate from '@form-create/element-ui'
 import hljs from 'highlight.js' // 导入代码高亮文件
 import 'highlight.js/styles/github.css' // 导入代码高亮样式
 import xml from 'highlight.js/lib/languages/java'

+ 6 - 7
src/views/infra/config/index.vue

@@ -93,8 +93,8 @@ const message = useMessage() // 消息弹窗
 // 列表相关的变量
 const [registerTable, { reload, deleteData, exportList }] = useXTable({
   allSchemas: allSchemas,
-  getListApi: ConfigApi.getConfigPage,
-  deleteApi: ConfigApi.deleteConfig,
+  getListApi: ConfigApi.getConfigPageApi,
+  deleteApi: ConfigApi.deleteConfigApi,
   exportListApi: ConfigApi.exportConfigApi
 })
 
@@ -117,7 +117,6 @@ const setDialogTile = (type: string) => {
 const handleCreate = async () => {
   setDialogTile('create')
   await nextTick()
-  console.log(allSchemas.formSchema, 'allSchemas.formSchema')
   if (allSchemas.formSchema[2].field !== 'key') {
     unref(formRef)?.addSchema(
       {
@@ -134,7 +133,7 @@ const handleCreate = async () => {
 const handleUpdate = async (rowId: number) => {
   setDialogTile('update')
   // 设置数据
-  const res = await ConfigApi.getConfig(rowId)
+  const res = await ConfigApi.getConfigApi(rowId)
   unref(formRef)?.delSchema('key')
   unref(formRef)?.setValues(res)
 }
@@ -142,7 +141,7 @@ const handleUpdate = async (rowId: number) => {
 // 详情操作
 const handleDetail = async (rowId: number) => {
   setDialogTile('detail')
-  const res = await ConfigApi.getConfig(rowId)
+  const res = await ConfigApi.getConfigApi(rowId)
   detailData.value = res
 }
 
@@ -157,10 +156,10 @@ const submitForm = async () => {
       try {
         const data = unref(formRef)?.formModel as ConfigApi.ConfigVO
         if (actionType.value === 'create') {
-          await ConfigApi.createConfig(data)
+          await ConfigApi.createConfigApi(data)
           message.success(t('common.createSuccess'))
         } else {
-          await ConfigApi.updateConfig(data)
+          await ConfigApi.updateConfigApi(data)
           message.success(t('common.updateSuccess'))
         }
         dialogVisible.value = false

+ 1 - 1
src/views/infra/druid/index.vue

@@ -12,7 +12,7 @@ const url = ref(import.meta.env.VITE_BASE_URL + '/druid/index.html')
 /** 初始化 */
 onMounted(async () => {
   try {
-    const data = await ConfigApi.getConfigKey('url.druid')
+    const data = await ConfigApi.getConfigKeyApi('url.druid')
     if (data && data.length > 0) {
       url.value = data
     }

+ 1 - 1
src/views/infra/server/index.vue

@@ -12,7 +12,7 @@ const src = ref(import.meta.env.VITE_BASE_URL + '/admin/applications')
 /** 初始化 */
 onMounted(async () => {
   try {
-    const data = await ConfigApi.getConfigKey('url.spring-boot-admin')
+    const data = await ConfigApi.getConfigKeyApi('url.spring-boot-admin')
     if (data && data.length > 0) {
       src.value = data
     }

+ 1 - 1
src/views/infra/skywalking/index.vue

@@ -12,7 +12,7 @@ const src = ref('http://skywalking.shop.iocoder.cn')
 /** 初始化 */
 onMounted(async () => {
   try {
-    const data = await ConfigApi.getConfigKey('url.skywalking')
+    const data = await ConfigApi.getConfigKeyApi('url.skywalking')
     if (data && data.length > 0) {
       src.value = data
     }

+ 1 - 1
src/views/infra/swagger/index.vue

@@ -13,7 +13,7 @@ const src = ref(import.meta.env.VITE_BASE_URL + '/doc.html') // Knife4j UI
 /** 初始化 */
 onMounted(async () => {
   try {
-    const data = await ConfigApi.getConfigKey('url.swagger')
+    const data = await ConfigApi.getConfigKeyApi('url.swagger')
     if (data && data.length > 0) {
       src.value = data
     }