Browse Source

打卡导出

uni
xuesinan 3 years ago
parent
commit
e7583718aa
  1. 3
      apis/plugin.js
  2. 12
      common/styles/tailwind.scss
  3. 10
      hooks/project/useGetTasks.js
  4. 8
      pages/detail/detail.vue
  5. 33
      plugins/p-check-work/detail.vue
  6. 151
      plugins/p-salary/detail.vue
  7. 8
      plugins/p-salary/p-salary.vue

3
apis/plugin.js

@ -50,4 +50,7 @@ export function setupPlugin(app) {
// 审核
uni.$u.api.clockAudit = (params, url) => uni.$u.post(`${url ? url : domain.value}/clock/audit`, params);
// 导出
uni.$u.api.clockExport = (params, url) => uni.$u.post(`${url ? url : domain.value}/clock/export`, params);
}

12
common/styles/tailwind.scss

@ -14,6 +14,10 @@
position: relative;
}
.bottom-0 {
bottom: 0;
}
.z-10 {
z-index: 10;
}
@ -4680,4 +4684,12 @@
.line-through {
text-decoration: line-through;
}
.h-48 {
height: 48px;
}
.h-50 {
height: 50px;
}

10
hooks/project/useGetTasks.js

@ -103,9 +103,13 @@ export default function useGetTasks() {
// 将真实任务存储到allTasks中对应的角色下
const arr = [...allTasks.value];
arr[roleIndex.value].realTasks = [...realTasks.value];
arr[roleIndex.value].upNextPage = upNextPage.value; // 存储下一页(向上)
arr[roleIndex.value].downNextPage = downNextPage.value; // 存储下一页(向下)
if (arr[roleIndex.value]) {
arr[roleIndex.value].realTasks = [...realTasks.value];
arr[roleIndex.value].upNextPage = upNextPage.value; // 存储下一页(向上)
arr[roleIndex.value].downNextPage = downNextPage.value; // 存储下一页(向下)
}
store.commit('task/setAllTasks', arr);
// 数据处理

8
pages/detail/detail.vue

@ -1,11 +1,15 @@
<template>
<!-- 考勤详情页 -->
<p-check-work-detail v-if="key === 'checkWork'" :clockParams="params"></p-check-work-detail>
<!-- 工资条详情页 -->
<p-salary-detail v-if="key === 'salary'"></p-salary-detail>
</template>
<script setup>
import { ref, onMounted } from 'vue';
import pCheckWorkDetail from "@/plugins/p-check-work/detail";
import { ref, onMounted } from 'vue';
import pCheckWorkDetail from "@/plugins/p-check-work/detail";
import pSalaryDetail from "@/plugins/p-salary/detail";
let key = ref(null);
let params = ref({});

33
plugins/p-check-work/detail.vue

@ -231,9 +231,9 @@
try {
const params = { projectId, roleId, memberIdList: memberIdList.value, startTime, endTime }
const data = await uni.$u.api.clockQuery(params, url);
const res = await uni.$u.api.clockQuery(params, url);
data.forEach(list => {
res.forEach(list => {
let arr = [];
list.recordList.forEach(item => {
if (item.isMine === 1) {
@ -256,8 +256,12 @@
list.recordList = arr;
})
clockInfos.value = data;
} catch (error) {
clockInfos.value = res;
} catch (error) {
uni.showToast({
title: '查询失败',
duration: 2000
})
console.log('error: ', error);
}
}
@ -363,8 +367,25 @@
}
//
function clockExport() {
closePopup();
async function clockExport(data) {
closePopup();
startTime = data ? dayjs(data.startTime).startOf('day').valueOf() : startTime;
endTime = data ? dayjs(data.endTime).endOf('day').valueOf() : endTime;
memberIdList.value = data ? data.memberIdList : memberIdList.value;
try {
const params = { projectId, roleId, memberIdList: memberIdList.value, startTime, endTime }
const res = await uni.$u.api.clockExport(params, url);
window.location.href = res.url;
} catch (error) {
console.log('error: ', error);
uni.showToast({
title: '导出失败',
duration: 2000
})
}
}
</script>

151
plugins/p-salary/detail.vue

@ -0,0 +1,151 @@
<template>
<view class="container">
<!-- -->
<view class="salary-total text-center flex flex-col justify-center text-white">
<view class="salary-total-money">5000.00</view>
<view class="pt-2">实发金额</view>
</view>
<!-- 详细名目 -->
<view>
<view class="mt-3 px-4 bg-white">
<view class="flex justify-between items-center h-48 font-bold border-bottom">
<view>固定工资</view>
<view><text>5000</text><u-icon class="m-1 text-gray-400" size="26" name="arrow-right" @click=""></u-icon></view>
</view>
<view class="text-gray-500">
<view>
<view class="flex justify-between items-center h-48 border-bottom">
<view>基本工资</view>
<view><text>5000</text><u-icon class="m-1 text-gray-400" size="26" name="arrow-right" @click=""></u-icon></view>
</view>
<view class="px-4 text-gray-400">
<view class="flex justify-between items-center h-48">
<view>基本工资</view>
<view>5000</view>
</view>
<view class="flex justify-between items-center h-48">
<view>基本工资</view>
<view>5000</view>
</view>
<view class="flex justify-between items-center h-48">
<view>基本工资</view>
<view>5000</view>
</view>
</view>
</view>
<view class="flex justify-between items-center h-48 border-bottom">
<view>基本工资</view>
<view><text>5000</text><u-icon class="m-1 text-gray-400" size="26" name="arrow-right" @click=""></u-icon></view>
</view>
<view class="flex justify-between items-center h-48 border-bottom">
<view>基本工资</view>
<view><text>5000</text><u-icon class="m-1 text-gray-400" size="26" name="arrow-right" @click=""></u-icon></view>
</view>
</view>
</view>
<view class="mt-3 px-4 bg-white">
<view class="flex justify-between items-center h-48 font-bold border-bottom">
<view>固定工资</view>
<view><text>5000</text><u-icon class="m-1 text-gray-400" size="26" name="arrow-right" @click=""></u-icon></view>
</view>
<view class="text-gray-500">
<view>
<view class="flex justify-between items-center h-48 border-bottom">
<view>基本工资</view>
<view><text>5000</text><u-icon class="m-1 text-gray-400" size="26" name="arrow-right" @click=""></u-icon></view>
</view>
<view class="px-4 text-gray-400">
<view class="flex justify-between items-center h-48">
<view>基本工资</view>
<view>5000</view>
</view>
<view class="flex justify-between items-center h-48">
<view>基本工资</view>
<view>5000</view>
</view>
<view class="flex justify-between items-center h-48">
<view>基本工资</view>
<view>5000</view>
</view>
</view>
</view>
<view class="flex justify-between items-center h-48 border-bottom">
<view>基本工资</view>
<view><text>5000</text><u-icon class="m-1 text-gray-400" size="26" name="arrow-right" @click=""></u-icon></view>
</view>
<view class="flex justify-between items-center h-48 border-bottom">
<view>基本工资</view>
<view><text>5000</text><u-icon class="m-1 text-gray-400" size="26" name="arrow-right" @click=""></u-icon></view>
</view>
</view>
</view>
</view>
<!-- 确认 -->
<view class="fixed bottom-0 px-6 flex justify-around items-center w-full border-top h-50 bg-white">
<u-button class="salary-btn" @click="">对工资有疑问</u-button>
<u-button class="salary-btn" type="primary" @click="">确认</u-button>
</view>
</view>
</template>
<script setup>
</script>
<style lang="scss" scoped>
.container {
padding-bottom: 80px;
width: 100%;
background-color: #f3f3f3 !important;
.border-bottom {
border-bottom: 1px solid #E5E7EB;
}
.border-top {
border-top: 1px solid #E5E7EB;
}
}
.salary-total {
height: 160px;
background-color: #40a9ff;
.salary-total-money {
font-size: 40px;
}
}
.salary-btn {
width: 47%;
height: 36px;
font-size: 16px;
&:after {
border: 0;
}
&:first-child {
color: #929292;
}
&:last-child {
letter-spacing: 8px;
}
}
</style>

8
plugins/p-salary/p-salary.vue

@ -25,7 +25,13 @@
return currMonth === 1 ? 12 : currMonth - 1;
});
function toLink() {
function toLink() {
// uni.$storage.setStorageSync('pluginKey', 'salary');
// uni.navigateTo({
// url: "/pages/detail/detail"
// })
const url = "http://101.201.226.163/tallsalary/";
const params = {
pid: projectId.value,

Loading…
Cancel
Save