123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721 |
- <template>
- <el-dialog
- title="工资信息"
- v-model="visible"
- :width="width"
- append-to-body
- draggable
- @close="close"
- >
- <!-- 功能按钮 -->
- <div style="padding: 8px 24px 16px 24px">
- <el-form size="small" label-width="100px" v-model="form">
- <el-row :gutter="30">
- <el-col :span="12">
- <el-form-item label="客户名称">
- <div>{{ form.companyName }}</div>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="所属月份">
- <div>{{ form.year }}-{{ form.month }}</div>
- </el-form-item>
- </el-col>
- <el-col :span="24" class="details-container">
- <div class="details-head">
- <div class="title">
- <i class="fa fa-th-list" aria-hidden="true" /> 人员信息
- <el-button
- size="small"
- @click="printSalary"
- icon="printer"
- type="primary"
- >打印</el-button
- >
- <el-button
- size="small"
- @click="exportSalary"
- icon="download"
- type="info"
- >导出</el-button
- >
- </div>
- </div>
- <div class="details-body">
- <div>
- <el-table
- ref="sourceTable"
- :data="form.details"
- size="small"
- max-height="260px"
- border
- show-summary
- :summary-method="getSummaries"
- highlight-current-row
- header-row-class-name="list-header-row"
- row-class-name="list-row"
- @selection-change="handleCheckChange"
- @current-change="handleCurrentChange"
- >
- <el-table-column
- type="index"
- label="序号"
- width="50"
- align="center"
- />
- <el-table-column label="员工姓名" width="80" align="center">
- <template #default="scope">
- <div>
- {{ scope.row.employeeName }}
- </div>
- <span
- style="
- color: red;
- position: absolute;
- z-index: 10;
- top: 4px;
- right: 6px;
- "
- >*</span
- >
- </template>
- </el-table-column>
- <el-table-column label="身份证号" width="150" align="center">
- <template #default="scope">
- <div>
- {{ scope.row.idCode }}
- </div>
- <span
- style="
- color: red;
- position: absolute;
- z-index: 10;
- top: 4px;
- right: 6px;
- "
- >*</span
- >
- </template>
- </el-table-column>
- <el-table-column
- label="应发工资"
- width="70"
- header-align="center"
- align="right"
- prop="planSalary"
- >
- <template #default="scope">
- <div>
- {{ rowNum(scope.row.planSalary) }}
- </div>
- </template>
- </el-table-column>
- <el-table-column
- label="实发工资"
- width="70"
- header-align="center"
- align="right"
- prop="actuallySalary"
- >
- <template #default="scope">
- <div>
- {{ rowNum(scope.row.actuallySalary) }}
- </div>
- </template>
- </el-table-column>
- <el-table-column
- label="奖金及其他"
- width="95"
- header-align="center"
- align="right"
- prop="bonusAmount"
- >
- <template #default="scope">
- <div>
- {{ rowNum(scope.row.bonusAmount) }}
- </div>
- </template>
- </el-table-column>
- <el-table-column label="社保" align="center">
- <el-table-column
- label="养老保险"
- width="70"
- header-align="center"
- align="right"
- prop="endowmentInsurance"
- >
- <template #default="scope">
- <div>
- {{ rowNum(scope.row.endowmentInsurance) }}
- </div>
- </template>
- </el-table-column>
- <el-table-column
- label="医疗保险"
- width="70"
- header-align="center"
- align="right"
- prop="medicalInsurance"
- >
- <template #default="scope">
- <div>
- {{ rowNum(scope.row.medicalInsurance) }}
- </div>
- </template>
- </el-table-column>
- <el-table-column
- label="失业险"
- width="70"
- header-align="center"
- align="right"
- prop="unemploymentBenefit"
- >
- <template #default="scope">
- <div>
- {{ rowNum(scope.row.unemploymentBenefit) }}
- </div>
- </template>
- </el-table-column>
- <el-table-column
- label="大病险"
- width="70"
- header-align="center"
- align="right"
- prop="seriousIllnessInsurance"
- >
- <template #default="scope">
- <div>
- {{ rowNum(scope.row.seriousIllnessInsurance) }}
- </div>
- </template>
- </el-table-column>
- </el-table-column>
- <el-table-column
- label="公积金"
- width="80"
- header-align="center"
- align="right"
- prop="housingFund"
- >
- <template #default="scope">
- <div>
- {{ rowNum(scope.row.housingFund) }}
- </div>
- </template>
- </el-table-column>
- <el-table-column
- label="个税"
- header-align="center"
- align="right"
- :prop="
- form.status === 3 && form.hasIndividualIncomeTax
- ? 'individualIncomeTaxConfirm'
- : 'currentIndividualIncomeTax'
- "
- >
- <template #default="scope">
- <div>
- {{
- rowNum(
- form.status === 3 && form.hasIndividualIncomeTax
- ? scope.row.individualIncomeTaxConfirm
- : scope.row.currentIndividualIncomeTax
- )
- }}
- </div>
- </template></el-table-column
- >
- <el-table-column
- label="其他扣款"
- width="70"
- header-align="center"
- align="right"
- prop="otherCut"
- >
- <template #default="scope">
- <div>
- {{ rowNum(scope.row.otherCut) }}
- </div>
- </template>
- </el-table-column>
- <el-table-column
- label="备注"
- width="100"
- header-align="center"
- >
- <template #default="scope">
- <div>
- {{ scope.row.remark }}
- </div>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </div>
- </el-col>
- <el-col :span="24">
- <el-divider />
- </el-col>
- <el-col :span="24">
- <el-form-item label="备注">
- <span>
- {{ form.content }}
- </span>
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item label="合计工资">
- {{ rowNum(form.amount) }}
- </el-form-item>
- </el-col>
- <el-col v-if="showVerify()" :span="24">
- <el-divider />
- </el-col>
- <el-col v-if="showVerify()" :span="24">
- <el-form-item label="是否有个税">
- <el-select
- v-model.trim="form.hasIndividualIncomeTax"
- placeholder="请选择"
- size="small"
- style="width: 100%"
- @change="changeIndividual"
- >
- <el-option
- v-for="item in confirmChoices"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col
- v-if="showVerify() && form.hasIndividualIncomeTax === 1"
- :span="24"
- class="details-container"
- >
- <div class="details-head">
- <div class="title">
- <i class="fa fa-th-list" aria-hidden="true" /> 人员信息
- </div>
- </div>
- <div class="details-body">
- <div>
- <el-table
- ref="sourceTable"
- :data="form.details"
- size="small"
- max-height="260px"
- border
- highlight-current-row
- header-row-class-name="list-header-row"
- row-class-name="list-row"
- @selection-change="handleCheckChange"
- @current-change="handleCurrentChange"
- >
- <el-table-column
- type="index"
- label="序号"
- width="50"
- align="center"
- />
- <el-table-column label="员工姓名" width="120" align="center">
- <template #default="scope">
- <div>
- {{ scope.row.employeeName }}
- </div>
- <span
- style="
- color: red;
- position: absolute;
- z-index: 10;
- top: 4px;
- right: 6px;
- "
- >*</span
- >
- </template>
- </el-table-column>
- <el-table-column
- label="实际个税"
- align="center"
- width="120"
- prop="individualIncomeTaxConfirm"
- >
- <template #default="scope">
- <div>
- <el-input-number
- v-model="scope.row.individualIncomeTaxConfirm"
- size="small"
- placeholder="个税"
- :precision="2"
- :controls="false"
- style="width: 100%"
- @change="rowChangeSum(scope.row)"
- />
- </div>
- </template>
- </el-table-column>
- </el-table>
- <br />
- </div>
- </div>
- </el-col>
- <el-col :span="24">
- <el-form-item label="审核备注">
- <el-input
- v-if="form.status === 2"
- maxlength="200"
- show-word-limit
- v-model.trim="form.verifyContent"
- type="textarea"
- rows="2"
- />
- <span v-else>{{ form.verifyContent }}</span>
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- </div>
- <div class="form-btns-container" style="height: 40px">
- <el-button
- v-if="showVerify()"
- type="danger"
- size="small"
- icon="back"
- style="float: right; margin-left: 12px"
- @click="handleVerify(4)"
- >
- 驳回</el-button
- >
- <el-button
- v-if="showVerify()"
- type="primary"
- size="small"
- style="float: right; margin-left: 12px"
- icon="check"
- @click="handleVerify(3)"
- >
- 审核通过</el-button
- >
- <el-button
- v-if="verifiable() && form.status === 3"
- type="warning"
- size="small"
- icon="back"
- style="float: right; margin-left: 12px"
- @click="returnStatus()"
- >
- 退回</el-button
- >
- </div>
- <feedback-dialog ref="feedbackDialogView" :verify="verify" />
- <!-- <print-dialog ref="printDialog" /> -->
- </el-dialog>
- </template>
- <script setup>
- import {
- getDetail,
- verifyDetail,
- turnBackDetail,
- exportSalaryEmployee,
- exportSalaryPdf,
- } from "@/api/business/production/salaryZero";
- import { rowNum, numberToCurrencyNo } from "@/utils/index";
- import feedbackDialog from "../feedbackDialog.vue";
- import useUserStore from "@/store/modules/user";
- import { ref } from "vue";
- const { proxy } = getCurrentInstance();
- const visible = ref(false);
- const width = ref(800);
- const selections = ref([]);
- const currentSource = ref(null);
- const permissions = useUserStore().permissions;
- const all_permission = "*:*:*";
- const feedbackDialogView = ref(null);
- const confirmChoices = ref([
- {
- label: "是",
- value: 1,
- },
- {
- label: "否",
- value: 0,
- },
- ]);
- const props = defineProps({
- getList: {
- type: Function,
- default: () => {},
- },
- });
- const { getList } = toRefs(props);
- const total = ref(0);
- const employeeEmptyData = {
- id: null,
- title: "",
- remark: "",
- employeeName: "",
- departmentName: "",
- idCode: "",
- salaryAmount: "",
- bonusAmount: "",
- allowanceAmount: "",
- subsidyAmount: "",
- absenceCut: "",
- planSalary: 0,
- actuallySalary: 0,
- endowmentInsurance: 0,
- medicalInsurance: 0,
- unemploymentBenefit: 0,
- seriousIllnessInsurance: 0,
- housingFund: 0,
- otherCut: 0,
- cumulativeIncome: 0,
- cumulativeSpecialCut: 0,
- cumulativeChildEduCut: 0,
- cumulativeHouseLoanInterestCut: 0,
- cumulativeHouseRentCut: 0,
- cumulativeSupportElderCut: 0,
- cumulativeContinuingEduCut: 0,
- cumulativeBabyCareCut: 0,
- sumSpecialCumulativeCut: 0,
- cumulativeOtherCut: 0,
- cumulativeIndividualIncomeTax: 0,
- cumulativeHasPaidIit: 0,
- currentIndividualIncomeTax: 0,
- idiograph: "",
- details: [],
- editStatus: true,
- };
- const form = ref({
- amount: null,
- details: [],
- });
- const emptyForm = {
- details: [],
- };
- function open(detail) {
- console.log(detail);
- visible.value = true;
- form.value = detail;
- loadData();
- }
- function loadData() {
- getDetail(form.value).then((res) => {
- form.value = { ...proxy.deepClone(emptyForm), ...res.data };
- computeTotal();
- });
- }
- function close() {
- visible.value = false;
- reset();
- }
- function reset() {
- form.value = proxy.deepClone(emptyForm);
- total.value = 0;
- }
- function printSalary() {
- exportSalaryPdf(form.value.id);
- }
- function exportSalary() {
- exportSalaryEmployee(form.value.id);
- }
- function showVerify() {
- if (
- form.value.id == null ||
- form.value.status === 0 ||
- form.value.status === 3 ||
- form.value.status === 4
- ) {
- return false;
- } else if (verifiable()) {
- return true;
- } else {
- return false;
- }
- }
- function verifiable() {
- // console.log(permissions)
- // console.log(permissions)
- return (
- permissions.includes(all_permission) ||
- permissions.includes("business:salary:verify")
- );
- }
- function handleCurrentChange(row) {
- currentSource.value = row;
- }
- function handleCheckChange(selection) {
- selections.value = selection.map((item) => item);
- }
- function getSummaries(param) {
- const { columns, data } = param;
- const sums = [];
- columns.forEach((column, index) => {
- if (index === 0) {
- sums[index] = "合计";
- return;
- } else if (index === 1) {
- sums[index] = "";
- return;
- }
- const values = data.map((item) => Number(item[column.property]));
- if (!values.every((value) => isNaN(value))) {
- sums[index] = values.reduce((prev, curr) => {
- const value = Number(curr);
- if (!isNaN(value)) {
- return (Number(prev) + Number(curr)).toFixed(2);
- } else {
- return Number(prev).toFixed(2);
- }
- }, 0);
- sums[index] = numberToCurrencyNo(sums[index]);
- } else {
- sums[index] = "";
- }
- });
- return sums;
- }
- function handleVerify(status) {
- if (status === 4) {
- const saveValue = proxy.deepClone(form.value);
- saveValue.status = status;
- feedbackDialogView.value.open(saveValue);
- } else {
- proxy.$modal
- .confirm("确认审核么?")
- .then((_) => {
- const saveValue = proxy.deepClone(form.value);
- saveValue.status = status;
- verify(saveValue);
- })
- .catch((_) => {
- proxy.$modal.msg("已取消审核");
- });
- }
- }
- function verify(data) {
- verifyDetail(data).then((res) => {
- reset();
- getList.value();
- close();
- });
- }
- function rowChangeSum(row) {
- let actuallySalary = 0;
- actuallySalary += row.planSalary == null ? 0 : row.planSalary;
- actuallySalary += row.bonusAmount == null ? 0 : row.bonusAmount;
- actuallySalary -= row.endowmentInsurance == null ? 0 : row.endowmentInsurance;
- actuallySalary -= row.medicalInsurance == null ? 0 : row.medicalInsurance;
- actuallySalary -=
- row.unemploymentBenefit == null ? 0 : row.unemploymentBenefit;
- actuallySalary -=
- row.seriousIllnessInsurance == null ? 0 : row.seriousIllnessInsurance;
- actuallySalary -= row.housingFund == null ? 0 : row.housingFund;
- if (form.value.hasIndividualIncomeTax === 1) {
- actuallySalary -=
- row.individualIncomeTaxConfirm == null
- ? 0
- : row.individualIncomeTaxConfirm;
- } else {
- actuallySalary -=
- row.currentIndividualIncomeTax == null
- ? 0
- : row.currentIndividualIncomeTax;
- }
- actuallySalary -= row.otherCut == null ? 0 : row.otherCut;
- row.actuallySalary = actuallySalary;
- computeTotal();
- }
- function computeTotal() {
- let totalSalay = 0;
- form.value.details.forEach((l) => {
- totalSalay += l.actuallySalary == null ? 0 : l.actuallySalary;
- });
- form.value.amount = totalSalay;
- }
- function returnStatus(status) {
- proxy.$modal
- .confirm("确认退回么?")
- .then((_) => {
- turnBackDetail(form.value).then((res) => {
- // if (res.data.successStatus = true) {
- // reset()
- // getList.value()
- // close()
- // } else {
- // proxy.$modal.msg(res.data.message)
- // }
- reset();
- getList.value();
- close();
- });
- })
- .catch((_) => {
- proxy.$modal.msg("已取消退回");
- });
- }
- function changeIndividual(arg) {
- // if (arg === 1) {
- form.value.details.forEach((row) => {
- let actuallySalary = 0;
- actuallySalary += row.planSalary == null ? 0 : row.planSalary;
- actuallySalary += row.bonusAmount == null ? 0 : row.bonusAmount;
- actuallySalary -=
- row.endowmentInsurance == null ? 0 : row.endowmentInsurance;
- actuallySalary -= row.medicalInsurance == null ? 0 : row.medicalInsurance;
- actuallySalary -=
- row.unemploymentBenefit == null ? 0 : row.unemploymentBenefit;
- actuallySalary -=
- row.seriousIllnessInsurance == null ? 0 : row.seriousIllnessInsurance;
- actuallySalary -= row.housingFund == null ? 0 : row.housingFund;
- if (arg === 1) {
- actuallySalary -=
- row.individualIncomeTaxConfirm == null
- ? 0
- : row.individualIncomeTaxConfirm;
- } else {
- actuallySalary -=
- row.currentIndividualIncomeTax == null
- ? 0
- : row.currentIndividualIncomeTax;
- }
- actuallySalary -= row.otherCut == null ? 0 : row.otherCut;
- row.actuallySalary = actuallySalary;
- });
- computeTotal();
- }
- // 暴露给父组件的方法
- defineExpose({
- open,
- });
- </script>
|