feat(permission): 为多个模块添加管理员权限控制功能
- 在供应商管理黑名单标签页添加管理员角色判断逻辑
- 在供应商管理首页标签页添加管理员权限过滤条件
- 在客户档案管理页面添加管理员身份验证机制
- 在公海客户分配功能中实现管理员权限绕过限制
- 在采购审批模块中添加管理员删除权限控制
- 在客户服务反馈登记中增加管理员操作权限
- 在生产工单管理中为报工和排产功能添加管理员豁免
- 在质量检验模块中为终检、过程检和原料检添加管理员权限
- 在安全生产业务中为整改功能添加管理员标识控制
- 在销售台账管理中为编辑删除及敏感数据显示添加管理员权限
| | |
| | | </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, |
| | |
| | | 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); |
| | |
| | | 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("公海分配的客户不能删除"); |
| | |
| | | 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({ |
| | |
| | | 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("不可删除他人维护的数据"); |
| | |
| | | </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"; |
| | |
| | | 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([ |
| | | { |
| | |
| | | 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; |
| | |
| | | </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"; |
| | |
| | | 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([ |
| | | { |
| | |
| | | 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; |
| | |
| | | <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"; |
| | |
| | | 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); |
| | |
| | | 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; |
| | |
| | | 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' |
| | | |
| | |
| | | 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; |
| | |
| | | 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([]); |
| | |
| | | return ids.includes(uid); |
| | | }; |
| | | |
| | | // 判断当前用户是否可以报工(工单报工人 或 工序报工人) |
| | | // 判断当前用户是否可以报工(工单报工人 或 工序报工人,管理员不受限) |
| | | const canCurrentUserReport = row => { |
| | | return isCurrentUserInUserIds(row) || isCurrentUserInProcessUserIds(row); |
| | | return ( |
| | | isAdminUser.value || |
| | | isCurrentUserInUserIds(row) || |
| | | isCurrentUserInProcessUserIds(row) |
| | | ); |
| | | }; |
| | | |
| | | const canOperateByReportWorker = computed(() => { |
| | |
| | | |
| | | // 判断当前用户是否能排产 |
| | | const canScheduleByWorkOrderNo = row => { |
| | | // 管理员可排产 |
| | | if (isAdminUser.value) return true; |
| | | if (!row) return false; |
| | | |
| | | const uid = String(currentUserId.value || ""); |
| | |
| | | toRefs, |
| | | getCurrentInstance, |
| | | nextTick, |
| | | computed, |
| | | } from "vue"; |
| | | import InspectionFormDia from "@/views/qualityManagement/finalInspection/components/inspectionFormDia.vue"; |
| | | import FormDia from "@/views/qualityManagement/finalInspection/components/formDia.vue"; |
| | |
| | | if (row.inspectState == 1) return true; |
| | | // 如果检验员有值,只有当前登录用户能编辑 |
| | | if (row.checkName) { |
| | | return row.checkName !== userStore.nickName; |
| | | return row.checkName !== userStore.nickName && !isAdminUser.value; |
| | | } |
| | | return false; |
| | | }, |
| | |
| | | if (row.inspectState == 1) return true; |
| | | // 如果检验员有值,只有当前登录用户能提交 |
| | | if (row.checkName) { |
| | | return row.checkName !== userStore.nickName; |
| | | return row.checkName !== userStore.nickName && !isAdminUser.value; |
| | | } |
| | | return false; |
| | | }, |
| | |
| | | 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: "", |
| | |
| | | |
| | | <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"; |
| | |
| | | if (row.inspectState == 1) return true; |
| | | // 如果检验员有值,只有当前登录用户能编辑 |
| | | if (row.checkName) { |
| | | return row.checkName !== userStore.nickName; |
| | | return row.checkName !== userStore.nickName && !isAdminUser.value; |
| | | } |
| | | return false; |
| | | } |
| | |
| | | if (row.inspectState == 1) return true; |
| | | // 如果检验员有值,只有当前登录用户能提交 |
| | | if (row.checkName) { |
| | | return row.checkName !== userStore.nickName; |
| | | return row.checkName !== userStore.nickName && !isAdminUser.value; |
| | | } |
| | | return false; |
| | | } |
| | |
| | | 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; |
| | |
| | | |
| | | <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"; |
| | |
| | | if (row.inspectState == 1) return true; |
| | | // 如果检验员有值,只有当前登录用户能编辑 |
| | | if (row.checkName) { |
| | | return row.checkName !== userStore.nickName; |
| | | return row.checkName !== userStore.nickName && !isAdminUser.value; |
| | | } |
| | | return false; |
| | | } |
| | |
| | | if (row.inspectState == 1) return true; |
| | | // 如果检验员有值,只有当前登录用户能提交 |
| | | if (row.checkName) { |
| | | return row.checkName !== userStore.nickName; |
| | | return row.checkName !== userStore.nickName && !isAdminUser.value; |
| | | } |
| | | return false; |
| | | } |
| | |
| | | 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; |
| | |
| | | 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([]); |
| | |
| | | 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; |
| | |
| | | <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"; |
| | |
| | | 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([]); |
| | |
| | | } |
| | | 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); |
| | |
| | | }; |
| | | // 子表合计方法 |
| | | const summarizeChildrenTable = (param, parentRow) => { |
| | | if (!isCurrentUserMaintainer(parentRow)) { |
| | | if (!isCurrentUserMaintainer(parentRow) && !isAdminUser.value) { |
| | | const { columns } = param; |
| | | return columns.map((column, index) => { |
| | | if (index === 0) { |