@@ -46,13 +46,23 @@ export function menuUpdate(data) { | |||
data | |||
}) | |||
} | |||
/** | |||
* 删除菜单 | |||
* params | |||
*/ | |||
export function deleteMenu(id) { | |||
return request({ | |||
url: `/menu/delete/${id}`, | |||
method: 'DELETE' | |||
}) | |||
} | |||
/** | |||
* 添加按钮 | |||
* params | |||
*/ | |||
export function permissionCreate(data) { | |||
return request({ | |||
url: '/menu/add', | |||
url: '/permission/add', | |||
method: 'POST', | |||
data | |||
}) | |||
@@ -64,25 +74,24 @@ export function permissionCreate(data) { | |||
*/ | |||
export function permissionUpdate(data) { | |||
return request({ | |||
url: '/menu/edit', | |||
url: '/permission/edit', | |||
method: 'PUT', | |||
data | |||
}) | |||
} | |||
/** | |||
* 删除菜单 | |||
* 删除按钮 | |||
* params | |||
*/ | |||
export function deleteMenu(id) { | |||
export function deletePermission(ids) { | |||
return request({ | |||
url: `/menu/delete/${id}`, | |||
url: `/permission/delete/${ids}`, | |||
method: 'DELETE' | |||
}) | |||
} | |||
/** | |||
* 添加按钮 | |||
* 添加小程序菜单 | |||
* params | |||
*/ | |||
export function mpMenuCreate(data) { | |||
@@ -94,7 +103,7 @@ export function mpMenuCreate(data) { | |||
} | |||
/** | |||
* 编辑菜单 | |||
* 编辑小程序菜单 | |||
* params | |||
*/ | |||
export function mpMenuUpdate(data) { | |||
@@ -106,7 +115,7 @@ export function mpMenuUpdate(data) { | |||
} | |||
/** | |||
* 删除菜单 | |||
* 删除小程序菜单 | |||
* params | |||
*/ | |||
export function deleteMpMenu(id) { | |||
@@ -116,13 +125,3 @@ export function deleteMpMenu(id) { | |||
}) | |||
} | |||
/** | |||
* 删除按钮 | |||
* params | |||
*/ | |||
export function deletePermission(ids) { | |||
return request({ | |||
url: `/menu/delete/${ids}`, | |||
method: 'DELETE' | |||
}) | |||
} |
@@ -11,7 +11,7 @@ | |||
@update:checked-row-keys="handleCheck" | |||
> | |||
<template #tableTitle> | |||
<n-button type="primary" @click="handleModal"> 新建 </n-button> | |||
<n-button v-if="permissionList.includes('equipment:box:create')" type="primary" @click="handleModal"> {{ getPermissionLabel('equipment:box:create') }} </n-button> | |||
<n-popconfirm | |||
negative-text="取消" | |||
positive-text="确认" | |||
@@ -38,16 +38,27 @@ import dataTable from '@/components/DataTable/index.vue' | |||
import BoxModal from './components/BoxModal.vue' | |||
import { ref, unref, toRefs, reactive, onUnmounted } from 'vue' | |||
import { boxPage } from '@/api/equipment/box.js' | |||
import { usePermissionStore } from '@/store/modules/permission' | |||
export default { | |||
name: 'BoxManage', | |||
components: { dataTable, BoxModal, headSearch }, | |||
setup() { | |||
const permissionStore = usePermissionStore() | |||
const data = reactive({ | |||
...toRefs(table), | |||
search | |||
search, | |||
permissionList: permissionStore.accessPermissionCodes | |||
}) | |||
const getPermissionLabel = (code) => { | |||
return permissionStore.accessPermissions.find((item) => { | |||
return item.code === code | |||
})?.name || '' | |||
} | |||
const loadDataTable = async(res) => { | |||
const _params = { | |||
...unref(data.searchParams), | |||
@@ -85,7 +96,8 @@ export default { | |||
loadDataTable, | |||
handleModal, | |||
handleDelete, | |||
handleCheck | |||
handleCheck, | |||
getPermissionLabel | |||
} | |||
} | |||
} |
@@ -91,12 +91,12 @@ const data = reactive({ | |||
text: true, | |||
onClick: getRowData.bind(null, row, 'update') | |||
}, | |||
auth: 'basic_list' | |||
auth: 'equipment:box:edit' | |||
}, | |||
{ | |||
label: '删除', | |||
type: 'popconfirm', | |||
auth: 'basic_list', | |||
auth: 'equipment:box:delete', | |||
tip: '确定删除这条数据吗?', | |||
props: { | |||
onPositiveClick: deleteData.bind(null, [row.id]) |
@@ -11,7 +11,7 @@ | |||
@update:checked-row-keys="handleCheck" | |||
> | |||
<template #tableTitle> | |||
<n-button type="primary" @click="handleModal"> 新建 </n-button> | |||
<n-button v-if="permissionList.includes('equipment:mount:create')" type="primary" @click="handleModal"> {{ getPermissionLabel('equipment:mount:create') }} </n-button> | |||
<n-popconfirm | |||
negative-text="取消" | |||
positive-text="确认" | |||
@@ -38,15 +38,25 @@ import dataTable from '@/components/DataTable/index.vue' | |||
import MountModal from './components/MountModal.vue' | |||
import { ref, unref, toRefs, reactive, onUnmounted } from 'vue' | |||
import { mountPage } from '@/api/equipment/mount.js' | |||
import { usePermissionStore } from '@/store/modules/permission' | |||
export default { | |||
name: 'BoxManage', | |||
components: { dataTable, MountModal, headSearch }, | |||
setup() { | |||
const permissionStore = usePermissionStore() | |||
const data = reactive({ | |||
...toRefs(table), | |||
search | |||
search, | |||
permissionList: permissionStore.accessPermissionCodes | |||
}) | |||
const getPermissionLabel = (code) => { | |||
return permissionStore.accessPermissions.find((item) => { | |||
return item.code === code | |||
})?.name || '' | |||
} | |||
const loadDataTable = async(res) => { | |||
const _params = { | |||
@@ -85,7 +95,8 @@ export default { | |||
loadDataTable, | |||
handleModal, | |||
handleDelete, | |||
handleCheck | |||
handleCheck, | |||
getPermissionLabel | |||
} | |||
} | |||
} |
@@ -98,12 +98,12 @@ const data = reactive({ | |||
text: true, | |||
onClick: getRowData.bind(null, row, 'update') | |||
}, | |||
auth: 'basic_list' | |||
auth: 'equipment:mount:edit' | |||
}, | |||
{ | |||
label: '删除', | |||
type: 'popconfirm', | |||
auth: 'basic_list', | |||
auth: 'equipment:mount:delete', | |||
tip: '确定删除这条数据吗?', | |||
props: { | |||
onPositiveClick: deleteData.bind(null, [row.id]) |
@@ -11,7 +11,7 @@ | |||
@update:checked-row-keys="handleCheck" | |||
> | |||
<template #tableTitle> | |||
<n-button type="primary" @click="handleModal"> 新建 </n-button> | |||
<n-button v-if="permissionList.includes('equipment:uva:create')" type="primary" @click="handleModal"> {{ getPermissionLabel('equipment:uva:create') }} </n-button> | |||
<n-popconfirm | |||
negative-text="取消" | |||
positive-text="确认" | |||
@@ -38,16 +38,23 @@ import dataTable from '@/components/DataTable/index.vue' | |||
import UVAModal from './components/UVAModal.vue' | |||
import { ref, unref, toRefs, reactive, onUnmounted } from 'vue' | |||
import { uvaPage } from '@/api/equipment/uva.js' | |||
import { usePermissionStore } from '@/store/modules/permission' | |||
export default { | |||
name: 'BoxManage', | |||
components: { dataTable, UVAModal, headSearch }, | |||
setup() { | |||
const permissionStore = usePermissionStore() | |||
const data = reactive({ | |||
...toRefs(table), | |||
search | |||
}) | |||
const getPermissionLabel = (code) => { | |||
return permissionStore.accessPermissions.find((item) => { | |||
return item.code === code | |||
})?.name || '' | |||
} | |||
const loadDataTable = async(res) => { | |||
const _params = { | |||
...unref(data.searchParams), | |||
@@ -85,7 +92,8 @@ export default { | |||
loadDataTable, | |||
handleModal, | |||
handleDelete, | |||
handleCheck | |||
handleCheck, | |||
getPermissionLabel | |||
} | |||
} | |||
} |
@@ -107,12 +107,12 @@ const data = reactive({ | |||
text: true, | |||
onClick: getRowData.bind(null, row, 'update') | |||
}, | |||
auth: 'basic_list' | |||
auth: 'equipment:uva:edit' | |||
}, | |||
{ | |||
label: '删除', | |||
type: 'popconfirm', | |||
auth: 'basic_list', | |||
auth: 'equipment:uva:delete', | |||
tip: '确定删除这条数据吗?', | |||
props: { | |||
onPositiveClick: deleteData.bind(null, [row.id]) |
@@ -14,7 +14,7 @@ | |||
v-if="permissionList.includes('system:menu:create')" | |||
type="primary" | |||
@click="handleModal" | |||
><n-icon size="18"><AddOutline /></n-icon> {{ getPermissionLabel('system:menu:create') }} </n-button> | |||
> {{ getPermissionLabel('system:menu:create') }} </n-button> | |||
</template> | |||
</DataTable> | |||
</n-card> |
@@ -132,7 +132,7 @@ export default defineComponent({ | |||
const { opMenusList, permissionsList } = res.data | |||
const adminMenus = opMenusList.filter((item) => { | |||
item.title = item.name | |||
item.key = item.identificationId | |||
item.key = item.id | |||
return item.clientId === 'tuoheng-pilot-admin' | |||
}) | |||
const adminPermissions = permissionsList.filter((item) => { | |||
@@ -143,24 +143,23 @@ export default defineComponent({ | |||
}) | |||
const mpMenus = opMenusList.filter((item) => { | |||
item.title = item.name | |||
item.key = item.identificationId | |||
return item.clientId === 'tuoheng-waterway-mp' | |||
item.key = item.id | |||
return item.clientId === 'tuoheng-pilot-mp' | |||
}) | |||
const mpPermissions = permissionsList.filter((item) => { | |||
item.title = item.name | |||
item.parentId = item.menuId | |||
item.key = item.identificationId | |||
return item.clientId === 'tuoheng-waterway-mp' | |||
return item.clientId === 'tuoheng-pilot-mp' | |||
}) | |||
const adminData = adminMenus.concat(adminPermissions) | |||
const adminTreeData = toTreeData(adminData, 'id', 'parentId', 'children') | |||
const adminTreeData = toTreeData(adminData, 'key', 'parentId', 'children') | |||
data.adminKeys = [] | |||
querySelectedKeys(adminTreeData, data.adminKeys) | |||
const miniData = mpMenus.concat(mpPermissions) | |||
const miniTreeData = toTreeData(miniData, 'id', 'parentId', 'children') | |||
const miniTreeData = toTreeData(miniData, 'key', 'parentId', 'children') | |||
data.miniKeys = [] | |||
querySelectedKeys(miniTreeData, data.miniKeys) | |||
nextTick(() => { | |||
data.tabsTreeVisible = true | |||
data.adminData = adminTreeData |
@@ -1,108 +0,0 @@ | |||
<template> | |||
<Modal | |||
:options="getModalOptions" | |||
:on-positive-click="handleConfirm" | |||
:on-negative-click="handleClose" | |||
:on-close="handleClose" | |||
> | |||
<template #Context> | |||
<n-tree | |||
block-line | |||
cascade | |||
checkable | |||
:data="allTreeData" | |||
key-field="id" | |||
label-field="title" | |||
:default-expand-all="true" | |||
:default-checked-keys="checkedTreeData" | |||
@update:checked-keys="handleCheckTree" | |||
/> | |||
</template> | |||
</Modal> | |||
</template> | |||
<script> | |||
import { defineComponent, computed, onBeforeMount, reactive, toRefs } from 'vue' | |||
import { getRolePermission, savePermission } from '@/api/system/role/index' | |||
import Modal from '@/components/Modal/index.vue' | |||
import { toTreeData } from '@/utils/handleData.js' | |||
export default defineComponent({ | |||
name: 'ConfigModal', | |||
components: { Modal }, | |||
props: { | |||
visible: { | |||
type: Boolean, | |||
default: false | |||
}, | |||
data: { | |||
type: Object, | |||
default: () => {} | |||
} | |||
}, | |||
emits: { | |||
'update:visible': null, | |||
'reload': null | |||
}, | |||
setup(props, { emit }) { | |||
const data = reactive({ | |||
menuIds: [], | |||
checkedTreeData: [], | |||
allTreeData: [] | |||
}) | |||
const getModalOptions = computed(() => { | |||
return { | |||
title: '权限分配', | |||
show: props.visible, | |||
negativeText: '取消', | |||
positiveText: '确认' | |||
} | |||
}) | |||
onBeforeMount(() => { | |||
getMenuByRoleId() | |||
}) | |||
// 获取当前角色的权限菜单列表 | |||
async function getMenuByRoleId() { | |||
const res = await getRolePermission(props.data.id) | |||
data.allTreeData = toTreeData(res.data, 'id', 'pid', 'children') | |||
const checkedArr = res.data | |||
if (checkedArr.length) { | |||
checkedArr.forEach((item) => { | |||
if (item.checked) { | |||
data.checkedTreeData.push(item.id) | |||
} | |||
}) | |||
} | |||
data.menuIds = data.checkedTreeData | |||
} | |||
// 勾选节点 | |||
function handleCheckTree(keys) { | |||
data.menuIds = keys | |||
} | |||
function handleConfirm() { | |||
savePermission({ roleId: props.data.id, menuIds: data.menuIds }).then(res => { | |||
if (res.code === 0) { | |||
emit('reload') | |||
handleClose() | |||
} | |||
}).catch(e => { | |||
console.log(e) | |||
}) | |||
} | |||
/* 关闭弹窗 */ | |||
const handleClose = () => { | |||
emit('update:visible', false) | |||
} | |||
return { | |||
...toRefs(data), | |||
getModalOptions, | |||
handleCheckTree, | |||
handleConfirm, | |||
handleClose | |||
} | |||
} | |||
}) | |||
</script> |
@@ -1,8 +1,8 @@ | |||
<template> | |||
<div> | |||
<n-card> | |||
<headSearch :info="search" @search="handleSearch" @reset="handleSearch" /> | |||
<data-table | |||
<HeadSearch :info="search" @search="handleSearch" @reset="handleSearch" /> | |||
<DataTable | |||
ref="tableRef" | |||
:columns="columns" | |||
:request="loadDataTable" | |||
@@ -11,9 +11,13 @@ | |||
size="large" | |||
> | |||
<template #tableTitle> | |||
<n-button v-if="permissionStore.includes('system:role:create')" type="primary" @click="handleModal"> 新建 </n-button> | |||
<n-button | |||
v-if="permissionList.includes('system:role:create')" | |||
type="primary" | |||
@click="handleModal" | |||
> {{ getPermissionLabel('system:role:create') }} </n-button> | |||
</template> | |||
</data-table> | |||
</DataTable> | |||
</n-card> | |||
</div> | |||
{{ permissionStore.getToken }} | |||
@@ -25,8 +29,8 @@ | |||
<script> | |||
import search from './tools/search.js' | |||
import table from './tools/table.js' | |||
import headSearch from '@/components/Search/index.vue' | |||
import dataTable from '@/components/DataTable/index.vue' | |||
import HeadSearch from '@/components/Search/index.vue' | |||
import DataTable from '@/components/DataTable/index.vue' | |||
import RoleModal from './components/RoleModal.vue' | |||
import AuthModal from './components/AuthModal.vue' | |||
import { getRoleList } from '@/api/system/role/index.js' | |||
@@ -35,13 +39,21 @@ import { usePermissionStore } from '@/store/modules/permission' | |||
export default { | |||
name: 'UserManage', | |||
components: { dataTable, headSearch, RoleModal, AuthModal }, | |||
components: { DataTable, HeadSearch, RoleModal, AuthModal }, | |||
setup() { | |||
const permissionStore = usePermissionStore() | |||
const data = reactive({ | |||
...toRefs(table), | |||
search | |||
search, | |||
permissionList: permissionStore.accessPermissionCodes | |||
}) | |||
const permissionStore = usePermissionStore().accessPermissionCodes // 按钮权限 | |||
const getPermissionLabel = (code) => { | |||
return permissionStore.accessPermissions.find((item) => { | |||
return item.code === code | |||
})?.name || '' | |||
} | |||
const loadDataTable = async(res) => { | |||
const _params = { | |||
...unref(data.searchParams), | |||
@@ -66,7 +78,7 @@ export default { | |||
...toRefs(data), | |||
loadDataTable, | |||
handleModal, | |||
permissionStore | |||
getPermissionLabel | |||
} | |||
} | |||
} |
@@ -5,16 +5,16 @@ export const form = reactive({ | |||
userForm: { | |||
roleName: null, | |||
remark: null, | |||
roleCode: null, | |||
// code: null, | |||
status: 1 | |||
}, | |||
userRules: { | |||
roleName: [{ required: true, message: '请输入角色名称', trigger: 'blur' }], | |||
roleCode: [{ required: true, message: '请输入角色编码', trigger: 'blur' }] | |||
roleName: [{ required: true, message: '请输入角色名称', trigger: 'blur' }] | |||
// code: [{ required: true, message: '请输入角色编码', trigger: 'blur' }] | |||
}, | |||
formItem: [ | |||
{ type: 'input', key: 'roleName', label: '角色名称', props: { maxlength: '20', placeholder: '请输入角色名称', clearable: true }}, | |||
{ type: 'input', key: 'roleCode', label: '角色编码', props: { maxlength: '20', placeholder: '请输入角色名称', clearable: true }}, | |||
// { type: 'input', key: 'code', label: '角色编码', props: { maxlength: '20', placeholder: '请输入角色名称', clearable: true }}, | |||
{ type: 'radio', key: 'status', label: '角色状态', options: ROLE_STATUS }, | |||
{ type: 'input', key: 'remark', label: '备注', props: { type: 'textarea', maxlength: '140', autosize: { minRows: 3, maxRows: 3 }, placeholder: '请输入备注', clearable: true }} | |||
] |
@@ -18,6 +18,7 @@ function handleSearch(params) { | |||
* @return {*} | |||
*/ | |||
function handleStatusChange(row) { | |||
console.log(row) | |||
setRoleStatus({ id: row.data.id, status: row.value }) | |||
.then((res) => { | |||
if (res.code === 0) { | |||
@@ -81,12 +82,12 @@ const data = reactive({ | |||
align: 'center', | |||
width: 200 | |||
}, | |||
{ | |||
title: '角色编码', | |||
key: 'roleCode', | |||
align: 'center', | |||
width: 200 | |||
}, | |||
// { | |||
// title: '角色编码', | |||
// key: 'code', | |||
// align: 'center', | |||
// width: 200 | |||
// }, | |||
{ | |||
title: '状态', | |||
key: 'status', | |||
@@ -102,15 +103,15 @@ const data = reactive({ | |||
}) | |||
} | |||
}, | |||
{ | |||
title: '描述', | |||
key: 'remark', | |||
align: 'center', | |||
ellipsis: { | |||
tooltip: true | |||
}, | |||
width: 400 | |||
}, | |||
// { | |||
// title: '描述', | |||
// key: 'remark', | |||
// align: 'center', | |||
// ellipsis: { | |||
// tooltip: true | |||
// }, | |||
// width: 400 | |||
// }, | |||
{ | |||
title: '操作', | |||
align: 'center', |
@@ -17,7 +17,7 @@ | |||
> | |||
<template v-for="(item,index) in getFormOptions" :key="index"> | |||
<n-form-item :label="item.label" :path="item.key"> | |||
<n-input v-if="item.type === 'input'" v-model:value="userForm[item.key]" v-bind="item.props" /> | |||
<n-input v-if="item.type === 'input'" v-model:value="userForm[item.key]" :disabled="item.key==='username' && modelTyle ==='update'" v-bind="item.props" /> | |||
<n-select v-if="item.type === 'select'" v-model:value="userForm[item.key]" v-bind="item.props" /> | |||
</n-form-item> | |||
</template> | |||
@@ -69,6 +69,7 @@ export default defineComponent({ | |||
userRules: { | |||
...userRules | |||
}, | |||
modelTyle: props.type, | |||
disabled: props.type === 'preview' | |||
}) | |||