| | |
| | | const rows = ref<SalaryPayment[]>([]), period = ref(new Date().toISOString().slice(0, 7)), loading = ref(false), pageNo = ref(1), total = ref(0); |
| | | const pageSize = 15; |
| | | const canQuery = computed(() => hasPermission("hrm:salary-payment:query")); |
| | | // 与后端 /generate 接口及菜单权限项一致,注意不是 hrm:salary-payment:generate |
| | | const canGenerate = computed(() => hasPermission("hrm:salary:generate")); |
| | | const hasMore = computed(() => rows.value.length < total.value); |
| | | async function load(reset = true) { |
| | | if (!state.accessToken || !canQuery.value || loading.value) return; |
| | |
| | | onPullDownRefresh(() => load(true)); |
| | | onReachBottom(() => { if (hasMore.value) load(false); }); |
| | | </script> |
| | | <template><view class="page"><template v-if="canQuery"><view class="search"><input v-model="period" placeholder="发放周期 YYYY-MM" @confirm="load" /><text @click="load">查询</text></view><view v-if="hasPermission('hrm:salary-payment:generate')" class="top-actions"><button @click="generate">生成发放台账</button></view><view v-for="row in rows" :key="row.id" class="card" @click="uni.navigateTo({ url: `/pages/hrm/salary-payment/detail?id=${row.id}` })"><view class="head"><view class="head-main"><text class="name">{{ row.no || "暂无单号" }}</text><text class="sub">{{ row.period || "--" }}</text></view><text :class="['tag', row.status === 1 ? 'tag-green' : 'tag-orange']">{{ row.status === 1 ? "已发放" : "待发放" }}</text></view><view class="grid"><text>总人数:{{ row.totalCount ?? 0 }}</text><text>总金额:{{ money(row.totalAmount) }}</text><text>发放时间:{{ dateTime(row.paymentTime) }}</text><text>备注:{{ row.remark || "--" }}</text></view><view class="actions" @click.stop><button @click="uni.navigateTo({ url: `/pages/hrm/salary-payment/detail?id=${row.id}` })">查看明细</button><button v-if="row.status === 0 && hasPermission('hrm:salary-payment:pay')" @click="pay(row)">发放</button></view></view><view v-if="!rows.length" class="state">{{ loading ? "加载中..." : "暂无发放台账" }}</view><view v-else class="state more">{{loading ? "加载中..." : hasMore ? "上拉加载更多" : "没有更多了"}}</view></template><view v-else class="state">暂无薪资发放查看权限</view></view></template> |
| | | <template><view class="page"><template v-if="canQuery"><view class="search"><input v-model="period" placeholder="发放周期 YYYY-MM" @confirm="load" /><text @click="load">查询</text></view><view v-if="canGenerate" class="top-actions"><button @click="generate">生成发放台账</button></view><view v-for="row in rows" :key="row.id" class="card" @click="uni.navigateTo({ url: `/pages/hrm/salary-payment/detail?id=${row.id}` })"><view class="head"><view class="head-main"><text class="name">{{ row.no || "暂无单号" }}</text><text class="sub">{{ row.period || "--" }}</text></view><text :class="['tag', row.status === 1 ? 'tag-green' : 'tag-orange']">{{ row.status === 1 ? "已发放" : "待发放" }}</text></view><view class="grid"><text>总人数:{{ row.totalCount ?? 0 }}</text><text>总金额:{{ money(row.totalAmount) }}</text><text>发放时间:{{ dateTime(row.paymentTime) }}</text><text>备注:{{ row.remark || "--" }}</text></view><view class="actions" @click.stop><button @click="uni.navigateTo({ url: `/pages/hrm/salary-payment/detail?id=${row.id}` })">查看明细</button><button v-if="row.status === 0 && hasPermission('hrm:salary-payment:pay')" @click="pay(row)">发放</button></view></view><view v-if="!rows.length" class="state">{{ loading ? "加载中..." : "暂无发放台账" }}</view><view v-else class="state more">{{loading ? "加载中..." : hasMore ? "上拉加载更多" : "没有更多了"}}</view></template><view v-else class="state">暂无薪资发放查看权限</view></view></template> |
| | | <style scoped lang="scss">@import "../list.scss";.top-actions{display:flex;justify-content:flex-end;margin-bottom:18rpx}.top-actions button{margin:0;color:var(--color-primary, #1769d8);font-size:24rpx;background:#fff}</style> |