设备管理
This commit is contained in:
		
							
								
								
									
										87
									
								
								packages/conv/AppDeviceConfig/AppDeviceConfig.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										87
									
								
								packages/conv/AppDeviceConfig/AppDeviceConfig.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,87 @@ | ||||
| <template> | ||||
|   <ai-list class="AppDeviceConfig"> | ||||
|     <template slot="title"> | ||||
|       <ai-title title="设备管理" :isShowBottomBorder="false" :fullname.sync="areaName" v-model="areaId" :instance="instance" @change="onAreaChange"></ai-title> | ||||
|     </template> | ||||
|     <template slot="tabs"> | ||||
|       <el-tabs v-model="currIndex"> | ||||
|         <el-tab-pane v-for="(tab,i) in tabs" :key="i" :label="tab.label"> | ||||
|           <component :areaId="areaId" :ref="String(i)" v-if="currIndex == i" :is="tab.comp" @change="onChange" lazy :instance="instance" :dict="dict" :permissions="permissions"/> | ||||
|         </el-tab-pane> | ||||
|       </el-tabs> | ||||
|     </template> | ||||
|   </ai-list> | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
|   import eyeList from './components/eyeList.vue' | ||||
|   import videoList from './components/videoList.vue' | ||||
|   import { mapState } from 'vuex' | ||||
|  | ||||
|   export default { | ||||
|     name: 'AppDeviceConfig', | ||||
|     label: '设备管理', | ||||
|  | ||||
|     components: { | ||||
|       eyeList, | ||||
|       videoList, | ||||
|     }, | ||||
|  | ||||
|     props: { | ||||
|       instance: Function, | ||||
|       dict: Object, | ||||
|       permissions: Function | ||||
|     }, | ||||
|  | ||||
|     computed: { | ||||
|       ...mapState(['user']), | ||||
|  | ||||
|       tabs () { | ||||
|         const tabList = [ | ||||
|           {label: '千里眼', name: 'eyeList', comp: eyeList, permission: ''}, | ||||
|           {label: '视联网', name: 'videoList', comp: videoList, permission: ''} | ||||
|         ] | ||||
|  | ||||
|         return tabList | ||||
|       } | ||||
|     }, | ||||
|  | ||||
|     data () { | ||||
|       return { | ||||
|         currIndex: '0', | ||||
|         component: 'eyeList', | ||||
|         params: {}, | ||||
|         areaId: '', | ||||
|         areaName: '' | ||||
|       } | ||||
|     }, | ||||
|  | ||||
|     created () { | ||||
|       this.areaId = this.user.info.areaId | ||||
|     }, | ||||
|  | ||||
|     methods: { | ||||
|       onChange (data) { | ||||
|         this.component = data.type | ||||
|         this.params = data.params | ||||
|  | ||||
|         this.$nextTick(() => { | ||||
|           if (data.isRefresh) { | ||||
|             this.$refs.component.getList() | ||||
|           } | ||||
|         }) | ||||
|          | ||||
|       }, | ||||
|  | ||||
|       onAreaChange () { | ||||
|         this.$refs[this.currIndex][0].changeArea() | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| </script> | ||||
|  | ||||
| <style lang="scss" scoped> | ||||
|   .AppDeviceConfig { | ||||
|     height: 100%; | ||||
|   } | ||||
| </style> | ||||
							
								
								
									
										202
									
								
								packages/conv/AppDeviceConfig/components/eyeList.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										202
									
								
								packages/conv/AppDeviceConfig/components/eyeList.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,202 @@ | ||||
| <template> | ||||
|   <ai-list class="eyeList" isTabs> | ||||
|     <template slot="content"> | ||||
|       <ai-search-bar bottomBorder> | ||||
|         <template #left> | ||||
|           <el-button type="primary" icon="iconfont iconAdd" size="small" @click="add('添加设备', {})">添加</el-button> | ||||
|           <el-button icon="el-icon-delete" class="delete-btn del-btn-list" :disabled="!Boolean(ids.length)" @click="remove(ids)">删除</el-button> | ||||
|         </template> | ||||
|       </ai-search-bar> | ||||
|       <ai-table | ||||
|         :tableData="tableData" | ||||
|         :col-configs="colConfigs" | ||||
|         :total="total" | ||||
|         v-loading="loading" | ||||
|         style="margin-top: 16px;" | ||||
|         :current.sync="search.current" | ||||
|         :size.sync="search.size" | ||||
|         @getList="getList"> | ||||
|         <el-table-column slot="options" width="140px" fixed="right" label="操作" align="center"> | ||||
|           <template slot-scope="{ row }"> | ||||
|             <div class="table-options"> | ||||
|               <el-button type="text" @click="edit('编辑设备', row)">编辑</el-button> | ||||
|               <el-button type="text" @click="refresh(row)">刷新</el-button> | ||||
|               <el-button type="text" @click="remove(row.id)">删除</el-button> | ||||
|             </div> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|       </ai-table> | ||||
|       <ai-dialog :title="dialogTitle" :visible.sync="dialog" width="800px"  @onConfirm="addForm" @closed="dialogForm={}"> | ||||
|         <el-form ref="addForm" :model="dialogForm" :rules="rules" size="small"  label-width="160px"> | ||||
|           <el-form-item label="租户id" prop="corpId"> | ||||
|             <el-input v-model.trim="dialogForm.corpId" placeholder="请输入..." clearable :maxLength="50"/> | ||||
|           </el-form-item> | ||||
|           <el-form-item required label="中移账号开启状态"> | ||||
|              <el-radio-group v-model="dialogForm.flag"> | ||||
|               <el-radio :label="0">关闭</el-radio> | ||||
|               <el-radio :label="1">开启</el-radio> | ||||
|             </el-radio-group> | ||||
|           </el-form-item> | ||||
|           <el-form-item label="中移账号appid"> | ||||
|             <el-input v-model.trim="dialogForm.appId" placeholder="请输入..." clearable :maxLength="50" /> | ||||
|           </el-form-item> | ||||
|           <el-form-item label="中移账号rsa"> | ||||
|             <el-input v-model.trim="dialogForm.rsa" placeholder="请输入..." clearable :maxLength="500"  type="textarea" :rows="5"/> | ||||
|           </el-form-item> | ||||
|           <el-form-item label="中移账号secret"> | ||||
|             <el-input v-model.trim="dialogForm.secret" placeholder="请输入..." clearable :maxLength="50" /> | ||||
|           </el-form-item> | ||||
|           <el-form-item label="TOKEN信息"> | ||||
|             <el-input v-model.trim="dialogForm.token" placeholder="请输入..." clearable :maxLength="200"  type="textarea" :rows="2"/> | ||||
|           </el-form-item> | ||||
|           <el-form-item label="中移组织结构结点ids"> | ||||
|             <el-input v-model.trim="dialogForm.orgIds" placeholder="请输入..." clearable :maxLength="50" /> | ||||
|           </el-form-item> | ||||
|           <el-form-item label="中移账号版本号"> | ||||
|             <el-input v-model.trim="dialogForm.version" placeholder="请输入..." clearable :maxLength="50" /> | ||||
|           </el-form-item> | ||||
|           <el-form-item label="大喇叭账号"> | ||||
|             <el-input v-model.trim="dialogForm.dlbName" placeholder="请输入..." clearable :maxLength="50" /> | ||||
|           </el-form-item> | ||||
|           <el-form-item label="大喇叭密码"> | ||||
|             <el-input v-model.trim="dialogForm.dlbPwd" placeholder="请输入..." clearable :maxLength="50" /> | ||||
|           </el-form-item> | ||||
|           <el-form-item label="大喇叭Token"> | ||||
|             <el-input v-model.trim="dialogForm.dlbToken" placeholder="请输入..." clearable :maxLength="50" /> | ||||
|           </el-form-item> | ||||
|         </el-form> | ||||
|       </ai-dialog> | ||||
|     </template> | ||||
|   </ai-list> | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
|   import { mapState } from 'vuex' | ||||
|   export default { | ||||
|     name: 'eyeList', | ||||
|     props: { | ||||
|       instance: Function, | ||||
|       dict: Object, | ||||
|       areaId: String | ||||
|     }, | ||||
|  | ||||
|     data () { | ||||
|       return { | ||||
|         search: { | ||||
|           current: 1, | ||||
|           size: 10, | ||||
|         }, | ||||
|         ids: [], | ||||
|         tableData: [], | ||||
|         total: 0, | ||||
|         loading: false, | ||||
|         dialog: false, | ||||
|         dialogTitle: '', | ||||
|         dialogForm: {} | ||||
|       } | ||||
|     }, | ||||
|  | ||||
|     computed: { | ||||
|       ...mapState(['user']), | ||||
|  | ||||
|       param () { | ||||
|         return this.search | ||||
|       }, | ||||
|       rules() { | ||||
|         return { | ||||
|           corpId: [{required: true, message: "请输入租户id"}], | ||||
|         } | ||||
|       }, | ||||
|       colConfigs() { | ||||
|         return [ | ||||
|           {type: "selection"}, | ||||
|           { prop: 'corpId', label: '租户id' }, | ||||
|           { prop: 'flag', align: 'center', label: '中移账号开启状态' }, | ||||
|           { prop: 'appId', align: 'center', label: '中移账号appid' }, | ||||
|           { prop: 'rsa', align: 'center', label: '中移账号rsa' }, | ||||
|           { prop: 'secret', align: 'center', label: '中移账号secret' }, | ||||
|           { prop: 'token', align: 'center', label: 'TOKEN信息' }, | ||||
|           { prop: 'orgIds', align: 'center', label: '中移组织结构结点ids' }, | ||||
|           { prop: 'version', align: 'center', label: '中移账号版本号' }, | ||||
|           { prop: 'dlbName', align: 'center', label: '大喇叭账号' }, | ||||
|           { prop: 'dlbPwd', align: 'center', label: '大喇叭密码' }, | ||||
|           { prop: 'dlbToken', align: 'center', label: '大喇叭Token' }, | ||||
|           { prop: 'createTime', align: 'center', label: '创建时间' }, | ||||
|           { slot: 'options'}, | ||||
|         ] | ||||
|       } | ||||
|     }, | ||||
|  | ||||
|     created () { | ||||
|       this.getList() | ||||
|     }, | ||||
|     methods: { | ||||
|       getListInit() { | ||||
|         this.search.current = 1  | ||||
|         this.getList() | ||||
|       }, | ||||
|       getList () { | ||||
|         this.instance.post(`/app/appzyaccountconfig/list`, null, { | ||||
|           params: { | ||||
|             ...this.search, | ||||
|           } | ||||
|         }).then(res => { | ||||
|           if (res.code == 0) { | ||||
|             this.tableData = res.data.records | ||||
|             this.total = res.data.total | ||||
|             this.loading = false | ||||
|           } else { | ||||
|             this.loading = false | ||||
|           } | ||||
|         }).catch(() => { | ||||
|           this.loading = false | ||||
|         }) | ||||
|       }, | ||||
|       remove(id) { | ||||
|         this.$confirm('确定删除该数据?').then(() => { | ||||
|           this.instance.post(`/app/appzyaccountconfig/delete?ids=${id}`).then(res => { | ||||
|             if (res.code == 0) { | ||||
|               this.$message.success('删除成功!') | ||||
|               this.getList() | ||||
|             } | ||||
|           }) | ||||
|         }) | ||||
|       }, | ||||
|       add(title, item) { | ||||
|         this.dialog = true | ||||
|         this.dialogTitle = title | ||||
|         this.dialogForm = item | ||||
|         if(title == '添加设备') { | ||||
|           this.dialogForm.flag = 1 | ||||
|           this.dialogForm.version = '1.0.0' | ||||
|         } | ||||
|       }, | ||||
|       addForm() { | ||||
|         this.$refs.addForm.validate((valid) => { | ||||
|           if (valid) { | ||||
|             this.dialogForm.type = 1 | ||||
|             this.instance.post(`/app/appzyaccountconfig/addOrUpdate`, this.dialogForm).then((res) => { | ||||
|               if (res.code == 0) { | ||||
|                 this.$message.success(`${this.dialogForm.id ? '编辑成功' : '添加成功'}`) | ||||
|                 this.getListInit() | ||||
|                 this.dialog = false; | ||||
|               } | ||||
|             }); | ||||
|           } else { | ||||
|             return false; | ||||
|           } | ||||
|         }); | ||||
|       }, | ||||
|       refresh() { | ||||
|         this.$confirm('确定刷新该数据token?').then(() => { | ||||
|           // this.instance.post(`/app/appzyaccountconfig/delete`).then(res => { | ||||
|           //   if (res.code == 0) { | ||||
|           //     this.$message.success('刷新成功!') | ||||
|           //     this.getList() | ||||
|           //   } | ||||
|           // }) | ||||
|         }) | ||||
|       }, | ||||
|     } | ||||
|   } | ||||
| </script> | ||||
							
								
								
									
										190
									
								
								packages/conv/AppDeviceConfig/components/videoList.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										190
									
								
								packages/conv/AppDeviceConfig/components/videoList.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,190 @@ | ||||
| <template> | ||||
|   <ai-list class="videoList" isTabs> | ||||
|     <template slot="content"> | ||||
|       <ai-search-bar bottomBorder> | ||||
|         <template #left> | ||||
|           <el-button type="primary" icon="iconfont iconAdd" size="small" @click="add('添加设备', {})">添加</el-button> | ||||
|           <el-button icon="el-icon-delete" class="delete-btn del-btn-list" :disabled="!Boolean(ids.length)" @click="remove(ids)">删除</el-button> | ||||
|         </template> | ||||
|       </ai-search-bar> | ||||
|       <ai-table | ||||
|         :tableData="tableData" | ||||
|         :col-configs="colConfigs" | ||||
|         :total="total" | ||||
|         v-loading="loading" | ||||
|         style="margin-top: 16px;" | ||||
|         :current.sync="search.current" | ||||
|         :size.sync="search.size" | ||||
|         @getList="getList"> | ||||
|         <el-table-column slot="options" width="140px" fixed="right" label="操作" align="center"> | ||||
|           <template slot-scope="{ row }"> | ||||
|             <div class="table-options"> | ||||
|               <el-button type="text" @click="edit('编辑设备', row)">编辑</el-button> | ||||
|               <el-button type="text" @click="refresh(row)">刷新</el-button> | ||||
|               <el-button type="text" @click="remove(row.id)">删除</el-button> | ||||
|             </div> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|       </ai-table> | ||||
|       <ai-dialog :title="dialogTitle" :visible.sync="dialog" width="800px"  @onConfirm="addForm" @closed="dialogForm={}"> | ||||
|         <el-form ref="addForm" :model="dialogForm" :rules="rules" size="small"  label-width="160px"> | ||||
|           <el-form-item label="租户id" prop="corpId"> | ||||
|             <el-input v-model.trim="dialogForm.corpId" placeholder="请输入..." clearable :maxLength="50"/> | ||||
|           </el-form-item> | ||||
|           <el-form-item required label="视联网账号开启状态"> | ||||
|              <el-radio-group v-model="dialogForm.flag"> | ||||
|               <el-radio :label="0">关闭</el-radio> | ||||
|               <el-radio :label="1">开启</el-radio> | ||||
|             </el-radio-group> | ||||
|           </el-form-item> | ||||
|           <el-form-item label="视联网地区ID"> | ||||
|             <el-input v-model.trim="dialogForm.slwAreaId" placeholder="请输入..." clearable :maxLength="50" /> | ||||
|           </el-form-item> | ||||
|           <el-form-item label="视联网用户ID"> | ||||
|             <el-input v-model.trim="dialogForm.slwUserId" placeholder="请输入..." clearable :maxLength="50" /> | ||||
|           </el-form-item> | ||||
|           <el-form-item label="视联网TOKEN"> | ||||
|             <el-input v-model.trim="dialogForm.slwToken" placeholder="请输入..." clearable :maxLength="50" /> | ||||
|           </el-form-item> | ||||
|           <el-form-item label="大喇叭账号"> | ||||
|             <el-input v-model.trim="dialogForm.dlbName" placeholder="请输入..." clearable :maxLength="50" /> | ||||
|           </el-form-item> | ||||
|           <el-form-item label="大喇叭密码"> | ||||
|             <el-input v-model.trim="dialogForm.dlbPwd" placeholder="请输入..." clearable :maxLength="50" /> | ||||
|           </el-form-item> | ||||
|           <el-form-item label="大喇叭Token"> | ||||
|             <el-input v-model.trim="dialogForm.dlbToken" placeholder="请输入..." clearable :maxLength="50" /> | ||||
|           </el-form-item> | ||||
|         </el-form> | ||||
|       </ai-dialog> | ||||
|     </template> | ||||
|   </ai-list> | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
|   import { mapState } from 'vuex' | ||||
|   export default { | ||||
|     name: 'eyeList', | ||||
|     props: { | ||||
|       instance: Function, | ||||
|       dict: Object, | ||||
|       areaId: String | ||||
|     }, | ||||
|  | ||||
|     data () { | ||||
|       return { | ||||
|         search: { | ||||
|           current: 1, | ||||
|           size: 10, | ||||
|         }, | ||||
|         ids: [], | ||||
|         tableData: [], | ||||
|         total: 0, | ||||
|         loading: false, | ||||
|         dialog: false, | ||||
|         dialogTitle: '', | ||||
|         dialogForm: {} | ||||
|       } | ||||
|     }, | ||||
|  | ||||
|     computed: { | ||||
|       ...mapState(['user']), | ||||
|  | ||||
|       param () { | ||||
|         return this.search | ||||
|       }, | ||||
|       rules() { | ||||
|         return { | ||||
|           corpId: [{required: true, message: "请输入租户id"}], | ||||
|         } | ||||
|       }, | ||||
|       colConfigs() { | ||||
|         return [ | ||||
|           {type: "selection"}, | ||||
|           { prop: 'corpId', label: '租户id' }, | ||||
|           { prop: 'flag', align: 'center', label: '视联网账号开启状态' }, | ||||
|           { prop: 'slwAreaId', align: 'center', label: '视联网地区ID' }, | ||||
|           { prop: 'slwUserId', align: 'center', label: '视联网用户ID' }, | ||||
|           { prop: 'slwToken', align: 'center', label: '视联网TOKEN' }, | ||||
|           { prop: 'dlbName', align: 'center', label: '大喇叭账号' }, | ||||
|           { prop: 'dlbPwd', align: 'center', label: '大喇叭密码' }, | ||||
|           { prop: 'dlbToken', align: 'center', label: '大喇叭Token' }, | ||||
|           { prop: 'createTime', align: 'center', label: '创建时间' }, | ||||
|           { slot: 'options'}, | ||||
|         ] | ||||
|       } | ||||
|     }, | ||||
|  | ||||
|     created () { | ||||
|       this.getList() | ||||
|     }, | ||||
|     methods: { | ||||
|       getListInit() { | ||||
|         this.search.current = 1  | ||||
|         this.getList() | ||||
|       }, | ||||
|       getList () { | ||||
|         this.instance.post(`/app/appzyaccountconfig/list`, null, { | ||||
|           params: { | ||||
|             ...this.search, | ||||
|           } | ||||
|         }).then(res => { | ||||
|           if (res.code == 0) { | ||||
|             this.tableData = res.data.records | ||||
|             this.total = res.data.total | ||||
|             this.loading = false | ||||
|           } else { | ||||
|             this.loading = false | ||||
|           } | ||||
|         }).catch(() => { | ||||
|           this.loading = false | ||||
|         }) | ||||
|       }, | ||||
|       remove(id) { | ||||
|         this.$confirm('确定删除该数据?').then(() => { | ||||
|           this.instance.post(`/app/appzyaccountconfig/delete?ids=${id}`).then(res => { | ||||
|             if (res.code == 0) { | ||||
|               this.$message.success('删除成功!') | ||||
|               this.getList() | ||||
|             } | ||||
|           }) | ||||
|         }) | ||||
|       }, | ||||
|       add(title, item) { | ||||
|         this.dialog = true | ||||
|         this.dialogTitle = title | ||||
|         this.dialogForm = item | ||||
|         if(title == '添加设备') { | ||||
|           this.dialogForm.flag = 1 | ||||
|           this.dialogForm.version = '1.0.0' | ||||
|         } | ||||
|       }, | ||||
|       addForm() { | ||||
|         this.$refs.addForm.validate((valid) => { | ||||
|           if (valid) { | ||||
|             this.dialogForm.type = 1 | ||||
|             this.instance.post(`/app/appzyaccountconfig/addOrUpdate`, this.dialogForm).then((res) => { | ||||
|               if (res.code == 0) { | ||||
|                 this.$message.success(`${this.dialogForm.id ? '编辑成功' : '添加成功'}`) | ||||
|                 this.getListInit() | ||||
|                 this.dialog = false; | ||||
|               } | ||||
|             }); | ||||
|           } else { | ||||
|             return false; | ||||
|           } | ||||
|         }); | ||||
|       }, | ||||
|       refresh() { | ||||
|         this.$confirm('确定刷新该数据token?').then(() => { | ||||
|           // this.instance.post(`/app/appzyaccountconfig/delete`).then(res => { | ||||
|           //   if (res.code == 0) { | ||||
|           //     this.$message.success('刷新成功!') | ||||
|           //     this.getList() | ||||
|           //   } | ||||
|           // }) | ||||
|         }) | ||||
|       }, | ||||
|     } | ||||
|   } | ||||
| </script> | ||||
		Reference in New Issue
	
	Block a user