<template>
  <div class="customer-css" >
    <!--  菜单按钮区域  -->
    <fieldset class="customer-field" style="width: 612px; padding: 0.35em 0.75em 0.425em;" >
      <legend>菜单</legend>
      <el-form :inline="true" label-position="top" label-width="100px" style="margin-top: -2px;" >
      <el-form-item :label="''">
        <el-button type="primary" style="margin-left: 30px; margin-bottom: 5px;">列表</el-button>
      </el-form-item>
      <el-form-item :label="''">
        <el-button type="primary" style="margin-left: 10px; margin-bottom: 5px;">关闭</el-button>
      </el-form-item>
      <el-form-item :label="''">
        <el-button type="primary" @click="refreshPageTables()" style="margin-left: 10px; margin-bottom: 5px;">查询</el-button>
      </el-form-item>
      </el-form>
    </fieldset>
    <!--  排序规则  -->
    <fieldset class="customer-field" style="margin-left: 640px; margin-top: -45px; width: 135px;" >
      <legend>排序</legend><br>
      <el-form :inline="true" style="margin-top: -10px; margin-bottom: 15px;" label-position="top" label-width="100px" >
        <el-form-item :label="''" style="margin-bottom: 5px;">
          <el-radio-group v-model="searchData.sortField">
            <el-radio label="needDate">要求完工日期</el-radio>
            <el-radio label="orderNo">订单号</el-radio>
            <el-radio label="partNo">产品编码</el-radio>
          </el-radio-group>
        </el-form-item>
      </el-form>
    </fieldset>
    <!--  查询时间和产品  -->
    <el-form :inline="true" label-position="top" label-width="100px" style="margin-top: -15px;" >
      <el-form-item :label="'录入日期:'">
        <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-top: -10px;">
        <el-date-picker class="el-time-width"
                        style="margin-top: 30px;"
                        v-model="searchData.enterTime2"
                        value-format="yyyy-MM-dd" placeholder="">
        </el-date-picker>
      </el-form-item>
      <el-form-item :label="'要求完工日期:'">
        <el-date-picker class="el-time-width"
                        style=""
                        v-model="searchData.needTime1"
                        value-format="yyyy-MM-dd" placeholder="">
        </el-date-picker>
      </el-form-item>
      <el-form-item :label="''" style="margin-top: -10px;">
        <el-date-picker class="el-time-width"
                        style="margin-top: 30px;"
                        v-model="searchData.needTime2"
                        value-format="yyyy-MM-dd" placeholder="">
        </el-date-picker>
      </el-form-item>
      <el-form-item :label="'产成品编码:'">
        <el-input v-model="searchData.partNo" style="width: 120px"></el-input>
      </el-form-item>
    </el-form>

    <!-- 排产信息   -->
    <fieldset class="customer-field" style="margin-top: 10px; width: 612px; padding: 0.125em;" >
      <legend>排产信息</legend>
      <!--  排产日期  -->
      <el-form :inline="true" label-position="top" label-width="100px"  style="margin-top: 5px;">
        <el-form-item :label="'排产日期:'">
          <el-date-picker class="el-time-width"
                          style=""
                          v-model="searchData.scheduleDate"
                          value-format="yyyy-MM-dd">
          </el-date-picker>
        </el-form-item>
        <el-form-item :label="''" style="margin-top: -10px;">
          <el-time-picker
            format="HH:mm"
            arrow-control
            style="margin-top: 30px; width: 65px"
            v-model="searchData.timePeriod"
            value-format="HH:mm">
          </el-time-picker>
        </el-form-item>
        <el-form-item :label="''" style="margin-top: -10px; margin-left: -5px;">
          <el-checkbox style="margin-top: 28px;" label="仅查看前道工序已排产的工序" name="type"></el-checkbox>
        </el-form-item>
      </el-form>
      <el-form :inline="true" label-position="top" label-width="100px" style="margin-top: 10px;">
        <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: 120px"></el-input>
        </el-form-item>
        <el-form-item :label="'加工中心编码:'">
          <el-input v-model="searchData.workCenterNo" style="width: 120px"></el-input>
        </el-form-item>
      </el-form>
      <!--  记录示意图  -->
      <fieldset style="margin-left: 380px; margin-top: -88px; 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 style="margin-left: 585px; margin-top: -93px; width: 180px; margin-bottom: 5px;">
        <legend>等待订单</legend>
        <el-form :inline="true" label-position="left" label-width="100px" class="customer-border">
          <el-form-item :label="'等待时间(分钟):'" >
            <el-input type="number" v-model="searchData.waitTimes"
                      style="margin-top: 3px; width: 48px;">
            </el-input>
          </el-form-item>
          <el-form-item :label="''" style="text-align: center; margin-top: 15px; margin-bottom: 9px;">
            <el-button type="primary" style="margin-left: 30px; margin-top: 10px; margin-bottom: 15px;">插入等待订单</el-button>
          </el-form-item>
        </el-form>
      </fieldset>

    </fieldset >
    <!--  机台班次信息  -->
    <el-main style="margin-left: 770px; margin-top: -255px; width: 452px;">
      <el-table
        height="235"
        :data="resourceShiftList"
        border
        v-loading="dataListLoading"
        style="width: 100%;">
        <el-table-column
          v-for="(item,index) in columnTimeArray" :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>

    <!--  工单主表信息  -->
    <el-main style="margin-left: -20px; margin-top: -35px; width: 104%;">
      <el-form :inline="true"  label-position="top" label-width="100px">
        <el-form-item :label="'主记录'">
        </el-form-item>
      </el-form>
      <el-table
        height="120"
        :data="shopOrderList"
        border
        @row-dblclick="startScheduleOperation(row, $event)"
        v-loading="dataListLoading"
        style="margin-top: -20px; width: 100%;">
        <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"
          :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-main style="margin-left: -20px; margin-top: -35px; width: 104%;">
      <el-form :inline="true"  label-position="top" label-width="100px">
        <el-form-item :label="'明细记录'">
        </el-form-item>
      </el-form>
      <el-table
        height="135"
        :data="orderScheduleList"
        border
        v-loading="dataListLoading"
        style="margin-top: -20px; width: 100%;">
        <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"
          :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>
  </div>
</template>

<script>

import {
  getResourceRestList,
  getShopOrderList,
  getOrderScheduleList,
} from '@/api/schedule/order_schedule.js'

export default {
  data() {
    return {
      height: 200,
      modelFlag: false,
      modelInputFlag: true,
      selectList: [],
      searchData: {
        site: this.$store.state.user.site,
        resourceId: '',
        workCenterNo: '',
        enterTime1: '',
        enterTime2: new Date(),
        needTime1: '',
        needTime2: new Date(),
        scheduleDate: '',
        sortField: '',
        status: 1,
        user: this.$store.state.user.name
      },
      resourceShiftList: [],
      shopOrderList: [],
      orderScheduleList: [],
      dataListLoading: false,
      buttons: {
        search: '查询',
      },
      columnTimeArray: [
        {
          userId: this.$store.state.user.name,
          functionId: 5301,
          serialNumber: '5301ShiftShiftDate',
          tableId: "5301Shift",
          tableName: "工作日历",
          columnProp: "shiftDate",
          headerAlign: "center",
          align: "center",
          columnLabel: "日期字段",
          columnWidth: 90,
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5301,
          serialNumber: '5301ShiftShiftInfo',
          tableId: "5301Shift",
          tableName: "工作日历",
          columnProp: "shiftInfo",
          headerAlign: "center",
          align: "center",
          columnLabel: "休息时间览表",
          columnWidth: 320,
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: false
        }
      ],
      columnOrderArray: [
        {
          userId: this.$store.state.user.name,
          functionId: 5301,
          serialNumber: '5301OrderOrderNo',
          tableId: "5301Order",
          tableName: "工单表",
          columnProp: "orderNo",
          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: 5301,
          serialNumber: '5301OrderItemNo',
          tableId: "5301Order",
          tableName: "工单表",
          columnProp: "itemNo",
          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: 5301,
          serialNumber: '5301OrderItemDesc',
          tableId: "5301Order",
          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: 5301,
          serialNumber: '5301OrderNeedDate',
          tableId: "5301Order",
          tableName: "工单表",
          columnProp: "needDate",
          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: 5301,
          serialNumber: '5301OrderPartNo',
          tableId: "5301Order",
          tableName: "工单表",
          columnProp: "partNo",
          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: 5301,
          serialNumber: '5301OrderCustomerName',
          tableId: "5301Order",
          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: 5301,
          serialNumber: '5301OrderCustPartNo',
          tableId: "5301Order",
          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: 5301,
          serialNumber: '5301OrderPartDesc',
          tableId: "5301Order",
          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: 5301,
          serialNumber: '5301OrderLotSize',
          tableId: "5301Order",
          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: 5301,
          serialNumber: '5301OrderQtyToSchedule',
          tableId: "5301Order",
          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: 5301,
          serialNumber: '5301OrderQtyScheduled',
          tableId: "5301Order",
          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: 5301,
          serialNumber: '5301OrderQtyReported',
          tableId: "5301Order",
          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: 5301,
          serialNumber: '5301OrderSpec',
          tableId: "5301Order",
          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: 5301,
          serialNumber: '5301OrderSite',
          tableId: "5301Order",
          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: 5301,
          serialNumber: '5301OrderWorkCenterNo',
          tableId: "5301Order",
          tableName: "工单表",
          columnProp: "workCenterNo",
          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: 5301,
          serialNumber: '5301OrderNextItemNo',
          tableId: "5301Order",
          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: 5301,
          serialNumber: '5301OrderNextItemDesc',
          tableId: "5301Order",
          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: 5301,
          serialNumber: '5301OrderNextScheduledFlag',
          tableId: "5301Order",
          tableName: "工单表",
          columnProp: "nextScheduledFlag",
          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: 5301,
          serialNumber: '5301OrderPreItemNo',
          tableId: "5301Order",
          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: 5301,
          serialNumber: '5301OrderPreItemDesc',
          tableId: "5301Order",
          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: 5301,
          serialNumber: '5301OrderPreScheduledFlag',
          tableId: "5301Order",
          tableName: "工单表",
          columnProp: "preScheduledFlag",
          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: 5301,
          serialNumber: '5301OrderScheduledFlag',
          tableId: "5301Order",
          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: 5301,
          serialNumber: '5301OrderAvailResource',
          tableId: "5301Order",
          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: 5301,
          serialNumber: '5301OrderEnterDate',
          tableId: "5301Order",
          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: 5301,
          serialNumber: '5301Order',
          tableId: "5301Order",
          tableName: "工单表",
          columnProp: "计划时间",
          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: 5301,
          serialNumber: '5301OrderMachRunFactor',
          tableId: "5301Order",
          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: 5301,
          serialNumber: '5301OrderQtyScheduledPreOps',
          tableId: "5301Order",
          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: 5301,
          serialNumber: '5301OrderQtyApprovedPreOps',
          tableId: "5301Order",
          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: 5301,
          serialNumber: '5301Order',
          tableId: "5301Order",
          tableName: "工单表",
          columnProp: "",
          headerAlign: "center",
          align: "center",
          columnLabel: "SAP参考号",
          columnWidth: 80,
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: false
        },
        {
          userId: this.$store.state.user.name,
          functionId: 5301,
          serialNumber: '5301OrderTimeRequired',
          tableId: "5301Order",
          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: 5301,
          serialNumber: '5301OrderEfficiency',
          tableId: "5301Order",
          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: 5301,
          serialNumber: '5301Order',
          tableId: "5301Order",
          tableName: "工单表",
          columnProp: "刀模已发",
          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: 5301,
          serialNumber: '5301Order',
          tableId: "5301Order",
          tableName: "工单表",
          columnProp: "印版已发",
          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: 5301,
          serialNumber: '5301Schedule',
          tableId: "5301Schedule",
          tableName: "排产明细表",
          columnProp: "",
          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: 5301,
          serialNumber: '5301SchedulePlanStartTime',
          tableId: "5301Schedule",
          tableName: "排产明细表",
          columnProp: "planStartTime",
          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: 5301,
          serialNumber: '5301SchedulePlanFinishTime',
          tableId: "5301Schedule",
          tableName: "排产明细表",
          columnProp: "planFinishTime",
          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: 5301,
          serialNumber: '5301ScheduleTimeRequired',
          tableId: "5301Schedule",
          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: 5301,
          serialNumber: '5301ScheduleOrderNo',
          tableId: "5301Schedule",
          tableName: "排产明细表",
          columnProp: "orderNo",
          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: 5301,
          serialNumber: '5301ScheduleNeedDate',
          tableId: "5301Schedule",
          tableName: "排产明细表",
          columnProp: "needDate",
          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: 5301,
          serialNumber: '5301ScheduleItemNo',
          tableId: "5301Schedule",
          tableName: "排产明细表",
          columnProp: "itemNo",
          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: 5301,
          serialNumber: '5301ScheduleItemDesc',
          tableId: "5301Schedule",
          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: 5301,
          serialNumber: '5301SchedulePartNo',
          tableId: "5301Schedule",
          tableName: "排产明细表",
          columnProp: "partNo",
          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: 5301,
          serialNumber: '5301SchedulePartDesc',
          tableId: "5301Schedule",
          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: 5301,
          serialNumber: '5301OrderSpec',
          tableId: "5301Schedule",
          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: 5301,
          serialNumber: '5301ScheduleLotSize',
          tableId: "5301Schedule",
          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: 5301,
          serialNumber: '5301ScheduleLotSize',
          tableId: "5301Schedule",
          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: 5301,
          serialNumber: '5301ScheduleQtyReported',
          tableId: "5301Schedule",
          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: 5301,
          serialNumber: '5301SchedulePreItemNo',
          tableId: "5301Schedule",
          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: 5301,
          serialNumber: '5301SchedulePreItemDesc',
          tableId: "5301Schedule",
          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: 5301,
          serialNumber: '5301SchedulePreScheduledFlag',
          tableId: "5301Schedule",
          tableName: "排产明细表",
          columnProp: "preScheduledFlag",
          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: 5301,
          serialNumber: '5301ScheduleNextItemNo',
          tableId: "5301Schedule",
          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: 5301,
          serialNumber: '5301ScheduleNextItemDesc',
          tableId: "5301Schedule",
          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: 5301,
          serialNumber: '5301ScheduleNextScheduledFlag',
          tableId: "5301Schedule",
          tableName: "排产明细表",
          columnProp: "nextScheduledFlag",
          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: 5301,
          serialNumber: '5301ScheduleResourceId',
          tableId: "5301Schedule",
          tableName: "排产明细表",
          columnProp: "resourceId",
          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: 5301,
          serialNumber: '5301ScheduleCustomerName',
          tableId: "5301Schedule",
          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: 5301,
          serialNumber: '5301ScheduleEnterDate',
          tableId: "5301Schedule",
          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: 5301,
          serialNumber: '5301ScheduleAvailResource',
          tableId: "5301Schedule",
          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: 5301,
          serialNumber: '5301ScheduleWorkCenterNo',
          tableId: "5301Schedule",
          tableName: "排产明细表",
          columnProp: "workCenterNo",
          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: 5301,
          serialNumber: '5301ScheduleMachRunFactor',
          tableId: "5301Schedule",
          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: 5301,
          serialNumber: '5301ScheduleMachSetupTime',
          tableId: "5301Schedule",
          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: 5301,
          serialNumber: '5301ScheduleFactorUnit',
          tableId: "5301Schedule",
          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: 5301,
          serialNumber: '5301ScheduleSite',
          tableId: "5301Schedule",
          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: 5301,
          serialNumber: '5301ScheduleQtyScheduledPreOps',
          tableId: "5301Schedule",
          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: 5301,
          serialNumber: '5301ScheduleDelayHours',
          tableId: "5301Schedule",
          tableName: "排产明细表",
          columnProp: "delayHours",
          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: 5301,
          serialNumber: '5301Schedule',
          tableId: "5301Schedule",
          tableName: "排产明细表",
          columnProp: "RecordType",
          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: 5301,
          serialNumber: '5301ScheduleClosedFlag',
          tableId: "5301Schedule",
          tableName: "排产明细表",
          columnProp: "closedFlag",
          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: 5301,
          serialNumber: '5301Schedule',
          tableId: "5301Schedule",
          tableName: "排产明细表",
          columnProp: "是否关闭",
          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: 5301,
          serialNumber: '5301ScheduleParkFlag',
          tableId: "5301Schedule",
          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: 5301,
          serialNumber: '5301ScheduleTimeRequired',
          tableId: "5301Schedule",
          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: 5301,
          serialNumber: '5301SchedulePreOpsPlanFinishTime',
          tableId: "5301Schedule",
          tableName: "排产明细表",
          columnProp: "preOpsPlanFinishTime",
          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: 5301,
          serialNumber: '5301ScheduleRemark',
          tableId: "5301Schedule",
          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: 5301,
          serialNumber: '5301Schedule',
          tableId: "5301Schedule",
          tableName: "排产明细表",
          columnProp: "SAP参考号",
          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: 5301,
          serialNumber: '5301ScheduleCustPartNo',
          tableId: "5301Schedule",
          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: 5301,
          serialNumber: '5301ScheduleEficiency',
          tableId: "5301Schedule",
          tableName: "排产明细表",
          columnProp: "eficiency",
          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: 5301,
          serialNumber: '5301ScheduleDelayHours',
          tableId: "5301Schedule",
          tableName: "排产明细表",
          columnProp: "delayHours",
          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: 5301,
          serialNumber: '5301Schedule',
          tableId: "5301Schedule",
          tableName: "排产明细表",
          columnProp: "已排料",
          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: 5301,
          serialNumber: '5301Schedule',
          tableId: "5301Schedule",
          tableName: "排产明细表",
          columnProp: "排产完成时间早于上工序",
          headerAlign: "center",
          align: "center",
          columnLabel: "",
          columnWidth: 80,
          columnHidden: false,
          columnImage: false,
          columnSortable: false,
          sortLv: 0,
          status: true,
          fixed: false
        }
      ],
    }
  },
  mounted() {
    this.$nextTick(() => {
      this.height = window.innerHeight - 300;
    })
  },
  methods: {
    getResourceShiftData() {
      let queryData = {
        site: this.$store.state.user.site,
        workCenterNo: this.searchData.workCenterNo,
        resourceId: this.searchData.resourceId,
        scheduleDate: this.searchData.scheduleDate
      }
      getResourceRestList(queryData).then(({data}) => {
        this.resourceShiftList = data.rows
      })
    },
    getShopOrderList() {
      getShopOrderList(this.searchData).then(({data}) => {
        this.shopOrderList = data.rows
      })
    },
    getOrderScheduleList() {
      getOrderScheduleList(this.searchData).then(({data}) => {
        this.orderScheduleList = data.rows
      })
    },

    /*刷新页面table*/
    refreshPageTables(){
      this.getResourceShiftData();
      this.getShopOrderList();
      this.getOrderScheduleList();
    },

    /*开始排产的操作*/
    startScheduleOperation(row, $event){
      this.$message.error('字段time_required找不到!');
    }
  },
  created() {
    //执行查询休息时间数据
    this.getResourceShiftData();
    //查询工单的数据
    this.getShopOrderList();
    //查询派工的数据
    this.getOrderScheduleList();
  }
}
</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: 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;
}


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