master
张同海 9 months ago
parent ee811c5f58
commit 45f82bec3b

@ -7,9 +7,8 @@ enum Api {
GetTenantPermission = '/adminApi/Tenant/GetTenantPermission',
GetTenantInfo = '/adminApi/Tenant/GetTenantInfo',
UpdateTenantPermission = '/adminApi/Tenant/UpdateTenantPermission',
GetPermissionAuthList = '/adminApi/Tenant/GetPermissionAuthList',
editUser = '/adminApi/User/EditUser',
getUser = '/adminApi/User/GetUserInfo',
}
export function GetTenantList(data: PageRequest) {
@ -40,17 +39,11 @@ export function UpdatePermission(data: any) {
data,
})
}
export function editUser(data: any) {
export function GetAuthList(query: any) {
return request<DataResult>({
url: Api.editUser,
method: 'post',
data,
})
}
export function getUser(query: { id: string }) {
return request<DataResult>({
url: Api.getUser,
url: Api.GetPermissionAuthList,
method: 'get',
params: query,
})
}

@ -44,7 +44,7 @@
// disabled: true,
// onClick: customSubmitFunc,
// },
showResetButton: true,
showResetButton: false,
submitButtonOptions: {
text: '下一步',
},

@ -20,9 +20,7 @@
{ deep: true },
)
async function initData() {
let Rdata = {
authUserNum: props.ApiData.authUserNum,
}
let Rdata = {}
props.ApiData.permissionAuthList.forEach((item) => {
Rdata[`${item.permissionId}--authNum`] = item.authNum
})
@ -88,12 +86,11 @@
schemas: authorization.value,
resetButtonOptions: {
text: '上一步',
// onClick: handlePrev,
},
resetFunc: handlePrev,
showResetButton: true,
submitButtonOptions: {
text: '下一步',
text: '授权',
},
submitFunc: handleNext,
})

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

@ -16,11 +16,10 @@
</div>
<div class="mt-5">
<PermissionSetStep
@prev="handleStepPrev"
@next="handleStep2Next"
v-show="current === 0"
v-if="state.initSetp1"
:ApiData="checkedKeys"
:ApiData="ApiData"
/>
<Authorization
@prev="handleStepPrev"
@ -51,17 +50,13 @@
import { useMessage } from '/@/hooks/web/useMessage'
import PermissionSetStep from './PermissionSetStep.vue'
import Authorization from './Authorization.vue'
import { RejectTenantApply } from './api'
import { getPermission, getInfo } from '/@/api/system/tenant'
import { useUserStore } from '/@/store/modules/user'
import { getClientPermissionTreeList } from './api'
import { getPermission, GetAuthList } from '/@/api/system/tenant'
import { UpdatePermission } from '/@/api/system/tenant'
const userStore = useUserStore()
onMounted(() => {
// tenantId
tenantId.value = userStore.getUserInfo?.tenantId
console.log('Mounted', userStore.getUserInfo)
})
const tenantId = ref('')
const treeData = ref([])
const { notification, createConfirm, createMessage } = useMessage()
// Emits
const emit = defineEmits(['success', 'register'])
@ -82,57 +77,39 @@
permissionIds: [],
permissionAuthList: [],
})
const ShowData = reactive({
address: '',
adminUserCode: '',
auditNote: '',
auditStatus: '',
auditTime: '',
chief: '',
contractBeginDate: '',
contractEndDate: '',
email: '',
id: '',
name: '',
phone: '',
pinYinCode: '',
taxNo: '',
tel: '',
})
async function initData() {
console.log('initData')
const res: API.DataResult = await getInfo({ id: applyId.value })
const e = await getClientPermissionTreeList()
treeData.value = e.data
const res: API.DataResult = await GetAuthList({ id: tenantId.value })
if (res.succeeded) {
ShowData.address = res.data.address
ShowData.adminUserCode = res.data.adminUserCode
ShowData.auditNote = res.data.auditNote
ShowData.auditStatus = res.data.auditStatus
ShowData.auditTime = res.data.auditTime
ShowData.chief = res.data.chief
ShowData.contractBeginDate = res.data.contractBeginDate
ShowData.contractEndDate = res.data.contractEndDate
ShowData.email = res.data.email
ShowData.id = res.data.id
ShowData.name = res.data.name
ShowData.phone = res.data.phone
ShowData.pinYinCode = res.data.pinYinCode
ShowData.taxNo = res.data.taxNo
ShowData.tel = res.data.tel
console.log(res)
ApiData.permissionAuthList = res.data
}
console.log(tenantId)
const res2: API.DataResult = await getPermission({ id: tenantId.value })
if (res2.succeeded) {
console.log(res2)
checkedKeys.value = []
// res2.data.forEach((item) => {
// console.log(item, 'item')
// treeData.value.forEach((item2) => {
// console.log(item2, 'item2')
// })
// })
// WebcheckedKeys = res2.succeeded
console.log(res2.data)
checkedKeys.value = res2.data
ApiData.permissionIds = res2.data
}
}
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
console.log('closeModal')
tenantId.value = data.record.id
ApiData.tenantId = tenantId.value
ApiData.permissionIds = []
ApiData.permissionAuthList = []
checkedKeys.value = []
current.value = 0
state.initSetp1 = true
@ -153,9 +130,9 @@
})
function handleStepPrev(stepValues) {
current.value--
console.log(current.value)
console.log(ApiData)
current.value--
if (current.value == 0) {
state.initSetp1 = true
state.initSetp2 = false
@ -232,5 +209,5 @@
// }
// }
const getTitle = computed(() => (!unref(isUpdate) ? '' : '企业用户审批'))
const getTitle = computed(() => (!unref(isUpdate) ? '' : '权限模块授权'))
</script>

@ -3,6 +3,20 @@ import { BasicColumn, FormSchema } from '/@/components/Table'
// import { getDictDropDown } from '/@/api/common/index';
import { getRoleList } from '/@/api/common'
import { Tag } from 'ant-design-vue'
export const searchFormSchema: FormSchema[] = [
{
field: 'Name',
label: '公司名称',
component: 'Input',
colProps: { span: 8 },
},
{
field: 'PinYinCode',
label: '助记码',
component: 'Input',
colProps: { span: 8 },
},
]
export const columns: BasicColumn[] = [
{
title: '公司名称',
@ -76,7 +90,7 @@ export const permissionFormSchema: FormSchema[] = [
{
field: 'divider-selects',
component: 'Divider',
label: '审批步骤',
label: '授权步骤',
colProps: { span: 24 },
},
{
@ -87,20 +101,7 @@ export const permissionFormSchema: FormSchema[] = [
show: false,
},
]
export const searchFormSchema: FormSchema[] = [
{
field: 'UserName',
label: '用户名称',
component: 'Input',
colProps: { span: 8 },
},
{
field: 'UserCode',
label: '用户唯一编码',
component: 'Input',
colProps: { span: 8 },
},
]
export const formSchema: FormSchema[] = [
{
field: 'divider-selects',

@ -2,7 +2,7 @@
<div>
<BasicTable @register="registerTable">
<template #toolbar>
<a-button type="primary" @click="handleCreate"> </a-button>
<!-- <a-button type="primary" @click="handleCreate"> </a-button> -->
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'userName'">
@ -56,17 +56,17 @@
},
}
let condition: API.ConditionItem[] = []
if (!!data.UserName) {
if (!!data.Name) {
condition.push({
FieldName: 'UserName',
FieldValue: data.UserName,
FieldName: 'Name',
FieldValue: data.Name,
ConditionalType: 1,
})
}
if (!!data.UserCode) {
if (!!data.PinYinCode) {
condition.push({
FieldName: 'UserCode',
FieldValue: data.UserCode,
FieldName: 'PinYinCode',
FieldValue: data.PinYinCode,
ConditionalType: 1,
})
}
@ -86,12 +86,15 @@
showTableSetting: true,
bordered: true,
showIndexColumn: true,
indexColumnProps: {
fixed: 'left',
},
canResize: false,
actionColumn: {
width: 80,
title: '操作',
dataIndex: 'action',
fixed: undefined,
fixed: 'right',
},
})

Loading…
Cancel
Save