|
|
@ -14,7 +14,7 @@
|
|
|
|
<BasicForm @register="registerForm" />
|
|
|
|
<BasicForm @register="registerForm" />
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
|
|
<script lang="ts" setup>
|
|
|
|
import { defineComponent, onMounted, ref, unref } from 'vue'
|
|
|
|
import { defineComponent, onMounted, ref, unref, watch } from 'vue'
|
|
|
|
import { BasicForm, useForm } from '/@/components/Form/index'
|
|
|
|
import { BasicForm, useForm } from '/@/components/Form/index'
|
|
|
|
import { permissionFormSchema } from './columns'
|
|
|
|
import { permissionFormSchema } from './columns'
|
|
|
|
import { getTenantAuditInfo, auditInfo } from './api'
|
|
|
|
import { getTenantAuditInfo, auditInfo } from './api'
|
|
|
@ -22,6 +22,7 @@
|
|
|
|
import { BasicTree, TreeItem } from '/@/components/Tree'
|
|
|
|
import { BasicTree, TreeItem } from '/@/components/Tree'
|
|
|
|
import { getClientPermissionTreeList } from './api'
|
|
|
|
import { getClientPermissionTreeList } from './api'
|
|
|
|
import { propTypes } from '/@/utils/propTypes'
|
|
|
|
import { propTypes } from '/@/utils/propTypes'
|
|
|
|
|
|
|
|
|
|
|
|
//树的信息
|
|
|
|
//树的信息
|
|
|
|
const treeData = ref<TreeItem[]>([])
|
|
|
|
const treeData = ref<TreeItem[]>([])
|
|
|
|
//树的全部节点信息
|
|
|
|
//树的全部节点信息
|
|
|
@ -42,6 +43,14 @@
|
|
|
|
const props = defineProps({
|
|
|
|
const props = defineProps({
|
|
|
|
ApiData: propTypes.object,
|
|
|
|
ApiData: propTypes.object,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
watch(
|
|
|
|
|
|
|
|
() => props.ApiData,
|
|
|
|
|
|
|
|
() => {
|
|
|
|
|
|
|
|
fetch()
|
|
|
|
|
|
|
|
console.log(props.ApiData, 'props.ApiData')
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{ deep: true },
|
|
|
|
|
|
|
|
)
|
|
|
|
const [registerForm, { resetFields, setFieldsValue, validate, updateSchema }] = useForm({
|
|
|
|
const [registerForm, { resetFields, setFieldsValue, validate, updateSchema }] = useForm({
|
|
|
|
labelWidth: 100,
|
|
|
|
labelWidth: 100,
|
|
|
|
schemas: permissionFormSchema,
|
|
|
|
schemas: permissionFormSchema,
|
|
|
@ -54,14 +63,10 @@
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
async function handleNext() {
|
|
|
|
async function handleNext() {
|
|
|
|
console.log('permission', checkedKeys.value)
|
|
|
|
|
|
|
|
let Rdata = []
|
|
|
|
let Rdata = []
|
|
|
|
treeData.value.forEach((item) => {
|
|
|
|
treeData.value.forEach((item) => {
|
|
|
|
console.log(item)
|
|
|
|
|
|
|
|
item.children.forEach((item2) => {
|
|
|
|
item.children.forEach((item2) => {
|
|
|
|
console.log(item2)
|
|
|
|
|
|
|
|
checkedKeys.value.forEach((e) => {
|
|
|
|
checkedKeys.value.forEach((e) => {
|
|
|
|
console.log(e)
|
|
|
|
|
|
|
|
if (e == item2.key) {
|
|
|
|
if (e == item2.key) {
|
|
|
|
Rdata.push(item2)
|
|
|
|
Rdata.push(item2)
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -74,25 +79,36 @@
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
async function fetch() {
|
|
|
|
async function fetch() {
|
|
|
|
|
|
|
|
console.log('fetch')
|
|
|
|
|
|
|
|
|
|
|
|
reset()
|
|
|
|
reset()
|
|
|
|
//初始化数据
|
|
|
|
//初始化数据
|
|
|
|
const res = await getClientPermissionTreeList()
|
|
|
|
|
|
|
|
treeData.value = res.data
|
|
|
|
|
|
|
|
initData()
|
|
|
|
initData()
|
|
|
|
// allTreeKeys.value = res.data.ids
|
|
|
|
// allTreeKeys.value = res.data.ids
|
|
|
|
// treeData.value = data
|
|
|
|
// treeData.value = data
|
|
|
|
}
|
|
|
|
}
|
|
|
|
async function initData() {
|
|
|
|
async function initData() {
|
|
|
|
console.log(props.ApiData)
|
|
|
|
console.log('initData', props.ApiData)
|
|
|
|
let Arr = []
|
|
|
|
WebcheckedKeys.value = props.ApiData.permissionIds
|
|
|
|
props.ApiData.forEach((item) => {
|
|
|
|
checkedKeys.value = props.ApiData.permissionIds
|
|
|
|
Arr.push(item.key)
|
|
|
|
const res = await getClientPermissionTreeList()
|
|
|
|
})
|
|
|
|
let Hierarchy = (data, num) => {
|
|
|
|
// setFieldsValue({
|
|
|
|
data.forEach((item) => {
|
|
|
|
// ...props.ShowData,
|
|
|
|
// if (num != 1) {
|
|
|
|
// ...props.ApiData.auditInfo,
|
|
|
|
//
|
|
|
|
// })
|
|
|
|
// }
|
|
|
|
checkedKeys.value = Arr
|
|
|
|
checkedKeys.value.forEach((e) => {
|
|
|
|
|
|
|
|
if (e == item.key) {
|
|
|
|
|
|
|
|
item.disableCheckbox = true
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
if (item.children) {
|
|
|
|
|
|
|
|
Hierarchy(item.children, num + 1)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Hierarchy(res.data, 0)
|
|
|
|
|
|
|
|
treeData.value = res.data
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -102,20 +118,18 @@
|
|
|
|
treeData.value = []
|
|
|
|
treeData.value = []
|
|
|
|
allTreeKeys.value = []
|
|
|
|
allTreeKeys.value = []
|
|
|
|
checkedKeys.value = []
|
|
|
|
checkedKeys.value = []
|
|
|
|
defaultCheckedKeys.value = []
|
|
|
|
|
|
|
|
selectedKeys.value = []
|
|
|
|
selectedKeys.value = []
|
|
|
|
// roleId.value = ''
|
|
|
|
// roleId.value = ''
|
|
|
|
|
|
|
|
defaultCheckedKeys.value = []
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 点击选中
|
|
|
|
* 点击选中
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
function onCheck(o, info) {
|
|
|
|
function onCheck(o, info) {
|
|
|
|
console.log(o, info)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
checkedKeys.value = o.checked ? o.checked : o
|
|
|
|
checkedKeys.value = o.checked ? o.checked : o
|
|
|
|
WebcheckedKeys.value = o.concat(info.halfCheckedKeys)
|
|
|
|
WebcheckedKeys.value = o.concat(info.halfCheckedKeys)
|
|
|
|
console.log(WebcheckedKeys.value, checkedKeys.value)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// checkedKeys.value = o.concat(info.halfCheckedKeys)
|
|
|
|
// checkedKeys.value = o.concat(info.halfCheckedKeys)
|
|
|
|
}
|
|
|
|
}
|
|
|
|