From ccd67e291e00a2ad9c29ad8df43de6fab5a4afed Mon Sep 17 00:00:00 2001
From: 张诺 <zhang_12370@163.com>
Date: 星期四, 09 四月 2026 09:30:08 +0800
Subject: [PATCH] feat(协同审批/报价单): 添加附件上传、预览和下载功能
---
src/views/productionManagement/productionProcess/index.vue | 105 +++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 78 insertions(+), 27 deletions(-)
diff --git a/src/views/productionManagement/productionProcess/index.vue b/src/views/productionManagement/productionProcess/index.vue
index 7ab8c9a..ac76651 100644
--- a/src/views/productionManagement/productionProcess/index.vue
+++ b/src/views/productionManagement/productionProcess/index.vue
@@ -30,7 +30,9 @@
class="mb10">
<el-button type="primary"
@click="showNewModal">鏂板宸ュ簭</el-button>
- <el-button type="info" plain @click="handleImport">瀵煎叆</el-button>
+ <el-button type="info"
+ plain
+ @click="handleImport">瀵煎叆</el-button>
<el-button type="danger"
@click="handleDelete"
:disabled="selectedRows.length === 0"
@@ -53,29 +55,33 @@
v-model:visible="isShowEditModal"
:record="record"
@completed="getList" />
- <ImportDialog
- ref="importDialogRef"
- v-model="importDialogVisible"
- title="瀵煎叆宸ュ簭"
- :action="importAction"
- :headers="importHeaders"
- :auto-upload="false"
- :on-success="handleImportSuccess"
- :on-error="handleImportError"
- @confirm="handleImportConfirm"
- @download-template="handleDownloadTemplate"
- @close="handleImportClose"
- />
+ <ImportDialog ref="importDialogRef"
+ v-model="importDialogVisible"
+ title="瀵煎叆宸ュ簭"
+ :action="importAction"
+ :headers="importHeaders"
+ :auto-upload="false"
+ :on-success="handleImportSuccess"
+ :on-error="handleImportError"
+ @confirm="handleImportConfirm"
+ @download-template="handleDownloadTemplate"
+ @close="handleImportClose" />
</div>
</template>
<script setup>
- import { onMounted, ref, reactive, toRefs, getCurrentInstance } from "vue";
+ import { onMounted, ref, reactive, toRefs, getCurrentInstance, computed } from "vue";
import NewProcess from "@/views/productionManagement/productionProcess/New.vue";
import EditProcess from "@/views/productionManagement/productionProcess/Edit.vue";
import ImportDialog from "@/components/Dialog/ImportDialog.vue";
- import { listPage, del, importData, downloadTemplate } from "@/api/productionManagement/productionProcess.js";
+ import {
+ listPage,
+ del,
+ importData,
+ downloadTemplate,
+ } from "@/api/productionManagement/productionProcess.js";
import { getToken } from "@/utils/auth";
+ import { getDeviceLedger } from "@/api/equipmentManagement/ledger";
const data = reactive({
searchForm: {
@@ -93,16 +99,34 @@
label: "宸ュ簭鍚嶇О",
prop: "name",
},
-
+ {
+ label: "宸ュ簭鏈哄彴",
+ prop: "deviceName",
+ },
+ {
+ label: "宸ュ簭绫诲瀷",
+ prop: "typeText",
+ },
{
label: "宸ヨ祫瀹氶",
prop: "salaryQuota",
+ },
+ // {
+ // label: "宸ュ簭",
+ // prop: "process",
+ // },
+ {
+ label: "鏄惁璐ㄦ",
+ prop: "isQuality",
+ formatData: (params) => {
+ return params ? "鏄�" : "鍚�";
+ },
},
{
label: "澶囨敞",
prop: "remark",
},
- {
+ {
label: "鏇存柊鏃堕棿",
prop: "updateTime",
},
@@ -125,6 +149,15 @@
]);
const tableData = ref([]);
const selectedRows = ref([]);
+ const deviceList = ref([]);
+ const deviceNameMap = computed(() => {
+ const map = new Map();
+ (deviceList.value || []).forEach((d) => {
+ if (d?.id == null) return;
+ map.set(d.id, d.deviceName ?? "");
+ });
+ return map;
+ });
const tableLoading = ref(false);
const isShowNewModal = ref(false);
const isShowEditModal = ref(false);
@@ -137,9 +170,19 @@
total: 0,
});
const { proxy } = getCurrentInstance();
-
+
+ const loadDeviceList = async () => {
+ try {
+ const res = await getDeviceLedger();
+ deviceList.value = Array.isArray(res?.data) ? res.data : [];
+ } catch (e) {
+ deviceList.value = [];
+ }
+ };
+
// 瀵煎叆鐩稿叧閰嶇疆
- const importAction = import.meta.env.VITE_APP_BASE_API + "/productProcess/importData";
+ const importAction =
+ import.meta.env.VITE_APP_BASE_API + "/productProcess/importData";
const importHeaders = { Authorization: "Bearer " + getToken() };
// 鏌ヨ鍒楄〃
@@ -161,9 +204,16 @@
listPage(params)
.then(res => {
tableLoading.value = false;
- tableData.value = res.data.records.map(item => ({
- ...item,
- }));
+ const records = Array.isArray(res?.data?.records) ? res.data.records : [];
+ const map = deviceNameMap.value;
+ tableData.value = records.map(item => {
+ const deviceName = item?.deviceName ?? map.get(item?.deviceId) ?? "";
+ return {
+ ...item,
+ deviceName,
+ typeText: item.type !== undefined && item.type !== null ? (item.type === 0 ? "璁℃椂" : "璁′欢") : "",
+ };
+ });
page.total = res.data.total;
})
.catch(err => {
@@ -233,9 +283,8 @@
importDialogRef.value.submit();
}
};
-
// 瀵煎叆鎴愬姛
- const handleImportSuccess = (response) => {
+ const handleImportSuccess = response => {
if (response.code === 200) {
proxy.$modal.msgSuccess("瀵煎叆鎴愬姛");
importDialogVisible.value = false;
@@ -249,7 +298,7 @@
};
// 瀵煎叆澶辫触
- const handleImportError = (error) => {
+ const handleImportError = error => {
proxy.$modal.msgError("瀵煎叆澶辫触锛�" + (error.message || "鏈煡閿欒"));
};
@@ -295,7 +344,9 @@
// };
onMounted(() => {
- getList();
+ loadDeviceList().finally(() => {
+ getList();
+ });
});
</script>
--
Gitblit v1.9.3