This commit is contained in:
2023-05-24 17:06:53 +08:00
8 changed files with 446 additions and 246 deletions

View File

@@ -1,6 +1,7 @@
import {post} from '@config/http.js'
// import store from '../vuex/store'
// 开发者选项
export const getIP = () => post('api/developer/getIP', {})
export const getLogList = () => post('api/developer/getLogList', {})
export const getROSNodeList = () => post('api/developer/getROSNodeList', {})
@@ -76,3 +77,52 @@ export const sysRoleQuery = (page, size) => post('api/sysRole/query', {
page: page,
size: size
})
// 1.2 添加角色
export const sysRoleAdd = (name, remark) => post('api/sysRole/add', {
name: name,
remark: remark
})
// 1.3 修改角色
export const sysRoleEdit = (roleId, name, remark) => post('api/sysRole/edit', {
roleId: roleId,
name: name,
remark: remark
})
// 1.4 删除角色
export const sysRoleDelete = (roleId) => post('api/sysRole/delete', {
rolesIds: roleId
})
// 1.5 保存菜单
export const sysRoleMenu = (roleId, menus) => post('api/sysRole/menu', {
roleId: roleId,
menus: menus
})
// 1.6 查询菜单树
export const menuQuery = (roleId, menus) => post('api/sysRole/menuQuery', {
})
// 系统参数
// 1.1 参数列表
export const paramQuery = (page, size) => post('api/param/query', {
page: page,
size: size
})
// 1.2 添加参数
export const paramAdd = (code, name, value, remark) => post('api/param/add', {
code: code,
name: name,
value: value,
remark: remark
})
// 1.3 修改参数
export const paramEdit = (id, code, name, value, remark) => post('api/param/edit', {
id: id,
code: code,
name: name,
value: value,
remark: remark
})
// 1.4 删除参数
export const paramDelete = (paramsIds) => post('api/param/delete', {
paramsIds: paramsIds
})

View File

@@ -9,7 +9,7 @@ import fastClick from 'fastclick'
import infiniteScroll from 'vue-infinite-scroll'
import VueTouchKeyboard from 'vue-touch-keyboard'
import 'vue-touch-keyboard/dist/vue-touch-keyboard.css'
import { DatePicker, Select, Option, Radio, Menu, MenuItem } from 'element-ui'
import { DatePicker, Select, Option, Radio, Menu, MenuItem, Tree } from 'element-ui'
import { Pagination } from 'vant'
// import '@style/layout.styl'
import '@style/common.styl'
@@ -26,6 +26,7 @@ Vue.use(Option)
Vue.use(Radio)
Vue.use(Menu)
Vue.use(MenuItem)
Vue.use(Tree)
Vue.use(Pagination)
Vue.use(infiniteScroll)
Vue.use(VueTouchKeyboard)

View File

@@ -14,7 +14,7 @@ export default {
name: 'PreLoad',
mounted () {
setTimeout(() => {
this.$router.replace('/setup')
this.$router.replace('/login')
}, 1000)
}
}

View File

@@ -11,28 +11,113 @@
</div>
</div>
<div class="tabs_content">
<div v-show="tab === '1'" class="tab_pane">首页首页首页首页首页首页首页</div>
<div v-show="tab === '2'" class="tab_pane">动态</div>
<div v-show="tab === '3'" class="tab_pane">项目</div>
<div v-show="tab === '4'" class="tab_pane">项目</div>
<div v-show="tab === '5'" class="tab_pane">项目</div>
<div v-show="tab === '6'" class="tab_pane">其他</div>
<div v-show="tab === '1'" class="tab_pane">{{ result1 }}</div>
<div v-show="tab === '2'" class="tab_pane">{{ result2 }}</div>
<div v-show="tab === '3'" class="tab_pane">{{ result3 }}</div>
<div v-show="tab === '4'" class="tab_pane">{{ result4 }}</div>
<div v-show="tab === '5'" class="tab_pane">{{ result5 }}</div>
<div v-show="tab === '6'" class="tab_pane">{{ result6 }}</div>
</div>
</div>
</div>
</template>
<script>
import { getIP, getLogList, getROSNodeList, temperature, debugInfo, softwareVersion } from '@/config/getData2.js'
export default {
data () {
return {
tabs: [{id: '1', label: '首页'}, {id: '2', label: '动态'}, {id: '3', label: '项目'}, {id: '4', label: '项目'}, {id: '5', label: '项目'}, {id: '6', label: '其他'}],
tab: '1'
tabs: [{id: '1', label: 'ifconfig'}, {id: '2', label: '日志列表'}, {id: '3', label: 'ROS运行列表'}, {id: '4', label: '芯片温度/主频'}, {id: '5', label: '调试信息'}, {id: '6', label: '软/硬件版本'}],
tab: '1',
interTime: this.$store.getters.setTime,
timer: null,
result1: '',
result2: '',
result3: '',
result4: '',
result5: '',
result6: ''
}
},
created () {
this._getIP()
},
methods: {
refresh () {
this.timer = setInterval(() => {
this._getIP()
}, this.interTime)
},
async _getIP () {
let res = await getIP()
if (res.code === '1') {
this.result1 = res.result.result_info
} else {
this.toast(res.desc)
}
},
async _getLogList () {
let res = await getLogList()
if (res.code === '1') {
this.result2 = res.result.result_info
} else {
this.toast(res.desc)
}
},
async _getROSNodeList () {
let res = await getROSNodeList()
if (res.code === '1') {
this.result3 = res.result.result_info
} else {
this.toast(res.desc)
}
},
async _temperature () {
let res = await temperature()
if (res.code === '1') {
this.result4 = res.result.result_info
} else {
this.toast(res.desc)
}
},
async _debugInfo () {
let res = await debugInfo()
if (res.code === '1') {
this.result5 = res.result.result_info
} else {
this.toast(res.desc)
}
},
async _softwareVersion () {
let res = await softwareVersion()
if (res.code === '1') {
this.result6 = res.result.result_info
} else {
this.toast(res.desc)
}
},
changeTab (id) {
this.tab = id
switch (id) {
case '1':
this._getIP()
break
case '2':
this._getLogList()
break
case '3':
this._getROSNodeList()
break
case '4':
this._temperature()
break
case '5':
this._debugInfo()
break
case '6':
this._softwareVersion()
break
}
}
}
}

View File

@@ -19,13 +19,13 @@
<td>
<div class="radio__input icon_radio_checked"><i class="icon_radio"></i></div>
</td>
<td>超级管理员</td>
<td>垃圾分类几点睡浪费就冷冻机房蓝黛科技弗兰克</td>
<td>2023-05-05 08:50:08</td>
<td>{{ e.name }}</td>
<td>{{ e.remark }}</td>
<td>{{ e.createTime }}</td>
<td>
<div class="row">
<button class="button button--primary grid_button" @click="showDialog('2')">修改</button>
<button class="button button--primary grid_button" @click="showDialog('3')">删除</button>
<button class="button button--primary grid_button" @click="showDialog('2', e)">修改</button>
<button class="button button--primary grid_button" @click="showDialog('3', e)">删除</button>
</div>
</td>
</tr>
@@ -34,45 +34,18 @@
<div class="tree_wrapper">
<div class="tree_header">
<span>角色名称</span>
<button class="button button--primary grid_button button1">保存</button>
<button class="button button--primary grid_button button1" :disabled="disabled" @click="toSave">保存</button>
</div>
<div class="tree_body_container">
<div class="tree">
<div class="tree-node is-expanded is-focusable" v-for="(e, i) in tree" :key="i">
<div class="tree-node__content" style="padding-left: 0">
<span class="icon_tree-node__expand icon_caret_right"></span>
<div class="checkbox__input" @click="toCheck(e, tree)">
<i class="icon_checkbox" :class="{'icon_checkbox_checked': e.checked}"></i>
<input type="checkbox" class="checkbox__original" v-model="e.id">
</div>
<span class="tree-node__label">{{e.label}}</span>
</div>
<div class="tree-node__children">
<div class="tree-node is-expanded is-focusable" v-for="(el, j) in e.children" :key="j">
<div class="tree-node__content" style="padding-left: 24px">
<span class="icon_tree-node__expand icon_caret_right"></span>
<div class="checkbox__input" @click="toCheck(el, e.children)">
<i class="icon_checkbox" :class="{'icon_checkbox_checked': el.checked}"></i>
<input type="checkbox" class="checkbox__original" v-model="el.id">
</div>
<span class="tree-node__label">{{el.label}}</span>
</div>
<div class="tree-node__children">
<div class="tree-node is-expanded is-focusable" v-for="(ele, t) in el.children" :key="t">
<div class="tree-node__content" style="padding-left: 48px">
<span class="icon_tree-node__expand icon_caret_right"></span>
<div class="checkbox__input" @click="toCheck(ele, el.children)">
<i class="icon_checkbox" :class="{'icon_checkbox_checked': ele.checked}"></i>
<input type="checkbox" class="checkbox__original" v-model="ele.id">
</div>
<span class="tree-node__label">{{ ele.label }}</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<el-tree
:data="tree"
show-checkbox
default-expand-all
node-key="menuId"
ref="tree"
highlight-current
:props="defaultProps">
</el-tree>
</div>
</div>
</div>
@@ -80,6 +53,7 @@
ref="child"
:title="title"
:type="type"
:unclick="unclick"
@toSure="toSureDialog"
>
<div v-if="type === '1' || type === '2'" class="form_wraper">
@@ -87,7 +61,7 @@
<div class="form_item">
<div class="form_item__label"><i>*</i>角色名称</div>
<div class="form_item__content">
<input type="text" class="form_item__input">
<input type="text" class="form_item__input" v-model="rolename">
</div>
</div>
</div>
@@ -107,114 +81,27 @@
<script>
import jxDialog from '@components/dialog.vue'
import { sysRoleQuery, sysRoleAdd, sysRoleEdit, sysRoleDelete, menuQuery, sysRoleMenu } from '@config/getData2.js'
export default {
components: {
jxDialog
},
data () {
return {
datalist: [{name: ''}, {name: 'a'}, {name: 'a'}, {name: ''}, {name: 'a'}, {name: 'a'}],
datalist: [],
active: false,
type: '',
title: '',
rolename: '',
remark: '',
tree: [{
id: '1',
label: '智能搬运车系统',
checked: false,
children: [{
id: '1-1',
label: '首页',
checked: false,
children: [{
id: '1-1-1',
label: '首页',
checked: false
}]
}, {
id: '1-2',
label: '任务管理',
checked: false,
children: [{
id: '1-2-1',
label: '搬运起点',
checked: false
}, {
id: '1-2-2',
label: '任务列表',
checked: false
}, {
id: '1-2-3',
label: '任务操作',
checked: false
}]
}, {
id: '1-3',
label: '故障管理',
checked: false,
children: [{
id: '1-3-1',
label: '故障处理',
checked: false
}]
}, {
id: '1-4',
label: '车辆信息',
checked: false,
children: [{
id: '1-4-1',
label: '车辆状态',
checked: false
}, {
id: '1-4-2',
label: '传感器状态',
checked: false
}, {
id: '1-4-3',
label: 'AGV',
checked: false
}, {
id: '1-5',
label: '示教',
checked: false,
children: [{
id: '1-5-1',
label: '地图',
checked: false
}, {
id: '1-5-2',
label: '绘制路线',
checked: false
}, {
id: '1-5-3',
label: '地图演示',
checked: false
}]
}, {
id: '1-6',
label: '系统管理',
checked: false,
children: [{
id: '1-6-1',
label: '用户管理',
checked: false
}, {
id: '1-6-2',
label: '角色管理',
checked: false
}, {
id: '1-6-3',
label: '系统参数',
checked: false
}, {
id: '1-6-4',
label: '开发者选项',
checked: false
}]
}]
}]
}]
tree: [],
defaultProps: {
children: 'children',
label: 'title'
},
pkObj: {},
unclick: false,
disabled: false
}
},
watch: {
@@ -232,34 +119,136 @@ export default {
default:
this.title = ''
}
},
rolename (val) {
if ((this.type === '1' || this.type === '2') && val === '') {
this.unclick = true
} else {
this.unclick = false
}
}
},
created () {
this._sysRoleQuery()
this._menuQuery()
},
methods: {
showDialog (type) {
async _sysRoleQuery () {
let res = await sysRoleQuery('0', '100')
this.datalist = [...res]
},
async _menuQuery () {
let res = await menuQuery()
this.tree = [...res]
},
showDialog (type, e) {
this.type = type
this.$refs.child.active = true
switch (type) {
case '1':
this.rolename = ''
this.remark = ''
this.unclick = true
break
case '2':
this.pkObj = e
this.rolename = e.name
this.remark = e.remark
if (this.rolename === '') {
this.unclick = true
} else {
this.unclick = false
}
break
case '3':
this.pkObj = e
this.unclick = false
break
}
},
toSureDialog (type) {
switch (type) {
case '1':
console.log(type)
this._sysRoleAdd()
break
case '2':
console.log(type)
this._sysRoleEdit()
break
case '3':
console.log(type)
this._sysRoleDelete()
break
default:
console.log(type)
}
},
toCheck (e, arr) {
arr.map(el => {
if (e.id === el.id) {
e.checked = !e.checked
async _sysRoleAdd () {
this.$refs.child.disabled = true
if (!this.rolename) {
this.toast('角色名称不能为空')
this.$refs.child.disabled = false
return
}
try {
await sysRoleAdd(this.rolename, this.remark)
this.toast('操作成功')
this._sysRoleQuery()
this.$refs.child.active = false
this.$refs.child.disabled = false
} catch (e) {
this.$refs.child.active = false
this.$refs.child.disabled = false
}
},
async _sysRoleEdit () {
this.$refs.child.disabled = true
if (!this.rolename) {
this.toast('角色名称不能为空')
this.$refs.child.disabled = false
return
}
try {
await sysRoleEdit(this.pkObj.roleId, this.rolename, this.remark)
this.toast('操作成功')
this._sysRoleQuery()
this.$refs.child.active = false
this.$refs.child.disabled = false
} catch (e) {
this.$refs.child.active = false
this.$refs.child.disabled = false
}
},
async _sysRoleDelete () {
this.$refs.child.disabled = true
try {
await sysRoleDelete([this.pkObj.roleId])
this.toast('操作成功')
this._sysRoleQuery()
this.$refs.child.active = false
this.$refs.child.disabled = false
} catch (e) {
this.$refs.child.active = false
this.$refs.child.disabled = false
}
},
async _sysRoleMenu (arr) {
this.disabled = true
try {
let res = await sysRoleMenu(arr)
if (res.code === '1') {
this.toast(res.desc)
} else {
this.toast(res.desc)
}
this.disabled = false
} catch (e) {
this.disabled = false
}
},
toSave () {
let arr = this.$refs.tree.getCheckedKeys()
let arr1 = []
arr.map(el => {
arr1.push({menuId: el})
})
this._sysRoleMenu(arr1)
}
}
}
@@ -282,7 +271,8 @@ export default {
_wh(calc(50% - 10px), 100%)
overflow-y auto
.tree_header
position relative
position sticky
top -1px
z-index 99
background #d7d7d7
_font(14px, 23px, #323232, bold, center)

View File

@@ -17,14 +17,14 @@
</tr>
<tr v-for="(e, i) in datalist" :key="i">
<td>{{i+1}}</td>
<td>platform</td>
<td>平台名称</td>
<td>智能搬运车系统</td>
<td></td>
<td>{{ e.code }}</td>
<td>{{ e.name }}</td>
<td>{{ e.value }}</td>
<td>{{ e.remark }}</td>
<td>
<div class="row">
<button class="button button--primary grid_button" @click="showDialog('2')">修改</button>
<button class="button button--primary grid_button" @click="showDialog('3')">删除</button>
<button class="button button--primary grid_button" @click="showDialog('2', e)">修改</button>
<button class="button button--primary grid_button" @click="showDialog('3', e)">删除</button>
</div>
</td>
</tr>
@@ -34,6 +34,7 @@
ref="child"
:title="title"
:type="type"
:unclick="unclick"
@toSure="toSureDialog"
>
<div v-if="type === '1' || type === '2'" class="form_wraper">
@@ -55,7 +56,7 @@
<div class="form_item">
<div class="form_item__label"><i>*</i>数值</div>
<div class="form_item__content">
<input type="text" class="form_item__input" v-model="number">
<input type="text" class="form_item__input" v-model="value">
</div>
</div>
</div>
@@ -75,20 +76,22 @@
<script>
import jxDialog from '@components/dialog.vue'
import { paramQuery, paramAdd, paramEdit, paramDelete } from '@config/getData2.js'
export default {
components: {
jxDialog
},
data () {
return {
datalist: [{name: ''}, {name: 'a'}, {name: 'a'}, {name: 'a'}, {name: 'a'}, {name: 'a'}, {name: 'a'}],
datalist: [],
active: false,
type: '',
title: '',
code: '',
name: '',
number: '',
remark: ''
value: '',
remark: '',
unclick: false
}
},
watch: {
@@ -106,26 +109,150 @@ export default {
default:
this.title = ''
}
},
code (val) {
if ((this.type === '1' || this.type === '2') && (val === '' || this.name === '' || this.value === '')) {
this.unclick = true
} else {
this.unclick = false
}
},
name (val) {
if ((this.type === '1' || this.type === '2') && (val === '' || this.code === '' || this.value === '')) {
this.unclick = true
} else {
this.unclick = false
}
},
value (val) {
if ((this.type === '1' || this.type === '2') && (val === '' || this.code === '' || this.name === '')) {
this.unclick = true
} else {
this.unclick = false
}
}
},
created () {
this._paramQuery()
},
methods: {
showDialog (type) {
async _paramQuery () {
let res = await paramQuery('0', '100')
this.datalist = [...res]
},
showDialog (type, e) {
this.type = type
this.$refs.child.active = true
switch (type) {
case '1':
this.code = ''
this.name = ''
this.value = ''
this.unclick = true
break
case '2':
this.code = e.code
this.name = e.name
this.value = e.value
if (!this.code || !this.name || !this.value) {
this.unclick = true
} else {
this.unclick = false
}
this.pkObj = e
break
case '3':
this.unclick = false
this.pkObj = e
break
}
},
toSureDialog (type) {
switch (type) {
case '1':
console.log(type)
this._paramAdd()
break
case '2':
console.log(type)
this._paramEdit()
break
case '3':
console.log(type)
this._paramDelete()
break
default:
console.log(type)
}
},
async _paramAdd () {
this.$refs.child.disabled = true
if (!this.code) {
this.toast('编码不能为空')
this.$refs.child.disabled = false
return
}
if (!this.name) {
this.toast('名字不能为空')
this.$refs.child.disabled = false
return
}
if (!this.value) {
this.toast('数值不能为空')
this.$refs.child.disabled = false
return
}
try {
let res = await paramAdd(this.code, this.name, this.value, this.remark)
if (res.code === '1') {
this._usersQuery()
}
this.toast(res.desc)
this.$refs.child.active = false
this.$refs.child.disabled = false
} catch (e) {
this.$refs.child.active = false
this.$refs.child.disabled = false
}
},
async _paramEdit () {
this.$refs.child.disabled = true
if (!this.code) {
this.toast('编码不能为空')
this.$refs.child.disabled = false
return
}
if (!this.name) {
this.toast('名字不能为空')
this.$refs.child.disabled = false
return
}
if (!this.value) {
this.toast('数值不能为空')
this.$refs.child.disabled = false
return
}
try {
let res = await paramEdit(this.pkObj.id, this.code, this.name, this.value, this.remark)
if (res.code === '1') {
this._usersQuery()
}
this.toast(res.desc)
this.$refs.child.active = false
this.$refs.child.disabled = false
} catch (e) {
this.$refs.child.active = false
this.$refs.child.disabled = false
}
},
async _paramDelete () {
this.$refs.child.disabled = true
try {
let res = await paramDelete([this.pkObj.id])
if (res.code === '1') {
this._usersQuery()
}
this.toast(res.desc)
this.$refs.child.active = false
this.$refs.child.disabled = false
} catch (e) {
this.$refs.child.active = false
this.$refs.child.disabled = false
}
}
}

View File

@@ -149,15 +149,18 @@ export default {
}
},
username (val) {
if (this.type === '1' && this.password !== '' && val !== '') {
this.unclick = false
}
if (this.type === '2' && val !== '') {
if (this.type === '1' && (this.password === '' || val === '')) {
this.unclick = true
} else if (this.type === '2' && val === '') {
this.unclick = true
} else {
this.unclick = false
}
},
password (val) {
if (this.type === '1' && this.password !== '' && val !== '') {
if (this.type === '1' && (this.password === '' || val === '')) {
this.unclick = true
} else {
this.unclick = false
}
}
@@ -199,8 +202,10 @@ export default {
this.value = el.roleId
}
})
if (this.username && this.password) {
if (this.username === '') {
this.unclick = true
} else {
this.unclick = false
}
break
case '3':

View File

@@ -356,69 +356,11 @@
padding 6px 12px
// tree
.tree
position: relative;
cursor: default;
background: #fff;
color: #606266;
.tree-node
white-space: nowrap;
outline: none;
.tree-node__content
display: flex;
align-items: center;
height: 26px;
cursor: pointer;
.icon_tree-node__expand
cursor: pointer;
color: #c0c4cc;
font-size: 12px;
transform: rotate(0deg);
transition: transform .3s ease-in-out;
padding: 6px;
&::before
content: '\e65b'
.icon_caret_right
transform rotate(-90deg)
.checkbox__input
color: #606266;
font-weight: 500;
font-size: 12px;
position: relative;
cursor: pointer;
display: inline-block;
white-space: nowrap;
user-select: none;
margin-right: 8px
cursor: pointer;
.icon_checkbox
white-space: nowrap;
cursor: pointer;
outline: none;
display: inline-block;
padding: 2px;
position: relative;
vertical-align: middle;
color #fff
border: 1px solid $green1
background-color: #fff;
border-radius 3px
&::before
content: '\E608'
.icon_checkbox_checked
.el-checkbox__inner:hover, .el-checkbox__input.is-focus .el-checkbox__inner
border-color $green1
.el-checkbox__input.is-checked .el-checkbox__inner, .el-checkbox__input.is-indeterminate .el-checkbox__inner
background-color $green1
.checkbox__original
opacity: 0;
outline: none;
position: absolute;
margin: 0;
width: 0;
height: 0;
z-index: -1;
.tree-node__label
font-size: 14px
.tree-node__children
overflow hidden
border-color $green1
//
.content_wrap