This commit is contained in:
dzc committed 2025-06-24 15:11:23 +08:00
commit c7ed4ae2ba
3 files changed
+144 -51

No files matched your search

+2 -1
View File
@@ -34,6 +34,7 @@
"element-plus": "2.5.5",
"form-designer-plus": "^0.1.5",
"highlight.js": "^11.7.0",
"html-to-image": "^1.11.13",
"js-base64": "^3.7.7",
"js-cookie": "^3.0.1",
"json-editor-vue3": "^1.1.1",
@@ -116,4 +117,4 @@
"type": "git",
"url": "https://gitee.com/log4j/pig"
}
}
}
+113 -46
View File
@@ -1,8 +1,7 @@
<template>
<div class="layout-padding">
<div class="layout-padding-auto layout-padding-view">
<el-form v-show="showSearch" ref="queryRef" :inline="true" :model="state.queryForm"
@keyup.enter="getDataList">
<el-form v-show="showSearch" ref="queryRef" :inline="true" :model="state.queryForm" @keyup.enter="getDataList">
<el-row>
<el-form-item style="width: 300px" label="用户" prop="userIds">
<select-user v-model="state.queryForm.userIds" placeholder="用户" />
@@ -11,47 +10,60 @@
<select-wallet-type v-model="state.queryForm.walletTypeId" placeholder="饭卡类型" clearable />
</el-form-item>
<el-form-item style="width: 200px" label="充值类型" prop="bizType">
<dict-select v-model="state.queryForm.bizType" dict-code="wallet_biz_recharge"
placeholder="充值类型" />
<dict-select v-model="state.queryForm.bizType" dict-code="wallet_biz_recharge" placeholder="充值类型" />
</el-form-item>
<el-form-item style="width: 450px" label="创建时间" prop="createTimeList">
<el-date-picker v-model="state.queryForm.createTimeList" value-format="YYYY-MM-DD HH:mm:ss"
type="datetimerange" />
<el-date-picker v-model="state.queryForm.createTimeList" value-format="YYYY-MM-DD HH:mm:ss" type="datetimerange" />
</el-form-item>
<el-form-item style="width: 450px" label="审核时间" prop="processTimeList">
<el-date-picker v-model="state.queryForm.processTimeList" value-format="YYYY-MM-DD HH:mm:ss"
type="datetimerange" />
<el-date-picker v-model="state.queryForm.processTimeList" value-format="YYYY-MM-DD HH:mm:ss" type="datetimerange" />
</el-form-item>
<el-form-item>
<el-button icon="Search" type="primary" @click="getDataList">{{ $t("common.queryBtn")
}}</el-button>
<el-button icon="Search" type="primary" @click="getDataList">{{ $t("common.queryBtn") }}</el-button>
<el-button icon="Refresh" @click="resetQuery">{{ $t("common.resetBtn") }}</el-button>
</el-form-item>
</el-row>
</el-form>
<el-row>
<div class="mb8" style="width: 100%">
<el-button icon="folder-add" type="primary" class="ml10" @click="uploadExcelRef.show()"
v-auth="'wallet_walletRechargeApply_add'">
<el-button icon="folder-add" type="primary" class="ml10" @click="uploadExcelRef.show()" v-auth="'wallet_walletRechargeApply_add'">
导 入
</el-button>
<el-button v-if="false" plain :disabled="multiple" icon="Delete" type="primary"
v-auth="'wallet_walletRechargeApply_del'" @click="handleDelete(selectObjs)">
<el-button
v-if="false"
plain
:disabled="multiple"
icon="Delete"
type="primary"
v-auth="'wallet_walletRechargeApply_del'"
@click="handleDelete(selectObjs)"
>
删除
</el-button>
<div class="flex justify-between items-center">
<el-tabs class="flex-1" v-model="activeName" @tab-click="handleClickTabItem">
<el-tab-pane v-for="v in tabItems" :key="v.id" :label="v.label" :name="v.value" />
</el-tabs>
<right-toolbar v-model:showSearch="showSearch" :export="'wallet_walletRechargeApply_export'"
@exportExcel="exportExcel" class="ml10 mr20" style="float: right"
@queryTable="getDataList" />
<right-toolbar
v-model:showSearch="showSearch"
:export="'wallet_walletRechargeApply_export'"
@exportExcel="exportExcel"
class="ml10 mr20"
style="float: right"
@queryTable="getDataList"
/>
</div>
</div>
</el-row>
<el-table :data="state.dataList" v-loading="state.loading" border :cell-style="tableStyle.cellStyle"
:header-cell-style="tableStyle.headerCellStyle" @selection-change="selectionChangHandle"
@sort-change="sortChangeHandle">
<el-table
:data="state.dataList"
v-loading="state.loading"
border
:cell-style="tableStyle.cellStyle"
:header-cell-style="tableStyle.headerCellStyle"
@selection-change="selectionChangHandle"
@sort-change="sortChangeHandle"
>
<el-table-column type="selection" width="40" align="center" />
<el-table-column type="index" label="#" width="80" />
<el-table-column prop="username" label="申请人" />
@@ -98,50 +110,96 @@
</div>
</template>
</el-table-column>
<el-table-column label="操作" v-auths="[
'wallet_walletRechargeApply_view',
'wallet_walletRechargeApply_apply',
'wallet_walletRechargeApply_edit',
'wallet_walletRechargeApply_del',
'wallet_walletRechargeApply_check',
]" width="300" fixed="right">
<el-table-column
label="操作"
v-auths="[
'wallet_walletRechargeApply_view',
'wallet_walletRechargeApply_apply',
'wallet_walletRechargeApply_edit',
'wallet_walletRechargeApply_del',
'wallet_walletRechargeApply_check',
]"
width="300"
fixed="right"
>
<template #default="{ row }">
<el-button v-if="row.importTime" icon="Document" text type="primary"
v-auth="'wallet_walletRechargeApply_view'" @click="doInfo(row)">
<el-button
v-if="row.importTime"
icon="Document"
text
type="primary"
v-auth="'wallet_walletRechargeApply_view'"
@click="doInfo(row)"
>
数据
</el-button>
<el-button v-if="row.importTime && !row.processId" icon="Connection" text type="primary"
v-auth="'wallet_walletRechargeApply_apply'" @click="doApply(row)">
<el-button
v-if="row.importTime && !row.processId"
icon="Connection"
text
type="primary"
v-auth="'wallet_walletRechargeApply_apply'"
@click="doApply(row)"
>
申请
</el-button>
<el-button v-if="!row.processId" icon="edit-pen" text type="primary"
v-auth="'wallet_walletRechargeApply_edit'" @click="formDialogRef.openDialog(row.id)">
<el-button
v-if="!row.processId"
icon="edit-pen"
text
type="primary"
v-auth="'wallet_walletRechargeApply_edit'"
@click="formDialogRef.openDialog(row.id)"
>
编辑
</el-button>
<el-button v-if="row.isCheckUser && row.processStatus == '1'" type="primary" size="small" link
icon="VideoPlay" @click="deal(row)" v-auth="'wallet_walletRechargeApply_check'">
<el-button
v-if="row.isCheckUser && row.processStatus == '1'"
type="primary"
size="small"
link
icon="VideoPlay"
@click="deal(row)"
v-auth="'wallet_walletRechargeApply_check'"
>
开始处理
</el-button>
<el-button
v-if="row.userId == userInfos?.user?.userId && [null, '1'].includes(row.processStatus)"
icon="delete" text type="primary" v-auth="'wallet_walletRechargeApply_del'"
@click="handleDelete([row.id])">
icon="delete"
text
type="primary"
v-auth="'wallet_walletRechargeApply_del'"
@click="handleDelete([row.id])"
>
删除
</el-button>
<el-button v-auth="'wallet_walletRechargeApply_print'" v-if="['1'].includes(row.processStatus)"
icon="GoodsFilled" text type="primary" @click="previewInvoice(row)">打印发票</el-button>
<el-button
v-auth="'wallet_walletRechargeApply_print'"
v-if="['1'].includes(row.processStatus)"
icon="printer"
text
type="primary"
@click="previewInvoice(row)"
>
打印发票
</el-button>
</template>
</el-table-column>
</el-table>
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle"
v-bind="state.pagination" />
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
</div>
<!-- 编辑、新增 -->
<form-dialog ref="formDialogRef" @refresh="getDataList(false)" />
<upload-excel ref="uploadExcelRef" title="用户信息导入" url="/wallet/wallet-recharge-apply/read-excel"
temp-url="/admin/sys-file/local/file/wallet_recharge.xlsx" @refreshDataList="getDataList(false)" />
<upload-excel
ref="uploadExcelRef"
title="用户信息导入"
url="/wallet/wallet-recharge-apply/read-excel"
temp-url="/admin/sys-file/local/file/wallet_recharge.xlsx"
@refreshDataList="getDataList(false)"
/>
<!-- 审批抽屉 -->
<process-drawer ref="processDrawerRef" @task-submit-event="taskSubmitEvent" />
@@ -160,6 +218,7 @@ import { ElLoading, ElMessage } from "element-plus"
import ProcessDrawer from "/@/components/processDrawer/index.vue"
import { getDicts } from "/@/api/admin/dict"
import { useUserInfo } from "/@/stores/userInfo"
import { getInvoice } from "/@/api/wallet/wallet-recharge-invoice"
const { push } = useRouter()
@@ -310,9 +369,17 @@ const taskSubmitEvent = () => {
}
// 预览发票
const previewInvoice = (row: any) => {
// receiptData.value = row
printDialogVisible.value = true
const previewInvoice = async (row: any) => {
try {
const res = await getInvoice({ id: row.id })
if (res.code == 0) {
receiptData.value = res.data
printDialogVisible.value = true
return
}
} catch (error: any) {
useMessage().error(error.msg)
}
}
</script>
@@ -1,6 +1,6 @@
<template>
<el-dialog v-model="visible" title="打印发票" width="900px" :close-on-click-modal="false" draggable destroy-on-close>
<div class="border border-gray-300 p-6 bg-[#EBE1C622]">
<el-dialog v-model="visible" title="预览" width="900px" :close-on-click-modal="false" draggable destroy-on-close>
<div id="receiptRef" ref="receiptRef" class="border border-gray-300 p-6 bg-[#EBE1C622]">
<div class="text-center text-4xl font-bold">浦江县行政事业单位食堂统一收款收据</div>
<div class="flex justify-between items-end mb-1">
@@ -64,6 +64,7 @@
<template #footer>
<el-button @click="handleClose">关闭</el-button>
<el-button type="primary" @click="saveReceipt">保存</el-button>
<el-button type="primary" @click="handlePrint">打印</el-button>
</template>
</el-dialog>
@@ -71,6 +72,9 @@
<script setup lang="ts">
import { ref, computed } from "vue"
import * as htmlToImage from "html-to-image"
import { toPng, toJpeg, toBlob, toPixelData, toSvg } from "html-to-image"
import { useMessage } from "/@/hooks/message"
interface ReceiptData {
receiptNo?: string
@@ -102,8 +106,8 @@ const receiptData = computed(
cashier: "",
},
)
const receiptRef = ref<HTMLElement | null>()
// 监听 visible 变化
watch(
() => visible.value,
(newVal) => {
@@ -111,7 +115,6 @@ watch(
},
)
// 监听 props.modelValue 变化
watch(
() => props.modelValue,
(newVal) => {
@@ -123,6 +126,28 @@ const handleClose = () => {
visible.value = false
}
const saveReceipt = () => {
if (receiptRef.value) {
htmlToImage
.toPng(receiptRef.value, {
canvasWidth: 1920,
canvasHeight: 900,
backgroundColor: "#ffffff",
// style: {},
})
.then((dataUrl: string) => {
console.log(dataUrl)
const img = new Image()
img.src = dataUrl
})
.catch((err) => {
useMessage().error(err)
})
}
// visible.value = false
}
const handlePrint = () => {
window.print()
}