From f591f31789ff3da7bc669b849f8acc2561732557 Mon Sep 17 00:00:00 2001
From: tuqin <tuqin@tuqin.cn>
Date: 星期四, 29 十月 2026 16:35:06 +0800
Subject: [PATCH] feat(LIMS): 补「安全与权限管理」独立菜单与页面
---
src/views/lims/securityManagement/index.vue | 314 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 314 insertions(+), 0 deletions(-)
diff --git a/src/views/lims/securityManagement/index.vue b/src/views/lims/securityManagement/index.vue
new file mode 100644
index 0000000..30fe33b
--- /dev/null
+++ b/src/views/lims/securityManagement/index.vue
@@ -0,0 +1,314 @@
+<template>
+ <div class="app-container">
+ <el-tabs v-model="activeTab" type="border-card">
+ <!-- ==================== Tab1: 瀹¤杩借釜 ==================== -->
+ <el-tab-pane label="瀹¤杩借釜" name="audit">
+ <el-alert type="info" :closable="false" style="margin-bottom: 12px">
+ <template #title>
+ 璁板綍鏁忔劅鏁版嵁鐨勫鍒犳敼涓庡叧閿笟鍔℃搷浣滐紙鏍峰搧鍑哄簱銆佸疄楠岃祫婧愬垎閰嶃�佸憡璀﹀鐞嗙瓑锛夛紝
+ 鍖呭惈鎿嶄綔浜恒�両P銆佸瓧娈靛彉鏇村墠鍚庡�硷紝婊¤冻鍚堣杩芥函瑕佹眰銆�
+ </template>
+ </el-alert>
+ <div class="search_form">
+ <div>
+ <span class="search_title">妯″潡锛�</span>
+ <el-input v-model="auditSearch.module" style="width: 140px" placeholder="濡� 鏍峰搧绠$悊" clearable @change="loadAudit" />
+ <span class="search_title" style="margin-left: 14px">鍔ㄤ綔锛�</span>
+ <el-select v-model="auditSearch.action" style="width: 150px" placeholder="鍏ㄩ儴" clearable @change="loadAudit">
+ <el-option label="鏂板 create" value="create" />
+ <el-option label="淇敼 update" value="update" />
+ <el-option label="鍑哄簱 stock_out" value="stock_out" />
+ <el-option label="鍏ュ簱 stock_in" value="stock_in" />
+ <el-option label="鍒嗛厤璧勬簮 assign_resource" value="assign_resource" />
+ <el-option label="澶勭悊鍛婅 handle_alert" value="handle_alert" />
+ </el-select>
+ <span class="search_title" style="margin-left: 14px">鎿嶄綔浜猴細</span>
+ <el-input v-model="auditSearch.operator" style="width: 130px" placeholder="璇疯緭鍏�" clearable @change="loadAudit" />
+ <span class="search_title" style="margin-left: 14px">缁撴灉锛�</span>
+ <el-select v-model="auditSearch.execResult" style="width: 110px" placeholder="鍏ㄩ儴" clearable @change="loadAudit">
+ <el-option label="鎴愬姛" value="success" />
+ <el-option label="澶辫触" value="fail" />
+ </el-select>
+ <el-button type="primary" style="margin-left: 10px" @click="loadAudit">鎼滅储</el-button>
+ </div>
+ <div>
+ <el-button @click="loadAudit">鍒锋柊</el-button>
+ </div>
+ </div>
+ <PIMTable rowKey="id" :column="auditColumns" :tableData="auditData" :page="auditPage"
+ :tableLoading="auditLoading" @pagination="paginationAudit" />
+ </el-tab-pane>
+
+ <!-- ==================== Tab2: 璁块棶鎺у埗 ==================== -->
+ <el-tab-pane label="璁块棶鎺у埗" name="access">
+ <el-alert type="success" :closable="false" style="margin-bottom: 16px">
+ <template #title>
+ 鍩轰簬 RuoYi 鏉冮檺浣撶郴锛氱敤鎴� 鈫� 瑙掕壊 鈫� 鑿滃崟/鎸夐挳鏉冮檺銆傛墍鏈夋帴鍙i兘鏈� @PreAuthorize 鏍¢獙锛�
+ 鏈巿鏉冭闂繑鍥� 401/403锛涚櫥褰曞瘑鐮佺敤 BCrypt 鍔犲瘑瀛樺偍锛屼笉钀芥槑鏂囥��
+ </template>
+ </el-alert>
+
+ <el-row :gutter="16">
+ <el-col :span="8">
+ <el-card shadow="hover">
+ <template #header>
+ <div style="display: flex; justify-content: space-between; align-items: center">
+ <span style="font-weight: 600">鐢ㄦ埛绠$悊</span>
+ <el-button link type="primary" @click="goSystem('user')">鍓嶅線 鈫�</el-button>
+ </div>
+ </template>
+ <div style="color: #606266; font-size: 13px; line-height: 1.8">
+ 缁存姢绯荤粺浣跨敤鑰呰处鍙凤紝鍒嗛厤瑙掕壊涓庨儴闂ㄣ��<br>
+ 褰撳墠鐢ㄦ埛锛�<b>{{ stat.userCount ?? '-' }}</b> 浜�
+ </div>
+ </el-card>
+ </el-col>
+ <el-col :span="8">
+ <el-card shadow="hover">
+ <template #header>
+ <div style="display: flex; justify-content: space-between; align-items: center">
+ <span style="font-weight: 600">瑙掕壊绠$悊</span>
+ <el-button link type="primary" @click="goSystem('role')">鍓嶅線 鈫�</el-button>
+ </div>
+ </template>
+ <div style="color: #606266; font-size: 13px; line-height: 1.8">
+ 鎸夊矖浣嶅垝鍒嗚鑹诧紝閰嶇疆鍙闂殑鑿滃崟鍜屾暟鎹寖鍥淬��<br>
+ 褰撳墠瑙掕壊锛�<b>{{ stat.roleCount ?? '-' }}</b> 涓�
+ </div>
+ </el-card>
+ </el-col>
+ <el-col :span="8">
+ <el-card shadow="hover">
+ <template #header>
+ <div style="display: flex; justify-content: space-between; align-items: center">
+ <span style="font-weight: 600">鑿滃崟鏉冮檺</span>
+ <el-button link type="primary" @click="goSystem('menu')">鍓嶅線 鈫�</el-button>
+ </div>
+ </template>
+ <div style="color: #606266; font-size: 13px; line-height: 1.8">
+ 鎺у埗姣忎釜瑙掕壊鑳界湅鍒板摢浜涜彍鍗曘�佽兘鐐瑰摢浜涙寜閽��<br>
+ 褰撳墠鑿滃崟锛�<b>{{ stat.menuCount ?? '-' }}</b> 椤�
+ </div>
+ </el-card>
+ </el-col>
+ </el-row>
+
+ <el-divider content-position="left">鐧诲綍涓庢搷浣滃璁�</el-divider>
+ <el-row :gutter="16">
+ <el-col :span="8">
+ <el-card shadow="hover">
+ <template #header>
+ <div style="display: flex; justify-content: space-between; align-items: center">
+ <span style="font-weight: 600">鐧诲綍鏃ュ織</span>
+ <el-button link type="primary" @click="goMonitor('logininfor')">鍓嶅線 鈫�</el-button>
+ </div>
+ </template>
+ <div style="color: #606266; font-size: 13px">璁板綍姣忔鐧诲綍鐨� IP銆佸湴鐐广�佹祻瑙堝櫒銆佹垚鍔�/澶辫触</div>
+ </el-card>
+ </el-col>
+ <el-col :span="8">
+ <el-card shadow="hover">
+ <template #header>
+ <div style="display: flex; justify-content: space-between; align-items: center">
+ <span style="font-weight: 600">鎿嶄綔鏃ュ織</span>
+ <el-button link type="primary" @click="goMonitor('operlog')">鍓嶅線 鈫�</el-button>
+ </div>
+ </template>
+ <div style="color: #606266; font-size: 13px">妗嗘灦绾ф搷浣滄棩蹇楋紙鎵�鏈夊甫 @Log 娉ㄨВ鐨勬帴鍙o級</div>
+ </el-card>
+ </el-col>
+ <el-col :span="8">
+ <el-card shadow="hover">
+ <template #header>
+ <div style="display: flex; justify-content: space-between; align-items: center">
+ <span style="font-weight: 600">鍦ㄧ嚎鐢ㄦ埛</span>
+ <el-button link type="primary" @click="goMonitor('online')">鍓嶅線 鈫�</el-button>
+ </div>
+ </template>
+ <div style="color: #606266; font-size: 13px">褰撳墠鐧诲綍浼氳瘽锛屽彲寮哄埗涓嬬嚎</div>
+ </el-card>
+ </el-col>
+ </el-row>
+
+ <el-divider content-position="left">瀹夊叏鎺柦璇存槑</el-divider>
+ <el-table :data="securityMeasures" border size="small">
+ <el-table-column prop="item" label="鎺柦" width="180" />
+ <el-table-column prop="impl" label="瀹炵幇鏂瑰紡" />
+ <el-table-column prop="status" label="鐘舵��" width="100" align="center">
+ <template #default="{ row }">
+ <el-tag :type="row.status === '宸插疄鏂�' ? 'success' : 'info'" size="small">{{ row.status }}</el-tag>
+ </template>
+ </el-table-column>
+ </el-table>
+ </el-tab-pane>
+
+ <!-- ==================== Tab3: 瀹夊叏绛栫暐 ==================== -->
+ <el-tab-pane label="瀹夊叏绛栫暐" name="policy">
+ <el-alert type="warning" :closable="false" style="margin-bottom: 12px">
+ <template #title>
+ 浠ヤ笅鍙傛暟鎺у埗瀹夊叏鐩稿叧琛屼负锛屼慨鏀瑰悗绔嬪嵆鐢熸晥锛堝璁′笌鍙傛暟鏈嶅姟鏈夋湰鍦扮紦瀛橈紝鏀瑰畬鍒锋柊椤甸潰鍗冲彲锛夈��
+ </template>
+ </el-alert>
+ <div class="search_form">
+ <div>
+ <span class="search_title">鍙傛暟鍚嶏細</span>
+ <el-input v-model="secSearch.settingName" style="width: 180px" placeholder="璇疯緭鍏�" clearable @change="loadSecurity" />
+ <el-button type="primary" style="margin-left: 10px" @click="loadSecurity">鎼滅储</el-button>
+ </div>
+ <div>
+ <el-button @click="loadSecurity">鍒锋柊</el-button>
+ </div>
+ </div>
+ <el-table :data="secData" :loading="secLoading" border size="small">
+ <el-table-column prop="settingKey" label="鍙傛暟閿�" width="230" />
+ <el-table-column prop="settingName" label="鍙傛暟鍚�" width="160" />
+ <el-table-column prop="settingValue" label="褰撳墠鍊�" width="140" />
+ <el-table-column prop="defaultValue" label="榛樿鍊�" width="110" />
+ <el-table-column prop="description" label="璇存槑" show-overflow-tooltip />
+ <el-table-column label="鎿嶄綔" width="90" align="center">
+ <template #default="{ row }">
+ <el-button link type="primary" @click="openEdit(row)">淇敼</el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+ </el-tab-pane>
+ </el-tabs>
+
+ <!-- ===== 鍙傛暟缂栬緫寮圭獥 ===== -->
+ <el-dialog v-model="editVisible" title="淇敼瀹夊叏绛栫暐" width="560px">
+ <el-form :model="editForm" label-position="top">
+ <el-form-item label="鍙傛暟閿�"><el-input v-model="editForm.settingKey" disabled /></el-form-item>
+ <el-form-item :label="editForm.settingName">
+ <el-input v-model="editForm.settingValue" placeholder="璇疯緭鍏�" />
+ <div style="color: #909399; font-size: 12px; margin-top: 4px">{{ editForm.description }}</div>
+ </el-form-item>
+ </el-form>
+ <template #footer>
+ <el-button @click="editVisible = false">鍙栨秷</el-button>
+ <el-button type="primary" @click="submitEdit">淇濆瓨</el-button>
+ </template>
+ </el-dialog>
+ </div>
+</template>
+
+<script setup>
+import { ref, reactive, onMounted, getCurrentInstance } from "vue";
+import { useRouter } from "vue-router";
+import { ElMessage } from "element-plus";
+import { listAuditLog } from "@/api/lims/auditLog";
+import { listSetting, updateSetting } from "@/api/lims/setting";
+
+const { proxy } = getCurrentInstance();
+const router = useRouter();
+const activeTab = ref("audit");
+
+/* ==================== 瀹¤杩借釜 ==================== */
+const auditSearch = ref({});
+const auditData = ref([]);
+const auditLoading = ref(false);
+const auditPage = reactive({ pageNum: 1, pageSize: 20, total: 0 });
+
+const auditColumns = ref([
+ { label: "鏃堕棿", prop: "operateTime", width: 160 },
+ { label: "妯″潡", prop: "module", width: 110 },
+ { label: "鍔ㄤ綔", prop: "action", width: 140 },
+ { label: "涓氬姟缂栧彿", prop: "bizCode", width: 130 },
+ { label: "璇存槑", prop: "description", showOverflowTooltip: true },
+ { label: "瀛楁", prop: "fieldName", width: 100 },
+ { label: "鏃у��", prop: "oldValue", width: 100 },
+ { label: "鏂板��", prop: "newValue", width: 100 },
+ { label: "鎿嶄綔浜�", prop: "operator", width: 100 },
+ { label: "IP", prop: "operatorIp", width: 130 },
+ { label: "缁撴灉", prop: "execResult", width: 80 },
+]);
+
+const loadAudit = () => {
+ auditLoading.value = true;
+ listAuditLog({ ...auditSearch.value, ...auditPage }).then((res) => {
+ auditLoading.value = false;
+ auditData.value = res.data.records || [];
+ auditPage.total = res.data.total || 0;
+ }).catch(() => (auditLoading.value = false));
+};
+const paginationAudit = (p) => { auditPage.pageNum = p.pageNum; auditPage.pageSize = p.pageSize; loadAudit(); };
+
+/* ==================== 璁块棶鎺у埗 ==================== */
+const stat = ref({});
+const securityMeasures = ref([
+ { item: "瀵嗙爜瀛樺偍", impl: "BCrypt 鍔犵洂鍝堝笇锛堜笉鍙�嗭級锛屾暟鎹簱涓笉钀芥槑鏂�", status: "宸插疄鏂�" },
+ { item: "鎺ュ彛閴存潈", impl: "JWT Token + Spring Security 鎷︽埅锛屾湭鎺堟潈杩斿洖 401", status: "宸插疄鏂�" },
+ { item: "鑿滃崟/鎸夐挳鏉冮檺", impl: "鐢ㄦ埛鈫掕鑹测啋鑿滃崟涓夌骇锛屾寜閽骇 perms 鏍¢獙", status: "宸插疄鏂�" },
+ { item: "鏁版嵁闅旂", impl: "澶氱鎴锋彃浠惰嚜鍔ㄦ嫾鎺� tenant_id 鏉′欢", status: "宸插疄鏂�" },
+ { item: "鏁忔劅鎿嶄綔瀹¤", impl: "鏍峰搧鍑哄叆搴撱�佸疄楠岃祫婧愬垎閰嶃�佸憡璀﹀鐞嗗啓 lims_audit_log", status: "宸插疄鏂�" },
+ { item: "瀹¤鐣欑棔鍐呭", impl: "鎿嶄綔浜恒�両P銆佸瓧娈靛彉鏇村墠鍚庡�笺�佹搷浣滅粨鏋�", status: "宸插疄鏂�" },
+ { item: "鐧诲綍鏃ュ織", impl: "璁板綍姣忔鐧诲綍鐨� IP銆佸湴鐐广�佹祻瑙堝櫒銆佹垚鍔熷け璐�", status: "宸插疄鏂�" },
+ { item: "瀛楁绾у姞瀵�", impl: "鏈仛锛屽瀹㈡埛鏈夌瓑淇濊姹傞渶鍙﹁寮�鍙�", status: "寰呭畾" },
+ { item: "鍒楄〃鑴辨晱鏄剧ず", impl: "鍙傛暟 security.maskSensitive 宸查鐣欙紝鍓嶇灞曠ず鏈疄鐜�", status: "寰呭畾" },
+]);
+
+const goSystem = (path) => { router.push("/system/" + path); };
+const goMonitor = (path) => { router.push("/monitor/" + path); };
+
+// 缁熻锛堢敤宸叉湁鐨勬帴鍙i『鎵嬪彇鏁帮紝澶辫触涓嶅奖鍝嶅睍绀猴級
+const loadStat = () => {
+ Promise.all([
+ import("@/api/system/user").then((m) => m.listUser({ pageNum: 1, pageSize: 1 })).catch(() => null),
+ import("@/api/system/role").then((m) => m.listRole({ pageNum: 1, pageSize: 1 })).catch(() => null),
+ import("@/api/system/menu").then((m) => m.listMenu({})).catch(() => null),
+ ]).then(([u, r, m]) => {
+ stat.value = {
+ userCount: u && u.total !== undefined ? u.total : (u && u.data && u.data.total),
+ roleCount: r && r.total !== undefined ? r.total : (r && r.data && r.data.total),
+ menuCount: Array.isArray(m) ? m.length : (m && m.data ? m.data.length : undefined),
+ };
+ }).catch(() => {});
+};
+
+/* ==================== 瀹夊叏绛栫暐 ==================== */
+const secSearch = ref({});
+const secData = ref([]);
+const secLoading = ref(false);
+const editVisible = ref(false);
+const editForm = ref({});
+
+const loadSecurity = () => {
+ secLoading.value = true;
+ listSetting({ ...secSearch.value, category: "security", pageNum: 1, pageSize: 50 }).then((res) => {
+ secLoading.value = false;
+ secData.value = res.data.records || [];
+ }).catch(() => (secLoading.value = false));
+};
+
+const openEdit = (row) => {
+ editForm.value = { ...row };
+ editVisible.value = true;
+};
+const submitEdit = () => {
+ updateSetting(editForm.value).then(() => {
+ ElMessage.success("宸蹭繚瀛橈紝鍒锋柊椤甸潰鍚庣敓鏁�");
+ editVisible.value = false;
+ loadSecurity();
+ });
+};
+
+onMounted(() => {
+ loadAudit();
+ loadStat();
+ loadSecurity();
+});
+</script>
+
+<style scoped>
+.search_form {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 12px;
+ flex-wrap: wrap;
+ gap: 8px;
+}
+.search_title {
+ font-size: 14px;
+ color: #606266;
+}
+</style>
--
Gitblit v1.9.3