销售结算

This commit is contained in:
‘huanghaiixia’
2026-02-10 15:08:56 +08:00
parent b3b2e701b4
commit 72d3ccbc6d
7 changed files with 207 additions and 63 deletions

View File

@ -215,8 +215,8 @@
formState.value.alterSign = 'I'
formState.value.approCode = 'WTJ'
const res = await getCompDept(userInfo.id)
formState.value.cuCode = res?.comp?.code
formState.value.comId = res?.comp?.id
formState.value.cuCode = res?.dept?.code
formState.value.comId = res?.dept?.id
const res1 = await getLngPngDemandRate({}) || []
formState.value.rateM3Gj = res1[0]?.rateM3Gj
}

View File

@ -54,7 +54,7 @@ export const columns: BasicColumn[] = [
},
{
dataIndex: 'cpName',
dataIndex: 'cuSname',
title: '客户简称',
componentType: 'input',
align: 'left',

View File

@ -83,13 +83,13 @@
<a-button v-if="!isDisable" type="primary" style="margin-bottom: 10px;margin-right: 10px;" @click="handleBtn('add')">新增</a-button>
<a-button v-if="!isDisable" @click="handleBtn('del')">删除</a-button>
</div>
<a-table :columns="columns" :data-source="dataList" :scroll="{x: 1300}" rowKey="salesId" :pagination="false" :row-selection="{ selectedRowKeys: selectedKeys, onChange: onSelectChange }">
<a-table :columns="columns" :data-source="dataList" :scroll="{x: 1500}" rowKey="salesId" :pagination="false" :row-selection="{ selectedRowKeys: selectedKeys, onChange: onSelectChange }">
<template #bodyCell="{ column, record, index }">
<template v-if="column.dataIndex === 'operation'">
<a v-if="!isDisable" @click="btnCheck(record, index, 'delete')">删除</a>
</template>
<template v-if="column.dataIndex === 'priceDesc'">
<a v-if="!isDisable" @click="btnCheck(record, index, 'price')">增量</a>
<a v-if="!isDisable" @click="btnCheck(record, index, 'price')">{{record.priceDesc}}</a>
</template>
</template>
</a-table>
@ -129,9 +129,10 @@
import measureListModal from '/@/components/common/measureListModal.vue';
import priceComposeListModal from '/@/components/common/priceComposeListModal.vue';
import { getAllCom} from '/@/api/contract/ContractPurInt';
import { DataFormat, FormatOption, DATE_FORMAT, FormatType } from '/@/utils/dataFormat';
const tableName = 'ContractSalesInt';
const columnName = 'ContractSalesInt'
const tableName = 'PngSettleHdr';
const columnName = 'PngSettleHdr'
const formType = ref('2'); // 0 新建 1 修改 2 查看
const formRef = ref();
@ -194,16 +195,16 @@
{ title: t('提气日期'), dataIndex: 'dateMea', width: 130},
{ title: t('客户'), dataIndex: 'cuName', width: 200},
{ title: t('下载点'), dataIndex: 'pointDelyName',width: 150 },
{ title: t('完成量(吉焦)'), dataIndex: 'qtyMeaGj', width: 120},
{ title: t('完成量(吉焦)'), dataIndex: 'qtyMeaGj', width: 150},
{ title: t('完成量(方)'), dataIndex: 'qtyMeaM3', width: 120},
{ title: t('结算量(吉焦)'), dataIndex: 'qtySettleGj', width: 120},
{ title: t('结算量(方)'), dataIndex: 'qtySettleM3', width: 120},
{ title: t('结算价格(元/吉焦)'), dataIndex: 'priceGj', width: 120},
{ title: t('结算价格(元/方)'), dataIndex: 'priceM3', width: 120},
{ title: t('结算金额(元)'), dataIndex: 'amount', width: 120},
{ title: t('结算量(吉焦)'), dataIndex: 'qtySettleGj', width: 140},
{ title: t('结算量(方)'), dataIndex: 'qtySettleM3', width: 130},
{ title: t('结算价格(元/吉焦)'), dataIndex: 'priceGj', width: 190},
{ title: t('结算价格(元/方)'), dataIndex: 'priceM3', width: 170},
{ title: t('结算金额(元)'), dataIndex: 'amount', width: 140},
{ title: t('价格组成'), dataIndex: 'priceDesc', width: 120},
{ title: t('合同名称'), dataIndex: 'kName', width: 120},
{ title: t('操作'), dataIndex: 'operation', width: 220},
{ title: t('合同名称'), dataIndex: 'ksName', width: 170},
{ title: t('操作'), dataIndex: 'operation', width: 100},
]);
watch(
() => props.id,
@ -246,11 +247,30 @@
try {
let data = await getLngPngSettleHdr(id)
spinning.value = false
Object.assign(formState, {...data})
let a = DataFormat.format({...data}, [
FormatOption.createQty('qtySettleGj'),
FormatOption.createQty('qtySettleM3'),
FormatOption.createAmt('amount'),
]);
Object.assign(formState, a)
Object.assign(dataFile.value, formState.lngFileUploadList || [])
Object.assign(dataFileAccount.value, formState.billList || [])
Object.assign(dataList.value, formState.lngPngSettleSalesList || [])
formState.settleMonth = formState.settleMonth ? dayjs(formState.settleMonth) : null
formState.dateFrom = formState.dateFrom ? dayjs(formState.dateFrom) : null
formState.dateTo = formState.dateTo ? dayjs(formState.dateTo) : null
dataList.value = DataFormat.format(dataList.value, [
FormatOption.createQty('qtySettleGj'),
FormatOption.createQty('qtySettleM3'),
FormatOption.createQty('qtyMeaGj'),
FormatOption.createQty('qtyMeaM3'),
FormatOption.createAmt('amount'),
FormatOption.createQty('priceGj',4),
FormatOption.createQty('priceM3',4),
]);
} catch (error) {
console.log(error, 'error')
spinning.value = false
@ -295,7 +315,15 @@
}
const handleBtn = (type) => {
if (type === 'add') {
openModalMeasure(true,{isUpdate: false})
if (!formState.cpCode || !formState.comId) {
message.warn('请选择客户和交易主体')
return
}
let obj = {
cpCode: formState.cpCode,
comId: formState.comId
}
openModalMeasure(true,{isUpdate: false, searchParams: obj})
} else {
if (!selectedKeys.value.length) {
message.warn('请选择删除数据')
@ -334,16 +362,20 @@
let qtySettleGj = 0
let qtySettleM3 = 0
let amount = 0
let idx = dataList.value.findIndex(v =>v.salesId == curRecord.salesId)
arr.forEach(v=> {
qtySettleGj+=Number(v.qtySettleGj) || 0
qtySettleM3+=Number(v.qtySettleM3) || 0
amount+=Number(v.amount) || 0
if (!pageId.value &&idx>-1&& !(dataList.value[idx].lngPngSettleSalesDtlList || []).length) {
v.id = ''
}
})
// price_gj=amount/qty_settle_gj保留4位小数
// price_m3=amount/qty_settle_m3保留4位小数
let priceGj = qtySettleGj ? Number(amount) / Number(qtySettleGj) : '0'
let priceM3 = qtySettleM3 ? Number(amount) / Number(qtySettleM3) : '0'
let idx = dataList.value.findIndex(v =>v.salesId == curRecord.salesId)
if (idx > -1) {
dataList.value[idx].qtySettleGj = qtySettleGj.toFixed(3)
dataList.value[idx].qtySettleM3 = qtySettleM3.toFixed(3)
@ -374,7 +406,7 @@
}
const handleSuccessCustomer = (val) => {
formState.cpCode = val[0].cuCode
formState.cpName = val[0].cuName
formState.cpName = val[0].cuSname
getDate()
}
function close() {

View File

@ -18,6 +18,11 @@
<template v-if="column.dataIndex === 'action'">
<TableAction :actions="getActions(record)" />
</template>
<template v-if="column.dataIndex === 'lngFileUploadList'">
<div v-for="(item, idx) in record.lngFileUploadList">
<a @click="handleDownload(item)">{{item.fileOrg}}</a>
</div>
</template>
</template>
</BasicTable>
<PngSettleHdrModal @register="registerModal" @success="handleSuccess" />
@ -49,6 +54,7 @@
import ApprovalProcess from '/@/views/workflow/task/components/ApprovalProcess.vue';
import { getDraftInfo } from '/@/api/workflow/process';
import { isValidJSON } from '/@/utils/event/design';
import { downloadByUrl } from '/@/utils/file/download';
import PngSettleHdrModal from './components/PngSettleHdrModal.vue';
import {formConfig, searchFormSchema, columns } from './components/config';
@ -57,6 +63,9 @@
import { DataFormat, FormatOption, DATE_FORMAT, FormatType } from '/@/utils/dataFormat';
import useEventBus from '/@/hooks/event/useEventBus';
import { cloneDeep } from 'lodash-es';
import { useUserStore } from '/@/store/modules/user';
const userStore = useUserStore();
const userInfo = userStore.getUserInfo;
const { bus, CREATE_FLOW, FLOW_PROCESSED, FORM_LIST_MODIFIED } = useEventBus();
@ -72,7 +81,7 @@
const tableRef = ref();
//所有按钮
const buttons = ref([{"isUse":true,"name":"新增","code":"add","icon":"ant-design:plus-outlined","isDefault":true,"type":"primary"},{"isUse":true,"name":"编辑","code":"edit","icon":"ant-design:form-outlined","isDefault":true},{"isUse":true,"name":"生成对账单","code":"check","icon":"ant-design:check-outlined","isDefault":true},{"isUse":true,"name":"取消结算","code":"cancel","icon":"ant-design:close-outlined","isDefault":false},{"isUse":true,"name":"刷新","code":"refresh","icon":"ant-design:reload-outlined","isDefault":true},{"isUse":true,"name":"查看","code":"view","icon":"ant-design:eye-outlined","isDefault":true},{"isUse":true,"name":"发起审批","code":"startwork","icon":"ant-design:form-outlined","isDefault":true},{"isUse":true,"name":"查看流转记录","code":"flowRecord","icon":"ant-design:form-outlined","isDefault":true},{"isUse":true,"name":"审批","code":"approve","icon":"ant-design:check-outlined","isDefault":true},{"isUse":true,"name":"删除","code":"delete","icon":"ant-design:delete-outlined","isDefault":true}]);
const buttons = ref([{"isUse":true,"name":"新增","code":"add","icon":"ant-design:plus-outlined","isDefault":true,"type":"primary"},{"isUse":true,"name":"编辑","code":"edit","icon":"ant-design:form-outlined","isDefault":true},{"isUse":true,"name":"生成对账单","code":"check","icon":"ant-design:check-outlined","isDefault":true},{"isUse":true,"name":"取消结算","code":"cancel","icon":"ant-design:close-outlined","isDefault":false},{"isUse":true,"name":"刷新","code":"refresh","icon":"ant-design:reload-outlined","isDefault":true},{"isUse":true,"name":"查看","code":"view","icon":"ant-design:eye-outlined","isDefault":true},{"isUse":true,"name":"发起审批","code":"startwork","icon":"ant-design:form-outlined","isDefault":true},{"isUse":true,"name":"查看流转记录","code":"flowRecord","icon":"ant-design:form-outlined","isDefault":true},{"isUse":true,"name":"审批","code":"approve","icon":"ant-design:check-outlined","isDefault":true},{"isUse":true,"name":"删除","code":"delete","icon":"ant-design:delete-outlined","isDefault":true},{"name":"数据日志","code":"datalog","icon":"ant-design:profile-outlined","isDefault":true,"isUse":true}]);
//展示在列表内的按钮
const actionButtons = ref<string[]>(['view', 'edit','datalog', 'copyData', 'delete', 'startwork','flowRecord','approve']);
const buttonConfigs = computed(()=>{
@ -87,7 +96,7 @@
return buttonConfigs.value?.filter((x) => actionButtons.value.includes(x.code));
});
const btnEvent = {add : handleAdd,edit : handleEdit,refresh : handleRefresh,view : handleView,startwork : handleStartwork,flowRecord : handleFlowRecord,approve : handleApprove,delete : handleDelete,}
const btnEvent = {add : handleAdd,edit : handleEdit,refresh : handleRefresh,view : handleView,startwork : handleStartwork,flowRecord : handleFlowRecord,approve : handleApprove,delete : handleDelete,datalog : handleDatalog}
const { currentRoute } = useRouter();
const router = useRouter();
@ -107,6 +116,7 @@
const visibleApproveProcessRef = ref(false);
const taskIdRef = ref('');
const selectedKeys = ref([])
const visibleFlowRecordModal = ref(false);
const [registerModal, { openModal }] = useModal();
const formName=currentRoute.value.meta?.title
@ -141,6 +151,14 @@
dataIndex: 'action',
slots: { customRender: 'action' },
},
rowSelection: {
type: 'checkbox',
onChange: onSelectChange,
getCheckboxProps: (record) => ({
disabled: record.approCode !== 'YSP',
name: record.name,
}),
},
tableSetting: {
size: false,
setting: false,
@ -166,6 +184,14 @@
deep: true,
}
);
const handleDownload = (info) => {
const url = parseDownloadUrl(info.response ? info.response.data.fileUrl : info.fileUrl);
const fileName = info.response ? info.response.data.fileOrg : info.fileOrg;
downloadByUrl({ url, fileName: fileName});
};
function onSelectChange(rowKeys: string[]) {
selectedKeys.value = rowKeys;
}
function dbClickRow(record) {
if (!actionButtonConfig?.value.some(element => element.code == 'view')) {
return;
@ -177,7 +203,9 @@
query: {
taskId: taskIds[0],
formName: formName,
formId:currentRoute.value.meta.formId
formId:currentRoute.value.meta.formId,
id: record.id,
readonly: 1,
}
});
} else if (schemaId && !taskIds && processId) {
@ -187,18 +215,32 @@
readonly: 1,
taskId: '',
formName: formName,
formId:currentRoute.value.meta.formId
formId:currentRoute.value.meta.formId,
id: record.id,
}
});
} else {
router.push({
path: '/form/PngSettleHdr/' + record.id + '/viewForm',
query: {
formPath: 'dayPlan/PngSettleHdr',
formName: formName,
formId:currentRoute.value.meta.formId
}
});
if (schemaIdComputedRef.value) {
router.push({
path: '/flow/' + schemaIdComputedRef.value + '/0/createFlow',
query: {
formPath: 'dayPlan/PngSettleHdr',
formName: "查看"+formName,
formId:currentRoute.value.meta.formId,
type:'edit',
id: record.id,
disabled: 1,
}
});
}
// router.push({
// path: '/form/PngSettleHdr/' + record.id + '/viewForm',
// query: {
// formPath: 'dayPlan/PngSettleHdr',
// formName: formName,
// formId:currentRoute.value.meta.formId
// }
// });
}
}
@ -233,18 +275,42 @@
}
function handleEdit(record: Recordable) {
router.push({
path: '/form/PngSettleHdr/' + record.id + '/updateForm',
query: {
if (schemaIdComputedRef.value) {
router.push({
path: '/flow/' + schemaIdComputedRef.value + '/0/createFlow',
query: {
formPath: 'dayPlan/PngSettleHdr',
formName: formName,
formId:currentRoute.value.meta.formId
}
});
formName: "编辑"+formName,
formId:currentRoute.value.meta.formId,
type:'edit',
id: record.id
}
});
} else {
router.push({
path: '/form/PngSettleHdr/' + record.id + '/updateForm',
query: {
formPath: 'dayPlan/PngSettleHdr',
formName: formName,
formId:currentRoute.value.meta.formId
}
});
}
}
function handleApprove () {
const { processId, taskIds, schemaId } = record.workflowData || {};
if (taskIds && taskIds.length) {
router.push({
path: '/flow/' + schemaId + '/' + (processId || '') + '/approveFlow',
query: {
taskId: taskIds[0],
formName: "审批"+formName,
formId:currentRoute.value.meta.formId,
id: record.id
}
});
}
}
function handleDelete(record: Recordable) {
deleteList([record.id]);
@ -305,9 +371,10 @@
let actionsList: ActionItem[] = [];
let editAndDelBtn: ActionItem[] = [];
let hasFlowRecord = false;
let approveBtn: ActionItem[] = [];
let hasFlowRecord = false;
actionButtonConfig.value?.map((button) => {
if (['view', 'copyData'].includes(button.code)) {
if (['view', 'copyData','datalog'].includes(button.code)) {
actionsList.push({
icon: button?.icon,
tooltip: button?.name,
@ -322,21 +389,41 @@
onClick: btnEvent[button.code].bind(null, record),
});
}
if (['approve'].includes(button.code)) {
approveBtn.push({
icon: button?.icon,
tooltip: button?.name,
onClick: btnEvent[button.code].bind(null, record),
});
}
if (button.code === 'flowRecord') hasFlowRecord = true;
});
if (record.workflowData?.enabled) {
//与工作流有关联的表单
if (record.workflowData.status) {
actionsList.unshift(setIndexFlowStatus(record.workflowData))
} else {
actionsList = actionsList.concat(editAndDelBtn);
}
} else {
if (!record.workflowData?.processId) {
//与工作流没有关联的表单并且在当前页面新增的数据 如选择编辑、删除按钮则加上
actionsList = actionsList.concat(editAndDelBtn);
// 未提交或已驳回
if (record.approCode == 'WTJ' || record.approCode == 'YBH' ) {
actionsList = actionsList.concat(editAndDelBtn);
if (record.createUserId !== userInfo.id) {
let idx = actionsList.findIndex(v =>v.tooltip == '删除')
idx > -1 && actionsList.splice(idx, 1)
}
}
// 审批中SPZ
if (record.workflowData?.editable) {
actionsList = actionsList.concat(approveBtn);
}
// if (record.workflowData?.enabled) {
// //与工作流有关联的表单
// if (record.workflowData.status) {
// actionsList.unshift(setIndexFlowStatus(record.workflowData))
// } else {
// actionsList = actionsList.concat(editAndDelBtn);
// }
// } else {
// if (!record.workflowData?.processId) {
// //与工作流没有关联的表单并且在当前页面新增的数据 如选择编辑、删除按钮则加上
// actionsList = actionsList.concat(editAndDelBtn);
// }
// }
return actionsList;
}
function handleStartwork(record: Recordable) {