choice-item-page.vue 5.4 KB

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