<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()" 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="refreshPageTables()" 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="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="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="refreshPageTables()" 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"></el-input>
      </el-form-item>
      <el-form-item :label="'派工单号:'">
        <el-input v-model="searchData.seqNo" style="width: 120px"></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-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>

  </div>
</template>

<script>

import {
  getProduceScheduleList,
} 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";/*结束派工的组件*/

export default {
  data() {
    return {
      height: 800,
      showOperatorFlag: false,
      showReportFlag: false,
      showFinishScheduleFlag: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
        }
      ],
    }
  },
  components: {
    comSwitchOperator,/*切换用户的组件*/
    comProduceReportNormal,/*报工页面的组件*/
    comFinishSchedule,/*结束派工单的组件*/
  },
  mounted() {
    this.$nextTick(() => {
      this.height = window.innerHeight - 225;
    })
  },
  methods: {

    /*查询派工单*/
    getProduceScheduleList() {
      //开始真的查询;
      this.searchData.searchFlag = true;
      getProduceScheduleList(this.searchData).then(({data}) => {
        //设置查询数据
        this.produceScheduleList = data.rows;
      })
    },

    /*刷新页面table*/
    refreshPageTables() {
      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));
      //切换到报工组件
      this.switchProduceReportModal();
    },

    notInitOperatorData(){
      //关闭切换用户模态框
      this.showOperatorFlag = false;
      //切换到报工组件
      this.switchProduceReportModal();
    },

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

    //切换报工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;
}

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