| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from "@/utils/request"; |
| | | |
| | | // 人åèªèµå°è´¦å表 |
| | | export function monthlyStatisticsListPage(query) { |
| | | return request({ |
| | | url: "/compensationPerformance/listPage", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | |
| | | // 人åèªèµå°è´¦è¯¦æ
|
| | | export function monthlyStatisticsGet(id) { |
| | | return request({ |
| | | url: "/monthlyStatistics/get", |
| | | method: "get", |
| | | params: { id }, |
| | | }); |
| | | } |
| | | |
| | | // æ°å¢äººåèªèµå°è´¦ |
| | | export function monthlyStatisticsAdd(data) { |
| | | return request({ |
| | | url: "/compensationPerformance/add", |
| | | method: "post", |
| | | data, |
| | | }); |
| | | } |
| | | |
| | | // ç¼è¾äººåèªèµå°è´¦ |
| | | export function monthlyStatisticsUpdate(data) { |
| | | return request({ |
| | | url: "/compensationPerformance/update", |
| | | method: "post", |
| | | data, |
| | | }); |
| | | } |
| | | |
| | | // å é¤äººåèªèµå°è´¦ |
| | | export function monthlyStatisticsDelete(ids) { |
| | | return request({ |
| | | url: "/compensationPerformance/delete", |
| | | method: "delete", |
| | | data: ids, |
| | | }); |
| | | } |
| | | |
| | | // 导åºäººåèªèµå°è´¦ |
| | | export function monthlyStatisticsExport(query) { |
| | | return request({ |
| | | url: "/compensationPerformance/export", |
| | | method: "get", |
| | | params: query, |
| | | responseType: "blob", |
| | | }); |
| | | } |
| | | |
| | | // 人åå表 |
| | | export function staffOnJobList(query) { |
| | | return request({ |
| | | url: "/staff/staffOnJob/list", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <el-dialog v-model="dialogVisible" |
| | | :title="title" |
| | | width="700px" |
| | | :close-on-click-modal="false"> |
| | | <el-form ref="formRef" |
| | | :model="form" |
| | | :rules="rules" |
| | | label-width="140px" |
| | | label-position="top"> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ç»è®¡æä»½" |
| | | prop="payDate"> |
| | | <el-date-picker v-model="form.payDate" |
| | | type="month" |
| | | value-format="YYYY-MM" |
| | | format="YYYY-MM" |
| | | placeholder="è¯·éæ©æä»½" |
| | | style="width: 100%" |
| | | :disabled="operationType === 'view'" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å§å" |
| | | prop="staffId"> |
| | | <el-select v-model="form.staffId" |
| | | placeholder="è¯·éæ©åå·¥" |
| | | style="width: 100%" |
| | | :disabled="operationType === 'view'"> |
| | | <el-option v-for="item in userList" |
| | | :key="item.id" |
| | | :label="item.staffName" |
| | | :value="item.id" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="åºæ¬å·¥èµ" |
| | | prop="basicSalary"> |
| | | <el-input v-model="form.basicSalary" |
| | | type="number" |
| | | placeholder="请è¾å
¥åºæ¬å·¥èµ" |
| | | :disabled="operationType === 'view'" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="计件工èµ" |
| | | prop="pieceworkSalary"> |
| | | <el-input v-model="form.pieceworkSalary" |
| | | type="number" |
| | | placeholder="请è¾å
¥è®¡ä»¶å·¥èµ" |
| | | :disabled="operationType === 'view'" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="计æ¶å·¥èµ" |
| | | prop="hourlySalary"> |
| | | <el-input v-model="form.hourlySalary" |
| | | type="number" |
| | | placeholder="请è¾å
¥è®¡æ¶å·¥èµ" |
| | | :disabled="operationType === 'view'" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å
¶ä»æ¶å
¥" |
| | | prop="otherIncome"> |
| | | <el-input v-model="form.otherIncome" |
| | | type="number" |
| | | placeholder="请è¾å
¥å
¶ä»æ¶å
¥" |
| | | :disabled="operationType === 'view'" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="社ä¿ä¸ªäºº" |
| | | prop="socialSecurityIndividuals"> |
| | | <el-input v-model="form.socialSecurityIndividuals" |
| | | type="number" |
| | | placeholder="请è¾å
¥ç¤¾ä¿ä¸ªäºº" |
| | | :disabled="operationType === 'view'" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å
¬ç§¯é个人" |
| | | prop="providentFundIndividuals"> |
| | | <el-input v-model="form.providentFundIndividuals" |
| | | type="number" |
| | | placeholder="请è¾å
¥å
¬ç§¯é个人" |
| | | :disabled="operationType === 'view'" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="个人æå¾ç¨" |
| | | prop="personalIncomeTax"> |
| | | <el-input v-model="form.personalIncomeTax" |
| | | type="number" |
| | | placeholder="请è¾å
¥ä¸ªäººæå¾ç¨" |
| | | :disabled="operationType === 'view'" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å
¶ä»æ£æ¬¾" |
| | | prop="otherDeductions"> |
| | | <el-input v-model="form.otherDeductions" |
| | | type="number" |
| | | placeholder="请è¾å
¥å
¶ä»æ£æ¬¾" |
| | | :disabled="operationType === 'view'" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="24"> |
| | | <el-form-item label="夿³¨" |
| | | prop="remark"> |
| | | <el-input v-model="form.remark" |
| | | type="textarea" |
| | | placeholder="请è¾å
¥å¤æ³¨" |
| | | :rows="3" |
| | | :disabled="operationType === 'view'" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button @click="dialogVisible = false">åæ¶</el-button> |
| | | <el-button type="primary" |
| | | @click="submitForm" |
| | | v-if="operationType !== 'view'"> |
| | | ç¡®å® |
| | | </el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, reactive, computed, onMounted } from "vue"; |
| | | import { ElMessage } from "element-plus"; |
| | | import { |
| | | monthlyStatisticsAdd, |
| | | monthlyStatisticsUpdate, |
| | | staffOnJobList, |
| | | } from "@/api/personnelManagement/monthlyStatistics.js"; |
| | | |
| | | const props = defineProps({ |
| | | modelValue: { |
| | | type: Boolean, |
| | | default: false, |
| | | }, |
| | | operationType: { |
| | | type: String, |
| | | default: "add", |
| | | }, |
| | | row: { |
| | | type: Object, |
| | | default: () => ({}), |
| | | }, |
| | | }); |
| | | |
| | | const emit = defineEmits(["update:modelValue", "close"]); |
| | | |
| | | const dialogVisible = computed({ |
| | | get: () => props.modelValue, |
| | | set: val => emit("update:modelValue", val), |
| | | }); |
| | | |
| | | const title = computed(() => { |
| | | if (props.operationType === "add") return "æ°å¢èªèµå°è´¦"; |
| | | if (props.operationType === "edit") return "ç¼è¾èªèµå°è´¦"; |
| | | return "æ¥çèªèµå°è´¦"; |
| | | }); |
| | | |
| | | const formRef = ref(); |
| | | const form = reactive({ |
| | | id: "", |
| | | payDate: "", |
| | | staffId: "", |
| | | basicSalary: 0, |
| | | pieceworkSalary: 0, |
| | | hourlySalary: 0, |
| | | otherIncome: 0, |
| | | socialSecurityIndividuals: 0, |
| | | providentFundIndividuals: 0, |
| | | personalIncomeTax: 0, |
| | | otherDeductions: 0, |
| | | payableWages: 0, |
| | | deductibleWages: 0, |
| | | actualWages: 0, |
| | | remark: "", |
| | | }); |
| | | |
| | | const rules = { |
| | | payDate: [{ required: true, message: "è¯·éæ©ç»è®¡æä»½", trigger: "change" }], |
| | | staffId: [{ required: true, message: "è¯·éæ©åå·¥", trigger: "change" }], |
| | | basicSalary: [{ required: true, message: "请è¾å
¥åºæ¬å·¥èµ", trigger: "blur" }], |
| | | }; |
| | | |
| | | const userList = ref([]); |
| | | |
| | | const loadUserList = () => { |
| | | // userListNoPage().then(res => { |
| | | // userList.value = res.data || []; |
| | | // }); |
| | | staffOnJobList().then(res => { |
| | | userList.value = res.data || []; |
| | | }); |
| | | }; |
| | | |
| | | const openDialog = (type, row) => { |
| | | // é置表å |
| | | Object.assign(form, { |
| | | id: "", |
| | | payDate: "", |
| | | staffId: "", |
| | | basicSalary: 0, |
| | | pieceworkSalary: 0, |
| | | hourlySalary: 0, |
| | | otherIncome: 0, |
| | | socialSecurityIndividuals: 0, |
| | | providentFundIndividuals: 0, |
| | | personalIncomeTax: 0, |
| | | otherDeductions: 0, |
| | | payableWages: 0, |
| | | deductibleWages: 0, |
| | | actualWages: 0, |
| | | remark: "", |
| | | }); |
| | | |
| | | if (type === "add") { |
| | | dialogVisible.value = true; |
| | | } else if (type === "edit" || type === "view") { |
| | | if (row && row.id) { |
| | | Object.assign(form, row); |
| | | dialogVisible.value = true; |
| | | } |
| | | } |
| | | }; |
| | | |
| | | const submitForm = () => { |
| | | formRef.value.validate(valid => { |
| | | if (valid) { |
| | | form.basicSalary = Number(form.basicSalary); |
| | | form.pieceworkSalary = Number(form.pieceworkSalary); |
| | | form.hourlySalary = Number(form.hourlySalary); |
| | | form.otherIncome = Number(form.otherIncome); |
| | | form.socialSecurityIndividuals = Number(form.socialSecurityIndividuals); |
| | | form.providentFundIndividuals = Number(form.providentFundIndividuals); |
| | | form.personalIncomeTax = Number(form.personalIncomeTax); |
| | | form.otherDeductions = Number(form.otherDeductions); |
| | | |
| | | // 计ç®åºåå·¥èµãåºæ£å·¥èµåå®åå·¥èµ |
| | | const payableWages = |
| | | form.basicSalary + |
| | | form.pieceworkSalary + |
| | | form.hourlySalary + |
| | | form.otherIncome; |
| | | const deductibleWages = |
| | | form.socialSecurityIndividuals + |
| | | form.providentFundIndividuals + |
| | | form.personalIncomeTax + |
| | | form.otherDeductions; |
| | | const actualWages = payableWages - deductibleWages; |
| | | |
| | | const submitData = { |
| | | ...form, |
| | | payableWages, |
| | | deductibleWages, |
| | | actualWages, |
| | | }; |
| | | |
| | | if (props.operationType === "add") { |
| | | monthlyStatisticsAdd(submitData).then(res => { |
| | | if (res.code === 200) { |
| | | ElMessage.success("æ°å¢æå"); |
| | | dialogVisible.value = false; |
| | | emit("close"); |
| | | } else { |
| | | ElMessage.error(res.msg || "æ°å¢å¤±è´¥"); |
| | | } |
| | | }); |
| | | } else if (props.operationType === "edit") { |
| | | monthlyStatisticsUpdate(submitData).then(res => { |
| | | if (res.code === 200) { |
| | | ElMessage.success("æ´æ°æå"); |
| | | dialogVisible.value = false; |
| | | emit("close"); |
| | | } else { |
| | | ElMessage.error(res.msg || "æ´æ°å¤±è´¥"); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | loadUserList(); |
| | | }); |
| | | |
| | | defineExpose({ |
| | | openDialog, |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .dialog-footer { |
| | | text-align: right; |
| | | } |
| | | </style> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <div class="search_form"> |
| | | <div> |
| | | <span class="search_title">å§åï¼</span> |
| | | <el-input v-model="searchForm.staffName" |
| | | style="width: 240px" |
| | | placeholder="请è¾å
¥å§åæç´¢" |
| | | @change="handleQuery" |
| | | clearable |
| | | :prefix-icon="Search" /> |
| | | <span class="search_title ml10">æä»½ï¼</span> |
| | | <el-date-picker v-model="searchForm.payDateStr" |
| | | 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"> |
| | | æç´¢ |
| | | </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> |
| | | </div> |
| | | </div> |
| | | <div class="table_list"> |
| | | <PIMTable rowKey="id" |
| | | :column="tableColumn" |
| | | :tableData="tableData" |
| | | :page="page" |
| | | :isSelection="true" |
| | | @selection-change="handleSelectionChange" |
| | | :tableLoading="tableLoading" |
| | | @pagination="pagination" |
| | | :total="page.total"></PIMTable> |
| | | </div> |
| | | <form-dia v-model="dialogVisible" |
| | | :operation-type="operationType" |
| | | :row="currentRow" |
| | | ref="formDia" |
| | | @close="handleQuery"></form-dia> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { Search } from "@element-plus/icons-vue"; |
| | | import { |
| | | onMounted, |
| | | ref, |
| | | reactive, |
| | | toRefs, |
| | | getCurrentInstance, |
| | | nextTick, |
| | | } from "vue"; |
| | | import { ElMessageBox } from "element-plus"; |
| | | import dayjs from "dayjs"; |
| | | import FormDia from "./components/formDia.vue"; |
| | | import { |
| | | monthlyStatisticsListPage, |
| | | monthlyStatisticsDelete, |
| | | } from "@/api/personnelManagement/monthlyStatistics.js"; |
| | | |
| | | const data = reactive({ |
| | | searchForm: { |
| | | staffName: "", |
| | | payDateStr: "", |
| | | }, |
| | | }); |
| | | |
| | | 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, |
| | | }, |
| | | { |
| | | dataType: "action", |
| | | label: "æä½", |
| | | align: "center", |
| | | fixed: "right", |
| | | width: 220, |
| | | operation: [ |
| | | { |
| | | name: "ç¼è¾", |
| | | type: "text", |
| | | clickFun: row => { |
| | | openForm("edit", row); |
| | | }, |
| | | }, |
| | | // { |
| | | // name: "æ¥ç", |
| | | // type: "text", |
| | | // clickFun: row => { |
| | | // openForm("view", row); |
| | | // }, |
| | | // }, |
| | | ], |
| | | }, |
| | | ]); |
| | | |
| | | const tableData = ref([]); |
| | | const selectedRows = ref([]); |
| | | const tableLoading = ref(false); |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | total: 0, |
| | | }); |
| | | |
| | | const formDia = ref(); |
| | | const dialogVisible = ref(false); |
| | | const operationType = ref("add"); |
| | | const currentRow = ref({}); |
| | | const { proxy } = getCurrentInstance(); |
| | | |
| | | // æ¥è¯¢å表 |
| | | /** æç´¢æé®æä½ */ |
| | | const handleQuery = () => { |
| | | 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; |
| | | }) |
| | | .catch(err => { |
| | | tableLoading.value = false; |
| | | }); |
| | | }; |
| | | |
| | | // è¡¨æ ¼éæ©æ°æ® |
| | | 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); |
| | | }); |
| | | }; |
| | | |
| | | // å é¤ |
| | | const handleDelete = () => { |
| | | let ids = []; |
| | | if (selectedRows.value.length > 0) { |
| | | ids = selectedRows.value.map(item => item.id); |
| | | } else { |
| | | proxy.$modal.msgWarning("è¯·éæ©æ°æ®"); |
| | | return; |
| | | } |
| | | ElMessageBox.confirm("éä¸çå
容å°è¢«å é¤ï¼æ¯å¦ç¡®è®¤å é¤ï¼", "å é¤", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | monthlyStatisticsDelete(ids).then(res => { |
| | | proxy.$modal.msgSuccess("å 餿å"); |
| | | getList(); |
| | | }); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已忶"); |
| | | }); |
| | | }; |
| | | |
| | | // å¯¼åº |
| | | const handleExport = () => { |
| | | ElMessageBox.confirm("æ¯å¦ç¡®è®¤å¯¼åºäººåèªèµå°è´¦ï¼", "导åº", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | proxy.download( |
| | | "/compensationPerformance/export", |
| | | { ...searchForm.value, ...page }, |
| | | "人åèªèµå°è´¦.xlsx" |
| | | ); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已忶"); |
| | | }); |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | getList(); |
| | | }); |
| | | </script> |
| | | |
| | | <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> |