任务台

szh-new
lijingjia 4 months ago
parent 02557bb14e
commit 027d3ac57b

@ -11,36 +11,11 @@
title="所拥有的的权限"
:tree-data="treeData"
:checkable="true"
:checked-keys="checkedKeys"
:selected-keys="selectedKeys"
:checked-keys="checkedKeys"
default-expand-all
@check="onCheck"
/>
<!-- <BasicTree-->
<!-- ref="treeRef"-->
<!-- checkable-->
<!-- toolbar-->
<!-- :treeData="treeData"-->
<!-- :checkedKeys="checkedKeys"-->
<!-- :expandedKeys="allTreeKeys"-->
<!-- :selectedKeys="selectedKeys"-->
<!-- :fieldNames="{ key: 'key', title: 'title' }"-->
<!-- :checkStrictly="true"-->
<!-- :clickRowToExpand="false"-->
<!-- title="所拥有的的权限"-->
<!-- @check="onCheck"-->
<!-- @select="onTreeNodeSelect"-->
<!-- >-->
<!-- <template #title="{ slotTitle, ruleFlag }">-->
<!-- {{ slotTitle }}-->
<!-- <Icon-->
<!-- v-if="ruleFlag"-->
<!-- icon="ant-design:align-left-outlined"-->
<!-- style="margin-left: 5px; color: red"-->
<!-- />-->
<!-- </template>-->
<!-- </BasicTree>-->
<!--右下角按钮-->
<template #footer>
<PopConfirmButton
title="确定放弃编辑?"
@ -63,7 +38,7 @@
</BasicModal>
</template>
<script lang="ts" setup>
import { ref, computed, unref, onMounted } from 'vue'
import { ref, computed, unref } from 'vue'
import { BasicModal, useModalInner } from '/@/components/Modal'
import { BasicTree, TreeItem } from '/@/components/Tree'
import { PopConfirmButton } from '/@/components/Button'
@ -76,9 +51,9 @@
const allTreeKeys = ref([])
//
const checkedKeys = ref([])
const defaultCheckedKeys = ref([])
//
const checkKeys = ref([])
const selectedKeys = ref([])
const defaultCheckedKeys = ref([])
const roleId = ref('')
//
const treeRef = ref(null)
@ -98,11 +73,16 @@
defaultCheckedKeys.value = permResult.data
setModalProps({ loading: false })
})
const checkedKeysIsChange = ref(false)
const halfCheckedKeys = ref([])
const historyCheckedKeys = ref([])
/**
* 点击选中
*/
function onCheck(o) {
checkedKeys.value = o.checked ? o.checked : o
function onCheck(checkedKeys, e) {
checkedKeysIsChange.value = true
checkKeys.value = checkedKeys
halfCheckedKeys.value = e.halfCheckedKeys
}
/**
@ -113,7 +93,6 @@
allTreeKeys.value = []
checkedKeys.value = []
defaultCheckedKeys.value = []
selectedKeys.value = []
roleId.value = ''
}
/**
@ -130,10 +109,15 @@
* 提交
*/
async function handleSubmit(exit) {
let permissionIds = []
if(checkedKeysIsChange.value){
permissionIds = checkKeys.value.concat(halfCheckedKeys.value)
}else{
permissionIds = historyCheckedKeys.value
}
let params = {
roleId: unref(roleId),
permissionIds: unref(getTree().getCheckedKeys()).join(',').split(','),
// lastpermissionIds: unref(defaultCheckedKeys).join(','),
permissionIds: permissionIds
}
loading.value = true
await updateRolePermission(params)

Loading…
Cancel
Save