From 22229c67d87f0fae4c4bc90db106b8a1e2c49b53 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期四, 20 八月 2026 15:50:11 +0800
Subject: [PATCH] feat(permission): 为多个模块添加管理员权限控制功能
---
src/views/collaborativeApproval/purchaseApproval/index.vue | 7 ++-
src/views/basicData/customerFile/index.vue | 7 ++-
src/views/customerService/feedbackRegistration/index.vue | 5 ++
src/views/productionManagement/workOrder/index.vue | 15 ++++++-
src/views/basicData/customerFileOpenSea/index.vue | 7 ++-
src/views/qualityManagement/rawMaterialInspection/index.vue | 9 +++-
src/views/salesManagement/salesLedger/index.vue | 15 ++++---
src/views/basicData/supplierManage/components/BlacklistTab.vue | 7 ++-
src/views/qualityManagement/finalInspection/index.vue | 8 +++-
src/views/qualityManagement/processInspection/index.vue | 9 +++-
src/views/safeProduction/dangerInvestigation/index.vue | 7 +++
src/views/basicData/supplierManage/components/HomeTab.vue | 7 ++-
12 files changed, 75 insertions(+), 28 deletions(-)
diff --git a/src/views/basicData/customerFile/index.vue b/src/views/basicData/customerFile/index.vue
index 77206ed..3385fef 100644
--- a/src/views/basicData/customerFile/index.vue
+++ b/src/views/basicData/customerFile/index.vue
@@ -659,7 +659,7 @@
</template>
<script setup>
- import { onMounted, ref, reactive, getCurrentInstance, toRefs } from "vue";
+ import { onMounted, ref, reactive, getCurrentInstance, toRefs, computed } from "vue";
import { Search, Paperclip, Upload } from "@element-plus/icons-vue";
import {
addCustomerPrivate,
@@ -682,6 +682,9 @@
import { getToken } from "@/utils/auth.js";
const { proxy } = getCurrentInstance();
const userStore = useUserStore();
+ const isAdminUser = computed(() =>
+ ["admin", "鏅��2", "鏈�楂�1"].some(r => (userStore.roles || []).includes(r))
+ );
// 鍥炶鎻愰啋鐩稿叧
const reminderDialogVisible = ref(false);
@@ -1194,7 +1197,7 @@
let ids = [];
if (selectedRows.value.length > 0) {
const unauthorizedData = selectedRows.value.filter(
- item => item.type === 1 || item.type === "1"
+ item => (item.type === 1 || item.type === "1") && !isAdminUser.value
);
if (unauthorizedData.length > 0) {
proxy.$modal.msgWarning("鍏捣鍒嗛厤鐨勫鎴蜂笉鑳藉垹闄�");
diff --git a/src/views/basicData/customerFileOpenSea/index.vue b/src/views/basicData/customerFileOpenSea/index.vue
index ddf17f6..cc2523c 100644
--- a/src/views/basicData/customerFileOpenSea/index.vue
+++ b/src/views/basicData/customerFileOpenSea/index.vue
@@ -779,6 +779,9 @@
import { getToken } from "@/utils/auth.js";
const { proxy } = getCurrentInstance();
const userStore = useUserStore();
+ const isAdminUser = computed(() =>
+ ["admin", "鏅��2", "鏈�楂�1"].some(r => (userStore.roles || []).includes(r))
+ );
const assignDialogVisible = ref(false);
const assignFormRef = ref();
const assignForm = reactive({
@@ -1433,9 +1436,9 @@
const handleDelete = () => {
let ids = [];
if (selectedRows.value.length > 0) {
- // 妫�鏌ユ槸鍚︽湁浠栦汉缁存姢鐨勬暟鎹�
+ // 妫�鏌ユ槸鍚︽湁浠栦汉缁存姢鐨勬暟鎹紙绠$悊鍛樹笉鍙楅檺锛�
const unauthorizedData = selectedRows.value.filter(
- item => item.maintainer !== userStore.nickName
+ item => item.maintainer !== userStore.nickName && !isAdminUser.value
);
if (unauthorizedData.length > 0) {
proxy.$modal.msgWarning("涓嶅彲鍒犻櫎浠栦汉缁存姢鐨勬暟鎹�");
diff --git a/src/views/basicData/supplierManage/components/BlacklistTab.vue b/src/views/basicData/supplierManage/components/BlacklistTab.vue
index 8f6204b..eba0f49 100644
--- a/src/views/basicData/supplierManage/components/BlacklistTab.vue
+++ b/src/views/basicData/supplierManage/components/BlacklistTab.vue
@@ -236,7 +236,7 @@
</template>
<script setup>
-import { onMounted, ref } from "vue";
+import { onMounted, ref, computed } from "vue";
import { Search } from "@element-plus/icons-vue";
import { delSupplier } from "@/api/basicData/supplierManageFile.js";
import { ElMessageBox } from "element-plus";
@@ -252,6 +252,9 @@
import FilesDia from "../filesDia.vue";
const { proxy } = getCurrentInstance();
const userStore = useUserStore();
+const isAdminUser = computed(() =>
+ ["admin", "鏅��2", "鏈�楂�1"].some(r => (userStore.roles || []).includes(r))
+);
const tableColumn = ref([
{
@@ -527,7 +530,7 @@
let ids = [];
if (selectedRows.value.length > 0) {
// 妫�鏌ユ槸鍚︽湁浠栦汉缁存姢鐨勬暟鎹�
- const unauthorizedData = selectedRows.value.filter(item => item.maintainUserName !== userStore.nickName);
+ const unauthorizedData = selectedRows.value.filter(item => item.maintainUserName !== userStore.nickName && !isAdminUser.value);
if (unauthorizedData.length > 0) {
proxy.$modal.msgWarning("涓嶅彲鍒犻櫎浠栦汉缁存姢鐨勬暟鎹�");
return;
diff --git a/src/views/basicData/supplierManage/components/HomeTab.vue b/src/views/basicData/supplierManage/components/HomeTab.vue
index f3b3ef7..794f430 100644
--- a/src/views/basicData/supplierManage/components/HomeTab.vue
+++ b/src/views/basicData/supplierManage/components/HomeTab.vue
@@ -242,7 +242,7 @@
</template>
<script setup>
-import { onMounted, ref } from "vue";
+import { onMounted, ref, computed } from "vue";
import { Search } from "@element-plus/icons-vue";
import { delSupplier } from "@/api/basicData/supplierManageFile.js";
import { ElMessageBox } from "element-plus";
@@ -258,6 +258,9 @@
import FilesDia from "../filesDia.vue";
const { proxy } = getCurrentInstance();
const userStore = useUserStore();
+const isAdminUser = computed(() =>
+ ["admin", "鏅��2", "鏈�楂�1"].some(r => (userStore.roles || []).includes(r))
+);
const tableColumn = ref([
{
@@ -533,7 +536,7 @@
let ids = [];
if (selectedRows.value.length > 0) {
// 妫�鏌ユ槸鍚︽湁浠栦汉缁存姢鐨勬暟鎹�
- const unauthorizedData = selectedRows.value.filter(item => item.maintainUserName !== userStore.nickName);
+ const unauthorizedData = selectedRows.value.filter(item => item.maintainUserName !== userStore.nickName && !isAdminUser.value);
if (unauthorizedData.length > 0) {
proxy.$modal.msgWarning("涓嶅彲鍒犻櫎浠栦汉缁存姢鐨勬暟鎹�");
return;
diff --git a/src/views/collaborativeApproval/purchaseApproval/index.vue b/src/views/collaborativeApproval/purchaseApproval/index.vue
index 5fc1947..5f5f07d 100644
--- a/src/views/collaborativeApproval/purchaseApproval/index.vue
+++ b/src/views/collaborativeApproval/purchaseApproval/index.vue
@@ -199,7 +199,7 @@
<script setup>
import { getToken } from "@/utils/auth";
import pagination from "@/components/PIMTable/Pagination.vue";
-import { ref, onMounted, reactive, toRefs, getCurrentInstance, nextTick } from "vue";
+import { ref, onMounted, reactive, toRefs, getCurrentInstance, nextTick, computed } from "vue";
import { Search } from "@element-plus/icons-vue";
import { ElMessageBox } from "element-plus";
import { userListNoPage } from "@/api/system/user.js";
@@ -247,6 +247,9 @@
import { getCurrentDate } from "@/utils/index.js";
const userStore = useUserStore();
+const isAdminUser = computed(() =>
+ ["admin", "鏅��2", "鏈�楂�1"].some(r => (userStore.roles || []).includes(r))
+);
// 浜岀淮鐮佺浉鍏冲彉閲�
const qrCodeDialogVisible = ref(false);
@@ -752,7 +755,7 @@
let ids = [];
if (selectedRows.value.length > 0) {
// 妫�鏌ユ槸鍚︽湁浠栦汉缁存姢鐨勬暟鎹�
- const unauthorizedData = selectedRows.value.filter(item => item.recorderName !== userStore.nickName);
+ const unauthorizedData = selectedRows.value.filter(item => item.recorderName !== userStore.nickName && !isAdminUser.value);
if (unauthorizedData.length > 0) {
proxy.$modal.msgWarning("涓嶅彲鍒犻櫎浠栦汉缁存姢鐨勬暟鎹�");
return;
diff --git a/src/views/customerService/feedbackRegistration/index.vue b/src/views/customerService/feedbackRegistration/index.vue
index 3a2d362..4a75731 100644
--- a/src/views/customerService/feedbackRegistration/index.vue
+++ b/src/views/customerService/feedbackRegistration/index.vue
@@ -140,6 +140,9 @@
import useUserStore from "@/store/modules/user.js";
const { proxy } = getCurrentInstance();
const userStore = useUserStore()
+const isAdminUser = computed(() =>
+ ["admin", "鏅��2", "鏈�楂�1"].some(r => (userStore.roles || []).includes(r))
+)
import { Document, FolderOpened, UserFilled } from "@element-plus/icons-vue"
import { markRaw } from 'vue'
@@ -358,7 +361,7 @@
let ids = [];
if (selectedRows.value.length > 0) {
// 妫�鏌ユ槸鍚︽湁浠栦汉缁存姢鐨勬暟鎹�
- const unauthorizedData = selectedRows.value.filter(item => item.checkUserId !== userStore.id);
+ const unauthorizedData = selectedRows.value.filter(item => item.checkUserId !== userStore.id && !isAdminUser.value);
if (unauthorizedData.length > 0) {
proxy.$modal.msgWarning("涓嶅彲鍒犻櫎浠栦汉缁存姢鐨勬暟鎹�");
return;
diff --git a/src/views/productionManagement/workOrder/index.vue b/src/views/productionManagement/workOrder/index.vue
index 13f0a24..d8cc499 100644
--- a/src/views/productionManagement/workOrder/index.vue
+++ b/src/views/productionManagement/workOrder/index.vue
@@ -508,8 +508,13 @@
import { getCurrentInstance, reactive, toRefs } from "vue";
import FilesDia from "./components/filesDia.vue";
import { getDeviceLedger } from "@/api/equipmentManagement/ledger.js";
+ import useUserStore from "@/store/modules/user";
const { proxy } = getCurrentInstance();
+ const userStore = useUserStore();
+ const isAdminUser = computed(() =>
+ ["admin", "鏅��2", "鏈�楂�1"].some(r => (userStore.roles || []).includes(r))
+ );
const currentUserId = ref("");
const deviceOptions = ref([]);
@@ -577,9 +582,13 @@
return ids.includes(uid);
};
- // 鍒ゆ柇褰撳墠鐢ㄦ埛鏄惁鍙互鎶ュ伐锛堝伐鍗曟姤宸ヤ汉 鎴� 宸ュ簭鎶ュ伐浜猴級
+ // 鍒ゆ柇褰撳墠鐢ㄦ埛鏄惁鍙互鎶ュ伐锛堝伐鍗曟姤宸ヤ汉 鎴� 宸ュ簭鎶ュ伐浜猴紝绠$悊鍛樹笉鍙楅檺锛�
const canCurrentUserReport = row => {
- return isCurrentUserInUserIds(row) || isCurrentUserInProcessUserIds(row);
+ return (
+ isAdminUser.value ||
+ isCurrentUserInUserIds(row) ||
+ isCurrentUserInProcessUserIds(row)
+ );
};
const canOperateByReportWorker = computed(() => {
@@ -1800,6 +1809,8 @@
// 鍒ゆ柇褰撳墠鐢ㄦ埛鏄惁鑳芥帓浜�
const canScheduleByWorkOrderNo = row => {
+ // 绠$悊鍛樺彲鎺掍骇
+ if (isAdminUser.value) return true;
if (!row) return false;
const uid = String(currentUserId.value || "");
diff --git a/src/views/qualityManagement/finalInspection/index.vue b/src/views/qualityManagement/finalInspection/index.vue
index a051c8c..d3d4152 100644
--- a/src/views/qualityManagement/finalInspection/index.vue
+++ b/src/views/qualityManagement/finalInspection/index.vue
@@ -193,6 +193,7 @@
toRefs,
getCurrentInstance,
nextTick,
+ computed,
} from "vue";
import InspectionFormDia from "@/views/qualityManagement/finalInspection/components/inspectionFormDia.vue";
import FormDia from "@/views/qualityManagement/finalInspection/components/formDia.vue";
@@ -313,7 +314,7 @@
if (row.inspectState == 1) return true;
// 濡傛灉妫�楠屽憳鏈夊�硷紝鍙湁褰撳墠鐧诲綍鐢ㄦ埛鑳界紪杈�
if (row.checkName) {
- return row.checkName !== userStore.nickName;
+ return row.checkName !== userStore.nickName && !isAdminUser.value;
}
return false;
},
@@ -336,7 +337,7 @@
if (row.inspectState == 1) return true;
// 濡傛灉妫�楠屽憳鏈夊�硷紝鍙湁褰撳墠鐧诲綍鐢ㄦ埛鑳芥彁浜�
if (row.checkName) {
- return row.checkName !== userStore.nickName;
+ return row.checkName !== userStore.nickName && !isAdminUser.value;
}
return false;
},
@@ -379,6 +380,9 @@
const inspectionFormDia = ref();
const { proxy } = getCurrentInstance();
const userStore = useUserStore();
+ const isAdminUser = computed(() =>
+ ["admin", "鏅��2", "鏈�楂�1"].some(r => (userStore.roles || []).includes(r))
+ );
const userList = ref([]);
const form = ref({
checkName: "",
diff --git a/src/views/qualityManagement/processInspection/index.vue b/src/views/qualityManagement/processInspection/index.vue
index 6c1ef71..ce1811d 100644
--- a/src/views/qualityManagement/processInspection/index.vue
+++ b/src/views/qualityManagement/processInspection/index.vue
@@ -144,7 +144,7 @@
<script setup>
import { Search } from "@element-plus/icons-vue";
-import {onMounted, ref, reactive, toRefs, getCurrentInstance, nextTick} from "vue";
+import {onMounted, ref, reactive, toRefs, getCurrentInstance, nextTick, computed} from "vue";
import InspectionFormDia from "@/views/qualityManagement/processInspection/components/inspectionFormDia.vue";
import FormDia from "@/views/qualityManagement/processInspection/components/formDia.vue";
import {ElMessageBox} from "element-plus";
@@ -259,7 +259,7 @@
if (row.inspectState == 1) return true;
// 濡傛灉妫�楠屽憳鏈夊�硷紝鍙湁褰撳墠鐧诲綍鐢ㄦ埛鑳界紪杈�
if (row.checkName) {
- return row.checkName !== userStore.nickName;
+ return row.checkName !== userStore.nickName && !isAdminUser.value;
}
return false;
}
@@ -282,7 +282,7 @@
if (row.inspectState == 1) return true;
// 濡傛灉妫�楠屽憳鏈夊�硷紝鍙湁褰撳墠鐧诲綍鐢ㄦ埛鑳芥彁浜�
if (row.checkName) {
- return row.checkName !== userStore.nickName;
+ return row.checkName !== userStore.nickName && !isAdminUser.value;
}
return false;
}
@@ -366,6 +366,9 @@
const inspectionFormDia = ref()
const { proxy } = getCurrentInstance()
const userStore = useUserStore()
+const isAdminUser = computed(() =>
+ ["admin", "鏅��2", "鏈�楂�1"].some(r => (userStore.roles || []).includes(r))
+)
const changeDaterange = (value) => {
searchForm.value.entryDateStart = undefined;
searchForm.value.entryDateEnd = undefined;
diff --git a/src/views/qualityManagement/rawMaterialInspection/index.vue b/src/views/qualityManagement/rawMaterialInspection/index.vue
index d66da3a..7f88a5b 100644
--- a/src/views/qualityManagement/rawMaterialInspection/index.vue
+++ b/src/views/qualityManagement/rawMaterialInspection/index.vue
@@ -146,7 +146,7 @@
<script setup>
import {Search} from "@element-plus/icons-vue";
-import {onMounted, ref, reactive, toRefs, getCurrentInstance, nextTick} from "vue";
+import {onMounted, ref, reactive, toRefs, getCurrentInstance, nextTick, computed} from "vue";
import InspectionFormDia from "@/views/qualityManagement/rawMaterialInspection/components/inspectionFormDia.vue";
import FormDia from "@/views/qualityManagement/rawMaterialInspection/components/formDia.vue";
import {ElMessageBox} from "element-plus";
@@ -261,7 +261,7 @@
if (row.inspectState == 1) return true;
// 濡傛灉妫�楠屽憳鏈夊�硷紝鍙湁褰撳墠鐧诲綍鐢ㄦ埛鑳界紪杈�
if (row.checkName) {
- return row.checkName !== userStore.nickName;
+ return row.checkName !== userStore.nickName && !isAdminUser.value;
}
return false;
}
@@ -284,7 +284,7 @@
if (row.inspectState == 1) return true;
// 濡傛灉妫�楠屽憳鏈夊�硷紝鍙湁褰撳墠鐧诲綍鐢ㄦ埛鑳芥彁浜�
if (row.checkName) {
- return row.checkName !== userStore.nickName;
+ return row.checkName !== userStore.nickName && !isAdminUser.value;
}
return false;
}
@@ -368,6 +368,9 @@
const inspectionFormDia = ref()
const {proxy} = getCurrentInstance()
const userStore = useUserStore()
+const isAdminUser = computed(() =>
+ ["admin", "鏅��2", "鏈�楂�1"].some(r => (userStore.roles || []).includes(r))
+)
const changeDaterange = (value) => {
searchForm.value.entryDateStart = undefined;
searchForm.value.entryDateEnd = undefined;
diff --git a/src/views/safeProduction/dangerInvestigation/index.vue b/src/views/safeProduction/dangerInvestigation/index.vue
index 49965e9..68a8e93 100644
--- a/src/views/safeProduction/dangerInvestigation/index.vue
+++ b/src/views/safeProduction/dangerInvestigation/index.vue
@@ -454,6 +454,9 @@
import { get } from "@vueuse/core";
const userStore = useUserStore();
+ const isAdminUser = computed(() =>
+ ["admin", "鏅��2", "鏈�楂�1"].some(r => (userStore.roles || []).includes(r))
+ );
const { proxy } = getCurrentInstance();
const tableData = ref([]);
const selectedRows = ref([]);
@@ -661,7 +664,9 @@
total.value = res.data.total;
tableData.value.forEach(item => {
// console.log(item.rectifyUserId, currentUserId.value, "=======");
- if (Number(item.rectifyUserId) != Number(currentUserId.value)) {
+ if (isAdminUser.value) {
+ item.isRectify = false;
+ } else if (Number(item.rectifyUserId) != Number(currentUserId.value)) {
item.isRectify = true;
} else {
item.isRectify = false;
diff --git a/src/views/salesManagement/salesLedger/index.vue b/src/views/salesManagement/salesLedger/index.vue
index d35f68f..8d2a3d7 100644
--- a/src/views/salesManagement/salesLedger/index.vue
+++ b/src/views/salesManagement/salesLedger/index.vue
@@ -936,7 +936,7 @@
<script setup>
import { getToken } from "@/utils/auth";
import pagination from "@/components/PIMTable/Pagination.vue";
- import { onMounted, ref, getCurrentInstance } from "vue";
+ import { onMounted, ref, computed, getCurrentInstance } from "vue";
import { addShippingInfo, batchAdd } from "@/api/salesManagement/deliveryLedger.js";
import { ElMessageBox, ElMessage } from "element-plus";
import { UploadFilled, Download } from "@element-plus/icons-vue";
@@ -965,6 +965,9 @@
import { listCustomerPrivatePool } from "@/api/basicData/customerFile.js";
const userStore = useUserStore();
+ const isAdminUser = computed(() =>
+ ["admin", "鏅��2", "鏈�楂�1"].some(r => (userStore.roles || []).includes(r))
+ );
const { proxy } = getCurrentInstance();
const tableData = ref([]);
const productData = ref([]);
@@ -1276,16 +1279,16 @@
}
return true;
};
- const canEditLedger = row => isCurrentUserMaintainer(row);
- const canDeleteLedger = row => isCurrentUserMaintainer(row);
+ const canEditLedger = row => isCurrentUserMaintainer(row) || isAdminUser.value;
+ const canDeleteLedger = row => isCurrentUserMaintainer(row) || isAdminUser.value;
const sensitiveAmountFormatter = (row, column, cellValue) => {
- if (!isCurrentUserMaintainer(row)) {
+ if (!isCurrentUserMaintainer(row) && !isAdminUser.value) {
return "*****";
}
return formattedNumber(row, column, cellValue);
};
const sensitiveAmountFormatter4 = (row, column, cellValue) => {
- if (!isCurrentUserMaintainer(row)) {
+ if (!isCurrentUserMaintainer(row) && !isAdminUser.value) {
return "*****";
}
return formattedAmount4(row, column, cellValue);
@@ -1408,7 +1411,7 @@
};
// 瀛愯〃鍚堣鏂规硶
const summarizeChildrenTable = (param, parentRow) => {
- if (!isCurrentUserMaintainer(parentRow)) {
+ if (!isCurrentUserMaintainer(parentRow) && !isAdminUser.value) {
const { columns } = param;
return columns.map((column, index) => {
if (index === 0) {
--
Gitblit v1.9.3