Compare commits

...

2 Commits

Author SHA1 Message Date
fyy
1695f017b0 Merge branch 'master' of http://47.109.37.87:3000/by2025/admin-vben5
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2025-07-25 12:01:21 +08:00
fyy
d96d906392 feat: 新建采购申请、个人中心菜单 2025-07-25 12:00:49 +08:00
18 changed files with 2221 additions and 0 deletions

View File

@ -0,0 +1,79 @@
import type {
ProcurementApplicationVO,
ProcurementApplicationForm,
ProcurementApplicationQuery,
} from './model';
import type { ID, IDS } from '#/api/common';
import type { PageResult } from '#/api/common';
import { commonExport } from '#/api/helper';
import { requestClient } from '#/api/request';
/**
*
* @param params
* @returns
*/
export function procurementApplicationList(
params?: ProcurementApplicationQuery,
) {
return requestClient.get<PageResult<ProcurementApplicationVO>>(
'/domain/procurementApplication/list',
{ params },
);
}
/**
*
* @param params
* @returns
*/
export function procurementApplicationExport(
params?: ProcurementApplicationQuery,
) {
return commonExport('/domain/procurementApplication/export', params ?? {});
}
/**
*
* @param id id
* @returns
*/
export function procurementApplicationInfo(id: ID) {
return requestClient.get<ProcurementApplicationVO>(
`/domain/procurementApplication/${id}`,
);
}
/**
*
* @param data
* @returns void
*/
export function procurementApplicationAdd(data: ProcurementApplicationForm) {
return requestClient.postWithMsg<void>(
'/domain/procurementApplication',
data,
);
}
/**
*
* @param data
* @returns void
*/
export function procurementApplicationUpdate(data: ProcurementApplicationForm) {
return requestClient.putWithMsg<void>('/domain/procurementApplication', data);
}
/**
*
* @param id id
* @returns void
*/
export function procurementApplicationRemove(id: ID | IDS) {
return requestClient.deleteWithMsg<void>(
`/domain/procurementApplication/${id}`,
);
}

View File

@ -0,0 +1,197 @@
import type { PageQuery, BaseEntity } from '#/api/common';
export interface ProcurementApplicationVO {
/**
*
*/
id: string | number;
/**
*
*/
title: string;
/**
* id
*/
applicat: number;
/**
*
*/
phone: string;
/**
* id
*/
supplier: number;
/**
* id
*/
capitalId: string | number;
/**
*
*/
buyType: string;
/**
*
*/
buyUnitPrice: number;
/**
*
*/
buyAmount: number;
/**
*
*/
state: string;
/**
*
*/
remark: string;
/**
*
*/
applicationTime: string;
/**
*
*/
searchValue: string;
}
export interface ProcurementApplicationForm extends BaseEntity {
/**
*
*/
id?: string | number;
/**
*
*/
title?: string;
/**
* id
*/
applicat?: number;
/**
*
*/
phone?: string;
/**
* id
*/
supplier?: number;
/**
* id
*/
capitalId?: string | number;
/**
*
*/
buyType?: string;
/**
*
*/
buyUnitPrice?: number;
/**
*
*/
buyAmount?: number;
/**
*
*/
state?: string;
/**
*
*/
remark?: string;
/**
*
*/
applicationTime?: string;
/**
*
*/
searchValue?: string;
}
export interface ProcurementApplicationQuery extends PageQuery {
/**
*
*/
title?: string;
/**
* id
*/
applicat?: number;
/**
*
*/
phone?: string;
/**
* id
*/
supplier?: number;
/**
* id
*/
capitalId?: string | number;
/**
*
*/
buyType?: string;
/**
*
*/
buyUnitPrice?: number;
/**
*
*/
buyAmount?: number;
/**
*
*/
state?: string;
/**
*
*/
applicationTime?: string;
/**
*
*/
searchValue?: string;
/**
*
*/
params?: any;
}

View File

@ -0,0 +1,61 @@
import type { LeaveApplicationVO, LeaveApplicationForm, LeaveApplicationQuery } from './model';
import type { ID, IDS } from '#/api/common';
import type { PageResult } from '#/api/common';
import { commonExport } from '#/api/helper';
import { requestClient } from '#/api/request';
/**
*
* @param params
* @returns
*/
export function leaveApplicationList(params?: LeaveApplicationQuery) {
return requestClient.get<PageResult<LeaveApplicationVO>>('/property/leaveApplication/list', { params });
}
/**
*
* @param params
* @returns
*/
export function leaveApplicationExport(params?: LeaveApplicationQuery) {
return commonExport('/property/leaveApplication/export', params ?? {});
}
/**
*
* @param id id
* @returns
*/
export function leaveApplicationInfo(id: ID) {
return requestClient.get<LeaveApplicationVO>(`/property/leaveApplication/${id}`);
}
/**
*
* @param data
* @returns void
*/
export function leaveApplicationAdd(data: LeaveApplicationForm) {
return requestClient.postWithMsg<void>('/property/leaveApplication', data);
}
/**
*
* @param data
* @returns void
*/
export function leaveApplicationUpdate(data: LeaveApplicationForm) {
return requestClient.putWithMsg<void>('/property/leaveApplication', data);
}
/**
*
* @param id id
* @returns void
*/
export function leaveApplicationRemove(id: ID | IDS) {
return requestClient.deleteWithMsg<void>(`/property/leaveApplication/${id}`);
}

View File

@ -0,0 +1,189 @@
import type { PageQuery, BaseEntity } from '#/api/common';
export interface LeaveApplicationVO {
/**
*
*/
id: string | number;
/**
* ID
*/
userId: string | number;
/**
*
*/
username: string;
/**
* ID
*/
departmentId: string | number;
/**
*
*/
departmentName: string;
/**
*
*/
leaveType: number;
/**
*
*/
startTime: string;
/**
*
*/
endTime: string;
/**
* 35
*/
totalDuration: string;
/**
*
*/
reason: string;
/**
* 1'草稿',2'待审批',3'已批准',4'已拒绝':5'已取消'
*/
status: number;
/**
*
*/
searchValue: string;
}
export interface LeaveApplicationForm extends BaseEntity {
/**
*
*/
id?: string | number;
/**
* ID
*/
userId?: string | number;
/**
*
*/
username?: string;
/**
* ID
*/
departmentId?: string | number;
/**
*
*/
departmentName?: string;
/**
*
*/
leaveType?: number;
/**
*
*/
startTime?: string;
/**
*
*/
endTime?: string;
/**
* 35
*/
totalDuration?: string;
/**
*
*/
reason?: string;
/**
* 1'草稿',2'待审批',3'已批准',4'已拒绝':5'已取消'
*/
status?: number;
/**
*
*/
searchValue?: string;
}
export interface LeaveApplicationQuery extends PageQuery {
/**
* ID
*/
userId?: string | number;
/**
*
*/
username?: string;
/**
* ID
*/
departmentId?: string | number;
/**
*
*/
departmentName?: string;
/**
*
*/
leaveType?: number;
/**
*
*/
startTime?: string;
/**
*
*/
endTime?: string;
/**
* 35
*/
totalDuration?: string;
/**
*
*/
reason?: string;
/**
* 1'草稿',2'待审批',3'已批准',4'已拒绝':5'已取消'
*/
status?: number;
/**
*
*/
searchValue?: string;
/**
*
*/
params?: any;
}

View File

@ -0,0 +1,61 @@
import type { WorkflowDefinitionVO, WorkflowDefinitionForm, WorkflowDefinitionQuery } from './model';
import type { ID, IDS } from '#/api/common';
import type { PageResult } from '#/api/common';
import { commonExport } from '#/api/helper';
import { requestClient } from '#/api/request';
/**
*
* @param params
* @returns
*/
export function workflowDefinitionList(params?: WorkflowDefinitionQuery) {
return requestClient.get<PageResult<WorkflowDefinitionVO>>('/property/workflowDefinition/list', { params });
}
/**
*
* @param params
* @returns
*/
export function workflowDefinitionExport(params?: WorkflowDefinitionQuery) {
return commonExport('/property/workflowDefinition/export', params ?? {});
}
/**
*
* @param id id
* @returns
*/
export function workflowDefinitionInfo(id: ID) {
return requestClient.get<WorkflowDefinitionVO>(`/property/workflowDefinition/${id}`);
}
/**
*
* @param data
* @returns void
*/
export function workflowDefinitionAdd(data: WorkflowDefinitionForm) {
return requestClient.postWithMsg<void>('/property/workflowDefinition', data);
}
/**
*
* @param data
* @returns void
*/
export function workflowDefinitionUpdate(data: WorkflowDefinitionForm) {
return requestClient.putWithMsg<void>('/property/workflowDefinition', data);
}
/**
*
* @param id id
* @returns void
*/
export function workflowDefinitionRemove(id: ID | IDS) {
return requestClient.deleteWithMsg<void>(`/property/workflowDefinition/${id}`);
}

View File

@ -0,0 +1,129 @@
import type { PageQuery, BaseEntity } from '#/api/common';
export interface WorkflowDefinitionVO {
/**
* id
*/
id: string | number;
/**
*
*/
code: string;
/**
*
*/
name: string;
/**
* (0123)
*/
status: number;
/**
*
*/
currentApprover: string;
/**
*
*/
workflowSuggestion: string;
/**
*
*/
endTime: string;
/**
*
*/
searchValue: string;
}
export interface WorkflowDefinitionForm extends BaseEntity {
/**
* id
*/
id?: string | number;
/**
*
*/
code?: string;
/**
*
*/
name?: string;
/**
* (0123)
*/
status?: number;
/**
*
*/
currentApprover?: string;
/**
*
*/
workflowSuggestion?: string;
/**
*
*/
endTime?: string;
/**
*
*/
searchValue?: string;
}
export interface WorkflowDefinitionQuery extends PageQuery {
/**
*
*/
code?: string;
/**
*
*/
name?: string;
/**
* (0123)
*/
status?: number;
/**
*
*/
currentApprover?: string;
/**
*
*/
workflowSuggestion?: string;
/**
*
*/
endTime?: string;
/**
*
*/
searchValue?: string;
/**
*
*/
params?: any;
}

View File

@ -0,0 +1,232 @@
import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table';
import { getDictOptions } from '#/utils/dict';
import { renderDict } from '#/utils/render';
export const querySchema: FormSchemaGetter = () => [
{
component: 'Input',
fieldName: 'title',
label: '标题',
},
{
component: 'Input',
fieldName: 'applicat',
label: '申请人id',
},
{
component: 'Input',
fieldName: 'phone',
label: '申请人手机号',
},
{
component: 'Input',
fieldName: 'supplier',
label: '供应商id',
},
{
component: 'Input',
fieldName: 'capitalId',
label: '资产id',
},
{
component: 'Select',
componentProps: {},
fieldName: 'buyType',
label: '采购方式',
},
{
component: 'Input',
fieldName: 'buyUnitPrice',
label: '采购单价',
},
{
component: 'Input',
fieldName: 'buyAmount',
label: '采购金额',
},
{
component: 'Select',
componentProps: {
// 可选从DictEnum中获取 DictEnum.WY_ZCSQSHZT 便于维护
options: getDictOptions('wy_zcsqshzt'),
},
fieldName: 'state',
label: '状态',
},
{
component: 'DatePicker',
componentProps: {
showTime: true,
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
fieldName: 'applicationTime',
label: '申请时间',
},
{
component: 'Input',
fieldName: 'searchValue',
label: '搜索值',
},
];
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
// export const columns: () => VxeGridProps['columns'] = () => [
export const columns: VxeGridProps['columns'] = [
{ type: 'checkbox', width: 60 },
{
title: '',
field: 'id',
},
{
title: '标题',
field: 'title',
},
{
title: '申请人id',
field: 'applicat',
},
{
title: '申请人手机号',
field: 'phone',
},
{
title: '供应商id',
field: 'supplier',
},
{
title: '资产id',
field: 'capitalId',
},
{
title: '采购方式',
field: 'buyType',
},
{
title: '采购单价',
field: 'buyUnitPrice',
},
{
title: '采购金额',
field: 'buyAmount',
},
{
title: '状态',
field: 'state',
slots: {
default: ({ row }) => {
// 可选从DictEnum中获取 DictEnum.WY_ZCSQSHZT 便于维护
return renderDict(row.state, 'wy_zcsqshzt');
},
},
},
{
title: '备注',
field: 'remark',
},
{
title: '申请时间',
field: 'applicationTime',
},
{
title: '搜索值',
field: 'searchValue',
},
{
field: 'action',
fixed: 'right',
slots: { default: 'action' },
title: '操作',
width: 180,
},
];
export const modalSchema: FormSchemaGetter = () => [
{
label: '',
fieldName: 'id',
component: 'Input',
dependencies: {
show: () => false,
triggerFields: [''],
},
},
{
label: '标题',
fieldName: 'title',
component: 'Input',
rules: 'required',
},
{
label: '申请人id',
fieldName: 'applicat',
component: 'Input',
rules: 'required',
},
{
label: '申请人手机号',
fieldName: 'phone',
component: 'Input',
rules: 'required',
},
{
label: '供应商id',
fieldName: 'supplier',
component: 'Input',
rules: 'required',
},
{
label: '资产id',
fieldName: 'capitalId',
component: 'Input',
rules: 'required',
},
{
label: '采购方式',
fieldName: 'buyType',
component: 'Select',
componentProps: {},
rules: 'selectRequired',
},
{
label: '采购单价',
fieldName: 'buyUnitPrice',
component: 'Input',
},
{
label: '采购金额',
fieldName: 'buyAmount',
component: 'Input',
},
{
label: '状态',
fieldName: 'state',
component: 'Select',
componentProps: {
// 可选从DictEnum中获取 DictEnum.WY_ZCSQSHZT 便于维护
options: getDictOptions('wy_zcsqshzt'),
},
},
{
label: '备注',
fieldName: 'remark',
component: 'Input',
},
{
label: '申请时间',
fieldName: 'applicationTime',
component: 'DatePicker',
componentProps: {
showTime: true,
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
},
{
label: '搜索值',
fieldName: 'searchValue',
component: 'Input',
},
];

View File

@ -0,0 +1,188 @@
<script setup lang="ts">
import type { Recordable } from '@vben/types';
import { ref } from 'vue';
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
import { getVxePopupContainer } from '@vben/utils';
import { Modal, Popconfirm, Space } from 'ant-design-vue';
import dayjs from 'dayjs';
import {
useVbenVxeGrid,
vxeCheckboxChecked,
type VxeGridProps,
} from '#/adapter/vxe-table';
import {
procurementApplicationExport,
procurementApplicationList,
procurementApplicationRemove,
} from '#/api/property/assetManage/procurementApplication';
import type { ProcurementApplicationForm } from '#/api/property/assetManage/procurementApplication/model';
import { commonDownloadExcel } from '#/utils/file/download';
import procurementApplicationModal from './procurementApplication-modal.vue';
import { columns, querySchema } from './data';
const formOptions: VbenFormProps = {
commonConfig: {
labelWidth: 80,
componentProps: {
allowClear: true,
},
},
schema: querySchema(),
wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4',
// RangePicker /
//
// fieldMappingTime: [
// [
// 'createTime',
// ['params[beginTime]', 'params[endTime]'],
// ['YYYY-MM-DD 00:00:00', 'YYYY-MM-DD 23:59:59'],
// ],
// ],
};
const gridOptions: VxeGridProps = {
checkboxConfig: {
//
highlight: true,
//
reserve: true,
//
// trigger: 'row',
},
// 使i18ngetter
// columns: columns(),
columns,
height: 'auto',
keepSource: true,
pagerConfig: {},
proxyConfig: {
ajax: {
query: async ({ page }, formValues = {}) => {
return await procurementApplicationList({
pageNum: page.currentPage,
pageSize: page.pageSize,
...formValues,
});
},
},
},
rowConfig: {
keyField: 'id',
},
//
id: 'domain-procurementApplication-index',
};
const [BasicTable, tableApi] = useVbenVxeGrid({
formOptions,
gridOptions,
});
const [ProcurementApplicationModal, modalApi] = useVbenModal({
connectedComponent: procurementApplicationModal,
});
function handleAdd() {
modalApi.setData({});
modalApi.open();
}
async function handleEdit(row: Required<ProcurementApplicationForm>) {
modalApi.setData({ id: row.id });
modalApi.open();
}
async function handleDelete(row: Required<ProcurementApplicationForm>) {
await procurementApplicationRemove(row.id);
await tableApi.query();
}
function handleMultiDelete() {
const rows = tableApi.grid.getCheckboxRecords();
const ids = rows.map((row: Required<ProcurementApplicationForm>) => row.id);
Modal.confirm({
title: '提示',
okType: 'danger',
content: `确认删除选中的${ids.length}条记录吗?`,
onOk: async () => {
await procurementApplicationRemove(ids);
await tableApi.query();
},
});
}
function handleDownloadExcel() {
commonDownloadExcel(
procurementApplicationExport,
'资产申请数据',
tableApi.formApi.form.values,
{
fieldMappingTime: formOptions.fieldMappingTime,
},
);
}
</script>
<template>
<Page :auto-content-height="true">
<BasicTable table-title="资产申请列表">
<template #toolbar-tools>
<Space>
<a-button
v-access:code="['domain:procurementApplication:export']"
@click="handleDownloadExcel"
>
{{ $t('pages.common.export') }}
</a-button>
<a-button
:disabled="!vxeCheckboxChecked(tableApi)"
danger
type="primary"
v-access:code="['domain:procurementApplication:remove']"
@click="handleMultiDelete"
>
{{ $t('pages.common.delete') }}
</a-button>
<a-button
type="primary"
v-access:code="['domain:procurementApplication:add']"
@click="handleAdd"
>
{{ $t('pages.common.add') }}
</a-button>
</Space>
</template>
<template #action="{ row }">
<Space>
<ghost-button
v-access:code="['domain:procurementApplication:edit']"
@click.stop="handleEdit(row)"
>
{{ $t('pages.common.edit') }}
</ghost-button>
<Popconfirm
:get-popup-container="getVxePopupContainer"
placement="left"
title="确认删除?"
@confirm="handleDelete(row)"
>
<ghost-button
danger
v-access:code="['domain:procurementApplication:remove']"
@click.stop=""
>
{{ $t('pages.common.delete') }}
</ghost-button>
</Popconfirm>
</Space>
</template>
</BasicTable>
<ProcurementApplicationModal @reload="tableApi.query()" />
</Page>
</template>

View File

@ -0,0 +1,106 @@
<script setup lang="ts">
import { computed, ref } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { $t } from '@vben/locales';
import { cloneDeep } from '@vben/utils';
import { useVbenForm } from '#/adapter/form';
import {
procurementApplicationAdd,
procurementApplicationInfo,
procurementApplicationUpdate,
} from '#/api/property/assetManage/procurementApplication';
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
import { modalSchema } from './data';
const emit = defineEmits<{ reload: [] }>();
const isUpdate = ref(false);
const title = computed(() => {
return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add');
});
const [BasicForm, formApi] = useVbenForm({
commonConfig: {
//
formItemClass: 'col-span-2',
// label px
labelWidth: 80,
//
componentProps: {
class: 'w-full',
},
},
schema: modalSchema(),
showDefaultActions: false,
wrapperClass: 'grid-cols-2',
});
const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
{
initializedGetter: defaultFormValueGetter(formApi),
currentGetter: defaultFormValueGetter(formApi),
},
);
const [BasicModal, modalApi] = useVbenModal({
//
class: 'w-[550px]',
fullscreenButton: false,
onBeforeClose,
onClosed: handleClosed,
onConfirm: handleConfirm,
onOpenChange: async (isOpen) => {
if (!isOpen) {
return null;
}
modalApi.modalLoading(true);
const { id } = modalApi.getData() as { id?: number | string };
isUpdate.value = !!id;
if (isUpdate.value && id) {
const record = await procurementApplicationInfo(id);
await formApi.setValues(record);
}
await markInitialized();
modalApi.modalLoading(false);
},
});
async function handleConfirm() {
try {
modalApi.lock(true);
const { valid } = await formApi.validate();
if (!valid) {
return;
}
// getValuesreadonly
const data = cloneDeep(await formApi.getValues());
await (isUpdate.value
? procurementApplicationUpdate(data)
: procurementApplicationAdd(data));
resetInitialized();
emit('reload');
modalApi.close();
} catch (error) {
console.error(error);
} finally {
modalApi.lock(false);
}
}
async function handleClosed() {
await formApi.resetForm();
resetInitialized();
}
</script>
<template>
<BasicModal :title="title">
<BasicForm />
</BasicModal>
</template>

View File

@ -0,0 +1,229 @@
import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table';
import { getDictOptions } from '#/utils/dict';
import { renderDict } from '#/utils/render';
export const querySchema: FormSchemaGetter = () => [
{
component: 'Input',
fieldName: 'userId',
label: '用户ID关联用户表',
},
{
component: 'Input',
fieldName: 'username',
label: '申请人姓名',
},
{
component: 'Input',
fieldName: 'departmentId',
label: '部门ID关联部门表',
},
{
component: 'Input',
fieldName: 'departmentName',
label: '部门名称',
},
{
component: 'Select',
componentProps: {
},
fieldName: 'leaveType',
label: '请假类型',
},
{
component: 'DatePicker',
componentProps: {
showTime: true,
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
fieldName: 'startTime',
label: '开始时间',
},
{
component: 'DatePicker',
componentProps: {
showTime: true,
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
fieldName: 'endTime',
label: '结束时间',
},
{
component: 'Input',
fieldName: 'totalDuration',
label: '合计时间如3天5个小时',
},
{
component: 'Textarea',
fieldName: 'reason',
label: '请假事由',
},
{
component: 'Select',
componentProps: {
// 可选从DictEnum中获取 DictEnum.WY_SQZT 便于维护
options: getDictOptions('wy_sqzt'),
},
fieldName: 'status',
label: '申请状态',
},
{
component: 'Input',
fieldName: 'searchValue',
label: '搜索值',
},
];
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
// export const columns: () => VxeGridProps['columns'] = () => [
export const columns: VxeGridProps['columns'] = [
{ type: 'checkbox', width: 60 },
{
title: '',
field: 'id',
},
{
title: '用户ID关联用户表',
field: 'userId',
},
{
title: '申请人姓名',
field: 'username',
},
{
title: '部门ID关联部门表',
field: 'departmentId',
},
{
title: '部门名称',
field: 'departmentName',
},
{
title: '请假类型',
field: 'leaveType',
},
{
title: '开始时间',
field: 'startTime',
},
{
title: '结束时间',
field: 'endTime',
},
{
title: '合计时间如3天5个小时',
field: 'totalDuration',
},
{
title: '请假事由',
field: 'reason',
},
{
title: '申请状态',
field: 'status',
slots: {
default: ({ row }) => {
// 可选从DictEnum中获取 DictEnum.WY_SQZT 便于维护
return renderDict(row.status, 'wy_sqzt');
},
},
},
{
title: '搜索值',
field: 'searchValue',
},
{
field: 'action',
fixed: 'right',
slots: { default: 'action' },
title: '操作',
width: 180,
},
];
export const modalSchema: FormSchemaGetter = () => [
{
label: '',
fieldName: 'id',
component: 'Input',
dependencies: {
show: () => false,
triggerFields: [''],
},
},
{
label: '用户ID关联用户表',
fieldName: 'userId',
component: 'Input',
},
{
label: '申请人姓名',
fieldName: 'username',
component: 'Input',
},
{
label: '部门ID关联部门表',
fieldName: 'departmentId',
component: 'Input',
},
{
label: '部门名称',
fieldName: 'departmentName',
component: 'Input',
},
{
label: '请假类型',
fieldName: 'leaveType',
component: 'Select',
componentProps: {
},
},
{
label: '开始时间',
fieldName: 'startTime',
component: 'DatePicker',
componentProps: {
showTime: true,
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
},
{
label: '结束时间',
fieldName: 'endTime',
component: 'DatePicker',
componentProps: {
showTime: true,
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
},
{
label: '合计时间如3天5个小时',
fieldName: 'totalDuration',
component: 'Input',
},
{
label: '请假事由',
fieldName: 'reason',
component: 'Textarea',
},
{
label: '申请状态',
fieldName: 'status',
component: 'Select',
componentProps: {
// 可选从DictEnum中获取 DictEnum.WY_SQZT 便于维护
options: getDictOptions('wy_sqzt'),
},
},
{
label: '搜索值',
fieldName: 'searchValue',
component: 'Input',
},
];

View File

@ -0,0 +1,188 @@
<script setup lang="ts">
import type { Recordable } from '@vben/types';
import { ref } from 'vue';
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
import { getVxePopupContainer } from '@vben/utils';
import { Modal, Popconfirm, Space } from 'ant-design-vue';
import dayjs from 'dayjs';
import {
useVbenVxeGrid,
vxeCheckboxChecked,
type VxeGridProps,
} from '#/adapter/vxe-table';
import {
leaveApplicationExport,
leaveApplicationList,
leaveApplicationRemove,
} from '#/api/property/personalCenter/leaveApplication';
import type { LeaveApplicationForm } from '#/api/property/personalCenter/leaveApplication/model';
import { commonDownloadExcel } from '#/utils/file/download';
import leaveApplicationModal from './leaveApplication-modal.vue';
import { columns, querySchema } from './data';
const formOptions: VbenFormProps = {
commonConfig: {
labelWidth: 80,
componentProps: {
allowClear: true,
},
},
schema: querySchema(),
wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4',
// RangePicker /
//
// fieldMappingTime: [
// [
// 'createTime',
// ['params[beginTime]', 'params[endTime]'],
// ['YYYY-MM-DD 00:00:00', 'YYYY-MM-DD 23:59:59'],
// ],
// ],
};
const gridOptions: VxeGridProps = {
checkboxConfig: {
//
highlight: true,
//
reserve: true,
//
// trigger: 'row',
},
// 使i18ngetter
// columns: columns(),
columns,
height: 'auto',
keepSource: true,
pagerConfig: {},
proxyConfig: {
ajax: {
query: async ({ page }, formValues = {}) => {
return await leaveApplicationList({
pageNum: page.currentPage,
pageSize: page.pageSize,
...formValues,
});
},
},
},
rowConfig: {
keyField: 'id',
},
//
id: 'property-leaveApplication-index',
};
const [BasicTable, tableApi] = useVbenVxeGrid({
formOptions,
gridOptions,
});
const [LeaveApplicationModal, modalApi] = useVbenModal({
connectedComponent: leaveApplicationModal,
});
function handleAdd() {
modalApi.setData({});
modalApi.open();
}
async function handleEdit(row: Required<LeaveApplicationForm>) {
modalApi.setData({ id: row.id });
modalApi.open();
}
async function handleDelete(row: Required<LeaveApplicationForm>) {
await leaveApplicationRemove(row.id);
await tableApi.query();
}
function handleMultiDelete() {
const rows = tableApi.grid.getCheckboxRecords();
const ids = rows.map((row: Required<LeaveApplicationForm>) => row.id);
Modal.confirm({
title: '提示',
okType: 'danger',
content: `确认删除选中的${ids.length}条记录吗?`,
onOk: async () => {
await leaveApplicationRemove(ids);
await tableApi.query();
},
});
}
function handleDownloadExcel() {
commonDownloadExcel(
leaveApplicationExport,
'请假申请数据',
tableApi.formApi.form.values,
{
fieldMappingTime: formOptions.fieldMappingTime,
},
);
}
</script>
<template>
<Page :auto-content-height="true">
<BasicTable table-title="请假申请列表">
<template #toolbar-tools>
<Space>
<a-button
v-access:code="['property:leaveApplication:export']"
@click="handleDownloadExcel"
>
{{ $t('pages.common.export') }}
</a-button>
<a-button
:disabled="!vxeCheckboxChecked(tableApi)"
danger
type="primary"
v-access:code="['property:leaveApplication:remove']"
@click="handleMultiDelete"
>
{{ $t('pages.common.delete') }}
</a-button>
<a-button
type="primary"
v-access:code="['property:leaveApplication:add']"
@click="handleAdd"
>
{{ $t('pages.common.add') }}
</a-button>
</Space>
</template>
<template #action="{ row }">
<Space>
<ghost-button
v-access:code="['property:leaveApplication:edit']"
@click.stop="handleEdit(row)"
>
{{ $t('pages.common.edit') }}
</ghost-button>
<Popconfirm
:get-popup-container="getVxePopupContainer"
placement="left"
title="确认删除?"
@confirm="handleDelete(row)"
>
<ghost-button
danger
v-access:code="['property:leaveApplication:remove']"
@click.stop=""
>
{{ $t('pages.common.delete') }}
</ghost-button>
</Popconfirm>
</Space>
</template>
</BasicTable>
<LeaveApplicationModal @reload="tableApi.query()" />
</Page>
</template>

View File

@ -0,0 +1,106 @@
<script setup lang="ts">
import { computed, ref } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { $t } from '@vben/locales';
import { cloneDeep } from '@vben/utils';
import { useVbenForm } from '#/adapter/form';
import {
leaveApplicationAdd,
leaveApplicationInfo,
leaveApplicationUpdate,
} from '#/api/property/personalCenter/leaveApplication';
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
import { modalSchema } from './data';
const emit = defineEmits<{ reload: [] }>();
const isUpdate = ref(false);
const title = computed(() => {
return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add');
});
const [BasicForm, formApi] = useVbenForm({
commonConfig: {
//
formItemClass: 'col-span-2',
// label px
labelWidth: 80,
//
componentProps: {
class: 'w-full',
},
},
schema: modalSchema(),
showDefaultActions: false,
wrapperClass: 'grid-cols-2',
});
const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
{
initializedGetter: defaultFormValueGetter(formApi),
currentGetter: defaultFormValueGetter(formApi),
},
);
const [BasicModal, modalApi] = useVbenModal({
//
class: 'w-[550px]',
fullscreenButton: false,
onBeforeClose,
onClosed: handleClosed,
onConfirm: handleConfirm,
onOpenChange: async (isOpen) => {
if (!isOpen) {
return null;
}
modalApi.modalLoading(true);
const { id } = modalApi.getData() as { id?: number | string };
isUpdate.value = !!id;
if (isUpdate.value && id) {
const record = await leaveApplicationInfo(id);
await formApi.setValues(record);
}
await markInitialized();
modalApi.modalLoading(false);
},
});
async function handleConfirm() {
try {
modalApi.lock(true);
const { valid } = await formApi.validate();
if (!valid) {
return;
}
// getValuesreadonly
const data = cloneDeep(await formApi.getValues());
await (isUpdate.value
? leaveApplicationUpdate(data)
: leaveApplicationAdd(data));
resetInitialized();
emit('reload');
modalApi.close();
} catch (error) {
console.error(error);
} finally {
modalApi.lock(false);
}
}
async function handleClosed() {
await formApi.resetForm();
resetInitialized();
}
</script>
<template>
<BasicModal :title="title">
<BasicForm />
</BasicModal>
</template>

View File

@ -0,0 +1 @@
<template>我的消息</template>

View File

@ -0,0 +1 @@
<template>已办</template>

View File

@ -0,0 +1 @@
<template>待办</template>

View File

@ -0,0 +1,159 @@
import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table';
import { getDictOptions } from '#/utils/dict';
import { renderDict } from '#/utils/render';
export const querySchema: FormSchemaGetter = () => [
{
component: 'Input',
fieldName: 'code',
label: '流程编号',
},
{
component: 'Input',
fieldName: 'name',
label: '流程名称',
},
{
component: 'Select',
componentProps: {
// 可选从DictEnum中获取 DictEnum.WY_LCZT 便于维护
options: getDictOptions('wy_lczt'),
},
fieldName: 'status',
label: '流程状态(0审批不通过1审批通过2审批中3已取消)',
},
{
component: 'Input',
fieldName: 'currentApprover',
label: '当前审批人',
},
{
component: 'Input',
fieldName: 'workflowSuggestion',
label: '审批建议',
},
{
component: 'DatePicker',
componentProps: {
showTime: true,
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
fieldName: 'endTime',
label: '结束时间',
},
{
component: 'Input',
fieldName: 'searchValue',
label: '搜索值',
},
];
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
// export const columns: () => VxeGridProps['columns'] = () => [
export const columns: VxeGridProps['columns'] = [
{ type: 'checkbox', width: 60 },
{
title: '主键id',
field: 'id',
},
{
title: '流程编号',
field: 'code',
},
{
title: '流程名称',
field: 'name',
},
{
title: '流程状态(0审批不通过1审批通过2审批中3已取消)',
field: 'status',
slots: {
default: ({ row }) => {
// 可选从DictEnum中获取 DictEnum.WY_LCZT 便于维护
return renderDict(row.status, 'wy_lczt');
},
},
},
{
title: '当前审批人',
field: 'currentApprover',
},
{
title: '审批建议',
field: 'workflowSuggestion',
},
{
title: '结束时间',
field: 'endTime',
},
{
title: '搜索值',
field: 'searchValue',
},
{
field: 'action',
fixed: 'right',
slots: { default: 'action' },
title: '操作',
width: 180,
},
];
export const modalSchema: FormSchemaGetter = () => [
{
label: '主键id',
fieldName: 'id',
component: 'Input',
dependencies: {
show: () => false,
triggerFields: [''],
},
},
{
label: '流程编号',
fieldName: 'code',
component: 'Input',
},
{
label: '流程名称',
fieldName: 'name',
component: 'Input',
},
{
label: '流程状态(0审批不通过1审批通过2审批中3已取消)',
fieldName: 'status',
component: 'Select',
componentProps: {
// 可选从DictEnum中获取 DictEnum.WY_LCZT 便于维护
options: getDictOptions('wy_lczt'),
},
},
{
label: '当前审批人',
fieldName: 'currentApprover',
component: 'Input',
},
{
label: '审批建议',
fieldName: 'workflowSuggestion',
component: 'Input',
},
{
label: '结束时间',
fieldName: 'endTime',
component: 'DatePicker',
componentProps: {
showTime: true,
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
},
{
label: '搜索值',
fieldName: 'searchValue',
component: 'Input',
},
];

View File

@ -0,0 +1,188 @@
<script setup lang="ts">
import type { Recordable } from '@vben/types';
import { ref } from 'vue';
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
import { getVxePopupContainer } from '@vben/utils';
import { Modal, Popconfirm, Space } from 'ant-design-vue';
import dayjs from 'dayjs';
import {
useVbenVxeGrid,
vxeCheckboxChecked,
type VxeGridProps,
} from '#/adapter/vxe-table';
import {
workflowDefinitionExport,
workflowDefinitionList,
workflowDefinitionRemove,
} from '#/api/property/personalCenter/workflowDefinition';
import type { WorkflowDefinitionForm } from '#/api/property/personalCenter/workflowDefinition/model';
import { commonDownloadExcel } from '#/utils/file/download';
import workflowDefinitionModal from './workflowDefinition-modal.vue';
import { columns, querySchema } from './data';
const formOptions: VbenFormProps = {
commonConfig: {
labelWidth: 80,
componentProps: {
allowClear: true,
},
},
schema: querySchema(),
wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4',
// RangePicker /
//
// fieldMappingTime: [
// [
// 'createTime',
// ['params[beginTime]', 'params[endTime]'],
// ['YYYY-MM-DD 00:00:00', 'YYYY-MM-DD 23:59:59'],
// ],
// ],
};
const gridOptions: VxeGridProps = {
checkboxConfig: {
//
highlight: true,
//
reserve: true,
//
// trigger: 'row',
},
// 使i18ngetter
// columns: columns(),
columns,
height: 'auto',
keepSource: true,
pagerConfig: {},
proxyConfig: {
ajax: {
query: async ({ page }, formValues = {}) => {
return await workflowDefinitionList({
pageNum: page.currentPage,
pageSize: page.pageSize,
...formValues,
});
},
},
},
rowConfig: {
keyField: 'id',
},
//
id: 'property-workflowDefinition-index',
};
const [BasicTable, tableApi] = useVbenVxeGrid({
formOptions,
gridOptions,
});
const [WorkflowDefinitionModal, modalApi] = useVbenModal({
connectedComponent: workflowDefinitionModal,
});
function handleAdd() {
modalApi.setData({});
modalApi.open();
}
async function handleEdit(row: Required<WorkflowDefinitionForm>) {
modalApi.setData({ id: row.id });
modalApi.open();
}
async function handleDelete(row: Required<WorkflowDefinitionForm>) {
await workflowDefinitionRemove(row.id);
await tableApi.query();
}
function handleMultiDelete() {
const rows = tableApi.grid.getCheckboxRecords();
const ids = rows.map((row: Required<WorkflowDefinitionForm>) => row.id);
Modal.confirm({
title: '提示',
okType: 'danger',
content: `确认删除选中的${ids.length}条记录吗?`,
onOk: async () => {
await workflowDefinitionRemove(ids);
await tableApi.query();
},
});
}
function handleDownloadExcel() {
commonDownloadExcel(
workflowDefinitionExport,
'流程定义数据',
tableApi.formApi.form.values,
{
fieldMappingTime: formOptions.fieldMappingTime,
},
);
}
</script>
<template>
<Page :auto-content-height="true">
<BasicTable table-title="流程定义列表">
<template #toolbar-tools>
<Space>
<a-button
v-access:code="['property:workflowDefinition:export']"
@click="handleDownloadExcel"
>
{{ $t('pages.common.export') }}
</a-button>
<a-button
:disabled="!vxeCheckboxChecked(tableApi)"
danger
type="primary"
v-access:code="['property:workflowDefinition:remove']"
@click="handleMultiDelete"
>
{{ $t('pages.common.delete') }}
</a-button>
<a-button
type="primary"
v-access:code="['property:workflowDefinition:add']"
@click="handleAdd"
>
{{ $t('pages.common.add') }}
</a-button>
</Space>
</template>
<template #action="{ row }">
<Space>
<ghost-button
v-access:code="['property:workflowDefinition:edit']"
@click.stop="handleEdit(row)"
>
{{ $t('pages.common.edit') }}
</ghost-button>
<Popconfirm
:get-popup-container="getVxePopupContainer"
placement="left"
title="确认删除?"
@confirm="handleDelete(row)"
>
<ghost-button
danger
v-access:code="['property:workflowDefinition:remove']"
@click.stop=""
>
{{ $t('pages.common.delete') }}
</ghost-button>
</Popconfirm>
</Space>
</template>
</BasicTable>
<WorkflowDefinitionModal @reload="tableApi.query()" />
</Page>
</template>

View File

@ -0,0 +1,106 @@
<script setup lang="ts">
import { computed, ref } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { $t } from '@vben/locales';
import { cloneDeep } from '@vben/utils';
import { useVbenForm } from '#/adapter/form';
import {
workflowDefinitionAdd,
workflowDefinitionInfo,
workflowDefinitionUpdate,
} from '#/api/property/personalCenter/workflowDefinition';
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
import { modalSchema } from './data';
const emit = defineEmits<{ reload: [] }>();
const isUpdate = ref(false);
const title = computed(() => {
return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add');
});
const [BasicForm, formApi] = useVbenForm({
commonConfig: {
//
formItemClass: 'col-span-2',
// label px
labelWidth: 80,
//
componentProps: {
class: 'w-full',
},
},
schema: modalSchema(),
showDefaultActions: false,
wrapperClass: 'grid-cols-2',
});
const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
{
initializedGetter: defaultFormValueGetter(formApi),
currentGetter: defaultFormValueGetter(formApi),
},
);
const [BasicModal, modalApi] = useVbenModal({
//
class: 'w-[550px]',
fullscreenButton: false,
onBeforeClose,
onClosed: handleClosed,
onConfirm: handleConfirm,
onOpenChange: async (isOpen) => {
if (!isOpen) {
return null;
}
modalApi.modalLoading(true);
const { id } = modalApi.getData() as { id?: number | string };
isUpdate.value = !!id;
if (isUpdate.value && id) {
const record = await workflowDefinitionInfo(id);
await formApi.setValues(record);
}
await markInitialized();
modalApi.modalLoading(false);
},
});
async function handleConfirm() {
try {
modalApi.lock(true);
const { valid } = await formApi.validate();
if (!valid) {
return;
}
// getValuesreadonly
const data = cloneDeep(await formApi.getValues());
await (isUpdate.value
? workflowDefinitionUpdate(data)
: workflowDefinitionAdd(data));
resetInitialized();
emit('reload');
modalApi.close();
} catch (error) {
console.error(error);
} finally {
modalApi.lock(false);
}
}
async function handleClosed() {
await formApi.resetForm();
resetInitialized();
}
</script>
<template>
<BasicModal :title="title">
<BasicForm />
</BasicModal>
</template>