提交 | 用户 | 时间
|
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> |
b45bad
|
70 |
<el-button |
D |
71 |
link |
|
72 |
type="primary" |
|
73 |
@click="publish(scope.row.id,scope.row.version)" |
|
74 |
> |
|
75 |
<Icon icon="ep:upload"/> |
|
76 |
发布 |
|
77 |
</el-button> |
9ec4bd
|
78 |
</template> |
潘 |
79 |
</el-table-column> |
|
80 |
|
|
81 |
</el-table> |
|
82 |
<!-- 分页 --> |
|
83 |
<Pagination |
|
84 |
:total="total" |
b45bad
|
85 |
v-model:page="queryParams.page" |
D |
86 |
v-model:limit="queryParams.limit" |
9ec4bd
|
87 |
@pagination="getList" |
潘 |
88 |
/> |
|
89 |
</ContentWrap> |
|
90 |
|
|
91 |
<PackageModel ref="packageModelRef"/> |
|
92 |
</template> |
|
93 |
<script lang="ts" setup> |
|
94 |
import download from "@/utils/download"; |
aff5c9
|
95 |
import * as PackageHistoryApi from '@/api/model/mpk/projectPackageHistory' |
潘 |
96 |
import * as ProjectApi from '@/api/model/mpk/project' |
9ec4bd
|
97 |
import {dateFormatter} from '@/utils/formatTime' |
潘 |
98 |
import PackageModel from './ProjectPackageModelDialog.vue' |
b45bad
|
99 |
import * as MpkApi from "@/api/model/mpk/mpk"; |
9ec4bd
|
100 |
|
潘 |
101 |
defineOptions({name: 'ProjectPackageHistory'}) |
|
102 |
|
|
103 |
const message = useMessage() // 消息弹窗 |
|
104 |
const {t} = useI18n() // 国际化 |
|
105 |
const route = useRoute() // 路由 |
|
106 |
|
|
107 |
const loading = ref(true) // 列表的加载中 |
|
108 |
const total = ref(0) // 列表的总页数 |
|
109 |
const list = ref([]) // 列表的数据 |
|
110 |
const queryParams = reactive({ |
b45bad
|
111 |
page: 1, |
D |
112 |
limit: 10, |
9ec4bd
|
113 |
projectId: route.params.projectId, |
潘 |
114 |
startTime: undefined, |
|
115 |
endTime: undefined, |
|
116 |
}) |
|
117 |
const queryFormRef = ref() // 搜索的表单 |
|
118 |
const projectList = ref() // 字典类型的列表 |
|
119 |
|
|
120 |
/** 查询列表 */ |
|
121 |
const getList = async () => { |
|
122 |
loading.value = true |
|
123 |
try { |
|
124 |
const data = await PackageHistoryApi.getPage(queryParams) |
|
125 |
list.value = data.list |
|
126 |
total.value = data.total |
|
127 |
} finally { |
|
128 |
loading.value = false |
|
129 |
} |
|
130 |
} |
|
131 |
|
b45bad
|
132 |
watch(() => queryParams.projectId, (newVal, oldVal) => { |
D |
133 |
handleQuery() |
|
134 |
}) |
|
135 |
|
9ec4bd
|
136 |
/** 搜索按钮操作 */ |
潘 |
137 |
const handleQuery = () => { |
b45bad
|
138 |
queryParams.page = 1 |
9ec4bd
|
139 |
getList() |
潘 |
140 |
} |
|
141 |
|
|
142 |
/** 重置按钮操作 */ |
|
143 |
const resetQuery = () => { |
|
144 |
queryFormRef.value.resetFields() |
|
145 |
handleQuery() |
|
146 |
} |
|
147 |
|
|
148 |
const downloadHistory = async (filePath,fileName) => { |
|
149 |
const param = { |
|
150 |
filePath, |
|
151 |
fileName, |
|
152 |
} |
|
153 |
const data = await PackageHistoryApi.download(param) |
|
154 |
download.zip(data, fileName) |
|
155 |
} |
|
156 |
|
|
157 |
const packageModelRef = ref() |
|
158 |
const viewPackageModel = (id) => { |
|
159 |
packageModelRef.value.open('package',id) |
|
160 |
} |
|
161 |
|
b45bad
|
162 |
// 发布 |
D |
163 |
const publish = async (historyId,version) => { |
|
164 |
// 发布的二次确认 |
|
165 |
await message.confirm('确认发布 ' + projectList.value.find(e => e.id === queryParams.projectId).projectName + '【' + version + '】') |
|
166 |
|
|
167 |
// 发布 |
|
168 |
await MpkApi.publish({historyId,projectId: queryParams.projectId}) |
|
169 |
|
|
170 |
message.success('发布成功'); |
|
171 |
} |
|
172 |
|
9ec4bd
|
173 |
/** 初始化 **/ |
潘 |
174 |
onMounted(async () => { |
|
175 |
await getList() |
|
176 |
// 查询字典(精简)列表 |
|
177 |
projectList.value = await ProjectApi.list() |
|
178 |
}) |
|
179 |
</script> |