lipengtao 6 years ago
parent
commit
2f91b7f70b

+ 82 - 0
src/api/bridge.js

1
import request from '@/utils/request'
2
3
/*  添加桥梁 */
4
export function addDevice(params) {
5
  return request({
6
    url: '/ajax/bridge',
7
    method: 'post',
8
    params
9
  })
10
}
11
12
/*  更新桥梁信息 */
13
export function updateDevice(params) {
14
  return request({
15
    url: '/ajax/bridge/update',
16
    method: 'post',
17
    params
18
  })
19
}
20
21
/*  删除桥梁信息 */
22
export function deleteDevice(params) {
23
  return request({
24
    url: '/ajax/bridge/delete',
25
    method: 'get',
26
    params
27
  })
28
}
29
30
/*  查询单个桥梁 */
31
export function queryDevice(params) {
32
  return request({
33
    url: '/ajax/bridge/qo',
34
    method: 'get',
35
    params
36
  })
37
}
38
39
/*  分页查询桥梁 */
40
export function pageQueryDevice(params) {
41
  return request({
42
    url: '/ajax/bridge/pq',
43
    method: 'get',
44
    params
45
  })
46
}
47
48
/*  校验桥梁编号 */
49
export function checkDeviceCode(params) {
50
  return request({
51
    url: '/ajax/bridge/checkCode',
52
    method: 'get',
53
    params
54
  })
55
}
56
57
/*  校验桥梁简称 */
58
export function checkBridgeShortName(params) {
59
  return request({
60
    url: '/ajax/bridge/checkShortName',
61
    method: 'get',
62
    params
63
  })
64
}
65
66
/*  校验桥梁全称 */
67
export function checkBridgeName(params) {
68
  return request({
69
    url: '/ajax/bridge/checkName',
70
    method: 'get',
71
    params
72
  })
73
}
74
75
/*  上传图片 */
76
export function uploadBridgeImg() {
77
  return request({
78
    url: '/ajax/bridge/upload',
79
    method: 'post'
80
  })
81
}
82

+ 0 - 1
src/api/collectionbox.js

2
2
3
/*  添加采集盒 */
3
/*  添加采集盒 */
4
export function addDevice(params) {
4
export function addDevice(params) {
5
  console.log(params)
6
  return request({
5
  return request({
7
    url: '/ajax/device',
6
    url: '/ajax/device',
8
    method: 'post',
7
    method: 'post',

+ 82 - 0
src/api/sensor.js

1
import request from '@/utils/request'
2
3
/*  添加传感器 */
4
export function addDevice(params) {
5
  return request({
6
    url: '/ajax/transducer',
7
    method: 'post',
8
    params
9
  })
10
}
11
12
/*  更新传感器信息 */
13
export function updateDevice(params) {
14
  return request({
15
    url: '/ajax/transducer/update',
16
    method: 'post',
17
    params
18
  })
19
}
20
21
/*  删除传感器信息 */
22
export function deleteDevice(params) {
23
  return request({
24
    url: '/ajax/transducer/delete',
25
    method: 'get',
26
    params
27
  })
28
}
29
30
/*  查询单个传感器 */
31
export function queryDevice(params) {
32
  return request({
33
    url: '/ajax/transducer/qo',
34
    method: 'get',
35
    params
36
  })
37
}
38
39
/*  分页查询传感器 */
40
export function pageQueryDevice(params) {
41
  return request({
42
    url: '/ajax/transducer/pq',
43
    method: 'get',
44
    params
45
  })
46
}
47
48
/*  传感器所属采集盒编号列表 */
49
export function DeviceOfservice(params) {
50
  return request({
51
    url: '/ajax/device/listByCode',
52
    method: 'get',
53
    params
54
  })
55
}
56
57
/*  校验传感器编号 */
58
export function checkDeviceCode(params) {
59
  return request({
60
    url: '/ajax/transducer/checkCode',
61
    method: 'get',
62
    params
63
  })
64
}
65
66
/*  校验传感器内部编号 */
67
export function checkDeviceInternalCode(params) {
68
  return request({
69
    url: '/ajax/transducer/checkSeq',
70
    method: 'get',
71
    params
72
  })
73
}
74
75
/*  查询采集盒名字 */
76
export function queryServer(params) {
77
  return request({
78
    url: '/ajax/device/qo',
79
    method: 'get',
80
    params
81
  })
82
}

+ 82 - 0
src/api/server.js

1
import request from '@/utils/request'
2
3
/*  添加服务器 */
4
export function addDevice(params) {
5
  return request({
6
    url: '/ajax/server',
7
    method: 'post',
8
    params
9
  })
10
}
11
12
/*  更新服务器信息 */
13
export function updateDevice(params) {
14
  return request({
15
    url: '/ajax/server/update',
16
    method: 'post',
17
    params
18
  })
19
}
20
21
/*  删除服务器信息 */
22
export function deleteDevice(params) {
23
  return request({
24
    url: '/ajax/server/delete',
25
    method: 'get',
26
    params
27
  })
28
}
29
30
/*  查询单个服务器 */
31
export function queryDevice(params) {
32
  return request({
33
    url: '/ajax/server/qo',
34
    method: 'get',
35
    params
36
  })
37
}
38
39
/*  分页查询服务器 */
40
export function pageQueryDevice(params) {
41
  return request({
42
    url: '/ajax/server/pq',
43
    method: 'get',
44
    params
45
  })
46
}
47
48
/*  服务器所属采桥梁列表 */
49
export function DeviceOfservice(params) {
50
  return request({
51
    url: '/ajax/bridge/list',
52
    method: 'get',
53
    params
54
  })
55
}
56
57
/*  校验服务器编号 */
58
export function checkDeviceCode(params) {
59
  return request({
60
    url: '/ajax/server/checkCode',
61
    method: 'get',
62
    params
63
  })
64
}
65
66
/*  校验服务器内部编号 */
67
export function checkDeviceInternalCode(params) {
68
  return request({
69
    url: '/ajax/server/checkSeq',
70
    method: 'get',
71
    params
72
  })
73
}
74
75
/*  查询服务器名字 */
76
export function queryServer(params) {
77
  return request({
78
    url: '/ajax/bridge/qo',
79
    method: 'get',
80
    params
81
  })
82
}

+ 82 - 0
src/api/userManagemen.js

1
import request from '@/utils/request'
2
3
/*  停用用户 */
4
export function deleteUser(params) {
5
  return request({
6
    url: '/ajax/sys/ban',
7
    method: 'get',
8
    params
9
  })
10
}
11
12
/*  查询负责桥梁 */
13
export function queryResponsibleBridge(params) {
14
  return request({
15
    url: '/ajax/bridge/byUserId',
16
    method: 'get',
17
    params
18
  })
19
}
20
21
/*  分页查询用户 */
22
export function pageQueryUser(params) {
23
  return request({
24
    url: '/ajax/sys/pq',
25
    method: 'get',
26
    params
27
  })
28
}
29
30
/*  检查账号是否注册 */
31
export function checkRegister(params) {
32
  return request({
33
    url: '/ajax/sys/check',
34
    method: 'get',
35
    params
36
  })
37
}
38
39
/*  新增新用户 */
40
export function addRegister(params) {
41
  return request({
42
    url: '/ajax/sys/insert',
43
    method: 'post',
44
    params
45
  })
46
}
47
48
/*  更新新用户 */
49
export function updateRegister(params) {
50
  return request({
51
    url: '/ajax/sys/update',
52
    method: 'post',
53
    params
54
  })
55
}
56
57
/*  查找用户信息 */
58
export function queryRegister(params) {
59
  return request({
60
    url: '/ajax/sys/qo',
61
    method: 'get',
62
    params
63
  })
64
}
65
66
/*  传感器所属采集盒编号列表 */
67
export function DeviceOfservice(params) {
68
  return request({
69
    url: '/ajax/bridge/list',
70
    method: 'get',
71
    params
72
  })
73
}
74
75
/*  更新用户权限 */
76
export function updatePermission(params) {
77
  return request({
78
    url: '/ajax/sys/userBridge/refresh',
79
    method: 'post',
80
    params
81
  })
82
}

+ 26 - 21
src/views/baseInfoManage/boxesConfig/index.vue

1
<template>
1
<template>
2
  <div class="app-container">
2
  <div class="app-container">
3
    <div class="filter-container" style="margin-bottom:20px">
3
    <div class="filter-container" style="margin-bottom:20px">
4
      <el-input style="width: 200px;" class="filter-item" placeholder="所属服务器编号" v-model="listQuery.title">
4
      <el-input style="width: 200px;" class="filter-item" placeholder="所属服务器编号" v-model="listQuery.scode">
5
      </el-input>
5
      </el-input>
6
       <el-input style="width: 200px;" class="filter-item" placeholder="采集盒编号" v-model="listQuery.importance">
6
       <el-input style="width: 200px;" class="filter-item" placeholder="采集盒编号" v-model="listQuery.code">
7
      </el-input>
7
      </el-input>
8
      <el-button class="filter-item" style="margin-left: 10px;" @click="handleFilter" type="primary" icon="el-icon-search">查找</el-button>
8
      <el-button class="filter-item" style="margin-left: 10px;" @click="handleFilter" type="primary" icon="el-icon-search">查找</el-button>
9
      <el-button class="filter-item" style="margin-left: 10px;" @click="handleCreate" type="primary" icon="el-icon-edit">添加采集盒</el-button>
9
      <el-button class="filter-item" style="margin-left: 10px;" @click="handleCreate" type="primary" icon="el-icon-edit">添加采集盒</el-button>
39
        </template>
39
        </template>
40
      </el-table-column>
40
      </el-table-column>
41
    </el-table>
41
    </el-table>
42
    <el-dialog title="采集盒配置" ref="ruleForm" :visible.sync="dialogTableVisible" width="680px">
42
    <el-dialog title="采集盒配置" ref="ruleForm" :visible.sync="dialogTableVisible" width="680px" @close='closed'>
43
      <el-form :model="ruleForm2" :rules="rules2" ref="ruleForm2" class="form-main" label-width="120px" label-position='right' status-icon>
43
      <el-form :model="ruleForm2" :rules="rules2" ref="ruleForm2" class="form-main" label-width="120px" label-position='right' status-icon>
44
        <el-row>
44
        <el-row>
45
          <el-col :span="12">
45
          <el-col :span="12">
82
      </el-form>
82
      </el-form>
83
    </el-dialog>
83
    </el-dialog>
84
    <div class="pagination-container" style="text-align:center;">
84
    <div class="pagination-container" style="text-align:center;">
85
      <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="listQuery.page" :page-size="listQuery.limit" layout="prev, pager, next, jumper" :total="total">
85
      <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="listQuery.pageNo" :page-size="listQuery.pageSize" layout="prev, pager, next, jumper" :total="total">
86
      </el-pagination>
86
      </el-pagination>
87
    </div>
87
    </div>
88
  </div>
88
  </div>
111
      if (value === '') {
111
      if (value === '') {
112
        callback(new Error('请输入内部编号'))
112
        callback(new Error('请输入内部编号'))
113
      } else {
113
      } else {
114
        if (!this.ruleForm2.serverId) {
115
          callback('请先选择所属服务器编号')
116
          return
117
        }
114
        if (this.edit) {
118
        if (this.edit) {
115
          checkDeviceInternalCode({ seq: value, id: this.edit }).then(response => {
119
          checkDeviceInternalCode({ seq: value, id: this.edit, serverId: this.ruleForm2.serverId }).then(response => {
116
            if (response.data) {
120
            if (response.data) {
117
              callback(new Error('采集盒编号已存在,请重新输入'))
121
              callback(new Error('内部编号已存在,请重新输入'))
118
            } else {
122
            } else {
119
              callback()
123
              callback()
120
            }
124
            }
121
          })
125
          })
122
        } else {
126
        } else {
123
          checkDeviceInternalCode({ seq: value }).then(response => {
127
          checkDeviceInternalCode({ seq: value, serverId: this.ruleForm2.serverId }).then(response => {
124
            if (response.data) {
128
            if (response.data) {
125
              callback(new Error('采集盒编号已存在,请重新输入'))
129
              callback(new Error('内部编号已存在,请重新输入'))
126
            } else {
130
            } else {
127
              callback()
131
              callback()
128
            }
132
            }
207
        if (valid) {
211
        if (valid) {
208
          if (!this.edit) {
212
          if (!this.edit) {
209
            addDevice(this.ruleForm2).then(response => {
213
            addDevice(this.ruleForm2).then(response => {
214
              this.getList()
210
              setTimeout(function() {
215
              setTimeout(function() {
211
                that.pop('已成功添加传感器')
216
                that.pop('已成功添加传感器')
212
              }, 1000)
217
              }, 1000)
213
              this.resetForm(this.ruleForm2)
218
              this.resetForm(this.ruleForm2)
214
              this.getList()
215
              this.dialogTableVisible = false
219
              this.dialogTableVisible = false
216
            }).catch(error => {
220
            }).catch(error => {
217
              console.log(error)
221
              console.log(error)
245
    resetForm(formName) {
249
    resetForm(formName) {
246
      this.dialogTableVisible = false
250
      this.dialogTableVisible = false
247
      this.$refs[formName].resetFields()
251
      this.$refs[formName].resetFields()
248
      this.ruleForm2.mark = ''
252
      this.edit = ''
253
    },
254
    closed() {
255
      this.$refs['ruleForm2'].resetFields()
256
      this.edit = ''
249
    },
257
    },
250
    getList() {
258
    getList() {
251
      this.listLoading = true
259
      this.listLoading = true
266
      })
274
      })
267
    },
275
    },
268
    handleFilter() {
276
    handleFilter() {
269
      this.listQuery.page = 1
270
      //  this.getList()
277
      this.listQuery.pageNo = 1
278
      this.getList()
271
    },
279
    },
272
    handleSizeChange(val) {
280
    handleSizeChange(val) {
273
      this.listQuery.limit = val
274
      //  this.getList()
281
      this.listQuery.pageSize = val
282
      this.getList()
275
    },
283
    },
276
    handleCurrentChange(val) {
284
    handleCurrentChange(val) {
277
      this.listQuery.page = val
278
      //  this.getList()
285
      this.listQuery.pageNo = val
286
      this.getList()
279
    },
287
    },
280
    handleModifyStatus(row, status) {
288
    handleModifyStatus(row, status) {
281
      this.$confirm('确实要删除:采集盒' + row.code + '吗?', '提示', {
289
      this.$confirm('确实要删除:采集盒' + row.code + '吗?', '提示', {
337
      this.ruleForm2.serverId = ''
345
      this.ruleForm2.serverId = ''
338
      clearTimeout(this.timeout)
346
      clearTimeout(this.timeout)
339
      this.timeout = setTimeout(() => {
347
      this.timeout = setTimeout(() => {
340
        DeviceOfservice({ code: this.ruleForm2.bridge }).then(response => {
348
        DeviceOfservice({ code: this.ruleForm2.server }).then(response => {
341
          const $info = response.data
349
          const $info = response.data
342
          if ($info.length) {
350
          if ($info.length) {
343
            const $data = $info.map(item => {
351
            const $data = $info.map(item => {
344
              return { 'value': item.code, 'id': item.id }
352
              return { 'value': item.code, 'id': item.id }
345
            })
353
            })
346
            cb($data)
354
            cb($data)
347
            if ($info.length === 1 && this.ruleForm2.bridge === $info[0].code) {
355
            if ($info.length === 1 && this.ruleForm2.server === $info[0].code) {
348
              this.ruleForm2.serverId = $info[0].id
356
              this.ruleForm2.serverId = $info[0].id
349
            } else {
357
            } else {
350
              this.ruleForm2.serverId = ''
358
              this.ruleForm2.serverId = ''
369
  .el-btn-col{
377
  .el-btn-col{
370
    margin-top: 45px
378
    margin-top: 45px
371
  }
379
  }
372
  .editTe{
373
    margin: 10px 0 0 22px
374
  }
375
</style>
380
</style>

+ 371 - 153
src/views/baseInfoManage/bridgesInfo/index.vue

1
<template>
1
<template>
2
  <div class="app-container">
2
  <div class="app-container">
3
    <div class="filter-container" style="margin-bottom:20px">
3
    <div class="filter-container" style="margin-bottom:20px">
4
      <el-input style="width: 200px;" class="filter-item" placeholder="桥梁名称" v-model="listQuery.title">
4
      <el-input style="width: 200px;" class="filter-item" placeholder="桥梁名称" v-model="listQuery.name">
5
      </el-input>
5
      </el-input>
6
       <el-input style="width: 200px;" class="filter-item" placeholder="桥梁编号" v-model="listQuery.importance">
6
       <el-input style="width: 200px;" class="filter-item" placeholder="桥梁编号" v-model="listQuery.code">
7
      </el-input>
7
      </el-input>
8
      <el-button class="filter-item" style="margin-left: 10px;" @click="handleFilter" type="primary" icon="el-icon-search">查找</el-button>
8
      <el-button class="filter-item" style="margin-left: 10px;" @click="handleFilter" type="primary" icon="el-icon-search">查找</el-button>
9
      <el-button class="filter-item" style="margin-left: 10px;" @click="handleCreate" type="primary" icon="el-icon-edit">添加桥梁</el-button>
9
      <el-button class="filter-item" style="margin-left: 10px;" @click="handleCreate" type="primary" icon="el-icon-edit">添加桥梁</el-button>
13
      style="width: 100%;min-height:550px;">
13
      style="width: 100%;min-height:550px;">
14
      <el-table-column width="150px" align="center" label="桥梁编号">
14
      <el-table-column width="150px" align="center" label="桥梁编号">
15
        <template slot-scope="scope">
15
        <template slot-scope="scope">
16
          <span>{{scope.row.num}}</span>
16
          <span>{{scope.row.code}}</span>
17
        </template>
17
        </template>
18
      </el-table-column>
18
      </el-table-column>
19
      <el-table-column width="150px" align="center" label="桥梁简称">
19
      <el-table-column width="150px" align="center" label="桥梁简称">
20
        <template slot-scope="scope">
20
        <template slot-scope="scope">
21
          <span>{{scope.row.name}}</span>
21
          <span>{{scope.row.shortName}}</span>
22
        </template>
22
        </template>
23
      </el-table-column>
23
      </el-table-column>
24
      <el-table-column min-width="150px" align="center" label="桥梁位置">
24
      <el-table-column min-width="150px" align="center" label="桥梁位置">
25
        <template slot-scope="scope">
25
        <template slot-scope="scope">
26
          <span>{{scope.row.address}}</span>
26
          <span>{{scope.row.location}}</span>
27
        </template>
27
        </template>
28
      </el-table-column>
28
      </el-table-column>
29
      <el-table-column min-width="150px" align="center" label="维护机构">
29
      <el-table-column min-width="150px" align="center" label="维护机构">
33
      </el-table-column>
33
      </el-table-column>
34
      <el-table-column min-width="200px" align="center" label="备注信息">
34
      <el-table-column min-width="200px" align="center" label="备注信息">
35
        <template slot-scope="scope">
35
        <template slot-scope="scope">
36
          <span>{{scope.row.message}}</span>
36
          <span>{{scope.row.remark}}</span>
37
        </template>
37
        </template>
38
      </el-table-column>
38
      </el-table-column>
39
      <el-table-column align="center" label="Actions" width="230" class-name="small-padding fixed-width">
39
      <el-table-column align="center" label="Actions" width="230" class-name="small-padding fixed-width">
44
        </template>
44
        </template>
45
      </el-table-column>
45
      </el-table-column>
46
    </el-table>
46
    </el-table>
47
    <el-dialog title="桥梁信息" :visible.sync="dialogTableVisible" width="80%">
48
    <el-form class="form-main" label-width="120px">
49
      <el-row :gutter="10">
50
        <el-col :xs="24" :sm="18" :lg="16">
51
          <el-row>
52
            <el-col :span="12">
53
              <el-form-item label="桥梁编号">
54
                <el-input placeholder="请输入桥梁编号"></el-input>
55
              </el-form-item>
56
            </el-col>
57
            <el-col :span="12">
58
              <el-form-item label="桥梁简称">
59
                <el-input placeholder="请输入桥梁简称"></el-input>
60
              </el-form-item>
61
            </el-col>
62
            <el-col :span="24">
63
              <el-form-item label="桥梁全称">
64
                <el-input placeholder="请输入桥梁全称"></el-input>
65
              </el-form-item>
66
            </el-col>
67
            <el-col :span="24">
68
              <el-form-item label="桥梁位置信息">
69
                <city></city>
70
              </el-form-item>
71
            </el-col>
72
            <el-col :span="12">
73
              <el-form-item label="地理位置信息">
74
                <el-input placeholder="请输入地理位置信息"></el-input>
75
              </el-form-item>
76
            </el-col>
77
            <el-col :span="12">
78
              <el-form-item label="桥梁开通日期">
79
                <el-date-picker
80
                  v-model="value2"
81
                  type="date"
82
                  placeholder="选择日期">
83
                </el-date-picker>
84
              </el-form-item>
85
            </el-col>
86
            <el-col :span="24">
87
              <el-form-item label="维护机构">
88
                <el-input placeholder="请输入维护机构"></el-input>
89
              </el-form-item>
90
            </el-col>
91
            <el-col :span="12">
92
              <el-form-item label="维护单位电话">
93
                <el-input placeholder="请输入维护单位电话"></el-input>
94
              </el-form-item>
95
            </el-col>
96
            <el-col :span="12">
97
              <el-form-item label="维护单位电邮">
98
                <el-input placeholder="请输入维护单位电邮"></el-input>
99
              </el-form-item>
100
            </el-col>
101
          </el-row>
102
        </el-col>
103
        <el-col :xs="24" :sm="6" :lg="8">
104
          <div style="width:100%;display: flex;justify-content:center">
105
            <el-upload
106
              class="avatar-uploader"
107
              action="https://jsonplaceholder.typicode.com/posts/"
108
              :show-file-list="false"
109
              :on-success="handleAvatarSuccess"
110
              :before-upload="beforeAvatarUpload">
111
              <img v-if="imageUrl" :src="imageUrl" class="avatar">
112
              <i v-else class="el-icon-plus avatar-uploader-icon"></i>
113
            </el-upload>
47
    <el-dialog title="桥梁信息" ref="ruleForm" :visible.sync="dialogTableVisible" width="80%" @close='closed'>
48
      <el-form :model="ruleForm2" :rules="rules2" ref="ruleForm2" class="form-main" label-width="120px" label-position='right' status-icon>
49
        <el-row :gutter="10">
50
          <el-col :xs="24" :sm="18" :lg="16">
51
            <el-row>
52
              <el-col :span="12">
53
                <el-form-item label="桥梁编号" prop="code">
54
                  <el-input placeholder="请输入桥梁编号" v-model="ruleForm2.code"></el-input>
55
                </el-form-item>
56
              </el-col>
57
              <el-col :span="12">
58
                <el-form-item label="桥梁简称" prop="shortName">
59
                  <el-input placeholder="请输入桥梁简称" v-model="ruleForm2.shortName"></el-input>
60
                </el-form-item>
61
              </el-col>
62
              <el-col :span="24">
63
                <el-form-item label="桥梁全称" prop="name">
64
                  <el-input placeholder="请输入桥梁全称" v-model="ruleForm2.name"></el-input>
65
                </el-form-item>
66
              </el-col>
67
              <el-col :span="24">
68
                <el-form-item label="桥梁位置信息" prop="addrCode">
69
                  <city @paren="toshow" :addrCode='ruleForm2.addrCode'></city>
70
                </el-form-item>
71
              </el-col>
72
              <el-col :span="12">
73
                <el-form-item label="地理位置信息" prop="location">
74
                  <el-input placeholder="请输入地理位置信息" v-model="ruleForm2.location"></el-input>
75
                </el-form-item>
76
              </el-col>
77
              <el-col :span="12">
78
                <el-form-item label="桥梁开通日期" prop="serviceDay">
79
                  <el-date-picker
80
                    value-format='yyyyMMdd'
81
                    v-model="ruleForm2.serviceDay"
82
                    type="date"
83
                    placeholder="选择日期">
84
                  </el-date-picker>
85
                </el-form-item>
86
              </el-col>
87
              <el-col :span="24">
88
                <el-form-item label="维护机构" prop="org">
89
                  <el-input placeholder="请输入维护机构" v-model="ruleForm2.org"></el-input>
90
                </el-form-item>
91
              </el-col>
92
              <el-col :span="12">
93
                <el-form-item label="维护单位电话" prop="phone">
94
                  <el-input placeholder="请输入维护单位电话" v-model="ruleForm2.phone"></el-input>
95
                </el-form-item>
96
              </el-col>
97
              <el-col :span="12">
98
                <el-form-item label="维护单位电邮" prop="email">
99
                  <el-input placeholder="请输入维护单位电邮" v-model="ruleForm2.email"></el-input>
100
                </el-form-item>
101
              </el-col>
102
            </el-row>
103
          </el-col>
104
          <el-col :xs="24" :sm="6" :lg="8">
105
            <div style="width:100%;display: flex;justify-content:center">
106
              <el-upload
107
                class="avatar-uploader"
108
                action="/ajax/bridge/upload"
109
                accept='image'
110
                :show-file-list="false"
111
                :on-success="handleAvatarSuccess"
112
                :before-upload="beforeAvatarUpload">
113
                <img v-if="imageUrl" :src="imageUrl" class="avatar">
114
                <i v-else class="el-icon-plus avatar-uploader-icon"></i>
115
              </el-upload>
114
116
115
          </div>
116
          <p style="width:100%;text-align:center;font-size:20px;color:#999;">上传桥梁图片<br>
117
              JPEG/JPG/PNG格式大小5M以内</p>
118
        </el-col>
119
      </el-row>
120
      <el-row>
121
        <el-col :span="24">
122
          <el-form-item label="详细描述" class="el-to-block"><br />
123
            <el-input type="textarea" maxlength=500  rows=6></el-input>
124
          </el-form-item>
125
        </el-col>
126
        <el-col :span="24">
127
          <el-form-item label="备注" class="el-to-block"><br />
128
            <el-input type="textarea" maxlength=100 rows=3></el-input>
129
          </el-form-item>
130
        </el-col>
131
        <el-col :span="24" class="el-btn-col">
132
          <div class="el-btn-col-box">
133
            <el-button type="primary" @click="dialogTableVisible=false">确认</el-button>
134
            <el-button type="primary" @click="dialogTableVisible=false">返回</el-button>
135
          </div>
136
        </el-col>
137
      </el-row>
138
    </el-form>
139
  </el-dialog>
117
            </div>
118
            <p style="width:100%;text-align:center;font-size:20px;color:#999;">上传桥梁图片<br>
119
                JPEG/JPG/PNG格式大小5M以内</p>
120
          </el-col>
121
        </el-row>
122
        <el-row>
123
          <el-col :span="24">
124
            <el-form-item label="详细描述" class="el-to-block" prop="descp">
125
              <el-input type="textarea" maxlength=500  rows=6 v-model="ruleForm2.descp"></el-input>
126
            </el-form-item>
127
          </el-col>
128
          <el-col :span="24">
129
            <el-form-item label="备注" class="el-to-block" prop="remark">
130
              <el-input type="textarea" maxlength=100 rows=3 v-model="ruleForm2.remark"></el-input>
131
            </el-form-item>
132
          </el-col>
133
          <el-col :span="24" class="el-btn-col">
134
            <div class="el-btn-col-box">
135
              <el-button type="primary" @click="submitForm('ruleForm2')">确认</el-button>
136
              <el-button type="primary" @click="resetForm('ruleForm2')">返回</el-button>
137
            </div>
138
          </el-col>
139
        </el-row>
140
      </el-form>
141
    </el-dialog>
140
    <div class="pagination-container" style="text-align:center;">
142
    <div class="pagination-container" style="text-align:center;">
141
      <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="listQuery.page" :page-size="listQuery.limit" layout="prev, pager, next, jumper" :total="total">
143
      <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="listQuery.pageNo" :page-size="listQuery.pageSize" layout="prev, pager, next, jumper" :total="total">
142
      </el-pagination>
144
      </el-pagination>
143
    </div>
145
    </div>
144
  </div>
146
  </div>
145
</template>
147
</template>
146
148
147
<script>
149
<script>
148
//  import { fetchList, fetchPv, createArticle, updateArticle } from '@/api/article'
150
import { addDevice, updateDevice, deleteDevice, pageQueryDevice, DeviceOfservice, checkDeviceCode, checkBridgeShortName, checkBridgeName } from '@/api/bridge'
149
import waves from '@/directive/waves'
151
import waves from '@/directive/waves'
150
import city from '../../city/linkage'
152
import city from '../../city/linkage'
151
//  import { parseTime } from '@/utils'
152
153
export default {
153
export default {
154
  name: 'complexTable',
154
  name: 'complexTable',
155
  directives: {
155
  directives: {
156
    waves
156
    waves
157
  },
157
  },
158
  data() {
158
  data() {
159
    var code = (rule, value, callback) => {
160
      if (value === '') {
161
        callback(new Error('请输入桥梁编号'))
162
      } else {
163
        if (this.edit) {
164
          checkDeviceCode({ code: value, id: this.edit }).then(response => {
165
            if (response.data) {
166
              callback(new Error('桥梁编号已存在,请重新输入'))
167
            } else {
168
              callback()
169
            }
170
          })
171
        } else {
172
          checkDeviceCode({ code: value }).then(response => {
173
            if (response.data) {
174
              callback(new Error('桥梁编号已存在,请重新输入'))
175
            } else {
176
              callback()
177
            }
178
          })
179
        }
180
      }
181
    }
182
    var shortName = (rule, value, callback) => {
183
      if (value === '') {
184
        callback(new Error('请输入桥梁简称'))
185
      } else {
186
        if (this.edit) {
187
          checkBridgeShortName({ shortName: value, id: this.edit }).then(response => {
188
            if (response.data) {
189
              callback(new Error('桥梁简称已存在,请重新输入'))
190
            } else {
191
              callback()
192
            }
193
          })
194
        } else {
195
          checkBridgeShortName({ shortName: value }).then(response => {
196
            if (response.data) {
197
              callback(new Error('桥梁简称已存在,请重新输入'))
198
            } else {
199
              callback()
200
            }
201
          })
202
        }
203
      }
204
    }
205
    var name = (rule, value, callback) => {
206
      if (value === '') {
207
        callback(new Error('请输入桥梁全称'))
208
      } else {
209
        if (this.edit) {
210
          checkBridgeName({ name: value, id: this.edit }).then(response => {
211
            if (response.data) {
212
              callback(new Error('桥梁全称已存在,请重新输入'))
213
            } else {
214
              callback()
215
            }
216
          })
217
        } else {
218
          checkBridgeName({ name: value }).then(response => {
219
            if (response.data) {
220
              callback(new Error('桥梁全称已存在,请重新输入'))
221
            } else {
222
              callback()
223
            }
224
          })
225
        }
226
      }
227
    }
159
    return {
228
    return {
160
      value2: '',
229
      edit: '',
161
      imageUrl: '',
230
      imageUrl: '',
231
      ruleForm2: {
232
        code: '',
233
        shortName: '',
234
        name: '',
235
        addrCode: '',
236
        serviceDay: '',
237
        location: '',
238
        descp: '',
239
        remark: '',
240
        img: '',
241
        org: '',
242
        phone: '',
243
        email: ''
244
      },
245
      rules2: {
246
        code: [
247
          { required: true, validator: code, trigger: 'blur' }
248
        ],
249
        shortName: [
250
          { required: true, validator: shortName, trigger: 'blur' }
251
        ],
252
        name: [
253
          { required: true, validator: name, trigger: 'blur' }
254
        ],
255
        location: [
256
          { required: true, message: '请输入地理位置信息', trigger: 'blur' }
257
        ],
258
        serviceDay: [
259
          { required: true, message: '请输入桥梁开通日期', trigger: 'blur' }
260
        ],
261
        org: [
262
          { required: true, message: '请输入维护机构名称', trigger: 'blur' }
263
        ],
264
        phone: [
265
          { required: true, message: '请输入维护机构电话', trigger: 'blur' }
266
        ],
267
        addrCode: [
268
          { required: true, message: '请选择桥梁位置信息', trigger: 'blur' }
269
        ],
270
        email: [
271
          { required: true, message: '请输入维护机构电邮', trigger: 'blur' }
272
        ]
273
      },
274
      timeout: null,
162
      dialogTableVisible: false,
275
      dialogTableVisible: false,
163
      tableKey: 0,
276
      tableKey: 0,
164
      list: null,
277
      list: null,
165
      dataList: { total: 20, data: [{ num: 1111, name: '北京科技大学', address: '北京', org: '机电学院', message: '想落户上海,你还差几分?抢人才看出身,清华北大照单全收' }] },
166
      total: null,
278
      total: null,
167
      listLoading: true,
279
      listLoading: true,
168
      listQuery: {
280
      listQuery: {
169
        page: 1,
170
        limit: 10,
171
        importance: undefined,
172
        title: undefined,
173
        type: undefined,
174
        sort: '+id'
175
      },
176
      dialogFormVisible: false,
177
      dialogStatus: '',
178
      textMap: {
179
        update: 'Edit',
180
        create: 'Create'
281
        name: '',
282
        code: '',
283
        active: 1,
284
        pageSize: 10,
285
        pageNo: 1
181
      }
286
      }
182
    }
287
    }
183
  },
288
  },
193
    city
298
    city
194
  },
299
  },
195
  methods: {
300
  methods: {
301
    submitForm(formName) {
302
      const that = this
303
      this.$refs[formName].validate((valid) => {
304
        if (valid) {
305
          if (!this.edit) {
306
            addDevice(this.ruleForm2).then(response => {
307
              this.getList()
308
              setTimeout(function() {
309
                that.pop('已成功添加桥梁')
310
              }, 1000)
311
              this.resetForm(this.ruleForm2)
312
              this.dialogTableVisible = false
313
            }).catch(error => {
314
              console.log(error)
315
            })
316
          } else {
317
            const par = this.ruleForm2
318
            par.id = this.edit
319
            updateDevice(par).then(response => {
320
              if (response.success) {
321
                setTimeout(function() {
322
                  that.pop('已成功更新桥梁')
323
                }, 1000)
324
                this.resetForm('ruleForm2')
325
                this.getList()
326
                this.dialogTableVisible = false
327
                this.edit = ''
328
                this.ruleForm2 = {
329
                  code: '',
330
                  shortName: '',
331
                  name: '',
332
                  addrCode: '',
333
                  serviceDay: '',
334
                  location: '',
335
                  descp: '',
336
                  remark: '',
337
                  img: '',
338
                  org: '',
339
                  phone: '',
340
                  email: ''
341
                }
342
              }
343
            })
344
          }
345
        }
346
      })
347
    },
348
    resetForm(formName) {
349
      this.dialogTableVisible = false
350
      this.$refs[formName].resetFields()
351
      this.imageUrl = ''
352
      this.edit = ''
353
    },
354
    closed() {
355
      this.$refs['ruleForm2'].resetFields()
356
      this.edit = ''
357
      this.imageUrl = ''
358
    },
196
    getList() {
359
    getList() {
197
      this.listLoading = true
360
      this.listLoading = true
198
      this.list = this.dataList.data
199
      this.total = this.dataList.total
200
      setTimeout(() => {
201
        this.listLoading = false
202
      }, 1.5 * 1000)
203
      /*  fetchList(this.listQuery).then(response => {
204
        this.list = this.dataList.data
205
        this.total =  this.dataList.total
361
      pageQueryDevice(this.listQuery).then(response => {
362
        this.list = response.data.data
363
        this.total = response.data.total
206
        setTimeout(() => {
364
        setTimeout(() => {
207
          this.listLoading = false
365
          this.listLoading = false
208
        }, 1.5 * 1000)
366
        }, 1.5 * 1000)
209
      })  */
367
      })
210
    },
368
    },
211
    handleFilter() {
369
    handleFilter() {
212
      this.listQuery.page = 1
213
      //  this.getList()
370
      this.listQuery.pageNo = 1
371
      this.getList()
214
    },
372
    },
215
    handleSizeChange(val) {
373
    handleSizeChange(val) {
216
      this.listQuery.limit = val
217
      //  this.getList()
374
      this.listQuery.pageSize = val
375
      this.getList()
218
    },
376
    },
219
    handleCurrentChange(val) {
377
    handleCurrentChange(val) {
220
      this.listQuery.page = val
221
      //  this.getList()
378
      this.listQuery.pageNo = val
379
      this.getList()
222
    },
380
    },
223
    handleModifyStatus(row, status) {
381
    handleModifyStatus(row, status) {
224
      this.$confirm('已成功删除该传感器', '提示', {
382
      this.$confirm('确实要删除:桥梁' + row.code + '吗?', '提示', {
383
        confirmButtonText: '确定',
384
        cancelButtonText: '取消',
385
        type: 'warning',
386
        center: true
387
      }).then(() => {
388
        deleteDevice({ id: row.id }).then(response => {
389
          if (response.success) {
390
            this.getList()
391
            this.pop('已成功删除该桥梁')
392
          }
393
        })
394
      }).catch(() => {
395
396
      })
397
    },
398
    pop($par) {
399
      this.$confirm($par, '提示', {
225
        confirmButtonText: '确定',
400
        confirmButtonText: '确定',
226
        cancelButtonText: '取消',
401
        cancelButtonText: '取消',
227
        type: 'success',
402
        type: 'success',
232
      }).catch(() => {
407
      }).catch(() => {
233
408
234
      })
409
      })
235
      /*  this.$confirm('确实要删除:桥梁12324吗?, 是否继续?', '提示', {
236
      confirmButtonText: '确定',
237
          cancelButtonText: '取消',
238
          type: 'warning',
239
          center: true
240
        }).then(() => {
241
          this.$message({
242
            type: 'success',
243
            message: '删除成功!'
244
          });
245
        }).catch(() => {
246
247
        }); */
248
    },
410
    },
249
    resetTemp() {
250
411
    resetTemp(row) {
412
      this.ruleForm2 = {
413
        code: row.code,
414
        shortName: row.shortName,
415
        name: row.shortName,
416
        addrCode: row.addrCode,
417
        serviceDay: row.serviceDay,
418
        location: row.location,
419
        descp: row.descp,
420
        remark: row.remark,
421
        img: row.img,
422
        org: row.org,
423
        phone: row.phone,
424
        email: row.email
425
      }
426
      this.edit = row.id
251
    },
427
    },
252
    handleCreate() {
428
    handleCreate() {
253
      this.dialogTableVisible = true
429
      this.dialogTableVisible = true
254
    },
430
    },
255
    handleUpdate(row) {
431
    handleUpdate(row) {
432
      this.resetTemp(row)
433
      this.dialogTableVisible = true
434
      this.imageUrl = '/data/bridge' + row.img
435
    },
436
    querySearchAsync(queryString, cb) {
437
      if (queryString === '') {
438
        cb([])
439
        return
440
      }
441
      this.ruleForm2.deviceId = ''
442
      clearTimeout(this.timeout)
443
      this.timeout = setTimeout(() => {
444
        DeviceOfservice({ code: this.ruleForm2.device }).then(response => {
445
          const $info = response.data
446
          if ($info.length) {
447
            const $data = $info.map(item => {
448
              return { 'value': item.code, 'id': item.id }
449
            })
450
            cb($data)
451
            if ($info.length === 1 && this.ruleForm2.bridge === $info[0].code) {
452
              this.ruleForm2.deviceId = $info[0].id
453
            } else {
454
              this.ruleForm2.deviceId = ''
455
            }
456
          } else {
457
            cb([])
458
          }
459
        })
460
      }, 3000 * Math.random())
461
    },
462
    handleSelect(item) {
463
      this.ruleForm2.deviceId = item.id
256
    },
464
    },
257
    handleAvatarSuccess(res, file) {
465
    handleAvatarSuccess(res, file) {
258
      this.imageUrl = URL.createObjectURL(file.raw)
466
      this.imageUrl = URL.createObjectURL(file.raw)
467
      this.ruleForm2.img = res.data[0].uri
259
    },
468
    },
260
    beforeAvatarUpload(file) {
469
    beforeAvatarUpload(file) {
261
      const isJPG = file.type === 'image/jpeg'
470
      const isJPG = file.type === 'image/jpeg'
262
      const isLt2M = file.size / 1024 / 1024 < 2
263
264
      if (!isJPG) {
265
        this.$message.error('上传头像图片只能是 JPG 格式!')
471
      const isPNG = file.type === 'image/png'
472
      const isLt2M = file.size / 1024 / 1024 < 5
473
      if (!isJPG && !isPNG) {
474
        this.$message.error('图片过大或格式不对请重新上传')
266
      }
475
      }
267
      if (!isLt2M) {
476
      if (!isLt2M) {
268
        this.$message.error('上传头像图片大小不能超过 2MB!')
477
        this.$message.error('图片过大或格式不对请重新上传')
269
      }
478
      }
270
      return isJPG && isLt2M
479
      return (!isJPG || !isPNG) && isLt2M
480
    },
481
    toshow(value) {
482
      this.ruleForm2.addrCode = value
271
    }
483
    }
272
  }
484
  }
273
}
485
}
274
</script>
486
</script>
275
487
276
<style rel="stylesheet/scss" lang="scss" scoped>
488
<style rel="stylesheet/scss" lang="scss" scoped>
489
  .el-autocomplete{
490
    display: block
491
  }
492
  .el-btn-col{
493
    margin-top: 45px
494
  }
277
  .avatar-uploader{
495
  .avatar-uploader{
278
    border: 1px dashed #409EFF;
496
    border: 1px dashed #409EFF;
279
    border-radius: 6px;
497
    border-radius: 6px;

+ 279 - 180
src/views/baseInfoManage/sensorsConfig/index.vue

1
<template>
1
<template>
2
  <div class="app-container">
2
  <div class="app-container">
3
    <div class="filter-container" style="margin-bottom:20px">
3
    <div class="filter-container" style="margin-bottom:20px">
4
      <el-input style="width: 200px;" class="filter-item" placeholder="采集盒编号" v-model="listQuery.title">
4
      <el-input style="width: 200px;" class="filter-item" placeholder="采集盒编号" v-model="listQuery.cdCode">
5
      </el-input>
5
      </el-input>
6
       <el-input style="width: 200px;" class="filter-item" placeholder="传感器编号" v-model="listQuery.importance">
6
       <el-input style="width: 200px;" class="filter-item" placeholder="传感器编号" v-model="listQuery.code">
7
      </el-input>
7
      </el-input>
8
      <el-button class="filter-item" style="margin-left: 10px;" @click="handleFilter" type="primary" icon="el-icon-search">查找</el-button>
8
      <el-button class="filter-item" style="margin-left: 10px;" @click="handleFilter" type="primary" icon="el-icon-search">查找</el-button>
9
      <el-button class="filter-item" style="margin-left: 10px;" @click="handleCreate" type="primary" icon="el-icon-edit">添加传感器</el-button>
9
      <el-button class="filter-item" style="margin-left: 10px;" @click="handleCreate" type="primary" icon="el-icon-edit">添加传感器</el-button>
13
      style="width: 100%;min-height:550px;">
13
      style="width: 100%;min-height:550px;">
14
      <el-table-column width="150px" align="center" label="传感器编号">
14
      <el-table-column width="150px" align="center" label="传感器编号">
15
        <template slot-scope="scope">
15
        <template slot-scope="scope">
16
          <span>{{scope.row.num}}</span>
16
          <span>{{scope.row.code}}</span>
17
        </template>
17
        </template>
18
      </el-table-column>
18
      </el-table-column>
19
      <el-table-column width="150px" align="center" label="传感器所在主缆">
19
      <el-table-column width="150px" align="center" label="传感器所在主缆">
20
        <template slot-scope="scope">
20
        <template slot-scope="scope">
21
          <span>{{scope.row.name}}</span>
21
          <span>{{scope.row.cableType}}</span>
22
        </template>
22
        </template>
23
      </el-table-column>
23
      </el-table-column>
24
      <el-table-column min-width="150px" align="center" label="传感器位置">
24
      <el-table-column width="150px" align="center" label="传感器位置">
25
        <template slot-scope="scope">
25
        <template slot-scope="scope">
26
          <span>{{scope.row.address}}</span>
26
          <span>{{scope.row.locType}}</span>
27
        </template>
27
        </template>
28
      </el-table-column>
28
      </el-table-column>
29
      <el-table-column min-width="150px" align="center" label="所属采集盒编号">
29
      <el-table-column min-width="150px" align="center" label="所属采集盒编号">
30
        <template slot-scope="scope">
30
        <template slot-scope="scope">
31
          <span>{{scope.row.org}}</span>
31
          <span>{{scope.row.deviceName}}</span>
32
        </template>
32
        </template>
33
      </el-table-column>
33
      </el-table-column>
34
      <el-table-column min-width="200px" align="center" label="备注信息">
34
      <el-table-column min-width="200px" align="center" label="备注信息">
35
        <template slot-scope="scope">
35
        <template slot-scope="scope">
36
          <span>{{scope.row.message}}</span>
36
          <span>{{scope.row.remark}}</span>
37
        </template>
37
        </template>
38
      </el-table-column>
38
      </el-table-column>
39
      <el-table-column align="center" label="Actions" width="230" class-name="small-padding fixed-width">
39
      <el-table-column align="center" label="Actions" width="230" class-name="small-padding fixed-width">
44
        </template>
44
        </template>
45
      </el-table-column>
45
      </el-table-column>
46
    </el-table>
46
    </el-table>
47
     <el-dialog title="传感器配置" ref="ruleForm" :visible.sync="dialogTableVisible" width="680px">
48
    <el-form class="form-main" label-width="120px">
49
      <el-row>
50
        <el-col :span="12">
51
          <el-form-item label="采集盒编号">
52
            <el-autocomplete
53
              v-model="state4"
54
              :fetch-suggestions="querySearchAsync"
55
              placeholder="请选择采集盒编号"
56
              @select="handleSelect">
57
            </el-autocomplete>
58
          </el-form-item>
59
        </el-col>
60
        <el-col :span="12">
61
          <el-form-item label="传感器编号">
62
            <el-input placeholder="请输入传感器编号"></el-input>
63
          </el-form-item>
64
        </el-col>
65
        <el-col :span="12">
66
          <el-form-item label="内部编号">
67
            <el-input placeholder="请输入内部编号"></el-input>
68
          </el-form-item>
69
        </el-col>
70
        <el-col :span="12">
71
          <el-form-item label="传感器所在主缆">
72
            <el-select v-model="value" placeholder="请选择主缆">
73
              <el-option
74
                v-for="item in options"
75
                :key="item.value"
76
                :label="item.label"
77
                :value="item.value">
78
              </el-option>
79
            </el-select>
80
          </el-form-item>
81
        </el-col>
82
        <el-col :span="12">
83
          <el-form-item label="传感器位置">
84
            <el-select v-model="value1" placeholder="请选择主缆传感器位置">
85
              <el-option
86
                v-for="item in options1"
87
                :key="item.value"
88
                :label="item.label"
89
                :value="item.value">
90
              </el-option>
91
            </el-select>
92
          </el-form-item>
93
        </el-col>
94
         
95
         <el-col :span="24" >
96
         备注
97
          <div class="editTe">
98
            <el-input type="textarea"></el-input>
99
          </div>
100
        </el-col>
101
        <el-col :span="24" class="el-btn-col">
102
          <div class="el-btn-col-box">
103
            <el-button type="primary" @click="submitForm('ruleForm')">确认</el-button>
104
            <el-button type="info">返回</el-button>
105
          </div>
106
        </el-col>
107
      </el-row>
108
    </el-form>
109
  </el-dialog>
47
    <el-dialog title="传感器配置" ref="ruleForm" :visible.sync="dialogTableVisible" width="680px" @close='closed'>
48
      <el-form :model="ruleForm2" :rules="rules2" ref="ruleForm2" class="form-main" label-width="120px" label-position='right' status-icon>
49
        <el-row>
50
          <el-col :span="12">
51
            <el-form-item label="采集盒编号" prop="device">
52
              <el-autocomplete
53
                 v-model="ruleForm2.device"
54
                :fetch-suggestions="querySearchAsync"
55
                placeholder="请选择采集盒编号"
56
                @select="handleSelect">
57
              </el-autocomplete>
58
            </el-form-item>
59
          </el-col>
60
          <el-col :span="12">
61
            <el-form-item label="传感器编号" prop="code">
62
              <el-input placeholder="请输入传感器编号" v-model="ruleForm2.code"></el-input>
63
            </el-form-item>
64
          </el-col>
65
          <el-col :span="12">
66
            <el-form-item label="内部编号" prop="seq">
67
              <el-input placeholder="请输入内部编号" v-model="ruleForm2.seq"></el-input>
68
            </el-form-item>
69
          </el-col>
70
          <el-col :span="12">
71
            <el-form-item label="传感器所在主缆" prop="cableType">
72
              <el-select v-model="ruleForm2.cableType" placeholder="请选择主缆">
73
                <el-option
74
                  v-for="item in options"
75
                  :key="item.value"
76
                  :label="item.label"
77
                  :value="item.value">
78
                </el-option>
79
              </el-select>
80
            </el-form-item>
81
          </el-col>
82
          <el-col :span="12">
83
            <el-form-item label="传感器位置" prop="locType">
84
              <el-select v-model="ruleForm2.locType" placeholder="请选择主缆传感器位置">
85
                <el-option
86
                  v-for="item in options1"
87
                  :key="item.value"
88
                  :label="item.label"
89
                  :value="item.value">
90
                </el-option>
91
              </el-select>
92
            </el-form-item>
93
          </el-col>
94
          <el-col :span="24" >
95
            <el-form-item label="备注" prop="remark">
96
              <el-input type="textarea" maxlength=100 v-model="ruleForm2.remark" rows=4></el-input>
97
             </el-form-item>
98
          </el-col>
99
          <el-col :span="24" class="el-btn-col">
100
            <div class="el-btn-col-box">
101
              <el-button type="primary" @click="submitForm('ruleForm2')">确认</el-button>
102
              <el-button type="info" @click="resetForm('ruleForm2')">返回</el-button>
103
            </div>
104
          </el-col>
105
        </el-row>
106
      </el-form>
107
    </el-dialog>
110
    <div class="pagination-container" style="text-align:center;">
108
    <div class="pagination-container" style="text-align:center;">
111
      <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="listQuery.page" :page-size="listQuery.limit" layout="prev, pager, next, jumper" :total="total">
109
      <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="listQuery.pageNo" :page-size="listQuery.pageSize" layout="prev, pager, next, jumper" :total="total">
112
      </el-pagination>
110
      </el-pagination>
113
    </div>
111
    </div>
114
  </div>
112
  </div>
115
</template>
113
</template>
116
114
117
<script>
115
<script>
118
//  import { fetchList, fetchPv, createArticle, updateArticle } from '@/api/article'
116
import { addDevice, updateDevice, deleteDevice, pageQueryDevice, DeviceOfservice, checkDeviceCode, checkDeviceInternalCode, queryServer } from '@/api/sensor'
119
import waves from '@/directive/waves'
117
import waves from '@/directive/waves'
120
//  import { parseTime } from '@/utils'
121
122
export default {
118
export default {
123
  name: 'complexTable',
119
  name: 'complexTable',
124
  directives: {
120
  directives: {
125
    waves
121
    waves
126
  },
122
  },
127
  data() {
123
  data() {
124
    var device = (rule, value, callback) => {
125
      const that = this
126
      setTimeout(function() {
127
        if (value === '' || that.ruleForm2.deviceId === '') {
128
          callback(new Error('请选择采集盒编号'))
129
        } else {
130
          callback()
131
        }
132
      }, 300)
133
    }
134
    var seq = (rule, value, callback) => {
135
      if (value === '') {
136
        callback(new Error('请输入内部编号'))
137
      } else {
138
        if (!this.ruleForm2.deviceId) {
139
          callback('请先选择采集盒编号')
140
          return
141
        }
142
        if (this.edit) {
143
          checkDeviceInternalCode({ seq: value, id: this.edit, deviceId: this.ruleForm2.deviceId }).then(response => {
144
            if (response.data) {
145
              callback(new Error('内部编号已存在,请重新输入'))
146
            } else {
147
              callback()
148
            }
149
          })
150
        } else {
151
          checkDeviceInternalCode({ seq: value, deviceId: this.ruleForm2.deviceId }).then(response => {
152
            if (response.data) {
153
              callback(new Error('内部编号已存在,请重新输入'))
154
            } else {
155
              callback()
156
            }
157
          })
158
        }
159
      }
160
    }
161
    var code = (rule, value, callback) => {
162
      if (value === '') {
163
        callback(new Error('请输入传感器编号'))
164
      } else {
165
        if (this.edit) {
166
          checkDeviceCode({ code: value, id: this.edit }).then(response => {
167
            if (response.data) {
168
              callback(new Error('传感器编号已存在,请重新输入'))
169
            } else {
170
              callback()
171
            }
172
          })
173
        } else {
174
          checkDeviceCode({ code: value }).then(response => {
175
            if (response.data) {
176
              callback(new Error('传感器编号已存在,请重新输入'))
177
            } else {
178
              callback()
179
            }
180
          })
181
        }
182
      }
183
    }
128
    return {
184
    return {
129
      options: [{
185
      options: [{
130
        value: '上游主缆',
186
        value: '上游主缆',
133
        value: '下游主缆',
189
        value: '下游主缆',
134
        label: '下游主缆'
190
        label: '下游主缆'
135
      }],
191
      }],
136
      value: '',
137
      options1: [{
192
      options1: [{
138
        value: '东跨',
193
        value: '东跨',
139
        label: '东跨'
194
        label: '东跨'
150
        value: '北跨',
205
        value: '北跨',
151
        label: '北跨'
206
        label: '北跨'
152
      }],
207
      }],
153
      value1: '',
154
      restaurants: [],
155
      state4: '',
208
      edit: '',
209
      ruleForm2: {
210
        code: '',
211
        cableType: '上游主缆',
212
        device: '',
213
        seq: '',
214
        deviceId: '',
215
        locType: '东跨',
216
        remark: ''
217
      },
218
      rules2: {
219
        code: [
220
          { required: true, validator: code, trigger: 'blur' }
221
        ],
222
        device: [
223
          { required: true, validator: device, trigger: 'blur' }
224
        ],
225
        cableType: [
226
          { required: true, message: '请选择主缆', trigger: 'blur' }
227
        ],
228
        locType: [
229
          { required: true, message: '请选择传感器位置', trigger: 'blur' }
230
        ],
231
        seq: [
232
          { required: true, validator: seq, trigger: 'blur' }
233
        ]
234
      },
156
      timeout: null,
235
      timeout: null,
157
      dialogTableVisible: false,
236
      dialogTableVisible: false,
158
      tableKey: 0,
237
      tableKey: 0,
159
      list: null,
238
      list: null,
160
      dataList: { total: 20, data: [{ num: 1111, name: '北京科技大学', address: '北京', org: '机电学院', message: '想落户上海,你还差几分?抢人才看出身,清华北大照单全收' }] },
161
      total: null,
239
      total: null,
162
      listLoading: true,
240
      listLoading: true,
163
      listQuery: {
241
      listQuery: {
164
        page: 1,
165
        limit: 10,
166
        importance: undefined,
167
        title: undefined,
168
        type: undefined,
169
        sort: '+id'
170
      },
171
      dialogFormVisible: false,
172
      dialogStatus: '',
173
      textMap: {
174
        update: 'Edit',
175
        create: 'Create'
242
        cdCode: '',
243
        code: '',
244
        active: 1,
245
        pageSize: 10,
246
        pageNo: 1
176
      }
247
      }
177
    }
248
    }
178
  },
249
  },
182
    }
253
    }
183
  },
254
  },
184
  created() {
255
  created() {
185
    this.restaurants = this.loadAll()
186
    this.getList()
256
    this.getList()
187
  },
257
  },
188
  methods: {
258
  methods: {
189
    submitForm(formName) {
259
    submitForm(formName) {
260
      const that = this
190
      this.$refs[formName].validate((valid) => {
261
      this.$refs[formName].validate((valid) => {
191
        if (valid) {
262
        if (valid) {
192
        //   let paramsData = {
193
        //     'title': this.ruleFormDem.demandTit,
194
        //     'descp': this.ruleFormDem.demandDesc,
195
        //     'province': this.ruleFormDem.province,
196
        //     'city': this.ruleFormDem.city,
197
        //     'invalidDay': util.dateFormatter(this.ruleFormDem.lastDate, false, true),
198
        //     'cost': this.selectCostRange,
199
        //     'duration': this.selectLongTime,
200
        //     'orgName': this.ruleFormDem.orgName,
201
        //     'contactNum': this.ruleFormDem.linkTel,
202
        //     'creator': this.kxUserId,
203
        //     'source': this.platSource
204
        //   };
205
        //   this.$axios.post(httpUrl.kxQurey.demand.add, paramsData).then((res) => {
206
        //     if (res.success) {
207
        //       this.$alert('我们已收到您的需求,马上为您对接合适的专家和专业机构,您可以登录科袖网与对方做进一步沟通。', '需求发布成功!', {
208
        //         confirmButtonText: '进入科袖网,发现更多服务和资源',
209
        //         type: 'success',
210
        //         center: true,
211
        //         cancelButtonText: '取消',
212
        //         callback: action => {
213
        //           if (action === 'confirm') {
214
        //             window.open(util.ekexiuUrl, '科袖网首页');
215
        //           };
216
        //         }
217
        //       });
218
        //       this.resetForm(formName);
219
        //       this.$emit('dialogChangedLogin', false);
220
        //     } else {
221
        //       this.$message({
222
        //         message: '需求发布失败,请重新发布!',
223
        //         type: 'warning'
224
        //       });
225
        //     };
226
        //     console.log(res);
227
        //   });
228
        // } else {
229
        //   console.log('error submit!!');
230
        //   return false
263
          if (!this.edit) {
264
            addDevice(this.ruleForm2).then(response => {
265
              this.getList()
266
              setTimeout(function() {
267
                that.pop('已成功添加传感器')
268
              }, 1000)
269
              this.resetForm(this.ruleForm2)
270
              this.dialogTableVisible = false
271
            }).catch(error => {
272
              console.log(error)
273
            })
274
          } else {
275
            const par = this.ruleForm2
276
            par.id = this.edit
277
            updateDevice(par).then(response => {
278
              if (response.success) {
279
                setTimeout(function() {
280
                  that.pop('已成功更新传感器')
281
                }, 1000)
282
                this.resetForm('ruleForm2')
283
                this.getList()
284
                this.dialogTableVisible = false
285
                this.edit = ''
286
                this.ruleForm2 = {
287
                  code: '',
288
                  cableType: '',
289
                  device: '',
290
                  seq: '',
291
                  deviceId: '',
292
                  locType: '',
293
                  remark: ''
294
                }
295
              }
296
            })
297
          }
231
        }
298
        }
232
      })
299
      })
233
    },
300
    },
301
    resetForm(formName) {
302
      this.dialogTableVisible = false
303
      this.$refs[formName].resetFields()
304
      this.edit = ''
305
    },
306
    closed() {
307
      this.$refs['ruleForm2'].resetFields()
308
      this.edit = ''
309
    },
234
    getList() {
310
    getList() {
235
      this.listLoading = true
311
      this.listLoading = true
236
      this.list = this.dataList.data
237
      this.total = this.dataList.total
238
      setTimeout(() => {
239
        this.listLoading = false
240
      }, 1.5 * 1000)
241
      /*  fetchList(this.listQuery).then(response => {
242
        this.list = this.dataList.data
243
        this.total =  this.dataList.total
312
      pageQueryDevice(this.listQuery).then(response => {
313
        const $data = response.data.data
314
        for (let i = 0; i < $data.length; i++) {
315
          $data[i].deviceName = ''
316
          queryServer({ id: $data[i].deviceId }).then(response => {
317
            this.list[i].deviceName = response.data.code
318
            this.$forceUpdate()
319
          })
320
        }
321
        this.list = $data
322
        this.total = response.data.total
244
        setTimeout(() => {
323
        setTimeout(() => {
245
          this.listLoading = false
324
          this.listLoading = false
246
        }, 1.5 * 1000)
325
        }, 1.5 * 1000)
247
      })  */
326
      })
248
    },
327
    },
249
    handleFilter() {
328
    handleFilter() {
250
      this.listQuery.page = 1
251
      //  this.getList()
329
      this.listQuery.pageNo = 1
330
      this.getList()
252
    },
331
    },
253
    handleSizeChange(val) {
332
    handleSizeChange(val) {
254
      this.listQuery.limit = val
255
      //  this.getList()
333
      this.listQuery.pageSize = val
334
      this.getList()
256
    },
335
    },
257
    handleCurrentChange(val) {
336
    handleCurrentChange(val) {
258
      this.listQuery.page = val
259
      //  this.getList()
337
      this.listQuery.pageNo = val
338
      this.getList()
260
    },
339
    },
261
    handleModifyStatus(row, status) {
340
    handleModifyStatus(row, status) {
262
      this.$confirm('已成功删除传感器', '提示', {
341
      this.$confirm('确实要删除:传感器' + row.code + '吗?', '提示', {
342
        confirmButtonText: '确定',
343
        cancelButtonText: '取消',
344
        type: 'warning',
345
        center: true
346
      }).then(() => {
347
        deleteDevice({ id: row.id }).then(response => {
348
          if (response.success) {
349
            this.getList()
350
            this.pop('已成功删除该传感器')
351
          }
352
        })
353
      }).catch(() => {
354
355
      })
356
    },
357
    pop($par) {
358
      this.$confirm($par, '提示', {
263
        confirmButtonText: '确定',
359
        confirmButtonText: '确定',
264
        cancelButtonText: '取消',
360
        cancelButtonText: '取消',
265
        type: 'success',
361
        type: 'success',
270
      }).catch(() => {
366
      }).catch(() => {
271
367
272
      })
368
      })
273
      /*  this.$confirm('确实要删除:桥梁12324吗?, 是否继续?', '提示', {
274
      confirmButtonText: '确定',
275
          cancelButtonText: '取消',
276
          type: 'warning',
277
          center: true
278
        }).then(() => {
279
          this.$message({
280
            type: 'success',
281
            message: '删除成功!'
282
          });
283
        }).catch(() => {
284
285
        }); */
286
    },
369
    },
287
    resetTemp() {
288
370
    resetTemp(row) {
371
      this.ruleForm2 = {
372
        code: row.code,
373
        cableType: row.cableType,
374
        device: row.deviceName,
375
        seq: row.seq,
376
        deviceId: row.deviceId,
377
        locType: row.locType,
378
        remark: row.remark
379
      }
380
      this.edit = row.id
289
    },
381
    },
290
    handleCreate() {
382
    handleCreate() {
291
      this.dialogTableVisible = true
383
      this.dialogTableVisible = true
292
    },
384
    },
293
    handleUpdate(row) {
385
    handleUpdate(row) {
294
    },
295
    loadAll() {
296
      return [{ 'value': '三全鲜食(北新泾店)', 'address': '长宁区新渔路144号' }]
386
      this.resetTemp(row)
387
      this.dialogTableVisible = true
297
    },
388
    },
298
    querySearchAsync(queryString, cb) {
389
    querySearchAsync(queryString, cb) {
299
      console.log(queryString + 'wewe')
300
      var restaurants = this.restaurants
301
      var results = queryString ? restaurants.filter(this.createStateFilter(queryString)) : restaurants
302
      console.log(results + 'dddd')
390
      if (queryString === '') {
391
        cb([])
392
        return
393
      }
394
      this.ruleForm2.deviceId = ''
303
      clearTimeout(this.timeout)
395
      clearTimeout(this.timeout)
304
      this.timeout = setTimeout(() => {
396
      this.timeout = setTimeout(() => {
305
        cb(results)
397
        DeviceOfservice({ code: this.ruleForm2.device }).then(response => {
398
          const $info = response.data
399
          if ($info.length) {
400
            const $data = $info.map(item => {
401
              return { 'value': item.code, 'id': item.id }
402
            })
403
            cb($data)
404
            if ($info.length === 1 && this.ruleForm2.bridge === $info[0].code) {
405
              this.ruleForm2.deviceId = $info[0].id
406
            } else {
407
              this.ruleForm2.deviceId = ''
408
            }
409
          } else {
410
            cb([])
411
          }
412
        })
306
      }, 3000 * Math.random())
413
      }, 3000 * Math.random())
307
    },
414
    },
308
    createStateFilter(queryString) {
309
      return (state) => {
310
        return (state.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0)
311
      }
312
    },
313
    handleSelect(item) {
415
    handleSelect(item) {
314
      console.log(item + 'ccc')
416
      this.ruleForm2.deviceId = item.id
315
    }
417
    }
316
  }
418
  }
317
}
419
}
324
  .el-btn-col{
426
  .el-btn-col{
325
    margin-top: 45px
427
    margin-top: 45px
326
  }
428
  }
327
  .editTe{
328
    margin: 10px 0 0 22px
329
  }
330
</style>
429
</style>

+ 228 - 131
src/views/baseInfoManage/serversConfig/index.vue

1
<template>
1
<template>
2
  <div class="app-container">
2
  <div class="app-container">
3
    <div class="filter-container" style="margin-bottom:20px">
3
    <div class="filter-container" style="margin-bottom:20px">
4
      <el-input style="width: 200px;" class="filter-item" placeholder="所属桥梁编号" v-model="listQuery.title">
4
      <el-input style="width: 200px;" class="filter-item" placeholder="所属桥梁编号" v-model="listQuery.bcode">
5
      </el-input>
5
      </el-input>
6
       <el-input style="width: 200px;" class="filter-item" placeholder="服务器编号" v-model="listQuery.importance">
6
       <el-input style="width: 200px;" class="filter-item" placeholder="服务器编号" v-model="listQuery.code">
7
      </el-input>
7
      </el-input>
8
      <el-button class="filter-item" style="margin-left: 10px;" @click="handleFilter" type="primary" icon="el-icon-search">查找</el-button>
8
      <el-button class="filter-item" style="margin-left: 10px;" @click="handleFilter" type="primary" icon="el-icon-search">查找</el-button>
9
      <el-button class="filter-item" style="margin-left: 10px;" @click="handleCreate" type="primary" icon="el-icon-edit">添加服务器</el-button>
9
      <el-button class="filter-item" style="margin-left: 10px;" @click="handleCreate" type="primary" icon="el-icon-edit">添加服务器</el-button>
13
      style="width: 100%;min-height:550px;">
13
      style="width: 100%;min-height:550px;">
14
      <el-table-column width="150px" align="center" label="服务器编号">
14
      <el-table-column width="150px" align="center" label="服务器编号">
15
        <template slot-scope="scope">
15
        <template slot-scope="scope">
16
          <span>{{scope.row.num}}</span>
16
          <span>{{scope.row.code}}</span>
17
        </template>
17
        </template>
18
      </el-table-column>
18
      </el-table-column>
19
      <el-table-column width="150px" align="center" label="采集盒数量">
19
      <el-table-column width="150px" align="center" label="采集盒数量">
20
        <template slot-scope="scope">
20
        <template slot-scope="scope">
21
          <span>{{scope.row.name}}</span>
21
          <span>{{scope.row.devices}}</span>
22
        </template>
22
        </template>
23
      </el-table-column>
23
      </el-table-column>
24
      <el-table-column min-width="150px" align="center" label="所属桥梁">
24
      <el-table-column min-width="150px" align="center" label="所属桥梁">
25
        <template slot-scope="scope">
25
        <template slot-scope="scope">
26
          <span>{{scope.row.address}}</span>
26
          <span>{{scope.row.bridgeName}}</span>
27
        </template>
27
        </template>
28
      </el-table-column>
28
      </el-table-column>
29
      <el-table-column min-width="200px" align="center" label="备注信息">
29
      <el-table-column min-width="200px" align="center" label="备注信息">
30
        <template slot-scope="scope">
30
        <template slot-scope="scope">
31
          <span>{{scope.row.message}}</span>
31
          <span>{{scope.row.remark}}</span>
32
        </template>
32
        </template>
33
      </el-table-column>
33
      </el-table-column>
34
      <el-table-column align="center" label="Actions" width="230" class-name="small-padding fixed-width">
34
      <el-table-column align="center" label="Actions" width="230" class-name="small-padding fixed-width">
39
        </template>
39
        </template>
40
      </el-table-column>
40
      </el-table-column>
41
    </el-table>
41
    </el-table>
42
    <el-dialog title="采集服务器配置" ref="ruleForm" :visible.sync="dialogTableVisible" width="680px">
43
      <el-form class="form-main" label-width="120px">
42
    <el-dialog title="采集服务器配置" ref="ruleForm" :visible.sync="dialogTableVisible" width="680px" @close='closed'>
43
      <el-form :model="ruleForm2" :rules="rules2" ref="ruleForm2" class="form-main" label-width="120px" label-position='right' status-icon>
44
        <el-row>
44
        <el-row>
45
          <el-col :span="12">
45
          <el-col :span="12">
46
            <el-form-item label="服务器编号">
47
              <el-input placeholder="请输入服务器编号"></el-input>
46
            <el-form-item label="服务器编号" prop="code">
47
              <el-input placeholder="请输入服务器编号" v-model="ruleForm2.code"></el-input>
48
            </el-form-item>
48
            </el-form-item>
49
          </el-col>
49
          </el-col>
50
          <el-col :span="12">
50
          <el-col :span="12">
51
            <el-form-item label="采集盒数量">
52
              <el-input placeholder="请输入采集盒数量"></el-input>
51
            <el-form-item label="采集盒数量" prop="devices">
52
              <el-input placeholder="请输入采集盒数量" v-model="ruleForm2.devices"></el-input>
53
            </el-form-item>
53
            </el-form-item>
54
          </el-col>
54
          </el-col>
55
           <el-col :span="12">
56
            <el-form-item label="所属桥梁">
55
          <el-col :span="12">
56
            <el-form-item label="所属桥梁" prop="bridge">
57
              <el-autocomplete
57
              <el-autocomplete
58
                v-model="state4"
58
                 v-model="ruleForm2.bridge"
59
                :fetch-suggestions="querySearchAsync"
59
                :fetch-suggestions="querySearchAsync"
60
                placeholder="请选择所属桥梁"
60
                placeholder="请选择所属桥梁"
61
                @select="handleSelect">
61
                @select="handleSelect">
63
            </el-form-item>
63
            </el-form-item>
64
          </el-col>
64
          </el-col>
65
          <el-col :span="12">
65
          <el-col :span="12">
66
            <el-form-item label="内部编号">
67
              <el-input placeholder="请输入内部编号"></el-input>
66
            <el-form-item label="内部编号" prop="seq">
67
              <el-input placeholder="请输入内部编号" v-model="ruleForm2.seq"></el-input>
68
            </el-form-item>
68
            </el-form-item>
69
          </el-col>
69
          </el-col>
70
           <el-col :span="24" >
71
           备注
72
            <div class="editTe">
73
              <el-input type="textarea"></el-input>
74
            </div>
70
          <el-col :span="24" >
71
            <el-form-item label="备注" prop="remark">
72
              <el-input type="textarea" maxlength=100 v-model="ruleForm2.remark" rows=4></el-input>
73
             </el-form-item>
75
          </el-col>
74
          </el-col>
76
          <el-col :span="24" class="el-btn-col">
75
          <el-col :span="24" class="el-btn-col">
77
            <div class="el-btn-col-box">
76
            <div class="el-btn-col-box">
78
              <el-button type="primary" @click="submitForm('ruleForm')">确认</el-button>
79
              <el-button type="info">返回</el-button>
77
              <el-button type="primary" @click="submitForm('ruleForm2')">确认</el-button>
78
              <el-button type="info" @click="resetForm('ruleForm2')">返回</el-button>
80
            </div>
79
            </div>
81
          </el-col>
80
          </el-col>
82
        </el-row>
81
        </el-row>
83
      </el-form>
82
      </el-form>
84
    </el-dialog>
83
    </el-dialog>
85
    <div class="pagination-container" style="text-align:center;">
84
    <div class="pagination-container" style="text-align:center;">
86
      <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="listQuery.page" :page-size="listQuery.limit" layout="prev, pager, next, jumper" :total="total">
85
      <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="listQuery.pageNo" :page-size="listQuery.pageSize" layout="prev, pager, next, jumper" :total="total">
87
      </el-pagination>
86
      </el-pagination>
88
    </div>
87
    </div>
89
  </div>
88
  </div>
90
</template>
89
</template>
91
90
92
<script>
91
<script>
93
//  import { fetchList, fetchPv, createArticle, updateArticle } from '@/api/article'
92
import { addDevice, updateDevice, deleteDevice, pageQueryDevice, DeviceOfservice, checkDeviceCode, checkDeviceInternalCode, queryServer } from '@/api/server'
94
import waves from '@/directive/waves'
93
import waves from '@/directive/waves'
95
//  import { parseTime } from '@/utils'
96
97
export default {
94
export default {
98
  name: 'complexTable',
95
  name: 'complexTable',
99
  directives: {
96
  directives: {
100
    waves
97
    waves
101
  },
98
  },
102
  data() {
99
  data() {
100
    var bridge = (rule, value, callback) => {
101
      const that = this
102
      setTimeout(function() {
103
        if (value === '' || that.ruleForm2.bridgeId === '') {
104
          callback(new Error('请选择所属桥梁'))
105
        } else {
106
          callback()
107
        }
108
      }, 300)
109
    }
110
    var seq = (rule, value, callback) => {
111
      if (value === '') {
112
        callback(new Error('请输入内部编号'))
113
      } else {
114
        if (!this.ruleForm2.bridgeId) {
115
          callback('请先选择服务器编号')
116
          return
117
        }
118
        if (this.edit) {
119
          checkDeviceInternalCode({ seq: value, id: this.edit, bridgeId: this.ruleForm2.bridgeId }).then(response => {
120
            if (response.data) {
121
              callback(new Error('内部编号已存在,请重新输入'))
122
            } else {
123
              callback()
124
            }
125
          })
126
        } else {
127
          checkDeviceInternalCode({ seq: value, bridgeId: this.ruleForm2.bridgeId }).then(response => {
128
            if (response.data) {
129
              callback(new Error('内部编号已存在,请重新输入'))
130
            } else {
131
              callback()
132
            }
133
          })
134
        }
135
      }
136
    }
137
    var code = (rule, value, callback) => {
138
      if (value === '') {
139
        callback(new Error('请输入服务器编号'))
140
      } else {
141
        if (this.edit) {
142
          checkDeviceCode({ code: value, id: this.edit }).then(response => {
143
            if (response.data) {
144
              callback(new Error('服务器编号已存在,请重新输入'))
145
            } else {
146
              callback()
147
            }
148
          })
149
        } else {
150
          checkDeviceCode({ code: value }).then(response => {
151
            if (response.data) {
152
              callback(new Error('服务器编号已存在,请重新输入'))
153
            } else {
154
              callback()
155
            }
156
          })
157
        }
158
      }
159
    }
103
    return {
160
    return {
104
      restaurants: [],
105
      state4: '',
161
      edit: '',
162
      ruleForm2: {
163
        code: '',
164
        bridge: '',
165
        seq: '',
166
        bridgeId: '',
167
        remark: '',
168
        devices: ''
169
      },
170
      rules2: {
171
        code: [
172
          { required: true, validator: code, trigger: 'blur' }
173
        ],
174
        bridge: [
175
          { required: true, validator: bridge, trigger: 'blur' }
176
        ],
177
        devices: [
178
          { required: true, message: '请输入采集盒数量', trigger: 'blur' }
179
        ],
180
        seq: [
181
          { required: true, validator: seq, trigger: 'blur' }
182
        ]
183
      },
106
      timeout: null,
184
      timeout: null,
107
      dialogTableVisible: false,
185
      dialogTableVisible: false,
108
      tableKey: 0,
186
      tableKey: 0,
109
      list: null,
187
      list: null,
110
      dataList: { total: 20, data: [{ num: 1111, name: '北京科技大学', address: '北京', org: '机电学院', message: '想落户上海,你还差几分?抢人才看出身,清华北大照单全收' }] },
111
      total: null,
188
      total: null,
112
      listLoading: true,
189
      listLoading: true,
113
      listQuery: {
190
      listQuery: {
114
        page: 1,
115
        limit: 10,
116
        importance: undefined,
117
        title: undefined,
118
        type: undefined,
119
        sort: '+id'
120
       },
121
      dialogFormVisible: false,
122
      dialogStatus: '',
123
      textMap: {
124
        update: 'Edit',
125
        create: 'Create'
191
        bcode: '',
192
        code: '',
193
        active: 1,
194
        pageSize: 10,
195
        pageNo: 1
126
      }
196
      }
127
    }
197
    }
128
  },
198
  },
132
    }
202
    }
133
  },
203
  },
134
  created() {
204
  created() {
135
    this.restaurants = this.loadAll()
136
    this.getList()
205
    this.getList()
137
  },
206
  },
138
  methods: {
207
  methods: {
139
    submitForm(formName) {
208
    submitForm(formName) {
209
      const that = this
140
      this.$refs[formName].validate((valid) => {
210
      this.$refs[formName].validate((valid) => {
141
        if (valid) {
211
        if (valid) {
142
        //   let paramsData = {
143
        //     'title': this.ruleFormDem.demandTit,
144
        //     'descp': this.ruleFormDem.demandDesc,
145
        //     'province': this.ruleFormDem.province,
146
        //     'city': this.ruleFormDem.city,
147
        //     'invalidDay': util.dateFormatter(this.ruleFormDem.lastDate, false, true),
148
        //     'cost': this.selectCostRange,
149
        //     'duration': this.selectLongTime,
150
        //     'orgName': this.ruleFormDem.orgName,
151
        //     'contactNum': this.ruleFormDem.linkTel,
152
        //     'creator': this.kxUserId,
153
        //     'source': this.platSource
154
        //   };
155
        //   this.$axios.post(httpUrl.kxQurey.demand.add, paramsData).then((res) => {
156
        //     if (res.success) {
157
        //       this.$alert('我们已收到您的需求,马上为您对接合适的专家和专业机构,您可以登录科袖网与对方做进一步沟通。', '需求发布成功!', {
158
        //         confirmButtonText: '进入科袖网,发现更多服务和资源',
159
        //         type: 'success',
160
        //         center: true,
161
        //         cancelButtonText: '取消',
162
        //         callback: action => {
163
        //           if (action === 'confirm') {
164
        //             window.open(util.ekexiuUrl, '科袖网首页');
165
        //           };
166
        //         }
167
        //       });
168
        //       this.resetForm(formName);
169
        //       this.$emit('dialogChangedLogin', false);
170
        //     } else {
171
        //       this.$message({
172
        //         message: '需求发布失败,请重新发布!',
173
        //         type: 'warning'
174
        //       });
175
        //     };
176
        //     console.log(res);
177
        //   });
178
        // } else {
179
        //   console.log('error submit!!');
180
        //   return false
212
          if (!this.edit) {
213
            addDevice(this.ruleForm2).then(response => {
214
              this.getList()
215
              setTimeout(function() {
216
                that.pop('已成功添加传感器')
217
              }, 1000)
218
              this.resetForm(this.ruleForm2)
219
              this.dialogTableVisible = false
220
            }).catch(error => {
221
              console.log(error)
222
            })
223
          } else {
224
            const par = this.ruleForm2
225
            par.id = this.edit
226
            updateDevice(par).then(response => {
227
              if (response.success) {
228
                setTimeout(function() {
229
                  that.pop('已成功更新传感器')
230
                }, 1000)
231
                this.resetForm('ruleForm2')
232
                this.getList()
233
                this.dialogTableVisible = false
234
                this.edit = ''
235
                this.ruleForm2 = {
236
                  code: '',
237
                  bridge: '',
238
                  seq: '',
239
                  bridgeId: '',
240
                  devices: '',
241
                  remark: ''
242
                }
243
              }
244
            })
245
          }
181
        }
246
        }
182
      })
247
      })
183
    },
248
    },
249
    resetForm(formName) {
250
      this.dialogTableVisible = false
251
      this.$refs[formName].resetFields()
252
      this.edit = ''
253
    },
254
    closed() {
255
      this.$refs['ruleForm2'].resetFields()
256
      this.edit = ''
257
    },
184
    getList() {
258
    getList() {
185
      this.listLoading = true
259
      this.listLoading = true
186
      this.list = this.dataList.data
187
      this.total = this.dataList.total
188
      setTimeout(() => {
189
        this.listLoading = false
190
      }, 1.5 * 1000)
191
      /*  fetchList(this.listQuery).then(response => {
192
        this.list = this.dataList.data
193
        this.total =  this.dataList.total
260
      pageQueryDevice(this.listQuery).then(response => {
261
        const $data = response.data.data
262
        for (let i = 0; i < $data.length; i++) {
263
          $data[i].bridgeName = ''
264
          queryServer({ id: $data[i].bridgeId }).then(response => {
265
            this.list[i].bridgeName = response.data.shortName
266
            this.$forceUpdate()
267
          })
268
        }
269
        this.list = $data
270
        this.total = response.data.total
194
        setTimeout(() => {
271
        setTimeout(() => {
195
          this.listLoading = false
272
          this.listLoading = false
196
        }, 1.5 * 1000)
273
        }, 1.5 * 1000)
197
      })  */
274
      })
198
    },
275
    },
199
    handleFilter() {
276
    handleFilter() {
200
      this.listQuery.page = 1
201
      //  this.getList()
277
      this.listQuery.pageNo = 1
278
      this.getList()
202
    },
279
    },
203
    handleSizeChange(val) {
280
    handleSizeChange(val) {
204
      this.listQuery.limit = val
205
      //  this.getList()
281
      this.listQuery.pageSize = val
282
      this.getList()
206
    },
283
    },
207
    handleCurrentChange(val) {
284
    handleCurrentChange(val) {
208
      this.listQuery.page = val
209
      //  this.getList()
285
      this.listQuery.pageNo = val
286
      this.getList()
210
    },
287
    },
211
    handleModifyStatus(row, status) {
288
    handleModifyStatus(row, status) {
212
      this.$confirm('已成功删除该传感器', '提示', {
289
      this.$confirm('确实要删除:服务器' + row.code + '吗?', '提示', {
290
        confirmButtonText: '确定',
291
        cancelButtonText: '取消',
292
        type: 'warning',
293
        center: true
294
      }).then(() => {
295
        deleteDevice({ id: row.id }).then(response => {
296
          if (response.success) {
297
            this.getList()
298
            this.pop('已成功删除该传感器')
299
          }
300
        })
301
      }).catch(() => {
302
303
      })
304
    },
305
    pop($par) {
306
      this.$confirm($par, '提示', {
213
        confirmButtonText: '确定',
307
        confirmButtonText: '确定',
214
        cancelButtonText: '取消',
308
        cancelButtonText: '取消',
215
        type: 'success',
309
        type: 'success',
220
      }).catch(() => {
314
      }).catch(() => {
221
315
222
      })
316
      })
223
      /*  this.$confirm('确实要删除:桥梁12324吗?, 是否继续?', '提示', {
224
      confirmButtonText: '确定',
225
          cancelButtonText: '取消',
226
          type: 'warning',
227
          center: true
228
        }).then(() => {
229
          this.$message({
230
            type: 'success',
231
            message: '删除成功!'
232
          });
233
        }).catch(() => {
234
235
        }); */
236
    },
317
    },
237
    resetTemp() {
238
318
    resetTemp(row) {
319
      this.ruleForm2 = {
320
        code: row.code,
321
        bridge: row.bridgeName,
322
        seq: row.seq,
323
        bridgeId: row.bridgeId,
324
        devices: row.devices,
325
        remark: row.remark
326
      }
327
      this.edit = row.id
239
    },
328
    },
240
    handleCreate() {
329
    handleCreate() {
241
      this.dialogTableVisible = true
330
      this.dialogTableVisible = true
242
    },
331
    },
243
    handleUpdate(row) {
332
    handleUpdate(row) {
244
    },
245
    loadAll() {
246
      return [{ 'value': '三全鲜食(北新泾店)', 'address': '长宁区新渔路144号' }]
333
      this.resetTemp(row)
334
      this.dialogTableVisible = true
247
    },
335
    },
248
    querySearchAsync(queryString, cb) {
336
    querySearchAsync(queryString, cb) {
249
      console.log(queryString + 'wewe')
250
      var restaurants = this.restaurants
251
      var results = queryString ? restaurants.filter(this.createStateFilter(queryString)) : restaurants
252
      console.log(results + 'dddd')
337
      if (queryString === '') {
338
        cb([])
339
        return
340
      }
341
      this.ruleForm2.bridgeId = ''
253
      clearTimeout(this.timeout)
342
      clearTimeout(this.timeout)
254
      this.timeout = setTimeout(() => {
343
      this.timeout = setTimeout(() => {
255
        cb(results)
344
        DeviceOfservice({ key: this.ruleForm2.bridge, active: 1 }).then(response => {
345
          const $info = response.data
346
          if ($info.length) {
347
            const $data = $info.map(item => {
348
              return { 'value': item.shortName, 'id': item.id }
349
            })
350
            cb($data)
351
            if ($info.length === 1 && this.ruleForm2.bridge === $info[0].shortName) {
352
              this.ruleForm2.bridgeId = $info[0].id
353
            } else {
354
              this.ruleForm2.bridgeId = ''
355
            }
356
          } else {
357
            cb([])
358
          }
359
        })
256
      }, 3000 * Math.random())
360
      }, 3000 * Math.random())
257
    },
361
    },
258
    createStateFilter(queryString) {
259
      return (state) => {
260
        return (state.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0)
261
      }
262
    },
263
    handleSelect(item) {
362
    handleSelect(item) {
264
      console.log(item + 'ccc')
363
      this.ruleForm2.bridgeId = item.id
364
      console.log(item.id)
265
    }
365
    }
266
  }
366
  }
267
}
367
}
274
  .el-btn-col{
374
  .el-btn-col{
275
    margin-top: 45px
375
    margin-top: 45px
276
  }
376
  }
277
  .editTe{
278
    margin: 10px 0 0 22px
279
  }
280
</style>
377
</style>

+ 45 - 13
src/views/city/linkage.vue

3
    <el-select
3
    <el-select
4
      v-model="sheng"
4
      v-model="sheng"
5
      @change="choseProvince"
5
      @change="choseProvince"
6
      placeholder="省级地区">
6
      placeholder="省">
7
      <el-option
7
      <el-option
8
        v-for="item in province"
8
        v-for="item in province"
9
        :key="item.id"
9
        :key="item.id"
14
    <el-select
14
    <el-select
15
      v-model="shi"
15
      v-model="shi"
16
      @change="choseCity"
16
      @change="choseCity"
17
      placeholder="市级地区">
17
      placeholder="市">
18
      <el-option
18
      <el-option
19
        v-for="item in shi1"
19
        v-for="item in shi1"
20
        :key="item.id"
20
        :key="item.id"
25
    <el-select
25
    <el-select
26
      v-model="qu"
26
      v-model="qu"
27
      @change="choseBlock"
27
      @change="choseBlock"
28
      placeholder="区级地区">
28
      placeholder="区(县)">
29
      <el-option
29
      <el-option
30
        v-for="item in qu1"
30
        v-for="item in qu1"
31
        :key="item.id"
31
        :key="item.id"
39
<script>
39
<script>
40
import axios from 'axios'
40
import axios from 'axios'
41
export default {
41
export default {
42
  props: ['addrCode'],
42
  data() {
43
  data() {
43
    return {
44
    return {
44
      mapJson: '../../static/map.json',
45
      mapJson: '../../static/map.json',
45
      province: '',
46
      province: [],
46
      sheng: '',
47
      sheng: '',
47
      shi: '',
48
      shi: '',
48
      shi1: [],
49
      shi1: [],
52
      block: ''
53
      block: ''
53
    }
54
    }
54
  },
55
  },
56
  watch: {
57
    addrCode: function() {
58
      if (!this.addrCode) {
59
        this.sheng = ''
60
        this.shi = ''
61
        this.qu = ''
62
        return
63
      }
64
      const s = this.addrCode.substring(0, 2) + '0000'
65
      const si = this.addrCode.substring(0, 4) + '00'
66
      const x = this.addrCode
67
      this.province.map(item => {
68
        if (item.id === s) {
69
          this.sheng = item.value
70
          item.children.map(item => {
71
            if (item.id === si) {
72
              this.shi = item.value
73
              item.children.map(item => {
74
                if (x === item.id) {
75
                  this.qu = item.value
76
                }
77
              })
78
            }
79
          })
80
        }
81
      })
82
    }
83
  },
55
  methods: {
84
  methods: {
56
    getCityData: function() {
85
    getCityData: function() {
57
      var that = this
86
      var that = this
58
      axios.get(this.mapJson).then(function(response) {
87
      axios.get('/ajax/dict/items?dict=XZQH').then(function(response) {
59
        if (response.status === 200) {
88
        if (response.status === 200) {
60
          var data = response.data
89
          var data = response.data.data
61
          that.province = []
90
          that.province = []
62
          that.city = []
91
          that.city = []
63
          that.block = []
92
          that.block = []
64
          for (var item in data) {
65
            if (item.match(/0000$/)) {
66
              that.province.push({ id: item, value: data[item], children: [] })
67
            } else if (item.match(/00$/)) {
68
              that.city.push({ id: item, value: data[item], children: [] })
93
          data.map(item => {
94
            if (item.code.match(/0000$/)) {
95
              that.province.push({ id: item.code, value: item.caption, children: [] })
96
            } else if (item.code.match(/00$/)) {
97
              that.city.push({ id: item.code, value: item.caption, children: [] })
69
            } else {
98
            } else {
70
              that.block.push({ id: item, value: data[item] })
99
              that.block.push({ id: item.code, value: item.caption })
71
            }
100
            }
72
          }
101
          })
73
          for (var index in that.province) {
102
          for (var index in that.province) {
74
            for (var index1 in that.city) {
103
            for (var index1 in that.city) {
75
              if (that.province[index].id.slice(0, 2) === that.city[index1].id.slice(0, 2)) {
104
              if (that.province[index].id.slice(0, 2) === that.city[index1].id.slice(0, 2)) {
100
          this.sheng = this.province[index2].value
129
          this.sheng = this.province[index2].value
101
        }
130
        }
102
      }
131
      }
132
      this.$emit('paren', this.E)
103
    },
133
    },
104
    choseCity: function(e) {
134
    choseCity: function(e) {
105
      for (var index3 in this.city) {
135
      for (var index3 in this.city) {
110
          this.shi = this.city[index3].value
140
          this.shi = this.city[index3].value
111
        }
141
        }
112
      }
142
      }
143
      this.$emit('paren', this.E)
113
    },
144
    },
114
    choseBlock: function(e) {
145
    choseBlock: function(e) {
115
      for (var index3 in this.qu1) {
146
      for (var index3 in this.qu1) {
118
        }
149
        }
119
      }
150
      }
120
      this.E = e
151
      this.E = e
152
      this.$emit('paren', this.E)
121
    }
153
    }
122
  },
154
  },
123
  created: function() {
155
  created: function() {

+ 245 - 63
src/views/peoplesManage/infoManage/editUser.vue

1
<template>
1
<template>
2
   <el-form class="form-main" label-width="120px">
3
      <el-row>
4
        <el-col :span="12">
5
          <el-form-item label="账号">
6
            <el-input placeholder="请输入账号"></el-input>
7
          </el-form-item>
8
        </el-col>
9
        <el-col :span="12">
10
          <el-form-item label="用户姓名">
11
            <el-input placeholder="请输入用户姓名"></el-input>
12
          </el-form-item>
13
        </el-col>
14
         <el-col :span="12">
15
          <el-form-item label="职位">
16
            <el-input placeholder="请输入用户职位"></el-input>
17
          </el-form-item>
18
        </el-col>
19
        <el-col :span="12">
20
          <el-form-item label="用户类型">
21
            <el-select v-model="value" placeholder="请选择用户类型">
22
              <el-option
23
                v-for="item in options"
24
                :key="item.value"
25
                :label="item.label"
26
                :value="item.value">
27
              </el-option>
28
            </el-select>
29
          </el-form-item>
30
        </el-col>
31
        <el-col :span="12">
32
          <el-form-item label="联系电话">
33
            <el-input placeholder="请输入手机号码"></el-input>
34
          </el-form-item>
35
        </el-col>
36
        <el-col :span="12">
37
          <el-form-item label="联系邮箱">
38
            <el-input placeholder="请输入邮箱地址"></el-input>
39
          </el-form-item>
40
        </el-col>
41
        <el-col :span="12">
42
          <el-form-item label="所在机构">
43
            <el-input placeholder="请输入所在用户机构"></el-input>
44
          </el-form-item>
45
        </el-col>
46
         <el-col :span="24" >
47
         备注
48
          <div class="editTe">
49
            <el-input type="textarea" row=4></el-input>
50
          </div>
51
        </el-col>
52
        <el-col :span="24" class="el-btn-col">
53
          <div class="el-btn-col-box">
54
            <el-button type="primary" @click="submitForm('ruleForm')">确认</el-button>
55
            <el-button type="info">返回</el-button>
56
          </div>
57
        </el-col>
58
      </el-row>
59
    </el-form>
2
  <el-dialog title="编辑用户" ref="ruleForm" :visible.sync="dialogTableVisible" width="680px" @close='closed'>
3
     <el-form class="form-main" :model="ruleForm2" :rules="rules2" ref="ruleForm2" label-width="120px" label-position='right' status-icon>
4
        <el-row>
5
          <el-col :span="12">
6
            <el-form-item label="账号" prop='account'>
7
              <el-input placeholder="请输入账号" v-model="ruleForm2.account"></el-input>
8
            </el-form-item>
9
          </el-col>
10
          <el-col :span="12">
11
            <el-form-item label="用户姓名" prop='name'>
12
              <el-input placeholder="请输入用户姓名" v-model="ruleForm2.name"></el-input>
13
            </el-form-item>
14
          </el-col>
15
           <el-col :span="12">
16
            <el-form-item label="职位" prop='job'>
17
              <el-input placeholder="请输入用户职位" v-model="ruleForm2.job"></el-input>
18
            </el-form-item>
19
          </el-col>
20
          <el-col :span="12">
21
            <el-form-item label="用户类型" prop='type'>
22
              <el-select v-model="ruleForm2.type" placeholder="请选择用户类型">
23
                <el-option
24
                  v-for="item in options"
25
                  :key="item.value"
26
                  :label="item.label"
27
                  :value="item.value">
28
                </el-option>
29
              </el-select>
30
            </el-form-item>
31
          </el-col>
32
          <el-col :span="12">
33
            <el-form-item label="联系电话" prop='phone'>
34
              <el-input placeholder="请输入手机号码" v-model="ruleForm2.phone"></el-input>
35
            </el-form-item>
36
          </el-col>
37
          <el-col :span="12">
38
            <el-form-item label="联系邮箱" prop='email'>
39
              <el-input placeholder="请输入邮箱地址" v-model="ruleForm2.email"></el-input>
40
            </el-form-item>
41
          </el-col>
42
          <el-col :span="12">
43
            <el-form-item label="所在机构" prop='comp'>
44
              <el-input placeholder="请输入所在用户机构" v-model="ruleForm2.comp"></el-input>
45
            </el-form-item>
46
          </el-col>
47
           <el-col :span="24" >
48
            <el-form-item label="备注" prop='remark'>
49
              <el-input type="textarea" rows=4 v-model="ruleForm2.remark"></el-input>
50
             </el-form-item>
51
          </el-col>
52
          <el-col :span="24" class="el-btn-col">
53
            <div class="el-btn-col-box">
54
              <el-button type="primary" @click="submitForm('ruleForm2')">确认</el-button>
55
              <el-button type="info"  @click="resetForm('ruleForm2')">返回</el-button>
56
            </div>
57
          </el-col>
58
        </el-row>
59
      </el-form>
60
    </el-dialog>
60
</template>
61
</template>
61
62
62
<script>
63
<script>
64
import { checkRegister, addRegister, updateRegister, queryRegister } from '@/api/userManagemen'
63
export default {
65
export default {
66
  props: ['dialog', 'id'],
64
  data() {
67
  data() {
68
    var account = (rule, value, callback) => {
69
      if (value === '') {
70
        callback(new Error('请输入账号'))
71
      } else {
72
        if (this.edit) {
73
          checkRegister({ account: value, id: this.edit }).then(response => {
74
            if (!response.data) {
75
              callback(new Error('账户已存在,请重新输入'))
76
            } else {
77
              callback()
78
            }
79
          })
80
        } else {
81
          checkRegister({ account: value }).then(response => {
82
            if (!response.data) {
83
              callback(new Error('账户已存在,请重新输入'))
84
            } else {
85
              callback()
86
            }
87
          })
88
        }
89
      }
90
    }
91
    var phone = (rule, value, callback) => {
92
      const regTel = /^1[3|4|5|7|8][0-9]\d{8}$/
93
      if (value === '') {
94
        callback()
95
      } else {
96
        if (!regTel.test(value)) {
97
          callback(new Error('手机号码格式不正确'))
98
        }
99
      }
100
    }
101
    var email = (rule, value, callback) => {
102
      const regTel = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/
103
      if (value === '') {
104
        callback()
105
      } else {
106
        if (!regTel.test(value)) {
107
          callback(new Error('邮箱格式不正确'))
108
        }
109
      }
110
    }
65
    return {
111
    return {
66
      options: [{
112
      options: [{
67
        value: '上游主缆',
68
        label: '上游主缆'
113
        value: 0,
114
        label: '普通用户'
69
      }, {
115
      }, {
70
        value: '下游主缆',
71
        label: '下游主缆'
116
        value: 1,
117
        label: '管理员'
72
      }],
118
      }],
73
      value: ''
119
      dialogTableVisible: false,
120
      ruleForm2: {
121
        edit: '',
122
        account: '',
123
        name: '',
124
        comp: '',
125
        job: '',
126
        phone: '',
127
        email: '',
128
        remark: '',
129
        type: 0
130
      },
131
      rules2: {
132
        account: [
133
          { required: true, validator: account, trigger: 'blur' }
134
        ],
135
        name: [
136
          { required: true, message: '请输入用户姓名', trigger: 'blur' }
137
        ],
138
        comp: [
139
          { required: true, message: '请输入所在用户机构', trigger: 'blur' }
140
        ],
141
        job: [
142
          { required: true, message: '请输入用户职位', trigger: 'blur' }
143
        ],
144
        phone: [
145
          { validator: phone, trigger: 'blur' }
146
        ],
147
        email: [
148
          { validator: email, trigger: 'blur' }
149
        ]
150
      }
151
    }
152
  },
153
  watch: {
154
    dialog() {
155
      this.dialogTableVisible = true
156
      this.edit = this.id
157
      if (this.edit) {
158
        queryRegister({ id: this.edit }).then(response => {
159
          if (response.success) {
160
            const $data = response.data
161
            this.ruleForm2 = {
162
              account: $data.account,
163
              name: $data.name,
164
              comp: $data.comp,
165
              job: $data.job,
166
              phone: $data.phone || '',
167
              email: $data.email || '',
168
              remark: $data.remark || '',
169
              type: $data.type
170
            }
171
          }
172
        })
173
      }
174
    }
175
  },
176
  methods: {
177
    submitForm(formName) {
178
      const that = this
179
      this.$refs[formName].validate((valid) => {
180
        if (valid) {
181
          if (!this.edit) {
182
            addRegister(this.ruleForm2).then(response => {
183
              this.$emit('chilF')
184
              setTimeout(function() {
185
                that.pop('已成功添加')
186
              }, 1000)
187
              this.resetForm(this.ruleForm2)
188
              this.dialogTableVisible = false
189
            }).catch(error => {
190
              console.log(error)
191
            })
192
          } else {
193
            const par = this.ruleForm2
194
            par.id = this.edit
195
            updateRegister(par).then(response => {
196
              if (response.success) {
197
                setTimeout(function() {
198
                  that.pop('已成功更新')
199
                }, 1000)
200
                this.resetForm('ruleForm2')
201
                this.$emit('chilF')
202
                this.dialogTableVisible = false
203
                this.edit = ''
204
                this.ruleForm2 = {
205
                  account: '',
206
                  name: '',
207
                  comp: '',
208
                  job: '',
209
                  phone: '',
210
                  email: '',
211
                  remark: '',
212
                  type: 0
213
                }
214
              }
215
            })
216
          }
217
        }
218
      })
219
    },
220
    resetForm(formName) {
221
      this.dialogTableVisible = false
222
      this.$refs[formName].resetFields()
223
      this.edit = ''
224
      this.$emit('chilF', true)
225
    },
226
    closed() {
227
      this.$refs['ruleForm2'].resetFields()
228
      this.edit = ''
229
      this.$emit('chilF', true)
230
    },
231
    pop($par) {
232
      this.$confirm($par, '提示', {
233
        confirmButtonText: '确定',
234
        cancelButtonText: '取消',
235
        type: 'success',
236
        showCancelButton: false,
237
        center: true
238
      }).then(() => {
239
240
      }).catch(() => {
241
242
      })
243
    },
244
    resetTemp(row) {
245
      this.ruleForm2 = {
246
        account: row.account,
247
        name: row.name,
248
        comp: row.comp,
249
        job: row.job,
250
        phone: row.phone,
251
        email: row.email,
252
        remark: row.remark,
253
        type: row.type
254
      }
255
      this.edit = row.id
74
    }
256
    }
75
  }
257
  }
76
}
258
}

+ 118 - 68
src/views/peoplesManage/infoManage/editUserPermissions.vue

1
<template>
1
<template>
2
  <el-dialog title="用户数据权限修改" :visible.sync="dialogTableVisible" width="80%">
3
    <el-form class="form-main">
2
  <el-dialog title="用户数据权限修改" :visible.sync="dialogTableVisible" width="80%" @close='closed'>
3
    <el-form class="form-main" :model="ruleForm2"  ref="ruleForm2">
4
      <el-row :gutter="16">
4
      <el-row :gutter="16">
5
        <el-col :xs="12" :sm="12" :lg="12">
5
        <el-col :xs="12" :sm="12" :lg="12">
6
          <div class="list-item">
6
          <div class="list-item">
7
            <el-row>
7
            <el-row>
8
              <el-col :span="12">
8
              <el-col :span="12">
9
                <el-form-item label="账号">000000001</el-form-item>
9
                <el-form-item label="账号">{{ruleForm2.account}}</el-form-item>
10
              </el-col>
10
              </el-col>
11
              <el-col :span="12">
11
              <el-col :span="12">
12
                <el-form-item label="用户姓名">2</el-form-item>
12
                <el-form-item label="用户姓名">{{ruleForm2.name}}</el-form-item>
13
              </el-col>
13
              </el-col>
14
              <el-col :span="12">
15
                <el-form-item label="用户类型">000000001</el-form-item>
14
              <el-col :span="12"  style='margin-top:30px'>
15
                <el-form-item label="用户类型">{{(ruleForm2.type) ? '管理员' : '普通用户'}}</el-form-item>
16
              </el-col>
16
              </el-col>
17
              <el-col :span="12">
18
                <el-form-item label="职位">2</el-form-item>
17
              <el-col :span="12" style='margin-top:30px'>
18
                <el-form-item label="职位">{{ruleForm2.job}}</el-form-item>
19
              </el-col>
19
              </el-col>
20
              <el-col :span="24">
21
                <el-form-item label="所属机构">1926831</el-form-item>
20
              <el-col :span="24" style='margin-top:30px'>
21
                <el-form-item label="所属机构">{{ruleForm2.comp}}</el-form-item>
22
              </el-col>
22
              </el-col>
23
            </el-row>
23
            </el-row>
24
          </div>
24
          </div>
36
                  </el-autocomplete>
36
                  </el-autocomplete>
37
                </el-form-item>
37
                </el-form-item>
38
              </el-col>
38
              </el-col>
39
              <el-col :span="24"> 
39
              <el-col :span="24" style="margin-top:30px"> 
40
                 <el-table
40
                 <el-table
41
                  :show-header="shouHead"
41
                  :data="tableData3"
42
                  :data="tableData3"
42
                  height="250"
43
                  height="250"
43
                  border
44
                  border
63
      </el-row>
64
      </el-row>
64
      <el-row>
65
      <el-row>
65
        <el-col :span="24" class="el-btn-col">
66
        <el-col :span="24" class="el-btn-col">
66
          <div class="el-btn-col-box">
67
            <el-button type="primary" @click="dialogTableVisible=false">关闭</el-button>
68
            <el-button type="primary" @click="dialogTableVisible=false">确认</el-button>
69
          </div>
70
        </el-col>
67
            <div class="el-btn-col-box">
68
              <el-button type="primary" @click="submit">确认</el-button>
69
              <el-button type="info"  @click="closed">返回</el-button>
70
            </div>
71
          </el-col>
71
      </el-row>
72
      </el-row>
72
    </el-form>
73
    </el-form>
73
  </el-dialog>
74
  </el-dialog>
74
</template>
75
</template>
75
76
76
<script>
77
<script>
77
78
import { queryRegister, queryResponsibleBridge, DeviceOfservice, updatePermission } from '@/api/userManagemen'
78
export default {
79
export default {
80
  props: ['dialog', 'id'],
79
  data() {
81
  data() {
80
    return {
82
    return {
81
      tableData3: [{
82
        date: '2016-05-03',
83
        name: '王小虎',
84
        address: '上海市普陀区金沙江路 1518 弄'
85
      }, {
86
        date: '2016-05-02',
87
        name: '王小虎',
88
        address: '上海市普陀区金沙江路 1518 弄'
89
      }, {
90
        date: '2016-05-04',
91
        name: '王小虎',
92
        address: '上海市普陀区金沙江路 1518 弄'
93
      }, {
94
        date: '2016-05-01',
95
        name: '王小虎',
96
        address: '上海市普陀区金沙江路 1518 弄'
97
      }, {
98
        date: '2016-05-08',
99
        name: '王小虎',
100
        address: '上海市普陀区金沙江路 1518 弄'
101
      }, {
102
        date: '2016-05-06',
103
        name: '王小虎',
104
        address: '上海市普陀区金沙江路 1518 弄'
105
      }, {
106
        date: '2016-05-07',
107
        name: '王小虎',
108
        address: '上海市普陀区金沙江路 1518 弄'
109
      }],
110
      restaurants: [],
83
      arr: [],
84
      shouHead: false,
111
      state4: '',
85
      state4: '',
86
      ruleForm2: {
87
        account: '',
88
        name: '',
89
        comp: '',
90
        job: '',
91
        type: 0
92
      },
93
      tableData3: [],
112
      timeout: null,
94
      timeout: null,
113
      dialogTableVisible: false
95
      dialogTableVisible: false
114
    }
96
    }
115
  },
97
  },
116
  created() {
117
    this.restaurants = this.loadAll()
98
  watch: {
99
    dialog() {
100
      this.dialogTableVisible = true
101
      queryRegister({ id: this.id }).then(response => {
102
        if (response.success) {
103
          const $data = response.data
104
          this.ruleForm2 = {
105
            account: $data.account,
106
            name: $data.name,
107
            comp: $data.comp,
108
            job: $data.job,
109
            type: $data.type
110
          }
111
        }
112
      })
113
      queryResponsibleBridge({ uid: this.id }).then(response => {
114
        if (response.success) {
115
          const $info = response.data
116
          for (let j = 0; j < $info.length; j++) {
117
            this.tableData3.push({ name: $info[j].shortName, address: $info[j].id })
118
          }
119
        }
120
      })
121
    }
118
  },
122
  },
119
  methods: {
123
  methods: {
120
    handleSizeChange(val) {
121
      console.log(`每页 ${val} 条`)
122
    },
123
    handleCurrentChange(val) {
124
      console.log(`当前页: ${val}`)
125
    },
126
    loadAll() {
127
      return [{ 'value': '三全鲜食(北新泾店)', 'address': '长宁区新渔路144号' }]
128
    },
129
    querySearchAsync(queryString, cb) {
124
    querySearchAsync(queryString, cb) {
130
      console.log(queryString + 'wewe')
131
      var restaurants = this.restaurants
132
      var results = queryString ? restaurants.filter(this.createStateFilter(queryString)) : restaurants
133
      console.log(results + 'dddd')
125
      if (queryString === '') {
126
        cb([])
127
        return
128
      }
134
      clearTimeout(this.timeout)
129
      clearTimeout(this.timeout)
135
      this.timeout = setTimeout(() => {
130
      this.timeout = setTimeout(() => {
136
        cb(results)
131
        DeviceOfservice({ key: this.state4, active: 1 }).then(response => {
132
          const $info = response.data
133
          if ($info.length) {
134
            const $data = $info.map(item => {
135
              return { 'value': item.shortName, 'id': item.id }
136
            })
137
            cb($data)
138
          } else {
139
            cb([])
140
          }
141
        })
137
      }, 3000 * Math.random())
142
      }, 3000 * Math.random())
138
    },
143
    },
139
    createStateFilter(queryString) {
140
      return (state) => {
141
        return (state.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0)
144
    handleSelect(item) {
145
      this.state4 = ''
146
      let flag = false
147
      for (let i = 0; i < this.tableData3.length; i++) {
148
        if (item.id === this.tableData3[i].address) {
149
          flag = true
150
          break
151
        }
152
      }
153
      if (!flag) {
154
        const $data = { name: item.value, address: item.id }
155
        this.tableData3.push($data)
142
      }
156
      }
143
    },
157
    },
144
    handleSelect(item) {
145
      console.log(item + 'ccc')
158
    handleModifyStatus(value) {
159
      const index = this.tableData3.indexOf(value)
160
      this.tableData3.splice(index, 1)
161
    },
162
    pop($par) {
163
      this.$confirm($par, '提示', {
164
        confirmButtonText: '确定',
165
        cancelButtonText: '取消',
166
        type: 'success',
167
        showCancelButton: false,
168
        center: true
169
      }).then(() => {
170
171
      }).catch(() => {
172
173
      })
174
    },
175
    closed() {
176
      this.tableData3 = []
177
      this.arr = []
178
      this.dialogTableVisible = false
179
    },
180
    submit() {
181
      this.tableData3.map(item => {
182
        this.arr.push(item.address)
183
      })
184
      updatePermission({ id: this.id, bridges: this.arr }).then(response => {
185
        if (response.success) {
186
          this.tableData3 = []
187
          this.arr = []
188
          this.$emit('chilF')
189
          const that = this
190
          setTimeout(function() {
191
            that.pop('权限修改修改成功')
192
          }, 1000)
193
          this.dialogTableVisible = false
194
        }
195
      })
146
    }
196
    }
147
  }
197
  }
148
}
198
}

+ 72 - 165
src/views/peoplesManage/infoManage/index.vue

1
<template>
1
<template>
2
  <div class="app-container">
2
  <div class="app-container">
3
    <div class="filter-container" style="margin-bottom:20px">
3
    <div class="filter-container" style="margin-bottom:20px">
4
      <el-input style="width: 200px;" class="filter-item" placeholder="账号" v-model="listQuery.title">
4
      <el-input style="width: 200px;" class="filter-item" placeholder="账号" v-model="listQuery.account">
5
      </el-input>
5
      </el-input>
6
       <el-input style="width: 200px;" class="filter-item" placeholder="用户姓名" v-model="listQuery.importance">
6
       <el-input style="width: 200px;" class="filter-item" placeholder="用户姓名" v-model="listQuery.name">
7
      </el-input>
7
      </el-input>
8
       <el-input style="width: 250px;" class="filter-item" placeholder="所在机构" v-model="listQuery.importance">
8
       <el-input style="width: 250px;" class="filter-item" placeholder="所在机构" v-model="listQuery.comp">
9
      </el-input>
9
      </el-input>
10
      <el-button class="filter-item" style="margin-left: 10px;" @click="handleFilter" type="primary" icon="el-icon-search">查找</el-button>
10
      <el-button class="filter-item" style="margin-left: 10px;" @click="handleFilter" type="primary" icon="el-icon-search">查找</el-button>
11
      <el-button class="filter-item" style="margin-left: 10px;" @click="handleCreate" type="primary" icon="el-icon-edit">添加传感器</el-button>
11
      <el-button class="filter-item" style="margin-left: 10px;" @click="handleCreate" type="primary" icon="el-icon-edit">添加用户</el-button>
12
    </div>
12
    </div>
13
13
14
    <el-table :key='tableKey' :data="list" v-loading="listLoading" border fit highlight-current-row
14
    <el-table :key='tableKey' :data="list" v-loading="listLoading" border fit highlight-current-row
15
      style="width: 100%;min-height:550px;">
15
      style="width: 100%;min-height:550px;">
16
      <el-table-column width="110px" align="center" label="账号">
16
      <el-table-column width="110px" align="center" label="账号">
17
        <template slot-scope="scope">
17
        <template slot-scope="scope">
18
          <span>{{scope.row.num}}</span>
18
          <span>{{scope.row.account}}</span>
19
        </template>
19
        </template>
20
      </el-table-column>
20
      </el-table-column>
21
      <el-table-column width="80px" align="center" label="用户姓名">
21
      <el-table-column width="80px" align="center" label="用户姓名">
23
          <span>{{scope.row.name}}</span>
23
          <span>{{scope.row.name}}</span>
24
        </template>
24
        </template>
25
      </el-table-column>
25
      </el-table-column>
26
      <el-table-column width="50px" align="center" label="职位">
26
      <el-table-column width="200px" align="center" label="职位">
27
        <template slot-scope="scope">
27
        <template slot-scope="scope">
28
          <span>{{scope.row.address}}</span>
28
          <span>{{scope.row.job}}</span>
29
        </template>
29
        </template>
30
      </el-table-column>
30
      </el-table-column>
31
      <el-table-column width="100px" align="center" label="联系电话">
31
      <el-table-column width="110px" align="center" label="联系电话">
32
        <template slot-scope="scope">
32
        <template slot-scope="scope">
33
          <span>{{scope.row.org}}</span>
33
          <span>{{scope.row.phone}}</span>
34
        </template>
34
        </template>
35
      </el-table-column>
35
      </el-table-column>
36
      <el-table-column width="100px" align="center" label="用户类型">
36
      <el-table-column width="100px" align="center" label="用户类型">
37
        <template slot-scope="scope">
37
        <template slot-scope="scope">
38
          <span>{{scope.row.message}}</span>
38
          <span>{{(scope.row.type) ? '管理员' : '普通用户'}}</span>
39
        </template>
39
        </template>
40
      </el-table-column>
40
      </el-table-column>
41
      <el-table-column width="100px" align="center" label="账户状态">
41
      <el-table-column width="100px" align="center" label="账户状态">
42
        <template slot-scope="scope">
42
        <template slot-scope="scope">
43
          <span>{{scope.row.message}}</span>
43
          <span>{{(scope.row.active) ? '未停用' : '已停用'}}</span>
44
        </template>
44
        </template>
45
      </el-table-column>
45
      </el-table-column>
46
      <el-table-column min-width="200px" align="center" label="所在机构">
46
      <el-table-column min-width="200px" align="center" label="所在机构">
47
        <template slot-scope="scope">
47
        <template slot-scope="scope">
48
          <span>{{scope.row.message}}</span>
48
          <span>{{scope.row.comp}}</span>
49
        </template>
49
        </template>
50
      </el-table-column>
50
      </el-table-column>
51
      <el-table-column min-width="200px" align="center" label="负责桥梁">
51
      <el-table-column min-width="200px" align="center" label="负责桥梁">
52
        <template slot-scope="scope">
52
        <template slot-scope="scope">
53
          <span>{{scope.row.message}}</span>
53
          <span>{{scope.row.bridgeName}}</span>
54
        </template>
54
        </template>
55
      </el-table-column>
55
      </el-table-column>
56
      <el-table-column align="center" label="Actions" width="260px" class-name="small-padding fixed-width">
56
      <el-table-column align="center" label="Actions" width="260px" class-name="small-padding fixed-width">
58
          <el-button type="primary" size="mini" @click="handleUpdate(scope.row)">编辑</el-button> 
58
          <el-button type="primary" size="mini" @click="handleUpdate(scope.row)">编辑</el-button> 
59
          <el-button size="mini" type="danger" @click="handleModifyStatus(scope.row,'deleted')">停用
59
          <el-button size="mini" type="danger" @click="handleModifyStatus(scope.row,'deleted')">停用
60
          </el-button>
60
          </el-button>
61
           <el-button size="mini" type="primary" @click="handleModifyStatus(scope.row,'deleted')">分配权限
61
           <el-button size="mini" type="primary" @click="distribution(scope.row)">分配权限
62
          </el-button>
62
          </el-button>
63
        </template>
63
        </template>
64
      </el-table-column>
64
      </el-table-column>
65
    </el-table>
65
    </el-table>
66
     <el-dialog title="编辑用户" ref="ruleForm" :visible.sync="dialogTableVisible" width="680px">
67
     <editUser></editUser>
68
     <editSystemMessage></editSystemMessage>
69
  </el-dialog>
70
  <editUserPermissions></editUserPermissions>
66
    <editUser :dialog="dialogTableVisible" @chilF='chilF' :id='edit'></editUser>
67
    <editSystemMessage></editSystemMessage>
68
    <editUserPermissions :dialog='dialogPerssion' @chilF='chilF' :id='edit'></editUserPermissions>
71
    <div class="pagination-container" style="text-align:center;">
69
    <div class="pagination-container" style="text-align:center;">
72
      <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="listQuery.page" :page-size="listQuery.limit" layout="prev, pager, next, jumper" :total="total">
70
      <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="listQuery.page" :page-size="listQuery.limit" layout="prev, pager, next, jumper" :total="total">
73
      </el-pagination>
71
      </el-pagination>
76
</template>
74
</template>
77
75
78
<script>
76
<script>
79
//  import { fetchList, fetchPv, createArticle, updateArticle } from '@/api/article'
77
import { deleteUser, queryResponsibleBridge, pageQueryUser } from '@/api/userManagemen'
80
import waves from '@/directive/waves'
78
import waves from '@/directive/waves'
81
import editUser from './editUser'
79
import editUser from './editUser'
82
import editSystemMessage from './editSystemMessage'
80
import editSystemMessage from './editSystemMessage'
83
import editUserPermissions from './editUserPermissions'
81
import editUserPermissions from './editUserPermissions'
84
//  import { parseTime } from '@/utils'
85
82
86
export default {
83
export default {
87
  name: 'complexTable',
84
  name: 'complexTable',
90
  },
87
  },
91
  data() {
88
  data() {
92
    return {
89
    return {
93
      options: [{
94
        value: '上游主缆',
95
        label: '上游主缆'
96
      }, {
97
        value: '下游主缆',
98
        label: '下游主缆'
99
      }],
100
      value: '',
101
      options1: [{
102
        value: '东跨',
103
        label: '东跨'
104
      }, {
105
        value: '西跨',
106
        label: '西跨'
107
      }, {
108
        value: '南跨',
109
        label: '南跨'
110
      }, {
111
        value: '中跨',
112
        label: '中跨'
113
      }, {
114
        value: '北跨',
115
        label: '北跨'
116
      }],
117
      value1: '',
118
      restaurants: [],
119
      state4: '',
120
      timeout: null,
121
      dialogTableVisible: false,
90
      edit: '',
122
      tableKey: 0,
91
      tableKey: 0,
123
      list: null,
92
      list: null,
124
      dataList: { total: 20, data: [{ num: 1111, name: '北京科技大学', address: '北京', org: '机电学院', message: '想落户上海,你还差几分?抢人才看出身,清华北大照单全收' }] },
125
      total: null,
93
      total: null,
126
      listLoading: true,
94
      listLoading: true,
95
      dialogPerssion: false,
96
      dialogTableVisible: false,
127
      listQuery: {
97
      listQuery: {
128
        page: 1,
129
        limit: 10,
130
        importance: undefined,
131
        title: undefined,
132
        type: undefined,
133
        sort: '+id'
134
      },
135
      dialogFormVisible: false,
136
      dialogStatus: '',
137
      textMap: {
138
        update: 'Edit',
139
        create: 'Create'
98
        account: '',
99
        name: '',
100
        comp: '',
101
        active: 0,
102
        pageSize: 10,
103
        pageNo: 1
140
      }
104
      }
141
    }
105
    }
142
  },
106
  },
146
    }
110
    }
147
  },
111
  },
148
  created() {
112
  created() {
149
    this.restaurants = this.loadAll()
150
    this.getList()
113
    this.getList()
151
  },
114
  },
152
  components: {
115
  components: {
155
    editUserPermissions
118
    editUserPermissions
156
  },
119
  },
157
  methods: {
120
  methods: {
158
    submitForm(formName) {
159
      this.$refs[formName].validate((valid) => {
160
        if (valid) {
161
        //   let paramsData = {
162
        //     'title': this.ruleFormDem.demandTit,
163
        //     'descp': this.ruleFormDem.demandDesc,
164
        //     'province': this.ruleFormDem.province,
165
        //     'city': this.ruleFormDem.city,
166
        //     'invalidDay': util.dateFormatter(this.ruleFormDem.lastDate, false, true),
167
        //     'cost': this.selectCostRange,
168
        //     'duration': this.selectLongTime,
169
        //     'orgName': this.ruleFormDem.orgName,
170
        //     'contactNum': this.ruleFormDem.linkTel,
171
        //     'creator': this.kxUserId,
172
        //     'source': this.platSource
173
        //   };
174
        //   this.$axios.post(httpUrl.kxQurey.demand.add, paramsData).then((res) => {
175
        //     if (res.success) {
176
        //       this.$alert('我们已收到您的需求,马上为您对接合适的专家和专业机构,您可以登录科袖网与对方做进一步沟通。', '需求发布成功!', {
177
        //         confirmButtonText: '进入科袖网,发现更多服务和资源',
178
        //         type: 'success',
179
        //         center: true,
180
        //         cancelButtonText: '取消',
181
        //         callback: action => {
182
        //           if (action === 'confirm') {
183
        //             window.open(util.ekexiuUrl, '科袖网首页');
184
        //           };
185
        //         }
186
        //       });
187
        //       this.resetForm(formName);
188
        //       this.$emit('dialogChangedLogin', false);
189
        //     } else {
190
        //       this.$message({
191
        //         message: '需求发布失败,请重新发布!',
192
        //         type: 'warning'
193
        //       });
194
        //     };
195
        //     console.log(res);
196
        //   });
197
        // } else {
198
        //   console.log('error submit!!');
199
        //   return false
200
        }
201
      })
202
    },
203
    getList() {
121
    getList() {
204
      this.listLoading = true
122
      this.listLoading = true
205
      this.list = this.dataList.data
206
      this.total = this.dataList.total
207
      setTimeout(() => {
208
        this.listLoading = false
209
      }, 1.5 * 1000)
210
      /*  fetchList(this.listQuery).then(response => {
211
        this.list = this.dataList.data
212
        this.total =  this.dataList.total
123
      pageQueryUser(this.listQuery).then(response => {
124
        const $data = response.data.data
125
        for (let i = 0; i < $data.length; i++) {
126
          $data[i].bridgeName = ''
127
          queryResponsibleBridge({ uid: $data[i].id }).then(response => {
128
            if (response.success) {
129
              const arr = []
130
              const $info = response.data
131
              for (let j = 0; j < $info.length; j++) {
132
                arr.push($info[j].shortName)
133
              }
134
              this.list[i].bridgeName = arr.join(',')
135
              this.$forceUpdate()
136
            }
137
          })
138
        }
139
        this.list = $data
140
        this.total = response.data.total
213
        setTimeout(() => {
141
        setTimeout(() => {
214
          this.listLoading = false
142
          this.listLoading = false
215
        }, 1.5 * 1000)
143
        }, 1.5 * 1000)
216
      })  */
144
      })
217
    },
145
    },
218
    handleFilter() {
146
    handleFilter() {
219
      this.listQuery.page = 1
220
      //  this.getList()
147
      this.listQuery.pageNo = 1
148
      this.getList()
221
    },
149
    },
222
    handleSizeChange(val) {
150
    handleSizeChange(val) {
223
      this.listQuery.limit = val
224
      //  this.getList()
151
      this.listQuery.pageNo = val
152
      this.getList()
153
    },
154
    chilF(val) {
155
      if (!val) {
156
        this.getList()
157
      }
158
      this.edit = ''
225
    },
159
    },
226
    handleCurrentChange(val) {
160
    handleCurrentChange(val) {
227
      this.listQuery.page = val
228
      //  this.getList()
161
      this.listQuery.pageNo = val
162
      this.getList()
229
    },
163
    },
230
    handleModifyStatus(row, status) {
164
    handleModifyStatus(row, status) {
231
      this.$confirm('已成功删除该传感器', '提示', {
165
      this.$confirm('确实要停用:用户' + row.name + '吗?', '提示', {
232
        confirmButtonText: '确定',
166
        confirmButtonText: '确定',
233
        cancelButtonText: '取消',
167
        cancelButtonText: '取消',
234
        type: 'success',
235
        showCancelButton: false,
168
        type: 'warning',
236
        center: true
169
        center: true
237
      }).then(() => {
170
      }).then(() => {
238
171
        deleteUser({ id: row.id }).then(response => {
172
          if (response.success) {
173
            this.getList()
174
            this.pop('已成功停用该用户')
175
          }
176
        })
239
      }).catch(() => {
177
      }).catch(() => {
240
178
241
      })
179
      })
242
      /*  this.$confirm('确实要删除:桥梁12324吗?, 是否继续?', '提示', {
243
      confirmButtonText: '确定',
244
          cancelButtonText: '取消',
245
          type: 'warning',
246
          center: true
247
        }).then(() => {
248
          this.$message({
249
            type: 'success',
250
            message: '删除成功!'
251
          });
252
        }).catch(() => {
253
254
        }); */
255
    },
256
    resetTemp() {
257
258
    },
180
    },
259
    handleCreate() {
181
    handleCreate() {
260
      this.dialogTableVisible = true
182
      this.dialogTableVisible = !this.dialogTableVisible
261
    },
183
    },
262
    handleUpdate(row) {
184
    handleUpdate(row) {
185
      this.edit = row.id
186
      this.dialogTableVisible = !this.dialogTableVisible
263
    },
187
    },
264
    loadAll() {
265
      return [{ 'value': '三全鲜食(北新泾店)', 'address': '长宁区新渔路144号' }]
266
    },
267
    querySearchAsync(queryString, cb) {
268
      console.log(queryString + 'wewe')
269
      var restaurants = this.restaurants
270
      var results = queryString ? restaurants.filter(this.createStateFilter(queryString)) : restaurants
271
      console.log(results + 'dddd')
272
      clearTimeout(this.timeout)
273
      this.timeout = setTimeout(() => {
274
        cb(results)
275
      }, 3000 * Math.random())
276
    },
277
    createStateFilter(queryString) {
278
      return (state) => {
279
        return (state.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0)
280
      }
281
    },
282
    handleSelect(item) {
283
      console.log(item + 'ccc')
188
    distribution(row) {
189
      this.edit = row.id
190
      this.dialogPerssion = !this.dialogPerssion
284
    }
191
    }
285
  }
192
  }
286
}
193
}