<template>
  <div class="customer-css">
    <!--  查询时间和产品  -->
    <el-form :inline="true" label-position="top" label-width="100px" style="margin-top: 0px;">
      <el-row style="width: 780px;">
        <el-col :span="4">
          <el-form-item :label="'生产订单号:'">
            <el-input v-model="pageData.orderNo" class="customer-input-color-red" readonly="readonly" style="width: 100px"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="2" style="margin-left: -15px;">
          <el-form-item :label="'工序号:'">
            <el-input v-model="pageData.itemNo" class="customer-input-color-red" readonly="readonly" style="width: 80px"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="4" style="margin-left: 20px;">
          <el-form-item :label="'工序名称:'">
            <el-input v-model="pageData.itemDesc" class="customer-input-color-red" readonly="readonly" style="width: 100px"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="4" style="margin-left: -15px;">
          <el-form-item :label="'加工中心编码:'">
            <el-input v-model="pageData.workCenterNo" class="customer-input-color-red" readonly="readonly" style="width: 90px"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span=4 style="margin-left: -25px;">
          <el-form-item :label="'加工中心名称:'">
            <el-input v-model="pageData.workCenterDesc" class="customer-input-color-red" readonly="readonly" style="width: 120px"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row style="width: 780px;">
        <el-col :span="4">
          <el-form-item :label="'产品编码:'">
            <el-input v-model="pageData.partNo" class="customer-input-color-red" readonly="readonly" style="width: 100px"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="6" style="margin-left: -15px;">
          <el-form-item :label="'产品名称:'">
            <el-input v-model="pageData.partDesc" class="customer-input-color-red" readonly="readonly" style="width: 185px"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="3" style="margin-left: 5px;">
          <el-form-item :label="'需求数量:'">
            <el-input v-model="pageData.qtyRequired" class="customer-input-color-red" readonly="readonly" style="width: 70px"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="3" style="margin-left: -20px;">
          <el-form-item :label="'已排产数量:'">
            <el-input v-model="pageData.qtyScheduled" class="customer-input-color-red" readonly="readonly" style="width: 70px"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="3" style="margin-left: -20px;">
          <el-form-item :label="'待排产数量:'">
            <el-input v-model="pageData.qtyToSchedule" class="customer-input-color-red" readonly="readonly" style="width: 70px"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>

    <!-- 排产信息   -->
    <fieldset class="customer-field" style="margin-top: -85px; width: 140px; height: 95px; padding: 0.125em;">
      <legend>排产日期</legend>
      <el-form style="margin-left: 10px; height: 60px;">
        <el-row style="margin-top: 10px; width: 120px; height: 20px;">
          <el-col :span="18">
            <el-form-item>
              <el-date-picker class="el-time-width"
                              style=""
                              v-model="pageData.scheduleDate"
                              value-format="yyyy-MM-dd">
              </el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row style="margin-top: 20px; padding-bottom: 20px; width: 120px; height: 60px;">
          <el-col :span="24" style="margin-left: 5px;">
            <el-form-item :label="''">
              <el-checkbox v-model="pageData.specifiedTime" true-label="Y" false-label="N"
                           style="margin-top: 0px; margin-right: -20px;"></el-checkbox>
              <el-time-picker
                format="HH:mm"
                arrow-control
                style="margin-top: -50px; width: 110px; height: 60px;"
                v-model="pageData.scheduleTime"
                value-format="HH:mm">
              </el-time-picker>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </fieldset>
    <!--  记录示意图  -->
    <fieldset style="margin-left: 730px; margin-top: -95px; width: 180px;">
      <legend>记录示意图</legend>
      <el-form :inline="true" label-position="top" label-width="100px" class="customer-card">
        <el-form-item :label="'已关闭,已达数量'">
          <el-card class="customer-el-card customer-el-card-pink"></el-card>
        </el-form-item>
        <el-form-item :label="'已关闭,未达数量'">
          <el-card class="customer-el-card customer-el-card-orange"></el-card>
        </el-form-item>
        <el-form-item :label="'未关闭,未达数量'">
          <el-card class="customer-el-card customer-el-card-blue"></el-card>
        </el-form-item>
      </el-form>
    </fieldset>
    <!--  下面的页面  -->
    <fieldset class="customer-fieldset" style="margin-bottom: 0px; width: 100%;">
      <el-tabs v-model="activeTable" style="margin-top: 0px;"
               type="border-card" @tab-click="tabClick" class="customer-tab">
        <el-tab-pane label="排产" name="scheduling">
          <!--    左边的边框    -->
          <fieldset class="customer-left-fieldset" style="width: 46%; margin-left: 0px; margin-top: 2px;">
            <legend>可用操作员</legend>
            <el-row>
              <el-col :span="6">
                <el-dropdown trigger="click" class="customer-dropdown" size="mini" @command="operatorHandleCommand">
                  <el-button type="primary" @click="controlOperatorMenuBun">
                    菜单<i class="el-icon-arrow-down el-icon--right"></i>
                  </el-button>
                  <el-dropdown-menu slot="dropdown">
                    <el-dropdown-item class="customer-li" command="工作日历"
                                      :disabled="operatorMenuButton.workCalendarOutFlag">工作日历</el-dropdown-item>
                    <hr width="95%" />
                    <el-dropdown-item class="customer-li" command="批量维护工作日历"
                                      :disabled="operatorMenuButton.batchWorkCalendarFlag">批量维护工作日历</el-dropdown-item>
                    <hr width="95%" />
                    <el-dropdown-item class="customer-li" command="重新排产"
                                      :disabled="operatorMenuButton.reScheduleOrderFlag">重新排产</el-dropdown-item>
                  </el-dropdown-menu>
                </el-dropdown>
              </el-col>
              <el-col :span="6">
                <el-button class="customer-bun-mid" type="primary" @click="scheduleOperatorsBun(true)"
                           style="margin-left: 10px; margin-bottom: 5px;">
                  排产
                </el-button>
              </el-col>
              <el-col :span="6">
                <el-button class="customer-bun-mid" type="primary" @click="getOperatorList"
                           style="margin-left: 10px; margin-bottom: 5px;">
                  刷新数据
                </el-button>
              </el-col>
              <el-col :span="6">
                <el-button class="customer-bun-max" type="primary" @click="scheduleVirtualOperatorsBun(true)"
                           style="margin-left: 10px; margin-bottom: 5px;">
                  虚拟机台排产
                </el-button>
              </el-col>
            </el-row>
            <el-container>
              <el-main class="customer-left-main">
                <el-table class="customer-left-table"
                          :height="tableHeight" :width="tableLeftWidth"
                          :data="operatorList"
                          border
                          :cell-style="customerCellStyle" :cell-class-name="customerCellClassName"
                          @row-click="setCurrentOperatorRow"
                          @current-change="changeCurrentOperatorRow"
                          highlight-current-row
                          ref="operatorTable"
                          v-loading="dataListLoading"
                          style="margin-left: -15px; margin-top: -5px;">
                  <el-table-column
                    v-for="(item,index) in columnOperatorArray" :key="index"
                    :sortable="item.columnSortable"
                    :prop="item.columnProp"
                    :header-align="item.headerAlign"
                    :show-overflow-tooltip="item.showOverflowTooltip"
                    :align="item.align"
                    :fixed="item.fixed==''?false:item.fixed"
                    :width="item.columnWidth"
                    :label="item.columnLabel">
                    <template slot-scope="scope">
                      <!--<el-input type="number" class="table-input" align="right" @blur="checkValidQty(scope.row)"-->
                      <el-input type="number" class="table-input" align="right" v-if="item.columnHidden"
                                v-model="scope.row[item.columnProp]"></el-input>
                      <span v-else>{{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>
            </el-container>
          </fieldset>
          <!--    右边的边框    -->
          <fieldset class="customer-right-field">
            <legend>已排产记录</legend>
            <el-row>
              <el-col :span="4">
                <el-button class="customer-bun-mid" type="primary" @click="moveUpScheduleBun"
                           style="margin-left: 10px; margin-bottom: 5px;">
                  上移
                </el-button>
              </el-col>
              <el-col :span="4">
                <el-button class="customer-bun-mid" type="primary" @click="moveDownScheduleBun"
                           style="margin-left: 10px; margin-bottom: 5px;">
                  下移
                </el-button>
              </el-col>
              <el-col :span="4">
                <el-button class="customer-bun-mid" type="primary" @click="warnReScheduleConfirm"
                           style="margin-left: 10px; margin-bottom: 5px;">
                  重新排产
                </el-button>
              </el-col>
              <el-col :span="4">
                <el-button class="customer-bun-mid" :disabled="shopOrderFlag" type="primary" @click="openSchedledOrderPage"
                           style="margin-left: 10px; margin-bottom: 5px;">
                  生产订单
                </el-button>
              </el-col>
            </el-row>
            <el-container>
              <el-main class="customer-right-main">
                <el-table class="customer-left-table schedule-table"
                          :height="tableHeight" :width="tableRightWidth"
                          :data="orderScheduleList"
                          border
                          ref="scheduleTable"
                          highlight-current-row
                          :row-style="controlRowStyle"
                          :row-class-name="scheduleRowClassName"
                          @row-click="setCurrentScheduleRow"
                          @current-change="changeScheduleRow"
                          @row-dblclick="warnCancelScheduleConfirm"
                          v-loading="dataListLoading"
                          style="margin-left: -15px; margin-top: -5px;">
                  <el-table-column
                    v-for="(item,index) in columnOrderScheduleArray" :key="index"
                    :sortable="item.columnSortable"
                    :prop="item.columnProp"
                    :header-align="item.headerAlign"
                    :show-overflow-tooltip="item.showOverflowTooltip"
                    :align="item.align"
                    :fixed="item.fixed==''?false: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>
            </el-container>
          </fieldset>
        </el-tab-pane>
        <el-tab-pane label="待排产清单" name="shop_order">
          <fieldset style="margin-left: 0px; margin-top: 2px;">
            <el-form :inline="true" label-position="top" style="margin-top: 5px;">
              <el-form-item :label="'录入日期'" style="margin-top: 0px;">
                <el-date-picker class="el-time-width"
                                style=""
                                v-model="searchData.enterTime1"
                                value-format="yyyy-MM-dd">
                </el-date-picker>
              </el-form-item>
              <el-form-item :label="' '" style="margin-left: -8px;">
                <el-date-picker class="el-time-width"
                                style=""
                                v-model="searchData.enterTime2"
                                value-format="yyyy-MM-dd">
                </el-date-picker>
              </el-form-item>
              <el-form-item :label="'要求完工日期'" style="margin-left: -8px;">
                <el-date-picker class="el-time-width"
                                style=""
                                v-model="searchData.needTime1"
                                value-format="yyyy-MM-dd">
                </el-date-picker>
              </el-form-item>
              <el-form-item :label="' '" style="margin-left: -8px;">
                <el-date-picker class="el-time-width"
                                style=""
                                v-model="searchData.needTime2"
                                value-format="yyyy-MM-dd">
                </el-date-picker>
              </el-form-item>
              <el-form-item :label="'产品编码'" style="margin-left: -8px;">
                <el-input v-model="searchData.partNo" style="width: 80px"></el-input>
              </el-form-item>
              <el-form-item :label="'生产订单'" style="margin-left: -8px;">
                <el-input v-model="searchData.orderNo" style="width: 80px"></el-input>
              </el-form-item>
              <el-form-item :label="''" style="margin-left: 5px;">
                <el-row>
                  <el-col :span="24">
                    <el-checkbox v-model="searchData.fulledFlag" class="customer-checkbox" true-label="Y" false-label="N" style=""
                                 label="查看已排满的工序"></el-checkbox>
                  </el-col>
                  <el-col :span="24" style="margin-top: 0px; ">
                    <el-checkbox v-model="searchData.preScheduledFlag" class="customer-checkbox" true-label="Y" false-label="N" style="margin-top: 5px;"
                                 label="仅查看前道工序已排产的工序"></el-checkbox>
                  </el-col>
                </el-row>
              </el-form-item>
              <el-form-item :label="''" style="margin-left: -110px; margin-top: 5px;">
                <el-button class="customer-bun-max" @click="getShopOrderList" type="primary">刷新排产清单
                </el-button>
              </el-form-item>
              <el-form-item :label="''" style="margin-left: 0px; margin-top: 5px;">
                <el-button class="customer-bun-mid" @click="openOrderPage" :disabled="shopOrderFlag" type="primary">生产订单
                </el-button>
              </el-form-item>

              <el-container>
                <el-main class="customer-left-main">
                  <el-table class="customer-left-table"
                            :height="tableHeight" :width="tableLeftWidth"
                            :data="shopOrderList"
                            border
                            highlight-current-row
                            v-loading="dataListLoading"
                            @row-dblclick="startScheduleBun"
                            @row-click="setCurrentRoutingRow"
                            style="margin-left: -15px; margin-top: -5px;">
                    <el-table-column
                      v-for="(item,index) in columnOrderArray" :key="index"
                      :sortable="item.columnSortable"
                      :prop="item.columnProp"
                      :header-align="item.headerAlign"
                      :show-overflow-tooltip="item.showOverflowTooltip"
                      :align="item.align"
                      :fixed="item.fixed==''?false: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>
              </el-container>

            </el-form>
          </fieldset>

        </el-tab-pane>
      </el-tabs>
    </fieldset>

    <!-- 工作日历外的组件 -->
    <comWorkCalendarOut ref="comWorkCalendarOut" :close-on-click-modal="false"
                        :visible.sync="showWorkCalendarOut">

    </comWorkCalendarOut>

    <!-- 批量工作日历的组件 -->
    <comBatchWorkCalendar ref="comBatchWorkCalendar" :close-on-click-modal="false"
                          :visible.sync="showBatchWorkCalendar">

    </comBatchWorkCalendar>
  </div>
</template>

<script>
/*组件*/
import comWorkCalendarOut from "../common/com_work_calendar_out";/*工作日历外组件*/
import comBatchWorkCalendar from "../common/com_batch_work_calendar";/*批量维护工作日历外组件*/
import {
  getShopOrderListWithFqc,
  getOperatorListWithFqc,
  getOrderScheduleListWithFqc,
  scheduleFqcOperators,
  cancelSoSchedule,
  reScheduleWorkOrders,
  moveUpSchedule,
  moveDownSchedule,
  getCalendarMapByResourceId,/*获取人员的班次*/
  getShopOrderByCon,/*刷新工单数据使用*/
} from '@/api/schedule/order_schedule_fqc.js'

export default {
  data() {
    return {
      tableHeight: 0,
      tableLeftWidth: 0,
      tableRightWidth: 0,
      operatorIndex: 0,
      scheduleIndex: -1,
      activeTable: 'shop_order',
      modelFlag: false,
      modelInputFlag: true,
      showWorkCalendarOut: false,
      showBatchWorkCalendar: false,
      shopOrderFlag: true,
      currentRoutingRow: null,
      currentOperatorRow: {},
      currentScheduleRow: {},
      pageData: {
        site: this.$store.state.user.site,
        username: this.$store.state.user.name,
        orderNo: '',
        itemNo: '',
        itemDesc: '',
        workCenterNo: 'FQC',
        workCenterDesc: '',
        resourceId: '',
        qtyRequired: '',
        qtyScheduled: '',
        qtyToSchedule: '',
        scheduleDate: this.dayjs(new Date()).format('YYYY-MM-DD'),
        scheduleTime: '08:30',
        specifiedTime: 'Y',
        scheduleSeqNo: -1,
        planStartTime: '',
        virtualFlag: 'N',
        calendarId: '',
        calendarDesc: '',
      },
      searchData: {
        site: this.$store.state.user.site,
        username: this.$store.state.user.name,
        orderNo: '',
        itemNo: '',
        workCenterNo: '',
        resourceId: '',
        enterTime1: '',
        enterTime2: '',
        needTime1: '',
        needTime2: '',
        waitTimes: 0,
        fulledFlag: 'N',
        preScheduledFlag: 'Y'
      },
      operatorList: [],
      shopOrderList: [],
      orderScheduleList: [],
      dataListLoading: false,
      columnOrderArray: [
        {
          userId: this.$store.state.user.name,
          functionId: 5304,
          serialNumber: '5304OrderOrderNo',
          tableId: "5304Order",
          tableName: "工单表",
          columnProp: "orderNo",
          headerAlign: "center",
          align: "center",
          columnLabel: "订单号",
          columnWidth: 90,
          columnHidden: false,
          columnImage: false,
          columnSortable: true,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5304,
          serialNumber: '5304OrderItemNo',
          tableId: "5304Order",
          tableName: "工单表",
          columnProp: "itemNo",
          headerAlign: "center",
          align: "center",
          columnLabel: "工序号",
          columnWidth: 90,
          columnHidden: false,
          columnImage: false,
          columnSortable: true,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5304,
          serialNumber: '5304OrderItemDesc',
          tableId: "5304Order",
          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: 5304,
          serialNumber: '5304OrderNeedDate',
          tableId: "5304Order",
          tableName: "工单表",
          columnProp: "needDate",
          headerAlign: "center",
          align: "center",
          columnLabel: "要求完工日期",
          columnWidth: 120,
          columnHidden: false,
          columnImage: false,
          columnSortable: true,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5304,
          serialNumber: '5304OrderPartNo',
          tableId: "5304Order",
          tableName: "工单表",
          columnProp: "partNo",
          headerAlign: "center",
          align: "center",
          columnLabel: "产成品编码",
          columnWidth: 120,
          columnHidden: false,
          columnImage: false,
          columnSortable: true,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5304,
          serialNumber: '5304OrderPartDesc',
          tableId: "5304Order",
          tableName: "工单表",
          columnProp: "partDesc",
          headerAlign: "center",
          align: "center",
          columnLabel: "产成品名称/规格",
          columnWidth: 185,
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5304,
          serialNumber: '5304OrderSpec',
          tableId: "5304Order",
          tableName: "工单表",
          columnProp: "spec",
          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: 5304,
          serialNumber: '5304OrderSite',
          tableId: "5304Order",
          tableName: "工单表",
          columnProp: "site",
          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: 5304,
          serialNumber: '5304OrderWorkCenterNo',
          tableId: "5304Order",
          tableName: "工单表",
          columnProp: "workCenterNo",
          headerAlign: "center",
          align: "center",
          columnLabel: "加工中心",
          columnWidth: 100,
          columnHidden: false,
          columnImage: false,
          columnSortable: true,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5304,
          serialNumber: '5304OrderNextItemNo',
          tableId: "5304Order",
          tableName: "工单表",
          columnProp: "nextItemNo",
          headerAlign: "center",
          align: "center",
          columnLabel: "下道工序",
          columnWidth: 100,
          columnHidden: false,
          columnImage: false,
          columnSortable: true,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5304,
          serialNumber: '5304OrderNextItemDesc',
          tableId: "5304Order",
          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: 5304,
          serialNumber: '5304OrderNextScheduledFlag',
          tableId: "5304Order",
          tableName: "工单表",
          columnProp: "nextScheduledFlag",
          headerAlign: "center",
          align: "center",
          columnLabel: "下道工序已排产",
          columnWidth: 150,
          columnHidden: false,
          columnImage: false,
          columnSortable: true,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5304,
          serialNumber: '5304OrderPreItemNo',
          tableId: "5304Order",
          tableName: "工单表",
          columnProp: "preItemNo",
          headerAlign: "center",
          align: "center",
          columnLabel: "上道工序",
          columnWidth: 100,
          columnHidden: false,
          columnImage: false,
          columnSortable: true,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5304,
          serialNumber: '5304OrderPreItemDesc',
          tableId: "5304Order",
          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: 5304,
          serialNumber: '5304OrderPreScheduledFlag',
          tableId: "5304Order",
          tableName: "工单表",
          columnProp: "preScheduledFlag",
          headerAlign: "center",
          align: "center",
          columnLabel: "上道工序已排产",
          columnWidth: 150,
          columnHidden: false,
          columnImage: false,
          columnSortable: true,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5304,
          serialNumber: '5304OrderQtyReported',
          tableId: "5304Order",
          tableName: "工单表",
          columnProp: "qtyReported",
          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: 5304,
          serialNumber: '5304OrderScheduledFlag',
          tableId: "5304Order",
          tableName: "工单表",
          columnProp: "scheduledFlag",
          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: 5304,
          serialNumber: '5304OrderLotSize',
          tableId: "5304Order",
          tableName: "工单表",
          columnProp: "lotSize",
          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: 5304,
          serialNumber: '5304OrderAvailResource',
          tableId: "5304Order",
          tableName: "工单表",
          columnProp: "availResource",
          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: 5304,
          serialNumber: '5304OrderEnterDate',
          tableId: "5304Order",
          tableName: "工单表",
          columnProp: "enterDate",
          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: 5304,
          serialNumber: '5304OrderScheduleToPlanTime',
          tableId: "5304Order",
          tableName: "工单表",
          columnProp: "scheduleToPlanTime",
          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: 5304,
          serialNumber: '5304OrderCustomerName',
          tableId: "5304Order",
          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: 5304,
          serialNumber: '5304OrderMachRunFactor',
          tableId: "5304Order",
          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: 5304,
          serialNumber: '5304OrderMachSetupTime',
          tableId: "5304Order",
          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: 5304,
          serialNumber: '5304OrderFactorUnit',
          tableId: "5304Order",
          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: 5304,
          serialNumber: '5304OrderQtyScheduled',
          tableId: "5304Order",
          tableName: "工单表",
          columnProp: "qtyScheduled",
          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: 5304,
          serialNumber: '5304OrderQtyToSchedule',
          tableId: "5304Order",
          tableName: "工单表",
          columnProp: "qtyToSchedule",
          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: 5304,
          serialNumber: '5304OrderQtyScheduledPreOps',
          tableId: "5304Order",
          tableName: "工单表",
          columnProp: "qtyScheduledPreOps",
          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: 5304,
          serialNumber: '5304OrderCustPartNo',
          tableId: "5304Order",
          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: 5304,
          serialNumber: '5304OrderTimeRequired',
          tableId: "5304Order",
          tableName: "工单表",
          columnProp: "timeRequired",
          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: 5304,
          serialNumber: '5304OrderQtyApprovedPreOps',
          tableId: "5304Order",
          tableName: "工单表",
          columnProp: "qtyApprovedPreOps",
          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: 5304,
          serialNumber: '5304OrderPrePlanStartTime',
          tableId: "5304Order",
          tableName: "工单表",
          columnProp: "prePlanStartTime",
          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: 5304,
          serialNumber: '5304OrderPrePlanFinishTime',
          tableId: "5304Order",
          tableName: "工单表",
          columnProp: "prePlanFinishTime",
          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: 5304,
          serialNumber: '5304OrderEfficiency',
          tableId: "5304Order",
          tableName: "工单表",
          columnProp: "efficiency",
          headerAlign: "center",
          align: "center",
          columnLabel: "效率",
          columnWidth: 80,
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: false
        }
      ],
      columnOperatorArray: [
        {
          userId: this.$store.state.user.name,
          functionId: 5304,
          serialNumber: '5304OperatorOperatorId',
          tableId: "5304Operator",
          tableName: "操作员表",
          columnProp: "operatorId",
          headerAlign: "center",
          align: "center",
          columnLabel: "员工编号",
          columnWidth: 100,
          columnHidden: false,
          columnImage: false,
          columnSortable: true,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5304,
          serialNumber: '5304OperatorOperatorName',
          tableId: "5304Operator",
          tableName: "操作员表",
          columnProp: "operatorName",
          headerAlign: "center",
          align: "center",
          columnLabel: "员工姓名",
          columnWidth: 120,
          columnHidden: false,
          columnImage: false,
          columnSortable: true,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5304,
          serialNumber: '5304OperatorLastScheduledTime',
          tableId: "5304Operator",
          tableName: "操作员表",
          columnProp: "lastScheduledTime",
          headerAlign: "center",
          align: "center",
          columnLabel: "最后排产时间",
          columnWidth: 125,
          columnHidden: false,
          columnImage: false,
          columnSortable: true,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5304,
          serialNumber: '5304OperatorEfficiency',
          tableId: "5304Operator",
          tableName: "操作员表",
          columnProp: "efficiency",
          headerAlign: "center",
          align: "center",
          columnLabel: "效率",
          columnWidth: 80,
          columnHidden: false,
          columnImage: false,
          columnSortable: true,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5304,
          serialNumber: '5304OperatorQtyToSchedule',
          tableId: "5304Operator",
          tableName: "操作员表",
          columnProp: "qtyToSchedule",
          headerAlign: "center",
          align: "center",
          columnLabel: "排产数量",
          columnWidth: 100,
          columnHidden: true,
          columnImage: false,
          columnSortable: true,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5304,
          serialNumber: '5304OperatorCalendarId',
          tableId: "5304Operator",
          tableName: "操作员表",
          columnProp: "calendarId",
          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: 5304,
          serialNumber: '5304OperatorVirturlFlag',
          tableId: "5304Operator",
          tableName: "操作员表",
          columnProp: "virturlFlag",
          headerAlign: "center",
          align: "center",
          columnLabel: "虚拟机台",
          columnWidth: 80,
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: false
        }
      ],
      columnOrderScheduleArray: [
        {
          userId: this.$store.state.user.name,
          functionId: 5304,
          serialNumber: '5304ScheduleScheduledSeqNo',
          tableId: "5304Schedule",
          tableName: "排产明细表",
          columnProp: "scheduledSeqNo",
          headerAlign: "center",
          align: "center",
          columnLabel: "排产序号",
          columnWidth: 100,
          columnHidden: false,
          columnImage: false,
          columnSortable: true,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5304,
          serialNumber: '5304ScheduleQtyRequired',
          tableId: "5304Schedule",
          tableName: "排产明细表",
          columnProp: "qtyRequired",
          headerAlign: "center",
          align: "center",
          columnLabel: "待生产数量",
          columnWidth: 120,
          columnHidden: false,
          columnImage: false,
          columnSortable: true,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5304,
          serialNumber: '5304SchedulePlanStartTime',
          tableId: "5304Schedule",
          tableName: "排产明细表",
          columnProp: "planStartTime",
          headerAlign: "center",
          align: "center",
          columnLabel: "计划开工时间",
          columnWidth: 125,
          columnHidden: false,
          columnImage: false,
          columnSortable: true,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5304,
          serialNumber: '5304SchedulePlanFinishTime',
          tableId: "5304Schedule",
          tableName: "排产明细表",
          columnProp: "planFinishTime",
          headerAlign: "center",
          align: "center",
          columnLabel: "计划完工时间",
          columnWidth: 125,
          columnHidden: false,
          columnImage: false,
          columnSortable: true,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5304,
          serialNumber: '5304ScheduleOrderNo',
          tableId: "5304Schedule",
          tableName: "排产明细表",
          columnProp: "orderNo",
          headerAlign: "center",
          align: "center",
          columnLabel: "订单号",
          columnWidth: 90,
          columnHidden: false,
          columnImage: false,
          columnSortable: true,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5304,
          serialNumber: '5304ScheduleItemNo',
          tableId: "5304Schedule",
          tableName: "排产明细表",
          columnProp: "itemNo",
          headerAlign: "center",
          align: "center",
          columnLabel: "工序号",
          columnWidth: 90,
          columnHidden: false,
          columnImage: false,
          columnSortable: true,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5304,
          serialNumber: '5304ScheduleRemark',
          tableId: "5304Schedule",
          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: 5304,
          serialNumber: '5304SchedulePartNo',
          tableId: "5304Schedule",
          tableName: "排产明细表",
          columnProp: "partNo",
          headerAlign: "center",
          align: "center",
          columnLabel: "产品编码",
          columnWidth: 100,
          columnHidden: false,
          columnImage: false,
          columnSortable: true,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5304,
          serialNumber: '5304ScheduleCustomerName',
          tableId: "5304Schedule",
          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: 5304,
          serialNumber: '5304ScheduleCustPartNo',
          tableId: "5304Schedule",
          tableName: "排产明细表",
          columnProp: "custPartNo",
          headerAlign: "center",
          align: "center",
          columnLabel: "客户产品料号",
          columnWidth: 140,
          columnHidden: false,
          columnImage: false,
          columnSortable: true,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5304,
          serialNumber: '5304SchedulePartDesc',
          tableId: "5304Schedule",
          tableName: "排产明细表",
          columnProp: "partDesc",
          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: 5304,
          serialNumber: '5304OrderSpec',
          tableId: "5304Schedule",
          tableName: "排产明细表",
          columnProp: "spec",
          headerAlign: "center",
          align: "center",
          columnLabel: "规格型号",
          columnWidth: 80,
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: false
        }
      ],
      operatorMenuButton: {
        workCalendarOutFlag: true,
        batchWorkCalendarFlag: true,
        reScheduleOrderFlag: true,
        partStockFlag: true,
      },
    }
  },
  /*注册组件*/
  components: {
    comWorkCalendarOut,/*工作日历外*/
    comBatchWorkCalendar,/*批量维护工作日历外组件*/
  },
  mounted() {
    this.$nextTick(() => {
      this.tableHeight = (window.innerHeight - 270);
      this.tableLeftWidth = ((window.innerWidth - 100) / 2) - 60;
      this.tableRightWidth = ((window.innerWidth - 100) / 2) + 60;
    });
    //设置当前的动态高度

  },
  methods: {

    //列表表格选择替换
    tabClick(tab, event) {
      let tabName = tab.name;
      //区分两个页签
      if(tabName == 'shop_order'){
        //刷新当前的table
        //this.getShopOrderList();
      }else if(tabName == 'scheduling'){
        //刷新刷新FQC员工
        this.getOperatorList();
      }
    },

    /*获取FQC工单信息*/
    getShopOrderList() {
      getShopOrderListWithFqc(this.searchData).then(({data}) => {
        this.shopOrderList = data.rows;
      })
    },

    /*刷新当前的页面的显示数据*/
    refreshShopOrderByCon(orderRow){
      //请求的参数
      getShopOrderByCon(this.pageData).then(({data}) => {
        //刷新排产的数量
        this.pageData.qtyRequired = data.row.lotSize;
        this.pageData.qtyScheduled = data.row.qtyScheduled;
        this.pageData.qtyToSchedule = data.row.qtyToSchedule;
      });
    },

    /*获取FQC操作员信息*/
    getOperatorList() {
      getOperatorListWithFqc(this.searchData).then(({data}) => {
        //设置列表
        this.operatorList = data.rows;
        //判断是否选中行
        if(this.operatorIndex >= 0){
          //设置选中行
          this.$refs.operatorTable.setCurrentRow(this.operatorList[this.operatorIndex]);
          //选中当前是的行
          setTimeout(() =>{
            //设置默认选中的人员
            this.searchData.resourceId = this.operatorList[this.operatorIndex].operatorId;
            this.pageData.resourceId = this.operatorList[this.operatorIndex].operatorId;
            //刷新当前的派工单记录
            this.getOrderScheduleList();
          },500);

        }
      });
    },

    /*获取派工单的信息*/
    getOrderScheduleList() {
      getOrderScheduleListWithFqc(this.searchData).then(({data}) => {
        this.orderScheduleList = data.rows;
        //清空已经选好的行数据
        this.currentSchedeRow = null;
        //判断是否需要选中当前行
        if (this.scheduleIndex >= 0) {
          //选中当前是的行
          this.$refs.scheduleTable.setCurrentRow(this.orderScheduleList[this.scheduleIndex]);
        }
      })
    },

    /*设置工艺的行*/
    setCurrentRoutingRow(row, column, event) {
      this.currentRoutingRow = row;
    },

    /*开始排产*/
    startScheduleBun(row, column, event){
      //设置页面参数
      setTimeout(() =>{
        this.pageData.orderNo = row.orderNo;
        this.pageData.itemNo = row.itemNo;
        this.pageData.itemDesc = row.itemDesc;
        this.pageData.workCenterNo = row.workCenterNo;
        this.pageData.workCenterDesc = '全检';
        this.pageData.partNo = row.partNo;
        this.pageData.partDesc = row.partDesc;
        //this.pageData.qtyRequired = row.lotSize;
        //this.pageData.qtyScheduled = row.qtyScheduled;
        //this.pageData.qtyToSchedule = row.qtyToSchedule;
        //设置页签
        this.activeTable = 'scheduling';
        //刷新页签的参数
        this.getOperatorList();
        //刷新页面的数据
        this.refreshShopOrderByCon();
      }, 500)
    },

    /*设置当前的操作员行*/
    setCurrentOperatorRow(row, column, event) {
      this.currentOperatorRow = JSON.parse(JSON.stringify(row));
      //设置查询的条件
      this.searchData.resourceId = row.operatorId;
      this.pageData.resourceId = row.operatorId;
      //刷新table
      this.getOrderScheduleList();
    },

    /*当前值发生变化的时候修改*/
    changeCurrentOperatorRow(row, oldRow){
      //判断是否是获取焦点的事件
      if(row){
        this.currentOperatorRow = JSON.parse(JSON.stringify(row));
        //设置日历编码和日历描述
        this.refreshCalendarMapByResourceId();
      }
    },

    /*刷新日历编码和日历的描述*/
    refreshCalendarMapByResourceId(){
      let requestData = {'site': this.pageData.site,
        'workCenterNo': 'FQC', 'resourceId': this.currentOperatorRow.operatorId};
     getCalendarMapByResourceId(requestData).then(({data}) => {
       this.pageData.calendarId = data.row.calendarId;
       this.pageData.calendarDesc = data.row.calendarDesc;
     });
    },

    /*设置当前派工单行的下标*/
    scheduleRowClassName({row, rowIndex}){
      row.index = rowIndex;
    },

    /*添加定制的css类*/
    customerCellClassName({row, column, rowIndex, columnIndex}) {
      if(column.property == 'qtyToSchedule'){
        return 'customer-number-cell';
      }
    },
    /*添加定制的cess样式*/
    customerCellStyle({row, column, rowIndex, columnIndex}) {
      if(column.property == 'qtyToSchedule'){
        return 'padding: 0px 0px;';
      }
    },


    /*设置当前的派工单行*/
    setCurrentScheduleRow(row, column, event) {
      this.currentSchedeRow = JSON.parse(JSON.stringify(row));
      //设置当前的序号
      this.scheduleIndex = row.index;
    },

    /*当前值发生变化的时候修改*/
    changeScheduleRow(row, oldRow){
      //判断是否是获取焦点的事件
      if(row){
        this.currentScheduleRow = JSON.parse(JSON.stringify(row));
      }
    },

    /*开始排产的操作*/
    scheduleOperatorsBun(checkFlag) {
      //循环判断是否存在需要排产
      let scheduleOperators = [];
      this.pageData.virtualFlag = 'N';
      //处理需要排产的数据
      for(let i = 0; i < this.operatorList.length; i++){
        let tempOperator = this.operatorList[i];
        if(parseFloat(tempOperator.qtyToSchedule) > 0){
          scheduleOperators.push(tempOperator);
        }
      }
      //判断是否存在需要排产的操作员
      if(scheduleOperators.length == 0){
        this.$message.error('暂无可排产的操作员!');
        return false;
      }
      //处理参数
      let postData = {'pageData': JSON.stringify(this.pageData),
        'operatorList': JSON.stringify(scheduleOperators),
      'checkFlag': checkFlag}
      //提交后台的数据
      scheduleFqcOperators(postData).then(({data}) => {
        if (data.code == 500) {
          this.$message.error(data.msg);
        } else if (data.code == 201) {
          this.$confirm(data.msg, '提示', {
            confirmButtonText: '确认',
            celButtonText: '取消',
            type: 'warning'
          }).then(() => {
            //重新掉用排产
            this.scheduleOperatorsBun(false);
          });
        }else {
          this.$message.success(data.msg);
          //刷新页面的数据
          this.refreshShopOrderByCon();
          //刷新明FQC操作员
          this.getOperatorList();
          this.pageData.virtualFlag = 'N';
          this.pageData.checkFlag = true;
        }
      });
    },


    /*虚拟排产的操作*/
    scheduleVirtualOperatorsBun(checkFlag) {
      //循环判断是否存在需要排产
      let scheduleOperators = [];
      this.pageData.virtualFlag = 'Y';
      //处理需要排产的数据
      for(let i = 0; i < this.operatorList.length; i++){
        let tempOperator = this.operatorList[i];
        if(parseFloat(tempOperator.qtyToSchedule) > 0){
          scheduleOperators.push(tempOperator);
        }
      }
      //判断是否存在需要排产的操作员
      if(scheduleOperators.length == 0){
        this.$message.error('暂无可排产的操作员!');
        return false;
      }
      //处理参数
      let postData = {'pageData': JSON.stringify(this.pageData),
        'operatorList': JSON.stringify(scheduleOperators),
        'checkFlag': checkFlag}
      //提交后台的数据
      scheduleFqcOperators(postData).then(({data}) => {
        if (data.code == 500) {
          this.$message.error(data.msg);
        } else if (data.code == 201) {
          this.$confirm(data.msg, '提示', {
            confirmButtonText: '确认',
            celButtonText: '取消',
            type: 'warning'
          }).then(() => {
            //重新掉用排产
            this.scheduleVirtualOperatorsBun(false);
          });
        }else {
          this.$message.success(data.msg);
          //刷新页面的数据
          this.refreshShopOrderByCon();
          //刷新明FQC操作员
          this.getOperatorList();
          this.pageData.virtualFlag = 'N';
          this.pageData.checkFlag = true;
        }
      });
    },

    /*提示取消派工单*/
    warnCancelScheduleConfirm(row, $event, column) {
      //提示操作
      this.$confirm('确实要取消该派工单吗?', '提示', {
        confirmButtonText: '确认',
        celButtonText: '取消',
        type: 'warning'
      }).then(() => {
        //执行创建新卷的操作
        this.cancelScheduleBun(row);
      });
    },

    /*取消派工单的操作*/
    cancelScheduleBun(scheduleRow) {
      //设置参数
      this.pageData.orderNo = scheduleRow.orderNo;
      this.pageData.itemNo = scheduleRow.itemNo;
      this.pageData.seqNo = scheduleRow.seqNo;
      this.pageData.scheduledQty = scheduleRow.qtyRequired;
      this.pageData.workCenterNo = scheduleRow.workCenterNo;
      this.pageData.resourceId = scheduleRow.resourceId;
      this.pageData.scheduleSeqNo = scheduleRow.scheduledSeqNo;
      this.pageData.planStartTime = scheduleRow.planStartTime;
      //取消排产
      cancelSoSchedule(this.pageData).then(({data}) => {
        if (data.code == 500) {
          this.$message.error(data.msg);
        } else {
          this.$message.success(data.msg);
          //刷新页面的数据
          this.refreshShopOrderByCon();
          //刷新明细的报工页面
          this.getOrderScheduleList();
        }
      });
    },

    /*提示是否重新排产*/
    warnReScheduleConfirm() {
      //提示操作
      this.$confirm('确实要对排产清单中的未完成派工单进行排产吗?', '提示', {
        confirmButtonText: '确认',
        celButtonText: '取消',
        type: 'warning'
      }).then(() => {
        //执行创建新卷的操作
        this.reScheduleFqcOperator();
      });
    },

    /*重新排产的方法*/
    reScheduleFqcOperator() {
      //设置重新排产的人员
      this.pageData.resourceId = this.currentOperatorRow.operatorId;
      reScheduleWorkOrders(this.pageData).then(({data}) => {
        if (data.code == 500) {
          this.$message.error(data.msg);
        } else {
          this.$message.success(data.msg);
          //刷新明细的报工页面
          this.getOrderScheduleList();
        }
      });
    },

    /*上移派工单*/
    moveUpScheduleBun(){
      //判断是否选择好了移动的行
      let scheduleRow = this.currentScheduleRow;
      if(null == scheduleRow || scheduleRow == ''){
        this.$message.error('请先选择处理的行!');
        return false;
      }
      //判断是否是第一行
      if(scheduleRow.index == 0){
        this.$message.error('已经是首行,无法继续上行!');
        return false;
      }
      //请求的参数
      let requestData = {'site': this.pageData.site,
        'workCenterNo': this.pageData.workCenterNo,
        'resourceId': this.pageData.resourceId,
        'scheduleSeqNo': scheduleRow.scheduledSeqNo};
      //请求处理当前的参数
      moveUpSchedule(requestData).then(({data}) => {
        if(data.code == 500){
          this.$message.error(data.msg);
        }else{
          this.$message.success(data.msg);
          //重置当前行
          this.scheduleIndex = this.scheduleIndex - 1;
          //刷新派工单的数据
          this.getOrderScheduleList();
        }
      });
    },

    /*上移派工单*/
    moveDownScheduleBun(){
      //判断是否选择好了移动的行
      let scheduleRow = this.currentScheduleRow;
      if(null == scheduleRow || scheduleRow == ''){
        this.$message.error('请先选择处理的行!');
        return false;
      }
      let countNums = this.orderScheduleList.length;
      //判断是否是第一行
      if(scheduleRow.index == countNums - 1){
        this.$message.error('已经是末行,无法继续下行!');
        return false;
      }
      //请求的参数
      let requestData = {'site': this.pageData.site,
        'workCenterNo': this.pageData.workCenterNo,
        'resourceId': this.pageData.resourceId,
        'scheduleSeqNo': scheduleRow.scheduledSeqNo};
      //请求处理当前的参数
      moveDownSchedule(requestData).then(({data}) => {
        if(data.code == 500){
          this.$message.error(data.msg);
        }else{
          this.$message.success(data.msg);
          //重置当前行
          this.scheduleIndex = this.scheduleIndex + 1;
          //刷新派工单的数据
          this.getOrderScheduleList();
        }
      });
    },

    /*区分不同的菜单  调用不同的方法  调用不同的方法*/
    operatorHandleCommand(menuName){
      //区分是哪一个方法调用
     if('工作日历' === menuName){
        //判断是否选择好了工单
        if(this.currentOperatorRow == null || this.currentOperatorRow == {}){
          //重置按钮
          this.operatorMenuButton.workCalendarOutFlag = true;
          //返回错误
          this.$message.error('请选择人员!');
          return false;
        }
        let tempData = {'site': this.pageData.site, 'calendarId': this.pageData.calendarId,
          'calendarDesc': this.pageData.calendarDesc, 'scheduledDate': this.pageData.scheduleDate};
        //打开组件  需要的数据 展示需要的数据
        this.$nextTick(() => {
          this.showWorkCalendarOut = true;
          this.$refs.comWorkCalendarOut.init(tempData);
        })

      }else if('批量维护工作日历' === menuName){
        //判断是否选择好了工单
        if(this.currentOperatorRow == null || this.currentOperatorRow == {}){
          //重置按钮
          this.operatorMenuButton.batchWorkCalendarFlag = true;
          //返回错误
          this.$message.error('请选择人员!');
          return false;
        }
       let tempData = {'site': this.pageData.site, 'calendarId': this.pageData.calendarId,
         'calendarDesc': this.pageData.calendarDesc, 'scheduledDate': this.pageData.scheduleDate};
        //打开组件  需要的数据 展示需要的数据
        this.$nextTick(() => {
          this.showBatchWorkCalendar = true;
          this.$refs.comBatchWorkCalendar.init(tempData);
        })
      }else if('重新排产' === menuName){
        //判断是否选择好了工单
        if(this.currentOperatorRow == null || this.currentOperatorRow == {}){
          //重置按钮
          this.operatorMenuButton.reScheduleOrderFlag = true;
          //返回错误
          this.$message.error('请选择人员!');
          return false;
        }
       //调用提示的方法
       this.warnReScheduleConfirm();
      }
    },

    //控制菜单的按钮
    /*控制明细菜单是否显示*/
    controlOperatorMenuBun(){
      //没有选择行 所有的按钮都是灰色
      if(this.currentOperatorRow == null || this.currentOperatorRow == {}){
        this.operatorMenuButton.workCalendarOutFlag = true;
        this.operatorMenuButton.batchWorkCalendarFlag = true;
        this.operatorMenuButton.reScheduleOrderFlag = true;
        this.operatorMenuButton.changeScheduleByCalendarFlag = true;
        this.operatorMenuButton.partStockFlag = true;
      }else{
        this.operatorMenuButton.workCalendarOutFlag = false;
        this.operatorMenuButton.batchWorkCalendarFlag = false;
        this.operatorMenuButton.reScheduleOrderFlag = false;
        this.operatorMenuButton.changeScheduleByCalendarFlag = false;
        this.operatorMenuButton.partStockFlag = false;
      }
    },

    /*打开已经排产工单的页面*/
    openSchedledOrderPage(){
      //判断是否选择好了工单
      if(this.currentScheduleRow == null || this.currentScheduleRow == {}){
        //返回错误
        this.$message.error('请选择派工单!');
        return false;
      }
      //跳转页面
      this.$router.push({
        path: '/shopOrder-shopOrder/shopOrder',
        query: {
          site: this.$store.state.user.site,
          user: this.$store.state.user.name,
          order: this.currentScheduleRow.orderNo,
        }
      });
    },

    /*打开工单的页面*/
    openOrderPage(){
      //判断是否选择好了工单
      if(!this.currentRoutingRow){
        //返回错误
        this.$message.error('请选择工单!');
        return false;
      }
      //跳转页面
      this.$router.push({
        path: '/shopOrder-shopOrder/shopOrder',
        query: {
          site: this.$store.state.user.site,
          user: this.$store.state.user.name,
          order: this.currentRoutingRow.orderNo,
        }
      });
    },

    /*控制单行的背景颜色*/
    controlRowStyle({row, rowIndex}){
      let colorStyle = row.colorStyle;
      //区分不同的样式对应不同的颜色
      if(colorStyle == 'firstColor'){
        return "background-color: #FF00FF";
      }else if(colorStyle == 'secondColor'){
        return "background-color: #0000CD";
      }else if(colorStyle == 'thirdColor'){
        return "background-color: #FFD700";
      }
    },

  },
  created() {
    //查询工单的数据
    //this.getShopOrderList();
    //查询派工的数据
    //this.getOrderScheduleList();
    // 判断是否具有该页面权限
    let menList = JSON.parse(sessionStorage.getItem('dynamicMenuRoutes') || '[]')
      .filter(item => item.path == 'shopOrder-shopOrder/shopOrder')
    //如果存在权限
    if (menList.length > 0){
      this.shopOrderFlag = false;
    }
  }
}
</script>

<!--当前页面的标签样式-->
<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: 100px !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: 60px;
  text-align: center;
}

.customer-css .customer-bun-min {
  width: 50px;
  text-align: center;
}

.customer-css .customer-bun-max {
  width: 85px;
  text-align: center;
}

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

/*灰色的表格行背景颜色*/
.customer-css /deep/ tr.customer-row-gray:hover {
  background: #7e819e;
}

/*灰色的表格行背景颜色*/
.customer-css /deep/ tr.customer-row-gray > td{
  background: #7e819e;
}

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

.el-dropdown-menu /deep/ li.customer-li {
  font-size: 10px;
}

.el-input /deep/ .el-icon-time {
  display: none;
}

/*左边的样式*/
.customer-css .customer-left-main {
  width: calc(50vw - 360px) !important;
  padding: 0px;
  margin-left: -5px;
  margin-right: -20px;
  margin-bottom: -5px;
}

/* el-main的样式 */
.customer-css .customer-right-main {
  width: calc(50vw - 240px) !important;
  padding: 0px;
  margin-left: -5px;
  margin-right: -20px;
  margin-bottom: -5px;
}

.customer-css .customer-left-table {
  margin-top: -20px;
}

/*调整右边field的样式*/
.customer-css .customer-right-field {
  margin-left: 46.2%;
  margin-top: calc(-100vh + 223px);
  width: 53.8%;
}

.customer-css /deep/ .el-tabs__content {
  padding: 0px;
}

/*两个checkbox的样式*/
.customer-checkbox + .customer-checkbox {
  margin-top: 20px;
}

/*统一的input内容颜色样式*/
.customer-input-color-red /deep/ .el-input__inner {
  color: red;
}

/deep/ .customer-tab .el-tabs__content{
  padding: 0px !important;
}

/*table中input*/
div.table-input /deep/ input.el-input__inner{
  text-align: right;
}

hr {
  margin-top: 0px;
  margin-bottom: 2px;
}

/*设置间距*//* 我是来测试的*/
.el-dropdown-menu /deep/ li.customer-li{
  font-size: 12px;
  line-height: 16px;
  padding: 4px 8px;
}


//el-table 取消鼠标悬浮时行高亮效果
/deep/ .schedule-table tbody tr:hover:not(.current-row) >td  {
  background-color: unset !important;
}
</style>
