From a4fcad66822cfc97858a1e460c5585e577ec2551 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期二, 24 三月 2026 12:21:07 +0800
Subject: [PATCH] fix: 质量管理可编辑

---
 src/pages/qualityManagement/nonconformingManagement/index.vue |   35 ++++++++++++++++++++++-------------
 1 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/src/pages/qualityManagement/nonconformingManagement/index.vue b/src/pages/qualityManagement/nonconformingManagement/index.vue
index f3cc42e..f83e37d 100644
--- a/src/pages/qualityManagement/nonconformingManagement/index.vue
+++ b/src/pages/qualityManagement/nonconformingManagement/index.vue
@@ -54,8 +54,8 @@
           </view>
           <view class="card-actions">
             <view class="btn-link btn-link-primary" v-if="item.inspectState == 0" @click.stop="openDealDialog(item)">澶勭悊</view>
-            <view class="btn-link btn-link-plain" v-if="item.inspectState == 0" @click.stop="openForm('edit', item)">缂栬緫</view>
-            <view class="btn-link btn-link-warn" @click.stop="handleDelete(item)">鍒犻櫎</view>
+            <view class="btn-link btn-link-plain" v-if="item.inspectState == 0 && hasNonconformingEdit" @click.stop="openForm('edit', item)">缂栬緫</view>
+            <view class="btn-link btn-link-warn" v-if="item.inspectState == 0 && hasNonconformingCancel" @click.stop="handleDelete(item)">鍒犻櫎</view>
           </view>
         </view>
         <view class="load-more-wrap">
@@ -168,6 +168,10 @@
 import dayjs from 'dayjs';
 import PageHeader from '@/components/PageHeader.vue'
 import { onReachBottom, onShow } from '@dcloudio/uni-app'
+import { checkPermi } from '@/utils/permission'
+
+const hasNonconformingEdit = computed(() => checkPermi(['nonconforming_edit']))
+const hasNonconformingCancel = computed(() => checkPermi(['nonconforming_cancel']))
 
 const searchForm = reactive({
   productName: '',
@@ -243,9 +247,14 @@
   return types[String(type ?? '')] || '-';
 };
 
-const getList = () => {
+const getList = (force = false) => {
   const isFirstPage = page.current === 1
-  if (loadStatus.value === 'loading' || (!isFirstPage && page.total > 0 && tableData.value.length >= page.total)) return
+  if (
+    !force &&
+    (loadStatus.value === 'loading' ||
+      (!isFirstPage && page.total > 0 && tableData.value.length >= page.total))
+  )
+    return
 
   loadStatus.value = 'loading'
   const params = {
@@ -288,7 +297,7 @@
   page.total = 0;
   tableData.value = [];
   loadStatus.value = 'loadmore';
-  getList();
+  getList(true);
 };
 
 const selectType = (e) => {
@@ -353,14 +362,13 @@
 };
 
 const handleDelete = (row) => {
-  showConfirm('纭鍒犻櫎璇ヤ笉鍚堟牸璁板綍鍚楋紵').then(res => {
-    if (res.confirm) {
-      qualityUnqualifiedDel([row.id]).then(() => {
-        toast('鍒犻櫎鎴愬姛');
-        handleQuery();
-      });
-    }
-  });
+  if (!hasNonconformingCancel.value) return
+  showConfirm('纭鍒犻櫎璇ヤ笉鍚堟牸璁板綍鍚楋紵').then(async res => {
+    if (!res.confirm) return
+    await qualityUnqualifiedDel([row.id])
+    toast('鍒犻櫎鎴愬姛')
+    handleQuery()
+  })
 };
 
 const confirmDate = (e) => {
@@ -369,6 +377,7 @@
 };
 
 const openForm = (type, row) => {
+  if (type === 'edit' && !hasNonconformingEdit.value) return
   if (type !== 'add' && row?.inspectState == 1) {
     toast('宸插鐞嗙殑鏁版嵁涓嶈兘鍐嶇紪杈�')
     return

--
Gitblit v1.9.3