choice-item-page.vue 5.1 KB

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