From 3471290659516cf21db3211a9053daff5f283e03 Mon Sep 17 00:00:00 2001
From: zhuguifei <312353457@qq.com>
Date: 星期五, 20 三月 2026 15:50:18 +0800
Subject: [PATCH] feat: 基础数据仪器管理、判定依据、判定依据明细

---
 ruoyi-plus-soybean/src/views/md/instrument/index.vue |  247 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 247 insertions(+), 0 deletions(-)

diff --git a/ruoyi-plus-soybean/src/views/md/instrument/index.vue b/ruoyi-plus-soybean/src/views/md/instrument/index.vue
new file mode 100644
index 0000000..9910a7d
--- /dev/null
+++ b/ruoyi-plus-soybean/src/views/md/instrument/index.vue
@@ -0,0 +1,247 @@
+<script setup lang="tsx">
+import { ref } from 'vue';
+import { NDivider, NTooltip } from 'naive-ui';
+import { fetchBatchDeleteInstrument, fetchGetInstrumentList } from '@/service/api/md/instrument';
+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 { useDict } from '@/hooks/business/dict';
+import { $t } from '@/locales';
+import ButtonIcon from '@/components/custom/button-icon.vue';
+import InstrumentOperateDrawer from './modules/instrument-operate-drawer.vue';
+import InstrumentSearch from './modules/instrument-search.vue';
+
+defineOptions({
+  name: 'InstrumentList'
+});
+
+useDict('sys_yes_no');
+
+const appStore = useAppStore();
+const { download } = useDownload();
+const { hasAuth } = useAuth();
+
+const searchParams = ref<Api.Md.InstrumentSearchParams>({
+  pageNum: 1,
+  pageSize: 10,
+  instrumentCode: null,
+  instrumentName: null,
+  enable: null,
+  params: {}
+});
+
+const { columns, columnChecks, data, getData, getDataByPage, loading, mobilePagination, scrollX } =
+  useNaivePaginatedTable({
+  api: () => fetchGetInstrumentList(searchParams.value),
+  transform: response => defaultTransform(response),
+  onPaginationParamsChange: params => {
+    searchParams.value.pageNum = params.page;
+    searchParams.value.pageSize = params.pageSize;
+  },
+  columns: () => [
+    {
+      type: 'selection',
+      align: 'center',
+      width: 48
+    },
+    {
+      key: 'index',
+      title: $t('common.index'),
+      align: 'center',
+      width: 64,
+      render: (_, index) => index + 1
+    },
+    {
+      key: 'instrumentCode',
+      title: '浠櫒浠g爜',
+      align: 'center',
+      width: 120
+    },
+    {
+      key: 'instrumentName',
+      title: '浠櫒鍚嶇О',
+      align: 'center',
+      width: 200
+    },
+    {
+      key: 'ifStd',
+      title: '鎺ュ彛鏍囧噯',
+      align: 'center',
+      width: 120
+    },
+    {
+      key: 'isc',
+      title: '鎺ュ彛鏍囧噯浠g爜',
+      align: 'center',
+      width: 100
+    },
+    {
+      key: 'workShop',
+      title: '鎵�灞炶溅闂�',
+      align: 'center',
+      width: 120
+    },
+    {
+      key: 'enable',
+      title: '鍚敤',
+      align: 'center',
+      width: 120,
+      render(row) {
+        return <DictTag value={row.enable} dictCode="sys_yes_no" />;
+      }
+    },
+    {
+      key: 'del',
+      title: '鍒犻櫎',
+      align: 'center',
+      width: 120
+    },
+    {
+      key: 'instrumentDes',
+      title: '澶囨敞',
+      align: 'center',
+      width: 300,
+      render: row => (
+        <NTooltip trigger="hover">
+          {{
+            trigger: () => (
+              <div
+                style={{
+                  whiteSpace: 'nowrap',
+                  overflow: 'hidden',
+                  textOverflow: 'ellipsis'
+                }}
+              >
+                {row.instrumentDes}
+              </div>
+            ),
+            default: () => row.instrumentDes
+          }}
+        </NTooltip>
+      )
+    },
+    {
+      key: 'operate',
+      title: $t('common.operate'),
+      align: 'center',
+      width: 130,
+      render: row => {
+        const divider = () => {
+          if (!hasAuth('md:instrument:edit') || !hasAuth('md:instrument:remove')) {
+            return null;
+          }
+          return <NDivider vertical />;
+        };
+
+        const editBtn = () => {
+          if (!hasAuth('md:instrument:edit')) {
+            return null;
+          }
+          return (
+            <ButtonIcon
+              text
+              type="primary"
+              icon="material-symbols:drive-file-rename-outline-outline"
+              tooltipContent={$t('common.edit')}
+              onClick={() => edit(row.id)}
+            />
+          );
+        };
+
+        const deleteBtn = () => {
+          if (!hasAuth('md:instrument:remove')) {
+            return null;
+          }
+          return (
+            <ButtonIcon
+              text
+              type="error"
+              icon="material-symbols:delete-outline"
+              tooltipContent={$t('common.delete')}
+              popconfirmContent={$t('common.confirmDelete')}
+              onPositiveClick={() => handleDelete(row.id)}
+            />
+          );
+        };
+
+        return (
+          <div class="flex-center gap-8px">
+            {editBtn()}
+            {divider()}
+            {deleteBtn()}
+          </div>
+        );
+      }
+    }
+  ]
+});
+
+const { drawerVisible, operateType, editingData, handleAdd, handleEdit, checkedRowKeys, onBatchDeleted, onDeleted } =
+  useTableOperate(data, 'id', getData);
+
+async function handleBatchDelete() {
+  // request
+  const { error } = await fetchBatchDeleteInstrument(checkedRowKeys.value);
+  if (error) return;
+  onBatchDeleted();
+}
+
+async function handleDelete(id: CommonType.IdType) {
+  // request
+  const { error } = await fetchBatchDeleteInstrument([id]);
+  if (error) return;
+  onDeleted();
+}
+
+function edit(id: CommonType.IdType) {
+  handleEdit(id);
+}
+
+function handleExport() {
+  download('/md/instrument/export', searchParams.value, `娴嬮噺浠櫒_${new Date().getTime()}.xlsx`);
+}
+</script>
+
+<template>
+  <div class="min-h-500px flex-col-stretch gap-16px overflow-hidden lt-sm:overflow-auto">
+    <InstrumentSearch v-model:model="searchParams" @search="getDataByPage" />
+    <NCard title="娴嬮噺浠櫒鍒楄〃" :bordered="false" size="small" class="card-wrapper sm:flex-1-hidden">
+      <template #header-extra>
+        <TableHeaderOperation
+          v-model:columns="columnChecks"
+          :disabled-delete="checkedRowKeys.length === 0"
+          :loading="loading"
+          :show-add="hasAuth('md:instrument:add')"
+          :show-delete="hasAuth('md:instrument:remove')"
+          :show-export="hasAuth('md:instrument:export')"
+          @add="handleAdd"
+          @delete="handleBatchDelete"
+          @export="handleExport"
+          @refresh="getData"
+        />
+      </template>
+      <NDataTable
+        v-model:checked-row-keys="checkedRowKeys"
+        :columns="columns"
+        :data="data"
+        size="small"
+        :flex-height="!appStore.isMobile"
+        :scroll-x="scrollX"
+        :loading="loading"
+        remote
+        :row-key="row => row.id"
+        :pagination="mobilePagination"
+        class="sm:h-full"
+      />
+      <InstrumentOperateDrawer
+        v-model:visible="drawerVisible"
+        :operate-type="operateType"
+        :row-data="editingData"
+        @submitted="getDataByPage"
+      />
+    </NCard>
+  </div>
+</template>
+
+<style scoped></style>

--
Gitblit v1.9.3