index.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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 { useCommonStoreHook ,useDictionaryStore} from "@/store";
  25. import dictDataUtil from "@/common/configs/dictDataUtil";
  26. const { isShowTable, tableType } = toRefs(useCommonStoreHook());
  27. const test = () => {
  28. isShowTable.value = true;
  29. tableType.value = tableType.value == 1 ? 2 : 1;
  30. };
  31. const { dicts,getLabelByValue } = useDictionaryStore();
  32. // 传入一个url,后面不带/
  33. const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
  34. useCrud({
  35. src: "/api/v1/wmsOrder",
  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: "type",
  53. width: 60,
  54. overHidden: true,
  55. type: "select",
  56. search: true,
  57. dicData:[{label: "入库",value: "1"},{label: "出库",value: "2"},{label: "退料",value: "3"}],
  58. },
  59. {
  60. label: "载具编号",
  61. width: 110,
  62. overHidden: true,
  63. prop: "vehicleCode",
  64. },
  65. {
  66. label: "物料编号",
  67. width: 130,
  68. search: true,
  69. overHidden: true,
  70. prop: "materialNo",
  71. },
  72. {
  73. label: "物料名称",
  74. width:130,
  75. search: true,
  76. overHidden: true,
  77. prop: "materialName",
  78. },
  79. {
  80. label: "物料型号",
  81. width:130,
  82. overHidden: true,
  83. prop: "spec",
  84. },
  85. {
  86. label: "单位",
  87. width: 60,
  88. overHidden: true,
  89. prop: "unit",
  90. },
  91. /* {
  92. label: "任务单号",
  93. prop: "taskNo",
  94. search: true,
  95. overHidden: true
  96. },*/
  97. {
  98. label: "单号",
  99. prop: "planNo",
  100. search: true,
  101. },
  102. {
  103. label: "库位",
  104. overHidden: true,
  105. prop: "locationNo",
  106. },
  107. {
  108. label: "二维码",
  109. prop: "batchCode",
  110. width:150,
  111. overHidden: true,
  112. formatter:(val,value,label)=>{
  113. if(val.seqNo){
  114. return val.seqNo;
  115. }else{
  116. return val.batchCode
  117. }
  118. }
  119. },
  120. {
  121. label: "数量",
  122. prop: "num",
  123. width: 60,
  124. overHidden: true,
  125. },
  126. {
  127. label: "状态",
  128. prop: "state",
  129. type: "select",
  130. search: true,
  131. width: 70,
  132. overHidden: true,
  133. dicUrl:
  134. dictDataUtil.request_url +
  135. dictDataUtil.TYPE_CODE.warehouse_task_state,
  136. props: {
  137. label: "dictLabel",
  138. value: "dictValue",
  139. }
  140. },
  141. {
  142. label: "操作日志",
  143. prop: "message",
  144. width: 180,
  145. overHidden: true,
  146. display: false
  147. },
  148. {
  149. label: "操作时间",
  150. prop: "created",
  151. width: 180,
  152. display: false
  153. },
  154. {
  155. label: "操作人",
  156. prop: "creator",
  157. type: "select",
  158. dicData: dicts.user_name_list,
  159. props: {"label": "dictLabel","value":"dictValue"},
  160. display: false
  161. },
  162. ],
  163. });
  164. onMounted(() => {
  165. // console.log("crudRef", crudRef)
  166. //search.value.type = '2'
  167. dataList();
  168. });
  169. </script>