Browse Source

feat: 工资插件改写为uni

uni
xuesinan 3 years ago
parent
commit
12ba0999ad
  1. 3
      CHANGELOG.md
  2. 9
      components/Plugin/Plugin.vue
  3. 4
      hooks/project/useGetTasks.js
  4. 1
      pages/submitLog/submitLog.vue
  5. 153
      plugins/p-check-work-summary/detail.vue
  6. 33
      plugins/p-check-work-summary/p-check-work-summary.vue
  7. 42
      plugins/p-salary-manage/p-salary-manage.vue
  8. 42
      plugins/p-salary/p-salary.vue

3
CHANGELOG.md

@ -1,4 +1,4 @@
# 1.0.0 (2022-09-15)
# 1.0.0 (2022-09-16)
### 🌟 新功能
范围|描述|commitId
@ -91,6 +91,7 @@
- | 增加位置信息并传参给内嵌插件 | [fe5fe4e](https://101.201.226.163:50022/ccsens_tall/TALL-MUI-4/commits/fe5fe4e)
- | 长按改变层级 | [c25319a](https://101.201.226.163:50022/ccsens_tall/TALL-MUI-4/commits/c25319a)
- | 账户名密码登录 | [ebf456e](https://101.201.226.163:50022/ccsens_tall/TALL-MUI-4/commits/ebf456e)
- | 整理交付物代码文件 | [4480546](https://101.201.226.163:50022/ccsens_tall/TALL-MUI-4/commits/4480546)
- | 重复数据删除 | [99aa565](https://101.201.226.163:50022/ccsens_tall/TALL-MUI-4/commits/99aa565)
- | 主体颜色 | [bb5c0e3](https://101.201.226.163:50022/ccsens_tall/TALL-MUI-4/commits/bb5c0e3)
- | 注册、用户协议 | [68e9189](https://101.201.226.163:50022/ccsens_tall/TALL-MUI-4/commits/68e9189)

9
components/Plugin/Plugin.vue

@ -40,6 +40,15 @@
<!-- 考勤插件 -->
<p-check-work :task="task" v-else-if="pluginId === '1485171846022434817'"></p-check-work>
<!-- 考勤统计插件 -->
<p-check-work-summary :task="task" v-else-if="pluginId === '25'"></p-check-work-summary>
<!-- 工资条插件 -->
<p-salary :task="task" v-else-if="pluginId === '1541239500222763008'"></p-salary>
<!-- 工资汇总插件 -->
<p-salary-manage :task="task" v-else-if="pluginId === '1541234829630377984'"></p-salary-manage>
<Render
v-else
:task="task"

4
hooks/project/useGetTasks.js

@ -90,7 +90,9 @@ export default function useGetTasks() {
// 存储当前查询的真实任务
params.queryType === 0 ? store.commit('task/setUpRealTasks', data.list) : store.commit('task/setDownRealTasks', data.list);
params.queryType === 0 ? store.commit('socket/setCurrLocationTaskId', data.list[0].id) : store.commit('socket/setCurrLocationTaskId', data.list[data.list.length - 1].id);
if (data.list.length > 0) {
params.queryType === 0 ? store.commit('socket/setCurrLocationTaskId', data.list[0].id) : store.commit('socket/setCurrLocationTaskId', data.list[data.list.length - 1].id);
}
// 下一页
if (data.list.length < params.pageSize) {

1
pages/submitLog/submitLog.vue

@ -100,6 +100,7 @@
import { ref, provide } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import dayjs from 'dayjs';
import pDeliverUploadSecond from "@/plugins/p-deliver-second/p-deliver-upload-second.vue"
import pDeliverCheckSecondDetail from "@/plugins/p-deliver-second/p-deliver-check-second-detail.vue"
const listRef = ref([]);

153
plugins/p-check-work-summary/detail.vue

@ -0,0 +1,153 @@
<template>
<!-- 考勤统计 -->
<view>
<!-- 标题 + 筛选 -->
<view class="check-work-title px-3 fixed top-0 z-10 w-full flex justify-between items-center bg-white">
<text>考勤统计</text>
<view>
<u-button class="mr-3" size="mini" type="primary" @click="isShow = !isShow">过滤</u-button>
<u-button size="mini" type="primary" @click="isShow = !isShow">导出</u-button>
</view>
</view>
<view class="check-work-list">
<u-table class="table-head">
<u-tr>
<u-th>姓名</u-th>
<u-th>出勤()</u-th>
<u-th>请假()</u-th>
<u-th>加班()</u-th>
</u-tr>
</u-table>
<view v-if="clockInfos.length" v-for="(list, listIndex) in clockInfos" :key="listIndex">
<view class="table-time px-2">{{ dayjs(+list.dateTime).format("YYYY-MM") }}</view>
<u-table class="table-body">
<u-tr v-if="list.recordList.length" v-for="(item, index) in list.recordList" :key="index" @click="toDetail(list.dateTime, item)">
<u-td>{{ item.memberName }}</u-td>
<u-td>{{ item.attendance_days }}</u-td>
<u-td>{{ item.leave_days }}</u-td>
<u-td>{{ item.overtime_days }}</u-td>
</u-tr>
</u-table>
</view>
</view>
<!-- 筛选框 -->
<SearchPopup v-if="isShow" :members="list" :show="isShow" :source="'checkWorkSummary'" @closePopup="closePopup" @getClockQuery="getClockQuery" @clockExport="clockExport"></SearchPopup>
</view>
</template>
<script setup>
import { computed, onMounted, ref } from 'vue';
import { useStore } from 'vuex';
import dayjs from 'dayjs';
import SearchPopup from '@/components/SearchPopup/SearchPopup.vue';
const emit = defineEmits(['checkClock']);
const projectId = uni.$storage.getStorageSync('projectId');
const roleId = uni.$storage.getStorageSync('roleId');
const checkers = uni.$storage.getStorageSync('checkers'); //
const checkWorkDetail = uniCloud.importObject('check-work') //
const clockInfos = ref([]);
let isShow = ref(false);
let list = ref([]); //
let checkerId = ref(null);
let checkerName = ref(null);
onMounted(() => {
list.value = [];
let checker_arr = JSON.parse(checkers);
checker_arr.forEach(item => {
list.value.push({
value: item.memberId,
label: item.memberName
})
if (item.memberName === '周勇') {
checkerId.value = item.memberId;
checkerName.value = item.memberName;
}
})
getClockQuery();
})
async function getClockQuery(data) {
closePopup();
const startTime = data ? dayjs(+data.startTime).startOf('month').valueOf() : dayjs().subtract(1, 'month').startOf('month').valueOf();
const endTime = data ? dayjs(+data.endTime).endOf('month').valueOf() : dayjs().subtract(1, 'month').endOf('month').valueOf();
const memberIdList = data ? data.memberIdList : [];
try {
const params = { projectId, roleId, memberIdList, startTime, endTime }
const res = await checkWorkDetail.getClockQuery(params);
clockInfos.value = res.data;
} catch (error) {
console.log('error: ', error);
}
}
//
function toDetail(time, data) {
data.startTime = time,
data.endTime = dayjs(+time).endOf('month').valueOf();
data.memberIdList = [];
data.memberIdList.push(data.memberId._value);
emit('checkClock', data)
}
//
function closePopup(data) {
isShow.value = data;
}
//
function clockExport() {
closePopup();
}
</script>
<style lang="scss" scoped>
.check-work-title {
height: 50px;
border-bottom: 1px solid #e8e8e8;
}
.check-work-list {
margin-top: 50px;
}
.u-table {
border-left: unset !important;
}
.table-head {
border-top: unset !important;
}
.u-th {
border-right: unset !important;
height: 36px;
background: #fafafa;
}
.u-td {
border-right: unset !important;
height: 40px;
}
.table-time {
height: 30px;
line-height: 30px;
background: #fafafa;
}
</style>

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

@ -0,0 +1,33 @@
<template>
<!-- 考勤统计插件 -->
<view class="p-4 flex justify-between items-center">
<text>{{ prveMonth }}月考勤数据统计</text>
<u-button size="mini" type="primary" class="m-0" @click="toLink">查看</u-button>
</view>
</template>
<script setup>
import { ref, computed } from 'vue';
import { useStore } from 'vuex';
import dayjs from 'dayjs';
const props = defineProps({ task: { type: Object, default: () => {} } });
const store = useStore();
const prveMonth = computed(() => {
const currMonth = dayjs(+props.task.planStart).format("M");
return currMonth === 1 ? 12 : currMonth - 1;
});
function toLink() {
uni.$storage.setStorageSync('pluginKey', 'checkWorkSummary');
uni.navigateTo({
url: "/pages/detail/detail"
})
}
</script>
<style>
</style>

42
plugins/p-salary-manage/p-salary-manage.vue

@ -0,0 +1,42 @@
<template>
<!-- 工资条插件 -->
<view class="p-2 flex justify-between items-center">
<text>{{ prveMonth }}月份工资汇总</text>
<u-button size="mini" type="primary" class="m-0" @click="toLink">查看</u-button>
</view>
</template>
<script setup>
import { ref, computed } from 'vue';
import { useStore } from 'vuex';
import dayjs from 'dayjs';
const props = defineProps({ task: { type: Object, default: () => {} } });
const store = useStore();
const projectId = computed(() => store.getters['project/projectId']);
const userId = computed(() => store.getters['user/userId']);
const roleId = computed(() => store.state.role.roleId);
const token = computed(() => store.state.user.token);
const domain = computed(() => store.state.domain);
const prveMonth = computed(() => {
const currMonth = dayjs(+props.task.planStart).format("M");
return currMonth === 1 ? 12 : currMonth - 1;
});
function toLink() {
const url = "http://101.201.226.163/salarysummary/";
const params = {
pid: projectId.value,
uid: userId.value,
rid: roleId.value,
token: token.value,
url: domain.value
}
window.location.href = `${url}?pid=${params.pId}&uid=${params.uId}&rid=${params.rId}&token=${params.token}&url=${params.url}`;
}
</script>
<style>
</style>

42
plugins/p-salary/p-salary.vue

@ -0,0 +1,42 @@
<template>
<!-- 工资条插件 -->
<view class="p-4 flex justify-between items-center">
<text>{{ prveMonth }}月份工资条</text>
<u-button size="mini" type="primary" class="m-0" @click="toLink">查看</u-button>
</view>
</template>
<script setup>
import { ref, computed } from 'vue';
import { useStore } from 'vuex';
import dayjs from 'dayjs';
const props = defineProps({ task: { type: Object, default: () => {} } });
const store = useStore();
const projectId = computed(() => store.getters['project/projectId']);
const userId = computed(() => store.getters['user/userId']);
const roleId = computed(() => store.state.role.roleId);
const token = computed(() => store.state.user.token);
const domain = computed(() => store.state.domain);
const prveMonth = computed(() => {
const currMonth = dayjs(+props.task.planStart).format("M");
return currMonth === 1 ? 12 : currMonth - 1;
});
function toLink() {
const url = "http://101.201.226.163/tallsalary/";
const params = {
pid: projectId.value,
uid: userId.value,
rid: roleId.value,
token: token.value,
url: domain.value
}
window.location.href = `${url}?pid=${params.pid}&uid=${params.uid}&rid=${params.rid}&token=${params.token}&url=${params.url}`;
}
</script>
<style>
</style>
Loading…
Cancel
Save