6de87ed4e2
- 调整合同管理备注输入框行数和最大长度 - 细化合同变更页面表单项间距和对齐方式 - 统一弹窗表单项的底部间距样式,改为注释禁用 - 调整 port-terminal 和 region 组件的表单项底部间距 - 修改 vite 配置中 API 请求代理地址 - 优化凭证执行详情搜索表单列宽布局 - 在运单管理页面更新型号字段为非必填,调整变更记录内容格式化显示 - 引入并使用 formatRouteChangeContent 工具函数 - 统一明细按钮显示逻辑,草稿状态也显示详情按钮 - 新增路由变更相关工具函数与样式支持
186 lines
5.1 KiB
Vue
186 lines
5.1 KiB
Vue
<template>
|
|
<basic-container class="bill-payment-page">
|
|
<bill-payment-search
|
|
v-if="searchVisible"
|
|
:query="query"
|
|
:loading="loading"
|
|
@search="handleSearch"
|
|
@reset="resetSearch"
|
|
/>
|
|
<bill-payment-table
|
|
:rows="rows"
|
|
:loading="loading"
|
|
:page="page"
|
|
:mk-enabled="mkEnabled"
|
|
v-model:search-visible="searchVisible"
|
|
@add="openCreate"
|
|
@view="openView"
|
|
@edit="openEdit"
|
|
@delete="handleDelete"
|
|
@submit="handleSubmit"
|
|
@mk-audit="handleMkAudit"
|
|
@approve="handleApprove"
|
|
@return="handleReturn"
|
|
@void="handleVoid"
|
|
@refresh="loadTable"
|
|
@page-change="handlePageChange"
|
|
@size-change="handleSizeChange"
|
|
/>
|
|
</basic-container>
|
|
</template>
|
|
|
|
<script>
|
|
import * as api from '@/api/payment/billPayment';
|
|
import { getMKApprovalUrl } from '@/api/system/business-process';
|
|
import { loadMkEnabled, submitMkApprovalFlow } from '@/utils/mk-approval';
|
|
import BillPaymentSearch from './components/bill-payment-search.vue';
|
|
import BillPaymentTable from './components/bill-payment-table.vue';
|
|
|
|
const emptyQuery = () => ({
|
|
paymentNo: '',
|
|
deptName: '',
|
|
deptPath: [],
|
|
paymentDateRange: [],
|
|
approvalStatus: '',
|
|
});
|
|
|
|
export default {
|
|
name: 'BillPayment',
|
|
components: { BillPaymentSearch, BillPaymentTable },
|
|
data() {
|
|
return {
|
|
query: emptyQuery(),
|
|
searchVisible: true,
|
|
rows: [],
|
|
loading: false,
|
|
page: { current: 1, size: 10, total: 0 },
|
|
mkEnabled: false,
|
|
};
|
|
},
|
|
mounted() {
|
|
this.loadTable();
|
|
loadMkEnabled()
|
|
.then(enabled => {
|
|
this.mkEnabled = !!enabled;
|
|
})
|
|
.catch(() => {
|
|
this.mkEnabled = false;
|
|
});
|
|
},
|
|
methods: {
|
|
unwrapData(response) {
|
|
const body = response?.data || response || {};
|
|
return body?.data || body;
|
|
},
|
|
buildParams() {
|
|
const params = { ...this.query };
|
|
const range = params.paymentDateRange || [];
|
|
delete params.paymentDateRange;
|
|
if (range.length === 2) {
|
|
params.paymentStartDate = range[0];
|
|
params.paymentEndDate = range[1];
|
|
}
|
|
return params;
|
|
},
|
|
async loadTable() {
|
|
this.loading = true;
|
|
try {
|
|
const data = this.unwrapData(
|
|
await api.getList(this.page.current, this.page.size, this.buildParams())
|
|
);
|
|
this.rows = data.records || [];
|
|
this.page.total = Number(data.total || 0);
|
|
} finally {
|
|
this.loading = false;
|
|
}
|
|
},
|
|
handleSearch() {
|
|
this.page.current = 1;
|
|
this.loadTable();
|
|
},
|
|
resetSearch() {
|
|
this.query = emptyQuery();
|
|
this.handleSearch();
|
|
},
|
|
openCreate() {
|
|
this.$router.push({ path: '/payment/bill-payment/form', query: { mode: 'add' } });
|
|
},
|
|
openView(row) {
|
|
this.$router.push({
|
|
path: '/payment/bill-payment/form',
|
|
query: { mode: 'view', id: row.id },
|
|
});
|
|
},
|
|
openEdit(row) {
|
|
this.$router.push({
|
|
path: '/payment/bill-payment/form',
|
|
query: { mode: 'edit', id: row.id },
|
|
});
|
|
},
|
|
async handleDelete(row) {
|
|
await this.$confirm('确认删除该汇票付款?', '提示', { type: 'warning' });
|
|
await api.remove(row.id);
|
|
this.$message.success('删除成功');
|
|
if (this.rows.length === 1 && this.page.current > 1) this.page.current -= 1;
|
|
this.loadTable();
|
|
},
|
|
async handleSubmit(row) {
|
|
const previousApprovalStatus = row.approvalStatus || '';
|
|
await api.submit({ id: row.id });
|
|
await submitMkApprovalFlow({
|
|
bizType: 'bill-payment',
|
|
bizId: row.id,
|
|
subjectName: row.paymentNo || row.billNo || '',
|
|
approvalStatus: previousApprovalStatus,
|
|
});
|
|
this.$message.success('提交成功');
|
|
this.loadTable();
|
|
},
|
|
handleMkAudit(row) {
|
|
if (!row?.id) {
|
|
this.$message.warning('汇票付款ID为空,无法打开审核页');
|
|
return;
|
|
}
|
|
getMKApprovalUrl({ bizId: String(row.id) })
|
|
.then(res => {
|
|
const url = res?.data?.data;
|
|
if (!url) {
|
|
this.$message.error('获取审核跳转地址失败');
|
|
return;
|
|
}
|
|
window.open(url, '_blank');
|
|
})
|
|
.catch(() => {
|
|
this.$message.error('获取审核跳转地址失败');
|
|
});
|
|
},
|
|
async handleApprove(row) {
|
|
await api.approve({ id: row.id });
|
|
this.$message.success('审批通过');
|
|
this.loadTable();
|
|
},
|
|
async handleReturn(row) {
|
|
const { value } = await this.$prompt('请输入驳回原因', '审批驳回');
|
|
await api.returnBill({ id: row.id, reason: value });
|
|
this.$message.success('已驳回');
|
|
this.loadTable();
|
|
},
|
|
async handleVoid(row) {
|
|
const { value } = await this.$prompt('请输入作废原因', '作废汇票付款');
|
|
await api.voidBill({ id: row.id, reason: value });
|
|
this.$message.success('作废成功');
|
|
this.loadTable();
|
|
},
|
|
handlePageChange(current) {
|
|
this.page.current = current;
|
|
this.loadTable();
|
|
},
|
|
handleSizeChange(size) {
|
|
this.page.current = 1;
|
|
this.page.size = size;
|
|
this.loadTable();
|
|
},
|
|
},
|
|
};
|
|
</script>
|