<template>
  <div class="customer-css">
    <!--  菜单按钮区域  -->
    <fieldset class="customer-field" style="width: 675px; padding: 0.35em 0.75em 0.425em;">
      <legend>菜单</legend>
      <el-form :inline="true" label-position="top" label-width="100px" style="">
        <el-form-item :label="''">
          <el-button type="primary" class="customer-bun-mid"
                     style="margin-left: 10px; width: 60px;  margin-bottom: 5px;">列表
          </el-button>
        </el-form-item>
        <el-form-item :label="''">
          <el-button type="primary" @click="refreshPageTables()" class="customer-bun-mid"
                     style="margin-left: 10px;  margin-bottom: 5px;">查询
          </el-button>
        </el-form-item>
        <el-form-item :label="''">
          <el-button type="primary" @click="switchOperatorModal(0)" class="customer-bun-mid"
                     style="margin-left: 10px;  margin-bottom: 5px;">报工
          </el-button>
        </el-form-item>
        <el-form-item :label="''">
          <el-button type="primary" @click="switchOperatorModal(1)" class="customer-bun-mid"
                     style="margin-left: 10px;  margin-bottom: 5px;">FQC报工
          </el-button>
        </el-form-item>
        <el-form-item :label="''">
          <el-button type="primary" @click="switchOperatorModal(2)" class="customer-bun-mid"
                     style="margin-left: 10px;  margin-bottom: 5px;">返工重检
          </el-button>
        </el-form-item>
        <el-form-item :label="''">
          <el-button type="primary" @click="switchOperatorModal(4)" class="customer-bun-mid"
                     style="margin-left: 10px;  margin-bottom: 5px;">换包装
          </el-button>
        </el-form-item>
        <el-form-item :label="''">
          <el-button type="primary" @click="switchOperatorModal(3)" class="customer-bun-mid"
                     style="margin-left: 10px; margin-bottom: 5px;">FQC分卷
          </el-button>
        </el-form-item>
      </el-form>
    </fieldset>
    <!--  查询时间和产品  -->
    <el-form :inline="true" label-position="top" label-width="100px" style="margin-top: 5px;">
      <el-form-item :label="'工厂编号:'">
        <el-input v-model="searchData.site" style="width: 85px"></el-input>
      </el-form-item>
      <el-form-item :label="'机台编号:'">
        <el-input v-model="searchData.resourceId" style="width: 110px"></el-input>
      </el-form-item>
      <el-form-item :label="'计划开工时间:'">
        <el-date-picker class="el-time-width"
                        style=""
                        v-model="searchData.planStartTime1"
                        value-format="yyyy-MM-dd">
        </el-date-picker>
      </el-form-item>
      <el-form-item :label="''">
        <el-date-picker class="el-time-width"
                        style="margin-top: 20px;"
                        v-model="searchData.planStartTime2"
                        format="yyyy-MM-dd"
                        value-format="yyyy-MM-dd"
                        placeholder="">
        </el-date-picker>
      </el-form-item>
      <el-form-item :label="'生产订单号:'">
        <el-input v-model="searchData.orderNo" style="width: 120px" @keyup.enter.native="refreshPageTables"></el-input>
      </el-form-item>
      <el-form-item :label="'派工单号:'">
        <el-input v-model="searchData.seqNo" style="width: 120px" @keyup.enter.native="refreshPageTables"></el-input>
      </el-form-item>
      <el-form-item :label="''" style="margin-left: -5px;">
        <el-checkbox style="margin-top: 20px;" true-label="Y" false-label="N" v-model="searchData.closedFlag">显示已结束派工单
        </el-checkbox>
      </el-form-item>
    </el-form>

    <!-- 右键操作菜单  -->
    <el-form :inline="true">
      <el-form-item label="生产工单列表">

        <el-dropdown trigger="click" style="margin-top: 3px" class="customer-dropdown" @command="handleCommand">
          <el-button type="primary" @click="menuButtonFlag">
            主菜单<i class="el-icon-arrow-down el-icon--right"></i>
          </el-button>
          <el-dropdown-menu v-show="menuShow" slot="dropdown">
            <el-dropdown-item class="customer-li" command="0" :disabled="menuButton.prdButton"><span>生产订单</span>
            </el-dropdown-item>
            <hr width="95%"/>
            <el-dropdown-item class="customer-li" command="1" :disabled="menuButton.closedButton">关闭</el-dropdown-item>
            <el-dropdown-item class="customer-li" command="2" :disabled="menuButton.openButton">打开
            </el-dropdown-item>
            <hr width="95%"/>
            <el-dropdown-item class="customer-li" command="3" :disabled="menuButton.pauseButton">暂停</el-dropdown-item>
            <el-dropdown-item class="customer-li" command="4" :disabled="menuButton.openReverseButton">重新开工
            </el-dropdown-item>
            <hr width="95%"/>
            <el-dropdown-item class="customer-li" command="5" :disabled="menuButton.createRecheckButton">创建重检派工单
            </el-dropdown-item>
            <hr width="95%"/>
            <el-dropdown-item class="customer-li" command="6" :disabled="menuButton.canceledAllPrdButton">取消所有派工单操作
            </el-dropdown-item>
            <hr width="95%"/>
            <el-dropdown-item class="customer-li" command="7" :disabled="menuButton.costRollUpFlagButton">生产已排料
            </el-dropdown-item>
            <el-dropdown-item class="customer-li" command="8" :disabled="menuButton.canceledCostRollUpFlagButton">
              取消生产已排料
            </el-dropdown-item>
            <hr width="95%"/>
            <el-dropdown-item class="customer-li" command="9" :disabled="menuButton.manualFlagButton">刀模已发
            </el-dropdown-item>
            <el-dropdown-item class="customer-li" command="10" :disabled="menuButton.canceledManualFlagButton">取消刀模已发
            </el-dropdown-item>
            <hr width="95%"/>
            <el-dropdown-item class="customer-li" command="11" :disabled="menuButton.repairSOFlagButton">印版已发
            </el-dropdown-item>
            <el-dropdown-item class="customer-li" command="12" :disabled="menuButton.canceledRepairSOFlagButton">取消印版已发
            </el-dropdown-item>
            <hr width="95%"/>
          </el-dropdown-menu>
        </el-dropdown>
      </el-form-item>
    </el-form>
    <!--  工单主表信息  -->
    <el-main style="margin-left: -20px; margin-top: -20px; width: 104%;">
      <el-table @row-click="setCurrentRow"
                :height="height"
                highlight-current-row
                :data="produceScheduleList"
                border
                v-loading="dataListLoading"
                style="width: 100%;">
        <el-table-column
          v-for="(item,index) in columnProduceScheduleArray" :key="index"
          :sortable="item.columnSortable"
          :prop="item.columnProp"
          :header-align="item.headerAlign"
          :show-overflow-tooltip="item.showOverflowTooltip"
          :align="item.align"
          :fixed="item.fixed"
          :width="item.columnWidth"
          :label="item.columnLabel">
          <template slot-scope="scope">
            <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span>
            <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
                                               style="width: 100px; height: 80px"/></span>
          </template>
        </el-table-column>
      </el-table>
    </el-main>

    <!-- 切换操作员 -->
    <comSwitchOperator ref="comSwitchOperator" :close-on-click-modal="false"
                       :visible.sync="showOperatorFlag"
                       @initOperatorData="initOperatorData"
                       @notInitOperatorData="notInitOperatorData">

    </comSwitchOperator>

    <!-- 正常报工的组件 -->
    <comProduceReportNormal :close-on-click-modal="false"
                            :visible.sync="showReportFlag" ref="comProduceReportNormal">

    </comProduceReportNormal>

    <!-- 正常的结束派工单组件 -->
    <comFinishSchedule :close-on-click-modal="false"
                       :visible.sync="showFinishScheduleFlag" ref="comFinishSchedule"
                       @processFinishScheduleOperation="processFinishScheduleOperation">

    </comFinishSchedule>
    <!-- fqc报工的组件 -->
    <fqcProduceReportNormal :close-on-click-modal="false"
                            :visible.sync="fqcShowReportFlag" ref="fqcProduceReportNormal">
    </fqcProduceReportNormal>

    <!-- 返工重检   -->
    <reworkInspectReport :close-on-click-modal="false"
                         :visible.sync="reworkShowReportFlag" ref="reworkInspectReport"></reworkInspectReport>
    <!-- FQC分卷   -->
    <fqcSplitRollReport :close-on-click-modal="false"
                        :visible.sync="fqcRollShowReportFlag" ref="fqcSplitRollReport"></fqcSplitRollReport>
    <!-- 创建重检派工单   -->
    <createRecheck ref="createRecheck"></createRecheck>
    <!-- 换包装   -->
    <changePackaging :close-on-click-modal="false"
                     :visible.sync="changePackagingFlag" ref="changePackaging"></changePackaging>
  </div>
</template>

<script>

import {
  getProduceScheduleList,
  reportCheck,
  getUserSpecialSecurity,
  closeOrOpenProduceOrder,
  pauseOrOpenProduceOrder,
  costRollUpProduceOrder,
  manualProduceOrder,
  repairSOFlagProduceOrder,
  workbenchCancelallops
} from '@/api/yieldReport/produce_order.js';

/*引入组件*/
import comSwitchOperator from "./com_switch_operator";/*切换操作员*/
import comProduceReportNormal from "./com_produce_report_normal";/* 报工的组件*/
import comFinishSchedule from "./com_finish_schedule";/*结束派工的组件*/
import fqcProduceReportNormal from "./otherReport/fqc_produce_report_normal";/*结束派工的组件*/
import reworkInspectReport from "./otherReport/rework_inspect_report";/*结束派工的组件*/
import fqcSplitRollReport from "./otherReport/fqc_split_roll_report";/*结束派工的组件*/
import changePackaging from "./otherReport/change_packaging";/*结束派工的组件*/
import createRecheck from './com_create_recheck'

export default {
  data() {
    return {
      height: 800,
      menuShow:false,
      showOperatorFlag: false,
      showReportFlag: false,
      fqcShowReportFlag: false,
      reworkShowReportFlag: false,
      fqcRollShowReportFlag: false,
      showFinishScheduleFlag: false,
      changePackagingFlag: false,
      searchData: {
        site: this.$store.state.user.site,
        resourceId: '',
        orderNo: '',
        seqNo: '',
        planStartTime1: '',
        planStartTime2: this.dayjs(new Date()).format('YYYY-MM-DD'),
        closedFlag: 'N',
        status: 1,
        username: this.$store.state.user.name,
        searchFlag: false
      },
      currentRow: {},
      operatorData: {
        site: this.$store.state.user.site,
        username: this.$store.state.user.name,
        operatorId: '',
        operatorName: '',
        status: '',
        showFlag: false
      },
      produceScheduleList: [],
      dataListLoading: false,
      buttons: {
        search: '查询',
      },
      columnProduceScheduleArray: [
        {
          userId: this.$store.state.user.name,
          functionId: 5302,
          serialNumber: '5302ProducePlanStartTime',
          tableId: "5302Produce",
          tableName: "待生产工单",
          columnProp: "planStartTime",
          headerAlign: "center",
          align: "center",
          columnLabel: "计划开工时间",
          columnWidth: 125,
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5302,
          serialNumber: '5302ProducePlanFinishTime',
          tableId: "5302Produce",
          tableName: "待生产工单",
          columnProp: "planFinishTime",
          headerAlign: "center",
          align: "center",
          columnLabel: "计划完工时间",
          columnWidth: 125,
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5302,
          serialNumber: '5302ProduceTimeRequired',
          tableId: "5302Produce",
          tableName: "待生产工单",
          columnProp: "timeRequired",
          headerAlign: "center",
          align: "center",
          columnLabel: "需求时间",
          columnWidth: 60,
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5302,
          serialNumber: '5302ProduceTimeReported',
          tableId: "5302Produce",
          tableName: "待生产工单",
          columnProp: "timeReported",
          headerAlign: "center",
          align: "center",
          columnLabel: "已报告时间",
          columnWidth: 70,
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5302,
          serialNumber: '5302ProduceOrderNo',
          tableId: "5302Produce",
          tableName: "待生产工单",
          columnProp: "orderNo",
          headerAlign: "center",
          align: "center",
          columnLabel: "生产订单号",
          columnWidth: 70,
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5302,
          serialNumber: '5302ProduceItemNo',
          tableId: "5302Produce",
          tableName: "待生产工单",
          columnProp: "itemNo",
          headerAlign: "center",
          align: "center",
          columnLabel: "工序号",
          columnWidth: 50,
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5302,
          serialNumber: '5302ProduceItemDesc',
          tableId: "5302Produce",
          tableName: "待生产工单",
          columnProp: "itemDesc",
          headerAlign: "center",
          align: "center",
          columnLabel: "工序描述",
          columnWidth: 80,
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5302,
          serialNumber: '5302ProduceResourceId',
          tableId: "5302Produce",
          tableName: "待生产工单",
          columnProp: "resourceId",
          headerAlign: "center",
          align: "center",
          columnLabel: "机台",
          columnWidth: 60,
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5302,
          serialNumber: '5302ProduceQtyRequired',
          tableId: "5302Produce",
          tableName: "待生产工单",
          columnProp: "qtyRequired",
          headerAlign: "center",
          align: "center",
          columnLabel: "需求数量",
          columnWidth: 60,
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5302,
          serialNumber: '5302ProduceQtyReported',
          tableId: "5302Produce",
          tableName: "待生产工单",
          columnProp: "qtyReported",
          headerAlign: "center",
          align: "center",
          columnLabel: "已报告数量",
          columnWidth: 70,
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5302,
          serialNumber: '5302ProduceNeedDate',
          tableId: "5302Produce",
          tableName: "待生产工单",
          columnProp: "needDate",
          headerAlign: "center",
          align: "center",
          columnLabel: "生产订单要求完工日期",
          columnWidth: 130,
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5302,
          serialNumber: '5302ProduceClosedFlag',
          tableId: "5302Produce",
          tableName: "待生产工单",
          columnProp: "closedFlag",
          headerAlign: "center",
          align: "center",
          columnLabel: "已关闭",
          columnWidth: 50,
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5302,
          serialNumber: '5302ProducePartNo',
          tableId: "5302Produce",
          tableName: "待生产工单",
          columnProp: "partNo",
          headerAlign: "center",
          align: "center",
          columnLabel: "产品编码",
          columnWidth: 110,
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5302,
          serialNumber: '5302ProducePartDesc',
          tableId: "5302Produce",
          tableName: "待生产工单",
          columnProp: "partDesc",
          headerAlign: "center",
          align: "center",
          columnLabel: "产品名称",
          columnWidth: 180,
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5302,
          serialNumber: '5302ProduceSpec',
          tableId: "5302Produce",
          tableName: "待生产工单",
          columnProp: "spec",
          headerAlign: "center",
          align: "center",
          columnLabel: "规格型号",
          columnWidth: 80,
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5302,
          serialNumber: '5302ProduceSeqNo',
          tableId: "5302Produce",
          tableName: "待生产工单",
          columnProp: "seqNo",
          headerAlign: "center",
          align: "center",
          columnLabel: "次序号",
          columnWidth: 80,
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5302,
          serialNumber: '5302ProduceQtyApprove',
          tableId: "5302Produce",
          tableName: "待生产工单",
          columnProp: "qtyApprove",
          headerAlign: "center",
          align: "center",
          columnLabel: "合格数量",
          columnWidth: 80,
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5302,
          serialNumber: '5302ProduceBarcodeId',
          tableId: "5302Produce",
          tableName: "条形码",
          columnProp: "barcodeId",
          headerAlign: "center",
          align: "center",
          columnLabel: "条形码",
          columnWidth: 80,
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5302,
          serialNumber: '5302ProduceRemark',
          tableId: "5302Produce",
          tableName: "待生产工单",
          columnProp: "remark",
          headerAlign: "center",
          align: "center",
          columnLabel: "备注",
          columnWidth: 80,
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5302,
          serialNumber: '5302ProduceCrewSize',
          tableId: "5302Produce",
          tableName: "待生产工单",
          columnProp: "crewSize",
          headerAlign: "center",
          align: "center",
          columnLabel: "操作工人数",
          columnWidth: 80,
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5302,
          serialNumber: '5302ProduceQtyScrapt',
          tableId: "5302Produce",
          tableName: "待生产工单",
          columnProp: "qtyScrapt",
          headerAlign: "center",
          align: "center",
          columnLabel: "报废数量",
          columnWidth: 80,
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5302,
          serialNumber: '5302ProduceOutWorkFlag',
          tableId: "5302Produce",
          tableName: "待生产工单",
          columnProp: "outWorkFlag",
          headerAlign: "center",
          align: "center",
          columnLabel: "是否外协",
          columnWidth: 80,
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5302,
          serialNumber: '5302ProduceScheduledDate',
          tableId: "5302Produce",
          tableName: "待生产工单",
          columnProp: "scheduledDate",
          headerAlign: "center",
          align: "center",
          columnLabel: "排产日期",
          columnWidth: 80,
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5302,
          serialNumber: '5302ProduceScheduledSeqNo',
          tableId: "5302Produce",
          tableName: "待生产工单",
          columnProp: "scheduledSeqNo",
          headerAlign: "center",
          align: "center",
          columnLabel: "次序号",
          columnWidth: 80,
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5302,
          serialNumber: '5302ProduceShiftNo',
          tableId: "5302Produce",
          tableName: "待生产工单",
          columnProp: "shiftNo",
          headerAlign: "center",
          align: "center",
          columnLabel: "班次",
          columnWidth: 80,
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5302,
          serialNumber: '5302ProduceMachSetupTime',
          tableId: "5302Produce",
          tableName: "待生产工单",
          columnProp: "machSetupTime",
          headerAlign: "center",
          align: "center",
          columnLabel: "调机时间",
          columnWidth: 80,
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5302,
          serialNumber: '5302ProduceMachRunFactor',
          tableId: "5302Produce",
          tableName: "待生产工单",
          columnProp: "machRunFactor",
          headerAlign: "center",
          align: "center",
          columnLabel: "单位产出",
          columnWidth: 80,
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5302,
          serialNumber: '5302ProduceFactorUnit',
          tableId: "5302Produce",
          tableName: "待生产工单",
          columnProp: "factorUnit",
          headerAlign: "center",
          align: "center",
          columnLabel: "产出单位",
          columnWidth: 80,
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5302,
          serialNumber: '5302ProduceEfficiency',
          tableId: "5302Produce",
          tableName: "待生产工单",
          columnProp: "efficiency",
          headerAlign: "center",
          align: "center",
          columnLabel: "效率",
          columnWidth: 80,
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5302,
          serialNumber: '5302ProduceNextItemNo',
          tableId: "5302Produce",
          tableName: "待生产工单",
          columnProp: "nextItemNo",
          headerAlign: "center",
          align: "center",
          columnLabel: "下道工序号",
          columnWidth: 80,
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5302,
          serialNumber: '5302ProduceNextItemDesc',
          tableId: "5302Produce",
          tableName: "待生产工单",
          columnProp: "nextItemDesc",
          headerAlign: "center",
          align: "center",
          columnLabel: "下道工序名称",
          columnWidth: 80,
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5302,
          serialNumber: '5302ProducePreItemNo',
          tableId: "5302Produce",
          tableName: "待生产工单",
          columnProp: "preItemNo",
          headerAlign: "center",
          align: "center",
          columnLabel: "前道工序号",
          columnWidth: 80,
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5302,
          serialNumber: '5302ProducePreItemDesc',
          tableId: "5302Produce",
          tableName: "待生产工单",
          columnProp: "preItemDesc",
          headerAlign: "center",
          align: "center",
          columnLabel: "前道工序名称",
          columnWidth: 80,
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5302,
          serialNumber: '5302ProduceSite',
          tableId: "5302Produce",
          tableName: "待生产工单",
          columnProp: "site",
          headerAlign: "center",
          align: "center",
          columnLabel: "工厂编号",
          columnWidth: 80,
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5302,
          serialNumber: '5302ProduceParkFlag',
          tableId: "5302Produce",
          tableName: "待生产工单",
          columnProp: "parkFlag",
          headerAlign: "center",
          align: "center",
          columnLabel: "暂停",
          columnWidth: 80,
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5302,
          serialNumber: '5302ProduceCustomerName',
          tableId: "5302Produce",
          tableName: "待生产工单",
          columnProp: "customerName",
          headerAlign: "center",
          align: "center",
          columnLabel: "客户名称",
          columnWidth: 80,
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5302,
          serialNumber: '5302ProduceCustPartNo',
          tableId: "5302Produce",
          tableName: "待生产工单",
          columnProp: "custPartNo",
          headerAlign: "center",
          align: "center",
          columnLabel: "客户产品料号",
          columnWidth: 80,
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5302,
          serialNumber: '5302ProduceQtyRequiredOriginal',
          tableId: "5302Produce",
          tableName: "待生产工单",
          columnProp: "qtyRequiredOriginal",
          headerAlign: "center",
          align: "center",
          columnLabel: "原始派工单需求数量",
          columnWidth: 80,
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5302,
          serialNumber: '5302ProduceClosedBy',
          tableId: "5302Produce",
          tableName: "待生产工单",
          columnProp: "closedBy",
          headerAlign: "center",
          align: "center",
          columnLabel: "关闭人",
          columnWidth: 80,
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5302,
          serialNumber: '5302ProduceClosedDate',
          tableId: "5302Produce",
          tableName: "待生产工单",
          columnProp: "closedDate",
          headerAlign: "center",
          align: "center",
          columnLabel: "关闭日期",
          columnWidth: 80,
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5302,
          serialNumber: '5302ProduceCostRollUpFlag',
          tableId: "5302Produce",
          tableName: "待生产工单",
          columnProp: "costRollUpFlag",
          headerAlign: "center",
          align: "center",
          columnLabel: "已排料",
          columnWidth: 80,
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5302,
          serialNumber: '5302ProduceManualFlag',
          tableId: "5302Produce",
          tableName: "待生产工单",
          columnProp: "manualFlag",
          headerAlign: "center",
          align: "center",
          columnLabel: "刀模已发",
          columnWidth: 80,
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5302,
          serialNumber: '5302ProduceRepairSOFlag',
          tableId: "5302Produce",
          tableName: "待生产工单",
          columnProp: "repairSOFlag",
          headerAlign: "center",
          align: "center",
          columnLabel: "印版已发",
          columnWidth: 80,
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: false
        }
      ],
      menuButton: {
        prdButton: true,
        openButton: true,
        closedButton: true,
        pauseButton: true,
        openReverseButton: true,
        costRollUpFlagButton: true,
        canceledCostRollUpFlagButton: false,
        manualFlagButton: false,
        canceledManualFlagButton: false,
        repairSOFlagButton: false,
        canceledRepairSOFlagButton: false,
        canceledAllPrdButton: false,
        createRecheckButton: false,
      }
    }
  },
  components: {
    comSwitchOperator,/*切换用户的组件*/
    comProduceReportNormal,/*报工页面的组件*/
    comFinishSchedule,/*结束派工单的组件*/
    fqcProduceReportNormal, /*FQC报工*/
    reworkInspectReport, /*返工重建*/
    fqcSplitRollReport, /*FQC分卷*/
    createRecheck,/*创建重检派工单*/
    changePackaging, /*换包装*/

  },
  mounted() {
    this.$nextTick(() => {
      this.height = window.innerHeight - 235;
    })
  },
  methods: {
    // 控制是否显示功能
    menuButtonFlag() {
      this.menuShow = false
      if (JSON.stringify(this.currentRow) == '{}') {
        this.menuButton.prdButton = true
        this.menuButton.openButton = true
        this.menuButton.closedButton = true
        this.menuButton.pauseButton = true
        this.menuButton.costRollUpFlagButton = true
        this.menuButton.canceledCostRollUpFlagButton = true
        this.menuButton.manualFlagButton = true
        this.menuButton.canceledManualFlagButton = true
        this.menuButton.repairSOFlagButton = true
        this.menuButton.canceledRepairSOFlagButton = true
        this.menuButton.canceledAllPrdButton = true
        this.menuButton.createRecheckButton = true
      } else {
        let currentRow = null
        // 获取订单信息
        let searchOrder = {
          orderNo: this.currentRow.orderNo,
          seqNo: this.currentRow.seqNo,
          site: this.currentRow.site,
          username: this.$store.state.user.name,
          searchFlag: true
        }
        currentRow = getProduceScheduleList(searchOrder).then(({data}) => {
          //设置查询数据
          currentRow = data.rows[0];
          if (currentRow == null){
            return;
          }
          this.menuButton.canceledAllPrdButton = false
          this.menuButton.createRecheckButton = false
          // 判断是否具有该页面权限

          this.menuButton.prdButton = false
          // 关闭按钮
          if (currentRow.closedFlag == 'N') {
            let data = {
              userSpecialSecurityNo: 230,
              username: this.$store.state.user.name,
            }
            getUserSpecialSecurity(data).then(({data}) => {
              if (data.userSpecialSecurity == 'Y') {
                this.menuButton.closedButton = false
              } else {
                this.menuButton.closedButton = true
              }
            })
          } else {
            this.menuButton.closedButton = true
          }
          // 打开按钮
          if (currentRow.closedFlag == 'Y') {
            let data = {
              userSpecialSecurityNo: 231,
              username: this.$store.state.user.name,
            }
            getUserSpecialSecurity(data).then(({data}) => {
              if (data.userSpecialSecurity == 'Y') {
                this.menuButton.openButton = false
              } else {
                this.menuButton.openButton = true
              }
            })
          } else {
            this.menuButton.openButton = true
          }
          // 暂停
          if (currentRow.closedFlag == 'N' && currentRow.parkFlag == 'N') {
            this.menuButton.pauseButton = false
            this.menuButton.openReverseButton = true
          }
          // 重开
          if (currentRow.closedFlag == 'N' & currentRow.parkFlag == 'Y') {
            menuButton.openReverseButton = false
            menuButton.pauseButton = true
          }
          //  生产排料
          if (currentRow.costRollUpFlag == 'N') {
            // 获取特殊权限
            let data = {
              userSpecialSecurityNo: 238,
              username: this.$store.state.user.name,
            }
            getUserSpecialSecurity(data).then(({data}) => {
              if (data.userSpecialSecurity == 'Y') {
                this.menuButton.costRollUpFlagButton = false
              } else {
                this.menuButton.costRollUpFlagButton = true
              }
            })
          } else {
            this.menuButton.costRollUpFlagButton = true
          }
          //  取消生产排料
          if (currentRow.costRollUpFlag == 'Y') {
            // 获取特殊权限
            let data = {
              userSpecialSecurityNo: 238,
              username: this.$store.state.user.name,
            }
            getUserSpecialSecurity(data).then(({data}) => {
              if (data.userSpecialSecurity == 'Y') {
                this.menuButton.canceledCostRollUpFlagButton = false
              } else {
                this.menuButton.canceledCostRollUpFlagButton = true
              }
            })
          } else {
            this.menuButton.canceledCostRollUpFlagButton = true
          }
          // 刀模已发 确认
          if (currentRow.manualFlag == 'N') {
            // 获取特殊权限
            let data = {
              userSpecialSecurityNo: 258,
              username: this.$store.state.user.name,
            }
            getUserSpecialSecurity(data).then(({data}) => {
              if (data.userSpecialSecurity == 'Y') {
                this.menuButton.manualFlagButton = false
              } else {
                this.menuButton.manualFlagButton = true
              }
            })
          } else {
            this.menuButton.manualFlagButton = true
          }
          // 刀模已发 取消
          if (currentRow.manualFlag == 'Y') {
            // 获取特殊权限
            let canceledAllPrdData = {
              userSpecialSecurityNo: 259,
              username: this.$store.state.user.name,
            }
            getUserSpecialSecurity(canceledAllPrdData).then(({data}) => {
              if (data.userSpecialSecurity == 'Y') {
                this.menuButton.canceledManualFlagButton = false
              } else {
                this.menuButton.canceledManualFlagButton = true
              }
            })
          } else {
            this.menuButton.canceledManualFlagButton = true
          }
          // 印版已发 确认
          if (currentRow.repairSOFlag == 'N') {
            // 获取特殊权限
            let data = {
              userSpecialSecurityNo: 259,
              username: this.$store.state.user.name,
            }
            getUserSpecialSecurity(data).then(({data}) => {
              if (data.userSpecialSecurity == 'Y') {
                this.menuButton.repairSOFlagButton = false
              } else {
                this.menuButton.repairSOFlagButton = true
              }
            })
          } else {
            this.menuButton.repairSOFlagButton = true
          }
          // 印版已发 取消
          if (currentRow.repairSOFlag == 'Y') {
            // 获取特殊权限
            let data = {
              userSpecialSecurityNo: 259,
              username: this.$store.state.user.name,
            }
            getUserSpecialSecurity(data).then(({data}) => {
              if (data.userSpecialSecurity == 'Y') {
                this.menuButton.canceledRepairSOFlagButton = false
              } else {
                this.menuButton.canceledRepairSOFlagButton = true
              }
            })
          } else {
            this.menuButton.canceledRepairSOFlagButton = true
          }
          this.menuShow=true
        });
      }
    },
    /*区分不同的菜单  调用不同的方法  调用不同的方法*/
    handleCommand(val) {
      //区分是哪一个方法调用
      //页面跳转
      if ('0' == val) {
        if (JSON.stringify(this.currentRow) == '{}') {
          this.$message.error('请先选择派工单!');
          return false;
        }
        this.$router.push({
          path: '/shopOrder-shopOrder/shopOrder',
          query: {
            order: this.currentRow.orderNo,
            site: this.currentRow.site,
            user: this.$store.state.user.name
          }
        })
      }
      // 关闭
      if ('1' == val) {
        //调用提示的方法
        this.$confirm(`确定要关闭当前派工单吗？`, `关闭派工单`, {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          let data = {
            username: this.$store.state.user.name,
            itemNo: this.currentRow.itemNo,
            site: this.currentRow.site,
            orderNo: this.currentRow.orderNo,
            seqNo: this.currentRow.seqNo,
            closedFlag: 'Y',
          }
          closeOrOpenProduceOrder(data).then(({data}) => {
            if (data.code == 0) {
              this.$message.success(data.msg)
            } else {
              this.$message.error(data.msg)
            }
          })
        });
      }
      // 打开
      if ('2' == val) {
        //调用提示的方法
        this.$confirm(`确定要打开当前派工单吗？`, `关闭派工单`, {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          let data = {
            username: this.$store.state.user.name,
            itemNo: this.currentRow.itemNo,
            site: this.currentRow.site,
            orderNo: this.currentRow.orderNo,
            seqNo: this.currentRow.seqNo,
            closedFlag: 'N',
          }
          closeOrOpenProduceOrder(data).then(({data}) => {
            if (data.code == 0) {
              this.$message.success(data.msg)
            } else {
              this.$message.error(data.msg)
            }
          })
        });
      }
      // 暂停
      if ('3' == val) {
        //调用提示的方法
        this.$confirm(`确定要暂停当前派工单吗？`, `关闭派工单`, {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          let data = {
            username: this.$store.state.user.name,
            itemNo: this.currentRow.itemNo,
            site: this.currentRow.site,
            orderNo: this.currentRow.orderNo,
            seqNo: this.currentRow.seqNo,
            parkFlag: 'Y',
          }
          pauseOrOpenProduceOrder(data).then(({data}) => {
            if (data.code == 0) {
              this.$message.success(data.msg)
            } else {
              this.$message.error(data.msg)
            }
          })
        });
      }
      // 重开
      if ('4' == val) {
        //调用提示的方法
        this.$confirm(`确定要重开当前派工单吗？`, `关闭派工单`, {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          let data = {
            username: this.$store.state.user.name,
            itemNo: this.currentRow.itemNo,
            site: this.currentRow.site,
            orderNo: this.currentRow.orderNo,
            seqNo: this.currentRow.seqNo,
            parkFlag: 'N',
          }
          pauseOrOpenProduceOrder(data).then(({data}) => {
            if (data.code == 0) {
              this.$message.success(data.msg)
            } else {
              this.$message.error(data.msg)
            }
          })
        });
      }
      // 创建重检派工单
      if ('5' == val) {
        this.$nextTick(() => {
          this.$refs.createRecheck.init(this.currentRow);
        });
      }
      // 取消所有派工单操作
      if ('6' == val) {
        //调用提示的方法
        this.$confirm(` 确定取消所有派工单操作`, `生产已排料`, {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          let data = {
            orderNo: this.currentRow.orderNo,
            itemNo: this.currentRow.itemNo,
            site: this.currentRow.site,
            seqNo: this.currentRow.seqNo,
          }
          workbenchCancelallops(data).then(({data}) => {
            if (data.code == 0) {
              this.$message.success(data.msg)
            } else {
              this.$message.warning(data.msg)
            }
          })
        })
      }
      // 生产已排料 确认
      if ('7' == val) {
        //调用提示的方法
        this.$confirm(` 确定该订单的料已排`, `生产已排料`, {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          let data = {
            username: this.$store.state.user.name,
            orderNo: this.currentRow.orderNo,
            costRollUpFlag: 'Y',
            site: this.currentRow.site,
            orderChangeStatus: "订单已排料",
          }
          costRollUpProduceOrder(data).then(({data}) => {
            if (data.code == 0) {
              this.$message.success(data.msg)
            } else {
              this.$message.warning(data.msg)
            }
          })

        })
      }
      // 生产已排料 取消
      if ('8' == val) {
        //调用提示的方法
        this.$confirm(` 确定要撤销该订单的排料？`, `撤销订单排料`, {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          let data = {
            username: this.$store.state.user.name,
            orderNo: this.currentRow.orderNo,
            costRollUpFlag: 'N',
            site: this.currentRow.site,
            orderChangeStatus: "撤销订单排料",
          }
          costRollUpProduceOrder(data).then(({data}) => {
            if (data.code == 0) {
              this.$message.success(data.msg)
            } else {
              this.$message.warning(data.msg)
            }
          })

        })
      }
      // 刀模 确认
      if ('9' == val) {
        this.$confirm(` 确定该订单的刀模已发？`, `刀模已发`, {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          let data = {
            username: this.$store.state.user.name,
            orderNo: this.currentRow.orderNo,
            manualFlag: 'Y',
            site: this.currentRow.site,
            orderChangeStatus: "订单刀模已发",
          }
          manualProduceOrder(data).then(({data}) => {
            if (data.code == 0) {
              this.$message.success(data.msg)
            } else {
              this.$message.warning(data.msg)
            }
          })

        })
      }
      // 刀模 取消
      if ('10' == val) {
        this.$confirm(` 确定要撤销该订单的刀模已发？`, `刀模已发`, {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          let data = {
            username: this.$store.state.user.name,
            orderNo: this.currentRow.orderNo,
            manualFlag: 'N',
            site: this.currentRow.site,
            orderChangeStatus: "撤销订单刀模已发",
          }
          manualProduceOrder(data).then(({data}) => {
            if (data.code == 0) {
              this.$message.success(data.msg)
            } else {
              this.$message.warning(data.msg)
            }
          })

        })
      }
      // 印版已发
      if ('11' == val) {
        this.$confirm(` 确定该订单的印版已发？`, `印版已发`, {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          let data = {
            username: this.$store.state.user.name,
            orderNo: this.currentRow.orderNo,
            repairSOFlag: 'Y',
            site: this.currentRow.site,
            orderChangeStatus: "订单印版已发",
          }
          repairSOFlagProduceOrder(data).then(({data}) => {
            if (data.code == 0) {
              this.$message.success(data.msg)
            } else {
              this.$message.warning(data.msg)
            }
          })

        })
      }
      // 印版已发 取消
      if ('12' == val) {
        this.$confirm(` 确定要撤销该订单的印版已发？`, `订单印版`, {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          let data = {
            username: this.$store.state.user.name,
            orderNo: this.currentRow.orderNo,
            repairSOFlag: 'N',
            site: this.currentRow.site,
            orderChangeStatus: "订单印版已发",
          }
          repairSOFlagProduceOrder(data).then(({data}) => {
            if (data.code == 0) {
              this.$message.success(data.msg)
            } else {
              this.$message.warning(data.msg)
            }
          })

        })
      }
    },
    // FQC 报工
    fqcReportModal() {
      //首先判断是否选择好派工单
      if (JSON.stringify(this.currentRow) == '{}') {
        this.$message.error('请先选择派工单!');
        return false;
      }
      //打开操作员切换功能
      this.fqcShowReportFlag = true;
      this.$nextTick(() => {
        this.$refs.fqcProduceReportNormal.init(this.currentRow.seqNo, this.operatorData);
      });
    },
    // FQC 分卷
    fqcSplitRollModal() {
      if (JSON.stringify(this.currentRow) == '{}') {
        this.$message.error('请先选择派工单!');
        return false;
      }
      //打开操作员切换功能
      this.fqcRollShowReportFlag = true;
      this.$nextTick(() => {
        this.$refs.fqcSplitRollReport.init(this.currentRow.seqNo, this.operatorData);
      });
    },
    // 返工重捡
    reworkInspectModal() {
      //首先判断是否选择好派工单
      if (JSON.stringify(this.currentRow) == '{}') {
        this.$message.error('请先选择派工单!');
        return false;
      }
      //打开操作员切换功能
      this.reworkShowReportFlag = true;
      this.$nextTick(() => {
        this.$refs.reworkInspectReport.init(this.currentRow.seqNo, this.operatorData);
      });
    },
    // 换包装
    changePackaging() {
      //首先判断是否选择好派工单
      if (JSON.stringify(this.currentRow) == '{}') {
        this.$message.error('请先选择派工单!');
        return false;
      }
      //打开操作员切换功能
      this.changePackagingFlag = true;
      this.$nextTick(() => {
        this.$refs.changePackaging.init(this.currentRow.seqNo, this.operatorData);
      });
    },
    /*查询派工单*/
    getProduceScheduleList() {
      //开始真的查询;
      this.searchData.searchFlag = true;
      getProduceScheduleList(this.searchData).then(({data}) => {
        //设置查询数据
        this.produceScheduleList = data.rows;
      })
    },

    /*刷新页面table*/
    refreshPageTables() {
      this.currentRow = {}
      this.getProduceScheduleList();
    },
    /*设置选中行的参数*/
    setCurrentRow(row, column, event) {
      this.currentRow = JSON.parse(JSON.stringify(row));
    },

    //设置参数
    initOperatorData(operatorData) {
      this.showOperatorFlag = false;
      this.operatorData = JSON.parse(JSON.stringify(operatorData));
      if (operatorData.reportType == 0) {
        //切换到报工组件
        this.switchProduceReportModal();
      }

      if (operatorData.reportType == 1) {
        //切换到fqc报工组件
        this.fqcReportModal();
      }

      if (operatorData.reportType == 2) {
        //切换到返工 重检组件
        this.reworkInspectModal();
      }
      if (operatorData.reportType == 3) {
        //切换到fqc分卷组件
        this.fqcSplitRollModal();
      }
      if (operatorData.reportType == 4) {
        // 换包装
        this.changePackaging();
      }
    },

    notInitOperatorData(val) {
      //注销用户信息
      this.operatorData.operatorId = '';
      this.operatorData.operatorName = '';
      //关闭切换用户模态框
      this.showOperatorFlag = false;
      if (val == 0) {
        //切换到报工组件
        this.switchProduceReportModal();
      }

      if (val == 1) {
        //切换到fqc报工组件
        this.fqcReportModal();
      }

      if (val == 2) {
        //切换到返工 重检组件
        this.reworkInspectModal();
      }
      if (val == 3) {
        //切换到fqc分卷组件
        this.fqcSplitRollModal();
      }
      if (val == 4) {
        //切换到fqc分卷组件
        this.changePackaging();
      }
    },
    //切换员工modal
    switchOperatorModal(val) {

      //首先判断是否选择好派工单
      if (JSON.stringify(this.currentRow) == '{}') {
        this.$message.error('请先选择派工单!');
        return false;
      }
      if (val == 0) {
        let data = {
          site: this.currentRow.site,
          resourceId: this.currentRow.resourceId,
          workCenterNo: this.currentRow.workCenterNo,
          seqNo: this.currentRow.seqNo,
          username: this.$store.state.user.name
        }
        reportCheck(data).then(({data}) => {
          if (data.code == 0) {
            //打开操作员切换功能
            this.showOperatorFlag = true;
            this.$nextTick(() => {
              this.$refs.comSwitchOperator.init(val);
            });
          }
          if (data.code == 300) {
            this.$message.warning(data.msg)
          }
          if (data.code == 400) {
            this.$confirm(`${data.msg}`, '提示', {
              confirmButtonText: '确定',
              cancelButtonText: '取消',
              type: 'warning'
            }).then(() => {
              //打开操作员切换功能
              this.showOperatorFlag = true;
              this.$nextTick(() => {
                this.$refs.comSwitchOperator.init(val);
              });
            })
          }
        })
      } else {
        //打开操作员切换功能
        this.showOperatorFlag = true;
        this.$nextTick(() => {
          this.$refs.comSwitchOperator.init(val);
        });
      }

    },
    //切换报工modal
    switchProduceReportModal() {
      //首先判断是否选择好派工单
      if (JSON.stringify(this.currentRow) == '{}') {
        this.$message.error('请先选择派工单!');
        return false;
      }
      //打开操作员切换功能
      this.showReportFlag = true;
      this.$nextTick(() => {
        this.$refs.comProduceReportNormal.init(this.currentRow.seqNo, this.operatorData);
      });
    },

    //打开结束派工单的modal
    showFinishScheduleModal() {
      //首先判断是否选择好派工单
      if (JSON.stringify(this.currentRow) == '{}') {
        this.$message.error('请先选择派工单!');
        return false;
      }
      //打开操作员切换功能
      this.showFinishScheduleFlag = true;
      this.$nextTick(() => {
        this.$refs.comFinishSchedule.init(this.currentRow, this.operatorData);
      });
    },

    //结束派工单后刷新页面
    processFinishScheduleOperation() {
      //刷新当前页面的数据
      this.refreshPageTables();
    },

    //保存操作员的信息
    saveOperatorData() {
      //查询操作员信息
      getOperatorData(this.operatorData).then(({data}) => {
        let operatorData = data.row;
        let status = operatorData.status;
        this.operatorData.operatorName = data.row.operatorName;
        //重置操作员信息状态
        this.operatorData.status = status;
        //判断是否验证通过
        if (status == 'N') {
          this.operatorFlag = false;
        } else {
          this.operatorFlag = true;
        }
        if (!this.operatorFlag) {
          this.$message.error('操作员信息不可用!');
        }
      })
        //判断是否检查通过--不通过不在继续
        .then(() => {
          if (!this.operatorFlag) {
            return false;
          }
          //关闭操作员切换功能
          this.operatorData.showFlag = false;
          //打开组件
          this.showReportFlag = true;
          //打开报工操作页面
          this.$nextTick(() => {
            this.$refs.comProduceReportNormal.init(this.currentRow.seqNo, this.operatorData);
          });
        })
    }
  },
  created() {
    //不查询
    getProduceScheduleList(this.searchData).then(({data}) => {
      //设置查询数据
      this.searchData.searchFlag = false;
      this.produceScheduleList = data.rows;
    });
  }

}
</script>

<style>
.el-textarea__inner {
  padding: 5px 5px;
}

</style>

<!--当前页面的标签样式-->
<style scoped lang="scss">

/*针对el-card*/
.customer-card .el-form-item__content {
  margin-top: -15px;
}

.customer-card .el-form-item {
  height: 22px;
}

.customer-border .el-form-item__content {
  margin-top: -30px;
}

/*全局年与日类型  宽度*/
div.el-time-width {
  width: 110px !important;
}

/* 全局时间右边框*/
.customer-css input.el-input__inner {
  height: 22px !important;
  padding-right: 0px !important;
}

/* 控制el-card标签的数据*/
div.customer-el-card {
  margin-left: 110px;
  margin-top: -15px;
  height: 20px;
  width: 60px;
}

/* 颜色控制 */
div.customer-el-card-pink {
  background: #FF00FF;
}

div.customer-el-card-orange {
  background: #FFD700;
}

div.customer-el-card-blue {
  background: #0000CD;
}

/*清掉样式*/
.el-radio + .el-radio {
  margin-left: 0px;
}

/*当前按钮的通用样式*/
.customer-css .customer-bun-mid {
  width: 65px;
  text-align: center;
}

/*当前按钮的通用样式*/
.customer-css .el-button--medium {
  padding: 5px 5px;
}

/*添加主菜单和明细菜单的样式*/
.customer-css .customer-dropdown .el-button--primary {
  padding: 2px;
  font-size: 12px;
}

.el-dropdown-menu--medium .el-dropdown-menu__item {
  line-height: 18px;
  padding: 0 17px;
  font-size: 12px;
}

hr {
  margin-top: 0px;
}


/*控制上下间距*/
</style>
