新增apiconfig管理界面
This commit is contained in:
parent
a79798254d
commit
4ac4b366d4
52
src/api/system/apiconfig/index.ts
Normal file
52
src/api/system/apiconfig/index.ts
Normal file
@ -0,0 +1,52 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
// 接口配置 VO
|
||||
export interface ApiconfigVO {
|
||||
id: string // 主键
|
||||
orgId: string // 机构ID
|
||||
apiType: string // 接口类别:下拉选项:HIS接口 ,体检接口,LIS接口,EMR接口
|
||||
apiName: string // 接口名称:HIS登记信息同步,体检的登记信息同步,检查项目同步
|
||||
apiUrl: string // 接口地址
|
||||
databaseType: string // sqlserver , mysql ,oracle
|
||||
databaseIP: string // 第三方数据库的IP
|
||||
databasePort: string // 第三方数据库的端口
|
||||
databaseUserName: string // 第三方数据库的登录用户名
|
||||
databasePwd: string // 第三方数据库的登录密码
|
||||
softwareManufacturer: string // 第三方软件的制造商
|
||||
isdelete: string // 是否删除:1为删除
|
||||
remark: string // 备注信息
|
||||
apiCode: string // api代码:his01,his02,tj01,tj02 ,此为接口代码,唯一,每条接口一个api代码
|
||||
}
|
||||
|
||||
// 接口配置 API
|
||||
export const ApiconfigApi = {
|
||||
// 查询接口配置分页
|
||||
getApiconfigPage: async (params: any) => {
|
||||
return await request.get({ url: `/system/apiconfig/page`, params })
|
||||
},
|
||||
|
||||
// 查询接口配置详情
|
||||
getApiconfig: async (id: number) => {
|
||||
return await request.get({ url: `/system/apiconfig/get?id=` + id })
|
||||
},
|
||||
|
||||
// 新增接口配置
|
||||
createApiconfig: async (data: ApiconfigVO) => {
|
||||
return await request.post({ url: `/system/apiconfig/create`, data })
|
||||
},
|
||||
|
||||
// 修改接口配置
|
||||
updateApiconfig: async (data: ApiconfigVO) => {
|
||||
return await request.put({ url: `/system/apiconfig/update`, data })
|
||||
},
|
||||
|
||||
// 删除接口配置
|
||||
deleteApiconfig: async (id: number) => {
|
||||
return await request.delete({ url: `/system/apiconfig/delete?id=` + id })
|
||||
},
|
||||
|
||||
// 导出接口配置 Excel
|
||||
exportApiconfig: async (params) => {
|
||||
return await request.download({ url: `/system/apiconfig/export-excel`, params })
|
||||
},
|
||||
}
|
172
src/views/system/apiconfig/ApiconfigForm.vue
Normal file
172
src/views/system/apiconfig/ApiconfigForm.vue
Normal file
@ -0,0 +1,172 @@
|
||||
<template>
|
||||
<Dialog :title="dialogTitle" v-model="dialogVisible">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
label-width="100px"
|
||||
v-loading="formLoading"
|
||||
>
|
||||
<el-form-item label="接口类别" prop="apiType" label-width="160px">
|
||||
<el-select v-model="formData.apiType" placeholder="请选择接口类别">
|
||||
<el-option label="HIS接口" value="HIS接口" />
|
||||
<el-option label="体检接口" value="体检接口" />
|
||||
<el-option label="LIS接口" value="LIS接口" />
|
||||
<el-option label="EMR接口" value="EMR接口" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="接口名称" prop="apiName" label-width="160px">
|
||||
<el-input v-model="formData.apiName" placeholder="请输入接口名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="接口地址" prop="apiUrl" label-width="160px">
|
||||
<el-input v-model="formData.apiUrl" placeholder="请输入接口地址" />
|
||||
</el-form-item>
|
||||
<el-form-item label="数据库类型" prop="databaseType" label-width="160px">
|
||||
<el-select v-model="formData.databaseType" placeholder="请选择数据库类型">
|
||||
<el-option label="sqlserver" value="sqlserver" />
|
||||
<el-option label="mysql" value="mysql" />
|
||||
<el-option label="oracle" value="oracle" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="API代码" prop="apiCode" label-width="160px">
|
||||
<el-input v-model="formData.apiCode" placeholder="请输入API代码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="第三方数据库的IP" prop="databaseIP" label-width="160px">
|
||||
<el-input v-model="formData.databaseIP" placeholder="请输入第三方数据库的IP" />
|
||||
</el-form-item>
|
||||
<el-form-item label="第三方数据库端口" prop="databasePort" label-width="160px">
|
||||
<el-input v-model="formData.databasePort" placeholder="请输入第三方数据库端口" />
|
||||
</el-form-item>
|
||||
<el-form-item label="第三方数据库登录名" prop="databaseUserName" label-width="160px">
|
||||
<el-input v-model="formData.databaseUserName" placeholder="请输入第三方数据库登录用户名" />
|
||||
</el-form-item>
|
||||
<el-form-item label="第三方数据库登录密码" prop="databasePwd" label-width="160px">
|
||||
<el-input v-model="formData.databasePwd" placeholder="请输入第三方数据库登录密码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="第三方软件的制造商" prop="softwareManufacturer" label-width="160px">
|
||||
<el-input v-model="formData.softwareManufacturer" placeholder="请输入第三方软件的制造商" />
|
||||
</el-form-item>
|
||||
<el-form-item label="机构编码" prop="orgId" label-width="160px">
|
||||
<el-input v-model="formData.orgId" placeholder="请输入机构编码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注信息" prop="remark" label-width="160px">
|
||||
<el-input v-model="formData.remark" placeholder="请输入备注信息" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ApiconfigApi, ApiconfigVO } from '@/api/system/apiconfig'
|
||||
|
||||
/** 接口配置 表单 */
|
||||
defineOptions({ name: 'ApiconfigForm' })
|
||||
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||
const dialogTitle = ref('') // 弹窗的标题
|
||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||
const formData = ref({
|
||||
id: undefined,
|
||||
orgId: undefined,
|
||||
apiType: undefined,
|
||||
apiName: undefined,
|
||||
apiUrl: undefined,
|
||||
databaseType: undefined,
|
||||
databaseIP: undefined,
|
||||
databasePort: undefined,
|
||||
databaseUserName: undefined,
|
||||
databasePwd: undefined,
|
||||
softwareManufacturer: undefined,
|
||||
isdelete: undefined,
|
||||
remark: undefined,
|
||||
apiCode: undefined
|
||||
})
|
||||
const formRules = reactive({
|
||||
orgId: [{ required: true, message: '请输入机构编码', trigger: 'blur' }],
|
||||
apiType: [{ required: true, message: '请输入接口类别', trigger: 'blur' }],
|
||||
apiName: [{ required: true, message: '请输入接口名称', trigger: 'blur' }],
|
||||
apiUrl: [{ required: true, message: '请输入接口地址', trigger: 'blur' }],
|
||||
apiCode: [{ required: true, message: '请输入API代码', trigger: 'blur' }]
|
||||
})
|
||||
const formRef = ref() // 表单 Ref
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (type: string, id?: number) => {
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = t('action.' + type)
|
||||
formType.value = type
|
||||
resetForm()
|
||||
// 修改时,设置数据
|
||||
if (id) {
|
||||
formLoading.value = true
|
||||
try {
|
||||
formData.value = await ApiconfigApi.getApiconfig(id)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||
|
||||
/** 提交表单 */
|
||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||
const submitForm = async () => {
|
||||
// 校验表单
|
||||
await formRef.value.validate()
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
const re = ref()
|
||||
try {
|
||||
const data = formData.value as unknown as ApiconfigVO
|
||||
if (formType.value === 'create') {
|
||||
re.value = await ApiconfigApi.createApiconfig(data)
|
||||
|
||||
if (re.value==='Api代码重复') {
|
||||
message.error(re.value)
|
||||
return
|
||||
}
|
||||
else
|
||||
{
|
||||
message.success(t('common.createSuccess'))
|
||||
}
|
||||
|
||||
} else {
|
||||
await ApiconfigApi.updateApiconfig(data)
|
||||
message.success(t('common.updateSuccess'))
|
||||
}
|
||||
dialogVisible.value = false
|
||||
// 发送操作成功的事件
|
||||
emit('success')
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
id: undefined,
|
||||
orgId: undefined,
|
||||
apiType: undefined,
|
||||
apiName: undefined,
|
||||
apiUrl: undefined,
|
||||
databaseType: undefined,
|
||||
databaseIP: undefined,
|
||||
databasePort: undefined,
|
||||
databaseUserName: undefined,
|
||||
databasePwd: undefined,
|
||||
softwareManufacturer: undefined,
|
||||
isdelete: undefined,
|
||||
remark: undefined,
|
||||
apiCode: undefined
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
</script>
|
304
src/views/system/apiconfig/index.vue
Normal file
304
src/views/system/apiconfig/index.vue
Normal file
@ -0,0 +1,304 @@
|
||||
<template>
|
||||
<ContentWrap>
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form
|
||||
class="-mb-15px"
|
||||
:model="queryParams"
|
||||
ref="queryFormRef"
|
||||
:inline="true"
|
||||
label-width="68px"
|
||||
>
|
||||
<!-- <el-form-item label="机构ID" prop="orgId">
|
||||
<el-input
|
||||
v-model="queryParams.orgId"
|
||||
placeholder="请输入机构ID"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="接口类别" prop="apiType">
|
||||
<el-select
|
||||
v-model="queryParams.apiType"
|
||||
placeholder="请选择接口类别"
|
||||
clearable
|
||||
class="!w-240px"
|
||||
>
|
||||
<el-option label="HIS接口" value="HIS接口" />
|
||||
<el-option label="体检接口" value="体检接口" />
|
||||
<el-option label="LIS接口" value="LIS接口" />
|
||||
<el-option label="EMR接口" value="EMR接口" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="接口名称" prop="apiName">
|
||||
<el-input
|
||||
v-model="queryParams.apiName"
|
||||
placeholder="请输入接口名称"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="接口地址" prop="apiUrl">
|
||||
<el-input
|
||||
v-model="queryParams.apiUrl"
|
||||
placeholder="请输入接口地址"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item> -->
|
||||
<!-- <el-form-item label="sqlserver , mysql ,oracle" prop="databaseType">
|
||||
<el-select
|
||||
v-model="queryParams.databaseType"
|
||||
placeholder="请选择sqlserver , mysql ,oracle"
|
||||
clearable
|
||||
class="!w-240px"
|
||||
>
|
||||
<el-option label="请选择字典生成" value="" />
|
||||
</el-select>
|
||||
</el-form-item> -->
|
||||
<!-- <el-form-item label="第三方数据库的IP" prop="databaseIP">
|
||||
<el-input
|
||||
v-model="queryParams.databaseIP"
|
||||
placeholder="请输入第三方数据库的IP"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item> -->
|
||||
<!-- <el-form-item label="第三方数据库的端口" prop="databasePort">
|
||||
<el-input
|
||||
v-model="queryParams.databasePort"
|
||||
placeholder="请输入第三方数据库的端口"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item> -->
|
||||
<!-- <el-form-item label="第三方数据库的登录用户名" prop="databaseUserName">
|
||||
<el-input
|
||||
v-model="queryParams.databaseUserName"
|
||||
placeholder="请输入第三方数据库的登录用户名"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="第三方数据库的登录密码" prop="databasePwd">
|
||||
<el-input
|
||||
v-model="queryParams.databasePwd"
|
||||
placeholder="请输入第三方数据库的登录密码"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="第三方软件的制造商" prop="softwareManufacturer">
|
||||
<el-input
|
||||
v-model="queryParams.softwareManufacturer"
|
||||
placeholder="请输入第三方软件的制造商"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否删除:1为删除" prop="isdelete">
|
||||
<el-input
|
||||
v-model="queryParams.isdelete"
|
||||
placeholder="请输入是否删除:1为删除"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注信息" prop="remark">
|
||||
<el-input
|
||||
v-model="queryParams.remark"
|
||||
placeholder="请输入备注信息"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="api代码" prop="apiCode">
|
||||
<el-input
|
||||
v-model="queryParams.apiCode"
|
||||
placeholder="请输入api代码"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
||||
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
@click="openForm('create')"
|
||||
v-hasPermi="['system:apiconfig:create']"
|
||||
>
|
||||
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
||||
</el-button>
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
@click="handleExport"
|
||||
:loading="exportLoading"
|
||||
v-hasPermi="['system:apiconfig:export']"
|
||||
>
|
||||
<Icon icon="ep:download" class="mr-5px" /> 导出
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</ContentWrap>
|
||||
|
||||
<!-- 列表 -->
|
||||
<ContentWrap>
|
||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
||||
<el-table-column label="主键" align="center" prop="id" v-if="false" />
|
||||
<el-table-column label="机构编码" align="center" prop="orgId" v-if="false"/>
|
||||
<el-table-column label="接口类别" align="center" prop="apiType" />
|
||||
<el-table-column label="接口名称" align="center" prop="apiName" />
|
||||
<el-table-column label="接口地址" align="center" prop="apiUrl" />
|
||||
<el-table-column label="数据库类型" align="center" prop="databaseType" />
|
||||
<el-table-column label="第三方数据库的IP" align="center" prop="databaseIP" />
|
||||
<el-table-column label="第三方数据库的端口" align="center" prop="databasePort" />
|
||||
<el-table-column label="第三方数据库的登录名" align="center" prop="databaseUserName" />
|
||||
<el-table-column label="第三方数据库的登录密码" align="center" prop="databasePwd" />
|
||||
<el-table-column label="第三方软件的制造商" align="center" prop="softwareManufacturer" />
|
||||
<el-table-column label="是否删除:1为删除" align="center" prop="isdelete" v-if="false"/>
|
||||
<el-table-column label="备注信息" align="center" prop="remark" />
|
||||
<el-table-column label="api代码" align="center" prop="apiCode" />
|
||||
<el-table-column label="操作" align="center">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
@click="openForm('update', scope.row.id)"
|
||||
v-hasPermi="['system:apiconfig:update']"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="danger"
|
||||
@click="handleDelete(scope.row.id)"
|
||||
v-hasPermi="['system:apiconfig:delete']"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
<Pagination
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNo"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</ContentWrap>
|
||||
|
||||
<!-- 表单弹窗:添加/修改 -->
|
||||
<ApiconfigForm ref="formRef" @success="getList" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import download from '@/utils/download'
|
||||
import { ApiconfigApi, ApiconfigVO } from '@/api/system/apiconfig'
|
||||
import ApiconfigForm from './ApiconfigForm.vue'
|
||||
|
||||
/** 接口配置 列表 */
|
||||
defineOptions({ name: 'Apiconfig' })
|
||||
|
||||
const message = useMessage() // 消息弹窗
|
||||
const { t } = useI18n() // 国际化
|
||||
|
||||
const loading = ref(true) // 列表的加载中
|
||||
const list = ref<ApiconfigVO[]>([]) // 列表的数据
|
||||
const total = ref(0) // 列表的总页数
|
||||
const queryParams = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
orgId: undefined,
|
||||
apiType: undefined,
|
||||
apiName: undefined,
|
||||
apiUrl: undefined,
|
||||
databaseType: undefined,
|
||||
databaseIP: undefined,
|
||||
databasePort: undefined,
|
||||
databaseUserName: undefined,
|
||||
databasePwd: undefined,
|
||||
softwareManufacturer: undefined,
|
||||
isdelete: undefined,
|
||||
remark: undefined,
|
||||
apiCode: undefined,
|
||||
})
|
||||
const queryFormRef = ref() // 搜索的表单
|
||||
const exportLoading = ref(false) // 导出的加载中
|
||||
|
||||
/** 查询列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await ApiconfigApi.getApiconfigPage(queryParams)
|
||||
list.value = data.list
|
||||
total.value = data.total
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.pageNo = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value.resetFields()
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
/** 添加/修改操作 */
|
||||
const formRef = ref()
|
||||
const openForm = (type: string, id?: number) => {
|
||||
formRef.value.open(type, id)
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (id: number) => {
|
||||
try {
|
||||
// 删除的二次确认
|
||||
await message.delConfirm()
|
||||
// 发起删除
|
||||
await ApiconfigApi.deleteApiconfig(id)
|
||||
message.success(t('common.delSuccess'))
|
||||
// 刷新列表
|
||||
await getList()
|
||||
} catch {}
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = async () => {
|
||||
try {
|
||||
// 导出的二次确认
|
||||
await message.exportConfirm()
|
||||
// 发起导出
|
||||
exportLoading.value = true
|
||||
const data = await ApiconfigApi.exportApiconfig(queryParams)
|
||||
download.excel(data, '接口配置.xls')
|
||||
} catch {
|
||||
} finally {
|
||||
exportLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 初始化 **/
|
||||
onMounted(() => {
|
||||
getList()
|
||||
})
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user