7/24 收银台 日期筛选,合计

This commit is contained in:
Zy
2026-07-24 09:23:50 +08:00
parent 0c4c9676b5
commit 903c92fef0
8 changed files with 143 additions and 219 deletions

View File

@@ -22,6 +22,8 @@ export const cashQuery = (data: { residentName?: string; queryType: number }): A
};
export type billlistType = {
actualAccount: string;
singleDiscountAmount: string;
'villageId': string;
'residentId': string;
'houseId': string;

View File

@@ -15,8 +15,8 @@
<div class="flex flex-items-center">
<div style="width: 50px; text-align: right; padding-right: 10px">楼栋</div>
<div class="flex-1"></div>
<el-select @change="handleChangebuilding" clearable style="width: 120px" v-model="queryParams.buildingId">
<el-option v-for="(item, index) in buildinglist" :key="index" :label="item.buildingName" :value="item.id"></el-option>
<el-select @change="handleChangeBuilding" clearable style="width: 120px" v-model="queryParams.buildingId">
<el-option v-for="(item, index) in buildingList" :key="index" :label="item.buildingName" :value="item.id"></el-option>
</el-select>
</div>
<div class="flex flex-items-center mr-20px">
@@ -49,11 +49,19 @@
</div>
</div>
<div>
<el-button type="primary" @click="getlist">查询</el-button>
<el-button type="primary" @click="getList">查询</el-button>
<el-button @click="resetQuery">重置</el-button>
</div>
</nav>
<el-table row-key="houseId" v-loading="loading" ref="multipleTableRef" :data="tableData" border @selection-change="handleSelectionChange">
<el-table
style="height: 500px"
row-key="houseId"
v-loading="loading"
ref="multipleTableRef"
:data="tableData"
border
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" align="center" width="55" type="index" />
<el-table-column label="小区" align="center" prop="villageName" />
@@ -70,15 +78,15 @@
<div class="dialog-footer flex flex-items-center flex-justify-between">
<pagination
style="margin-top: 0"
layout="total, prev, pager, next, jumper"
layout="total, prev, sizes, pager, next, jumper"
v-show="total > 0"
:total="total"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
@pagination="getlist"
@pagination="getList"
/>
<div>
<el-button @click="conback">退出</el-button>
<el-button @click="conBack">退出</el-button>
<el-button type="primary" @click="confirm"> 确定 </el-button>
</div>
</div>
@@ -176,7 +184,7 @@ const handleUserSelection = () => {
const houseUseTypeList = ref([]);
const isFetching = ref(false);
// 获取列表
function getlist() {
function getList() {
isFetching.value = true; // 🔒 加锁:禁止 selection-change 更新数据
loading.value = true;
listBillHouse(queryParams.value)
@@ -195,39 +203,39 @@ function getlist() {
}
/** 楼栋列表 */
const buildinglist = ref([]);
const buildingList = ref([]);
/** 房屋列表 */
const unitlist = ref([]);
/** 获取楼栋 列表 */
function handleChangeHouse() {
getBuildinglistAPI().then((res) => {
buildinglist.value = res.data;
buildingList.value = res.data;
});
}
function handleClear() {
queryParams.value.residentName = '';
getlist();
getList();
}
function handleHouseUseChange() {
getlist();
getList();
}
/** 单元列表 */
function handleChangebuilding(val: string) {
function handleChangeBuilding(val: string) {
queryParams.value.unitNoId = null;
unitlist.value = [];
if (queryParams.value.buildingId) {
getHouselistAPI(val).then((res) => {
unitlist.value = res.data.units;
getlist();
getList();
});
}
getlist();
getList();
}
function handleChangeUnit() {
getlist();
getList();
}
// ==============================================
@@ -285,11 +293,11 @@ function resetQuery() {
houseNo: '',
residentName: ''
};
getlist();
getList();
}
// 退出
function conback() {
function conBack() {
dialog.value.dialogVisible = false;
resetQuery();
}
@@ -338,7 +346,7 @@ defineExpose({
}) as BillHouse
);
}
getlist();
getList();
dialog.value.dialogVisible = true;
listHouseUseType_add_house().then((res) => {
houseUseTypeList.value = res.data;
@@ -356,7 +364,7 @@ defineExpose({
border: 1px solid #ccc;
border-radius: 5px;
padding: 0 10px;
.defaultbox {
.defaultBox {
display: flex;
align-items: center;
justify-content: space-between;

View File

@@ -34,13 +34,13 @@
</div>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item divided command="changecommunity">
<el-dropdown-item divided command="changecommunity" v-if="isShow">
<span>{{ proxy.$t('navbar.community') }}</span>
</el-dropdown-item>
<router-link to="/system/user/profile">
<router-link to="/system/user/profile" v-if="isShow">
<el-dropdown-item>{{ proxy.$t('navbar.personalCenter') }}</el-dropdown-item>
</router-link>
<el-dropdown-item divided command="logout">
<el-dropdown-item :divided="isShow" command="logout">
<span>{{ proxy.$t('navbar.logout') }}</span>
</el-dropdown-item>
</el-dropdown-menu>
@@ -109,7 +109,14 @@ const changecommunity = () => {
path: '/community'
});
};
const route = useRoute();
const isShow = ref(true);
const hiddenAction = ['communitylist'];
onMounted(() => {
if (hiddenAction.includes(typeof route.name === 'string' ? route.name : '')) {
isShow.value = false;
}
});
const emits = defineEmits(['setLayout']);
const setLayout = () => {
emits('setLayout');

View File

@@ -9,7 +9,6 @@ import App from './App.vue';
import store from './store';
import router from './router';
// 自定义指令
import directive from './directive';
import print from 'vue3-print-nb';
@@ -54,8 +53,8 @@ app.use(router);
app.use(store);
app.use(i18n);
app.use(VXETable);
app.use(plugins);
app.use(print);
app.use(plugins);
// 自定义指令
directive(app);

View File

@@ -87,7 +87,7 @@ export function convertToChineseCapital(num: number | string): string {
* 标准化为Big实例空/undefined/null转0
* @param num 数字 | 数字字符串
*/
function toBig(num: string | number | undefined | null): Big {
export function toBig(num: string | number | undefined | null): Big {
if (num === null || num === undefined || num === '') return new Big(0);
return new Big(num);
}
@@ -112,6 +112,12 @@ export function maxMoney(a: string | number, b: string | number): number {
const bigB = toBig(b);
return Number(bigA.gt(bigB) ? bigA : bigB);
}
// 取较小值
export function minMoney(a: string | number, b: string | number): number {
const bigA = toBig(a);
const bigB = toBig(b);
return Number(bigA.lt(bigB) ? bigA : bigB);
}
/**
* 减法 a - b
*/
@@ -119,6 +125,12 @@ export function sub(a: string | number, b: string | number): number {
return Number(toBig(a).minus(toBig(b)));
}
/**
* 加法 a + b
*/
export function add(a: string | number, b: string | number): number {
return Number(toBig(a).plus(toBig(b)));
}
/**
* 乘法 a * b
*/

View File

@@ -275,228 +275,87 @@ export function printTicketDiv(elementId: string, title: string = '票据打印'
}
const win = window.open('', '_blank', 'width=1200,height=1000');
if (!win) return;
// ==============================================
// 【核心1】复制 全局样式 + Element Plus 样式
// ==============================================
const styles = Array.from(document.querySelectorAll('link[rel="stylesheet"], style:not([scoped])'))
.map((item) => item.outerHTML)
.join('');
// ==============================================
// 【核心2】手动注入打印区域的 scoped 样式(关键!)
// ==============================================
const styles = '';
const printScopeStyle = `
<style>
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
margin: 0;
padding: 0.3cm;
background: #fff;
font-size: 12px;
font-family: "Microsoft YaHei", sans-serif;
page-break-inside: avoid !important;
}
/* 隐藏后台布局 */
.el-container, .el-aside, .el-header, .el-footer {
display: none !important;
}
/* ========== 核心:强制 宽25cm 高10cm 无边距 ========== */
@page {
size: 25cm 10cm;
margin: 0;
}
/* 打印容器:固定尺寸,限制单页 */
#${elementId} {
width: 25cm !important;
height: 10cm !important;
margin: 0 auto;
overflow: hidden;
page-break-after: avoid !important;
page-break-inside: avoid !important;
}
/* ========== 表格:压缩高度 + 禁止拆分 ========== */
table {
border-collapse: collapse;
width: 100% !important;
table-layout: fixed;
margin: 0.1cm 0;
page-break-inside: avoid !important;
transform-origin: top left;
/* 初始不缩放由JS动态控制 */
page-break-after: avoid !important;
}
table th, table td {
border: 1px solid #333;
font-size: 10px;
height:40px;
min-width:80px;
text-align: center;
padding: 1px 2px; /* 缩小内边距,减少高度 */
line-height: 1.1;
white-space: normal;
overflow: hidden;
}
</style>
`;
// ==============================================
// 【核心3】写入新窗口
// ==============================================
win.document.write(`
<!DOCTYPE html>
<html>
<head>
<title>${title}</title>
<meta charset="UTF-8">
${styles}
${printScopeStyle}
</head>
<body>
${el.outerHTML} <!-- 直接用innerHTML复制完整结构 -->
</body>
</html>
`);
win.document.close();
win.onload = () => {
const printContainer = win.document.getElementById(elementId);
if (!printContainer) {
win.close();
return;
}
setTimeout(() => {
const containerHeightPx = printContainer.clientHeight;
const contentHeightPx = printContainer.scrollHeight;
const containerWidthPx = printContainer.clientWidth;
const contentWidthPx = printContainer.scrollWidth;
// 固定顶部偏移量约0.2cm确保打印边缘不裁切内容╬D2╬╬2Σ╬╬╬╬2╬2222╬╬2╬22╬22╬22╬2╬╬2╬╬
const offsetPx = 20; // 可根据实际效果调整
// 计算可用高度(减去偏移)
const availableHeight = containerHeightPx - offsetPx;
// 如果内容高度超过可用高度,或宽度超过容器宽度,则等比缩放
let scale = 1;
let needScale = false;
if (contentHeightPx > availableHeight) {
scale = availableHeight / contentHeightPx;
needScale = true;
}
if (contentWidthPx > containerWidthPx) {
const scaleW = containerWidthPx / contentWidthPx;
if (scaleW < scale) {
scale = scaleW;
needScale = true;
}
}
// 应用 transform先缩放如果需要再整体下移固定偏移
if (needScale) {
printContainer.style.transform = `translateY(${offsetPx}px) scale(${scale})`;
} else {
// 即使不缩放,也下移避免顶部贴边
printContainer.style.transform = `translateY(${offsetPx}px)`;
}
// 确保缩放原点在左上,保证缩放后位置正确
printContainer.style.transformOrigin = 'top left';
// 执行打印
win.print();
win.close();
callback && callback();
}, 300); // 等待渲染完成
};
}
export function printTicketDiv2(elementId: string, title: string = '票据打印', callback?: () => void) {
const el = document.getElementById(elementId);
if (!el) {
console.error('未找到打印元素');
return;
}
const win = window.open('', '_blank', 'width=1200,height=1000');
if (!win) return;
// 复制全局非scoped样式Element Plus、全局公共样式
const styles = Array.from(document.querySelectorAll('link[rel="stylesheet"], style:not([scoped])'))
.map((item) => item.outerHTML)
.join('');
// 专属打印样式,根治空白第二页
const printScopeStyle = `
<style>
<style>
* {
box-sizing: border-box;
margin: 0 !important;
padding: 0 !important;
}
html, body {
height: auto !important;
min-height: auto !important;
margin: 0 !important;
padding: 0 !important;
width: 100%;
height: 100%;
background: #fff;
font-size: 12px;
font-family: "Microsoft YaHei", sans-serif;
page-break-inside: avoid !important;
}
/* 隐藏弹窗无关组件:输入框、按钮、弹窗头部 */
.el-input {
/* 隐藏后台布局 */
.el-container, .el-aside, .el-header, .el-footer {
display: none !important;
}
/* 纸张自适应宽高,无边距 */
/* ✅ @page 提升到外层,不要嵌套在 @media print 内部修复不生效BUG */
@page {
size: auto auto;
margin: 0mm !important;
size: 25cm 10cm !important;
margin: 0 !important;
}
/* 打印容器核心禁止分页 */
/* 自定义纸张 25cm × 10cm 无边距 */
@media print {
html {
height: 10cm !important;
overflow: hidden !important;
}
body {
/* 强制内容左上角对齐,禁止浏览器自动居中 */
transform-origin: top left !important;
position: absolute !important;
left: 0 !important;
top: 0 !important;
height: 10cm !important;
overflow: hidden !important;
}
/* =========票据容器:贴左上角,不再居中========= */
#${elementId} {
margin: 0 auto !important;
overflow: visible;
width: 25cm !important;
height: 10cm !important;
box-sizing: border-box;
page-break-inside: avoid !important;
page-break-before: avoid !important;
page-break-after: avoid !important;
break-inside: avoid !important;
break-after: avoid !important;
break-inside: avoid;
break-before: avoid;
break-after: avoid;
padding: 8mm; /* 内部留白,模拟页边距 */
}
.title{
font-weight: 800;
}
/* 表格禁止截断、压缩高度 */
table {
border-collapse: collapse;
width: 100% !important;
table-layout: fixed;
margin: 0.1cm 0;
page-break-inside: avoid !important;
break-inside: avoid !important;
break-inside: avoid;
table-layout: auto;
}
table th, table td {
border: 1px solid #333;
font-size: 10px;
height:32px; /* 缩小行高减少整体高度 */
min-width:80px;
height:40px;
text-align: center;
padding: 1px 2px;
line-height: 1.1;
white-space: normal;
overflow: hidden;
page-break-inside: avoid !important;
}
}
</style>
`;
// 只复制票据内部innerHTML不带外层el-dialog多余结构
const printContent = el.innerHTML;
win.document.write(`
const html = `
<!DOCTYPE html>
<html>
<head>
@@ -506,10 +365,12 @@ export function printTicketDiv2(elementId: string, title: string = '票据打印
${printScopeStyle}
</head>
<body>
<div id="${elementId}">${printContent}</div>
${el.outerHTML}
</body>
</html>
`);
`;
win.document.write(html);
win.document.close();
win.onload = () => {
setTimeout(() => {

View File

@@ -88,6 +88,23 @@
style="width: 100%"
/>
</el-form-item>
<!-- <el-form-item label="选择生成账单的房屋">-->
<!-- <div class="flex flex-col">-->
<!-- <div>-->
<!-- <el-radio-group v-model="BillForm.chargeScope">-->
<!-- <el-radio v-for="(item, index) in com_bill_charge_scope_house" :key="index" :value="item.value" :label="item.label"></el-radio>-->
<!-- </el-radio-group>-->
<!-- <div style="height: 32px" v-if="BillForm.chargeScope === '1'">-->
<!-- <el-button @click="OpenUseTablesFun" link type="primary" class="ml-10px">请选择房屋</el-button>-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
<!-- </el-form-item>-->
<!-- <el-form-item v-if="BillForm.chargeScope === '1'">-->
<!-- <div class="residentBox">-->
<!-- <House returnvalue="houseId" ref="HolderRef" :isMultiple="true" @change="handleSelect"> </House>-->
<!-- </div>-->
<!-- </el-form-item>-->
</el-form>
<template #footer>
<div class="dialog-footer">
@@ -107,6 +124,10 @@ import { listBill, manualGenerateApi } from '@/api/system/SdbBill';
import { BillVO, BillQuery, BillForm } from '@/api/system/SdbBill/type';
import { listChargeItem } from '@/api/system/SdbChargeItem';
import { checkPermi } from '@/utils/permission';
// import House from '@/components/Holder/house.vue';
import { ref } from 'vue';
// import UserHolder from '@/components/Holder/user.vue';
// import CarUser from '@/components/Holder/CarUser.vue';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { com_questionnaire_scope } = toRefs<any>(proxy?.useDict('com_questionnaire_scope'));
@@ -220,13 +241,26 @@ const BillForm = ref<{
title: string;
billId: string;
chargePeriod: string;
chargeScope: string;
yearMonths?: string[];
houseId: string[];
year?: string[];
}>({
title: '',
billId: '',
chargePeriod: '1'
chargePeriod: '1', // 账单类型
chargeScope: '0',
houseId: []
});
// const HolderRef = ref<InstanceType<typeof House>>();
// // 打开模态框
// function OpenUseTablesFun() {
// HolderRef.value.open(BillForm.value.houseId);
// }
// // 接受选择的房屋id
// function handleSelect(val: string[]) {
// BillForm.value.houseId = val;
// }
function handleChange(row: BillVO) {
clearChangeBillForm();
BillVisible.value = true;
@@ -250,7 +284,9 @@ function clearChangeBillForm() {
BillForm.value = {
title: '',
billId: '',
chargePeriod: '1'
chargePeriod: '1',
chargeScope: '0',
houseId: []
};
}

View File

@@ -149,7 +149,6 @@ const form = ref({
const rules = ref({
areaId: [{ required: true, message: '请选择区域', trigger: 'blur' }],
residentId: [{ required: true, message: '请选择', trigger: 'blur' }],
carNum: [
{
required: true,
@@ -157,7 +156,7 @@ const rules = ref({
trigger: ['blur']
}
],
carBrand: [{ required: true, message: '请输入车辆品牌', trigger: 'blur' }]
carBrand: [{ required: false, message: '请输入车辆品牌', trigger: 'blur' }]
});
function handleValidate() {
formRef.value.validateField('carNum');