From 3f15d0eef89e52f3fd6d1be13ff3af010b6f0ee9 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期三, 05 十一月 2025 15:27:44 +0800
Subject: [PATCH] 录入日期改为可选择
---
src/views/qualityManagement/nearExpiryReturn/index.vue | 154 +++++----------------------------------------------
1 files changed, 15 insertions(+), 139 deletions(-)
diff --git a/src/views/qualityManagement/nearExpiryReturn/index.vue b/src/views/qualityManagement/nearExpiryReturn/index.vue
index d2fe85b..3758b43 100644
--- a/src/views/qualityManagement/nearExpiryReturn/index.vue
+++ b/src/views/qualityManagement/nearExpiryReturn/index.vue
@@ -218,13 +218,7 @@
<script setup name="NearExpiryReturn">
import { ref, reactive, onMounted } from "vue";
import { ElMessageBox } from "element-plus";
-import {
- nearExpiryReturnListPage,
- nearExpiryReturnAdd,
- nearExpiryReturnUpdate,
- nearExpiryReturnDel,
- nearExpiryReturnDetail
-} from "@/api/qualityManagement/nearExpiryReturn";
+// API鎺ュ彛宸茬Щ闄わ紝涓嶅啀璋冪敤鍚庣鎺ュ彛
const { proxy } = getCurrentInstance();
const { parseTime } = proxy;
@@ -291,101 +285,9 @@
/** 鏌ヨ涓存湡閫�鍥炲彴璐﹀垪琛� */
function getList() {
loading.value = true;
- // 浣跨敤鍋囨暟鎹�
- const mockData = {
- records: [
- {
- id: 1,
- productName: "缁寸敓绱燙鐗�",
- productSpec: "100mg脳30鐗�",
- batchNumber: "VC20240315001",
- productionDate: "2024-03-15",
- expiryDate: "2024-09-15",
- returnQuantity: 50,
- returnReason: "涓磋繎淇濊川鏈�",
- returnDate: "2024-09-10",
- status: "1",
- remark: "閫�鍥炰粨搴撳鐞�"
- },
- {
- id: 2,
- productName: "闃胯帿瑗挎灄鑳跺泭",
- productSpec: "250mg脳24绮�",
- batchNumber: "AMX20240220002",
- productionDate: "2024-02-20",
- expiryDate: "2024-08-20",
- returnQuantity: 30,
- returnReason: "鍖呰鐮存崯涓斾复鏈�",
- returnDate: "2024-08-18",
- status: "2",
- remark: "宸查攢姣佸鐞�"
- },
- {
- id: 3,
- productName: "鎰熷啋鐏甸绮�",
- productSpec: "10g脳12琚�",
- batchNumber: "GML20240110003",
- productionDate: "2024-01-10",
- expiryDate: "2024-07-10",
- returnQuantity: 25,
- returnReason: "涓磋繎淇濊川鏈�",
- returnDate: "2024-07-08",
- status: "0",
- remark: "寰呴噸鏂板寘瑁�"
- },
- {
- id: 4,
- productName: "澶嶅悎缁寸敓绱犵墖",
- productSpec: "60鐗�/鐡�",
- batchNumber: "VB20240405004",
- productionDate: "2024-04-05",
- expiryDate: "2025-04-05",
- returnQuantity: 80,
- returnReason: "涓磋繎淇濊川鏈�",
- returnDate: "2024-09-25",
- status: "1",
- remark: "姝e湪鑱旂郴閿�鍞笭閬�"
- },
- {
- id: 5,
- productName: "閽欑墖",
- productSpec: "600mg脳100鐗�",
- batchNumber: "CA20240301005",
- productionDate: "2024-03-01",
- expiryDate: "2024-09-01",
- returnQuantity: 120,
- returnReason: "鍖呰闂涓斾复鏈�",
- returnDate: "2024-08-30",
- status: "2",
- remark: "宸插畬鎴愰��璐у鐞�"
- }
- ],
- total: 5
- };
-
- // 妯℃嫙杩囨护閫昏緫
- let filteredRecords = mockData.records;
-
- if (queryParams.value.productName) {
- filteredRecords = filteredRecords.filter(item =>
- item.productName.includes(queryParams.value.productName)
- );
- }
-
- if (queryParams.value.batchNumber) {
- filteredRecords = filteredRecords.filter(item =>
- item.batchNumber.includes(queryParams.value.batchNumber)
- );
- }
-
- if (queryParams.value.returnDate) {
- filteredRecords = filteredRecords.filter(item =>
- item.returnDate === queryParams.value.returnDate
- );
- }
-
- nearExpiryReturnList.value = filteredRecords;
- total.value = filteredRecords.length;
+ // 涓嶈皟鐢ㄦ帴鍙o紝杩斿洖绌烘暟鎹�
+ nearExpiryReturnList.value = [];
+ total.value = 0;
loading.value = false;
}
@@ -442,12 +344,9 @@
/** 淇敼鎸夐挳鎿嶄綔 */
function handleUpdate(row) {
reset();
- const id = row.id || ids.value;
-
- // 浣跨敤鍋囨暟鎹幏鍙栬鎯�
- const mockDetail = nearExpiryReturnList.value.find(item => item.id === (Array.isArray(id) ? id[0] : id));
- if (mockDetail) {
- form.value = { ...mockDetail };
+ // 涓嶈皟鐢ㄦ帴鍙o紝鐩存帴浣跨敤浼犲叆鐨勬暟鎹�
+ if (row) {
+ form.value = { ...row };
open.value = true;
title.value = "淇敼涓存湡閫�鍥炲彴璐�";
}
@@ -457,24 +356,14 @@
function submitForm() {
proxy.$refs["formRef"].validate(valid => {
if (valid) {
+ // 涓嶈皟鐢ㄦ帴鍙o紝鍙樉绀烘垚鍔熸彁绀�
if (form.value.id != null) {
- // 妯℃嫙鏇存柊
- const index = nearExpiryReturnList.value.findIndex(item => item.id === form.value.id);
- if (index !== -1) {
- nearExpiryReturnList.value[index] = { ...form.value };
- }
proxy.$modal.msgSuccess("淇敼鎴愬姛");
- open.value = false;
- getList();
} else {
- // 妯℃嫙鏂板
- const newId = Math.max(...nearExpiryReturnList.value.map(item => item.id)) + 1;
- nearExpiryReturnList.value.push({ ...form.value, id: newId });
- total.value = nearExpiryReturnList.value.length;
proxy.$modal.msgSuccess("鏂板鎴愬姛");
- open.value = false;
- getList();
}
+ open.value = false;
+ getList();
}
});
}
@@ -487,33 +376,20 @@
cancelButtonText: "鍙栨秷",
type: "warning"
}).then(function() {
- // 妯℃嫙鍒犻櫎
- if (Array.isArray(deleteIds)) {
- deleteIds.forEach(id => {
- const index = nearExpiryReturnList.value.findIndex(item => item.id === id);
- if (index !== -1) {
- nearExpiryReturnList.value.splice(index, 1);
- }
- });
- } else {
- const index = nearExpiryReturnList.value.findIndex(item => item.id === deleteIds);
- if (index !== -1) {
- nearExpiryReturnList.value.splice(index, 1);
- }
- }
- getList();
+ // 涓嶈皟鐢ㄦ帴鍙o紝鍙樉绀烘垚鍔熸彁绀�
proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+ getList();
}).catch(() => {});
}
/** 瀵煎嚭鎸夐挳鎿嶄綔 */
function handleExport() {
- proxy.download('quality/nearExpiryReturn/export', {
- ...queryParams.value
- }, `涓存湡閫�鍥炲彴璐${new Date().getTime()}.xlsx`);
+ // 涓嶈皟鐢ㄦ帴鍙o紝鍙樉绀烘彁绀�
+ proxy.$modal.msgSuccess("瀵煎嚭鍔熻兘鏆傛湭瀹炵幇");
}
onMounted(() => {
getList();
});
</script>
+
--
Gitblit v1.9.3