3 天以前 22229c67d87f0fae4c4bc90db106b8a1e2c49b53
feat(permission): 为多个模块添加管理员权限控制功能

- 在供应商管理黑名单标签页添加管理员角色判断逻辑
- 在供应商管理首页标签页添加管理员权限过滤条件
- 在客户档案管理页面添加管理员身份验证机制
- 在公海客户分配功能中实现管理员权限绕过限制
- 在采购审批模块中添加管理员删除权限控制
- 在客户服务反馈登记中增加管理员操作权限
- 在生产工单管理中为报工和排产功能添加管理员豁免
- 在质量检验模块中为终检、过程检和原料检添加管理员权限
- 在安全生产业务中为整改功能添加管理员标识控制
- 在销售台账管理中为编辑删除及敏感数据显示添加管理员权限
已修改12个文件
103 ■■■■ 文件已修改
src/views/basicData/customerFile/index.vue 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/basicData/customerFileOpenSea/index.vue 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/basicData/supplierManage/components/BlacklistTab.vue 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/basicData/supplierManage/components/HomeTab.vue 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/collaborativeApproval/purchaseApproval/index.vue 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/customerService/feedbackRegistration/index.vue 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productionManagement/workOrder/index.vue 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/qualityManagement/finalInspection/index.vue 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/qualityManagement/processInspection/index.vue 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/qualityManagement/rawMaterialInspection/index.vue 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/safeProduction/dangerInvestigation/index.vue 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/salesManagement/salesLedger/index.vue 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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("公海分配的客户不能删除");
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("不可删除他人维护的数据");
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;
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;
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;
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;
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 || "");
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: "",
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;
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;
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;
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) {