From bc5cab0770963c2ae0f54cbceadb5cc42780879a Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期二, 24 三月 2026 14:20:52 +0800
Subject: [PATCH] fix: 仓储物流日期筛选有问题,耗材物料没有日期筛选框

---
 src/pages/qualityManagement/rawMaterial/index.vue |   56 +++++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 45 insertions(+), 11 deletions(-)

diff --git a/src/pages/qualityManagement/rawMaterial/index.vue b/src/pages/qualityManagement/rawMaterial/index.vue
index 8f2d009..a661bc4 100644
--- a/src/pages/qualityManagement/rawMaterial/index.vue
+++ b/src/pages/qualityManagement/rawMaterial/index.vue
@@ -31,7 +31,11 @@
       <view v-for="(item, index) in tableData" :key="index" class="list-item">
         <view class="item-header">
           <text class="product-name">{{ item.productName }}</text>
-          <up-tag :text="item.inspectState ? '宸叉彁浜�' : '鏈彁浜�'" :type="item.inspectState ? 'success' : 'warning'" size="mini"></up-tag>
+          <up-tag
+            :text="item.inspectState == 1 ? '宸叉彁浜�' : '鏈彁浜�'"
+            :type="item.inspectState == 1 ? 'success' : 'warning'"
+            size="mini"
+          ></up-tag>
         </view>
         <view class="item-content">
           <view class="item-row">
@@ -56,9 +60,10 @@
           </view>
         </view>
         <view class="item-actions">
-          <up-button v-if="!item.inspectState" type="primary" size="mini" @click.stop="openForm('edit', item)">缂栬緫</up-button>
-          <up-button v-if="!item.inspectState" type="success" size="mini" @click.stop="handleConfirmSubmit(item)">鎻愪氦</up-button>
-          <up-button type="error" size="mini" @click.stop="handleDelete(item)">鍒犻櫎</up-button>
+          <up-button v-if="item.inspectState != 1" type="primary" size="mini" @click.stop="openForm('edit', item)">缂栬緫</up-button>
+          <up-button type="info" size="mini" @click.stop="openFiles(item)">闄勪欢</up-button>
+          <up-button v-if="item.inspectState != 1" type="success" size="mini" @click.stop="handleConfirmSubmit(item)">鎻愪氦</up-button>
+          <up-button v-if="hasRawCancel" type="error" size="mini" @click.stop="handleDelete(item)">鍒犻櫎</up-button>
         </view>
       </view>
       <view class="pagination-container">
@@ -96,7 +101,8 @@
 </template>
 
 <script setup>
-import { ref, reactive, onMounted, computed } from 'vue';
+import { ref, reactive, computed } from 'vue';
+import { onShow } from '@dcloudio/uni-app';
 import {
   findRawMaterialListPage,
   submitRawMaterial,
@@ -104,8 +110,10 @@
 } from '@/api/qualityManagement/rawMaterial.js';
 import { toast, showConfirm } from '@/utils/common';
 import useUserStore from '@/store/modules/user';
+import { checkPermi } from '@/utils/permission';
 
 const userStore = useUserStore();
+const hasRawCancel = computed(() => checkPermi(['raw_cancel']));
 
 const searchForm = reactive({
   batchNo: '',
@@ -195,9 +203,11 @@
 };
 
 const openForm = (type, item) => {
-  // Mobile usually navigates to a new page for add/edit if complex
-  // Here we'll just show a toast for now as the actual form components are many
-  toast('鍔熻兘寮�鍙戜腑锛岃鍦≒C绔搷浣�');
+  if (type === 'edit' && !hasRawEdit.value) return
+  const id = item?.id
+  uni.navigateTo({
+    url: `/pages/qualityManagement/rawMaterial/form?type=${type}${id ? `&id=${id}` : ''}`
+  })
 };
 
 const handleConfirmSubmit = (row) => {
@@ -212,9 +222,11 @@
 };
 
 const handleDelete = (row) => {
+  if (!hasRawCancel.value) return
   showConfirm('纭鍒犻櫎璇ヨ褰曞悧锛�').then(res => {
     if (res.confirm) {
-      deleteRawMaterial({ id: row.id }).then(() => {
+      // 瀵归綈 PC 绔細鍒犻櫎鎺ュ彛鎺ユ敹 id 鏁扮粍
+      deleteRawMaterial([row.id]).then(() => {
         toast('鍒犻櫎鎴愬姛');
         handleQuery();
       });
@@ -222,11 +234,24 @@
   });
 };
 
+const openFiles = (row) => {
+  if (!row?.id) {
+    toast('璇峰厛淇濆瓨鍚庡啀涓婁紶闄勪欢')
+    return
+  }
+  try {
+    uni.setStorageSync('rawMaterialFilesCtx', JSON.stringify({ id: row.id }))
+  } catch (e) {}
+  uni.navigateTo({
+    url: `/pages/qualityManagement/rawMaterial/files?id=${row.id}`
+  })
+}
+
 const goBack = () => {
   uni.navigateBack();
 };
 
-onMounted(() => {
+onShow(() => {
   handleQuery();
 });
 </script>
@@ -309,10 +334,19 @@
 .item-actions {
   display: flex;
   justify-content: flex-end;
-  gap: 20rpx;
+  gap: 16rpx;
   border-top: 1rpx solid #ebeef5;
   padding-top: 20rpx;
 }
+.item-actions :deep(.u-button),
+.item-actions :deep(.up-button) {
+  min-width: 140rpx;
+  height: 64rpx;
+  line-height: 64rpx;
+  font-size: 26rpx;
+  border-radius: 999rpx;
+  padding: 0 24rpx;
+}
 
 .no-data {
   padding-top: 200rpx;

--
Gitblit v1.9.3