248 lines
6.4 KiB
Vue
248 lines
6.4 KiB
Vue
<template>
|
|
<div class="log">
|
|
<div ref="leftContainer" class="left">
|
|
<el-form :inline="true">
|
|
<el-form-item label="发布版本" prop="Version">
|
|
<el-input v-model="searchData.Version" size="small" clearable />
|
|
</el-form-item>
|
|
<el-form-item label="更新功能" prop="UpdateContent">
|
|
<el-input v-model="searchData.UpdateContent" size="small" clearable />
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-button
|
|
type="primary"
|
|
icon="el-icon-search"
|
|
size="mini"
|
|
@click="getList"
|
|
>
|
|
查询
|
|
</el-button>
|
|
<el-button
|
|
type="primary"
|
|
icon="el-icon-plus"
|
|
size="mini"
|
|
@click="handleAdd"
|
|
>
|
|
新增
|
|
</el-button>
|
|
</el-form-item>
|
|
</el-form>
|
|
<el-table
|
|
v-loading="loading"
|
|
v-adaptive="{ bottomOffset: 45 }"
|
|
height="100"
|
|
:data="list"
|
|
class="table"
|
|
@sort-change="handleSortByColumn"
|
|
:default-sort="{ prop: 'PublishTime', order: 'descending' }"
|
|
>
|
|
<el-table-column type="index" width="50" />
|
|
<el-table-column
|
|
label="发布版本"
|
|
prop="Version"
|
|
min-width="90"
|
|
show-overflow-tooltip
|
|
sortable="custom"
|
|
/>
|
|
<el-table-column
|
|
label="更新功能"
|
|
prop="UpdateContent"
|
|
min-width="150"
|
|
show-overflow-tooltip
|
|
/>
|
|
<el-table-column
|
|
label="发布状态"
|
|
prop="State"
|
|
min-width="150"
|
|
show-overflow-tooltip
|
|
>
|
|
<template slot-scope="scope">
|
|
<span>{{ $fd("PublishStatus", scope.row.State) }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
label="发布日期"
|
|
prop="PublishTime"
|
|
min-width="90"
|
|
show-overflow-tooltip
|
|
sortable="custom"
|
|
>
|
|
<template slot-scope="scope">
|
|
{{
|
|
scope.row.PublishTime
|
|
? moment(scope.row.PublishTime).format("YYYY-MM-DD")
|
|
: ""
|
|
}}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
label="是否当前版本"
|
|
prop="IsCurrentVersion"
|
|
min-width="150"
|
|
show-overflow-tooltip
|
|
>
|
|
<template slot-scope="scope">
|
|
<span>{{ $fd("YesOrNo", scope.row.IsCurrentVersion) }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
label="操作"
|
|
fixed="right"
|
|
prop=""
|
|
min-width="200"
|
|
show-overflow-tooltip
|
|
>
|
|
<template slot-scope="scope">
|
|
<el-button
|
|
size="mini"
|
|
type="text"
|
|
icon="el-icon-edit-outline"
|
|
@click="handleEdit(scope.row)"
|
|
>
|
|
编辑
|
|
</el-button>
|
|
<el-button
|
|
size="mini"
|
|
type="text"
|
|
icon="el-icon-delete"
|
|
@click="handleDelete(scope.row)"
|
|
>
|
|
删除
|
|
</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
<div class="pagination" style="text-align: right; margin-top: 5px">
|
|
<pagination
|
|
:total="total"
|
|
:page.sync="searchData.PageIndex"
|
|
:limit.sync="searchData.PageSize"
|
|
@pagination="getList"
|
|
/>
|
|
</div>
|
|
<log-form ref="LogForm" @getList="getList" />
|
|
</div>
|
|
</div>
|
|
</template>
|
|
<script>
|
|
import { getPublishLogList, deletePublishLog } from "@/api/admin";
|
|
import Pagination from "@/components/Pagination";
|
|
import LogForm from "./components/LogForm.vue";
|
|
import moment from "moment";
|
|
const searchDataDefault = () => {
|
|
return {
|
|
Version: null,
|
|
UpdateContent: null,
|
|
Asc: false,
|
|
SortField: "PublishTime",
|
|
PageIndex: 1,
|
|
PageSize: 20,
|
|
};
|
|
};
|
|
export default {
|
|
components: { Pagination, LogForm },
|
|
data() {
|
|
return {
|
|
moment,
|
|
searchData: searchDataDefault(),
|
|
list: [],
|
|
total: 0,
|
|
loading: false,
|
|
};
|
|
},
|
|
mounted() {
|
|
this.getList();
|
|
},
|
|
methods: {
|
|
getList() {
|
|
this.loading = true;
|
|
getPublishLogList(this.searchData)
|
|
.then((res) => {
|
|
this.loading = false;
|
|
this.list = res.Result.CurrentPageData;
|
|
this.total = res.Result.TotalCount;
|
|
})
|
|
.catch(() => {
|
|
this.loading = false;
|
|
});
|
|
},
|
|
handleAdd() {
|
|
this.$nextTick(() => {
|
|
this.$refs["LogForm"].openDialog("新增", {});
|
|
});
|
|
},
|
|
handleEdit(row) {
|
|
this.$nextTick(() => {
|
|
this.$refs["LogForm"].openDialog("编辑", row);
|
|
});
|
|
},
|
|
// 重置列表查询
|
|
handleReset() {
|
|
this.searchData = searchDataDefault();
|
|
this.getList();
|
|
},
|
|
// 删除
|
|
handleDelete(row) {
|
|
this.$confirm("是否确认删除?", {
|
|
type: "warning",
|
|
distinguishCancelAndClose: true,
|
|
}).then(() => {
|
|
this.loading = true;
|
|
deletePublishLog(row.Id)
|
|
.then((res) => {
|
|
this.loading = false;
|
|
if (res.IsSuccess) {
|
|
this.getList();
|
|
this.$message.success(
|
|
this.$t("common:message:deletedSuccessfully")
|
|
);
|
|
}
|
|
})
|
|
.catch(() => {
|
|
this.loading = false;
|
|
});
|
|
});
|
|
},
|
|
// 排序
|
|
handleSortByColumn(column) {
|
|
if (column.order === "ascending") {
|
|
this.searchData.Asc = true;
|
|
} else {
|
|
this.searchData.Asc = false;
|
|
}
|
|
this.searchData.SortField = column.prop;
|
|
this.searchData.PageIndex = 1;
|
|
this.getList();
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
<style lang="scss">
|
|
.log {
|
|
height: 100%;
|
|
box-sizing: border-box;
|
|
display: flex;
|
|
padding: 10px;
|
|
border-radius: 5px;
|
|
.left {
|
|
display: flex;
|
|
flex-direction: column;
|
|
width: 0;
|
|
flex-grow: 4;
|
|
// border-right: 1px solid #ccc;
|
|
.filter-container {
|
|
display: flex;
|
|
align-items: center;
|
|
margin: 5px;
|
|
}
|
|
.data-table {
|
|
flex: 1;
|
|
padding: 5px 0px;
|
|
}
|
|
.pagination-container {
|
|
text-align: right;
|
|
}
|
|
}
|
|
}
|
|
</style>
|