From 759f41097324fa1ade4060fc838d700d8c8fa55f Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期五, 24 四月 2026 11:27:57 +0800
Subject: [PATCH] 提交一版
---
src/views/productionManagement/processRoute/index.vue | 93 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 93 insertions(+), 0 deletions(-)
diff --git a/src/views/productionManagement/processRoute/index.vue b/src/views/productionManagement/processRoute/index.vue
index e30566e..a7d1a4c 100644
--- a/src/views/productionManagement/processRoute/index.vue
+++ b/src/views/productionManagement/processRoute/index.vue
@@ -48,6 +48,14 @@
v-model:visible="isShowItemModal"
:record="record"
@completed="getList" />
+ <FileListDialog ref="fileListDialogRef"
+ v-model="fileDialogVisible"
+ :show-upload-button="true"
+ :show-delete-button="true"
+ :delete-method="handleAttachmentDelete"
+ :process-route-id="currentProcessRouteId"
+ :name-column-label="'闄勪欢鍚嶇О'"
+ @upload="handleAttachmentUpload" />
</div>
</template>
@@ -57,7 +65,14 @@
import EditProcess from "@/views/productionManagement/processRoute/Edit.vue";
import RouteItemForm from "@/views/productionManagement/processRoute/ItemsForm.vue";
import { listPage, del } from "@/api/productionManagement/processRoute.js";
+ import {
+ listProcessRouteFiles,
+ addProcessRouteFile,
+ delProcessRouteFile,
+ } from "@/api/productionManagement/processRouteFile.js";
+ import FileListDialog from "@/components/Dialog/FileListDialog.vue";
import { useRouter } from "vue-router";
+ import { ElMessage, ElMessageBox } from "element-plus";
const router = useRouter();
const data = reactive({
@@ -108,6 +123,13 @@
showItemModal(row);
},
},
+ {
+ name: "闄勪欢",
+ type: "text",
+ clickFun: row => {
+ openFileDialog(row);
+ },
+ },
],
},
]);
@@ -123,8 +145,79 @@
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();
+ };
+
// 鏌ヨ鍒楄〃
/** 鎼滅储鎸夐挳鎿嶄綔 */
const handleQuery = () => {
--
Gitblit v1.9.3