Explorar el Código

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

liuchang %!s(int64=4) %!d(string=hace) años
padre
commit
5e6587822f

+ 26 - 0
ebc-middle-platform/src/modules/authorization/menu-authorization.scss

@ -0,0 +1,26 @@
1
.authorization-container{
2
  display:flex;
3
  justify-content: center;
4
  margin:20px;
5
  .left-container{
6
    width:400px;
7
    height: 700px;
8
    border: 1px solid rgba(0, 0, 0, 0.09);
9
    margin-right:20px;
10
    .title{
11
      padding:0 20px;
12
      line-height: 48px;
13
      border-bottom: 1px solid rgba(0, 0, 0, 0.09);
14
    }
15
    .table-content{
16
      flex-direction: column;
17
      justify-content: space-between;
18
      height: 100%;
19
      padding:0 20px
20
    }
21
  }
22
  .transfer-list{
23
    width: 400px;
24
    height: 700px;
25
  }
26
}

+ 190 - 37
ebc-middle-platform/src/modules/authorization/menu-authorization.vue

@ -1,45 +1,44 @@
1 1
<template>
2
  <div class="authorization-container" style="display:flex;margin:20px">
3
    <div style="width:400px;border: 1px solid rgba(0, 0, 0, 0.09);margin-right:20px">
4
      <div>
2
  <div class="authorization-container">
3
    <div class="left-container">
4
      <div class="title">
5 5
        <div>角色列表</div>
6 6
      </div>
7
      <div style="flex-direction: column;
8
    justify-content: space-between;
9
    height: 100%;padding:0 20px">
7
      <div class="table-content">
10 8
        <t-table :data="table.data" highlight-current-row @current-change="handleCurrentChange">
11 9
          <t-table-column prop="name" label="角色名称"></t-table-column>
12 10
          <t-table-column prop="number" label="角色编码"></t-table-column>
13 11
        </t-table>
14
        <div>
15
          <t-pager :total="table.pager.total" :current.sync="table.pager.currentPage"
16
                   :page-size.sync="table.pager.size"
17
                   class="px-24 pt-16 float-right"
18
                   show-elevator show-sizer
19
                   @on-size-change="onSizeChange"
20
                   @on-change="onPagerChange">
21
          </t-pager>
22
        </div>
12
        <t-pager :total="table.pager.total" :current.sync="table.pager.currentPage"
13
                 :page-size.sync="table.pager.size"
14
                 class="px-24 pt-16 float-right"
15
                 show-elevator
16
                 @on-size-change="onSizeChange"
17
                 @on-change="onPagerChange">
18
        </t-pager>
23 19
      </div>
24 20
    </div>
25
    <div>
21
    <div class="transfer-container">
26 22
      <t-transfer
27 23
        ref="transfer"
28 24
        :data="dataTable"
29 25
        :selected-keys="targetKeysTable"
30
        :operations="['向左移动','向右移动']"
31
        filterable
26
        :operations="['← 绑定','解绑 →']"
27
        :titles="['已关联菜单','可关联菜单']"
28
        @change="changeTransfer"
32 29
      >
33 30
        <div slot="listBodyLeft" slot-scope="tableLeft">
34
          <t-tree :multiple="true"
31
          <t-tree ref="leftTree" :multiple="true"
35 32
                  :with-ancestors="true"
36
                  :node-data="tableLeft"
33
                  :with-descendants="true"
34
                  :node-data="tableLeft.data" @select="changeLeftTree"
37 35
          ></t-tree>
38 36
        </div>
39 37
        <div slot="listBodyRight" slot-scope="tableRight">
40 38
          <t-tree :multiple="true"
41 39
                  :with-ancestors="true"
42
                  :node-data="tableRight.data"
40
                  :with-descendants="true"
41
                  :node-data="tableRight.data" @select="changeRightTree"
43 42
          ></t-tree>
44 43
        </div>
45 44
      </t-transfer>
@ -47,6 +46,7 @@
47 46
  </div>
48 47
</template>
49 48
<script>
49
import './menu-authorization.scss'
50 50
export default {
51 51
  data() {
52 52
    return {
@ -71,38 +71,191 @@ export default {
71 71
          total: 0
72 72
        }
73 73
      },
74
      dataTable: this.getMockData(),
75
      targetKeysTable: []
74
      dataTable: [
75
        {
76
          key: '1',
77
          label: '地图监控',
78
          title: '地图监控',
79
          id: '1'
80
        },
81
        {
82
          key: '2',
83
          label: '智能报警',
84
          title: '智能报警',
85
          value: 'node_2',
86
          id: '2'
87
        },
88
        {
89
          key: '3',
90
          label: '统计报表',
91
          title: '统计报表',
92
          value: 'node_5',
93
          id: '3'
94
        },
95
        {
96
          key: '4',
97
          label: '轨迹分析',
98
          title: '轨迹分析',
99
          value: 'node_3',
100
          id: '4',
101
          pid: '3'
102
        },
103
        {
104
          key: '5',
105
          label: '作业考勤',
106
          title: '作业考勤',
107
          value: 'node_4',
108
          id: '5',
109
          pid: '3'
110
        },
111
        {
112
          key: '6',
113
          label: '系统管理',
114
          title: '系统管理',
115
          id: '6'
116
        },
117
        {
118
          key: '7',
119
          label: '终端管理',
120
          title: '终端管理',
121
          id: '7',
122
          pid: '6'
123
        },
124
        {
125
          key: '8',
126
          label: '地图标记',
127
          title: '地图标记',
128
          pid: '3',
129
          id: '8'
130
        }
131
      ],
132
      targetKeysTable: [],
133
      copyData: [],
134
      removeData: []
76 135
    }
77 136
  },
78 137
  methods: {
79 138
    handleCurrentChange(val) {
80 139
      this.currentRow = val
81 140
    },
82
    getMockData: function() {
83
      let mockData = []
84
      for (let i = 0; i <= 20; i++) {
85
        mockData.push({
86
          key: i.toString(),
87
          label: '内容' + i,
88
          description: '描述' + i,
89
          disabled: Math.random() * 3 < 1
141
    changeTransfer(targetKeys, direction, moveKeys) {
142
      console.log('change', targetKeys, direction, moveKeys)
143
      if (this.copyData.length > 0) {
144
        // this.dataTable = this.dataTable.concat(this.copyData)
145
        // this.targetKeysTable.push(this.copyData.id)
146
        this.copyData.forEach(element => {
147
          this.dataTable.splice(element.index, 0, element)
90 148
        })
149
150
        this.copyData = []
91 151
      }
92
      return mockData
152
      if (this.removeData.length > 0) {
153
        console.log(this.removeData)
154
        this.removeData.forEach(element => {
155
          this.dataTable.splice(element.index, 1)
156
        })
157
        this.removeData = []
158
      }
159
      console.log(this.dataTable)
93 160
    },
94
    $_onCheckboxChange(selection) {
95
      let keysArray = []
96
      selection.forEach(item => {
97
        keysArray.push(item.key)
161
    changeLeftTree(ids) {
162
      console.log(ids)
163
      var transferId = []
164
      ids.forEach(id => {
165
        console.log(this.isContained(ids, this.$refs.leftTree.getNodeStateById(id).children))
166
        if (this.$refs.leftTree.getNodeStateById(id).children && this.isContained(ids, this.$refs.leftTree.getNodeStateById(id).children)) {
167
          // 修改子节点的pid
168
          var includeFlag = true
169
          this.$refs.leftTree.getNodeStateById(id).children.forEach(elementChild => {
170
            // 不含在选中的ids
171
            if (ids.indexOf(elementChild) === -1) {
172
              includeFlag = false
173
              this.dataTable.forEach(elementChildTable => {
174
                if (elementChildTable.id === elementChild) {
175
                  if (elementChildTable.pid.indexOf('copy') === -1) {
176
                    elementChildTable.pid = 'copy' + elementChildTable.pid
177
                  }
178
                }
179
              })
180
            } else {
181
              this.dataTable.forEach(elementChildTable => {
182
                if (elementChildTable.id === elementChild) {
183
                  if (elementChildTable.pid.indexOf('copy') !== -1) {
184
                    elementChildTable.pid = elementChildTable.pid.slice(4)
185
                  }
186
                }
187
              })
188
            }
189
          })
190
          if (id.indexOf('copy') === -1) {
191
            var flag = false
192
            this.copyData.forEach(element => {
193
              if (element.id === 'copy' + id) {
194
                flag = true
195
              }
196
            })
197
            if (!flag) {
198
              var dataIndex = 0
199
              this.dataTable.forEach((e, index) => {
200
                if (e.id === id) {
201
                  dataIndex = index
202
                }
203
              })
204
              this.copyData.push({
205
                key: 'copy' + id,
206
                label: this.$refs.leftTree.getNodeStateById(id).label,
207
                title: this.$refs.leftTree.getNodeStateById(id).title,
208
                id: 'copy' + id,
209
                index: dataIndex
210
              })
211
            }
212
          } else {
213
            if (includeFlag) {
214
              var includeIndex = 0
215
              this.dataTable.forEach((e, index) => {
216
                if (e.id === id) {
217
                  includeIndex = index
218
                }
219
              })
220
              this.removeData.push({
221
                key: id,
222
                label: this.$refs.leftTree.getNodeStateById(id).label,
223
                title: this.$refs.leftTree.getNodeStateById(id).title,
224
                id: id,
225
                index: includeIndex
226
              })
227
            }
228
          }
229
        }
230
        if (id.indexOf('copy') === -1) {
231
          transferId.push(id)
232
        } else {
233
          console.log(this.$refs.leftTree.getNodeStateById(id).children)
234
          if (!this.$refs.leftTree.getNodeStateById(id).children) {
235
            console.log(123213, id)
236
          }
237
        }
98 238
      })
99
      this.targetKeysTable = keysArray
239
      console.log(transferId)
240
      this.targetKeysTable = transferId
241
    },
242
    changeRightTree(ids) {
243
      console.log(ids)
100 244
    },
101 245
    onPagerChange(page) {
102 246
103 247
    },
104 248
    onSizeChange(number) {
105 249
250
    },
251
    isContained (a, b) {
252
      if (!(a instanceof Array) || !(b instanceof Array)) return false
253
      // if (a.length < b.length) return false
254
      var aStr = a.toString()
255
      for (var i = 0, len = b.length; i < len; i++) {
256
        if (aStr.indexOf(b[i]) !== -1) return true
257
      }
258
      return false
106 259
    }
107 260
  }
108 261
}

+ 159 - 0
ebc-middle-platform/src/modules/authorization/role-authorization.vue

@ -0,0 +1,159 @@
1
<template>
2
  <div class="authorization-container">
3
    <div class="left-container">
4
      <div class="title">
5
        <div>用户列表</div>
6
      </div>
7
      <div class="table-content">
8
        <t-table :data="table.data" highlight-current-row @current-change="handleCurrentChange">
9
          <t-table-column prop="name" label="姓名"></t-table-column>
10
          <t-table-column prop="number" label="员工编号"></t-table-column>
11
        </t-table>
12
        <t-pager :total="table.pager.total" :current.sync="table.pager.currentPage"
13
                 :page-size.sync="table.pager.size"
14
                 class="px-24 pt-16 float-right"
15
                 show-elevator
16
                 @on-size-change="onSizeChange"
17
                 @on-change="onPagerChange">
18
        </t-pager>
19
      </div>
20
    </div>
21
    <div class="transfer-container">
22
      <t-transfer
23
        ref="transfer"
24
        :data="dataTable"
25
        :selected-keys="targetKeysTable"
26
        :operations="['← 绑定','解绑 →']"
27
        :titles="['已关联角色','可关联角色']"
28
        @change="changeTransfer"
29
      >
30
        <div slot="listBodyLeft" slot-scope="tableLeft">
31
          <t-table :data="tableLeft.data" size="sm" @selection-change="changeTable">
32
            <t-table-column type="selection" width="50"></t-table-column>
33
            <t-table-column prop="label" width="70" label="角色名称"></t-table-column>
34
            <t-table-column prop="description" width="70" label="角色编码"></t-table-column>
35
            <div slot="empty"></div>
36
          </t-table>
37
        </div>
38
        <div slot="listBodyRight" slot-scope="tableRight">
39
          <t-table :data="tableRight.data" size="sm" @selection-change="changeTable">
40
            <t-table-column type="selection" width="50"></t-table-column>
41
            <t-table-column prop="label" width="70" label="角色名称"></t-table-column>
42
            <t-table-column prop="description" width="70" label="角色编码"></t-table-column>
43
            <div slot="empty"></div>
44
          </t-table>
45
        </div>
46
      </t-transfer>
47
    </div>
48
  </div>
49
</template>
50
<script>
51
import './menu-authorization.scss'
52
export default {
53
  data() {
54
    return {
55
      table: {
56
        data: [
57
          {
58
            name: '张三',
59
            number: '108373'
60
          },
61
          {
62
            name: '张三',
63
            number: '108373'
64
          },
65
          {
66
            name: '张三',
67
            number: '108373'
68
          }
69
        ],
70
        pager: {
71
          currentPage: 1,
72
          size: 10,
73
          total: 0
74
        }
75
      },
76
      dataTable: [
77
        {
78
          key: '1',
79
          label: '超级管理员',
80
          description: 'superadmin'
81
        },
82
        {
83
          key: '2',
84
          label: '管理员1',
85
          description: 'admin1'
86
        },
87
        {
88
          key: '3',
89
          label: '管理员2',
90
          description: 'admin2'
91
        },
92
        {
93
          key: '4',
94
          label: '管理员3',
95
          description: 'admin3'
96
        },
97
        {
98
          key: '5',
99
          label: '运维人员1',
100
          description: 'operator1'
101
        },
102
        {
103
          key: '6',
104
          label: '运维人员2',
105
          description: 'operator2'
106
        },
107
        {
108
          key: '7',
109
          label: '检修人员',
110
          description: 'maintainer'
111
        },
112
        {
113
          key: '8',
114
          label: '救援人员1',
115
          description: 'rescuer1'
116
        },
117
        {
118
          key: '9',
119
          label: '救援人员2',
120
          description: 'rescuer2'
121
        }
122
      ],
123
      targetKeysTable: [],
124
      copyData: []
125
    }
126
  },
127
  methods: {
128
    handleCurrentChange(val) {
129
      this.currentRow = val
130
    },
131
    changeTransfer(targetKeys, direction, moveKeys) {
132
      console.log(targetKeys, direction, moveKeys)
133
    },
134
    changeTable(elements) {
135
      var ids = []
136
      elements.forEach(element => {
137
        ids.push(element.key)
138
      })
139
      console.log(ids)
140
      this.targetKeysTable = ids
141
    },
142
    onPagerChange(page) {
143
144
    },
145
    onSizeChange(number) {
146
147
    },
148
    isContained (a, b) {
149
      if (!(a instanceof Array) || !(b instanceof Array)) return false
150
      if (a.length < b.length) return false
151
      var aStr = a.toString()
152
      for (var i = 0, len = b.length; i < len; i++) {
153
        if (aStr.indexOf(b[i]) == -1) return false
154
      }
155
      return true
156
    }
157
  }
158
}
159
</script>

+ 4 - 0
ebc-middle-platform/src/modules/system-management/equipment-management.scss

@ -39,4 +39,8 @@
39 39
  .table-pager{
40 40
    margin: 20px auto;
41 41
  }
42
}
43
.submit-button{
44
  background-color: #147BD1;
45
  color: #ffffff;
42 46
}

+ 130 - 2
ebc-middle-platform/src/modules/system-management/equipment-management.vue

@ -40,7 +40,7 @@
40 40
        <div class="btns">
41 41
          <t-button color="success" icon="upload-outline" @click="onReset">导入</t-button>
42 42
          <t-button color="success" icon="download-outline" @click="onReset">下载模板</t-button>
43
          <t-button color="success" icon="plus-outline" @click="toExport">新增</t-button>
43
          <t-button color="success" icon="plus-outline" @click="addEquipment">新增</t-button>
44 44
        </div>
45 45
      </div>
46 46
    </div>
@ -72,6 +72,33 @@
72 72
               @on-change="onPagerChange">
73 73
      </t-pager>
74 74
    </div>
75
    <t-modal :visibled.sync="modal" title="新增设备" >
76
      <t-form ref="formValidate" :model="formValidate" :rules="ruleValidate" :label-width="80" label-position="left">
77
        <t-form-item label="设备类型" prop="type">
78
          <t-select v-model="formValidate.type" label-in-value placeholder="请选择设备类型">
79
            <t-option value="1">风机</t-option>
80
            <t-option value="2">升压站</t-option>
81
            <t-option value="3">测风塔</t-option>
82
          </t-select>
83
        </t-form-item>
84
        <t-form-item label="设备名称" prop="name">
85
          <t-input v-model="formValidate.name" placeholder="请输入风机名称"></t-input>
86
        </t-form-item>
87
        <t-form-item label="设备编号" prop="number">
88
          <t-input v-model="formValidate.number" placeholder="请输入字母、数字、中划线、下划线、#"></t-input>
89
        </t-form-item>
90
        <t-form-item label="经度" prop="lng">
91
          <t-input v-model="formValidate.lng" placeholder="请输入数字"></t-input>
92
        </t-form-item>
93
        <t-form-item label="纬度" prop="lat">
94
          <t-input v-model="formValidate.lat" placeholder="请输入数字"></t-input>
95
        </t-form-item>
96
      </t-form>
97
      <div slot="footer">
98
        <t-button @click="cancel">取消</t-button>
99
        <t-button class="submit-button" @click="submit">保存</t-button>
100
      </div>
101
    </t-modal>
75 102
  </div>
76 103
</template>
77 104
<script>
@ -113,7 +140,93 @@ export default {
113 140
        type: '',
114 141
        alarmPerson: ''
115 142
      },
116
      rangeDate: ''
143
      rangeDate: '',
144
      modal: false,
145
      formValidate: {
146
        type: '',
147
        name: '',
148
        number: '',
149
        lng: '',
150
        lat: ''
151
      },
152
      ruleValidate: {
153
        type: [{
154
          required: true,
155
          message: '设备类型不能为空',
156
          trigger: 'blur'
157
        }],
158
        name: [
159
          {
160
            required: true,
161
            message: '设备名称不能为空',
162
            trigger: 'blur'
163
          },
164
          {
165
            message: '设备名称重复',
166
            trigger: 'blur',
167
            validator: function(rule, value, callback) {
168
              // TODO 判断编号重复
169
              if (false) {
170
                callback(rule.message)
171
              }
172
            }
173
          }
174
        ],
175
        number: [
176
          {
177
            required: true,
178
            message: '编号不能为空',
179
            trigger: 'blur'
180
          },
181
          {
182
            message: '请输入字母、数字、中划线、下划线、#',
183
            trigger: 'blur',
184
            validator: function(rule, value, callback) {
185
              if (!/^[a-zA-Z0-9-_#]+$/.test(value)) {
186
                callback(rule.message)
187
              } else {
188
                // TODO 判断编号重复
189
                if (false) {
190
                  rule.message = '编号重复'
191
                  callback(rule.message)
192
                }
193
              }
194
            }
195
          }
196
        ],
197
        lng: [
198
          {
199
            required: true,
200
            message: '经度不能为空',
201
            trigger: 'blur'
202
          },
203
          {
204
            message: '请输入数字',
205
            trigger: 'blur',
206
            validator: function(rule, value, callback) {
207
              if (isNaN(value)) {
208
                callback(rule.message)
209
              }
210
            }
211
          }
212
        ],
213
        lat: [
214
          {
215
            required: true,
216
            message: '经度不能为空',
217
            trigger: 'blur'
218
          },
219
          {
220
            message: '请输入数字',
221
            trigger: 'blur',
222
            validator: function(rule, value, callback) {
223
              if (isNaN(value)) {
224
                callback(rule.message)
225
              }
226
            }
227
          }
228
        ]
229
      }
117 230
    }
118 231
  },
119 232
  mounted() {
@ -138,6 +251,21 @@ export default {
138 251
    },
139 252
    onSizeChange(number) {
140 253
254
    },
255
    cancel() {
256
      this.modal = false
257
    },
258
    submit() {
259
      this.$refs.formValidate.validate(valid => {
260
        if (valid) {
261
          this.$Message.success('提交成功!')
262
        } else {
263
          this.$Message.danger('表单验证失败!')
264
        }
265
      })
266
    },
267
    addEquipment() {
268
      this.modal = true
141 269
    }
142 270
  }
143 271
}

+ 52 - 0
ebc-middle-platform/src/modules/system-management/map-mark.scss

@ -39,4 +39,56 @@
39 39
  .table-pager{
40 40
    margin: 20px auto;
41 41
  }
42
}
43
.modal{
44
  .top{
45
    display: flex;
46
    >div{
47
      display: flex; 
48
      margin: 0 20px 16px 0;    
49
      line-height: 2;
50
      .label-content{
51
        display: flex; 
52
        margin: 0 20px 16px 0;    
53
        line-height: 2;
54
      }
55
      .input-rule{
56
        flex: 1;
57
        margin:0 0 0 20px;
58
        .dropdown{
59
          width: 100%
60
        }
61
      }
62
    }
63
  }
64
  .content{
65
    display: flex;
66
    .left{
67
      width: 430px;
68
      .header{
69
        display: flex;
70
        justify-content: space-between;
71
        padding-right: 10px;
72
        .import-down{
73
          display: flex;
74
        }
75
      }
76
      th{
77
        padding: 0;
78
      }
79
      .explain{
80
        margin-top: 20px;
81
        font-size: 10px;
82
        color: #000000;
83
        padding-right: 10px;
84
        .title{
85
          color: #4C8DDA;
86
        }
87
      }
88
    }
89
    .right{
90
      width: 1200px;
91
      height: 700px;
92
    }
93
  }
42 94
}

+ 120 - 5
ebc-middle-platform/src/modules/system-management/map-mark.vue

@ -16,10 +16,10 @@
16 16
          </div>
17 17
        </div>
18 18
        <div class="btns">
19
          <t-button color="success" icon="plus-outline" @click="onReset">考勤区域</t-button>
20
          <t-button color="success" icon="plus-outline" @click="onReset">作业区域</t-button>
21
          <t-button color="success" icon="plus-outline" @click="onSearch">电子围栏</t-button>
22
          <t-button color="success" icon="plus-outline" @click="toExport">定点</t-button>
19
          <t-button color="success" icon="plus-outline" @click="markModal(1)">考勤区域</t-button>
20
          <t-button color="success" icon="plus-outline" @click="markModal(2)">作业区域</t-button>
21
          <t-button color="success" icon="plus-outline" @click="markModal(3)">电子围栏</t-button>
22
          <t-button color="success" icon="plus-outline" @click="markModal(4)">定点</t-button>
23 23
        </div>
24 24
      </div>
25 25
    </div>
@ -49,6 +49,57 @@
49 49
               @on-change="onPagerChange">
50 50
      </t-pager>
51 51
    </div>
52
    <t-modal :visibled.sync="addMark" :ok="submitMark" :cancel="cancel" class="modal" title="新增标记" ok-text="保存" width="1500px" >
53
      <div class="top">
54
        <div>
55
          <div class="label">标记类型:</div>
56
          <div class="input-rule">
57
            <t-select v-model="markType" width="200" placeholder="请输入...">
58
              <t-option v-for="item in markTypes" :key="item.id" :value="item.id">{{ item.type }}</t-option>
59
            </t-select>
60
          </div>
61
        </div>
62
        <div>
63
          <div class="label">标记名称:</div>
64
          <div class="input-rule">
65
            <t-input v-model="markName" placeholder="请输入..." style="width: 200px"></t-input>
66
          </div>
67
        </div>
68
      </div>
69
      <div class="content">
70
        <div class="left">
71
          <div class="header">
72
            <div>坐标列表</div>
73
            <div class="import-down">
74
              <a href="javascript:void(0)" size="sm" @click="handleClick(scope.row)">导入kml</a>
75
              <span class="mod-line">|</span>
76
              <a href="javascript:void(0)" size="sm" @click="handleClick(scope.row)">下载模板</a>
77
            </div>
78
          </div>
79
          <div>
80
            <t-table :data="modalData" size="sm" height="500">
81
              <t-table-column align="center" type="index" label="坐标名称"></t-table-column>
82
              <t-table-column align="center" prop="lng" label="经度"></t-table-column>
83
              <t-table-column align="center" prop="lat" label="纬度"></t-table-column>
84
            </t-table>
85
          </div>
86
          <div class="explain">
87
            <div class="title">说明</div>
88
            <div>
89
              1、可在地图中点击绘制对应区域
90
            </div>
91
            <div>
92
              2、可编辑坐标列表中的经纬度值调整对应点坐标,对应点在地图中处于选中态
93
            </div>
94
            <div>
95
              3、kml导入将清空已绘制信息
96
            </div>
97
          </div>
98
        </div>
99
        <div id="modalMap" class="right">
100
        </div>
101
      </div>
102
    </t-modal>
52 103
  </div>
53 104
</template>
54 105
<script>
@ -84,10 +135,57 @@ export default {
84 135
        type: '',
85 136
        alarmPerson: ''
86 137
      },
87
      rangeDate: ''
138
      rangeDate: '',
139
      addMark: false,
140
      markName: '',
141
      markType: 1,
142
      markTypes: [
143
        {
144
          id: 1,
145
          type: '考勤区域'
146
        },
147
        {
148
          id: 2,
149
          type: '作业区域'
150
        },
151
        {
152
          id: 3,
153
          type: '电子围栏'
154
        },
155
        {
156
          id: 4,
157
          type: '定点'
158
        }
159
      ],
160
      modalData: [],
161
      map: null,
162
      polygonDrawer: null
88 163
    }
89 164
  },
90 165
  mounted() {
166
    this.map = new Ai.Map('modalMap', {
167
      ak: 'MTYwMDkMTAwMU1UWXdNRGt4T0RnNU5UVXlNaU14TnpRdw__',
168
      center: [39.915599, 116.406568],
169
      zoom: 5
170
    })
171
    var maplayer = null
172
    maplayer = Ai.TileLayer('http://192.168.74.189:9999/tdtvector')
173
    this.map.addLayer(maplayer)
174
175
    var options = {
176
      guideLayers: []// 导向(吸附)图层对象,当距离相隔很近的时候会与导向对象重合
177
    }
178
    this.polygonDrawer = Ai.DrawPolygon(this.map, options)// 初始化多边形绘制工具
179
    this.polygonDrawer.enable()// 激活多边形绘制工具
180
    this.map.on(AiDrawEvent.CREATED, (e) => {
181
      console.log(1)
182
      this.layer = this.polygonDrawer.polygon(e)// 获取多边形信息
183
      // console.log(this.polygonDrawer.getPoints())
184
      this.modalData = this.layer._latlngs[0]
185
      this.polygonDrawer.editing(this.layer)
186
      this.polygonDrawer.disable()
187
      this.map.addLayer(this.layer)
188
    })
91 189
  },
92 190
  methods: {
93 191
    onChange(value) {
@ -102,6 +200,23 @@ export default {
102 200
    toExport() {
103 201
104 202
    },
203
    markModal(typeId) {
204
      this.markType = typeId
205
      this.addMark = true
206
      this.polygonDrawer.enable()
207
    },
208
    submitMark() {
209
      console.log(this.layer._latlngs[0])
210
      this.map.removeLayer(this.layer)
211
      this.polygonDrawer.disable()
212
      this.modalData = []
213
    },
214
    cancel() {
215
      console.log(this.layer)
216
      this.map.removeLayer(this.layer)
217
      this.polygonDrawer.disable()
218
      this.modalData = []
219
    },
105 220
    onPagerChange(page) {
106 221
107 222
    },

+ 4 - 0
ebc-middle-platform/src/modules/system-management/terminal-management.scss

@ -83,4 +83,8 @@
83 83
    border-radius: 5px;
84 84
    background-color: #E8F8E8;
85 85
  }
86
}
87
.submit-button{
88
  background-color: #147BD1;
89
  color: #ffffff;
86 90
}

+ 69 - 1
ebc-middle-platform/src/modules/system-management/terminal-management.vue

@ -27,6 +27,11 @@
27 27
          <t-button color="secondary" icon="unlock-outline" @click="toExport">解绑用户</t-button>
28 28
          <t-button color="secondary" icon="delete-outline" @click="toExport">删除</t-button>
29 29
        </div>
30
        <div class="btns">
31
          <t-button color="success" icon="upload-outline" @click="onReset">导入</t-button>
32
          <t-button color="success" icon="download-outline" @click="onReset">下载模板</t-button>
33
          <t-button color="success" icon="plus-outline" @click="addTerminal">新增</t-button>
34
        </div>
30 35
      </div>
31 36
    </div>
32 37
    <div>
@ -71,6 +76,25 @@
71 76
               @on-change="onPagerChange">
72 77
      </t-pager>
73 78
    </div>
79
    <t-modal :visibled.sync="modal" title="新增终端" >
80
      <t-form ref="formValidate" :model="formValidate" :rules="ruleValidate" :label-width="80" label-position="left">
81
        <t-form-item label="终端编号" prop="number">
82
          <t-input v-model="formValidate.number" placeholder="请输入字母、数字、中划线、下划线、#"></t-input>
83
        </t-form-item>
84
        <t-form-item label="备注" prop="desc">
85
          <t-input
86
            v-model="formValidate.desc"
87
            :autosize="{minRows: 2,maxRows: 5}"
88
            type="textarea"
89
            placeholder="请输入..."
90
          ></t-input>
91
        </t-form-item>
92
      </t-form>
93
      <div slot="footer">
94
        <t-button @click="cancel">取消</t-button>
95
        <t-button class="submit-button" @click="submit">保存</t-button>
96
      </div>
97
    </t-modal>
74 98
  </div>
75 99
</template>
76 100
<script>
@ -117,7 +141,36 @@ export default {
117 141
        type: '',
118 142
        alarmPerson: ''
119 143
      },
120
      rangeDate: ''
144
      rangeDate: '',
145
      modal: false,
146
      formValidate: {
147
        number: '',
148
        desc: ''
149
      },
150
      ruleValidate: {
151
        number: [
152
          {
153
            required: true,
154
            message: '编号不能为空',
155
            trigger: 'blur'
156
          },
157
          {
158
            message: '请输入字母、数字、中划线、下划线、#',
159
            trigger: 'blur',
160
            validator: function(rule, value, callback) {
161
              if (!/^[a-zA-Z0-9-_#]+$/.test(value)) {
162
                callback(rule.message)
163
              } else {
164
                // TODO 判断编号重复
165
                if (true) {
166
                  rule.message = '编号重复'
167
                  callback(rule.message)
168
                }
169
              }
170
            }
171
          }
172
        ]
173
      }
121 174
    }
122 175
  },
123 176
  mounted() {
@ -147,6 +200,21 @@ export default {
147 200
    },
148 201
    onSizeChange(number) {
149 202
203
    },
204
    addTerminal() {
205
      this.modal = true
206
    },
207
    cancel() {
208
      this.modal = false
209
    },
210
    submit() {
211
      this.$refs.formValidate.validate(valid => {
212
        if (valid) {
213
          this.$Message.success('提交成功!')
214
        } else {
215
          this.$Message.danger('表单验证失败!')
216
        }
217
      })
150 218
    }
151 219
  }
152 220
}

+ 4 - 0
ebc-middle-platform/src/modules/system-management/user-management.scss

@ -39,4 +39,8 @@
39 39
  .table-pager{
40 40
    margin: 20px auto;
41 41
  }
42
}
43
.submit-button{
44
  background-color: #147BD1;
45
  color: #ffffff;
42 46
}

+ 134 - 2
ebc-middle-platform/src/modules/system-management/user-management.vue

@ -40,7 +40,7 @@
40 40
        <div class="btns">
41 41
          <t-button color="success" icon="upload-outline" @click="onReset">导入</t-button>
42 42
          <t-button color="success" icon="download-outline" @click="onReset">下载模板</t-button>
43
          <t-button color="success" icon="plus-outline" @click="toExport">新增</t-button>
43
          <t-button color="success" icon="plus-outline" @click="addUser">新增</t-button>
44 44
        </div>
45 45
      </div>
46 46
    </div>
@ -78,6 +78,40 @@
78 78
               @on-change="onPagerChange">
79 79
      </t-pager>
80 80
    </div>
81
    <t-modal :visibled.sync="modal" title="新增设备" >
82
      <t-form ref="formValidate" :model="formValidate" :rules="ruleValidate" :label-width="80" label-position="left">
83
        <t-form-item label="姓名" prop="name">
84
          <t-input v-model="formValidate.name" placeholder="请输入风机名称"></t-input>
85
        </t-form-item>
86
        <t-form-item label="员工编号" prop="number">
87
          <t-input v-model="formValidate.number" placeholder="请输入字母、数字、中划线、下划线、#"></t-input>
88
        </t-form-item>
89
        <t-form-item label="部门" prop="department">
90
          <t-select v-model="formValidate.department" label-in-value placeholder="请选择设备类型">
91
            <t-option value="1">部门1</t-option>
92
            <t-option value="2">部门2</t-option>
93
            <t-option value="3">部门3</t-option>
94
          </t-select>
95
        </t-form-item>
96
        <t-form-item label="职务" prop="job">
97
          <t-select v-model="formValidate.job" label-in-value placeholder="请选择设备类型">
98
            <t-option value="1">职务1</t-option>
99
            <t-option value="2">职务2</t-option>
100
            <t-option value="3">职务3</t-option>
101
          </t-select>
102
        </t-form-item>
103
        <t-form-item label="年龄" prop="age">
104
          <t-input v-model="formValidate.age" placeholder="请输入数字"></t-input>
105
        </t-form-item>
106
        <t-form-item label="手机" prop="phone">
107
          <t-input v-model="formValidate.phone" placeholder="请输入数字"></t-input>
108
        </t-form-item>
109
      </t-form>
110
      <div slot="footer">
111
        <t-button @click="cancel">取消</t-button>
112
        <t-button class="submit-button" @click="submit">保存</t-button>
113
      </div>
114
    </t-modal>
81 115
  </div>
82 116
</template>
83 117
<script>
@ -125,7 +159,90 @@ export default {
125 159
        type: '',
126 160
        alarmPerson: ''
127 161
      },
128
      rangeDate: ''
162
      rangeDate: '',
163
      modal: false,
164
      formValidate: {
165
        name: '',
166
        number: '',
167
        department: '',
168
        job: '',
169
        age: '',
170
        phone: ''
171
      },
172
      ruleValidate: {
173
        name: [
174
          {
175
            required: true,
176
            message: '姓名不能为空',
177
            trigger: 'blur'
178
          }
179
        ],
180
        number: [
181
          {
182
            required: true,
183
            message: '员工编号不能为空',
184
            trigger: 'blur'
185
          },
186
          {
187
            message: '员工编号重复',
188
            trigger: 'blur',
189
            validator: function(rule, value, callback) {
190
              // TODO 判断编号重复
191
              if (false) {
192
                callback(rule.message)
193
              }
194
            }
195
          }
196
        ],
197
        department: [
198
          {
199
            required: true,
200
            message: '部门不能为空',
201
            trigger: 'blur'
202
          }
203
        ],
204
        job: [
205
          {
206
            required: true,
207
            message: '职务不能为空',
208
            trigger: 'blur'
209
          }
210
        ],
211
        age: [
212
          {
213
            required: true,
214
            message: '年龄不能为空',
215
            trigger: 'blur'
216
          },
217
          {
218
            message: '年龄不正确',
219
            trigger: 'blur',
220
            validator: function(rule, value, callback) {
221
              let pattern = /^(([0-9]|[1-9][1-9]|1[0-7][0-9])(\\.[0-9]+)?|180)$/
222
              if (!pattern.test(value)) {
223
                callback(rule.message)
224
              }
225
            }
226
          }
227
        ],
228
        phone: [
229
          {
230
            required: true,
231
            message: '手机不能为空',
232
            trigger: 'blur'
233
          },
234
          {
235
            message: '手机不正确',
236
            trigger: 'blur',
237
            validator: function(rule, value, callback) {
238
              let pattern = /^1[3456789]\d{9}$/
239
              if (!pattern.test(value)) {
240
                callback(rule.message)
241
              }
242
            }
243
          }
244
        ]
245
      }
129 246
    }
130 247
  },
131 248
  mounted() {
@ -150,6 +267,21 @@ export default {
150 267
    },
151 268
    onSizeChange(number) {
152 269
270
    },
271
    cancel() {
272
      this.modal = false
273
    },
274
    submit() {
275
      this.$refs.formValidate.validate(valid => {
276
        if (valid) {
277
          this.$Message.success('提交成功!')
278
        } else {
279
          this.$Message.danger('表单验证失败!')
280
        }
281
      })
282
    },
283
    addUser() {
284
      this.modal = true
153 285
    }
154 286
  }
155 287
}