feat(web): 新增预测管理和策略表单功能

- 添加预测管理页面和相关组件
- 实现策略表单组件,支持创建和编辑策略
- 优化表格组件,增加分页和数据加载功能
- 调整视频监控组件布局
- 修复部分组件样式问题
This commit is contained in:
zhoumengru
2025-09-04 13:42:48 +08:00
parent 6d6d05e18f
commit 5f5eeb1cbf
22 changed files with 1548 additions and 312 deletions

View File

@@ -10,9 +10,9 @@
<div class="main-title">能源站监控与运行管理系统</div>
<div class="login-content">
<div class="title" style="">账号登录</div>
<a-form ref="ruleForm" :model="form" :rules="rules">
<a-form-item label="" name="user">
<a-input v-model:value="form.user" placeholder="请输入账号" autocomplete>
<a-form ref="ruleForm" :model="form" :rules="rules" >
<a-form-item label="" name="account">
<a-input v-model:value="form.account" placeholder="请输入账号" autocomplete>
<template #prefix>
<user-outlined />
</template>
@@ -39,7 +39,7 @@
</template>
<script>
import { UserOutlined, LockOutlined } from '@ant-design/icons-vue'
import { postReq,getReq } from '@/request/api.js'
export default {
name: 'LoginView',
components: {
@@ -49,11 +49,11 @@ export default {
data() {
return {
form: {
user: 'admin',
account: 'admin',
passwd: '123456'
},
rules: {
user: [
account: [
{
required: true,
message: '请输入账号'
@@ -71,27 +71,30 @@ export default {
},
methods: {
async login() {
this.$refs.ruleForm.validate(async (valid) => {
if (valid) {
this.loading = true
try {
const res = await this.$http.post('/login', this.form)
this.loading = false
if (res.code === 200) {
this.$message.success('登录成功')
localStorage.setItem('token', res.token)
this.$router.push('/main')
} else {
this.$message.error(res.message || '登录失败')
}
} catch (error) {
this.loading = false
this.$message.error('请求失败,请稍后重试')
}
} else {
// console.log("表单验证失败");
}
})
try {
const values = await this.$refs.ruleForm.validateFields()
const res = await getReq('/login',this.form )
this.loading = false
console.log(res);
// if (res.code === 200) {
this.$message.success('登录成功')
localStorage.setItem('token', res.token)
this.$router.push('/')
// } else {
// this.$message.error(res.message || '登录失败')
// }
} catch (error) {
console.log(error);
this.loading = false
this.$message.error('请求失败,请稍后重试')
}
}
}
}