1、消息提示
This commit is contained in:
		| @ -2,5 +2,7 @@ | |||||||
| ENV = 'development' | ENV = 'development' | ||||||
|  |  | ||||||
| # base api | # base api | ||||||
| VUE_APP_BASE_API = 'http://192.168.2.102:8000' | VUE_APP_BASE_API = 'http://192.168.2.22:8001' | ||||||
|  |  | ||||||
|  | #websocket url | ||||||
|  | VUE_APP_WEBSOCKET_URL = '192.168.2.22:8001' | ||||||
|  | |||||||
| @ -4,3 +4,5 @@ ENV = 'production' | |||||||
| # base api | # base api | ||||||
| VUE_APP_BASE_API = '' | VUE_APP_BASE_API = '' | ||||||
|  |  | ||||||
|  | #websocket url | ||||||
|  | VUE_APP_WEBSOCKET_URL = 'sys.systemcd.org' | ||||||
|  | |||||||
| @ -5,8 +5,8 @@ | |||||||
|   "author": "https://github.com/wenjianzhang", |   "author": "https://github.com/wenjianzhang", | ||||||
|   "license": "MIT", |   "license": "MIT", | ||||||
|   "scripts": { |   "scripts": { | ||||||
|     "dev": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve", |     "dev": " vue-cli-service serve", | ||||||
|     "build:prod": "set NODE_OPTIONS=--openssl-legacy-provider &&vue-cli-service build", |     "build:prod": "vue-cli-service build", | ||||||
|     "build:stage": "vue-cli-service build --mode staging", |     "build:stage": "vue-cli-service build --mode staging", | ||||||
|     "preview": "node build/index.js --preview", |     "preview": "node build/index.js --preview", | ||||||
|     "lint": "eslint --ext .js,.vue src", |     "lint": "eslint --ext .js,.vue src", | ||||||
|  | |||||||
							
								
								
									
										55
									
								
								src/api/admin/mm-alarm-log.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										55
									
								
								src/api/admin/mm-alarm-log.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,55 @@ | |||||||
|  | import request from '@/utils/request' | ||||||
|  |  | ||||||
|  | // 查询MmAlarmLog列表 | ||||||
|  | export function listMmAlarmLog(query) { | ||||||
|  |     return request({ | ||||||
|  |         url: '/api/v1/mm-alarm-log', | ||||||
|  |         method: 'get', | ||||||
|  |         params: query | ||||||
|  |     }) | ||||||
|  | } | ||||||
|  |  | ||||||
|  | // 查询MmAlarmLog详细 | ||||||
|  | export function getMmAlarmLog (id) { | ||||||
|  |     return request({ | ||||||
|  |         url: '/api/v1/mm-alarm-log/' + id, | ||||||
|  |         method: 'get' | ||||||
|  |     }) | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | // 新增MmAlarmLog | ||||||
|  | export function addMmAlarmLog(data) { | ||||||
|  |     return request({ | ||||||
|  |         url: '/api/v1/mm-alarm-log', | ||||||
|  |         method: 'post', | ||||||
|  |         data: data | ||||||
|  |     }) | ||||||
|  | } | ||||||
|  |  | ||||||
|  | // 修改MmAlarmLog | ||||||
|  | export function updateMmAlarmLog(data) { | ||||||
|  |     return request({ | ||||||
|  |         url: '/api/v1/mm-alarm-log/'+data.id, | ||||||
|  |         method: 'put', | ||||||
|  |         data: data | ||||||
|  |     }) | ||||||
|  | } | ||||||
|  |  | ||||||
|  | // 删除MmAlarmLog | ||||||
|  | export function delMmAlarmLog(data) { | ||||||
|  |     return request({ | ||||||
|  |         url: '/api/v1/mm-alarm-log', | ||||||
|  |         method: 'delete', | ||||||
|  |         data: data | ||||||
|  |     }) | ||||||
|  | } | ||||||
|  |  | ||||||
|  | // 清空MmAlarmLog | ||||||
|  | export function clearAllAlarmLog() { | ||||||
|  |     return request({ | ||||||
|  |         url: '/api/v1/mm-alarm-log/clear-all', | ||||||
|  |         method: 'delete' | ||||||
|  |     }) | ||||||
|  | } | ||||||
|  |  | ||||||
							
								
								
									
										53
									
								
								src/api/admin/mm-wallet-white-list.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								src/api/admin/mm-wallet-white-list.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,53 @@ | |||||||
|  | import request from "@/utils/request"; | ||||||
|  |  | ||||||
|  | // 查询MmWalletWhiteList列表 | ||||||
|  | export function listMmWalletWhiteList(query) { | ||||||
|  |   return request({ | ||||||
|  |     url: "/api/v1/mm-wallet-white-list", | ||||||
|  |     method: "get", | ||||||
|  |     params: query, | ||||||
|  |   }); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | // 查询MmWalletWhiteList详细 | ||||||
|  | export function getMmWalletWhiteList(id) { | ||||||
|  |   return request({ | ||||||
|  |     url: "/api/v1/mm-wallet-white-list/" + id, | ||||||
|  |     method: "get", | ||||||
|  |   }); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | // 新增MmWalletWhiteList | ||||||
|  | export function addMmWalletWhiteList(data) { | ||||||
|  |   return request({ | ||||||
|  |     url: "/api/v1/mm-wallet-white-list", | ||||||
|  |     method: "post", | ||||||
|  |     data: data, | ||||||
|  |   }); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | // 修改MmWalletWhiteList | ||||||
|  | export function updateMmWalletWhiteList(data) { | ||||||
|  |   return request({ | ||||||
|  |     url: "/api/v1/mm-wallet-white-list/" + data.id, | ||||||
|  |     method: "put", | ||||||
|  |     data: data, | ||||||
|  |   }); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | // 删除MmWalletWhiteList | ||||||
|  | export function delMmWalletWhiteList(data) { | ||||||
|  |   return request({ | ||||||
|  |     url: "/api/v1/mm-wallet-white-list", | ||||||
|  |     method: "delete", | ||||||
|  |     data: data, | ||||||
|  |   }); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | export function batchInsertMmWalletWhiteList(data) { | ||||||
|  |   return request({ | ||||||
|  |     url: "/api/v1/mm-wallet-white-list/batch", | ||||||
|  |     method: "post", | ||||||
|  |     data: data, | ||||||
|  |   }); | ||||||
|  | } | ||||||
							
								
								
									
										
											BIN
										
									
								
								src/assets/tiktok/sisfus.mp3
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								src/assets/tiktok/sisfus.mp3
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| @ -1,9 +1,10 @@ | |||||||
| <template> | <template> | ||||||
|   <div :class="classObj" class="app-wrapper" :style="{'--current-color': $store.state.settings.theme}"> |   <div :class="classObj" class="app-wrapper" :style="{ '--current-color': $store.state.settings.theme }"> | ||||||
|     <div v-if="device==='mobile'&&sidebar.opened" class="drawer-bg" @click="handleClickOutside" /> |     <div v-if="device === 'mobile' && sidebar.opened" class="drawer-bg" @click="handleClickOutside" /> | ||||||
|     <sidebar class="sidebar-container" :style="{ backgroundColor: $store.state.settings.themeStyle === 'dark' ? variables.menuBg : variables.menuLightBg }" /> |     <sidebar class="sidebar-container" | ||||||
|     <div :class="{hasTagsView:needTagsView}" class="main-container"> |       :style="{ backgroundColor: $store.state.settings.themeStyle === 'dark' ? variables.menuBg : variables.menuLightBg }" /> | ||||||
|       <div :class="{'fixed-header':fixedHeader}"> |     <div :class="{ hasTagsView: needTagsView }" class="main-container"> | ||||||
|  |       <div :class="{ 'fixed-header': fixedHeader }"> | ||||||
|         <navbar /> |         <navbar /> | ||||||
|         <tags-view v-if="needTagsView" /> |         <tags-view v-if="needTagsView" /> | ||||||
|       </div> |       </div> | ||||||
| @ -21,6 +22,8 @@ import { AppMain, Navbar, Settings, Sidebar, TagsView } from './components' | |||||||
| import ResizeMixin from './mixin/ResizeHandler' | import ResizeMixin from './mixin/ResizeHandler' | ||||||
| import { mapState } from 'vuex' | import { mapState } from 'vuex' | ||||||
| import variables from '@/styles/variables.scss' | import variables from '@/styles/variables.scss' | ||||||
|  | import dingSound from '@/assets/tiktok/sisfus.mp3' | ||||||
|  | import checkPermisAction from '@/utils/permisaction' | ||||||
|  |  | ||||||
| export default { | export default { | ||||||
|   name: 'Layout', |   name: 'Layout', | ||||||
| @ -32,6 +35,11 @@ export default { | |||||||
|     Sidebar, |     Sidebar, | ||||||
|     TagsView |     TagsView | ||||||
|   }, |   }, | ||||||
|  |   data() { | ||||||
|  |     return { | ||||||
|  |       voice: null, | ||||||
|  |     } | ||||||
|  |   }, | ||||||
|   mixins: [ResizeMixin], |   mixins: [ResizeMixin], | ||||||
|   computed: { |   computed: { | ||||||
|     ...mapState({ |     ...mapState({ | ||||||
| @ -53,7 +61,89 @@ export default { | |||||||
|       return variables |       return variables | ||||||
|     } |     } | ||||||
|   }, |   }, | ||||||
|  |  | ||||||
|  |   created() { | ||||||
|  |     // if (!this.roles.includes('admin')) { | ||||||
|  |     //   this.currentRole = 'editorDashboard' | ||||||
|  |     // } | ||||||
|  |  | ||||||
|  |     if (checkPermisAction(['admin:mmAlarmLog:notice'])) { | ||||||
|  |       this.$confirm('是否接收警告?', '提示', { | ||||||
|  |         distinguishCancelAndClose: true, | ||||||
|  |         confirmButtonText: '确定', | ||||||
|  |         cancelButtonText: '取消', | ||||||
|  |         type: 'warning' | ||||||
|  |       }).then(() => { | ||||||
|  |         this.voice = new Audio(dingSound) | ||||||
|  |  | ||||||
|  |         this.initWebSocket() | ||||||
|  |       }).catch(() => { | ||||||
|  |         console.log('取消') | ||||||
|  |       }); | ||||||
|  |     } | ||||||
|  |   }, | ||||||
|  |   destroyed() { | ||||||
|  |     console.log('断开websocket连接') | ||||||
|  |     this.websock.close() // 离开路由之后断开websocket连接 | ||||||
|  |     // unWsLogout(this.id, this.group).then(response => { | ||||||
|  |     //   console.log(response.data) | ||||||
|  |     // } | ||||||
|  |     // ) | ||||||
|  |   }, | ||||||
|   methods: { |   methods: { | ||||||
|  |     checkPermisAction, | ||||||
|  |     initWebSocket() { // 初始化weosocket | ||||||
|  |       const wsuri = `ws://${process.env.VUE_APP_WEBSOCKET_URL}/ws?token=${this.$store.state.user.token}` | ||||||
|  |  | ||||||
|  |       this.websock = new WebSocket(wsuri) | ||||||
|  |       this.websock.onmessage = this.websocketonmessage | ||||||
|  |       this.websock.onopen = this.websocketonopen | ||||||
|  |       this.websock.onerror = this.websocketonerror | ||||||
|  |       this.websock.onclose = this.websocketclose | ||||||
|  |     }, | ||||||
|  |     websocketonopen() { // 连接建立之后执行send方法发送数据 | ||||||
|  |       console.log('ws连接打开') | ||||||
|  |       //   const actions = { 'test': '12345' } | ||||||
|  |       //   this.websocketsend(JSON.stringify(actions)) | ||||||
|  |     }, | ||||||
|  |     websocketonerror() { // 连接建立失败重连 | ||||||
|  |       this.initWebSocket() | ||||||
|  |     }, | ||||||
|  |     websocketonmessage(e) { // 数据接收 | ||||||
|  |       console.log("ws:", e.data) | ||||||
|  |       try { | ||||||
|  |         let data = JSON.parse(e.data) | ||||||
|  |  | ||||||
|  |         this.$notify({ | ||||||
|  |           title: '钱包警告', | ||||||
|  |           dangerouslyUseHTMLString: true, | ||||||
|  |           message: `<p>设备id:${data.machineId}</p><p>设备码:${data.biosId}</p><p style="text-align:left;">内容:${data.content}</p>`, | ||||||
|  |           type: 'warning', | ||||||
|  |           duration: 0 | ||||||
|  |         }); | ||||||
|  |  | ||||||
|  |         this.playVoice("钱包告警") | ||||||
|  |       } catch (err) { | ||||||
|  |         console.log("接收websocket数据失败:", err) | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |  | ||||||
|  |     playVoice(text) { | ||||||
|  |  | ||||||
|  |       this.voice.play().catch(err => { | ||||||
|  |         console.error('音频播放失败:', err) | ||||||
|  |       }) | ||||||
|  |     }, | ||||||
|  |     websocketsend(Data) { // 数据发送 | ||||||
|  |       //   this.websock.send(Data) | ||||||
|  |     }, | ||||||
|  |     websocketclose(e) { // 关闭 | ||||||
|  |       // unWsLogout(this.id, this.group).then(response => { | ||||||
|  |       //   console.log(response.data) | ||||||
|  |       // } | ||||||
|  |       // ) | ||||||
|  |       // console.log('断开连接', e) | ||||||
|  |     }, | ||||||
|     handleClickOutside() { |     handleClickOutside() { | ||||||
|       this.$store.dispatch('app/closeSideBar', { withoutAnimation: false }) |       this.$store.dispatch('app/closeSideBar', { withoutAnimation: false }) | ||||||
|     } |     } | ||||||
| @ -62,45 +152,45 @@ export default { | |||||||
| </script> | </script> | ||||||
|  |  | ||||||
| <style lang="scss" scoped> | <style lang="scss" scoped> | ||||||
|   @import "~@/styles/mixin.scss"; | @import "~@/styles/mixin.scss"; | ||||||
|   @import "~@/styles/variables.scss"; | @import "~@/styles/variables.scss"; | ||||||
|  |  | ||||||
|   .app-wrapper { | .app-wrapper { | ||||||
|     @include clearfix; |   @include clearfix; | ||||||
|     position: relative; |   position: relative; | ||||||
|     height: 100%; |   height: 100%; | ||||||
|     width: 100%; |   width: 100%; | ||||||
|  |  | ||||||
|     &.mobile.openSidebar { |   &.mobile.openSidebar { | ||||||
|       position: fixed; |  | ||||||
|       top: 0; |  | ||||||
|     } |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   .drawer-bg { |  | ||||||
|     background: #000; |  | ||||||
|     opacity: 0.3; |  | ||||||
|     width: 100%; |  | ||||||
|     top: 0; |  | ||||||
|     height: 100%; |  | ||||||
|     position: absolute; |  | ||||||
|     z-index: 999; |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   .fixed-header { |  | ||||||
|     position: fixed; |     position: fixed; | ||||||
|     top: 0; |     top: 0; | ||||||
|     right: 0; |  | ||||||
|     z-index: 9; |  | ||||||
|     width: calc(100% - #{$sideBarWidth}); |  | ||||||
|     transition: width 0.28s; |  | ||||||
|   } |   } | ||||||
|  | } | ||||||
|  |  | ||||||
|   .hideSidebar .fixed-header { | .drawer-bg { | ||||||
|     width: calc(100% - 54px) |   background: #000; | ||||||
|   } |   opacity: 0.3; | ||||||
|  |   width: 100%; | ||||||
|  |   top: 0; | ||||||
|  |   height: 100%; | ||||||
|  |   position: absolute; | ||||||
|  |   z-index: 999; | ||||||
|  | } | ||||||
|  |  | ||||||
|   .mobile .fixed-header { | .fixed-header { | ||||||
|     width: 100%; |   position: fixed; | ||||||
|   } |   top: 0; | ||||||
|  |   right: 0; | ||||||
|  |   z-index: 9; | ||||||
|  |   width: calc(100% - #{$sideBarWidth}); | ||||||
|  |   transition: width 0.28s; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .hideSidebar .fixed-header { | ||||||
|  |   width: calc(100% - 54px) | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .mobile .fixed-header { | ||||||
|  |   width: 100%; | ||||||
|  | } | ||||||
| </style> | </style> | ||||||
|  | |||||||
							
								
								
									
										24
									
								
								src/utils/permisaction.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								src/utils/permisaction.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,24 @@ | |||||||
|  | import store from '@/store' | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * @param {Array} value | ||||||
|  |  * @returns {Boolean} | ||||||
|  |  * @example see @/views/permission/directive.vue | ||||||
|  |  */ | ||||||
|  | export default function checkPermisAction(value) { | ||||||
|  |   if (value && value instanceof Array && value.length > 0) { | ||||||
|  |     const all_permission = '*:*:*' | ||||||
|  |     const permissions = store.getters && store.getters.permisaction | ||||||
|  |     const permissionFlag = value | ||||||
|  |  | ||||||
|  |     const hasPermissions = permissions.some((permission) => { | ||||||
|  |       return ( | ||||||
|  |         all_permission === permission || permissionFlag.includes(permission) | ||||||
|  |       ) | ||||||
|  |     }) | ||||||
|  |  | ||||||
|  |     return hasPermissions | ||||||
|  |   } else { | ||||||
|  |     throw new Error(`请设置操作权限标签值`) | ||||||
|  |   } | ||||||
|  | } | ||||||
							
								
								
									
										306
									
								
								src/views/admin/mm-alarm-log/index.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										306
									
								
								src/views/admin/mm-alarm-log/index.vue
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,306 @@ | |||||||
|  | <template> | ||||||
|  |     <BasicLayout> | ||||||
|  |         <template #wrapper> | ||||||
|  |             <el-card class="box-card"> | ||||||
|  |                 <el-form ref="queryForm" :model="queryParams" :inline="true" label-width="68px"> | ||||||
|  |                     <el-form-item label="机器编号" prop="machineId"> | ||||||
|  |                         <el-select v-model="queryParams.machineId" placeholder="请选择机器编号" filterable clearable | ||||||
|  |                             size="small"> | ||||||
|  |                             <el-option v-for="item in machineIdOptions" :key="'machine' + item.value" | ||||||
|  |                                 :label="item.label" :value="item.value"> | ||||||
|  |                             </el-option> | ||||||
|  |                         </el-select> | ||||||
|  |                     </el-form-item> | ||||||
|  |                     <!-- <el-form-item label="设备码" prop="biosId"><el-input v-model="queryParams.biosId" placeholder="请输入设备码" | ||||||
|  |                             clearable size="small" @keyup.enter.native="handleQuery" /> | ||||||
|  |                     </el-form-item> --> | ||||||
|  |  | ||||||
|  |                     <el-form-item> | ||||||
|  |                         <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> | ||||||
|  |                         <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> | ||||||
|  |                     </el-form-item> | ||||||
|  |                 </el-form> | ||||||
|  |  | ||||||
|  |                 <el-row :gutter="10" class="mb8"> | ||||||
|  |                     <el-col :span="1.5"> | ||||||
|  |                         <el-button v-permisaction="['admin:mmAlarmLog:add']" type="primary" icon="el-icon-plus" | ||||||
|  |                             size="mini" @click="handleAdd">新增 | ||||||
|  |                         </el-button> | ||||||
|  |                     </el-col> | ||||||
|  |                     <el-col :span="1.5"> | ||||||
|  |                         <el-button v-permisaction="['admin:mmAlarmLog:edit']" type="success" icon="el-icon-edit" | ||||||
|  |                             size="mini" :disabled="single" @click="handleUpdate">修改 | ||||||
|  |                         </el-button> | ||||||
|  |                     </el-col> | ||||||
|  |                     <el-col :span="1.5"> | ||||||
|  |                         <el-button v-permisaction="['admin:mmAlarmLog:remove']" type="danger" icon="el-icon-delete" | ||||||
|  |                             size="mini" :disabled="multiple" @click="handleDelete">删除 | ||||||
|  |                         </el-button> | ||||||
|  |                     </el-col> | ||||||
|  |                     <el-col :span="1.5"> | ||||||
|  |                         <el-popconfirm class="delete-popconfirm" title="确认要清除所有吗?" confirm-button-text="清除" | ||||||
|  |                             @confirm="handleClearAll()"> | ||||||
|  |                             <el-button slot="reference" v-permisaction="['admin:mmAlarmLog:clearAll']" type="danger" | ||||||
|  |                                 icon="el-icon-delete-solid" size="mini"> | ||||||
|  |                                 清除所有 | ||||||
|  |                             </el-button> | ||||||
|  |                         </el-popconfirm> | ||||||
|  |                     </el-col> | ||||||
|  |                 </el-row> | ||||||
|  |  | ||||||
|  |                 <el-table v-loading="loading" :data="mmAlarmLogList" @selection-change="handleSelectionChange"> | ||||||
|  |                     <el-table-column type="selection" width="55" align="center" /> | ||||||
|  |                     <el-table-column label="设备id" align="center" prop="machineId" :show-overflow-tooltip="true" /> | ||||||
|  |                     <el-table-column label="设备码" align="center" prop="biosId" :show-overflow-tooltip="true" /> | ||||||
|  |                     <el-table-column label="内容" align="center" prop="content" :show-overflow-tooltip="true" /> | ||||||
|  |                     <el-table-column label="创建时间" align="center" prop="createdAt" width="155px" sortable="custom"> | ||||||
|  |                         <template slot-scope="scope"> | ||||||
|  |                             <span>{{ parseTime(scope.row.createdAt) }}</span> | ||||||
|  |                         </template> | ||||||
|  |                     </el-table-column> | ||||||
|  |                     <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> | ||||||
|  |                         <template slot-scope="scope"> | ||||||
|  |                             <el-popconfirm class="delete-popconfirm" title="确认要修改吗?" confirm-button-text="修改" | ||||||
|  |                                 @confirm="handleUpdate(scope.row)"> | ||||||
|  |                                 <el-button slot="reference" v-permisaction="['admin:mmAlarmLog:edit']" size="mini" | ||||||
|  |                                     type="text" icon="el-icon-edit">修改 | ||||||
|  |                                 </el-button> | ||||||
|  |                             </el-popconfirm> | ||||||
|  |                             <el-popconfirm class="delete-popconfirm" title="确认要删除吗?" confirm-button-text="删除" | ||||||
|  |                                 @confirm="handleDelete(scope.row)"> | ||||||
|  |                                 <el-button slot="reference" v-permisaction="['admin:mmAlarmLog:remove']" size="mini" | ||||||
|  |                                     type="text" icon="el-icon-delete">删除 | ||||||
|  |                                 </el-button> | ||||||
|  |                             </el-popconfirm> | ||||||
|  |                         </template> | ||||||
|  |                     </el-table-column> | ||||||
|  |                 </el-table> | ||||||
|  |  | ||||||
|  |                 <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageIndex" | ||||||
|  |                     :limit.sync="queryParams.pageSize" @pagination="getList" /> | ||||||
|  |  | ||||||
|  |                 <!-- 添加或修改对话框 --> | ||||||
|  |                 <el-dialog :title="title" :visible.sync="open" width="500px"> | ||||||
|  |                     <el-form ref="form" :model="form" :rules="rules" label-width="80px"> | ||||||
|  |  | ||||||
|  |                         <el-form-item label="设备id" prop="machineId"> | ||||||
|  |                             <el-select v-model="form.machineId" placeholder="请选择"> | ||||||
|  |                                 <el-option v-for="dict in machineIdOptions" :key="dict.value" :label="dict.label" | ||||||
|  |                                     :value="dict.value" /> | ||||||
|  |                             </el-select> | ||||||
|  |                         </el-form-item> | ||||||
|  |                         <el-form-item label="设备码" prop="biosId"> | ||||||
|  |                             <el-input v-model="form.biosId" placeholder="设备码" /> | ||||||
|  |                         </el-form-item> | ||||||
|  |                         <el-form-item label="内容" prop="content"> | ||||||
|  |                             <el-input v-model="form.content" placeholder="内容" /> | ||||||
|  |                         </el-form-item> | ||||||
|  |                     </el-form> | ||||||
|  |                     <div slot="footer" class="dialog-footer"> | ||||||
|  |                         <el-button type="primary" @click="submitForm">确 定</el-button> | ||||||
|  |                         <el-button @click="cancel">取 消</el-button> | ||||||
|  |                     </div> | ||||||
|  |                 </el-dialog> | ||||||
|  |             </el-card> | ||||||
|  |         </template> | ||||||
|  |     </BasicLayout> | ||||||
|  | </template> | ||||||
|  |  | ||||||
|  | <script> | ||||||
|  | import { addMmAlarmLog, delMmAlarmLog, getMmAlarmLog, listMmAlarmLog, updateMmAlarmLog, clearAllAlarmLog } from '@/api/admin/mm-alarm-log' | ||||||
|  | import { getMmMachineList } from '@/api/admin/mm-machine' | ||||||
|  |  | ||||||
|  | export default { | ||||||
|  |     name: 'MmAlarmLog', | ||||||
|  |     components: { | ||||||
|  |     }, | ||||||
|  |     data() { | ||||||
|  |         return { | ||||||
|  |             // 遮罩层 | ||||||
|  |             loading: true, | ||||||
|  |             // 选中数组 | ||||||
|  |             ids: [], | ||||||
|  |             // 非单个禁用 | ||||||
|  |             single: true, | ||||||
|  |             // 非多个禁用 | ||||||
|  |             multiple: true, | ||||||
|  |             // 总条数 | ||||||
|  |             total: 0, | ||||||
|  |             // 弹出层标题 | ||||||
|  |             title: '', | ||||||
|  |             // 是否显示弹出层 | ||||||
|  |             open: false, | ||||||
|  |             isEdit: false, | ||||||
|  |             // 类型数据字典 | ||||||
|  |             typeOptions: [], | ||||||
|  |             machineIdOptions: [], | ||||||
|  |             mmAlarmLogList: [], | ||||||
|  |  | ||||||
|  |             // 关系表类型 | ||||||
|  |  | ||||||
|  |             // 查询参数 | ||||||
|  |             queryParams: { | ||||||
|  |                 pageIndex: 1, | ||||||
|  |                 pageSize: 10, | ||||||
|  |                 machineId: undefined, | ||||||
|  |                 biosId: undefined, | ||||||
|  |                 idOrder: 'desc', | ||||||
|  |             }, | ||||||
|  |             // 表单参数 | ||||||
|  |             form: { | ||||||
|  |             }, | ||||||
|  |             // 表单校验 | ||||||
|  |             rules: { | ||||||
|  |                 machineId: [{ required: true, message: '设备id不能为空', trigger: 'blur' }], | ||||||
|  |                 biosId: [{ required: true, message: '设备码不能为空', trigger: 'blur' }], | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |     }, | ||||||
|  |     created() { | ||||||
|  |         this.getList() | ||||||
|  |         this.getMachineList() | ||||||
|  |     }, | ||||||
|  |     methods: { | ||||||
|  |         /** 查询参数列表 */ | ||||||
|  |         getList() { | ||||||
|  |             this.loading = true | ||||||
|  |             listMmAlarmLog(this.addDateRange(this.queryParams, this.dateRange)).then(response => { | ||||||
|  |                 this.mmAlarmLogList = response.data.list | ||||||
|  |                 this.total = response.data.count | ||||||
|  |                 this.loading = false | ||||||
|  |             } | ||||||
|  |             ) | ||||||
|  |         }, | ||||||
|  |         getMachineList() { | ||||||
|  |             getMmMachineList().then(response => { | ||||||
|  |                 this.machineIdOptions = response.data | ||||||
|  |             }) | ||||||
|  |         }, | ||||||
|  |         // 取消按钮 | ||||||
|  |         cancel() { | ||||||
|  |             this.open = false | ||||||
|  |             this.reset() | ||||||
|  |         }, | ||||||
|  |         // 表单重置 | ||||||
|  |         reset() { | ||||||
|  |             this.form = { | ||||||
|  |  | ||||||
|  |                 id: undefined, | ||||||
|  |                 machineId: undefined, | ||||||
|  |                 biosId: undefined, | ||||||
|  |                 content: undefined, | ||||||
|  |             } | ||||||
|  |             this.resetForm('form') | ||||||
|  |         }, | ||||||
|  |         getImgList: function () { | ||||||
|  |             this.form[this.fileIndex] = this.$refs['fileChoose'].resultList[0].fullUrl | ||||||
|  |         }, | ||||||
|  |         fileClose: function () { | ||||||
|  |             this.fileOpen = false | ||||||
|  |         }, | ||||||
|  |         // 关系 | ||||||
|  |         // 文件 | ||||||
|  |         /** 搜索按钮操作 */ | ||||||
|  |         handleQuery() { | ||||||
|  |             this.queryParams.pageIndex = 1 | ||||||
|  |             this.getList() | ||||||
|  |         }, | ||||||
|  |         /** 重置按钮操作 */ | ||||||
|  |         resetQuery() { | ||||||
|  |             this.dateRange = [] | ||||||
|  |             this.resetForm('queryForm') | ||||||
|  |             this.handleQuery() | ||||||
|  |         }, | ||||||
|  |         /** 新增按钮操作 */ | ||||||
|  |         handleAdd() { | ||||||
|  |             this.reset() | ||||||
|  |             this.open = true | ||||||
|  |             this.title = '添加钱包告警记录' | ||||||
|  |             this.isEdit = false | ||||||
|  |         }, | ||||||
|  |         // 多选框选中数据 | ||||||
|  |         handleSelectionChange(selection) { | ||||||
|  |             this.ids = selection.map(item => item.id) | ||||||
|  |             this.single = selection.length !== 1 | ||||||
|  |             this.multiple = !selection.length | ||||||
|  |         }, | ||||||
|  |         /** 修改按钮操作 */ | ||||||
|  |         handleUpdate(row) { | ||||||
|  |             this.reset() | ||||||
|  |             const id = | ||||||
|  |                 row.id || this.ids | ||||||
|  |             getMmAlarmLog(id).then(response => { | ||||||
|  |                 this.form = response.data | ||||||
|  |                 this.open = true | ||||||
|  |                 this.title = '修改钱包告警记录' | ||||||
|  |                 this.isEdit = true | ||||||
|  |             }) | ||||||
|  |         }, | ||||||
|  |         /** 提交按钮 */ | ||||||
|  |         submitForm: function () { | ||||||
|  |             this.$refs['form'].validate(valid => { | ||||||
|  |                 if (valid) { | ||||||
|  |                     if (this.form.id !== undefined) { | ||||||
|  |                         updateMmAlarmLog(this.form).then(response => { | ||||||
|  |                             if (response.code === 200) { | ||||||
|  |                                 this.msgSuccess(response.msg) | ||||||
|  |                                 this.open = false | ||||||
|  |                                 this.getList() | ||||||
|  |                             } else { | ||||||
|  |                                 this.msgError(response.msg) | ||||||
|  |                             } | ||||||
|  |                         }) | ||||||
|  |                     } else { | ||||||
|  |                         addMmAlarmLog(this.form).then(response => { | ||||||
|  |                             if (response.code === 200) { | ||||||
|  |                                 this.msgSuccess(response.msg) | ||||||
|  |                                 this.open = false | ||||||
|  |                                 this.getList() | ||||||
|  |                             } else { | ||||||
|  |                                 this.msgError(response.msg) | ||||||
|  |                             } | ||||||
|  |                         }) | ||||||
|  |                     } | ||||||
|  |                 } | ||||||
|  |             }) | ||||||
|  |         }, | ||||||
|  |         /** 删除按钮操作 */ | ||||||
|  |         handleDelete(row) { | ||||||
|  |             var Ids = (row.id && [row.id]) || this.ids | ||||||
|  |  | ||||||
|  |             this.$confirm('是否确认删除编号为"' + Ids + '"的数据项?', '警告', { | ||||||
|  |                 confirmButtonText: '确定', | ||||||
|  |                 cancelButtonText: '取消', | ||||||
|  |                 type: 'warning' | ||||||
|  |             }).then(function () { | ||||||
|  |                 return delMmAlarmLog({ 'ids': Ids }) | ||||||
|  |             }).then((response) => { | ||||||
|  |                 if (response.code === 200) { | ||||||
|  |                     this.msgSuccess(response.msg) | ||||||
|  |                     this.open = false | ||||||
|  |                     this.getList() | ||||||
|  |                 } else { | ||||||
|  |                     this.msgError(response.msg) | ||||||
|  |                 } | ||||||
|  |             }).catch(function () { | ||||||
|  |             }) | ||||||
|  |         }, | ||||||
|  |         handleClearAll() { | ||||||
|  |             this.loading = true | ||||||
|  |  | ||||||
|  |             clearAllAlarmLog().then(response => { | ||||||
|  |                 if (response.code === 200) { | ||||||
|  |                     this.msgSuccess(response.msg) | ||||||
|  |                     this.getList() | ||||||
|  |                 } else { | ||||||
|  |                     this.msgError(response.msg) | ||||||
|  |                 } | ||||||
|  |             }).catch(error => { | ||||||
|  |                 console.log(error) | ||||||
|  |             }).finally(() => { | ||||||
|  |                 this.loading = false | ||||||
|  |             }) | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | </script> | ||||||
							
								
								
									
										71
									
								
								src/views/admin/mm-wallet-white-list/batch-add.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										71
									
								
								src/views/admin/mm-wallet-white-list/batch-add.vue
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,71 @@ | |||||||
|  | <template> | ||||||
|  |     <el-dialog title="批量添加白名单" :visible.sync="dialogVisible" width="800px" @close="handleClose"> | ||||||
|  |         <el-form ref="form" :model="form" :rules="rules" label-width="120px"> | ||||||
|  |             <el-form-item label="钱包地址" prop="addresss"> | ||||||
|  |                 <el-input v-model="form.addresss" type="textarea" :autosize="{ minRows: 5, maxRows: 16 }" | ||||||
|  |                     placeholder="钱包地址(用换行符分隔)"></el-input> | ||||||
|  |             </el-form-item> | ||||||
|  |         </el-form> | ||||||
|  |         <div slot="footer" class="dialog-footer"> | ||||||
|  |             <el-button type="primary" :loading="loading" @click="submitForm">确 定</el-button> | ||||||
|  |             <el-button @click="cancel">取 消</el-button> | ||||||
|  |         </div> | ||||||
|  |     </el-dialog> | ||||||
|  | </template> | ||||||
|  |  | ||||||
|  | <script> | ||||||
|  | import { batchInsertMmWalletWhiteList } from '@/api/admin/mm-wallet-white-list' | ||||||
|  |  | ||||||
|  | export default { | ||||||
|  |     name: "BatchAdd", | ||||||
|  |     props: { | ||||||
|  |         dialogVisible: { | ||||||
|  |             type: Boolean, | ||||||
|  |             default: false | ||||||
|  |         } | ||||||
|  |     }, | ||||||
|  |     data() { | ||||||
|  |         return { | ||||||
|  |             // dialogVisible: false, | ||||||
|  |             loading: false, | ||||||
|  |             form: { | ||||||
|  |  | ||||||
|  |             }, | ||||||
|  |             rules: { | ||||||
|  |                 addresss: [{ required: true, message: '请输入地址', trigger: 'blur' }] | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |     }, | ||||||
|  |     methods: { | ||||||
|  |         handleClose(done) { | ||||||
|  |             this.$emit('update:dialogVisible', false) | ||||||
|  |             this.$emit("close"); | ||||||
|  |             done(); | ||||||
|  |         }, | ||||||
|  |         submitForm() { | ||||||
|  |             this.$refs.form.validate((valid) => { | ||||||
|  |                 if (valid) { | ||||||
|  |                     this.loading = true; | ||||||
|  |  | ||||||
|  |                     batchInsertMmWalletWhiteList(this.form).then(response => { | ||||||
|  |                         if (response.code === 200) { | ||||||
|  |                             this.$message.success('批量添加成功'); | ||||||
|  |                             this.handleClose(); | ||||||
|  |                         } else { | ||||||
|  |                             this.$message.error(response.message); | ||||||
|  |                         } | ||||||
|  |                     }).catch(error => { | ||||||
|  |                         console.log(error); | ||||||
|  |                         // this.$message.error('批量添加失败'); | ||||||
|  |                     }).finally(() => { | ||||||
|  |                         this.loading = false; | ||||||
|  |                     }); | ||||||
|  |                 } | ||||||
|  |             }); | ||||||
|  |         }, | ||||||
|  |         cancel() { | ||||||
|  |             this.handleClose(); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | </script> | ||||||
							
								
								
									
										292
									
								
								src/views/admin/mm-wallet-white-list/index.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										292
									
								
								src/views/admin/mm-wallet-white-list/index.vue
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,292 @@ | |||||||
|  | <template> | ||||||
|  |     <BasicLayout> | ||||||
|  |         <template #wrapper> | ||||||
|  |             <el-card class="box-card"> | ||||||
|  |                 <el-form ref="queryForm" :model="queryParams" :inline="true" label-width="68px"> | ||||||
|  |                     <el-form-item label="钱包地址" prop="address"><el-input v-model="queryParams.address" | ||||||
|  |                             placeholder="请输入钱包地址" clearable size="small" @keyup.enter.native="handleQuery" /> | ||||||
|  |                     </el-form-item> | ||||||
|  |                     <el-form-item label="是否启用" prop="status"> | ||||||
|  |                         <el-select v-model="queryParams.status" placeholder="请选择" clearable> | ||||||
|  |                             <el-option v-for="dict in statusOptions" :key="'query_status'+dict.value" :label="dict.label" | ||||||
|  |                                 :value="dict.value" /> | ||||||
|  |                         </el-select> | ||||||
|  |                     </el-form-item> | ||||||
|  |  | ||||||
|  |                     <el-form-item> | ||||||
|  |                         <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> | ||||||
|  |                         <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> | ||||||
|  |                     </el-form-item> | ||||||
|  |                 </el-form> | ||||||
|  |  | ||||||
|  |                 <el-row :gutter="10" class="mb8"> | ||||||
|  |                     <el-col :span="1.5"> | ||||||
|  |                         <el-button v-permisaction="['admin:mmWalletWhiteList:add']" type="primary" icon="el-icon-plus" | ||||||
|  |                             size="mini" @click="handleAdd">新增 | ||||||
|  |                         </el-button> | ||||||
|  |                     </el-col> | ||||||
|  |                     <el-col :span="1.5"> | ||||||
|  |                         <el-button v-permisaction="['admin:mmWalletWhiteList:add']" type="primary" | ||||||
|  |                             icon="el-icon-plus" size="mini" @click="handleBatchAdd">批量新增 | ||||||
|  |                         </el-button> | ||||||
|  |                     </el-col> | ||||||
|  |                     <el-col :span="1.5"> | ||||||
|  |                         <el-button v-permisaction="['admin:mmWalletWhiteList:edit']" type="success" icon="el-icon-edit" | ||||||
|  |                             size="mini" :disabled="single" @click="handleUpdate">修改 | ||||||
|  |                         </el-button> | ||||||
|  |                     </el-col> | ||||||
|  |                     <el-col :span="1.5"> | ||||||
|  |                         <el-button v-permisaction="['admin:mmWalletWhiteList:remove']" type="danger" | ||||||
|  |                             icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete">删除 | ||||||
|  |                         </el-button> | ||||||
|  |                     </el-col> | ||||||
|  |                 </el-row> | ||||||
|  |  | ||||||
|  |                 <el-table v-loading="loading" :data="mmWalletWhiteListList" @selection-change="handleSelectionChange"> | ||||||
|  |                     <el-table-column type="selection" width="55" align="center" /> | ||||||
|  |                     <el-table-column label="钱包地址" align="center" prop="address" :show-overflow-tooltip="true" /> | ||||||
|  |                     <el-table-column label="是否启用" align="center" prop="status" :show-overflow-tooltip="true" > | ||||||
|  |                         <template slot-scope="scope"> | ||||||
|  |                             <el-tag :type="scope.row.status===1?'success':'danger'">{{ statusFormat(scope.row.status) }}</el-tag> | ||||||
|  |                         </template> | ||||||
|  |                     </el-table-column> | ||||||
|  |                     <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> | ||||||
|  |                         <template slot-scope="scope"> | ||||||
|  |                             <el-popconfirm class="delete-popconfirm" title="确认要修改吗?" confirm-button-text="修改" | ||||||
|  |                                 @confirm="handleUpdate(scope.row)"> | ||||||
|  |                                 <el-button slot="reference" v-permisaction="['admin:mmWalletWhiteList:edit']" | ||||||
|  |                                     size="mini" type="text" icon="el-icon-edit">修改 | ||||||
|  |                                 </el-button> | ||||||
|  |                             </el-popconfirm> | ||||||
|  |                             <el-popconfirm class="delete-popconfirm" title="确认要删除吗?" confirm-button-text="删除" | ||||||
|  |                                 @confirm="handleDelete(scope.row)"> | ||||||
|  |                                 <el-button slot="reference" v-permisaction="['admin:mmWalletWhiteList:remove']" | ||||||
|  |                                     size="mini" type="text" icon="el-icon-delete">删除 | ||||||
|  |                                 </el-button> | ||||||
|  |                             </el-popconfirm> | ||||||
|  |                         </template> | ||||||
|  |                     </el-table-column> | ||||||
|  |                 </el-table> | ||||||
|  |  | ||||||
|  |                 <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageIndex" | ||||||
|  |                     :limit.sync="queryParams.pageSize" @pagination="getList" /> | ||||||
|  |  | ||||||
|  |                 <!-- 添加或修改对话框 --> | ||||||
|  |                 <el-dialog :title="title" :visible.sync="open" width="500px"> | ||||||
|  |                     <el-form ref="form" :model="form" :rules="rules" label-width="80px"> | ||||||
|  |  | ||||||
|  |                         <el-form-item label="钱包地址" prop="address"> | ||||||
|  |                             <el-input v-model="form.address" placeholder="钱包地址" /> | ||||||
|  |                         </el-form-item> | ||||||
|  |                         <el-form-item label="是否启用" prop="status"> | ||||||
|  |                             <el-select v-model="form.status" placeholder="请选择"> | ||||||
|  |                                 <el-option v-for="dict in statusOptions" :key="dict.value" :label="dict.label" | ||||||
|  |                                     :value="dict.value" /> | ||||||
|  |                             </el-select> | ||||||
|  |                         </el-form-item> | ||||||
|  |                     </el-form> | ||||||
|  |                     <div slot="footer" class="dialog-footer"> | ||||||
|  |                         <el-button type="primary" @click="submitForm" :loading="loading">确 定</el-button> | ||||||
|  |                         <el-button @click="cancel">取 消</el-button> | ||||||
|  |                     </div> | ||||||
|  |                 </el-dialog> | ||||||
|  |  | ||||||
|  |                 <batch-add :dialogVisible.sync="showBatch" @close="handleBatchClose"></batch-add> | ||||||
|  |             </el-card> | ||||||
|  |         </template> | ||||||
|  |     </BasicLayout> | ||||||
|  | </template> | ||||||
|  |  | ||||||
|  | <script> | ||||||
|  | import { addMmWalletWhiteList, delMmWalletWhiteList, getMmWalletWhiteList, listMmWalletWhiteList, updateMmWalletWhiteList } from '@/api/admin/mm-wallet-white-list' | ||||||
|  | import BatchAdd from './batch-add.vue' | ||||||
|  |  | ||||||
|  | export default { | ||||||
|  |     name: 'MmWalletWhiteList', | ||||||
|  |     components: { | ||||||
|  |         BatchAdd     | ||||||
|  |     }, | ||||||
|  |     data() { | ||||||
|  |         return { | ||||||
|  |             // 遮罩层 | ||||||
|  |             loading: true, | ||||||
|  |             // 选中数组 | ||||||
|  |             ids: [], | ||||||
|  |             // 非单个禁用 | ||||||
|  |             single: true, | ||||||
|  |             // 非多个禁用 | ||||||
|  |             multiple: true, | ||||||
|  |             // 总条数 | ||||||
|  |             total: 0, | ||||||
|  |             // 弹出层标题 | ||||||
|  |             title: '', | ||||||
|  |             // 是否显示弹出层 | ||||||
|  |             open: false, | ||||||
|  |             showBatch:false, | ||||||
|  |             isEdit: false, | ||||||
|  |             // 类型数据字典 | ||||||
|  |             typeOptions: [], | ||||||
|  |             statusOptions: [{ | ||||||
|  |                 value: 1, | ||||||
|  |                 label: '启用' | ||||||
|  |             }, { | ||||||
|  |                 value: 2, | ||||||
|  |                 label: '禁用' | ||||||
|  |             }], | ||||||
|  |             mmWalletWhiteListList: [], | ||||||
|  |  | ||||||
|  |             // 关系表类型 | ||||||
|  |  | ||||||
|  |             // 查询参数 | ||||||
|  |             queryParams: { | ||||||
|  |                 pageIndex: 1, | ||||||
|  |                 pageSize: 10, | ||||||
|  |                 address: undefined, | ||||||
|  |                 status: undefined, | ||||||
|  |                 idOrder: 'desc' | ||||||
|  |             }, | ||||||
|  |             // 表单参数 | ||||||
|  |             form: { | ||||||
|  |             }, | ||||||
|  |             // 表单校验 | ||||||
|  |             rules: { | ||||||
|  |                 address: [{ required: true, message: '钱包地址不能为空', trigger: 'blur' }], | ||||||
|  |                 status: [{ required: true, message: '是否启用不能为空', trigger: 'blur' }], | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |     }, | ||||||
|  |     created() { | ||||||
|  |         this.getList() | ||||||
|  |     }, | ||||||
|  |     methods: { | ||||||
|  |         statusFormat(statusId){ | ||||||
|  |             let status = this.statusOptions.find(item => item.value === statusId) | ||||||
|  |             return status? status.label : '' | ||||||
|  |         }, | ||||||
|  |         /** 查询参数列表 */ | ||||||
|  |         getList() { | ||||||
|  |             this.loading = true | ||||||
|  |             listMmWalletWhiteList(this.addDateRange(this.queryParams, this.dateRange)).then(response => { | ||||||
|  |                 this.mmWalletWhiteListList = response.data.list | ||||||
|  |                 this.total = response.data.count | ||||||
|  |                 this.loading = false | ||||||
|  |             } | ||||||
|  |             ) | ||||||
|  |         }, | ||||||
|  |         // 取消按钮 | ||||||
|  |         cancel() { | ||||||
|  |             this.open = false | ||||||
|  |             this.reset() | ||||||
|  |         }, | ||||||
|  |         // 表单重置 | ||||||
|  |         reset() { | ||||||
|  |             this.form = { | ||||||
|  |  | ||||||
|  |                 id: undefined, | ||||||
|  |                 address: undefined, | ||||||
|  |                 status: 1, | ||||||
|  |             } | ||||||
|  |             this.resetForm('form') | ||||||
|  |         }, | ||||||
|  |         getImgList: function () { | ||||||
|  |             this.form[this.fileIndex] = this.$refs['fileChoose'].resultList[0].fullUrl | ||||||
|  |         }, | ||||||
|  |         fileClose: function () { | ||||||
|  |             this.fileOpen = false | ||||||
|  |         }, | ||||||
|  |         // 关系 | ||||||
|  |         // 文件 | ||||||
|  |         /** 搜索按钮操作 */ | ||||||
|  |         handleQuery() { | ||||||
|  |             this.queryParams.pageIndex = 1 | ||||||
|  |             this.getList() | ||||||
|  |         }, | ||||||
|  |         /** 重置按钮操作 */ | ||||||
|  |         resetQuery() { | ||||||
|  |             this.dateRange = [] | ||||||
|  |             this.resetForm('queryForm') | ||||||
|  |             this.handleQuery() | ||||||
|  |         }, | ||||||
|  |         /** 新增按钮操作 */ | ||||||
|  |         handleAdd() { | ||||||
|  |             this.reset() | ||||||
|  |             this.open = true | ||||||
|  |             this.title = '添加钱包白名单' | ||||||
|  |             this.isEdit = false | ||||||
|  |         }, | ||||||
|  |         // 多选框选中数据 | ||||||
|  |         handleSelectionChange(selection) { | ||||||
|  |             this.ids = selection.map(item => item.id) | ||||||
|  |             this.single = selection.length !== 1 | ||||||
|  |             this.multiple = !selection.length | ||||||
|  |         }, | ||||||
|  |         /** 修改按钮操作 */ | ||||||
|  |         handleUpdate(row) { | ||||||
|  |             this.reset() | ||||||
|  |             const id = | ||||||
|  |                 row.id || this.ids | ||||||
|  |             getMmWalletWhiteList(id).then(response => { | ||||||
|  |                 this.form = response.data | ||||||
|  |                 this.open = true | ||||||
|  |                 this.title = '修改钱包白名单' | ||||||
|  |                 this.isEdit = true | ||||||
|  |             }) | ||||||
|  |         }, | ||||||
|  |         /** 提交按钮 */ | ||||||
|  |         submitForm: function () { | ||||||
|  |             this.$refs['form'].validate(valid => { | ||||||
|  |                 if (valid) { | ||||||
|  |                     if (this.form.id !== undefined) { | ||||||
|  |                         updateMmWalletWhiteList(this.form).then(response => { | ||||||
|  |                             if (response.code === 200) { | ||||||
|  |                                 this.msgSuccess(response.msg) | ||||||
|  |                                 this.open = false | ||||||
|  |                                 this.getList() | ||||||
|  |                             } else { | ||||||
|  |                                 this.msgError(response.msg) | ||||||
|  |                             } | ||||||
|  |                         }) | ||||||
|  |                     } else { | ||||||
|  |                         addMmWalletWhiteList(this.form).then(response => { | ||||||
|  |                             if (response.code === 200) { | ||||||
|  |                                 this.msgSuccess(response.msg) | ||||||
|  |                                 this.open = false | ||||||
|  |                                 this.getList() | ||||||
|  |                             } else { | ||||||
|  |                                 this.msgError(response.msg) | ||||||
|  |                             } | ||||||
|  |                         }) | ||||||
|  |                     } | ||||||
|  |                 } | ||||||
|  |             }) | ||||||
|  |         }, | ||||||
|  |         /** 删除按钮操作 */ | ||||||
|  |         handleDelete(row) { | ||||||
|  |             var Ids = (row.id && [row.id]) || this.ids | ||||||
|  |  | ||||||
|  |             this.$confirm('是否确认删除编号为"' + Ids + '"的数据项?', '警告', { | ||||||
|  |                 confirmButtonText: '确定', | ||||||
|  |                 cancelButtonText: '取消', | ||||||
|  |                 type: 'warning' | ||||||
|  |             }).then(function () { | ||||||
|  |                 return delMmWalletWhiteList({ 'ids': Ids }) | ||||||
|  |             }).then((response) => { | ||||||
|  |                 if (response.code === 200) { | ||||||
|  |                     this.msgSuccess(response.msg) | ||||||
|  |                     this.open = false | ||||||
|  |                     this.getList() | ||||||
|  |                 } else { | ||||||
|  |                     this.msgError(response.msg) | ||||||
|  |                 } | ||||||
|  |             }).catch(function () { | ||||||
|  |             }) | ||||||
|  |         }, | ||||||
|  |         handleBatchClose(){ | ||||||
|  |             this.getList() | ||||||
|  |         }, | ||||||
|  |         handleBatchAdd(){ | ||||||
|  |             this.showBatch = true | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | </script> | ||||||
| @ -14,7 +14,8 @@ export default { | |||||||
|   components: { adminDashboard, editorDashboard }, |   components: { adminDashboard, editorDashboard }, | ||||||
|   data() { |   data() { | ||||||
|     return { |     return { | ||||||
|       currentRole: 'adminDashboard' |       currentRole: 'adminDashboard', | ||||||
|  |       // websock: null | ||||||
|     } |     } | ||||||
|   }, |   }, | ||||||
|   computed: { |   computed: { | ||||||
| @ -22,10 +23,5 @@ export default { | |||||||
|       'roles' |       'roles' | ||||||
|     ]) |     ]) | ||||||
|   }, |   }, | ||||||
|   created() { |  | ||||||
|     // if (!this.roles.includes('admin')) { |  | ||||||
|     //   this.currentRole = 'editorDashboard' |  | ||||||
|     // } |  | ||||||
|   } |  | ||||||
| } | } | ||||||
| </script> | </script> | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user