优化菜单、省市区树结构排序,修复部门搜索空指针问题

This commit is contained in:
孟帅
2023-07-03 11:23:40 +08:00
parent 4a06a895b3
commit cc3ab9acec
18 changed files with 438 additions and 426 deletions

View File

@@ -115,7 +115,6 @@
h(
NButton,
{
ghost: true,
strong: true,
size: 'small',
text: true,
@@ -182,7 +181,6 @@
h(
NButton,
{
ghost: true,
strong: true,
size: 'small',
text: true,

View File

@@ -106,7 +106,6 @@
h(
NButton,
{
ghost: true,
strong: true,
size: 'small',
text: true,

View File

@@ -105,9 +105,7 @@ export const columns = [
h(
NButton,
{
ghost: true,
strong: true,
tertiary: true,
size: 'small',
text: true,
iconPlacement: 'right',

View File

@@ -192,7 +192,7 @@
id: number;
children?: RowData[];
};
const data = ref([]);
const data = ref<any>([]);
const columns: DataTableColumns<RowData> = [
{
title(_column) {
@@ -200,9 +200,7 @@
h(
NButton,
{
ghost: true,
strong: true,
tertiary: true,
size: 'small',
text: true,
iconPlacement: 'right',
@@ -283,7 +281,7 @@
title: '操作',
key: 'actions',
width: 220,
// fixed: 'right',
fixed: 'right',
render(record: any) {
return h(TableAction as any, {
style: 'button',
@@ -384,7 +382,7 @@
const loadDataTable = async (res) => {
loading.value = true;
const tmp = await getDeptList({ ...res, ...formRef.value?.formModel });
data.value = tmp.list;
data.value = tmp?.list;
if (data.value === undefined || data.value === null) {
data.value = [];
}

View File

@@ -375,7 +375,7 @@
</template>
<script lang="ts" setup>
import { onMounted, reactive, ref, unref } from 'vue';
import { FormItemRule, TreeSelectOption, useDialog, useMessage } from 'naive-ui';
import { FormItemRule, useDialog, useMessage } from 'naive-ui';
import {
AlignLeftOutlined,
FormOutlined,
@@ -406,19 +406,6 @@
return s;
});
const switchStatusMap = [
{
value: 2,
label: '关闭',
},
{
value: 1,
label: '开启',
},
].map((s) => {
return s;
});
const statusMap = [
{
value: 0,
@@ -472,8 +459,6 @@
const createDrawerRef = ref();
const message = useMessage();
const dialog = useDialog();
let treeItemKey = ref([]);
let expandedKeys = ref([]);
const treeData = ref([]);
const loading = ref(true);
const subLoading = ref(false);
@@ -482,9 +467,11 @@
const pattern = ref('');
const drawerTitle = ref('');
const optionTreeData = ref<any>([]);
const formParams = reactive<State>(newState(null));
let treeItemKey = ref([]);
let expandedKeys = ref([]);
function openCreateDrawer() {
drawerTitle.value = '添加菜单';
const { openDrawer } = createDrawerRef.value;
@@ -562,10 +549,7 @@
}
// 处理选项更新
function handleUpdateValue(
value: string | number | Array<string | number> | null,
_option: TreeSelectOption | null | Array<TreeSelectOption | null>
) {
function handleUpdateValue(value) {
formParams.pid = value as number;
}

View File

@@ -13,7 +13,6 @@ export const columns = [
h(
NButton,
{
ghost: true,
strong: true,
size: 'small',
text: true,