<template>
  <basic-container>
    <avue-crud
      :option="option"
      :table-loading="loading"
      :data="data"
      v-model:page="page"
      v-model="form"
      ref="crud"
      @search-change="searchChange"
      @search-reset="searchReset"
      @selection-change="selectionChange"
      @current-change="currentChange"
      @size-change="sizeChange"
      @refresh-change="refreshChange"
      @on-load="onLoad"
    >
      <template #menu="{ row }">
        <el-button type="text">返工工艺</el-button>
        <el-button type="text" @click="receiveData(row)">接收</el-button>
        <el-button type="text" @click="finishData(row)">完成</el-button>
      </template>
    </avue-crud>
  </basic-container>
</template>
<script>
export default {
  data() {
    return {
      page: {},
      data: [],
      form: {},
      option: {
        tip: false,
        height: "auto",
        calcHeight: 32,
        columnSort: true,
        // simplePage: true,
        searchShow: true,
        searchMenuSpan: 6,
        searchIcon: true,
        searchIndex: 3,
        tree: false,
        border: true,
        index: true,
        selection: true,
        viewBtn: false,
        delBtn: false,
        addBtn: false,
        editBtn: false,
        editBtnText: "修改",
        viewBtnText: "详情",
        addBtnIcon: " ",
        viewBtnIcon: " ",
        delBtnIcon: " ",
        editBtnIcon: " ",
        labelWidth: "200px",
        dialogWidth: 600,
        dialogClickModal: false,
        searchEnter: true,
        filterBtn: true,
        searchShowBtn: false,
        excelBtn: true,
        showOverflowTooltip: true,
        align: "center",
        searchLabelPosition: "left",
        searchLabelPosition: "left",
        searchGutter: 24,
        searchSpan: 6,
        menuAlign: "left",
        gridBtn: false,
        searchMenuPosition: "right",
        column: [
          {
            label: "返修单号",
            prop: "searchCode",
            searchLabelWidth: 150,
            search: true,
            hide: true,
            addDisplay: false,
            viewDisplay: false,
            editDisplay: false,
            sortable: true,
            filter: true,
            addDisplay: false,
            editDisplay: false,
            viewDisplay: false,
            span: 24,
            width: 200,
            rules: [
              {
                required: true,
                message: "请输入流程卡号",
                trigger: "blur",
              },
            ],
          },
          {
            label: "返工单号",
            prop: "redono",
            searchLabelWidth: 150,
            search: true,
            sortable: true,
            filter: true,
            addDisplay: false,
            editDisplay: false,
            viewDisplay: false,
            span: 24,
            width: 200,
            rules: [
              {
                required: true,
                message: "请输入返工单号",
                trigger: "blur",
              },
            ],
          },
          {
            label: "路线编号",
            prop: "seqno",
            searchLabelWidth: 150,
            search: false,
            sortable: true,
            filter: true,
            addDisplay: false,
            editDisplay: false,
            viewDisplay: false,
            span: 24,
            width: 200,
            rules: [
              {
                required: true,
                message: "请输入路线编号",
                trigger: "blur",
              },
            ],
          },
          {
            label: "发生单位",
            prop: "usedept",
            searchLabelWidth: 150,
            search: false,
            sortable: true,
            filter: true,
            addDisplay: false,
            editDisplay: false,
            viewDisplay: false,
            span: 24,
            width: 200,
            rules: [
              {
                required: true,
                message: "请输入发生单位",
                trigger: "blur",
              },
            ],
          },
          {
            label: "物料号",
            prop: "prtno",
            searchLabelWidth: 150,
            search: true,
            sortable: true,
            filter: true,
            addDisplay: false,
            editDisplay: false,
            viewDisplay: false,
            span: 24,
            width: 200,
            rules: [
              {
                required: true,
                message: "请输入物料号",
                trigger: "blur",
              },
            ],
          },
          {
            label: "数量",
            prop: "amount",
            searchLabelWidth: 150,
            search: false,
            sortable: true,
            filter: true,
            addDisplay: false,
            editDisplay: false,
            viewDisplay: false,
            span: 24,
            width: 200,
            rules: [
              {
                required: true,
                message: "请输入数量",
                trigger: "blur",
              },
            ],
          },
          {
            label: "处理意见",
            prop: "detail",
            searchLabelWidth: 150,
            search: false,
            sortable: true,
            filter: true,
            addDisplay: false,
            editDisplay: false,
            viewDisplay: false,
            span: 24,
            width: 200,
            rules: [
              {
                required: true,
                message: "请输入处理意见",
                trigger: "blur",
              },
            ],
          },
          {
            label: "工艺路线",
            prop: "deptcode",
            searchLabelWidth: 150,
            search: false,
            sortable: true,
            filter: true,
            addDisplay: false,
            editDisplay: false,
            viewDisplay: false,
            span: 24,
            width: 200,
            rules: [
              {
                required: true,
                message: "请输入工艺路线",
                trigger: "blur",
              },
            ],
          },
          {
            label: "备注",
            prop: "remark",
            searchLabelWidth: 150,
            search: false,
            sortable: true,
            filter: true,
            addDisplay: false,
            editDisplay: false,
            viewDisplay: false,
            span: 24,
            width: 200,
            rules: [
              {
                required: true,
                message: "请输入备注",
                trigger: "blur",
              },
            ],
          },
          {
            label: "需求日期",
            prop: "reqdate",
            searchLabelWidth: 150,
            search: false,
            sortable: true,
            filter: true,
            addDisplay: false,
            editDisplay: false,
            viewDisplay: false,
            span: 24,
            width: 200,
            rules: [
              {
                required: true,
                message: "请输入需求日期",
                trigger: "blur",
              },
            ],
          },
          {
            label: "批次号",
            prop: "splcode",
            searchLabelWidth: 150,
            search: true,
            sortable: true,
            filter: true,
            addDisplay: false,
            editDisplay: false,
            viewDisplay: false,
            span: 24,
            width: 200,
            rules: [
              {
                required: true,
                message: "请输入批次号",
                trigger: "blur",
              },
            ],
          },
        ],
      },
    };
  },
  mounted() {},
  methods: {
    receiveData(row) {
      this.$confirm("确定接收此工单?", "提示", {
        confirmButtonText: "确认",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {});
    },
    finishData(row) {
      this.$confirm("确定完成此工单?", "提示", {
        confirmButtonText: "确认",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {});
    },
    onLoad() {
      this.data = [
        {
          redono: "111",
        },
      ];
    },
  },
};
</script>
<style lang="scss" scoped></style>
