index.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  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. @selection-change="selectionChange"
  18. >
  19. <template #menu="{ row, index, type }">
  20. <el-button
  21. type="primary"
  22. size="small"
  23. link
  24. @click="showSeq(row.seqNos)"
  25. >查看管号
  26. </el-button
  27. >
  28. </template>
  29. </avue-crud>
  30. <el-dialog
  31. v-model="dialog2.visible"
  32. :title="dialog2.title"
  33. width="950px"
  34. @close="dialog2.visible = false"
  35. >
  36. <el-card
  37. style="cursor: pointer; font-size: 20px"
  38. shadow="always"
  39. :key="item"
  40. v-for="item in showSeqList"
  41. >{{ item }}
  42. </el-card
  43. >
  44. </el-dialog>
  45. </div>
  46. </template>
  47. <script setup>
  48. import {useCrud} from "@/hooks/userCrud";
  49. import {useDictionaryStore} from "@/store";
  50. import {ref} from "vue";
  51. // 数据字典相关
  52. const {dicts} = useDictionaryStore();
  53. const showSeqList = ref([]);
  54. // 传入一个url,后面不带/
  55. const {form, data, option, search, page, toDeleteIds, Methords, Utils} =
  56. useCrud({
  57. // src: "/api/v1/processSeqDestruction",
  58. dataListUrl: "/api/v1/processSeqDestruction/checkPage",
  59. });
  60. const {dataList, createRow, updateRow, deleteRow, searchChange, resetChange} =
  61. Methords; //增删改查
  62. const {selectionChange} = Methords; //选中和批量删除事件
  63. const {checkBtnPerm, downloadTemplate, exportData} = Utils; //按钮权限等工具
  64. // const tableData = ref({});
  65. const crudRef = ref(null); //crudRef.value 获取avue-crud对象
  66. const dialog2 = reactive({
  67. title: "管号列表",
  68. visible: false,
  69. });
  70. const showSeq = async (seqs) => {
  71. showSeqList.value = []; // 清空
  72. await nextTick(); // 等待 DOM 更新
  73. showSeqList.value = [...seqs]; // 重新赋值
  74. dialog2.visible = true;
  75. };
  76. onMounted(() => {
  77. dataList();
  78. });
  79. // 设置表格列或者其他自定义的option
  80. option.value = Object.assign(option.value, {
  81. searchEnter: true,
  82. selection: false,
  83. addBtn: false,
  84. delBtn: false,
  85. editBtn: false,
  86. viewBtn: false,
  87. column: [
  88. {
  89. label: "生产批号",
  90. prop: "workOrderCode",
  91. editDisabled: true,
  92. overHidden: true,
  93. width: 120,
  94. search: true,
  95. },
  96. {
  97. label: "产品名称",
  98. prop: "materialName",
  99. editDisabled: true,
  100. search: true,
  101. },
  102. {
  103. label: "管号",
  104. prop: "seqNo",
  105. search: true,
  106. editDisabled: true,
  107. hide: true,
  108. display: false,
  109. },
  110. {
  111. label: "破坏性检验",
  112. prop: "isDestruction",
  113. type: "select",
  114. display: false,
  115. dicData: [
  116. {
  117. label: "否",
  118. value: 0,
  119. },
  120. {
  121. label: "是",
  122. value: 1,
  123. }
  124. ],
  125. html: true,
  126. formatter: (val) => {
  127. if (val.isDestruction === 0) {
  128. return '<b class="el-tag el-tag--danger el-tag--light">否</b>';
  129. } else if (val.isDestruction === 1) {
  130. return '<b class="el-tag el-tag--success el-tag--light">是</b>';
  131. }
  132. },
  133. },
  134. {
  135. label: "检验类型",
  136. prop: "checkType",
  137. type: "select",
  138. display: false,
  139. dicData: [
  140. {
  141. label: "首件检验",
  142. value: "1",
  143. },
  144. {
  145. label: "过程检验",
  146. value: "2",
  147. }
  148. ],
  149. html: true,
  150. formatter: (val) => {
  151. if (val.checkType === "1") {
  152. return '<b class="el-tag el-tag--warning el-tag--light">首件检验</b>';
  153. } else if (val.checkType === "2") {
  154. return '<b class="el-tag el-tag--primary el-tag--light">过程检验</b>';
  155. }
  156. },
  157. },
  158. {
  159. label: "更新日期",
  160. prop: "updated",
  161. type: "date",
  162. width: 160,
  163. editDisplay: false,
  164. overHidden: true,
  165. },
  166. // {
  167. // label: "日期",
  168. // prop: "createdSearch",
  169. // width: 160,
  170. // type: "daterange",
  171. // searchRange: true,
  172. // display: false,
  173. // hide: true,
  174. // startPlaceholder: "开始范围",
  175. // endPlaceholder: "结束范围",
  176. // format: "YYYY-MM-DD",
  177. // valueFormat: "YYYY-MM-DD",
  178. // overHidden: true,
  179. // search: true,
  180. // },
  181. ],
  182. });
  183. </script>