浏览代码

页面新增modal

wangkang3 4 年之前
父节点
当前提交
34934adcea

+ 7 - 4
ebc-middle-platform/src/modules/authorization/menu-authorization.vue

@ -31,14 +31,14 @@
31 31
          <t-tree ref="leftTree" :multiple="true"
32 32
                  :with-ancestors="true"
33 33
                  :with-descendants="true"
34
                  :node-data="tableLeft.data" @select="changeTree"
34
                  :node-data="tableLeft.data" @select="changeLeftTree"
35 35
          ></t-tree>
36 36
        </div>
37 37
        <div slot="listBodyRight" slot-scope="tableRight">
38 38
          <t-tree :multiple="true"
39 39
                  :with-ancestors="true"
40 40
                  :with-descendants="true"
41
                  :node-data="tableRight.data" @select="changeTree"
41
                  :node-data="tableRight.data" @select="changeRightTree"
42 42
          ></t-tree>
43 43
        </div>
44 44
      </t-transfer>
@ -158,7 +158,7 @@ export default {
158 158
      }
159 159
      console.log(this.dataTable)
160 160
    },
161
    changeTree(ids) {
161
    changeLeftTree(ids) {
162 162
      console.log(ids)
163 163
      var transferId = []
164 164
      ids.forEach(id => {
@ -210,7 +210,7 @@ export default {
210 210
              })
211 211
            }
212 212
          } else {
213
            if (!includeFlag) {
213
            if (includeFlag) {
214 214
              var includeIndex = 0
215 215
              this.dataTable.forEach((e, index) => {
216 216
                if (e.id === id) {
@ -239,6 +239,9 @@ export default {
239 239
      console.log(transferId)
240 240
      this.targetKeysTable = transferId
241 241
    },
242
    changeRightTree(ids) {
243
      console.log(ids)
244
    },
242 245
    onPagerChange(page) {
243 246
244 247
    },

+ 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
}