index.vue
8.77 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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
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
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
<template>
<!-- <el-tabs v-model="activeName"> -->
<!-- <el-tab-pane label="个性化管理" name="zhcx"> -->
<div class="main">
<!-- <p class="tips">查询条件</p> -->
<el-form
:inline="true"
ref="ruleForm"
class="demo-form-inline"
>
<el-form-item label="个性化标题" class="w100" prop="syqlx">
<el-input
placeholder="输入个性化标题"
v-model="queryData.title"
@change="getData"
></el-input>
</el-form-item>
<el-form-item label="个性化代码" class="w100" prop="zdtzm">
<el-input
placeholder="输入个性化代码"
v-model="queryData.code"
@change="getData"
></el-input>
</el-form-item>
<el-form-item class="ml20">
<el-button type="primary" @click="getData" icon="el-icon-search"
>查询</el-button
>
<el-button
type="warning"
style="margin-left:60px"
@click="reset"
icon="el-icon-refresh"
>重置</el-button
>
</el-form-item>
<el-form-item style="margin-left:-20px">
<el-button
type="primary"
@click="gxhVisible = true"
icon="el-icon-plus"
>新增</el-button
>
<el-button
type="success"
style="margin-left:60px"
@click="save"
icon="el-icon-folder"
>保存</el-button
>
</el-form-item>
</el-form>
<!-- <p class="tips">查询列表</p> -->
<div class="dataGrid" ref="dataGrid">
<el-table
:data="tableData"
:height="tableHeight"
>
<el-table-column
type="index"
width="80"
align="center"
label="序号"
>
</el-table-column>
<el-table-column prop="title" align="center" label="个性化标题">
</el-table-column>
<el-table-column prop="code" align="center" label="个性化代码">
</el-table-column>
<el-table-column prop="bz" align="center" label="备注">
</el-table-column>
<el-table-column prop="open" align="center" label="是否开启">
<template slot-scope="scope">
<el-switch
v-model="scope.row.open"
active-value="1"
inactive-value="0"
active-color="#409EFF"
inactive-color="#F56C6C"
@change="changeEnabled(scope.row)"
/>
</template>
</el-table-column>
<!-- <el-table-column width="80px" align="center" label="操作">
<template slot-scope="scope">
<el-tooltip class="item" effect="light" content="删除" placement="top">
<i class="iconfont iconshanchu1" @click="handleClick(scope.row)" style="padding:0 10px"></i>
</el-tooltip>
</template>
</el-table-column> -->
</el-table>
<div class="pagination">
<el-pagination
background
layout="prev, pager, next,total"
:total="total"
:current-page="pageNo"
:page-size="pageSize"
@current-change="handleCurrentChange"
>
</el-pagination>
</div>
<el-dialog
v-dialogDrag
:close-on-click-modal="false"
title="新增个性化配置"
:visible.sync="gxhVisible"
width="30%"
>
<el-form ref="form" class="addForm" :model="form" label-width="100px">
<el-form-item label="个性化标题">
<el-input v-model="form.title"></el-input>
</el-form-item>
<el-form-item label="个性化代码">
<el-input v-model="form.code"></el-input>
</el-form-item>
<el-form-item label="是否开启">
<el-switch v-model="form.open" active-value="1" inactive-value="0" ></el-switch>
</el-form-item>
<el-form-item label="备注">
<el-input v-model="form.bz"></el-input>
</el-form-item>
</el-form>
<div class="btnGroup">
<el-button type="primary" @click="addGxhData">确定</el-button>
<el-button type="primary" @click="gxhVisible = false"
>取消</el-button>
</div>
</el-dialog>
</div>
</div>
<!-- </el-tab-pane> -->
<!-- </el-tabs> -->
</template>
<script>
import { getGxhList,updateGxh,insertGxh } from "@api/gxhgl";
export default {
name: "",
inject: ["getRightTree", "getTreeByBsm"],
components: {},
props: {},
data() {
return {
activeName: "zhcx",
type: "all",
total: 0,
pageNo: 1,
pageSize: 15,
tableData: [
{
title: "宗地坐落必填",
code: "ZDZLBT",
bz: "宗地坐落必填",
open: true,
},
{
title: "宗地附件材料显示",
code: "ZDFJCLXS",
bz: "宗地附件材料显示",
open: false,
},
],
tableHeight: 0,
queryData: {
title: "",
code: "",
},
gxhVisible: false,
//新增数据
form:{
title: "",
code: "",
open:false,
bz:''
},
//已修改的数据
hasChanged:[],
};
},
created() {},
mounted() {
this.getData(this.queryData);
this.$nextTick(() => {
this.tableHeight =
(document.documentElement.clientHeight || document.body.clientHeight) -
277;
});
},
methods: {
//获取数据
getData() {
this.queryData.pageSize = this.pageSize;
this.queryData.pageNo = this.pageNo;
getGxhList(this.queryData).then((res) => {
this.tableData = res.result.records
this.total = res.result.total
// 查询后重置修改项
this.hasChanged = [];
})
.catch((error) => {});
//调用查询接口 给tableData赋值 TODO
},
//新增个性化配置
addGxhData() {
//调用接口 新增个性化配置数据 传入this.form TODO
insertGxh(this.form).then((res) => {
if(res.code == 200){
this.$message.success("添加成功")
this.gxhVisible = false;
this.getData();
}
})
.catch((error) => {});
},
//重置查询条件
reset() {
this.queryData = {
title: "",
code: "",
pageSize:"15",
pageNo:"1",
}
},
//翻页
handleCurrentChange(val) {
this.pageNo = val;
this.getData();
},
// 是否开启
changeEnabled(data) {
if(this.hasChanged.some( i => i.bsm == data.bsm)){
this.hasChanged.filter(i => i.bsm == data.bsm)
}else{
this.hasChanged.push(data);
}
},
//保存修改后的数据
save(){
if(this.hasChanged.length < 1){
this.$message.warning("暂无数据修改")
}else{
//接口调用 hasChanged为已修改数据项数组 TODO
updateGxh(this.hasChanged).then((res) => {
if(res.code == 200){
this.$message.success("修改成功")
}
this.getData();
})
.catch((error) => {});
}
},
//删除
handleClick(row){
//调用删除个性化数据接口,row是整条记录,需要id或者bsm自取 TODO
}
},
computed: {},
watch: {},
};
</script>
<style scoped lang="less">
.main {
width: 100%;
height: 100%;
box-sizing: border-box;
padding: 0 18px 0 0;
display: flex;
flex-direction: column;
//background-color: #F4F9FF;
background-color: #f4f9ff;
.el-form {
width: 100%;
border: 1px solid #e6e6e6;
background-color: white;
-webkit-box-sizing: border-box;
box-sizing: border-box;
padding: 10px 15px;
/deep/.el-form-item {
margin-bottom: 0;
}
/deep/.el-form-item__label {
width: 100px;
}
/deep/ .el-form-item__content {
width: 300px;
.el-select {
width: 100%;
}
}
}
.addForm{
border: 0;
/deep/.el-form-item {
margin-bottom: 10px;
}
/deep/ .el-form-item__content {
width: auto;
}
}
.tips {
color: #9b9b9b;
margin-left: 2px;
margin-bottom: 10px;
}
.demo-form-inline {
margin: 0 0 18px 0;
.moreSearchBtn {
background-color: #1ad6e1;
border-color: #1ad6e1;
}
.moreSearchBtn:focus,
.moreSearchBtn:hover {
background-color: rgba(28, 200, 229, 0.6);
}
}
.dataGrid {
flex: 1;
.pagination {
padding: 18px 0;
}
}
.hbjDialog {
/deep/ .el-dialog {
margin-top: 10vh !important;
}
}
.btnGroup {
margin: 20px auto 0;
width: 230px;
.el-button+.el-button{
margin-left: 90px;
}
}
.ml20 {
margin-left: 20px;
}
.iconfont{
cursor: pointer;
}
}
</style>