| | |
| | | v-model:visible="isShowItemModal" |
| | | :record="record" |
| | | @completed="getList" /> |
| | | <FileList v-if="fileDialogVisible" |
| | | v-model:visible="fileDialogVisible" |
| | | :record-type="'technology_routing'" |
| | | :record-id="currentProcessRouteId" /> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | import EditProcess from "@/views/productionManagement/processRoute/Edit.vue"; |
| | | import RouteItemForm from "@/views/productionManagement/processRoute/ItemsForm.vue"; |
| | | import { listPage, del } from "@/api/productionManagement/processRoute.js"; |
| | | const FileList = defineAsyncComponent(() => import("@/components/Dialog/FileList.vue")); |
| | | |
| | | import { useRouter } from "vue-router"; |
| | | import { ElMessage, ElMessageBox } from "element-plus"; |
| | | |
| | | const router = useRouter(); |
| | | const data = reactive({ |
| | |
| | | showItemModal(row); |
| | | }, |
| | | }, |
| | | { |
| | | name: "附件", |
| | | type: "text", |
| | | clickFun: row => { |
| | | openFileDialog(row); |
| | | }, |
| | | }, |
| | | ], |
| | | }, |
| | | ]); |
| | |
| | | size: 100, |
| | | total: 0, |
| | | }); |
| | | |
| | | // 附件相关 |
| | | const fileDialogVisible = ref(false); |
| | | const fileListDialogRef = ref(null); |
| | | const currentProcessRouteId = ref(null); |
| | | const filePage = reactive({ |
| | | current: 1, |
| | | size: 1000, |
| | | total: 0, |
| | | }); |
| | | |
| | | const { proxy } = getCurrentInstance(); |
| | | |
| | | // 附件:查询 |
| | | const fetchProcessRouteFiles = async processRouteId => { |
| | | const params = { |
| | | current: filePage.current, |
| | | size: filePage.size, |
| | | processRouteId, |
| | | }; |
| | | const res = await listProcessRouteFiles(params); |
| | | const records = res?.data?.records || []; |
| | | filePage.total = res?.data?.total || records.length; |
| | | const mapped = records.map(item => ({ |
| | | id: item.id, |
| | | name: item.fileName || item.name, |
| | | url: item.fileUrl || item.url, |
| | | raw: item, |
| | | })); |
| | | fileListDialogRef.value?.setList(mapped); |
| | | }; |
| | | |
| | | // 打开附件弹窗 |
| | | const openFileDialog = async row => { |
| | | currentProcessRouteId.value = row.id; |
| | | fileDialogVisible.value = true; |
| | | await fetchProcessRouteFiles(row.id); |
| | | }; |
| | | |
| | | // 刷新附件列表 |
| | | const refreshFileList = async () => { |
| | | if (!currentProcessRouteId.value) return; |
| | | await fetchProcessRouteFiles(currentProcessRouteId.value); |
| | | }; |
| | | |
| | | // 上传附件 |
| | | const handleAttachmentUpload = async filePayload => { |
| | | if (!currentProcessRouteId.value) return; |
| | | const payload = { |
| | | fileName: filePayload?.fileName || filePayload?.name, |
| | | fileUrl: filePayload?.fileUrl || filePayload?.url, |
| | | processRouteId: currentProcessRouteId.value, |
| | | }; |
| | | await addProcessRouteFile(payload); |
| | | ElMessage.success("文件上传成功"); |
| | | await refreshFileList(); |
| | | }; |
| | | |
| | | // 删除附件 |
| | | const handleAttachmentDelete = async row => { |
| | | if (!row?.id) return false; |
| | | try { |
| | | await ElMessageBox.confirm("确认删除该附件?", "提示", { |
| | | type: "warning", |
| | | }); |
| | | } catch { |
| | | return false; |
| | | } |
| | | await delProcessRouteFile([row.id]); |
| | | ElMessage.success("删除成功"); |
| | | await refreshFileList(); |
| | | }; |
| | | |
| | | // 查询列表 |
| | | /** 搜索按钮操作 */ |
| | |
| | | productName: row.productName || "", |
| | | model: row.model || "", |
| | | bomNo: row.bomNo || "", |
| | | bomId: row.bomId || "", |
| | | description: row.description || "", |
| | | type: "route", |
| | | }, |