|
@@ -4,7 +4,7 @@ import { useDropDownData } from '@/hooks/useDropDownData';
|
|
|
import { ref, reactive, computed, onBeforeMount, unref, Ref } from 'vue';
|
|
|
import { useQueryList } from '@/hooks/useQueryList';
|
|
|
import { useEleFormValidate } from '@/hooks/useEleFormValidate';
|
|
|
-import { api_customerBillList, api_customerBillReportDownload } from '@/api/accountPeriod/accountPeriod';
|
|
|
+import { api_billReportEndTimeStatus, api_customerBillList, api_customerBillReportDownload } from '@/api/accountPeriod/accountPeriod';
|
|
|
import { resCodeSuccess } from '@/utils/useReturnData';
|
|
|
import { ListIitem } from '@/api/base/BaseDataModel';
|
|
|
import { formatDate, getCurrentDateAndPretDate } from '@/utils/dateTimeStr';
|
|
@@ -13,6 +13,7 @@ import { usePersonnel } from '@/store/list_personnel';
|
|
|
import { useApiDownTemplate } from '@/hooks/useApiDownTemplate';
|
|
|
import { isArrayLength } from '@/utils/is';
|
|
|
import { useMessage } from '@/hooks/useMessage';
|
|
|
+import { ReportEndTimeStatus } from '@/type/BaseEnum';
|
|
|
|
|
|
const { createMessage } = useMessage()
|
|
|
/**
|
|
@@ -126,6 +127,7 @@ function useCustomerBill(customerBillOptions: BasicTableProps, customerBillTable
|
|
|
customerId: row.customerId,
|
|
|
periodBeginDate: row.periodBeginDate,
|
|
|
periodEndDate: row.periodEndDate,
|
|
|
+ customerBillId: row.id,
|
|
|
},
|
|
|
params: {
|
|
|
customerId: row.customerId,
|
|
@@ -181,6 +183,40 @@ function useCustomerBill(customerBillOptions: BasicTableProps, customerBillTable
|
|
|
const targetData = Array.from(summaryData, ([currencyCode, data]) => ({ currencyCode, ...data }));
|
|
|
unref(summaryShowRef)?.show(targetData)
|
|
|
}
|
|
|
+ // 获取表格选中账单id的数据
|
|
|
+ const getCheckboxRecords = () => {
|
|
|
+ const $table = unref(customerBillTableRef)
|
|
|
+ if(!$table) return []
|
|
|
+ const checkData = $table.getCheckboxRecords()
|
|
|
+ const customerBillIdList = checkData.map(item => item.id)
|
|
|
+ return customerBillIdList.filter(item => item)
|
|
|
+ }
|
|
|
+ // 结账锁定
|
|
|
+ const onClosingLockBtn = async () => {
|
|
|
+ const customerBillIdList = getCheckboxRecords()
|
|
|
+ if (!isArrayLength<number>(customerBillIdList)) {
|
|
|
+ createMessage.warning('请勾选需要锁定的数据!')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const res = await api_billReportEndTimeStatus({ customerBillIdList, status: ReportEndTimeStatus.LOCKING })
|
|
|
+ if (resCodeSuccess(res)) {
|
|
|
+ createMessage.success('操作成功')
|
|
|
+ searchBtn()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 重算解锁
|
|
|
+ const onRecalculateUnlockBtn = async () => {
|
|
|
+ const customerBillIdList = getCheckboxRecords()
|
|
|
+ if (!isArrayLength<number>(customerBillIdList)) {
|
|
|
+ createMessage.warning('请勾选需要解锁的数据!')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const res = await api_billReportEndTimeStatus({ customerBillIdList, status: ReportEndTimeStatus.UNLOCK })
|
|
|
+ if (resCodeSuccess(res)) {
|
|
|
+ createMessage.success('操作成功')
|
|
|
+ searchBtn()
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
return {
|
|
|
customerBillFormRef,
|
|
@@ -200,6 +236,8 @@ function useCustomerBill(customerBillOptions: BasicTableProps, customerBillTable
|
|
|
reportDownloadBtn,
|
|
|
customerBillReportLoading,
|
|
|
summaryBtn,
|
|
|
+ onClosingLockBtn,
|
|
|
+ onRecalculateUnlockBtn,
|
|
|
currencyList,
|
|
|
summaryShowRef
|
|
|
}
|