Merge branch 'dev' of http://47.109.205.240:3000/Web/daimp-front into dev
This commit is contained in:
commit
9dbb616558
@ -1,7 +1,7 @@
|
|||||||
# 生产环境
|
# 生产环境
|
||||||
VITE_MODE = 'PRO'
|
VITE_MODE = 'PRO'
|
||||||
VITE_APP_MIAN = 'daimp-front-main'
|
VITE_APP_MIAN = 'daimp-front-main'
|
||||||
VITE_APP_MIAN_URL = 'http://47.109.205.240:80'
|
VITE_APP_MIAN_URL = 'http://47.109.205.240'
|
||||||
VITE_APP_NAME = 'sub-government-affairs-service'
|
VITE_APP_NAME = 'sub-government-affairs-service'
|
||||||
# 接口
|
# 接口
|
||||||
VITE_APP_BASE_API = '/apis'
|
VITE_APP_BASE_API = '/apis'
|
||||||
|
@ -26,6 +26,13 @@ export default [
|
|||||||
name: 'system-role',
|
name: 'system-role',
|
||||||
meta: { title: '角色管理', icon: 'Document' },
|
meta: { title: '角色管理', icon: 'Document' },
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/sub-government-affairs-service/system-auth-user',
|
||||||
|
component: () => import('@/views/system/role/authUser.vue'),
|
||||||
|
name: 'system-auth-user',
|
||||||
|
meta: { title: '分配用户', icon: 'Document' },
|
||||||
|
hidden: true,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: '/sub-government-affairs-service/system-menu',
|
path: '/sub-government-affairs-service/system-menu',
|
||||||
component: () => import('@/views/system/menu/index.vue'),
|
component: () => import('@/views/system/menu/index.vue'),
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* @Author: zenghua.wang
|
* @Author: zenghua.wang
|
||||||
* @Date: 2022-02-23 21:12:37
|
* @Date: 2022-02-23 21:12:37
|
||||||
* @LastEditors: zenghua.wang
|
* @LastEditors: zenghua.wang
|
||||||
* @LastEditTime: 2025-03-26 10:02:18
|
* @LastEditTime: 2025-04-08 15:36:24
|
||||||
*/
|
*/
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { ElNotification } from 'element-plus';
|
import { ElNotification } from 'element-plus';
|
||||||
@ -11,7 +11,7 @@ import router from '@/router';
|
|||||||
import { isEmpty } from '@/utils';
|
import { isEmpty } from '@/utils';
|
||||||
import { useUserStore } from '@/store/modules/user';
|
import { useUserStore } from '@/store/modules/user';
|
||||||
|
|
||||||
const { VITE_APP_BASE_API, VITE_APP_UPLOAD_API, VITE_APP_DICDATA_API } = import.meta.env;
|
const { VITE_APP_BASE_API, VITE_APP_UPLOAD_API } = import.meta.env;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建axios实例
|
* 创建axios实例
|
||||||
|
@ -0,0 +1,266 @@
|
|||||||
|
<template>
|
||||||
|
<div class="custom-page">
|
||||||
|
<avue-crud
|
||||||
|
ref="crudRef"
|
||||||
|
v-model:search="state.query"
|
||||||
|
v-model:page="state.pageData"
|
||||||
|
:table-loading="state.loading"
|
||||||
|
:data="state.data"
|
||||||
|
:option="state.options"
|
||||||
|
@refresh-change="refreshChange"
|
||||||
|
@search-reset="searchChange"
|
||||||
|
@search-change="searchChange"
|
||||||
|
@selection-change="selectionChange"
|
||||||
|
@current-change="currentChange"
|
||||||
|
@size-change="sizeChange"
|
||||||
|
>
|
||||||
|
<template #menu-left>
|
||||||
|
<el-button type="primary" icon="plus" @click="rowAdd">选择用户</el-button>
|
||||||
|
<el-button type="danger" icon="close" @click="rowAuthAll(state.selection)">批量取消授权</el-button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #status="{ row }">
|
||||||
|
<el-tag v-if="row.status == 0" type="success">启用</el-tag>
|
||||||
|
<el-tag v-if="row.status == 1" type="danger">禁用</el-tag>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #menu="scope">
|
||||||
|
<custom-table-operate :actions="state.options.actions" :data="scope" />
|
||||||
|
</template>
|
||||||
|
</avue-crud>
|
||||||
|
|
||||||
|
<select-user ref="userRef" :role-id="state.roleId" @on-confirm="rowSave" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script setup>
|
||||||
|
import { reactive, ref } from 'vue';
|
||||||
|
import { useRoute } from 'vue-router';
|
||||||
|
import { useApp } from '@/hooks';
|
||||||
|
import { CRUD_OPTIONS } from '@/config';
|
||||||
|
import { AuthUserList, AuthUserCancel, AuthUserCancelAll, AuthUserSelectAll } from '@/apis/system/auth';
|
||||||
|
import SelectUser from './selectUser.vue';
|
||||||
|
|
||||||
|
const app = useApp();
|
||||||
|
const route = useRoute();
|
||||||
|
const crudRef = ref(null);
|
||||||
|
const userRef = ref(null);
|
||||||
|
const state = reactive({
|
||||||
|
loading: false,
|
||||||
|
query: {
|
||||||
|
current: 1,
|
||||||
|
size: 10,
|
||||||
|
},
|
||||||
|
form: {},
|
||||||
|
selection: [],
|
||||||
|
options: {
|
||||||
|
...CRUD_OPTIONS,
|
||||||
|
addBtn: false,
|
||||||
|
selection: true,
|
||||||
|
rowKey: 'userId',
|
||||||
|
column: [
|
||||||
|
{
|
||||||
|
label: '用户名称',
|
||||||
|
prop: 'userName',
|
||||||
|
search: true,
|
||||||
|
rules: {
|
||||||
|
required: true,
|
||||||
|
message: '请输入',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '用户昵称',
|
||||||
|
prop: 'nickName',
|
||||||
|
rules: {
|
||||||
|
required: true,
|
||||||
|
message: '请输入',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '状态',
|
||||||
|
prop: 'status',
|
||||||
|
type: 'select',
|
||||||
|
dicData: [
|
||||||
|
{
|
||||||
|
label: '启用',
|
||||||
|
value: '0',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '禁用',
|
||||||
|
value: '1',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
value: '0',
|
||||||
|
rules: {
|
||||||
|
required: true,
|
||||||
|
message: '请选择',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '手机',
|
||||||
|
prop: 'phonenumber',
|
||||||
|
search: true,
|
||||||
|
rules: {
|
||||||
|
required: true,
|
||||||
|
message: '请输入',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '邮箱',
|
||||||
|
prop: 'email',
|
||||||
|
rules: {
|
||||||
|
required: true,
|
||||||
|
message: '请输入',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
actions: [
|
||||||
|
{
|
||||||
|
type: 'danger',
|
||||||
|
name: '取消授权',
|
||||||
|
icon: 'close',
|
||||||
|
event: ({ row }) => rowAuth(row),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
pageData: {
|
||||||
|
total: 0,
|
||||||
|
currentPage: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
},
|
||||||
|
data: [],
|
||||||
|
roleId: '',
|
||||||
|
});
|
||||||
|
|
||||||
|
// 加载
|
||||||
|
const loadData = () => {
|
||||||
|
state.loading = true;
|
||||||
|
state.query.roleId = route.query.id;
|
||||||
|
AuthUserList(state.query)
|
||||||
|
.then((res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
const { current, size, total, records } = res.data;
|
||||||
|
state.data = records;
|
||||||
|
state.pageData = {
|
||||||
|
currentPage: current || 1,
|
||||||
|
pageSize: size || 10,
|
||||||
|
total: total,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
app.$message.error(err.msg);
|
||||||
|
state.data = [];
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
state.loading = false;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
loadData();
|
||||||
|
|
||||||
|
// 页数
|
||||||
|
const currentChange = (current) => {
|
||||||
|
state.query.current = current;
|
||||||
|
loadData();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 条数
|
||||||
|
const sizeChange = (size) => {
|
||||||
|
state.query.size = size;
|
||||||
|
loadData();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 搜索
|
||||||
|
const searchChange = (params, done) => {
|
||||||
|
if (done) done();
|
||||||
|
state.query = params;
|
||||||
|
state.query.current = 1;
|
||||||
|
loadData();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 刷新
|
||||||
|
const refreshChange = () => {
|
||||||
|
loadData();
|
||||||
|
app.$message.success('刷新成功');
|
||||||
|
};
|
||||||
|
|
||||||
|
// 选择
|
||||||
|
const selectionChange = (rows) => {
|
||||||
|
state.selection = rows;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 取消授权
|
||||||
|
const rowAuth = (row) => {
|
||||||
|
const roleId = route.query.id;
|
||||||
|
app
|
||||||
|
.$confirm(`确认要取消该用户 ${row.userName} 角色吗?`, '确定取消', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning',
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
AuthUserCancel({ roleId: roleId, userId: row.userId })
|
||||||
|
.then((res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
app.$message.success('取消授权成功!');
|
||||||
|
loadData();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
app.$message.error(err.msg);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 批量取消授权
|
||||||
|
const rowAuthAll = () => {
|
||||||
|
const roleId = route.query.id;
|
||||||
|
const userIds = state.selection.map((item) => item.userId);
|
||||||
|
app
|
||||||
|
.$confirm(`是否取消选中用户授权数据项?`, '确定取消', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning',
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
AuthUserCancelAll({ roleId: roleId, userIds: userIds.join(',') })
|
||||||
|
.then((res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
app.$message.success('取消授权成功!');
|
||||||
|
loadData();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
app.$message.error(err.msg);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 添加
|
||||||
|
const rowAdd = () => {
|
||||||
|
state.roleId = route.query.id;
|
||||||
|
userRef?.value && userRef.value.show();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 授权用户
|
||||||
|
const rowSave = (data) => {
|
||||||
|
AuthUserSelectAll(data)
|
||||||
|
.then((res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
app.$message.success('授权用户成功!');
|
||||||
|
loadData();
|
||||||
|
userRef.value.hide();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
app.$message.error(err.msg);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
</script>
|
@ -473,10 +473,10 @@ const rowScopeSave = () => {
|
|||||||
|
|
||||||
// 分配用户
|
// 分配用户
|
||||||
const rowUser = (row) => {
|
const rowUser = (row) => {
|
||||||
// router.push({
|
router.push({
|
||||||
// path: '/sub-government-affairs-service/system-auth-user',
|
path: '/sub-government-affairs-service/system-auth-user',
|
||||||
// query: { id: row.roleId },
|
query: { id: row.roleId },
|
||||||
// });
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// 新增
|
// 新增
|
||||||
|
@ -0,0 +1,227 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog
|
||||||
|
v-model="state.visible"
|
||||||
|
draggable
|
||||||
|
append-to-body
|
||||||
|
title="选择用户"
|
||||||
|
width="70%"
|
||||||
|
class="avue-dialog"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
:close-on-press-escape="false"
|
||||||
|
@close="state.visible = false"
|
||||||
|
>
|
||||||
|
<avue-crud
|
||||||
|
ref="crudRef"
|
||||||
|
v-model:search="state.query"
|
||||||
|
v-model:page="state.pageData"
|
||||||
|
:table-loading="state.loading"
|
||||||
|
:data="state.data"
|
||||||
|
:option="state.options"
|
||||||
|
@refresh-change="refreshChange"
|
||||||
|
@search-reset="searchChange"
|
||||||
|
@search-change="searchChange"
|
||||||
|
@selection-change="selectionChange"
|
||||||
|
@current-change="currentChange"
|
||||||
|
@size-change="sizeChange"
|
||||||
|
>
|
||||||
|
<template #status="{ row }">
|
||||||
|
<el-tag v-if="row.status == 0" type="success">启用</el-tag>
|
||||||
|
<el-tag v-if="row.status == 1" type="danger">禁用</el-tag>
|
||||||
|
</template>
|
||||||
|
</avue-crud>
|
||||||
|
|
||||||
|
<div class="avue-dialog__footer avue-dialog__footer--right">
|
||||||
|
<el-button type="primary" icon="CircleCheck" @click="onConfirm">确 定</el-button>
|
||||||
|
<el-button icon="CircleClose" @click="state.visible = false">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
<script setup>
|
||||||
|
import { reactive, ref } from 'vue';
|
||||||
|
import { useApp } from '@/hooks';
|
||||||
|
import { CRUD_OPTIONS } from '@/config';
|
||||||
|
import { isEmpty } from '@/utils';
|
||||||
|
import { UnAuthUserList } from '@/apis/system/auth';
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
roleId: {
|
||||||
|
type: [Number, String],
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const emit = defineEmits(['on-confirm']);
|
||||||
|
|
||||||
|
const app = useApp();
|
||||||
|
const crudRef = ref(null);
|
||||||
|
const state = reactive({
|
||||||
|
visible: false,
|
||||||
|
loading: false,
|
||||||
|
query: {
|
||||||
|
current: 1,
|
||||||
|
size: 10,
|
||||||
|
},
|
||||||
|
form: {},
|
||||||
|
selection: [],
|
||||||
|
options: {
|
||||||
|
...CRUD_OPTIONS,
|
||||||
|
menu: false,
|
||||||
|
addBtn: false,
|
||||||
|
selection: true,
|
||||||
|
rowKey: 'userId',
|
||||||
|
column: [
|
||||||
|
{
|
||||||
|
label: '用户名称',
|
||||||
|
prop: 'userName',
|
||||||
|
search: true,
|
||||||
|
rules: {
|
||||||
|
required: true,
|
||||||
|
message: '请输入',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '用户昵称',
|
||||||
|
prop: 'nickName',
|
||||||
|
rules: {
|
||||||
|
required: true,
|
||||||
|
message: '请输入',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '状态',
|
||||||
|
prop: 'status',
|
||||||
|
type: 'select',
|
||||||
|
dicData: [
|
||||||
|
{
|
||||||
|
label: '启用',
|
||||||
|
value: '0',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '禁用',
|
||||||
|
value: '1',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
value: '0',
|
||||||
|
rules: {
|
||||||
|
required: true,
|
||||||
|
message: '请选择',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '手机',
|
||||||
|
prop: 'phonenumber',
|
||||||
|
search: true,
|
||||||
|
rules: {
|
||||||
|
required: true,
|
||||||
|
message: '请输入',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '邮箱',
|
||||||
|
prop: 'email',
|
||||||
|
rules: {
|
||||||
|
required: true,
|
||||||
|
message: '请输入',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
pageData: {
|
||||||
|
total: 0,
|
||||||
|
currentPage: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
},
|
||||||
|
data: [],
|
||||||
|
});
|
||||||
|
|
||||||
|
// 加载
|
||||||
|
const loadData = () => {
|
||||||
|
state.loading = true;
|
||||||
|
state.query.roleId = props.id;
|
||||||
|
UnAuthUserList(state.query)
|
||||||
|
.then((res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
const { current, size, total, records } = res.data;
|
||||||
|
state.data = records;
|
||||||
|
state.pageData = {
|
||||||
|
currentPage: current || 1,
|
||||||
|
pageSize: size || 10,
|
||||||
|
total: total,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
app.$message.error(err.msg);
|
||||||
|
state.data = [];
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
state.loading = false;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 页数
|
||||||
|
const currentChange = (current) => {
|
||||||
|
state.query.current = current;
|
||||||
|
loadData();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 条数
|
||||||
|
const sizeChange = (size) => {
|
||||||
|
state.query.size = size;
|
||||||
|
loadData();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 搜索
|
||||||
|
const searchChange = (params, done) => {
|
||||||
|
if (done) done();
|
||||||
|
state.query = params;
|
||||||
|
state.query.current = 1;
|
||||||
|
loadData();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 刷新
|
||||||
|
const refreshChange = () => {
|
||||||
|
loadData();
|
||||||
|
app.$message.success('刷新成功');
|
||||||
|
};
|
||||||
|
|
||||||
|
// 选择
|
||||||
|
const selectionChange = (rows) => {
|
||||||
|
state.selection = rows;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 选择授权用户操作
|
||||||
|
const onConfirm = () => {
|
||||||
|
const roleId = props.roleId;
|
||||||
|
const userIds = state.selection.map((item) => item.userId);
|
||||||
|
if (isEmpty(userIds)) {
|
||||||
|
app.$message.error('请选择要分配的用户!');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
emit('on-confirm', { roleId: roleId, userIds: userIds.join(',') });
|
||||||
|
};
|
||||||
|
|
||||||
|
// watch(
|
||||||
|
// () => props.roleId,
|
||||||
|
// (val) => {},
|
||||||
|
// {
|
||||||
|
// deep: true,
|
||||||
|
// immediate: true,
|
||||||
|
// }
|
||||||
|
// );
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
show: () => {
|
||||||
|
loadData();
|
||||||
|
state.visible = true;
|
||||||
|
},
|
||||||
|
hide: () => {
|
||||||
|
state.visible = false;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
</script>
|
@ -1,6 +1,6 @@
|
|||||||
# 生产环境
|
# 生产环境
|
||||||
VITE_APP_MIAN = 'daimp-front-main'
|
VITE_APP_MIAN = 'daimp-front-main'
|
||||||
VITE_APP_MIAN_URL = 'http://47.109.205.240:88'
|
VITE_APP_MIAN_URL = 'http://47.109.205.240'
|
||||||
VITE_APP_NAME = 'sub-government-screen-service'
|
VITE_APP_NAME = 'sub-government-screen-service'
|
||||||
# 接口
|
# 接口
|
||||||
VITE_APP_BASE_API = '/apis'
|
VITE_APP_BASE_API = '/apis'
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# 生产环境
|
# 生产环境
|
||||||
VITE_APP_MIAN = 'daimp-front-main'
|
VITE_APP_MIAN = 'daimp-front-main'
|
||||||
VITE_APP_MIAN_URL = 'http://47.109.205.240:88'
|
VITE_APP_MIAN_URL = 'http://47.109.205.240'
|
||||||
VITE_APP_NAME = 'sub-operation-service'
|
VITE_APP_NAME = 'sub-operation-service'
|
||||||
# 接口
|
# 接口
|
||||||
VITE_APP_BASE_API = '/apis'
|
VITE_APP_BASE_API = '/apis'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user