259 lines
7.0 KiB
Vue
259 lines
7.0 KiB
Vue
<!--
|
|
* Copyright (c) 2013-Now https://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>
|
|
<template #bizScopeKey="{ record, text, value }">
|
|
<a @click="handleForm({ flowId: record.flowId })" :title="value">
|
|
{{ text }}
|
|
</a>
|
|
</template>
|
|
</BasicTable>
|
|
<InputForm @register="registerDrawer" @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, 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';
|
|
|
|
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: 'flowType',
|
|
component: 'Input',
|
|
},
|
|
{
|
|
label: t('交易账户'),
|
|
field: 'accountId',
|
|
component: 'Input',
|
|
},
|
|
{
|
|
label: t('交易分类'),
|
|
field: 'categoryId',
|
|
component: 'Input',
|
|
},
|
|
{
|
|
label: t('业务标识'),
|
|
field: 'businessId',
|
|
component: 'Input',
|
|
},
|
|
],
|
|
};
|
|
|
|
const tableColumns: BasicColumn<ErpTransactionFlow>[] = [
|
|
{
|
|
title: t('记录时间'),
|
|
dataIndex: 'createTime',
|
|
key: 'a.create_time',
|
|
sorter: true,
|
|
width: 150,
|
|
align: 'left',
|
|
},
|
|
{
|
|
title: t('交易名称'),
|
|
dataIndex: 'flowName',
|
|
key: 'a.flow_name',
|
|
sorter: true,
|
|
width: 130,
|
|
align: 'left',
|
|
slot: 'bizScopeKey',
|
|
},
|
|
{
|
|
title: t('交易类型'),
|
|
dataIndex: 'flowType',
|
|
key: 'a.flow_type',
|
|
sorter: true,
|
|
width: 130,
|
|
align: 'left',
|
|
},
|
|
{
|
|
title: t('交易金额'),
|
|
dataIndex: 'amount',
|
|
key: 'a.amount',
|
|
sorter: true,
|
|
width: 130,
|
|
align: 'right',
|
|
},
|
|
{
|
|
title: t('交易时间'),
|
|
dataIndex: 'tradeTime',
|
|
key: 'a.trade_time',
|
|
sorter: true,
|
|
width: 130,
|
|
align: 'center',
|
|
},
|
|
{
|
|
title: t('交易账户'),
|
|
dataIndex: 'accountId',
|
|
key: 'a.account_id',
|
|
sorter: true,
|
|
width: 130,
|
|
align: 'left',
|
|
},
|
|
{
|
|
title: t('交易分类'),
|
|
dataIndex: 'categoryId',
|
|
key: 'a.category_id',
|
|
sorter: true,
|
|
width: 130,
|
|
align: 'left',
|
|
},
|
|
{
|
|
title: t('交易备注'),
|
|
dataIndex: 'remark',
|
|
key: 'a.remark',
|
|
sorter: true,
|
|
width: 130,
|
|
align: 'left',
|
|
},
|
|
{
|
|
title: t('更新时间'),
|
|
dataIndex: 'updateTime',
|
|
key: 'a.update_time',
|
|
sorter: true,
|
|
width: 130,
|
|
align: 'center',
|
|
},
|
|
{
|
|
title: t('业务标识'),
|
|
dataIndex: 'businessId',
|
|
key: 'a.business_id',
|
|
sorter: true,
|
|
width: 130,
|
|
align: 'left',
|
|
},
|
|
];
|
|
|
|
const actionColumn: BasicColumn<ErpTransactionFlow> = {
|
|
width: 160,
|
|
actions: (record: ErpTransactionFlow) => [
|
|
{
|
|
icon: 'i-clarity:note-edit-line',
|
|
title: t('编辑'),
|
|
onClick: handleForm.bind(this, { flowId: record.flowId }),
|
|
auth: 'erp:transactionFlow:edit',
|
|
},
|
|
{
|
|
icon: 'i-ant-design:delete-outlined',
|
|
color: 'error',
|
|
title: t('删除'),
|
|
popConfirm: {
|
|
title: t('是否确认删除流水?'),
|
|
confirm: handleDelete.bind(this, record),
|
|
},
|
|
auth: 'erp:transactionFlow:edit',
|
|
},
|
|
],
|
|
};
|
|
|
|
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;
|
|
}
|
|
|
|
async function handleDelete(record: Recordable) {
|
|
const params = { flowId: record.flowId };
|
|
const res = await erpTransactionFlowDelete(params);
|
|
showMessage(res.message);
|
|
await handleSuccess(record);
|
|
}
|
|
|
|
async function handleSuccess(record: Recordable) {
|
|
await reload({ record });
|
|
}
|
|
</script>
|