From b3b2e701b4bb5b0615035149518607927ba24366 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=98huanghaiixia=E2=80=99?= <980486410@.com> Date: Fri, 6 Feb 2026 17:33:38 +0800 Subject: [PATCH] =?UTF-8?q?=E9=94=80=E5=94=AE=E7=BB=93=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/dayPlan/PngSettleHdr/index.ts | 28 ++- src/components/common/measureListModal.vue | 193 ++++++++++++++++++ .../common/priceComposeListModal.vue | 92 +++++++++ .../dayPlan/PngSettleHdr/components/config.ts | 19 +- .../PngSettleHdr/components/createForm.vue | 157 +++++++++++--- src/views/dayPlan/PngSettleHdr/index.vue | 2 +- 6 files changed, 452 insertions(+), 39 deletions(-) create mode 100644 src/components/common/measureListModal.vue create mode 100644 src/components/common/priceComposeListModal.vue diff --git a/src/api/dayPlan/PngSettleHdr/index.ts b/src/api/dayPlan/PngSettleHdr/index.ts index cdc4245..af3da97 100644 --- a/src/api/dayPlan/PngSettleHdr/index.ts +++ b/src/api/dayPlan/PngSettleHdr/index.ts @@ -3,14 +3,38 @@ import { defHttp } from '/@/utils/http/axios'; import { ErrorMessageMode } from '/#/axios'; enum Api { - Page = '/dayPlan/pngSettleHdr/page', + // Page = '/dayPlan/pngSettleHdr/page', + Page = '/magic-api/dayPlan/pngSettleSalesHdrPage', List = '/dayPlan/pngSettleHdr/list', Info = '/dayPlan/pngSettleHdr/info', LngPngSettleHdr = '/dayPlan/pngSettleHdr', + PageAdd = '/magic-api/dayPlan/pngSettleSalesHdrSelectPage', + date = '/magic-api/dayPlan/pngSettleSalesHdrSelectDateTo', - +} +export async function getLngPngSettleHdrDate(params, mode: ErrorMessageMode = 'modal') { + return defHttp.get( + { + url: Api.date, + params, + }, + { + errorMessageMode: mode, + }, + ); +} +export async function getLngPngSettleHdrPageAdd(params: LngPngSettleHdrPageParams, mode: ErrorMessageMode = 'modal') { + return defHttp.get( + { + url: Api.PageAdd, + params, + }, + { + errorMessageMode: mode, + }, + ); } /** diff --git a/src/components/common/measureListModal.vue b/src/components/common/measureListModal.vue new file mode 100644 index 0000000..ae7b464 --- /dev/null +++ b/src/components/common/measureListModal.vue @@ -0,0 +1,193 @@ + + + + diff --git a/src/components/common/priceComposeListModal.vue b/src/components/common/priceComposeListModal.vue new file mode 100644 index 0000000..7e1fd3a --- /dev/null +++ b/src/components/common/priceComposeListModal.vue @@ -0,0 +1,92 @@ + + + + diff --git a/src/views/dayPlan/PngSettleHdr/components/config.ts b/src/views/dayPlan/PngSettleHdr/components/config.ts index 1c51eba..4556bd2 100644 --- a/src/views/dayPlan/PngSettleHdr/components/config.ts +++ b/src/views/dayPlan/PngSettleHdr/components/config.ts @@ -8,10 +8,11 @@ export const formConfig = { export const searchFormSchema: FormSchema[] = [ { field: 'datePlan', - label: '结算日期', + label: '结算月', component: 'RangePicker', componentProps: { - format: 'YYYY-MM-DD', + format: 'YYYY-MM', + picker: 'month', style: { width: '100%' }, getPopupContainer: () => document.body, }, @@ -30,7 +31,7 @@ export const columns: BasicColumn[] = [ title: '结算月', componentType: 'input', align: 'left', - + width: 100, sorter: true, }, @@ -39,7 +40,7 @@ export const columns: BasicColumn[] = [ title: '结算月开始日期', componentType: 'input', align: 'left', - + width: 140, sorter: true, }, @@ -48,12 +49,12 @@ export const columns: BasicColumn[] = [ title: '结算月结束日期', componentType: 'input', align: 'left', - + width: 140, sorter: true, }, { - dataIndex: 'cpCode', + dataIndex: 'cpName', title: '客户简称', componentType: 'input', align: 'left', @@ -89,7 +90,7 @@ export const columns: BasicColumn[] = [ }, { - dataIndex: 'comId', + dataIndex: 'comName', title: '交易主体', componentType: 'input', align: 'left', @@ -116,11 +117,11 @@ export const columns: BasicColumn[] = [ }, { - dataIndex: 'approCode', + dataIndex: 'approName', title: '审批状态', componentType: 'input', align: 'left', - + width: 100, sorter: true, }, ]; diff --git a/src/views/dayPlan/PngSettleHdr/components/createForm.vue b/src/views/dayPlan/PngSettleHdr/components/createForm.vue index 929d26a..273aea6 100644 --- a/src/views/dayPlan/PngSettleHdr/components/createForm.vue +++ b/src/views/dayPlan/PngSettleHdr/components/createForm.vue @@ -21,12 +21,12 @@ - + - + {{ item.name }} @@ -44,17 +44,17 @@ - + - + - + @@ -83,16 +83,19 @@ 新增 删除 - + - + @@ -100,6 +103,8 @@ + + @@ -115,12 +120,14 @@ import type { Rule } from 'ant-design-vue/es/form'; import { getDictionary } from '/@/api/sales/Customer'; import { useModal } from '/@/components/Modal'; - import { addLngContract,updateLngContract, getLngContract} from '/@/api/contract/ContractSalesInt'; + import { addLngPngSettleHdr,updateLngPngSettleHdr, getLngPngSettleHdr, getLngPngSettleHdrDate} from '/@/api/dayPlan/PngSettleHdr'; import dayjs from 'dayjs'; import { getAppEnvConfig } from '/@/utils/env'; import { message } from 'ant-design-vue'; import UploadList from '/@/components/Form/src/components/UploadList.vue'; import customerListModal from '/@/components/common/customerListModal.vue'; + import measureListModal from '/@/components/common/measureListModal.vue'; + import priceComposeListModal from '/@/components/common/priceComposeListModal.vue'; import { getAllCom} from '/@/api/contract/ContractPurInt'; const tableName = 'ContractSalesInt'; @@ -147,32 +154,33 @@ const pageType = ref(currentRoute.value.query?.type); const pageId = ref(currentRoute.value.query?.id) - const contractQty = ref() const spinning = ref(false); - const curIdx = ref(null) const { notification } = useMessage(); const { t } = useI18n(); - const isExpend=ref(false) const formState = reactive({ approCode: 'WTJ', - typeCode: 'SI', - onlineSign: 'N', - cpTableName: 'lng_customer', - lngContractSalesIntList: [{}] + settleMonth: dayjs(new Date()), + settleTypeCode: 'I', + rpSign: 'Y' }); - const [register, { openModal:openModal}] = useModal(); + const [registerMeasure, { openModal:openModalMeasure}] = useModal(); const [registerCustomer, { openModal:openModalCustomer}] = useModal(); + const [registerPrice, { openModal:openModalPrice}] = useModal(); const rules= reactive({ - kNo: [{ required: true, message: "该项为必填项", trigger: 'change' }], - kName: [{ required: true, message: "该项为必填项", trigger: 'change' }], + settleMonth: [{ required: true, message: "该项为必填项", trigger: 'change' }], + dateFrom: [{ required: true, message: "该项为必填项", trigger: 'change' }], + dateTo: [{ required: true, message: "该项为必填项", trigger: 'change' }], cpName: [{ required: true, message: "该项为必填项", trigger: 'change' }], + rpSign: [{ required: true, message: "该项为必填项", trigger: 'change' }], + comId: [{ required: true, message: "该项为必填项", trigger: 'change' }], }); const layout = { labelCol: { span: 8 }, wrapperCol: { span: 16 }, } const dataFile = ref([]); + const dataFileAccount = ref([]) const dataList = ref([]) let optionSelect= reactive({ approCodeList: [], @@ -227,13 +235,16 @@ const onSelectChange = (rowKeys) => { selectedKeys.value = rowKeys; } + const uploadChange = (val) => { + dataFileAccount.value = val + } const uploadListChange = (val) => { dataFile.value = val } async function getInfo(id) { spinning.value = true try { - let data = await getLngContract(id) + let data = await getLngPngSettleHdr(id) spinning.value = false Object.assign(formState, {...data}) Object.assign(dataFile.value, formState.lngFileUploadList || []) @@ -245,9 +256,25 @@ spinning.value = false } } + const comIdChange = (val) => { + if (!val)return + getDate() + } + const getDate=(async () => { + let obj = { + cpCode: formState.cpCode, + comId: formState.comId + } + if (!pageId.value && formState.cpCode && formState.comId && !formState.dateFrom) { + let data = await getLngPngSettleHdrDate(obj) || [] + if (data.length) { + formState.dateFrom = data[0] + formState.dateTo = null + } + } + }) async function getOption() { optionSelect.approCodeList = await getDictionary('LNG_APPRO') - optionSelect.comIdList = await getAllCom() || [] optionSelect.signList = await getDictionary('LNG_YN') @@ -266,11 +293,81 @@ } return endValue.valueOf() <= startValue.valueOf(); } - const handleBtn = () => { - + const handleBtn = (type) => { + if (type === 'add') { + openModalMeasure(true,{isUpdate: false}) + } else { + if (!selectedKeys.value.length) { + message.warn('请选择删除数据') + return + } + selectedKeys.value.forEach(i => { + let idx = dataList.value.findIndex(v=>v.salesId == i) + idx>-1&&dataList.value.splice(idx, 1) + }); + setTimeout(() => { + selectedKeys.value = [] + }, 8000); + } } - const btnCheck = () => { - + const handleSuccessMeasure = (val) => { + if (!dataList.value.length) { + dataList.value = val + return + } + val.forEach(v=> { + dataList.value.forEach(k=> { + if (v.salesId!==k.salesId) { + dataList.value.push(v) + } + }) + }) + } + const btnCheck = (record, index, type) => { + if (type == 'delete') { + dataList.value.splice(index, 1) + } else { + openModalPrice(true,{isUpdate: false, record}) + } + } + const handleSuccessPrice = (arr, curRecord) => { + let qtySettleGj = 0 + let qtySettleM3 = 0 + let amount = 0 + arr.forEach(v=> { + qtySettleGj+=Number(v.qtySettleGj) || 0 + qtySettleM3+=Number(v.qtySettleM3) || 0 + amount+=Number(v.amount) || 0 + }) + // 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) + dataList.value[idx].amount = amount.toFixed(2) + dataList.value[idx].priceGj = priceGj.toFixed(4) + dataList.value[idx].priceM3 = priceM3.toFixed(4) + dataList.value[idx].lngPngSettleSalesDtlList = arr + tableCount() + } + } + const tableCount = () => { + let qtySettleGj = 0 + let qtySettleM3 = 0 + let amount = 0 + dataList.value.forEach(v => { + if (Number(v.settleTimes) == 1){ + qtySettleGj+=Number(v.qtySettleGj) || 0 + qtySettleM3+=Number(v.qtySettleM3) || 0 + } + amount+=Number(v.amount) || 0 + }) + formState.qtySettleGj = qtySettleGj.toFixed(3) + formState.qtySettleM3 = qtySettleM3.toFixed(3) + formState.amount = amount.toFixed(2) } const onSearchCustomer = () => { openModalCustomer(true,{isUpdate: false}) @@ -278,6 +375,7 @@ const handleSuccessCustomer = (val) => { formState.cpCode = val[0].cuCode formState.cpName = val[0].cuName + getDate() } function close() { tabStore.closeTab(currentRoute.value, router); @@ -288,13 +386,18 @@ async function handleSubmit(type) { try { await formRef.value.validateFields(); + dataList.value.forEach(v => { + v.settleTypeCode = 'I' + }) let obj = { ...formState, lngFileUploadList: dataFile.value, + billList: dataFileAccount.value, + lngPngSettleSalesList: dataList.value, } spinning.value = true; - let request = !formState.id ? addLngContract :updateLngContract + let request = !formState.id ? addLngPngSettleHdr :updateLngPngSettleHdr try { const data = await request(obj); @@ -319,7 +422,7 @@ console.log(errorInfo, 'errorInfo') spinning.value = false; errorInfo?.errorFields?.length && notification.warning({ - message: 'Tip', + message: '提示', description: '请完善信息' }); return false diff --git a/src/views/dayPlan/PngSettleHdr/index.vue b/src/views/dayPlan/PngSettleHdr/index.vue index 64e38d8..eb6f2f6 100644 --- a/src/views/dayPlan/PngSettleHdr/index.vue +++ b/src/views/dayPlan/PngSettleHdr/index.vue @@ -120,7 +120,7 @@ gutter: 16, }, schemas: customSearchFormSchema, - fieldMapToTime: [['datePlan', ['startDate', 'endDate'], 'YYYY-MM-DD']], + fieldMapToTime: [['datePlan', ['startDate', 'endDate'], 'YYYY-MM']], showResetButton: true, }, beforeFetch: (params) => {