app登录接口联调
This commit is contained in:
@ -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>
|
||||
|
Reference in New Issue
Block a user