From e97b55310155a2dd691bd698a10295a4d867f60c Mon Sep 17 00:00:00 2001
From: baoshiwei <baoshiwei@shlanbao.cn>
Date: 星期五, 17 四月 2026 15:55:51 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 ruoyi-plus-soybean/src/views/qm/batch/index.vue |  231 ++++++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 177 insertions(+), 54 deletions(-)

diff --git a/ruoyi-plus-soybean/src/views/qm/batch/index.vue b/ruoyi-plus-soybean/src/views/qm/batch/index.vue
index 96d7c52..e25ab9c 100755
--- a/ruoyi-plus-soybean/src/views/qm/batch/index.vue
+++ b/ruoyi-plus-soybean/src/views/qm/batch/index.vue
@@ -1,12 +1,14 @@
 <script setup lang="tsx">
-import { ref } from 'vue';
-import { NDivider } from 'naive-ui';
-import { fetchBatchDeleteBatch, fetchGetBatchList } from '@/service/api/qm/batch';
-import { useAppStore } from '@/store/modules/app';
-import { useAuth } from '@/hooks/business/auth';
-import { useDownload } from '@/hooks/business/download';
-import { defaultTransform, useNaivePaginatedTable, useTableOperate } from '@/hooks/common/table';
-import { $t } from '@/locales';
+import {nextTick, ref} from 'vue';
+import {useRouter} from 'vue-router';
+import {NDivider, NDropdown} from 'naive-ui';
+import {fetchBatchDeleteBatch, fetchGetBatchList} from '@/service/api/qm/batch';
+import {useAppStore} from '@/store/modules/app';
+import {useAuth} from '@/hooks/business/auth';
+import {useDownload} from '@/hooks/business/download';
+import {useSvgIcon} from '@/hooks/common/icon';
+import {defaultTransform, useNaivePaginatedTable, useTableOperate} from '@/hooks/common/table';
+import {$t} from '@/locales';
 import ButtonIcon from '@/components/custom/button-icon.vue';
 import BatchOperateDrawer from './modules/batch-operate-drawer.vue';
 import BatchSearch from './modules/batch-search.vue';
@@ -16,18 +18,145 @@
 });
 
 const appStore = useAppStore();
-const { download } = useDownload();
-const { hasAuth } = useAuth();
+const router = useRouter();
+const {download} = useDownload();
+const {hasAuth} = useAuth();
+const {SvgIconVNode} = useSvgIcon();
+
+// 鍙抽敭鑿滃崟鐩稿叧
+const showDropdown = ref(false);
+const x = ref(0);
+const y = ref(0);
+const currentRow = ref<Api.Qm.Batch | null>(null);
+
+const dropdownOptions = [
+  {
+    label: '鍘熷鏁版嵁缁存姢',
+    key: 'raw-data-maintenance',
+    icon: SvgIconVNode({icon: 'mdi:database-edit-outline', fontSize: 18})
+  },
+  {
+    label: '缁煎悎娴嬭瘯鍙版暟鎹淮鎶�',
+    key: 'test-bench-maintenance',
+    icon: SvgIconVNode({icon: 'mdi:monitor-dashboard', fontSize: 18})
+  },
+  {
+    label: '鏂板缓澶嶆鎵规',
+    key: 'new-recheck-batch',
+    icon: SvgIconVNode({icon: 'mdi:plus-circle-outline', fontSize: 18})
+  },
+  {
+    type: 'divider',
+    key: 'd1'
+  },
+  {
+    label: '鍗峰寘鍗峰埗妫�楠岀粨鏋滄姤鍛�',
+    key: 'report-rolling',
+    icon: SvgIconVNode({icon: 'mdi:file-document-outline', fontSize: 18})
+  },
+  {
+    label: '鍖呰鏍囪瘑妫�楠屽師濮嬭褰�',
+    key: 'record-packaging',
+    icon: SvgIconVNode({icon: 'mdi:barcode-scan', fontSize: 18})
+  },
+  {
+    label: '鐔勭伀銆佸惈姘寸巼銆佸惈鏈巼鍘熷璁板綍',
+    key: 'record-quality',
+    icon: SvgIconVNode({icon: 'mdi:water-percent', fontSize: 18})
+  },
+  {
+    label: '绔儴钀戒笣鍘熷璁板綍',
+    key: 'record-silk',
+    icon: SvgIconVNode({icon: 'mdi:format-list-bulleted-type', fontSize: 18})
+  },
+  {
+    label: '缁煎悎娴嬭瘯鍙板師濮嬭褰�',
+    key: 'record-bench',
+    icon: SvgIconVNode({icon: 'mdi:chart-line', fontSize: 18})
+  },
+  {
+    label: '澶栬妫�楠屽師濮嬭褰�',
+    key: 'record-appearance',
+    icon: SvgIconVNode({icon: 'mdi:eye-outline', fontSize: 18})
+  },
+  {
+    type: 'divider',
+    key: 'd2'
+  },
+  {
+    label: $t('common.edit'),
+    key: 'edit',
+    icon: SvgIconVNode({icon: 'material-symbols:drive-file-rename-outline-outline', fontSize: 18}),
+    show: hasAuth('qm:batch:edit')
+  },
+  {
+    label: $t('common.delete'),
+    key: 'delete',
+    icon: SvgIconVNode({icon: 'material-symbols:delete-outline', fontSize: 18}),
+    show: hasAuth('qm:batch:remove')
+  }
+];
+
+function handleSelect(key: string) {
+  showDropdown.value = false;
+  if (!currentRow.value) return;
+
+  if (key === 'edit') {
+    edit(currentRow.value.id);
+  } else if (key === 'delete') {
+    window.$dialog?.error({
+      title: $t('common.confirmDelete'),
+      content: $t('common.confirmDelete'),
+      positiveText: $t('common.confirm'),
+      negativeText: $t('common.cancel'),
+      onPositiveClick: () => {
+        handleDelete(currentRow.value!.id);
+      }
+    });
+  } else if (key === 'raw-data-maintenance') {
+    // 璺宠浆鍒� matcheck 椤甸潰
+    if (!currentRow.value.judgeCode) {
+      window.$message?.warning('璇ユ壒娆℃病鏈夊垽瀹氫緷鎹�');
+      return;
+    }
+    router.push({
+      path: '/qm/matcheck',
+      query: {
+        judgeCode: currentRow.value.judgeCode,
+        batchCode: currentRow.value.batchCode,
+        matCode: currentRow.value.matCode
+      }
+    });
+  } else {
+    // 澶勭悊鍏朵粬涓氬姟鎿嶄綔
+    window.$message?.info(`鐐瑰嚮浜�: ${key}`);
+  }
+}
+
+function handleRowProps(row: Api.Qm.Batch) {
+  return {
+    onContextmenu: (e: MouseEvent) => {
+      e.preventDefault();
+      showDropdown.value = false;
+      nextTick().then(() => {
+        currentRow.value = row;
+        x.value = e.clientX;
+        y.value = e.clientY;
+        showDropdown.value = true;
+      });
+    }
+  };
+}
 
 // 绫诲瀷/鍙嶉MES/绫诲埆鐨� value->label 鏄犲皠锛堢敤浜庤〃鏍兼樉绀猴級
-const TYP_MAP: Record<string, string> = { A: '鍒朵笣', B: '鎴愬瀷', C: '鍗峰寘', D: '灏佺', E: '绯栭鏂�' };
-const FLAG_MAP: Record<string, string> = { '0': '鏈笂浼爉es', '1': '宸蹭笂浼�', '3': '浠嶮ES涓嬭浇' };
-const CATEGORY_MAP: Record<string, string> = { '0': '鎴愬搧', '1': '杈呮潗' };
+const FLAG_MAP: Record<string, string> = {'0': '鏈笂浼爉es', '1': '宸蹭笂浼�', '3': '浠嶮ES涓嬭浇'};
+const CATEGORY_MAP: Record<string, string> = {'0': '鎴愬搧', '1': '杈呮潗'};
 
 const searchParams = ref<Api.Qm.BatchSearchParams>({
   pageNum: 1,
   pageSize: 10,
   batchCode: null,
+  isflag: '1',
   typ: null,
   eqpCode: null,
   matCode: null,
@@ -35,13 +164,17 @@
   flag: null,
   toMesDate: null,
   fromMesDate: null,
-  deleted: null,
-  category: null,
+  enabled: '1',
+  deleted: 0,
+  category: '0',
   state: null,
-  params: {}
+  params: {
+    beginBatchDate: `${new Date().getFullYear()}-${String(new Date().getMonth() + 1).padStart(2, '0')}-${String(new Date().getDate()).padStart(2, '0')} 00:00:00`,
+    endBatchDate: `${new Date().getFullYear()}-${String(new Date().getMonth() + 1).padStart(2, '0')}-${String(new Date().getDate()).padStart(2, '0')} 23:59:59`
+  }
 });
 
-const { columns, columnChecks, data, getData, getDataByPage, loading, mobilePagination, scrollX } =
+const {columns, columnChecks, data, getData, getDataByPage, loading, mobilePagination, scrollX} =
   useNaivePaginatedTable({
     api: () => fetchGetBatchList(searchParams.value),
     transform: response => defaultTransform(response),
@@ -63,45 +196,20 @@
         render: (_, index) => index + 1
       },
       {
-        key: 'id',
-        title: '缂栫爜',
-        align: 'center',
-        minWidth: 120
-      },
-      {
         key: 'batchCode',
-        title: '鎵规浠g爜',
+        title: '鎵规鍙�',
         align: 'center',
         minWidth: 120
       },
       {
-        key: 'batchName',
-        title: '鎵规鍚嶇О',
-        align: 'center',
-        minWidth: 120
-      },
-      {
-        key: 'typ',
-        title: '绫诲瀷',
-        align: 'center',
-        minWidth: 120,
-        render: row => TYP_MAP[row.typ] ?? row.typ
-      },
-      {
-        key: 'eqpCode',
-        title: '鏈哄彴浠g爜',
-        align: 'center',
-        minWidth: 120
-      },
-      {
-        key: 'matCode',
+        key: 'matName',
         title: '鐗屽彿',
         align: 'center',
         minWidth: 120
       },
       {
-        key: 'judgeCode',
-        title: '鍒ゅ畾渚濇嵁浠g爜',
+        key: 'judgeName',
+        title: '鍒ゅ畾渚濇嵁',
         align: 'center',
         minWidth: 120
       },
@@ -115,13 +223,15 @@
         key: 'isflag',
         title: '浣跨敤鏍囧織',
         align: 'center',
-        minWidth: 120
+        minWidth: 120,
+        render: row => (row.isflag == '1' ? '鏄�' : '鍚�')
       },
       {
         key: 'enabled',
         title: '鍚敤鏍囧織',
         align: 'center',
-        minWidth: 120
+        minWidth: 120,
+        render: row => (row.enabled == '1' ? '鏄�' : '鍚�')
       },
       {
         key: 'totalNum',
@@ -200,7 +310,8 @@
         key: 'deleted',
         title: '鍒犻櫎鏍囧織',
         align: 'center',
-        minWidth: 120
+        minWidth: 120,
+        render: row => (row.deleted == 1 ? '鏄�' : '鍚�')
       },
       {
         key: 'batchDes',
@@ -350,6 +461,7 @@
       {
         key: 'operate',
         title: $t('common.operate'),
+        fixed: 'right',
         align: 'center',
         width: 130,
         render: row => {
@@ -357,7 +469,7 @@
             if (!hasAuth('qm:batch:edit') || !hasAuth('qm:batch:remove')) {
               return null;
             }
-            return <NDivider vertical />;
+            return <NDivider vertical/>;
           };
 
           const editBtn = () => {
@@ -403,19 +515,19 @@
     ]
   });
 
-const { drawerVisible, operateType, editingData, handleAdd, handleEdit, checkedRowKeys, onBatchDeleted, onDeleted } =
+const {drawerVisible, operateType, editingData, handleAdd, handleEdit, checkedRowKeys, onBatchDeleted, onDeleted} =
   useTableOperate(data, 'id', getData);
 
 async function handleBatchDelete() {
   // request
-  const { error } = await fetchBatchDeleteBatch(checkedRowKeys.value);
+  const {error} = await fetchBatchDeleteBatch(checkedRowKeys.value);
   if (error) return;
   onBatchDeleted();
 }
 
 async function handleDelete(id: CommonType.IdType) {
   // request
-  const { error } = await fetchBatchDeleteBatch([id]);
+  const {error} = await fetchBatchDeleteBatch([id]);
   if (error) return;
   onDeleted();
 }
@@ -431,7 +543,7 @@
 
 <template>
   <div class="min-h-500px flex-col-stretch gap-16px overflow-hidden lt-sm:overflow-auto">
-    <BatchSearch v-model:model="searchParams" @search="getDataByPage" />
+    <BatchSearch v-model:model="searchParams" @search="getDataByPage"/>
     <NCard title="妫�楠屾壒娆″垪琛�" :bordered="false" size="small" class="card-wrapper sm:flex-1-hidden">
       <template #header-extra>
         <TableHeaderOperation
@@ -458,8 +570,19 @@
         remote
         :row-key="row => row.id"
         :pagination="mobilePagination"
+        :row-props="handleRowProps"
         class="sm:h-full"
       />
+      <NDropdown
+        placement="bottom-start"
+        trigger="manual"
+        :x="x"
+        :y="y"
+        :options="dropdownOptions"
+        :show="showDropdown"
+        :on-clickoutside="() => (showDropdown = false)"
+        @select="handleSelect"
+      />
       <BatchOperateDrawer
         v-model:visible="drawerVisible"
         :operate-type="operateType"

--
Gitblit v1.9.3