Commit bfa7a507 authored by “yiyousong”'s avatar “yiyousong”

perf: 优化应用历史版本列表

parent a060b0cb
...@@ -45,66 +45,63 @@ ...@@ -45,66 +45,63 @@
<div class="version-manage flex1"> <div class="version-manage flex1">
<div class="title">版本管理</div> <div class="title">版本管理</div>
<div class="table-content"> <div class="table-content">
<a-table <y-table
:loading="loading"
size="small" size="small"
bordered bordered
:scroll="{ y: 350 }" :scroll="{ y: 350 }"
:columns="columns" :columns="columns"
:pagination="{ :data="tableData"
showTotal: (total) => `共 ${total} 条`, :pageSize.sync="size"
current: current, :page.sync="page"
total: total, :total="total"
pageSize: size, :loading="loading"
showSizeChanger: true, @changePagination="getVersions"
showQuickJumper: true,
size: 'small',
pageSizeOptions: pageSizeOptions,
onChange: handleChange,
onShowSizeChange: showSizeChange,
}"
:data-source="tableData"
:rowKey="(record) => record.id"
> >
<!-- 序号 --> <span slot="index" slot-scope="{ index }">{{
<span slot="num" slot-scope="text, record, index">{{ (page - 1) * size + index + 1
(current - 1) * size + index + 1
}}</span> }}</span>
<!-- 版本号 --> <!-- 版本号 -->
<template slot="version" slot-scope="text"> <template slot="version" slot-scope="{ record }">
v{{ text.version }} v{{ record.version }}
</template> </template>
<!-- 应用包 --> <!-- 应用包 -->
<template slot="fileName" slot-scope="text"> <template slot="fileName" slot-scope="{ record }">
<a v-if="text.fileName" class="primary">{{ text.fileName }}</a> <a v-if="record.fileName" class="primary">{{ record.fileName }}</a>
<span v-else>--</span> <span v-else>--</span>
</template> </template>
<!-- 当前是否使用 --> <!-- 当前是否使用 -->
<template slot="used" slot-scope="text"> <template slot="used" slot-scope="{ record }">
<a-tag v-if="text.used" color="blue"> 正在使用 </a-tag> <a-tag v-if="record.used" color="blue"> 正在使用 </a-tag>
<span v-else></span> <span v-else></span>
</template> </template>
<!-- 操作 --> <!-- 操作 -->
<template slot="action" slot-scope="text"> <template slot="action" slot-scope="{ record }">
<a-space size="middle"> <a-space size="middle">
<span <a-button
type="link"
class="primary pointer" class="primary pointer"
:disabled="text.used ? true : false" :disabled="record.used ? true : false"
@click="handleUse(text.id)" @click="handleUse(record.id)"
>使用</span >使用</a-button
> >
<span class="primary pointer" @click="handlePreview(text.id)" <a-button
>预览</span type="link"
class="primary pointer"
:disabled="record.used ? false : true"
@click="handlePreview(record.id)"
>预览</a-button
> >
<span <a-button
type="link"
class="delete pointer" class="delete pointer"
v-permission="[1]" v-permission="[1]"
@click="handleDel(text.id)" @click="handleDel(record.id)"
>删除</span >删除</a-button
> >
</a-space> </a-space>
</template> </template>
</a-table> </y-table>
</div> </div>
</div> </div>
<!-- 站点树弹窗 --> <!-- 站点树弹窗 -->
...@@ -127,8 +124,8 @@ import { ...@@ -127,8 +124,8 @@ import {
deleteVersion, deleteVersion,
} from "@/services/market"; } from "@/services/market";
import CheckSite from "../modal/CheckSite.vue"; import CheckSite from "../modal/CheckSite.vue";
import { pageSizeOptions } from "@/config/pageConfig.js";
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
import YTable from "@/components/YTable.vue";
export default { export default {
props: { props: {
// 应用信息 // 应用信息
...@@ -142,15 +139,15 @@ export default { ...@@ -142,15 +139,15 @@ export default {
}, },
components: { components: {
CheckSite, CheckSite,
YTable,
}, },
data() { data() {
const columns = [ const columns = [
{ {
title: "序号", title: "序号",
dataIndex: "num",
width: "65px", width: "65px",
scopedSlots: { scopedSlots: {
customRender: "num", customRender: "index",
}, },
}, },
{ {
...@@ -181,11 +178,10 @@ export default { ...@@ -181,11 +178,10 @@ export default {
columns, columns,
appId: this.$route.query.id, appId: this.$route.query.id,
appInfo: {}, // 应用信息 appInfo: {}, // 应用信息
current: 1, page: 1,
size: 10, size: 10,
total: 0, total: 0,
loading: false, loading: false,
pageSizeOptions,
form: {}, form: {},
tableData: [], tableData: [],
siteVisible: false, siteVisible: false,
...@@ -224,7 +220,7 @@ export default { ...@@ -224,7 +220,7 @@ export default {
async getVersions() { async getVersions() {
this.loading = true; this.loading = true;
let res = await getVersionList({ let res = await getVersionList({
page: this.current, page: this.page,
size: this.size, size: this.size,
appId: this.appId, appId: this.appId,
}); });
...@@ -304,17 +300,6 @@ export default { ...@@ -304,17 +300,6 @@ export default {
}); });
}, },
// 翻页
handleChange(cur) {
this.current = cur;
this.getVersions();
},
// 改变每页显示数量
showSizeChange(cur, size) {
this.current = cur;
this.size = size;
this.getVersions();
},
// 查看试用范围详情 // 查看试用范围详情
checkSite(siteList) { checkSite(siteList) {
this.$refs.CheckSite.getSiteList(siteList); this.$refs.CheckSite.getSiteList(siteList);
...@@ -387,4 +372,7 @@ export default { ...@@ -387,4 +372,7 @@ export default {
/deep/.ant-form-item { /deep/.ant-form-item {
align-items: flex-start; align-items: flex-start;
} }
/deep/.ant-btn-link {
padding: 0px;
}
</style> </style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment