进销存-付款单
This commit is contained in:
parent
46488a8e0d
commit
65b830e69a
|
|
@ -5,6 +5,7 @@ const { createConfirm } = useMessage();
|
|||
|
||||
enum Api {
|
||||
list = '/cgd/nuInvoicingCgdMain/list',
|
||||
calcList = '/cgd/nuInvoicingCgdMain/calcList',
|
||||
save='/cgd/nuInvoicingCgdMain/add',
|
||||
edit='/cgd/nuInvoicingCgdMain/edit',
|
||||
deleteOne = '/cgd/nuInvoicingCgdMain/delete',
|
||||
|
|
@ -32,6 +33,12 @@ export const getImportUrl = Api.importExcel;
|
|||
*/
|
||||
export const list = (params) => defHttp.get({ url: Api.list, params });
|
||||
|
||||
/**
|
||||
* 列表接口 包含每个采购单应付金额
|
||||
* @param params
|
||||
*/
|
||||
export const calcList = (params) => defHttp.get({ url: Api.calcList, params });
|
||||
|
||||
/**
|
||||
* 删除单个
|
||||
* @param params
|
||||
|
|
|
|||
|
|
@ -1,42 +1,53 @@
|
|||
import {BasicColumn} from '/@/components/Table';
|
||||
import {FormSchema} from '/@/components/Table';
|
||||
import { rules} from '/@/utils/helper/validator';
|
||||
import { BasicColumn } from '/@/components/Table';
|
||||
import { FormSchema } from '/@/components/Table';
|
||||
import { rules } from '/@/utils/helper/validator';
|
||||
import { render } from '/@/utils/common/renderUtils';
|
||||
import { getWeekMonthQuarterYear } from '/@/utils';
|
||||
//列表数据
|
||||
export const columns: BasicColumn[] = [
|
||||
{
|
||||
title: '付款单单号',
|
||||
align: "center",
|
||||
dataIndex: 'fkdNo'
|
||||
align: 'center',
|
||||
dataIndex: 'fkdNo',
|
||||
width: 200,
|
||||
},
|
||||
{
|
||||
title: '供应商名称',
|
||||
align: "center",
|
||||
dataIndex: 'gysName'
|
||||
align: 'center',
|
||||
dataIndex: 'gysName',
|
||||
width: 400,
|
||||
},
|
||||
{
|
||||
title: '总金额',
|
||||
align: "center",
|
||||
dataIndex: 'totalPrice'
|
||||
title: '总金额(元)',
|
||||
align: 'center',
|
||||
dataIndex: 'totalPrice',
|
||||
customRender: ({ text }) => {
|
||||
const num = parseFloat(text);
|
||||
// 处理无效值
|
||||
if (isNaN(num)) {
|
||||
return '0.00';
|
||||
}
|
||||
// 格式化为两位小数
|
||||
return num.toFixed(2);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '付款状态',
|
||||
align: "center",
|
||||
dataIndex: 'status_dictText'
|
||||
align: 'center',
|
||||
dataIndex: 'status_dictText',
|
||||
},
|
||||
{
|
||||
title: '付款时间',
|
||||
align: "center",
|
||||
dataIndex: 'fksj'
|
||||
align: 'center',
|
||||
dataIndex: 'fksj',
|
||||
},
|
||||
];
|
||||
|
||||
// 高级查询数据
|
||||
export const superQuerySchema = {
|
||||
fkdNo: {title: '付款单单号',order: 0,view: 'text', type: 'string',},
|
||||
gysName: {title: '供应商名称',order: 2,view: 'text', type: 'string',},
|
||||
totalPrice: {title: '总金额',order: 5,view: 'number', type: 'number',},
|
||||
status: {title: '付款状态 0待付款 1作废 2已付款',order: 6,view: 'list', type: 'string',dictCode: 'invoicing_payment_status',},
|
||||
fksj: {title: '付款时间',order: 7,view: 'datetime', type: 'string',},
|
||||
fkdNo: { title: '付款单单号', order: 0, view: 'text', type: 'string' },
|
||||
gysName: { title: '供应商名称', order: 2, view: 'text', type: 'string' },
|
||||
totalPrice: { title: '总金额', order: 5, view: 'number', type: 'number' },
|
||||
status: { title: '付款状态 0待付款 1作废 2已付款', order: 6, view: 'list', type: 'string', dictCode: 'invoicing_payment_status' },
|
||||
fksj: { title: '付款时间', order: 7, view: 'datetime', type: 'string' },
|
||||
};
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ function getTableAction(record) {
|
|||
{
|
||||
label: '详情',
|
||||
onClick: handleDetail.bind(null, record),
|
||||
ifShow: record.status != '1'
|
||||
// ifShow: record.status != '1'
|
||||
},
|
||||
{
|
||||
label: '付款',
|
||||
|
|
|
|||
|
|
@ -1,6 +1,17 @@
|
|||
<template>
|
||||
<BasicTable @register="registerTable">
|
||||
<template #tableTitle>
|
||||
<div style="width:100%;display: flex;justify-content: space-between;">
|
||||
<div class="divider-content">
|
||||
<!-- 总金额:{{ zongJinE }} 元 -->
|
||||
</div>
|
||||
<div style="float: right;">
|
||||
<span style="color: red;font-size: 16px; font-weight: bold;">
|
||||
总金额:{{ handlePriceFormat(zongJinE || zongJinECalc) }} 元
|
||||
</span>
|
||||
<span style="margin-left: 20px;"> 单位:元</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template #action="{ record }">
|
||||
<TableAction />
|
||||
|
|
@ -16,15 +27,22 @@ import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
|||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import { listAndJh } from '../../cgd/NuInvoicingCgdInfo.api';
|
||||
import { wlColumns } from './cgd.data';
|
||||
import { any } from 'vue-types';
|
||||
|
||||
// 定义props
|
||||
const props = defineProps({
|
||||
cgdId: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
zongJinE: {
|
||||
type: any,
|
||||
default: null
|
||||
}
|
||||
});
|
||||
|
||||
const zongJinECalc = ref()
|
||||
|
||||
// 定义事件
|
||||
const emit = defineEmits(['total-amount-change']);
|
||||
|
||||
|
|
@ -39,8 +57,10 @@ const { tableContext } = useListPage({
|
|||
canResize: false,
|
||||
useSearchForm: false,
|
||||
showActionColumn: false,
|
||||
showTableSetting: false,
|
||||
immediate: false,
|
||||
showIndexColumn: true,
|
||||
scroll: { y: '50vh' },
|
||||
actionColumn: {
|
||||
width: 120,
|
||||
fixed: 'right',
|
||||
|
|
@ -53,6 +73,7 @@ const { tableContext } = useListPage({
|
|||
// 获取总金额并传递给父组件
|
||||
if (data && data.length > 0) {
|
||||
const totalAmount = data[0].zongJinE || '';
|
||||
zongJinECalc.value = totalAmount
|
||||
emit('total-amount-change', totalAmount);
|
||||
}
|
||||
return data;
|
||||
|
|
@ -69,8 +90,35 @@ watch(() => props.cgdId, (newCgdId) => {
|
|||
}
|
||||
});
|
||||
|
||||
function handlePriceFormat(text) {
|
||||
{
|
||||
const num = parseFloat(text);
|
||||
// 处理无效值
|
||||
if (isNaN(num)) {
|
||||
return '0.00';
|
||||
}
|
||||
// 格式化为两位小数
|
||||
return num.toFixed(2);
|
||||
}
|
||||
}
|
||||
|
||||
// 暴露方法给父组件
|
||||
defineExpose({
|
||||
reload
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
|
||||
|
||||
<style lang="less" scoped>
|
||||
:deep .jeecg-basic-table-header__toolbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.divider-content {
|
||||
font-weight: bold;
|
||||
font-size: 16px;
|
||||
color: red;
|
||||
white-space: nowrap;
|
||||
margin-left: 14px;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
<a-spin :spinning="confirmLoading">
|
||||
<JFormContainer :disabled="true">
|
||||
<template #detail>
|
||||
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol"
|
||||
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol2" :wrapperCol="wrapperCol2"
|
||||
name="NuInvoicingFkdMainForm">
|
||||
<a-row class="card-class">
|
||||
<a-col :span="24" style="border-bottom: 2px solid #f7f7f7; margin-bottom: 14px;">
|
||||
|
|
@ -14,6 +14,15 @@
|
|||
<a-input v-model:value="formData.gysName"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</template>
|
||||
</JFormContainer>
|
||||
<JFormContainer :disabled="true" style="margin-top:-60px ;">
|
||||
<template #detail>
|
||||
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol"
|
||||
name="NuInvoicingFkdMainForm">
|
||||
<a-row class="card-class">
|
||||
<a-col :span="12">
|
||||
<a-form-item label="开户行" v-bind="validateInfos.openingBank" id="NuInvoicingFkdMainForm-openingBank"
|
||||
name="openingBank">
|
||||
|
|
@ -26,18 +35,18 @@
|
|||
<a-input v-model:value="formData.openingBankNo"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="结账状态" v-bind="validateInfos.status_dictText"
|
||||
id="NuInvoicingFkdMainForm-status_dictText" name="status_dictText">
|
||||
<a-input v-model:value="formData.status_dictText"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="总金额(元)" v-bind="validateInfos.totalPrice" id="NuInvoicingFkdMainForm-totalPrice"
|
||||
name="totalPrice">
|
||||
<a-input-number v-model:value="formData.totalPrice" style="width: 100%" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="结账状态" v-bind="validateInfos.status_dictText"
|
||||
id="NuInvoicingFkdMainForm-status_dictText" name="status_dictText">
|
||||
<a-input v-model:value="formData.status_dictText"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</template>
|
||||
|
|
@ -52,12 +61,12 @@
|
|||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="付款凭证" v-bind="validateInfos.fkpz" id="NuInvoicingFkdMainForm-fkpz" name="fkpz">
|
||||
<j-image-upload :fileMax="0" v-model:value="formData.fkpz"></j-image-upload>
|
||||
<j-image-upload :fileMax="disabled ? 1 : 0" v-model:value="formData.fkpz"></j-image-upload>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="发票" v-bind="validateInfos.fp" id="NuInvoicingFkdMainForm-fp" name="fp">
|
||||
<j-image-upload :fileMax="0" v-model:value="formData.fp"></j-image-upload>
|
||||
<j-image-upload :fileMax="disabled ? 1 : 0" v-model:value="formData.fp"></j-image-upload>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
|
@ -82,7 +91,7 @@
|
|||
</template>
|
||||
</JFormContainer>
|
||||
|
||||
<CgdTableList :cgdId="cgdIdsValue" />
|
||||
<CgdTableList :cgdId="cgdIdsValue" :zongJinE="formData.totalPrice"/>
|
||||
</a-spin>
|
||||
</template>
|
||||
|
||||
|
|
|
|||
|
|
@ -2,14 +2,14 @@
|
|||
<div>
|
||||
<!--供应商选择-->
|
||||
<div class="jeecg-basic-table-form-container">
|
||||
<a-form ref="formRef" @keyup.enter.native="searchQuery" :model="queryParam" :label-col="labelCol"
|
||||
:wrapper-col="wrapperCol">
|
||||
<a-form ref="formRef" @keyup.enter.native="searchQuery" :model="queryParam" :label-col="labelCol2"
|
||||
:wrapper-col="wrapperCol2">
|
||||
<a-row :gutter="24">
|
||||
<a-col :lg="6">
|
||||
<a-col :lg="8">
|
||||
<a-form-item name="gysId">
|
||||
<template #label><span title="供应商">供应商</span></template>
|
||||
<j-search-select placeholder="请选择供应商" v-model:value="queryParam.gysId"
|
||||
dict="view_cgd_gys,gys_name,gys_id,cgd_type = '2'" allow-clear @change="searchQuery()" />
|
||||
dict="view_cgd_gys,gys_name,gys_id,cgd_type = '2'" allow-clear @change="changeGysFunc()" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
|
@ -25,8 +25,8 @@
|
|||
<template #label>
|
||||
<a-select v-model:value="timeSearchValue" :allow-clear="false" @change="handleTimeSearchChange">
|
||||
<a-select-option value="qgDate">采购日期</a-select-option>
|
||||
<a-select-option value="jhTime_">拣货日期</a-select-option>
|
||||
<a-select-option value="wjTime_">完结日期</a-select-option>
|
||||
<a-select-option value="jhTime">拣货日期</a-select-option>
|
||||
<a-select-option value="wjTime">完结日期</a-select-option>
|
||||
</a-select>
|
||||
</template>
|
||||
<a-range-picker value-format="YYYY-MM-DD" v-model:value="currentDateRange" @change="handleDateRangeChange"
|
||||
|
|
@ -42,14 +42,13 @@
|
|||
</a-col>
|
||||
</span>
|
||||
</a-col>
|
||||
<a-col :lg="4" :push="8">
|
||||
<!-- <a-col :lg="4" :push="8">
|
||||
<a-form-item>
|
||||
<span>总金额:</span>
|
||||
<a-button type="link" @click="queryTotalPirceFunc()" v-if="zongJiaGeValue == null">查看</a-button>
|
||||
<span v-else>{{ zongJiaGeValue }} 元</span>
|
||||
</a-form-item>
|
||||
|
||||
</a-col>
|
||||
</a-col> -->
|
||||
</a-row>
|
||||
</a-form>
|
||||
</div>
|
||||
|
|
@ -57,6 +56,8 @@
|
|||
<BasicTable @register="registerTable" :row-selection="rowSelection">
|
||||
<!--插槽:table标题-->
|
||||
<template #tableTitle>
|
||||
<span style="color: red;font-size: 15px; font-weight: bold;">已勾选总金额: {{ formatPrice(selectedTotalAmount) }}
|
||||
元</span>
|
||||
</template>
|
||||
<!--操作栏-->
|
||||
<template #action="{ record }">
|
||||
|
|
@ -84,7 +85,7 @@ import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
|||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import { columns } from './cgd.data';
|
||||
import { saveOrUpdate } from '../NuInvoicingFkdMain.api';
|
||||
import { list } from '../../cgd/NuInvoicingCgdMain.api'
|
||||
import { calcList } from '../../cgd/NuInvoicingCgdMain.api'
|
||||
import { calcTotalPrice } from '../../cgd/NuInvoicingCgdInfo.api'
|
||||
import { downloadFile } from '/@/utils/common/renderUtils';
|
||||
import { useUserStore } from '/@/store/modules/user';
|
||||
|
|
@ -108,15 +109,17 @@ const currentDateRange = ref([]);
|
|||
const visible = ref(false)
|
||||
const registerForm = ref()
|
||||
const zongJiaGeValue = ref(null)//总价格
|
||||
const selectedTotalAmount = ref(0);//已勾选总金额
|
||||
//注册table数据
|
||||
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
title: '进销存-付款单主信息',
|
||||
api: list,
|
||||
api: calcList,
|
||||
columns,
|
||||
canResize: false,
|
||||
useSearchForm: false,
|
||||
pagination: false,
|
||||
scroll: { y: '50vh' },
|
||||
actionColumn: {
|
||||
width: 120,
|
||||
fixed: 'right',
|
||||
|
|
@ -134,6 +137,8 @@ const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
|||
//清空已计算总价格
|
||||
zongJiaGeValue.value = null
|
||||
selectedRows.value = selectedRows_;
|
||||
// 计算已勾选行的xiaoJi总和
|
||||
calculateSelectedTotal();
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -182,6 +187,16 @@ function getTableAction(record) {
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 变更供应商
|
||||
*/
|
||||
function changeGysFunc() {
|
||||
// 清除已勾选数据
|
||||
selectedRows.value = [];
|
||||
selectedRowKeys.value = [];
|
||||
selectedTotalAmount.value = 0;
|
||||
searchQuery()
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询
|
||||
|
|
@ -196,6 +211,14 @@ function searchQuery() {
|
|||
function searchReset() {
|
||||
formRef.value.resetFields();
|
||||
selectedRowKeys.value = [];
|
||||
// 清空之前的日期字段值
|
||||
['qgDate', 'jhTime', 'wjTime'].forEach(field => {
|
||||
queryParam[field + '_begin'] = '';
|
||||
queryParam[field + '_end'] = '';
|
||||
queryParam['[]'] = '';
|
||||
queryParam[field] = undefined;
|
||||
});
|
||||
currentDateRange.value = [];
|
||||
//刷新数据
|
||||
reload();
|
||||
}
|
||||
|
|
@ -267,7 +290,7 @@ async function scfkd() {
|
|||
|
||||
const handleTimeSearchChange = (value) => {
|
||||
// 清空之前的日期字段值
|
||||
['qgDate', 'jhTime_', 'wjTime_'].forEach(field => {
|
||||
['qgDate', 'jhTime', 'wjTime'].forEach(field => {
|
||||
if (field !== value) {
|
||||
queryParam[field + '_begin'] = '';
|
||||
queryParam[field + '_end'] = '';
|
||||
|
|
@ -279,9 +302,57 @@ const handleTimeSearchChange = (value) => {
|
|||
};
|
||||
|
||||
const handleDateRangeChange = (dates) => {
|
||||
queryParam[timeSearchValue.value] = dates;
|
||||
if (dates && dates.length === 2) {
|
||||
// 对于jhTime和wjTime字段,拼接时分秒
|
||||
if (timeSearchValue.value === 'jhTime' || timeSearchValue.value === 'wjTime') {
|
||||
queryParam[timeSearchValue.value + '_begin'] = dates[0] + ' 00:00:00';
|
||||
queryParam[timeSearchValue.value + '_end'] = dates[1] + ' 23:59:59';
|
||||
} else {
|
||||
// 其他字段保持原样
|
||||
queryParam[timeSearchValue.value + '_begin'] = dates[0];
|
||||
queryParam[timeSearchValue.value + '_end'] = dates[1];
|
||||
}
|
||||
} else {
|
||||
delete queryParam[timeSearchValue.value + '_begin'];
|
||||
delete queryParam[timeSearchValue.value + '_end'];
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* 计算已勾选行的总金额
|
||||
*/
|
||||
function calculateSelectedTotal() {
|
||||
if (!selectedRows.value || selectedRows.value.length === 0) {
|
||||
selectedTotalAmount.value = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
// 将xiaoJi字段从字符串转换为数字并求和
|
||||
selectedTotalAmount.value = selectedRows.value.reduce((total, row) => {
|
||||
// 确保xiaoJi字段存在且是有效数字
|
||||
const amount = parseFloat(row.xiaoJi) || 0;
|
||||
return total + amount;
|
||||
}, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 金额格式化函数
|
||||
*/
|
||||
function formatPrice(value) {
|
||||
if (value == null || value === '') {
|
||||
return '0.00';
|
||||
}
|
||||
|
||||
const num = parseFloat(value);
|
||||
if (isNaN(num)) {
|
||||
return '0.00';
|
||||
}
|
||||
|
||||
// 格式化为两位小数
|
||||
return num.toFixed(2);
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
scfkd
|
||||
});
|
||||
|
|
|
|||
|
|
@ -14,6 +14,21 @@ export const columns: BasicColumn[] = [
|
|||
title: '供应商',
|
||||
align: 'center',
|
||||
dataIndex: 'gysName',
|
||||
width: 400,
|
||||
},
|
||||
{
|
||||
title: '付款金额(元)',
|
||||
align: 'center',
|
||||
dataIndex: 'xiaoJi',
|
||||
customRender: ({ text }) => {
|
||||
const num = parseFloat(text);
|
||||
// 处理无效值
|
||||
if (isNaN(num)) {
|
||||
return '0.00';
|
||||
}
|
||||
// 格式化为两位小数
|
||||
return num.toFixed(2);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '采购日期',
|
||||
|
|
@ -48,9 +63,9 @@ export const wlColumns: BasicColumn[] = [
|
|||
dataIndex: 'wlName',
|
||||
},
|
||||
{
|
||||
title: '到货单价',
|
||||
title: '规格型号',
|
||||
align: 'center',
|
||||
dataIndex: 'arrivalPrice',
|
||||
dataIndex: 'wlSpecificationModel',
|
||||
},
|
||||
{
|
||||
title: '采购单位',
|
||||
|
|
@ -58,14 +73,50 @@ export const wlColumns: BasicColumn[] = [
|
|||
dataIndex: 'wlUnits',
|
||||
},
|
||||
{
|
||||
title: '入库数量',
|
||||
title: '采购单价',
|
||||
align: 'center',
|
||||
dataIndex: 'rksl',
|
||||
dataIndex: 'procurementPrice',
|
||||
customRender: ({ text }) => {
|
||||
const num = parseFloat(text);
|
||||
// 处理无效值
|
||||
if (isNaN(num)) {
|
||||
return '0.00';
|
||||
}
|
||||
// 格式化为两位小数
|
||||
return num.toFixed(2);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '小计(元)',
|
||||
title: '到货单价',
|
||||
align: 'center',
|
||||
dataIndex: 'crkje',
|
||||
customRender: ({ text }) => {
|
||||
const num = parseFloat(text);
|
||||
// 处理无效值
|
||||
if (isNaN(num)) {
|
||||
return '0.00';
|
||||
}
|
||||
// 格式化为两位小数
|
||||
return num.toFixed(2);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '入库数量',
|
||||
align: 'center',
|
||||
dataIndex: 'crksl',
|
||||
},
|
||||
{
|
||||
title: '小计',
|
||||
align: 'center',
|
||||
dataIndex: 'xiaoJi',
|
||||
|
||||
customRender: ({ text }) => {
|
||||
const num = parseFloat(text);
|
||||
// 处理无效值
|
||||
if (isNaN(num)) {
|
||||
return '0.00';
|
||||
}
|
||||
// 格式化为两位小数
|
||||
return num.toFixed(2);
|
||||
},
|
||||
},
|
||||
];
|
||||
|
|
|
|||
Loading…
Reference in New Issue