From 38f01dc619fb9b7326abc345a216793750758c9a Mon Sep 17 00:00:00 2001
From: lxp <1928192722@qq.com>
Date: 星期五, 14 三月 2025 20:09:45 +0800
Subject: [PATCH] Merge branch 'dev' of http://114.132.189.42:9002/r/center-lims-before-ruoyi into dev
---
src/views/performance/manHour/work-time-management.vue | 1285 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 1,285 insertions(+), 0 deletions(-)
diff --git a/src/views/performance/manHour/work-time-management.vue b/src/views/performance/manHour/work-time-management.vue
new file mode 100644
index 0000000..df4bd08
--- /dev/null
+++ b/src/views/performance/manHour/work-time-management.vue
@@ -0,0 +1,1285 @@
+<template>
+ <div class="work-time-management">
+ <div class="search">
+ <div class="search_thing" style="width: 200px">
+ <div class="search_label">鏄熸湡锛�</div>
+ <el-select
+ v-model="entity.weekDay"
+ placeholder="鍏ㄩ儴"
+ size="small"
+ @change="refreshTable()"
+ clearable
+ >
+ <el-option
+ v-for="item in weekList"
+ :key="item.value"
+ :label="item.label"
+ :value="item.value"
+ >
+ </el-option>
+ </el-select>
+ </div>
+ <div class="search_thing" style="width: 390px">
+ <div class="search_label" style="width: 90px">鏃堕棿鑼冨洿锛�</div>
+ <div class="search_input">
+ <el-date-picker
+ style="width: 100%"
+ v-model="entity.dateTime"
+ size="small"
+ type="daterange"
+ range-separator="鑷�"
+ format="yyyy-MM-dd"
+ value-format="yyyy-MM-dd"
+ start-placeholder="寮�濮嬫棩鏈�"
+ end-placeholder="缁撴潫鏃ユ湡"
+ @change="refreshTable()"
+ clearable
+ >
+ </el-date-picker>
+ </div>
+ </div>
+ <!-- 浠ヤ笅杩欎袱涓负缁勯暱瑙掕壊鐗规湁鐨� -->
+ <div class="search_thing" style="width: 200px">
+ <div class="search_label">鍚嶅瓧锛�</div>
+ <el-input
+ size="small"
+ placeholder="璇疯緭鍏�"
+ clearable
+ v-model="entity.name"
+ @keyup.enter.native="refreshTable()"
+ ></el-input>
+ </div>
+ <div
+ class="search_thing"
+ style="width: 200px"
+ v-if="currentTable == 'ValueTable0'"
+ >
+ <div class="search_label">鐘舵�侊細</div>
+ <el-select
+ v-model="entity.state"
+ placeholder="鍏ㄩ儴"
+ size="small"
+ @change="refreshTable()"
+ >
+ <el-option
+ v-for="item in stateList"
+ :key="item.value"
+ :label="item.label"
+ :value="item.value"
+ >
+ </el-option>
+ </el-select>
+ </div>
+ <div class="search_thing" style="padding-left: 30px; width: 100px">
+ <el-button size="small" @click="refresh()">閲� 缃�</el-button>
+ <el-button size="small" type="primary" @click="refreshTable()"
+ >鏌� 璇�</el-button
+ >
+ </div>
+ </div>
+ <div
+ style="
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ margin-top: 10px;
+ "
+ >
+ <el-radio-group v-model="currentTable" size="small" :key="'111'">
+ <el-radio-button label="ValueTable0"> 杈呭姪宸ユ椂 </el-radio-button>
+ <el-radio-button label="ValueTable1"> 浜ч噺宸ユ椂 </el-radio-button>
+ </el-radio-group>
+ <div style="display: flex; align-items: center">
+ <p style="font-size: 14px; margin-right: 30px">
+ 鎬诲伐鏃舵眹鎬伙細<span
+ style="font-size: 16px; color: #3a7bfa"
+ v-if="totalInfo"
+ >{{
+ totalInfo["浜ч噺宸ユ椂姹囨��"] + totalInfo["杈呭姪宸ユ椂姹囨��"]
+ ? Number(
+ totalInfo["浜ч噺宸ユ椂姹囨��"] + totalInfo["杈呭姪宸ユ椂姹囨��"]
+ ).tofixed(4)
+ : 0
+ }}</span
+ > 浜ч噺宸ユ椂姹囨�伙細<span
+ style="font-size: 16px; color: #3a7bfa"
+ v-if="totalInfo"
+ >{{
+ totalInfo["浜ч噺宸ユ椂姹囨��"]
+ ? Number(totalInfo["浜ч噺宸ユ椂姹囨��"]).tofixed(4)
+ : 0
+ }}</span
+ > 杈呭姪宸ユ椂姹囨�伙細<span
+ style="font-size: 16px; color: #3a7bfa"
+ v-if="totalInfo"
+ >{{
+ totalInfo["杈呭姪宸ユ椂姹囨��"]
+ ? Number(totalInfo["杈呭姪宸ユ椂姹囨��"]).tofixed(4)
+ : 0
+ }}</span
+ >
+ </p>
+ <el-button
+ size="small"
+ type="primary"
+ @click="openAdd"
+ v-show="currentTable == 'ValueTable0'"
+ >褰曞叆鏁版嵁</el-button
+ >
+ <el-button
+ size="small"
+ type="primary"
+ @click="handleOut"
+ :loading="outLoading"
+ >瀵� 鍑�</el-button
+ >
+ <el-button
+ size="small"
+ type="primary"
+ v-show="currentTable == 'ValueTable0'"
+ @click="openBatchCheck(0)"
+ >鎵归噺瀹℃牳</el-button
+ >
+ <el-button
+ size="small"
+ type="primary"
+ v-show="currentTable == 'ValueTable0'"
+ @click="openBatchCheck(1)"
+ >鎵归噺鎵瑰噯</el-button
+ >
+ </div>
+ </div>
+ <div class="table">
+ <!-- <ValueTable
+ ref="ValueTable0"
+ v-if="currentTable == 'ValueTable0'"
+ :isColumnWidth="true"
+ :url="$api.auxiliaryWorkingHoursDay.selectAuxiliaryWorkingHoursDay"
+ :delUrl="$api.auxiliaryWorkingHoursDay.deleteAuxiliaryWorkingHoursDay"
+ :componentData="componentData"
+ :key="upIndex"
+ @delete="handleDelete"
+ /> -->
+ <!-- <ValueTable
+ ref="ValueTable1"
+ v-if="currentTable == 'ValueTable1'"
+ :isColumnWidth="true"
+ :url="
+ $api.auxiliaryOutputWorkingHours.selectAuxiliaryOutputWorkingHours
+ "
+ :componentData="componentData1"
+ :key="upIndex1"
+ /> -->
+ <lims-table
+ v-if="currentTable == 'ValueTable0'"
+ :tableData="tableData"
+ isSelection
+ :handleSelectionChange="handleSelectionChange"
+ :column="column"
+ :key="upIndex"
+ :tableLoading="tableLoading"
+ :height="'calc(100vh - 270px)'"
+ :page="page"
+ @pagination="pagination"
+ ></lims-table>
+
+ <lims-table
+ v-if="currentTable == 'ValueTable1'"
+ :tableData="tableData1"
+ :column="column1"
+ :key="upIndex1"
+ :tableLoading="tableLoading1"
+ :height="'calc(100vh - 270px)'"
+ :page="page1"
+ @pagination="pagination1"
+ ></lims-table>
+ </div>
+
+ <el-dialog
+ :title="formData.id ? '缂栬緫' : '褰曞叆鏁版嵁'"
+ :visible.sync="addVisible"
+ width="600px"
+ :before-close="handleClose"
+ >
+ <el-row style="display: flex; justify-content: space-around">
+ <el-col :span="12">
+ <el-form :model="formData" label-width="90px">
+ <el-form-item label="褰曞叆鏃堕棿:">
+ <el-radio-group v-model="formData.dateTime" size="small">
+ <el-radio :label="getYearAndMonthAndDays() + ' 00:00:00'"
+ >浠婂ぉ</el-radio
+ >
+ <el-radio
+ :label="
+ getYearAndMonthAndDays(
+ new Date(new Date().getTime() - 24 * 60 * 60 * 1000)
+ ) + ' 00:00:00'
+ "
+ >鏄ㄥぉ</el-radio
+ >
+ </el-radio-group>
+ </el-form-item>
+ <el-form-item label="骞翠唤:">
+ <el-input
+ v-model="formData.year"
+ disabled
+ size="small"
+ ></el-input>
+ </el-form-item>
+ <el-form-item label="鍛ㄦ:">
+ <el-input
+ v-model="formData.week"
+ size="small"
+ disabled
+ ></el-input>
+ </el-form-item>
+ <el-form-item label="鏄熸湡:">
+ <el-select
+ v-model="formData.weekDay"
+ placeholder="璇烽�夋嫨"
+ size="small"
+ disabled
+ >
+ <el-option
+ v-for="item in weekList"
+ :key="item.value"
+ :label="item.label"
+ :value="item.value"
+ >
+ </el-option>
+ </el-select>
+ </el-form-item>
+ <el-form-item label="鐝:">
+ <el-select
+ v-model="formData.shift"
+ placeholder="璇烽�夋嫨"
+ size="small"
+ disabled
+ >
+ <el-option
+ v-for="item in classType"
+ :key="item.value"
+ :label="item.label"
+ :value="item.value"
+ >
+ </el-option>
+ </el-select>
+ </el-form-item>
+ </el-form>
+ </el-col>
+ <el-col :span="12">
+ <el-form :model="formData" label-width="90px">
+ <el-form-item label="缂栧彿:" required>
+ <el-input
+ v-model="formData.number"
+ size="small"
+ @blur="getInfoByCode"
+ ></el-input>
+ </el-form-item>
+ <el-form-item label="鏁伴噺:" required>
+ <el-input v-model="formData.amount" size="small"></el-input>
+ </el-form-item>
+ <el-form-item label="鏍稿噯宸ユ椂:">
+ <el-input
+ v-model="formData.approvedWorkingHour"
+ size="small"
+ disabled
+ ></el-input>
+ </el-form-item>
+ <el-form-item label="杈呭姪宸ユ椂:">
+ <el-input
+ v-model="formData.nonproductiveTime"
+ size="small"
+ disabled
+ ></el-input>
+ </el-form-item>
+ <el-form-item label="杈呭姪椤圭洰:">
+ <el-input
+ v-model="formData.auxiliaryProject"
+ size="small"
+ disabled
+ ></el-input>
+ </el-form-item>
+ </el-form>
+ </el-col>
+ </el-row>
+ <el-form :model="formData" label-width="90px">
+ <el-form-item label="杈呭姪璇存槑:">
+ <el-input
+ v-model="formData.remarks"
+ type="textarea"
+ :rows="3"
+ size="small"
+ ></el-input>
+ </el-form-item>
+ </el-form>
+ <span slot="footer" class="dialog-footer">
+ <el-row>
+ <el-button @click="handleClose">鍙� 娑�</el-button>
+ <el-button type="primary" @click="submitAdd" :loading="addLoad"
+ >纭� 瀹�</el-button
+ >
+ </el-row>
+ </span>
+ </el-dialog>
+ <el-dialog :title="title" :visible.sync="checkVisible" width="600px">
+ <el-row style="display: flex; justify-content: space-around">
+ <el-col :span="12">
+ <el-form :model="formData0" label-width="90px">
+ <el-form-item label="骞翠唤:">
+ <el-input
+ v-model="formData0.year"
+ size="small"
+ :disabled="title == '鎵瑰噯'"
+ ></el-input>
+ </el-form-item>
+ <el-form-item label="鍛ㄦ:">
+ <el-input
+ v-model="formData0.week"
+ size="small"
+ :disabled="title == '鎵瑰噯'"
+ ></el-input>
+ </el-form-item>
+ <el-form-item label="鏄熸湡:">
+ <el-select
+ v-model="formData0.weekDay"
+ placeholder="璇烽�夋嫨"
+ size="small"
+ :disabled="title == '鎵瑰噯'"
+ >
+ <el-option
+ v-for="item in weekList"
+ :key="item.value"
+ :label="item.label"
+ :value="item.value"
+ >
+ </el-option>
+ </el-select>
+ </el-form-item>
+ <el-form-item label="濮撳悕:">
+ <el-input
+ v-model="formData0.name"
+ size="small"
+ disabled
+ ></el-input>
+ </el-form-item>
+ <el-form-item label="鐝:">
+ <el-select
+ v-model="formData0.shift"
+ placeholder="璇烽�夋嫨"
+ size="small"
+ :disabled="title == '鎵瑰噯'"
+ >
+ <el-option
+ v-for="item in classType"
+ :key="item.value"
+ :label="item.label"
+ :value="item.value"
+ >
+ </el-option>
+ </el-select>
+ </el-form-item>
+ <el-form-item label="澶嶆牳璇存槑:">
+ <el-input
+ v-model="formData0.reviewerRemark"
+ type="textarea"
+ :rows="3"
+ size="small"
+ :disabled="title == '鎵瑰噯'"
+ ></el-input>
+ </el-form-item>
+ </el-form>
+ </el-col>
+ <el-col :span="12">
+ <el-form :model="formData0" label-width="90px">
+ <el-form-item label="缂栧彿:" required>
+ <el-input
+ v-model="formData0.number"
+ size="small"
+ :disabled="title == '鎵瑰噯'"
+ ></el-input>
+ </el-form-item>
+ <el-form-item label="鏁伴噺:" required>
+ <el-input
+ v-model="formData0.amount"
+ size="small"
+ :disabled="title == '鎵瑰噯'"
+ ></el-input>
+ </el-form-item>
+ <el-form-item label="澶嶆牳鏁伴噺:" required>
+ <el-input
+ v-model="formData0.reviewerNumber"
+ size="small"
+ :disabled="title == '鎵瑰噯'"
+ ></el-input>
+ </el-form-item>
+ <el-form-item label="鏍稿噯宸ユ椂:">
+ <el-input
+ v-model="formData0.approvedWorkingHour"
+ size="small"
+ disabled
+ ></el-input>
+ </el-form-item>
+ <el-form-item label="澶嶆牳宸ユ椂:">
+ <el-input
+ v-model="formData0.reviewerNonproductiveTime"
+ size="small"
+ disabled
+ ></el-input>
+ </el-form-item>
+ <el-form-item label="杈呭姪椤圭洰:">
+ <el-input
+ v-model="formData0.auxiliaryProject"
+ size="small"
+ disabled
+ ></el-input>
+ </el-form-item>
+ </el-form>
+ </el-col>
+ </el-row>
+ <span slot="footer" class="dialog-footer">
+ <el-row>
+ <el-button
+ @click="submitCheck(0)"
+ type="danger"
+ :loading="checkLoadN"
+ >{{ title == "瀹℃牳" ? "涓嶉�氳繃" : "涓嶆壒鍑�" }}</el-button
+ >
+ <el-button
+ style="margin-left: 20px"
+ type="primary"
+ @click="submitCheck(1)"
+ :loading="checkLoadY"
+ >{{ title == "瀹℃牳" ? "閫� 杩�" : "鎵� 鍑�" }}</el-button
+ >
+ </el-row>
+ </span>
+ </el-dialog>
+ <el-dialog
+ :title="batchCheckTitle"
+ :visible.sync="batchCheckDialog"
+ width="30%"
+ :before-close="closeBatchCheckDialog"
+ >
+ <span>{{ batchCheckDialogMessage }}</span>
+ <span slot="footer" class="dialog-footer">
+ <el-button type="danger" @click="batchCheckDialog = false">{{
+ batchCheckTitle == "鎵归噺瀹℃牳" ? "涓嶉�氳繃" : "涓嶆壒鍑�"
+ }}</el-button>
+ <el-button
+ style="margin-left: 20px"
+ type="primary"
+ @click="batchCheck"
+ >{{ batchCheckTitle == "鎵归噺瀹℃牳" ? "閫� 杩�" : "鎵� 鍑�" }}</el-button
+ >
+ </span>
+ </el-dialog>
+ </div>
+</template>
+
+ <script>
+import limsTable from "@/components/Table/lims-table.vue";
+import {
+ obtainItemParameterList,
+ selectAuxiliaryCorrectionHours,
+ selectAuxiliaryOriginalHours,
+ selectAuxiliaryWorkingHoursDay,
+ selectAuxiliaryOutputWorkingHours,
+ insertAuxiliaryWorkingHoursDay,
+ updateAuxiliaryWorkingHoursDay,
+ check,
+ approve,
+ collectWorkingHours,
+ selectshiftByUser,
+ selectAuxiliaryWorkingHoursByNumber,
+ exportWorkingHours
+} from "../../../api/business/manHour";
+import { getYearAndMonthAndDays } from "../../../utils/date";
+
+import { getDicts } from "@/api/system/dict/data";
+import Big from "big.js";
+export default {
+ components: {
+ limsTable,
+ },
+ data() {
+ return {
+ shiftList:[],
+ tableData: [],
+ column: [
+ {
+ label: '濮撳悕',
+ prop: 'name',
+ },
+ {
+ label: '缂栧彿',
+ prop: 'number',
+ },
+ {
+ label: '杈呭姪椤圭洰鍚嶇О',
+ prop: 'auxiliaryProject'
+ },
+ {
+ label: '鐘舵��',
+ prop: 'state',
+ },
+ {
+ label: '鏍稿噯宸ユ椂',
+ prop: 'approvedWorkingHour'
+ },
+ {
+ label: '鏁伴噺',
+ prop: 'amount'
+ },
+ {
+ label: '杈呭姪宸ユ椂',
+ prop: 'nonproductiveTime'
+ },
+ {
+ label: '杈呭姪璇存槑',
+ prop: 'remarks'
+ },
+ {
+ label: '鐝',
+ prop: 'shift',
+ dataType: 'tag',
+ formatData: (params) => {
+ let farmat = '';
+ let list = this.shiftList.filter(item => item.dictValue == params)
+ if(list.length > 0){
+ farmat = list[0].dictLabel
+ }
+ return farmat;
+ },
+ formatType: () => {
+ return "primary";
+ },
+ },
+ {
+ label: '鍛ㄦ',
+ prop: 'week',
+
+ },
+ {
+ label: '鏄熸湡',
+ prop: 'weekDay',
+ dataType: 'tag',
+
+ formatData: (params) => {
+ let farmat = '';
+ let list = this.weekList.filter(item => item.value == params)
+ if(list.length > 0){
+ farmat = list[0].label
+ }
+ return farmat;
+ },
+ formatType: () => {
+ return "success";
+ },
+ },
+ {
+ label: '澶嶆牳浜�',
+ prop: 'reviewer'
+ },
+ {
+ label: '澶嶆牳鏁伴噺',
+ prop: 'reviewerNumber'
+ },
+ {
+ label: '澶嶆牳宸ユ椂',
+ prop: 'reviewerNonproductiveTime'
+ },
+ {
+ label: '澶嶆牳璇存槑',
+ prop: 'reviewerRemark'
+ },
+ {
+ label: '骞�',
+ prop: 'year'
+ },
+ {
+ label: '鍒涘缓鏃堕棿',
+ prop: 'createTime'
+ },
+ {
+ label: '鏃ユ湡',
+ prop: 'dateTime'
+ }
+ ],
+ tableLoading: false,
+ page: {
+ current: 1,
+ size: 20,
+ total: 0,
+ },
+ entity: {
+ week: null,
+ weekDay: null,
+ dateTime: [],
+ name: null,
+ state: null,
+ },
+ tableData1: [],
+ column1: [
+ {
+ label: '妫�娴嬬埗椤�',
+ prop: 'inspectionItem'
+ },
+ {
+ label: '妫�娴嬪瓙椤�',
+ prop: 'inspectionItemSubclass'
+ },
+ {
+ label: '鏍峰搧缂栧彿',
+ prop: 'sample'
+ },
+ {
+ label: '鍔犵彮濮旀墭鍗曞彿',
+ prop: 'overtimeOrderNo'
+ },
+ {
+ label: '鍔犵彮宸ユ椂',
+ prop: 'overtimeWorkTime'
+ },
+ {
+ label: '鍔犵彮鏁伴噺',
+ prop: 'overtimeAmount'
+ },
+ {
+ label: '闈炲姞鐝鎵樺崟鍙�',
+ prop: 'orderNo'
+ },
+ {
+ label: '闈炲姞鐝伐鏃�',
+ prop: 'workTime'
+ },
+ {
+ label: '闈炲姞鐝暟閲�',
+ prop: 'amount'
+ },
+ {
+ label: '浜ч噺宸ユ椂',
+ prop: 'outputWorkTime'
+ },
+ {
+ label: '鏃ユ湡',
+ prop: 'dateTime'
+ },
+ {
+ label: '鍛ㄦ',
+ prop: 'week'
+ },
+ {
+ label: '鏄熸湡',
+ prop: 'weekDay'
+ },
+ {
+ label: '妫�娴嬩汉',
+ prop: 'name'
+ }
+ ],
+ tableLoading1: false,
+ page1: {
+ current: 1,
+ size: 20,
+ total: 0,
+ },
+ entityCopy: {},
+ upIndex: 0,
+ addFileVisible: false,
+ entityCopy1: {},
+ upIndex1: 100,
+ weekList: [
+ { label: "鍛ㄤ竴", value: "1", type: "primary" },
+ { label: "鍛ㄤ簩", value: "2", type: "primary" },
+ { label: "鍛ㄤ笁", value: "3", type: "primary" },
+ { label: "鍛ㄥ洓", value: "4", type: "primary" },
+ { label: "鍛ㄤ簲", value: "5", type: "primary" },
+ { label: "鍛ㄥ叚", value: "6", type: "primary" },
+ { label: "鍛ㄦ棩", value: "0", type: "primary" },
+ ],
+ currentTable: "ValueTable0",
+ addVisible: false,
+ addLoad: false,
+ formData: {
+ dateTime: getYearAndMonthAndDays() + " 00:00:00",
+ year: new Date().getFullYear(),
+ week: this.getCurrentWeekNumber(),
+ weekDay: this.getWeek(),
+ shift: "",
+ number: "",
+ amount: "",
+ approvedWorkingHour: "",
+ nonproductiveTime: "",
+ auxiliaryProject: "",
+ remarks: "",
+ },
+ formData0: {
+ dateTime: 0,
+ year: new Date().getFullYear(),
+ week: this.getCurrentWeekNumber(),
+ weekDay: this.getWeek(),
+ createUser: "",
+ shift: "",
+ number: "",
+ reviewerNumber: "",
+ approvedWorkingHour: "",
+ reviewerNonproductiveTime: "",
+ auxiliaryProject: "",
+ reviewerRemark: "",
+ nameUser: "",
+ name: "",
+ },
+ checkVisible: false,
+ checkLoadN: false,
+ checkLoadY: false,
+ title: "瀹℃牳",
+ classType: [],
+ stateList: [
+ {
+ value: "宸叉彁浜�",
+ label: "宸叉彁浜�",
+ },
+ {
+ value: "宸插鏍�",
+ label: "宸插鏍�",
+ },
+ {
+ value: "宸叉壒鍑�",
+ label: "宸叉壒鍑�",
+ },
+ ],
+ totalInfo: null,
+ auxiliaryWorking: null,
+ outLoading: false,
+ batchCheckTitle: "鎵归噺瀹℃牳",
+ batchCheckDialog: false,
+ ValueTable0Selected: [],
+ batchCheckDialogMessage: "",
+ };
+ },
+ watch: {
+ currentTable() {
+ this.refreshTable();
+ },
+ "formData.dateTime"(val) {
+ if (val == getYearAndMonthAndDays() + " 00:00:00") {
+ this.formData.year = new Date().getFullYear();
+ this.formData.week = this.getCurrentWeekNumber();
+ this.formData.weekDay = this.getWeek();
+ } else {
+ var today = new Date(); // 鑾峰彇褰撳墠鏃ユ湡
+ var yesterday = new Date(today); // 澶嶅埗褰撳墠鏃ユ湡
+ yesterday.setDate(today.getDate() - 1); // 璁剧疆涓哄墠涓�澶�
+ var timestamp = new Date(yesterday.getTime());
+ this.formData.year = timestamp.getFullYear();
+ this.formData.week = this.getCurrentWeekNumber(timestamp);
+ this.formData.weekDay = this.getWeek(timestamp);
+ }
+ },
+ "formData.amount"(val) {
+ if (val) {
+ if (!isNaN(val)) {
+ if (this.formData.approvedWorkingHour) {
+ let workHour = new Big(this.formData.approvedWorkingHour);
+ this.formData.nonproductiveTime = workHour.times(val).toNumber();
+ }
+ } else {
+ this.$message.error("璇疯緭鍏ユ暟瀛�");
+ this.formData.amount = "";
+ }
+ }
+ },
+ "formData.approvedWorkingHour"(val) {
+ if (val && this.formData.amount) {
+ let amount = new Big(this.formData.amount);
+ this.formData.nonproductiveTime = amount.times(val).toNumber();
+ }
+ },
+ "formData0.reviewerNumber"(val) {
+ if (val) {
+ if (!isNaN(val)) {
+ if (this.formData0.approvedWorkingHour) {
+ let approvedWorkingHour = new Big(
+ this.formData0.approvedWorkingHour
+ );
+ this.formData0.reviewerNonproductiveTime = approvedWorkingHour
+ .times(val)
+ .toNumber();
+ }
+ } else {
+ this.$message.error("璇疯緭鍏ユ暟瀛�");
+ this.formData0.reviewerNumber = "";
+ }
+ }
+ },
+ "formData0.approvedWorkingHour"(val) {
+ if (val && this.formData0.reviewerNumber) {
+ let num = new Big(reviewerNumber);
+ this.formData0.reviewerNonproductiveTime = num.times(val).toNumber();
+ }
+ },
+ },
+ created() {
+ //褰撳彧鏈変骇閲忓伐鏃秚ab椤垫椂锛屽綋鍓嶉〉鏀逛负浜ч噺宸ユ椂椤�
+ this.selectEnumByCategory();
+ this.setDate();
+ },
+ mounted() {
+ console.log(11);
+ this.getCurrentWeekNumber();
+ this.selectshiftByUser();
+ this.entityCopy = this.HaveJson(this.entity);
+ this.entityCopy1 = this.HaveJson(this.entity);
+ },
+ methods: {
+ getData() {
+ if (this.currentTable == "ValueTable0") {
+ console.log('杈呭姪宸ユ椂');
+ this.tableLoading = true;
+ let params = {
+ current: this.page.current,
+ size: this.page.size,
+ dateTime1: this.entity.dateTime[0],
+ dateTime2: this.entity.dateTime[1],
+ week: this.entity.week,
+ weekDay: this.entity.weekDay,
+ name: this.entity.name,
+ state: this.entity.state,
+ };
+ selectAuxiliaryWorkingHoursDay(params)
+ .then((res) => {
+ this.tableLoading = false;
+ this.tableData = res.data.records;
+ this.page.total = res.data.total;
+ });
+ } else {
+ console.log('浜ч噺宸ユ椂');
+ this.tableLoading1 = true;
+ let params = {
+ current: this.page.current,
+ size: this.page.size,
+ dateTime1: this.entity.dateTime[0],
+ dateTime2: this.entity.dateTime[1],
+ week: this.entity.week,
+ weekDay: this.entity.weekDay,
+ name: this.entity.name,
+ state: this.entity.state,
+ };
+ selectAuxiliaryOutputWorkingHours(params)
+ .then((res) => {
+ this.tableLoading1 = false;
+ this.tableData1 = res.data.records;
+ this.page1.total = res.data.total;
+ });
+ }
+ },
+ pagination({ current, limit }) {
+ this.page.current = current;
+ this.page.size = limit;
+ this.getData();
+ },
+ pagination1({ current, limit }) {
+ this.page1.current = current;
+ this.page1.size = limit;
+ this.getData();
+ },
+ /** 灏嗘椂闂撮�夋嫨鍣ㄩ粯璁ら�変负褰撳ぉ鐨勬棩鏈� */
+ setDate() {
+ let currentDate = new Date();
+ let year = currentDate.getFullYear();
+ let month = String(currentDate.getMonth() + 1).padStart(2, "0");
+ let day = String(currentDate.getDate()).padStart(2, "0");
+ let formattedDate1 = `${year}-${month}-${day}`;
+ let formattedDate2 = `${year}-${month}-${day}`;
+ this.entity.dateTime.push(formattedDate1);
+ this.entity.dateTime.push(formattedDate2);
+ this.refreshTable();
+ },
+ getYearAndMonthAndDays(date) {
+ return getYearAndMonthAndDays(date);
+ },
+ refreshTable(e) {
+ let entity = {};
+ if (this.entity.week1 && this.entity.week2) {
+ entity.week = JSON.stringify([this.entity.week1, this.entity.week2]);
+ } else {
+ entity.week = "";
+ }
+ if (!this.entity.dateTime) {
+ entity.dateTime = "";
+
+ }
+ entity.weekDay = this.entity.weekDay;
+ entity.name = this.entity.name;
+ if (this.currentTable == "ValueTable0") {
+ entity.state = this.entity.state;
+ this.entity = { ...this.entity, ...entity };
+ this.$nextTick(() => {
+ this.getData();
+ });
+ } else {
+ this.entity = {
+ ...this.entity,
+ ...entity,
+ };
+ this.getData();
+ }
+
+ this.collectWorkingHours();
+ },
+ refresh() {
+ this.entity = {};
+ this.refreshTable();
+ },
+ openAdd() {
+ this.formData = {
+ dateTime: getYearAndMonthAndDays() + " 00:00:00",
+ year: new Date().getFullYear(),
+ week: this.getCurrentWeekNumber(),
+ weekDay: this.getWeek(),
+ shift: "",
+ number: "",
+ amount: "",
+ approvedWorkingHour: "",
+ nonproductiveTime: "",
+ auxiliaryProject: "",
+ remarks: "",
+ };
+ this.addVisible = true;
+ },
+ handleSelectionChange(val) {
+ this.ValueTable0Selected = val;
+ },
+ handleEdit(row) {
+ this.formData = JSON.parse(JSON.stringify(row));
+ this.addVisible = true;
+ },
+ handleDelete() {
+ this.collectWorkingHours();
+ },
+ handleClose() {
+ this.addVisible = false;
+ },
+ submitAdd() {
+ if (!this.formData.number) {
+ this.$message.error("璇疯緭鍏ョ紪鍙�");
+ return;
+ }
+ if (!this.formData.amount) {
+ this.$message.error("璇疯緭鍏ユ暟閲�");
+ return;
+ }
+ this.addLoad = true;
+ if (!this.formData.id) {
+ insertAuxiliaryWorkingHoursDay({...this.formData})
+ .then((res) => {
+ this.addLoad = false;
+ if (res.code == 201) return;
+ this.$message.success("宸叉彁浜�");
+ this.formData.number = "";
+ this.formData.amount = "";
+ this.formData.remarks = "";
+ this.formData.approvedWorkingHour = "";
+ this.formData.nonproductiveTime = "";
+ this.formData.auxiliaryProject = "";
+ // this.addVisible = false
+ this.refreshTable("page");
+ });
+ } else {
+ updateAuxiliaryWorkingHoursDay({...this.formData})
+ .then((res) => {
+ this.addLoad = false;
+ if (res.code == 201) return;
+ this.$message.success("鎿嶄綔鎴愬姛");
+ this.formData.number = "";
+ this.formData.amount = "";
+ this.formData.remarks = "";
+ this.formData.approvedWorkingHour = "";
+ this.formData.nonproductiveTime = "";
+ this.formData.auxiliaryProject = "";
+ // this.addVisible = false
+ this.refreshTable("page");
+ });
+ }
+ },
+ handleCheck(row) {
+ this.title = "瀹℃牳";
+ this.formData0 = row;
+ this.checkVisible = true;
+ this.formData0.reviewerNumber = this.formData0.amount;
+ },
+ handleRatify(row) {
+ this.title = "鎵瑰噯";
+ this.formData0 = row;
+ this.checkVisible = true;
+ this.formData0.reviewerNumber = this.formData0.amount;
+ },
+ handleChangeTask(row) {
+ this.ValueTable0Selected = JSON.parse(JSON.stringify(row));
+ },
+ openBatchCheck(e) {
+ if (this.ValueTable0Selected.length > 0) {
+ const isChecked = this.ValueTable0Selected.every(
+ (item) => item.state === "宸叉彁浜�"
+ );
+ const isApprove = this.ValueTable0Selected.every(
+ (item) => item.state !== "宸叉壒鍑�"
+ );
+ console.log("this.isApprove---", isApprove);
+ this.batchCheckTitle = e === 0 ? "鎵归噺瀹℃牳" : "鎵归噺鎵瑰噯";
+ this.batchCheckDialogMessage =
+ e === 0 ? "鏄惁鍏ㄩ儴閫氳繃瀹℃牳?" : "鏄惁鍏ㄩ儴閫氳繃鎵瑰噯?";
+ if (this.batchCheckTitle === "鎵归噺瀹℃牳") {
+ if (isChecked) {
+ this.batchCheckDialog = true;
+ } else {
+ this.$message.error("璇烽�夋嫨鏈鏍告垨鏈壒鍑嗙殑鏁版嵁");
+ }
+ } else {
+ if (isApprove) {
+ this.batchCheckDialog = true;
+ } else {
+ this.$message.error("璇烽�夋嫨鏈壒鍑嗙殑鏁版嵁");
+ }
+ }
+ } else {
+ this.$message.error("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�");
+ }
+ },
+ batchCheck() {
+ const e = this.batchCheckTitle === "鎵归噺瀹℃牳" ? 0 : 1;
+ this.batchCheck1(e);
+ },
+ batchCheck1(e) {
+ if (this.ValueTable0Selected && this.ValueTable0Selected.length > 0) {
+ const list = JSON.parse(JSON.stringify(this.ValueTable0Selected));
+ const state = e === 0 ? "宸插鏍�" : "宸叉壒鍑�";
+ let auxiliaryWorkingHoursDays = [];
+ list.forEach((item) => {
+ delete item.orderBy;
+ item.state = state;
+ auxiliaryWorkingHoursDays.push(item);
+ });
+ if(e == 0) {
+ check({auxiliaryWorkingHoursDays: auxiliaryWorkingHoursDays}).then((res) => {
+ if (res.code == 201) return;
+ this.$message.success("鎿嶄綔鎴愬姛");
+ this.batchCheckDialog = false;
+ this.refreshTable("page");
+ });
+ }else {
+ approve({auxiliaryWorkingHoursDays: auxiliaryWorkingHoursDays}).then((res) => {
+ if (res.code == 201) return;
+ this.$message.success("鎿嶄綔鎴愬姛");
+ this.batchCheckDialog = false;
+ this.refreshTable("page");
+ });
+ }
+ } else {
+ this.$message.error("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�");
+ }
+ },
+ closeBatchCheckDialog() {
+ this.batchCheckDialog = false;
+ },
+ submitBatchCheckDialog() {
+ this.batchCheckDialog = false;
+ this.refreshTable("page");
+ this.collectWorkingHours();
+ },
+ submitCheck(e) {
+ if (!this.formData0.number) {
+ this.$message.error("璇疯緭鍏ョ紪鍙�");
+ return;
+ }
+ if (!this.formData0.amount) {
+ this.$message.error("璇疯緭鍏ユ暟閲�");
+ return;
+ }
+
+ if (this.title == "瀹℃牳") {
+ if (e == 0) {
+ // 瀹℃牳涓嶉�氳繃
+ this.checkLoadN = true;
+ } else {
+ // 瀹℃牳閫氳繃
+ this.checkLoadY = true;
+ }
+ this.formData0.state = e == 0 ? this.formData0.state : "宸插鏍�";
+ check({auxiliaryWorkingHoursDays: [this.formData0]}).then((res) => {
+ if (e == 0) {
+ // 瀹℃牳涓嶉�氳繃
+ this.checkLoadN = false;
+ } else {
+ // 瀹℃牳閫氳繃
+ this.checkLoadY = false;
+ }
+ if (res.code == 201) return;
+ this.$message.success("鎿嶄綔鎴愬姛");
+ this.checkVisible = false;
+ this.refreshTable("page");
+ });
+ } else {
+ if (e == 0) {
+ this.checkLoadN = true;
+ } else {
+ this.checkLoadY = true;
+ }
+ this.formData0.state = e == 0 ? "宸叉彁浜�" : "宸叉壒鍑�";
+ approve({auxiliaryWorkingHoursDays: [this.formData0]}).then((res) => {
+ if (e == 0) {
+ this.checkLoadN = false;
+ } else {
+ this.checkLoadY = false;
+ }
+ if (res.code == 201) return;
+ this.$message.success("鎿嶄綔鎴愬姛");
+ this.checkVisible = false;
+ this.refreshTable("page");
+ this.collectWorkingHours();
+ });
+ }
+ },
+ selectEnumByCategory() {
+ getDicts('sys_class_type').then((res) => {
+ this.classType = res.data;
+ this.classType = res.data;
+ this.shiftList = res.data
+ console.log('shif',this.shiftList);
+ });
+ },
+ getCurrentWeekNumber(now = new Date()) {
+ const startOfWeek = new Date(
+ now.getFullYear(),
+ now.getMonth(),
+ now.getDate() - now.getDay()
+ ); // 鍛ㄥぉ
+ const firstWeekOfYear = new Date(startOfWeek.getFullYear(), 0, 0); // 褰撳勾鐨勭涓�涓懆澶�
+ const firstWeekOfNextYear = new Date(
+ firstWeekOfYear.getFullYear() + 1,
+ 0,
+ 0
+ ); // 涓嬩竴骞寸殑绗竴涓懆澶�
+ const daysSinceNewYear =
+ (startOfWeek - firstWeekOfYear) / (24 * 60 * 60 * 1000); // 璁$畻鑷柊骞翠互鏉ョ殑澶╂暟
+ const weeksSinceNewYear = Math.floor(daysSinceNewYear / 7); // 澶╂暟闄や互7寰楀埌鍛ㄦ暟
+
+ if (startOfWeek > now) {
+ // 濡傛灉褰撳墠鍛ㄧ殑鍛ㄥぉ杩樻病鍒帮紝鍒欒繑鍥炰笂骞寸殑鏈�鍚庝竴鍛�
+ return weeksSinceNewYear;
+ } else if (firstWeekOfNextYear <= now) {
+ // 濡傛灉褰撳墠鍛ㄧ殑鍛ㄥぉ宸茬粡杩囦簡锛屽垯杩斿洖褰撳勾鐨勫懆鏁�
+ return weeksSinceNewYear + 1;
+ } else {
+ // 鍚﹀垯杩斿洖褰撳勾鐨勬渶鍚庝竴鍛�
+ return weeksSinceNewYear + 2;
+ }
+ },
+ getWeek(e = new Date()) {
+ // let str = '鏃ヤ竴浜屼笁鍥涗簲鍏�'
+ let d = e.getDay();
+ // let c = str.charAt(d)
+ // return `鍛�${c}`
+ return String(d);
+ },
+ collectWorkingHours() {
+ let entity = {};
+ if (this.entity.week1 && this.entity.week2) {
+ entity.week = JSON.stringify([this.entity.week1, this.entity.week2]);
+ } else {
+ entity.week = "";
+ }
+ if (this.entity.dateTime) {
+ entity.dateTime = JSON.stringify(this.entity.dateTime);
+ } else {
+ entity.dateTime = "";
+ }
+ entity.weekDay = this.entity.weekDay;
+ entity.name = this.entity.name;
+ entity.state = this.entity.state;
+ collectWorkingHours(entity).then((res) => {
+ this.totalInfo = res.data;
+ });
+ },
+ selectshiftByUser() {
+ selectshiftByUser().then((res) => {
+ this.formData.shift = res.data;
+ });
+ },
+ getInfoByCode() {
+ if (this.formData.number) {
+ selectAuxiliaryWorkingHoursByNumber({number:this.formData.number}).then((res) => {
+ this.auxiliaryWorking = res.data;
+ if (this.addVisible) {
+ this.formData.approvedWorkingHour =
+ this.auxiliaryWorking.approvedWorkingHour;
+ this.formData.auxiliaryProject =
+ this.auxiliaryWorking.auxiliaryProject;
+ } else if (this.title == "瀹℃牳" && this.checkVisible) {
+ this.formData0.approvedWorkingHour =
+ this.auxiliaryWorking.approvedWorkingHour;
+ this.formData0.auxiliaryProject =
+ this.auxiliaryWorking.auxiliaryProject;
+ }
+ });
+ }
+ },
+ handleOut() {
+ this.outLoading = true;
+ exportWorkingHours().then((res) => {
+ this.outLoading = false;
+ this.$message.success("瀵煎嚭鎴愬姛");
+ const blob = new Blob([res]);
+ console.log(blob);
+ const url = URL.createObjectURL(blob);
+ const link = document.createElement("a");
+ link.href = url;
+ link.download = "鏃ュ伐鏃舵眹鎬昏〃.xlsx";
+ link.click();
+ });
+ },
+ },
+};
+</script>
+
+ <style scoped>
+.work-time-management {
+ height: 100%;
+ overflow-y: scroll;
+ /* scrollbar-width: none; */
+}
+/* .work-time-management::-webkit-scrollbar {
+ display: none;
+ } */
+.search {
+ background-color: #fff;
+ height: 80px;
+ display: flex;
+ align-items: center;
+}
+
+.search_thing {
+ width: 300px;
+ display: flex;
+ align-items: center;
+}
+
+.search_label {
+ width: 70px;
+ font-size: 14px;
+ text-align: right;
+}
+
+.search_input {
+ width: calc(100% - 70px);
+}
+.table {
+ margin-top: 10px;
+ background-color: #fff;
+ width: calc(100% - 40px);
+ height: calc(100% - 60px - 80px - 10px - 40px - 25px);
+ padding: 20px;
+}
+</style>
+
\ No newline at end of file
--
Gitblit v1.9.3