新增apiconfig管理界面

This commit is contained in:
lxd 2024-07-28 15:32:19 +08:00
parent a79798254d
commit 4ac4b366d4
3 changed files with 528 additions and 0 deletions

View 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 })
},
}

View 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) // 12
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>

View 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>