Procházet zdrojové kódy

员工绩效模块

cz před 10 měsíci
rodič
revize
b0089c63a9

+ 2 - 2
.env.development

@@ -9,11 +9,11 @@ VUE_APP_BASE_API = '/test-api'
 
 VUE_APP_WS_API = ':20010/test-api'
 
-VUE_APP_IP = '121.37.194.75'
+VUE_APP_IP = '139.9.102.170'
 
 # 是否在打包时开启压缩,支持 gzip 和 brotli
 VUE_APP_COMPRESS = gzip
 
 #上传文件地址
-VUE_APP_UPLOAD_API='121.37.194.75:20010'
+VUE_APP_UPLOAD_API='139.9.102.170:20010'
 VUE_APP_UPLOAD_BASE_API = '/test-api'

+ 2 - 2
.env.staging

@@ -13,9 +13,9 @@ VUE_APP_BASE_API = '/test-api'
 # 是否在打包时开启压缩,支持 gzip 和 brotli
 VUE_APP_COMPRESS = gzip
 
-VUE_APP_IP = '121.37.194.75'
+VUE_APP_IP = '139.9.102.170'
 
 
 #上传文件地址
-VUE_APP_UPLOAD_API='121.37.194.75:20010'
+VUE_APP_UPLOAD_API='139.9.102.170:20010'
 VUE_APP_UPLOAD_BASE_API = '/test-api'

+ 10 - 0
src/router/index.js

@@ -484,6 +484,16 @@ const routes = [{
 				component: () => import('../views/MES/reportDetail/index.vue')
 			},
 			{
+				path: 'employeePerformance',
+				name: '生产绩效',
+				component: () => import('../views/MES/employeePerformance/index.vue')
+			},
+			// {
+			// 	path: 'employeePerformanceDetail',
+			// 	name: '生产绩效详情',
+			// 	component: () => import('../views/MES/employeePerformance/detail.vue')
+			// },
+			{
 				path: 'jstOrder',
 				name: '聚水潭订单',
 				component: () => import('../views/salesContract/jstOrder/index.vue')

+ 27 - 0
src/utils/util.js

@@ -105,6 +105,33 @@ export function compareTime(date1, date2) {
   }
 }
 
+// 获取日期范围内所有日期
+export function getMonthBetween(starDay, endDay) {
+  var arr = [];
+  var dates = [];
+  // 设置两个日期UTC时间
+  var db = new Date(starDay);
+  var de = new Date(endDay);
+  // 获取两个日期GTM时间
+  var s = db.getTime() - 24 * 60 * 60 * 1000;
+  var d = de.getTime() - 24 * 60 * 60 * 1000;
+  // 获取到两个日期之间的每一天的毫秒数
+  for (var i = s; i <= d;) {
+    i = i + 24 * 60 * 60 * 1000;
+    arr.push(parseInt(i));
+  }
+  // 获取每一天的时间  YY-MM-DD
+  for (var j in arr) {
+    var time = new Date(arr[j]);
+    var year = time.getFullYear(time);
+    var mouth = time.getMonth() + 1 >= 10 ? time.getMonth() + 1 : "0" + (time.getMonth() + 1);
+    var day = time.getDate() >= 10 ? time.getDate() : "0" + time.getDate();
+    var YYMMDD = year + "-" + mouth + "-" + day;
+    dates.push(YYMMDD);
+  }
+  return dates;
+}
+
 //根据value值回显字典label值
 export function dictValueLabel(value, arr) {
   if ((value || value === 0) && arr) {

+ 203 - 0
src/views/MES/employeePerformance/index.vue

@@ -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>

+ 28 - 3
src/views/MES/reportDetail/index.vue

@@ -23,10 +23,12 @@ import { ref, getCurrentInstance, onMounted, nextTick } from "vue";
 import commonList from "@/components/common-list.vue";
 import { useRoute } from "vue-router";
 const loading = ref(false);
-const router = useRoute();
+const route = useRoute();
 const req = ref({
   pageNum: 1,
   keyword: null,
+  userId: "",
+  dataDate: "",
 });
 const finished = ref(false);
 const proxy = getCurrentInstance().proxy;
@@ -41,7 +43,14 @@ const listConfig = ref([
     label: "报工数量",
     prop: "quantity",
   },
-
+  {
+    label: "单价",
+    prop: "price",
+  },
+  {
+    label: "小计",
+    prop: "amount",
+  },
   {
     label: "报工人",
     prop: "userName",
@@ -54,17 +63,33 @@ const listConfig = ref([
     label: "工序名称",
     prop: "processesName",
   },
+  {
+    label: "订单号",
+    prop: "orderCode",
+  },
+  {
+    label: "产品编码",
+    prop: "productCode",
+  },
+  {
+    label: "产品名称",
+    prop: "productName",
+  },
 ]);
 const onRefresh = () => {
   req.value.pageNum = 1;
   finished.value = false;
   getList("refresh");
 };
+if (route.query && route.query.userId) {
+  req.value.userId = route.query.userId;
+  req.value.dataDate = route.query.dataDate;
+}
 const onLoad = () => {
   getList();
 };
 
-const onClickLeft = () => proxy.$router.push("/main/working");
+const onClickLeft = () => history.back();
 
 const onClickRight = () => {
   proxy.$router.push("/main/taskAdd");

+ 2 - 2
vue.config.js

@@ -25,12 +25,12 @@ module.exports = defineConfig({
 		proxy: {
 			// https://cn.vitejs.dev/config/#server-proxy
 			'/test-api': {
-				target: 'http://121.37.194.75:20010/',
+				target: 'http://139.9.102.170:20010/',
 				changeOrigin: true,
 				rewrite: (p) => p.replace(/^\/test-api/, '')
 			},
 			'/prod-api': {
-				target: 'http://121.37.194.75:20011/',
+				target: 'http://139.9.102.170:20011/',
 				changeOrigin: true,
 				rewrite: (p) => p.replace(/^\/prod-api/, '')
 			}