提交 | 用户 | 时间
|
9ec4bd
|
1 |
<template> |
潘 |
2 |
<Dialog v-model="dialogVisible" :title="dialogTitle" width="80%"> |
|
3 |
<!-- 搜索工作栏 --> |
|
4 |
<ContentWrap> |
|
5 |
<el-form |
|
6 |
class="-mb-15px" |
|
7 |
:model="queryParams" |
|
8 |
ref="queryFormRef" |
|
9 |
:inline="true" |
|
10 |
label-width="68px" |
|
11 |
> |
|
12 |
<el-form-item label="模型名称" prop="pyName"> |
|
13 |
<el-input |
|
14 |
v-model="queryParams.pyName" |
|
15 |
placeholder="请输入模型名称" |
|
16 |
clearable |
|
17 |
class="!w-240px" |
|
18 |
/> |
|
19 |
</el-form-item> |
|
20 |
<el-form-item> |
|
21 |
<el-button @click="getList"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button> |
|
22 |
</el-form-item> |
|
23 |
</el-form> |
|
24 |
</ContentWrap> |
|
25 |
|
|
26 |
<!-- 列表 --> |
|
27 |
<ContentWrap> |
|
28 |
<el-table |
|
29 |
v-loading="loading" |
|
30 |
:data="list" |
|
31 |
row-key="id" |
|
32 |
border |
|
33 |
> |
e650cd
|
34 |
<el-table-column prop="pyChineseName" label="模型中文名称"/> |
9ec4bd
|
35 |
<el-table-column prop="pyName" label="模型名称"/> |
e650cd
|
36 |
<el-table-column prop="pyType" label="模型类型" :formatter="(r,c,v) => getDictLabel(DICT_TYPE.MODEL_TYPE,v)"/> |
9ec4bd
|
37 |
<el-table-column prop="remark" label="备注" width="300px"/> |
潘 |
38 |
<el-table-column label="模型方法" type="expand" width="100px"> |
|
39 |
<template #default="props"> |
|
40 |
<el-table :data="props.row.modelMethods"> |
|
41 |
<el-table-column align="center" label="方法名" prop="methodName" /> |
|
42 |
<el-table-column align="center" label="参数长度" prop="dataLength" /> |
|
43 |
<el-table-column align="center" label="是否有model" prop="model" :formatter="(row,column,cellValue) => cellValue === 1 ? 'true' : 'false'" /> |
e650cd
|
44 |
<el-table-column align="center" label="结果key" prop="resultKey" /> |
9ec4bd
|
45 |
</el-table> |
潘 |
46 |
</template> |
|
47 |
</el-table-column> |
|
48 |
</el-table> |
|
49 |
<!-- 分页 --> |
|
50 |
<Pagination |
|
51 |
v-model:limit="queryParams.pageSize" |
|
52 |
v-model:page="queryParams.page" |
|
53 |
:total="total" |
|
54 |
@pagination="getList" |
|
55 |
/> |
|
56 |
</ContentWrap> |
|
57 |
</Dialog> |
|
58 |
</template> |
|
59 |
<script lang="ts" setup> |
|
60 |
import download from "@/utils/download"; |
aff5c9
|
61 |
import * as projectHistoryApi from '@/api/model/mpk/projectPackageHistory' |
潘 |
62 |
import * as projectApi from '@/api/model/mpk/project' |
9ec4bd
|
63 |
import { dateFormatter } from '@/utils/formatTime' |
e650cd
|
64 |
import { DICT_TYPE, getDictLabel } from '@/utils/dict' |
9ec4bd
|
65 |
|
潘 |
66 |
|
|
67 |
const { t } = useI18n() // 国际化 |
|
68 |
const message = useMessage() // 消息弹窗 |
|
69 |
|
|
70 |
const dialogVisible = ref(false) // 弹窗的是否展示 |
|
71 |
const dialogTitle = ref('关联模型') // 弹窗的标题 |
|
72 |
|
|
73 |
const loading = ref(true) // 列表的加载中 |
|
74 |
const total = ref(0) // 列表的总页数 |
|
75 |
const list = ref([]) // 字典表格数据 |
|
76 |
const queryParams = reactive({ |
|
77 |
page: 1, |
|
78 |
pageSize: 10, |
|
79 |
packageHistoryId: undefined, |
|
80 |
projectId: undefined, |
|
81 |
pyName: undefined, |
|
82 |
}) |
|
83 |
|
|
84 |
const dialogType = ref('') |
|
85 |
|
|
86 |
/** 打开弹窗 */ |
|
87 |
const open = async (type: String,id: String) => { |
|
88 |
dialogVisible.value = true |
|
89 |
dialogType.value = type |
|
90 |
|
|
91 |
if (dialogType.value === 'package') { |
|
92 |
queryParams.packageHistoryId = id; |
|
93 |
}else if (dialogType.value === 'project') { |
|
94 |
queryParams.projectId = id; |
|
95 |
} |
|
96 |
|
|
97 |
queryParams.pyName = undefined; |
|
98 |
getList() |
|
99 |
} |
|
100 |
defineExpose({ open }) // 提供 open 方法,用于打开弹窗 |
|
101 |
|
|
102 |
const getList = async () => { |
|
103 |
loading.value = true |
|
104 |
try { |
|
105 |
let data = undefined; |
|
106 |
if (dialogType.value === 'package') { |
|
107 |
data = await projectHistoryApi.getPackageModel(queryParams) |
|
108 |
data.list.forEach(e => { |
|
109 |
e.modelMethods = JSON.parse(e.methodInfo) |
|
110 |
}) |
|
111 |
}else if (dialogType.value === 'project') { |
|
112 |
data = await projectApi.getProjectModel(queryParams) |
|
113 |
} |
|
114 |
|
|
115 |
list.value = data.list |
|
116 |
total.value = data.total |
|
117 |
} finally { |
|
118 |
loading.value = false |
|
119 |
} |
|
120 |
} |
|
121 |
</script> |