| | |
| | | <div class="app-container"> |
| | | <div class="search_form"> |
| | | <div> |
| | | <span class="search_title">姓名:</span> |
| | | <el-input v-model="searchForm.staffName" |
| | | <span class="search_title">主题:</span> |
| | | <el-input |
| | | v-model="searchForm.title" |
| | | style="width: 240px" |
| | | placeholder="请输入姓名搜索" |
| | | @change="handleQuery" |
| | | placeholder="请输入主题" |
| | | clearable |
| | | :prefix-icon="Search" /> |
| | | <span class="search_title ml10">月份:</span> |
| | | <el-date-picker v-model="searchForm.payDateStr" |
| | | @keyup.enter="handleQuery" |
| | | /> |
| | | <span class="search_title ml10">单据状态:</span> |
| | | <el-select |
| | | v-model="searchForm.documentStatus" |
| | | placeholder="请选择单据状态" |
| | | clearable |
| | | style="width: 180px" |
| | | > |
| | | <el-option label="草稿" value="draft" /> |
| | | <el-option label="已提交" value="submitted" /> |
| | | <el-option label="已审核" value="approved" /> |
| | | </el-select> |
| | | <span class="search_title ml10">工资月份:</span> |
| | | <el-date-picker |
| | | v-model="searchForm.payMonth" |
| | | type="month" |
| | | @change="handleQuery" |
| | | value-format="YYYY-MM" |
| | | format="YYYY-MM" |
| | | placeholder="请选择月份" |
| | | style="width: 240px" |
| | | clearable /> |
| | | <el-button type="primary" |
| | | @click="handleQuery" |
| | | style="margin-left: 10px"> |
| | | placeholder="请选择工资月份" |
| | | style="width: 180px" |
| | | clearable |
| | | @change="handleQuery" |
| | | /> |
| | | <span class="search_title ml10">审核状态:</span> |
| | | <el-select |
| | | v-model="searchForm.approvalStatus" |
| | | placeholder="请选择审核状态" |
| | | clearable |
| | | style="width: 180px" |
| | | > |
| | | <el-option label="待审核" value="pending" /> |
| | | <el-option label="已通过" value="passed" /> |
| | | <el-option label="已驳回" value="rejected" /> |
| | | </el-select> |
| | | <el-button type="primary" @click="handleQuery" style="margin-left: 10px"> |
| | | 搜索 |
| | | </el-button> |
| | | </div> |
| | | <div> |
| | | <el-button @click="handleExport" |
| | | style="margin-right: 10px">导出</el-button> |
| | | <el-button type="primary" |
| | | @click="openForm('add')">新增台账</el-button> |
| | | <el-button type="danger" |
| | | plain |
| | | @click="handleDelete">删除</el-button> |
| | | <el-button @click="handleReset">重置</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="table_list"> |
| | | <PIMTable rowKey="id" |
| | | <div style="margin-bottom: 10px"> |
| | | <el-button type="primary" @click="openForm('add')">新建工资表</el-button> |
| | | <el-button @click="handleDelete">删除</el-button> |
| | | <el-button @click="handleExport">导出</el-button> |
| | | </div> |
| | | <PIMTable |
| | | rowKey="id" |
| | | :column="tableColumn" |
| | | :tableData="tableData" |
| | | :page="page" |
| | | :isSelection="true" |
| | | @selection-change="handleSelectionChange" |
| | | :tableLoading="tableLoading" |
| | | @selection-change="handleSelectionChange" |
| | | @pagination="pagination" |
| | | :total="page.total"></PIMTable> |
| | | :total="page.total" |
| | | /> |
| | | </div> |
| | | <form-dia v-model="dialogVisible" |
| | | <form-dia |
| | | v-model="dialogVisible" |
| | | :operation-type="operationType" |
| | | :row="currentRow" |
| | | ref="formDia" |
| | | @close="handleQuery"></form-dia> |
| | | ref="formDiaRef" |
| | | @close="handleQuery" |
| | | /> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { Search } from "@element-plus/icons-vue"; |
| | | import { |
| | | onMounted, |
| | | ref, |
| | |
| | | nextTick, |
| | | } from "vue"; |
| | | import { ElMessageBox } from "element-plus"; |
| | | import dayjs from "dayjs"; |
| | | import FormDia from "./components/formDia.vue"; |
| | | import PIMTable from "@/components/PIMTable/PIMTable.vue"; |
| | | import { |
| | | monthlyStatisticsListPage, |
| | | monthlyStatisticsDelete, |
| | |
| | | |
| | | const data = reactive({ |
| | | searchForm: { |
| | | staffName: "", |
| | | payDateStr: "", |
| | | title: "", |
| | | documentStatus: "", |
| | | payMonth: "", |
| | | approvalStatus: "", |
| | | }, |
| | | }); |
| | | |
| | | const { searchForm } = toRefs(data); |
| | | |
| | | const tableColumn = ref([ |
| | | { |
| | | label: "员工姓名", |
| | | prop: "staffName", |
| | | }, |
| | | { |
| | | label: "部门", |
| | | prop: "deptName", |
| | | width: 140, |
| | | }, |
| | | { |
| | | label: "月份", |
| | | prop: "payDate", |
| | | }, |
| | | { |
| | | label: "基本工资", |
| | | prop: "basicSalary", |
| | | }, |
| | | { |
| | | label: "计件工资", |
| | | prop: "pieceworkSalary", |
| | | }, |
| | | { |
| | | label: "计时工资", |
| | | prop: "hourlySalary", |
| | | }, |
| | | { |
| | | label: "其他收入", |
| | | prop: "otherIncome", |
| | | }, |
| | | { |
| | | label: "社保个人", |
| | | prop: "socialSecurityIndividuals", |
| | | }, |
| | | { |
| | | label: "公积金个人", |
| | | prop: "providentFundIndividuals", |
| | | width: 140, |
| | | }, |
| | | { |
| | | label: "工资个税", |
| | | prop: "personalIncomeTax", |
| | | }, |
| | | { |
| | | label: "其他支出", |
| | | prop: "otherDeductions", |
| | | }, |
| | | { |
| | | label: "应发工资", |
| | | prop: "payableWages", |
| | | }, |
| | | { |
| | | label: "应扣工资", |
| | | prop: "deductibleWages", |
| | | }, |
| | | { |
| | | label: "实发工资", |
| | | prop: "actualWages", |
| | | }, |
| | | { |
| | | label: "备注", |
| | | prop: "remark", |
| | | width: 150, |
| | | }, |
| | | { label: "工资主题", prop: "title", minWidth: 140 }, |
| | | { label: "工资月份", prop: "payMonth", width: 120 }, |
| | | { label: "单据状态", prop: "documentStatusName", width: 100 }, |
| | | { label: "审核状态", prop: "approvalStatusName", width: 100 }, |
| | | { label: "工资总额", prop: "totalAmount", width: 120 }, |
| | | { label: "支付银行", prop: "paymentBank", width: 120 }, |
| | | { label: "发放时间", prop: "issueTime", width: 160 }, |
| | | { label: "审批人员", prop: "approver", width: 100 }, |
| | | { label: "备注", prop: "remark", minWidth: 120 }, |
| | | { |
| | | dataType: "action", |
| | | label: "操作", |
| | | align: "center", |
| | | fixed: "right", |
| | | width: 220, |
| | | width: 120, |
| | | operation: [ |
| | | { |
| | | name: "编辑", |
| | | type: "text", |
| | | clickFun: row => { |
| | | openForm("edit", row); |
| | | clickFun: (row) => openForm("edit", row), |
| | | }, |
| | | }, |
| | | // { |
| | | // name: "查看", |
| | | // type: "text", |
| | | // clickFun: row => { |
| | | // openForm("view", row); |
| | | // }, |
| | | // }, |
| | | ], |
| | | }, |
| | | ]); |
| | |
| | | const tableLoading = ref(false); |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | size: 10, |
| | | total: 0, |
| | | }); |
| | | |
| | | const formDia = ref(); |
| | | const formDiaRef = ref(null); |
| | | const dialogVisible = ref(false); |
| | | const operationType = ref("add"); |
| | | const currentRow = ref({}); |
| | | const { proxy } = getCurrentInstance(); |
| | | |
| | | // 查询列表 |
| | | /** 搜索按钮操作 */ |
| | | const handleQuery = () => { |
| | | page.current = 1; |
| | | getList(); |
| | | }; |
| | | |
| | | const pagination = obj => { |
| | | const handleReset = () => { |
| | | searchForm.value.title = ""; |
| | | searchForm.value.documentStatus = ""; |
| | | searchForm.value.payMonth = ""; |
| | | searchForm.value.approvalStatus = ""; |
| | | page.current = 1; |
| | | getList(); |
| | | }; |
| | | |
| | | const pagination = (obj) => { |
| | | page.current = obj.page; |
| | | page.size = obj.limit; |
| | | getList(); |
| | |
| | | |
| | | const getList = () => { |
| | | tableLoading.value = true; |
| | | monthlyStatisticsListPage({ ...page, ...searchForm.value }) |
| | | .then(res => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.data.records; |
| | | page.total = res.data.total; |
| | | monthlyStatisticsListPage({ |
| | | ...searchForm.value, |
| | | current: page.current, |
| | | size: page.size, |
| | | }) |
| | | .catch(err => { |
| | | .then((res) => { |
| | | tableLoading.value = false; |
| | | const records = res.data?.records ?? []; |
| | | // 兼容后端字段:若接口仍返回台账结构,可在此做映射 |
| | | tableData.value = records.map((item) => ({ |
| | | ...item, |
| | | title: item.title ?? item.payDateStr ?? "-", |
| | | payMonth: item.payMonth ?? item.payDateStr ?? item.payDate ?? "-", |
| | | documentStatusName: item.documentStatusName ?? "-", |
| | | approvalStatusName: item.approvalStatusName ?? "-", |
| | | totalAmount: item.totalAmount ?? item.actualWages ?? "-", |
| | | paymentBank: item.paymentBank ?? "-", |
| | | issueTime: item.issueTime ?? item.createTime ?? "-", |
| | | approver: item.approver ?? "-", |
| | | })); |
| | | page.total = res.data?.total ?? 0; |
| | | }) |
| | | .catch(() => { |
| | | tableLoading.value = false; |
| | | }); |
| | | }; |
| | | |
| | | // 表格选择数据 |
| | | const handleSelectionChange = selection => { |
| | | const handleSelectionChange = (selection) => { |
| | | selectedRows.value = selection; |
| | | }; |
| | | |
| | | // 打开弹框 |
| | | const openForm = (type, row) => { |
| | | operationType.value = type; |
| | | currentRow.value = row || {}; |
| | | dialogVisible.value = true; |
| | | nextTick(() => { |
| | | formDia.value?.openDialog(type, row); |
| | | formDiaRef.value?.openDialog(type, row); |
| | | }); |
| | | }; |
| | | |
| | | // 删除 |
| | | const handleDelete = () => { |
| | | let ids = []; |
| | | if (selectedRows.value.length > 0) { |
| | | ids = selectedRows.value.map(item => item.id); |
| | | } else { |
| | | proxy.$modal.msgWarning("请选择数据"); |
| | | if (!selectedRows.value?.length) { |
| | | proxy.$modal.msgWarning("请选择要删除的数据"); |
| | | return; |
| | | } |
| | | const ids = selectedRows.value.map((item) => item.id); |
| | | ElMessageBox.confirm("选中的内容将被删除,是否确认删除?", "删除", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | monthlyStatisticsDelete(ids).then(res => { |
| | | monthlyStatisticsDelete(ids).then(() => { |
| | | proxy.$modal.msgSuccess("删除成功"); |
| | | getList(); |
| | | }); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已取消"); |
| | | }); |
| | | .catch(() => {}); |
| | | }; |
| | | |
| | | // 导出 |
| | | const handleExport = () => { |
| | | ElMessageBox.confirm("是否确认导出人员薪资台账?", "导出", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | proxy.download( |
| | | "/compensationPerformance/export", |
| | | { ...searchForm.value, ...page }, |
| | | "人员薪资台账.xlsx" |
| | | { ...searchForm.value, current: page.current, size: page.size }, |
| | | "工资表.xlsx" |
| | | ); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已取消"); |
| | | }); |
| | | }; |
| | | |
| | | onMounted(() => { |
| | |
| | | |
| | | <style scoped> |
| | | .search_form { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | margin-bottom: 20px; |
| | | flex-wrap: wrap; |
| | | gap: 10px; |
| | | } |
| | | |
| | | .search_title { |
| | | font-weight: 500; |
| | | margin-right: 5px; |
| | | } |
| | | |
| | | .ml10 { |
| | | margin-left: 10px; |
| | | } |
| | | |
| | | .table_list { |
| | | margin-top: 20px; |
| | | } |
| | | |
| | | .dialog-footer { |
| | | text-align: right; |
| | | } |
| | | </style> |