280 lines
9.6 KiB
Vue
280 lines
9.6 KiB
Vue
<template>
|
|
<search @on-submit="onSubmit" @on-print="onPrint" @on-reset="onReset" @use-pagination="onPagination"
|
|
:is-modal="isModal" :loading="loading" :pagination="result" :rowSelectionType="selectionType"
|
|
@on-select-change="onSelectChange">
|
|
<template #control>
|
|
|
|
</template>
|
|
<template #bodyCell="{ column, record, index }">
|
|
|
|
</template>
|
|
<template #footer>
|
|
|
|
</template>
|
|
</search>
|
|
</template>
|
|
<script setup lang="ts">
|
|
import { reactive, inject, defineComponent, onMounted, ref, unref, provide, h } from "vue";
|
|
import { BindOption } from "@/data/custom/bindOption";
|
|
import { SelectOption } from "@/data/auto/selectOption";
|
|
import search from "@/components/basic/Search.vue";
|
|
import { DeleteOutlined, EditOutlined, FileAddOutlined, FileTextOutlined } from "@ant-design/icons-vue";
|
|
|
|
import { FamilyGroupResultData } from "@/data/auto/familyGroupResultData";
|
|
import { FamilyFolderFavoriteViewEntity } from "@/data/auto/familyFolderFavoriteViewEntity";
|
|
import { SearchFilter } from "@/data/auto/searchFilter"
|
|
|
|
import familyGroupService from "@/service/master/familyGroupService";
|
|
import { FamilyGroupManagerUserSearchCriteria } from "@/data/auto/familyGroupManagerUserSearchCriteria";
|
|
|
|
import { SearchCriteriaResultData } from "@/data/auto/searchCriteriaResultData";
|
|
import { PermissionContext, usePermissionContext } from "@/hooks/PermissionContext"
|
|
import { useRoute, useRouter } from "vue-router";
|
|
|
|
import { useBindOption } from "@/hooks/useBindOption";
|
|
import { SearchFilterOperatorPolicy } from "@/data/custom/searchFilterOperatorPolicy"
|
|
import { SearchFilterTypePolicy } from "@/data/custom/searchFilterTypePolicy"
|
|
import { notification } from "ant-design-vue";
|
|
import { GridColumnInfo } from "@/data/auto/gridColumnInfo"
|
|
import { useGridColumnInfo } from "@/hooks/gridColumnInfo"
|
|
import { title } from "process";
|
|
import { enquiryMethodKey, searchCriteriaManagerKey, masterOperationToEnquiryMethodKey, MasterOperationToEnquiryModelOption, layoutProviderMethodKey } from "@/injections";
|
|
import { useOrderedChildren } from "@/hooks/use-ordered-children";
|
|
import { SearchCriteriaContext } from "@/injections";
|
|
//page from-----------------------------------------------------------------------------------------------------------------------------------
|
|
//================inject================
|
|
//报表名称
|
|
const layoutProviderMethod = inject(layoutProviderMethodKey);
|
|
|
|
//当前是弹出的Modal,还是Page
|
|
const isModal = ref(inject("isModalShare", false) as boolean);
|
|
//初始化查询条件的值
|
|
const initBindOptions = ref(inject("initBindOptionsShare", []) as BindOption[]);
|
|
//记录单选还是多选
|
|
const selectionType = ref(inject("selectionTypeShare", 'checkbox') as string);
|
|
|
|
//================inject================
|
|
|
|
const loading = ref<boolean>(false);
|
|
const isEdit = ref<boolean>(false);
|
|
const canView = ref<boolean>(false);
|
|
const canAmend = ref<boolean>(false);
|
|
const canDelete = ref<boolean>(false);
|
|
const canCreate = ref<boolean>(false);
|
|
const route = useRoute();
|
|
const router = useRouter();
|
|
|
|
const columns = ref([
|
|
{
|
|
title: '序号',
|
|
dataIndex: 'index',
|
|
width: '30px',
|
|
align: 'center',
|
|
fixed: 'left',
|
|
sequence: 0,
|
|
hidden: 'N',
|
|
format: ''
|
|
},
|
|
{
|
|
title: "群组名称",
|
|
dataIndex: FamilyFolderFavoriteViewEntity.FAMILY_LOCAL_NAME,
|
|
sorter: true,
|
|
width: '65px',
|
|
sequence: 1,
|
|
hidden: 'N'
|
|
},
|
|
{
|
|
title: "顶级目录",
|
|
dataIndex: FamilyFolderFavoriteViewEntity.TOP_FOLDER_LOCAL_NAME,
|
|
sorter: false,
|
|
width: '80px',
|
|
sequence: 2,
|
|
hidden: 'N'
|
|
},
|
|
{
|
|
title: "目录",
|
|
dataIndex: FamilyFolderFavoriteViewEntity.FOLDER_LOCAL_NAME,
|
|
sorter: false,
|
|
width: '80px',
|
|
sequence: 3,
|
|
hidden: 'N'
|
|
},
|
|
{
|
|
title: "目录描述",
|
|
dataIndex: FamilyFolderFavoriteViewEntity.NOTICE,
|
|
sorter: false,
|
|
width: '80px',
|
|
sequence: 4,
|
|
hidden: 'N'
|
|
},
|
|
]);
|
|
|
|
const viewOption = {
|
|
Value: 'default',
|
|
SelectOptions: [{ BindValue: 'default', DisplayName: "默认" }],
|
|
Columns: [{ BindValue: 'default', BindColumn: columns }]
|
|
};
|
|
|
|
|
|
|
|
const bindOptions = ref<BindOption[]>([]);
|
|
const datas = ref<FamilyFolderFavoriteViewEntity[]>([]);
|
|
const pagingParams = ref<PagingParams>({ pageSize: 20, page: 1 });
|
|
const result = ref<SearchCriteriaResultData>(new SearchCriteriaResultData());
|
|
|
|
const data = ref<FamilyGroupResultData>(new FamilyGroupResultData());
|
|
const currentFilter = ref<SearchFilter[]>([]);
|
|
const isSearched = ref<boolean>(false);
|
|
const currentSearchCriteria = ref<FamilyGroupManagerUserSearchCriteria>(new FamilyGroupManagerUserSearchCriteria());
|
|
|
|
const keys = ref<FamilyFolderFavoriteViewEntity[]>([]);
|
|
|
|
const {
|
|
children: items,
|
|
addChild: addItem,
|
|
removeChild: removeItem,
|
|
} = useOrderedChildren<SearchCriteriaContext>();
|
|
|
|
//================provide================
|
|
provide(enquiryMethodKey, {
|
|
getLayoutSetting: () => { return { controlLeft: 16, controlRight: 8, space: true, soltLeft: 24, soltRight: 24 }; },
|
|
getBindOptions: () => { return unref(bindOptions); },
|
|
getViewOption: () => { return unref(viewOption); },
|
|
getDatas: () => { return datas; },
|
|
});
|
|
|
|
provide(
|
|
searchCriteriaManagerKey,
|
|
reactive({
|
|
items,
|
|
addItem,
|
|
removeItem,
|
|
})
|
|
);
|
|
//================provide================
|
|
|
|
defineExpose({
|
|
keys,
|
|
initBindOptions,
|
|
})
|
|
|
|
onMounted(() => {
|
|
let pContext: PermissionContext = usePermissionContext();
|
|
canView.value = pContext.canView(route.meta.permission as string);
|
|
canAmend.value = pContext.canAmend(route.meta.permission as string);
|
|
canDelete.value = pContext.canDelete(route.meta.permission as string);
|
|
canCreate.value = pContext.canCreate(route.meta.permission as string);
|
|
initBindOption();
|
|
onSubmit(items.value[0].getFilter());
|
|
})
|
|
|
|
const onSelectChange = ((selected: FamilyFolderFavoriteViewEntity[]) => {
|
|
keys.value = selected;
|
|
})
|
|
|
|
const onReset = (() => {
|
|
keys.value = [];
|
|
result.value.Total = 0;
|
|
})
|
|
|
|
|
|
const setBindOptionValue = ((bindValue: string, value: string, value1: string, values: string[], disabled: boolean) => {
|
|
let bindOption: BindOption = bindOptions.value.filter(x => x.BindValue == bindValue)[0];
|
|
if (!bindOption) return;
|
|
bindOption.Value = value;
|
|
bindOption.Value1 = value1;
|
|
bindOption.Values = values;
|
|
bindOption.disabled = disabled;
|
|
})
|
|
|
|
|
|
|
|
//初始化查询条件
|
|
const initBindOption = (async () => {
|
|
let ubo = useBindOption();
|
|
let bindOption: BindOption = ubo.getBindOption(FamilyFolderFavoriteViewEntity.DB_FAMILY_LOCAL_NAME, '群组名称', SearchFilterTypePolicy.TEXT, SearchFilterOperatorPolicy.CN_CONTAIN);
|
|
bindOptions.value.push(bindOption);
|
|
|
|
bindOption = ubo.getBindOption(FamilyFolderFavoriteViewEntity.DB_FOLDER_LOCAL_NAME, '目录名称', SearchFilterTypePolicy.TEXT, SearchFilterOperatorPolicy.CN_CONTAIN);
|
|
bindOption.lg = 10;
|
|
bindOptions.value.push(bindOption);
|
|
|
|
initBindOptions.value.forEach(element => {
|
|
setBindOptionValue(element.BindValue, element.Value, element.Value1, element.Values, element.disabled);
|
|
});
|
|
})
|
|
|
|
//table from-----------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
result.value.Page = pagingParams.value.page ?? 1;
|
|
result.value.Limit = pagingParams.value.pageSize;
|
|
|
|
const onSubmit = (async (filters: SearchFilter[]) => {
|
|
|
|
let c: FamilyGroupManagerUserSearchCriteria = new FamilyGroupManagerUserSearchCriteria();
|
|
currentFilter.value = filters;
|
|
isSearched.value = true;
|
|
c.Filter = filters;
|
|
c.limit = pagingParams.value.pageSize;
|
|
c.page = pagingParams.value.page ?? 1;
|
|
c.GridColumns = [];
|
|
currentSearchCriteria.value = c;
|
|
await findBySearchCriteria(c);
|
|
})
|
|
|
|
const onPrint = (async () => {
|
|
let c: FamilyGroupManagerUserSearchCriteria = new FamilyGroupManagerUserSearchCriteria();
|
|
if (currentFilter.value.length > 0)
|
|
c.Filter = currentFilter.value;
|
|
else c.Filter = [];
|
|
|
|
c.limit = pagingParams.value.pageSize;
|
|
c.page = pagingParams.value.page ?? 1;
|
|
c.GridColumns = useGridColumnInfo().getGridColumnInfo(unref(columns));
|
|
c.ReportName = layoutProviderMethod?.getLayoutProvider().layoutTitle!;
|
|
try {
|
|
let sss = await familyGroupService.FamilyFolderFavoriteBySearchCriteria(c);
|
|
} catch (error) {
|
|
console.log(error);
|
|
}
|
|
|
|
})
|
|
|
|
const findBySearchCriteria = (async (c: FamilyGroupManagerUserSearchCriteria) => {
|
|
try {
|
|
data.value = await familyGroupService.FamilyFolderFavoriteBySearchCriteria(c);
|
|
result.value.Total = data.value.Total;
|
|
result.value.Page = data.value.Page;
|
|
result.value.Limit = data.value.Limit;
|
|
datas.value = data.value.Favorites;
|
|
} catch (error) {
|
|
console.log(error);
|
|
}
|
|
})
|
|
|
|
const onPagination = (async (params: PagingParams) => {
|
|
|
|
if (!isSearched.value) return;
|
|
let c: FamilyGroupManagerUserSearchCriteria = new FamilyGroupManagerUserSearchCriteria();
|
|
|
|
if (currentFilter.value.length > 0)
|
|
c.Filter = currentFilter.value;
|
|
else c.Filter = [];
|
|
|
|
c.limit = params.pageSize;
|
|
c.page = params.page ?? 1;
|
|
if (params.sortField)
|
|
c.orderby = params.sortField!;
|
|
if (params.sortOrder)
|
|
c.orderbytag = params.sortOrder?.toString().substring(0, 4)!;
|
|
c.GridColumns = [];
|
|
currentSearchCriteria.value = c;
|
|
await findBySearchCriteria(c);
|
|
});
|
|
|
|
const onReload = (async () => {
|
|
await findBySearchCriteria(unref(currentSearchCriteria));
|
|
})
|
|
//table end-----------------------------------------------------------------------------------------------------------------------------------
|
|
</script>
|