From 509f1d71c91242b11fd287cfcdeafe3d19b2d807 Mon Sep 17 00:00:00 2001 From: 马宇豪 <978517621@qq.com> Date: 星期二, 04 三月 2025 11:11:46 +0800 Subject: [PATCH] 新增 --- src/views/specialOperationsPay/coalPay/components/studentDialog.vue | 96 ++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 84 insertions(+), 12 deletions(-) diff --git a/src/views/specialOperationsPay/coalPay/components/studentDialog.vue b/src/views/specialOperationsPay/coalPay/components/studentDialog.vue index 28a7602..d1f8f2e 100644 --- a/src/views/specialOperationsPay/coalPay/components/studentDialog.vue +++ b/src/views/specialOperationsPay/coalPay/components/studentDialog.vue @@ -24,12 +24,12 @@ <el-row :gutter="24"> <el-col :span="12" v-if="stuInfo.payType === 1 || stuInfo.payType === 3 || stuInfo.payType === 4"> <el-form-item label="理论类别:"> - <span>{{stuInfo.coalCategoryList.find(i=>i.categoryType == 1).subjectName}}</span> + <span>{{stuInfo.coalCategoryList.find(i => i.categoryType == 1) && stuInfo.coalCategoryList.find(i => i.categoryType == 1).subjectName }}</span> </el-form-item> </el-col> <el-col :span="12" v-if="stuInfo.payType === 2 || stuInfo.payType === 3"> <el-form-item label="实操类别:"> - <span>{{stuInfo.coalCategoryList.find(i=>i.categoryType == 2).subjectName}}</span> + <span>{{stuInfo.coalCategoryList.find(i => i.categoryType == 2) && stuInfo.coalCategoryList.find(i => i.categoryType == 2).subjectName }}</span> </el-form-item> </el-col> </el-row> @@ -75,18 +75,21 @@ </el-form> <!-- 表格--> - <div style="margin: 20px 15px;display: flex"> - <el-button size="small" type="primary" @click="handleAddStu('add',{})">添加学员</el-button> - <el-button size="small" type="primary" @click="importDialog = true">批量导入</el-button> + <div style="margin: 20px 15px;display: flex;justify-content: space-between"> + <div> + <el-button size="small" type="primary" @click="handleAddStu('add',{})">添加学员</el-button> + <el-button size="small" type="primary" @click="importDialog = true">批量导入</el-button> + </div> + <el-button type="text" @click="exportExcel">导出清单</el-button> </div> - <el-table v-loading="loading" :data="stuList"> + <el-table v-loading="loading" :data="stuList" id="table_excel"> <el-table-column label="序号" align="center" type="index" /> <el-table-column label="姓名" align="center" prop="name" /> <el-table-column label="身份证号" align="center" prop="idCard" /> <el-table-column label="手机号" align="center" prop="phone" /> <el-table-column label="性别" align="center" prop="sex"> <template #default="scope"> - {{scope.row.sex == 0?'男':scope.row.sex == 1?'女':'未知'}} + {{(parseInt(scope.row.idCard.substr(16, 1))) % 2 === 0 ? "女" : "男"}} </template> </el-table-column> <el-table-column label="财政缴款码" align="center" prop="payCode"> @@ -96,9 +99,11 @@ </el-table-column> <el-table-column label="是否已缴" align="center" prop="payStatus"> <template #default="scope"> - {{scope.row.payStatus == 0?'未缴':scope.row.payStatus == 1?'已缴':'未缴'}} + <span v-if="scope.row.payStatus == 1" style="color: green">已缴</span> + <span v-else style="color: red">未缴</span> </template> </el-table-column> + <el-table-column label="培训机构" align="center" prop="train" /> <el-table-column label="类别" align="center" prop="payType"> <template #default="scope"> {{scope.row.payType == 1?'个人':scope.row.payType == 2?'集体':'个人'}} @@ -106,9 +111,10 @@ </el-table-column> <el-table-column label="操作" align="center"> <template #default="scope"> - <el-button size="mini" type="text" v-if="scope.row.payStatus == 1" style="color: #1890ff">查看票据</el-button> - <el-button size="mini" type="text" style="color: #1890ff" @click="handleAddStu('edit',scope.row)">修改</el-button> - <el-button size="mini" type="text" style="color:lightcoral" @click="handleDelete(scope.row)">删除</el-button> + <el-button size="mini" type="text" v-if="scope.row.payStatus == 1" style="color: #1890ff" @click="checkTicket">查看票据</el-button> + <el-button size="mini" type="text" v-if="scope.row.payStatus == 0" style="color: #1890ff" @click="goPay(scope.row)">去缴费</el-button> + <el-button size="mini" type="text" style="color: #1890ff" v-if="!(scope.row.payCode && scope.row.payCode!=='')" @click="handleAddStu('edit',scope.row)">修改</el-button> + <el-button size="mini" type="text" style="color:lightcoral" v-if="!(scope.row.payCode && scope.row.payCode!=='')" @click="handleDelete(scope.row)">删除</el-button> </template> </el-table-column> </el-table> @@ -137,6 +143,9 @@ <el-radio :label="0">男</el-radio> <el-radio :label="1">女</el-radio> </el-radio-group> + </el-form-item> + <el-form-item label="培训机构:"> + <el-input v-model.trim="dataForm.train"/> </el-form-item> <el-form-item label="身份证号:" prop="idCard"> <el-input v-model.trim="dataForm.idCard"/> @@ -202,7 +211,15 @@ </template> <script> import {verifyIdCard, verifySimplePhone} from "@/utils/validate"; -import {addCoalPayStu, delCoalPayStu, editCoalPayStu, getCoalPayStudentList} from "@/api/specialOperationsPay/coalPay"; +import { + addCoalPayStu, + coalPersonPay, + delCoalPayStu, + editCoalPayStu, + getCoalPayStudentList +} from "@/api/specialOperationsPay/coalPay"; +import * as XLSX from 'xlsx'; +import { saveAs } from 'file-saver'; import exampleFile from '@/assets/studentInfo.xlsx' import {getToken} from "@/utils/auth"; export default { @@ -262,6 +279,38 @@ }; }, methods: { + exportExcel() { + var xlsxParam = { raw: true } + let tables = document.getElementById('table_excel') + let clonedTable = tables.cloneNode(true); // 深度克隆 + // 删除克隆表格中的最后一列 + const allRows = clonedTable.querySelectorAll('tr'); + allRows.forEach((row,index) => { + const cells = row.querySelectorAll('th,td'); + if (cells.length > 0) { + if(index == 0){ + row.removeChild(cells[cells.length - 2]); // 表头行要特殊处理 + }else{ + row.removeChild(cells[cells.length - 1]); // 移除最后一个单元格 + } + } + }) + let table_book = this.$XLSX.utils.table_to_book(clonedTable, xlsxParam); + const table_write = this.$XLSX.write(table_book, { + bookType: 'xlsx', + bookSST: true, + type: 'array' + }); + try { + this.$FileSaver.saveAs( + new Blob([table_write], { type: 'application/octet-stream' }), + `${this.stuInfo.batchName}批次学员缴费清单.xlsx` + ); + } catch (e) { + if (typeof console !== 'undefined') console.log(e, table_write); + } + return table_write + }, openDialog(val) { this.stuInfo = val this.getStuList(this.stuInfo.id) @@ -401,6 +450,29 @@ } }) }, + checkTicket(){ + window.open('http://finpt.xjcz.gov.cn/fs-public/index.do') + }, + async goPay(item){ + if(item.payCode && item.payCode !== ''){ + window.open(`http://finpt.xjcz.gov.cn/fs-public/billQuery/findByOrderId.do?orderId=${item.orderId}&deviceType=1`) + }else{ + const query = { + coalPayId: item.coalPayId, + studentId: item.id + } + const res = await coalPersonPay(query) + if(res.code == 200) { + window.open(`http://finpt.xjcz.gov.cn/fs-public/billQuery/findByOrderId.do?orderId=${res.msg}&deviceType=1`) + }else{ + this.payLoading = false + this.$message({ + type:'warning', + message: res.msg + }) + } + } + }, handleDelete(row){ this.$confirm('此操作将永久删除该条数据, 是否继续?', '提示', { confirmButtonText: '确定', -- Gitblit v1.9.2