无设备处理
This commit is contained in:
@@ -1,9 +0,0 @@
|
||||
// 登录
|
||||
export interface LoginData {
|
||||
username: string
|
||||
password?: string
|
||||
imageCode?: string
|
||||
grant_type: string
|
||||
verifyCode?: number
|
||||
refresh_token?: string
|
||||
}
|
||||
@@ -23,8 +23,8 @@ export async function pwdSm3(pwd: any, loginName?: string) {
|
||||
let publicKey = await gongkey(
|
||||
loginName
|
||||
? {
|
||||
loginName: encrypt(loginName)
|
||||
}
|
||||
loginName: encrypt(loginName)
|
||||
}
|
||||
: false
|
||||
)
|
||||
let sm3Pwd = sm3Digest(pwd) //SM3加密
|
||||
@@ -32,7 +32,9 @@ export async function pwdSm3(pwd: any, loginName?: string) {
|
||||
}
|
||||
|
||||
//登录获取token
|
||||
export function login(params: LoginData) {
|
||||
export async function login(params: any) {
|
||||
params.password = await pwdSm3(params.password, params.username)
|
||||
params.username = encrypt(params.username)
|
||||
return request({
|
||||
url: '/pqs-auth/oauth/token',
|
||||
method: 'post',
|
||||
@@ -86,10 +88,9 @@ export function edit(data: any) {
|
||||
})
|
||||
}
|
||||
|
||||
export async function passwordConfirm(pwd: string, loginName: string = '') {
|
||||
console.log(pwd, loginName)
|
||||
export async function passwordConfirm(pwd: string) {
|
||||
return request({
|
||||
url: '/user-boot/user/passwordConfirm?password=' + (await pwdSm3(pwd, loginName)),
|
||||
url: '/user-boot/user/passwordConfirm?password=' + (await pwdSm3(pwd)),
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
@@ -126,7 +127,7 @@ export async function updateFirstPassword(params: any) {
|
||||
url: '/user-boot/user/updateFirstPassword',
|
||||
method: 'put',
|
||||
data: {
|
||||
name: params.name,
|
||||
name: encrypt(params.name),
|
||||
password: await pwdSm3(params.password, params.name)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -51,12 +51,16 @@ getDeviceTree().then(res => {
|
||||
})
|
||||
tree.value = res.data
|
||||
nextTick(() => {
|
||||
treRef.value.treeRef.setCurrentKey(arr[0].id)
|
||||
// 注册父组件事件
|
||||
emit('init', {
|
||||
level: 2,
|
||||
...arr[0]
|
||||
})
|
||||
if (arr.length) {
|
||||
treRef.value.treeRef.setCurrentKey(arr[0].id)
|
||||
// 注册父组件事件
|
||||
emit('init', {
|
||||
level: 2,
|
||||
...arr[0]
|
||||
})
|
||||
} else {
|
||||
emit('init')
|
||||
}
|
||||
})
|
||||
})
|
||||
const handleCheckChange = (data: any, checked: any, indeterminate: any) => {
|
||||
|
||||
@@ -37,12 +37,16 @@ getLineTree().then(res => {
|
||||
})
|
||||
tree.value = res.data
|
||||
nextTick(() => {
|
||||
treRef.value.treeRef.setCurrentKey(arr[0].id)
|
||||
// 注册父组件事件
|
||||
emit('init', {
|
||||
level: 2,
|
||||
...arr[0]
|
||||
})
|
||||
if (arr.length) {
|
||||
treRef.value.treeRef.setCurrentKey(arr[0].id)
|
||||
// 注册父组件事件
|
||||
emit('init', {
|
||||
level: 2,
|
||||
...arr[0]
|
||||
})
|
||||
} else {
|
||||
emit('init')
|
||||
}
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
<template>
|
||||
<el-dialog class='cn-operate-dialog' v-model='dialogVisible' :title='title'>
|
||||
<el-dialog class="cn-operate-dialog" v-model="dialogVisible" :title="title">
|
||||
<el-scrollbar>
|
||||
<el-form :inline='false' :model='form' label-width='120px' :rules='rules' ref='formRef'>
|
||||
<el-form-item label='校验密码:' prop='password'>
|
||||
<el-input v-model='form.password' type='password' placeholder='请输入校验密码' show-password />
|
||||
<el-form :inline="false" :model="form" label-width="120px" :rules="rules" ref="formRef">
|
||||
<el-form-item label="校验密码:" prop="password">
|
||||
<el-input v-model="form.password" type="password" placeholder="请输入校验密码" show-password />
|
||||
</el-form-item>
|
||||
<el-form-item label='新密码:' prop='newPwd' style='margin-top: 20px'>
|
||||
<el-input v-model='form.newPwd' type='password' placeholder='请输入新密码' show-password />
|
||||
<el-form-item label="新密码:" prop="newPwd" style="margin-top: 20px">
|
||||
<el-input v-model="form.newPwd" type="password" placeholder="请输入新密码" show-password />
|
||||
</el-form-item>
|
||||
<el-form-item label='确认密码:' prop='confirmPwd' style='margin-top: 20px'>
|
||||
<el-input v-model='form.confirmPwd' type='password' placeholder='请输入确认密码' show-password />
|
||||
<el-form-item label="确认密码:" prop="confirmPwd" style="margin-top: 20px">
|
||||
<el-input v-model="form.confirmPwd" type="password" placeholder="请输入确认密码" show-password />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-scrollbar>
|
||||
<template #footer>
|
||||
<span class='dialog-footer'>
|
||||
<el-button @click='dialogVisible = false'>取消</el-button>
|
||||
<el-button type='primary' @click='submit'>确认</el-button>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="submit">确认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script lang='ts' setup>
|
||||
<script lang="ts" setup>
|
||||
import { ref, inject } from 'vue'
|
||||
import { reactive } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
@@ -85,20 +85,22 @@ const rules = {
|
||||
|
||||
const open = () => {
|
||||
dialogVisible.value = true
|
||||
form.password = ''
|
||||
form.newPwd = ''
|
||||
form.confirmPwd = ''
|
||||
}
|
||||
const submit = () => {
|
||||
formRef.value.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
passwordConfirm(form.password)
|
||||
.then(res => {
|
||||
updatePassword({
|
||||
id: adminInfo.$state.userIndex,
|
||||
newPassword: form.newPwd
|
||||
}).then((res: any) => {
|
||||
ElMessage.success('密码修改成功')
|
||||
dialogVisible.value = false
|
||||
})
|
||||
passwordConfirm(form.password).then(res => {
|
||||
updatePassword({
|
||||
id: adminInfo.$state.userIndex,
|
||||
newPassword: form.newPwd
|
||||
}).then((res: any) => {
|
||||
ElMessage.success('密码修改成功')
|
||||
dialogVisible.value = false
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,46 +1,46 @@
|
||||
<template>
|
||||
<div class='default-main'>
|
||||
<div class="default-main">
|
||||
<TableHeader>
|
||||
<template v-slot:select>
|
||||
<el-form-item label='用户状态'>
|
||||
<el-select v-model='tableStore.table.params.searchState' placeholder='选择用户状态'>
|
||||
<el-form-item label="用户状态">
|
||||
<el-select v-model="tableStore.table.params.searchState" placeholder="选择用户状态">
|
||||
<el-option
|
||||
v-for='(item, index) in userState'
|
||||
:label='item.label'
|
||||
:key='index'
|
||||
:value='item.value'
|
||||
v-for="(item, index) in userState"
|
||||
:label="item.label"
|
||||
:key="index"
|
||||
:value="item.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label='用户类型:'>
|
||||
<el-select v-model='tableStore.table.params.casualUser' placeholder='选择用户类型'>
|
||||
<el-form-item label="用户类型:">
|
||||
<el-select v-model="tableStore.table.params.casualUser" placeholder="选择用户类型">
|
||||
<el-option
|
||||
v-for='(item, index) in casualUser'
|
||||
:label='item.label'
|
||||
:key='index'
|
||||
:value='item.value'
|
||||
v-for="(item, index) in casualUser"
|
||||
:label="item.label"
|
||||
:key="index"
|
||||
:value="item.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label='关键词:'>
|
||||
<el-form-item label="关键词:">
|
||||
<el-input
|
||||
style='width: 240px'
|
||||
v-model='tableStore.table.params.searchValue'
|
||||
style="width: 240px"
|
||||
v-model="tableStore.table.params.searchValue"
|
||||
clearable
|
||||
placeholder='仅根据用户名/登录名'
|
||||
placeholder="仅根据用户名/登录名"
|
||||
/>
|
||||
</el-form-item>
|
||||
</template>
|
||||
<template v-slot:operation>
|
||||
<el-button :icon='Plus' type='primary' @click='addUser'>添加</el-button>
|
||||
<el-button :icon="Plus" type="primary" @click="addUser">添加</el-button>
|
||||
</template>
|
||||
</TableHeader>
|
||||
<Table ref='tableRef' />
|
||||
<PopupEdit ref='popupEditRef'></PopupEdit>
|
||||
<PopupPwd ref='popupPwdRef'></PopupPwd>
|
||||
<Table ref="tableRef" />
|
||||
<PopupEdit ref="popupEditRef"></PopupEdit>
|
||||
<PopupPwd ref="popupPwdRef"></PopupPwd>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang='ts'>
|
||||
<script setup lang="ts">
|
||||
import { Plus } from '@element-plus/icons-vue'
|
||||
import { ref, onMounted, provide } from 'vue'
|
||||
import { ElMessageBox, ElMessage } from 'element-plus'
|
||||
@@ -119,7 +119,15 @@ const tableStore = new TableStore({
|
||||
return row.state !== 1
|
||||
},
|
||||
click: row => {
|
||||
popupPwdRef.value.open(row.id, row.loginName)
|
||||
ElMessageBox.prompt('二次校验密码确认', '注销用户', {
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消',
|
||||
inputType: 'password'
|
||||
}).then(({ value }) => {
|
||||
passwordConfirm(value).then(res => {
|
||||
popupPwdRef.value.open(row.id)
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -154,17 +162,16 @@ const tableStore = new TableStore({
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消',
|
||||
inputType: 'password'
|
||||
})
|
||||
.then(({ value }) => {
|
||||
passwordConfirm(value).then(res => {
|
||||
deluser({
|
||||
id: row.id
|
||||
}).then(() => {
|
||||
ElMessage.success('注销成功')
|
||||
tableStore.index()
|
||||
})
|
||||
}).then(({ value }) => {
|
||||
passwordConfirm(value).then(res => {
|
||||
deluser({
|
||||
id: row.id
|
||||
}).then(() => {
|
||||
ElMessage.success('注销成功')
|
||||
tableStore.index()
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -2,9 +2,6 @@
|
||||
<el-dialog class="cn-operate-dialog" v-model="dialogVisible" title="修改密码">
|
||||
<el-scrollbar>
|
||||
<el-form :inline="false" :model="form" label-width="120px" :rules="rules" ref="formRef">
|
||||
<el-form-item label="校验密码" prop="password">
|
||||
<el-input v-model="form.password" type="password" placeholder="请输入校验密码" show-password />
|
||||
</el-form-item>
|
||||
<el-form-item label="新密码" prop="newPwd">
|
||||
<el-input v-model="form.newPwd" type="password" placeholder="请输入新密码" show-password />
|
||||
</el-form-item>
|
||||
@@ -29,26 +26,17 @@ import TableStore from '@/utils/tableStore'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { validatePwd } from '@/utils/common'
|
||||
import { passwordConfirm, updatePassword } from '@/api/user-boot/user'
|
||||
import { debug } from 'console'
|
||||
|
||||
const formRef = ref()
|
||||
const tableStore = inject('tableStore') as TableStore
|
||||
const form = reactive({
|
||||
id: '',
|
||||
password: '',
|
||||
newPwd: '',
|
||||
confirmPwd: '',
|
||||
loginName: ''
|
||||
})
|
||||
const rules = {
|
||||
password: [
|
||||
{ required: true, message: '请输入校验密码', trigger: 'blur' },
|
||||
{
|
||||
min: 6,
|
||||
max: 16,
|
||||
message: '长度在 6 到 16 个字符',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
newPwd: [
|
||||
{ required: true, message: '请输入密码', trigger: 'blur' },
|
||||
{
|
||||
@@ -84,10 +72,9 @@ const rules = {
|
||||
}
|
||||
const dialogVisible = ref(false)
|
||||
const title = ref('新增菜单')
|
||||
const open = (id: string,loginName: string) => {
|
||||
const open = (id: string, loginName: string) => {
|
||||
form.id = id
|
||||
form.loginName = loginName
|
||||
form.password = ''
|
||||
form.newPwd = ''
|
||||
form.confirmPwd = ''
|
||||
dialogVisible.value = true
|
||||
@@ -95,14 +82,12 @@ const open = (id: string,loginName: string) => {
|
||||
const submit = async () => {
|
||||
formRef.value.validate((valid: boolean) => {
|
||||
if (valid) {
|
||||
passwordConfirm(form.password, form.loginName).then((res: any) => {
|
||||
updatePassword({
|
||||
id: form.id,
|
||||
newPassword: form.newPwd
|
||||
}).then((res: any) => {
|
||||
ElMessage.success('密码修改成功')
|
||||
dialogVisible.value = false
|
||||
})
|
||||
updatePassword({
|
||||
id: form.id,
|
||||
newPassword: form.newPwd
|
||||
}).then((res: any) => {
|
||||
ElMessage.success('密码修改成功')
|
||||
dialogVisible.value = false
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="default-main analyze-apf" :style="{ height: pageHeight.height }" v-loading="loading">
|
||||
<DeviceTree @node-click="nodeClick" @init="nodeClick"></DeviceTree>
|
||||
<div class="analyze-apf-right">
|
||||
<div class="analyze-apf-right" v-if="formInline.devId">
|
||||
<el-form :inline="true">
|
||||
<el-form-item label="统计指标:">
|
||||
<el-select v-model="formInline.statisticalId" filterable placeholder="请选择">
|
||||
@@ -30,7 +30,7 @@
|
||||
<el-button type="primary" @click="search" icon="el-icon-Search">查询</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<div style="display: flex;align-items: center;">
|
||||
<div style="display: flex; align-items: center">
|
||||
<Icon name="el-icon-InfoFilled" style="color: #ff9912"></Icon>
|
||||
总输出电流阈值和总输出电流比较
|
||||
</div>
|
||||
@@ -41,6 +41,7 @@
|
||||
<MyEchart :options="echartsData" style="flex: 1" />
|
||||
</template>
|
||||
</div>
|
||||
<el-empty v-else description="请选择设备" class="analyze-apf-right" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
<div class="default-main">
|
||||
<div class="analyze-dvr" v-show="view" :style="{ height: pageHeight.height }" v-loading="loading">
|
||||
<DeviceTree @node-click="nodeClick" @init="nodeClick"></DeviceTree>
|
||||
<div class="analyze-dvr-right">
|
||||
<div class="analyze-dvr-right" v-if="tableStore.table.params.deviceId">
|
||||
<Table v-if="view" ref="tableRef"></Table>
|
||||
</div>
|
||||
<el-empty v-else description="请选择设备" class="analyze-dvr-right" />
|
||||
</div>
|
||||
<div :style="{ height: pageHeight.height }" style="padding: 10px; overflow: hidden" v-if="!view">
|
||||
<el-row>
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
v-for="(item, index) in deviceData.dataSetList"
|
||||
:key="index"
|
||||
></el-tab-pane>
|
||||
<el-form :inline="true" style="white-space: nowrap;margin-top: 10px">
|
||||
<el-form :inline="true" style="white-space: nowrap; margin-top: 10px">
|
||||
<el-form-item label="指标">
|
||||
<el-input
|
||||
v-model="formInline.searchValue"
|
||||
@@ -130,6 +130,7 @@
|
||||
></el-pagination>
|
||||
</el-tabs>
|
||||
</div>
|
||||
<el-empty v-else description="请选择设备" class="device-control-right" />
|
||||
<Popup ref="popupRef" />
|
||||
</div>
|
||||
</template>
|
||||
@@ -173,11 +174,11 @@ const formInline = reactive({
|
||||
lineId: ''
|
||||
})
|
||||
const getDeviceDataTrend = (e: any) => {
|
||||
popupRef.value.open(e.name,{
|
||||
popupRef.value.open(e.name, {
|
||||
...e,
|
||||
lineId: formInline.lineId
|
||||
})
|
||||
}
|
||||
}
|
||||
const pageChange = (e: number) => {
|
||||
formInline.pageNum = e
|
||||
handleClick()
|
||||
@@ -188,6 +189,10 @@ const handleSizeChange = (val: number) => {
|
||||
handleClick()
|
||||
}
|
||||
const nodeClick = (e: anyObj) => {
|
||||
if (!e) {
|
||||
loading.value = false
|
||||
return
|
||||
}
|
||||
if (e.level == 3) {
|
||||
loading.value = true
|
||||
getDeviceData(e.pid, 'history', e.id).then((res: any) => {
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
</div>
|
||||
</el-tabs>
|
||||
</div>
|
||||
<el-empty v-else description="请选择设备" class="device-manage-right" />
|
||||
<MangePopup ref="mangePopup" />
|
||||
</div>
|
||||
</template>
|
||||
@@ -85,6 +86,10 @@ const tableData = ref([])
|
||||
const tableHeight = mainHeight(215).height
|
||||
const mangePopup = ref()
|
||||
const nodeClick = (e: anyObj) => {
|
||||
if (!e) {
|
||||
loading.value = false
|
||||
return
|
||||
}
|
||||
if (e.level == 2) {
|
||||
loading.value = true
|
||||
getDeviceData(e.id, 'rt').then((res: any) => {
|
||||
|
||||
@@ -66,8 +66,6 @@
|
||||
<script setup lang="ts">
|
||||
import { onMounted, onBeforeUnmount, reactive, ref, nextTick } from 'vue'
|
||||
import * as pageBubble from '@/utils/pageBubble'
|
||||
import { sm3Digest } from '@/assets/commjs/sm3.js'
|
||||
import { sm2, encrypt } from '@/assets/commjs/sm2.js'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { gongkey, login } from '@/api/user-boot/user'
|
||||
import { useAdminInfo } from '@/stores/adminInfo'
|
||||
@@ -76,6 +74,7 @@ import { useRouter } from 'vue-router'
|
||||
import { ADMIN_INFO } from '@/stores/constant/cacheKey'
|
||||
import { Local } from '@/utils/storage'
|
||||
import PopupUpdatePwd from './popupUpdatePwd.vue'
|
||||
import { encrypt } from '@/assets/commjs/sm2.js';
|
||||
|
||||
const router = useRouter()
|
||||
let timer: number
|
||||
@@ -131,31 +130,25 @@ const onSubmit = async (formEl: FormInstance | undefined) => {
|
||||
await formEl.validate((valid, fields) => {
|
||||
if (valid) {
|
||||
state.submitLoading = true
|
||||
const loginName = encrypt(form.username)
|
||||
gongkey({ loginName }).then(res => {
|
||||
window.localStorage.setItem('publicKey', res.data)
|
||||
let jiamipassword = sm2(sm3Digest(form.password) + '|' + form.password, res.data, 0)
|
||||
login({
|
||||
username: loginName,
|
||||
password: jiamipassword,
|
||||
grant_type: 'captcha',
|
||||
imageCode: '',
|
||||
verifyCode: 0
|
||||
})
|
||||
.then(res => {
|
||||
res.data.loginName = loginName
|
||||
userInfo.dataFill(res.data)
|
||||
state.submitLoading = false
|
||||
router.push({
|
||||
path: '/'
|
||||
})
|
||||
})
|
||||
.catch(err => {
|
||||
if (err.code === 'A0101') {
|
||||
popupUpdatePwdRef.value.open(loginName)
|
||||
}
|
||||
})
|
||||
login({
|
||||
username: form.username,
|
||||
password: form.password,
|
||||
grant_type: 'captcha',
|
||||
imageCode: '',
|
||||
verifyCode: 0
|
||||
})
|
||||
.then(res => {
|
||||
userInfo.dataFill(res.data)
|
||||
state.submitLoading = false
|
||||
router.push({
|
||||
path: '/'
|
||||
})
|
||||
})
|
||||
.catch(err => {
|
||||
if (err.code === 'A0101' && err.message === '登录认证,密码失效,请重置') {
|
||||
popupUpdatePwdRef.value.open(form.username)
|
||||
}
|
||||
})
|
||||
setTimeout(() => {
|
||||
state.submitLoading = false
|
||||
}, 500)
|
||||
|
||||
@@ -27,8 +27,6 @@ import { validatePwd } from '@/utils/common'
|
||||
import { useAdminInfo } from '@/stores/adminInfo'
|
||||
import { useRouter } from 'vue-router'
|
||||
|
||||
const router = useRouter()
|
||||
const adminInfo = useAdminInfo()
|
||||
const dialogVisible = ref(false)
|
||||
const title = ref('修改默认密码')
|
||||
const formRef = ref()
|
||||
|
||||
Reference in New Issue
Block a user