重新dept模块

This commit is contained in:
admin 2023-03-19 21:44:13 +08:00
parent 15ac1d9d8b
commit 1846ba150e
2 changed files with 13 additions and 21 deletions

View File

@ -33,7 +33,7 @@
style="width: 100%" style="width: 100%"
> >
<el-option <el-option
v-for="item in props.userOption" v-for="item in userList"
:key="item.id" :key="item.id"
:label="item.nickname" :label="item.nickname"
:value="item.id" :value="item.id"
@ -88,6 +88,7 @@ const formLoading = ref(false) // 表单的加载中1修改时的数据加
const formType = ref('') // create - update - const formType = ref('') // create - update -
const formRef = ref() // Ref const formRef = ref() // Ref
const deptOptions = ref() // const deptOptions = ref() //
const userList = ref() //
const formData = ref({ const formData = ref({
id: undefined, id: undefined,
@ -100,12 +101,6 @@ const formData = ref({
email: undefined, email: undefined,
status: undefined status: undefined
}) })
const props = defineProps({
userOption: {
type: Array,
default: () => [] as UserVO[]
}
})
const formRules = reactive({ const formRules = reactive({
parentId: [{ required: true, message: '上级部门不能为空', trigger: 'blur' }], parentId: [{ required: true, message: '上级部门不能为空', trigger: 'blur' }],
@ -118,12 +113,12 @@ const formRules = reactive({
}) })
/** 打开弹窗 */ /** 打开弹窗 */
const openModal = async (type: string, id?: number) => { const openModal = async (type: string, id?: number, userOption?: UserVO[]) => {
userList.value = userOption
modelVisible.value = true modelVisible.value = true
modelTitle.value = t('action.' + type) modelTitle.value = t('action.' + type)
formType.value = type formType.value = type
resetForm() resetForm()
console.log(id)
// //
if (id) { if (id) {
formLoading.value = true formLoading.value = true

View File

@ -85,7 +85,7 @@
</ContentWrap> </ContentWrap>
<!-- 添加或修改部门对话框 --> <!-- 添加或修改部门对话框 -->
<dept-form ref="modalRef" @success="getList" :userOption="userOption" /> <dept-form ref="modalRef" @success="getList" />
</template> </template>
<script setup lang="ts" name="Dept"> <script setup lang="ts" name="Dept">
import { handleTree } from '@/utils/tree' import { handleTree } from '@/utils/tree'
@ -105,17 +105,14 @@ const queryParams = reactive({
pageSize: 100 pageSize: 100
}) })
// const queryFormRef = ref() //
const queryFormRef = ref() const deptDatas = ref() //
//
const deptDatas = ref()
const userOption = ref<UserVO[]>([]) const userOption = ref<UserVO[]>([])
//
const isExpandAll = ref(true) const isExpandAll = ref(true) //
// const refreshTable = ref(true) //
const refreshTable = ref(true) const loading = ref(true) //
//
const loading = ref(true)
// //
const getUserList = async () => { const getUserList = async () => {
const res = await getListSimpleUsersApi() const res = await getListSimpleUsersApi()
@ -172,7 +169,7 @@ const resetQuery = () => {
/** 添加/修改操作 */ /** 添加/修改操作 */
const modalRef = ref() const modalRef = ref()
const openModal = (type: string, id?: number) => { const openModal = (type: string, id?: number) => {
modalRef.value.openModal(type, id) modalRef.value.openModal(type, id, userOption.value)
} }
const userNicknameFormat = (row) => { const userNicknameFormat = (row) => {