lxp
2025-03-14 9c91c96c4c1dca21670abfa7a0c879a734a888de
工时管理
已添加4个文件
已修改6个文件
已删除3个文件
4270 ■■■■■ 文件已修改
src/api/business/manHour.js 150 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/business/reportPreparation.js 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/Table/lims-table.vue 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/request.js 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/business/inspectionOrder/index.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/business/reportPreparation/index.vue 108 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/performance/manHour/index.vue 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/performance/manHour/work-time-config.vue 469 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/performance/manHour/work-time-management.vue 1285 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/performance/manHour/work-time-statistics.vue 589 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/performance/manHour/workTimeConfig.vue 260 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/performance/manHour/workTimeManagement.vue 1143 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/performance/manHour/workTimeStatistics.vue 176 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/business/manHour.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,150 @@
import resquest from '@/utils/request'
export function obtainItemParameterList(params) {
    return resquest({
        url: '/laboratoryScope/obtainItemParameterList',
        method: 'get',
        params: params
    })
}
export function selectAuxiliaryWorkingHours(params) {
    return resquest({
        url: '/auxiliaryWorkingHours/selectAuxiliaryWorkingHours',
        method: 'get',
        params: params
    })
}
export function exportOriginalHours(data) {
    return resquest({
        url: '/auxiliaryOriginalHours/exportOriginalHours',
        method: 'post',
        responseType: 'blob',
        params: data
    })
}
export function selectAuxiliaryCorrectionHours(params) {
    return resquest({
        url: '/auxiliaryCorrectionHours/selectAuxiliaryCorrectionHours',
        method: 'get',
        params: params
    })
}
export function selectAuxiliaryOriginalHours(params) {
    return resquest({
        url: '/auxiliaryOriginalHours/selectAuxiliaryOriginalHours',
        method: 'get',
        params: params
    })
}
export function selectAuxiliaryWorkingHoursDay(params) {
    return resquest({
        url: '/auxiliaryWorkingHoursDay/selectAuxiliaryWorkingHoursDay',
        method: 'get',
        params: params
    })
}
export function selectAuxiliaryOutputWorkingHours(params) {
    return resquest({
        url: '/auxiliaryOutputWorkingHours/selectAuxiliaryOutputWorkingHours',
        method: 'get',
        params: params
    })
}
export function insertAuxiliaryWorkingHoursDay(data) {
    return resquest({
        url: '/auxiliaryWorkingHoursDay/insertAuxiliaryWorkingHoursDay',
        method: 'post',
        data: data
    })
}
export function updateAuxiliaryWorkingHoursDay(data) {
    return resquest({
        url: '/auxiliaryWorkingHoursDay/updateAuxiliaryWorkingHoursDay',
        method: 'post',
        data: data
    })
}
export function check(data) {
    return resquest({
        url: '/auxiliaryWorkingHoursDay/check',
        method: 'post',
        data: data
    })
}
export function approve(data) {
    return resquest({
        url: '/auxiliaryWorkingHoursDay/approve',
        method: 'post',
        data: data
    })
}
export function collectWorkingHours(data) {
    return resquest({
        url: '/auxiliaryOutputWorkingHours/collectWorkingHours',
        method: 'post',
        data: data
    })
}
export function selectshiftByUser(params) {
    return resquest({
        url: '/auxiliaryWorkingHoursDay/selectshiftByUser',
        method: 'get',
        params: params
    })
}
export function selectAuxiliaryWorkingHoursByNumber(params) {
    return resquest({
        url: '/auxiliaryWorkingHoursDay/selectAuxiliaryWorkingHoursByNumber',
        method: 'get',
        params: params
    })
}
export function exportWorkingHours(params) {
    return resquest({
        url: '/auxiliaryOutputWorkingHours/exportWorkingHours',
        method: 'get',
        responseType: 'blob',
        params: params
    })
}
export function deleteAuxiliaryWorkingHours(params) {
    return resquest({
        url: '/auxiliaryWorkingHours/deleteAuxiliaryWorkingHours',
        method: 'post',
        params: params
    })
}
export function upAuxiliaryWorkingHours(data) {
    return resquest({
        url: '/auxiliaryWorkingHours/upAuxiliaryWorkingHours',
        method: 'post',
        data: data
    })
}
export function insertAuxiliaryWorkingHours(data) {
    return resquest({
        url: '/auxiliaryWorkingHours/insertAuxiliaryWorkingHours',
        method: 'post',
        data: data
    })
}
src/api/business/reportPreparation.js
@@ -51,7 +51,7 @@
export function getUserList(params) {
    return resquest({
        url: '/approveConfig/getUserList',
        url: '/performanceShift/getUserList',
        method: 'get',
        params: params
    })
@@ -97,14 +97,6 @@
    })
}
export function downReport(params) {
    return resquest({
        url: '/insReport/downReport',
        method: 'get',
        params: params
    })
}
export function upReportUrl(data) {
    return resquest({
        url: '/insReport/upReportUrl',
@@ -117,7 +109,7 @@
    return resquest({
        url: '/insReport/examineReport',
        method: 'post',
        data: data
        params: data
    })
}
@@ -125,7 +117,7 @@
    return resquest({
        url: '/insReport/ratifyReport',
        method: 'post',
        data: data
        params: data
    })
}
@@ -163,3 +155,13 @@
        params: params
    })
}
    export function downReport(params) {
        return resquest({
            url: '/insReport/downReport',
            method: 'get',
            params: params,
            responseType: 'blob'
        })
    }
src/components/Table/lims-table.vue
@@ -319,7 +319,7 @@
  props: {
    isSelection: {
      type: Boolean,
      default: false,
      default: undefined,
    },
    height: {
      type: String,
@@ -387,7 +387,7 @@
    },
    rowKey: {
      type: String,
      default: undefined,
      default: "id",
    },
    page: {
      type: Object,
@@ -408,9 +408,9 @@
    };
  },
  watch: {
    column(val) {
      this.doLayout();
    },
    // column(val) {
    //   this.doLayout();
    // },
  },
  mounted() {
    this.calculateSpanInfo();
src/utils/request.js
@@ -76,6 +76,7 @@
          s_url === requestObj.url
        ) {
          const message = "数据正在处理,请勿重复提交";
          console.log('重复的请求',sessionObj.url);
          console.warn(`[${s_url}]: ` + message);
          return Promise.reject(new Error(message));
        } else {
src/views/business/inspectionOrder/index.vue
@@ -1428,6 +1428,7 @@
        insSampleId: row.insSampleId,
        entrustCode: row.entrustCode,
        sampleCode: row.sampleCode,
        inspectionItemSubclass: row.inspectionItemSubclass,
      };
      this.$axios
        .post(this.$api.insOrder.viewDetails, data, {
src/views/business/reportPreparation/index.vue
@@ -244,37 +244,6 @@
                    </el-dropdown-menu>
                  </el-dropdown>
                </template>
                <template>
                  <el-button
                    size="small"
                    type="primary"
                    @click="handleDowns"
                    :loading="outLoading"
                    style="margin-right: 6px"
                    >批量下载</el-button
                  >
                  <el-button
                    size="small"
                    type="primary"
                    @click="openBatchUploadDia()"
                    :loading="inLoading"
                    >批量上传</el-button
                  >
                  <el-button
                    size="small"
                    type="primary"
                    @click="oneClickApproval()"
                    :loading="approvalLoading"
                    >一键审批</el-button
                  >
                  <el-button
                    size="small"
                    type="primary"
                    @click="openApprovalConfig()"
                    :loading="approvalConfigLoading"
                    >审批签名配置</el-button
                  >
                </template>
              </div>
              <!-- <div class="btns">
              <el-button size="small" type="primary" @click="handleDowns" :loading="outLoading" style="margin-right: 16px;">批量下载</el-button>
@@ -316,6 +285,8 @@
          </p>
        </div>
        <lims-table
          :handleSelectionChange="handleSelectionChange"
          isSelection
          :tableData="tableData"
          :column="column"
          :tableLoading="tableLoading"
@@ -850,15 +821,18 @@
  downAll,
  getBatchApprovalProgress,
  getReportCountInfo,
  downReport,
  upReportUrl,
  ratifyReport,
  writeReport,
  examineReport,
  downLoad,
  getReportInfo,
  getURL
  getURL,
  batchApprovalReport,
  downReport,
} from "../../../api/business/reportPreparation";
import { getToken } from "@/utils/auth";
export default {
  components: {
@@ -1129,11 +1103,10 @@
            {
              name: "上传",
              type: "upload",
              url: "/file/attachmentType/upload",
              url: "/insReport/inReport",
              data: (row) => {
                return {
                  id: row.id,
                  type: 1,
                };
              },
              uploadIdFun: (row) => {
@@ -1238,12 +1211,13 @@
  },
  computed: {
    headers() {
      let token = getToken();
      return {
        token: sessionStorage.getItem("token"),
        authorization: token,
      };
    },
    action() {
      return "";
      return this.javaApi + "/insReport/upAll";
    },
  },
  created() {
@@ -1332,7 +1306,7 @@
    },
    // æ’¤å›ž å¼¹æ¡†
    withdraw(row) {
      getLaboratoryByReportId(row.id).then((res) => {
      getLaboratoryByReportId({ id: row.id }).then((res) => {
        this.laboratorys = res.data;
        this.reportId = row.id;
        this.withdrawDialogVisible = true;
@@ -1350,6 +1324,7 @@
      withdraw(data).then((res) => {
        if (res.code == 200) {
          this.$message.success("撤回成功");
          this.laboratory = [];
          this.withdrawDialogVisible = false;
          this.refresh();
        }
@@ -1400,6 +1375,7 @@
    getAuthorizedPerson() {
      getUserList()
        .then((res) => {
          console.log('res',res);
          this.personList = res.data;
        })
        .catch((error) => {
@@ -1540,6 +1516,10 @@
    handleChange(arr) {
      this.mutiList = arr;
    },
    handleSelectionChange(val) {
      this.mutiList = val;
      console.log(`output->val`, val);
    },
    handleDowns() {
      if (this.mutiList.length == 0) {
        this.$message.error("请选择报告");
@@ -1583,14 +1563,8 @@
      downAll({ ids: str }).then((res) => {
        this.outLoading = false;
        this.$message.success("导出成功");
        // const blob = new Blob([res],{ type: 'application/octet-stream' });
        // const url = URL.createObjectURL(blob);
        // const link = document.createElement('a');
        // link.href = url;
        // link.download = '报告.zip';
        // link.click();
        const link = document.createElement("a");
        link.href = this.javaApi + res.message;
        link.href = this.javaApi + res.data;
        link.target = "_blank";
        document.body.appendChild(link);
        link.click();
@@ -1719,27 +1693,21 @@
      console.log(`output->row`, row);
    },
    download(row) {
      getReportInfo({ id: row.id, type: 1,suffix:'.docx' }).then((response) => {
        if (response.data && response.data.contentType) {
          downLoad({ id: row.id, type: 1, code: row.code,suffix: '.docx' })
            .then((res) => {
              // èŽ·å–æ–‡ä»¶å
              const blob = new Blob([res], { type: response.data.contentType });
              const url = URL.createObjectURL(blob);
              let link = document.createElement("a");
      downReport({ id: row.id, type: 0 }).then((res) => {
          let rowUrl = row.urlS ? row.urlS : row.url;
          let fileName =
            rowUrl.indexOf("_") == -1
              ? rowUrl.split("/")[2]
              : rowUrl.split("_")[1];
          console.log(fileName);
          const blod = new Blob([res], { type: "application/octet-stream" });
          const url = URL.createObjectURL(blod);
          const link = document.createElement("a");
              link.href = url;
              link.download = row.code;
          link.target = "_blank";
          link.download = fileName;
              document.body.appendChild(link);
              link.click();
              document.body.removeChild(link);
              URL.revokeObjectURL(url);
            })
            .catch((error) => {
              this.$message.error(error);
            });
        } else {
          this.$message.error("未找到文件");
        }
      });
    },
    // è¿˜åŽŸæ“ä½œ
@@ -1763,7 +1731,7 @@
      this.currentInfo = row;
      let fileName = row.urlS === null || row.urlS === "" ? row.url : row.urlS;
      fileName = fileName.replace("/word/", "");
      const userName = JSON.parse(localStorage.getItem("user")).name;
      const userName = this.$store.state.user.name;
      this.option = {
        url: this.javaApi + "/word/" + fileName,
        isEdit: false,
@@ -1799,17 +1767,11 @@
    },
    handleApprove(row) {
      this.currentInfo = row;
      getURL().then(res => {
      })
      let fileName = row.urlS === null || row.urlS === "" ? row.url : row.urlS;
      fileName = fileName.replace("/word/", "");
      const userName = this.$store.state.user.name;
      this.option = {
        url: javaApi + "/word/" + fileName,
        url: this.javaApi + "/word/" + fileName,
        isEdit: false,
        fileType: "docx",
        title: fileName,
@@ -1895,8 +1857,8 @@
      this.loadingApproveReason = true;
      examineReport({
        id: this.currentInfo.id,
        isRatify: 0,
        ratifyTell: this.reason,
        isExamine: 0,
        examineTell: this.reason,
      })
        .then((res) => {
          this.loadingApproveReason = false;
src/views/performance/manHour/index.vue
@@ -1,27 +1,14 @@
<template>
  <div class="work-time-management">
  <div class="work-time-management bg-1">
    <div style="text-align: left">
      <el-radio-group
        v-model="currentComponent"
        size="small"
        style="margin-top: 16px; margin-left: 16px"
      >
        <el-radio-button
          v-if="checkPermi(['performance:manHour:workTimeStatistics'])"
          label="workTimeStatistics"
        >
          å·¥æ—¶æ±‡æ€»
      <el-radio-group v-model="currentComponent" size="small" style="margin-top: 16px;margin-bottom: 16px;">
        <el-radio-button label="workTimeStatistics">
          å·¥æ—¶ç»Ÿè®¡
        </el-radio-button>
        <el-radio-button
          v-if="checkPermi(['performance:manHour:workTimeManagement'])"
          label="workTimeManagement"
        >
        <el-radio-button label="workTimeManagement" >
          æ—¥å·¥æ—¶ç®¡ç†
        </el-radio-button>
        <el-radio-button
          v-if="checkPermi(['performance:manHour:workTimeConfig'])"
          label="workTimeConfig"
        >
        <el-radio-button label="workTimeConfig">
          è¾…助工时配置
        </el-radio-button>
      </el-radio-group>
@@ -31,26 +18,31 @@
</template>
<script>
import workTimeStatistics from "./workTimeStatistics.vue";
import workTimeManagement from "./workTimeManagement.vue";
import workTimeConfig from "./workTimeConfig.vue";
import { checkPermi } from "@/utils/permission"; // æƒé™åˆ¤æ–­å‡½æ•°
import workTimeStatistics from '../manHour/work-time-statistics.vue'
import workTimeManagement from '../manHour/work-time-management.vue'
import workTimeConfig from '../manHour/work-time-config.vue'
export default {
  components: {
    workTimeStatistics,
    workTimeManagement,
    workTimeConfig,
    workTimeConfig
  },
  created() {},
  created() {
    this.currentComponent = 'workTimeStatistics'
  },
  data() {
    return {
      currentComponent: "workTimeStatistics",
    };
      currentComponent:'workTimeStatistics',
      selectAuxiliaryOriginalHours:false,
      selectAuxiliaryOutputWorkingHours:false,
      insertAuxiliaryWorkingHours:false
    }
  },
  methods: {
    checkPermi,
  },
};
  }
}
</script>
<style scoped></style>
<style scoped>
</style>
src/views/performance/manHour/work-time-config.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,469 @@
<template>
  <div class="work-time-config bg-1">
    <div class="search">
      <div class="search_thing">
        <div class="search_label">编号:</div>
        <div class="search_input">
          <el-input
            size="small"
            placeholder="请输入"
            clearable
            v-model="entity.number"
            @keyup.enter.native="refreshTable()"
          ></el-input>
        </div>
      </div>
      <div class="search_thing">
        <div class="search_label">实验室:</div>
        <el-select
          v-model="entity.laboratory"
          placeholder="全部"
          size="small"
          @change="refreshTable()"
          clearable
        >
          <el-option
            v-for="item in laboratoryList"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          >
          </el-option>
        </el-select>
      </div>
      <div class="search_thing">
        <div class="search_label">部门:</div>
        <div class="search_input">
          <el-input
            size="small"
            placeholder="请输入"
            clearable
            v-model="entity.department"
            @keyup.enter.native="refreshTable()"
          ></el-input>
        </div>
      </div>
      <div class="search_thing" style="padding-left: 30px">
        <el-button size="small" @click="refresh()">重 ç½®</el-button>
        <el-button size="small" type="primary" @click="refreshTable()"
          >查 è¯¢</el-button
        >
      </div>
      <el-button
        size="small"
        type="primary"
        style="position: absolute; right: 50px"
        @click="openAdd()"
        >新 å¢ž</el-button
      >
    </div>
    <div class="table">
      <!-- <ValueTable ref="ValueTable0"
                  :url="$api.auxiliaryWorkingHours.selectAuxiliaryWorkingHours" :upUrl="$api.auxiliaryWorkingHours.upAuxiliaryWorkingHours"
                  :delUrl="$api.auxiliaryWorkingHours.deleteAuxiliaryWorkingHours" :componentData="componentData" :key="upIndex" /> -->
      <lims-table
        :tableData="tableData"
        :column="column"
        :tableLoading="tableLoading"
        :height="'calc(100vh - 270px)'"
        :page="page"
        @pagination="pagination"
      ></lims-table>
    </div>
    <!-- æ–°å¢ž ç¼–辑-->
    <el-dialog
      :title="title"
      :visible.sync="dialogVisible"
      width="30%"
      :before-close="handleClose"
    >
      <el-form
        :model="formData"
        label-position="right"
        :rules="rules"
        ref="form"
        label-width="120px"
        class="demo-form"
      >
        <el-form-item label="编号" prop="number">
          <el-input
            v-model="formData.number"
            size="mini"
            style="width: 100%"
          ></el-input>
        </el-form-item>
        <el-form-item label="辅助项目名称" prop="auxiliaryProject">
          <el-input
            v-model="formData.auxiliaryProject"
            size="mini"
            style="width: 100%"
          ></el-input>
        </el-form-item>
        <el-form-item label="实验室" prop="laboratory">
          <el-select
            v-model="formData.laboratory"
            clearable
            placeholder="请选择"
            size="mini"
            style="width: 100%"
          >
            <el-option
              v-for="item in laboratoryList"
              :key="item.value"
              :label="item.label"
              :value="item.value+''"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="单位" prop="unit">
          <el-select
            v-model="formData.unit"
            clearable
            placeholder="请选择"
            size="mini"
            style="width: 100%"
          >
            <el-option
              v-for="item in utilList"
              :key="item.dictValue"
              :label="item.dictLabel"
              :value="item.dictValue"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="核准工时" prop="approvedWorkingHour">
          <el-input
            v-model="formData.approvedWorkingHour"
            size="mini"
            style="width: 100%"
          ></el-input>
        </el-form-item>
        <el-form-item label="备注">
          <el-input
            v-model="formData.remarks"
            size="mini"
            style="width: 100%"
          ></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="submitForm('form')"
            >提交</el-button
          >
          <el-button @click="handleClose">取消</el-button>
        </el-form-item>
      </el-form>
    </el-dialog>
  </div>
</template>
  <script>
import limsTable from "@/components/Table/lims-table.vue";
import {
  selectAuxiliaryWorkingHours,
  obtainItemParameterList,
  deleteAuxiliaryWorkingHours,
  upAuxiliaryWorkingHours,
  insertAuxiliaryWorkingHours
} from "../../../api/business/manHour";
import { getYearAndMonthAndDays } from "../../../utils/date";
import { getDicts } from "@/api/system/dict/data";
import { number } from "echarts";
export default {
  components: {
    limsTable,
  },
  data() {
    return {
      rules: {
        number: [{ required: true, message: "请输入编号", trigger: "blur" }],
        auxiliaryProject: [
          { required: true, message: "请输入辅助项目名称", trigger: "blur" },
        ],
        laboratory: [
          { required: true, message: "请选择实验室", trigger: "change" },
        ],
        unit: [{ required: true, message: "请选择单位", trigger: "change" }],
        approvedWorkingHour: [
          { required: true, message: "请输入核准工时", trigger: "blur" },
        ],
      },
      dialogVisible: false,
      formData: {
        id: null,
        number: null,
        auxiliaryProject: null,
        laboratory: '',
        unit: '',
        approvedWorkingHour: null,
        remarks: null,
      },
      title: "",
      utilList: [],
      tableData: [],
      column: [
        {
          label: "编号",
          prop: "number",
        },
        {
          label: "辅助项目名称",
          prop: "auxiliaryProject",
        },
        {
          dataType: "tag",
          label: "实验室",
          prop: "laboratory",
          formatData: (params) => {
            let farmat = "";
            let list = this.laboratoryList.filter(
              (item) => item.value == Number(params)
            );
            if (list.length > 0) {
              farmat = list[0].label;
            }
            return farmat;
          },
          formatType: () => {
            return "success";
          },
        },
        {
          label: "单位",
          prop: "unit",
          dataType: "tag",
          formatData: (params) => {
            let farmat = "";
            let list = this.utilList.filter((item) => item.dictValue == params);
            if (list.length > 0) {
              farmat = list[0].dictLabel;
            }
            return farmat;
          },
          formatType: () => {
            return "primary";
          },
        },
        {
          label: "核准工时",
          prop: "approvedWorkingHour",
        },
        {
          label: "部门",
          prop: "department",
        },
        {
          label: "备注",
          prop: "remarks",
        },
        {
          dataType: "action",
          fixed: "right",
          label: "操作",
          operation: [
            {
              name: "编辑",
              type: "text",
              clickFun: (row) => {
                this.openAdd(row);
              },
            },
            {
              name: "删除",
              type: "text",
              clickFun: (row) => {
                this.del(row);
              },
            },
          ],
        },
      ],
      tableLoading: false,
      page: {
        current: 1,
        size: 20,
        total: 0,
      },
      entity: {
        number: null,
        department: null,
        laboratory: null,
      },
      entityCopy: {},
      upIndex: 0,
      laboratoryList: [],
      partList: [],
      addPower: true,
    };
  },
  created() {},
  mounted() {
    this.entityCopy = this.HaveJson(this.entity);
    this.obtainItemParameterList();
    this.selectEnumByCategoryForUnit();
    this.getData();
  },
  methods: {
    getData() {
      this.tableLoading = true;
      this.page.total = 0;
      selectAuxiliaryWorkingHours({ ...this.page, ...this.entity }).then(
        (res) => {
          this.tableData = res.data.records;
          this.page.total = res.data.total;
          this.tableLoading = false;
        }
      );
    },
    submitForm(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          if (this.formData.id) {
            upAuxiliaryWorkingHours(this.formData).then((res) => {
              this.$message({
                type: "success",
                message: "操作成功!",
              });
              this.refreshTable();
              this.dialogVisible = false;
            });
            this.dialogVisible = false;
          } else {
            insertAuxiliaryWorkingHours(this.formData).then((res) => {
              this.$message({
                type: "success",
                message: "操作成功!",
              });
              this.refreshTable();
              this.dialogVisible = false;
            });
          }
        } else {
          return false;
        }
      });
    },
    resetForm(formName) {
      this.$refs[formName].resetFields();
    },
    del(row) {
      console.log(row);
      this.$confirm("此操作将永久删除, æ˜¯å¦ç»§ç»­?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {
        deleteAuxiliaryWorkingHours({id:row.id}).then((res) => {
          this.$message({
            type: "success",
            message: "删除成功!",
          });
          this.refreshTable();
        });
      });
    },
    refresh() {
      this.entity = this.HaveJson(this.entityCopy);
      this.upIndex++;
    },
    refreshTable() {
      this.getData();
    },
    pagination({ page, limit }) {
      this.page.current = page;
      this.page.size = limit;
      this.refreshTable();
    },
    openAdd(row) {
        console.log(row);
        console.log(this.laboratoryList);
      if (row) {
        this.title = "编辑";
        this.formData.id = row.id;
        this.formData.number = row.number;
        this.formData.auxiliaryProject = row.auxiliaryProject;
        this.formData.laboratory = row.laboratory;
        this.formData.unit = row.unit;
        this.formData.approvedWorkingHour = row.approvedWorkingHour;
        this.formData.remarks = row.remarks;
      } else {
        this.title = "新增";
      }
      this.dialogVisible = true;
    },
    obtainItemParameterList() {
      obtainItemParameterList().then((res) => {
        let data = [];
        res.data.forEach((a) => {
          data.push({
            label: a.laboratoryName,
            value: a.id,
          });
        });
        this.laboratoryList = data;
      });
    },
    handleClose() {
      this.formData = {
        id: null,
        number: null,
        auxiliaryProject: null,
        laboratory: '',
        unit: '',
        approvedWorkingHour: null,
        remarks: null,
      };
      this.resetForm("form");
      this.dialogVisible = false;
      console.log(7898,this.formData);
    },
    selectEnumByCategoryForUnit() {
      getDicts("sys_unit").then((res) => {
        this.utilList = res.data;
      });
    },
  },
};
</script>
  <style scoped>
.work-time-config {
  height: 100%;
}
.search {
  background-color: #fff;
  height: 80px;
  display: flex;
  align-items: center;
}
.search_thing {
  width: 250px;
  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 - 24px);
  padding: 20px;
}
</style>
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
          >&nbsp;&nbsp;&nbsp;&nbsp;产量工时汇总:<span
            style="font-size: 16px; color: #3a7bfa"
            v-if="totalInfo"
            >{{
              totalInfo["产量工时汇总"]
                ? Number(totalInfo["产量工时汇总"]).tofixed(4)
                : 0
            }}</span
          >&nbsp;&nbsp;&nbsp;&nbsp;辅助工时汇总:<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() {
    //当只有产量工时tab页时,当前页改为产量工时页
    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>
src/views/performance/manHour/work-time-statistics.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,589 @@
<template>
  <div class="work-time-statistics">
    <div class="search">
      <div class="search_thing">
        <div class="search_label">日期:</div>
        <div class="search_input" style="display: flex; align-items: center">
          <el-date-picker
            v-model="entity.month"
            type="month"
            format="yyyy-MM"
            value-format="yyyy-MM"
            placeholder="选择月"
            size="small"
            style="width: 100%"
            :clearable="false"
            @change="refreshTable()"
          >
          </el-date-picker>
        </div>
      </div>
      <div class="search_thing">
        <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">
        <div class="search_label">部门:</div>
        <div class="search_input">
          <el-select
            size="small"
            placeholder="请选择"
            clearable
            v-model="entity.departLims"
            @change="refreshTable()"
          >
            <el-option
              label="通信产品实验室"
              value="通信产品实验室"
            ></el-option>
            <el-option
              label="电力产品实验室"
              value="电力产品实验室"
            ></el-option>
          </el-select>
        </div>
      </div>
      <div class="search_thing" style="padding-left: 30px">
        <el-button size="small" @click="refresh()">重 ç½®</el-button>
        <el-button size="small" type="primary" @click="refreshTable()"
          >查 è¯¢</el-button
        >
      </div>
      <div class="search_thing">
        <el-button
          size="small"
          type="primary"
          @click="handleDown"
          v-show="
            currentTable == 'value0' &&
            down
          "
          :loading="outLoading"
          >导 å‡º</el-button
        >
        <el-button
          size="small"
          type="primary"
          @click="handleUp"
          v-show="currentTable == 'value1' && up"
          >导 å…¥</el-button
        >
      </div>
    </div>
    <div style="text-align: left">
      <el-radio-group
        v-model="currentTable"
        size="small"
        :key="'111'"
        style="margin-top: 10px"
      >
        <el-radio-button
          label="value0"        >
          åŽŸå§‹å·¥æ—¶
        </el-radio-button>
        <el-radio-button
          label="value1"
        >
          ä¿®æ­£å·¥æ—¶
        </el-radio-button>
      </el-radio-group>
    </div>
    <div class="table">
      <!-- <ValueTable ref="ValueTable0"
          v-if="currentTable == 'value0' && isPermission('selectAuxiliaryOriginalHours')" :isColumnWidth="true"
                    :isShowZero="true"
                  :url="$api.auxiliaryOriginalHours.selectAuxiliaryOriginalHours"
                  :componentData="componentData" :key="upIndex" />
        <ValueTable ref="ValueTable1" :isShowZero="true"
          v-if="currentTable == 'value1' && isPermission('selectAuxiliaryCorrectionHours')" :isColumnWidth="true"
                  :url="$api.auxiliaryCorrectionHours.selectAuxiliaryCorrectionHours"
          :inputUrl="$api.auxiliaryCorrectionHours.upload"
                  :componentData="componentData0"
          :key="upIndex1" /> -->
      <lims-table
        v-if="currentTable == 'value0'"
        :tableData="tableData"
        :column="column"
        :key="upIndex"
        :tableLoading="tableLoading"
        :height="'calc(100vh - 270px)'"
        :page="page"
        @pagination="pagination"
      ></lims-table>
      <lims-table
        v-if="currentTable == 'value1'"
        :tableData="tableData1"
        :column="column1"
        :key="upIndex1"
        :tableLoading="tableLoading1"
        :height="'calc(100vh - 270px)'"
        :page="page1"
        @pagination="pagination1"
      ></lims-table>
    </div>
  </div>
</template>
  <script>
import limsTable from "@/components/Table/lims-table.vue";
import {
  obtainItemParameterList,
  selectAuxiliaryCorrectionHours,
  selectAuxiliaryOriginalHours
} from "../../../api/business/manHour";
import { getDicts } from "@/api/system/dict/data";
import {
        getYearAndMonthAndDays
    } from '../../../utils/date'
export default {
  components: {
    limsTable,
  },
  computed: {},
  data() {
    return {
      column: [
        {
          label: "姓名",
          prop: "name",
        },
        {
          label: "类型",
          prop: "type",
        },
        {
          label: "1",
          prop: "oneHours",
        },
        {
          label: "2",
          prop: "twoHours",
        },
        {
          label: "3",
          prop: "threeHours",
        },
        {
          label: "4",
          prop: "fourHours",
        },
        {
          label: "5",
          prop: "fiveHours",
        },
        {
          label: "6",
          prop: "sixHours",
        },
        {
          label: "7",
          prop: "sevenHours",
        },
        {
          label: "8",
          prop: "eightHours",
        },
        {
          label: "9",
          prop: "nineHours",
        },
        {
          label: "10",
          prop: "tenHours",
        },
        {
          label: "11",
          prop: "elevenHours",
        },
        {
          label: "12",
          prop: "twelveHours",
        },
        {
          label: "13",
          prop: "thirteenHours",
        },
        {
          label: "14",
          prop: "fourteenHours",
        },
        {
          label: "15",
          prop: "fifteenHours",
        },
        {
          label: "16",
          prop: "sixteenHours",
        },
        {
          label: "17",
          prop: "seventeenHours",
        },
        {
          label: "18",
          prop: "eighteenHours",
        },
        {
          label: "19",
          prop: "nineteenHours",
        },
        {
          label: "20",
          prop: "twentyHours",
        },
        {
          label: "21",
          prop: "twentyOneHours",
        },
        {
          label: "22",
          prop: "twentyTwoHours",
        },
        {
          label: "23",
          prop: "twentyThreeHours",
        },
        {
          label: "24",
          prop: "twentyFourHours",
        },
        {
          label: "25",
          prop: "twentyFiveHours",
        },
        {
          label: "26",
          prop: "twentySixHours",
        },
        {
          label: "27",
          prop: "twentySevenHours",
        },
        {
          label: "28",
          prop: "twentyEightHours",
        },
        {
          label: "29",
          prop: "twentyNineHours",
        },
        {
          label: "30",
          prop: "thirtyHours",
        },
        {
          label: "31",
          prop: "thirtyOneHours",
        },
        {
          label: "总工时",
          prop: "total",
        },
        {
          label: "月份",
          prop: "month",
        },
      ],
      tableData: [],
      tableLoading: false,
      page: {
        current: 1,
        size: 20,
        total: 0,
      },
      entity: {},
      column1: [
        {
          label: "姓名",
          prop: "name",
        },
        {
          label: "类型",
          prop: "type",
        },
        {
          label: "1",
          prop: "oneHours",
        },
        {
          label: "2",
          prop: "twoHours",
        },
        {
          label: "3",
          prop: "threeHours",
        },
        {
          label: "4",
          prop: "fourHours",
        },
        {
          label: "5",
          prop: "fiveHours",
        },
        {
          label: "6",
          prop: "sixHours",
        },
        {
          label: "7",
          prop: "sevenHours",
        },
        {
          label: "8",
          prop: "eightHours",
        },
        {
          label: "9",
          prop: "nineHours",
        },
        {
          label: "10",
          prop: "tenHours",
        },
        {
          label: "11",
          prop: "elevenHours",
        },
        {
          label: "12",
          prop: "twelveHours",
        },
        {
          label: "13",
          prop: "thirteenHours",
        },
        {
          label: "14",
          prop: "fourteenHours",
        },
        {
          label: "15",
          prop: "fifteenHours",
        },
        {
          label: "16",
          prop: "sixteenHours",
        },
        {
          label: "17",
          prop: "seventeenHours",
        },
        {
          label: "18",
          prop: "eighteenHours",
        },
        {
          label: "19",
          prop: "nineteenHours",
        },
        {
          label: "20",
          prop: "twentyHours",
        },
        {
          label: "21",
          prop: "twentyOneHours",
        },
        {
          label: "22",
          prop: "twentyTwoHours",
        },
        {
          label: "23",
          prop: "twentyThreeHours",
        },
        {
          label: "24",
          prop: "twentyFourHours",
        },
        {
          label: "25",
          prop: "twentyFiveHours",
        },
        {
          label: "26",
          prop: "twentySixHours",
        },
        {
          label: "27",
          prop: "twentySevenHours",
        },
        {
          label: "28",
          prop: "twentyEightHours",
        },
        {
          label: "29",
          prop: "twentyNineHours",
        },
        {
          label: "30",
          prop: "thirtyHours",
        },
        {
          label: "31",
          prop: "thirtyOneHours",
        },
        {
          label: "总工时",
          prop: "total",
        },
        {
          label: "月份",
          prop: "month",
        },
      ],
      tableData1: [],
      tableLoading1: false,
      page1: {
        current: 1,
        size: 20,
        total: 0,
      },
      entity1: {},
      down: false,
      up: false,
      entity: {
        month: getYearAndMonthAndDays().split('-')[0]+'-'+getYearAndMonthAndDays().split('-')[1],
        name: "",
        departLims: "",
      },
      entityCopy: {},
      entityCopy0: {},
      upIndex: 0,
      upIndex1: 100,
      weekList: [],
      currentTable: "value0",
      outLoading: false,
    };
  },
  created() {},
  mounted() {
    this.entityCopy = this.HaveJson(this.entity);
    this.entityCopy0 = this.HaveJson(this.entity);
    this.getData();
  },
  watch: {
    currentTable(val) {
      this.getData();
    },
  },
  methods: {
    getData() {
        if (this.currentTable == "value0") {
            console.log('value0');
        this.tableLoading = true;
        let params = {...this.page, ...this.entity};
        selectAuxiliaryOriginalHours(params).then((res) => {
          this.tableData = res.data.records;
          this.page.total = res.data.total;
          this.tableLoading = false;
        });
      } else {
        console.log('value1');
        this.tableLoading1 = true;
        let params = {...this.page1, ...this.entity1};
        selectAuxiliaryCorrectionHours(params).then((res) => {
          this.tableData1 = res.data.records;
          this.page1.total = res.data.total;
          this.tableLoading1 = false;
        });
      }
    },
    // è¿”回分页值
    pagination({ page, limit }) {
      this.page.current = page;
      this.page.size = limit;
      this.getList();
    },
   // è¿”回分页值
   pagination1({ page, limit }) {
      this.page1.current = page;
      this.page1.size = limit;
      this.getList();
    },
    refresh() {
      this.entity = {
        month: getYearAndMonthAndDays(),
      };
      if (this.currentTable == "value0") {
        this.entity = this.HaveJson(this.entityCopy);
        this.upIndex++;
      } else {
        this.entity = this.HaveJson(this.entityCopy0);
        this.upIndex1++;
      }
      this.refreshTable();
    },
    refreshTable() {
      this.getData();
    },
    handleDown() {
      let entity = { ...this.entity };
      entity.month =
        entity.month.split("-")[0] + "-" + entity.month.split("-")[1];
      this.outLoading = true;
      exportOriginalHours({ ...entity }).then((res) => {
        this.outLoading = false;
        this.$message.success("导出成功");
        const blob = new Blob([res], { type: "application/octet-stream" });
        const url = URL.createObjectURL(blob);
        const link = document.createElement("a");
        link.href = url;
        link.download = entity.month + "工时统计表.xlsx";
        link.click();
      });
    },
    handleUp() {
    },
  },
};
</script>
  <style scoped>
.work-time-statistics {
  height: 100%;
}
.search {
  background-color: #fff;
  height: 80px;
  display: flex;
  align-items: center;
}
.search_thing {
  width: 270px;
  display: flex;
  align-items: center;
}
.search_label {
  width: 60px;
  font-size: 14px;
  text-align: right;
}
.search_input {
  width: calc(100% - 60px);
}
.table {
  margin-top: 10px;
  background-color: #fff;
  width: calc(100% - 40px);
  height: calc(100% - 60px - 80px - 10px - 40px - 25px);
  padding: 20px;
}
</style>
src/views/performance/manHour/workTimeConfig.vue
ÎļþÒÑɾ³ý
src/views/performance/manHour/workTimeManagement.vue
ÎļþÒÑɾ³ý
src/views/performance/manHour/workTimeStatistics.vue
ÎļþÒÑɾ³ý