DetectionTemplatePage.vue
3.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<template>
<a-card class="tabs-card" :bordered="false">
<div
class="table-operations"
style="margin-bottom: 16px; width: 100%; float: left"
>
<div class="flex justify-end" style="float: left">检测模板管理</div>
</div>
<a-table
:columns="columns"
:data-source="pagination.content"
:loading="loading"
:bordered="false"
@change="pageRefresh"
@resizeColumn="this.$filters.tableResizeColumn"
size="small"
:pagination="pageState"
:row-key="(record) => record.id"
:scroll="{ y: 'calc(100vh - 350px)' }"
>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'action'">
<router-link
:to="{
path: '/detection/template/preview',
query: { id: record.id },
}"
>
<a-button type="link" size="small">预览</a-button>
</router-link>
</template>
</template>
</a-table>
</a-card>
</template>
<script lang="ts">
import { Component } from "vue-facing-decorator";
import { TableColumnsType } from "ant-design-vue";
import { PaginationComponent } from "@/components/PaginationComponent";
import { DetectionController } from "@/api/DetectionController";
interface InspectionTemplate {
id: number;
templateName: string;
templateType: number;
description: string;
}
@Component({})
export default class DetectionTemplatePage extends PaginationComponent<InspectionTemplate> {
/**
* 表格列配置
*/
columns: TableColumnsType = [
{
title: "序号",
key: "index",
width: 70,
align: "center",
fixed: "left",
sorter: false,
customRender: ({ index }) => {
const pager = this.getPagination();
return (pager.pageIndex - 1) * pager.pageSize + index + 1;
},
},
{
title: "模板ID",
dataIndex: "templateCode",
key: "templateCode",
align: "center",
},
{
title: "模板名称",
dataIndex: "templateName",
key: "templateName",
align: "center",
},
{
title: "适配车型",
dataIndex: "templateType",
key: "templateType",
align: "center",
customRender: ({ text }) => {
return (
{
1: "燃油车",
2: "新能源车",
}[Number(text)] || "-"
);
},
},
{
title: "备注说明",
dataIndex: "description",
key: "description",
align: "center",
width: 370,
resizable: true,
ellipsis: true,
},
{
title: "操作",
key: "action",
width: 170,
align: "center",
fixed: "right",
},
];
getPagination() {
return this.pagination;
}
/**
* 初始化配置
*/
created(): void {
const url = DetectionController.PAGE_INSPECTOR_REPORT_INSPECTOR;
this.init(this.axios, url);
this.pageLoad();
}
}
</script>