<template>
|
<Dialog v-model="dialogVisible" :title="dialogTitle" width="80%">
|
<!-- 搜索工作栏 -->
|
<ContentWrap>
|
<el-form
|
class="-mb-15px"
|
:model="queryParams"
|
ref="queryFormRef"
|
:inline="true"
|
label-width="68px"
|
>
|
<el-form-item label="模型名称" prop="pyName">
|
<el-input
|
v-model="queryParams.pyName"
|
placeholder="请输入模型名称"
|
clearable
|
class="!w-240px"
|
/>
|
</el-form-item>
|
<el-form-item>
|
<el-button @click="getList"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
</el-form-item>
|
</el-form>
|
</ContentWrap>
|
|
<!-- 列表 -->
|
<ContentWrap>
|
<el-table
|
v-loading="loading"
|
:data="list"
|
row-key="id"
|
border
|
>
|
<el-table-column prop="pyChineseName" label="模型中文名称"/>
|
<el-table-column prop="pyName" label="模型名称"/>
|
<el-table-column prop="pyType" label="模型类型" :formatter="(r,c,v) => getDictLabel(DICT_TYPE.MODEL_TYPE,v)"/>
|
<el-table-column prop="remark" label="备注" width="300px"/>
|
<el-table-column label="模型方法" type="expand" width="100px">
|
<template #default="props">
|
<el-table :data="props.row.modelMethods">
|
<el-table-column align="center" label="方法名" prop="methodName" />
|
<el-table-column align="center" label="参数长度" prop="dataLength" />
|
<el-table-column align="center" label="是否有model" prop="model" :formatter="(row,column,cellValue) => cellValue === 1 ? 'true' : 'false'" />
|
<el-table-column align="center" label="结果key" prop="resultKey" />
|
</el-table>
|
</template>
|
</el-table-column>
|
</el-table>
|
<!-- 分页 -->
|
<Pagination
|
v-model:limit="queryParams.pageSize"
|
v-model:page="queryParams.page"
|
:total="total"
|
@pagination="getList"
|
/>
|
</ContentWrap>
|
</Dialog>
|
</template>
|
<script lang="ts" setup>
|
import download from "@/utils/download";
|
import * as projectHistoryApi from '@/api/model/mpk/projectPackageHistory'
|
import * as projectApi from '@/api/model/mpk/project'
|
import { dateFormatter } from '@/utils/formatTime'
|
import { DICT_TYPE, getDictLabel } from '@/utils/dict'
|
|
|
const { t } = useI18n() // 国际化
|
const message = useMessage() // 消息弹窗
|
|
const dialogVisible = ref(false) // 弹窗的是否展示
|
const dialogTitle = ref('关联模型') // 弹窗的标题
|
|
const loading = ref(true) // 列表的加载中
|
const total = ref(0) // 列表的总页数
|
const list = ref([]) // 字典表格数据
|
const queryParams = reactive({
|
page: 1,
|
pageSize: 10,
|
packageHistoryId: undefined,
|
projectId: undefined,
|
pyName: undefined,
|
})
|
|
const dialogType = ref('')
|
|
/** 打开弹窗 */
|
const open = async (type: String,id: String) => {
|
dialogVisible.value = true
|
dialogType.value = type
|
|
if (dialogType.value === 'package') {
|
queryParams.packageHistoryId = id;
|
}else if (dialogType.value === 'project') {
|
queryParams.projectId = id;
|
}
|
|
queryParams.pyName = undefined;
|
getList()
|
}
|
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
|
const getList = async () => {
|
loading.value = true
|
try {
|
let data = undefined;
|
if (dialogType.value === 'package') {
|
data = await projectHistoryApi.getPackageModel(queryParams)
|
data.list.forEach(e => {
|
e.modelMethods = JSON.parse(e.methodInfo)
|
})
|
}else if (dialogType.value === 'project') {
|
data = await projectApi.getProjectModel(queryParams)
|
}
|
|
list.value = data.list
|
total.value = data.total
|
} finally {
|
loading.value = false
|
}
|
}
|
</script>
|