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/productionReporting/index.vue | 301 ++++++++++++++++++++++++++++++++++---------------
1 files changed, 206 insertions(+), 95 deletions(-)
diff --git a/src/views/productionManagement/productionReporting/index.vue b/src/views/productionManagement/productionReporting/index.vue
index b34b14e..1f16a83 100644
--- a/src/views/productionManagement/productionReporting/index.vue
+++ b/src/views/productionManagement/productionReporting/index.vue
@@ -19,19 +19,10 @@
style="width: 200px;"
@change="handleQuery" />
</el-form-item>
- <el-form-item label="宸ュ崟鐘舵��:">
- <el-select v-model="searchForm.workOrderStatus"
- placeholder="璇烽�夋嫨宸ュ崟鐘舵��"
- style="width: 140px"
- clearable>
- <el-option label="寰呯‘璁�"
- :value="1"></el-option>
- <el-option label="寰呯敓浜�"
- :value="2"></el-option>
- <el-option label="鐢熶骇涓�"
- :value="3"></el-option>
- <el-option label="宸茬敓浜�"
- :value="4"></el-option>
+ <el-form-item label="瀹℃牳鐘舵��:">
+ <el-select v-model="searchForm.auditStatus" placeholder="璇烽�夋嫨" style="width: 200px;" @change="handleQuery">
+ <el-option v-for="item in auditStatusOptions" :key="item.value" :label="item.label" :value="item.value">
+ </el-option>
</el-select>
</el-form-item>
<el-form-item>
@@ -115,7 +106,7 @@
</template>
</el-table-column>
<el-table-column label="鎿嶄綔"
- width="60">
+ >
<template #default="scope">
<el-button link
type="primary"
@@ -134,42 +125,83 @@
</template>
</PIMTable>
</div>
+ <el-dialog
+ v-model="auditDialogVisible"
+ title="瀹℃牳鎰忚"
+ width="1200px"
+ :close-on-click-modal="false"
+ >
+ <!-- 瀹℃牳琛ㄥ崟 -->
+ <div style=" padding: 15px; border-radius: 4px;">
+ <el-form ref="auditFormRef" :model="form" :rules="auditFormRules" label-width="100px">
+ <el-form-item label="瀹℃牳缁撴灉" prop="auditResult">
+ <el-radio-group v-model="form.auditResult" @change="handleAuditResultChange" size="large">
+ <el-radio label=1 >閫氳繃</el-radio>
+ <el-radio label=2 >涓嶉�氳繃</el-radio>
+ </el-radio-group>
+ </el-form-item>
+ <el-form-item label="澶囨敞鎰忚" prop="remarks">
+ <el-input
+ v-model="form.remarks"
+ type="textarea"
+ :rows="4"
+ placeholder="璇疯緭鍏ュ娉ㄦ垨鎰忚锛堜笉閫氳繃鏃朵负蹇呭~锛�"
+ maxlength="500"
+ show-word-limit
+ />
+ </el-form-item>
+ </el-form>
+ </div>
+
+ <template #footer>
+ <span class="dialog-footer">
+ <el-button type="primary" @click="submitAudit">鎻愪氦瀹℃牳</el-button>
+ <el-button :disabled="auditLoading" @click="auditDialogVisible = false">鍙栨秷</el-button>
+ </span>
+ </template>
+ </el-dialog>
<form-dia ref="formDia"
@close="handleQuery"></form-dia>
<input-modal v-if="isShowInput"
v-model:visible="isShowInput"
:production-product-main-id="isShowingId" />
- <output-modal v-if="isShowOutput"
- v-model:visible="isShowOutput"
- :production-product-main-id="isShowingId" />
</div>
</template>
<script setup>
- import { onMounted, ref } from "vue";
+ import { onMounted, ref, reactive, toRefs, nextTick, getCurrentInstance } from "vue";
import FormDia from "@/views/productionManagement/productionReporting/components/formDia.vue";
- import { ElMessageBox } from "element-plus";
+ import { ElMessageBox, ElMessage } from "element-plus";
import {
productionReportUpdate,
workListPageById,
productionReportDelete,
} from "@/api/productionManagement/productionReporting.js";
- import { productionProductMainListPage } from "@/api/productionManagement/productionProductMain.js";
+ import { productionProductMainListPage, productAudit } from "@/api/productionManagement/productionProductMain.js";
import { userListNoPageByTenantId } from "@/api/system/user.js";
import InputModal from "@/views/productionManagement/productionReporting/Input.vue";
- import OutputModal from "@/views/productionManagement/productionReporting/Output.vue";
const data = reactive({
searchForm: {
nickName: "",
workOrderNo: "",
workOrderStatus: "",
+ auditStatus: "", // 瀹℃牳鐘舵��
},
});
const { searchForm } = toRefs(data);
const expandedRowKeys = ref([]);
+ const auditDialogVisible = ref(false);
+ const auditRowData = ref(null);
+ const auditTableData = ref([]);
+ const auditLoading = ref(false);
const expandData = ref([]);
const userList = ref([]);
+ const auditStatusOptions = ref([
+ { label: "鏈鏍�", value: 0 },
+ { label: "閫氳繃", value: 1 },
+ { label: "涓嶉�氳繃", value: 2 },
+ ]);
const tableColumn = ref([
{
label: "鎶ュ伐鍗曞彿",
@@ -182,84 +214,80 @@
width: 120,
},
{
+ label: "宸ュ簭",
+ prop: "process",
+ width: 120,
+ },
+ {
+ label: "瀹℃牳鐘舵��",
+ prop: "auditStatus",
+ width: 120,
+ dataType: "tag",
+ formatData: val => {
+ const statusMap = { 0: "鏈鏍�", 1: "閫氳繃", 2: "涓嶉�氳繃" };
+ return statusMap[val] ?? "鏈煡";
+ },
+ formatType: val => {
+ const typeMap = { 0: "info", 1: "success", 2: "danger" };
+ return typeMap[val] ?? "";
+ },
+ },
+ {
label: "宸ュ崟缂栧彿",
prop: "workOrderNo",
width: 120,
},
{
- label: "鎶ュ伐鐘舵��",
- prop: "status",
- dataType: "tag",
- formatData: params => {
- if (params == 3) {
- return "宸叉姤宸�";
- } else if (params == 1) {
- return "寰呯敓浜�";
- } else {
- return "鐢熶骇涓�";
- }
- },
- formatType: params => {
- if (params == 3) {
- return "success";
- } else if (params == 1) {
- return "primary";
- } else {
- return "warning";
- }
- },
+ label: "閿�鍞悎鍚屽彿",
+ prop: "salesContractNo",
+ width: 120,
},
{
- label: "宸ュ崟鐘舵��",
- prop: "workOrderStatus",
- dataType: "tag",
- formatData: params => {
- switch (params) {
- case "1":
- return "寰呯‘璁�";
- case "2":
- return "寰呯敓浜�";
- case "3":
- return "鐢熶骇涓�";
- case "4":
- return "宸茬敓浜�";
- default:
- return "";
- }
- },
- formatType: params => {
- switch (params) {
- case "1":
- return "primary";
- case "2":
- return "info";
- case "3":
- return "warning";
- case "4":
- return "success";
- default:
- return "";
- }
- },
+ label: "浜у搧鍚嶇О",
+ prop: "productName",
+ width: 120,
},
{
- label: "鐢熶骇鏃堕棿",
+ label: "浜у搧瑙勬牸鍨嬪彿",
+ prop: "productModelName",
+ width: 120,
+ },
+ {
+ label: "浜у嚭鏁伴噺",
+ prop: "quantity",
+ width: 120,
+ },
+ {
+ label: "鎶ュ簾鏁伴噺",
+ prop: "scrapQty",
+ width: 120,
+ },
+ {
+ label: "鍗曚綅",
+ prop: "unit",
+ width: 120,
+ },
+ {
+ label: "瀹℃牳浜�",
+ prop: "auditUserName",
+ width: 120,
+ },
+ {
+ label: "澶囨敞淇℃伅",
+ prop: "auditOpinion",
+ minWidth: 120,
+ },
+ {
+ label: "鍒涘缓鏃堕棿",
prop: "createTime",
width: 120,
- formatData: params => {
- const date = new Date(params);
- return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(
- 2,
- "0"
- )}-${String(date.getDate()).padStart(2, "0")}`;
- },
},
{
dataType: "action",
label: "鎿嶄綔",
align: "center",
fixed: "right",
- width: 230,
+ width: 200,
operation: [
{
name: "鏌ョ湅鎶曞叆",
@@ -269,18 +297,19 @@
},
},
{
- name: "鏌ョ湅浜у嚭",
- type: "text",
- clickFun: row => {
- showOutput(row);
- },
- },
- {
name: "鍒犻櫎",
type: "danger",
clickFun: row => {
deleteReport(row);
},
+ },
+ {
+ name:"瀹℃牳",
+ color: "#E6A23C",
+ clickFun: row => {
+ handleAudit(row);
+ },
+ disabled: row => Number(row?.auditStatus) !== 0, // 宸插鏍告椂绂佺敤瀹℃牳鎸夐挳
},
],
},
@@ -296,6 +325,26 @@
});
const formDia = ref();
const { proxy } = getCurrentInstance();
+ const auditFormRef = ref(null);
+ const auditFormRules = ref({
+ auditResult: [{ required: true, message: "璇烽�夋嫨瀹℃牳缁撴灉", trigger: "change" }],
+ remarks: [
+ {
+ validator: (rule, value, callback) => {
+ if (form.value.auditResult === "2" && (!value || value.trim() === "")) {
+ callback(new Error("涓嶉�氳繃鏃跺繀椤诲~鍐欏娉ㄦ垨鎰忚"));
+ } else {
+ callback();
+ }
+ },
+ trigger: ["change", "blur"],
+ },
+ ],
+ });
+ const form = ref({
+ auditResult: 1,
+ remarks: "",
+ });
// 鏌ヨ鍒楄〃
/** 鎼滅储鎸夐挳鎿嶄綔 */
@@ -452,11 +501,73 @@
isShowingId.value = row.id;
};
- // 鎵撳紑浜у嚭妯℃�佹
- const isShowOutput = ref(false);
- const showOutput = row => {
- isShowOutput.value = true;
- isShowingId.value = row.id;
+ // 瀹℃牳
+ const handleAudit = (row) => {
+ if (Number(row?.auditStatus) === 1) {
+ ElMessage.warning("璇ュ伐鍗曞凡瀹℃牳");
+ return;
+ }
+ // 閲嶇疆琛ㄥ崟锛岄粯璁ら�夋嫨閫氳繃
+ form.value = {
+ auditResult: "1",
+ remarks: "",
+ };
+ auditRowData.value = row;
+ const workOrderNo = row?.workOrderNo;
+ const related = workOrderNo
+ ? tableData.value.filter(r => r?.workOrderNo === workOrderNo)
+ : [];
+ auditTableData.value = related.length > 0 ? related : [row];
+ auditDialogVisible.value = true;
+ nextTick(() => {
+ auditFormRef.value?.clearValidate();
+ });
+ };
+
+ // 瀹℃牳缁撴灉鍙樻洿
+ const handleAuditResultChange = () => {
+ if (form.value.auditResult === "1") {
+ // 鍒囨崲涓洪�氳繃鏃舵竻闄ゅ娉ㄦ牎楠�
+ auditFormRef.value?.clearValidate("remarks");
+ } else {
+ // 鍒囨崲涓轰笉閫氳繃鏃堕噸鏂拌Е鍙戝娉ㄦ牎楠�
+ auditFormRef.value?.validateField("remarks");
+ }
+ };
+
+ // 鎻愪氦瀹℃牳
+ const submitAudit = (auditResult) => {
+ auditFormRef.value?.validate().then(() => {
+ auditLoading.value = true;
+ const auditData = {
+ id: auditRowData.value.id,
+ auditStatus: Number(form.value.auditResult),
+ auditOpinion: form.value.remarks,
+ };
+ // 璋冪敤鎶ュ伐瀹℃壒API
+ productAudit(auditData)
+ .then(res => {
+ if (res.code === 200) {
+ if(form.value.auditResult == 1){
+ proxy.$modal.msgSuccess("瀹℃牳閫氳繃");
+ }else{
+ proxy.$modal.msgError("瀹℃牳涓嶉�氳繃");
+ }
+ auditDialogVisible.value = false;
+ getList();
+ } else {
+ proxy.$modal.msgError(res.msg || "瀹℃牳澶辫触");
+ }
+ })
+ .catch(err => {
+ proxy.$modal.msgError("瀹℃牳澶辫触");
+ })
+ .finally(() => {
+ auditLoading.value = false;
+ });
+ }).catch(() => {
+ // 楠岃瘉澶辫触
+ });
};
// 瀵煎嚭
@@ -467,7 +578,7 @@
type: "warning",
})
.then(() => {
- proxy.download("/salesLedger/work/export", {}, "鐢熶骇鎶ュ伐.xlsx");
+ proxy.download("/productionProductMain/export", {}, "鐢熶骇鎶ュ伐.xlsx");
})
.catch(() => {
proxy.$modal.msg("宸插彇娑�");
--
Gitblit v1.9.3