|
|
@@ -0,0 +1,739 @@
|
|
|
+<template>
|
|
|
+ <div class="ele-body">
|
|
|
+ <el-card shadow="never" v-loading="loading">
|
|
|
+ <el-form
|
|
|
+ ref="form"
|
|
|
+ :model="form"
|
|
|
+ :rules="{}"
|
|
|
+ label-width="120px"
|
|
|
+ class="el-form-box"
|
|
|
+ >
|
|
|
+ <div style="display: flex">
|
|
|
+ <el-form-item label="工厂名称:" prop="factoriesId">
|
|
|
+ <el-select
|
|
|
+ v-model="form.factoriesId"
|
|
|
+ placeholder="请选择"
|
|
|
+ @change="change_factoryId"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in factoriesList"
|
|
|
+ :label="item.factoryName"
|
|
|
+ :value="item.factoryId"
|
|
|
+ :key="item.factoryId"
|
|
|
+ @click.native="form.factoriesName = item.factoryName"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="班组名称:" prop="teamId">
|
|
|
+ <el-select v-model="form.teamId" placeholder="请选择">
|
|
|
+ <el-option
|
|
|
+ v-for="item in teamList"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.id"
|
|
|
+ :key="item.id"
|
|
|
+ @click.native="teamChange(item)"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="产线名称:" prop="productionLineId">
|
|
|
+ <el-select v-model="form.productionLineId" placeholder="请选择">
|
|
|
+ <el-option
|
|
|
+ v-for="item in productionLineList"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.id"
|
|
|
+ @click.native="form.productionLineName = item.name"
|
|
|
+ :key="item.id"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ icon="el-icon-search"
|
|
|
+ class="ele-btn-icon"
|
|
|
+ @click="search"
|
|
|
+ >
|
|
|
+ 查询
|
|
|
+ </el-button>
|
|
|
+ <el-button @click="reset" icon="el-icon-refresh-left"
|
|
|
+ >重置</el-button
|
|
|
+ >
|
|
|
+ </el-form-item>
|
|
|
+ </div>
|
|
|
+ </el-form>
|
|
|
+ <div style="display: flex">
|
|
|
+ <div class="calendar-container">
|
|
|
+ <el-calendar v-model="timeValue">
|
|
|
+ <template #dateCell="{ date, data }">
|
|
|
+ <div
|
|
|
+ class="calendar-day"
|
|
|
+ @click="handleDateClick(date)"
|
|
|
+ :class="{ 'selected-date': isSelected(date) }"
|
|
|
+ >
|
|
|
+ <div class="datetext">{{
|
|
|
+ data.day.split('-').slice(2).join('-')
|
|
|
+ }}</div>
|
|
|
+ <div class="lunar-date">{{ lunarDate(date) }}</div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-calendar>
|
|
|
+ </div>
|
|
|
+ <el-form ref="form" :rules="{}" label-width="300px" class="el-form-box">
|
|
|
+ <el-form-item label="生产班次" prop="code">
|
|
|
+ <el-select
|
|
|
+ v-model="productionShift"
|
|
|
+ multiple
|
|
|
+ placeholder="请选择"
|
|
|
+ style="width: calc(100% - 75px)"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in productionShiftList"
|
|
|
+ :key="item.code"
|
|
|
+ :label="item.shiftName"
|
|
|
+ :value="item.code"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ <el-button
|
|
|
+ size="small"
|
|
|
+ type="primary"
|
|
|
+ icon="el-icon-plus"
|
|
|
+ class="ele-btn-icon"
|
|
|
+ @click="selectProductionShiftList"
|
|
|
+ style="margin-left: 5px"
|
|
|
+ >
|
|
|
+ 适用
|
|
|
+ </el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <el-button
|
|
|
+ size="small"
|
|
|
+ type="primary"
|
|
|
+ icon="el-icon-plus"
|
|
|
+ class="ele-btn-icon"
|
|
|
+ @click="handleAddOrEdit()"
|
|
|
+ >
|
|
|
+ 新增行
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ size="small"
|
|
|
+ type="primary"
|
|
|
+ class="ele-btn-icon"
|
|
|
+ @click="save"
|
|
|
+ >
|
|
|
+ 保存
|
|
|
+ </el-button>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 数据表格 -->
|
|
|
+ <ele-pro-table
|
|
|
+ v-for="(item, index) in list"
|
|
|
+ :ref="'table' + index"
|
|
|
+ :columns="columns"
|
|
|
+ :datasource="item.list"
|
|
|
+ height="300px"
|
|
|
+ full-height="calc(100vh - 116px)"
|
|
|
+ tool-class="ele-toolbar-form"
|
|
|
+ :selection.sync="selection"
|
|
|
+ @columns-change="handleColumnChange"
|
|
|
+ :cache-key="cacheKeyUrl"
|
|
|
+ :needPage="false"
|
|
|
+
|
|
|
+ @cell-click="cellClick"
|
|
|
+ style="margin-top: 10px"
|
|
|
+ row-key="key"
|
|
|
+ >
|
|
|
+ <template v-slot:toolbar >
|
|
|
+ 班次名称
|
|
|
+ </template>
|
|
|
+ <template v-slot:action="{ row }">
|
|
|
+ <el-radio class="radio" v-model="radio" :label="row.key">
|
|
|
+ <i></i>
|
|
|
+ </el-radio>
|
|
|
+ </template>
|
|
|
+ <template v-slot:dutyName="{ row, $index }">
|
|
|
+ <DictSelection
|
|
|
+ dictName="班次出勤名称"
|
|
|
+ clearable
|
|
|
+ v-model="row.dutyName"
|
|
|
+ filterable
|
|
|
+ valueName="dictValue"
|
|
|
+ allow-create
|
|
|
+ default-first-option
|
|
|
+ :isOne="$index === 0"
|
|
|
+ >
|
|
|
+ </DictSelection>
|
|
|
+ </template>
|
|
|
+ <template v-slot:timeType="{ row, $index }">
|
|
|
+ <el-select
|
|
|
+ v-model="row.timeType"
|
|
|
+ clearable
|
|
|
+ style="width: 100%"
|
|
|
+ @change="setFormtime"
|
|
|
+ >
|
|
|
+ <el-option :value="'1'" label="工作时间"></el-option>
|
|
|
+ <el-option :value="'2'" label="休息时间"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </template>
|
|
|
+ <template v-slot:startTime="{ row, $index }">
|
|
|
+ <el-time-select
|
|
|
+ placeholder="开始时间"
|
|
|
+ v-model="row.startTime"
|
|
|
+ style="width: 100%"
|
|
|
+ :disabled="
|
|
|
+ item.list[$index - 1]?.endTime &&
|
|
|
+ item.list[$index - 1]?.dayDate == row.dayDate
|
|
|
+ "
|
|
|
+ @change="changeTime(row, $index, index, 'startTime')"
|
|
|
+ :picker-options="{
|
|
|
+ ...defTime,
|
|
|
+ ...(item.list[$index - 1]
|
|
|
+ ? {
|
|
|
+ minTime:
|
|
|
+ item.list[$index - 1].dayDate == row.dayDate
|
|
|
+ ? item.list[$index - 1].endTime
|
|
|
+ : ''
|
|
|
+ }
|
|
|
+ : {})
|
|
|
+ }"
|
|
|
+ >
|
|
|
+ </el-time-select>
|
|
|
+ </template>
|
|
|
+ <template v-slot:endTime="{ row, $index }">
|
|
|
+ <el-time-select
|
|
|
+ placeholder="结束时间"
|
|
|
+ v-model="row.endTime"
|
|
|
+ style="width: 100%"
|
|
|
+ @change="changeTime(row, $index, index, 'endTime')"
|
|
|
+ :picker-options="{
|
|
|
+ ...defTime,
|
|
|
+ ...{
|
|
|
+ minTime: row.startTime
|
|
|
+ }
|
|
|
+ }"
|
|
|
+ >
|
|
|
+ </el-time-select>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template v-slot:note="{ row }">
|
|
|
+ <el-input clearable v-model="row.note" placeholder="请输入" />
|
|
|
+ </template>
|
|
|
+ </ele-pro-table>
|
|
|
+ </el-card>
|
|
|
+
|
|
|
+ <!-- <add-or-edit-dialog
|
|
|
+ ref="addOrEditDialogRef"
|
|
|
+ @done="reload"
|
|
|
+ ></add-or-edit-dialog> -->
|
|
|
+
|
|
|
+ <!-- <process-submit-dialog
|
|
|
+ :processSubmitDialogFlag.sync="processSubmitDialogFlag"
|
|
|
+ v-if="processSubmitDialogFlag"
|
|
|
+ ref="processSubmitDialogRef"
|
|
|
+ @reload="reload"
|
|
|
+ :isNotNeedProcess="false"
|
|
|
+ ></process-submit-dialog> -->
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+ import tabMixins from '@/mixins/tableColumnsMixin';
|
|
|
+ // import addOrEditDialog from './components/addOrEditDialog.vue';
|
|
|
+ import { getTableList } from '@/api/productionScheduling/workCalendar';
|
|
|
+ import {
|
|
|
+ getTableList as getProductionShift,
|
|
|
+ selectProductionShiftList
|
|
|
+ } from '@/api/productionScheduling/productionShift';
|
|
|
+ // import processSubmitDialog from '@/components/processSubmitDialog/processSubmitDialog.vue';
|
|
|
+ import { solarToLunar } from 'lunar-calendar';
|
|
|
+ import { getFactoryarea } from '@/api/factoryModel';
|
|
|
+ import { getteampage } from '@/api/workforceManagement/team.js';
|
|
|
+ import dayjs from 'dayjs';
|
|
|
+ import HeaderTools from '@/layout/components/header-tools.vue';
|
|
|
+ import r from 'highlight.js/lib/languages/r';
|
|
|
+
|
|
|
+ export default {
|
|
|
+ mixins: [tabMixins],
|
|
|
+ components: {
|
|
|
+ // processSubmitDialog,
|
|
|
+ // addOrEditDialog
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ // 加载状态
|
|
|
+ loading: false,
|
|
|
+ delVisible: false,
|
|
|
+ current: {},
|
|
|
+ radio: '',
|
|
|
+ timeValue: new Date(),
|
|
|
+ selectedDates: [new Date()],
|
|
|
+ factoriesList: [],
|
|
|
+ productionShiftList: [],
|
|
|
+ productionShift: [],
|
|
|
+ teamList: [],
|
|
|
+ productionLineList: [],
|
|
|
+ defTime: {
|
|
|
+ step: '00:01',
|
|
|
+ start: '00:00',
|
|
|
+ end: '23:59'
|
|
|
+ },
|
|
|
+ form: {
|
|
|
+ factoriesId: '',
|
|
|
+ factoriesName: '',
|
|
|
+ teamId: '',
|
|
|
+ teamName: '',
|
|
|
+ productionLineId: '',
|
|
|
+ productionLineName: ''
|
|
|
+ },
|
|
|
+ list: [],
|
|
|
+ selection: [],
|
|
|
+ processSubmitDialogFlag: false,
|
|
|
+ cacheKeyUrl: 'main-productionScheduling-workCalendar-index',
|
|
|
+ columns: [
|
|
|
+ {
|
|
|
+ action: 'action',
|
|
|
+ slot: 'action',
|
|
|
+ align: 'center',
|
|
|
+ label: '选择',
|
|
|
+ reserveSelection: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ minWidth: 150,
|
|
|
+ prop: 'dayDate',
|
|
|
+ label: '日期',
|
|
|
+ align: 'center',
|
|
|
+ slot: 'code',
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+
|
|
|
+ {
|
|
|
+ minWidth: 180,
|
|
|
+ prop: 'productionLineName',
|
|
|
+ label: '产线名称',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ minWidth: 180,
|
|
|
+ prop: 'workCenterName',
|
|
|
+ label: '工作中心',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ minWidth: 130,
|
|
|
+ prop: 'workStationName',
|
|
|
+ label: '工位名称',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ minWidth: 180,
|
|
|
+ prop: 'productionShift',
|
|
|
+ label: '生产班次',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 60,
|
|
|
+ label: '序号',
|
|
|
+ type: 'index',
|
|
|
+ columnKey: 'index',
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ minWidth: 150,
|
|
|
+ prop: 'dutyName',
|
|
|
+ slot: 'dutyName',
|
|
|
+ label: '出勤名称',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+
|
|
|
+ {
|
|
|
+ minWidth: 120,
|
|
|
+ prop: 'timeType',
|
|
|
+ slot: 'timeType',
|
|
|
+ label: '类型',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ minWidth: 150,
|
|
|
+ prop: 'startTime',
|
|
|
+ slot: 'startTime',
|
|
|
+ label: '开始时间',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ minWidth: 150,
|
|
|
+ slot: 'endTime',
|
|
|
+ prop: 'endTime',
|
|
|
+ label: '结束时间',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ minWidth: 100,
|
|
|
+ prop: 'totalDuration',
|
|
|
+ label: '总时长(分钟)',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ minWidth: 100,
|
|
|
+ prop: 'updateUserName',
|
|
|
+ label: '设置人',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ minWidth: 100,
|
|
|
+ prop: 'updateTime',
|
|
|
+ label: '设置时间',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ minWidth: 180,
|
|
|
+ prop: 'note',
|
|
|
+ slot: 'note',
|
|
|
+ label: '备注',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ };
|
|
|
+ },
|
|
|
+
|
|
|
+ created() {
|
|
|
+ this.getFactory();
|
|
|
+ this.getProductionShift();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ handleAddOrEdit() {
|
|
|
+ if (!this.current.endTime) {
|
|
|
+ return this.$message.error('请先选择结束时间');
|
|
|
+ }
|
|
|
+ let parentIndex = this.current.parentKey;
|
|
|
+ let index = this.list[parentIndex].list.findIndex(
|
|
|
+ (item) => item.key === this.current.key
|
|
|
+ );
|
|
|
+ let data = JSON.parse(JSON.stringify(this.current));
|
|
|
+ //先删除后面的数据在插入
|
|
|
+ this.removeFormtime(index, parentIndex, data);
|
|
|
+ this.list[parentIndex].list.splice(index + 1, 0, {
|
|
|
+ dayDate: data.dayDate,
|
|
|
+ dutyName: '',
|
|
|
+ endTime: '',
|
|
|
+ key: '',
|
|
|
+ productionLineId: data.productionLineId,
|
|
|
+ productionLineName: data.productionLineName,
|
|
|
+ productionShift: data.productionShift,
|
|
|
+ startTime: data.endTime,
|
|
|
+ timeType: '1',
|
|
|
+ totalDuration: ''
|
|
|
+ });
|
|
|
+ this.keyInit();
|
|
|
+ },
|
|
|
+ //key初始化
|
|
|
+ keyInit() {
|
|
|
+ this.list.forEach((item, index) => {
|
|
|
+ this.$set(this.list[index], 'key', index);
|
|
|
+ item.list.forEach((item1, index1) => {
|
|
|
+ this.$set(
|
|
|
+ this.list[index].list[index1],
|
|
|
+ 'key',
|
|
|
+ item1.dayDate + index + '' + index1
|
|
|
+ );
|
|
|
+ this.$set(this.list[index].list[index1], 'parentKey', index);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ async search() {
|
|
|
+ let data = await getTableList({ ...this.form });
|
|
|
+ this.list = data;
|
|
|
+ },
|
|
|
+ reset() {
|
|
|
+ this.form = {
|
|
|
+ factoriesId: '',
|
|
|
+ factoriesName: '',
|
|
|
+ teamId: '',
|
|
|
+ teamName: '',
|
|
|
+ productionLineId: '',
|
|
|
+ productionLineName: ''
|
|
|
+ };
|
|
|
+ },
|
|
|
+ //获取班次
|
|
|
+ getProductionShift() {
|
|
|
+ getProductionShift({
|
|
|
+ pageNum: 1,
|
|
|
+ size: 999
|
|
|
+ }).then((res) => {
|
|
|
+ this.productionShiftList = res.records;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handleDateClick(date) {
|
|
|
+ const dateStr = date.toISOString().split('T')[0];
|
|
|
+ const index = this.selectedDates.findIndex(
|
|
|
+ (d) => d.toISOString().split('T')[0] === dateStr
|
|
|
+ );
|
|
|
+ if (index === -1) {
|
|
|
+ this.selectedDates.push(date);
|
|
|
+ } else {
|
|
|
+ this.selectedDates.splice(index, 1);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ isSelected(date) {
|
|
|
+ const dateStr = date.toISOString().split('T')[0];
|
|
|
+ return this.selectedDates.some(
|
|
|
+ (d) => d.toISOString().split('T')[0] === dateStr
|
|
|
+ );
|
|
|
+ },
|
|
|
+ formatDate(date) {
|
|
|
+ return date.toISOString().split('T')[0];
|
|
|
+ },
|
|
|
+ removeDate(index) {
|
|
|
+ this.selectedDates.splice(index, 1);
|
|
|
+ },
|
|
|
+ lunarDate(date) {
|
|
|
+ const lunar = solarToLunar(
|
|
|
+ date.getFullYear(),
|
|
|
+ date.getMonth() + 1,
|
|
|
+ date.getDate()
|
|
|
+ );
|
|
|
+ return lunar.lunarDay === 1
|
|
|
+ ? lunar.lunarMonthName + '月'
|
|
|
+ : lunar.lunarDayName; // 显示农历(初一显示月份)
|
|
|
+ },
|
|
|
+
|
|
|
+ /* 刷新表格 */
|
|
|
+ reload(where = {}) {
|
|
|
+ this.$refs.table.reload({ page: 1, where });
|
|
|
+ },
|
|
|
+
|
|
|
+ /* 获取工厂 */
|
|
|
+ async getFactory() {
|
|
|
+ const { list } = await getFactoryarea({
|
|
|
+ pageNum: 1,
|
|
|
+ size: 999,
|
|
|
+ type: 1,
|
|
|
+ enable: 1
|
|
|
+ });
|
|
|
+ this.factoriesList = list || [];
|
|
|
+ },
|
|
|
+ /* 获取班组 */
|
|
|
+ async getTeam() {
|
|
|
+ const { list } = await getteampage({
|
|
|
+ pageNum: 1,
|
|
|
+ size: 999,
|
|
|
+ enable: 1,
|
|
|
+ factoryId: this.form.factoriesId
|
|
|
+ });
|
|
|
+ this.teamList = list || [];
|
|
|
+ },
|
|
|
+ /* 获取产线 */
|
|
|
+ async getProductionLine() {
|
|
|
+ const { list } = await getFactoryarea({
|
|
|
+ pageNum: 1,
|
|
|
+ size: 999,
|
|
|
+ type: 4
|
|
|
+ });
|
|
|
+ this.productionLineList =
|
|
|
+ list.filter((item) => item.factoryId == this.form.factoriesId) || [];
|
|
|
+ },
|
|
|
+ change_factoryId() {
|
|
|
+ this.form.teamId = '';
|
|
|
+ this.form.productionLineId = '';
|
|
|
+ this.form.productionLineName = '';
|
|
|
+ this.form.teamName = '';
|
|
|
+ this.getTeam();
|
|
|
+ this.getProductionLine();
|
|
|
+ },
|
|
|
+ teamChange(item) {
|
|
|
+ this.form.teamName = item.name;
|
|
|
+ this.form.workCenterId = item.workCenterIds?.[0];
|
|
|
+ this.form.workCenterName = item.workCenterNames;
|
|
|
+ },
|
|
|
+ changeTime(row, index, parentIndex, type) {
|
|
|
+ if (type == 'startTime') {
|
|
|
+ this.$set(this.list[parentIndex].list[index], 'endTime', '');
|
|
|
+ }
|
|
|
+ if (type == 'endTime') {
|
|
|
+ if (!row.startTime) {
|
|
|
+ this.$set(this.list[parentIndex].list[index], 'endTime', '');
|
|
|
+ this.$message.error('请先选择开始时间');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ console.log(this.list[parentIndex], 'this.list[parentIndex][index]');
|
|
|
+ this.removeFormtime(index, parentIndex, row);
|
|
|
+ if (row.startTime && row.endTime) {
|
|
|
+ let val =
|
|
|
+ (new Date('2025-01-01 ' + row.endTime).getTime() -
|
|
|
+ new Date('2025-01-01 ' + row.startTime).getTime()) /
|
|
|
+ 60000;
|
|
|
+
|
|
|
+ this.$set(this.list[parentIndex].list[index], 'totalDuration', val);
|
|
|
+ } else {
|
|
|
+ this.$set(this.list[parentIndex].list[index], 'totalDuration', 0);
|
|
|
+ }
|
|
|
+ // this.setFormtime();
|
|
|
+ },
|
|
|
+ removeFormtime(i, parentIndex, row) {
|
|
|
+ let indexs = [];
|
|
|
+ //找到日期相同的并且在这条数据之后的
|
|
|
+ this.list[parentIndex].list.forEach((item, index) => {
|
|
|
+ if (i < index && row.dayDate == item.dayDate) {
|
|
|
+ indexs.push(index);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ if (indexs.length) {
|
|
|
+ this.list[parentIndex].list.splice(i + 1, indexs.length);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ setFormtime() {
|
|
|
+ if (this.form.list?.length) {
|
|
|
+ this.form.attendanceStartTime = this.form.list[0].startTime;
|
|
|
+ this.form.attendanceEndTime =
|
|
|
+ this.form.list[this.form.list.length - 1].endTime;
|
|
|
+ this.form.totalWorkingMinutes = 0;
|
|
|
+ this.form.restDurationMinutes = 0;
|
|
|
+ this.form.list.forEach((v) => {
|
|
|
+ if (v.timeType == '1') {
|
|
|
+ this.form.totalWorkingMinutes += v.totalDuration;
|
|
|
+ } else {
|
|
|
+ this.form.restDurationMinutes += v.totalDuration;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ async selectProductionShiftList() {
|
|
|
+ let data = await selectProductionShiftList(this.productionShift);
|
|
|
+ console.log(this.selectedDates, 'data');
|
|
|
+ this.list = data.map((item, index) => {
|
|
|
+ let dataValue = item.list.map((listItem, _index) => {
|
|
|
+ return {
|
|
|
+ key: index + '' + _index,
|
|
|
+ parentKey: index,
|
|
|
+ dayDate: '',
|
|
|
+ productionLineName: this.form.productionLineName,
|
|
|
+ productionLineId: this.form.productionLineId,
|
|
|
+ workCenterName: this.form.workCenterName,
|
|
|
+ workCenterId: this.form.workCenterId,
|
|
|
+ productionShift: item.shiftName,
|
|
|
+ dutyName: listItem.dutyName,
|
|
|
+ timeType: listItem.timeType,
|
|
|
+ startTime: listItem.startTime,
|
|
|
+ endTime: listItem.endTime,
|
|
|
+ totalDuration: listItem.totalDuration,
|
|
|
+ updateUserName: item.updateUserName,
|
|
|
+ updateTime: item.updateTime,
|
|
|
+ remark: listItem.remark
|
|
|
+ };
|
|
|
+ });
|
|
|
+ let list = [];
|
|
|
+ this.selectedDates.forEach((date) => {
|
|
|
+ list.push(
|
|
|
+ ...JSON.parse(
|
|
|
+ JSON.stringify(
|
|
|
+ dataValue.map((dataValueItem) => {
|
|
|
+ dataValueItem.dayDate = dayjs(date).format('YYYY-MM-DD');
|
|
|
+ dataValueItem.key =
|
|
|
+ dayjs(date).format('YYYY-MM-DD') + dataValueItem.key;
|
|
|
+ return dataValueItem;
|
|
|
+ })
|
|
|
+ )
|
|
|
+ )
|
|
|
+ );
|
|
|
+ });
|
|
|
+ return {
|
|
|
+ shiftName: item.shiftName,
|
|
|
+ key: index,
|
|
|
+ list
|
|
|
+ };
|
|
|
+ });
|
|
|
+
|
|
|
+ console.log(data, 'dasda');
|
|
|
+ },
|
|
|
+ // 单击获取id
|
|
|
+ cellClick(row) {
|
|
|
+ this.current = row;
|
|
|
+ this.radio = row.key;
|
|
|
+ },
|
|
|
+ save() {},
|
|
|
+ remove(row) {
|
|
|
+ del(row).then((res) => {
|
|
|
+ this.$message.success('删除成功!');
|
|
|
+ this.reload();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+ :deep(.el-link--inner) {
|
|
|
+ margin-left: 0px !important;
|
|
|
+ }
|
|
|
+
|
|
|
+ .sys-organization-list {
|
|
|
+ height: calc(100vh - 264px);
|
|
|
+ box-sizing: border-box;
|
|
|
+ border-width: 1px;
|
|
|
+ border-style: solid;
|
|
|
+ overflow: auto;
|
|
|
+ }
|
|
|
+
|
|
|
+ .sys-organization-list :deep(.el-tree-node__content) {
|
|
|
+ height: 40px;
|
|
|
+
|
|
|
+ & > .el-tree-node__expand-icon {
|
|
|
+ margin-left: 10px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ :deep(.el-calendar__body) {
|
|
|
+ padding: 0;
|
|
|
+ }
|
|
|
+ .calendar-day {
|
|
|
+ height: 100%;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+ .selected-date {
|
|
|
+ background: rgba($color: #409eff, $alpha: 0.2);
|
|
|
+ }
|
|
|
+ .selected-dates {
|
|
|
+ margin-top: 20px;
|
|
|
+ }
|
|
|
+ .calendar-container {
|
|
|
+ width: 480px;
|
|
|
+ height: 350px;
|
|
|
+ }
|
|
|
+ :deep(.el-calendar-day) {
|
|
|
+ padding: 0;
|
|
|
+ height: 40px;
|
|
|
+ }
|
|
|
+ :deep(.el-calendar-table)th:nth-last-child(-n + 2) {
|
|
|
+ color: #f56c6c; /* 深色文字 */
|
|
|
+ }
|
|
|
+ :deep(.el-calendar-table)td:nth-last-child(-n + 2) {
|
|
|
+ .datetext {
|
|
|
+ color: #f56c6c; /* 深色文字 */
|
|
|
+ }
|
|
|
+ }
|
|
|
+ :deep(.el-calendar-table)td.is-today {
|
|
|
+ color: #409eff !important; /* 深色文字 */
|
|
|
+ }
|
|
|
+ .lunar-date {
|
|
|
+ font-size: 10px;
|
|
|
+ }
|
|
|
+</style>
|