调整代码
This commit is contained in:
@@ -23,7 +23,7 @@ const prop = defineProps({
|
||||
const dictData = useDictData()
|
||||
const fontdveoption = dictData.getBasicData('Dev_Ops')
|
||||
|
||||
const tableStore = new TableStore({
|
||||
const tableStore:any = new TableStore({
|
||||
url: '/device-boot/pqsTerminalLogs/getList',
|
||||
method: 'POST',
|
||||
column: [
|
||||
|
||||
@@ -399,7 +399,7 @@ const handleCurrentChange = (val: number) => {
|
||||
const exportEvent = () => {
|
||||
const allFilteredData = filteredData.value
|
||||
tableRef.value.exportData({
|
||||
filename: '场战级评估-污染值报告',
|
||||
filename: '场站级评估-污染值报告',
|
||||
sheetName: 'Sheet1',
|
||||
type: 'xlsx',
|
||||
useStyle: true,
|
||||
|
||||
@@ -652,7 +652,7 @@ const initRadioCharts = () => {
|
||||
echartsData1.value.options.series[i].center = ['50%', '50%']
|
||||
}
|
||||
}
|
||||
const initEcharts = (color: string, key: number) => {
|
||||
const initEcharts = (color: string, key: number, name: string) => {
|
||||
return {
|
||||
options: {
|
||||
tooltip: {},
|
||||
@@ -731,7 +731,7 @@ const initEcharts = (color: string, key: number) => {
|
||||
data: [
|
||||
{
|
||||
value: 0,
|
||||
name: 'A相',
|
||||
name: name,
|
||||
itemStyle: {
|
||||
color: color
|
||||
}
|
||||
@@ -744,14 +744,14 @@ const initEcharts = (color: string, key: number) => {
|
||||
}
|
||||
//渲染echarts
|
||||
const init = () => {
|
||||
const url = (localStorage.getItem('WebSocketUrl') || 'ws://192.168.1.68:10407/api/pushMessage/')
|
||||
echartsDataV1.value = initEcharts('#DAA520', 0)
|
||||
echartsDataV2.value = initEcharts('#2E8B57', 0)
|
||||
echartsDataV3.value = initEcharts('#A52a2a', 0)
|
||||
const url = localStorage.getItem('WebSocketUrl') || 'ws://192.168.1.68:10407/api/pushMessage/'
|
||||
echartsDataV1.value = initEcharts('#DAA520', 0, 'A相')
|
||||
echartsDataV2.value = initEcharts('#2E8B57', 0, 'B相')
|
||||
echartsDataV3.value = initEcharts('#A52a2a', 0, 'C相')
|
||||
|
||||
echartsDataA1.value = initEcharts('#DAA520', 1)
|
||||
echartsDataA2.value = initEcharts('#2E8B57', 1)
|
||||
echartsDataA3.value = initEcharts('#A52a2a', 1)
|
||||
echartsDataA1.value = initEcharts('#DAA520', 1, 'A相')
|
||||
echartsDataA2.value = initEcharts('#2E8B57', 1, 'B相')
|
||||
echartsDataA3.value = initEcharts('#A52a2a', 1, 'C相')
|
||||
|
||||
if (!dataSocket.socketServe) {
|
||||
console.error('WebSocket 客户端实例不存在')
|
||||
@@ -764,9 +764,7 @@ const url = (localStorage.getItem('WebSocketUrl') || 'ws://192.168.1.68:10407/ap
|
||||
})
|
||||
}
|
||||
let pids = monitoringPoint.state.pid.split(',')
|
||||
dataSocket.socketServe.connect(
|
||||
`${url}${adminInfo.id},${monitoringPoint.state.lineId},${pids[pids.length - 2]}`
|
||||
)
|
||||
dataSocket.socketServe.connect(`${url}${adminInfo.id},${monitoringPoint.state.lineId},${pids[pids.length - 2]}`)
|
||||
dataSocket.socketServe.registerCallBack('message', (res: any) => {
|
||||
txtContent.value = res.value
|
||||
let data = JSON.parse(res.value)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,170 +1,172 @@
|
||||
<template>
|
||||
<div class="default-main" :style="height">
|
||||
<splitpanes style="height: 100%" class="default-theme" id="navigation-splitpanes">
|
||||
<pane :size="size">
|
||||
<PointTree
|
||||
v-if="showTree"
|
||||
:default-expand-all="false"
|
||||
@node-click="handleNodeClick"
|
||||
@init="handleNodeClick"
|
||||
></PointTree>
|
||||
</pane>
|
||||
<pane style="background: #fff" :style="height">
|
||||
<TableHeader ref="TableHeaderRef" datePicker @selectChange="selectChange">
|
||||
<template v-slot:select>
|
||||
<el-form-item label="模板策略">
|
||||
<el-select v-model="Template" @change="changetype" placeholder="请选择模版" value-key="id">
|
||||
<el-option
|
||||
v-for="item in templatePolicy"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="报表类型">
|
||||
<el-input readonly type="text" value="分析报表"></el-input>
|
||||
<!-- <el-select-->
|
||||
<!-- :disabled="true"-->
|
||||
<!-- v-model="reportForm"-->
|
||||
<!-- :popper-append-to-body="false"-->
|
||||
<!-- placeholder="请选择报表类型"-->
|
||||
<!-- >-->
|
||||
<!-- <el-option-->
|
||||
<!-- v-for="item in reportFormList"-->
|
||||
<!-- :key="item.value"-->
|
||||
<!-- :label="item.label"-->
|
||||
<!-- :value="item.value"-->
|
||||
<!-- ></el-option>-->
|
||||
<!-- </el-select>-->
|
||||
</el-form-item>
|
||||
</template>
|
||||
<template #operation>
|
||||
<el-button icon="el-icon-Download" type="primary" @click="exportEvent">导出excel</el-button>
|
||||
</template>
|
||||
</TableHeader>
|
||||
<div class="box">
|
||||
<div id="luckysheet" :style="`height: calc(${tableStore.table.height} + 45px)`"></div>
|
||||
</div>
|
||||
</pane>
|
||||
</splitpanes>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref, provide } from 'vue'
|
||||
import 'splitpanes/dist/splitpanes.css'
|
||||
import { Splitpanes, Pane } from 'splitpanes'
|
||||
import TableStore from '@/utils/tableStore'
|
||||
import PointTree from '@/components/tree/pqs/pointTree.vue'
|
||||
import TableHeader from '@/components/table/header/index.vue'
|
||||
import { useDictData } from '@/stores/dictData'
|
||||
import { mainHeight } from '@/utils/layout'
|
||||
import { getTemplateByDept } from '@/api/harmonic-boot/luckyexcel'
|
||||
import { exportExcel } from '@/views/system/reportForms/export.js'
|
||||
|
||||
defineOptions({
|
||||
name: 'harmonic-boot/xieboReport'
|
||||
})
|
||||
const showTree = ref(false)
|
||||
const height = mainHeight(20)
|
||||
const size = ref(0)
|
||||
const dictData = useDictData()
|
||||
const TableHeaderRef = ref()
|
||||
const dotList: any = ref({})
|
||||
const Template: any = ref({})
|
||||
const reportForm: any = ref('')
|
||||
|
||||
const templatePolicy: any = ref([])
|
||||
const reportFormList: any = ref([
|
||||
{
|
||||
value: '1',
|
||||
label: '分析报表'
|
||||
},
|
||||
{
|
||||
value: '2',
|
||||
label: '统计报表'
|
||||
},
|
||||
{
|
||||
value: '3',
|
||||
label: '自定义报表'
|
||||
}
|
||||
])
|
||||
const tableStore = new TableStore({
|
||||
url: '/harmonic-boot/customReport/getCustomReport',
|
||||
method: 'POST',
|
||||
column: [],
|
||||
beforeSearchFun: () => {
|
||||
tableStore.table.params.tempId = Template.value.id
|
||||
tableStore.table.params.lineId = dotList.value.id
|
||||
},
|
||||
loadCallback: () => {
|
||||
tableStore.table.data.forEach((item: any) => {
|
||||
item.data1 ? (item.data = JSON.parse(item.data1)) : ''
|
||||
item.celldata.forEach((k: any) => {
|
||||
item.data[k.r][k.c].v ? (item.data[k.r][k.c] = k.v) : ''
|
||||
})
|
||||
})
|
||||
console.log(tableStore.table.data)
|
||||
setTimeout(() => {
|
||||
luckysheet.create({
|
||||
container: 'luckysheet',
|
||||
title: '', // 表 头名
|
||||
lang: 'zh', // 中文
|
||||
showtoolbar: false, // 是否显示工具栏
|
||||
showinfobar: false, // 是否显示顶部信息栏
|
||||
showsheetbar: true, // 是否显示底部sheet按钮
|
||||
data: tableStore.table.data
|
||||
})
|
||||
}, 10)
|
||||
}
|
||||
})
|
||||
provide('tableStore', tableStore)
|
||||
|
||||
onMounted(() => {
|
||||
const dom = document.getElementById('navigation-splitpanes')
|
||||
if (dom) {
|
||||
size.value = Math.round((180 / dom.offsetHeight) * 100)
|
||||
}
|
||||
})
|
||||
getTemplateByDept({ id: dictData.state.area[0].id })
|
||||
.then((res: any) => {
|
||||
templatePolicy.value = res.data
|
||||
Template.value = res.data[0]
|
||||
reportForm.value = res.data[0]?.reportForm
|
||||
showTree.value = true
|
||||
})
|
||||
.catch((err: any) => {
|
||||
showTree.value = true
|
||||
})
|
||||
const changetype = (val: any) => {
|
||||
reportForm.value = val.reportForm
|
||||
}
|
||||
const selectChange = () => {
|
||||
console.log('🚀 ~ selectChange ~ tableStore.table.data.lnegth :', tableStore.table.data.length)
|
||||
if (tableStore.table.data.length != 0) {
|
||||
setTimeout(() => {
|
||||
luckysheet && luckysheet?.resize()
|
||||
}, 10)
|
||||
}
|
||||
}
|
||||
|
||||
const handleNodeClick = (data: any, node: any) => {
|
||||
if (data.level == 6) {
|
||||
dotList.value = data
|
||||
tableStore.index()
|
||||
}
|
||||
}
|
||||
|
||||
const exportEvent = () => {
|
||||
exportExcel(luckysheet.getAllSheets(), '统计报表下载')
|
||||
}
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.splitpanes.default-theme .splitpanes__pane {
|
||||
background: #eaeef1;
|
||||
}
|
||||
|
||||
.box {
|
||||
padding: 10px;
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<div class="default-main" :style="height">
|
||||
<splitpanes style="height: 100%" class="default-theme" id="navigation-splitpanes">
|
||||
<pane :size="size">
|
||||
<PointTree
|
||||
v-if="showTree"
|
||||
:default-expand-all="false"
|
||||
@node-click="handleNodeClick"
|
||||
@init="handleNodeClick"
|
||||
></PointTree>
|
||||
</pane>
|
||||
<pane style="background: #fff" :style="height">
|
||||
<TableHeader ref="TableHeaderRef" datePicker @selectChange="selectChange">
|
||||
<template v-slot:select>
|
||||
<el-form-item label="模板策略">
|
||||
<el-select v-model="Template" @change="changetype" placeholder="请选择模版" value-key="id">
|
||||
<el-option
|
||||
v-for="item in templatePolicy"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="报表类型">
|
||||
<el-input readonly type="text" value="分析报表"></el-input>
|
||||
<!-- <el-select-->
|
||||
<!-- :disabled="true"-->
|
||||
<!-- v-model="reportForm"-->
|
||||
<!-- :popper-append-to-body="false"-->
|
||||
<!-- placeholder="请选择报表类型"-->
|
||||
<!-- >-->
|
||||
<!-- <el-option-->
|
||||
<!-- v-for="item in reportFormList"-->
|
||||
<!-- :key="item.value"-->
|
||||
<!-- :label="item.label"-->
|
||||
<!-- :value="item.value"-->
|
||||
<!-- ></el-option>-->
|
||||
<!-- </el-select>-->
|
||||
</el-form-item>
|
||||
</template>
|
||||
<template #operation>
|
||||
<el-button icon="el-icon-Download" type="primary" @click="exportEvent">导出excel</el-button>
|
||||
</template>
|
||||
</TableHeader>
|
||||
<div class="box">
|
||||
<div id="luckysheet" :style="`height: calc(${tableStore.table.height} + 45px)`"></div>
|
||||
</div>
|
||||
</pane>
|
||||
</splitpanes>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref, provide } from 'vue'
|
||||
import 'splitpanes/dist/splitpanes.css'
|
||||
import { Splitpanes, Pane } from 'splitpanes'
|
||||
import TableStore from '@/utils/tableStore'
|
||||
import PointTree from '@/components/tree/pqs/pointTree.vue'
|
||||
import TableHeader from '@/components/table/header/index.vue'
|
||||
import { useDictData } from '@/stores/dictData'
|
||||
import { mainHeight } from '@/utils/layout'
|
||||
import { getTemplateByDept } from '@/api/harmonic-boot/luckyexcel'
|
||||
import { exportExcel } from '@/views/system/reportForms/export.js'
|
||||
|
||||
defineOptions({
|
||||
name: 'harmonic-boot/xieboReport'
|
||||
})
|
||||
const showTree = ref(false)
|
||||
const height = mainHeight(20)
|
||||
const size = ref(0)
|
||||
const dictData = useDictData()
|
||||
const TableHeaderRef = ref()
|
||||
const dotList: any = ref({})
|
||||
const Template: any = ref({})
|
||||
const reportForm: any = ref('')
|
||||
|
||||
const templatePolicy: any = ref([])
|
||||
const reportFormList: any = ref([
|
||||
{
|
||||
value: '1',
|
||||
label: '分析报表'
|
||||
},
|
||||
{
|
||||
value: '2',
|
||||
label: '统计报表'
|
||||
},
|
||||
{
|
||||
value: '3',
|
||||
label: '自定义报表'
|
||||
}
|
||||
])
|
||||
const tableStore = new TableStore({
|
||||
url: '/harmonic-boot/customReport/getCustomReport',
|
||||
method: 'POST',
|
||||
column: [],
|
||||
beforeSearchFun: () => {
|
||||
tableStore.table.params.tempId = Template.value.id
|
||||
tableStore.table.params.lineId = dotList.value.id
|
||||
},
|
||||
loadCallback: () => {
|
||||
tableStore.table.data.forEach((item: any) => {
|
||||
item.data1 ? (item.data = JSON.parse(item.data1)) : ''
|
||||
item.celldata.forEach((k: any) => {
|
||||
item.data[k.r][k.c].v ? (item.data[k.r][k.c] = k.v) : ''
|
||||
})
|
||||
})
|
||||
console.log(tableStore.table.data)
|
||||
setTimeout(() => {
|
||||
luckysheet.create({
|
||||
container: 'luckysheet',
|
||||
title: '', // 表 头名
|
||||
lang: 'zh', // 中文
|
||||
showtoolbar: false, // 是否显示工具栏
|
||||
showinfobar: false, // 是否显示顶部信息栏
|
||||
showsheetbar: true, // 是否显示底部sheet按钮
|
||||
allowEdit: false, // 禁止所有编辑操作(必填)
|
||||
data: tableStore.table.data
|
||||
})
|
||||
}, 10)
|
||||
}
|
||||
})
|
||||
provide('tableStore', tableStore)
|
||||
|
||||
onMounted(() => {
|
||||
const dom = document.getElementById('navigation-splitpanes')
|
||||
if (dom) {
|
||||
size.value = Math.round((180 / dom.offsetHeight) * 100)
|
||||
}
|
||||
})
|
||||
getTemplateByDept({ id: dictData.state.area[0].id })
|
||||
.then((res: any) => {
|
||||
templatePolicy.value = res.data
|
||||
Template.value = res.data[0]
|
||||
reportForm.value = res.data[0]?.reportForm
|
||||
showTree.value = true
|
||||
})
|
||||
.catch((err: any) => {
|
||||
showTree.value = true
|
||||
})
|
||||
const changetype = (val: any) => {
|
||||
reportForm.value = val.reportForm
|
||||
}
|
||||
const selectChange = () => {
|
||||
console.log('🚀 ~ selectChange ~ tableStore.table.data.lnegth :', tableStore.table.data.length)
|
||||
if (tableStore.table.data.length != 0) {
|
||||
setTimeout(() => {
|
||||
luckysheet && luckysheet?.resize()
|
||||
}, 10)
|
||||
}
|
||||
}
|
||||
|
||||
const handleNodeClick = (data: any, node: any) => {
|
||||
if (data.level == 6) {
|
||||
dotList.value = data
|
||||
tableStore.index()
|
||||
}
|
||||
}
|
||||
|
||||
const exportEvent = () => {
|
||||
exportExcel(luckysheet.getAllSheets(), '统计报表下载')
|
||||
}
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.splitpanes.default-theme .splitpanes__pane {
|
||||
background: #eaeef1;
|
||||
}
|
||||
|
||||
.box {
|
||||
padding: 10px;
|
||||
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,338 +1,338 @@
|
||||
<template>
|
||||
<div @keyup.enter="onSubmit(formRef)">
|
||||
<div @contextmenu.stop="" id="bubble" class="bubble">
|
||||
<canvas id="bubble-canvas" class="bubble-canvas"></canvas>
|
||||
</div>
|
||||
<div class="login-image"></div>
|
||||
<div class="login-container-form">
|
||||
<div class="title-container">
|
||||
<div class="title">
|
||||
<span style="font-size: 28px">{{ getThemeList.name || '电能质量监测系统' }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<el-form :rules="rules" ref="formRef" size="large" class="login-form" :model="form">
|
||||
<el-form-item prop="username">
|
||||
<el-input
|
||||
ref="usernameRef"
|
||||
v-model="form.username"
|
||||
type="text"
|
||||
clearable
|
||||
placeholder="用户名"
|
||||
autocomplete="off"
|
||||
>
|
||||
<template #prefix>
|
||||
<!-- <span class="iconfont icon-yonghu" style="color: var(--el-color-primary)"></span> -->
|
||||
<Icon name="fa fa-user" style="color: var(--el-color-primary); font-size: 16px" />
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="password">
|
||||
<el-input
|
||||
ref="passwordRef"
|
||||
v-model="form.password"
|
||||
type="password"
|
||||
placeholder="密码"
|
||||
autocomplete="off"
|
||||
>
|
||||
<template #prefix>
|
||||
<Icon name="local-password" style="color: var(--el-color-primary); font-size: 16px" />
|
||||
<!-- <span class="iconfont icon-mima" style="color: var(--el-color-primary)"></span> -->
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button
|
||||
:loading="state.submitLoading"
|
||||
class="submit-btn"
|
||||
round
|
||||
type="info"
|
||||
@click="onSubmit(formRef)"
|
||||
>
|
||||
登录
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<!-- <div class="copy-right">
|
||||
<span>版权所有 @ 南京灿能电力自动化股份有限公司</span>
|
||||
<br />
|
||||
<img style="width: 20px; height: 20px; position: absolute" src="@/assets/login/jhui.png" />
|
||||
|
||||
<span> 苏公网安备 32011502011902号</span>
|
||||
</div> -->
|
||||
<PopupUpdatePwd ref="popupUpdatePwdRef"></PopupUpdatePwd>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, onBeforeUnmount, reactive, ref, nextTick } from 'vue'
|
||||
import * as pageBubble from '@/utils/pageBubble'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { gongkey, login,getSysConfig } from '@/api/user-boot/user'
|
||||
import { useAdminInfo } from '@/stores/adminInfo'
|
||||
import type { FormInstance, InputInstance, FormRules } from 'element-plus'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { ADMIN_INFO } from '@/stores/constant/cacheKey'
|
||||
import { Local } from '@/utils/storage'
|
||||
import { getTheme } from '@/api/systerm'
|
||||
import { useConfig } from '@/stores/config'
|
||||
import PopupUpdatePwd from './popupUpdatePwd.vue'
|
||||
|
||||
const router = useRouter()
|
||||
let timer: number
|
||||
const configStore = useConfig()
|
||||
const popupUpdatePwdRef = ref()
|
||||
const formRef = ref<FormInstance>()
|
||||
const usernameRef = ref<InputInstance>()
|
||||
const passwordRef = ref<InputInstance>()
|
||||
const userInfo = useAdminInfo()
|
||||
Local.remove(ADMIN_INFO)
|
||||
userInfo.removeToken()
|
||||
const getThemeList: any = ref([])
|
||||
interface RuleForm {
|
||||
username: string
|
||||
password: string
|
||||
}
|
||||
|
||||
const state = reactive({
|
||||
showCaptcha: false,
|
||||
submitLoading: false
|
||||
})
|
||||
const form = reactive({
|
||||
username: '',
|
||||
password: ''
|
||||
})
|
||||
|
||||
const rules = reactive<FormRules<RuleForm>>({
|
||||
username: [{ required: true, trigger: 'blur', message: '请输入用户名' }],
|
||||
password: [{ required: true, trigger: 'blur', message: '请输入密码' }]
|
||||
})
|
||||
|
||||
const focusInput = () => {
|
||||
if (form.username === '') {
|
||||
usernameRef.value!.focus()
|
||||
} else if (form.password === '') {
|
||||
passwordRef.value!.focus()
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
timer = window.setTimeout(() => {
|
||||
pageBubble.init()
|
||||
}, 0)
|
||||
})
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
clearTimeout(timer)
|
||||
pageBubble.removeListeners()
|
||||
})
|
||||
getTheme().then(res => {
|
||||
document.title = res.data.name || '电能质量在线监测系统'
|
||||
|
||||
let list: any = [
|
||||
'elementUiPrimary',
|
||||
'tableHeaderBackground',
|
||||
'tableHeaderColor',
|
||||
'tableCurrent',
|
||||
'menuBackground',
|
||||
'menuColor',
|
||||
'menuTopBarBackground',
|
||||
'menuActiveBackground',
|
||||
'menuActiveColor',
|
||||
'headerBarTabColor',
|
||||
'headerBarBackground'
|
||||
]
|
||||
getThemeList.value = res.data
|
||||
window.localStorage.setItem('getTheme', JSON.stringify(res.data))
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
configStore.setLayout(list[i], JSON.parse(res.data[list[i]]))
|
||||
}
|
||||
configStore.setLayout('elementUiPrimary', JSON.parse(res.data['elementUiPrimary']))
|
||||
})
|
||||
const onSubmit = async (formEl: FormInstance | undefined) => {
|
||||
if (!formEl) return
|
||||
await formEl.validate((valid, fields) => {
|
||||
if (valid) {
|
||||
state.submitLoading = true
|
||||
login({
|
||||
username: form.username,
|
||||
password: form.password,
|
||||
grant_type: 'captcha',
|
||||
imageCode: '',
|
||||
verifyCode: 0
|
||||
})
|
||||
.then(res => {
|
||||
userInfo.dataFill(res.data)
|
||||
state.submitLoading = false
|
||||
getSysConfig().then(res => {
|
||||
window.localStorage.setItem('sysdata', JSON.stringify(res.data))
|
||||
})
|
||||
router.push({
|
||||
path: '/'
|
||||
})
|
||||
})
|
||||
.catch(err => {
|
||||
if (err.code === 'A0101' && err.message === '登录认证,密码失效,请重置') {
|
||||
popupUpdatePwdRef.value.open(form.username)
|
||||
}
|
||||
})
|
||||
setTimeout(() => {
|
||||
state.submitLoading = false
|
||||
}, 500)
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.bubble {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
min-height: 100%;
|
||||
overflow: hidden;
|
||||
background-color: var(--el-color-primary) !important;
|
||||
background-position: center 110px;
|
||||
background-repeat: repeat;
|
||||
background-size: 100%;
|
||||
background-image: url(https://gw.alipayobjects.com/zos/rmsportal/TVYTbAXWheQpRcWDaDMu.svg);
|
||||
}
|
||||
|
||||
.login-image {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 20%;
|
||||
min-width: 45%;
|
||||
min-height: 80%;
|
||||
|
||||
background: url('../../assets/login/login2.png') no-repeat center center;
|
||||
background-size: contain;
|
||||
transform: translate(-15%, -50%);
|
||||
// box-shadow: 0 0 0 #011b2bab;
|
||||
}
|
||||
|
||||
.form-item-icon {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.login-container-form {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 85%;
|
||||
width: 500px;
|
||||
height: auto;
|
||||
border-radius: 30px;
|
||||
transform: translate(-85%, -50%);
|
||||
box-shadow: 3px 3px 2px 2px #011b2bab;
|
||||
|
||||
.title-container {
|
||||
position: relative;
|
||||
width: 398px;
|
||||
max-width: 100%;
|
||||
padding: 20px 0 0;
|
||||
margin: 0 auto;
|
||||
|
||||
.title {
|
||||
margin-bottom: 20px;
|
||||
font-size: 33px;
|
||||
font-weight: 600;
|
||||
color: rgba(255, 255, 255, 0.85);
|
||||
text-align: center;
|
||||
|
||||
& :v-deep .svg-icon {
|
||||
// color: $;
|
||||
}
|
||||
|
||||
.logo {
|
||||
width: 46px;
|
||||
height: 46px;
|
||||
margin-right: 10px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.login-form {
|
||||
position: relative;
|
||||
width: 368px;
|
||||
max-width: 100%;
|
||||
//padding: 20px 0 0;
|
||||
margin: 0 auto;
|
||||
margin-bottom: 20px;
|
||||
overflow: hidden;
|
||||
|
||||
&.el-input {
|
||||
input {
|
||||
height: 40px;
|
||||
padding-right: 40px;
|
||||
padding-left: 40px;
|
||||
line-height: 40px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.el-input__prefix,
|
||||
.el-input__suffix {
|
||||
width: 40px;
|
||||
line-height: 40px;
|
||||
|
||||
.svg-icon {
|
||||
font-size: 16px;
|
||||
vertical-align: -0.25em;
|
||||
}
|
||||
}
|
||||
|
||||
.el-input__prefix {
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.el-input__suffix {
|
||||
right: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.copy-right {
|
||||
position: absolute;
|
||||
bottom: 10px;
|
||||
width: 100%;
|
||||
font-size: 14px;
|
||||
color: rgb(233, 229, 229);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
:v-deep.el-form-item--large {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.submit-btn {
|
||||
width: 100%;
|
||||
margin-top: 0px;
|
||||
margin-bottom: 20px;
|
||||
background: var(--el-color-primary-light-3);
|
||||
// background: #009688;
|
||||
//background: #4d6ea1;
|
||||
border-radius: 0;
|
||||
&:hover {
|
||||
background: var(--el-color-primary-light-5);
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 720px) {
|
||||
.login {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
.login-box {
|
||||
width: 340px;
|
||||
margin-top: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-height: 800px) {
|
||||
.login .login-box {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<div @keyup.enter="onSubmit(formRef)">
|
||||
<div @contextmenu.stop="" id="bubble" class="bubble">
|
||||
<canvas id="bubble-canvas" class="bubble-canvas"></canvas>
|
||||
</div>
|
||||
<div class="login-image"></div>
|
||||
<div class="login-container-form">
|
||||
<div class="title-container">
|
||||
<div class="title">
|
||||
<span style="font-size: 28px">{{ getThemeList.name || '电能质量监测系统' }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<el-form :rules="rules" ref="formRef" size="large" class="login-form" :model="form">
|
||||
<el-form-item prop="username">
|
||||
<el-input
|
||||
ref="usernameRef"
|
||||
v-model="form.username"
|
||||
type="text"
|
||||
clearable
|
||||
placeholder="用户名"
|
||||
autocomplete="off"
|
||||
>
|
||||
<template #prefix>
|
||||
<!-- <span class="iconfont icon-yonghu" style="color: var(--el-color-primary)"></span> -->
|
||||
<Icon name="fa fa-user" style="color: var(--el-color-primary); font-size: 16px" />
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="password">
|
||||
<el-input
|
||||
ref="passwordRef"
|
||||
v-model="form.password"
|
||||
type="password"
|
||||
placeholder="密码"
|
||||
autocomplete="off"
|
||||
>
|
||||
<template #prefix>
|
||||
<Icon name="local-password" style="color: var(--el-color-primary); font-size: 16px" />
|
||||
<!-- <span class="iconfont icon-mima" style="color: var(--el-color-primary)"></span> -->
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button
|
||||
:loading="state.submitLoading"
|
||||
class="submit-btn"
|
||||
round
|
||||
type="info"
|
||||
@click="onSubmit(formRef)"
|
||||
>
|
||||
登录
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<!-- <div class="copy-right">
|
||||
<span>版权所有 @ 南京灿能电力自动化股份有限公司</span>
|
||||
<br />
|
||||
<img style="width: 20px; height: 20px; position: absolute" src="@/assets/login/jhui.png" />
|
||||
|
||||
<span> 苏公网安备 32011502011902号</span>
|
||||
</div> -->
|
||||
<PopupUpdatePwd ref="popupUpdatePwdRef"></PopupUpdatePwd>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, onBeforeUnmount, reactive, ref, nextTick } from 'vue'
|
||||
import * as pageBubble from '@/utils/pageBubble'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { gongkey, login,getSysConfig } from '@/api/user-boot/user'
|
||||
import { useAdminInfo } from '@/stores/adminInfo'
|
||||
import type { FormInstance, InputInstance, FormRules } from 'element-plus'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { ADMIN_INFO } from '@/stores/constant/cacheKey'
|
||||
import { Local } from '@/utils/storage'
|
||||
import { getTheme } from '@/api/systerm'
|
||||
import { useConfig } from '@/stores/config'
|
||||
import PopupUpdatePwd from './popupUpdatePwd.vue'
|
||||
|
||||
const router = useRouter()
|
||||
let timer: number
|
||||
const configStore = useConfig()
|
||||
const popupUpdatePwdRef = ref()
|
||||
const formRef = ref<FormInstance>()
|
||||
const usernameRef = ref<InputInstance>()
|
||||
const passwordRef = ref<InputInstance>()
|
||||
const userInfo = useAdminInfo()
|
||||
Local.remove(ADMIN_INFO)
|
||||
userInfo.removeToken()
|
||||
const getThemeList: any = ref([])
|
||||
interface RuleForm {
|
||||
username: string
|
||||
password: string
|
||||
}
|
||||
|
||||
const state = reactive({
|
||||
showCaptcha: false,
|
||||
submitLoading: false
|
||||
})
|
||||
const form = reactive({
|
||||
username: '',
|
||||
password: ''
|
||||
})
|
||||
|
||||
const rules = reactive<FormRules<RuleForm>>({
|
||||
username: [{ required: true, trigger: 'blur', message: '请输入用户名' }],
|
||||
password: [{ required: true, trigger: 'blur', message: '请输入密码' }]
|
||||
})
|
||||
|
||||
const focusInput = () => {
|
||||
if (form.username === '') {
|
||||
usernameRef.value!.focus()
|
||||
} else if (form.password === '') {
|
||||
passwordRef.value!.focus()
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
timer = window.setTimeout(() => {
|
||||
pageBubble.init()
|
||||
}, 0)
|
||||
})
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
clearTimeout(timer)
|
||||
pageBubble.removeListeners()
|
||||
})
|
||||
getTheme().then(res => {
|
||||
document.title = res.data.name || '电能质量在线监测系统'
|
||||
|
||||
let list: any = [
|
||||
'elementUiPrimary',
|
||||
'tableHeaderBackground',
|
||||
'tableHeaderColor',
|
||||
'tableCurrent',
|
||||
'menuBackground',
|
||||
'menuColor',
|
||||
'menuTopBarBackground',
|
||||
'menuActiveBackground',
|
||||
'menuActiveColor',
|
||||
'headerBarTabColor',
|
||||
'headerBarBackground'
|
||||
]
|
||||
getThemeList.value = res.data
|
||||
window.localStorage.setItem('getTheme', JSON.stringify(res.data))
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
configStore.setLayout(list[i], JSON.parse(res.data[list[i]]))
|
||||
}
|
||||
configStore.setLayout('elementUiPrimary', JSON.parse(res.data['elementUiPrimary']))
|
||||
})
|
||||
const onSubmit = async (formEl: FormInstance | undefined) => {
|
||||
if (!formEl) return
|
||||
await formEl.validate((valid, fields) => {
|
||||
if (valid) {
|
||||
state.submitLoading = true
|
||||
login({
|
||||
username: form.username,
|
||||
password: form.password,
|
||||
grant_type: 'captcha',
|
||||
imageCode: '',
|
||||
verifyCode: 0
|
||||
})
|
||||
.then(res => {
|
||||
userInfo.dataFill(res.data)
|
||||
state.submitLoading = false
|
||||
getSysConfig().then(res => {
|
||||
window.localStorage.setItem('sysdata', JSON.stringify(res.data))
|
||||
})
|
||||
router.push({
|
||||
path: '/'
|
||||
})
|
||||
})
|
||||
.catch(err => {
|
||||
if (err.code === 'A0101' && err.message === '登录认证,密码失效,请重置') {
|
||||
popupUpdatePwdRef.value.open(form.username)
|
||||
}
|
||||
})
|
||||
setTimeout(() => {
|
||||
state.submitLoading = false
|
||||
}, 500)
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.bubble {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
min-height: 100%;
|
||||
overflow: hidden;
|
||||
background-color: var(--el-color-primary) !important;
|
||||
background-position: center 110px;
|
||||
background-repeat: repeat;
|
||||
background-size: 100%;
|
||||
background-image: url(https://gw.alipayobjects.com/zos/rmsportal/TVYTbAXWheQpRcWDaDMu.svg);
|
||||
}
|
||||
|
||||
.login-image {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 20%;
|
||||
min-width: 45%;
|
||||
min-height: 80%;
|
||||
|
||||
background: url('../../assets/login/login2.png') no-repeat center center;
|
||||
background-size: contain;
|
||||
transform: translate(-15%, -50%);
|
||||
// box-shadow: 0 0 0 #011b2bab;
|
||||
}
|
||||
|
||||
.form-item-icon {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.login-container-form {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 85%;
|
||||
width: 500px;
|
||||
height: auto;
|
||||
border-radius: 30px;
|
||||
transform: translate(-85%, -50%);
|
||||
box-shadow: 3px 3px 2px 2px #011b2bab;
|
||||
|
||||
.title-container {
|
||||
position: relative;
|
||||
width: 398px;
|
||||
max-width: 100%;
|
||||
padding: 20px 0 0;
|
||||
margin: 0 auto;
|
||||
|
||||
.title {
|
||||
margin-bottom: 20px;
|
||||
font-size: 33px;
|
||||
font-weight: 600;
|
||||
color: rgba(255, 255, 255, 0.85);
|
||||
text-align: center;
|
||||
|
||||
& :v-deep .svg-icon {
|
||||
// color: $;
|
||||
}
|
||||
|
||||
.logo {
|
||||
width: 46px;
|
||||
height: 46px;
|
||||
margin-right: 10px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.login-form {
|
||||
position: relative;
|
||||
width: 368px;
|
||||
max-width: 100%;
|
||||
//padding: 20px 0 0;
|
||||
margin: 0 auto;
|
||||
margin-bottom: 20px;
|
||||
overflow: hidden;
|
||||
|
||||
&.el-input {
|
||||
input {
|
||||
height: 40px;
|
||||
padding-right: 40px;
|
||||
padding-left: 40px;
|
||||
line-height: 40px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.el-input__prefix,
|
||||
.el-input__suffix {
|
||||
width: 40px;
|
||||
line-height: 40px;
|
||||
|
||||
.svg-icon {
|
||||
font-size: 16px;
|
||||
vertical-align: -0.25em;
|
||||
}
|
||||
}
|
||||
|
||||
.el-input__prefix {
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.el-input__suffix {
|
||||
right: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.copy-right {
|
||||
position: absolute;
|
||||
bottom: 10px;
|
||||
width: 100%;
|
||||
font-size: 14px;
|
||||
color: rgb(233, 229, 229);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
:v-deep.el-form-item--large {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.submit-btn {
|
||||
width: 100%;
|
||||
margin-top: 0px;
|
||||
margin-bottom: 20px;
|
||||
background: var(--el-color-primary-light-3);
|
||||
// background: #009688;
|
||||
//background: #4d6ea1;
|
||||
border-radius: 0;
|
||||
&:hover {
|
||||
background: var(--el-color-primary-light-5);
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 720px) {
|
||||
.login {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
.login-box {
|
||||
width: 340px;
|
||||
margin-top: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-height: 800px) {
|
||||
.login .login-box {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user