From fb0c769022609c0bf1b264b0c135eee900432f70 Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期四, 22 十月 2026 18:04:18 +0800
Subject: [PATCH] 1、整理APP端主题变量,统一主色、浅色背景、边框色、页面背景及卡片背景等公共样式 2、排查APP端列表分页情况,区分主列表分页与下拉选择器数据请求 3、补齐考勤记录、考勤异常、考勤汇总、员工社保档案、薪酬核算、薪资发放、班次、节假日、考勤规则、备件台账、领用记录及工序流转等页面分页
---
src/pages/hrm/attendance-exception/index.vue | 44 ++++++++++++++++++++++++++++++++++++++------
1 files changed, 38 insertions(+), 6 deletions(-)
diff --git a/src/pages/hrm/attendance-exception/index.vue b/src/pages/hrm/attendance-exception/index.vue
index 4d04a23..f1cfe13 100644
--- a/src/pages/hrm/attendance-exception/index.vue
+++ b/src/pages/hrm/attendance-exception/index.vue
@@ -1,7 +1,39 @@
<script setup lang="ts">
-import{computed,ref}from"vue";import{onPullDownRefresh,onShow}from"@dcloudio/uni-app";import{getAttendanceExceptionPage,submitAttendanceException,getAttendanceExceptionProcesses,type AttendanceException,type ApproveProcess}from"../../../api/hrm";import{useAuth}from"../../../stores/auth";import PickerSheet from"../../mes/process-design/components/PickerSheet.vue";import{confirm,toast}from"../shared";
-const{hasPermission,state}=useAuth();const rows=ref<AttendanceException[]>([]),processes=ref<ApproveProcess[]>([]),processVisible=ref(false),active=ref<AttendanceException>(),loading=ref(false);const canQuery=computed(()=>hasPermission("hrm:attendance-exception:query"));
-async function load(){if(!state.accessToken||!canQuery.value)return;loading.value=true;try{const[d,p]=await Promise.all([getAttendanceExceptionPage(state.accessToken,{pageNo:1,pageSize:100}),getAttendanceExceptionProcesses(state.accessToken)]);rows.value=d.list||[];processes.value=p;}catch(e){toast(e instanceof Error?e.message:"鍔犺浇澶辫触");}finally{loading.value=false;uni.stopPullDownRefresh();}}
-function submit(row:AttendanceException){active.value=row;if(processes.value.length===1)doSubmit(processes.value[0].key);else processVisible.value=true;}async function doSubmit(key:string|number){if(!state.accessToken||!active.value?.id||!await confirm("纭鎻愪氦鑰冨嫟寮傚父瀹℃壒锛�"))return;try{await submitAttendanceException(state.accessToken,active.value.id,String(key));toast("鎻愪氦鎴愬姛");processVisible.value=false;await load();}catch(e){toast(e instanceof Error?e.message:"鎻愪氦澶辫触");}}
-onShow(load);onPullDownRefresh(load);
-</script><template><view class="page"><template v-if="canQuery"><view v-for="row in rows" :key="row.id" class="card" @click="uni.navigateTo({url:`/pages/hrm/attendance-exception/form?id=${row.id}&detail=1`})"><view class="head"><view class="head-main"><text class="name">{{row.userName||'--'}}</text><text class="sub">{{row.deptName||'--'}} 路 {{row.date||'--'}}</text></view><text :class="['tag',row.status===20?'tag-green':row.status===10?'tag-blue':'tag-gray']">{{row.status===0?'鑽夌':row.status===10?'瀹℃壒涓�':row.status===20?'宸查�氳繃':'宸茬粨鏉�'}}</text></view><view class="grid"><text>寮傚父绫诲瀷锛歿{row.exceptionTypeName||row.exceptionType||'--'}}</text><text>鍘熷洜锛歿{row.reason||'--'}}</text><text>澶囨敞锛歿{row.remark||'--'}}</text></view><view class="actions" @click.stop><button @click="uni.navigateTo({url:`/pages/hrm/attendance-exception/form?id=${row.id}&detail=1`})">鏌ョ湅</button><button v-if="row.status===0&&hasPermission('hrm:attendance-exception:submit')" @click="submit(row)">鎻愪氦</button></view></view><view v-if="!rows.length" class="state">{{loading?'鍔犺浇涓�...':'鏆傛棤鑰冨嫟寮傚父鐢宠'}}</view><button v-if="hasPermission('hrm:attendance-exception:create')" class="fab" @click="uni.navigateTo({url:'/pages/hrm/attendance-exception/form'})"><view/></button></template><view v-else class="state">鏆傛棤鑰冨嫟寮傚父鏌ョ湅鏉冮檺</view><PickerSheet v-model:show="processVisible" title="閫夋嫨瀹℃壒娴佺▼" :items="processes.map(x=>({key:x.key,label:x.name}))" :selected-keys="[]" @confirm="k=>doSubmit(k[0])"/></view></template><style scoped lang="scss">@import "../list.scss";</style>
+import { computed, ref } from "vue";
+import { onPullDownRefresh, onReachBottom, onShow } from "@dcloudio/uni-app";
+import { getAttendanceExceptionPage, submitAttendanceException, getAttendanceExceptionProcesses, type AttendanceException, type ApproveProcess } from "../../../api/hrm";
+import { useAuth } from "../../../stores/auth";
+import PickerSheet from "../../mes/process-design/components/PickerSheet.vue";
+import { confirm, toast } from "../shared";
+const { hasPermission, state } = useAuth();
+const rows = ref<AttendanceException[]>([]), processes = ref<ApproveProcess[]>([]), processVisible = ref(false), active = ref<AttendanceException>(), loading = ref(false), pageNo = ref(1), total = ref(0);
+const pageSize = 15;
+const canQuery = computed(() => hasPermission("hrm:attendance-exception:query"));
+const hasMore = computed(() => rows.value.length < total.value);
+async function load(reset = true) {
+ if (!state.accessToken || !canQuery.value || loading.value) return;
+ if (reset) { pageNo.value = 1; total.value = 0; }
+ loading.value = true;
+ try {
+ const data = await getAttendanceExceptionPage(state.accessToken, { pageNo: pageNo.value, pageSize });
+ rows.value = reset ? (data.list || []) : [...rows.value, ...(data.list || [])];
+ total.value = Number(data.total || 0);
+ if (rows.value.length < total.value) pageNo.value += 1;
+ if (reset) processes.value = await getAttendanceExceptionProcesses(state.accessToken);
+ } catch (error) { toast(error instanceof Error ? error.message : "鍔犺浇澶辫触"); }
+ finally { loading.value = false; uni.stopPullDownRefresh(); }
+}
+function submit(row: AttendanceException) {
+ active.value = row;
+ if (processes.value.length === 1) doSubmit(processes.value[0].key);
+ else processVisible.value = true;
+}
+async function doSubmit(key: string | number) {
+ if (!state.accessToken || !active.value?.id || !await confirm("纭鎻愪氦鑰冨嫟寮傚父瀹℃壒锛�")) return;
+ try { await submitAttendanceException(state.accessToken, active.value.id, String(key)); toast("鎻愪氦鎴愬姛"); processVisible.value = false; await load(true); }
+ catch (error) { toast(error instanceof Error ? error.message : "鎻愪氦澶辫触"); }
+}
+onShow(() => load(true));
+onPullDownRefresh(() => load(true));
+onReachBottom(() => { if (hasMore.value) load(false); });
+</script><template><view class="page"><template v-if="canQuery"><view v-for="row in rows" :key="row.id" class="card" @click="uni.navigateTo({url:`/pages/hrm/attendance-exception/form?id=${row.id}&detail=1`})"><view class="head"><view class="head-main"><text class="name">{{row.userName||'--'}}</text><text class="sub">{{row.deptName||'--'}} 路 {{row.date||'--'}}</text></view><text :class="['tag',row.status===20?'tag-green':row.status===10?'tag-blue':'tag-gray']">{{row.status===0?'鑽夌':row.status===10?'瀹℃壒涓�':row.status===20?'宸查�氳繃':'宸茬粨鏉�'}}</text></view><view class="grid"><text>寮傚父绫诲瀷锛歿{row.exceptionTypeName||row.exceptionType||'--'}}</text><text>鍘熷洜锛歿{row.reason||'--'}}</text><text>澶囨敞锛歿{row.remark||'--'}}</text></view><view class="actions" @click.stop><button @click="uni.navigateTo({url:`/pages/hrm/attendance-exception/form?id=${row.id}&detail=1`})">鏌ョ湅</button><button v-if="row.status===0&&hasPermission('hrm:attendance-exception:submit')" @click="submit(row)">鎻愪氦</button></view></view><view v-if="!rows.length" class="state">{{loading?'鍔犺浇涓�...':'鏆傛棤鑰冨嫟寮傚父鐢宠'}}</view><view v-else class="state more">{{loading ? "鍔犺浇涓�..." : hasMore ? "涓婃媺鍔犺浇鏇村" : "娌℃湁鏇村浜�"}}</view><button v-if="hasPermission('hrm:attendance-exception:create')" class="fab" @click="uni.navigateTo({url:'/pages/hrm/attendance-exception/form'})"><view/></button></template><view v-else class="state">鏆傛棤鑰冨嫟寮傚父鏌ョ湅鏉冮檺</view><PickerSheet v-model:show="processVisible" title="閫夋嫨瀹℃壒娴佺▼" :items="processes.map(x=>({key:x.key,label:x.name}))" :selected-keys="[]" @confirm="k=>doSubmit(k[0])"/></view></template><style scoped lang="scss">@import "../list.scss";</style>
--
Gitblit v1.9.3