【升级】用户、角色、字典、机构、岗位这些左树右表得到增强,新增时选择树后对应新增的表单跟着选中

pull/90/head
小诺 2 years ago committed by 俞宝山
parent 41d8a234a3
commit cb4f0a4680

@ -84,12 +84,15 @@
const submitLoading = ref(false) const submitLoading = ref(false)
// //
const onOpen = (record) => { const onOpen = (record, parentId) => {
visible = true visible = true
extJson.value = ref([]) extJson.value = ref([])
formData.value = { formData.value = {
sortCode: 99 sortCode: 99
} }
if (parentId) {
formData.value.parentId = parentId
}
if (record) { if (record) {
const param = { const param = {
id: record.id id: record.id

@ -19,7 +19,7 @@
<a-row :gutter="24"> <a-row :gutter="24">
<a-col :span="8"> <a-col :span="8">
<a-form-item name="searchKey" label="名称关键词"> <a-form-item name="searchKey" label="名称关键词">
<a-input v-model:value="searchFormState.searchKey" placeholder="请输入机构名称关键词"></a-input> <a-input v-model:value="searchFormState.searchKey" placeholder="请输入机构名称关键词" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="8"> <a-col :span="8">
@ -48,7 +48,7 @@
> >
<template #operator class="table-operator"> <template #operator class="table-operator">
<a-space> <a-space>
<a-button type="primary" @click="form.onOpen()" v-if="hasPerm('bizOrgAdd')"> <a-button type="primary" @click="form.onOpen(undefined, searchFormState.parentId)" v-if="hasPerm('bizOrgAdd')">
<template #icon><plus-outlined /></template> <template #icon><plus-outlined /></template>
新增 新增
</a-button> </a-button>

@ -68,11 +68,14 @@
const submitLoading = ref(false) const submitLoading = ref(false)
// //
const onOpen = (record) => { const onOpen = (record, orgId) => {
visible = true visible = true
formData.value = { formData.value = {
sortCode: 99 sortCode: 99
} }
if (orgId) {
formData.value.orgId = orgId
}
if (record) { if (record) {
formData.value = Object.assign({}, record) formData.value = Object.assign({}, record)
} }

@ -19,7 +19,7 @@
<a-row :gutter="24"> <a-row :gutter="24">
<a-col :span="8"> <a-col :span="8">
<a-form-item name="searchKey" label="名称关键词"> <a-form-item name="searchKey" label="名称关键词">
<a-input v-model:value="searchFormState.searchKey" placeholder="请输入岗位名称关键词"></a-input> <a-input v-model:value="searchFormState.searchKey" placeholder="请输入岗位名称关键词" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="8"> <a-col :span="8">
@ -48,7 +48,7 @@
> >
<template #operator class="table-operator"> <template #operator class="table-operator">
<a-space> <a-space>
<a-button type="primary" @click="form.onOpen()" v-if="hasPerm('bizPositionAdd')"> <a-button type="primary" @click="form.onOpen(undefined, searchFormState.orgId)" v-if="hasPerm('bizPositionAdd')">
<template #icon><plus-outlined /></template> <template #icon><plus-outlined /></template>
新增 新增
</a-button> </a-button>

@ -351,33 +351,42 @@
let formData = ref({}) let formData = ref({})
// //
const onOpen = (record) => { const onOpen = (record, orgId) => {
visible = true visible = true
formData.value = { formData.value = {
gender: '男', gender: '男',
positionJson: [] positionJson: []
} }
if (orgId) {
formData.value.orgId = orgId
//
nextTick(() => {
selePositionData(orgId)
})
}
if (record) { if (record) {
convertFormData(record) convertFormData(record)
} }
// nextTick(() => {
bizUserApi.userOrgTreeSelector().then((res) => { //
if (res !== null) { bizUserApi.userOrgTreeSelector().then((res) => {
treeData.value = res if (res !== null) {
// 2 treeData.value = res
treeData.value.forEach((item) => { // 2
// 0 treeData.value.forEach((item) => {
if (item.parentId === '0') { // 0
treeDefaultExpandedKeys.value.push(item.id) if (item.parentId === '0') {
// ID treeDefaultExpandedKeys.value.push(item.id)
if (item.children) { // ID
item.children.forEach((items) => { if (item.children) {
treeDefaultExpandedKeys.value.push(items.id) item.children.forEach((items) => {
}) treeDefaultExpandedKeys.value.push(items.id)
})
}
} }
} })
}) }
} })
}) })
} }
// //

@ -60,7 +60,7 @@
> >
<template #operator class="table-operator"> <template #operator class="table-operator">
<a-space> <a-space>
<a-button type="primary" @click="form.onOpen()" v-if="hasPerm('bizUserAdd')"> <a-button type="primary" @click="form.onOpen(undefined, searchFormState.orgId)" v-if="hasPerm('bizUserAdd')">
<template #icon><plus-outlined /></template> <template #icon><plus-outlined /></template>
<span>{{ $t('common.addButton') }}{{ $t('model.user') }}</span> <span>{{ $t('common.addButton') }}{{ $t('model.user') }}</span>
</a-button> </a-button>

@ -39,7 +39,7 @@
</a-button> </a-button>
</a-col> </a-col>
<a-col :span="8"> <a-col :span="8">
<a-button type="primary" @click="form.onOpen(undefined, 'BIZ')"> <a-button type="primary" @click="form.onOpen(undefined, 'BIZ', searchFormState.parentId)">
<template #icon><plus-outlined /></template> <template #icon><plus-outlined /></template>
新增 新增
</a-button> </a-button>

@ -39,7 +39,7 @@
/> />
</a-form-item> </a-form-item>
<a-form-item label="排序:" name="sortCode"> <a-form-item label="排序:" name="sortCode">
<a-input-number style="width: 100%" v-model:value="formData.sortCode" :max="100" /> <a-input-number style="width: 100%" v-model:value="formData.sortCode" :max="1000" />
</a-form-item> </a-form-item>
</a-form> </a-form>
<template #footer> <template #footer>
@ -66,12 +66,15 @@
const defaultExpandedKeys = ref([0]) const defaultExpandedKeys = ref([0])
// //
const onOpen = (record, type) => { const onOpen = (record, type, parentId) => {
visible = true visible = true
formData.value = { formData.value = {
sortCode: 99, sortCode: 99,
category: type category: type
} }
if (parentId) {
formData.value.parentId = parentId
}
if (record) { if (record) {
formData.value = Object.assign({}, record) formData.value = Object.assign({}, record)
formData.value.category = type formData.value.category = type

@ -39,7 +39,7 @@
</a-button> </a-button>
</a-col> </a-col>
<a-col :span="8"> <a-col :span="8">
<a-button type="primary" @click="form.onOpen(undefined, 'FRM')"> <a-button type="primary" @click="form.onOpen(undefined, 'FRM', searchFormState.parentId)">
<template #icon><plus-outlined /></template> <template #icon><plus-outlined /></template>
新增 新增
</a-button> </a-button>

@ -25,7 +25,7 @@
}" }"
selectable="false" selectable="false"
tree-line tree-line
></a-tree-select> />
</a-form-item> </a-form-item>
<a-form-item label="组织名称:" name="name"> <a-form-item label="组织名称:" name="name">
<a-input v-model:value="formData.name" placeholder="请输入组织名称" allow-clear /> <a-input v-model:value="formData.name" placeholder="请输入组织名称" allow-clear />
@ -84,12 +84,15 @@
const submitLoading = ref(false) const submitLoading = ref(false)
// //
const onOpen = (record) => { const onOpen = (record, parentId) => {
visible = true visible = true
extJson.value = ref([]) extJson.value = ref([])
formData.value = { formData.value = {
sortCode: 99 sortCode: 99
} }
if (parentId) {
formData.value.parentId = parentId
}
if (record) { if (record) {
const param = { const param = {
id: record.id id: record.id

@ -8,8 +8,7 @@
:tree-data="treeData" :tree-data="treeData"
:field-names="treeFieldNames" :field-names="treeFieldNames"
@select="treeSelect" @select="treeSelect"
> />
</a-tree>
<a-empty v-else :image="Empty.PRESENTED_IMAGE_SIMPLE" /> <a-empty v-else :image="Empty.PRESENTED_IMAGE_SIMPLE" />
</a-card> </a-card>
</a-col> </a-col>
@ -48,7 +47,7 @@
> >
<template #operator class="table-operator"> <template #operator class="table-operator">
<a-space> <a-space>
<a-button type="primary" @click="form.onOpen()"> <a-button type="primary" @click="form.onOpen(undefined, searchFormState.parentId)">
<template #icon><plus-outlined /></template> <template #icon><plus-outlined /></template>
新增 新增
</a-button> </a-button>

@ -67,11 +67,14 @@
const submitLoading = ref(false) const submitLoading = ref(false)
// //
const onOpen = (record) => { const onOpen = (record, orgId) => {
visible = true visible = true
formData.value = { formData.value = {
sortCode: 99 sortCode: 99
} }
if (orgId) {
formData.value.orgId = orgId
}
if (record) { if (record) {
formData.value = Object.assign({}, record) formData.value = Object.assign({}, record)
} }

@ -19,7 +19,7 @@
<a-row :gutter="24"> <a-row :gutter="24">
<a-col :span="8"> <a-col :span="8">
<a-form-item name="searchKey" label="名称关键词"> <a-form-item name="searchKey" label="名称关键词">
<a-input v-model:value="searchFormState.searchKey" placeholder="请输入职位名称关键词"></a-input> <a-input v-model:value="searchFormState.searchKey" placeholder="请输入职位名称关键词" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="8"> <a-col :span="8">
@ -48,7 +48,7 @@
> >
<template #operator class="table-operator"> <template #operator class="table-operator">
<a-space> <a-space>
<a-button type="primary" @click="form.onOpen()"> <a-button type="primary" @click="form.onOpen(undefined, searchFormState.orgId)">
<template #icon><plus-outlined /></template> <template #icon><plus-outlined /></template>
新增 新增
</a-button> </a-button>

@ -67,11 +67,19 @@
const submitLoading = ref(false) const submitLoading = ref(false)
// //
const onOpen = (record) => { const onOpen = (record, category, orgId) => {
visible = true visible = true
formData.value = { formData.value = {
sortCode: 99 sortCode: 99
} }
//
if (category) {
formData.value.category = category
}
if (orgId) {
formData.value.category = 'ORG'
formData.value.orgId = orgId
}
if (record) { if (record) {
formData.value = Object.assign({}, record) formData.value = Object.assign({}, record)
} }

@ -49,7 +49,7 @@
> >
<template #operator class="table-operator"> <template #operator class="table-operator">
<a-space> <a-space>
<a-button type="primary" @click="form.onOpen()"> <a-button type="primary" @click="form.onOpen(undefined, searchFormState.category, searchFormState.orgId)">
<template #icon><plus-outlined /></template> <template #icon><plus-outlined /></template>
新增角色 新增角色
</a-button> </a-button>

@ -349,33 +349,42 @@
let formData = ref({}) let formData = ref({})
// //
const onOpen = (record) => { const onOpen = (record, orgId) => {
visible = true visible = true
formData.value = { formData.value = {
gender: '男', gender: '男',
positionJson: [] positionJson: []
} }
if (orgId) {
formData.value.orgId = orgId
//
nextTick(() => {
selePositionData(orgId)
})
}
if (record) { if (record) {
convertFormData(record) convertFormData(record)
} }
// nextTick(() => {
userApi.userOrgTreeSelector().then((res) => { //
if (res !== null) { userApi.userOrgTreeSelector().then((res) => {
treeData.value = res if (res !== null) {
// 2 treeData.value = res
treeData.value.forEach((item) => { // 2
// 0 treeData.value.forEach((item) => {
if (item.parentId === '0') { // 0
treeDefaultExpandedKeys.value.push(item.id) if (item.parentId === '0') {
// ID treeDefaultExpandedKeys.value.push(item.id)
if (item.children) { // ID
item.children.forEach((items) => { if (item.children) {
treeDefaultExpandedKeys.value.push(items.id) item.children.forEach((items) => {
}) treeDefaultExpandedKeys.value.push(items.id)
})
}
} }
} })
}) }
} })
}) })
} }
// //

@ -60,7 +60,7 @@
> >
<template #operator class="table-operator"> <template #operator class="table-operator">
<a-space> <a-space>
<a-button type="primary" @click="form.onOpen()"> <a-button type="primary" @click="form.onOpen(undefined, searchFormState.orgId)">
<template #icon><plus-outlined /></template> <template #icon><plus-outlined /></template>
<span>{{ $t('common.addButton') }}{{ $t('model.user') }}</span> <span>{{ $t('common.addButton') }}{{ $t('model.user') }}</span>
</a-button> </a-button>

Loading…
Cancel
Save