From 8347ef1b32e505da2d1399e4f1d1b8b1ab94862d Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期二, 10 二月 2026 17:50:25 +0800
Subject: [PATCH] 消息列表跳转字段
---
src/pages/humanResources/monthlyStatistics/detail.vue | 357 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 357 insertions(+), 0 deletions(-)
diff --git a/src/pages/humanResources/monthlyStatistics/detail.vue b/src/pages/humanResources/monthlyStatistics/detail.vue
new file mode 100644
index 0000000..732aa2a
--- /dev/null
+++ b/src/pages/humanResources/monthlyStatistics/detail.vue
@@ -0,0 +1,357 @@
+<template>
+ <view class="hazard-source-detail">
+ <PageHeader :title="isEdit ? '缂栬緫钖祫鍙拌处' : '鏂板钖祫鍙拌处'"
+ @back="goBack" />
+ <u-form @submit="handleSubmit"
+ ref="formRef"
+ label-width="110">
+ <!-- 钖祫淇℃伅 -->
+ <u-cell-group title="钖祫淇℃伅">
+ <u-form-item label="缁熻鏈堜唤"
+ prop="payDate"
+ required
+ border-bottom>
+ <u-input v-model="form.payDate"
+ placeholder="璇烽�夋嫨鏈堜唤"
+ @click="showDatePicker"
+ readonly />
+ <template #right>
+ <up-icon name="arrow-right"
+ @click="showDatePicker"></up-icon>
+ </template>
+ </u-form-item>
+ <u-form-item label="鍛樺伐濮撳悕"
+ prop="staffId"
+ required
+ border-bottom>
+ <u-input v-model="form.staffName"
+ placeholder="璇烽�夋嫨鍛樺伐"
+ @click="showStaffSheet"
+ readonly />
+ <template #right>
+ <up-icon name="arrow-right"
+ @click="showStaffSheet"></up-icon>
+ </template>
+ </u-form-item>
+ <u-form-item label="鍩烘湰宸ヨ祫"
+ prop="basicSalary"
+ required
+ border-bottom>
+ <u-input v-model="form.basicSalary"
+ type="number"
+ placeholder="璇疯緭鍏ュ熀鏈伐璧�" />
+ </u-form-item>
+ <u-form-item label="璁′欢宸ヨ祫"
+ prop="pieceworkSalary"
+ border-bottom>
+ <u-input v-model="form.pieceworkSalary"
+ type="number"
+ placeholder="璇疯緭鍏ヨ浠跺伐璧�" />
+ </u-form-item>
+ <u-form-item label="璁℃椂宸ヨ祫"
+ prop="hourlySalary"
+ border-bottom>
+ <u-input v-model="form.hourlySalary"
+ type="number"
+ placeholder="璇疯緭鍏ヨ鏃跺伐璧�" />
+ </u-form-item>
+ <u-form-item label="鍏朵粬鏀跺叆"
+ prop="otherIncome"
+ border-bottom>
+ <u-input v-model="form.otherIncome"
+ type="number"
+ placeholder="璇疯緭鍏ュ叾浠栨敹鍏�" />
+ </u-form-item>
+ <u-form-item label="绀句繚涓汉"
+ prop="socialSecurityIndividuals"
+ border-bottom>
+ <u-input v-model="form.socialSecurityIndividuals"
+ type="number"
+ placeholder="璇疯緭鍏ョぞ淇濅釜浜�" />
+ </u-form-item>
+ <u-form-item label="鍏Н閲戜釜浜�"
+ prop="providentFundIndividuals"
+ border-bottom>
+ <u-input v-model="form.providentFundIndividuals"
+ type="number"
+ placeholder="璇疯緭鍏ュ叕绉噾涓汉" />
+ </u-form-item>
+ <u-form-item label="涓汉鎵�寰楃◣"
+ prop="personalIncomeTax"
+ border-bottom>
+ <u-input v-model="form.personalIncomeTax"
+ type="number"
+ placeholder="璇疯緭鍏ヤ釜浜烘墍寰楃◣" />
+ </u-form-item>
+ <u-form-item label="鍏朵粬鎵f"
+ prop="otherDeductions"
+ border-bottom>
+ <u-input v-model="form.otherDeductions"
+ type="number"
+ placeholder="璇疯緭鍏ュ叾浠栨墸娆�" />
+ </u-form-item>
+ <u-form-item label="澶囨敞"
+ prop="remark"
+ border-bottom>
+ <u-textarea v-model="form.remark"
+ placeholder="璇疯緭鍏ュ娉�"
+ :rows="3"
+ :autoHeight="true" />
+ </u-form-item>
+ </u-cell-group>
+ <!-- 鎻愪氦鎸夐挳 -->
+ <view class="footer-btns">
+ <u-button class="cancel-btn"
+ @click="goBack">鍙栨秷</u-button>
+ <u-button class="sign-btn"
+ type="primary"
+ @click="handleSubmit"
+ :loading="loading">{{ isEdit ? '鏇存柊' : '淇濆瓨' }}</u-button>
+ </view>
+ </u-form>
+ <!-- 鍛樺伐閫夋嫨鍣� -->
+ <up-action-sheet :show="staffSheetVisible"
+ :actions="staffOptions"
+ @select="handleStaffSelect"
+ @close="staffSheetVisible = false"
+ title="閫夋嫨鍛樺伐" />
+ <!-- 鏃ユ湡閫夋嫨鍣� -->
+ <up-datetime-picker :show="datePickerVisible"
+ v-model="currentDate"
+ @confirm="onDateConfirm"
+ @cancel="datePickerVisible = false"
+ mode="month" />
+ </view>
+</template>
+
+<script setup>
+ // 鏇挎崲 toast 鏂规硶
+ defineOptions({ name: "monthly-statistics-detail" });
+ const showToast = message => {
+ uni.showToast({
+ title: message,
+ icon: "none",
+ });
+ };
+
+ import { ref, onMounted } from "vue";
+ import PageHeader from "@/components/PageHeader.vue";
+ import {
+ monthlyStatisticsAdd,
+ monthlyStatisticsUpdate,
+ staffOnJobList,
+ } from "@/api/personnelManagement/monthlyStatistics";
+ import dayjs from "dayjs";
+ import { onLoad } from "@dcloudio/uni-app";
+
+ // 琛ㄥ崟鏁版嵁
+ const form = ref({
+ id: "",
+ payDate: "",
+ staffId: "",
+ staffName: "",
+ basicSalary: 0,
+ pieceworkSalary: 0,
+ hourlySalary: 0,
+ otherIncome: 0,
+ socialSecurityIndividuals: 0,
+ providentFundIndividuals: 0,
+ personalIncomeTax: 0,
+ otherDeductions: 0,
+ payableWages: 0,
+ deductibleWages: 0,
+ actualWages: 0,
+ remark: "",
+ });
+
+ // 椤甸潰鐘舵��
+ const loading = ref(false);
+ const formRef = ref(null);
+ const isEdit = ref(false);
+
+ // 鍛樺伐閫夋嫨鍣�
+ const staffSheetVisible = ref(false);
+ const staffOptions = ref([]);
+ const staffList = ref([]);
+ const showStaffSheet = () => {
+ if (staffOptions.value.length === 0) {
+ loadStaffList();
+ } else {
+ staffSheetVisible.value = true;
+ }
+ };
+ const handleStaffSelect = item => {
+ const staff = staffList.value.find(s => s.id === item.value);
+ if (staff) {
+ form.value.staffId = staff.id;
+ form.value.staffName = staff.staffName;
+ }
+ staffSheetVisible.value = false;
+ };
+ const loadStaffList = () => {
+ staffOnJobList().then(res => {
+ if (res.code === 200) {
+ staffList.value = res.data || [];
+ staffOptions.value = staffList.value.map(item => ({
+ value: item.id,
+ name: item.staffName,
+ subname: `宸ュ彿: ${item.staffNo}`,
+ }));
+ staffSheetVisible.value = true;
+ }
+ });
+ };
+
+ // 鏃ユ湡閫夋嫨鍣�
+ const datePickerVisible = ref(false);
+ const currentDate = ref(Date.now());
+ const showDatePicker = () => {
+ datePickerVisible.value = true;
+ };
+ const onDateConfirm = e => {
+ form.value.payDate = dayjs(e.value).format("YYYY-MM");
+ currentDate.value = e.value;
+ datePickerVisible.value = false;
+ };
+
+ // 杩斿洖涓婁竴椤�
+ const goBack = () => {
+ // 杩斿洖鏃舵竻闄ゆ湰鍦板瓨鍌ㄧ殑鏁版嵁
+ uni.removeStorageSync("monthlyStatistics");
+ uni.navigateBack();
+ };
+
+ // 鎻愪氦琛ㄥ崟
+ const handleSubmit = async () => {
+ if (!form.value.payDate) {
+ showToast("璇烽�夋嫨缁熻鏈堜唤");
+ return;
+ }
+
+ if (!form.value.staffId) {
+ showToast("璇烽�夋嫨鍛樺伐");
+ return;
+ }
+
+ if (!form.value.basicSalary) {
+ showToast("璇疯緭鍏ュ熀鏈伐璧�");
+ return;
+ }
+
+ // 璁$畻搴斿彂宸ヨ祫銆佸簲鎵e伐璧勫拰瀹炲彂宸ヨ祫
+ const payableWages =
+ Number(form.value.basicSalary) +
+ Number(form.value.pieceworkSalary) +
+ Number(form.value.hourlySalary) +
+ Number(form.value.otherIncome);
+ const deductibleWages =
+ Number(form.value.socialSecurityIndividuals) +
+ Number(form.value.providentFundIndividuals) +
+ Number(form.value.personalIncomeTax) +
+ Number(form.value.otherDeductions);
+ const actualWages = payableWages - deductibleWages;
+
+ const submitData = {
+ ...form.value,
+ payableWages,
+ deductibleWages,
+ actualWages,
+ };
+
+ try {
+ loading.value = true;
+
+ if (isEdit.value) {
+ const { code } = await monthlyStatisticsUpdate(submitData);
+ if (code === 200) {
+ showToast("鏇存柊鎴愬姛");
+ setTimeout(() => {
+ goBack();
+ }, 500);
+ } else {
+ loading.value = false;
+ showToast("鏇存柊澶辫触锛岃閲嶈瘯");
+ }
+ } else {
+ const { code } = await monthlyStatisticsAdd(submitData);
+ if (code === 200) {
+ showToast("淇濆瓨鎴愬姛");
+ setTimeout(() => {
+ goBack();
+ }, 500);
+ } else {
+ loading.value = false;
+ showToast("淇濆瓨澶辫触锛岃閲嶈瘯");
+ }
+ }
+ } catch (e) {
+ loading.value = false;
+ console.error("鎻愪氦澶辫触:", e);
+ showToast("鎻愪氦澶辫触锛岃閲嶈瘯");
+ }
+ };
+
+ onLoad(() => {
+ // 缂栬緫钖祫鍙拌处鏃讹紝浠庢湰鍦板瓨鍌ㄨ幏鍙栨暟鎹�
+ const monthlyStatistics = uni.getStorageSync("monthlyStatistics");
+ if (monthlyStatistics.id) {
+ form.value = monthlyStatistics;
+ isEdit.value = true;
+ } else {
+ isEdit.value = false;
+ }
+ });
+
+ onMounted(() => {
+ // 璁剧疆榛樿鏃堕棿
+ if (!isEdit.value) {
+ form.value.payDate = dayjs().format("YYYY-MM");
+ currentDate.value = Date.now();
+ }
+ });
+</script>
+
+<style scoped lang="scss">
+ @import "@/static/scss/form-common.scss";
+ .hazard-source-detail {
+ min-height: 100vh;
+ background: #f8f9fa;
+ padding-bottom: 5rem;
+ }
+
+ .footer-btns {
+ position: fixed;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ background: #fff;
+ display: flex;
+ justify-content: space-around;
+ align-items: center;
+ padding: 0.75rem 0;
+ box-shadow: 0 -0.125rem 0.5rem rgba(0, 0, 0, 0.05);
+ z-index: 1000;
+ }
+
+ .cancel-btn {
+ font-weight: 400;
+ font-size: 1rem;
+ color: #666;
+ background: #f5f5f5;
+ border: 1px solid #ddd;
+ width: 45%;
+ height: 2.5rem;
+ border-radius: 2.5rem 2.5rem 2.5rem 2.5rem;
+ }
+
+ .sign-btn {
+ font-weight: 500;
+ font-size: 1rem;
+ color: #fff;
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
+ border: none;
+ width: 45%;
+ height: 2.5rem;
+ border-radius: 2.5rem 2.5rem 2.5rem 2.5rem;
+ }
+</style>
\ No newline at end of file
--
Gitblit v1.9.3