<template>
  <basic-container>
    <avue-crud
      :option="option"
      :table-loading="loading"
      :data="data"
      v-model="form"
      v-model:page="page"
      ref="crud"
      @row-del="rowDel"
      @search-change="searchChange"
      @search-reset="searchReset"
      @selection-change="selectionChange"
      @current-change="currentChange"
      @size-change="sizeChange"
      @refresh-change="refreshChange"
      @on-load="onLoad"
    >
      <template #menu-left>
        <el-input
          v-model="input"
          style="width: 240px; margin-right: 24px"
          placeholder="请扫描条形码"
        />
        <el-button type="primary" @click="addView()">新增</el-button>
      </template>
      <template #menu-right> </template>
      <template #menu="scope">
        <el-button type="text" size="mini" @click="handle(scope.row.tbId)"
          >处理</el-button
        >
      </template>
      <template #userNam="scope">
        {{
          scope.row.stAccBill.pfUserInfo.userCode +
          "/" +
          scope.row.stAccBill.pfUserInfo.userName
        }}
      </template>
    </avue-crud>
    <otherIssuingDailog v-if="openShow" :showDialog="openShow"></otherIssuingDailog>
  </basic-container>
</template>
<script>
import otherIssuingDailog from "./otherIssuingDailog.vue";
export default {
  components: {
    otherIssuingDailog,
  },
  data() {
    return {
      openShow: false,
      selectionList: [],
      option: {
        height: "auto",
        calcHeight: 32,
        tip: false,
        size: "medium",
        simplePage: true,
        searchShow: true,
        searchMenuSpan: 6,
        searchIcon: true,
        searchIndex: 3,
        tree: false,
        border: true,
        index: true,
        selection: false,
        viewBtn: true,
        delBtn: false,
        addBtn: false,
        editBtnText: "修改",
        viewBtnIcon: " ",
        delBtnIcon: " ",
        editBtnIcon: " ",
        viewBtnText: "详情",
        labelWidth: 120,
        menuWidth: 120,
        dialogWidth: 1200,
        dialogClickModal: false,
        searchEnter: true,
        excelBtn: false,
        filterBtn: true,
        searchShowBtn: false,
        columnSort: true,
        excelBtn: true,
        columnSort: true,
        index: true,
        searchLabelPosition: "left",
        searchLabelPosition: "left",
        searchGutter: 24,
        searchSpan: 6,
        menuAlign: "left",
        gridBtn: false,
        searchMenuPosition: "right",
        addBtnIcon: " ",
        viewBtnIcon: " ",
        delBtnIcon: " ",
        editBtnIcon: " ",
        align: "center",

        column: [
          {
            label: "出库单号",
            prop: "stAccBill.billCode",
            bind: "stAccBill.billCode",
            sortable: true,
            filter: true,
            span: 12,
            search: true,
          },
          {
            label: "出库日期",
            prop: "stAccBill.billDate",
            bind: "stAccBill.billDate",
            search: true,
            sortable: true,
            filter: true,
            span: 12,
          },
          {
            label: "出库仓库",
            prop: "stAccBill.coStorehouse.shName",
            bind: "stAccBill.coStorehouse.shName",
            search: true,
            sortable: true,
            filter: true,
            span: 12,
          },
          {
            label: "出库类别",
            prop: "stAccBill.billFlagStr",
            bind: "stAccBill.billFlagStr",
            search: false,
            sortable: true,
            filter: true,
            span: 12,
          },
          {
            label: "出库原因",
            prop: "outTypStr",
            search: false,
            sortable: true,
            filter: true,
            span: 12,
          },
          {
            label: "领料人",
            prop: "userName",
            search: true,
            sortable: true,
            filter: true,
            span: 12,
          },
          {
            label: "制单人",
            prop: "stAccBill.createMan.userName",
            bind: "stAccBill.createMan.userName",
            search: false,
            sortable: true,
            filter: true,
            span: 12,
          },
          {
            label: "工装编号",
            prop: "pjMold.toolingCode",
            bind: "pjMold.toolingCode",
            search: false,
            sortable: true,
            filter: true,
            span: 12,
            display: false,
          },
          {
            label: "备注",
            prop: "memo",
            search: false,
            sortable: true,
            filter: true,
            span: 12,
            display: false,
          },
          {
            label: "报废单号",
            prop: "bfCode",
            search: false,
            sortable: true,
            filter: true,
            span: 12,
            display: false,
          },
        ],
      },
      form: {},
      page: {
        pageSize: 10,
        currentPage: 1,
        total: 0,
      },
    };
  },
  methods: {
    addView() {
      this.openShow = true;
    },
    handleDelete() {
      if (this.selectionList.length === 0) {
        this.$message.warning("请选择至少一条数据");
        return;
      }
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {});
    },
    // 多选
    selectionChange(list) {
      this.selectionList = list;
    },
    onLoad() {
      this.loading = true;
      this.data = [{}];
      this.page.total = this.data.length;
      this.loading = false;
      setTimeout(() => {
        this.selectionClear();
      }, 500);
    },
  },
};
</script>
<style lang="scss" scoped></style>
