Quellcode durchsuchen

Merge branch 'master' of http://10.1.235.20:3000/asiainfo/ebc

wangchao vor 4 Jahren
Ursprung
Commit
0c9930d3e3

+ 6 - 0
ebc-middle-platform/src/conf/services.js

@ -146,6 +146,12 @@ export default {
146 146
    DEL_MAP_TAG: '/mapTag/deleteMapTagXyInfo', // 删除地图标记信息
147 147
    UPD_MAP_TAG: '/mapTag/queryMapTagforModifyInfo' // 查询地图标记信息用作修改
148 148
  },
149
  equipment: {
150
    GET_EQUIPMENT: '/equipment/queryEquipmentInfo', // 查询设备管理信息
151
    ADD_EQUIPMENT: '/equipment/modifyEquipmentInfo', // 新增/修改设备管理信息
152
    DEL_EQUIPMENT: '/equipment/deleteEquipmentInfo', // 删除设备管理信息
153
    REPETITION_EQUIPMENT: '/equipment/verifyEquipmentInfoRepetition' // 删除设备管理信息
154
  },
149 155
  history: {
150 156
    GET_HISTORICAL_ALARM: '/history/queryHistoricalAlarm' // 查询历史报警信息
151 157
  },

+ 108 - 0
ebc-middle-platform/src/ipu-stomp.js

@ -0,0 +1,108 @@
1
import SockJS from 'sockjs-client'
2
import Stomp from 'stompjs'
3
// import UUID from './uuid'
4
5
// define(["sockjs", "stomp", "uuid"],function(SockJS, Stomp, UUID) {
6
// var IpuStomp = {};
7
8
export default function (params, callbacks) {
9
  var onConnected, onFailure
10
  if (callbacks) {
11
    /* 供stomp.js中做判断:args[1] instanceof Function */
12
    onConnected = callbacks.onConnected ? callbacks.onConnected : new Function()
13
    onFailure = callbacks.onFailure ? callbacks.onFailure : new Function()
14
  } else {
15
    onConnected = new Function()
16
    onFailure = new Function()
17
  }
18
  var client
19
  if (params.url.startsWith('http') || params.url.startsWith('https')) { // SockJS支持http和https前缀
20
    var socket = new SockJS(params.url)
21
    client = Stomp.over(socket)
22
  } else { // SockJS支持ws前缀
23
    client = Stomp.client(params.url)
24
  }
25
  var headers = {'name': params.name, 'passcode': params.passcode, 'host': params.host, 'uuid': params.UUID}
26
  client.connect(headers, onConnected, onFailure)
27
  return new StompClient(client)
28
}
29
30
// IpuStomp.connect = function(url, login, passcode, callbacks, host){
31
// 	if(url.startsWith("http")||url.startsWith("https")){
32
// 		return connectWithSockJS(url, login, passcode, callbacks, host); //SockJS支持http和https前缀
33
// 	}else {
34
// 		return connectWithStomp(url, login, passcode, callbacks, host); //SockJS支持ws前缀
35
// 	}
36
// }
37
//
38
// function connectWithStomp(url, login, passcode, callbacks, host){
39
// 	var onConnected, onFailure;
40
//     if(callbacks){
41
//     	/*供stomp.js中做判断:args[1] instanceof Function*/
42
//     	onConnected = callbacks.onConnected?callbacks.onConnected:new Function();
43
//         onFailure = callbacks.onFailure?callbacks.onFailure:new Function();
44
//     }else{
45
//     	onConnected = new Function();
46
//     	onFailure = new Function();
47
//     }
48
//     var client = Stomp.client(url);
49
//     var headers = {"login":login,"passcode":passcode,"host":host,"uuid":UUID};
50
//     client.connect(headers, onConnected, onFailure);
51
//     return new StompClient(client);
52
// }
53
//
54
// function connectWithSockJS(url, login, passcode, callbacks, host){
55
// 	var onConnected, onFailure;
56
//     if(callbacks){
57
//     	/*供stomp.js中做判断:args[1] instanceof Function*/
58
//     	onConnected = callbacks.onConnected?callbacks.onConnected:new Function();
59
//         onFailure = callbacks.onFailure?callbacks.onFailure:new Function();
60
//     }else{
61
//     	onConnected = new Function();
62
//     	onFailure = new Function();
63
//     }
64
//
65
// 	var socket = new SockJS(url);
66
//     var client = Stomp.over(socket);
67
//     var headers = {"login":login,"passcode":passcode,"host":host,"uuid":UUID};
68
//     client.connect(headers, onConnected, onFailure);
69
//     return new StompClient(client);
70
// }
71
72
function StompClient(client) {
73
  this.client = client
74
}
75
76
StompClient.prototype.setTopicPath = function(topicPath) {
77
//   topicPath = topicPath.startsWith('/') ? topicPath : '/' + topicPath
78
//   topicPath = topicPath.endsWith('/') ? topicPath : topicPath + '/'
79
//   console.log(topicPath)
80
  this.topicPath = topicPath
81
}
82
83
StompClient.prototype.disconnect = function() {
84
  this.client.disconnect()
85
}
86
87
StompClient.prototype.connected = function() {
88
  return this.client.connected
89
}
90
91
StompClient.prototype.subscribe = function(topic, callback) {
92
//   return this.client.subscribe(this.topicPath + topic, callback)
93
  return this.client.subscribe(this.topicPath, callback)
94
}
95
96
StompClient.prototype.publish = function(topic, text) {
97
//   this.client.send(this.topicPath + topic, {}, text)
98
  this.client.send(this.topicPath, {}, text)
99
}
100
101
// return IpuStomp;
102
// })
103
104
// export default {
105
//     IpuStomp: {
106
//         connect:IpuStomp.connect
107
//     }
108
// }

+ 1 - 1
ebc-middle-platform/src/modules/call-help/current.scss

@ -1,7 +1,7 @@
1 1
.current-container{
2 2
  display: flex;
3 3
  width: 100%;
4
  height: 100%;
4
  height: 94%;
5 5
  .left{
6 6
    margin-top: 30px;
7 7
    width: 360px;

+ 26 - 0
ebc-middle-platform/src/modules/layouts/BasicLayout.vue

@ -43,6 +43,7 @@
43 43
44 44
<script>
45 45
import GlobalLayout from '../page/GlobalLayout.vue'
46
import IpuStomp from '../../ipu-stomp'
46 47
export default {
47 48
  name: 'BasicLayout',
48 49
  components: {
@ -58,6 +59,31 @@ export default {
58 59
      return this.$route.meta.keepAlive
59 60
    }
60 61
  },
62
  mounted() {
63
    // 镜屏调用
64
    var client
65
    var callbacks = {}
66
    callbacks.onConnected = msg => {
67
      console.log('连接成功:' + msg)
68
      client.subscribe('zhangsan', msg => {
69
        console.log(msg)
70
      })
71
    }
72
    callbacks.onFailure = msg => {
73
      console.log('连接失败:' + msg)
74
    }
75
    client = IpuStomp(
76
      {
77
        url: 'ws://192.168.3.200:7100/stomp',
78
        name: 'zhangsan',
79
        passcode: '123456',
80
        host: '',
81
        UUID: 'zhangsan'
82
      },
83
      callbacks
84
    )
85
    client.setTopicPath('personnel')
86
  },
61 87
  methods: {
62 88
    closeAlarmModal() {
63 89
      this.modal = false

+ 2 - 1
ebc-middle-platform/src/modules/layouts/LayoutContent.vue

@ -1,7 +1,7 @@
1 1
<template>
2 2
  <div class="layout-content">
3 3
    <!-- tags nav -->
4
    <div v-if="!hideTabGroup" class="tag-nav-wrapper">
4
    <div v-if="!hideTabGroup" v-show="this.$route.path!='/orientation'" class="tag-nav-wrapper">
5 5
      <tags-nav :value="$route" :list="tagNavList" :home-name="homeRoute.name" @tagSelect="handleClick" @on-close="handleCloseTag"/>
6 6
    </div>
7 7
    <!-- pageHeader , route meta :true on hide -->
@ -35,6 +35,7 @@ export default {
35 35
    /**
36 36
     * @description 初始化标签导航
37 37
     */
38
    console.log(this.$route.path)
38 39
    this.setTagNavList()
39 40
  },
40 41
  methods: {

+ 43 - 2
ebc-middle-platform/src/modules/orientation/orientation.vue

@ -82,6 +82,20 @@
82 82
        </div>
83 83
      </div>
84 84
    </t-modal>
85
    <t-modal :visibled.sync="rescueModal" title="指派救援人员" >
86
      <t-form ref="formValidate" :model="formValidate" :rules="ruleValidate" :label-width="80" label-position="left">
87
        <t-form-item label="救援人员" prop="rescue">
88
          <t-select v-model="formValidate.rescue" placeholder="请选择">
89
            <t-option>张三</t-option>
90
            <t-option>李四</t-option>
91
          </t-select>
92
        </t-form-item>
93
      </t-form>
94
      <div slot="footer">
95
        <t-button @click="cancel">取消</t-button>
96
        <t-button class="submit-button" @click="appoint()">指派</t-button>
97
      </div>
98
    </t-modal>
85 99
  </div>
86 100
</template>
87 101
@ -184,7 +198,18 @@ export default {
184 198
        currentIndex: 0
185 199
      },
186 200
      trackMap: null,
187
      rangeDate: ''
201
      rangeDate: '',
202
      rescueModal: false,
203
      formValidate: {
204
        rescue: ''
205
      },
206
      ruleValidate: {
207
        rescue: [{
208
          required: true,
209
          message: '救援人员不能为空',
210
          trigger: 'blur'
211
        }]
212
      }
188 213
    }
189 214
  },
190 215
  computed: {
@ -256,6 +281,7 @@ export default {
256 281
      Ai.Zoom({type: 'small'}).addTo(this.trackMap)
257 282
    },
258 283
    pointsSet() {
284
      window.Vue = this
259 285
      var arr = []
260 286
      this.pointsLayer = new Ai.FeatureGroup()
261 287
      var icon = (icon = Ai.IconPulse({ iconSize: [13, 13] }))
@ -291,7 +317,7 @@ export default {
291 317
           '<div>2020.08.13 08:24:32</div>' +
292 318
         '</div></div></div>' +
293 319
         '<div style="display:flex;">' +
294
          '<button class="point-out" onClick="window.Vue.modal=true"><i style="font-size: 20px;" class="aidicon aidicon-user-outline"></i>指派</button>' +
320
          '<button class="point-out" onClick="window.Vue.rescueModal=true"><i style="font-size: 20px;" class="aidicon aidicon-user-outline"></i>指派</button>' +
295 321
          '<button class="close-confirm" onClick="window.Vue.close()"><i style="font-size: 20px;" class="aidicon aidicon-close"></i>关闭</button>' +
296 322
        '</div></div></div>'
297 323
          var popup = Ai.Popup({minWidth: 300, offset: [0, -10], autoClose: true})
@ -407,6 +433,21 @@ export default {
407 433
    },
408 434
    toExport() {
409 435
436
    },
437
    close(item) {
438
      this.$Confirm.confirm({
439
        title: '确认要关闭张三落水报警吗?',
440
        content: '关闭后将不再进行报警显示',
441
        ok: () => {
442
          console.log('点击了确定')
443
        },
444
        cancel: () => {
445
          console.log('点击了取消')
446
        }
447
      })
448
    },
449
    cancel() {
450
      this.rescueModal = false
410 451
    }
411 452
  }
412 453
}

+ 317 - 118
ebc-middle-platform/src/modules/system-management/equipment-management.vue

@ -5,37 +5,39 @@
5 5
        <div>
6 6
          <div class="label">设备类型:</div>
7 7
          <div class="input-rule">
8
            <t-select v-model="queryCondition.equipmentType" width="200" placeholder="请输入...">
9
              <t-option>风机</t-option>
10
              <t-option>升压站</t-option>
11
              <t-option>船舶</t-option>
8
            <t-select v-model="queryCondition.equipmentType" style="width: 200px" clearable placeholder="请输入...">
9
              <t-option value="1">风机</t-option>
10
              <t-option value="2">升压站</t-option>
11
              <t-option value="3">船舶</t-option>
12 12
            </t-select>
13 13
          </div>
14 14
        </div>
15 15
        <div>
16 16
          <div class="label">设备名称:</div>
17 17
          <div class="input-rule">
18
            <t-select v-model="queryCondition.equipmentName" filterable clearable :loading.sync="currentLoading" @load="$_onLoad" width="200">
19
              <t-option v-for="item in searchResult"
20
                        :key="item.value"
21
              >{{ item.label }}</t-option>
22
            </t-select>
18
            <t-input v-model="queryCondition.equipmentName" style="width: 200px" placeholder="请输入..." clearable></t-input>
19
<!--            <t-select v-model="queryCondition.equipmentName" filterable clearable :loading.sync="currentLoading" @load="$_onLoad" width="200">-->
20
<!--              <t-option v-for="item in searchResult"-->
21
<!--                        :key="item.value"-->
22
<!--              >{{ item.FACILITY_NAME }}</t-option>-->
23
<!--            </t-select>-->
23 24
          </div>
24 25
        </div>
25 26
        <div>
26 27
          <div class="label">设备编号:</div>
27 28
          <div class="input-rule">
28
            <t-select filterable
29
                      clearable
30
                      :loading.sync="currentLoading_n"
31
                      @load="$_onLoad_n"
32
                      v-model="queryCondition.equipmentNumber"
33
                      width="200"
34
            >
35
              <t-option v-for="item in searchResult_n"
36
                        :key="item.value"
37
              >{{ item.label }}</t-option>
38
            </t-select>
29
            <t-input v-model="queryCondition.equipmentNumber" style="width: 200px" placeholder="请输入..." clearable></t-input>
30
<!--            <t-select filterable-->
31
<!--                      clearable-->
32
<!--                      :loading.sync="currentLoading_n"-->
33
<!--                      @load="$_onLoad_n"-->
34
<!--                      v-model="queryCondition.equipmentNumber"-->
35
<!--                      width="200" id="ccc"-->
36
<!--            >-->
37
<!--              <t-option v-for="item in searchResult_n"-->
38
<!--                        :key="item.value"-->
39
<!--              >{{ item.FACILITY_CODE }}</t-option>-->
40
<!--            </t-select>-->
39 41
          </div>
40 42
        </div>
41 43
        <div class="btns">
@ -55,11 +57,23 @@
55 57
    </div>
56 58
    <div>
57 59
      <t-table :data="table.data">
58
        <t-table-column prop="name" label="设备名称"></t-table-column>
59
        <t-table-column prop="number" label="设备编号"></t-table-column>
60
        <t-table-column prop="type" label="设备类型"></t-table-column>
61
        <t-table-column prop="long" label="经度"></t-table-column>
62
        <t-table-column prop="lat" label="纬度"></t-table-column>
60
        <t-table-column prop="FACILITY_NAME" label="设备名称"></t-table-column>
61
        <t-table-column prop="FACILITY_CODE" label="设备编号"></t-table-column>
62
        <t-table-column prop="FACILITY_TYPE" label="设备类型">
63
          <template slot-scope="scope">
64
            <div v-if="scope.row.FACILITY_TYPE==1">
65
              <span >风机</span>
66
            </div>
67
            <div v-if="scope.row.FACILITY_TYPE==2">
68
              <span>升压站</span>
69
            </div>
70
            <div v-if="scope.row.FACILITY_TYPE==3">
71
              <span>船舶</span>
72
            </div>
73
          </template>
74
        </t-table-column>
75
        <t-table-column prop="LONGITUDE" label="经度"></t-table-column>
76
        <t-table-column prop="LATITUDE" label="纬度"></t-table-column>
63 77
        <t-table-column
64 78
            fixed="right"
65 79
            label="操作"
@ -106,6 +120,42 @@
106 120
        <t-button class="submit-button" @click="submit">保存</t-button>
107 121
      </div>
108 122
    </t-modal>
123
    <t-modal :visibled.sync="updateModal" title="编辑设备" >
124
      <t-form ref="updateRow" :model="updateRow" :rules="updateRowValidate" :label-width="80" label-position="left">
125
<!--        <t-form-item label="设备类型" prop="type">-->
126
<!--          <template v-if="updateRow.FACILITY_TYPE==1">-->
127
<!--            风机-->
128
<!--          </template>-->
129
<!--          <template v-if="updateRow.FACILITY_TYPE==2">-->
130
<!--            升压站-->
131
<!--          </template>-->
132
<!--          <template v-if="updateRow.FACILITY_TYPE==3">-->
133
<!--            船舶-->
134
<!--          </template>-->
135
<!--        </t-form-item>-->
136
        <t-form-item label="设备类型" prop="FACILITY_TYPE">
137
          <t-select v-model="updateRow.FACILITY_TYPE" placeholder="请选择设备类型" clearable>
138
            <t-option v-for="(item, index) in typeList" :value="item.value" :key="index">{{ item.label }}</t-option>
139
          </t-select>
140
        </t-form-item>
141
        <t-form-item label="设备名称" prop="FACILITY_NAME">
142
          <t-input v-model="updateRow.FACILITY_NAME" placeholder="请输入风机名称"></t-input>
143
        </t-form-item>
144
        <t-form-item label="设备编号" prop="FACILITY_CODE">
145
          {{updateRow.FACILITY_CODE }}
146
        </t-form-item>
147
        <t-form-item label="经度" prop="LONGITUDE">
148
          <t-input v-model="updateRow.LONGITUDE" placeholder="请输入数字"></t-input>
149
        </t-form-item>
150
        <t-form-item label="纬度" prop="LATITUDE">
151
          <t-input v-model="updateRow.LATITUDE" placeholder="请输入数字"></t-input>
152
        </t-form-item>
153
      </t-form>
154
      <div slot="footer">
155
        <t-button @click="cancel">取消</t-button>
156
        <t-button class="submit-button" @click="updateSubmit">保存</t-button>
157
      </div>
158
    </t-modal>
109 159
  </div>
110 160
</template>
111 161
<script>
@ -114,32 +164,12 @@ import services from '../../conf/services'
114 164
export default {
115 165
  data() {
116 166
    return {
117
      currentLoading: false,
118
      searchResult: [],
119
      demoDataA: [
120
        {
121
          label: 'aacc',
122
          value: 'a001'
123
        },
124
        {
125
          label: 'ccce',
126
          value: 'a002'
127
        }
128
      ],
129
      currentLoading_n: false,
130
      searchResult_n: [],
131
      demoDataA_n: [
132
        {
133
          label: 'aacc',
134
          value: 'a001'
135
        },
136
        {
137
          label: 'ccce',
138
          value: 'a002'
139
        }
140
      ],
141
142
167
      // currentLoading: false,
168
      // searchResult: [],
169
      // demoDataA: [],
170
      // currentLoading_n: false,
171
      // searchResult_n: [],
172
      // demoDataA_n: [],
143 173
      typeList: [
144 174
        {
145 175
          value: '1',
@ -151,25 +181,11 @@ export default {
151 181
        },
152 182
        {
153 183
          value: '3',
154
          label: '测风塔'
184
          label: '船舶'
155 185
        }
156 186
      ],
157 187
      table: {
158 188
        data: [
159
          {
160
            name: '1#风机',
161
            number: 'FJ0001',
162
            type: '风机',
163
            long: '113.445454',
164
            lat: '23.157919'
165
          },
166
          {
167
            name: '1#风机',
168
            number: 'FJ0001',
169
            type: '风机',
170
            long: '113.445454',
171
            lat: '23.157919'
172
          }
173 189
        ],
174 190
        pager: {
175 191
          currentPage: 1,
@ -185,6 +201,14 @@ export default {
185 201
      },
186 202
      rangeDate: '',
187 203
      modal: false,
204
      updateModal: false,
205
      updateRow: {
206
        FACILITY_TYPE: '',
207
        FACILITY_NAME: '',
208
        FACILITY_CODE: '',
209
        LONGITUDE: '',
210
        LATITUDE: ''
211
      },
188 212
      formValidate: {
189 213
        type: '',
190 214
        name: '',
@ -211,6 +235,8 @@ export default {
211 235
              // TODO 判断编号重复
212 236
              if (false) {
213 237
                callback(rule.message)
238
              }else {
239
                return true
214 240
              }
215 241
            }
216 242
          }
@ -232,6 +258,8 @@ export default {
232 258
                if (false) {
233 259
                  rule.message = '编号重复'
234 260
                  callback(rule.message)
261
                }else {
262
                  return true
235 263
                }
236 264
              }
237 265
            }
@ -249,6 +277,8 @@ export default {
249 277
            validator: function(rule, value, callback) {
250 278
              if (isNaN(value)) {
251 279
                callback(rule.message)
280
              }else {
281
                return true
252 282
              }
253 283
            }
254 284
          }
@ -265,6 +295,70 @@ export default {
265 295
            validator: function(rule, value, callback) {
266 296
              if (isNaN(value)) {
267 297
                callback(rule.message)
298
              }else {
299
                return true
300
              }
301
            }
302
          }
303
        ]
304
      },
305
      updateRowValidate: {
306
        FACILITY_TYPE: [{
307
          required: true,
308
          message: '设备类型不能为空',
309
          trigger: 'change'
310
        }],
311
        FACILITY_NAME: [
312
          {
313
            required: true,
314
            message: '设备名称不能为空',
315
            trigger: 'blur'
316
          },
317
          {
318
            message: '设备名称重复',
319
            trigger: 'blur',
320
            validator: function(rule, value, callback) {
321
              // TODO 判断编号重复
322
              if (false) {
323
                callback(rule.message)
324
              }else {
325
                return true
326
              }
327
            }
328
          }
329
        ],
330
        LONGITUDE: [
331
          {
332
            required: true,
333
            message: '经度不能为空',
334
            trigger: 'blur'
335
          },
336
          {
337
            message: '请输入数字',
338
            trigger: 'blur',
339
            validator: function(rule, value, callback) {
340
              if (isNaN(value)) {
341
                callback(rule.message)
342
              }else {
343
                return true
344
              }
345
            }
346
          }
347
        ],
348
        LATITUDE: [
349
          {
350
            required: true,
351
            message: '经度不能为空',
352
            trigger: 'blur'
353
          },
354
          {
355
            message: '请输入数字',
356
            trigger: 'blur',
357
            validator: function(rule, value, callback) {
358
              if (isNaN(value)) {
359
                callback(rule.message)
360
              }else {
361
                return true
268 362
              }
269 363
            }
270 364
          }
@ -273,74 +367,176 @@ export default {
273 367
    }
274 368
  },
275 369
  mounted() {
276
    this.getList(1, 10, '')
370
    this.getList(1, 10, '', '', '')
277 371
  },
278 372
  methods: {
279 373
280
    $_onLoad(filterValue) {
281
      this.queryCondition.equipmentName = filterValue
282
      window.setTimeout(() => {
283
        let d = this.demoDataA.concat()
284
        this.searchResult = d
285
        this.currentLoading = false
286
      }, 1000)
287
    },
288
    $_onLoad_n(filterValue) {
289
      this.queryCondition.equipmentNumber = filterValue
290
      window.setTimeout(() => {
291
        let d = this.demoDataA_n.concat()
292
        this.searchResult_n = d
293
        this.currentLoading_n = false
294
      }, 1000)
295
    },
296
    getList(pageNum, pageSize, params) {
297
      this.table.data = this.table.data.concat(this.table.data)
298
      this.table.pager.total = this.table.data.length
299
      // var params = new FormData()
300
      // params.append('data', JSON.stringify({
301
      //   params: {
302
      //     pageNum: pageNum,
303
      //     pageSize: pageSize,
304
      //     MAP_TAG_NAME: MAP_TAG_NAME
305
      //   }
306
      // }))
307
      // this.$test.post(services.mapTag.GET_MAP_TAG, params
308
      // ).then(res => {
309
      //   // 请求成功处理...
310
      //   this.table.data = res.data.result.list
311
      //   this.table.pager.total = res.data.result.total
312
      //   this.table.pager.currentPage = res.data.result.pageNum
313
      // }).catch(res => {
314
      //   // 请求失败处理...
315
      // })
374
    // $_onLoad(filterValue) {
375
    //   this.queryCondition.equipmentName = filterValue
376
    //   window.setTimeout(() => {
377
    //     var params = new FormData()
378
    //     params.append('data', JSON.stringify({
379
    //       params: {
380
    //         FACILITY_NAME: filterValue
381
    //       }
382
    //     }))
383
    //     this.$test.post(services.equipment.GET_EQUIPMENT, params
384
    //     ).then(res => {
385
    //       // 请求成功处理...
386
    //       let d = res.data.result.list.concat()
387
    //       this.searchResult = d
388
    //       this.currentLoading = false
389
    //     }).catch(res => {
390
    //       // 请求失败处理...
391
    //     })
392
    //   }, 1000)
393
    // },
394
    // $_onLoad_n(filterValue) {
395
    //   this.queryCondition.equipmentNumber = filterValue
396
    //   window.setTimeout(() => {
397
    //     var params = new FormData()
398
    //     params.append('data', JSON.stringify({
399
    //       params: {
400
    //         FACILITY_CODE: filterValue
401
    //       }
402
    //     }))
403
    //     this.$test.post(services.equipment.GET_EQUIPMENT, params
404
    //     ).then(res => {
405
    //       // 请求成功处理...
406
    //       let d = res.data.result.list.concat()
407
    //       this.searchResult_n = d
408
    //       this.currentLoading_n = false
409
    //     }).catch(res => {
410
    //       // 请求失败处理...
411
    //     })
412
    //   }, 1000)
413
    // },
414
    getList(pageNum, pageSize, type, name, number) {
415
      var params = new FormData()
416
      params.append('data', JSON.stringify({
417
        params: {
418
          pageNum: pageNum,
419
          pageSize: pageSize,
420
          FACILITY_CODE: number,
421
          FACILITY_TYPE: type,
422
          FACILITY_NAME: name
423
        }
424
      }))
425
      this.$test.post(services.equipment.GET_EQUIPMENT, params
426
      ).then(res => {
427
        // 请求成功处理...
428
        this.table.data = res.data.result.list
429
        this.table.pager.total = res.data.result.total
430
        this.table.pager.currentPage = res.data.result.pageNum
431
      }).catch(res => {
432
        // 请求失败处理...
433
      })
316 434
    },
317 435
    onChange(value) {
318 436
      console.log('date change:' + value)
319 437
    },
320 438
    onReset() {
321
439
      this.queryCondition.equipmentType = ''
440
      this.queryCondition.equipmentName = ''
441
      this.queryCondition.equipmentNumber = ''
442
      this.searchResult = [
443
        {
444
          FACILITY_CODE: '',
445
          FACILITY_ID: '',
446
          FACILITY_NAME: '',
447
          FACILITY_TYPE: '',
448
          LATITUDE: '',
449
          LONGITUDE: ''
450
        }
451
      ]
452
      this.searchResult_n = [
453
        {
454
          FACILITY_CODE: '',
455
          FACILITY_ID: '',
456
          FACILITY_NAME: '',
457
          FACILITY_TYPE: '',
458
          LATITUDE: '',
459
          LONGITUDE: ''
460
        }
461
      ]
462
      this.onSearch()
322 463
    },
323 464
    onSearch() {
324
465
      console.log(this.queryCondition.equipmentType)
466
      console.log(this.queryCondition.equipmentName)
467
      this.getList(1, this.table.pager.size, this.queryCondition.equipmentType, this.queryCondition.equipmentName, this.queryCondition.equipmentNumber)
325 468
    },
326 469
    toExport() {
327 470
328 471
    },
329 472
    onPagerChange(page) {
330
473
      this.getList(page, this.table.pager.size, '', '', '')
331 474
    },
332 475
    onSizeChange(number) {
333
476
      this.getList(1, number, '', '', '')
334 477
    },
335 478
    cancel() {
336 479
      this.modal = false
480
      this.updateModal = false
481
      this.formValidate.type = ''
482
      this.formValidate.name = ''
483
      this.formValidate.number = ''
484
      this.formValidate.lng = ''
485
      this.formValidate.lat = ''
486
      this.getList(this.table.pager.currentPage, this.table.pager.size, this.queryCondition.equipmentType, this.queryCondition.equipmentName, this.queryCondition.equipmentNumber)
337 487
    },
338 488
    submit() {
339 489
      debugger
340 490
      this.$refs.formValidate.validate(valid => {
341 491
        console.log(valid)
342 492
        if (valid) {
343
          this.$Message.success('提交成功!')
493
          var params = new FormData()
494
          params.append('data', JSON.stringify({
495
            params: {
496
              FACILITY_TYPE: this.formValidate.type,
497
              FACILITY_NAME: this.formValidate.name,
498
              FACILITY_CODE: this.formValidate.number,
499
              LONGITUDE: this.formValidate.lng,
500
              LATITUDE: this.formValidate.lat
501
            }
502
          }))
503
          this.$test.post(services.equipment.ADD_EQUIPMENT, params
504
          ).then(res => {
505
            // 请求成功处理...
506
            this.$Message.success('提交成功!')
507
            this.cancel()
508
            // this.getList(this.table.pager.currentPage, this.table.pager.size, this.queryCondition.equipmentType, this.queryCondition.equipmentName, this.queryCondition.equipmentNumber)
509
          }).catch(res => {
510
            // 请求失败处理...
511
          })
512
        } else {
513
          this.$Message.danger('表单验证失败!')
514
        }
515
      })
516
    },
517
    updateSubmit() {
518
      debugger
519
      this.$refs.updateRow.validate(valid => {
520
        console.log(valid)
521
        if (valid) {
522
          var params = new FormData()
523
          params.append('data', JSON.stringify({
524
            params: {
525
              FACILITY_ID: this.updateRow.FACILITY_ID,
526
              FACILITY_TYPE: this.updateRow.FACILITY_TYPE,
527
              FACILITY_NAME: this.updateRow.FACILITY_NAME,
528
              LONGITUDE: this.updateRow.LONGITUDE,
529
              LATITUDE: this.updateRow.LATITUDE
530
            }
531
          }))
532
          this.$test.post(services.equipment.ADD_EQUIPMENT, params
533
          ).then(res => {
534
            // 请求成功处理...
535
            this.$Message.success('提交成功!')
536
            this.cancel()
537
          }).catch(res => {
538
            // 请求失败处理...
539
          })
344 540
        } else {
345 541
          this.$Message.danger('表单验证失败!')
346 542
        }
@ -350,7 +546,8 @@ export default {
350 546
      this.modal = true
351 547
    },
352 548
    handleClick(row) {
353
      this.modal = true
549
      this.updateModal = true
550
      this.updateRow = row
354 551
    },
355 552
    remove(row) {
356 553
      let that = this
@ -360,16 +557,18 @@ export default {
360 557
        ok: function () {
361 558
          var params = new FormData()
362 559
          params.append('data', JSON.stringify({
363
            MAP_TAG_ID: row.MAP_TAG_ID
560
            params: {
561
              FACILITY_ID: row.FACILITY_ID
562
            }
364 563
          }))
365
          // this.$test.post(services.mapTag.DEL_MAP_TAG, params
366
          // ).then(res => {
367
          //   // 请求成功处理...
368
          this.$Message.success('操作成功')
369
          //   that.getList(that.table.pager.currentPage, that.table.pager.size, that.queryCondition.userName)
370
          // }).catch(res => {
371
          //   // 请求失败处理...
372
          // })
564
          this.$test.post(services.equipment.DEL_EQUIPMENT, params
565
          ).then(res => {
566
            // 请求成功处理...
567
            that.$Message.success('操作成功')
568
            that.getList(that.table.pager.currentPage, that.table.pager.size, that.queryCondition.equipmentType, that.queryCondition.equipmentName, that.queryCondition.equipmentNumber)
569
          }).catch(res => {
570
            // 请求失败处理...
571
          })
373 572
        }
374 573
      }
375 574
      this.$Confirm.confirm(confirm)

+ 103 - 35
ebc-middle-platform/src/modules/system-management/terminal-management.vue

@ -97,37 +97,35 @@
97 97
        <t-button class="submit-button" @click="submit">保存</t-button>
98 98
      </div>
99 99
    </t-modal>
100
    <t-modal :visibled.sync="relevance" title="关联用户" >
100
    <t-modal :visibled.sync="relevance" title="关联用户">
101 101
      <div>
102 102
        <t-form ref="relevanceValidate" :model="relevanceValidate" :rules="relevanceRuleValidate" :label-width="80" label-position="left">
103 103
          <t-form-item label="终端编号" prop="number">
104 104
            <div>ZDBH002</div>
105 105
          </t-form-item>
106
          <t-form-item label="关联类型" prop="type">
107
            <t-radio-group v-model="relevanceValidate.type">
108
              <t-radio value="0" label="用户"></t-radio>
109
              <t-radio value="1" label="船舶"></t-radio>
106
          <t-form-item label="关联类型">
107
            <t-radio-group v-model="relevanceValidate.type" @change="userConectChanged()">
108
              <t-radio v-for="(item,index) in radioList" :value="item.value" :key="index" :label="item.label"></t-radio>
110 109
            </t-radio-group>
111 110
          </t-form-item>
112
          <t-form-item label="关联用户" prop="user">
111
          <t-form-item v-for="(item,index) in itemList" v-show="item.isShow" :key="index" :label="connectName" prop="user">
113 112
            <div class="row">
114 113
              <div class="col-9">
115
                <t-form-item>
116
                  <t-select v-model="relevanceValidate.user" placeholder="请选择">
117
                    <t-option>张三</t-option>
118
                    <t-option>李四</t-option>
119
                  </t-select>
120
                </t-form-item>
114
                <t-select v-model="relevanceValidate.user" placeholder="请选择">
115
                  <t-option v-for="(todo,index) in item.goList" :key="index" :value="todo.value">{{ todo.name }}</t-option>
116
                </t-select>
121 117
              </div>
122 118
              <div class="col-3">
123
                <t-form-item>
124
                  <t-button>新增</t-button>
125
                </t-form-item>
119
                <t-button @click="goUserManagement()">新增</t-button>
126 120
              </div>
127 121
            </div>
128 122
          </t-form-item>
129 123
        </t-form>
130 124
      </div>
125
      <div slot="footer">
126
        <t-button @click="cancelUserModal">取消</t-button>
127
        <t-button color="primary" @click="confirmUserModal">确定</t-button>
128
      </div>
131 129
    </t-modal>
132 130
  </div>
133 131
</template>
@ -141,6 +139,44 @@ export default {
141 139
        relevance: false,
142 140
        unrelevance: false
143 141
      },
142
      radioList: [
143
        {value: '1', label: '用户'},
144
        {value: '2', label: '船舶'}
145
      ],
146
      itemList: [
147
        {
148
          isRadio: '1',
149
          isShow: true,
150
          goList: [
151
            {
152
              name: '张三',
153
              value: '0'
154
            },
155
            {
156
              name: '李四',
157
              value: '2'
158
            },
159
            {
160
              name: '用户',
161
              value: '1'
162
            }
163
          ]
164
        },
165
        {
166
          isRadio: '2',
167
          isShow: false,
168
          goList: [
169
            {
170
              name: '张三',
171
              value: '0'
172
            },
173
            {
174
              name: '船舶',
175
              value: '1'
176
            }
177
          ]
178
        }
179
      ],
144 180
      table: {
145 181
        data: [
146 182
          {
@ -175,6 +211,7 @@ export default {
175 211
        type: '',
176 212
        alarmPerson: ''
177 213
      },
214
      connectName: '关联用户',
178 215
      rangeDate: '',
179 216
      modal: false,
180 217
      formValidate: {
@ -212,27 +249,30 @@ export default {
212 249
      },
213 250
      relevanceRuleValidate: {
214 251
        user: [
215
          {
216
            required: true,
217
            message: '编号不能为空',
218
            trigger: 'blur'
219
          },
220
          {
221
            message: '张三已关联终端ZDBH001,点击保存更改关联关系',
222
            trigger: 'blur',
223
            validator: function(rule, value, callback) {
224
              if (!/^[a-zA-Z0-9-_#]+$/.test(value)) {
225
                callback(rule.message)
226
              } else {
227
                // TODO 判断编号重复
228
                if (true) {
229
                  rule.message = '编号重复'
230
                  callback(rule.message)
231
                }
232
              }
233
            }
234
          }
252
          { required: true, message: '请选择读写类型', trigger: 'change' }
235 253
        ]
254
        // user: [
255
        //   {
256
        //     required: true,
257
        //     message: '编号不能为空',
258
        //     trigger: 'blur'
259
        //   },
260
        //   {
261
        //     message: '张三已关联终端ZDBH001,点击保存更改关联关系',
262
        //     trigger: 'blur',
263
        //     validator: function(rule, value, callback) {
264
        //       if (!/^[a-zA-Z0-9-_#]+$/.test(value)) {
265
        //         callback(rule.message)
266
        //       } else {
267
        //         // TODO 判断编号重复
268
        //         if (true) {
269
        //           rule.message = '编号重复'
270
        //           callback(rule.message)
271
        //         }
272
        //       }
273
        //     }
274
        //   }
275
        // ]
236 276
      }
237 277
    }
238 278
  },
@ -241,6 +281,34 @@ export default {
241 281
    this.table.pager.total = this.table.data.length
242 282
  },
243 283
  methods: {
284
    cancelUserModal() {
285
      this.relevance = false
286
      this.$refs['relevanceValidate'].resetFields()
287
    },
288
    confirmUserModal() {
289
      this.$refs['relevanceValidate'].validate(valid => {
290
        if (valid) {
291
          this.relevance = false
292
        }
293
      })
294
    },
295
    goUserManagement () {
296
      this.$router.push({path: '../system-management/user-management'})
297
      this.relevance = false
298
    },
299
    userConectChanged() {
300
      this.itemList.forEach(element => {
301
        if (element.isRadio === this.relevanceValidate.type) {
302
          this.radioList.forEach(todo => {
303
            this.relevanceValidate.user = ''
304
            if (todo.value === this.relevanceValidate.type) {
305
              this.connectName = '关联' + todo.label
306
            }
307
          })
308
          element.isShow = true
309
        } else { element.isShow = false }
310
      })
311
    },
244 312
    changeType(type) {
245 313
      Object.keys(this.relevanceType).forEach((value, key) => {
246 314
        this.relevanceType[value] = value === type