Ben Lin
2025-02-24 8736042f4116942b2253d6eb4e782645125c40e2
src/views/tigerprojects/system/menu/index.vue
@@ -15,14 +15,15 @@
            @expanded-rows-change="onExpandedRChg"
          >
            <template #toolbar>
              <a-button type="primary" @click="handleCreate"> 新增菜单 </a-button>
              <a-button type="primary" @click="handleCreate('BS')"> 新增菜单 </a-button>
            </template>
            <template #action="{ record }">
              <TableAction
                :actions="[
                  {
                    icon: 'clarity:note-edit-line',
                    onClick: handleEdit.bind(null, record),
                    onClick: handleEdit.bind(null, record, 'BS'),
                    name: '',
                  },
                  {
                    icon: 'ant-design:delete-outlined',
@@ -32,6 +33,7 @@
                      placement: 'left',
                      confirm: handleDelete.bind(null, record),
                    },
                    name: '',
                  },
                ]"
              />
@@ -47,14 +49,15 @@
            @expanded-rows-change="onExpandedRChg"
          >
            <template #toolbar>
              <a-button type="primary" @click="handleCreate"> 新增菜单 </a-button>
              <a-button type="primary" @click="handleCreate('PDA')"> 新增菜单 </a-button>
            </template>
            <template #action="{ record }">
              <TableAction
                :actions="[
                  {
                    icon: 'clarity:note-edit-line',
                    onClick: handleEdit.bind(null, record),
                    onClick: handleEdit.bind(null, record, 'PDA'),
                    name: '',
                  },
                  {
                    icon: 'ant-design:delete-outlined',
@@ -64,6 +67,7 @@
                      placement: 'left',
                      confirm: handleDelete.bind(null, record),
                    },
                    name: '',
                  },
                ]"
              />
@@ -94,16 +98,16 @@
    // const [registerTable, { reload, expandRows }] = useTable({
    title: '菜单列表',
    api: getMenuList,
    searchInfo: { menuName: 'BS 菜单' },
    searchInfo: { menuName: 'BS' },
    columns,
    // formConfig: {
    //   labelWidth: 120,
    //   schemas: searchFormSchema,
    // },
    formConfig: {
      labelWidth: 120,
      schemas: searchFormSchema,
    },
    isTreeTable: true,
    // pagination: false,
    // striped: false,
    // // useSearchForm: true,
    useSearchForm: true,
    showTableSetting: true,
    // bordered: true,
    // showIndexColumn: false,
@@ -118,20 +122,23 @@
    rowKey: 'id',
  });
  const [registerTableSecond, { reloadSecond, expandAllSecond, expandRowsSecond }] = useTable({
  const [
    registerTableSecond,
    { reload: reloadSecond, expandAll: expandAllSecond, expandRows: expandRowsSecond },
  ] = useTable({
    // const [registerTable, { reload, expandRows }] = useTable({
    title: '菜单列表',
    api: getMenuList,
    searchInfo: { menuName: 'PDA' },
    columns,
    // formConfig: {
    //   labelWidth: 120,
    //   schemas: searchFormSchema,
    // },
    formConfig: {
      labelWidth: 120,
      schemas: searchFormSchema,
    },
    isTreeTable: true,
    // pagination: false,
    // striped: false,
    // // useSearchForm: true,
    useSearchForm: true,
    showTableSetting: true,
    // bordered: true,
    // showIndexColumn: false,
@@ -146,16 +153,18 @@
    rowKey: 'id',
  });
  function handleCreate() {
  function handleCreate(menuName: string) {
    openDrawer(true, {
      isUpdate: false,
      menuName: menuName,
    });
  }
  function handleEdit(record: Recordable) {
  function handleEdit(record: Recordable, menuName: string) {
    openDrawer(true, {
      record,
      isUpdate: true,
      menuName: menuName,
    });
  }
@@ -165,20 +174,25 @@
    const apiAction = DeleteMenu(record);
    apiAction.then((onfulfilled) => {
      if (onfulfilled.IsSuccessed) {
        reload();
          reloadSecond();
          reload();
      }
    });
  }
  function handleSuccess({ values }) {
    reload();
  function handleSuccess(d) {
    if (d.menuName == 'PDA') {
      reloadSecond();
    } else {
      reload();
    }
    nextTick(() => {
      setTimeout(() => {
        var tdList = document.querySelectorAll(
          '.ant-table-cell.ant-table-cell-ellipsis.ant-table-cell-with-append',
        );
        for (var i = 0; i < tdList.length; i++) {
          if (tdList[i].attributes['title'].nodeValue == values.menuName) {
          if (tdList[i].attributes['title'].nodeValue == d.values.menuName) {
            tdList[i].scrollIntoView();
          }
        }