Commit f473041e by 温丽香

总览页面修改

1 parent 75081ef8
Pipeline #4714 passed
in 2 minutes 2 seconds
......@@ -31,3 +31,6 @@ export const getApp = data => axios(GET, FRONT + APPID + '/query_list', data)
export const deleteApp = data => axios(GET, FRONT + APPID + '/delete', data)
export const setApp = data => axios(GET, FRONT + APPID + '/set', data)
export const addApp = data => axios(POST, FRONT + APPID + '/add', data)
const ACCOUNt = '/account'
export const getAccount = data => axios(GET, FRONT + ACCOUNt + '/query', data)
......@@ -16,7 +16,7 @@
</ul>
<template v-slot:reference>
<span class="user-info flex right">
<span v-if="userData.info">{{ userData.info.creater }}</span>
<span>{{ name }}</span>
<i class="iconfont icon-mianxingxiala"
:class="{
'expand': showInfo,
......@@ -32,6 +32,7 @@ import { getUser, removeUser } from '@/utils/user'
import { logoutApi } from '@/axios'
import Dialog from '@/helpers/dialog'
import seetaPopover from '@/components/seeta-ui/seeta-popover.vue'
import browserStorage from '@/services/local-storage'
@Component({
components: {
......@@ -40,7 +41,9 @@ import seetaPopover from '@/components/seeta-ui/seeta-popover.vue'
})
export default class userInfo extends Vue {
showInfo: boolean = false
get name() {
return browserStorage.getItem('nickname') || browserStorage.getItem('username')
}
get userData() { return getUser() }
get shouldConfirmBeforeLeave(): boolean {
......
......@@ -6,11 +6,11 @@
<div class="page-nav">
<div class="search-fields">
<span class="fields">用户名:</span>
<st-input width="240px" class="align contents" id="align-input" v-model="userName"></st-input>
<st-input width="240px" class="align contents" id="align-input" v-model="nickname" @input="getData"></st-input>
<!-- <input type="text" id="raw-input" autocomplete="off" class="align contents" :style="{borderColor: borderColor}" placeholder="请输入" @blur="getData" v-model.trim="deviceName" @keyup.enter="getData" @input="checkSearchContent"> -->
<span class="fields">用户角色:</span>
<st-select
v-model="userRole"
v-model="role"
:options="userRoleOptions"
size="small"
style="width: 240px"
......@@ -66,32 +66,30 @@
ref="form"
:model="form"
:rules="rules">
<st-form-item
:label="'账号:'">
<st-form-item :label="'账号:'" prop="username">
<st-input v-model="form.username" :disabled="submitType === 'edit'"></st-input>
</st-form-item>
<st-form-item
:label="'角色:'">
<st-input v-model="form.role"></st-input>
:label="'昵称:'" prop="nickname">
<st-input v-model="form.nickname"></st-input>
</st-form-item>
<st-form-item
:label="'邮箱:'">
<st-form-item :label="'角色:'" prop="role">
<st-select v-model="form.role" :options="userRoleOptions" clearable>
</st-select>
</st-form-item>
<st-form-item :label="'邮箱:'" prop="email">
<st-input v-model="form.email"></st-input>
</st-form-item>
<st-form-item v-if="submitType === 'create'"
:label="'初始密码:'">
<st-form-item v-if="submitType === 'create'" :label="'初始密码:'" prop="passwd">
<st-input v-model="form.passwd" type="password"></st-input>
</st-form-item>
<st-form-item v-if="submitType === 'create'"
:label="'重复密码:'">
<st-form-item v-if="submitType === 'create'" :label="'重复密码:'" prop="confirmPwd">
<st-input v-model="form.confirmPwd" type="password"></st-input>
</st-form-item>
<st-form-item v-if="submitType === 'edit'"
:label="'原密码:'">
<st-form-item v-if="submitType === 'edit'" :label="'原密码:'" prop="passwordd">
<st-input v-model="form.passwordd" type="password"></st-input>
</st-form-item>
<st-form-item v-if="submitType === 'edit'"
:label="'新密码:'">
<st-form-item v-if="submitType === 'edit'" :label="'新密码:'" prop="new_passwordd">
<st-input v-model="form.new_passwordd" type="password"></st-input>
</st-form-item>
</st-form>
......@@ -122,16 +120,16 @@ export default {
}
return {
// 查询字段
userName: '',
userRole: '',
nickname: '',
role: '',
created_at: [],
showDialog: false,
submitType: 'create',
form: {},
userRoleOptions: [
{ value: '管理员', label: '管理员' },
{ value: '操作员', label: '操作员' },
{ value: '观察员', label: '观察员' },
{ value: 'admin', label: '管理员' },
{ value: 'operator', label: '操作员' },
{ value: 'watcher', label: '观察员' },
],
currentPage: 1,
currentSize: 10,
......@@ -159,7 +157,9 @@ export default {
},
{
label: '备注',
render: 'desc'
render: () => {
return '-'
}
},
{
label: '操作',
......@@ -171,7 +171,11 @@ export default {
tokenList: [],
total: 0,
rules: { // 表单校验
passwordConfirmation: [
username: [{ required: true, message: '请输入账号', trigger: 'blur' }],
nickname: [{ required: true, message: '请输入昵称', trigger: 'blur' }],
role: [{ required: true, message: '请选择角色', trigger: 'change' }],
passwd: [{ required: true, message: '请输入密码', trigger: 'blur' }],
confirmPwd: [
{ required: true, message: '请确认密码', trigger: 'blur' },
{ validator: validatePasswordConfirmation, trigger: 'blur' }
]
......@@ -254,7 +258,7 @@ export default {
},
async getData() {
this.loadingStatus = true
const res = await getUsers({ pages: this.currentPage - 1, pagesize: this.currentSize })
const res = await getUsers({ pages: this.currentPage - 1, pagesize: this.currentSize, nickname: this.nickname, role: this.role, begin_date: this.created_at ? this.created_at[0] : '', end_date: this.created_at ? this.created_at[1] : '' })
if (res && res.data && res.data.code === 0) {
this.tokenList = res.data.data.users
this.total = res.data.data.total
......@@ -276,6 +280,12 @@ export default {
::v-deep.el-form-item__content
height: 32px!important
line-height: 32px!important
::v-deep input
&::placeholder
font-size: 14px
font-family: PingFangSC-Regular, PingFang SC
font-weight: 400
color:#999999
.search-fields
::v-deep input
&::placeholder
......
......@@ -8,8 +8,8 @@
<st-button type="primary" @click="addTableData">
<i class="iconfont icon-tianjia"></i><span class="text">{{'插入数据'}}</span></st-button>
<div class="search-box">
<el-checkbox v-model="isBase64">Base64</el-checkbox>
<st-select
<!-- <el-checkbox v-model="isBase64">Base64</el-checkbox> -->
<!-- <st-select
v-model="inputVal"
:options="orderOptions"
size="small"
......@@ -17,9 +17,9 @@
clearable
placeholder="序号"
>
</st-select>
</st-select> -->
<div class="search">
<input type="text" class="search-input" placeholder="请输入搜索内容" v-model="inputVal">
<input type="text" class="search-input" placeholder="请输入搜索内容" v-model="content" @input="getData">
<i class="el-input__icon el-icon-search"></i>
</div>
</div>
......@@ -95,7 +95,7 @@ import { base64ToString, stringToBase64, isASCII } from '@/utils/typeConversion'
export default {
data() {
return {
inputVal: '',
content: '',
isBase64: false,
loadingStatus: false,
totalColumns: 0,
......@@ -134,7 +134,7 @@ export default {
methods: {
async getData() {
this.loadingStatus = true
const res = await getData({ name: this.$route.query.name, pages: this.currentPage - 1, pagesize: this.currentSize })
const res = await getData({ name: this.$route.query.name, pages: this.currentPage - 1, pagesize: this.currentSize, content: this.content })
if (res && res.data && res.data.code === 0) {
this.tableData = res.data.table.data.map(item => {
item.binary = item.binary.map(base64 => {
......@@ -388,6 +388,7 @@ export default {
width: 240px
height: 32px
position: relative
margin-left: 10px
.search-input
width: 100%
padding-right: 35px
......
......@@ -29,12 +29,12 @@
<st-form-item
style="margin-bottom:10px"
:label="'账户'+':'">
<span>{{userData.role}}</span>
<span>{{userData.username}}</span>
</st-form-item>
<st-form-item
style="margin-bottom:10px"
:label="'姓名'+':'">
<span>{{userData.creater}}</span><span class="btn-text" @click="showDialog = true;type = 'name'">编辑</span>
<span>{{userData.nickname}}</span><span class="btn-text" @click="showDialog = true;type = 'name';form = JSON.parse(JSON.stringify(userData))">编辑</span>
</st-form-item>
<st-form-item
style="margin-bottom:10px"
......@@ -63,8 +63,8 @@
<st-form-item v-if="type === 'email'" :label="'邮箱:'" prop="email">
<st-input v-model="form.email"></st-input>
</st-form-item>
<st-form-item v-if="type === 'name'" :label="'姓名:'" prop="name">
<st-input v-model="form.name"></st-input>
<st-form-item v-if="type === 'name'" :label="'姓名:'" prop="nickname">
<st-input v-model="form.nickname"></st-input>
</st-form-item>
<div v-if="type === 'password'">
<st-form-item :label="'当前密码:'" prop="password">
......@@ -123,7 +123,7 @@ export default {
newPwd: '',
confirmPwd: '',
rules: {
name: [
nickname: [
{ required: true, message: '请输入姓名' }
],
email: [
......@@ -147,6 +147,8 @@ export default {
},
mounted() {
this.userData = getUser().info
this.userData.username = browserStorage.getItem('username')
this.userData.nickname = browserStorage.getItem('nickname')
this.imageList = [{ url: browserStorage.getItem('image') }]
this.userData.email = browserStorage.getItem('email')
},
......@@ -156,16 +158,21 @@ export default {
if (valid) {
let res = {}
switch (this.type) {
case 'name': res = await editUser({ username: 'test', new_username: this.form.name, password: this.form.password })
case 'name': res = await editUser({ username: browserStorage.getItem('username'), nickname: this.form.nickname })
if (res && res.data && res.data.code === 0) {
browserStorage.setItem('nickname', this.form.nickname)
this.userData.nickname = browserStorage.getItem('nickname')
Toast.success('操作成功')
}
break
case 'email': res = await editUser({ username: 'test', email: this.form.email })
case 'email': res = await editUser({ username: browserStorage.getItem('username'), email: this.form.email })
if (res && res.data && res.data.code === 0) {
browserStorage.setItem('email', this.form.email)
this.userData.email = browserStorage.getItem('email')
Toast.success('操作成功')
}
break
case 'password': res = await editUser({ username: 'test', password: this.form.password, new_password: this.form.newPwd })
case 'password': res = await editUser({ username: browserStorage.getItem('username'), password: this.form.password, new_password: this.form.newPwd })
if (res && res.data && res.data.code === 0) {
Toast.success('操作成功')
}
......@@ -173,9 +180,9 @@ export default {
default:
break
}
this.showDialog = false
}
})
this.showDialog = false
},
fileToBase64(file) {
return new Promise((resolve, reject) => {
......@@ -198,7 +205,7 @@ export default {
return
}
const base64 = await this.fileToBase64(file.raw)
const res = await editUser({ username: 'test', image: base64 })
const res = await editUser({ username: browserStorage.getItem('username'), image: base64 })
if (res && res.data && res.data.code === 0) {
browserStorage.setItem('image', base64)
this.imageList[0].url = base64
......@@ -208,7 +215,7 @@ export default {
},
async handleRemove(file, fileList) {
this.imageList = []
const res = await editUser({ username: 'test', image: '' })
const res = await editUser({ username: browserStorage.getItem('username'), image: '' })
if (res && res.data && res.data.code === 0) {
browserStorage.setItem('image', '')
} else {
......
......@@ -295,6 +295,8 @@ export default {
browserStorage.setItem('user', JSON.stringify(res.data))
browserStorage.setItem('image', res.data.image)
browserStorage.setItem('email', res.data.email)
browserStorage.setItem('nickname', res.data.nickname)
browserStorage.setItem('username', this.userName)
this.$router.push({ path: '/overview' })
} else {
Toast.danger(res.data.msg)
......
......@@ -12,40 +12,23 @@
</template>
<script>
import { getApp } from '@/axios'
import { getApp, getAccount } from '@/axios'
import * as echarts from 'echarts'
export default {
data() {
return {
applyInfo: {},
option: {
tooltip: {
trigger: 'item'
},
series: [
{
name: '设备状态',
type: 'pie',
radius: ['40%', '70%'],
avoidLabelOverlap: true,
labelLine: {
show: true
},
data: [
{ value: 580, name: '在线' },
{ value: 235, name: '离线' },
{ value: 100, name: '异常' },
]
}
]
}
devicesInfo: {},
myChart: null,
option: {}
}
},
mounted() {
const chartDom = document.getElementById('main')
const myChart = echarts.init(chartDom)
myChart.setOption(this.option)
this.myChart = echarts.init(chartDom)
this.getApply()
this.getAccount()
this.repint()
},
methods: {
async getApply() {
......@@ -54,6 +37,40 @@ export default {
this.applyInfo = res.data.data.apps.filter(item => item.ismainapp === 1)[0]
}
},
repint() {
window.onresize = () => {
setTimeout(() => {
this.myChart.resize()
}, 10)
}
},
async getAccount() {
const res = await getAccount()
if (res && res.data && res.data.code === 0) {
this.devicesInfo = res.data
this.myChart.setOption({
tooltip: {
trigger: 'item'
},
series: [
{
name: '设备状态',
type: 'pie',
radius: ['40%', '70%'],
avoidLabelOverlap: true,
labelLine: {
show: true
},
data: [
{ value: res.data.onlines, name: '在线' },
{ value: res.data.offlines, name: '离线' },
{ value: res.data.exceptions, name: '异常' },
]
}
]
})
}
}
}
}
</script>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!