<template>
  <div class="app-container">
    <el-table
      :data="itemList"
    >
      <!-- 序号 -->
      <el-table-column
        type="index"
        width="90"
        align="center"
        :index="indexMethod"
        label="序号"
        fixed
      />
      <el-table-column
        label="单号"
        align="center"
        width="200"
        prop="orderCode"
        fixed
      />
      <el-table-column
        label="循环周期"
        align="center"
        prop="planLoop"
        width="80"
      />
      <el-table-column
        label="实际开始时间"
        align="center"
        prop="orderStart"
        width="200"
      />
      <el-table-column
        label="实际结束时间"
        align="center"
        prop="orderEnd"
        width="200"
      />
      <el-table-column
        label="工单状态"
        align="center"
        prop="orderStatus"
        width="100"
      >
        <template slot-scope="scope">
          {{
            scope.row.orderStatus == 0
            ? "待处理"
            : scope.row.orderStatus == 1
            ? "已完成"
            : scope.row.orderStatus == 2
            ? "已逾期"
            : scope.row.orderStatus == 3
            ? "进行中"
            : ""
          }}
        </template>
      </el-table-column>
      <el-table-column
        label="工单费用"
        align="center"
        prop="orderCost"
        width="100"
      />
      <el-table-column
        label="责任人"
        align="center"
        prop="planPerson"
        width="100"
      />
      <el-table-column
        label="工单用时"
        align="center"
        prop="orderCostTime"
        width="100"
      />
      <el-table-column
        label="签字"
        align="center"
        prop="orderSignPerson"
        width="100"
      />
    </el-table>

    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

  </div>
</template>

<script>
import { getBYRecordsList } from "@/api/wms/equipment";
import { Message } from "element-ui";

export default {
  name: "MdItemSingle",
  dicts: ["equipment_status"],
  data() {
    return {
      itemList :[],
      showFlag: false,
      // 选中数组
      selectedItemId: undefined,
      selectedRows: undefined,
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        equipmentCode: this.equipmentCode,
      },
    };
  },

  props: {
    equipmentCode: undefined,
    optType: undefined,
  },

  created() {
    this.getList();
  },

  methods: {
    // 取消按钮
    cancel() {
      this.showFlag = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        itemId: null,
        itemCode: this.processId,
        itemType: null,
      };
      this.resetForm("form");
    },

    // 生成表头序号
    indexMethod(index) {
      return index + 1;
    },

    /** 查询设备编码列表*/
    getList() {
      getBYRecordsList(this.queryParams).then((response) => {
        this.itemList = response.rows;
        this.total = response.total;
      });
    },

  },
};
</script>
