|
1
|
<template>
|
王硕
authored
|
2
3
|
<el-container style="padding: 20px">
<el-aside>
|
王硕
authored
|
4
|
<el-card :style="{ height: asideHeight }">
|
王硕
authored
|
5
6
7
8
9
10
11
12
13
14
15
16
17
|
<el-form label-width="80px">
<el-form-item label="参数编码">
<el-input
v-model="paramCode"
placeholder="请输入参数编码"
></el-input>
</el-form-item>
<el-form-item label="参数名称">
<el-input
v-model="paramName"
placeholder="请输入参数名称"
></el-input>
</el-form-item>
|
王硕
authored
|
18
|
|
王硕
authored
|
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
|
<el-form-item>
<el-row>
<el-col :span="8">
<el-button type="primary" size="small" @click="handleQuery"
>查询</el-button
>
</el-col>
<el-col :span="8">
<el-button type="success" size="small" @click="handleAdd"
>新增</el-button
>
</el-col>
</el-row>
<el-row style="margin-top: 5px">
<el-col :span="8">
<el-button type="warning" size="small" @click="handleEdit"
>编辑</el-button
>
</el-col>
<el-col :span="8">
<el-button type="danger" size="small" @click="handleDelete"
>删除</el-button
>
</el-col>
</el-row>
</el-form-item>
</el-form>
</el-card>
</el-aside>
|
王硕
authored
|
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
|
<el-dialog
title="新增字典"
:visible.sync="dialogFormVisible"
width="30%"
center
>
<el-form :model="form" label-width="80px">
<el-form-item label="参数编码">
<el-input v-model="form.code" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="参数名称">
<el-input v-model="form.name" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="参数值">
<el-input v-model="form.value" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="备注">
<el-input v-model="form.remark" autocomplete="off"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false">取 消</el-button>
<el-button type="primary" @click="handleAddData">确 定</el-button>
</span>
</el-dialog>
<el-dialog
|
|
74
|
title="编辑"
|
王硕
authored
|
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
|
:visible.sync="EditdialogFormVisible"
width="30%"
center
>
<el-form :model="Editform" label-width="80px">
<el-form-item label="参数编码">
<el-input v-model="Editform.code" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="参数名称">
<el-input v-model="Editform.name" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="参数值">
<el-input v-model="Editform.value" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="备注">
<el-input v-model="Editform.remark" autocomplete="off"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="EditdialogFormVisible = false">取 消</el-button>
<el-button type="primary" :loading="editLoading" @click="handleEditData"
>确 定</el-button
>
</span>
</el-dialog>
|
王硕
authored
|
100
101
102
103
|
<el-main>
<el-card>
<el-table
:data="tableData"
|
|
104
|
border
|
王硕
authored
|
105
|
style="width: 100%"
|
王硕
authored
|
106
|
:height="TableHeight"
|
王硕
authored
|
107
|
@selection-change="handleSelectionChange"
|
|
108
|
highlight-current-row
|
|
109
110
|
@row-click="handleRowClick"
ref="multipleTable"
|
王硕
authored
|
111
112
113
114
115
|
>
<el-table-column type="selection" width="55"></el-table-column>
<el-table-column prop="id" label="ID" width="80"></el-table-column>
<el-table-column prop="code" label="参数编码"></el-table-column>
<el-table-column prop="name" label="参数名称"></el-table-column>
|
|
116
117
118
119
120
|
<el-table-column
prop="value"
width="290"
label="参数值"
></el-table-column>
|
王硕
authored
|
121
|
<el-table-column prop="remark" label="备注"></el-table-column>
|
|
122
123
124
125
126
|
<el-table-column
prop="created"
width="180"
label="创建时间"
></el-table-column>
|
王硕
authored
|
127
|
<el-table-column prop="createdBy" label="创建人"></el-table-column>
|
|
128
129
130
131
132
|
<el-table-column
prop="updated"
width="180"
label="更新时间"
></el-table-column>
|
王硕
authored
|
133
134
135
136
137
138
139
140
141
142
143
|
<el-table-column prop="updatedBy" label="更新人"></el-table-column>
</el-table>
<el-pagination
style="margin-top: 15px"
align="center"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
layout="total, sizes, prev, pager, next, jumper"
|
王硕
authored
|
144
|
:total="total"
|
王硕
authored
|
145
146
147
148
|
/>
</el-card>
</el-main>
</el-container>
|
|
149
150
151
|
</template>
<script>
|
王硕
authored
|
152
153
154
155
156
157
|
import {
GetConfigsByPage,
AddConfig,
DeleteConfigs,
EditConfig,
} from "@/api/systemManage/config";
|
|
158
|
export default {
|
王硕
authored
|
159
|
name: "Config",
|
|
160
161
|
data() {
return {
|
王硕
authored
|
162
163
164
165
166
167
|
paramCode: "",
paramName: "",
currentPage: 1,
total: 0,
pageSize: 10,
selectedItems: [],
|
王硕
authored
|
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
|
dialogFormVisible: false,
form: {
code: "",
name: "",
value: "",
remark: "",
},
EditdialogFormVisible: false,
Editform: {
code: "",
name: "",
value: "",
remark: "",
},
editLoading: false,
tableData: [],
|
王硕
authored
|
184
|
};
|
|
185
|
},
|
王硕
authored
|
186
187
188
189
190
191
192
193
|
computed: {
TableHeight() {
return `calc(100vh - 220px )`;
},
asideHeight() {
return `calc(100vh - 150px)`;
},
},
|
|
194
|
methods: {
|
|
195
196
197
|
handleRowClick(row) {
this.$refs.multipleTable.toggleRowSelection(row);
},
|
王硕
authored
|
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
|
handleSelectionChange(val) {
this.selectedItems = val;
// console.log("选中的行数据:", this.selectedItems);
},
handleSizeChange(val) {
this.pageSize = val;
this.currentPage = 1;
this.handleQuery();
},
handleCurrentChange(val) {
this.currentPage = val;
this.handleQuery();
},
handleQuery() {
|
王硕
authored
|
213
214
215
216
217
218
219
220
221
222
223
224
225
226
|
const requestData = {
pageNumber: this.currentPage,
perPageCount: this.pageSize,
queryConfig: {
code: this.paramCode.trim(),
name: this.paramName.trim(),
},
};
GetConfigsByPage(requestData).then((res) => {
if (res.code == "Success" && res.data) {
this.tableData = res.data.data || res.data;
this.total = res.data.totalCount || res.data.data.length;
}
});
|
王硕
authored
|
227
228
|
},
handleAdd() {
|
王硕
authored
|
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
|
this.dialogFormVisible = true;
this.form = {
code: "",
name: "",
value: "",
remark: "",
};
},
handleAddData() {
if (!this.form.code) {
this.$message.error("参数编码不能为空");
return;
}
if (!this.form.name) {
this.$message.error("参数名称不能为空");
return;
}
if (!this.form.value) {
this.$message.error("参数值不能为空");
return;
}
AddConfig(this.form).then((res) => {
if (res.code === "Success") {
this.$message.success("新增成功");
this.dialogFormVisible = false;
this.handleQuery();
} else {
this.$message.error(res.message);
}
});
|
王硕
authored
|
259
260
|
},
handleEdit() {
|
王硕
authored
|
261
262
263
264
265
266
267
268
269
270
271
272
273
|
if (this.selectedItems.length === 0) {
this.$alert("请至少选择一条数据", "提示", {
confirmButtonText: "确定",
});
return;
}
if (this.selectedItems.length > 1) {
this.$alert("只能选择一条数据进行编辑", "提示", {
confirmButtonText: "确定",
});
return;
}
this.EditdialogFormVisible = true;
|
王硕
authored
|
274
|
this.Editform = { ...this.selectedItems[0] };
|
王硕
authored
|
275
276
277
278
279
280
281
282
283
284
285
286
287
|
},
handleEditData() {
this.editLoading = true;
EditConfig(this.Editform).then((res) => {
if (res.code === "Success") {
this.$message.success("数据修改成功");
this.EditdialogFormVisible = false;
this.editLoading = false;
this.handleQuery();
} else {
this.$message.error(res.message);
}
});
|
王硕
authored
|
288
289
|
},
handleDelete() {
|
王硕
authored
|
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
|
if (this.selectedItems.length === 0) {
this.$alert("请至少选择一条数据", "提示", {
confirmButtonText: "确定",
});
return;
}
this.$confirm("确定要删除选中的数据吗?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
const list = this.selectedItems;
DeleteConfigs(list).then((res) => {
if (res.code === "Success") {
this.$message.success("删除成功");
this.handleQuery();
}
});
})
.catch(() => {
this.$message.info("已取消删除");
});
|
王硕
authored
|
313
314
315
|
},
},
};
|
|
316
317
318
|
</script>
<style scoped>
|
王硕
authored
|
319
320
321
322
323
324
325
326
|
.el-card__body,
.el-main {
padding: 0 10px 0 10px;
}
::v-deep.el-table thead {
color: #101010;
font-weight: 600;
}
|
王硕
authored
|
327
328
329
|
.el-form-item {
margin-bottom: 18px;
}
|
|
330
331
332
|
.el-table__body tr.current-row {
background-color: #f0f9eb; /* 自定义高亮背景色 */
}
|
王硕
authored
|
333
|
</style>
|