|
@ -5,37 +5,38 @@ |
|
|
<div class="left"> |
|
|
<div class="left"> |
|
|
<div class="top"> |
|
|
<div class="top"> |
|
|
<div class="ns-table-title">关联企业</div> |
|
|
<div class="ns-table-title">关联企业</div> |
|
|
<div> |
|
|
<div style="height: 100%; overflow-y: auto"> |
|
|
<a-input-search |
|
|
<a-input-search |
|
|
v-model:value="searchValue" |
|
|
v-model:value="searchValue" |
|
|
style="margin-bottom: 8px" |
|
|
style="margin-bottom: 8px" |
|
|
placeholder="请输入关联企业" |
|
|
placeholder="请输入关联企业" |
|
|
@search="onSearch" /> |
|
|
@search="onSearch" /> |
|
|
<a-tree :tree-data="treeData" defaultExpandAll @select="handleSelect"> |
|
|
<a-tree |
|
|
<template #title="{ title }"> |
|
|
v-if="treeData?.length" |
|
|
{{ title }} |
|
|
:tree-data="treeData" |
|
|
<!-- <span v-if="title.indexOf(searchValue) > -1"> |
|
|
defaultExpandAll |
|
|
{{ title.substring(0, title.indexOf(searchValue)) }} |
|
|
@select="handleSelect"> |
|
|
</span> |
|
|
<template #title="data"> |
|
|
<span v-else>{{ title }}</span> --> |
|
|
{{ data.orgInfo?.orgName }} |
|
|
</template> |
|
|
</template> |
|
|
</a-tree> |
|
|
</a-tree> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
<div class="ns-table-title">关联部门</div> |
|
|
|
|
|
<div> |
|
|
<div> |
|
|
|
|
|
<div class="ns-table-title">关联部门</div> |
|
|
|
|
|
|
|
|
<a-input-search |
|
|
<a-input-search |
|
|
v-model:value="searchValue2" |
|
|
v-model:value="searchValue2" |
|
|
style="margin-bottom: 8px" |
|
|
style="margin-bottom: 8px" |
|
|
placeholder="请输入关联部门" |
|
|
placeholder="请输入关联部门" |
|
|
@search="onSearch2" /> |
|
|
@search="onSearch2" /> |
|
|
<a-tree :tree-data="treeData2" defaultExpandAll @select="handleSelect2"> |
|
|
<a-tree |
|
|
<template #title="{ title }"> |
|
|
v-if="treeData2?.length" |
|
|
{{ title }} |
|
|
:tree-data="treeData2" |
|
|
<!-- <span v-if="title.indexOf(searchValue) > -1"> |
|
|
defaultExpandAll |
|
|
{{ title.substring(0, title.indexOf(searchValue)) }} |
|
|
@select="handleSelect2"> |
|
|
</span> |
|
|
<template #title="data"> |
|
|
<span v-else>{{ title }}</span> --> |
|
|
{{ data.deptInfo?.deptName }} |
|
|
</template> |
|
|
</template> |
|
|
</a-tree> |
|
|
</a-tree> |
|
|
</div> |
|
|
</div> |
|
@ -44,17 +45,31 @@ |
|
|
<ns-view-list-table v-bind="tableConfig" :model="data" ref="mainRef" /> |
|
|
<ns-view-list-table v-bind="tableConfig" :model="data" ref="mainRef" /> |
|
|
</div> |
|
|
</div> |
|
|
<a-drawer |
|
|
<a-drawer |
|
|
:width="1200" |
|
|
:width="500" |
|
|
:visible="visible" |
|
|
:visible="visible" |
|
|
:body-style="{ paddingBottom: '80px' }" |
|
|
:body-style="{ paddingBottom: '80px' }" |
|
|
:footer-style="{ textAlign: 'right' }" |
|
|
:footer-style="{ textAlign: 'right' }" |
|
|
destroyOnClose |
|
|
destroyOnClose |
|
|
@close="onClose"> |
|
|
@close="onClose"> |
|
|
<ns-form ref="formRef" :schemas="formSchema" :model="formData" class="form" /> |
|
|
<ns-form |
|
|
|
|
|
ref="formRef" |
|
|
|
|
|
:schemas="formSchema" |
|
|
|
|
|
:model="formData" |
|
|
|
|
|
class="form" |
|
|
|
|
|
:wrapperCol="{ span: 20 }" |
|
|
|
|
|
formLayout="vertical" /> |
|
|
<span class="admin">用户权限</span> |
|
|
<span class="admin">用户权限</span> |
|
|
<ns-view-list-table v-bind="tableConfig2" :model="data" ref="mainRef" rowKey="uuid" /> |
|
|
<ns-view-list-table |
|
|
|
|
|
v-bind="tableConfig2" |
|
|
|
|
|
class="drawerTable" |
|
|
|
|
|
:model="data" |
|
|
|
|
|
:pagination="false" |
|
|
|
|
|
ref="mainRef" |
|
|
|
|
|
rowKey="uuid" /> |
|
|
|
|
|
<template #footer> |
|
|
<a-button style="margin-right: 8px" @click="onClose">取消</a-button> |
|
|
<a-button style="margin-right: 8px" @click="onClose">取消</a-button> |
|
|
<a-button type="primary" @click="onEdit">确定</a-button> |
|
|
<a-button type="primary" @click="onEdit">确定</a-button> |
|
|
|
|
|
</template> |
|
|
</a-drawer> |
|
|
</a-drawer> |
|
|
|
|
|
|
|
|
<a-modal |
|
|
<a-modal |
|
@ -69,15 +84,13 @@ |
|
|
</div> |
|
|
</div> |
|
|
</template> |
|
|
</template> |
|
|
<script lang="ts"> |
|
|
<script lang="ts"> |
|
|
import { Modal } from 'ant-design-vue'; |
|
|
|
|
|
import { createVNode, defineComponent, reactive, ref } from 'vue'; |
|
|
import { createVNode, defineComponent, reactive, ref } from 'vue'; |
|
|
import { http } from '/nerv-lib/util/http'; |
|
|
import { http } from '/nerv-lib/util/http'; |
|
|
import { ExclamationCircleOutlined } from '@ant-design/icons-vue'; |
|
|
import { ExclamationCircleOutlined } from '@ant-design/icons-vue'; |
|
|
import { cloneDeep } from 'lodash-es'; |
|
|
import { cloneDeep } from 'lodash-es'; |
|
|
import { NsMessage } from '/nerv-lib/component'; |
|
|
import { NsMessage, NsModal } from '/nerv-lib/component'; |
|
|
import { formConfig, formConfig2 } from './config'; |
|
|
import { formConfig, formConfig2 } from './config'; |
|
|
import { mockData, mockData2, treeData, treeData2 } from './mock'; |
|
|
import { origanizemanage, department } from '/@/api/origanizemanage'; |
|
|
import { origanizemanage } from '/@/api/origanizemanage'; |
|
|
|
|
|
|
|
|
|
|
|
export default defineComponent({ |
|
|
export default defineComponent({ |
|
|
name: 'OrderListIndex', |
|
|
name: 'OrderListIndex', |
|
@ -85,7 +98,7 @@ |
|
|
const mainRef = ref(); |
|
|
const mainRef = ref(); |
|
|
const data = reactive({}); |
|
|
const data = reactive({}); |
|
|
let formData = ref({}); |
|
|
let formData = ref({}); |
|
|
let formData2 = ref({}); |
|
|
let formData2 = ref({ userRoleList: [1, 1, 3] }); |
|
|
const formRef = ref(); |
|
|
const formRef = ref(); |
|
|
const visible = ref(false); |
|
|
const visible = ref(false); |
|
|
const addformvisible = ref(false); |
|
|
const addformvisible = ref(false); |
|
@ -94,7 +107,24 @@ |
|
|
const formSchema = formConfig; |
|
|
const formSchema = formConfig; |
|
|
const casData = ref([]); |
|
|
const casData = ref([]); |
|
|
const formSchema2 = formConfig2(casData); |
|
|
const formSchema2 = formConfig2(casData); |
|
|
|
|
|
const treeData = ref([]); |
|
|
|
|
|
const treeData2 = ref([]); |
|
|
|
|
|
const userAuthList = ref([]); |
|
|
|
|
|
const orgId = JSON.parse(sessionStorage.getItem('userInfo')).orgId; |
|
|
|
|
|
|
|
|
|
|
|
const fetch = (api, params = { orgId }) => { |
|
|
|
|
|
return http.post(api, params); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// 企业树 |
|
|
|
|
|
fetch(origanizemanage.queryOrgTree).then((res) => { |
|
|
|
|
|
treeData.value = res.data; |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// 部门树 |
|
|
|
|
|
fetch(origanizemanage.queryDeptTree).then((res) => { |
|
|
|
|
|
treeData2.value = res.data; |
|
|
|
|
|
}); |
|
|
const opMap: any = { |
|
|
const opMap: any = { |
|
|
type: 'add', |
|
|
type: 'add', |
|
|
fuc: () => {}, |
|
|
fuc: () => {}, |
|
@ -103,18 +133,37 @@ |
|
|
|
|
|
|
|
|
const onSearch = () => { |
|
|
const onSearch = () => { |
|
|
console.log(searchValue.value); |
|
|
console.log(searchValue.value); |
|
|
|
|
|
fetch(origanizemanage.queryOrgTree, { orgName: searchValue.value, orgId }).then((res) => { |
|
|
|
|
|
treeData.value = res.data; |
|
|
|
|
|
}); |
|
|
}; |
|
|
}; |
|
|
const onSearch2 = () => { |
|
|
const onSearch2 = () => { |
|
|
console.log(searchValue2.value); |
|
|
console.log(searchValue2.value); |
|
|
|
|
|
fetch(origanizemanage.queryDeptTree, { deptName: searchValue2.value, orgId }).then( |
|
|
|
|
|
(res) => { |
|
|
|
|
|
treeData2.value = res.data; |
|
|
|
|
|
}, |
|
|
|
|
|
); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const tableFetch = (params) => { |
|
|
|
|
|
tableConfig.value.params = { |
|
|
|
|
|
...tableConfig.value.params, |
|
|
|
|
|
...params, |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
mainRef.value?.nsTableRef.reload(); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
const handleSelect = (selectedKeys: any, info: any) => { |
|
|
const handleSelect = (selectedKeys: any, info: any) => { |
|
|
console.log(selectedKeys, 'selectedKeys'); |
|
|
fetch(origanizemanage.queryDeptTree, { orgId: info.node?.orgInfo.orgId }).then((res) => { |
|
|
console.log(info, 'info'); |
|
|
treeData2.value = res.data; |
|
|
|
|
|
}); |
|
|
|
|
|
tableFetch({ orgId: info.node?.orgInfo.orgId }); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
const handleSelect2 = (selectedKeys: any, info: any) => { |
|
|
const handleSelect2 = (selectedKeys: any, info: any) => { |
|
|
console.log(selectedKeys, 'selectedKeys'); |
|
|
tableFetch({ deptId: info.node?.deptInfo.deptId }); |
|
|
console.log(info, 'info'); |
|
|
|
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
const onClose = () => { |
|
|
const onClose = () => { |
|
@ -124,31 +173,38 @@ |
|
|
const onEdit = () => { |
|
|
const onEdit = () => { |
|
|
formRef.value?.triggerSubmit().then(() => { |
|
|
formRef.value?.triggerSubmit().then(() => { |
|
|
console.log(formData.value, 'formData.value'); |
|
|
console.log(formData.value, 'formData.value'); |
|
|
opMap.fuc && opMap.fuc(formData.value); |
|
|
if (!userAuthList.value.length) { |
|
|
|
|
|
NsMessage.error('请添加用户权限'); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
opMap.fuc && opMap.fuc({ ...formData.value, userRoleList: userAuthList.value, orgId }); |
|
|
visible.value = false; |
|
|
visible.value = false; |
|
|
}); |
|
|
}); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
const handleOk = () => { |
|
|
const handleOk = () => { |
|
|
console.log(formData2.value, 'formData2.value'); |
|
|
console.log(formData2.value, 'formData2.value'); |
|
|
console.log(opMap.type, 'type'); |
|
|
if (casData.value?.length !== 3) { |
|
|
if (opMap.type === 'add') { |
|
|
NsMessage.error('未选择角色'); |
|
|
mockData2.value.push({ information: casData.value.join('/') }); |
|
|
|
|
|
} else { |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
userAuthList.value.push({ |
|
|
|
|
|
userAuthList: cloneDeep(casData.value), |
|
|
|
|
|
roleId: casData.value[2].value, |
|
|
|
|
|
roleName: casData.value[2].label, |
|
|
|
|
|
}); |
|
|
addformvisible.value = false; |
|
|
addformvisible.value = false; |
|
|
}; |
|
|
}; |
|
|
const handleClose = () => { |
|
|
const handleClose = () => { |
|
|
addformvisible.value = false; |
|
|
addformvisible.value = false; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
const tableConfig = { |
|
|
const tableConfig = ref({ |
|
|
title: '用户管理', |
|
|
title: '用户管理', |
|
|
api: origanizemanage.userList, |
|
|
api: origanizemanage.userList, |
|
|
params: { |
|
|
params: { |
|
|
orgId: JSON.parse(sessionStorage.getItem('userInfo')).orgId, |
|
|
orgId, |
|
|
}, |
|
|
}, |
|
|
listField: 'data.records', |
|
|
|
|
|
headerActions: [ |
|
|
headerActions: [ |
|
|
{ |
|
|
{ |
|
|
label: '新增', |
|
|
label: '新增', |
|
@ -158,11 +214,9 @@ |
|
|
opMap.type = 'add'; |
|
|
opMap.type = 'add'; |
|
|
opMap.fuc = (formData: any) => { |
|
|
opMap.fuc = (formData: any) => { |
|
|
console.log(formData, 'formData'); |
|
|
console.log(formData, 'formData'); |
|
|
// origanizemanage.addUser |
|
|
http.post(origanizemanage.addUser, formData).then(() => { |
|
|
// mockData.value.push({ |
|
|
visible.value = false; |
|
|
// id: Math.random().toString().slice(2, 6), |
|
|
}); |
|
|
// ...cloneDeep(formData), |
|
|
|
|
|
// }); |
|
|
|
|
|
}; |
|
|
}; |
|
|
visible.value = true; |
|
|
visible.value = true; |
|
|
}, |
|
|
}, |
|
@ -187,33 +241,14 @@ |
|
|
{ |
|
|
{ |
|
|
label: '批量删除', |
|
|
label: '批量删除', |
|
|
type: 'primary', |
|
|
type: 'primary', |
|
|
name: 'RoleTypeAdd', |
|
|
name: 'userBatchDel', |
|
|
dynamicDisabled: (data: any) => { |
|
|
dynamicDisabled: (data: any) => { |
|
|
return data.list.length === 0; |
|
|
return data.list.length === 0; |
|
|
}, |
|
|
}, |
|
|
confirm: true, |
|
|
confirm: true, |
|
|
isReload: true, |
|
|
isReload: true, |
|
|
handle: (data: any) => { |
|
|
api: origanizemanage.batchDel, |
|
|
console.log('object :>> ', data.list); |
|
|
dynamicParams: { userIds: 'userId[]' }, |
|
|
const idList = data.list.map((item) => item.id); |
|
|
|
|
|
mockData.value.splice(0); |
|
|
|
|
|
return; |
|
|
|
|
|
const copyData = cloneDeep(mockData.value); |
|
|
|
|
|
mockData.value = copyData.filter((tar) => { |
|
|
|
|
|
return !idList.includes(tar.id); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
console.log(mockData.value); |
|
|
|
|
|
|
|
|
|
|
|
return; |
|
|
|
|
|
copyData.map((item, index) => { |
|
|
|
|
|
if (idList.includes(item.id)) { |
|
|
|
|
|
mockData.value.filter((tar) => { |
|
|
|
|
|
return !idList.includes(tar.id); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
}, |
|
|
|
|
|
}, |
|
|
}, |
|
|
], |
|
|
], |
|
|
columns: [ |
|
|
columns: [ |
|
@ -258,30 +293,34 @@ |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
title: '组织关系', |
|
|
title: '组织关系', |
|
|
dataIndex: 'deptInfo', |
|
|
dataIndex: 'orgName', |
|
|
customRender: (value) => { |
|
|
|
|
|
return value.record.deptInfo.orgName; |
|
|
|
|
|
}, |
|
|
|
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
title: '部门/角色', |
|
|
title: '部门/角色', |
|
|
dataIndex: 'orgInfo', |
|
|
dataIndex: 'deptRoleInfoList', |
|
|
customRender: (value) => { |
|
|
customRender: ({ value }) => { |
|
|
// // console.log(value.record.orgInfo.orgName, 'ss'); |
|
|
if (!value) return '-'; |
|
|
// console.log( |
|
|
return createVNode('div', {}, [ |
|
|
// value.record.userRoleList.map((item) => { |
|
|
createVNode('span', {}, value[0]), |
|
|
// return `${value.record.orgInfo.orgName}/${item.roleName}`; |
|
|
value.length > 1 && |
|
|
// }), |
|
|
createVNode( |
|
|
// ); |
|
|
'a', |
|
|
// value.record.userRoleList.map((item) => { |
|
|
{ |
|
|
// return `${value.record.orgInfo.orgName}/${item.roleName}`; |
|
|
onClick: () => |
|
|
// }); |
|
|
NsModal.info({ |
|
|
// return `${value.record.orgInfo.orgName}/`; |
|
|
icon: null, |
|
|
|
|
|
content: createVNode('div', { innerHTML: value.join('<br>') }), |
|
|
|
|
|
}), |
|
|
|
|
|
}, |
|
|
|
|
|
`+${value.length}`, |
|
|
|
|
|
), |
|
|
|
|
|
]); |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
title: '状态', |
|
|
title: '状态', |
|
|
dataIndex: 'userStatus', |
|
|
dataIndex: 'userStatus', |
|
|
|
|
|
customRender: ({ value }) => ['正常', '冻结'][value], |
|
|
}, |
|
|
}, |
|
|
], |
|
|
], |
|
|
columnActions: { |
|
|
columnActions: { |
|
@ -306,61 +345,30 @@ |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
label: '冻结', |
|
|
label: '冻结', |
|
|
name: 'RoleTypeEdit', |
|
|
name: 'userFrozen', |
|
|
handle: (record: any) => { |
|
|
confirm: true, |
|
|
console.log(record, 'record'); |
|
|
defaultParams: { userStatus: 1 }, |
|
|
Modal.confirm({ |
|
|
dynamicParams: 'userId', |
|
|
title: '是否冻结该账户', |
|
|
isReload: true, |
|
|
icon: createVNode(ExclamationCircleOutlined), |
|
|
api: origanizemanage.frozen, |
|
|
content: createVNode('div', { style: 'color:red;' }, ''), |
|
|
|
|
|
|
|
|
|
|
|
onOk() { |
|
|
|
|
|
// http |
|
|
|
|
|
// .post('/api/parking_merchant/objs/gateInfo/delete', { |
|
|
|
|
|
// uuid: record.uuid, |
|
|
|
|
|
// }) |
|
|
|
|
|
// .then((res) => { |
|
|
|
|
|
// mainRef.value.nsTableRef.reload(); |
|
|
|
|
|
// }); |
|
|
|
|
|
NsMessage.success('冻结成功'); |
|
|
|
|
|
}, |
|
|
|
|
|
class: 'test', |
|
|
|
|
|
}); |
|
|
|
|
|
}, |
|
|
|
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
label: '重置密码', |
|
|
label: '重置密码', |
|
|
name: 'RoleTypeEdit', |
|
|
name: 'userCodeReset', |
|
|
handle: (record: any) => { |
|
|
confirm: true, |
|
|
console.log(record, 'record'); |
|
|
handle: ({ userId }: any) => { |
|
|
Modal.confirm({ |
|
|
http |
|
|
title: '是否重置密码', |
|
|
.post(origanizemanage.resetPwd, { userId }) |
|
|
icon: createVNode(ExclamationCircleOutlined), |
|
|
.then(() => NsModal.success({ content: '密码重置成功,初始密码123456' })); |
|
|
content: createVNode('div', { style: 'color:red;' }, ''), |
|
|
|
|
|
onOk() { |
|
|
|
|
|
// Modal.success({ |
|
|
|
|
|
// title: '密码重置成功,初始密码123456', |
|
|
|
|
|
// }); |
|
|
|
|
|
NsMessage.success('密码重置成功,初始密码123456'); |
|
|
|
|
|
}, |
|
|
|
|
|
onCancel() { |
|
|
|
|
|
console.log('Cancel'); |
|
|
|
|
|
}, |
|
|
|
|
|
class: 'test', |
|
|
|
|
|
}); |
|
|
|
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
label: '删除', |
|
|
label: '删除', |
|
|
name: 'RoleTypeEdit', |
|
|
name: 'userDelete', |
|
|
dynamicParams: { |
|
|
dynamicParams: 'userId', |
|
|
uuid: 'uuid', |
|
|
|
|
|
}, |
|
|
|
|
|
confirm: true, |
|
|
confirm: true, |
|
|
handle: (record: any, name: any, reload: any) => { |
|
|
isReload: true, |
|
|
console.log(record, name, reload, 'record'); |
|
|
api: origanizemanage.del, |
|
|
mockData.value.splice(0, 1); |
|
|
|
|
|
}, |
|
|
|
|
|
}, |
|
|
}, |
|
|
], |
|
|
], |
|
|
}, |
|
|
}, |
|
@ -409,15 +417,15 @@ |
|
|
component: 'NsSelect', |
|
|
component: 'NsSelect', |
|
|
componentProps: { |
|
|
componentProps: { |
|
|
placeholder: '请选择', |
|
|
placeholder: '请选择', |
|
|
disabled: true, |
|
|
allowClear: true, |
|
|
options: [ |
|
|
options: [ |
|
|
{ |
|
|
{ |
|
|
label: '正常', |
|
|
label: '正常', |
|
|
value: 1, |
|
|
value: 0, |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
label: '冻结', |
|
|
label: '冻结', |
|
|
value: 2, |
|
|
value: 1, |
|
|
}, |
|
|
}, |
|
|
], |
|
|
], |
|
|
}, |
|
|
}, |
|
@ -427,14 +435,13 @@ |
|
|
}, |
|
|
}, |
|
|
// pagination: { defaultPageSize: 10 }, |
|
|
// pagination: { defaultPageSize: 10 }, |
|
|
rowKey: 'id', |
|
|
rowKey: 'id', |
|
|
}; |
|
|
}); |
|
|
const tableConfig2 = { |
|
|
const tableConfig2 = { |
|
|
// api: { |
|
|
// api: { |
|
|
// url: '/carbon_emission/device/getGatewayList', |
|
|
// url: '/carbon_emission/device/getGatewayList', |
|
|
// method: 'post', |
|
|
// method: 'post', |
|
|
// }, |
|
|
// }, |
|
|
value: mockData2.value, |
|
|
value: userAuthList.value, |
|
|
listField: 'data.records', |
|
|
|
|
|
rowSelection: null, |
|
|
rowSelection: null, |
|
|
headerActions: [ |
|
|
headerActions: [ |
|
|
{ |
|
|
{ |
|
@ -442,11 +449,11 @@ |
|
|
name: 'RoleTypeAdd', |
|
|
name: 'RoleTypeAdd', |
|
|
type: 'primary', |
|
|
type: 'primary', |
|
|
handle: () => { |
|
|
handle: () => { |
|
|
opMap.type = 'add'; |
|
|
// opMap.type = 'add'; |
|
|
opMap.fuc = (formData2: any) => { |
|
|
// opMap.fuc = (formData2: any) => { |
|
|
console.log(formData2, 'formData2'); |
|
|
// console.log(formData2, 'formData2'); |
|
|
mockData2.value.push(cloneDeep(formData2)); |
|
|
// userAuthList.value.push(cloneDeep(formData2)); |
|
|
}; |
|
|
// }; |
|
|
addformvisible.value = true; |
|
|
addformvisible.value = true; |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
@ -454,36 +461,52 @@ |
|
|
columns: [ |
|
|
columns: [ |
|
|
{ |
|
|
{ |
|
|
title: '角色信息', |
|
|
title: '角色信息', |
|
|
dataIndex: 'information', |
|
|
dataIndex: 'userRoleList', |
|
|
|
|
|
customRender: ({ record }) => { |
|
|
|
|
|
if (record) { |
|
|
|
|
|
const res = record.userAuthList.reduce((pre, cur) => { |
|
|
|
|
|
pre.push(cur.label); |
|
|
|
|
|
return pre; |
|
|
|
|
|
}, []); |
|
|
|
|
|
return res.join('/'); |
|
|
|
|
|
} |
|
|
|
|
|
return '-'; |
|
|
|
|
|
}, |
|
|
}, |
|
|
}, |
|
|
], |
|
|
], |
|
|
columnActions: { |
|
|
columnActions: { |
|
|
title: '操作', |
|
|
title: '操作', |
|
|
actions: [ |
|
|
actions: [ |
|
|
{ |
|
|
// { |
|
|
label: '编辑', |
|
|
// label: '编辑', |
|
|
name: 'RoleTypeEdit', |
|
|
// name: 'RoleTypeEdit', |
|
|
// dynamicParams: 'uuid', |
|
|
// // dynamicParams: 'uuid', |
|
|
handle: (record: any) => { |
|
|
// handle: (record: any) => { |
|
|
console.log(record, 'record'); |
|
|
// console.log(record, 'record'); |
|
|
formData2.value = record; |
|
|
// formData2.value = record; |
|
|
opMap.type = 'edit'; |
|
|
// opMap.type = 'edit'; |
|
|
opMap.fuc = (formData2: any) => { |
|
|
// opMap.fuc = (formData2: any) => { |
|
|
Object.assign( |
|
|
// Object.assign( |
|
|
mockData.value.filter((item) => item.id === record.id)[0], |
|
|
// mockData.value.filter((item) => item.id === record.id)[0], |
|
|
formData2, |
|
|
// formData2, |
|
|
); |
|
|
// ); |
|
|
}; |
|
|
// }; |
|
|
addformvisible.value = true; |
|
|
// addformvisible.value = true; |
|
|
}, |
|
|
// }, |
|
|
}, |
|
|
// }, |
|
|
{ |
|
|
{ |
|
|
label: '删除', |
|
|
label: '删除', |
|
|
name: 'RoleTypeEdit', |
|
|
name: 'RoleTypeEdit', |
|
|
confirm: true, |
|
|
confirm: true, |
|
|
handle: (record: any, name: any, reload: any) => { |
|
|
handle: (record: any, name: any, reload: any) => { |
|
|
console.log(record, name, reload, 'record'); |
|
|
const id = record.roleId; |
|
|
mockData2.value.splice(0, 1); |
|
|
console.log(userAuthList.value, id); |
|
|
|
|
|
let idx = 0; |
|
|
|
|
|
userAuthList.value?.some((item, index) => { |
|
|
|
|
|
idx = index; |
|
|
|
|
|
if (item.roleId === id) return true; |
|
|
|
|
|
}); |
|
|
|
|
|
userAuthList.value.splice(idx, 1); |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
], |
|
|
], |
|
@ -523,16 +546,16 @@ |
|
|
display: flex; |
|
|
display: flex; |
|
|
} |
|
|
} |
|
|
.left { |
|
|
.left { |
|
|
width: 400px; |
|
|
width: 350px; |
|
|
border-right: 5px solid rgb(229, 235, 240); |
|
|
border-right: 5px solid rgb(229, 235, 240); |
|
|
min-width: fit-content; |
|
|
min-width: fit-content; |
|
|
} |
|
|
} |
|
|
.right { |
|
|
.right { |
|
|
flex: 1; |
|
|
flex: 1; |
|
|
overflow: auto; |
|
|
min-width: 0; |
|
|
} |
|
|
} |
|
|
.top { |
|
|
.top { |
|
|
height: 46vh; |
|
|
height: 50%; |
|
|
border-bottom: 5px solid rgb(229, 235, 240); |
|
|
border-bottom: 5px solid rgb(229, 235, 240); |
|
|
} |
|
|
} |
|
|
.ns-table-title { |
|
|
.ns-table-title { |
|
@ -550,10 +573,13 @@ |
|
|
font-size: 16px; |
|
|
font-size: 16px; |
|
|
font-weight: bold; |
|
|
font-weight: bold; |
|
|
user-select: text; |
|
|
user-select: text; |
|
|
padding-left: 16px; |
|
|
|
|
|
width: calc(100% + 32px); |
|
|
width: calc(100% + 32px); |
|
|
} |
|
|
} |
|
|
.form { |
|
|
.drawerTable { |
|
|
margin-left: 10px; |
|
|
:deep(.ns-table-container), |
|
|
|
|
|
:deep(.ns-table-main) { |
|
|
|
|
|
border-top: 0; |
|
|
|
|
|
padding: 0; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
</style> |
|
|
</style> |
|
|