提交 3f03c869 authored 作者: 刘旭's avatar 刘旭

优化

上级 fd34fd18
...@@ -2,6 +2,7 @@ import httpRequest from "@/services/common"; ...@@ -2,6 +2,7 @@ import httpRequest from "@/services/common";
import { userUrlConfig, authUrlConfig } from '@/services/config'; import { userUrlConfig, authUrlConfig } from '@/services/config';
import { store } from '@/store/index' import { store } from '@/store/index'
import { LoginParm, LoginResult, UserInfo } from "@/services/types/user/userModel"; import { LoginParm, LoginResult, UserInfo } from "@/services/types/user/userModel";
import { request } from '../config';
export async function getImagApi() { export async function getImagApi() {
//获取验证码接口 //获取验证码接口
...@@ -47,3 +48,13 @@ export const getAllRole = async () => { ...@@ -47,3 +48,13 @@ export const getAllRole = async () => {
export const findRoleByUser = async (params: any) => { export const findRoleByUser = async (params: any) => {
return await httpRequest.get(authUrlConfig['findRoleByUser'], params) return await httpRequest.get(authUrlConfig['findRoleByUser'], params)
} }
// 启用与禁用
export const userEnabled = (userId: number) => {
return request({
url: '/userAccount/enabled',
method: 'post',
data: { userId }
})
}
...@@ -88,6 +88,8 @@ let rules = ref({ ...@@ -88,6 +88,8 @@ let rules = ref({
let dictRef = ref() let dictRef = ref()
let handleFilter = () => { let handleFilter = () => {
if (dictQuery.value.dictName)
dictQuery.value.dictName = ',' + dictQuery.value.dictName + ','
init(dictQuery.value) init(dictQuery.value)
} }
...@@ -196,6 +198,8 @@ let init = (params?: any) => { ...@@ -196,6 +198,8 @@ let init = (params?: any) => {
getDictList(params).then((res: any) => { getDictList(params).then((res: any) => {
dictData.value = res.data.records dictData.value = res.data.records
total.value = res.data.total total.value = res.data.total
let reg = new RegExp(',', "g")
dictQuery.value.dictName = dictQuery.value.dictName.replace(reg, '')
console.log(res, '字典数据'); console.log(res, '字典数据');
}) })
} }
......
...@@ -15,6 +15,12 @@ ...@@ -15,6 +15,12 @@
{{ moment(scope.row.fdate).format("YYYY-MM-DD hh:mm:ss") }} {{ moment(scope.row.fdate).format("YYYY-MM-DD hh:mm:ss") }}
</template> </template>
</el-table-column> </el-table-column>
<!-- 设置启用禁用 -->
<el-table-column label="是否启用" align="center">
<template #default="scope">
<el-switch v-model="scope.row.enabled" @change="switchChange($event, scope.row.userId)" />
</template>
</el-table-column>
<el-table-column label="操作" width="135" align="center"> <el-table-column label="操作" width="135" align="center">
<template #default="scope"> <template #default="scope">
<el-link type="primary" :underline="false" @click="handleEdit(scope)">编辑</el-link> <el-link type="primary" :underline="false" @click="handleEdit(scope)">编辑</el-link>
...@@ -62,7 +68,7 @@ ...@@ -62,7 +68,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { reactive, ref, watch, computed } from 'vue' import { reactive, ref, watch, computed } from 'vue'
import { ElMessageBox } from 'element-plus'; import { ElMessageBox } from 'element-plus';
import { addUser, getUserInfo, editUser, deleteUser, getAllRole, findRoleByUser } from '@/services/api/user/userAPI' import { addUser, getUserInfo, editUser, deleteUser, getAllRole, findRoleByUser, userEnabled } from '@/services/api/user/userAPI'
import { uploadPath } from "@/services/api/storage"; import { uploadPath } from "@/services/api/storage";
import moment from 'moment'; import moment from 'moment';
import pagination from '@/components/pagination/index.vue' import pagination from '@/components/pagination/index.vue'
...@@ -239,6 +245,17 @@ function init() { ...@@ -239,6 +245,17 @@ function init() {
}) })
} }
// 是否启用
const switchChange = (value: boolean, userId: any) => {
// console.log(value, userId);
userEnabled(userId).then((res: any) => {
if (res.code === 200) {
init()
}
})
}
// 上传头像
let uploadPicUrl = (res: any) => { let uploadPicUrl = (res: any) => {
console.log(res); console.log(res);
avatarUrl.value = res.data.url; avatarUrl.value = res.data.url;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论