chore: 从 git 中移除 backend/target 目录
- 使用 git rm --cached 从版本控制中删除 target 目录 - .gitignore 已配置忽略 target 和 node_modules - 本地文件保留,仅从 git 索引中删除 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
934b8aad40
commit
ea8f8390da
99 files changed
+3551
-724
No files matched your search
@@ -15,3 +15,13 @@ export const getUserInfo = () => {
|
||||
export const logout = () => {
|
||||
return http.post('/auth/logout')
|
||||
}
|
||||
|
||||
// 修改密码
|
||||
export const changePassword = (data: { oldPassword: string; newPassword: string }) => {
|
||||
return http.post('/auth/change-password', data)
|
||||
}
|
||||
|
||||
// 重置密码(管理员功能)
|
||||
export const resetPassword = (data: { userId: number; newPassword: string }) => {
|
||||
return http.post('/auth/reset-password', data)
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export interface DashboardStatistics {
|
||||
customerCount: number
|
||||
reportCount: number
|
||||
pendingCount: number
|
||||
dealerCount: number
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取首页统计数据
|
||||
*/
|
||||
export function getStatistics() {
|
||||
return request<DashboardStatistics>({
|
||||
url: '/dashboard/statistics',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
import { http } from '@/utils/request'
|
||||
|
||||
// 学校接口类型定义
|
||||
export interface School {
|
||||
id?: number
|
||||
schoolCode: string
|
||||
schoolName: string
|
||||
location?: string
|
||||
createdAt?: string
|
||||
updatedAt?: string
|
||||
}
|
||||
|
||||
// 根据名称搜索学校(用于自动完成)
|
||||
export const searchSchoolByName = (keyword: string) => {
|
||||
return http.get<School[]>('/school/search', { params: { keyword } })
|
||||
}
|
||||
|
||||
// 查询所有学校
|
||||
export const getAllSchools = () => {
|
||||
return http.get<School[]>('/school/list')
|
||||
}
|
||||
|
||||
// 创建学校
|
||||
export const createSchool = (data: Omit<School, 'id' | 'createdAt' | 'updatedAt'>) => {
|
||||
return http.post<number>('/school', data)
|
||||
}
|
||||
|
||||
// 批量导入学校
|
||||
export const batchImportSchools = (data: School[]) => {
|
||||
return http.post<number>('/school/batch', data)
|
||||
}
|
||||
|
||||
// 从Excel文件导入学校数据
|
||||
export const importSchoolsFromExcel = (file: File) => {
|
||||
const formData = new FormData()
|
||||
formData.append('file', file)
|
||||
return http.post<number>('/school/import', formData, {
|
||||
headers: { 'Content-Type': 'multipart/form-data' }
|
||||
})
|
||||
}
|
||||
|
||||
// 从项目docs目录导入学校数据
|
||||
export const importSchoolsFromDocs = () => {
|
||||
return http.post<number>('/school/import-from-docs')
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
import type { SystemConfig } from '@/types'
|
||||
|
||||
/**
|
||||
* 获取所有系统配置(管理员)
|
||||
*/
|
||||
export function getAllConfigs() {
|
||||
return request<SystemConfig[]>({
|
||||
url: '/system/config',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定配置值
|
||||
*/
|
||||
export function getConfigValue(configKey: string) {
|
||||
return request<string>({
|
||||
url: `/system/config/value/${configKey}`,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新配置
|
||||
*/
|
||||
export function updateConfig(configKey: string, configValue: string) {
|
||||
return request({
|
||||
url: '/system/config',
|
||||
method: 'put',
|
||||
data: { configKey, configValue }
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量更新配置
|
||||
*/
|
||||
export function batchUpdateConfigs(configs: Record<string, string>) {
|
||||
return request({
|
||||
url: '/system/config/batch',
|
||||
method: 'put',
|
||||
data: configs
|
||||
})
|
||||
}
|
||||
@@ -37,6 +37,12 @@ const routes: RouteRecordRaw[] = [
|
||||
name: 'Dealer',
|
||||
component: () => import('@/views/Dealer.vue'),
|
||||
meta: { title: '经销商管理', requiresAdmin: true }
|
||||
},
|
||||
{
|
||||
path: 'system-config',
|
||||
name: 'SystemConfig',
|
||||
component: () => import('@/views/SystemConfig.vue'),
|
||||
meta: { title: '系统配置', requiresAdmin: true }
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -27,6 +27,9 @@ export interface Customer {
|
||||
industry?: string
|
||||
status: number
|
||||
statusDesc: string
|
||||
currentDealerId?: number
|
||||
currentDealerName?: string
|
||||
protectEndDate?: string
|
||||
createdAt: string
|
||||
updatedAt: string
|
||||
}
|
||||
@@ -47,6 +50,7 @@ export interface Dealer {
|
||||
contactPhone: string
|
||||
email?: string
|
||||
status: number
|
||||
userId: number // 关联的用户ID,用于重置密码
|
||||
createdAt: string
|
||||
updatedAt: string
|
||||
}
|
||||
@@ -99,3 +103,16 @@ export interface DictItem {
|
||||
label: string
|
||||
value: string | number
|
||||
}
|
||||
|
||||
// 系统配置相关类型
|
||||
export interface SystemConfig {
|
||||
id: number
|
||||
configKey: string
|
||||
configValue: string
|
||||
configLabel: string
|
||||
configType: 'string' | 'integer' | 'boolean'
|
||||
description?: string
|
||||
isEditable: number
|
||||
createdAt: string
|
||||
updatedAt: string
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
* 密码加密工具
|
||||
* 使用 Web Crypto API 进行 SHA-256 哈希
|
||||
*/
|
||||
|
||||
/**
|
||||
* 将字符串转换为 ArrayBuffer
|
||||
*/
|
||||
function stringToArrayBuffer(str: string): ArrayBuffer {
|
||||
const encoder = new TextEncoder()
|
||||
return encoder.encode(str).buffer
|
||||
}
|
||||
|
||||
/**
|
||||
* 将 ArrayBuffer 转换为十六进制字符串
|
||||
*/
|
||||
function arrayBufferToHex(buffer: ArrayBuffer): string {
|
||||
const bytes = new Uint8Array(buffer)
|
||||
return Array.from(bytes)
|
||||
.map(b => b.toString(16).padStart(2, '0'))
|
||||
.join('')
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用 SHA-256 算法哈希密码
|
||||
* @param password 明文密码
|
||||
* @returns 哈希后的十六进制字符串
|
||||
*/
|
||||
export async function hashPassword(password: string): Promise<string> {
|
||||
if (!password) return ''
|
||||
|
||||
try {
|
||||
// 使用 Web Crypto API 进行 SHA-256 哈希
|
||||
const data = stringToArrayBuffer(password)
|
||||
const hashBuffer = await crypto.subtle.digest('SHA-256', data)
|
||||
return arrayBufferToHex(hashBuffer)
|
||||
} catch (error) {
|
||||
console.error('密码哈希失败:', error)
|
||||
throw new Error('密码加密失败')
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 简单的加盐哈希(可选,用于增强安全性)
|
||||
* @param password 明文密码
|
||||
* @param salt 盐值
|
||||
* @returns 哈希后的十六进制字符串
|
||||
*/
|
||||
export async function hashPasswordWithSalt(password: string, salt: string): Promise<string> {
|
||||
if (!password) return ''
|
||||
|
||||
try {
|
||||
const saltedPassword = password + salt
|
||||
const data = stringToArrayBuffer(saltedPassword)
|
||||
const hashBuffer = await crypto.subtle.digest('SHA-256', data)
|
||||
return arrayBufferToHex(hashBuffer)
|
||||
} catch (error) {
|
||||
console.error('密码哈希失败:', error)
|
||||
throw new Error('密码加密失败')
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
import * as bcrypt from 'bcryptjs'
|
||||
|
||||
/**
|
||||
* 密码加密工具
|
||||
* 注意:BCrypt 每次加密相同密码会产生不同的哈希值(因为有随机盐)
|
||||
* 这是正常的行为,后端使用 BCrypt.matches() 方法来验证密码
|
||||
*/
|
||||
|
||||
/**
|
||||
* 生成密码的 BCrypt 哈希值(用于注册或修改密码)
|
||||
* @param password 原始密码
|
||||
* @returns BCrypt 哈希值
|
||||
*/
|
||||
export function hashPassword(password: string): string {
|
||||
const salt = bcrypt.genSaltSync(10)
|
||||
return bcrypt.hashSync(password, salt)
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证明文密码是否匹配 BCrypt 哈希值(用于前端预验证)
|
||||
* 注意:这只是辅助验证,真正的验证应该在后端进行
|
||||
* @param password 原始密码
|
||||
* @param hash BCrypt 哈希值
|
||||
* @returns 是否匹配
|
||||
*/
|
||||
export function verifyPassword(password: string, hash: string): boolean {
|
||||
return bcrypt.compareSync(password, hash)
|
||||
}
|
||||
|
||||
/**
|
||||
* 前端登录时的密码处理
|
||||
* 说明:
|
||||
* 1. 方案一(推荐):前端发送明文密码,后端使用 BCrypt 验证
|
||||
* 2. 方案二:前端对密码进行简单哈希(如 MD5/SHA256)传输,后端再验证
|
||||
*
|
||||
* 注意:不建议在前端使用 BCrypt 加密后传输,因为:
|
||||
* - BCrypt 每次加密相同密码会生成不同哈希值
|
||||
* - 后端收到哈希值后无法使用 BCrypt.matches() 验证
|
||||
* - 这需要修改后端验证逻辑,降低安全性
|
||||
*/
|
||||
|
||||
/**
|
||||
* 方案一:直接返回明文密码(推荐,通过 HTTPS 传输)
|
||||
*/
|
||||
export function preparePasswordForLogin(password: string): string {
|
||||
return password // 明文传输,后端 BCrypt 验证
|
||||
}
|
||||
|
||||
/**
|
||||
* 方案二:使用固定盐值的哈希(可选,用于额外的一层保护)
|
||||
* 注意:这不是 BCrypt,而是简单的 SHA-256
|
||||
*/
|
||||
export async function hashPasswordForLogin(password: string): Promise<string> {
|
||||
// 使用 Web Crypto API 进行 SHA-256 哈希
|
||||
const encoder = new TextEncoder()
|
||||
const data = encoder.encode(password)
|
||||
const hashBuffer = await crypto.subtle.digest('SHA-256', data)
|
||||
const hashArray = Array.from(new Uint8Array(hashBuffer))
|
||||
const hashHex = hashArray.map(b => b.toString(16).padStart(2, '0')).join('')
|
||||
return hashHex
|
||||
}
|
||||
|
||||
/**
|
||||
* 推荐的登录密码处理方式
|
||||
* 直接返回明文密码,让后端使用 BCrypt 验证
|
||||
* 这是最安全和标准的方式
|
||||
*/
|
||||
export function getLoginPassword(password: string): string {
|
||||
return password
|
||||
}
|
||||
@@ -4,10 +4,15 @@
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>客户管理</span>
|
||||
<el-button type="primary" @click="handleAdd">
|
||||
<el-icon><Plus /></el-icon>
|
||||
新增客户
|
||||
</el-button>
|
||||
<div style="display: flex; gap: 10px; align-items: center">
|
||||
<el-tag type="info" size="large">
|
||||
当前保护期配置:{{ protectDays }} 天
|
||||
</el-tag>
|
||||
<el-button type="primary" @click="handleAdd">
|
||||
<el-icon><Plus /></el-icon>
|
||||
新增客户
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -60,6 +65,16 @@
|
||||
<el-tag v-else type="info">已失效</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="currentDealerName" label="当前经销商" width="150">
|
||||
<template #default="{ row }">
|
||||
{{ row.status === 1 ? (row.currentDealerName || '-') : '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="protectEndDate" label="保护期截止" width="180">
|
||||
<template #default="{ row }">
|
||||
{{ row.status === 1 && row.protectEndDate ? formatDate(row.protectEndDate) : '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="createdAt" label="创建时间" width="180" />
|
||||
<el-table-column label="操作" width="180" fixed="right">
|
||||
<template #default="{ row }">
|
||||
@@ -76,6 +91,8 @@
|
||||
:total="total"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
prev-text="上一页"
|
||||
next-text="下一页"
|
||||
@size-change="fetchData"
|
||||
@current-change="fetchData"
|
||||
style="margin-top: 20px; justify-content: flex-end"
|
||||
@@ -91,7 +108,21 @@
|
||||
>
|
||||
<el-form ref="formRef" :model="formData" :rules="rules" label-width="100px">
|
||||
<el-form-item label="客户名称" prop="name">
|
||||
<el-input v-model="formData.name" placeholder="请输入客户名称" />
|
||||
<el-autocomplete
|
||||
v-model="formData.name"
|
||||
:fetch-suggestions="searchSchool"
|
||||
placeholder="请输入客户名称"
|
||||
:trigger-on-focus="false"
|
||||
style="width: 100%"
|
||||
@select="handleSchoolSelect"
|
||||
>
|
||||
<template #default="{ item }">
|
||||
<div class="school-option">
|
||||
<div class="school-name">{{ item.schoolName }}</div>
|
||||
<div class="school-location">{{ item.location }}</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-autocomplete>
|
||||
</el-form-item>
|
||||
<el-form-item label="联系电话" prop="phone">
|
||||
<el-input v-model="formData.phone" placeholder="请输入联系电话" />
|
||||
@@ -123,7 +154,12 @@
|
||||
import { ref, reactive, onMounted, computed } from 'vue'
|
||||
import { ElMessage, ElMessageBox, type FormInstance, type FormRules } from 'element-plus'
|
||||
import { getCustomerPage, createCustomer, updateCustomer, deleteCustomer } from '@/api/customer'
|
||||
import { getConfigValue } from '@/api/system'
|
||||
import { searchSchoolByName } from '@/api/school'
|
||||
import type { Customer, CustomerForm } from '@/types'
|
||||
import type { School } from '@/api/school'
|
||||
|
||||
const protectDays = ref<number>(90)
|
||||
|
||||
const loading = ref(false)
|
||||
const tableData = ref<Customer[]>([])
|
||||
@@ -131,6 +167,8 @@ const total = ref(0)
|
||||
const dialogVisible = ref(false)
|
||||
const dialogTitle = computed(() => (formData.id ? '编辑客户' : '新增客户'))
|
||||
const formRef = ref<FormInstance>()
|
||||
const schoolSearchLoading = ref(false)
|
||||
const schoolOptions = ref<School[]>([])
|
||||
|
||||
const queryForm = reactive({
|
||||
current: 1,
|
||||
@@ -151,6 +189,44 @@ const rules: FormRules = {
|
||||
name: [{ required: true, message: '请输入客户名称', trigger: 'blur' }]
|
||||
}
|
||||
|
||||
// 格式化日期,去掉时分秒
|
||||
const formatDate = (dateStr: string | null | undefined) => {
|
||||
if (!dateStr) return '-'
|
||||
return dateStr.split(' ')[0] // 只保留日期部分,去掉时间
|
||||
}
|
||||
|
||||
// 搜索学校(用于自动完成)
|
||||
const searchSchool = async (queryString: string, cb: any) => {
|
||||
if (!queryString || queryString.trim().length < 1) {
|
||||
cb([])
|
||||
return
|
||||
}
|
||||
|
||||
schoolSearchLoading.value = true
|
||||
try {
|
||||
const schools = await searchSchoolByName(queryString)
|
||||
// 转换为 el-autocomplete 需要的格式
|
||||
const suggestions = schools.map(school => ({
|
||||
...school,
|
||||
value: school.schoolName
|
||||
}))
|
||||
cb(suggestions)
|
||||
} catch (error) {
|
||||
console.error('搜索学校失败', error)
|
||||
cb([])
|
||||
} finally {
|
||||
schoolSearchLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 选择学校后的回调
|
||||
const handleSchoolSelect = (item: School) => {
|
||||
// 用户可以选择性地填充地址字段
|
||||
if (item.location && !formData.address) {
|
||||
formData.address = item.location
|
||||
}
|
||||
}
|
||||
|
||||
// 获取行业标签
|
||||
const getIndustryLabel = (industry: string) => {
|
||||
const map: Record<string, string> = {
|
||||
@@ -208,7 +284,15 @@ const handleEdit = (row: Customer) => {
|
||||
// 删除按钮
|
||||
const handleDelete = async (row: Customer) => {
|
||||
try {
|
||||
await ElMessageBox.confirm('确定要删除该客户吗?', '提示', { type: 'warning' })
|
||||
await ElMessageBox.confirm(
|
||||
'确定要删除该客户吗?',
|
||||
'提示',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}
|
||||
)
|
||||
await deleteCustomer(row.id)
|
||||
ElMessage.success('删除成功')
|
||||
fetchData()
|
||||
@@ -251,7 +335,18 @@ const handleDialogClose = () => {
|
||||
delete formData.id
|
||||
}
|
||||
|
||||
// 获取保护期配置
|
||||
const fetchProtectDays = async () => {
|
||||
try {
|
||||
const res = await getConfigValue('report.protect.days')
|
||||
protectDays.value = parseInt(res) || 90
|
||||
} catch (error) {
|
||||
console.error('获取配置失败', error)
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
fetchProtectDays()
|
||||
fetchData()
|
||||
})
|
||||
</script>
|
||||
@@ -270,4 +365,20 @@ onMounted(() => {
|
||||
.query-form {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.school-option {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.school-name {
|
||||
font-weight: 500;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.school-location {
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
margin-top: 4px;
|
||||
}
|
||||
</style>
|
||||
@@ -65,8 +65,9 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import * as statisticsApi from '@/api/customer'
|
||||
import { getStatistics } from '@/api/dashboard'
|
||||
|
||||
const userStore = useUserStore()
|
||||
|
||||
@@ -77,14 +78,19 @@ const stats = ref({
|
||||
dealerCount: 0
|
||||
})
|
||||
|
||||
// 加载统计数据(模拟数据)
|
||||
onMounted(() => {
|
||||
stats.value = {
|
||||
customerCount: 5,
|
||||
reportCount: 0,
|
||||
pendingCount: 0,
|
||||
dealerCount: 3
|
||||
// 加载统计数据
|
||||
const fetchStatistics = async () => {
|
||||
try {
|
||||
const res = await getStatistics()
|
||||
stats.value = res
|
||||
} catch (error) {
|
||||
console.error('加载统计数据失败', error)
|
||||
ElMessage.error('加载统计数据失败')
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
fetchStatistics()
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
+153
-12
@@ -16,8 +16,8 @@
|
||||
<el-form-item label="经销商名称">
|
||||
<el-input v-model="queryForm.name" placeholder="请输入经销商名称" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="经销商编码">
|
||||
<el-input v-model="queryForm.code" placeholder="请输入经销商编码" clearable />
|
||||
<el-form-item label="经销商账号">
|
||||
<el-input v-model="queryForm.code" placeholder="请输入经销商账号" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="状态">
|
||||
<el-select v-model="queryForm.status" placeholder="请选择状态" clearable>
|
||||
@@ -37,7 +37,7 @@
|
||||
<!-- 数据表格 -->
|
||||
<el-table :data="tableData" border stripe v-loading="loading">
|
||||
<el-table-column prop="name" label="经销商名称" />
|
||||
<el-table-column prop="code" label="经销商编码" />
|
||||
<el-table-column prop="code" label="经销商账号" />
|
||||
<el-table-column prop="contactPerson" label="联系人" />
|
||||
<el-table-column prop="contactPhone" label="联系电话" />
|
||||
<el-table-column prop="email" label="邮箱" />
|
||||
@@ -49,9 +49,10 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="createdAt" label="创建时间" width="180" />
|
||||
<el-table-column label="操作" width="180" fixed="right">
|
||||
<el-table-column label="操作" width="240" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" @click="handleEdit(row)">编辑</el-button>
|
||||
<el-button link type="warning" @click="handleResetPassword(row)">重置密码</el-button>
|
||||
<el-button link type="danger" @click="handleDelete(row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -69,8 +70,8 @@
|
||||
<el-form-item label="经销商名称" prop="name">
|
||||
<el-input v-model="formData.name" placeholder="请输入经销商名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="经销商编码" prop="code">
|
||||
<el-input v-model="formData.code" placeholder="请输入经销商编码" />
|
||||
<el-form-item label="经销商账号" prop="code">
|
||||
<el-input v-model="formData.code" placeholder="请输入经销商账号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="联系人" prop="contactPerson">
|
||||
<el-input v-model="formData.contactPerson" placeholder="请输入联系人" />
|
||||
@@ -87,12 +88,57 @@
|
||||
<el-radio :label="0">禁用</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="初始密码" prop="password" v-if="!formData.id">
|
||||
<el-input
|
||||
v-model="formData.password"
|
||||
type="password"
|
||||
placeholder="请输入初始密码(不填默认为123456)"
|
||||
show-password
|
||||
/>
|
||||
<div style="color: #909399; font-size: 12px; margin-top: 4px">
|
||||
长度6-20位,不填则默认密码为 123456
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="dialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="handleSubmit">确定</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 重置密码对话框 -->
|
||||
<el-dialog
|
||||
v-model="resetPasswordDialogVisible"
|
||||
title="重置密码"
|
||||
width="500px"
|
||||
@close="handleResetPasswordDialogClose"
|
||||
>
|
||||
<el-form ref="resetPasswordFormRef" :model="resetPasswordForm" :rules="resetPasswordRules" label-width="100px">
|
||||
<el-form-item label="经销商名称">
|
||||
<el-input v-model="resetPasswordForm.dealerName" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="新密码" prop="newPassword">
|
||||
<el-input
|
||||
v-model="resetPasswordForm.newPassword"
|
||||
type="password"
|
||||
placeholder="请输入新密码(6-20位)"
|
||||
show-password
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="确认密码" prop="confirmPassword">
|
||||
<el-input
|
||||
v-model="resetPasswordForm.confirmPassword"
|
||||
type="password"
|
||||
placeholder="请再次输入新密码"
|
||||
show-password
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="resetPasswordDialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="handleResetPasswordSubmit">确定</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -100,13 +146,17 @@
|
||||
import { ref, reactive, onMounted, computed } from 'vue'
|
||||
import { ElMessage, ElMessageBox, type FormInstance, type FormRules } from 'element-plus'
|
||||
import { getDealerList, createDealer, updateDealer, deleteDealer } from '@/api/dealer'
|
||||
import { resetPassword } from '@/api/auth'
|
||||
import { hashPassword } from '@/utils/crypto'
|
||||
import type { Dealer } from '@/types'
|
||||
|
||||
const loading = ref(false)
|
||||
const tableData = ref<Dealer[]>([])
|
||||
const dialogVisible = ref(false)
|
||||
const resetPasswordDialogVisible = ref(false)
|
||||
const dialogTitle = computed(() => (formData.id ? '编辑经销商' : '新增经销商'))
|
||||
const formRef = ref<FormInstance>()
|
||||
const resetPasswordFormRef = ref<FormInstance>()
|
||||
|
||||
const queryForm = reactive({
|
||||
name: '',
|
||||
@@ -114,20 +164,62 @@ const queryForm = reactive({
|
||||
status: undefined as number | undefined
|
||||
})
|
||||
|
||||
const formData = reactive<Partial<Dealer> & { id?: number }>({
|
||||
const formData = reactive<Partial<Dealer> & { id?: number; password?: string }>({
|
||||
name: '',
|
||||
code: '',
|
||||
contactPerson: '',
|
||||
contactPhone: '',
|
||||
email: '',
|
||||
status: 1
|
||||
status: 1,
|
||||
password: ''
|
||||
})
|
||||
|
||||
const rules: FormRules = {
|
||||
name: [{ required: true, message: '请输入经销商名称', trigger: 'blur' }],
|
||||
code: [{ required: true, message: '请输入经销商编码', trigger: 'blur' }],
|
||||
code: [{ required: true, message: '请输入经销商账号', trigger: 'blur' }],
|
||||
contactPerson: [{ required: true, message: '请输入联系人', trigger: 'blur' }],
|
||||
contactPhone: [{ required: true, message: '请输入联系电话', trigger: 'blur' }]
|
||||
contactPhone: [{ required: true, message: '请输入联系电话', trigger: 'blur' }],
|
||||
password: [
|
||||
{
|
||||
validator: (rule, value, callback) => {
|
||||
// 密码可选,如果填写则校验长度
|
||||
if (value && (value.length < 6 || value.length > 20)) {
|
||||
callback(new Error('密码长度必须在6-20位之间'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
},
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
// 重置密码表单
|
||||
const resetPasswordForm = reactive({
|
||||
userId: 0,
|
||||
dealerName: '',
|
||||
newPassword: '',
|
||||
confirmPassword: ''
|
||||
})
|
||||
|
||||
const resetPasswordRules: FormRules = {
|
||||
newPassword: [
|
||||
{ required: true, message: '请输入新密码', trigger: 'blur' },
|
||||
{ min: 6, max: 20, message: '新密码长度必须在6-20位之间', trigger: 'blur' }
|
||||
],
|
||||
confirmPassword: [
|
||||
{ required: true, message: '请再次输入新密码', trigger: 'blur' },
|
||||
{
|
||||
validator: (rule, value, callback) => {
|
||||
if (value !== resetPasswordForm.newPassword) {
|
||||
callback(new Error('两次输入的密码不一致'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
},
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
// 查询数据
|
||||
@@ -170,7 +262,15 @@ const handleEdit = (row: Dealer) => {
|
||||
// 删除按钮
|
||||
const handleDelete = async (row: Dealer) => {
|
||||
try {
|
||||
await ElMessageBox.confirm('确定要删除该经销商吗?', '提示', { type: 'warning' })
|
||||
await ElMessageBox.confirm(
|
||||
'确定要删除该经销商吗?',
|
||||
'提示',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}
|
||||
)
|
||||
await deleteDealer(row.id)
|
||||
ElMessage.success('删除成功')
|
||||
fetchData()
|
||||
@@ -201,6 +301,46 @@ const handleSubmit = async () => {
|
||||
})
|
||||
}
|
||||
|
||||
// 重置密码按钮
|
||||
const handleResetPassword = (row: Dealer) => {
|
||||
resetPasswordForm.userId = row.userId
|
||||
resetPasswordForm.dealerName = row.name
|
||||
resetPasswordDialogVisible.value = true
|
||||
}
|
||||
|
||||
// 提交重置密码
|
||||
const handleResetPasswordSubmit = async () => {
|
||||
if (!resetPasswordFormRef.value) return
|
||||
await resetPasswordFormRef.value.validate(async (valid) => {
|
||||
if (valid) {
|
||||
try {
|
||||
// 对密码进行 SHA-256 哈希后再传输
|
||||
const hashedPassword = await hashPassword(resetPasswordForm.newPassword)
|
||||
|
||||
await resetPassword({
|
||||
userId: resetPasswordForm.userId,
|
||||
newPassword: hashedPassword
|
||||
})
|
||||
ElMessage.success('密码重置成功')
|
||||
resetPasswordDialogVisible.value = false
|
||||
} catch (error) {
|
||||
console.error('重置密码失败', error)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 重置密码对话框关闭
|
||||
const handleResetPasswordDialogClose = () => {
|
||||
resetPasswordFormRef.value?.resetFields()
|
||||
Object.assign(resetPasswordForm, {
|
||||
userId: 0,
|
||||
dealerName: '',
|
||||
newPassword: '',
|
||||
confirmPassword: ''
|
||||
})
|
||||
}
|
||||
|
||||
// 对话框关闭
|
||||
const handleDialogClose = () => {
|
||||
formRef.value?.resetFields()
|
||||
@@ -210,7 +350,8 @@ const handleDialogClose = () => {
|
||||
contactPerson: '',
|
||||
contactPhone: '',
|
||||
email: '',
|
||||
status: 1
|
||||
status: 1,
|
||||
password: ''
|
||||
})
|
||||
delete formData.id
|
||||
}
|
||||
|
||||
@@ -25,6 +25,10 @@
|
||||
<el-icon><Shop /></el-icon>
|
||||
<span>经销商管理</span>
|
||||
</el-menu-item>
|
||||
<el-menu-item v-if="userStore.isAdmin" index="/system-config">
|
||||
<el-icon><Setting /></el-icon>
|
||||
<span>系统配置</span>
|
||||
</el-menu-item>
|
||||
</el-menu>
|
||||
</el-aside>
|
||||
<el-container>
|
||||
@@ -47,6 +51,10 @@
|
||||
</span>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item @click="showChangePasswordDialog = true">
|
||||
<el-icon><Lock /></el-icon>
|
||||
修改密码
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item @click="handleLogout">
|
||||
<el-icon><SwitchButton /></el-icon>
|
||||
退出登录
|
||||
@@ -61,14 +69,55 @@
|
||||
<router-view />
|
||||
</el-main>
|
||||
</el-container>
|
||||
|
||||
<!-- 修改密码对话框 -->
|
||||
<el-dialog
|
||||
v-model="showChangePasswordDialog"
|
||||
title="修改密码"
|
||||
width="500px"
|
||||
@close="handleDialogClose"
|
||||
>
|
||||
<el-form ref="formRef" :model="passwordForm" :rules="passwordRules" label-width="100px">
|
||||
<el-form-item label="原密码" prop="oldPassword">
|
||||
<el-input
|
||||
v-model="passwordForm.oldPassword"
|
||||
type="password"
|
||||
placeholder="请输入原密码"
|
||||
show-password
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="新密码" prop="newPassword">
|
||||
<el-input
|
||||
v-model="passwordForm.newPassword"
|
||||
type="password"
|
||||
placeholder="请输入新密码(6-20位)"
|
||||
show-password
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="确认密码" prop="confirmPassword">
|
||||
<el-input
|
||||
v-model="passwordForm.confirmPassword"
|
||||
type="password"
|
||||
placeholder="请再次输入新密码"
|
||||
show-password
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="showChangePasswordDialog = false">取消</el-button>
|
||||
<el-button type="primary" @click="handleChangePassword">确定</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</el-container>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { computed, reactive, ref } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { ElMessageBox } from 'element-plus'
|
||||
import { ElMessage, ElMessageBox, type FormInstance, type FormRules } from 'element-plus'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import { changePassword } from '@/api/auth'
|
||||
import { hashPassword } from '@/utils/crypto'
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
@@ -77,11 +126,81 @@ const userStore = useUserStore()
|
||||
const activeMenu = computed(() => route.path)
|
||||
const currentPageTitle = computed(() => route.meta.title as string || '首页')
|
||||
|
||||
// 修改密码对话框
|
||||
const showChangePasswordDialog = ref(false)
|
||||
const formRef = ref<FormInstance>()
|
||||
const passwordForm = reactive({
|
||||
oldPassword: '',
|
||||
newPassword: '',
|
||||
confirmPassword: ''
|
||||
})
|
||||
|
||||
const passwordRules: FormRules = {
|
||||
oldPassword: [{ required: true, message: '请输入原密码', trigger: 'blur' }],
|
||||
newPassword: [
|
||||
{ required: true, message: '请输入新密码', trigger: 'blur' },
|
||||
{ min: 6, max: 20, message: '新密码长度必须在6-20位之间', trigger: 'blur' }
|
||||
],
|
||||
confirmPassword: [
|
||||
{ required: true, message: '请再次输入新密码', trigger: 'blur' },
|
||||
{
|
||||
validator: (rule, value, callback) => {
|
||||
if (value !== passwordForm.newPassword) {
|
||||
callback(new Error('两次输入的密码不一致'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
},
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
const handleChangePassword = async () => {
|
||||
if (!formRef.value) return
|
||||
await formRef.value.validate(async (valid) => {
|
||||
if (valid) {
|
||||
try {
|
||||
// 对密码进行 SHA-256 哈希后再传输
|
||||
const hashedOldPassword = await hashPassword(passwordForm.oldPassword)
|
||||
const hashedNewPassword = await hashPassword(passwordForm.newPassword)
|
||||
|
||||
await changePassword({
|
||||
oldPassword: hashedOldPassword,
|
||||
newPassword: hashedNewPassword
|
||||
})
|
||||
ElMessage.success('密码修改成功,请重新登录')
|
||||
showChangePasswordDialog.value = false
|
||||
// 退出登录
|
||||
userStore.logout()
|
||||
router.push('/login')
|
||||
} catch (error) {
|
||||
console.error('修改密码失败', error)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const handleDialogClose = () => {
|
||||
formRef.value?.resetFields()
|
||||
Object.assign(passwordForm, {
|
||||
oldPassword: '',
|
||||
newPassword: '',
|
||||
confirmPassword: ''
|
||||
})
|
||||
}
|
||||
|
||||
const handleLogout = async () => {
|
||||
try {
|
||||
await ElMessageBox.confirm('确定要退出登录吗?', '提示', {
|
||||
type: 'warning'
|
||||
})
|
||||
await ElMessageBox.confirm(
|
||||
'确定要退出登录吗?',
|
||||
'提示',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}
|
||||
)
|
||||
userStore.logout()
|
||||
router.push('/login')
|
||||
} catch {
|
||||
|
||||
@@ -36,6 +36,7 @@ import { ref, reactive } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { ElMessage, type FormInstance, type FormRules } from 'element-plus'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import { hashPassword } from '@/utils/crypto'
|
||||
|
||||
const router = useRouter()
|
||||
const userStore = useUserStore()
|
||||
@@ -59,7 +60,12 @@ const handleLogin = async () => {
|
||||
if (valid) {
|
||||
loading.value = true
|
||||
try {
|
||||
await userStore.login(loginForm)
|
||||
// 对密码进行 SHA-256 哈希后再传输
|
||||
const hashedPassword = await hashPassword(loginForm.password)
|
||||
await userStore.login({
|
||||
username: loginForm.username,
|
||||
password: hashedPassword
|
||||
})
|
||||
ElMessage.success('登录成功')
|
||||
router.push('/')
|
||||
} catch (error) {
|
||||
|
||||
@@ -3,7 +3,12 @@
|
||||
<el-card>
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>报备管理</span>
|
||||
<div>
|
||||
<span>报备管理</span>
|
||||
<el-tag type="info" size="small" style="margin-left: 10px">
|
||||
保护期:{{ protectDays }} 天
|
||||
</el-tag>
|
||||
</div>
|
||||
<el-button type="primary" @click="handleAdd" v-if="!userStore.isAdmin">
|
||||
<el-icon><Plus /></el-icon>
|
||||
提交报备
|
||||
@@ -49,7 +54,7 @@
|
||||
</el-table-column>
|
||||
<el-table-column prop="protectEndDate" label="保护期截止" width="180">
|
||||
<template #default="{ row }">
|
||||
{{ row.protectEndDate || '-' }}
|
||||
{{ formatDate(row.protectEndDate) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="createdAt" label="创建时间" width="180" />
|
||||
@@ -83,6 +88,8 @@
|
||||
:total="total"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
prev-text="上一页"
|
||||
next-text="下一页"
|
||||
@size-change="fetchData"
|
||||
@current-change="fetchData"
|
||||
style="margin-top: 20px; justify-content: flex-end"
|
||||
@@ -157,10 +164,13 @@ import { ElMessage, ElMessageBox, type FormInstance, type FormRules } from 'elem
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import { getReportPage, createReport, auditReport, withdrawReport } from '@/api/report'
|
||||
import { searchCustomerByName } from '@/api/customer'
|
||||
import { getConfigValue } from '@/api/system'
|
||||
import type { Report, ReportForm } from '@/types'
|
||||
|
||||
const userStore = useUserStore()
|
||||
|
||||
const protectDays = ref<number>(90)
|
||||
|
||||
const loading = ref(false)
|
||||
const tableData = ref<Report[]>([])
|
||||
const total = ref(0)
|
||||
@@ -193,6 +203,12 @@ const rules: FormRules = {
|
||||
customerId: [{ required: true, message: '请选择客户', trigger: 'change' }]
|
||||
}
|
||||
|
||||
// 格式化日期,去掉时分秒
|
||||
const formatDate = (dateStr: string | null | undefined) => {
|
||||
if (!dateStr) return '-'
|
||||
return dateStr.split(' ')[0] // 只保留日期部分,去掉时间
|
||||
}
|
||||
|
||||
// 查询数据
|
||||
const fetchData = async () => {
|
||||
loading.value = true
|
||||
@@ -251,7 +267,7 @@ const handleView = (row: Report) => {
|
||||
<p><strong>报备说明:</strong>${row.description || '-'}</p>
|
||||
<p><strong>状态:</strong>${row.statusDesc}</p>
|
||||
<p><strong>驳回原因:</strong>${row.rejectReason || '-'}</p>
|
||||
<p><strong>保护期:</strong>${row.protectStartDate || '-'} ~ ${row.protectEndDate || '-'}</p>
|
||||
<p><strong>保护期:</strong>${formatDate(row.protectStartDate)} ~ ${formatDate(row.protectEndDate)}</p>
|
||||
</div>
|
||||
`,
|
||||
'报备详情',
|
||||
@@ -273,7 +289,15 @@ const handleAudit = (row: Report) => {
|
||||
// 撤回按钮
|
||||
const handleWithdraw = async (row: Report) => {
|
||||
try {
|
||||
await ElMessageBox.confirm('确定要撤回该报备吗?', '提示', { type: 'warning' })
|
||||
await ElMessageBox.confirm(
|
||||
'确定要撤回该报备吗?',
|
||||
'提示',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}
|
||||
)
|
||||
await withdrawReport(row.id)
|
||||
ElMessage.success('撤回成功')
|
||||
fetchData()
|
||||
@@ -326,7 +350,18 @@ const handleDialogClose = () => {
|
||||
customerOptions.value = []
|
||||
}
|
||||
|
||||
// 获取保护期配置
|
||||
const fetchProtectDays = async () => {
|
||||
try {
|
||||
const res = await getConfigValue('report.protect.days')
|
||||
protectDays.value = parseInt(res) || 90
|
||||
} catch (error) {
|
||||
console.error('获取配置失败', error)
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
fetchProtectDays()
|
||||
fetchData()
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,146 @@
|
||||
<template>
|
||||
<div class="system-config-page">
|
||||
<el-card>
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>系统配置管理</span>
|
||||
<el-button type="primary" @click="handleSave" :loading="saving">
|
||||
<el-icon><Check /></el-icon>
|
||||
保存配置
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<el-alert
|
||||
title="提示"
|
||||
type="warning"
|
||||
:closable="false"
|
||||
style="margin-bottom: 20px"
|
||||
>
|
||||
修改配置后立即生效,请谨慎操作。保护期天数的修改仅影响新生成的报备。
|
||||
</el-alert>
|
||||
|
||||
<el-form :model="formData" label-width="150px">
|
||||
<el-divider content-position="left">报备配置</el-divider>
|
||||
|
||||
<el-form-item label="保护期天数">
|
||||
<el-input-number
|
||||
v-model="formData['report.protect.days']"
|
||||
:min="1"
|
||||
:max="365"
|
||||
:step="1"
|
||||
controls-position="right"
|
||||
style="width: 200px"
|
||||
/>
|
||||
<span style="margin-left: 10px; color: #909399">天</span>
|
||||
<div style="margin-top: 5px; color: #909399; font-size: 12px">
|
||||
报备审核通过后,客户的保护时长。修改仅影响新生成的报备。
|
||||
</div>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="允许重叠报备">
|
||||
<el-switch
|
||||
v-model="formData['report.allow.overlap']"
|
||||
active-text="是"
|
||||
inactive-text="否"
|
||||
/>
|
||||
<div style="margin-top: 5px; color: #F56C6C; font-size: 12px">
|
||||
⚠️ 警告:生产环境必须设置为"否",否则会导致同一个客户被多个经销商报备!
|
||||
</div>
|
||||
</el-form-item>
|
||||
|
||||
<el-divider content-position="left">当前配置状态</el-divider>
|
||||
|
||||
<el-descriptions :column="2" border>
|
||||
<el-descriptions-item label="当前保护期天数">
|
||||
{{ configs.find(c => c.configKey === 'report.protect.days')?.configValue || 90 }} 天
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="允许重叠报备">
|
||||
<el-tag :type="configs.find(c => c.configKey === 'report.allow.overlap')?.configValue === 'true' ? 'danger' : 'success'">
|
||||
{{ configs.find(c => c.configKey === 'report.allow.overlap')?.configValue === 'true' ? '是(危险)' : '否(安全)' }}
|
||||
</el-tag>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { Check } from '@element-plus/icons-vue'
|
||||
import { getAllConfigs, batchUpdateConfigs } from '@/api/system'
|
||||
import type { SystemConfig } from '@/types'
|
||||
|
||||
const configs = ref<SystemConfig[]>([])
|
||||
const saving = ref(false)
|
||||
|
||||
const formData = reactive<Record<string, any>>({
|
||||
'report.protect.days': 90,
|
||||
'report.allow.overlap': false
|
||||
})
|
||||
|
||||
// 加载配置
|
||||
const fetchConfigs = async () => {
|
||||
try {
|
||||
const res = await getAllConfigs()
|
||||
configs.value = res
|
||||
|
||||
// 填充表单
|
||||
res.forEach(config => {
|
||||
if (config.configType === 'integer') {
|
||||
formData[config.configKey] = parseInt(config.configValue)
|
||||
} else if (config.configType === 'boolean') {
|
||||
formData[config.configKey] = config.configValue === 'true'
|
||||
} else {
|
||||
formData[config.configKey] = config.configValue
|
||||
}
|
||||
})
|
||||
} catch (error) {
|
||||
console.error('加载配置失败', error)
|
||||
ElMessage.error('加载配置失败')
|
||||
}
|
||||
}
|
||||
|
||||
// 保存配置
|
||||
const handleSave = async () => {
|
||||
saving.value = true
|
||||
try {
|
||||
const configMap: Record<string, string> = {}
|
||||
Object.keys(formData).forEach(key => {
|
||||
const value = formData[key]
|
||||
if (typeof value === 'boolean') {
|
||||
configMap[key] = String(value)
|
||||
} else {
|
||||
configMap[key] = String(value)
|
||||
}
|
||||
})
|
||||
|
||||
await batchUpdateConfigs(configMap)
|
||||
ElMessage.success('保存成功')
|
||||
fetchConfigs()
|
||||
} catch (error) {
|
||||
console.error('保存失败', error)
|
||||
ElMessage.error('保存失败')
|
||||
} finally {
|
||||
saving.value = false
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
fetchConfigs()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.system-config-page {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.card-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user