Crunchy
2025-03-17 0a26d58a3906b9e13946c7cb46fae51a0de98920
src/views/performance/manHour/workTimeManagement.vue
@@ -42,28 +42,28 @@
      </div>
    </div>
    <div style="display: flex; align-items: center; justify-content: space-between">
      <el-radio-group :key="'111'" v-model="currentTable" size="small">
      <el-radio-group :key="'111'" v-model="currentTable" size="small" @change="searchList">
        <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 v-if="totalInfo" style="font-size: 16px; color: #3a7bfa">{{
            totalInfo["产量工时汇总"] + totalInfo["辅助工时汇总"]
              ? Number(
                totalInfo["产量工时汇总"] + totalInfo["辅助工时汇总"]
              ).tofixed(4)
              : 0
          }}</span>&nbsp;&nbsp;&nbsp;&nbsp;产量工时汇总:<span v-if="totalInfo" style="font-size: 16px; color: #3a7bfa">{{
              totalInfo["产量工时汇总"]
                ? Number(totalInfo["产量工时汇总"]).tofixed(4)
                : 0
            }}</span>&nbsp;&nbsp;&nbsp;&nbsp;辅助工时汇总:<span v-if="totalInfo" style="font-size: 16px; color: #3a7bfa">{{
              totalInfo["辅助工时汇总"]
                ? Number(totalInfo["辅助工时汇总"]).tofixed(4)
                : 0
            }}</span>
        </p>
<!--        <p style="font-size: 14px; margin-right: 30px">-->
<!--          总工时汇总:<span v-if="totalInfo" style="font-size: 16px; color: #3a7bfa">{{-->
<!--            totalInfo["产量工时汇总"] + totalInfo["辅助工时汇总"]-->
<!--              ? Number(-->
<!--                totalInfo["产量工时汇总"] + totalInfo["辅助工时汇总"]-->
<!--              ).tofixed(4)-->
<!--              : 0-->
<!--          }}</span>&nbsp;&nbsp;&nbsp;&nbsp;产量工时汇总:<span v-if="totalInfo" style="font-size: 16px; color: #3a7bfa">{{-->
<!--              totalInfo["产量工时汇总"]-->
<!--                ? Number(totalInfo["产量工时汇总"]).tofixed(4)-->
<!--                : 0-->
<!--            }}</span>&nbsp;&nbsp;&nbsp;&nbsp;辅助工时汇总:<span v-if="totalInfo" style="font-size: 16px; color: #3a7bfa">{{-->
<!--              totalInfo["辅助工时汇总"]-->
<!--                ? Number(totalInfo["辅助工时汇总"]).tofixed(4)-->
<!--                : 0-->
<!--            }}</span>-->
<!--        </p>-->
        <el-button v-show="currentTable == 'ValueTable0' &&
          checkPermi(['performance:manHour:workTimeManagement:add'])
          " size="small" type="primary" @click="openAdd">录入数据</el-button>
@@ -78,9 +78,11 @@
    </div>
    <div class="table">
      <lims-table :tableData="tableData" :column="column" :page="page" :tableLoading="tableLoading"
                  key="tableData"
        :height="'calc(100vh - 350px)'" :isSelection="true" v-if="currentTable == 'ValueTable0'"
        @pagination="pagination" :handleSelectionChange="handleSelectionChange"></lims-table>
      <lims-table :tableData="tableData0" :column="column0" :page="page0" :tableLoading="tableLoading"
                  key="tableData0"
        :height="'calc(100vh - 350px)'" v-if="currentTable == 'ValueTable1'" @pagination="pagination0"></lims-table>
    </div>
    <el-dialog :before-close="handleClose" :title="formData.id ? '编辑' : '录入数据'" :visible.sync="addVisible"
@@ -220,7 +222,6 @@
</template>
<script>
import ValueTable from "@/components/Table/value-table.vue";
import { getYearAndMonthAndDays } from "@/utils/date";
import {
  selectAuxiliaryWorkingHoursDay,
@@ -238,7 +239,6 @@
import limsTable from "@/components/Table/lims-table.vue";
export default {
  components: {
    ValueTable,
    limsTable,
  },
  dicts: ["sys_class_type"],
@@ -250,13 +250,13 @@
      down: false,
      addFileVisible: false,
      weekList: [
        { label: "周一", value: "周一", type: "primary" },
        { label: "周二", value: "周二", type: "primary" },
        { label: "周三", value: "周三", type: "primary" },
        { label: "周四", value: "周四", type: "primary" },
        { label: "周五", value: "周五", type: "primary" },
        { label: "周六", value: "周六", type: "primary" },
        { label: "周日", value: "周日", type: "primary" },
        { 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,
@@ -354,10 +354,23 @@
          label: "班次",
          prop: "shift",
          dataType: "tag",
          formatData: this.shifList,
          formatData: (params) => {
            if (this.shifList.find(m => m.value == params)) {
              return this.shifList.find(m => m.value == params).label
            } else {
              return null
            }
          },
        },
        { label: "周次", prop: "week" },
        { label: "星期", prop: "weekDay" },
        {
          label: "星期",
          prop: "weekDay",
          dataType: "tag",
          formatData: (params) => {
            return this.weekList.find(m => m.value == params).label
          },
        },
        { label: "创建时间", prop: "createTime" },
        { label: "日期", prop: "dateTime" },
        {
@@ -505,12 +518,19 @@
  },
  mounted() {
    this.getCurrentWeekNumber();
    this.collectWorkingHours();
    // this.collectWorkingHours();
    this.selectshiftByUser();
    this.getList();
    this.getList0();
    this.searchList()
  },
  methods: {
    searchList() {
      if (this.currentTable == 'ValueTable0') {
        this.getList();
      } else {
        this.getList0();
      }
    },
    // 查询辅助工时列表
    getList(entity) {
      this.tableLoading = true;
      let param = {};
@@ -521,7 +541,6 @@
        param.dateTime = param.dateTime?.length > 0 ? JSON.stringify(param.dateTime) : null;
      }
      delete param.total;
      console.log('11111111111111111')
      selectAuxiliaryWorkingHoursDay({ ...param })
        .then((res) => {
          this.tableLoading = false;
@@ -534,6 +553,7 @@
          this.tableLoading = false;
        });
    },
    // 查询产量工时列表
    getList0(entity) {
      this.tableLoading = true;
      let param = {};
@@ -541,9 +561,10 @@
        param = { ...entity, ...this.page0 };
      } else {
        param = { ...this.entity, ...this.page0 };
        param.dateTime = JSON.stringify(param.dateTime);
        param.dateTime = param.dateTime?.length > 0 ? JSON.stringify(param.dateTime) : null
      }
      delete param.total;
      delete param.state;
      selectAuxiliaryOutputWorkingHours({ ...param })
        .then((res) => {
          this.tableLoading = false;
@@ -604,10 +625,12 @@
        this.page0.current = 1;
        this.getList0(entity);
      }
      this.collectWorkingHours();
      // this.collectWorkingHours();
    },
    refresh() {
      this.entity = {};
      this.entity.dateTime = []
      this.setDate()
      this.refreshTable();
    },
    openAdd() {
@@ -669,7 +692,7 @@
          this.formData.auxiliaryProject = "";
          this.addVisible = false;
          this.refreshTable("page");
          this.collectWorkingHours();
          // this.collectWorkingHours();
        });
      } else {
        updateAuxiliaryWorkingHoursDay(this.formData).then((res) => {
@@ -682,7 +705,7 @@
          this.formData.nonproductiveTime = "";
          this.formData.auxiliaryProject = "";
          this.refreshTable("page");
          this.collectWorkingHours();
          // this.collectWorkingHours();
        });
      }
    },
@@ -737,7 +760,7 @@
    submitBatchCheckDialog() {
      this.batchCheckDialog = false;
      this.refreshTable("page");
      this.collectWorkingHours();
      // this.collectWorkingHours();
    },
    submitCheck(e) {
      if (!this.formData0.number) {
@@ -765,7 +788,7 @@
        this.$message.success("操作成功");
        this.checkVisible = false;
        this.refreshTable("page");
        this.collectWorkingHours();
        // this.collectWorkingHours();
      });
    },
    getCurrentWeekNumber(now = new Date()) {
@@ -817,6 +840,7 @@
      }
      entity.weekDay = this.entity.weekDay;
      entity.name = this.entity.name;
      entity.state = this.entity.state;
      collectWorkingHours(entity).then((res) => {
        this.totalInfo = res.data;
      });