Commit bc7d5466 authored by zhouzihao's avatar zhouzihao

dev-构建日志没有查询条件的版本OC

parent e29e12b7
<style lang="postcss" scoped>
.home-container {
}
.demo-drawer-footer {
width: 100%;
position: absolute;
bottom: 0;
left: 0;
border-top: 1px solid #e8e8e8;
padding: 10px 16px;
text-align: right;
background: #fff;
}
</style>
<template>
<section class="home-container">
<MasterPage title="构建日志">
<div slot="title-icon">
<Icon type="ios-game-controller-b" />
</div>
<div slot="title-toolbar"></div>
<div slot="searchContent" class="search-content-slot">
<!-- TODO 这里要添加查询条件 -->
<!-- 表单位置 -->
</div>
<div slot="search">
<Button type="info" icon="ios-search" @click="getList">查询</Button>
</div>
<div slot="paddingContent">
<Table :columns="columns1" :data="data1"></Table>
</div>
<div slot="pager">
<Page :total="total" :current="page" :page-size="pageSize" @on-change="pageChange" />
</div>
</MasterPage>
</section>
</template>
<script>
import MasterPage from "@/components/Master";
import axios from "axios";
import config from "@/config/configs";
import _ from "lodash";
export default {
components: {
MasterPage
},
data() {
return {
columns1: [
{
title: "日志id",
key: "log_id",
width: 100,
fixed: "left"
},
{
title: "项目id",
key: "p_id",
width: 100
},
{
title: "项目名称",
key: "project_name",
width: 100
},
{
title: "构建环境",
key: "env_id",
width: 100,
render: (h, params) => {
return h("span", {}, this.getEnv(params.row.env_id));
}
},
{
title: "分支",
key: "branch",
width: 100
},
{
title: "版本",
key: "version",
width: 100
},
{
title: "构建是否成功",
key: "success",
width: 100,
render: (h, params) => {
let flag = params.row.success;
switch (flag) {
case 1:
return h(
"Tag",
{
props: {
color: "success"
}
},
"成功"
);
case 2:
return h(
"Tag",
{
props: {
color: "error"
}
},
"失败"
);
default:
return h(
"Tag",
{
props: {
color: "warning"
}
},
"执行中"
);
}
}
},
{
title: "镜像名称",
key: "image_name",
width: 100
},
{
title: "报错地址",
key: "fail_url"
},
{
title: "开始时间",
key: "create_time",
width: 100,
fixed: "right"
}
],
data1: [],
page: 1,
pageSize: 10,
total: 0,
isShow: false,
isAdd: false,
showData: {},
typeList: [],
envlist: [],
p_id: 0
};
},
methods: {
getList: function() {
axios
.get(
config.serve_url +
"/build/log/page?page=" +
this.page +
"&pageSize=" +
this.pageSize
)
.then(rs => {
if (rs.status == 200) {
console.log(JSON.stringify(rs));
this.data1 = rs.data.data;
this.total = rs.data.paged.total;
}
})
.catch(err => {
console.log(JSON.stringify(err));
});
},
addShow: function() {
this.isShow = true;
this.showData = {};
},
show: function(index) {
this.isShow = true;
this.showData = this.data1[index];
},
goConfigs: function(index) {
this.$router.push({ path: "/configList", query: this.data1[index] });
},
getEnvList: function() {
axios
.get(config.serve_url + "/env/")
.then(rs => {
if (rs.status == 200) {
this.envlist = rs.data;
}
})
.catch(err => {
console.log(JSON.stringify(err));
});
},
pageChange: function(i) {
this.page = i;
this.getList();
},
getTypeList: function() {
axios
.get(config.serve_url + "/meta/names/")
.then(rs => {
if (rs.status == 200) {
this.typeList = rs.data;
}
})
.catch(err => {
console.log(JSON.stringify(err));
});
},
getType(type_id) {
return _.find(this.typeList, { type_id: type_id }).name;
},
getEnv(env_id) {
return _.find(this.envlist, { env_id: env_id }).name;
}
},
mounted: function() {
this.getList();
this.getEnvList();
}
};
</script>
\ No newline at end of file
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