ow
This commit is contained in:
1 parent
1404640f16
commit
2bbf016cbf
167 files changed
+18941
-589
No files matched your search
@@ -0,0 +1,390 @@
|
||||
<template>
|
||||
<search @on-submit="onSubmit" @on-print="onPrint" @on-reset="onReset" @use-pagination="onPagination"
|
||||
:loading="loading" :pagination="result" :rowSelectionType="selectionType" @on-row-dblclick="onRowDblclick"
|
||||
@on-select-change="onSelectChange">
|
||||
<template #bodyCell="{ column, record, index }">
|
||||
<template v-if="column.dataIndex === SecurityGeneratorNumberEntity.REFRESH_PERIOD">
|
||||
<template v-if="record.RefreshPeriod == 'Y'">
|
||||
<span>是</span>
|
||||
</template>
|
||||
<template v-else> <span>否</span></template>
|
||||
</template>
|
||||
</template>
|
||||
<template #footer>
|
||||
<div style="
|
||||
margin-left: 12;
|
||||
margin-right: 12px;
|
||||
padding-left: 8px;
|
||||
padding-right: 8px;
|
||||
position: fixed;
|
||||
bottom: 8px;
|
||||
">
|
||||
<a-row :gutter="24">
|
||||
<a-col :lg="24" :sm="24">
|
||||
<div v-if="!isModal">
|
||||
<a-row v-if="isEdit" :gutter="[16, 8]">
|
||||
<a-space>
|
||||
<a-button type="primary" @click.prevent="onCancel">取消</a-button>
|
||||
<a-button type="primary" @click.prevent="onSave">确定</a-button>
|
||||
</a-space>
|
||||
</a-row>
|
||||
<a-row v-else :gutter="[16, 8]">
|
||||
<a-space>
|
||||
<a-button type="primary" v-if="canAmend" :icon="h(EditOutlined)"
|
||||
:disabled="!(keys && keys.length > 0)" @click.prevent="onAmend">修改</a-button>
|
||||
<a-popconfirm title="确定是否删除这条记录?" ok-text="是" cancel-text="否" @confirm="onDelete">
|
||||
<a-button type="primary" danger :icon="h(DeleteOutlined)" v-if="canDelete"
|
||||
:disabled="!(keys && keys.length > 0)">删除</a-button>
|
||||
</a-popconfirm>
|
||||
</a-space>
|
||||
</a-row>
|
||||
</div>
|
||||
<a-row v-if="isModal" :gutter="[16, 8]">
|
||||
<a-space>
|
||||
<a-button type="primary" @click.prevent="onClose">关闭</a-button>
|
||||
<a-button type="primary" @click.prevent="onSelected">确定</a-button>
|
||||
</a-space>
|
||||
</a-row>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</div>
|
||||
</template>
|
||||
</search>
|
||||
<generatorNumber @on-submit="onReload" />
|
||||
</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,
|
||||
RightCircleFilled,
|
||||
} from "@ant-design/icons-vue";
|
||||
|
||||
import { SecurityGeneratorNumberEntity } from "@/data/auto/securityGeneratorNumberEntity";
|
||||
import { SecurityGeneratorNumberResultData } from "@/data/auto/securityGeneratorNumberResultData";
|
||||
import { SearchFilter } from "@/data/auto/searchFilter";
|
||||
import securityGeneratorNumberService from "@/service/security/securityGeneratorNumberService";
|
||||
import { useYesNoPolicy } from "@/hooks/useYesNoPolicy";
|
||||
import { SecurityGeneratorNumberSearchCriteria } from "@/data/auto/securityGeneratorNumberSearchCriteria";
|
||||
import { SearchCriteriaResultData } from "@/data/auto/searchCriteriaResultData";
|
||||
import { PermissionContext, usePermissionContext } from "@/hooks/PermissionContext";
|
||||
import { useRoute } from "vue-router";
|
||||
import { useBindOption } from "@/hooks/useBindOption";
|
||||
import { SearchFilterOperatorPolicy } from "@/data/custom/searchFilterOperatorPolicy";
|
||||
import { SearchFilterTypePolicy } from "@/data/custom/searchFilterTypePolicy";
|
||||
import generatorNumber from "./GeneratorNumberModal.vue";
|
||||
import { notification } from "ant-design-vue";
|
||||
import { GridColumnInfo } from "@/data/auto/gridColumnInfo";
|
||||
import { useGridColumnInfo } from "@/hooks/gridColumnInfo";
|
||||
import { title } from "process";
|
||||
import { enquiryMethodKey, searchCriteriaManagerKey, layoutProviderMethodKey } from "@/injections";
|
||||
import { useOrderedChildren } from "@/hooks/use-ordered-children";
|
||||
import { SearchCriteriaContext } from "@/injections";
|
||||
|
||||
|
||||
//page from-----------------------------------------------------------------------------------------------------------------------------------
|
||||
//================inject================
|
||||
const isModal = ref(inject("isModal", false) as boolean);
|
||||
const layoutProviderMethod = inject(layoutProviderMethodKey);
|
||||
//================inject================
|
||||
|
||||
const emit = defineEmits(['onRowDblclick']);
|
||||
|
||||
const isEdit = ref<boolean>(false);
|
||||
const canAmend = ref<boolean>(false);
|
||||
const canDelete = ref<boolean>(false);
|
||||
const canCreate = ref<boolean>(false);
|
||||
const route = useRoute();
|
||||
const loading = ref<boolean>(false);
|
||||
const selectionType: string = "checkbox";
|
||||
const keys = ref<SecurityGeneratorNumberEntity[]>([]);
|
||||
const generatorNumberModal = ref<boolean>(false);
|
||||
const entity = ref<SecurityGeneratorNumberEntity>(new SecurityGeneratorNumberEntity());
|
||||
const bindOptions = ref<BindOption[]>([]);
|
||||
const data = ref<SecurityGeneratorNumberResultData>(
|
||||
new SecurityGeneratorNumberResultData()
|
||||
);
|
||||
const datas = ref<SecurityGeneratorNumberEntity[]>([]);
|
||||
const pagingParams = ref<PagingParams>({ pageSize: 20, page: 1 });
|
||||
|
||||
const isSearched = ref<boolean>(false);
|
||||
const currentSearchCriteria = ref<SecurityGeneratorNumberSearchCriteria>(
|
||||
new SecurityGeneratorNumberSearchCriteria()
|
||||
);
|
||||
const result = ref<SearchCriteriaResultData>(new SearchCriteriaResultData());
|
||||
|
||||
const columns = ref([
|
||||
{
|
||||
title: "序号",
|
||||
dataIndex: "index",
|
||||
width: "5%",
|
||||
align: "center",
|
||||
fixed: "left",
|
||||
sequence: 0,
|
||||
hidden: "N",
|
||||
format: "",
|
||||
},
|
||||
{
|
||||
title: "项目编号",
|
||||
dataIndex: SecurityGeneratorNumberEntity.SYSTEM_ID,
|
||||
sorter: true,
|
||||
width: "20%",
|
||||
sequence: 1,
|
||||
hidden: "N",
|
||||
},
|
||||
{
|
||||
title: "子编号",
|
||||
dataIndex: SecurityGeneratorNumberEntity.SUBSYSTEM_ID,
|
||||
sorter: true,
|
||||
width: "20%",
|
||||
sequence: 2,
|
||||
hidden: "N",
|
||||
},
|
||||
{
|
||||
title: "前缀",
|
||||
dataIndex: SecurityGeneratorNumberEntity.PREFIX,
|
||||
sorter: true,
|
||||
width: "10%",
|
||||
sequence: 3,
|
||||
hidden: "N",
|
||||
},
|
||||
{
|
||||
title: "重新刷新",
|
||||
dataIndex: SecurityGeneratorNumberEntity.REFRESH_PERIOD,
|
||||
sorter: true,
|
||||
width: "10%",
|
||||
sequence: 4,
|
||||
hidden: "N",
|
||||
},
|
||||
{
|
||||
title: "格式",
|
||||
dataIndex: SecurityGeneratorNumberEntity.FORMAT,
|
||||
sorter: true,
|
||||
width: "20%",
|
||||
sequence: 5,
|
||||
hidden: "N",
|
||||
},
|
||||
{
|
||||
title: "编号",
|
||||
dataIndex: SecurityGeneratorNumberEntity.NEXT_ID,
|
||||
sorter: true,
|
||||
align: "left",
|
||||
width: "",
|
||||
sequence: 6,
|
||||
hidden: "N",
|
||||
},
|
||||
]);
|
||||
|
||||
const viewOption = {
|
||||
Value: "default",
|
||||
SelectOptions: [{ BindValue: "default", DisplayName: "默认" }],
|
||||
Columns: [{ BindValue: "default", BindColumn: columns }],
|
||||
};
|
||||
const initBindOption = async () => {
|
||||
let ubo = useBindOption();
|
||||
let bindOption: BindOption = ubo.getBindOption(
|
||||
SecurityGeneratorNumberEntity.DB_SYSTEM_ID,
|
||||
"项目编号",
|
||||
SearchFilterTypePolicy.TEXT,
|
||||
SearchFilterOperatorPolicy.CONTAIN
|
||||
);
|
||||
bindOptions.value.push(bindOption);
|
||||
bindOption = ubo.getBindOption(
|
||||
SecurityGeneratorNumberEntity.DB_SUBSYSTEM_ID,
|
||||
"子编号",
|
||||
SearchFilterTypePolicy.TEXT,
|
||||
SearchFilterOperatorPolicy.CONTAIN
|
||||
);
|
||||
bindOption.lg = 10;
|
||||
bindOptions.value.push(bindOption);
|
||||
bindOptions.value.push(
|
||||
ubo.getBindOption(
|
||||
SecurityGeneratorNumberEntity.DB_PREFIX,
|
||||
"前缀",
|
||||
SearchFilterTypePolicy.TEXT,
|
||||
SearchFilterOperatorPolicy.CONTAIN
|
||||
)
|
||||
);
|
||||
let rps: SelectOption[] = await useYesNoPolicy().getSelectOption(true);
|
||||
bindOption = ubo.getBindSelectOption(
|
||||
SecurityGeneratorNumberEntity.DB_REFRESH_PERIOD,
|
||||
"重新刷新",
|
||||
SearchFilterTypePolicy.SINGLE_SELECTION,
|
||||
SearchFilterOperatorPolicy.SINGLE,
|
||||
rps
|
||||
);
|
||||
bindOption.lg = 10;
|
||||
bindOptions.value.push(bindOption);
|
||||
};
|
||||
|
||||
const {
|
||||
children: items,
|
||||
addChild: addItem,
|
||||
removeChild: removeItem,
|
||||
} = useOrderedChildren<SearchCriteriaContext>();
|
||||
|
||||
//================provide================
|
||||
provide("generatorNumberModal", generatorNumberModal);
|
||||
provide("SecurityGeneratorNumberEntity", entity);
|
||||
provide("rowKey", SecurityGeneratorNumberEntity.GENERATOR_ID);
|
||||
|
||||
//控制按键多行显示,可以单列24或者多列
|
||||
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================
|
||||
|
||||
onMounted(() => {
|
||||
let pContext: PermissionContext = usePermissionContext();
|
||||
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();
|
||||
onSearch();
|
||||
});
|
||||
|
||||
const onSelectChange = (selected: SecurityGeneratorNumberEntity[]) => {
|
||||
keys.value = selected;
|
||||
};
|
||||
|
||||
const onRowDblclick = ((e: any, record: SecurityGeneratorNumberEntity) => {
|
||||
if (isModal.value) {
|
||||
emit('onRowDblclick', record);
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
const onReset = () => {
|
||||
keys.value = [];
|
||||
};
|
||||
|
||||
const onAmend = () => {
|
||||
generatorNumberModal.value = true;
|
||||
entity.value = keys.value[0];
|
||||
};
|
||||
|
||||
const onDelete = async () => {
|
||||
|
||||
for (let i = 0; i < keys.value.length; i++) {
|
||||
await securityGeneratorNumberService.Delete(keys.value[i].GeneratorId);
|
||||
}
|
||||
|
||||
notification.info({
|
||||
message: "系统提示:",
|
||||
description: "记录删除成功",
|
||||
placement: "topRight",
|
||||
});
|
||||
onReload();
|
||||
};
|
||||
|
||||
const onSave = () => {
|
||||
isEdit.value = false;
|
||||
};
|
||||
|
||||
const onCancel = () => {
|
||||
isEdit.value = false;
|
||||
};
|
||||
|
||||
const onSelected = () => { };
|
||||
|
||||
const onClose = () => { };
|
||||
|
||||
const onCreate = () => {
|
||||
entity.value = new SecurityGeneratorNumberEntity();
|
||||
generatorNumberModal.value = true;
|
||||
};
|
||||
|
||||
//SearchCriteria from-----------------------------------------------------------------------------------------------------------------------------------
|
||||
result.value.Page = pagingParams.value.page ?? 1;
|
||||
result.value.Limit = pagingParams.value.pageSize;
|
||||
|
||||
const onSubmit = async (filters: SearchFilter[]) => {
|
||||
let c: SecurityGeneratorNumberSearchCriteria = new SecurityGeneratorNumberSearchCriteria();
|
||||
|
||||
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 onSearch = (async () => {
|
||||
onSubmit(items.value[0].getFilter());
|
||||
})
|
||||
|
||||
|
||||
const onPrint = async () => {
|
||||
let c: SecurityGeneratorNumberSearchCriteria = new SecurityGeneratorNumberSearchCriteria();
|
||||
c.Filter = items.value[0].getFilter();
|
||||
|
||||
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 securityGeneratorNumberService.PrintBySearchCriteria(c);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
|
||||
const findBySearchCriteria = async (c: SecurityGeneratorNumberSearchCriteria) => {
|
||||
data.value = await securityGeneratorNumberService.FindBySearchCriteria(c);
|
||||
result.value.Total = data.value.Total;
|
||||
result.value.Page = data.value.Page;
|
||||
result.value.Limit = data.value.Limit;
|
||||
datas.value = data.value.Datas;
|
||||
};
|
||||
|
||||
const onPagination = async (params: PagingParams) => {
|
||||
if (!isSearched.value) return;
|
||||
|
||||
let c: SecurityGeneratorNumberSearchCriteria = new SecurityGeneratorNumberSearchCriteria();
|
||||
|
||||
c.Filter = items.value[0].getFilter();
|
||||
|
||||
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>
|
||||
Reference in new issue
Block a user