index.vue
3.96 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<template>
<div class="form-header container">
<el-row>
<el-col>
<yl-form
ref="ruleForm"
:formConfig="formConfig"
:queryForm="queryForm"
/>
</el-col>
</el-row>
<yl-table
:attrs="tableAttr"
:loadingTable="tableAttr.loadingTable"
:columns="columns"
:tableData="tableData"
:pageConfig="pageConfig"
@sizeChange="handleSizeChange"
@currentChange="handleCurrentChange"
@search="searchBtn"
@restForm="restForm"
@add="addBtn"
>
</yl-table>
</div>
</template>
<script>
import YlForm from "@/components/YlForm";
import YlTable from "@/components/YlTable";
import { formConfig } from "./formConfig";
import { tableAttr, columnHeader } from "./tableConfig";
import {
findAllEtesRules, // ET86查询
} from "@/api/et86";
export default {
components: {
YlForm,
YlTable,
},
data() {
return {
formConfig: formConfig, // 表单配置项
queryForm: { // 表单参数
status: "有效",
},
pageConfig: { // 分页配置项
isPagination: true,
total: 0,
pageData: {
page: 1,
size: 10,
},
},
tableAttr: tableAttr, // table配置项
columns: columnHeader(this.viewRow, this.editRow, this.deleteRow), // 表头
tableData: [], // 表格数据
selectionList: [], // table复选框筛选集合
};
},
created() {
// ET86查询
this.$nextTick(() => {
this.searchBtn();
});
},
mounted() {},
methods: {
// ET86查询
queryFindAllEtesRules(params) {
this.tableAttr.loadingTable = true;
findAllEtesRules(params)
.then((res) => {
this.tableAttr.loadingTable = false;
const { code, data } = res;
if (code == 200) {
this.tableData = data.list;
this.pageConfig.total = data.total;
}
})
.catch(() => {});
},
// table复选框事件
selectionTable(e) {
this.selectionList = e;
},
//条数变化
handleSizeChange(e) {
this.pageConfig.pageData.size = e;
this.pageConfig.pageData.page = 1;
this.searchBtn();
},
//页码变化
handleCurrentChange(e) {
this.pageConfig.pageData.page = e;
this.searchBtn();
},
// 搜索
searchBtn(row) {
let params = {
createTimeStart: this.queryForm.startTime
? this.queryForm.startTime
: "",
createTimeEnd: this.queryForm.endTime ? this.queryForm.endTime : "",
limitStart: this.pageConfig.pageData.page,
limitSize: this.pageConfig.pageData.size,
status: this.queryForm.status,
};
if (this.queryForm.status == "有效") {
params.status = "1";
}
this.$refs.ruleForm.handleSearch("ruleForm", (val) => {
this.queryFindAllEtesRules(params);
});
},
// 重置表单
restForm() {
this.$refs.ruleForm.resetFields("ruleForm");
},
// 添加
addBtn(item) {
console.log("add:", item);
this.$router.push({
name: "edit",
params: {
name: "add",
},
});
},
// 查看
viewRow({ row }) {
this.$router.push({
name: "edit",
params: {
name: "view",
id: row.id,
status: row.status
},
});
console.log("查看:", row);
},
// 编辑
editRow({ row }) {
this.$router.push({
name: "edit",
params: {
name: "edit",
id: row.id,
},
});
},
// 删除
deleteRow({ row }) {
this.$confirm("是否确认删除?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
center: true,
}).then(() => {
console.log("删除:", row);
this.msgSuccess("删除成功!");
}).catch(() => {});
},
},
};
</script>
<style lang="scss" scoped></style>