提交 | 用户 | 时间
|
9ec4bd
|
1 |
<template> |
潘 |
2 |
<ContentWrap> |
|
3 |
<el-form |
|
4 |
class="-mb-15px" |
|
5 |
:model="queryParams" |
|
6 |
ref="queryFormRef" |
|
7 |
:inline="true" |
|
8 |
label-width="68px" |
|
9 |
> |
|
10 |
<el-form-item label="项目名称" prop="projectId"> |
|
11 |
<el-select v-model="queryParams.projectId" class="!w-240px"> |
|
12 |
<el-option |
|
13 |
v-for="item in projectList" |
|
14 |
:key="item.id" |
|
15 |
:label="item.projectName" |
|
16 |
:value="item.id" |
|
17 |
/> |
|
18 |
</el-select> |
|
19 |
</el-form-item> |
|
20 |
<el-form-item label="开始时间" prop="startTime"> |
|
21 |
<el-date-picker |
|
22 |
v-model="queryParams.startTime" |
|
23 |
type="datetime" |
|
24 |
value-format="YYYY-MM-DD HH:mm:ss" |
|
25 |
placeholder="选择日期时间"/> |
|
26 |
</el-form-item> |
|
27 |
<el-form-item label="结束时间" prop="endTime"> |
|
28 |
<el-date-picker |
|
29 |
v-model="queryParams.endTime" |
|
30 |
type="datetime" |
|
31 |
value-format="YYYY-MM-DD HH:mm:ss" |
|
32 |
placeholder="选择日期时间"/> |
|
33 |
</el-form-item> |
|
34 |
<el-form-item> |
|
35 |
<el-button @click="handleQuery"> |
|
36 |
<Icon icon="ep:search" class="mr-5px"/> |
|
37 |
搜索 |
|
38 |
</el-button> |
|
39 |
<el-button @click="resetQuery"> |
|
40 |
<Icon icon="ep:refresh" class="mr-5px"/> |
|
41 |
重置 |
|
42 |
</el-button> |
|
43 |
</el-form-item> |
|
44 |
</el-form> |
|
45 |
</ContentWrap> |
|
46 |
|
|
47 |
<!-- 列表 --> |
|
48 |
<ContentWrap> |
|
49 |
<el-table v-loading="loading" :data="list"> |
|
50 |
<el-table-column label="文件名" header-align="center" align="center" width="400"> |
|
51 |
<template #default="scope"> |
|
52 |
<a style="cursor: pointer;color: #409eff" |
|
53 |
@click="downloadHistory(scope.row.filePath,scope.row.fileName)">{{ scope.row.fileName |
|
54 |
}}</a> |
|
55 |
</template> |
|
56 |
</el-table-column> |
|
57 |
<el-table-column prop="version" label="版本号" header-align="center" align="center" width="200"/> |
|
58 |
<el-table-column prop="log" label="更新日志" header-align="center" align="center"/> |
|
59 |
<el-table-column prop="createTime" label="打包时间" :formatter="dateFormatter" header-align="center" align="center" width="200"/> |
|
60 |
<el-table-column label="操作" align="center" width="230px"> |
|
61 |
<template #default="scope"> |
|
62 |
<el-button |
|
63 |
link |
|
64 |
type="primary" |
|
65 |
@click="viewPackageModel(scope.row.id)" |
|
66 |
> |
|
67 |
<Icon icon="ep:link"/> |
|
68 |
查看关联模型 |
|
69 |
</el-button> |
|
70 |
</template> |
|
71 |
</el-table-column> |
|
72 |
|
|
73 |
</el-table> |
|
74 |
<!-- 分页 --> |
|
75 |
<Pagination |
|
76 |
:total="total" |
|
77 |
v-model:page="queryParams.pageNo" |
|
78 |
v-model:limit="queryParams.pageSize" |
|
79 |
@pagination="getList" |
|
80 |
/> |
|
81 |
</ContentWrap> |
|
82 |
|
|
83 |
<PackageModel ref="packageModelRef"/> |
|
84 |
</template> |
|
85 |
<script lang="ts" setup> |
|
86 |
import download from "@/utils/download"; |
aff5c9
|
87 |
import * as PackageHistoryApi from '@/api/model/mpk/projectPackageHistory' |
潘 |
88 |
import * as ProjectApi from '@/api/model/mpk/project' |
9ec4bd
|
89 |
import {dateFormatter} from '@/utils/formatTime' |
潘 |
90 |
import PackageModel from './ProjectPackageModelDialog.vue' |
|
91 |
|
|
92 |
defineOptions({name: 'ProjectPackageHistory'}) |
|
93 |
|
|
94 |
const message = useMessage() // 消息弹窗 |
|
95 |
const {t} = useI18n() // 国际化 |
|
96 |
const route = useRoute() // 路由 |
|
97 |
|
|
98 |
const loading = ref(true) // 列表的加载中 |
|
99 |
const total = ref(0) // 列表的总页数 |
|
100 |
const list = ref([]) // 列表的数据 |
|
101 |
const queryParams = reactive({ |
|
102 |
pageNo: 1, |
|
103 |
pageSize: 10, |
|
104 |
projectId: route.params.projectId, |
|
105 |
startTime: undefined, |
|
106 |
endTime: undefined, |
|
107 |
}) |
|
108 |
const queryFormRef = ref() // 搜索的表单 |
|
109 |
const projectList = ref() // 字典类型的列表 |
|
110 |
|
|
111 |
/** 查询列表 */ |
|
112 |
const getList = async () => { |
|
113 |
loading.value = true |
|
114 |
try { |
|
115 |
const data = await PackageHistoryApi.getPage(queryParams) |
|
116 |
list.value = data.list |
|
117 |
total.value = data.total |
|
118 |
} finally { |
|
119 |
loading.value = false |
|
120 |
} |
|
121 |
} |
|
122 |
|
|
123 |
/** 搜索按钮操作 */ |
|
124 |
const handleQuery = () => { |
|
125 |
queryParams.pageNo = 1 |
|
126 |
getList() |
|
127 |
} |
|
128 |
|
|
129 |
/** 重置按钮操作 */ |
|
130 |
const resetQuery = () => { |
|
131 |
queryFormRef.value.resetFields() |
|
132 |
handleQuery() |
|
133 |
} |
|
134 |
|
|
135 |
const downloadHistory = async (filePath,fileName) => { |
|
136 |
const param = { |
|
137 |
filePath, |
|
138 |
fileName, |
|
139 |
} |
|
140 |
const data = await PackageHistoryApi.download(param) |
|
141 |
download.zip(data, fileName) |
|
142 |
} |
|
143 |
|
|
144 |
const packageModelRef = ref() |
|
145 |
const viewPackageModel = (id) => { |
|
146 |
packageModelRef.value.open('package',id) |
|
147 |
} |
|
148 |
|
|
149 |
/** 初始化 **/ |
|
150 |
onMounted(async () => { |
|
151 |
await getList() |
|
152 |
// 查询字典(精简)列表 |
|
153 |
projectList.value = await ProjectApi.list() |
|
154 |
}) |
|
155 |
</script> |