<template>

  <div class="mainContentBox">
    <avue-crud
      ref="crudRef"
      v-model:search="search"
      v-model="form"
      :data="data"
      :option="option"
      v-model:page="page"
      @row-save="createRow"
      @row-update="updateRow"
      @row-del="deleteRow"
      @search-change="searchChange"
      @search-reset="resetChange"
      @selection-change="selectionChange"
    >



    </avue-crud>

  </div>



</template>
<script setup lang="ts">
  import { ref, getCurrentInstance } from "vue";
  import { useCrud } from "@/hooks/userCrud";
  import ButtonPermKeys from "@/common/configs/buttonPermission";
  import { useCommonStoreHook, useDictionaryStore } from "@/store";
  const { isShowTable, tableType } = toRefs(useCommonStoreHook());
  import {addStock} from "@/api/inStock"
  import dictDataUtil from "@/common/configs/dictDataUtil";
  // 数据字典相关

  const test = () => {
    isShowTable.value = true;
    tableType.value = tableType.value == 1 ? 2 : 1;
  };
  const props = defineProps({
    workOrderCode: {
      type: String,
      default: () => {
        return 0;
      }
    },
    dialog:{
      type:Object,
      default:()=>{
        return {};
      }
    }

  })
  const crudRef=ref(null);
  // 传入一个url，后面不带/
  const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
    useCrud({
      src: "/api/v1/plan/seq/in/stock",
    });
  const { dataNoPageList, createRow, updateRow, deleteRow, searchChange, resetChange } =
    Methords; //增删改查
  const { selectionChange, multipleDelete } = Methords; //选中和批量删除事件
  const { checkBtnPerm, downloadTemplate, exportData } = Utils; //按钮权限等工具
  // checkBtnPerm(ButtonPermKeys.PLAN.BTNS.order_add) :permission="permission"
  // const permission = reactive({
  //   delBtn: checkPerm(buttonPermission.PLAN.BTNS.order_del),
  //   addBtn: checkPerm(buttonPermission.PLAN.BTNS.order_add),
  //   editBtn: checkPerm(buttonPermission.PLAN.BTNS.order_edit),
  //   menu: true,
  // });





  onMounted(() => {
    search.value.workOrderCode=props.workOrderCode;
    dataNoPageList();


  });


  // 设置表格列或者其他自定义的option
  option.value = Object.assign(option.value, {
    selection: true,
    addBtn: false,
    editBtn:false,
    delBtn:false,
    viewBtn:false,
    menu:false,
    columnBtn: false,
    gridBtn: false,
    column: [
      {
        label: "接收人",
        prop: "recipient",
      },
      {
        label: "入库数量",
        prop: "inventoryNum",
      },
      {
        label: "流转卡号",
        prop: "seqNo",
        overHidden: true,
      },
      {
        label: "备注",
        prop: "remark",
        overHidden: true,
      },
      {
        label: "创建人",
        prop: "creator",
      },
      {
        label: "创建时间",
        prop: "created",
      },
    ],
  });

</script>

<style>
  .avue-crud__header{min-height: 0px;}
</style>
