|
@ -6,10 +6,7 @@
|
6
|
6
|
<div class="label">设备类型:</div>
|
7
|
7
|
<div class="input-rule">
|
8
|
8
|
<t-select v-model="queryCondition.equipmentType" style="width: 200px" clearable placeholder="请选择...">
|
9
|
|
<t-option value="001">船舶</t-option>
|
10
|
|
<t-option value="002">风机</t-option>
|
11
|
|
<t-option value="003">升压站</t-option>
|
12
|
|
<t-option value="004">测风塔</t-option>
|
|
9
|
<t-option v-for="(item,index) in typeList" :value="item.resourceToolType" :key="index+'type'">{{ item.name }}</t-option>
|
13
|
10
|
</t-select>
|
14
|
11
|
</div>
|
15
|
12
|
</div>
|
|
@ -29,7 +26,7 @@
|
29
|
26
|
<t-button color="success" icon="search-outline" @click="onSearch">查询</t-button>
|
30
|
27
|
<t-button color="secondary" icon="loading" class="reset-btn" @click="onReset">重置</t-button>
|
31
|
28
|
<t-button color="secondary" icon="upload-outline" @click="toExport">导出至Excel</t-button>
|
32
|
|
<t-button color="secondary" icon="delete-outline" @click="toExport">删除</t-button>
|
|
29
|
<t-button color="secondary" icon="delete-outline" @click="batchDelete">删除</t-button>
|
33
|
30
|
</div>
|
34
|
31
|
</div>
|
35
|
32
|
<div class="search-ctn" style="justify-content: flex-end;">
|
|
@ -41,32 +38,19 @@
|
41
|
38
|
</div>
|
42
|
39
|
</div>
|
43
|
40
|
<div>
|
44
|
|
<t-table :data="table.data">
|
|
41
|
<t-table :data="table.data" :loading="tableLoading" @selection-change="handleSelectionChange">
|
45
|
42
|
<t-table-column type="selection" width="70"></t-table-column>
|
46
|
|
<t-table-column prop="FACILITY_NAME" label="设备名称"></t-table-column>
|
47
|
|
<t-table-column prop="FACILITY_CODE" label="设备编号"></t-table-column>
|
48
|
|
<t-table-column prop="FACILITY_TYPE" label="设备类型">
|
49
|
|
<template slot-scope="scope">
|
50
|
|
<div v-if="scope.row.FACILITY_TYPE==1">
|
51
|
|
<span >船舶</span>
|
52
|
|
</div>
|
53
|
|
<div v-if="scope.row.FACILITY_TYPE==2">
|
54
|
|
<span>风机</span>
|
55
|
|
</div>
|
56
|
|
<div v-if="scope.row.FACILITY_TYPE==3">
|
57
|
|
<span>升压站</span>
|
58
|
|
</div>
|
59
|
|
<div v-if="scope.row.FACILITY_TYPE==4">
|
60
|
|
<span>测风塔</span>
|
61
|
|
</div>
|
62
|
|
</template>
|
|
43
|
<t-table-column prop="resourceToolName" label="设备名称"></t-table-column>
|
|
44
|
<t-table-column prop="resourceToolCode" label="设备编号"></t-table-column>
|
|
45
|
<t-table-column :formatter="type_formatter" prop="resourceToolType" label="设备类型">
|
63
|
46
|
</t-table-column>
|
64
|
|
<t-table-column :formatter="longLatFormatter" prop="LONGITUDE" label="经度"></t-table-column>
|
65
|
|
<t-table-column :formatter="longLatFormatter" prop="LATITUDE" label="纬度"></t-table-column>
|
|
47
|
<t-table-column prop="radius" label="半径"></t-table-column>
|
|
48
|
<t-table-column prop="longitude" label="经度"></t-table-column>
|
|
49
|
<t-table-column prop="latitude" label="纬度"></t-table-column>
|
66
|
50
|
<t-table-column
|
67
|
|
fixed="right"
|
68
|
|
label="操作"
|
69
|
|
width="120"
|
|
51
|
fixed="right"
|
|
52
|
label="操作"
|
|
53
|
width="120"
|
70
|
54
|
>
|
71
|
55
|
<template slot-scope="scope">
|
72
|
56
|
<a href="javascript:void(0)" size="sm" @click="handleClick(scope.row)">编辑</a>
|
|
@ -84,11 +68,11 @@
|
84
|
68
|
@on-change="onPagerChange">
|
85
|
69
|
</t-pager>
|
86
|
70
|
</div>
|
87
|
|
<t-modal :visibled.sync="modal":mask-closable="false" title="新增设备" >
|
|
71
|
<t-modal :visibled.sync="modal" :mask-closable="false" title="新增设备" >
|
88
|
72
|
<t-form ref="formValidate" :model="formValidate" :rules="ruleValidate" :label-width="80" label-position="left">
|
89
|
73
|
<t-form-item label="设备类型" prop="type">
|
90
|
|
<t-select v-model="formValidate.type" placeholder="请选择设备类型" clearable @change="typeChange(1)">
|
91
|
|
<t-option v-for="(item, index) in typeList" :value="item.value" :key="index">{{ item.label }}</t-option>
|
|
74
|
<t-select v-model="formValidate.type" placeholder="请选择设备类型" clearable>
|
|
75
|
<t-option v-for="(item,index) in typeList" :value="item.resourceToolType" :key="index+'type'">{{ item.name }}</t-option>
|
92
|
76
|
</t-select>
|
93
|
77
|
</t-form-item>
|
94
|
78
|
<t-form-item label="设备名称" prop="name">
|
|
@ -97,14 +81,17 @@
|
97
|
81
|
<t-form-item label="设备编号" prop="number">
|
98
|
82
|
<t-input v-model="formValidate.number" placeholder="请输入字母、数字、中划线、下划线、#"></t-input>
|
99
|
83
|
</t-form-item>
|
100
|
|
<div v-if="!lngLatDisabled">
|
|
84
|
<t-form-item label="半径" prop="radius">
|
|
85
|
<t-input v-model="formValidate.radius" placeholder="请输入设备名称"></t-input>
|
|
86
|
</t-form-item>
|
|
87
|
<div v-if="formValidate.type!=='001'">
|
101
|
88
|
<t-form-item label="经度" prop="lng">
|
102
|
|
<t-format-input v-model="formValidate.lng" numeral numeral-decimal-scale=8 placeholder="请输入数字"></t-format-input>
|
|
89
|
<t-format-input v-model="formValidate.lng" :numeral-decimal-scale="8" numeral placeholder="请输入数字"></t-format-input>
|
103
|
90
|
</t-form-item>
|
104
|
91
|
</div>
|
105
|
|
<div v-if="!lngLatDisabled">
|
|
92
|
<div v-if="formValidate.type!=='001'">
|
106
|
93
|
<t-form-item label="纬度" prop="lat">
|
107
|
|
<t-format-input v-model="formValidate.lat" numeral numeral-decimal-scale=8 placeholder="请输入数字"></t-format-input>
|
|
94
|
<t-format-input v-model="formValidate.lat" :numeral-decimal-scale="8" numeral placeholder="请输入数字"></t-format-input>
|
108
|
95
|
</t-form-item>
|
109
|
96
|
</div>
|
110
|
97
|
</t-form>
|
|
@ -113,27 +100,28 @@
|
113
|
100
|
<t-button class="submit-button" @click="submit">保存</t-button>
|
114
|
101
|
</div>
|
115
|
102
|
</t-modal>
|
116
|
|
<t-modal :visibled.sync="updateModal":mask-closable="false" title="编辑设备" >
|
117
|
|
<t-form ref="updateRow" :model="updateRow" :rules="updateRowValidate" :label-width="80" label-position="left">
|
118
|
|
<t-form-item label="设备类型" prop="FACILITY_TYPE">
|
119
|
|
<t-select v-model="updateRow.FACILITY_TYPE" placeholder="请选择设备类型" clearable @change="typeChange(2)">
|
120
|
|
<t-option v-for="(item, index) in typeList" :value="item.value" :key="index">{{ item.label }}</t-option>
|
121
|
|
</t-select>
|
|
103
|
<t-modal :visibled.sync="updateModal" :mask-closable="false" title="编辑设备" >
|
|
104
|
<t-form ref="updateRow" :model="updateRow" :rules="ruleUpdateValidate" :label-width="80" label-position="left">
|
|
105
|
<t-form-item label="设备类型" prop="resourceToolType">
|
|
106
|
{{ updateRow.name }}
|
122
|
107
|
</t-form-item>
|
123
|
|
<t-form-item label="设备名称" prop="FACILITY_NAME">
|
124
|
|
<t-input v-model="updateRow.FACILITY_NAME" placeholder="请输入设备名称"></t-input>
|
|
108
|
<t-form-item label="设备编号" prop="resourceToolCode">
|
|
109
|
{{ updateRow.resourceToolCode }}
|
125
|
110
|
</t-form-item>
|
126
|
|
<t-form-item label="设备编号" prop="FACILITY_CODE">
|
127
|
|
{{ updateRow.FACILITY_CODE }}
|
|
111
|
<t-form-item label="设备名称" prop="resourceToolName">
|
|
112
|
<t-input v-model="updateRow.resourceToolName" placeholder="请输入设备名称"></t-input>
|
128
|
113
|
</t-form-item>
|
129
|
|
<div v-if="!lngLatDisabled">
|
130
|
|
<t-form-item label="经度" prop="LONGITUDE">
|
131
|
|
<t-format-input v-model="updateRow.LONGITUDE" numeral numeral-decimal-scale=8 placeholder="请输入数字"></t-format-input>
|
|
114
|
<t-form-item label="半径" prop="radius">
|
|
115
|
<t-input v-model="updateRow.radius" numeral placeholder="请输入设备半径"></t-input>
|
|
116
|
</t-form-item>
|
|
117
|
<div v-if="updateRow.resourceToolType!=='001'">
|
|
118
|
<t-form-item label="经度" prop="longitude">
|
|
119
|
<t-format-input v-model="updateRow.longitude" :numeral-decimal-scale="8" numeral placeholder="请输入数字"></t-format-input>
|
132
|
120
|
</t-form-item>
|
133
|
121
|
</div>
|
134
|
|
<div v-if="!lngLatDisabled">
|
135
|
|
<t-form-item label="纬度" prop="LATITUDE">
|
136
|
|
<t-format-input v-model="updateRow.LATITUDE" numeral numeral-decimal-scale=8 placeholder="请输入数字"></t-format-input>
|
|
122
|
<div v-if="updateRow.resourceToolType!=='001'">
|
|
123
|
<t-form-item label="纬度" prop="latitude">
|
|
124
|
<t-format-input v-model="updateRow.latitude" :numeral-decimal-scale="8" numeral placeholder="请输入数字"></t-format-input>
|
137
|
125
|
</t-form-item>
|
138
|
126
|
</div>
|
139
|
127
|
</t-form>
|
|
@ -142,6 +130,7 @@
|
142
|
130
|
<t-button class="submit-button" @click="updateSubmit">保存</t-button>
|
143
|
131
|
</div>
|
144
|
132
|
</t-modal>
|
|
133
|
<t-loading v-model="fullLoading" fullscreen tip="加载中...."></t-loading>
|
145
|
134
|
</div>
|
146
|
135
|
</template>
|
147
|
136
|
<script>
|
|
@ -150,31 +139,7 @@ import services from '../../conf/services'
|
150
|
139
|
export default {
|
151
|
140
|
data() {
|
152
|
141
|
return {
|
153
|
|
// currentLoading: false,
|
154
|
|
// searchResult: [],
|
155
|
|
// demoDataA: [],
|
156
|
|
// currentLoading_n: false,
|
157
|
|
// searchResult_n: [],
|
158
|
|
// demoDataA_n: [],
|
159
|
|
lngLatDisabled: false,
|
160
|
|
typeList: [
|
161
|
|
{
|
162
|
|
value: '001',
|
163
|
|
label: '船舶'
|
164
|
|
},
|
165
|
|
{
|
166
|
|
value: '002',
|
167
|
|
label: '风机'
|
168
|
|
},
|
169
|
|
{
|
170
|
|
value: '003',
|
171
|
|
label: '升压站'
|
172
|
|
},
|
173
|
|
{
|
174
|
|
value: '004',
|
175
|
|
label: '测风塔'
|
176
|
|
}
|
177
|
|
],
|
|
142
|
typeList: [],
|
178
|
143
|
table: {
|
179
|
144
|
data: [
|
180
|
145
|
],
|
|
@ -184,25 +149,28 @@ export default {
|
184
|
149
|
total: 0
|
185
|
150
|
}
|
186
|
151
|
},
|
|
152
|
selection: [],
|
|
153
|
tableLoading: true,
|
|
154
|
fullLoading: false,
|
187
|
155
|
queryCondition: {
|
188
|
|
type: '',
|
189
|
|
equipmentType: '',
|
|
156
|
equipmentType: null,
|
190
|
157
|
equipmentName: '',
|
191
|
158
|
equipmentNumber: ''
|
192
|
159
|
},
|
193
|
|
rangeDate: '',
|
194
|
160
|
modal: false,
|
195
|
161
|
updateModal: false,
|
196
|
162
|
updateRow: {
|
197
|
|
FACILITY_TYPE: '',
|
198
|
|
FACILITY_NAME: '',
|
199
|
|
FACILITY_CODE: '',
|
200
|
|
LONGITUDE: '',
|
201
|
|
LATITUDE: ''
|
|
163
|
resourceToolType: '',
|
|
164
|
resourceToolName: '',
|
|
165
|
radius: null,
|
|
166
|
resourceToolCode: '',
|
|
167
|
longitude: '',
|
|
168
|
latitude: ''
|
202
|
169
|
},
|
203
|
170
|
formValidate: {
|
204
|
171
|
type: '',
|
205
|
172
|
name: '',
|
|
173
|
radius: null,
|
206
|
174
|
number: '',
|
207
|
175
|
lng: '',
|
208
|
176
|
lat: ''
|
|
@ -225,9 +193,14 @@ export default {
|
225
|
193
|
t: this,
|
226
|
194
|
validator: async function(rule, value, callback) {
|
227
|
195
|
// TODO 判断编号重复
|
228
|
|
if (await rule.t.checkReptition(1, value)) {
|
|
196
|
var flag = await rule.t.checkReptition({
|
|
197
|
resourceToolName: value
|
|
198
|
})
|
|
199
|
console.log(flag)
|
|
200
|
if (flag) {
|
|
201
|
console.log('编号重复')
|
229
|
202
|
callback(rule.message)
|
230
|
|
}else {
|
|
203
|
} else {
|
231
|
204
|
return true
|
232
|
205
|
}
|
233
|
206
|
}
|
|
@ -248,7 +221,10 @@ export default {
|
248
|
221
|
callback(rule.message)
|
249
|
222
|
} else {
|
250
|
223
|
// TODO 判断编号重复
|
251
|
|
var y = await rule.t.checkReptition(2, value)
|
|
224
|
var y = await rule.t.checkReptition({
|
|
225
|
resourceToolCode: value
|
|
226
|
})
|
|
227
|
console.log(y)
|
252
|
228
|
if (y) {
|
253
|
229
|
rule.message = '编号重复'
|
254
|
230
|
callback(rule.message)
|
|
@ -259,6 +235,19 @@ export default {
|
259
|
235
|
}
|
260
|
236
|
}
|
261
|
237
|
],
|
|
238
|
radius: [
|
|
239
|
{
|
|
240
|
message: '请输入数字',
|
|
241
|
trigger: 'blur',
|
|
242
|
validator: function(rule, value, callback) {
|
|
243
|
if (isNaN(value)) {
|
|
244
|
callback(rule.message)
|
|
245
|
} else {
|
|
246
|
return true
|
|
247
|
}
|
|
248
|
}
|
|
249
|
}
|
|
250
|
],
|
262
|
251
|
lng: [
|
263
|
252
|
{
|
264
|
253
|
required: true,
|
|
@ -280,7 +269,7 @@ export default {
|
280
|
269
|
lat: [
|
281
|
270
|
{
|
282
|
271
|
required: true,
|
283
|
|
message: '经度不能为空',
|
|
272
|
message: '纬度不能为空',
|
284
|
273
|
trigger: 'blur'
|
285
|
274
|
},
|
286
|
275
|
{
|
|
@ -296,26 +285,34 @@ export default {
|
296
|
285
|
}
|
297
|
286
|
]
|
298
|
287
|
},
|
299
|
|
updateRowValidate: {
|
300
|
|
FACILITY_TYPE: [{
|
301
|
|
required: true,
|
302
|
|
message: '设备类型不能为空',
|
303
|
|
trigger: 'change'
|
304
|
|
}],
|
305
|
|
FACILITY_NAME: [
|
|
288
|
ruleUpdateValidate: {
|
|
289
|
resourceToolName: [
|
306
|
290
|
{
|
307
|
291
|
required: true,
|
308
|
292
|
message: '设备名称不能为空',
|
309
|
|
trigger: 'blur'
|
|
293
|
trigger: 'blur',
|
|
294
|
validator: (rule, value, callback) => {
|
|
295
|
console.log(value)
|
|
296
|
if (value) {
|
|
297
|
callback()
|
|
298
|
} else {
|
|
299
|
callback(rule.message)
|
|
300
|
}
|
|
301
|
}
|
310
|
302
|
},
|
311
|
303
|
{
|
312
|
304
|
message: '设备名称重复',
|
313
|
305
|
trigger: 'blur',
|
314
|
306
|
t: this,
|
315
|
307
|
validator: async function(rule, value, callback) {
|
|
308
|
console.log(value)
|
316
|
309
|
// TODO 判断编号重复
|
317
|
|
var x = await rule.t.checkReptition(3, value)
|
318
|
|
if (x) {
|
|
310
|
var flag = await rule.t.checkReptition({
|
|
311
|
resourceToolName: value
|
|
312
|
})
|
|
313
|
console.log(flag)
|
|
314
|
if (flag) {
|
|
315
|
console.log('编号重复')
|
319
|
316
|
callback(rule.message)
|
320
|
317
|
} else {
|
321
|
318
|
return true
|
|
@ -323,7 +320,20 @@ export default {
|
323
|
320
|
}
|
324
|
321
|
}
|
325
|
322
|
],
|
326
|
|
LONGITUDE: [
|
|
323
|
radius: [
|
|
324
|
{
|
|
325
|
message: '请输入数字',
|
|
326
|
trigger: 'blur',
|
|
327
|
validator: function(rule, value, callback) {
|
|
328
|
if (isNaN(value)) {
|
|
329
|
callback(rule.message)
|
|
330
|
} else {
|
|
331
|
return true
|
|
332
|
}
|
|
333
|
}
|
|
334
|
}
|
|
335
|
],
|
|
336
|
longitude: [
|
327
|
337
|
{
|
328
|
338
|
required: true,
|
329
|
339
|
message: '经度不能为空',
|
|
@ -341,10 +351,10 @@ export default {
|
341
|
351
|
}
|
342
|
352
|
}
|
343
|
353
|
],
|
344
|
|
LATITUDE: [
|
|
354
|
latitude: [
|
345
|
355
|
{
|
346
|
356
|
required: true,
|
347
|
|
message: '经度不能为空',
|
|
357
|
message: '纬度不能为空',
|
348
|
358
|
trigger: 'blur'
|
349
|
359
|
},
|
350
|
360
|
{
|
|
@ -363,84 +373,98 @@ export default {
|
363
|
373
|
}
|
364
|
374
|
},
|
365
|
375
|
mounted() {
|
366
|
|
this.getList()
|
|
376
|
this.getType().then(() => {
|
|
377
|
this.getList()
|
|
378
|
})
|
367
|
379
|
},
|
368
|
380
|
methods: {
|
|
381
|
async getType() {
|
|
382
|
await this.$test.post(services.equipment.EQUIPMENT_TYPE, {}
|
|
383
|
).then(res => {
|
|
384
|
// 请求成功处理...
|
|
385
|
if (res.data.success) {
|
|
386
|
this.typeList = res.data.data
|
|
387
|
}
|
|
388
|
}).catch(res => {
|
|
389
|
// 请求失败处理...
|
|
390
|
})
|
|
391
|
},
|
369
|
392
|
getList() {
|
370
|
|
var params = new FormData()
|
371
|
|
params.append('data', JSON.stringify({
|
372
|
|
pageNum: this.table.pager.currentPage,
|
|
393
|
this.tableLoading = true
|
|
394
|
this.$test.post(services.equipment.GET_EQUIPMENT, {
|
|
395
|
pageNumber: this.table.pager.currentPage,
|
373
|
396
|
pageSize: this.table.pager.size,
|
374
|
|
FACILITY_CODE: this.queryCondition.equipmentNumber,
|
375
|
|
FACILITY_TYPE: this.queryCondition.equipmentType,
|
376
|
|
FACILITY_NAME: this.queryCondition.equipmentName
|
377
|
|
}))
|
378
|
|
this.$test.post(services.equipment.GET_EQUIPMENT, params
|
|
397
|
data: {
|
|
398
|
resourceToolType: this.queryCondition.equipmentType,
|
|
399
|
resourceToolNameAsLike: this.queryCondition.equipmentName,
|
|
400
|
resourceToolCode: this.queryCondition.equipmentNumber
|
|
401
|
}
|
|
402
|
}
|
379
|
403
|
).then(res => {
|
380
|
404
|
// 请求成功处理...
|
381
|
|
this.table.data = res.data.result.list
|
382
|
|
this.table.pager.total = res.data.result.total
|
|
405
|
console.log(res)
|
|
406
|
this.tableLoading = false
|
|
407
|
if (res.data.success) {
|
|
408
|
this.table.data = res.data.data.data
|
|
409
|
this.table.pager.total = res.data.data.total
|
|
410
|
}
|
383
|
411
|
}).catch(res => {
|
384
|
412
|
// 请求失败处理...
|
385
|
413
|
})
|
386
|
414
|
},
|
387
|
|
onChange(value) {
|
388
|
|
console.log('date change:' + value)
|
|
415
|
type_formatter(row, column) {
|
|
416
|
var arr = this.typeList.filter((item) => {
|
|
417
|
return item.resourceToolType === row.resourceToolType
|
|
418
|
})
|
|
419
|
if (arr[0]) {
|
|
420
|
return arr[0].name
|
|
421
|
}
|
389
|
422
|
},
|
390
|
423
|
onReset() {
|
391
|
|
this.queryCondition.equipmentType = ''
|
392
|
|
this.queryCondition.equipmentName = ''
|
393
|
|
this.queryCondition.equipmentNumber = ''
|
394
|
|
this.searchResult = [
|
395
|
|
{
|
396
|
|
FACILITY_CODE: '',
|
397
|
|
FACILITY_ID: '',
|
398
|
|
FACILITY_NAME: '',
|
399
|
|
FACILITY_TYPE: '',
|
400
|
|
LATITUDE: '',
|
401
|
|
LONGITUDE: ''
|
402
|
|
}
|
403
|
|
]
|
404
|
|
this.searchResult_n = [
|
405
|
|
{
|
406
|
|
FACILITY_CODE: '',
|
407
|
|
FACILITY_ID: '',
|
408
|
|
FACILITY_NAME: '',
|
409
|
|
FACILITY_TYPE: '',
|
410
|
|
LATITUDE: '',
|
411
|
|
LONGITUDE: ''
|
412
|
|
}
|
413
|
|
]
|
|
424
|
this.queryCondition = {
|
|
425
|
equipmentType: null,
|
|
426
|
equipmentName: '',
|
|
427
|
equipmentNumber: ''
|
|
428
|
}
|
414
|
429
|
this.onSearch()
|
415
|
430
|
},
|
416
|
431
|
onSearch() {
|
|
432
|
this.table = {
|
|
433
|
data: [
|
|
434
|
],
|
|
435
|
pager: {
|
|
436
|
currentPage: 1,
|
|
437
|
size: 10,
|
|
438
|
total: 0
|
|
439
|
}
|
|
440
|
}
|
417
|
441
|
this.getList()
|
418
|
442
|
},
|
419
|
443
|
toExport() {
|
420
|
444
|
|
421
|
445
|
},
|
422
|
|
checkReptition(type, value) {
|
423
|
|
var that = this
|
424
|
|
return new Promise(function(resolve) {
|
425
|
|
var params = new FormData()
|
426
|
|
if (type === 1) {
|
427
|
|
params.append('data', JSON.stringify({
|
428
|
|
FACILITY_NAME: value
|
429
|
|
}))
|
430
|
|
} else if (type === 2) {
|
431
|
|
params.append('data', JSON.stringify({
|
432
|
|
FACILITY_CODE: value
|
433
|
|
}))
|
434
|
|
} else {
|
435
|
|
params.append('data', JSON.stringify({
|
436
|
|
FACILITY_NAME: value,
|
437
|
|
FACILITY_ID: that.updateRow.FACILITY_ID
|
438
|
|
}))
|
|
446
|
checkReptition(data) {
|
|
447
|
return new Promise((resolve) => {
|
|
448
|
this.$test.post(services.equipment.GET_EQUIPMENT, {
|
|
449
|
pageNumber: 1,
|
|
450
|
pageSize: 10,
|
|
451
|
data: data
|
439
|
452
|
}
|
440
|
|
that.$test.post(services.equipment.REPETITION_EQUIPMENT, params
|
441
|
453
|
).then(res => {
|
442
|
|
console.log(1)
|
443
|
|
resolve(res.data.result)
|
|
454
|
// 请求成功处理...
|
|
455
|
console.log(res)
|
|
456
|
if (res.data.success) {
|
|
457
|
if (res.data.data.totalPage > 0 && res.data.data.data[0].resourceToolId === this.updateRow.resourceToolId) {
|
|
458
|
resolve(false)
|
|
459
|
} else {
|
|
460
|
resolve(res.data.data.totalPage > 0)
|
|
461
|
}
|
|
462
|
} else {
|
|
463
|
resolve(false)
|
|
464
|
}
|
|
465
|
}).catch(res => {
|
|
466
|
// 请求失败处理...
|
|
467
|
resolve(false)
|
444
|
468
|
})
|
445
|
469
|
})
|
446
|
470
|
},
|
|
@ -453,37 +477,46 @@ export default {
|
453
|
477
|
this.getList()
|
454
|
478
|
},
|
455
|
479
|
cancel() {
|
456
|
|
this.$refs['formValidate'].resetFields()
|
457
|
|
this.$refs['updateRow'].resetFields()
|
458
|
480
|
this.modal = false
|
459
|
481
|
this.updateModal = false
|
460
|
|
this.formValidate.type = ''
|
461
|
|
this.formValidate.name = ''
|
462
|
|
this.formValidate.number = ''
|
463
|
|
this.formValidate.lng = ''
|
464
|
|
this.formValidate.lat = ''
|
465
|
|
this.table.pager.currentPage = 1
|
|
482
|
this.formValidate = {
|
|
483
|
type: '',
|
|
484
|
name: '',
|
|
485
|
radius: null,
|
|
486
|
number: '',
|
|
487
|
lng: '',
|
|
488
|
lat: ''
|
|
489
|
}
|
466
|
490
|
},
|
467
|
491
|
submit() {
|
468
|
492
|
this.$refs.formValidate.validate(valid => {
|
469
|
493
|
console.log(valid)
|
470
|
494
|
if (valid) {
|
471
|
|
var params = new FormData()
|
472
|
|
params.append('data', JSON.stringify({
|
473
|
|
params: {
|
474
|
|
FACILITY_TYPE: this.formValidate.type,
|
475
|
|
FACILITY_NAME: this.formValidate.name,
|
476
|
|
FACILITY_CODE: this.formValidate.number,
|
477
|
|
LONGITUDE: this.formValidate.lng,
|
478
|
|
LATITUDE: this.formValidate.lat
|
479
|
|
}
|
480
|
|
}))
|
481
|
|
this.$test.post(services.equipment.ADD_EQUIPMENT, params
|
|
495
|
this.fullLoading = true
|
|
496
|
this.$test.post(services.equipment.CREATE_EQUIPMENT, {data: {
|
|
497
|
latitude: this.formValidate.lat ? this.formValidate.lat : null,
|
|
498
|
longitude: this.formValidate.lng ? this.formValidate.lng : null,
|
|
499
|
radius: this.formValidate.radius ? this.formValidate.radius : null,
|
|
500
|
resourceToolCode: this.formValidate.number,
|
|
501
|
resourceToolName: this.formValidate.name,
|
|
502
|
resourceToolType: this.formValidate.type
|
|
503
|
}}
|
482
|
504
|
).then(res => {
|
483
|
505
|
// 请求成功处理...
|
484
|
|
this.$Message.success('提交成功!')
|
485
|
|
this.getList()
|
486
|
|
this.cancel()
|
|
506
|
this.fullLoading = false
|
|
507
|
if (res.data.success) {
|
|
508
|
this.$Message.success('提交成功!')
|
|
509
|
this.getList()
|
|
510
|
this.modal = false
|
|
511
|
this.formValidate = {
|
|
512
|
type: '',
|
|
513
|
name: '',
|
|
514
|
radius: null,
|
|
515
|
number: '',
|
|
516
|
lng: '',
|
|
517
|
lat: ''
|
|
518
|
}
|
|
519
|
}
|
487
|
520
|
}).catch(res => {
|
488
|
521
|
// 请求失败处理...
|
489
|
522
|
})
|
|
@ -496,22 +529,19 @@ export default {
|
496
|
529
|
this.$refs.updateRow.validate(valid => {
|
497
|
530
|
console.log(valid)
|
498
|
531
|
if (valid) {
|
499
|
|
var params = new FormData()
|
500
|
|
params.append('data', JSON.stringify({
|
501
|
|
params: {
|
502
|
|
FACILITY_ID: this.updateRow.FACILITY_ID,
|
503
|
|
FACILITY_TYPE: this.updateRow.FACILITY_TYPE,
|
504
|
|
FACILITY_NAME: this.updateRow.FACILITY_NAME,
|
505
|
|
LONGITUDE: this.updateRow.LONGITUDE,
|
506
|
|
LATITUDE: this.updateRow.LATITUDE
|
507
|
|
}
|
508
|
|
}))
|
509
|
|
this.$test.post(services.equipment.ADD_EQUIPMENT, params
|
|
532
|
this.fullLoading = true
|
|
533
|
console.log(this.updateRow)
|
|
534
|
this.$test.post(services.equipment.UPDATE_EQUIPMENT, {
|
|
535
|
data: this.updateRow
|
|
536
|
}
|
510
|
537
|
).then(res => {
|
511
|
538
|
// 请求成功处理...
|
512
|
|
this.$Message.success('提交成功!')
|
513
|
|
this.getList()
|
514
|
|
this.cancel()
|
|
539
|
this.fullLoading = false
|
|
540
|
if (res.data.success) {
|
|
541
|
this.$Message.success('提交成功!')
|
|
542
|
this.getList()
|
|
543
|
this.updateModal = false
|
|
544
|
}
|
515
|
545
|
}).catch(res => {
|
516
|
546
|
// 请求失败处理...
|
517
|
547
|
})
|
|
@ -521,63 +551,63 @@ export default {
|
521
|
551
|
})
|
522
|
552
|
},
|
523
|
553
|
addEquipment() {
|
524
|
|
this.lngLatDisabled = false
|
525
|
554
|
this.modal = true
|
526
|
555
|
},
|
527
|
556
|
handleClick(row) {
|
528
|
|
var params = new FormData()
|
529
|
|
params.append('data', JSON.stringify({
|
530
|
|
FACILITY_ID: row.FACILITY_ID
|
531
|
|
}))
|
532
|
|
this.$test.post(services.equipment.GET_ONE_EQUIPMENT, params
|
533
|
|
).then(res => {
|
534
|
|
// 请求成功处理...
|
535
|
|
this.updateModal = true
|
536
|
|
this.updateRow = res.data.resultData
|
537
|
|
this.typeChange(2)
|
538
|
|
}).catch(res => {
|
539
|
|
// 请求失败处理...
|
|
557
|
this.updateModal = true
|
|
558
|
console.log(row)
|
|
559
|
var name
|
|
560
|
this.typeList.forEach(element => {
|
|
561
|
if (element.resourceToolType === row.resourceToolType) {
|
|
562
|
name = element.name
|
|
563
|
}
|
540
|
564
|
})
|
|
565
|
row.name = name
|
|
566
|
this.updateRow = row
|
541
|
567
|
},
|
542
|
568
|
remove(row) {
|
543
|
|
let that = this
|
544
|
|
let confirm = {
|
|
569
|
this.delete([row.resourceToolId])
|
|
570
|
},
|
|
571
|
delete(arr) {
|
|
572
|
this.$Confirm.confirm({
|
545
|
573
|
title: '请确认',
|
546
|
574
|
content: '删除后不可恢复,确认删除吗?',
|
547
|
|
ok: function () {
|
548
|
|
var params = new FormData()
|
549
|
|
params.append('data', JSON.stringify({
|
550
|
|
params: {
|
551
|
|
FACILITY_ID: row.FACILITY_ID
|
552
|
|
}
|
553
|
|
}))
|
554
|
|
this.$test.post(services.equipment.DEL_EQUIPMENT, params
|
|
575
|
ok: () => {
|
|
576
|
this.fullLoading = true
|
|
577
|
this.$test.post(services.equipment.DEL_EQUIPMENT, {
|
|
578
|
data: arr
|
|
579
|
}
|
555
|
580
|
).then(res => {
|
556
|
581
|
// 请求成功处理...
|
557
|
|
that.$Message.success('操作成功')
|
558
|
|
that.getList()
|
|
582
|
this.fullLoading = false
|
|
583
|
if (res.data.success) {
|
|
584
|
this.$Message.success('操作成功')
|
|
585
|
this.table.pager.currentPage = 1
|
|
586
|
this.getList()
|
|
587
|
}
|
559
|
588
|
}).catch(res => {
|
560
|
589
|
// 请求失败处理...
|
561
|
590
|
})
|
562
|
591
|
}
|
563
|
|
}
|
564
|
|
this.$Confirm.confirm(confirm)
|
|
592
|
})
|
565
|
593
|
},
|
566
|
|
longLatFormatter(cjsj, column, cellValue, index) {
|
567
|
|
if (cjsj.FACILITY_TYPE==1) {
|
568
|
|
return '--'
|
569
|
|
}
|
570
|
|
return cellValue
|
|
594
|
handleSelectionChange(val) {
|
|
595
|
var arr = []
|
|
596
|
val.forEach(element => {
|
|
597
|
arr.push(element.resourceToolId)
|
|
598
|
})
|
|
599
|
this.selection = arr
|
571
|
600
|
},
|
572
|
|
typeChange(t) {
|
573
|
|
var value
|
574
|
|
if (t === 1) {
|
575
|
|
value = this.formValidate.type
|
576
|
|
} else {
|
577
|
|
value = this.updateRow.FACILITY_TYPE
|
578
|
|
}
|
579
|
|
this.lngLatDisabled = (value == 1)
|
|
601
|
batchDelete() {
|
|
602
|
console.log(this.selection)
|
|
603
|
this.delete(this.selection)
|
580
|
604
|
}
|
|
605
|
// longLatFormatter(row, column, cellValue, index) {
|
|
606
|
// if (cjsj.FACILITY_TYPE === '001') {
|
|
607
|
// return '--'
|
|
608
|
// }
|
|
609
|
// return cellValue
|
|
610
|
// },
|
581
|
611
|
}
|
582
|
612
|
}
|
583
|
613
|
</script>
|