修改
This commit is contained in:
22
web-vue/packages/erp/README.md
Normal file
22
web-vue/packages/erp/README.md
Normal file
@@ -0,0 +1,22 @@
|
||||
- 官方网站:<https://jeesite.com>
|
||||
- 使用文档:<https://jeesite.com/docs>
|
||||
- 后端代码:<https://gitee.com/thinkgem/jeesite5>
|
||||
- 前端代码:<https://gitee.com/thinkgem/jeesite-vue>
|
||||
|
||||
------
|
||||
|
||||
<div align="center">
|
||||
如果你喜欢 JeeSite,请给她一个 ⭐️ Star,您的支持将是我们前行的动力。
|
||||
</div>
|
||||
|
||||
------
|
||||
|
||||
- 问题反馈:<https://gitee.com/thinkgem/jeesite-vue/issues> [【新手必读】](https://gitee.com/thinkgem/jeesite5/issues/I18ARR)
|
||||
- 需求收集:<https://gitee.com/thinkgem/jeesite-vue/issues/new>
|
||||
- QQ 群:`127515876`、`209330483`、`223507718`、`709534275`、`730390092`、`1373527`、`183903863(外包)`
|
||||
- 微信群:添加客服微信 <http://s.jeesite.com> 邀请您进群
|
||||
- 关注微信公众号,了解最新动态:
|
||||
|
||||
<p style="padding-left:40px">
|
||||
<img alt="JeeSite微信公众号" src="https://jeesite.com/assets/images/mp.png" width="220" height="220">
|
||||
</p>
|
||||
56
web-vue/packages/erp/api/erp/account.ts
Normal file
56
web-vue/packages/erp/api/erp/account.ts
Normal file
@@ -0,0 +1,56 @@
|
||||
/**
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
* @author gaoxq
|
||||
*/
|
||||
import { defHttp } from '@jeesite/core/utils/http/axios';
|
||||
import { useGlobSetting } from '@jeesite/core/hooks/setting';
|
||||
import { BasicModel, Page } from '@jeesite/core/api/model/baseModel';
|
||||
import { UploadApiResult } from '@jeesite/core/api/sys/upload';
|
||||
import { UploadFileParams } from '@jeesite/types/axios';
|
||||
import { AxiosProgressEvent } from 'axios';
|
||||
|
||||
const { ctxPath, adminPath } = useGlobSetting();
|
||||
|
||||
export interface ErpAccount extends BasicModel<ErpAccount> {
|
||||
createTime?: string; // 记录时间
|
||||
accountId?: string; // 账户标识
|
||||
accountName: string; // 账户名称
|
||||
accountType: string; // 账户类型
|
||||
accountCode: string; // 账户卡号
|
||||
initialBalance: number; // 初始余额
|
||||
currentBalance: number; // 当前余额
|
||||
isActive: string; // 是否激活
|
||||
updateTime?: string; // 更新时间
|
||||
ftenantId?: string; // 租户id
|
||||
fflowId?: string; // 流程id
|
||||
fflowTaskId?: string; // 流程任务主键
|
||||
fflowState?: number; // 流程任务状态
|
||||
}
|
||||
|
||||
export const erpAccountList = (params?: ErpAccount | any) =>
|
||||
defHttp.get<ErpAccount>({ url: adminPath + '/erp/account/list', params });
|
||||
|
||||
export const erpAccountListData = (params?: ErpAccount | any) =>
|
||||
defHttp.post<Page<ErpAccount>>({ url: adminPath + '/erp/account/listData', params });
|
||||
|
||||
export const erpAccountForm = (params?: ErpAccount | any) =>
|
||||
defHttp.get<ErpAccount>({ url: adminPath + '/erp/account/form', params });
|
||||
|
||||
export const erpAccountSave = (params?: any, data?: ErpAccount | any) =>
|
||||
defHttp.postJson<ErpAccount>({ url: adminPath + '/erp/account/save', params, data });
|
||||
|
||||
export const erpAccountImportData = (
|
||||
params: UploadFileParams,
|
||||
onUploadProgress: (progressEvent: AxiosProgressEvent) => void,
|
||||
) =>
|
||||
defHttp.uploadFile<UploadApiResult>(
|
||||
{
|
||||
url: ctxPath + adminPath + '/erp/account/importData',
|
||||
onUploadProgress,
|
||||
},
|
||||
params,
|
||||
);
|
||||
|
||||
export const erpAccountDelete = (params?: ErpAccount | any) =>
|
||||
defHttp.get<ErpAccount>({ url: adminPath + '/erp/account/delete', params });
|
||||
58
web-vue/packages/erp/api/erp/category.ts
Normal file
58
web-vue/packages/erp/api/erp/category.ts
Normal file
@@ -0,0 +1,58 @@
|
||||
/**
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
* @author gaoxq
|
||||
*/
|
||||
import { defHttp } from '@jeesite/core/utils/http/axios';
|
||||
import { useGlobSetting } from '@jeesite/core/hooks/setting';
|
||||
import { BasicModel, Page } from '@jeesite/core/api/model/baseModel';
|
||||
import { UploadApiResult } from '@jeesite/core/api/sys/upload';
|
||||
import { UploadFileParams } from '@jeesite/types/axios';
|
||||
import { AxiosProgressEvent } from 'axios';
|
||||
|
||||
const { ctxPath, adminPath } = useGlobSetting();
|
||||
|
||||
export interface ErpCategory extends BasicModel<ErpCategory> {
|
||||
createTime: string; // 记录时间
|
||||
categoryId: string; // 分类标识
|
||||
categoryName: string; // 分类名称
|
||||
categoryType: string; // 分类类型
|
||||
parentId?: string; // 父级分类
|
||||
sortOrder: string; // 排序序号
|
||||
isActive: string; // 是否启用
|
||||
updateTime?: string; // 更新时间
|
||||
ftenantId: string; // 租户id
|
||||
fflowId?: string; // 流程id
|
||||
fflowTaskId?: string; // 流程任务主键
|
||||
fflowState?: number; // 流程任务状态
|
||||
}
|
||||
|
||||
export const erpCategoryList = (params?: ErpCategory | any) =>
|
||||
defHttp.get<ErpCategory>({ url: adminPath + '/erp/category/list', params });
|
||||
|
||||
export const erpCategoryListAll = (params?: ErpCategory | any) =>
|
||||
defHttp.get<ErpCategory[]>({ url: adminPath + '/erp/category/listAll', params });
|
||||
|
||||
export const erpCategoryListData = (params?: ErpCategory | any) =>
|
||||
defHttp.post<Page<ErpCategory>>({ url: adminPath + '/erp/category/listData', params });
|
||||
|
||||
export const erpCategoryForm = (params?: ErpCategory | any) =>
|
||||
defHttp.get<ErpCategory>({ url: adminPath + '/erp/category/form', params });
|
||||
|
||||
export const erpCategorySave = (params?: any, data?: ErpCategory | any) =>
|
||||
defHttp.postJson<ErpCategory>({ url: adminPath + '/erp/category/save', params, data });
|
||||
|
||||
export const erpCategoryImportData = (
|
||||
params: UploadFileParams,
|
||||
onUploadProgress: (progressEvent: AxiosProgressEvent) => void,
|
||||
) =>
|
||||
defHttp.uploadFile<UploadApiResult>(
|
||||
{
|
||||
url: ctxPath + adminPath + '/erp/category/importData',
|
||||
onUploadProgress,
|
||||
},
|
||||
params,
|
||||
);
|
||||
|
||||
export const erpCategoryDelete = (params?: ErpCategory | any) =>
|
||||
defHttp.get<ErpCategory>({ url: adminPath + '/erp/category/delete', params });
|
||||
54
web-vue/packages/erp/api/erp/expense.ts
Normal file
54
web-vue/packages/erp/api/erp/expense.ts
Normal file
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
* @author gaoxq
|
||||
*/
|
||||
import { defHttp } from '@jeesite/core/utils/http/axios';
|
||||
import { useGlobSetting } from '@jeesite/core/hooks/setting';
|
||||
import { BasicModel, Page } from '@jeesite/core/api/model/baseModel';
|
||||
import { UploadApiResult } from '@jeesite/core/api/sys/upload';
|
||||
import { UploadFileParams } from '@jeesite/types/axios';
|
||||
import { AxiosProgressEvent } from 'axios';
|
||||
|
||||
const { ctxPath, adminPath } = useGlobSetting();
|
||||
|
||||
export interface ErpExpense extends BasicModel<ErpExpense> {
|
||||
createTime?: string; // 记录时间
|
||||
expenseId?: string; // 支出ID
|
||||
zflowId: string; // 关联流水ID
|
||||
accountId: string; // 支出账户ID
|
||||
categoryId: string; // 支出分类ID
|
||||
amount: number; // 交易金额
|
||||
updateTime?: string; // 更新时间
|
||||
ftenantId?: string; // 租户id
|
||||
fflowId?: string; // 流程id
|
||||
fflowTaskId?: string; // 流程任务主键
|
||||
fflowState?: number; // 流程任务状态
|
||||
}
|
||||
|
||||
export const erpExpenseList = (params?: ErpExpense | any) =>
|
||||
defHttp.get<ErpExpense>({ url: adminPath + '/erp/expense/list', params });
|
||||
|
||||
export const erpExpenseListData = (params?: ErpExpense | any) =>
|
||||
defHttp.post<Page<ErpExpense>>({ url: adminPath + '/erp/expense/listData', params });
|
||||
|
||||
export const erpExpenseForm = (params?: ErpExpense | any) =>
|
||||
defHttp.get<ErpExpense>({ url: adminPath + '/erp/expense/form', params });
|
||||
|
||||
export const erpExpenseSave = (params?: any, data?: ErpExpense | any) =>
|
||||
defHttp.postJson<ErpExpense>({ url: adminPath + '/erp/expense/save', params, data });
|
||||
|
||||
export const erpExpenseImportData = (
|
||||
params: UploadFileParams,
|
||||
onUploadProgress: (progressEvent: AxiosProgressEvent) => void,
|
||||
) =>
|
||||
defHttp.uploadFile<UploadApiResult>(
|
||||
{
|
||||
url: ctxPath + adminPath + '/erp/expense/importData',
|
||||
onUploadProgress,
|
||||
},
|
||||
params,
|
||||
);
|
||||
|
||||
export const erpExpenseDelete = (params?: ErpExpense | any) =>
|
||||
defHttp.get<ErpExpense>({ url: adminPath + '/erp/expense/delete', params });
|
||||
54
web-vue/packages/erp/api/erp/income.ts
Normal file
54
web-vue/packages/erp/api/erp/income.ts
Normal file
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
* @author gaoxq
|
||||
*/
|
||||
import { defHttp } from '@jeesite/core/utils/http/axios';
|
||||
import { useGlobSetting } from '@jeesite/core/hooks/setting';
|
||||
import { BasicModel, Page } from '@jeesite/core/api/model/baseModel';
|
||||
import { UploadApiResult } from '@jeesite/core/api/sys/upload';
|
||||
import { UploadFileParams } from '@jeesite/types/axios';
|
||||
import { AxiosProgressEvent } from 'axios';
|
||||
|
||||
const { ctxPath, adminPath } = useGlobSetting();
|
||||
|
||||
export interface ErpIncome extends BasicModel<ErpIncome> {
|
||||
createTime?: string; // 记录时间
|
||||
incomeId?: string; // 收入ID
|
||||
sflowId: string; // 关联流水ID
|
||||
accountId: string; // 收入账户ID
|
||||
categoryId: string; // 收入分类ID
|
||||
amount: number; // 交易金额(正数)
|
||||
updateTime?: string; // 更新时间
|
||||
ftenantId?: string; // 租户id
|
||||
fflowId?: string; // 流程id
|
||||
fflowTaskId?: string; // 流程任务主键
|
||||
fflowState?: number; // 流程任务状态
|
||||
}
|
||||
|
||||
export const erpIncomeList = (params?: ErpIncome | any) =>
|
||||
defHttp.get<ErpIncome>({ url: adminPath + '/erp/income/list', params });
|
||||
|
||||
export const erpIncomeListData = (params?: ErpIncome | any) =>
|
||||
defHttp.post<Page<ErpIncome>>({ url: adminPath + '/erp/income/listData', params });
|
||||
|
||||
export const erpIncomeForm = (params?: ErpIncome | any) =>
|
||||
defHttp.get<ErpIncome>({ url: adminPath + '/erp/income/form', params });
|
||||
|
||||
export const erpIncomeSave = (params?: any, data?: ErpIncome | any) =>
|
||||
defHttp.postJson<ErpIncome>({ url: adminPath + '/erp/income/save', params, data });
|
||||
|
||||
export const erpIncomeImportData = (
|
||||
params: UploadFileParams,
|
||||
onUploadProgress: (progressEvent: AxiosProgressEvent) => void,
|
||||
) =>
|
||||
defHttp.uploadFile<UploadApiResult>(
|
||||
{
|
||||
url: ctxPath + adminPath + '/erp/income/importData',
|
||||
onUploadProgress,
|
||||
},
|
||||
params,
|
||||
);
|
||||
|
||||
export const erpIncomeDelete = (params?: ErpIncome | any) =>
|
||||
defHttp.get<ErpIncome>({ url: adminPath + '/erp/income/delete', params });
|
||||
61
web-vue/packages/erp/api/erp/transactionFlow.ts
Normal file
61
web-vue/packages/erp/api/erp/transactionFlow.ts
Normal file
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
* @author gaoxq
|
||||
*/
|
||||
import { defHttp } from '@jeesite/core/utils/http/axios';
|
||||
import { useGlobSetting } from '@jeesite/core/hooks/setting';
|
||||
import { BasicModel, Page } from '@jeesite/core/api/model/baseModel';
|
||||
import { UploadApiResult } from '@jeesite/core/api/sys/upload';
|
||||
import { UploadFileParams } from '@jeesite/types/axios';
|
||||
import { AxiosProgressEvent } from 'axios';
|
||||
|
||||
const { ctxPath, adminPath } = useGlobSetting();
|
||||
|
||||
export interface ErpTransactionFlow extends BasicModel<ErpTransactionFlow> {
|
||||
createTime?: string; // 记录时间
|
||||
flowId?: string; // 流水编号
|
||||
flowName: string; // 交易名称
|
||||
transactionType: string; // 交易类型
|
||||
amount: number; // 交易金额
|
||||
transactionTime?: string; // 交易时间
|
||||
accountId: string; // 交易账户
|
||||
categoryId: string; // 交易分类
|
||||
remark?: string; // 交易备注
|
||||
isFinish?: string; // 是否记账
|
||||
updateTime?: string; // 更新时间
|
||||
ftenantId?: string; // 租户id
|
||||
fflowId?: string; // 流程id
|
||||
fflowTaskId?: string; // 流程任务主键
|
||||
fflowState?: number; // 流程任务状态
|
||||
}
|
||||
|
||||
export const erpTransactionFlowList = (params?: ErpTransactionFlow | any) =>
|
||||
defHttp.get<ErpTransactionFlow>({ url: adminPath + '/erp/transactionFlow/list', params });
|
||||
|
||||
export const erpTransactionFlowListData = (params?: ErpTransactionFlow | any) =>
|
||||
defHttp.post<Page<ErpTransactionFlow>>({ url: adminPath + '/erp/transactionFlow/listData', params });
|
||||
|
||||
export const erpTransactionFlowForm = (params?: ErpTransactionFlow | any) =>
|
||||
defHttp.get<ErpTransactionFlow>({ url: adminPath + '/erp/transactionFlow/form', params });
|
||||
|
||||
export const erpTransactionFlowSave = (params?: any, data?: ErpTransactionFlow | any) =>
|
||||
defHttp.postJson<ErpTransactionFlow>({ url: adminPath + '/erp/transactionFlow/save', params, data });
|
||||
|
||||
export const erpTransactionFlowImportData = (
|
||||
params: UploadFileParams,
|
||||
onUploadProgress: (progressEvent: AxiosProgressEvent) => void,
|
||||
) =>
|
||||
defHttp.uploadFile<UploadApiResult>(
|
||||
{
|
||||
url: ctxPath + adminPath + '/erp/transactionFlow/importData',
|
||||
onUploadProgress,
|
||||
},
|
||||
params,
|
||||
);
|
||||
|
||||
export const erpTransactionFlowDelete = (params?: ErpTransactionFlow | any) =>
|
||||
defHttp.get<ErpTransactionFlow>({ url: adminPath + '/erp/transactionFlow/delete', params });
|
||||
|
||||
export const erpTransactionFlowFinish = (params?: ErpTransactionFlow | any) =>
|
||||
defHttp.get<ErpTransactionFlow>({ url: adminPath + '/erp/transactionFlow/finish', params });
|
||||
30
web-vue/packages/erp/package.json
Normal file
30
web-vue/packages/erp/package.json
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"name": "@jeesite/erp",
|
||||
"version": "5.14.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"type:check": "vue-tsc --noEmit --skipLibCheck",
|
||||
"uninstall": "rimraf node_modules",
|
||||
"update": "ncu -u"
|
||||
},
|
||||
"dependencies": {
|
||||
"qs": "6.14.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/qs": "6.9.18"
|
||||
},
|
||||
"homepage": "https://jeesite.com",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://gitee.com/thinkgem/jeesite-vue.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://gitee.com/thinkgem/jeesite-vue/issues"
|
||||
},
|
||||
"author": {
|
||||
"name": "ThinkGem",
|
||||
"email": "thinkgem@163.com",
|
||||
"url": "https://gitee.com/thinkgem"
|
||||
}
|
||||
}
|
||||
20
web-vue/packages/erp/tsconfig.json
Normal file
20
web-vue/packages/erp/tsconfig.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@jeesite/erp/*": ["./*"]
|
||||
}
|
||||
},
|
||||
"include": [
|
||||
"./**/*.ts",
|
||||
"./**/*.tsx",
|
||||
"./**/*.vue"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"vite.config.ts",
|
||||
"_lib",
|
||||
"dist"
|
||||
]
|
||||
}
|
||||
143
web-vue/packages/erp/views/erp/account/form.vue
Normal file
143
web-vue/packages/erp/views/erp/account/form.vue
Normal file
@@ -0,0 +1,143 @@
|
||||
<!--
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
* @author gaoxq
|
||||
-->
|
||||
<template>
|
||||
<BasicDrawer
|
||||
v-bind="$attrs"
|
||||
:showFooter="true"
|
||||
:okAuth="'erp:account:edit'"
|
||||
@register="registerDrawer"
|
||||
@ok="handleSubmit"
|
||||
width="40%"
|
||||
>
|
||||
<template #title>
|
||||
<Icon :icon="getTitle.icon" class="m-1 pr-1" />
|
||||
<span> {{ getTitle.value }} </span>
|
||||
</template>
|
||||
<BasicForm @register="registerForm" />
|
||||
</BasicDrawer>
|
||||
</template>
|
||||
<script lang="ts" setup name="ViewsErpAccountForm">
|
||||
import { ref, unref, computed } from 'vue';
|
||||
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
|
||||
import { useMessage } from '@jeesite/core/hooks/web/useMessage';
|
||||
import { router } from '@jeesite/core/router';
|
||||
import { Icon } from '@jeesite/core/components/Icon';
|
||||
import { BasicForm, FormSchema, useForm } from '@jeesite/core/components/Form';
|
||||
import { BasicDrawer, useDrawerInner } from '@jeesite/core/components/Drawer';
|
||||
import { ErpAccount, erpAccountSave, erpAccountForm } from '@jeesite/erp/api/erp/account';
|
||||
|
||||
const emit = defineEmits(['success', 'register']);
|
||||
|
||||
const { t } = useI18n('erp.account');
|
||||
const { showMessage } = useMessage();
|
||||
const { meta } = unref(router.currentRoute);
|
||||
const record = ref<ErpAccount>({} as ErpAccount);
|
||||
|
||||
const getTitle = computed(() => ({
|
||||
icon: meta.icon || 'i-ant-design:book-outlined',
|
||||
value: record.value.isNewRecord ? t('新增账户信息') : t('编辑账户信息'),
|
||||
}));
|
||||
|
||||
const inputFormSchemas: FormSchema<ErpAccount>[] = [
|
||||
{
|
||||
label: t('账户名称'),
|
||||
field: 'accountName',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
maxlength: 100,
|
||||
},
|
||||
required: true,
|
||||
colProps: { md: 24, lg: 24 },
|
||||
},
|
||||
{
|
||||
label: t('账户卡号'),
|
||||
field: 'accountCode',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
maxlength: 32,
|
||||
},
|
||||
required: true,
|
||||
colProps: { md: 24, lg: 24 },
|
||||
},
|
||||
{
|
||||
label: t('初始余额'),
|
||||
field: 'initialBalance',
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
maxlength: 10,
|
||||
},
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: t('当前余额'),
|
||||
field: 'currentBalance',
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
maxlength: 10,
|
||||
},
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: t('账户类型'),
|
||||
field: 'accountType',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
dictType: 'account_type',
|
||||
allowClear: true,
|
||||
},
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: t('是否激活'),
|
||||
field: 'isActive',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
dictType: 'is_active',
|
||||
allowClear: true,
|
||||
},
|
||||
required: true,
|
||||
},
|
||||
];
|
||||
|
||||
const [registerForm, { resetFields, setFieldsValue, validate }] = useForm<ErpAccount>({
|
||||
labelWidth: 120,
|
||||
schemas: inputFormSchemas,
|
||||
baseColProps: { md: 24, lg: 12 },
|
||||
});
|
||||
|
||||
const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {
|
||||
setDrawerProps({ loading: true });
|
||||
await resetFields();
|
||||
const res = await erpAccountForm(data);
|
||||
record.value = (res.erpAccount || {}) as ErpAccount;
|
||||
record.value.__t = new Date().getTime();
|
||||
await setFieldsValue(record.value);
|
||||
setDrawerProps({ loading: false });
|
||||
});
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const data = await validate();
|
||||
setDrawerProps({ confirmLoading: true });
|
||||
const params: any = {
|
||||
isNewRecord: record.value.isNewRecord,
|
||||
accountId: record.value.accountId || data.accountId,
|
||||
};
|
||||
// console.log('submit', params, data, record);
|
||||
const res = await erpAccountSave(params, data);
|
||||
showMessage(res.message);
|
||||
setTimeout(closeDrawer);
|
||||
emit('success', data);
|
||||
} catch (error: any) {
|
||||
if (error && error.errorFields) {
|
||||
showMessage(error.message || t('common.validateError'));
|
||||
}
|
||||
console.log('error', error);
|
||||
} finally {
|
||||
setDrawerProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
103
web-vue/packages/erp/views/erp/account/formImport.vue
Normal file
103
web-vue/packages/erp/views/erp/account/formImport.vue
Normal file
@@ -0,0 +1,103 @@
|
||||
<!--
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
* @author gaoxq
|
||||
-->
|
||||
<template>
|
||||
<BasicModal
|
||||
v-bind="$attrs"
|
||||
:title="t('导入账户信息')"
|
||||
:okText="t('导入')"
|
||||
@register="registerModal"
|
||||
@ok="handleSubmit"
|
||||
:minHeight="120"
|
||||
:width="400"
|
||||
>
|
||||
<Upload accept=".xls,.xlsx" :file-list="fileList" :before-upload="beforeUpload" @remove="handleRemove">
|
||||
<a-button> <Icon icon="ant-design:upload-outlined" /> {{ t('选择文件') }} </a-button>
|
||||
<span class="ml-4">{{ uploadInfo }}</span>
|
||||
</Upload>
|
||||
<div class="ml-4 mt-4">
|
||||
{{ t('提示:仅允许导入“xls”或“xlsx”格式文件!') }}
|
||||
</div>
|
||||
<div class="mt-4">
|
||||
<a-button @click="handleDownloadTemplate()" type="text">
|
||||
<Icon icon="i-fa:file-excel-o" />
|
||||
{{ t('下载模板') }}
|
||||
</a-button>
|
||||
</div>
|
||||
</BasicModal>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import { Upload } from 'ant-design-vue';
|
||||
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
|
||||
import { useMessage } from '@jeesite/core/hooks/web/useMessage';
|
||||
import { useGlobSetting } from '@jeesite/core/hooks/setting';
|
||||
import { downloadByUrl } from '@jeesite/core/utils/file/download';
|
||||
import { Icon } from '@jeesite/core/components/Icon';
|
||||
import { BasicModal, useModalInner } from '@jeesite/core/components/Modal';
|
||||
import { erpAccountImportData } from '@jeesite/erp/api/erp/account';
|
||||
import { FileType } from 'ant-design-vue/es/upload/interface';
|
||||
import { AxiosProgressEvent } from 'axios';
|
||||
|
||||
const emit = defineEmits(['success', 'register']);
|
||||
|
||||
const { t } = useI18n('erp.account');
|
||||
const { showMessage, showMessageModal } = useMessage();
|
||||
|
||||
const fileList = ref<FileType[]>([]);
|
||||
const uploadInfo = ref('');
|
||||
|
||||
const beforeUpload = (file: FileType) => {
|
||||
fileList.value = [file];
|
||||
return false;
|
||||
};
|
||||
|
||||
const handleRemove = () => {
|
||||
fileList.value = [];
|
||||
};
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(() => {
|
||||
fileList.value = [];
|
||||
uploadInfo.value = '';
|
||||
});
|
||||
|
||||
async function handleDownloadTemplate() {
|
||||
const { ctxAdminPath } = useGlobSetting();
|
||||
downloadByUrl({ url: ctxAdminPath + '/erp/account/importTemplate' });
|
||||
}
|
||||
|
||||
function onUploadProgress(progressEvent: AxiosProgressEvent) {
|
||||
const complete = ((progressEvent.loaded / (progressEvent.total || 1)) * 100) | 0;
|
||||
if (complete != 100) {
|
||||
uploadInfo.value = t('正在导入,请稍候') + ' ' + complete + '%...';
|
||||
} else {
|
||||
uploadInfo.value = '';
|
||||
}
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
if (fileList.value.length == 0) {
|
||||
showMessage(t('请选择要导入的数据文件'));
|
||||
return;
|
||||
}
|
||||
setModalProps({ confirmLoading: true });
|
||||
const params = {
|
||||
file: fileList.value[0],
|
||||
};
|
||||
const { data } = await erpAccountImportData(params, onUploadProgress);
|
||||
showMessageModal({ content: data.message });
|
||||
setTimeout(closeModal);
|
||||
emit('success');
|
||||
} catch (error: any) {
|
||||
if (error && error.errorFields) {
|
||||
showMessage(error.message || t('common.validateError'));
|
||||
}
|
||||
console.log('error', error);
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
234
web-vue/packages/erp/views/erp/account/list.vue
Normal file
234
web-vue/packages/erp/views/erp/account/list.vue
Normal file
@@ -0,0 +1,234 @@
|
||||
<!--
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
* @author gaoxq
|
||||
-->
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable">
|
||||
<template #tableTitle>
|
||||
<Icon :icon="getTitle.icon" class="m-1 pr-1" />
|
||||
<span> {{ getTitle.value }} </span>
|
||||
</template>
|
||||
<template #toolbar>
|
||||
<a-button type="default" :loading="loading" @click="handleExport()">
|
||||
<Icon icon="i-ant-design:download-outlined" /> {{ t('导出') }}
|
||||
</a-button>
|
||||
<a-button type="primary" @click="handleForm({})" v-auth="'erp:account:edit'">
|
||||
<Icon icon="i-fluent:add-12-filled" /> {{ t('新增') }}
|
||||
</a-button>
|
||||
</template>
|
||||
<template #slotBizKey="{ record }">
|
||||
<a @click="handleForm({ accountId: record.accountId })" :title="record.accountName">
|
||||
{{ record.accountName }}
|
||||
</a>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<InputForm @register="registerDrawer" @success="handleSuccess" />
|
||||
<FormImport @register="registerImportModal" @success="handleSuccess" />
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup name="ViewsErpAccountList">
|
||||
import { onMounted, ref, unref } from 'vue';
|
||||
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
|
||||
import { useMessage } from '@jeesite/core/hooks/web/useMessage';
|
||||
import { useGlobSetting } from '@jeesite/core/hooks/setting';
|
||||
import { downloadByUrl } from '@jeesite/core/utils/file/download';
|
||||
import { router } from '@jeesite/core/router';
|
||||
import { Icon } from '@jeesite/core/components/Icon';
|
||||
import { BasicTable, BasicColumn, useTable } from '@jeesite/core/components/Table';
|
||||
import { ErpAccount, erpAccountList } from '@jeesite/erp/api/erp/account';
|
||||
import { erpAccountDelete, erpAccountListData } from '@jeesite/erp/api/erp/account';
|
||||
import { useDrawer } from '@jeesite/core/components/Drawer';
|
||||
import { useModal } from '@jeesite/core/components/Modal';
|
||||
import { FormProps } from '@jeesite/core/components/Form';
|
||||
import InputForm from './form.vue';
|
||||
import FormImport from './formImport.vue';
|
||||
|
||||
const { t } = useI18n('erp.account');
|
||||
const { showMessage } = useMessage();
|
||||
const { meta } = unref(router.currentRoute);
|
||||
const record = ref<ErpAccount>({} as ErpAccount);
|
||||
|
||||
const getTitle = {
|
||||
icon: meta.icon || 'i-ant-design:book-outlined',
|
||||
value: meta.title || t('账户信息管理'),
|
||||
};
|
||||
const loading = ref(false);
|
||||
|
||||
const searchForm: FormProps<ErpAccount> = {
|
||||
baseColProps: { md: 8, lg: 6 },
|
||||
labelWidth: 90,
|
||||
schemas: [
|
||||
{
|
||||
label: t('账户名称'),
|
||||
field: 'accountName',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: t('账户类型'),
|
||||
field: 'accountType',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
dictType: 'account_type',
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('是否激活'),
|
||||
field: 'isActive',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
dictType: 'is_active',
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const tableColumns: BasicColumn<ErpAccount>[] = [
|
||||
{
|
||||
title: t('记录时间'),
|
||||
dataIndex: 'createTime',
|
||||
key: 'a.create_time',
|
||||
sorter: true,
|
||||
width: 180,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('账户名称'),
|
||||
dataIndex: 'accountName',
|
||||
key: 'a.account_name',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
slot: 'slotBizKey',
|
||||
},
|
||||
{
|
||||
title: t('账户类型'),
|
||||
dataIndex: 'accountType',
|
||||
key: 'a.account_type',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
dictType: 'account_type',
|
||||
},
|
||||
{
|
||||
title: t('账户卡号'),
|
||||
dataIndex: 'accountCode',
|
||||
key: 'a.account_code',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('初始余额'),
|
||||
dataIndex: 'initialBalance',
|
||||
key: 'a.initial_balance',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'right',
|
||||
},
|
||||
{
|
||||
title: t('当前余额'),
|
||||
dataIndex: 'currentBalance',
|
||||
key: 'a.current_balance',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'right',
|
||||
},
|
||||
{
|
||||
title: t('是否激活'),
|
||||
dataIndex: 'isActive',
|
||||
key: 'a.is_active',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
dictType: 'is_active',
|
||||
},
|
||||
{
|
||||
title: t('更新时间'),
|
||||
dataIndex: 'updateTime',
|
||||
key: 'a.update_time',
|
||||
sorter: true,
|
||||
width: 180,
|
||||
align: 'center',
|
||||
},
|
||||
];
|
||||
|
||||
const actionColumn: BasicColumn<ErpAccount> = {
|
||||
width: 160,
|
||||
align: 'center',
|
||||
actions: (record: ErpAccount) => [
|
||||
{
|
||||
icon: 'i-clarity:note-edit-line',
|
||||
title: t('编辑'),
|
||||
onClick: handleForm.bind(this, { accountId: record.accountId }),
|
||||
auth: 'erp:account:edit',
|
||||
},
|
||||
{
|
||||
icon: 'i-ant-design:delete-outlined',
|
||||
color: 'error',
|
||||
title: t('删除'),
|
||||
popConfirm: {
|
||||
title: t('是否确认删除账户?'),
|
||||
confirm: handleDelete.bind(this, record),
|
||||
},
|
||||
auth: 'erp:account:edit',
|
||||
ifShow: record.isActive == '0'
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const [registerTable, { reload, getForm }] = useTable<ErpAccount>({
|
||||
api: erpAccountListData,
|
||||
beforeFetch: (params) => {
|
||||
return params;
|
||||
},
|
||||
columns: tableColumns,
|
||||
actionColumn: actionColumn,
|
||||
formConfig: searchForm,
|
||||
showTableSetting: true,
|
||||
useSearchForm: true,
|
||||
canResize: true,
|
||||
});
|
||||
|
||||
onMounted(async () => {
|
||||
const res = await erpAccountList();
|
||||
record.value = (res.erpAccount || {}) as ErpAccount;
|
||||
await getForm().setFieldsValue(record.value);
|
||||
});
|
||||
|
||||
const [registerDrawer, { openDrawer }] = useDrawer();
|
||||
|
||||
function handleForm(record: Recordable) {
|
||||
openDrawer(true, record);
|
||||
}
|
||||
|
||||
async function handleExport() {
|
||||
loading.value = true;
|
||||
const { ctxAdminPath } = useGlobSetting();
|
||||
await downloadByUrl({
|
||||
url: ctxAdminPath + '/erp/account/exportData',
|
||||
params: getForm().getFieldsValue(),
|
||||
});
|
||||
loading.value = false;
|
||||
}
|
||||
|
||||
const [registerImportModal, { openModal: importModal }] = useModal();
|
||||
|
||||
function handleImport() {
|
||||
importModal(true, {});
|
||||
}
|
||||
|
||||
async function handleDelete(record: Recordable) {
|
||||
const params = { accountId: record.accountId };
|
||||
const res = await erpAccountDelete(params);
|
||||
showMessage(res.message);
|
||||
await handleSuccess(record);
|
||||
}
|
||||
|
||||
async function handleSuccess(record: Recordable) {
|
||||
await reload({ record });
|
||||
}
|
||||
</script>
|
||||
142
web-vue/packages/erp/views/erp/category/form.vue
Normal file
142
web-vue/packages/erp/views/erp/category/form.vue
Normal file
@@ -0,0 +1,142 @@
|
||||
<!--
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
* @author gaoxq
|
||||
-->
|
||||
<template>
|
||||
<BasicDrawer
|
||||
v-bind="$attrs"
|
||||
:showFooter="true"
|
||||
:okAuth="'erp:category:edit'"
|
||||
@register="registerDrawer"
|
||||
@ok="handleSubmit"
|
||||
width="40%"
|
||||
>
|
||||
<template #title>
|
||||
<Icon :icon="getTitle.icon" class="m-1 pr-1" />
|
||||
<span> {{ getTitle.value }} </span>
|
||||
</template>
|
||||
<BasicForm @register="registerForm" />
|
||||
</BasicDrawer>
|
||||
</template>
|
||||
<script lang="ts" setup name="ViewsErpCategoryForm">
|
||||
import { ref, unref, computed } from 'vue';
|
||||
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
|
||||
import { useMessage } from '@jeesite/core/hooks/web/useMessage';
|
||||
import { router } from '@jeesite/core/router';
|
||||
import { Icon } from '@jeesite/core/components/Icon';
|
||||
import { BasicForm, FormSchema, useForm } from '@jeesite/core/components/Form';
|
||||
import { BasicDrawer, useDrawerInner } from '@jeesite/core/components/Drawer';
|
||||
import { ErpCategory, erpCategorySave, erpCategoryForm } from '@jeesite/erp/api/erp/category';
|
||||
|
||||
const emit = defineEmits(['success', 'register']);
|
||||
|
||||
const { t } = useI18n('erp.category');
|
||||
const { showMessage } = useMessage();
|
||||
const { meta } = unref(router.currentRoute);
|
||||
const record = ref<ErpCategory>({} as ErpCategory);
|
||||
|
||||
const getTitle = computed(() => ({
|
||||
icon: meta.icon || 'i-ant-design:book-outlined',
|
||||
value: record.value.isNewRecord ? t('新增分类信息') : t('编辑分类信息'),
|
||||
}));
|
||||
|
||||
const inputFormSchemas: FormSchema<ErpCategory>[] = [
|
||||
{
|
||||
label: t('记录时间'),
|
||||
field: 'createTime',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
format: 'YYYY-MM-DD HH:mm',
|
||||
showTime: { format: 'HH:mm' },
|
||||
},
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: t('分类名称'),
|
||||
field: 'categoryName',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
maxlength: 50,
|
||||
},
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: t('分类类型'),
|
||||
field: 'categoryType',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
dictType: 'category_type',
|
||||
allowClear: true,
|
||||
},
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: t('父级分类'),
|
||||
field: 'parentId',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
dictType: 'parent_type',
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('排序序号'),
|
||||
field: 'sortOrder',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
maxlength: 32,
|
||||
},
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: t('是否启用'),
|
||||
field: 'isActive',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
dictType: 'is_active',
|
||||
allowClear: true,
|
||||
},
|
||||
required: true,
|
||||
},
|
||||
];
|
||||
|
||||
const [registerForm, { resetFields, setFieldsValue, validate }] = useForm<ErpCategory>({
|
||||
labelWidth: 120,
|
||||
schemas: inputFormSchemas,
|
||||
baseColProps: { md: 24, lg: 12 },
|
||||
});
|
||||
|
||||
const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {
|
||||
setDrawerProps({ loading: true });
|
||||
await resetFields();
|
||||
const res = await erpCategoryForm(data);
|
||||
record.value = (res.erpCategory || {}) as ErpCategory;
|
||||
record.value.__t = new Date().getTime();
|
||||
await setFieldsValue(record.value);
|
||||
setDrawerProps({ loading: false });
|
||||
});
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const data = await validate();
|
||||
setDrawerProps({ confirmLoading: true });
|
||||
const params: any = {
|
||||
isNewRecord: record.value.isNewRecord,
|
||||
categoryId: record.value.categoryId || data.categoryId,
|
||||
};
|
||||
// console.log('submit', params, data, record);
|
||||
const res = await erpCategorySave(params, data);
|
||||
showMessage(res.message);
|
||||
setTimeout(closeDrawer);
|
||||
emit('success', data);
|
||||
} catch (error: any) {
|
||||
if (error && error.errorFields) {
|
||||
showMessage(error.message || t('common.validateError'));
|
||||
}
|
||||
console.log('error', error);
|
||||
} finally {
|
||||
setDrawerProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
103
web-vue/packages/erp/views/erp/category/formImport.vue
Normal file
103
web-vue/packages/erp/views/erp/category/formImport.vue
Normal file
@@ -0,0 +1,103 @@
|
||||
<!--
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
* @author gaoxq
|
||||
-->
|
||||
<template>
|
||||
<BasicModal
|
||||
v-bind="$attrs"
|
||||
:title="t('导入分类信息')"
|
||||
:okText="t('导入')"
|
||||
@register="registerModal"
|
||||
@ok="handleSubmit"
|
||||
:minHeight="120"
|
||||
:width="400"
|
||||
>
|
||||
<Upload accept=".xls,.xlsx" :file-list="fileList" :before-upload="beforeUpload" @remove="handleRemove">
|
||||
<a-button> <Icon icon="ant-design:upload-outlined" /> {{ t('选择文件') }} </a-button>
|
||||
<span class="ml-4">{{ uploadInfo }}</span>
|
||||
</Upload>
|
||||
<div class="ml-4 mt-4">
|
||||
{{ t('提示:仅允许导入“xls”或“xlsx”格式文件!') }}
|
||||
</div>
|
||||
<div class="mt-4">
|
||||
<a-button @click="handleDownloadTemplate()" type="text">
|
||||
<Icon icon="i-fa:file-excel-o" />
|
||||
{{ t('下载模板') }}
|
||||
</a-button>
|
||||
</div>
|
||||
</BasicModal>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import { Upload } from 'ant-design-vue';
|
||||
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
|
||||
import { useMessage } from '@jeesite/core/hooks/web/useMessage';
|
||||
import { useGlobSetting } from '@jeesite/core/hooks/setting';
|
||||
import { downloadByUrl } from '@jeesite/core/utils/file/download';
|
||||
import { Icon } from '@jeesite/core/components/Icon';
|
||||
import { BasicModal, useModalInner } from '@jeesite/core/components/Modal';
|
||||
import { erpCategoryImportData } from '@jeesite/erp/api/erp/category';
|
||||
import { FileType } from 'ant-design-vue/es/upload/interface';
|
||||
import { AxiosProgressEvent } from 'axios';
|
||||
|
||||
const emit = defineEmits(['success', 'register']);
|
||||
|
||||
const { t } = useI18n('erp.category');
|
||||
const { showMessage, showMessageModal } = useMessage();
|
||||
|
||||
const fileList = ref<FileType[]>([]);
|
||||
const uploadInfo = ref('');
|
||||
|
||||
const beforeUpload = (file: FileType) => {
|
||||
fileList.value = [file];
|
||||
return false;
|
||||
};
|
||||
|
||||
const handleRemove = () => {
|
||||
fileList.value = [];
|
||||
};
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(() => {
|
||||
fileList.value = [];
|
||||
uploadInfo.value = '';
|
||||
});
|
||||
|
||||
async function handleDownloadTemplate() {
|
||||
const { ctxAdminPath } = useGlobSetting();
|
||||
downloadByUrl({ url: ctxAdminPath + '/erp/category/importTemplate' });
|
||||
}
|
||||
|
||||
function onUploadProgress(progressEvent: AxiosProgressEvent) {
|
||||
const complete = ((progressEvent.loaded / (progressEvent.total || 1)) * 100) | 0;
|
||||
if (complete != 100) {
|
||||
uploadInfo.value = t('正在导入,请稍候') + ' ' + complete + '%...';
|
||||
} else {
|
||||
uploadInfo.value = '';
|
||||
}
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
if (fileList.value.length == 0) {
|
||||
showMessage(t('请选择要导入的数据文件'));
|
||||
return;
|
||||
}
|
||||
setModalProps({ confirmLoading: true });
|
||||
const params = {
|
||||
file: fileList.value[0],
|
||||
};
|
||||
const { data } = await erpCategoryImportData(params, onUploadProgress);
|
||||
showMessageModal({ content: data.message });
|
||||
setTimeout(closeModal);
|
||||
emit('success');
|
||||
} catch (error: any) {
|
||||
if (error && error.errorFields) {
|
||||
showMessage(error.message || t('common.validateError'));
|
||||
}
|
||||
console.log('error', error);
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
227
web-vue/packages/erp/views/erp/category/list.vue
Normal file
227
web-vue/packages/erp/views/erp/category/list.vue
Normal file
@@ -0,0 +1,227 @@
|
||||
<!--
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
* @author gaoxq
|
||||
-->
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable">
|
||||
<template #tableTitle>
|
||||
<Icon :icon="getTitle.icon" class="m-1 pr-1" />
|
||||
<span> {{ getTitle.value }} </span>
|
||||
</template>
|
||||
<template #toolbar>
|
||||
<a-button type="default" :loading="loading" @click="handleExport()">
|
||||
<Icon icon="i-ant-design:download-outlined" /> {{ t('导出') }}
|
||||
</a-button>
|
||||
<a-button type="primary" @click="handleForm({})" v-auth="'erp:category:edit'">
|
||||
<Icon icon="i-fluent:add-12-filled" /> {{ t('新增') }}
|
||||
</a-button>
|
||||
</template>
|
||||
<template #slotBizKey="{ record }">
|
||||
<a @click="handleForm({ categoryId: record.categoryId })" :title="record.categoryName">
|
||||
{{ record.categoryName }}
|
||||
</a>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<InputForm @register="registerDrawer" @success="handleSuccess" />
|
||||
<FormImport @register="registerImportModal" @success="handleSuccess" />
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup name="ViewsErpCategoryList">
|
||||
import { onMounted, ref, unref } from 'vue';
|
||||
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
|
||||
import { useMessage } from '@jeesite/core/hooks/web/useMessage';
|
||||
import { useGlobSetting } from '@jeesite/core/hooks/setting';
|
||||
import { downloadByUrl } from '@jeesite/core/utils/file/download';
|
||||
import { router } from '@jeesite/core/router';
|
||||
import { Icon } from '@jeesite/core/components/Icon';
|
||||
import { BasicTable, BasicColumn, useTable } from '@jeesite/core/components/Table';
|
||||
import { ErpCategory, erpCategoryList } from '@jeesite/erp/api/erp/category';
|
||||
import { erpCategoryDelete, erpCategoryListData } from '@jeesite/erp/api/erp/category';
|
||||
import { useDrawer } from '@jeesite/core/components/Drawer';
|
||||
import { useModal } from '@jeesite/core/components/Modal';
|
||||
import { FormProps } from '@jeesite/core/components/Form';
|
||||
import InputForm from './form.vue';
|
||||
import FormImport from './formImport.vue';
|
||||
|
||||
const { t } = useI18n('erp.category');
|
||||
const { showMessage } = useMessage();
|
||||
const { meta } = unref(router.currentRoute);
|
||||
const record = ref<ErpCategory>({} as ErpCategory);
|
||||
|
||||
const getTitle = {
|
||||
icon: meta.icon || 'i-ant-design:book-outlined',
|
||||
value: meta.title || t('分类信息管理'),
|
||||
};
|
||||
const loading = ref(false);
|
||||
|
||||
const searchForm: FormProps<ErpCategory> = {
|
||||
baseColProps: { md: 8, lg: 6 },
|
||||
labelWidth: 90,
|
||||
schemas: [
|
||||
{
|
||||
label: t('分类名称'),
|
||||
field: 'categoryName',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: t('分类类型'),
|
||||
field: 'categoryType',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
dictType: 'category_type',
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('是否启用'),
|
||||
field: 'isActive',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
dictType: 'is_active',
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const tableColumns: BasicColumn<ErpCategory>[] = [
|
||||
{
|
||||
title: t('记录时间'),
|
||||
dataIndex: 'createTime',
|
||||
key: 'a.create_time',
|
||||
sorter: true,
|
||||
width: 180,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('分类名称'),
|
||||
dataIndex: 'categoryName',
|
||||
key: 'a.category_name',
|
||||
sorter: true,
|
||||
width: 200,
|
||||
align: 'left',
|
||||
slot: 'slotBizKey',
|
||||
},
|
||||
{
|
||||
title: t('分类类型'),
|
||||
dataIndex: 'categoryType',
|
||||
key: 'a.category_type',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
dictType: 'category_type',
|
||||
},
|
||||
{
|
||||
title: t('父级分类'),
|
||||
dataIndex: 'parentId',
|
||||
key: 'a.parent_id',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
dictType: 'parent_type',
|
||||
},
|
||||
{
|
||||
title: t('排序序号'),
|
||||
dataIndex: 'sortOrder',
|
||||
key: 'a.sort_order',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('是否启用'),
|
||||
dataIndex: 'isActive',
|
||||
key: 'a.is_active',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
dictType: 'is_active',
|
||||
},
|
||||
{
|
||||
title: t('更新时间'),
|
||||
dataIndex: 'updateTime',
|
||||
key: 'a.update_time',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'center',
|
||||
},
|
||||
];
|
||||
|
||||
const actionColumn: BasicColumn<ErpCategory> = {
|
||||
width: 160,
|
||||
align: 'center',
|
||||
actions: (record: ErpCategory) => [
|
||||
{
|
||||
icon: 'i-clarity:note-edit-line',
|
||||
title: t('编辑'),
|
||||
onClick: handleForm.bind(this, { categoryId: record.categoryId }),
|
||||
auth: 'erp:category:edit',
|
||||
},
|
||||
{
|
||||
icon: 'i-ant-design:delete-outlined',
|
||||
color: 'error',
|
||||
title: t('删除'),
|
||||
popConfirm: {
|
||||
title: t('是否确认删除分类信息?'),
|
||||
confirm: handleDelete.bind(this, record),
|
||||
},
|
||||
auth: 'erp:category:edit',
|
||||
ifShow: record.isActive == '0'
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const [registerTable, { reload, getForm }] = useTable<ErpCategory>({
|
||||
api: erpCategoryListData,
|
||||
beforeFetch: (params) => {
|
||||
return params;
|
||||
},
|
||||
columns: tableColumns,
|
||||
actionColumn: actionColumn,
|
||||
formConfig: searchForm,
|
||||
showTableSetting: true,
|
||||
useSearchForm: true,
|
||||
canResize: true,
|
||||
});
|
||||
|
||||
onMounted(async () => {
|
||||
const res = await erpCategoryList();
|
||||
record.value = (res.erpCategory || {}) as ErpCategory;
|
||||
await getForm().setFieldsValue(record.value);
|
||||
});
|
||||
|
||||
const [registerDrawer, { openDrawer }] = useDrawer();
|
||||
|
||||
function handleForm(record: Recordable) {
|
||||
openDrawer(true, record);
|
||||
}
|
||||
|
||||
async function handleExport() {
|
||||
loading.value = true;
|
||||
const { ctxAdminPath } = useGlobSetting();
|
||||
await downloadByUrl({
|
||||
url: ctxAdminPath + '/erp/category/exportData',
|
||||
params: getForm().getFieldsValue(),
|
||||
});
|
||||
loading.value = false;
|
||||
}
|
||||
|
||||
const [registerImportModal, { openModal: importModal }] = useModal();
|
||||
|
||||
function handleImport() {
|
||||
importModal(true, {});
|
||||
}
|
||||
|
||||
async function handleDelete(record: Recordable) {
|
||||
const params = { categoryId: record.categoryId };
|
||||
const res = await erpCategoryDelete(params);
|
||||
showMessage(res.message);
|
||||
await handleSuccess(record);
|
||||
}
|
||||
|
||||
async function handleSuccess(record: Recordable) {
|
||||
await reload({ record });
|
||||
}
|
||||
</script>
|
||||
103
web-vue/packages/erp/views/erp/expense/formImport.vue
Normal file
103
web-vue/packages/erp/views/erp/expense/formImport.vue
Normal file
@@ -0,0 +1,103 @@
|
||||
<!--
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
* @author gaoxq
|
||||
-->
|
||||
<template>
|
||||
<BasicModal
|
||||
v-bind="$attrs"
|
||||
:title="t('导入支出信息')"
|
||||
:okText="t('导入')"
|
||||
@register="registerModal"
|
||||
@ok="handleSubmit"
|
||||
:minHeight="120"
|
||||
:width="400"
|
||||
>
|
||||
<Upload accept=".xls,.xlsx" :file-list="fileList" :before-upload="beforeUpload" @remove="handleRemove">
|
||||
<a-button> <Icon icon="ant-design:upload-outlined" /> {{ t('选择文件') }} </a-button>
|
||||
<span class="ml-4">{{ uploadInfo }}</span>
|
||||
</Upload>
|
||||
<div class="ml-4 mt-4">
|
||||
{{ t('提示:仅允许导入“xls”或“xlsx”格式文件!') }}
|
||||
</div>
|
||||
<div class="mt-4">
|
||||
<a-button @click="handleDownloadTemplate()" type="text">
|
||||
<Icon icon="i-fa:file-excel-o" />
|
||||
{{ t('下载模板') }}
|
||||
</a-button>
|
||||
</div>
|
||||
</BasicModal>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import { Upload } from 'ant-design-vue';
|
||||
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
|
||||
import { useMessage } from '@jeesite/core/hooks/web/useMessage';
|
||||
import { useGlobSetting } from '@jeesite/core/hooks/setting';
|
||||
import { downloadByUrl } from '@jeesite/core/utils/file/download';
|
||||
import { Icon } from '@jeesite/core/components/Icon';
|
||||
import { BasicModal, useModalInner } from '@jeesite/core/components/Modal';
|
||||
import { erpExpenseImportData } from '@jeesite/erp/api/erp/expense';
|
||||
import { FileType } from 'ant-design-vue/es/upload/interface';
|
||||
import { AxiosProgressEvent } from 'axios';
|
||||
|
||||
const emit = defineEmits(['success', 'register']);
|
||||
|
||||
const { t } = useI18n('erp.expense');
|
||||
const { showMessage, showMessageModal } = useMessage();
|
||||
|
||||
const fileList = ref<FileType[]>([]);
|
||||
const uploadInfo = ref('');
|
||||
|
||||
const beforeUpload = (file: FileType) => {
|
||||
fileList.value = [file];
|
||||
return false;
|
||||
};
|
||||
|
||||
const handleRemove = () => {
|
||||
fileList.value = [];
|
||||
};
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(() => {
|
||||
fileList.value = [];
|
||||
uploadInfo.value = '';
|
||||
});
|
||||
|
||||
async function handleDownloadTemplate() {
|
||||
const { ctxAdminPath } = useGlobSetting();
|
||||
downloadByUrl({ url: ctxAdminPath + '/erp/expense/importTemplate' });
|
||||
}
|
||||
|
||||
function onUploadProgress(progressEvent: AxiosProgressEvent) {
|
||||
const complete = ((progressEvent.loaded / (progressEvent.total || 1)) * 100) | 0;
|
||||
if (complete != 100) {
|
||||
uploadInfo.value = t('正在导入,请稍候') + ' ' + complete + '%...';
|
||||
} else {
|
||||
uploadInfo.value = '';
|
||||
}
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
if (fileList.value.length == 0) {
|
||||
showMessage(t('请选择要导入的数据文件'));
|
||||
return;
|
||||
}
|
||||
setModalProps({ confirmLoading: true });
|
||||
const params = {
|
||||
file: fileList.value[0],
|
||||
};
|
||||
const { data } = await erpExpenseImportData(params, onUploadProgress);
|
||||
showMessageModal({ content: data.message });
|
||||
setTimeout(closeModal);
|
||||
emit('success');
|
||||
} catch (error: any) {
|
||||
if (error && error.errorFields) {
|
||||
showMessage(error.message || t('common.validateError'));
|
||||
}
|
||||
console.log('error', error);
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
213
web-vue/packages/erp/views/erp/expense/list.vue
Normal file
213
web-vue/packages/erp/views/erp/expense/list.vue
Normal file
@@ -0,0 +1,213 @@
|
||||
<!--
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
* @author gaoxq
|
||||
-->
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable">
|
||||
<template #tableTitle>
|
||||
<Icon :icon="getTitle.icon" class="m-1 pr-1" />
|
||||
<span> {{ getTitle.value }} </span>
|
||||
</template>
|
||||
<template #toolbar>
|
||||
<a-button type="default" :loading="loading" @click="handleExport()">
|
||||
<Icon icon="i-ant-design:download-outlined" /> {{ t('导出') }}
|
||||
</a-button>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<InputForm @register="registerDrawer" @success="handleSuccess" />
|
||||
<FormImport @register="registerImportModal" @success="handleSuccess" />
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup name="ViewsErpExpenseList">
|
||||
import { onMounted, ref, unref } from 'vue';
|
||||
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
|
||||
import { useMessage } from '@jeesite/core/hooks/web/useMessage';
|
||||
import { useGlobSetting } from '@jeesite/core/hooks/setting';
|
||||
import { downloadByUrl } from '@jeesite/core/utils/file/download';
|
||||
import { router } from '@jeesite/core/router';
|
||||
import { Icon } from '@jeesite/core/components/Icon';
|
||||
import { BasicTable, BasicColumn, useTable } from '@jeesite/core/components/Table';
|
||||
import { ErpExpense, erpExpenseList } from '@jeesite/erp/api/erp/expense';
|
||||
import { erpExpenseDelete, erpExpenseListData } from '@jeesite/erp/api/erp/expense';
|
||||
import { useDrawer } from '@jeesite/core/components/Drawer';
|
||||
import { useModal } from '@jeesite/core/components/Modal';
|
||||
import { FormProps } from '@jeesite/core/components/Form';
|
||||
import FormImport from './formImport.vue';
|
||||
|
||||
const { t } = useI18n('erp.expense');
|
||||
const { showMessage } = useMessage();
|
||||
const { meta } = unref(router.currentRoute);
|
||||
const record = ref<ErpExpense>({} as ErpExpense);
|
||||
|
||||
const getTitle = {
|
||||
icon: meta.icon || 'i-ant-design:book-outlined',
|
||||
value: meta.title || t('支出信息管理'),
|
||||
};
|
||||
const loading = ref(false);
|
||||
|
||||
const searchForm: FormProps<ErpExpense> = {
|
||||
baseColProps: { md: 8, lg: 6 },
|
||||
labelWidth: 90,
|
||||
schemas: [
|
||||
{
|
||||
label: t('记录时间起'),
|
||||
field: 'createTime_gte',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
format: 'YYYY-MM-DD HH:mm',
|
||||
showTime: { format: 'HH:mm' },
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('记录时间止'),
|
||||
field: 'createTime_lte',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
format: 'YYYY-MM-DD HH:mm',
|
||||
showTime: { format: 'HH:mm' },
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('交易分类'),
|
||||
field: 'categoryId',
|
||||
fieldLabel: 'categoryName',
|
||||
component: 'ListSelect',
|
||||
componentProps: {
|
||||
selectType: 'erpCategorySelect',
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const tableColumns: BasicColumn<ErpExpense>[] = [
|
||||
{
|
||||
title: t('记录时间'),
|
||||
dataIndex: 'createTime',
|
||||
key: 'a.create_time',
|
||||
sorter: true,
|
||||
width: 180,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('交易账号'),
|
||||
dataIndex: 'accountName',
|
||||
key: 'b.account_name',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('父级分类'),
|
||||
dataIndex: 'parentId',
|
||||
key: 'c.parent_id',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
dictType: 'parent_type',
|
||||
},
|
||||
{
|
||||
title: t('分类名称'),
|
||||
dataIndex: 'categoryName',
|
||||
key: 'c.category_name',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('交易名称'),
|
||||
dataIndex: 'flowName',
|
||||
key: 'd.flow_name',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('交易金额'),
|
||||
dataIndex: 'amount',
|
||||
key: 'a.amount',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'right',
|
||||
},
|
||||
{
|
||||
title: t('更新时间'),
|
||||
dataIndex: 'updateTime',
|
||||
key: 'a.update_time',
|
||||
sorter: true,
|
||||
width: 180,
|
||||
align: 'center',
|
||||
},
|
||||
];
|
||||
|
||||
const actionColumn: BasicColumn<ErpExpense> = {
|
||||
width: 160,
|
||||
align: 'center',
|
||||
actions: (record: ErpExpense) => [
|
||||
{
|
||||
icon: 'i-ant-design:delete-outlined',
|
||||
color: 'error',
|
||||
title: t('删除'),
|
||||
popConfirm: {
|
||||
title: t('是否确认删除支出信息?'),
|
||||
confirm: handleDelete.bind(this, record),
|
||||
},
|
||||
auth: 'erp:expense:edit',
|
||||
ifShow: record.isFinish == '0'
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const [registerTable, { reload, getForm }] = useTable<ErpExpense>({
|
||||
api: erpExpenseListData,
|
||||
beforeFetch: (params) => {
|
||||
return params;
|
||||
},
|
||||
columns: tableColumns,
|
||||
actionColumn: actionColumn,
|
||||
formConfig: searchForm,
|
||||
showTableSetting: true,
|
||||
useSearchForm: true,
|
||||
canResize: true,
|
||||
});
|
||||
|
||||
onMounted(async () => {
|
||||
const res = await erpExpenseList();
|
||||
record.value = (res.erpExpense || {}) as ErpExpense;
|
||||
await getForm().setFieldsValue(record.value);
|
||||
});
|
||||
|
||||
const [registerDrawer, { openDrawer }] = useDrawer();
|
||||
|
||||
function handleForm(record: Recordable) {
|
||||
openDrawer(true, record);
|
||||
}
|
||||
|
||||
async function handleExport() {
|
||||
loading.value = true;
|
||||
const { ctxAdminPath } = useGlobSetting();
|
||||
await downloadByUrl({
|
||||
url: ctxAdminPath + '/erp/expense/exportData',
|
||||
params: getForm().getFieldsValue(),
|
||||
});
|
||||
loading.value = false;
|
||||
}
|
||||
|
||||
const [registerImportModal, { openModal: importModal }] = useModal();
|
||||
|
||||
function handleImport() {
|
||||
importModal(true, {});
|
||||
}
|
||||
|
||||
async function handleDelete(record: Recordable) {
|
||||
const params = { expenseId: record.expenseId };
|
||||
const res = await erpExpenseDelete(params);
|
||||
showMessage(res.message);
|
||||
await handleSuccess(record);
|
||||
}
|
||||
|
||||
async function handleSuccess(record: Recordable) {
|
||||
await reload({ record });
|
||||
}
|
||||
</script>
|
||||
103
web-vue/packages/erp/views/erp/income/formImport.vue
Normal file
103
web-vue/packages/erp/views/erp/income/formImport.vue
Normal file
@@ -0,0 +1,103 @@
|
||||
<!--
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
* @author gaoxq
|
||||
-->
|
||||
<template>
|
||||
<BasicModal
|
||||
v-bind="$attrs"
|
||||
:title="t('导入收入信息')"
|
||||
:okText="t('导入')"
|
||||
@register="registerModal"
|
||||
@ok="handleSubmit"
|
||||
:minHeight="120"
|
||||
:width="400"
|
||||
>
|
||||
<Upload accept=".xls,.xlsx" :file-list="fileList" :before-upload="beforeUpload" @remove="handleRemove">
|
||||
<a-button> <Icon icon="ant-design:upload-outlined" /> {{ t('选择文件') }} </a-button>
|
||||
<span class="ml-4">{{ uploadInfo }}</span>
|
||||
</Upload>
|
||||
<div class="ml-4 mt-4">
|
||||
{{ t('提示:仅允许导入“xls”或“xlsx”格式文件!') }}
|
||||
</div>
|
||||
<div class="mt-4">
|
||||
<a-button @click="handleDownloadTemplate()" type="text">
|
||||
<Icon icon="i-fa:file-excel-o" />
|
||||
{{ t('下载模板') }}
|
||||
</a-button>
|
||||
</div>
|
||||
</BasicModal>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import { Upload } from 'ant-design-vue';
|
||||
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
|
||||
import { useMessage } from '@jeesite/core/hooks/web/useMessage';
|
||||
import { useGlobSetting } from '@jeesite/core/hooks/setting';
|
||||
import { downloadByUrl } from '@jeesite/core/utils/file/download';
|
||||
import { Icon } from '@jeesite/core/components/Icon';
|
||||
import { BasicModal, useModalInner } from '@jeesite/core/components/Modal';
|
||||
import { erpIncomeImportData } from '@jeesite/erp/api/erp/income';
|
||||
import { FileType } from 'ant-design-vue/es/upload/interface';
|
||||
import { AxiosProgressEvent } from 'axios';
|
||||
|
||||
const emit = defineEmits(['success', 'register']);
|
||||
|
||||
const { t } = useI18n('erp.income');
|
||||
const { showMessage, showMessageModal } = useMessage();
|
||||
|
||||
const fileList = ref<FileType[]>([]);
|
||||
const uploadInfo = ref('');
|
||||
|
||||
const beforeUpload = (file: FileType) => {
|
||||
fileList.value = [file];
|
||||
return false;
|
||||
};
|
||||
|
||||
const handleRemove = () => {
|
||||
fileList.value = [];
|
||||
};
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(() => {
|
||||
fileList.value = [];
|
||||
uploadInfo.value = '';
|
||||
});
|
||||
|
||||
async function handleDownloadTemplate() {
|
||||
const { ctxAdminPath } = useGlobSetting();
|
||||
downloadByUrl({ url: ctxAdminPath + '/erp/income/importTemplate' });
|
||||
}
|
||||
|
||||
function onUploadProgress(progressEvent: AxiosProgressEvent) {
|
||||
const complete = ((progressEvent.loaded / (progressEvent.total || 1)) * 100) | 0;
|
||||
if (complete != 100) {
|
||||
uploadInfo.value = t('正在导入,请稍候') + ' ' + complete + '%...';
|
||||
} else {
|
||||
uploadInfo.value = '';
|
||||
}
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
if (fileList.value.length == 0) {
|
||||
showMessage(t('请选择要导入的数据文件'));
|
||||
return;
|
||||
}
|
||||
setModalProps({ confirmLoading: true });
|
||||
const params = {
|
||||
file: fileList.value[0],
|
||||
};
|
||||
const { data } = await erpIncomeImportData(params, onUploadProgress);
|
||||
showMessageModal({ content: data.message });
|
||||
setTimeout(closeModal);
|
||||
emit('success');
|
||||
} catch (error: any) {
|
||||
if (error && error.errorFields) {
|
||||
showMessage(error.message || t('common.validateError'));
|
||||
}
|
||||
console.log('error', error);
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
213
web-vue/packages/erp/views/erp/income/list.vue
Normal file
213
web-vue/packages/erp/views/erp/income/list.vue
Normal file
@@ -0,0 +1,213 @@
|
||||
<!--
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
* @author gaoxq
|
||||
-->
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable">
|
||||
<template #tableTitle>
|
||||
<Icon :icon="getTitle.icon" class="m-1 pr-1" />
|
||||
<span> {{ getTitle.value }} </span>
|
||||
</template>
|
||||
<template #toolbar>
|
||||
<a-button type="default" :loading="loading" @click="handleExport()">
|
||||
<Icon icon="i-ant-design:download-outlined" /> {{ t('导出') }}
|
||||
</a-button>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<InputForm @register="registerDrawer" @success="handleSuccess" />
|
||||
<FormImport @register="registerImportModal" @success="handleSuccess" />
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup name="ViewsErpIncomeList">
|
||||
import { onMounted, ref, unref } from 'vue';
|
||||
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
|
||||
import { useMessage } from '@jeesite/core/hooks/web/useMessage';
|
||||
import { useGlobSetting } from '@jeesite/core/hooks/setting';
|
||||
import { downloadByUrl } from '@jeesite/core/utils/file/download';
|
||||
import { router } from '@jeesite/core/router';
|
||||
import { Icon } from '@jeesite/core/components/Icon';
|
||||
import { BasicTable, BasicColumn, useTable } from '@jeesite/core/components/Table';
|
||||
import { ErpIncome, erpIncomeList } from '@jeesite/erp/api/erp/income';
|
||||
import { erpIncomeDelete, erpIncomeListData } from '@jeesite/erp/api/erp/income';
|
||||
import { useDrawer } from '@jeesite/core/components/Drawer';
|
||||
import { useModal } from '@jeesite/core/components/Modal';
|
||||
import { FormProps } from '@jeesite/core/components/Form';
|
||||
import FormImport from './formImport.vue';
|
||||
|
||||
const { t } = useI18n('erp.income');
|
||||
const { showMessage } = useMessage();
|
||||
const { meta } = unref(router.currentRoute);
|
||||
const record = ref<ErpIncome>({} as ErpIncome);
|
||||
|
||||
const getTitle = {
|
||||
icon: meta.icon || 'i-ant-design:book-outlined',
|
||||
value: meta.title || t('收入信息管理'),
|
||||
};
|
||||
const loading = ref(false);
|
||||
|
||||
const searchForm: FormProps<ErpIncome> = {
|
||||
baseColProps: { md: 8, lg: 6 },
|
||||
labelWidth: 90,
|
||||
schemas: [
|
||||
{
|
||||
label: t('记录时间起'),
|
||||
field: 'createTime_gte',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
format: 'YYYY-MM-DD HH:mm',
|
||||
showTime: { format: 'HH:mm' },
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('记录时间止'),
|
||||
field: 'createTime_lte',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
format: 'YYYY-MM-DD HH:mm',
|
||||
showTime: { format: 'HH:mm' },
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('交易分类'),
|
||||
field: 'categoryId',
|
||||
fieldLabel: 'categoryName',
|
||||
component: 'ListSelect',
|
||||
componentProps: {
|
||||
selectType: 'erpCategorySelect',
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const tableColumns: BasicColumn<ErpIncome>[] = [
|
||||
{
|
||||
title: t('记录时间'),
|
||||
dataIndex: 'createTime',
|
||||
key: 'a.create_time',
|
||||
sorter: true,
|
||||
width: 180,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('交易账号'),
|
||||
dataIndex: 'accountName',
|
||||
key: 'b.account_name',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('父级分类'),
|
||||
dataIndex: 'parentId',
|
||||
key: 'c.parent_id',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
dictType: 'parent_type',
|
||||
},
|
||||
{
|
||||
title: t('分类名称'),
|
||||
dataIndex: 'categoryName',
|
||||
key: 'c.category_name',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('交易名称'),
|
||||
dataIndex: 'flowName',
|
||||
key: 'd.flow_name',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('交易金额'),
|
||||
dataIndex: 'amount',
|
||||
key: 'a.amount',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'right',
|
||||
},
|
||||
{
|
||||
title: t('更新时间'),
|
||||
dataIndex: 'updateTime',
|
||||
key: 'a.update_time',
|
||||
sorter: true,
|
||||
width: 180,
|
||||
align: 'center',
|
||||
},
|
||||
];
|
||||
|
||||
const actionColumn: BasicColumn<ErpIncome> = {
|
||||
width: 160,
|
||||
align: 'center',
|
||||
actions: (record: ErpIncome) => [
|
||||
{
|
||||
icon: 'i-ant-design:delete-outlined',
|
||||
color: 'error',
|
||||
title: t('删除'),
|
||||
popConfirm: {
|
||||
title: t('是否确认删除收入信息?'),
|
||||
confirm: handleDelete.bind(this, record),
|
||||
},
|
||||
auth: 'erp:income:edit',
|
||||
ifShow: record.isFinish == '0'
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const [registerTable, { reload, getForm }] = useTable<ErpIncome>({
|
||||
api: erpIncomeListData,
|
||||
beforeFetch: (params) => {
|
||||
return params;
|
||||
},
|
||||
columns: tableColumns,
|
||||
actionColumn: actionColumn,
|
||||
formConfig: searchForm,
|
||||
showTableSetting: true,
|
||||
useSearchForm: true,
|
||||
canResize: true,
|
||||
});
|
||||
|
||||
onMounted(async () => {
|
||||
const res = await erpIncomeList();
|
||||
record.value = (res.erpIncome || {}) as ErpIncome;
|
||||
await getForm().setFieldsValue(record.value);
|
||||
});
|
||||
|
||||
const [registerDrawer, { openDrawer }] = useDrawer();
|
||||
|
||||
function handleForm(record: Recordable) {
|
||||
openDrawer(true, record);
|
||||
}
|
||||
|
||||
async function handleExport() {
|
||||
loading.value = true;
|
||||
const { ctxAdminPath } = useGlobSetting();
|
||||
await downloadByUrl({
|
||||
url: ctxAdminPath + '/erp/income/exportData',
|
||||
params: getForm().getFieldsValue(),
|
||||
});
|
||||
loading.value = false;
|
||||
}
|
||||
|
||||
const [registerImportModal, { openModal: importModal }] = useModal();
|
||||
|
||||
function handleImport() {
|
||||
importModal(true, {});
|
||||
}
|
||||
|
||||
async function handleDelete(record: Recordable) {
|
||||
const params = { incomeId: record.incomeId };
|
||||
const res = await erpIncomeDelete(params);
|
||||
showMessage(res.message);
|
||||
await handleSuccess(record);
|
||||
}
|
||||
|
||||
async function handleSuccess(record: Recordable) {
|
||||
await reload({ record });
|
||||
}
|
||||
</script>
|
||||
153
web-vue/packages/erp/views/erp/transactionFlow/form.vue
Normal file
153
web-vue/packages/erp/views/erp/transactionFlow/form.vue
Normal file
@@ -0,0 +1,153 @@
|
||||
<!--
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
* @author gaoxq
|
||||
-->
|
||||
<template>
|
||||
<BasicDrawer
|
||||
v-bind="$attrs"
|
||||
:showFooter="true"
|
||||
:okAuth="'erp:transactionFlow:edit'"
|
||||
@register="registerDrawer"
|
||||
@ok="handleSubmit"
|
||||
width="70%"
|
||||
>
|
||||
<template #title>
|
||||
<Icon :icon="getTitle.icon" class="m-1 pr-1" />
|
||||
<span> {{ getTitle.value }} </span>
|
||||
</template>
|
||||
<BasicForm @register="registerForm" />
|
||||
</BasicDrawer>
|
||||
</template>
|
||||
<script lang="ts" setup name="ViewsErpTransactionFlowForm">
|
||||
import { ref, unref, computed } from 'vue';
|
||||
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
|
||||
import { useMessage } from '@jeesite/core/hooks/web/useMessage';
|
||||
import { router } from '@jeesite/core/router';
|
||||
import { Icon } from '@jeesite/core/components/Icon';
|
||||
import { BasicForm, FormSchema, useForm } from '@jeesite/core/components/Form';
|
||||
import { BasicDrawer, useDrawerInner } from '@jeesite/core/components/Drawer';
|
||||
import { ErpCategory, erpCategoryListAll } from '@jeesite/erp/api/erp/category';
|
||||
import { ErpTransactionFlow, erpTransactionFlowSave, erpTransactionFlowForm } from '@jeesite/erp/api/erp/transactionFlow';
|
||||
|
||||
const emit = defineEmits(['success', 'register']);
|
||||
|
||||
const { t } = useI18n('erp.transactionFlow');
|
||||
const { showMessage } = useMessage();
|
||||
const { meta } = unref(router.currentRoute);
|
||||
const record = ref<ErpTransactionFlow>({} as ErpTransactionFlow);
|
||||
|
||||
const categoryParams = ref<Recordable>({ categoryType: '' });
|
||||
|
||||
const getTitle = computed(() => ({
|
||||
icon: meta.icon || 'i-ant-design:book-outlined',
|
||||
value: record.value.isNewRecord ? t('新增明细信息') : t('编辑明细信息'),
|
||||
}));
|
||||
|
||||
const inputFormSchemas: FormSchema<ErpTransactionFlow>[] = [
|
||||
{
|
||||
label: t('交易名称'),
|
||||
field: 'flowName',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
maxlength: 32,
|
||||
},
|
||||
required: true,
|
||||
colProps: { md: 24, lg: 24 },
|
||||
},
|
||||
{
|
||||
label: t('交易类型'),
|
||||
field: 'transactionType',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
dictType: 'transaction_type',
|
||||
allowClear: true,
|
||||
immediate: true,
|
||||
onChange:(value: string) => {
|
||||
categoryParams.value.categoryType = value
|
||||
},
|
||||
},
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: t('交易分类'),
|
||||
field: 'categoryId',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
api: erpCategoryListAll,
|
||||
params: categoryParams.value,
|
||||
fieldNames: { label: 'categoryName', value: 'categoryId' },
|
||||
allowClear: true,
|
||||
immediate: true,
|
||||
},
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: t('交易账户'),
|
||||
field: 'accountId',
|
||||
fieldLabel: 'accountName',
|
||||
component: 'ListSelect',
|
||||
componentProps: {
|
||||
selectType: 'erpAccountSelect',
|
||||
},
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: t('交易金额'),
|
||||
field: 'amount',
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
maxlength: 10,
|
||||
},
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: t('交易备注'),
|
||||
field: 'remark',
|
||||
component: 'InputTextArea',
|
||||
componentProps: {
|
||||
maxlength: 500,
|
||||
},
|
||||
colProps: { md: 24, lg: 24 },
|
||||
},
|
||||
];
|
||||
|
||||
const [registerForm, { resetFields, setFieldsValue, validate }] = useForm<ErpTransactionFlow>({
|
||||
labelWidth: 120,
|
||||
schemas: inputFormSchemas,
|
||||
baseColProps: { md: 24, lg: 12 },
|
||||
});
|
||||
|
||||
const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {
|
||||
setDrawerProps({ loading: true });
|
||||
await resetFields();
|
||||
const res = await erpTransactionFlowForm(data);
|
||||
record.value = (res.erpTransactionFlow || {}) as ErpTransactionFlow;
|
||||
record.value.__t = new Date().getTime();
|
||||
await setFieldsValue(record.value);
|
||||
setDrawerProps({ loading: false });
|
||||
});
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const data = await validate();
|
||||
setDrawerProps({ confirmLoading: true });
|
||||
const params: any = {
|
||||
isNewRecord: record.value.isNewRecord,
|
||||
flowId: record.value.flowId || data.flowId,
|
||||
};
|
||||
// console.log('submit', params, data, record);
|
||||
const res = await erpTransactionFlowSave(params, data);
|
||||
showMessage(res.message);
|
||||
setTimeout(closeDrawer);
|
||||
emit('success', data);
|
||||
} catch (error: any) {
|
||||
if (error && error.errorFields) {
|
||||
showMessage(error.message || t('common.validateError'));
|
||||
}
|
||||
console.log('error', error);
|
||||
} finally {
|
||||
setDrawerProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
103
web-vue/packages/erp/views/erp/transactionFlow/formImport.vue
Normal file
103
web-vue/packages/erp/views/erp/transactionFlow/formImport.vue
Normal file
@@ -0,0 +1,103 @@
|
||||
<!--
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
* @author gaoxq
|
||||
-->
|
||||
<template>
|
||||
<BasicModal
|
||||
v-bind="$attrs"
|
||||
:title="t('导入明细信息')"
|
||||
:okText="t('导入')"
|
||||
@register="registerModal"
|
||||
@ok="handleSubmit"
|
||||
:minHeight="120"
|
||||
:width="400"
|
||||
>
|
||||
<Upload accept=".xls,.xlsx" :file-list="fileList" :before-upload="beforeUpload" @remove="handleRemove">
|
||||
<a-button> <Icon icon="ant-design:upload-outlined" /> {{ t('选择文件') }} </a-button>
|
||||
<span class="ml-4">{{ uploadInfo }}</span>
|
||||
</Upload>
|
||||
<div class="ml-4 mt-4">
|
||||
{{ t('提示:仅允许导入“xls”或“xlsx”格式文件!') }}
|
||||
</div>
|
||||
<div class="mt-4">
|
||||
<a-button @click="handleDownloadTemplate()" type="text">
|
||||
<Icon icon="i-fa:file-excel-o" />
|
||||
{{ t('下载模板') }}
|
||||
</a-button>
|
||||
</div>
|
||||
</BasicModal>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import { Upload } from 'ant-design-vue';
|
||||
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
|
||||
import { useMessage } from '@jeesite/core/hooks/web/useMessage';
|
||||
import { useGlobSetting } from '@jeesite/core/hooks/setting';
|
||||
import { downloadByUrl } from '@jeesite/core/utils/file/download';
|
||||
import { Icon } from '@jeesite/core/components/Icon';
|
||||
import { BasicModal, useModalInner } from '@jeesite/core/components/Modal';
|
||||
import { erpTransactionFlowImportData } from '@jeesite/erp/api/erp/transactionFlow';
|
||||
import { FileType } from 'ant-design-vue/es/upload/interface';
|
||||
import { AxiosProgressEvent } from 'axios';
|
||||
|
||||
const emit = defineEmits(['success', 'register']);
|
||||
|
||||
const { t } = useI18n('erp.transactionFlow');
|
||||
const { showMessage, showMessageModal } = useMessage();
|
||||
|
||||
const fileList = ref<FileType[]>([]);
|
||||
const uploadInfo = ref('');
|
||||
|
||||
const beforeUpload = (file: FileType) => {
|
||||
fileList.value = [file];
|
||||
return false;
|
||||
};
|
||||
|
||||
const handleRemove = () => {
|
||||
fileList.value = [];
|
||||
};
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(() => {
|
||||
fileList.value = [];
|
||||
uploadInfo.value = '';
|
||||
});
|
||||
|
||||
async function handleDownloadTemplate() {
|
||||
const { ctxAdminPath } = useGlobSetting();
|
||||
downloadByUrl({ url: ctxAdminPath + '/erp/transactionFlow/importTemplate' });
|
||||
}
|
||||
|
||||
function onUploadProgress(progressEvent: AxiosProgressEvent) {
|
||||
const complete = ((progressEvent.loaded / (progressEvent.total || 1)) * 100) | 0;
|
||||
if (complete != 100) {
|
||||
uploadInfo.value = t('正在导入,请稍候') + ' ' + complete + '%...';
|
||||
} else {
|
||||
uploadInfo.value = '';
|
||||
}
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
if (fileList.value.length == 0) {
|
||||
showMessage(t('请选择要导入的数据文件'));
|
||||
return;
|
||||
}
|
||||
setModalProps({ confirmLoading: true });
|
||||
const params = {
|
||||
file: fileList.value[0],
|
||||
};
|
||||
const { data } = await erpTransactionFlowImportData(params, onUploadProgress);
|
||||
showMessageModal({ content: data.message });
|
||||
setTimeout(closeModal);
|
||||
emit('success');
|
||||
} catch (error: any) {
|
||||
if (error && error.errorFields) {
|
||||
showMessage(error.message || t('common.validateError'));
|
||||
}
|
||||
console.log('error', error);
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
310
web-vue/packages/erp/views/erp/transactionFlow/list.vue
Normal file
310
web-vue/packages/erp/views/erp/transactionFlow/list.vue
Normal file
@@ -0,0 +1,310 @@
|
||||
<!--
|
||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
||||
* No deletion without permission, or be held responsible to law.
|
||||
* @author gaoxq
|
||||
-->
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable">
|
||||
<template #tableTitle>
|
||||
<Icon :icon="getTitle.icon" class="m-1 pr-1" />
|
||||
<span> {{ getTitle.value }} </span>
|
||||
</template>
|
||||
<template #toolbar>
|
||||
<a-button type="default" :loading="loading" @click="handleExport()">
|
||||
<Icon icon="i-ant-design:download-outlined" /> {{ t('导出') }}
|
||||
</a-button>
|
||||
<a-button type="primary" @click="handleForm({})" v-auth="'erp:transactionFlow:edit'">
|
||||
<Icon icon="i-fluent:add-12-filled" /> {{ t('新增') }}
|
||||
</a-button>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<InputForm @register="registerDrawer" @success="handleSuccess" />
|
||||
<FormImport @register="registerImportModal" @success="handleSuccess" />
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup name="ViewsErpTransactionFlowList">
|
||||
import { onMounted, ref, unref } from 'vue';
|
||||
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
|
||||
import { useMessage } from '@jeesite/core/hooks/web/useMessage';
|
||||
import { useGlobSetting } from '@jeesite/core/hooks/setting';
|
||||
import { downloadByUrl } from '@jeesite/core/utils/file/download';
|
||||
import { router } from '@jeesite/core/router';
|
||||
import { Icon } from '@jeesite/core/components/Icon';
|
||||
import { BasicTable, BasicColumn, useTable } from '@jeesite/core/components/Table';
|
||||
import { ErpTransactionFlow, erpTransactionFlowList } from '@jeesite/erp/api/erp/transactionFlow';
|
||||
import { erpTransactionFlowDelete, erpTransactionFlowFinish, erpTransactionFlowListData } from '@jeesite/erp/api/erp/transactionFlow';
|
||||
import { useDrawer } from '@jeesite/core/components/Drawer';
|
||||
import { useModal } from '@jeesite/core/components/Modal';
|
||||
import { FormProps } from '@jeesite/core/components/Form';
|
||||
import InputForm from './form.vue';
|
||||
import FormImport from './formImport.vue';
|
||||
|
||||
const { t } = useI18n('erp.transactionFlow');
|
||||
const { showMessage } = useMessage();
|
||||
const { meta } = unref(router.currentRoute);
|
||||
const record = ref<ErpTransactionFlow>({} as ErpTransactionFlow);
|
||||
|
||||
const getTitle = {
|
||||
icon: meta.icon || 'i-ant-design:book-outlined',
|
||||
value: meta.title || t('明细信息管理'),
|
||||
};
|
||||
const loading = ref(false);
|
||||
|
||||
const searchForm: FormProps<ErpTransactionFlow> = {
|
||||
baseColProps: { md: 8, lg: 6 },
|
||||
labelWidth: 90,
|
||||
schemas: [
|
||||
{
|
||||
label: t('记录时间起'),
|
||||
field: 'createTime_gte',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
format: 'YYYY-MM-DD HH:mm',
|
||||
showTime: { format: 'HH:mm' },
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('记录时间止'),
|
||||
field: 'createTime_lte',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
format: 'YYYY-MM-DD HH:mm',
|
||||
showTime: { format: 'HH:mm' },
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('交易名称'),
|
||||
field: 'flowName',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: t('交易类型'),
|
||||
field: 'transactionType',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
dictType: 'transaction_type',
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('交易账户'),
|
||||
field: 'accountId',
|
||||
fieldLabel: 'accountName',
|
||||
component: 'ListSelect',
|
||||
componentProps: {
|
||||
selectType: 'erpAccountSelect',
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('交易分类'),
|
||||
field: 'categoryId',
|
||||
fieldLabel: 'categoryName',
|
||||
component: 'ListSelect',
|
||||
componentProps: {
|
||||
selectType: 'erpCategorySelect',
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('是否记账'),
|
||||
field: 'isFinish',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
dictType: 'is_finish',
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const tableColumns: BasicColumn<ErpTransactionFlow>[] = [
|
||||
{
|
||||
title: t('记录时间'),
|
||||
dataIndex: 'createTime',
|
||||
key: 'a.create_time',
|
||||
sorter: true,
|
||||
width: 180,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('交易名称'),
|
||||
dataIndex: 'flowName',
|
||||
key: 'a.flow_name',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('交易类型'),
|
||||
dataIndex: 'transactionType',
|
||||
key: 'a.transaction_type',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
dictType: 'transaction_type',
|
||||
},
|
||||
{
|
||||
title: t('账户名称'),
|
||||
dataIndex: 'accountName',
|
||||
key: 'b.account_name',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'right',
|
||||
},
|
||||
{
|
||||
title: t('父级分类'),
|
||||
dataIndex: 'parentId',
|
||||
key: 'c.parent_id',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'right',
|
||||
dictType: 'parent_type',
|
||||
},
|
||||
{
|
||||
title: t('分类名称'),
|
||||
dataIndex: 'categoryName',
|
||||
key: 'c.category_name',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'right',
|
||||
},
|
||||
{
|
||||
title: t('交易金额'),
|
||||
dataIndex: 'amount',
|
||||
key: 'a.amount',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'right',
|
||||
},
|
||||
{
|
||||
title: t('交易时间'),
|
||||
dataIndex: 'transactionTime',
|
||||
key: 'a.transaction_time',
|
||||
sorter: true,
|
||||
width: 180,
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: t('交易备注'),
|
||||
dataIndex: 'remark',
|
||||
key: 'a.remark',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
title: t('是否记账'),
|
||||
dataIndex: 'isFinish',
|
||||
key: 'a.is_finish',
|
||||
sorter: true,
|
||||
width: 130,
|
||||
align: 'left',
|
||||
dictType: 'is_finish',
|
||||
},
|
||||
{
|
||||
title: t('更新时间'),
|
||||
dataIndex: 'updateTime',
|
||||
key: 'a.update_time',
|
||||
sorter: true,
|
||||
width: 180,
|
||||
align: 'center',
|
||||
},
|
||||
];
|
||||
|
||||
const actionColumn: BasicColumn<ErpTransactionFlow> = {
|
||||
width: 160,
|
||||
align: 'center',
|
||||
actions: (record: ErpTransactionFlow) => [
|
||||
{
|
||||
icon: 'i-clarity:note-edit-line',
|
||||
title: t('编辑'),
|
||||
onClick: handleForm.bind(this, { flowId: record.flowId }),
|
||||
auth: 'erp:transactionFlow:edit',
|
||||
ifShow: record.isFinish == '0'
|
||||
},
|
||||
{
|
||||
icon: 'i-ant-design:delete-outlined',
|
||||
color: 'error',
|
||||
title: t('删除'),
|
||||
popConfirm: {
|
||||
title: t('是否确认删除明细信息?'),
|
||||
confirm: handleDelete.bind(this, record),
|
||||
},
|
||||
auth: 'erp:transactionFlow:edit',
|
||||
ifShow: record.isFinish == '0'
|
||||
},
|
||||
{
|
||||
icon: 'simple-line-icons:check',
|
||||
color: 'success',
|
||||
title: t('记账'),
|
||||
popConfirm: {
|
||||
title: t('是否确认记账本条明细?'),
|
||||
confirm: handleFinish.bind(this, record),
|
||||
},
|
||||
auth: 'erp:transactionFlow:edit',
|
||||
ifShow: record.isFinish == '0'
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const [registerTable, { reload, getForm }] = useTable<ErpTransactionFlow>({
|
||||
api: erpTransactionFlowListData,
|
||||
beforeFetch: (params) => {
|
||||
return params;
|
||||
},
|
||||
columns: tableColumns,
|
||||
actionColumn: actionColumn,
|
||||
formConfig: searchForm,
|
||||
showTableSetting: true,
|
||||
useSearchForm: true,
|
||||
canResize: true,
|
||||
});
|
||||
|
||||
onMounted(async () => {
|
||||
const res = await erpTransactionFlowList();
|
||||
record.value = (res.erpTransactionFlow || {}) as ErpTransactionFlow;
|
||||
await getForm().setFieldsValue(record.value);
|
||||
});
|
||||
|
||||
const [registerDrawer, { openDrawer }] = useDrawer();
|
||||
|
||||
function handleForm(record: Recordable) {
|
||||
openDrawer(true, record);
|
||||
}
|
||||
|
||||
async function handleExport() {
|
||||
loading.value = true;
|
||||
const { ctxAdminPath } = useGlobSetting();
|
||||
await downloadByUrl({
|
||||
url: ctxAdminPath + '/erp/transactionFlow/exportData',
|
||||
params: getForm().getFieldsValue(),
|
||||
});
|
||||
loading.value = false;
|
||||
}
|
||||
|
||||
const [registerImportModal, { openModal: importModal }] = useModal();
|
||||
|
||||
function handleImport() {
|
||||
importModal(true, {});
|
||||
}
|
||||
|
||||
async function handleDelete(record: Recordable) {
|
||||
const params = { flowId: record.flowId };
|
||||
const res = await erpTransactionFlowDelete(params);
|
||||
showMessage(res.message);
|
||||
await handleSuccess(record);
|
||||
}
|
||||
|
||||
async function handleFinish(record: Recordable) {
|
||||
const params = { flowId: record.flowId };
|
||||
const res = await erpTransactionFlowFinish(params);
|
||||
showMessage(res.message);
|
||||
await handleSuccess(record);
|
||||
}
|
||||
|
||||
|
||||
|
||||
async function handleSuccess(record: Recordable) {
|
||||
await reload({ record });
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user