|
@@ -7,6 +7,13 @@
|
|
|
@click-left="handleBack"
|
|
@click-left="handleBack"
|
|
|
/>
|
|
/>
|
|
|
|
|
|
|
|
|
|
+ <!-- 搜索组件 -->
|
|
|
|
|
+ <SearchForm
|
|
|
|
|
+ :search-params="queryParams"
|
|
|
|
|
+ @search="handleQuery"
|
|
|
|
|
+ @reset="handleReset"
|
|
|
|
|
+ />
|
|
|
|
|
+
|
|
|
<!-- 面包屑导航 -->
|
|
<!-- 面包屑导航 -->
|
|
|
<Breadcrumb ref="breadcrumbRef" v-model="currentParentId" />
|
|
<Breadcrumb ref="breadcrumbRef" v-model="currentParentId" />
|
|
|
|
|
|
|
@@ -55,24 +62,27 @@
|
|
|
</view>
|
|
</view>
|
|
|
|
|
|
|
|
<!-- 新增按钮 -->
|
|
<!-- 新增按钮 -->
|
|
|
- <view
|
|
|
|
|
- class="fixed bottom-100rpx right-32rpx z-10 h-100rpx w-100rpx flex items-center justify-center rounded-full bg-[#1890ff] shadow-lg"
|
|
|
|
|
|
|
+ <wd-fab
|
|
|
|
|
+ position="right-bottom"
|
|
|
|
|
+ type="primary"
|
|
|
|
|
+ :expandable="false"
|
|
|
@click="handleAdd"
|
|
@click="handleAdd"
|
|
|
- >
|
|
|
|
|
- <wd-icon name="add" size="24px" color="#fff" />
|
|
|
|
|
- </view>
|
|
|
|
|
|
|
+ />
|
|
|
</view>
|
|
</view>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
|
|
|
+import type { SearchFormData } from './components/search-form.vue'
|
|
|
import type { Dept } from '@/api/system/dept'
|
|
import type { Dept } from '@/api/system/dept'
|
|
|
import type { User } from '@/api/system/user'
|
|
import type { User } from '@/api/system/user'
|
|
|
-import { computed, onMounted, ref } from 'vue'
|
|
|
|
|
|
|
+import { computed, onMounted, reactive, ref } from 'vue'
|
|
|
import { getDeptList } from '@/api/system/dept'
|
|
import { getDeptList } from '@/api/system/dept'
|
|
|
import { getSimpleUserList } from '@/api/system/user'
|
|
import { getSimpleUserList } from '@/api/system/user'
|
|
|
|
|
+import { navigateBackPlus } from '@/utils'
|
|
|
import { DICT_TYPE } from '@/utils/constants'
|
|
import { DICT_TYPE } from '@/utils/constants'
|
|
|
import { findChildren, handleTree } from '@/utils/tree'
|
|
import { findChildren, handleTree } from '@/utils/tree'
|
|
|
import Breadcrumb from './components/breadcrumb.vue'
|
|
import Breadcrumb from './components/breadcrumb.vue'
|
|
|
|
|
+import SearchForm from './components/search-form.vue'
|
|
|
|
|
|
|
|
definePage({
|
|
definePage({
|
|
|
style: {
|
|
style: {
|
|
@@ -94,10 +104,15 @@ const currentList = computed(() => {
|
|
|
}) // 当前层级的部门列表
|
|
}) // 当前层级的部门列表
|
|
|
const breadcrumbRef = ref<InstanceType<typeof Breadcrumb>>()
|
|
const breadcrumbRef = ref<InstanceType<typeof Breadcrumb>>()
|
|
|
|
|
|
|
|
|
|
+const queryParams = reactive<SearchFormData>({
|
|
|
|
|
+ name: undefined,
|
|
|
|
|
+ status: undefined,
|
|
|
|
|
+})
|
|
|
|
|
+
|
|
|
/** 返回上一页或上一层级 */
|
|
/** 返回上一页或上一层级 */
|
|
|
function handleBack() {
|
|
function handleBack() {
|
|
|
if (!breadcrumbRef.value?.back()) {
|
|
if (!breadcrumbRef.value?.back()) {
|
|
|
- uni.navigateBack()
|
|
|
|
|
|
|
+ navigateBackPlus()
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -119,13 +134,28 @@ function handleEnterChildren(item: Dept) {
|
|
|
async function getList() {
|
|
async function getList() {
|
|
|
loading.value = true
|
|
loading.value = true
|
|
|
try {
|
|
try {
|
|
|
- const data = await getDeptList()
|
|
|
|
|
|
|
+ const data = await getDeptList(queryParams)
|
|
|
list.value = handleTree(data)
|
|
list.value = handleTree(data)
|
|
|
} finally {
|
|
} finally {
|
|
|
loading.value = false
|
|
loading.value = false
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+/** 搜索按钮操作 */
|
|
|
|
|
+function handleQuery(data?: SearchFormData) {
|
|
|
|
|
+ queryParams.name = data?.name
|
|
|
|
|
+ queryParams.status = data?.status
|
|
|
|
|
+ // 重置面包屑
|
|
|
|
|
+ currentParentId.value = 0
|
|
|
|
|
+ breadcrumbRef.value?.reset()
|
|
|
|
|
+ getList()
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/** 重置按钮操作 */
|
|
|
|
|
+function handleReset() {
|
|
|
|
|
+ handleQuery()
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
/** 新增部门 */
|
|
/** 新增部门 */
|
|
|
function handleAdd() {
|
|
function handleAdd() {
|
|
|
uni.navigateTo({
|
|
uni.navigateTo({
|