index.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <template>
  2. <div class="mainContentBox">
  3. <avue-crud
  4. ref="crudRef"
  5. v-model:search="search"
  6. v-model="form"
  7. :data="data"
  8. :option="option"
  9. v-model:page="page"
  10. @row-save="createRow"
  11. @row-update="updateRow"
  12. @row-del="deleteRow"
  13. @search-change="searchChange"
  14. @search-reset="resetChange"
  15. @size-change="dataList"
  16. @current-change="dataList"
  17. >
  18. </avue-crud>
  19. </div>
  20. </template>
  21. <script setup>
  22. import { ref, getCurrentInstance } from "vue";
  23. import { useCrud } from "@/hooks/userCrud";
  24. import ButtonPermKeys from "@/common/configs/buttonPermission";
  25. import { useCommonStoreHook } from "@/store";
  26. import dictDataUtil from "@/common/configs/dictDataUtil";
  27. const { isShowTable, tableType } = toRefs(useCommonStoreHook());
  28. const test = () => {
  29. isShowTable.value = true;
  30. tableType.value = tableType.value == 1 ? 2 : 1;
  31. };
  32. // 传入一个url,后面不带/
  33. const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
  34. useCrud({
  35. src: "/api/v1/wms/task",
  36. });
  37. const { dataList, createRow, updateRow, deleteRow, searchChange, resetChange } = Methords; //增删改查
  38. const { selectionChange, multipleDelete } = Methords; //选中和批量删除事件
  39. const { checkBtnPerm, downloadTemplate, exportData } = Utils; //按钮权限等工具
  40. const crudRef = ref(null); //crudRef.value 获取avue-crud对象
  41. // 设置表格列或者其他自定义的option
  42. option.value = Object.assign(option.value, {
  43. delBtn: false,
  44. selection: false,
  45. viewBtn: false,
  46. editBtn: false,
  47. menu: false,
  48. addBtn: false,
  49. column: [
  50. {
  51. label: "入库单号",
  52. prop: "taskNo",
  53. search: true,
  54. width:150,
  55. overHidden: true
  56. },
  57. {
  58. label: "计划单号",
  59. prop: "planNo",
  60. search: true,
  61. },
  62. {
  63. label: "物料编号",
  64. width: 130,
  65. overHidden: true,
  66. prop: "materialNo",
  67. },
  68. {
  69. label: "物料名称",
  70. width:150,
  71. overHidden: true,
  72. prop: "materialName",
  73. },
  74. {
  75. label: "批次号",
  76. prop: "batchCode",
  77. width:150,
  78. overHidden: true
  79. },
  80. {
  81. label: "入库总数量",
  82. prop: "num",
  83. },
  84. {
  85. label: "已入库数量",
  86. prop: "completedNum",
  87. },
  88. {
  89. label: "待入库数量",
  90. prop: "unDoNum",
  91. },
  92. {
  93. label: "单位",
  94. prop: "unit",
  95. },
  96. {
  97. label: "入库仓库",
  98. prop: "houseType",
  99. type: "select",
  100. search: true,
  101. dicUrl:
  102. dictDataUtil.request_url +
  103. dictDataUtil.TYPE_CODE.warehouse_type,
  104. props: {
  105. label: "dictLabel",
  106. value: "dictValue",
  107. }
  108. },
  109. {
  110. label: "状态",
  111. prop: "state",
  112. type: "select",
  113. search: true,
  114. dicUrl:
  115. dictDataUtil.request_url +
  116. dictDataUtil.TYPE_CODE.warehouse_task_state,
  117. props: {
  118. label: "dictLabel",
  119. value: "dictValue",
  120. }
  121. },
  122. ],
  123. });
  124. onMounted(() => {
  125. // console.log("crudRef", crudRef)
  126. search.value.type = '1'
  127. dataList();
  128. });
  129. </script>