<template>
|
<!-- 搜索 -->
|
<ContentWrap>
|
<el-form
|
class="-mb-15px"
|
:model="queryParams"
|
ref="queryFormRef"
|
:inline="true"
|
label-width="68px"
|
>
|
<el-form-item label="模型编号" prop="modelCode">
|
<el-input
|
v-model="queryParams.modelCode"
|
placeholder="请输入模型编号"
|
clearable
|
@keyup.enter="handleQuery"
|
class="!w-240px"
|
/>
|
</el-form-item>
|
<el-form-item label="模型名称" prop="modelName">
|
<el-input
|
v-model="queryParams.modelName"
|
placeholder="请输入模型名称"
|
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="['sche:model:create']"
|
>
|
<Icon icon="ep:plus" class="mr-5px" />
|
新增
|
</el-button>
|
</el-form-item>
|
</el-form>
|
</ContentWrap>
|
|
<!-- 列表 -->
|
<ContentWrap>
|
<el-table v-loading="loading" :data="list">
|
<el-table-column label="模型编号" align="center" prop="modelCode" min-width="100"/>
|
<el-table-column label="模型名称" align="center" prop="modelName" min-width="100"/>
|
<el-table-column label="模型类型" align="center" prop="modelType" min-width="100"/>
|
<el-table-column label="类名" header-align="center" align="left" prop="className" min-width="200"/>
|
<el-table-column label="方法名" align="center" prop="methodName" min-width="100"/>
|
<el-table-column label="参数数量" align="center" prop="portLength" min-width="100"/>
|
<el-table-column label="参数构造" header-align="center" align="left" prop="paramStructure" min-width="200" />
|
<el-table-column label="调用方式" align="center" prop="invocation" min-width="100">
|
<template #default="scope">
|
<dict-tag :type="DICT_TYPE.SCHE_MODEL_INVOCATION" :value="scope.row.invocation" />
|
</template>
|
</el-table-column>
|
<el-table-column label="操作" align="center" min-width="100" fixed="right">
|
<template #default="scope">
|
<el-button
|
link
|
type="primary"
|
@click="openForm('update', scope.row.id)"
|
v-hasPermi="['sche:model:update']"
|
>
|
编辑
|
</el-button>
|
<el-button
|
link
|
type="danger"
|
@click="handleDelete(scope.row.id)"
|
v-hasPermi="['sche:model: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>
|
|
<!-- 表单弹窗:添加/修改 -->
|
<ScheduleModelForm ref="formRef" @success="getList" />
|
|
</template>
|
<script lang="ts" setup>
|
import {DICT_TYPE, getIntDictOptions} from '@/utils/dict'
|
import {dateFormatter} from '@/utils/formatTime'
|
import download from '@/utils/download'
|
import * as ScheduleModelApi from '@/api/model/sche/model'
|
import ScheduleModelForm from './ScheduleModelForm.vue'
|
|
defineOptions({name: 'ScheduleModel'})
|
|
const message = useMessage() // 消息弹窗
|
const {t} = useI18n() // 国际化
|
|
const loading = ref(true) // 列表的加载中
|
const total = ref(0) // 列表的总页数
|
const list = ref([]) // 列表的数据
|
const queryParams = reactive({
|
pageNo: 1,
|
pageSize: 10,
|
modelCode: undefined,
|
modelName: undefined
|
})
|
const queryFormRef = ref() // 搜索的表单
|
const exportLoading = ref(false) // 导出的加载中
|
|
/** 查询列表 */
|
const getList = async () => {
|
loading.value = true
|
try {
|
const page = await ScheduleModelApi.getScheduleModelPage(queryParams)
|
list.value = page.list
|
total.value = page.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 ScheduleModelApi.deleteScheduleModel(id)
|
message.success(t('common.delSuccess'))
|
// 刷新列表
|
await getList()
|
} catch {
|
}
|
}
|
|
/** 初始化 **/
|
onMounted(async () => {
|
await getList()
|
})
|
</script>
|