联调
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<el-dialog v-model="dialogVisible" :title="dialogTitle" width="800px">
|
||||
<Dialog v-model="dialogVisible" :title="dialogTitle" width="800px">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
v-loading="formLoading"
|
||||
@@ -61,7 +61,7 @@
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</Dialog>
|
||||
</template>
|
||||
<script lang="ts" name="SystemDeptForm" setup>
|
||||
import { defaultProps, handleTree } from '@/utils/tree'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<el-dialog :title="title" v-model="dialogVisible" width="800px">
|
||||
<Dialog :title="title" v-model="dialogVisible" width="800px">
|
||||
<el-form :model="form" ref="addForm" :rules="rules" label-width="100px">
|
||||
<el-form-item label="知识库名称" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入" />
|
||||
@@ -21,7 +21,7 @@
|
||||
<el-button type="primary" @click="handleSave">保 存</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</Dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<el-dialog :title="title" v-model="show" width="800px">
|
||||
<Dialog :title="title" v-model="show" width="800px">
|
||||
<el-form :model="form" ref="resourceForm" :rules="rules" label-width="60px">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12" :offset="0">
|
||||
@@ -63,7 +63,7 @@
|
||||
<el-button type="primary" @click="handleSave">保 存</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</Dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<Dialog v-model="dialogVisible" :title="dialogTitle">
|
||||
<Dialog v-model="dialogVisible" :title="dialogTitle" width="500px">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
v-loading="formLoading"
|
||||
@@ -59,8 +59,8 @@
|
||||
</el-form-item>
|
||||
<el-form-item label="菜单状态" prop="status">
|
||||
<el-radio-group v-model="formData.status">
|
||||
<el-radio :label="1"> 启用 </el-radio>
|
||||
<el-radio :label="0"> 禁用 </el-radio>
|
||||
<el-radio :label="0"> 启用 </el-radio>
|
||||
<el-radio :label="1"> 禁用 </el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="formData.type !== 3" label="显示状态" prop="visible">
|
||||
@@ -105,7 +105,7 @@
|
||||
</template>
|
||||
<script lang="ts" name="SystemMenuForm" setup>
|
||||
// import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
||||
// import * as MenuApi from '@/api/system/menu'
|
||||
import * as MenuApi from '@/api/system/menu'
|
||||
import { CACHE_KEY, useCache } from '@/hooks/web/useCache'
|
||||
import { CommonStatusEnum, SystemMenuTypeEnum } from '@/utils/constants'
|
||||
import { defaultProps, handleTree } from '@/utils/tree'
|
||||
@@ -155,7 +155,7 @@ const open = async (type: string, id?: number, parentId?: number) => {
|
||||
if (id) {
|
||||
formLoading.value = true
|
||||
try {
|
||||
// formData.value = await MenuApi.getMenu(id)
|
||||
formData.value = await MenuApi.getMenu(id)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
@@ -189,12 +189,12 @@ const submitForm = async () => {
|
||||
}
|
||||
}
|
||||
}
|
||||
// const data = formData.value as unknown as MenuApi.MenuVO
|
||||
const data = formData.value as unknown as MenuApi.MenuVO
|
||||
if (formType.value === 'create') {
|
||||
// await MenuApi.createMenu(data)
|
||||
await MenuApi.createMenu(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
// await MenuApi.updateMenu(data)
|
||||
await MenuApi.updateMenu(data)
|
||||
message.success(t('common.updateSuccess'))
|
||||
}
|
||||
dialogVisible.value = false
|
||||
@@ -211,8 +211,7 @@ const submitForm = async () => {
|
||||
const menuTree = ref<Tree[]>([]) // 树形结构
|
||||
const getTree = async () => {
|
||||
menuTree.value = []
|
||||
// const res = await MenuApi.getSimpleMenusList()
|
||||
const res = []
|
||||
const res = await MenuApi.getSimpleMenusList()
|
||||
let menu: Tree = { id: 0, name: '主类目', children: [] }
|
||||
menu.children = handleTree(res)
|
||||
menuTree.value.push(menu)
|
||||
|
||||
@@ -80,8 +80,8 @@
|
||||
<MenuForm ref="formRef" @success="getList" />
|
||||
</template>
|
||||
<script lang="ts" name="SystemMenu" setup>
|
||||
// import { handleTree } from '@/utils/tree'
|
||||
// import * as MenuApi from '@/api/system/menu'
|
||||
import { handleTree } from '@/utils/tree'
|
||||
import * as MenuApi from '@/api/system/menu'
|
||||
import MenuForm from './MenuForm.vue'
|
||||
import { CACHE_KEY, useCache } from '@/hooks/web/useCache'
|
||||
const { wsCache } = useCache()
|
||||
@@ -102,9 +102,8 @@ const refreshTable = ref(true) // 重新渲染表格状态
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
// const data = await MenuApi.getMenuList(queryParams)
|
||||
// list.value = handleTree(data)
|
||||
list.value = []
|
||||
const data = await MenuApi.getMenuList(queryParams)
|
||||
list.value = handleTree(data)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
@@ -154,7 +153,7 @@ const handleDelete = async (id: number) => {
|
||||
// 删除的二次确认
|
||||
await message.delConfirm()
|
||||
// 发起删除
|
||||
// await MenuApi.deleteMenu(id)
|
||||
await MenuApi.deleteMenu(id)
|
||||
message.success(t('common.delSuccess'))
|
||||
// 刷新列表
|
||||
await getList()
|
||||
|
||||
@@ -20,6 +20,21 @@
|
||||
</template>
|
||||
|
||||
<script setup name="RoleEmployee">
|
||||
import * as UserApi from '@/api/system/user'
|
||||
|
||||
const props = defineProps({
|
||||
roleId: {
|
||||
type: Number
|
||||
}
|
||||
})
|
||||
|
||||
watch(
|
||||
() => props.roleId,
|
||||
(newValue) => {
|
||||
getList(newValue)
|
||||
}
|
||||
)
|
||||
|
||||
const loading = ref(false)
|
||||
const tableList = ref([])
|
||||
const total = ref(0)
|
||||
@@ -27,15 +42,25 @@ const pageSize = ref(20)
|
||||
const currentPage = ref(1)
|
||||
|
||||
const columns = ref([
|
||||
{ prop: 'userName', label: '姓名' },
|
||||
{ prop: '', label: '手机号' },
|
||||
{ prop: '', label: '部门' },
|
||||
{ prop: '', label: '角色', width: '300px' },
|
||||
{ prop: '', label: '性别' }
|
||||
{ prop: 'nickname', label: '姓名' },
|
||||
{ prop: 'mobile', label: '手机号' },
|
||||
{ prop: 'deptName', label: '部门' },
|
||||
{ prop: '', label: '角色', width: '300px' }
|
||||
])
|
||||
|
||||
function getList() {
|
||||
tableList.value = [{ userName: '测试', phone: '18899998888' }]
|
||||
async function getList() {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await UserApi.getUserPage({
|
||||
pageNo: currentPage.value,
|
||||
pageSize: pageSize.value,
|
||||
roleId: props.roleId
|
||||
})
|
||||
tableList.value = data.list
|
||||
total.value = data.total
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-form ref="formRef" v-loading="formLoading" :model="formData" label-width="0px">
|
||||
<el-form ref="formRef" v-loading="formLoading" label-width="0px">
|
||||
<el-form-item>
|
||||
<el-tree
|
||||
ref="treeRef"
|
||||
@@ -19,41 +19,45 @@
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" name="RoleAssignMenuForm" setup>
|
||||
import { defaultProps } from '@/utils/tree'
|
||||
// import * as MenuApi from '@/api/system/menu'
|
||||
// import * as PermissionApi from '@/api/system/permission'
|
||||
import { defaultProps, handleTree } from '@/utils/tree'
|
||||
import * as MenuApi from '@/api/system/menu'
|
||||
import * as PermissionApi from '@/api/system/permission'
|
||||
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
||||
const props = defineProps({
|
||||
roleId: {
|
||||
type: Number
|
||||
}
|
||||
})
|
||||
|
||||
watch(
|
||||
() => props.roleId,
|
||||
(newValue) => {
|
||||
getCheckedMenu(newValue)
|
||||
}
|
||||
)
|
||||
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
const formData = reactive({
|
||||
id: 0,
|
||||
name: '',
|
||||
menuIds: []
|
||||
})
|
||||
const formRef = ref() // 表单 Ref
|
||||
const menuOptions = ref<any[]>([]) // 菜单树形结构
|
||||
const treeRef = ref() // 菜单树组件 Ref
|
||||
|
||||
/** 提交表单 */
|
||||
const submitForm = async () => {
|
||||
// 校验表单
|
||||
if (!formRef.value) return
|
||||
const valid = await formRef.value.validate()
|
||||
if (!valid) return
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
// const data = {
|
||||
// roleId: formData.id,
|
||||
// menuIds: [
|
||||
// ...(treeRef.value.getCheckedKeys(false) as unknown as Array<number>), // 获得当前选中节点
|
||||
// ...(treeRef.value.getHalfCheckedKeys() as unknown as Array<number>) // 获得半选中的父节点
|
||||
// ]
|
||||
// }
|
||||
// await PermissionApi.assignRoleMenu(data)
|
||||
const data = {
|
||||
roleId: props.roleId,
|
||||
menuIds: [
|
||||
...(treeRef.value.getCheckedKeys(false) as unknown as Array<number>), // 获得当前选中节点
|
||||
...(treeRef.value.getHalfCheckedKeys() as unknown as Array<number>) // 获得半选中的父节点
|
||||
]
|
||||
}
|
||||
await PermissionApi.assignRoleMenu(data)
|
||||
message.success(t('common.updateSuccess'))
|
||||
dialogVisible.value = false
|
||||
} finally {
|
||||
@@ -61,25 +65,29 @@ const submitForm = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
const checkedMenuIds = ref([])
|
||||
|
||||
async function init() {
|
||||
menuOptions.value = handleTree(await MenuApi.getSimpleMenusList())
|
||||
getCheckedMenu(props.roleId)
|
||||
}
|
||||
|
||||
async function getCheckedMenu(id) {
|
||||
formLoading.value = true
|
||||
try {
|
||||
checkedMenuIds.value = await PermissionApi.getRoleMenuList(id)
|
||||
treeRef.value.setCheckedKeys([], false)
|
||||
// 设置选中
|
||||
checkedMenuIds.value.forEach((menuId: number) => {
|
||||
treeRef.value.setChecked(menuId, true, false)
|
||||
})
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
menuOptions.value = [
|
||||
{
|
||||
name: '统计报表',
|
||||
id: '10001',
|
||||
children: [
|
||||
{ name: '首页', id: '20001' },
|
||||
{ name: 'XX统计', id: '20002' }
|
||||
]
|
||||
},
|
||||
{
|
||||
name: '线索管理',
|
||||
id: '10002',
|
||||
children: [
|
||||
{ name: '线索库', id: '20002' },
|
||||
{ name: '成交管理', id: '20003' }
|
||||
]
|
||||
}
|
||||
]
|
||||
init()
|
||||
})
|
||||
</script>
|
||||
<style lang="scss" scoped></style>
|
||||
|
||||
@@ -15,36 +15,38 @@
|
||||
label="权限范围"
|
||||
style="display: flex"
|
||||
>
|
||||
<template #header>
|
||||
全选/全不选:
|
||||
<el-switch
|
||||
v-model="treeNodeAll"
|
||||
active-text="是"
|
||||
inactive-text="否"
|
||||
inline-prompt
|
||||
@change="handleCheckedTreeNodeAll()"
|
||||
<el-card class="card" shadow="never">
|
||||
<template #header>
|
||||
全选/全不选:
|
||||
<el-switch
|
||||
v-model="treeNodeAll"
|
||||
active-text="是"
|
||||
inactive-text="否"
|
||||
inline-prompt
|
||||
@change="handleCheckedTreeNodeAll()"
|
||||
/>
|
||||
全部展开/折叠:
|
||||
<el-switch
|
||||
v-model="deptExpand"
|
||||
active-text="展开"
|
||||
inactive-text="折叠"
|
||||
inline-prompt
|
||||
@change="handleCheckedTreeExpand"
|
||||
/>
|
||||
父子联动(选中父节点,自动选择子节点):
|
||||
<el-switch v-model="checkStrictly" active-text="是" inactive-text="否" inline-prompt />
|
||||
</template>
|
||||
<el-tree
|
||||
ref="treeRef"
|
||||
:check-strictly="!checkStrictly"
|
||||
:data="deptOptions"
|
||||
:props="defaultProps"
|
||||
default-expand-all
|
||||
empty-text="加载中,请稍后"
|
||||
node-key="id"
|
||||
show-checkbox
|
||||
/>
|
||||
全部展开/折叠:
|
||||
<el-switch
|
||||
v-model="deptExpand"
|
||||
active-text="展开"
|
||||
inactive-text="折叠"
|
||||
inline-prompt
|
||||
@change="handleCheckedTreeExpand"
|
||||
/>
|
||||
父子联动(选中父节点,自动选择子节点):
|
||||
<el-switch v-model="checkStrictly" active-text="是" inactive-text="否" inline-prompt />
|
||||
</template>
|
||||
<el-tree
|
||||
ref="treeRef"
|
||||
:check-strictly="!checkStrictly"
|
||||
:data="deptOptions"
|
||||
:props="defaultProps"
|
||||
default-expand-all
|
||||
empty-text="加载中,请稍后"
|
||||
node-key="id"
|
||||
show-checkbox
|
||||
/>
|
||||
</el-card>
|
||||
</el-form-item>
|
||||
<el-form-item label-width="0">
|
||||
<el-button :disabled="formLoading" type="primary" @click="submitForm">保存权限</el-button>
|
||||
@@ -52,15 +54,31 @@
|
||||
</el-form>
|
||||
</template>
|
||||
<script lang="ts" name="RoleDataPermissionForm" setup>
|
||||
// import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
||||
import { defaultProps, handleTree } from '@/utils/tree'
|
||||
import { SystemDataScopeEnum } from '@/utils/constants'
|
||||
|
||||
import * as DeptApi from '@/api/system/dept'
|
||||
import * as PermissionApi from '@/api/system/permission'
|
||||
import * as RoleApi from '@/api/system/role'
|
||||
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
||||
const props = defineProps({
|
||||
roleId: {
|
||||
type: Number
|
||||
}
|
||||
})
|
||||
|
||||
watch(
|
||||
() => props.roleId,
|
||||
(newValue) => {
|
||||
getRoleInfo(newValue)
|
||||
}
|
||||
)
|
||||
|
||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
const formData = reactive({
|
||||
const formData = ref({
|
||||
id: 0,
|
||||
name: '',
|
||||
dataScope: undefined,
|
||||
@@ -82,12 +100,24 @@ const dataScopeOptions = [
|
||||
{ label: '仅本人数据权限', value: 5 }
|
||||
]
|
||||
|
||||
async function getRoleInfo(id) {
|
||||
formData.value = await RoleApi.getRole(id)
|
||||
}
|
||||
|
||||
/** 提交表单 */
|
||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||
const submitForm = async () => {
|
||||
formLoading.value = true
|
||||
try {
|
||||
// await PermissionApi.assignRoleDataScope(data)
|
||||
const data = {
|
||||
roleId: formData.value.id,
|
||||
dataScope: formData.value.dataScope,
|
||||
dataScopeDeptIds:
|
||||
formData.value.dataScope !== SystemDataScopeEnum.DEPT_CUSTOM
|
||||
? []
|
||||
: treeRef.value.getCheckedKeys(false)
|
||||
}
|
||||
await PermissionApi.assignRoleDataScope(data)
|
||||
message.success(t('common.updateSuccess'))
|
||||
// 发送操作成功的事件
|
||||
emit('success')
|
||||
@@ -112,56 +142,12 @@ const handleCheckedTreeExpand = () => {
|
||||
}
|
||||
}
|
||||
|
||||
deptOptions.value = handleTree([
|
||||
{
|
||||
id: 100,
|
||||
name: '芋道源码',
|
||||
parentId: 0
|
||||
},
|
||||
{
|
||||
id: 101,
|
||||
name: '深圳总公司',
|
||||
parentId: 100
|
||||
},
|
||||
{
|
||||
id: 103,
|
||||
name: '研发部门',
|
||||
parentId: 101
|
||||
},
|
||||
{
|
||||
id: 108,
|
||||
name: '市场部门',
|
||||
parentId: 102
|
||||
},
|
||||
{
|
||||
id: 102,
|
||||
name: '长沙分公司',
|
||||
parentId: 100
|
||||
},
|
||||
{
|
||||
id: 104,
|
||||
name: '市场部门',
|
||||
parentId: 101
|
||||
},
|
||||
{
|
||||
id: 109,
|
||||
name: '财务部门',
|
||||
parentId: 102
|
||||
},
|
||||
{
|
||||
id: 105,
|
||||
name: '测试部门',
|
||||
parentId: 101
|
||||
},
|
||||
{
|
||||
id: 106,
|
||||
name: '财务部门',
|
||||
parentId: 101
|
||||
},
|
||||
{
|
||||
id: 107,
|
||||
name: '运维部门',
|
||||
parentId: 101
|
||||
}
|
||||
])
|
||||
async function init() {
|
||||
getRoleInfo(props.roleId)
|
||||
deptOptions.value = handleTree(await DeptApi.getSimpleDeptList())
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
init()
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<el-dialog v-model="dialogVisible" :title="dialogTitle" width="400px">
|
||||
<Dialog v-model="dialogVisible" :title="dialogTitle" width="400px">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
v-loading="formLoading"
|
||||
@@ -19,11 +19,11 @@
|
||||
<el-button :disabled="formLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</Dialog>
|
||||
</template>
|
||||
<script lang="ts" name="SystemRoleForm" setup>
|
||||
// import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
||||
// import * as RoleApi from '@/api/system/role'
|
||||
import * as RoleApi from '@/api/system/role'
|
||||
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
@@ -51,11 +51,7 @@ const open = async (type: string, id?: number) => {
|
||||
if (id) {
|
||||
formLoading.value = true
|
||||
try {
|
||||
// formData.value = await RoleApi.getRole(id)
|
||||
formData.value = {
|
||||
id: undefined,
|
||||
name: ''
|
||||
}
|
||||
formData.value = await RoleApi.getRole(id)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
@@ -82,12 +78,12 @@ const submitForm = async () => {
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
// const data = formData.value as unknown as RoleApi.RoleVO
|
||||
const data = formData.value as unknown as RoleApi.RoleVO
|
||||
if (formType.value === 'create') {
|
||||
// await RoleApi.createRole(data)
|
||||
await RoleApi.createRole(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
// await RoleApi.updateRole(data)
|
||||
await RoleApi.updateRole(data)
|
||||
message.success(t('common.updateSuccess'))
|
||||
}
|
||||
dialogVisible.value = false
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
class="ml-10px"
|
||||
style="padding: 0px"
|
||||
text
|
||||
@click="handleDelete(index)"
|
||||
@click="handleDelete(item.id)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
@@ -39,21 +39,33 @@
|
||||
<Pagination
|
||||
v-model:limit="queryParams.pageSize"
|
||||
v-model:page="queryParams.pageNo"
|
||||
layout="total, prev, pager, next"
|
||||
small
|
||||
:total="total"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</div>
|
||||
</el-card>
|
||||
<el-card class="ml-20px" style="flex: 1" shadow="always" :body-style="{ padding: '10px' }">
|
||||
<el-tabs v-model="roleOperateIndex" type="card">
|
||||
<el-tabs v-if="list && list.length" v-model="roleOperateIndex" type="card">
|
||||
<el-tab-pane label="角色用户" :name="1">
|
||||
<RoleEmployee />
|
||||
<RoleEmployee v-if="roleOperateIndex == 1" :roleId="list[libraryIndex].id" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="菜单权限" :name="2">
|
||||
<RoleAssignMenuForm ref="assignMenuFormRef" @success="getList" />
|
||||
<RoleAssignMenuForm
|
||||
v-if="roleOperateIndex == 2"
|
||||
ref="assignMenuFormRef"
|
||||
:roleId="list[libraryIndex].id"
|
||||
@success="getList"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="数据权限" :name="3">
|
||||
<RoleDataPermissionForm ref="dataPermissionFormRef" @success="getList" />
|
||||
<RoleDataPermissionForm
|
||||
v-if="roleOperateIndex == 3"
|
||||
ref="dataPermissionFormRef"
|
||||
:roleId="list[libraryIndex].id"
|
||||
@success="getList"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-card>
|
||||
@@ -66,6 +78,7 @@ import RoleForm from './RoleForm.vue'
|
||||
import RoleEmployee from './Comp/RoleEmployee.vue'
|
||||
import RoleAssignMenuForm from './RoleAssignMenuForm.vue'
|
||||
import RoleDataPermissionForm from './RoleDataPermissionForm.vue'
|
||||
import * as RoleApi from '@/api/system/role'
|
||||
|
||||
const message = useMessage() // 消息弹窗
|
||||
const { t } = useI18n() // 国际化
|
||||
@@ -76,14 +89,14 @@ const list = ref([]) // 列表的数据
|
||||
const libraryIndex = ref(0)
|
||||
const queryParams = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10
|
||||
pageSize: 20
|
||||
})
|
||||
|
||||
/** 查询角色列表 */
|
||||
const getList = async () => {
|
||||
// const data = await RoleApi.getRolePage(queryParams)
|
||||
list.value = [{ id: 1, name: '管理员' }]
|
||||
total.value = 0
|
||||
const data = await RoleApi.getRolePage(queryParams)
|
||||
list.value = data.list
|
||||
total.value = data.total
|
||||
}
|
||||
|
||||
/** 添加/修改操作 */
|
||||
@@ -101,12 +114,10 @@ const assignMenuFormRef = ref()
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (id: number) => {
|
||||
try {
|
||||
console.log(id)
|
||||
|
||||
// 删除的二次确认
|
||||
await message.delConfirm()
|
||||
// 发起删除
|
||||
// await RoleApi.deleteRole(id)
|
||||
await RoleApi.deleteRole(id)
|
||||
message.success(t('common.delSuccess'))
|
||||
// 刷新列表
|
||||
await getList()
|
||||
@@ -121,4 +132,8 @@ onMounted(() => {
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
<style lang="scss" scoped>
|
||||
.actived {
|
||||
background-color: var(--el-color-primary-light-9);
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<el-dialog :title="dialogTitle" v-model="dialogVisible" width="800px">
|
||||
<Dialog :title="dialogTitle" v-model="dialogVisible" width="800px">
|
||||
<el-tabs v-model="tabName">
|
||||
<el-tab-pane label="线索信息" name="info">
|
||||
<Form
|
||||
@@ -77,7 +77,7 @@
|
||||
<el-button :disabled="formLoading" type="primary" @click="handleSave">保 存</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</Dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<el-dialog :title="dialogTitle" v-model="dialogVisible" width="1000px">
|
||||
<Dialog :title="dialogTitle" v-model="dialogVisible" width="1000px">
|
||||
<div class="flex">
|
||||
<Form
|
||||
style="flex: 1"
|
||||
@@ -34,7 +34,7 @@
|
||||
<el-button type="primary" @click="handleSave">保 存</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</Dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<el-dialog title="成交登记" v-model="show" width="800px">
|
||||
<Dialog title="成交登记" v-model="show" width="800px">
|
||||
<Descriptions :data="info" :schema="schema" :columns="2" />
|
||||
<el-form :model="form" ref="formRef" :rules="rules" label-width="80px" class="mt-20px">
|
||||
<el-row :gutter="20">
|
||||
@@ -39,7 +39,7 @@
|
||||
<el-button type="primary" @click="handleSave">保 存</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</Dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<el-dialog :title="dialogTitle" v-model="dialogVisible" width="800px">
|
||||
<Dialog :title="dialogTitle" v-model="dialogVisible" width="800px">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
v-loading="formLoading"
|
||||
@@ -29,7 +29,7 @@
|
||||
<el-button :disabled="formLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</Dialog>
|
||||
</template>
|
||||
<script name="DialogSource" setup>
|
||||
const { t } = useI18n() // 国际化
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<el-dialog :title="dialogTitle" v-model="dialogVisible" width="800px">
|
||||
<Dialog :title="dialogTitle" v-model="dialogVisible" width="800px">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
v-loading="formLoading"
|
||||
@@ -21,7 +21,7 @@
|
||||
<el-button :disabled="formLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</Dialog>
|
||||
</template>
|
||||
<script name="DialogSkill" setup>
|
||||
const { t } = useI18n() // 国际化
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<!-- 左上角的 logo + 系统标题 -->
|
||||
<div class="flex items-center relative text-white">
|
||||
<img alt="" class="w-48px h-48px mr-10px" src="@/assets/imgs/logo.png" />
|
||||
<span class="text-20px font-bold">{{ underlineToHump(appStore.getTitle) }}</span>
|
||||
<span class="text-20px font-bold">{{ underlineToHump(appInfo.instanceName) }}</span>
|
||||
</div>
|
||||
<!-- 左边的背景图 + 欢迎语 -->
|
||||
<div class="flex justify-center">
|
||||
@@ -35,7 +35,7 @@
|
||||
<div class="flex justify-between items-center text-white @2xl:justify-end @xl:justify-end">
|
||||
<div class="flex items-center @2xl:hidden @xl:hidden">
|
||||
<img alt="" class="w-48px h-48px mr-10px" src="@/assets/imgs/logo.png" />
|
||||
<span class="text-20px font-bold">{{ underlineToHump(appStore.getTitle) }}</span>
|
||||
<span class="text-20px font-bold">{{ underlineToHump(appInfo.instanceName) }}</span>
|
||||
</div>
|
||||
<div class="flex justify-end items-center space-x-10px">
|
||||
<ThemeSwitch />
|
||||
@@ -63,7 +63,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" name="Login" setup>
|
||||
<script name="Login" setup>
|
||||
import { underlineToHump } from '@/utils'
|
||||
|
||||
import { useDesign } from '@/hooks/web/useDesign'
|
||||
@@ -74,11 +74,16 @@ import { LoginForm, MobileForm, QrCodeForm } from './components'
|
||||
|
||||
import soups from './components/soup.js'
|
||||
|
||||
import * as authUtil from '@/utils/auth'
|
||||
|
||||
// const { t } = useI18n()
|
||||
const { currentRoute } = useRouter()
|
||||
const appStore = useAppStore()
|
||||
const { getPrefixCls } = useDesign()
|
||||
const prefixCls = getPrefixCls('login')
|
||||
|
||||
const appInfo = ref({ title: appStore.getTitle })
|
||||
|
||||
const currentCharIndex = ref(0)
|
||||
const typingInterval = ref(null)
|
||||
|
||||
@@ -91,8 +96,22 @@ const chars = computed(() => {
|
||||
return text.slice(0, currentCharIndex.value)
|
||||
})
|
||||
|
||||
function init() {
|
||||
const res = currentRoute.value?.query?.tenantId
|
||||
authUtil.setTenantId(res)
|
||||
|
||||
const appId = currentRoute.value?.query?.appId
|
||||
authUtil.setAppId(appId)
|
||||
appStore.setAppInfo(appId).then((res) => {
|
||||
appInfo.value = res
|
||||
})
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
startTyping()
|
||||
if (currentRoute.value?.query?.appId) {
|
||||
init()
|
||||
}
|
||||
})
|
||||
|
||||
function startTyping() {
|
||||
|
||||
@@ -9,16 +9,16 @@
|
||||
label-width="120px"
|
||||
size="large"
|
||||
>
|
||||
<el-row style="maring-left: -10px; maring-right: -10px">
|
||||
<el-row style="margin-left: -10px; margin-right: -10px">
|
||||
<el-col :span="24" style="padding-left: 10px; padding-right: 10px">
|
||||
<el-form-item>
|
||||
<LoginFormTitle style="width: 100%" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" style="padding-left: 10px; padding-right: 10px">
|
||||
<el-form-item v-if="loginData.tenantEnable === 'true'" prop="tenantName">
|
||||
<el-form-item v-if="loginData.tenantEnable === 'true'" prop="tenantId">
|
||||
<el-input
|
||||
v-model="loginData.loginForm.tenantName"
|
||||
v-model="loginData.loginForm.tenantId"
|
||||
:placeholder="t('login.tenantNamePlaceholder')"
|
||||
:prefix-icon="iconHouse"
|
||||
type="primary"
|
||||
@@ -58,9 +58,9 @@
|
||||
{{ t('login.remember') }}
|
||||
</el-checkbox>
|
||||
</el-col>
|
||||
<el-col :offset="6" :span="12">
|
||||
<!-- <el-col :offset="6" :span="12">
|
||||
<el-link style="float: right" type="primary">{{ t('login.forgetPassword') }}</el-link>
|
||||
</el-col>
|
||||
</el-col> -->
|
||||
</el-row>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@@ -133,7 +133,6 @@ const captchaType = ref('blockPuzzle') // blockPuzzle 滑块 clickWord 点击文
|
||||
const getShow = computed(() => unref(getLoginState) === LoginStateEnum.LOGIN)
|
||||
|
||||
const LoginRules = {
|
||||
tenantName: [required],
|
||||
username: [required],
|
||||
password: [required]
|
||||
}
|
||||
@@ -142,11 +141,12 @@ const loginData = reactive({
|
||||
captchaEnable: import.meta.env.VITE_APP_CAPTCHA_ENABLE,
|
||||
tenantEnable: import.meta.env.VITE_APP_TENANT_ENABLE,
|
||||
loginForm: {
|
||||
tenantName: '莳松',
|
||||
tenantId: undefined,
|
||||
instanceId: undefined,
|
||||
username: 'admin',
|
||||
password: 'admin123',
|
||||
captchaVerification: '',
|
||||
rememberMe: false
|
||||
rememberMe: true
|
||||
}
|
||||
})
|
||||
|
||||
@@ -161,13 +161,6 @@ const getCode = async () => {
|
||||
verify.value.show()
|
||||
}
|
||||
}
|
||||
//获取租户ID
|
||||
const getTenantId = async () => {
|
||||
if (loginData.tenantEnable === 'true') {
|
||||
const res = await LoginApi.getTenantIdByName(loginData.loginForm.tenantName)
|
||||
authUtil.setTenantId(res)
|
||||
}
|
||||
}
|
||||
// 记住我
|
||||
const getCookie = () => {
|
||||
const loginForm = authUtil.getLoginForm()
|
||||
@@ -177,15 +170,22 @@ const getCookie = () => {
|
||||
username: loginForm.username ? loginForm.username : loginData.loginForm.username,
|
||||
password: loginForm.password ? loginForm.password : loginData.loginForm.password,
|
||||
rememberMe: loginForm.rememberMe ? true : false,
|
||||
tenantName: loginForm.tenantName ? loginForm.tenantName : loginData.loginForm.tenantName
|
||||
tenantId: loginForm.tenantId ? loginForm.tenantId : loginData.loginForm.tenantId
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getTenantId() {
|
||||
loginData.loginForm.tenantId = authUtil.getTenantId()
|
||||
|
||||
loginData.loginForm.instanceId = authUtil.getAppId()
|
||||
}
|
||||
|
||||
// 登录
|
||||
const handleLogin = async (params) => {
|
||||
loginLoading.value = true
|
||||
try {
|
||||
await getTenantId()
|
||||
getTenantId()
|
||||
const data = await validForm()
|
||||
if (!data) {
|
||||
return
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<el-dialog :title="dialogTitle" v-model="dialogVisible" width="800px">
|
||||
<Dialog :title="dialogTitle" v-model="dialogVisible" width="800px">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
v-loading="formLoading"
|
||||
@@ -26,7 +26,7 @@
|
||||
<el-button :disabled="formLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</Dialog>
|
||||
</template>
|
||||
<script name="DialogBrand" setup>
|
||||
const { t } = useI18n() // 国际化
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<el-dialog :title="dialogTitle" v-model="dialogVisible" width="800px">
|
||||
<Dialog :title="dialogTitle" v-model="dialogVisible" width="800px">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
v-loading="formLoading"
|
||||
@@ -29,7 +29,7 @@
|
||||
<el-button :disabled="formLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</Dialog>
|
||||
</template>
|
||||
<script name="DialogCategory" setup>
|
||||
const { t } = useI18n() // 国际化
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<el-dialog title="发起采购" v-model="dialogVisible" width="800px">
|
||||
<Dialog title="发起采购" v-model="dialogVisible" width="800px">
|
||||
<el-form :model="form" ref="addForm" :rules="rules" label-width="100px">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12" :offset="0">
|
||||
@@ -82,7 +82,7 @@
|
||||
<el-button type="primary" @click="handleSave">保 存</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</Dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<el-dialog title="采购审核" v-model="dialogVisible" width="800px">
|
||||
<Dialog title="采购审核" v-model="dialogVisible" width="800px">
|
||||
<Descriptions :data="form" :schema="schema" :columns="3" />
|
||||
<el-form v-if="canEdit" :model="form" ref="auditForm" :rules="rules" label-width="80px">
|
||||
<el-row :gutter="20">
|
||||
@@ -26,7 +26,7 @@
|
||||
<el-button type="primary" @click="handleSave">保 存</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</Dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<el-dialog :title="dialogTitle" v-model="dialogVisible" width="1000px">
|
||||
<Dialog :title="dialogTitle" v-model="dialogVisible" width="1000px">
|
||||
<el-tabs v-model="currentTab">
|
||||
<el-tab-pane label="基础信息" name="base">
|
||||
<el-form
|
||||
@@ -230,7 +230,7 @@
|
||||
<el-button :disabled="formLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</Dialog>
|
||||
</template>
|
||||
<script name="DialogClass" setup>
|
||||
import { formatDate } from '@/utils/formatTime'
|
||||
|
||||
@@ -112,7 +112,7 @@
|
||||
/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-dialog title="批量修改" v-model="batchStatusDialogShow" width="400px">
|
||||
<Dialog title="批量修改" v-model="batchStatusDialogShow" width="400px">
|
||||
<el-form :model="statusForm" ref="statusRef" label-width="80px">
|
||||
<el-form-item label="选择状态" prop="status">
|
||||
<el-radio-group v-model="statusForm.status">
|
||||
@@ -128,7 +128,7 @@
|
||||
<el-button type="primary" @click="handleSureStatus">确 认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</Dialog>
|
||||
|
||||
<DialogClass ref="ClassDialog" @success="getList" />
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<el-dialog :title="dialogTitle" v-model="dialogVisible" width="800px">
|
||||
<Dialog :title="dialogTitle" v-model="dialogVisible" width="800px">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
v-loading="formLoading"
|
||||
@@ -44,7 +44,7 @@
|
||||
<el-button :disabled="formLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</Dialog>
|
||||
</template>
|
||||
<script name="DialogSchool" setup>
|
||||
const { t } = useI18n() // 国际化
|
||||
|
||||
Reference in New Issue
Block a user