Skip to content

Commit 1846ba1

Browse files
author
admin
committed
重新dept模块
1 parent 15ac1d9 commit 1846ba1

File tree

2 files changed

+13
-21
lines changed

2 files changed

+13
-21
lines changed

src/views/system/dept/form.vue

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
style="width: 100%"
3434
>
3535
<el-option
36-
v-for="item in props.userOption"
36+
v-for="item in userList"
3737
:key="item.id"
3838
:label="item.nickname"
3939
:value="item.id"
@@ -88,6 +88,7 @@ const formLoading = ref(false) // 表单的加载中:1)修改时的数据加
8888
const formType = ref('') // 表单的类型:create - 新增;update - 修改
8989
const formRef = ref() // 表单 Ref
9090
const deptOptions = ref() // 树形结构
91+
const userList = ref() // 负责人列表选项结构
9192
9293
const formData = ref({
9394
id: undefined,
@@ -100,12 +101,6 @@ const formData = ref({
100101
email: undefined,
101102
status: undefined
102103
})
103-
const props = defineProps({
104-
userOption: {
105-
type: Array,
106-
default: () => [] as UserVO[]
107-
}
108-
})
109104
110105
const formRules = reactive({
111106
parentId: [{ required: true, message: '上级部门不能为空', trigger: 'blur' }],
@@ -118,12 +113,12 @@ const formRules = reactive({
118113
})
119114
120115
/** 打开弹窗 */
121-
const openModal = async (type: string, id?: number) => {
116+
const openModal = async (type: string, id?: number, userOption?: UserVO[]) => {
117+
userList.value = userOption
122118
modelVisible.value = true
123119
modelTitle.value = t('action.' + type)
124120
formType.value = type
125121
resetForm()
126-
console.log(id)
127122
// 修改时,设置数据
128123
if (id) {
129124
formLoading.value = true

src/views/system/dept/index.vue

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
</ContentWrap>
8686

8787
<!-- 添加或修改部门对话框 -->
88-
<dept-form ref="modalRef" @success="getList" :userOption="userOption" />
88+
<dept-form ref="modalRef" @success="getList" />
8989
</template>
9090
<script setup lang="ts" name="Dept">
9191
import { handleTree } from '@/utils/tree'
@@ -105,17 +105,14 @@ const queryParams = reactive({
105105
pageSize: 100
106106
})
107107
108-
// 搜索的表单
109-
const queryFormRef = ref()
110-
// 数据变量
111-
const deptDatas = ref()
108+
const queryFormRef = ref() // 搜索的表单
109+
const deptDatas = ref() // 数据变量
112110
const userOption = ref<UserVO[]>([])
113-
// 是否展开,默认全部展开
114-
const isExpandAll = ref(true)
115-
// 重新渲染表格状态
116-
const refreshTable = ref(true)
117-
// 列表的加载中
118-
const loading = ref(true)
111+
112+
const isExpandAll = ref(true) // 是否展开,默认全部展开
113+
const refreshTable = ref(true) // 重新渲染表格状态
114+
const loading = ref(true) // 列表的加载中
115+
119116
//获取用户列表
120117
const getUserList = async () => {
121118
const res = await getListSimpleUsersApi()
@@ -172,7 +169,7 @@ const resetQuery = () => {
172169
/** 添加/修改操作 */
173170
const modalRef = ref()
174171
const openModal = (type: string, id?: number) => {
175-
modalRef.value.openModal(type, id)
172+
modalRef.value.openModal(type, id, userOption.value)
176173
}
177174
178175
const userNicknameFormat = (row) => {

0 commit comments

Comments
 (0)