From d991871847391f150dd9c5aa9c871a96b75b7880 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期一, 23 三月 2026 17:11:36 +0800
Subject: [PATCH] fix: 质量管理 可编辑

---
 src/views/consumablesLogistics/dispatchLog/Record.vue |  104 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 102 insertions(+), 2 deletions(-)

diff --git a/src/views/consumablesLogistics/dispatchLog/Record.vue b/src/views/consumablesLogistics/dispatchLog/Record.vue
index b526972..ab73b46 100644
--- a/src/views/consumablesLogistics/dispatchLog/Record.vue
+++ b/src/views/consumablesLogistics/dispatchLog/Record.vue
@@ -28,7 +28,12 @@
 			</div>
 			<div>
 				<el-button @click="handleOut">瀵煎嚭</el-button>
-				<el-button type="danger" plain @click="handleDelete">鍒犻櫎</el-button>
+				<el-button
+					type="danger"
+					plain
+					@click="handleDelete"
+					v-if="hasCDispatchCancel"
+				>鍒犻櫎</el-button>
 				<!-- <el-button type="primary" plain @click="handlePrint">鎵撳嵃</el-button> -->
 			</div>
 		</div>
@@ -86,6 +91,16 @@
 					prop="createBy"
 					show-overflow-tooltip
 				/>
+				<el-table-column label="鎿嶄綔" width="160" align="center">
+					<template #default="scope">
+						<el-button
+							v-if="hasCDispatchEdit"
+							type="primary"
+							size="mini"
+							@click="handleEdit(scope.row)"
+						>缂栬緫</el-button>
+					</template>
+				</el-table-column>
         <!-- <el-table-column label="鏉ユ簮"
                          prop="recordType"
                          show-overflow-tooltip>
@@ -105,21 +120,66 @@
 			/>
 		</div>
 	</div>
+
+	<el-dialog
+		title="缂栬緫鍑哄簱淇℃伅"
+		v-model="isShowEditModal"
+		width="600px"
+	>
+		<el-form
+			ref="editFormRef"
+			:model="editForm"
+			label-width="90px"
+		>
+			<el-form-item
+				label="鏁伴噺"
+				prop="qualitity"
+				:rules="[{ required: true, message: '璇疯緭鍏ユ暟閲�', trigger: ['blur', 'change'] }]"
+			>
+				<el-input-number
+					v-model="editForm.qualitity"
+					:min="0"
+					:step="1"
+					:precision="0"
+					controls-position="right"
+					style="width: 100%"
+					placeholder="璇疯緭鍏ユ暟閲�"
+				/>
+			</el-form-item>
+			<el-form-item
+				label="閲囪喘鍛�"
+				prop="purchaser"
+				:rules="[{ required: true, message: '璇疯緭鍏ラ噰璐憳', trigger: ['blur', 'change'] }]"
+			>
+				<el-input
+					v-model="editForm.purchaser"
+					placeholder="璇疯緭鍏ラ噰璐憳"
+				/>
+			</el-form-item>
+		</el-form>
+
+		<template #footer>
+			<el-button @click="closeEditModal">鍙栨秷</el-button>
+			<el-button type="primary" @click="handleEditSubmit">纭畾</el-button>
+		</template>
+	</el-dialog>
 </template>
 
 <script setup>
 import pagination from "@/components/PIMTable/Pagination.vue";
-import { ref, reactive, toRefs, getCurrentInstance } from "vue";
+import { ref, reactive, toRefs, getCurrentInstance, computed } from "vue";
 import { ElMessageBox } from "element-plus";
 import useUserStore from "@/store/modules/user";
 import { getCurrentDate } from "@/utils/index.js";
 import {
 	getConsumablesOutRecordPage,
 	delConsumablesOutRecord,
+	editStockOut,
 } from "@/api/consumablesLogistics/consumablesOutRecord.js";
 import {
   findAllQualifiedStockOutRecordTypeOptions, findAllUnQualifiedStockOutRecordTypeOptions,
 } from "@/api/basicData/enum.js";
+import { checkPermi } from "@/utils/permission.js";
 
 const userStore = useUserStore();
 const { proxy } = getCurrentInstance();
@@ -142,6 +202,46 @@
   }
 })
 
+const hasCDispatchEdit = computed(() => checkPermi(['c_dispatch_edit']));
+const hasCDispatchCancel = computed(() => checkPermi(['c_dispatch_cancel']));
+
+// 缂栬緫寮规鏁版嵁
+const isShowEditModal = ref(false);
+const editFormRef = ref();
+const editForm = reactive({
+	id: undefined,
+	qualitity: undefined,
+	purchaser: "",
+});
+
+const handleEdit = (row) => {
+	editForm.id = row.id;
+	editForm.qualitity = row.qualitity;
+	editForm.purchaser = row.purchaser ?? "";
+	isShowEditModal.value = true;
+};
+
+const closeEditModal = () => {
+	isShowEditModal.value = false;
+
+	editForm.id = undefined;
+	editForm.qualitity = undefined;
+	editForm.purchaser = "";
+
+	editFormRef.value?.clearValidate?.();
+};
+
+const handleEditSubmit = () => {
+	editFormRef.value?.validate?.((valid) => {
+		if (!valid) return;
+		editStockOut({ ...editForm }).then(() => {
+			closeEditModal();
+			proxy.$modal.msgSuccess("缂栬緫鎴愬姛");
+			getList();
+		});
+	});
+};
+
 // 鎵撳嵃鐩稿叧
 const printPreviewVisible = ref(false);
 const printData = ref([]);

--
Gitblit v1.9.3