<template>
  <div class="page-box" style="position: relative;">
    <el-form
      ref="formTourImGroupRef"
      :size="layoutStore.defaultFormItemSize"
      label-width="120px"
      label-position="right"
      @submit.prevent
    >
      <filter-box :item-width="350" @search="refreshFormTourImGroup()" @reset="resetFormTourImGroup">
<!--        <el-form-item label="群聊所属类型">-->
<!--          <el-cascader-->
<!--            class="filter-item"-->
<!--            v-model="belongTypeIdFilterPath"-->
<!--            :options="belongTypeIdFilterWidgetDropdownList"-->
<!--            placeholder=""-->
<!--            :clearable="true"-->
<!--            :filterable="true"-->
<!--            :show-all-levels="false"-->
<!--            :props="{ value: 'id', label: 'name', children: 'children', checkStrictly: true }"-->
<!--            @change="onBelongTypeIdFilterValueChange"-->
<!--          />-->
<!--        </el-form-item>-->
        <el-form-item label="群主">
          <el-select
            class="filter-item"
            v-model="formFilter.leaderIdFilter"
            placeholder=""
            :clearable="true"
            :filterable="true"
            @visible-change="leaderIdFilterWidget.onVisibleChange"
          >
            <el-option
              v-for="item in leaderIdFilterWidgetDropdownList"
              :key="item.userId"
              :label="item.showName"
              :value="item.userId"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="群聊名称">
          <el-input
            class="filter-item"
            v-model="formFilter.groupNameFilter"
            type="text"
            placeholder=""
            :clearable="true"
            :show-word-limit="false"
            maxlength=""
          />
        </el-form-item>
<!--        <el-form-item label="群聊描述">-->
<!--          <el-input-->
<!--            class="filter-item"-->
<!--            v-model="formFilter.descriptionFilter"-->
<!--            type="text"-->
<!--            placeholder=""-->
<!--            :clearable="true"-->
<!--            :show-word-limit="false"-->
<!--            maxlength=""-->
<!--          />-->
<!--        </el-form-item>-->
<!--        <el-form-item label="单聊群聊">-->
<!--          <el-select-->
<!--            class="filter-item"-->
<!--            v-model="formFilter.noticeTypeFilter"-->
<!--            placeholder=""-->
<!--            :clearable="true"-->
<!--            :filterable="true"-->
<!--            @visible-change="noticeTypeFilterWidget.onVisibleChange"-->
<!--          >-->
<!--            <el-option-->
<!--              v-for="item in noticeTypeFilterWidgetDropdownList"-->
<!--              :key="item.id"-->
<!--              :label="item.name"-->
<!--              :value="item.id"-->
<!--            />-->
<!--          </el-select>-->
<!--        </el-form-item>-->
<!--        <el-form-item label="是否公开展示">-->
<!--          <el-select-->
<!--            class="filter-item"-->
<!--            v-model="formFilter.isPublicFilter"-->
<!--            placeholder=""-->
<!--            :clearable="true"-->
<!--            :filterable="true"-->
<!--            @visible-change="isPublicFilterWidget.onVisibleChange"-->
<!--          >-->
<!--            <el-option-->
<!--              v-for="item in isPublicFilterWidgetDropdownList"-->
<!--              :key="item.id"-->
<!--              :label="item.name"-->
<!--              :value="item.id"-->
<!--            />-->
<!--          </el-select>-->
<!--        </el-form-item>-->
<!--        <el-form-item label="是否开启群聊邀请">-->
<!--          <el-select-->
<!--            class="filter-item"-->
<!--            v-model="formFilter.isNeedConfirmFilter"-->
<!--            placeholder=""-->
<!--            :clearable="true"-->
<!--            :filterable="true"-->
<!--            @visible-change="isNeedConfirmFilterWidget.onVisibleChange"-->
<!--          >-->
<!--            <el-option-->
<!--              v-for="item in isNeedConfirmFilterWidgetDropdownList"-->
<!--              :key="item.id"-->
<!--              :label="item.name"-->
<!--              :value="item.id"-->
<!--            />-->
<!--          </el-select>-->
<!--        </el-form-item>-->
        <el-form-item label="是否封禁 ">
          <el-select
            class="filter-item"
            v-model="formFilter.bannedStatusFilter"
            placeholder=""
            :clearable="true"
            :filterable="true"
            @visible-change="bannedStatusFilterWidget.onVisibleChange"
          >
            <el-option
              v-for="item in bannedStatusFilterWidgetDropdownList"
              :key="item.id"
              :label="item.name"
              :value="item.id"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="热度值">
          <input-number-range
            class="filter-item"
            v-model="formFilter.hotValueFilter"
            startPlaceholder=""
            endPlaceholder=""
            :step="1"
          />
        </el-form-item>
      </filter-box>
    </el-form>
    <table-box
      ref="formTourImGroupTable"
      class="page-table"
      :data="formTourImGroupTableWidgetDataList"
      :size="layoutStore.defaultFormItemSize"
      :row-config="{isCurrent: false, isHover: true}"
      :seq-config="{startIndex: ((formTourImGroupTableWidgetCurrentPage - 1) * formTourImGroupTableWidgetPageSize)}"
      :sort-config="{remote: true}"
      :hasExtend="true"
      @sort-change="formTourImGroupTableWidget.onSortChange"
      @refresh="formTourImGroupTableWidget.refreshTable()"
    >
      <template #operator>
<!--        <el-button-->
<!--          type="primary"-->
<!--          :size="layoutStore.defaultFormItemSize"-->
<!--          @click="onAddTourImGroupClick()"-->
<!--          >-->
<!--          新建-->
<!--        </el-button>-->
        <el-button
          type="primary"
          :size="layoutStore.defaultFormItemSize"
          @click="onExportTourImGroupClick()"
          >
          导出
        </el-button>
        <el-upload
          class="btn-import"
          :auto-upload="false"
          action=""
          :show-file-list="false"
          accept=".xls,.xlsx"
          style="display: inline-block;"
          :on-change="onImportTourImGroupClick"
        >
          <template #trigger>
            <el-button
              type="primary"
              :size="layoutStore.defaultFormItemSize"
            >
              导入
            </el-button>
          </template>
        </el-upload>
      </template>
      <vxe-column title="序号" type="seq" :index="formTourImGroupTableWidget.getTableIndex" :width="80" />
      <vxe-column title="群聊类型" field="belongTypeIdDictMap.name" />
<!--      <vxe-column title="单聊群聊" field="belongTypeIdDictMap.name" />-->
      <vxe-column title="群主" field="leaderIdDictMap.name" />
      <vxe-column title="群聊名称" field="groupName" />
      <vxe-column title="群聊头像">
        <template v-slot="scope">
          <upload-file-list
            :file-list="
              parseUploadData(scope.row.groupAvatar, {
                id: scope.row.id,
                fieldName: 'groupAvatar',
                asImage: true
              })
            "
            type="card"
            direction="horizontal"
            :readonly="true"
          />
        </template>
      </vxe-column>
      <vxe-column title="群聊描述" field="description" />
<!--      <vxe-column title="是否公开展示" field="isPublicDictMap.name" />-->
<!--      <vxe-column title="是否开启群聊邀请确认" field="isNeedConfirmDictMap.name" />-->
<!--      <vxe-column title="通知分类 " field="noticeTypeDictMap.name" />-->
      <vxe-column title="是否封禁 " field="bannedStatusDictMap.name" />
      <vxe-column title="热度值" field="hotValue" />
<!--      <vxe-column title="创建人id" field="createUserId" />-->
      <vxe-column title="创建时间" field="createTime">
        <template v-slot="scope">
          <span>{{formatDateByStatsType(scope.row.createTime, 'day')}}</span>
        </template>
      </vxe-column>
      <vxe-column title="操作" fixed="right">
        <template v-slot="scope">
<!--          <el-button-->
<!--            link-->
<!--            type="primary"-->
<!--            :size="layoutStore.defaultFormItemSize"-->
<!--            @click.stop="onListTourImGroupInvitationClick(scope.row)"-->
<!--          >-->
<!--            聊天去聊邀请-->
<!--          </el-button>-->
          <el-button
            link
            type="primary"
            :size="layoutStore.defaultFormItemSize"
            @click.stop="onListTourImMemberClick(scope.row)"
          >
            聊天群聊成员
          </el-button>
<!--          <el-button-->
<!--            link-->
<!--            type="primary"-->
<!--            :size="layoutStore.defaultFormItemSize"-->
<!--            @click.stop="onListTourImMessageClick(scope.row)"-->
<!--          >-->
<!--            聊天群聊消息-->
<!--          </el-button>-->
          <el-button
            link
            type="primary"
            :size="layoutStore.defaultFormItemSize"
            @click.stop="onEditTourImGroupClick(scope.row)"
          >
            编辑
          </el-button>
<!--          <el-button-->
<!--            link-->
<!--            type="primary"-->
<!--            :size="layoutStore.defaultFormItemSize"-->
<!--            @click.stop="onDeleteTourImGroupClick(scope.row)"-->
<!--          >-->
<!--            删除-->
<!--          </el-button>-->
        </template>
      </vxe-column>
      <template slot="empty">
        <div class="table-empty unified-font">
          <img src="@/assets/img/empty.png">
          <span>暂无数据</span>
        </div>
      </template>
      <!-- 分页 -->
      <template #pagination>
        <el-row type="flex" justify="end" style="margin-top: 10px;">
          <el-pagination
            :total="formTourImGroupTableWidgetTotalCount"
            :current-page="formTourImGroupTableWidgetCurrentPage"
            :page-size="formTourImGroupTableWidgetPageSize"
            :page-sizes="[10, 20, 50, 100]"
            layout="total, prev, pager, next, sizes"
            @current-change="formTourImGroupTableWidget.onCurrentPageChange"
            @size-change="formTourImGroupTableWidget.onPageSizeChange">
          </el-pagination>
        </el-row>
      </template>
    </table-box>
    <label v-if="subPage" class="page-close-box" @click="onCancel()">
      <img src="@/assets/img/back2.png" alt="">
    </label>
  </div>
</template>

<script lang="ts">
export default {
  name: 'formTourImGroup',
};
</script>

<script setup lang="ts">
import { VxeColumn, VxeTable } from 'vxe-table';
import { ANY_OBJECT } from '@/types/generic';
import { DictData, DictionaryBase } from '@/common/staticDict/types';
import { ElMessage, ElMessageBox, UploadFile } from 'element-plus';
import { useRoute, useRouter } from 'vue-router';
import { useCommon } from '@/common/hooks/useCommon';
import { useLayoutStore, useStaticDictStore } from '@/store';
import { useDownload } from '@/common/hooks/useDownload';
import { useDropdown } from '@/common/hooks/useDropdown';
import { DropdownOptions, ListData } from '@/common/types/list';
import { useTable } from '@/common/hooks/useTable';
import { TableOptions } from '@/common/types/pagination';
import { useUpload } from '@/common/hooks/useUpload';
import { useUploadWidget } from '@/common/hooks/useUploadWidget';
import { DictionaryController } from '@/api/system';
import { treeDataTranslate, findItemFromList, findTreeNodePath, findTreeNode, stringCase } from '@/common/utils';
import { TourImMemberData } from '@/api/generated/tourImMemberController';
import { TourImGroupInvitationData } from '@/api/generated/tourImGroupInvitationController';
import { TourImMessageData } from '@/api/generated/tourImMessageController';
import { TourImGroupData } from '@/api/generated/tourImGroupController';
import {
  TourImMemberController,
  TourImGroupInvitationController,
  TourImMessageController,
  TourImGroupController,
  TourUserController
} from '@/api/generated';
import FormTourImGroupInvitation from '@/pages/ImGroup/formTourImGroupInvitation.vue';
import FormEditTourImGroup from '@/pages/ImGroup/formEditTourImGroup.vue';
import FormTourImMessage from '@/pages/ImGroup/formTourImMessage.vue';
import FormTourImMember from '@/pages/ImGroup/formTourImMember.vue';
import TourUser from "@/types/table/tourUser";

const router = useRouter();
const route = useRoute();
const layoutStore = useLayoutStore();
const { downloadFile } = useDownload();
const { getUploadHeaders, getUploadActionUrl, fileListToJson, parseUploadData, getPictureList } = useUpload();
const {
  Delete,
  Search,
  Edit,
  Plus,
  Refresh,
  Picture,
  Dialog,
  mainContextHeight,
  clientHeight,
  checkPermCodeExist,
  parseParams,
  parseArrayParams,
  formatDateByStatsType,
  getDateRangeFilter,
} = useCommon();
// 静态字典
const { staticDict: StaticDict } = useStaticDictStore();

const props = withDefaults(
  defineProps<{
    subPage?: number | string | boolean;
    groupId?: ANY_OBJECT;
  }>(),
  {
    subPage: 0,
    groupId: undefined,
  },
);

const formFilter = reactive({
  // 群聊所属类型
  belongTypeIdFilter: undefined,
  // 群主
  leaderIdFilter: undefined,
  // 群聊名称
  groupNameFilter: undefined,
  // 群聊描述
  descriptionFilter: undefined,
  // 通知分类
  noticeTypeFilter: undefined,
  // 是否公开展示
  isPublicFilter: undefined,
  // 是否开启群聊邀请
  isNeedConfirmFilter: undefined,
  // 是否封禁
  bannedStatusFilter: undefined,
  // 热度值
  hotValueFilter: [],
});
const formFilterCopy = reactive({
  // 群聊所属类型
  belongTypeIdFilter: undefined,
  // 群主
  leaderIdFilter: undefined,
  // 群聊名称
  groupNameFilter: undefined,
  // 群聊描述
  descriptionFilter: undefined,
  // 通知分类
  noticeTypeFilter: undefined,
  // 是否公开展示
  isPublicFilter: undefined,
  // 是否开启群聊邀请
  isNeedConfirmFilter: undefined,
  // 是否封禁
  bannedStatusFilter: undefined,
  // 热度值
  hotValueFilter: [],
});

const onCancel = () => {
  router.go(-1);
  layoutStore.removeCachePage(route.fullPath as string);
  route.meta.refreshParentCachedPage = true;
};

const onResume = () => {
  refreshFormTourImGroup();
};

/**
 * 表格组件数据获取函数，返回Promise
 */
const loadFormTourImGroupTableWidgetData = (params: ANY_OBJECT) => {
  if (params == null) params = {};
  params = {
    ...params,
    tourImGroupDtoFilter: {
      leaderId: formFilter.leaderIdFilter,
      noticeType: formFilter.noticeTypeFilter,
      groupName: formFilter.groupNameFilter,
      description: formFilter.descriptionFilter,
      isPublic: formFilter.isPublicFilter,
      isNeedConfirm: formFilter.isNeedConfirmFilter,
      bannedStatus: formFilter.bannedStatusFilter,
      hotValueStart: Array.isArray(formFilter.hotValueFilter) ? formFilter.hotValueFilter[0] : formFilter.hotValueFilter,
      hotValueEnd: Array.isArray(formFilter.hotValueFilter) ? formFilter.hotValueFilter[1] : formFilter.hotValueFilter,
    }
  };
  return new Promise((resolve, reject) => {
    TourImGroupController.list(params).then(res => {
      resolve({
        dataList: res.data.dataList,
        totalCount: res.data.totalCount
      });
    }).catch(e => {
      reject(e);
    });
  });
};
/**
 * 表格组件数据获取检测函数，返回true正常获取数据，返回false停止获取数据
 */
const loadFormTourImGroupTableVerify = () => {
  formFilterCopy.belongTypeIdFilter = formFilter.belongTypeIdFilter;
  formFilterCopy.leaderIdFilter = formFilter.leaderIdFilter;
  formFilterCopy.groupNameFilter = formFilter.groupNameFilter;
  formFilterCopy.descriptionFilter = formFilter.descriptionFilter;
  formFilterCopy.noticeTypeFilter = formFilter.noticeTypeFilter;
  formFilterCopy.isPublicFilter = formFilter.isPublicFilter;
  formFilterCopy.isNeedConfirmFilter = formFilter.isNeedConfirmFilter;
  formFilterCopy.bannedStatusFilter = formFilter.bannedStatusFilter;
  formFilterCopy.hotValueFilter = formFilter.hotValueFilter;
  return true;
};
/**
 * 新建
 */
const onAddTourImGroupClick = (row?: TourImGroupData) => {
  let params: ANY_OBJECT = {
  };

  Dialog
    .show('新建', FormEditTourImGroup, { area: '900px' }, { ...params, subPage: true })
    .then(res => {
      formTourImGroupTableWidget.refreshTable();
    }).catch(e => {
      // TODO: 异常处理
      console.error(e);
    });
};
/**
 * 聊天去聊邀请
 */
const onListTourImGroupInvitationClick = (row?: TourImGroupData) => {
  let params: ANY_OBJECT = {
    groupId: row?.id,
  };

  router.push({
    name: 'formTourImGroupInvitation',
    query: { ...params, subPage: true }
  });
};
/**
 * 聊天群聊成员
 */
const onListTourImMemberClick = (row?: TourImGroupData) => {
  let params: ANY_OBJECT = {
    groupId: row?.id,
  };

  router.push({
    name: 'formTourImMember',
    query: { ...params, subPage: true }
  });
};
/**
 * 聊天群聊消息
 */
const onListTourImMessageClick = (row?: TourImGroupData) => {
  let params: ANY_OBJECT = {
    groupId: row?.id,
  };

  router.push({
    name: 'formTourImMessage',
    query: { ...params, subPage: true }
  });
};
/**
 * 编辑
 */
const onEditTourImGroupClick = (row?: TourImGroupData) => {
  let params: ANY_OBJECT = {
    id: row?.id,
  };

  Dialog
    .show('编辑', FormEditTourImGroup, { area: '900px' }, { ...params, subPage: true })
    .then(res => {
      formTourImGroupTableWidget.refreshTable();
    }).catch(e => {
      // TODO: 异常处理
      console.error(e);
    });
};
/**
 * 导出
 */
const onExportTourImGroupClick = (row?: TourImGroupData) => {
  let params: ANY_OBJECT = {
  };

  TourImGroupController.export(params, '表格组件.xlsx').then(res => {
    ElMessage.success('导出成功');
  }).catch(e => {
    ElMessage.error(e.errorMessage);
  });
};
/**
 * 导入
 */
const onImportTourImGroupClick = (file) => {
  let params: ANY_OBJECT = {
    importFile: file.raw,
    // 是否忽略表头
    skipHeader: false
  };

  TourImGroupController.import(params).then(res => {
    ElMessage.success('导入成功');
    formTourImGroupTableWidget.refreshTable();
  }).catch(e => {
    // TODO: 异常处理
    console.error(e);
  });
};
/**
 * 删除
 */
const onDeleteTourImGroupClick = (row?: TourImGroupData) => {
  let params: ANY_OBJECT = {
    id: row?.id,
  };

  ElMessageBox.confirm('是否删除此记录？').then(res => {
    TourImGroupController.delete(params).then(res => {
      ElMessage.success('删除成功');
      formTourImGroupTableWidget.refreshTable(false, 1);
    }).catch(e => {
      // TODO: 异常处理
      console.error(e);
    });
  }).catch(e => {
    // TODO: 异常处理
    console.error(e);
  });
};
// 表格组件表格组件参数
const formTourImGroupTableOptions: TableOptions<TourImGroupData> = {
  loadTableData: loadFormTourImGroupTableWidgetData,
  verifyTableParameter: loadFormTourImGroupTableVerify,
  paged: true,
  rowSelection: false,
  orderFieldName: undefined,
  ascending: true,
};
// 表格组件表格组件
const formTourImGroupTable = ref();
const formTourImGroupTableWidget = useTable(formTourImGroupTableOptions);
const {
  dataList: formTourImGroupTableWidgetDataList,
  currentPage: formTourImGroupTableWidgetCurrentPage,
  pageSize: formTourImGroupTableWidgetPageSize,
  totalCount: formTourImGroupTableWidgetTotalCount,
} = formTourImGroupTableWidget;
/**
 * 群聊所属类型下拉数据获取函数
 */
const loadBelongTypeIdFilterDropdownList = (): Promise<ListData<DictData>> => {
  return new Promise((resolve, reject) => {
    const params = {
    };
    DictionaryController.dictTourImGroupType(params).then(res => {
      resolve({
        dataList: res.getList(),
      });
    }).catch(e => {
      reject(e);
    });
  });
};
/**
 * 群聊所属类型选中值改变
 */
const onBelongTypeIdFilterValueChange = (value) => {
  formFilter.belongTypeIdFilter = Array.isArray(value) ? value[value.length - 1] : value;
};
// 群聊所属类型配置参数
const belongTypeIdFilterOptions: DropdownOptions<DictData> = {
  loadData: loadBelongTypeIdFilterDropdownList,
  isTree: true,
};
// 群聊所属类型选中数据
const belongTypeIdFilterPath = ref<Array<string | number>>([]);
// 群聊所属类型下拉组件
const belongTypeIdFilterWidget = useDropdown(belongTypeIdFilterOptions);
const { dropdownList: belongTypeIdFilterWidgetDropdownList } = belongTypeIdFilterWidget
/**
 * 群主下拉数据获取函数
 */
const loadLeaderIdFilterDropdownList = (): Promise<ListData<TourUser>> => {
  return new Promise((resolve, reject) => {
    const params = {
    };
    TourUserController.list(params).then(res => {
      resolve({
        dataList: res.data.dataList,
      });
    }).catch(e => {
      reject(e);
    });
  });
};
// 群主配置参数
const leaderIdFilterOptions: DropdownOptions<TourUser> = {
  loadData: loadLeaderIdFilterDropdownList,
  isTree: false,
};
// 群主下拉组件
const leaderIdFilterWidget = useDropdown(leaderIdFilterOptions);
const { dropdownList: leaderIdFilterWidgetDropdownList } = leaderIdFilterWidget
/**
 * 通知分类下拉数据获取函数
 */
const loadNoticeTypeFilterDropdownList = (): Promise<ListData<DictData>> => {
  return new Promise((resolve, reject) => {
    DictionaryController.dictGlobalDict({ dictCode: 'TourImSingleOrGroup', itemIdType: 'Integer' }).then(res => {
      resolve({
        dataList: res.getList(),
      });
    }).catch(e => {
      reject(e);
    });
  });
};
// 通知分类配置参数
const noticeTypeFilterOptions: DropdownOptions<DictData> = {
  loadData: loadNoticeTypeFilterDropdownList,
  isTree: false,
};
// 通知分类下拉组件
const noticeTypeFilterWidget = useDropdown(noticeTypeFilterOptions);
const { dropdownList: noticeTypeFilterWidgetDropdownList } = noticeTypeFilterWidget
/**
 * 是否公开展示下拉数据获取函数
 */
const loadIsPublicFilterDropdownList = (): Promise<ListData<DictData>> => {
  return Promise.resolve({
    dataList: StaticDict.IsTrue.getList(),
  });
};
// 是否公开展示配置参数
const isPublicFilterOptions: DropdownOptions<DictData> = {
  loadData: loadIsPublicFilterDropdownList,
  isTree: false,
};
// 是否公开展示下拉组件
const isPublicFilterWidget = useDropdown(isPublicFilterOptions);
const { dropdownList: isPublicFilterWidgetDropdownList } = isPublicFilterWidget
/**
 * 是否开启群聊邀请下拉数据获取函数
 */
const loadIsNeedConfirmFilterDropdownList = (): Promise<ListData<DictData>> => {
  return Promise.resolve({
    dataList: StaticDict.IsTrue.getList(),
  });
};
// 是否开启群聊邀请配置参数
const isNeedConfirmFilterOptions: DropdownOptions<DictData> = {
  loadData: loadIsNeedConfirmFilterDropdownList,
  isTree: false,
};
// 是否开启群聊邀请下拉组件
const isNeedConfirmFilterWidget = useDropdown(isNeedConfirmFilterOptions);
const { dropdownList: isNeedConfirmFilterWidgetDropdownList } = isNeedConfirmFilterWidget
/**
 * 是否封禁 下拉数据获取函数
 */
const loadBannedStatusFilterDropdownList = (): Promise<ListData<DictData>> => {
  return Promise.resolve({
    dataList: StaticDict.IsTrue.getList(),
  });
};
// 是否封禁 配置参数
const bannedStatusFilterOptions: DropdownOptions<DictData> = {
  loadData: loadBannedStatusFilterDropdownList,
  isTree: false,
};
// 是否封禁 下拉组件
const bannedStatusFilterWidget = useDropdown(bannedStatusFilterOptions);
const { dropdownList: bannedStatusFilterWidgetDropdownList } = bannedStatusFilterWidget
const refreshFormTourImGroup = () => {
  // 刷新段落
  formTourImGroupTableWidget.refreshTable();
};
/**
 * 重置过滤值
 */
const resetFormTourImGroup = () => {
  formFilter.belongTypeIdFilter = undefined;
  formFilterCopy.belongTypeIdFilter = undefined;
  belongTypeIdFilterPath.value = [];
  formFilter.leaderIdFilter = undefined;
  formFilterCopy.leaderIdFilter = undefined;
  formFilter.groupNameFilter = undefined;
  formFilterCopy.groupNameFilter = undefined;
  formFilter.descriptionFilter = undefined;
  formFilterCopy.descriptionFilter = undefined;
  formFilter.noticeTypeFilter = undefined;
  formFilterCopy.noticeTypeFilter = undefined;
  formFilter.isPublicFilter = undefined;
  formFilterCopy.isPublicFilter = undefined;
  formFilter.isNeedConfirmFilter = undefined;
  formFilterCopy.isNeedConfirmFilter = undefined;
  formFilter.bannedStatusFilter = undefined;
  formFilterCopy.bannedStatusFilter = undefined;
  formFilter.hotValueFilter = undefined;
  formFilterCopy.hotValueFilter = undefined;
  refreshFormTourImGroup();
};
/**
 * 重置所有过滤值
 */
const resetFilter = () => {
  resetFormTourImGroup();
};
const formInit = () => {
  belongTypeIdFilterWidget.onVisibleChange(true).then(res => {
    // TODO: 获取级联选中路径
    belongTypeIdFilterPath.value = findTreeNodePath(res, formFilter.belongTypeIdFilter);
  }).catch(e => {
    // TODO: 异常处理
    console.error(e);
  });
  leaderIdFilterWidget.onVisibleChange(true).catch(e => {console.error(e)});
  noticeTypeFilterWidget.onVisibleChange(true).catch(e => {console.error(e)});
  isPublicFilterWidget.onVisibleChange(true).catch(e => {console.error(e)});
  isNeedConfirmFilterWidget.onVisibleChange(true).catch(e => {console.error(e)});
  bannedStatusFilterWidget.onVisibleChange(true).catch(e => {console.error(e)});
  refreshFormTourImGroup();
};

onMounted(() => {
  formInit();
});

onActivated(() => {
  onResume();
});
</script>
