<template>
  <div class="app-container" style="height: auto;position: relative">
    <div class="filter-container">
      <div style="display: inline-block;margin-right: 5px">当前上班人员:<span style="font-weight: bold;font-size: 16px;color: #F56C6C"> {{ name }}</span>({{ loginName }})</div>
      <el-input size="mini"  v-model="search.keyWord" placeholder="关键字" style="width: 200px;" class="filter-item"/>
      <el-button size="mini" class="filter-item" type="primary" icon="el-icon-search" @click="searchData">
        搜索
      </el-button>
      <el-button size="mini" class="filter-item" type="danger" @click="searchPrintBillList">
        查询施工单
      </el-button>
      <el-button size="mini" class="filter-item" type="primary" @click="handleMachine">
        查看机台任务
      </el-button>
      <el-button size="mini" class="filter-item" icon="el-icon-refresh" type="primary" @click="tableRefresh">
        刷新
      </el-button>
      <el-button class="filter-item" size="mini" type="warning" icon="el-icon-s-operation" @click="diyColumn">
        自定义列
      </el-button>
    </div>
    <div style="height: auto" class="rowHoverNone elTble">
      <el-table
        max-height="640"
        size="mini"
        :data="tableData"
        v-loading="listLoading"
        @row-contextmenu="rowContextmenu"
        :row-class-name="tableRowClassName"
        @row-click="handleClickTableRow"
        ref="multipleTable"
        tooltip-effect="light"
        row-key="id"
        border
        default-expand-all>
        <el-table-column
          label="#"
          fixed
          align="center"
          type="index"
          :index="indexMethod">
        </el-table-column>
        <el-table-column label="操作" fixed align="center" width="100px" class-name="small-padding fixed-width">
          <template slot-scope="scope">
            <el-button v-if="scope.row.workProcess.feedBackContent==0" :disabled="scope.row.pauseStatus==1"
                       @click="handleBackRecordStart(scope.row,scope.$index)" type="success" size="mini">
              反馈完成
            </el-button>
            <el-button v-if="scope.row.workProcess.feedBackContent==1 && scope.row.taskStatus==0"
                       :disabled="scope.row.pauseStatus==1" @click="handleBackRecordStart(scope.row,scope.$index)"
                       type="primary" size="mini">
              反馈开始
            </el-button>
            <el-button v-if="scope.row.workProcess.feedBackContent==1 && scope.row.taskStatus>0"
                       :disabled="scope.row.pauseStatus==1" @click="handleBackRecord(scope.row,scope.$index)"
                       type="success" size="mini">
              反馈完成
            </el-button>
            <el-button v-if="scope.row.workProcess.feedBackContent==2 && scope.row.taskStatus==0"
                       :disabled="scope.row.pauseStatus==1" @click="handleBackRecordStart(scope.row,scope.$index)"
                       type="primary" size="mini">
              反馈开始
            </el-button>
            <el-button v-if="scope.row.workProcess.feedBackContent==2 && scope.row.taskStatus>0"
                       :disabled="scope.row.pauseStatus==1" @click="handleBackRecord(scope.row,scope.$index)"
                       type="success" size="mini">
              反馈完成
            </el-button>
          </template>
        </el-table-column>
        <el-table-column
          fixed
          label="施工单号"
          width="160px"
        >
          <template slot-scope="{row}">
            <el-tooltip :content="getCodeName(row)" placement="top-start" effect="light">
              <a @click="getOrderStep(row.printBill.id)" style="color: #409EFF" href="javascript:;" class="ellipsis">
                {{ row.printBill.billCode }}-{{ row.printBreed.breedName }}</a>
            </el-tooltip>
          </template>
        </el-table-column>
        <el-table-column
          fixed
          label="印品名称"
          width="110px"
          show-overflow-tooltip
        >
          <template slot-scope="{row}">
            <a href="javascript:;" style="color: #20a0ff" @click="handleDetail(row.printBill.id)" class="ellipsis">
              {{ row.printBill.billName }}</a>
            <el-image v-if="row.printBill.importantBill == 1" :src="new_badge"></el-image>
          </template>
        </el-table-column>
        <template v-for="column in columnTable">
          <el-table-column  v-if="column.columnTitle == 'taskStatus'" label="生产状态" align="center" :width="column.columnWidth" class-name="small-padding fixed-width">
            <template slot-scope="{row}">
              <div v-if="row.pauseStatus==0">
                <el-tag size="mini" type="info" v-if="row.taskStatus==0">未开始</el-tag>
                <!--            <el-tag type="warning" type="info" v-if="row.taskStatus==0 && row.pauseStatus==1">暂停</el-tag>-->
                <el-tag size="mini" type="success" v-if="row.taskStatus==1">生产中</el-tag>
                <el-tag size="mini" type="danger" v-if="row.taskStatus==2">终止</el-tag>
                <el-tag size="mini" type="" v-if="row.taskStatus==5">完成</el-tag>
                <el-tag size="mini" type="su" v-if="row.taskStatus==10">已完成</el-tag>
              </div>
              <div v-if="row.pauseStatus==1">
                <el-tag size="mini" type="warning">暂停</el-tag>
              </div>
            </template>
          </el-table-column>
          <el-table-column
            label="施工单消息"
            v-else-if="column.columnTitle == 'breedMsg'"
            :width="column.columnWidth"
            show-overflow-tooltip
          >
            <template slot-scope="{row}">
              <template v-if="row.breedMsg">
                <el-button size="mini" circle icon="el-icon-plus" @click="openMessage(row)"></el-button>
                <span
                  style="color: #20a0ff;cursor: pointer"
                  @click="openMessage(row)"> {{ row.breedMsg }}</span>
              </template>
              <template v-else>
                <el-button size="mini" circle icon="el-icon-plus" @click="openMessage(row)"></el-button>
              </template>
            </template>
          </el-table-column>
          <el-table-column
            label="拼版要求"
            show-overflow-tooltip
            v-else-if="column.columnTitle == 'assembleBreedRequire'"
            :width="column.columnWidth"
          >
            <template slot-scope="{row}">
                      <span>
                        {{ row.printBill.assembleBreedRequire }}
                      </span>
            </template>
          </el-table-column>
          <el-table-column
            label="印刷要求"
            v-else-if="column.columnTitle == 'orderPrintRequire'"
            :width="column.columnWidth"
            show-overflow-tooltip
          >
            <template slot-scope="{row}">
            <span>
              {{ row.printBill.orderPrintRequire }}
            </span>
            </template>
          </el-table-column>
          <el-table-column
            label="印刷机台"
            show-overflow-tooltip
            v-if="column.columnTitle == 'machineName'"
            :width="column.columnWidth"
          >
            <template slot-scope="{row}">
              {{ row.machineName }}
            </template>
          </el-table-column>

          <el-table-column
            label="客户名称"
            v-else-if="column.columnTitle == 'clientName'"
            :width="column.columnWidth"
            show-overflow-tooltip
          >
            <template slot-scope="{row}">
              <span> {{ row.printBill.clientName }}</span>
            </template>
          </el-table-column>

          <el-table-column
            label="产品类型"
            show-overflow-tooltip
            v-else-if="column.columnTitle == 'productName'"
            :width="column.columnWidth"
          >
            <template slot-scope="{row}">
              <span> {{ row.printBill.productName }}</span>
            </template>
          </el-table-column>
          <el-table-column
            label="用纸"
            show-overflow-tooltip
            v-else-if="column.columnTitle == 'actualPaperName'"
            :width="column.columnWidth"
          >
            <template slot-scope="{row}">
              <span> {{ row.printBreed.actualPaperName }}</span>
            </template>
          </el-table-column>
          <el-table-column
            v-else-if="column.columnTitle == 'wholePaperCount'"
            :width="column.columnWidth"
            label="大纸张数">
            <template slot-scope="{row}">
              {{ row.printBreed.wholePaperCount }}
            </template>
          </el-table-column>
          <el-table-column
            v-else-if="column.columnTitle == 'cutName'"
            :width="column.columnWidth"
            label="开数">
            <template slot-scope="{row}">
              {{ row.printBreed.cutName }}
            </template>
          </el-table-column>
          <el-table-column
            v-else-if="column.columnTitle == 'cutSize'"
            :width="column.columnWidth"
            label="开纸尺寸">
            <template slot-scope="{row}">
              {{ row.printBreed.cutSize }}
            </template>
          </el-table-column>
          <el-table-column
            v-else-if="column.columnTitle == 'assembleStatus'"
            :width="column.columnWidth"
            label="拼版状态">
            <template slot-scope="{row}">
              <el-tag size="mini" type="info" v-if="row.assembleStatus=='未开始'">{{ row.assembleStatus }}</el-tag>
              <el-tag size="mini" type="warning" v-if="row.assembleStatus=='生产中'">{{ row.assembleStatus }}</el-tag>
              <el-tag size="mini" type="success" v-if="row.assembleStatus=='完成'">{{ row.assembleStatus }}</el-tag>

            </template>
          </el-table-column>
          <el-table-column
            v-else-if="column.columnTitle == 'assembleMan'"
            :width="column.columnWidth"
            label="拼版人">
            <template slot-scope="{row}">
            <span v-if="row.assembleStatus!='未开始'">
              {{ row.assembleMan }}
            </span>

            </template>
          </el-table-column>
          <el-table-column
            v-else-if="column.columnTitle == 'cutPaperStatus'"
            :width="column.columnWidth"
            label="白料状态">
            <template slot-scope="{row}">
              <el-tag size="mini" type="info" v-if="row.cutPaperStatus=='未开始'">{{ row.cutPaperStatus }}</el-tag>
              <el-tag size="mini" type="warning" v-if="row.cutPaperStatus=='生产中'">{{ row.cutPaperStatus }}</el-tag>
              <el-tag size="mini" type="success" v-if="row.cutPaperStatus=='完成'">{{ row.cutPaperStatus }}</el-tag>
            </template>
          </el-table-column>
          <el-table-column
            v-else-if="column.columnTitle == 'cutPaperMan'"
            :width="column.columnWidth"
            label="白料人">
            <template slot-scope="{row}">
            <span v-if="row.cutPaperStatus!='未开始'">
              {{ row.cutPaperMan }}
            </span>
            </template>
          </el-table-column>
          <el-table-column
            v-else-if="column.columnTitle == 'madeBreedStatus'"
            :width="column.columnWidth"
            label="制版状态">
            <template slot-scope="{row}">
              <el-tag size="mini" type="info" v-if="row.madeBreedStatus=='未开始'">{{ row.madeBreedStatus }}</el-tag>
              <el-tag size="mini" type="warning" v-if="row.madeBreedStatus=='生产中'">{{ row.madeBreedStatus }}</el-tag>
              <el-tag size="mini" type="success" v-if="row.madeBreedStatus=='完成'">{{ row.madeBreedStatus }}</el-tag>
            </template>
          </el-table-column>
          <el-table-column
            v-else-if="column.columnTitle == 'madeBreedMan'"
            :width="column.columnWidth"
            label="制版人">
            <template slot-scope="{row}">
            <span v-if="row.madeBreedStatus!='未开始'">
              {{ row.madeBreedMan }}
            </span>
            </template>
          </el-table-column>
          <el-table-column
            v-else-if="column.columnTitle == 'printStatus'"
            :width="column.columnWidth"
            label="印刷状态">
            <template slot-scope="{row}">
              <el-tag size="mini" type="info" v-if="row.printStatus=='未开始'">{{ row.printStatus }}</el-tag>
              <el-tag size="mini" type="warning" v-if="row.printStatus=='生产中'">{{ row.printStatus }}</el-tag>
              <el-tag size="mini" type="success" v-if="row.printStatus=='完成'">{{ row.printStatus }}</el-tag>
            </template>
          </el-table-column>
          <el-table-column
            v-else-if="column.columnTitle == 'printMan'"
            :width="column.columnWidth"
            label="印刷人">
            <template slot-scope="{row}">
            <span v-if="row.printStatus!='未开始'">
              {{ row.printMan }}
            </span>
            </template>
          </el-table-column>
          <el-table-column
            v-else-if="column.columnTitle == 'deliveryDate'"
            :width="column.columnWidth"
            label="交货时间"
          >
            <template slot-scope="{row}">
              {{ row.printBill.deliveryDate  | getTime }}
            </template>
          </el-table-column>
          <el-table-column
            v-else-if="column.columnTitle == 'paperStatusInfo'"
            :width="column.columnWidth"
            show-overflow-tooltip
            label="纸张状态">
            <template slot-scope="{row}">
              <span v-for="(item, index) in row.paperStatusInfo.split('/')" :key="index">
                <span v-if="item.indexOf('未')!=-1">{{item}}&nbsp;&nbsp;</span>
                <span style="color: #67C23A" v-if="item.indexOf('已')!=-1">{{item}}&nbsp;&nbsp;</span>
              </span>
            </template>
          </el-table-column>
          <el-table-column
            v-else-if="column.columnTitle == 'breedFlipType'"
            :width="column.columnWidth"
            label="版式">
            <template slot-scope="{row}">
              <span v-if="row.printBreed.breedFlipType==1">正反</span>
              <span v-if="row.printBreed.breedFlipType==2">滚翻</span>
              <span v-if="row.printBreed.breedFlipType==3">自翻</span>
              <span v-if="row.printBreed.breedFlipType==4">单面</span>
            </template>
          </el-table-column>
          <el-table-column
            v-else-if="column.columnTitle == 'breedSets'"
            :width="column.columnWidth"
            label="版套数">
            <template slot-scope="{row}">
              {{ row.printBreed.breedSets }}
            </template>
          </el-table-column>
          <el-table-column
            v-else-if="column.columnTitle == 'printCount'"
            :width="column.columnWidth"
            label="印量">
            <template slot-scope="{row}">
              {{ row.printBreed.printCount }}
            </template>
          </el-table-column>
          <el-table-column
            v-else-if="column.columnTitle == 'lastOperateManName'"
            :width="column.columnWidth"
            prop="lastOperateManName"
            label="最后操作人名字">
          </el-table-column>

          <el-table-column
            v-else-if="column.columnTitle == 'billMemo'"
            :width="column.columnWidth"
            show-overflow-tooltip
            prop="billMemo"
            label="备注">
          </el-table-column>
          <el-table-column
            v-else-if="column.columnTitle == 'createTime'"
            :width="column.columnWidth"
            label="创建时间"
          >
            <template slot-scope="scope">
              <span v-if="scope.row.createTime">{{ scope.row.createTime | getTime }}</span>
            </template>
          </el-table-column>
        </template>
      </el-table>
            <pagination v-show="listData.total>0" :total="listData.total" :page.sync="listData.page"
                        :limit.sync="listData.pageSize" @pagination="getTableInfo"/>
    </div>

    <el-dialog :title="printbilTitle" :visible.sync="printbilVisible" width="500px">
      <el-form :model="printForm" label-width="50px" label-position="right">
        <el-form-item  label="备注">
          <el-input type="textarea" v-model="printForm.taskMemo"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="printbilVisible = false">取 消</el-button>
        <el-button :disabled="disabledBtn" type="primary" @click="printBtn">确 定</el-button>
      </div>
    </el-dialog>
    <el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="500px">
      <el-form :model="ruleForm" label-width="100px" :rules="rules" ref="ruleForm" label-position="left">
        <el-form-item v-show="workProcessShow" prop="isComplete" label="是否反馈完成">
          <el-checkbox v-model="ruleForm.isComplete">任务已完成</el-checkbox>
        </el-form-item>
        <el-form-item v-show="feedBackContentVisible" prop="feedbackCount"  label="反馈数量">
          <el-input oninput = "value=value.replace(/[^0-9]/gi,'')" v-model.trim="ruleForm.feedbackCount"></el-input>
        </el-form-item>
        <el-form-item label="反馈备注">
          <el-input type="textarea" v-model="ruleForm.memo"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="backRecordBtn">确 定</el-button>
      </div>
    </el-dialog>
    <!--    <servicedialog @tableRefresh="tableRefresh" ref="menuDialog" :dialogStatus="dialogStatus" :menuId="menuId" :titleDialog="titleDialog" :dialogVisible="dialogVisible"/>-->
    <cancledialog @tableRefresh="tableRefresh" ref="confirmDialog"></cancledialog>
    <right-menu :btnShow="btnShow" :btnList="btnList" v-if="menuVisible" @foo="foo" ref="rightmenu"
                @handleOne="handleOne" @handleTwo="handleTwo"></right-menu>
    <el-drawer
      title="施工单消息"
      :reverse="true"
      :visible.sync="memoDrawer"
      size="600px">
      <order-message @handleAddBreed="handleAddBreed" ref="orderMessage"></order-message>
    </el-drawer>
    <printbill-detail ref="printbillDetail"></printbill-detail>
    <print-step ref="printStep"></print-step>
    <column-edit @saveColum="saveColum" ref="columnEdit"></column-edit>
    <div v-show="machinefListVisible" style="width: 100%;position: fixed;left: 0px;height: 510px;z-index: 1024;background: #fff;bottom:0px;border-top: 1px solid #ddd;overflow-y: auto">
      <machinef-list @closeDrawer="closeDrawer" @searchList="searchList" ref="machinefList"></machinef-list>
    </div>

  </div>
</template>

<script>
import {
  getPageInfo,
  taskFeedbackPause,
  feedbackTask,
  taskFeedbackStart, getPageTableColumn, savePageTableColumn
} from '@/api/feedBack/feedBack.js'
import Cancledialog from '@/components/Dialog/Cancledialog.vue';
import { mapGetters } from 'vuex';
import OrderMessage from './orderMessage/orderMessage'
import rightMenu from '@/components/rightMenu/index.vue'
import PrintbillDetail from "@/components/printbillDetail/printbillDetail";
import machinefList from "@/components/machinefList/machinefList";
import printStep from "@/components/printbillDetail/printStep";
import columnEdit from "@/components/columnEdit/list.vue";
import new_badge from '@/assets/new_badge.gif'

const defaultItems = [
  {
    columnName: '生产状态', id: 1, columnTitle: 'taskStatus', columnWidth: '110'
  },
  {
    columnName: '施工单消息', id: 2, columnTitle: 'breedMsg', columnWidth: '180'
  },
  {
    columnName: '出版备注', id: 3, columnTitle: 'assembleBreedRequire', columnWidth: '110'
  },
  {
    columnName: '印刷要求', id: 4, columnTitle: 'orderPrintRequire', columnWidth: '110'
  },
  {
    columnName: '印刷机台', id: 5, columnTitle: 'machineName', columnWidth: '110'
  },
  {
    columnName: '客户名称', id: 6, columnTitle: 'clientName', columnWidth: '130'
  },
  {
    columnName: '产品类型', id: 7, columnTitle: 'productName', columnWidth: '120'
  },
  {
    columnName: '用纸', id: 8, columnTitle: 'actualPaperName', columnWidth: '150'
  },
  {
    columnName: '大纸张数', id: 9, columnTitle: 'wholePaperCount', columnWidth: '130'
  },
  {
    columnName: '开数', id: 10, columnTitle: 'cutName', columnWidth: '100'
  },
  {
    columnName: '开纸尺寸', id: 11, columnTitle: 'cutSize', columnWidth: '120'
  },
  {
    columnName: '拼版状态', id: 12, columnTitle: 'assembleStatus', columnWidth: '100'
  },
  {
    columnName: '拼版人', id: 13, columnTitle: 'assembleMan', columnWidth: '120'
  },
  {
    columnName: '白料状态', id: 14, columnTitle: 'cutPaperStatus', columnWidth: '100'
  },
  {
    columnName: '白料人', id: 15, columnTitle: 'cutPaperMan', columnWidth: '90'
  },
  {
    columnName: '制版状态', id: 16, columnTitle: 'madeBreedStatus', columnWidth: '100'
  }, {
    columnName: '制版人', id: 17, columnTitle: 'madeBreedMan', columnWidth: '90'
  },
  {
    columnName: '印刷状态', id: 18, columnTitle: 'printStatus', columnWidth: '120'
  },
  {
    columnName: '印刷人', id: 19, columnTitle: 'printMan', columnWidth: '90'
  },
  {
    columnName: '交货时间', id: 20, columnTitle: 'deliveryDate', columnWidth: '120'
  },
  {
    columnName: '纸张状态', id: 21, columnTitle: 'paperStatusInfo', columnWidth: '220'
  },
  {
    columnName: '版式', id: 22, columnTitle: 'breedFlipType', columnWidth: '50'
  },
  {
    columnName: '版套数', id: 23, columnTitle: 'breedSets', columnWidth: '50'
  },
  {
    columnName: '印量', id: 24, columnTitle: 'printCount', columnWidth: '70'
  },
  {
    columnName: '最后操作人名字', id: 25, columnTitle: 'lastOperateManName', columnWidth: '100'
  },
  {
    columnName: '备注', id: 26, columnTitle: 'billMemo', columnWidth: '150'
  },
  {
    columnName: '创建时间', id: 27, columnTitle: 'createTime', columnWidth: '130'
  }
]
export default {
  computed: {
    ...mapGetters([
      'name',
      'loginName'
    ]),
  },
  components: {
    Cancledialog,
    rightMenu,
    OrderMessage,
    PrintbillDetail,
    printStep,
    machinefList,
    columnEdit
  },
  data() {
    return {
      disabledBtn:"",
      new_badge: new_badge,
      defaultItemCopyData:[],
      columnTable: [],
      clickCheckId:"",
      machinefListVisible:false,
      heightTable:"auto",
      rowIndex:999,
      rowData:{},
      activities: [],
      avtiveStep: true,
      activitiesArray: [],
      memoDrawer: false,
      workProcessShow:false,
      btnShow:false,
      row:{},
      btnList:[
        {name: '暂停'},
        {name: '反馈'}
      ],
      menuVisible:false,
      printbilVisible:false,
      printbilTitle:"",
      feedBackContentVisible:false,

      multipleSelection: [],
      multipleSelection2:[],
      dialogStatus: 1,//1增加，2修改
      dialogTitle: '',
      dialogVisible: false,
      search: {
        keyWord: '',
        idProcess:'',
        // idMachineInfo:""
      },
      printForm:{},
      ruleForm: {},
      rules: {
        feedbackCount: [
          { type: 'number', message: '必须为数字值'}
        ]
      },
      listData: {
        total: 0,
        page: 1,
        pageSize: 30
      },
      confirmdialog: false,
      listLoading: false,
      tableData: [],
      menuId: ''
    }
  },
  mounted() {
    var url = window.location.href.split(":id");
    this.search.idProcess=url[1];
    this.tableData = [];
    this.getTableInfo();
    this.getColum();
  },
  methods: {
    searchPrintBillList(){
      const _that = this;
      if (!_that.search.keyWord) {
        _that.$message("施工单号不能为空");
        return
      }
      _that.$router.push({path:'/printbill/listSearch',query:{printbillCode:_that.search.keyWord}})
    },
    getColum() {
      const _that = this;
      var Infos = {};
      _that.defaultItemCopyData = JSON.parse(JSON.stringify(defaultItems));
      getPageTableColumn(Infos, "白料裁切反馈").then(response => {
        _that.$refs.columnEdit.tableItem = response.data;
        if (response.data.length <= 0) {
          _that.columnTable = defaultItems;
          _that.$refs.columnEdit.defaultItem = defaultItems;
        } else {
          _that.columnTable = response.data;
          for (let i = 0; i < response.data.length; i++) {
            var datai = response.data[i];
            for (let j = 0; j < _that.defaultItemCopyData.length; j++) {
              var dataj = _that.defaultItemCopyData[j];
              if(datai.columnTitle == dataj.columnTitle){
                _that.defaultItemCopyData.splice(j,1);
              }
            }
          }
          _that.$refs.columnEdit.defaultItem = _that.defaultItemCopyData
        }
      }).catch(err => {
        _that.$message.error(err);
      })
    },
    saveColum(data, pageName) {
      // console.log("1123", data);
      const _that = this;
      for (let i = 0; i < data.length; i++) {
        var item = data[i];
        _that.$set(item, 'pageName', "白料裁切反馈");
        _that.$set(item, 'columnIndex', i);
      }

      var Infos = JSON.stringify(data);
      savePageTableColumn(Infos, "白料裁切反馈").then(response => {
        _that.$message("保存成功");
        _that.$refs.columnEdit.columnVisible = false;
        _that.listData.page = 1;
        _that.search.idMachineInfo = "";
        _that.search.keyWord = "";
        _that.tableData = [];
        _that.machinefListVisible = false;
        _that.getTableInfo();
        _that.getColum();

      }).catch(err => {
        _that.$message.error(err);
      })
    },
    diyColumn() {
      const _that = this;
      _that.$refs.columnEdit.columnVisible = true;
      _that.$refs.columnEdit.defaultItem = defaultItems;
      _that.$refs.columnEdit.form.pageName = "白料裁切反馈";
      _that.getColum();
    },
    tableRowClassName({row, rowIndex}) {
      var _that = this;
      if (row.id == _that.clickCheckId ) {
        return 'primary-row';
      }
    },
    handleClickTableRow(row, event, column) {
      const _that = this;
      _that.clickCheckId = row.id;
    },
    searchList(id){
      const _that = this;
      _that.search.idMachineInfo = id;
      _that.listData.page=1;
      _that.tableData = [];
      _that.getTableInfo();
    },
    //获取机台任务
    handleMachine(){
      const _that = this;
      _that.machinefListVisible = true;
      _that.$refs.machinefList.getMachine(_that.$refs.machinefList.activeName,_that.$refs.machinefList.activeIndex);
    },
    handleAddBreed(breedMsg){
      this.memoDrawer = false;
      this.rowData.breedMsg =breedMsg;
    },
    handleDetail(id) {
      const _that = this;
      _that.$refs.printbillDetail.idOrder = id;
      _that.$refs.printbillDetail.printVisible = true;
      _that.$refs.printbillDetail.getDetail();
    },
    getOrderStep(id) {
      const _that = this;
      _that.$refs.printStep.idOrder = id;
      _that.$refs.printStep.drawer = true;
      _that.$refs.printStep.getStep();
    },
    handleClose() {
      const _that = this;
      _that.avtiveStep = !_that.avtiveStep;
      _that.activitiesArray = _that.activities.slice(0, 9);
    },
    handleOpen() {
      const _that = this;
      _that.avtiveStep = !_that.avtiveStep;
      _that.activitiesArray = _that.activities;
    },
    // 订单消息
    openMessage(row) {
      var _that = this
      _that.memoDrawer = true;
      _that.rowData = row;
      _that.$nextTick(function() {
        // console.log(_that.$refs.orderMemo);
        _that.$refs.orderMessage.idOrder = row.id;
        _that.$refs.orderMessage.idPrint = row.idPrintBreed;
        _that.$refs.orderMessage.idPrintBill = row.idPrintBill;
        _that.$refs.orderMessage.sMessage = "";
        _that.$refs.orderMessage.getList()
      })
    },
    handleTwo(){
      const _that = this;
    },
    handleOne(row){
      const _that = this;
      _that.rowData = row;
      console.log(row);
      if(row.pauseStatus==1){
        _that.printbilTitle = "确定启动？";
        _that.printForm={
          id: row.id,
          taskStatus: row.taskStatus,
          taskMemo: ""
        }
      }else if(row.pauseStatus==0){
        _that.printbilTitle = "确定暂停？";
        _that.printForm={
          id: row.id,
          taskStatus: row.taskStatus,
          taskMemo: ""
        }
      }

      _that.disabledBtn = false;
      _that.printbilVisible = true
    },
    getCodeName(row){
      return row.printBill.billCode+"-"+row.printBreed.breedName
    },
    getPaper(row){
      return row.printBreed.cutSize+"-"+row.printBreed.paperName;
    },
    printBtn(){
      const _that = this;
      console.log(_that.printForm);

      if(!_that.printForm.taskMemo && _that.rowData.pauseStatus==0){
        _that.$message.warning("备注信息不能为空");
        return
      }
      _that.printbilVisible =false;
      _that.disabledBtn = true;
      if(_that.rowData.pauseStatus==0){
        var Infos = {
          "task": JSON.stringify(_that.printForm),
        }

        taskFeedbackPause(Infos).then(response => {
          console.log("taskFeedbackPause", response);
          _that.$message("暂停成功");
          _that.printbilVisible =false
          _that.rowData.pauseStatus = 1;
          _that.rowData.breedMsg =response.data.breedMsg;


        }).catch(err => {
          _that.$message.error(err);
        })
      }else if(_that.rowData.pauseStatus==1){
        var Infos = {
          "task": JSON.stringify(_that.printForm),
        }
        taskFeedbackStart(Infos).then(response => {
          console.log("taskFeedbackPause", response);
          _that.$message("启动成功");
          _that.printbilVisible =false
          _that.rowData.pauseStatus = 0;
          _that.rowData.breedMsg =response.data.breedMsg;
        }).catch(err => {
          _that.$message.error(err);
        })
      }
    },
    backRecordBtn(){
      const _that = this;
      // console.log(_that.ruleForm);
      if(_that.ruleForm.feedbackCount<=0 && _that.feedBackContentVisible){
        _that.$message.warning("反馈数量不能小于0");
        return
      }
      if(!_that.ruleForm.memo){
        // _that.$message.warning("备注信息不能为空");
        // return
      }
      var Infos = {
        "item": JSON.stringify(_that.ruleForm),
      }
      feedbackTask(Infos).then(response => {
        // console.log("feedbackTask", response);
        _that.$message("成功");
        _that.dialogVisible =false;
        _that.tableData.splice(_that.rowIndex,1);
        _that.listData.page=1;

      }).catch(err => {
        _that.$message.error(err);
      })
    },
    handleBackRecordStart(row,rowIndex){
      // console.log(row.pauseStatus);
      // rowIndex
      const _that = this;
      _that.rowIndex  = rowIndex;
      _that.dialogTitle = "版任务反馈";
      _that.rowData = row;
      _that.ruleForm={
        idTask: row.id,
        taskStatus: row.taskStatus,
        isComplete: true,
        feedbackCount:0,
        memo: "",
      }
      this.$confirm('确定操作？', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        var Infos = {
          "item": JSON.stringify(_that.ruleForm),
        }
        feedbackTask(Infos).then(response => {
          console.log("feedbackTask", response);
          _that.$message("反馈成功");

          if(row.workProcess.feedBackContent==0){
            _that.tableData.splice(_that.rowIndex,1);
            _that.listData.page=1;
          }else {
            _that.rowData.taskStatus = 1;
          }
        }).catch(err => {
          _that.$message.error(err);
        })
      }).catch(() => {
      });
    },
    //版任务数量反馈
    handleBackRecord(row,rowIndex){
      const _that = this;
      _that.rowData = row;
      _that.rowIndex  = rowIndex;
      _that.dialogTitle = "版任务反馈";
      // console.log(row.workProcess.feedBackContent);
      if(row.workProcess.feedBackContent==0){

      }else if(row.workProcess.feedBackContent==1){
        _that.workProcessShow = false;
        _that.dialogVisible = true;
        _that.feedBackContentVisible = false;
        _that.ruleForm={
          idTask: row.id,
          taskStatus: row.taskStatus,
          isComplete: true,
          feedbackCount:0,
          memo: "",
        }
      }else if(row.workProcess.feedBackContent==2){
        _that.workProcessShow = true;
        _that.dialogVisible = true;
        _that.ruleForm.isComplete = false;
        _that.feedBackContentVisible = true;
      }
      return;
      _that.workProcessShow = true;
      if(row.workProcess.feedBackContent==2){
        _that.feedBackContentVisible = true;
      }
      _that.ruleForm={
        idTask: row.id,
        taskStatus: row.taskStatus,
        isComplete: false,
        feedbackCount:0,
        memo: ""
      }
      if(row.workProcess. feedBackContent==0 || row.workProcess. feedBackContent==1 || row.workProcess. feedBackContent==2){
        _that.workProcessShow = false;
        _that.ruleForm.isComplete = true;
      }
      // console.log(row);

      _that.dialogVisible = true;
    },
    //任务暂停
    handlePause(id,pauseStatus){

    },
    //获取列表
    getTableInfo() {
      const _that = this
      _that.listLoading = true;
      var params = _that.search;
      var page = {
        pageIndex:_that.listData.page,
        pageSize: _that.listData.pageSize
      }
      var data = {
        "params": JSON.stringify(params),
        "page": JSON.stringify(page),
      }
      // console.log(data);
      getPageInfo(data).then(response => {
        _that.listData.total = response.total;
        if(response.data.length>0){
          _that.tableData = response.data
        }
        _that.listLoading = false
      }).catch(err => {
        _that.$message.error(err);
        _that.listLoading = false
      })
    },

    //刷新表格
    tableRefresh() {
      this.listData.page = 1;
      this.search.idMachineInfo = "";
      this.search.keyWord = "";
      this.tableData = [];
      this.machinefListVisible = false;
      this.getTableInfo()
    },
    closeDrawer(){
      this.machinefListVisible = false;
    },
    //搜索
    searchData() {
      this.listData.page = 1;
      this.search.idMachineInfo = "";
      this.tableData = [];
      this.getTableInfo()
    },
    //序号
    indexMethod(index) {
      return index+1;
    },
    rowContextmenu(row, column, event) {
      const _that = this;
      _that.row = row;
      _that.clickCheckId = row.id;
      if(row.pauseStatus==1){
        _that.btnList[0].name="启动";
        _that.btnShow = true;
      }
      if(row.pauseStatus==0){
        _that.btnList[0].name="暂停";
        _that.btnShow = false;
      }
      _that.menuVisible = false;
      _that.menuVisible = true;

      // _that.$refs.multipleTable.toggleRowSelection(row);
      // 阻止右键默认行为
      event.preventDefault()
      _that.$nextTick(() => {
        _that.$refs.rightmenu.init(row, column, event);
      })
    },
    foo() { // 取消鼠标监听事件 菜单栏
      this.menuVisible = false;
      document.removeEventListener('click', this.foo)
    },
  }
}
</script>
<style>
/*.el-drawer__container .el-drawer__open{*/
/*  height: 400px !important;*/
/*}*/
/*.el-drawer__wrapper{*/
/*  height: 400px !important;*/
/*  position: fixed !important;*/
/*  bottom: 0px !important;*/
/*}*/
/*.el-drawer__container{*/
/*  height: 400px !important;*/
/*  position: fixed !important;*/
/*  bottom: 0px !important;*/
/*}*/
</style>

<style lang="scss" scoped>
::v-deep .el-table__fixed {
  bottom: 15px !important;
}
::v-deep .elTble .el-table .primary-row {
  background: #8cc5ff!important;
  color: #fff!important;
}
.machineInfList{}
aside{
  background: #eef1f6;
  padding: 18px 24px;
  margin-bottom: 20px;
  border-radius: 2px;
  display: block;
  line-height: 32px;
  font-size: 16px;
  font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;
  color: #2c3e50;
  -webkit-font-smoothing: antialiased;
}
.filter-container {
  margin-bottom: 15px;
}
.text-task {
  font-size: 14px;
  text-align: center;
  color: #7c7c7c;
  margin-left: 15px;
}
</style>

