choice-item-page.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  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-click="rowClick"
  11. @search-change="searchChange"
  12. @search-reset="resetChange"
  13. @size-change="dataList"
  14. @current-change="dataList"
  15. >
  16. </avue-crud>
  17. </div>
  18. </template>
  19. <script setup>
  20. import { defineProps, ref } from "vue";
  21. import { useCrud } from "@/hooks/userCrud";
  22. import { useCommonStoreHook } from "@/store";
  23. import { useDictionaryStore } from "@/store";
  24. const { isShowTable, tableType } = toRefs(useCommonStoreHook());
  25. const { dicts } = useDictionaryStore();
  26. const test = () => {
  27. isShowTable.value = true;
  28. tableType.value = tableType.value == 1 ? 2 : 1;
  29. };
  30. const props = defineProps({
  31. materialCode: {
  32. type: String,
  33. default: () => {
  34. return "";
  35. },
  36. },
  37. });
  38. // 传入一个url,后面不带/
  39. const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
  40. useCrud({
  41. src: "/api/v1/base/material",
  42. });
  43. const { dataList, createRow, updateRow, deleteRow, searchChange, resetChange } =
  44. Methords; //增删改查
  45. const { selectionChange, multipleDelete } = Methords; //选中和批量删除事件
  46. const { checkBtnPerm, downloadTemplate } = Utils; //按钮权限等工具
  47. const crudRef = ref(null); //crudRef.value 获取avue-crud对象
  48. const emit = defineEmits(["materialInfo"]);
  49. const rowClick = (row) => {
  50. emit("materialInfo", row);
  51. };
  52. // 设置表格列或者其他自定义的option
  53. option.value = Object.assign(option.value, {
  54. searchEnter: true,
  55. delBtn: false,
  56. selection: false,
  57. search: false,
  58. editBtn: false,
  59. addBtn: false,
  60. viewBtn: false,
  61. menu: false,
  62. column: [
  63. {
  64. label: "物料编码",
  65. width: 150,
  66. overHidden: true,
  67. prop: "materialCode",
  68. search: true,
  69. },
  70. {
  71. label: "物料名称",
  72. width: 150,
  73. overHidden: true,
  74. prop: "materialName",
  75. search: true,
  76. },
  77. {
  78. label: "物料属性",
  79. prop: "attributeDictValue",
  80. search: true,
  81. width: 120,
  82. overHidden: true,
  83. type: "select",
  84. dicData: dicts.material_properties,
  85. props: { label: "dictLabel", value: "dictValue" },
  86. },
  87. { label: "物料规格", width: 120, prop: "spec", search: true },
  88. {
  89. label: "单位",
  90. prop: "unitDictValue",
  91. type: "select",
  92. dicData: dicts.danwei_type,
  93. props: { label: "dictLabel", value: "dictValue" },
  94. },
  95. {
  96. label: "物料级别",
  97. prop: "levelDictValue",
  98. width: 100,
  99. overHidden: true,
  100. type: "select",
  101. dicData: dicts.material_level,
  102. props: { label: "dictLabel", value: "dictValue" },
  103. },
  104. { label: "维修厂家", width: 120, overHidden: true, prop: "manufacturer" },
  105. {
  106. label: "质检方案",
  107. prop: "inspectDictValue",
  108. width: 120,
  109. overHidden: true,
  110. type: "select",
  111. dicData: dicts.quality_testing_plan,
  112. props: { label: "dictLabel", value: "dictValue" },
  113. },
  114. {
  115. label: "适用平台",
  116. prop: "applicablePlatformsDictValue",
  117. width: 120,
  118. type: "select",
  119. overHidden: true,
  120. dicData: dicts.applicable_platforms,
  121. props: { label: "dictLabel", value: "dictValue" },
  122. },
  123. {
  124. label: "质量等级",
  125. prop: "qualityLevelDictValue",
  126. width: 120,
  127. type: "select",
  128. overHidden: true,
  129. dicData: dicts.quality_grade,
  130. props: { label: "dictLabel", value: "dictValue" },
  131. },
  132. {
  133. label: "选用类型",
  134. prop: "selectionDictValue",
  135. width: 100,
  136. overHidden: true,
  137. type: "select",
  138. dicData: dicts.selection_type,
  139. props: { label: "dictLabel", value: "dictValue" },
  140. },
  141. {
  142. label: "产品阶段",
  143. prop: "stageDictValue",
  144. search: true,
  145. overHidden: true,
  146. width: 100,
  147. filterable: true,
  148. type: "select",
  149. dicData: dicts.stage,
  150. props: { label: "dictLabel", value: "dictValue" },
  151. },
  152. { label: "客户型号", width: 100, overHidden: true, prop: "customerModel" },
  153. {
  154. label: "保质期(天)",
  155. width: 100,
  156. overHidden: true,
  157. prop: "qualityGuaranteePeriod",
  158. },
  159. {
  160. label: "封装方法",
  161. prop: "packageDictValue",
  162. width: 100,
  163. overHidden: true,
  164. type: "select",
  165. dicData: dicts.packaging_method,
  166. props: { label: "dictLabel", value: "dictLabel" },
  167. },
  168. {
  169. label: "是否工装",
  170. prop: "frock",
  171. width: 100,
  172. type: "radio", //类型为单选框
  173. dicData: [
  174. {
  175. label: "是",
  176. value: 1,
  177. },
  178. {
  179. label: "否",
  180. value: 0,
  181. },
  182. ],
  183. value: 1,
  184. rules: [
  185. {
  186. required: true,
  187. message: "是否工装",
  188. trigger: "blur",
  189. },
  190. ],
  191. },
  192. {
  193. label: "筛选规范",
  194. width: 100,
  195. overHidden: true,
  196. prop: "selectionSpec",
  197. type: "textarea",
  198. span: 18,
  199. },
  200. {
  201. label: "备注",
  202. width: 100,
  203. overHidden: true,
  204. prop: "remark",
  205. type: "textarea",
  206. span: 18,
  207. },
  208. ],
  209. });
  210. onMounted(() => {
  211. search.value.prodtCode = props.materialCode;
  212. search.value.enabled = "0";
  213. dataList();
  214. });
  215. </script>