index.vue
10.1 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
<template>
<div class="main">
<div class="button">
<el-button type="primary" @click="oneExit">编辑</el-button>
<el-button type="primary" @click="save">保存</el-button>
<el-button type="primary" @click="batchExit">批量修改</el-button>
</div>
<div class="table">
<table border="1">
<tr>
<td><input type="checkbox" @click="allcheck" v-model="isCheckAll"/></td>
<td>界址点号</td>
<td>顺序号</td>
<td>X坐标值</td>
<td>Y坐标值</td>
<td>界标类型</td>
<td>界址点类型</td>
</tr>
<tr v-for="(item,index) in jzdlist" :key="index">
<td><input type="checkbox" v-model="item.isCheck" @change="changeAll"/></td>
<td><input type="text" class="formInput" v-model="item.jzdh" readonly="readonly"/></td>
<td><input type="text" class="formInput" v-model="item.sxh" readonly="readonly"/></td>
<td><input type="text" class="formInput" v-model="item.xzbz" :readonly="item.iszb"
@keydown="oninput"/></td>
<td><input tepe="text" class="formInput" v-model="item.yzbz" :readonly="item.iszb"
@keydown="oninput"/></td>
<td>
<el-select v-model="item.jblx" :disabled="item.jzdisdisabled">
<el-option
v-for="i in jblx"
:key="i.key"
:label="i.label"
:value="i.value"
></el-option>
</el-select>
</td>
<td>
<el-select v-model="item.jzdlx" :disabled="item.jzdisdisabled">
<el-option
v-for="i in jzdlx"
:key="i.key"
:label="i.label"
:value="i.value"
></el-option>
</el-select>
</td>
</tr>
</table>
</div>
<div>
<el-dialog
title="批量修改"
:visible.sync="centerDialogVisible"
width="30%"
center>
<div class="plxg">
<div>
<span class="batchlx"> 界标类型:</span>
<el-select v-model="batchJzd.jblx">
<el-option
v-for="i in jblx"
:key="i.key"
:label="i.label"
:value="i.value"
></el-option>
</el-select>
</div>
<div>
<span class="batchlx">界址点类型:</span>
<el-select v-model="batchJzd.jzdlx">
<el-option
v-for="i in jzdlx"
:key="i.key"
:label="i.label"
:value="i.value"
></el-option>
</el-select>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="centerDialogVisible = false">取 消</el-button>
<el-button type="primary" @click="jzdbatchsave">确 定</el-button>
</span>
</el-dialog>
</div>
</div>
</template>
<script>
import {queryjzd, jzdsingleModify, jzdbatchModify} from '../../../api/zd'
import {Message} from 'element-ui'
export default {
name: "界址点",
components: {},
props: {},
data() {
return {
isCheckAll: false,
centerDialogVisible: false,
jblx: [
{
key: '1',
label: '钢钉',
value: '1'
}, {
key: '2',
label: '水泥桩',
value: '2'
}, {
key: '3',
label: '石灰桩',
value: '3'
}, {
key: '4',
label: '喷绘',
value: '4'
}, {
key: '5',
label: '瓷标志',
value: '5'
}, {
key: '6',
label: '无标志',
value: '6'
}, {
key: '7',
label: '其他',
value: '7'
},
],
jzdlx: [
{
key: '1',
label: '解析界址点',
value: '1'
}, {
key: '2',
label: '图解界址点',
value: '2'
}, {
key: '3',
label: '航测界址点',
value: '3'
}, {
key: '4',
label: '其他',
value: '4'
}
],
jzdlist: [],
batchJzd: {
bsms: [],
jblx: '1',
jzdlx: '1'
}
}
},
created() {
},
mounted() {
// 该标识码继承过来
let bsm = '401044005bad0557d5e3787239d8e18e';
this.getData(bsm)
},
methods: {
getData(bsm) {
queryjzd(bsm).then(res => {
for (let i = 0; i < res.result.length; i++) {
res.result[i]['isCheck'] = false;
res.result[i]['iszb'] = 'readonly';
res.result[i]['jzdisdisabled'] = true;
}
this.jzdlist = res.result;
})
},
save() {
console.log("保存....");
jzdsingleModify(this.jzdlist).then(res => {
console.log(res)
if (res.success) {
Message.success("保存成功")
} else {
Message.error(res.message)
}
})
for (let item of this.jzdlist) {
if (item.isCheck) {
item.iszb = 'readonly';
item.jbisdisabled = true;
item.jzdisdisabled = true;
}
}
},
oninput(e) {
e.target.value = (e.target.value.match(/^\d*(\.?\d{0,4})/g)[0]) || null
},
changeAll(e) {
if (!e.target.checked) {
this.isCheckAll = false;
return
}
for (let item of this.jzdlist) {
if (!item.isCheck) {
this.isCheckAll = false;
return
}
}
this.isCheckAll = true;
},
allcheck(value) {
for (let item of this.jzdlist) {
item.isCheck = value.target.checked;
}
},
oneExit() {
for (let item of this.jzdlist) {
if (item.isCheck) {
item.iszb = false;
item.jzdisdisabled = false;
}
}
},
batchExit() {
console.log("批量修改")
let flag = false;
for (let item of this.jzdlist) {
if (item.isCheck) {
flag = true;
}
}
if (flag) {
this.centerDialogVisible = true;
} else {
Message.info("请勾选要修改的数据")
}
},
jzdbatchsave() {
this.batchJzd.bsms.length = 0;
for (let item of this.jzdlist) {
if (item.isCheck) {
this.batchJzd.bsms.push(item.bsm);
}
}
jzdbatchModify(this.batchJzd).then(res => {
console.log(res)
if (res.success) {
this.centerDialogVisible = false;
} else {
Message.error("修改失败")
}
})
}
},
computed: {},
watch: {},
}
</script>
<style scoped lang="less">
/* /deep/ .el-input.is-disabled .el-input__inner {
color: #606764;
}*/
.main {
box-sizing: border-box;
padding: 18px;
height: auto;
width: 80%;
}
table {
margin-top: 10px;
background-color: #fff;
font-size: 14px;
width: 100%;
}
td {
text-align: center;
height: 36px;
}
table .formInput {
margin: 0;
height: 36px;
outline: none;
border: none;
color: #606764;
overflow: visible;
text-align: center;
cursor: text;
}
table:hover {
cursor: pointer;
}
.batchlx {
text-align: center;
}
</style>