feat(device): 更新设备管理功能并优化错误处理- 修改设备更新接口路径从 /updateExpire 到 /update- 添加设备注册时获取计算机名称功能

- 优化设备配额检查逻辑,增加账号存在性验证- 更新前端设备列表刷新逻辑,使用保存的用户名参数
- 修改账号编辑表单,禁用已存在账号的用户名和账号名编辑
-优化跟卖精灵打开功能的错误提示和异常处理- 添加页面刷新 IPC通信功能
- 限制用户名输入只能包含字母、数字和下划线
- 移除冗余的本地 IP 获取函数- 升级 erp_client_sb 模块版本至 2.4.9
This commit is contained in:
2025-10-22 14:18:28 +08:00
parent 17b6a7b9f9
commit 5468dc53fc
15 changed files with 115 additions and 96 deletions

View File

@@ -79,10 +79,10 @@ export function getDeviceList(username) {
})
}
// 修改设备试用期过期时间
// 更新设备信息
export function updateDeviceExpire(data) {
return request({
url: '/monitor/device/updateExpire',
url: '/monitor/device/update',
method: 'post',
data: data
})

View File

@@ -148,16 +148,16 @@
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="账号名称" prop="accountName">
<el-input v-model="form.accountName" placeholder="请输入账号名称" />
<el-input v-model="form.accountName" placeholder="请输入账号名称" :disabled="!!form.id" />
</el-form-item>
<el-form-item label="用户名" prop="username">
<el-input v-model="form.username" placeholder="请输入用户名" />
<el-input v-model="form.username" placeholder="请输入用户名" :disabled="!!form.id" />
</el-form-item>
<el-form-item label="密码" prop="password" v-if="!form.id">
<el-input v-model="form.password" type="password" placeholder="请输入密码" />
</el-form-item>
<el-form-item label="账号状态">
<el-radio-group v-model="form.status">
<el-radio-group v-model="form.status" :disabled="!!form.id">
<el-radio
v-for="dict in statusOptions"
:key="dict.dictValue"
@@ -340,6 +340,7 @@ export default {
deviceListLoading: false,
deviceList: [],
currentAccountName: '',
currentUsername: '', // 当前账号的用户名
// 设备过期时间编辑
deviceExpireDialogVisible: false,
currentDevice: {},
@@ -598,6 +599,7 @@ export default {
/** 查看设备列表 */
async viewDevices(row) {
this.currentAccountName = row.accountName || row.username;
this.currentUsername = row.username;
this.deviceListVisible = true;
this.deviceListLoading = true;
try {
@@ -620,13 +622,12 @@ export default {
try {
await updateDeviceExpire({
deviceId: this.currentDevice.deviceId,
username: this.currentDevice.username,
trialExpireTime: this.currentDevice.trialExpireTime
});
this.$modal.msgSuccess('修改成功');
this.deviceExpireDialogVisible = false;
// 刷新设备列表
const response = await getDeviceList(this.currentDevice.username);
// 刷新设备列表(使用保存的 username
const response = await getDeviceList(this.currentUsername);
this.deviceList = response.data || [];
} catch (error) {
this.$modal.msgError('修改失败: ' + (error.message || '未知错误'));