index.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  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="{ size, row, index }">
  20. <el-button
  21. icon="el-icon-edit"
  22. text
  23. @click="openDialog(0, row.id, row.outsourceId)"
  24. type="primary"
  25. :size="size"
  26. >详情</el-button
  27. >
  28. </template>
  29. </avue-crud>
  30. <el-dialog
  31. v-model="dialog.visible"
  32. :title="dialog.title"
  33. width="1200px"
  34. @close="dialog.visible = false"
  35. >
  36. <el-form
  37. ref="queryFormRef"
  38. label-width="100"
  39. :inline="true"
  40. style="width: 100%"
  41. >
  42. <el-row :gutter="24">
  43. <el-col :lg="12" :xs="12">
  44. <el-form-item label="产品名称">
  45. <el-text>{{ form.materialName }}</el-text>
  46. </el-form-item>
  47. </el-col>
  48. <el-col :lg="12" :xs="12">
  49. <el-form-item label="产品编码">
  50. <el-text>{{ form.materialCode }}</el-text>
  51. </el-form-item>
  52. </el-col>
  53. </el-row>
  54. <el-row :gutter="24">
  55. <el-col :lg="12" :xs="12">
  56. <el-form-item label="委外工序">
  57. <el-text>{{ form.operationName }}</el-text>
  58. </el-form-item>
  59. </el-col>
  60. <el-col :lg="12" :xs="12">
  61. <el-form-item label="产品数量">
  62. <el-text>{{ form.outNum }}</el-text>
  63. </el-form-item>
  64. </el-col>
  65. </el-row>
  66. <el-row :gutter="24">
  67. <el-col :lg="24" :xs="24">
  68. <el-form-item label=" ">
  69. <el-table
  70. :border="true"
  71. class="gray-header-table"
  72. v-loading="loading"
  73. :data="form.details"
  74. highlight-current-row
  75. >
  76. <el-table-column
  77. label="WIN码"
  78. align="left"
  79. width="350"
  80. prop="seqNo"
  81. />
  82. <el-table-column
  83. label="状态"
  84. width="250"
  85. align="left"
  86. prop="state"
  87. >
  88. <template #default="scope">
  89. <el-tag v-if="scope.row.state === 0" type="success"
  90. >合格</el-tag
  91. >
  92. <el-tag v-if="scope.row.state === 1" type="error"
  93. >不合格</el-tag
  94. >
  95. </template>
  96. </el-table-column>
  97. </el-table>
  98. </el-form-item>
  99. </el-col>
  100. </el-row>
  101. <el-row :gutter="24" v-if="dialog.visible">
  102. <el-form-item label="Bom">
  103. <Boms :apply-id="bomId" />
  104. </el-form-item>
  105. </el-row>
  106. </el-form>
  107. <div
  108. class="dialog-footer"
  109. align="center"
  110. v-if="dialog.type === 1 && checkPerm('outsource:audit')"
  111. >
  112. <el-button @click="dialog.visible = false">取 消</el-button>
  113. <el-button type="primary" @click="audit">审 核</el-button>
  114. </div>
  115. </el-dialog>
  116. </div>
  117. </template>
  118. <script setup>
  119. import Boms from "./boms.vue";
  120. import { ref, getCurrentInstance } from "vue";
  121. import { useCrud } from "@/hooks/userCrud";
  122. import { checkPerm } from "@/directive/permission";
  123. import ButtonPermKeys from "@/common/configs/buttonPermission";
  124. import { queryOutSourceDetails, updateOutSourceApply } from "@/api/process";
  125. import { useCommonStoreHook } from "@/store";
  126. import dictDataUtil from "@/common/configs/dictDataUtil";
  127. const { isShowTable, tableType } = toRefs(useCommonStoreHook());
  128. const test = () => {
  129. isShowTable.value = true;
  130. tableType.value = tableType.value == 1 ? 2 : 1;
  131. };
  132. const radio = ref(0);
  133. // 传入一个url,后面不带/
  134. const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
  135. useCrud({
  136. src: "/api/v1/process/tdmOrder",
  137. });
  138. const { dataList, createRow, updateRow, deleteRow, searchChange, resetChange } =
  139. Methords; //增删改查
  140. const { selectionChange, multipleDelete } = Methords; //选中和批量删除事件
  141. const { checkBtnPerm, downloadTemplate, exportData } = Utils; //按钮权限等工具
  142. const loading = ref(false);
  143. const crudRef = ref(null); //crudRef.value 获取avue-crud对象
  144. const dialog = reactive({
  145. title: "委外详情",
  146. visible: false,
  147. type: 0,
  148. });
  149. const bomId = ref(""); //打开详情需要传入applyid
  150. const openDialog = (type, id, outId) => {
  151. bomId.value = id;
  152. dialog.title = type === 0 ? "委外详情" : "委外审核";
  153. queryOutSourceDetails(outId).then((data) => {
  154. form.value = data.data;
  155. radio.value = 0;
  156. if (form.value) {
  157. if (form.value.state === "2") {
  158. radio.value = 1;
  159. }
  160. }
  161. dialog.visible = true;
  162. dialog.type = type;
  163. });
  164. };
  165. const audit = () => {
  166. form.value.state = radio.value === 0 ? 1 : 2;
  167. updateOutSourceApply(form.value).then((data) => {
  168. if (data.code === "200") {
  169. ElMessage.success("操作成功");
  170. dialog.visible = false;
  171. dataList();
  172. } else {
  173. ElMessage.error(data.msg);
  174. }
  175. });
  176. };
  177. // 设置表格列或者其他自定义的option
  178. option.value = Object.assign(option.value, {
  179. addBtn: false,
  180. editBtn: false,
  181. viewBtn: false,
  182. delBtn: false,
  183. selection: true,
  184. column: [
  185. {
  186. label: "计划编号",
  187. prop: "orderCode",
  188. width: 150,
  189. overHidden: true,
  190. search: true,
  191. },
  192. {
  193. label: "物料编码",
  194. prop: "materialCode",
  195. search: true,
  196. width: 150,
  197. overHidden: true,
  198. },
  199. {
  200. label: "物料名称",
  201. width: 150,
  202. overHidden: true,
  203. prop: "materialName",
  204. },
  205. // {
  206. // label: "工单数量",
  207. // width: 120,
  208. // overHidden: true,
  209. // prop: "workOrderNum",
  210. // },
  211. {
  212. label: "委外工序",
  213. width: 150,
  214. overHidden: true,
  215. prop: "operationName",
  216. },
  217. {
  218. label: "状态",
  219. prop: "state",
  220. type: "select",
  221. search: true,
  222. width: 90,
  223. dicUrl: dictDataUtil.request_url + dictDataUtil.TYPE_CODE.outsource_state,
  224. props: {
  225. label: "dictLabel",
  226. value: "dictValue",
  227. },
  228. },
  229. {
  230. label: "申请人",
  231. width: 120,
  232. overHidden: true,
  233. prop: "creator",
  234. },
  235. {
  236. label: "申请时间",
  237. width: 120,
  238. overHidden: true,
  239. prop: "created",
  240. },
  241. {
  242. label: "审核人",
  243. width: 120,
  244. overHidden: true,
  245. prop: "auditUser",
  246. },
  247. {
  248. label: "审核时间",
  249. width: 120,
  250. overHidden: true,
  251. prop: "auditTime",
  252. },
  253. {
  254. label: "接收人",
  255. width: 120,
  256. overHidden: true,
  257. prop: "receiveUser",
  258. },
  259. {
  260. label: "接收时间",
  261. width: 120,
  262. overHidden: true,
  263. prop: "receiveTime",
  264. },
  265. ],
  266. });
  267. onMounted(() => {
  268. // console.log("crudRef", crudRef)
  269. dataList();
  270. });
  271. </script>
  272. <style>
  273. /* 添加自定义类名以区分不同表格的样式 */
  274. .gray-header-table .el-table__header-wrapper {
  275. background-color: #f2f2f2; /* 灰色背景 */
  276. }
  277. </style>