|
@@ -0,0 +1,203 @@
|
|
|
+<template>
|
|
|
+ <div>
|
|
|
+ <van-nav-bar :title="'员工绩效'" left-text="" left-arrow @click-left="onClickLeft">
|
|
|
+ <!-- <template #right> 扫码 </template> -->
|
|
|
+ </van-nav-bar>
|
|
|
+ <van-search v-model="req.keyword" :placeholder="$t('common.pleaseEnterKeywords')" @search="onRefresh" />
|
|
|
+
|
|
|
+ <van-popup v-model:show="showDate" position="bottom" round :style="{ height: '40%' }">
|
|
|
+ <van-date-picker v-model="currentDate" title="选择年月" :columns-type="['year', 'month']" @cancel="showDate=false" @confirm="handleChangeDate" />
|
|
|
+ </van-popup>
|
|
|
+
|
|
|
+ <div style="height:40px;line-height:40px;display:flex;align-items:center;padding-left:10px;background:#fff;">
|
|
|
+ <span>年月:{{ req.dataDate}}</span> <van-button plain type="primary" style="margin-left:15px" size="small"
|
|
|
+ @click="showDate=true">点击切换年月</van-button>
|
|
|
+ </div>
|
|
|
+ <div style="overflow-y:auto;height:calc(100vh - 210px);">
|
|
|
+ <van-pull-refresh v-model="loading" @refresh="onRefresh">
|
|
|
+ <div class="list">
|
|
|
+ <van-list v-model:loading="loading" :finished="finished" :finished-text="$t('common.noMore')" @load="onLoad">
|
|
|
+ <commonList :data="dateList" :config="listConfig" :showMore="true" @onClick="toDtl">
|
|
|
+ <template #wages="{row}">
|
|
|
+ <div>
|
|
|
+ <span v-if="listData.length>1">
|
|
|
+ {{ moneyFormat(listData[0].dayData[row.att],2)}}
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </commonList>
|
|
|
+ </van-list>
|
|
|
+ </div>
|
|
|
+ </van-pull-refresh>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- <div style="padding:20px">
|
|
|
+ <van-button type="success" style="width:100%;height:200px;font-size:36px" @click="handleScanCode">扫码</van-button>
|
|
|
+
|
|
|
+ </div> -->
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+<script setup>
|
|
|
+import { ref, getCurrentInstance, onMounted, nextTick } from "vue";
|
|
|
+import commonList from "@/components/common-list.vue";
|
|
|
+import { getUserInfo, getToken } from "@/utils/auth";
|
|
|
+import { useRoute } from "vue-router";
|
|
|
+import { getMonthBetween } from "@/utils/util";
|
|
|
+const showDate = ref(false);
|
|
|
+const userId = getUserInfo().userId;
|
|
|
+const loading = ref(false);
|
|
|
+const router = useRoute();
|
|
|
+const date = new Date();
|
|
|
+const yearData = ref(date.getFullYear());
|
|
|
+const monthData = ref(date.getMonth() + 1);
|
|
|
+monthData.value = monthData.value > 9 ? monthData.value : "0" + monthData.value;
|
|
|
+const currentDate = ref([yearData.value + "", monthData.value]);
|
|
|
+const yearMonth = ref(yearData.value + "-" + monthData.value);
|
|
|
+const beginTime = ref("");
|
|
|
+const endTime = ref("");
|
|
|
+const dateList = ref([]);
|
|
|
+const req = ref({
|
|
|
+ pageNum: 1,
|
|
|
+ keyword: null,
|
|
|
+ dataDate: yearMonth.value,
|
|
|
+ userId: userId,
|
|
|
+});
|
|
|
+const finished = ref(false);
|
|
|
+const proxy = getCurrentInstance().proxy;
|
|
|
+const listData = ref([]);
|
|
|
+
|
|
|
+const listConfig = ref([
|
|
|
+ {
|
|
|
+ label: "日期",
|
|
|
+ prop: "day",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "slot",
|
|
|
+ label: "工资",
|
|
|
+ slotName: "wages",
|
|
|
+ },
|
|
|
+]);
|
|
|
+const onRefresh = () => {
|
|
|
+ req.value.pageNum = 1;
|
|
|
+ finished.value = false;
|
|
|
+ getList("refresh");
|
|
|
+};
|
|
|
+const onLoad = () => {
|
|
|
+ getList();
|
|
|
+};
|
|
|
+
|
|
|
+const onClickLeft = () => proxy.$router.push("/main/working");
|
|
|
+
|
|
|
+const onClickRight = () => {
|
|
|
+ proxy.$router.push("/main/taskAdd");
|
|
|
+};
|
|
|
+proxy.uploadDdRightBtn(onClickRight, proxy.t("common.add"));
|
|
|
+// const toDtl = (row) => {
|
|
|
+// proxy.$router.push({
|
|
|
+// path: "taskDtl",
|
|
|
+// query: {
|
|
|
+// id: row.id,
|
|
|
+// },
|
|
|
+// });
|
|
|
+// };
|
|
|
+
|
|
|
+const getList = (type) => {
|
|
|
+ loading.value = true;
|
|
|
+ proxy
|
|
|
+ .post("/report/userPerformanceReport", req.value)
|
|
|
+ .then((res) => {
|
|
|
+ finished.value = true;
|
|
|
+ listData.value = res.data;
|
|
|
+ // listData.value =
|
|
|
+ // type === "refresh"
|
|
|
+ // ? res.data.rows
|
|
|
+ // : listData.value.concat(res.data.rows);
|
|
|
+ // if (req.value.pageNum * 10 >= res.data.total) {
|
|
|
+ // finished.value = true;
|
|
|
+ // }
|
|
|
+ // req.value.pageNum++;
|
|
|
+ loading.value = false;
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ loading.value = false;
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+// getList();
|
|
|
+
|
|
|
+const handleScanCode = () => {
|
|
|
+ // proxy.$router.push({
|
|
|
+ // path: "/main/productionReportAdd",
|
|
|
+ // query: {
|
|
|
+ // id: "contract_flow",
|
|
|
+ // },
|
|
|
+ // });
|
|
|
+ uni.postMessage({
|
|
|
+ data: {
|
|
|
+ type: "scanCode",
|
|
|
+ },
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+// const showScanData = (val) => {
|
|
|
+// proxy.post("/productionTaskDetail/snInfo", { productSn: val }).then((res) => {
|
|
|
+// if (res.data && res.data.productId) {
|
|
|
+// formData.data.productId = res.data.productId;
|
|
|
+// formData.data.productSn = res.data.productSn;
|
|
|
+// formData.data.code = res.data.contractCode;
|
|
|
+// formData.data.productName = res.data.productName;
|
|
|
+// formData.data.productSpec = res.data.productSpec;
|
|
|
+// formData.data.customerName = res.data.customerName;
|
|
|
+// }
|
|
|
+// });
|
|
|
+// };
|
|
|
+
|
|
|
+const handleChangeDate = ({
|
|
|
+ selectedValues,
|
|
|
+ selectedOptions,
|
|
|
+ selectedIndexes,
|
|
|
+}) => {
|
|
|
+ yearData.value = selectedValues[0];
|
|
|
+ monthData.value = selectedValues[1];
|
|
|
+ yearMonth.value = yearData.value + "-" + monthData.value;
|
|
|
+ req.value.dataDate = yearMonth.value;
|
|
|
+ beginTime.value = yearMonth.value + "-" + "01";
|
|
|
+ endTime.value =
|
|
|
+ yearMonth.value +
|
|
|
+ "-" +
|
|
|
+ new Date(yearData.value, monthData.value, 0).getDate();
|
|
|
+ let arr = getMonthBetween(beginTime.value, endTime.value);
|
|
|
+ for (let i = 0; i < arr.length; i++) {
|
|
|
+ const day = arr[i];
|
|
|
+ let obj = {
|
|
|
+ id: day,
|
|
|
+ day,
|
|
|
+ att: Number(day.slice(-2)),
|
|
|
+ };
|
|
|
+ arr[i] = obj;
|
|
|
+ }
|
|
|
+ dateList.value = arr;
|
|
|
+ showDate.value = false;
|
|
|
+ getList();
|
|
|
+};
|
|
|
+
|
|
|
+onMounted(() => {
|
|
|
+ handleChangeDate({ selectedValues: [yearData.value + "", monthData.value] });
|
|
|
+});
|
|
|
+
|
|
|
+const toDtl = (row) => {
|
|
|
+ proxy.$router.push({
|
|
|
+ path: "reportDetail",
|
|
|
+ query: {
|
|
|
+ userId: userId,
|
|
|
+ dataDate: row.id,
|
|
|
+ },
|
|
|
+ });
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.list {
|
|
|
+ min-height: 70vh;
|
|
|
+}
|
|
|
+</style>
|