forked from dyf/dyf-vue-ui
app登录接口联调
This commit is contained in:
@ -19,5 +19,13 @@ export const deviceList = (params): AxiosPromise => {
|
||||
params
|
||||
});
|
||||
};
|
||||
// 账号状态
|
||||
export const userStatus = (data): AxiosPromise => {
|
||||
return request({
|
||||
url: '/api/app/device',
|
||||
method: 'put',
|
||||
data
|
||||
});
|
||||
};
|
||||
|
||||
export default { userList,deviceList }
|
||||
export default { userList,deviceList,userStatus }
|
@ -0,0 +1,16 @@
|
||||
export interface userQuery {
|
||||
pageNum: number | string | undefined;
|
||||
pageSize: number | string | undefined;
|
||||
userName: string;
|
||||
status: string;
|
||||
}
|
||||
|
||||
|
||||
export interface userForm {
|
||||
configId: number | string | undefined;
|
||||
configName: string;
|
||||
configKey: string;
|
||||
configValue: string;
|
||||
configType: string;
|
||||
remark: string;
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 564 KiB After Width: | Height: | Size: 333 KiB |
@ -14,47 +14,6 @@
|
||||
</el-option>
|
||||
<template #prefix><svg-icon icon-class="company" class="el-input__icon input-icon" /></template>
|
||||
</el-select>
|
||||
|
||||
<!-- <search-menu ref="searchMenuRef" />
|
||||
<el-tooltip content="搜索" effect="dark" placement="bottom">
|
||||
<div class="right-menu-item hover-effect" @click="openSearchMenu">
|
||||
<svg-icon class-name="search-icon" icon-class="search" />
|
||||
</div>
|
||||
</el-tooltip> -->
|
||||
<!-- 消息 -->
|
||||
<!-- <el-tooltip :content="proxy.$t('navbar.message')" effect="dark" placement="bottom">
|
||||
<div>
|
||||
<el-popover placement="bottom" trigger="click" transition="el-zoom-in-top" :width="300" :persistent="false">
|
||||
<template #reference>
|
||||
<el-badge :value="newNotice > 0 ? newNotice : ''" :max="99">
|
||||
<div class="right-menu-item hover-effect" style="display: block"><svg-icon icon-class="message" /></div>
|
||||
</el-badge>
|
||||
</template>
|
||||
<template #default>
|
||||
<notice></notice>
|
||||
</template>
|
||||
</el-popover>
|
||||
</div>
|
||||
</el-tooltip> -->
|
||||
<!-- <el-tooltip content="Github" effect="dark" placement="bottom">
|
||||
<ruo-yi-git id="ruoyi-git" class="right-menu-item hover-effect" />
|
||||
</el-tooltip>
|
||||
|
||||
<el-tooltip :content="proxy.$t('navbar.document')" effect="dark" placement="bottom">
|
||||
<ruo-yi-doc id="ruoyi-doc" class="right-menu-item hover-effect" />
|
||||
</el-tooltip>
|
||||
|
||||
<el-tooltip :content="proxy.$t('navbar.full')" effect="dark" placement="bottom">
|
||||
<screenfull id="screenfull" class="right-menu-item hover-effect" />
|
||||
</el-tooltip>
|
||||
|
||||
<el-tooltip :content="proxy.$t('navbar.language')" effect="dark" placement="bottom">
|
||||
<lang-select id="lang-select" class="right-menu-item hover-effect" />
|
||||
</el-tooltip>
|
||||
|
||||
<el-tooltip :content="proxy.$t('navbar.layoutSize')" effect="dark" placement="bottom">
|
||||
<size-select id="size-select" class="right-menu-item hover-effect" />
|
||||
</el-tooltip> -->
|
||||
</template>
|
||||
<div class="avatar-container">
|
||||
<el-dropdown class="right-menu-item hover-effect" trigger="click" @command="handleCommand">
|
||||
@ -69,9 +28,6 @@
|
||||
<router-link v-if="!dynamic" to="/user/profile">
|
||||
<el-dropdown-item>{{ proxy.$t('navbar.personalCenter') }}</el-dropdown-item>
|
||||
</router-link>
|
||||
<el-dropdown-item v-if="settingsStore.showSettings" command="setLayout">
|
||||
<span>{{ proxy.$t('navbar.layoutSetting') }}</span>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item divided command="logout">
|
||||
<span>{{ proxy.$t('navbar.logout') }}</span>
|
||||
</el-dropdown-item>
|
||||
|
@ -5,14 +5,14 @@
|
||||
<div v-show="showSearch" class="mb-[10px]">
|
||||
<el-card shadow="hover">
|
||||
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
||||
<el-form-item label="APP账号" prop="username">
|
||||
<el-input v-model="queryParams.username" placeholder="请输入APP账号" clearable @keyup.enter="handleQuery" />
|
||||
<el-form-item label="APP账号" prop="userName">
|
||||
<el-input v-model="queryParams.userName" placeholder="请输入APP账号" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="账号状态" prop="enabled">
|
||||
<el-select v-model="queryParams.enabled" clearable placeholder="账号状态" style="width: 120px"
|
||||
<el-form-item label="账号状态" prop="status">
|
||||
<el-select v-model="queryParams.status" clearable placeholder="账号状态"
|
||||
class="filter-item">
|
||||
<el-option label="启用" :value="true" />
|
||||
<el-option label="禁用" :value="false" />
|
||||
<el-option label="启用" :value="0" />
|
||||
<el-option label="禁用" :value="1" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
@ -29,11 +29,11 @@
|
||||
<el-table-column label="APP账号" align="center" prop="userName" />
|
||||
<el-table-column label="账号状态" align="center" prop="status">
|
||||
<template #default="scope">
|
||||
<el-switch v-model="scope.row.status" active-color="#409EFF" inactive-color="#F56C6C" />
|
||||
<div @click="handleStatusChange(scope.row)">
|
||||
<el-switch v-model="scope.row.status" active-value="0" inactive-value="1" />
|
||||
</div>
|
||||
</template>
|
||||
<!-- @change="handleStatusChange(scope.row)" -->
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="创建时间" align="center" prop="loginDate" width="180">
|
||||
<template #default="scope">
|
||||
<span>{{ proxy.parseTime(scope.row.loginDate) }}</span>
|
||||
@ -58,18 +58,17 @@
|
||||
|
||||
<script setup name="userApp" lang="ts">
|
||||
import api from '@/api/userApp';
|
||||
import { OperLogQuery } from '@/api/monitor/operlog/types';
|
||||
import { userQuery, userForm } from '@/api/userApp/types';
|
||||
import UserInfoDialog from './user-info-dialog.vue';
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const operlogList = ref([]);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref<Array<number | string>>([]);
|
||||
const total = ref(0);
|
||||
const userInfoDialogRef = ref<ElTableInstance>();
|
||||
const queryFormRef = ref<ElFormInstance>();
|
||||
|
||||
const data = reactive<PageData<OperLogForm, OperLogQuery>>({
|
||||
const data = reactive<PageData<userForm, userQuery>>({
|
||||
form: {
|
||||
operId: undefined,
|
||||
tenantId: undefined,
|
||||
@ -94,13 +93,13 @@ const data = reactive<PageData<OperLogForm, OperLogQuery>>({
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
username: '',
|
||||
enabled: ''
|
||||
userName: '',
|
||||
status: ''
|
||||
},
|
||||
rules: {}
|
||||
});
|
||||
|
||||
const { queryParams, form } = toRefs(data);
|
||||
const { queryParams } = toRefs(data);
|
||||
|
||||
/** 查询登录日志 */
|
||||
const getList = async () => {
|
||||
@ -118,30 +117,33 @@ const handleQuery = () => {
|
||||
};
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields();
|
||||
queryParams.value.pageNum = 1;
|
||||
queryFormRef.value.resetFields();
|
||||
handleQuery()
|
||||
};
|
||||
/** 详细按钮操作 */
|
||||
const handleView = (row: any) => {
|
||||
userInfoDialogRef.value.openDialog(row);
|
||||
};
|
||||
const handleStatusChange = (row) => {
|
||||
const text = row.enabled ? '启用' : '禁用'
|
||||
proxy?.$modal.confirm('此操作将 "' + text + '" ' + row.username + ', 是否继续?', '提示', {
|
||||
const handleStatusChange = (row: any) => {
|
||||
const text = row.status == 0 ? '启用' : '禁用'
|
||||
proxy?.$modal.confirm('此操作将 "' + text + '" ' + row.userName + ', 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
api.edit(row).then(res => {
|
||||
proxy?.$modal.msgSuccess(text + '成功')
|
||||
api.userStatus(row).then(res => {
|
||||
if (res.code == 200) {
|
||||
proxy?.$modal.msgSuccess(text + '成功')
|
||||
getList();
|
||||
}
|
||||
}).catch(() => {
|
||||
row.enabled = !row.enabled
|
||||
row.status = !row.status
|
||||
})
|
||||
}).catch(() => {
|
||||
row.enabled = !row.enabled
|
||||
row.status = !row.status
|
||||
})
|
||||
};
|
||||
onMounted(() => {
|
||||
getList();
|
||||
});
|
||||
onMounted(() => {
|
||||
getList();
|
||||
});
|
||||
</script>
|
||||
|
@ -83,6 +83,7 @@ const getList = async () => {
|
||||
total.value = res.total;
|
||||
bindingLoading.value = false;
|
||||
};
|
||||
// 解绑
|
||||
const handleUnbind = (row) => {
|
||||
proxy?.$modal.confirm.confirm('此操作将解绑设备 "' + row.deviceName + '", 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
|
@ -58,7 +58,6 @@
|
||||
<div @click="handleStatusChange(scope.row)">
|
||||
<el-switch v-model="scope.row.enabled" />
|
||||
</div>
|
||||
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
|
@ -687,10 +687,11 @@ const handleAssignConfirm = () => {
|
||||
getList();
|
||||
assignDialogVisible.value = false
|
||||
return proxy?.$modal.msgSuccess(`设备已分配给客户: ${customerName}`)
|
||||
|
||||
} else {
|
||||
loadingIng.value = false;
|
||||
}
|
||||
}).catch(()=>{
|
||||
loadingIng.value = false;
|
||||
})
|
||||
};
|
||||
const importUpload = ref()
|
||||
@ -757,9 +758,8 @@ const handleBatchAssignConfirm = () => {
|
||||
if (!batchAssignCustomerId.value) {
|
||||
return proxy?.$modal.msgError('请选择客户')
|
||||
}
|
||||
// 这里可以调用批量分配API,传递 crud.selections 和 batchAssignCustomerId
|
||||
// 提取选中设备的 ID 数组
|
||||
const selectedIds = ids.value.map((item) => item.id)
|
||||
const selectedIds = ids.value.map((item:any) => item.id)
|
||||
// 构造请求数据
|
||||
const data = {
|
||||
customerId: batchAssignCustomerId.value, // 目标客户ID
|
||||
@ -771,11 +771,11 @@ const handleBatchAssignConfirm = () => {
|
||||
getList();
|
||||
return proxy?.$modal.msgSuccess(`分配成功`)
|
||||
}
|
||||
}).catch(()=>{
|
||||
|
||||
})
|
||||
};
|
||||
|
||||
|
||||
|
||||
watch(() => form.value.deviceType, (newVal) => {
|
||||
if (dialog.title === '新增设备') { // Only for add form
|
||||
handleDeviceTypeChange(newVal);
|
||||
|
@ -3,7 +3,6 @@
|
||||
<el-form ref="loginRef" :model="loginForm" :rules="loginRules" class="login-form">
|
||||
<div class="title-box">
|
||||
<h3 class="title">{{ title }}</h3>
|
||||
<lang-select />
|
||||
</div>
|
||||
<el-form-item v-if="tenantEnabled" prop="tenantId">
|
||||
<el-select v-model="loginForm.tenantId" filterable :placeholder="proxy.$t('login.selectPlaceholder')"
|
||||
@ -15,18 +14,18 @@
|
||||
</el-form-item>
|
||||
<el-form-item prop="username">
|
||||
<el-input v-model="loginForm.username" type="text" size="large" auto-complete="off"
|
||||
:placeholder="proxy.$t('login.username')">
|
||||
placeholder="账号">
|
||||
<template #prefix><svg-icon icon-class="user" class="el-input__icon input-icon" /></template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="password">
|
||||
<el-input v-model="loginForm.password" type="password" size="large" auto-complete="off"
|
||||
:placeholder="proxy.$t('login.password')" @keyup.enter="handleLogin">
|
||||
placeholder="密码" @keyup.enter="handleLogin">
|
||||
<template #prefix><svg-icon icon-class="password" class="el-input__icon input-icon" /></template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="captchaEnabled" prop="code">
|
||||
<el-input v-model="loginForm.code" size="large" auto-complete="off" :placeholder="proxy.$t('login.code')"
|
||||
<el-input v-model="loginForm.code" size="large" auto-complete="off" placeholder="验证码"
|
||||
style="width: 63%" @keyup.enter="handleLogin">
|
||||
<template #prefix><svg-icon icon-class="validCode" class="el-input__icon input-icon" /></template>
|
||||
</el-input>
|
||||
@ -34,24 +33,6 @@
|
||||
<img :src="codeUrl" class="login-code-img" @click="getCode" />
|
||||
</div>
|
||||
</el-form-item>
|
||||
<!-- <el-checkbox v-model="loginForm.rememberMe" style="margin: 0 0 25px 0">{{ proxy.$t('login.rememberPassword') }}</el-checkbox>
|
||||
<el-form-item style="float: right">
|
||||
<el-button circle :title="proxy.$t('login.social.wechat')" @click="doSocialLogin('wechat')">
|
||||
<svg-icon icon-class="wechat" />
|
||||
</el-button>
|
||||
<el-button circle :title="proxy.$t('login.social.maxkey')" @click="doSocialLogin('maxkey')">
|
||||
<svg-icon icon-class="maxkey" />
|
||||
</el-button>
|
||||
<el-button circle :title="proxy.$t('login.social.topiam')" @click="doSocialLogin('topiam')">
|
||||
<svg-icon icon-class="topiam" />
|
||||
</el-button>
|
||||
<el-button circle :title="proxy.$t('login.social.gitee')" @click="doSocialLogin('gitee')">
|
||||
<svg-icon icon-class="gitee" />
|
||||
</el-button>
|
||||
<el-button circle :title="proxy.$t('login.social.github')" @click="doSocialLogin('github')">
|
||||
<svg-icon icon-class="github" />
|
||||
</el-button>
|
||||
</el-form-item> -->
|
||||
<el-form-item style="width: 100%">
|
||||
<el-button :loading="loading" size="large" type="primary" style="width: 100%" @click.prevent="handleLogin">
|
||||
<span v-if="!loading">{{ proxy.$t('login.login') }}</span>
|
||||
@ -72,14 +53,12 @@ import { useUserStore } from '@/store/modules/user';
|
||||
import { LoginData, TenantVO } from '@/api/types';
|
||||
import { to } from 'await-to-js';
|
||||
import { HttpStatus } from '@/enums/RespEnum';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
|
||||
const title = import.meta.env.VITE_APP_TITLE;
|
||||
const userStore = useUserStore();
|
||||
const router = useRouter();
|
||||
const { t } = useI18n();
|
||||
|
||||
const loginForm = ref<LoginData>({
|
||||
tenantId: '000000',
|
||||
@ -91,10 +70,10 @@ const loginForm = ref<LoginData>({
|
||||
} as LoginData);
|
||||
|
||||
const loginRules: ElFormRules = {
|
||||
tenantId: [{ required: true, trigger: 'blur', message: t('login.rule.tenantId.required') }],
|
||||
username: [{ required: true, trigger: 'blur', message: t('login.rule.username.required') }],
|
||||
password: [{ required: true, trigger: 'blur', message: t('login.rule.password.required') }],
|
||||
code: [{ required: true, trigger: 'change', message: t('login.rule.code.required') }]
|
||||
tenantId: [{ required: true, trigger: 'blur', message: '请输入您的租户编号'}],
|
||||
username: [{ required: true, trigger: 'blur', message: '请输入您的账号' }],
|
||||
password: [{ required: true, trigger: 'blur', message: '请输入您的密码'}],
|
||||
code: [{ required: true, trigger: 'change', message: '请输入验证码'}]
|
||||
};
|
||||
|
||||
const codeUrl = ref('');
|
||||
|
Reference in New Issue
Block a user