feat:年前第一次正式存档以及全部修改

This commit is contained in:
大黑 2026-02-12 15:19:59 +08:00
parent 8636778f9d
commit d7e9e51ebf
25 changed files with 11591 additions and 7000 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -241,5 +241,21 @@ export default {
EDIT_CHART_COMMONLY_USED: {
url: '/custom/common/updateChartCommon',
method: 'post'
},
GET_USER_INFO :{
url: '/custom/xdapDeptUsersPojo/getUserInfo',
method: 'get'
},
GET_YC_TODO_LIST: {
url: '/custom/YcTaskResult/getTodoById',
method: 'get'
},
GET_YC_MY_SEND_LIST: {
url: '/custom/YcTaskResult/getInitiatorById',
method: 'get'
},
GET_YC_MY_DONE_LIST: {
url: '/custom/YcTaskResult/getCompletedById',
method: 'get'
}
}

View File

@ -0,0 +1,47 @@
{
font-size: 14px;
}
.app-loading {
position: absolute;
top: 42%;
left: 50%;
transform: translate(-50%, -50%);
display: flex;
flex-flow: column;
align-items: center;
}
.app-loading .loading-gif {
width: 60%;
height: 60%;
}
.app-ie :not(font) {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}{
font-size: 14px;
}
.app-loading {
position: absolute;
top: 42%;
left: 50%;
transform: translate(-50%, -50%);
display: flex;
flex-flow: column;
align-items: center;
}
.app-loading .loading-gif {
width: 60%;
height: 60%;
}
.app-ie :not(font) {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

View File

@ -138,7 +138,14 @@
<template slot="empty">
<div class="table-empty">
<template v-if="canViewData">
<x-empty-page></x-empty-page>
</template>
<template v-else>
<div style="padding: 40px 0; text-align: center; color: #909399;">
<div style="font-size: 14px;">无权限查看</div>
</div>
</template>
</div>
</template>
</x-vxe-table>
@ -221,7 +228,8 @@ export default {
opinion: ''
},
approvalSubmitting: false,
currentApprovalRow: null
currentApprovalRow: null,
canViewData: false //
}
},
computed: {
@ -267,11 +275,80 @@ export default {
}
}
},
created() {
this.loadUserSelfRole()
mounted() {
// localStorage
if (this.hasViewPermission()) {
this.canViewData = true
this.loadData()
} else {
this.canViewData = false
this.tableData = []
}
//
this.loadUserSelfRole()
.then(() => {
//
if (this.hasViewPermission()) {
this.canViewData = true
//
if (this.tableData.length === 0) {
this.loadData()
}
} else {
this.canViewData = false
//
this.tableData = []
}
})
.catch(() => {
//
console.error('加载权限数据失败')
})
},
methods: {
// isAdmin === 1
isAdmin() {
try {
const permissionDataStr = localStorage.getItem('user_self_role')
if (!permissionDataStr) {
return false
}
const permissionData = JSON.parse(permissionDataStr)
if (!Array.isArray(permissionData)) {
return false
}
// isAdmin === 1
return permissionData.some((perm) => perm.isAdmin === 1 || perm.isAdmin === '1')
} catch (err) {
console.error('检查管理员权限失败:', err)
return false
}
},
//
hasViewPermission() {
// 1.
if (this.isAdmin()) {
return true
}
try {
const permissionDataStr = localStorage.getItem('user_self_role')
if (!permissionDataStr) {
return false
}
const permissionData = JSON.parse(permissionDataStr)
if (!Array.isArray(permissionData)) {
return false
}
// 2. permissionPath ""
return permissionData.some((perm) => {
const permissionPath = perm.permissionPath || ''
return permissionPath.includes('参数模板审批流程')
})
} catch (err) {
console.error('检查查看权限失败:', err)
return false
}
},
//
loadUserSelfRole() {
const request = {
@ -281,19 +358,26 @@ export default {
},
disableSuccessMsg: true
}
return new Promise((resolve, reject) => {
this.$request(request)
.asyncThen((resp) => {
if (resp && resp.data) {
// localStorage
try {
localStorage.setItem('user_self_role', JSON.stringify(resp.data))
resolve(resp.data)
} catch (err) {
console.error('存储权限数据到 localStorage 失败:', err)
reject(err)
}
} else {
resolve(null)
}
})
.asyncErrorCatch((err) => {
console.error('获取用户自身角色失败:', err)
reject(err)
})
})
},
pageSizeChange(size) {

View File

@ -683,14 +683,14 @@ export default {
// ID
loadDepartmentTree() {
const request = {
...api.QUERY_ORG_TREE,
...api.GET_DEPT_OF_USER,
disableSuccessMsg: true
}
this.$request(request)
.asyncThen((resp) => {
let result = []
if (resp && resp.data) {
result = resp.data.result || resp.data.data || resp.data || []
result = resp.data.data || resp.data || []
}
this.departmentTreeData = this.formatDepartmentTreeData(result)
})

View File

@ -162,7 +162,16 @@
<template slot="empty">
<div class="table-empty">
<template v-if="canViewData">
<x-empty-page></x-empty-page>
</template>
<template v-else>
<div style="padding: 40px 0; text-align: center; color: #909399;">
<div style="font-size: 14px;">
无权限查看
</div>
</div>
</template>
</div>
</template>
</x-vxe-table>
@ -509,7 +518,8 @@ export default {
currentApprovalRow: null,
showReportDetail: false,
currentReportDetail: null,
downloadingRowId: ''
downloadingRowId: '',
canViewData: false //
}
},
computed: {
@ -555,10 +565,137 @@ export default {
}
}
},
created() {
mounted() {
// localStorage
if (this.hasViewPermission()) {
this.canViewData = true
this.loadData()
} else {
this.canViewData = false
this.tableData = []
}
//
this.loadUserSelfRole()
.then(() => {
//
if (this.hasViewPermission()) {
this.canViewData = true
//
if (this.tableData.length === 0) {
this.loadData()
}
} else {
this.canViewData = false
//
this.tableData = []
}
})
.catch(() => {
//
console.error('加载权限数据失败')
})
},
methods: {
// isAdmin === 1
isAdmin() {
try {
const permissionDataStr = localStorage.getItem('user_self_role')
if (!permissionDataStr) {
return false
}
const permissionData = JSON.parse(permissionDataStr)
if (!Array.isArray(permissionData)) {
return false
}
// isAdmin === 1
return permissionData.some((perm) => perm.isAdmin === 1 || perm.isAdmin === '1')
} catch (err) {
console.error('检查管理员权限失败:', err)
return false
}
},
//
hasViewPermission() {
// 1.
if (this.isAdmin()) {
return true
}
try {
const permissionDataStr = localStorage.getItem('user_self_role')
if (!permissionDataStr) {
return false
}
const permissionData = JSON.parse(permissionDataStr)
if (!Array.isArray(permissionData)) {
return false
}
// 2. permissionPath ""
return permissionData.some((perm) => {
const permissionPath = perm.permissionPath || ''
return permissionPath.includes('对标报告')
})
} catch (err) {
console.error('检查查看权限失败:', err)
return false
}
},
//
hasReportEditPermission() {
//
if (this.isAdmin()) {
return true
}
try {
const permissionDataStr = localStorage.getItem('user_self_role')
if (!permissionDataStr) {
return false
}
const permissionData = JSON.parse(permissionDataStr)
if (!Array.isArray(permissionData)) {
return false
}
// permissionPath "" parameterPer
return permissionData.some((perm) => {
const permissionPath = perm.permissionPath || ''
const parameterPer = perm.parameterPer || ''
return permissionPath === '对标报告' && parameterPer === '编辑'
})
} catch (err) {
console.error('检查报告编辑权限失败:', err)
return false
}
},
//
loadUserSelfRole() {
const request = {
...api.GET_USER_SELF_ROLE,
params: {
userOrDepID: getUserId()
},
disableSuccessMsg: true
}
return new Promise((resolve, reject) => {
this.$request(request)
.asyncThen((resp) => {
if (resp && resp.data) {
// localStorage
try {
localStorage.setItem('user_self_role', JSON.stringify(resp.data))
resolve(resp.data)
} catch (err) {
console.error('存储权限数据到 localStorage 失败:', err)
reject(err)
}
} else {
resolve(null)
}
})
.asyncErrorCatch((err) => {
console.error('获取用户自身角色失败:', err)
reject(err)
})
})
},
handleCreate() {
this.dialogMode = 'create'
this.currentRestartRow = null

View File

@ -997,7 +997,9 @@ export default {
const request = {
...api.GET_CHECK_DATA_Y_DATA,
params: {},
params: {
userId: getUserId()
},
disableSuccessMsg: true
}
this.$request(request)

View File

@ -53,9 +53,15 @@
>
<el-option v-for="ver in versions" :key="ver.id" :label="ver.label" :value="ver.id" />
</el-select> -->
<el-button size="small" @click="handleSyncVersion">
<el-button size="small" v-if="hasAnyEditPermission() && detail &&( detail.distributeStatus === '已完成' || detail.distributeStatus === '未分发')" @click="handleSyncVersion">
同步参数版本
</el-button>
<el-button
v-if="hasAnyEditPermission() && detail && detail.distributeStatus === '已完成'"
size="small"
@click="handleEdit">
编辑
</el-button>
<el-button
v-if="!isEditMode && !isJustCheckMode"
size="small"
@ -101,6 +107,17 @@
{{ shouldShowResendButton ? '发起' : '发起审批' }}
</el-button>
</template>
<!-- 查看模式下如果状态是已完成显示编辑按钮或发起审批按钮 -->
<template v-if="!isEditMode && detail && detail.distributeStatus === '已完成'">
<el-button
v-if="hasSavedInCheckMode"
type="primary"
size="small"
@click="handleInitiateApproval"
>发起审批</el-button
>
</template>
<template v-else-if="isEditMode">
<el-button size="small" @click="handleSaveEdit">保存编辑</el-button>
<el-button size="small" @click="handleCancelEdit">取消</el-button>
@ -242,6 +259,7 @@
size="small"
placeholder="请输入"
class="param-input"
:disabled="!hasParameterEditPermission(row.parameterName, row.subsystemName, row.partsName)"
/>
<span v-else-if="!isEditMode && !isDispatchMode && filledBy">{{
row.minorVersion || row.parameterValue || '/'
@ -606,6 +624,7 @@ export default {
approvalChangeData: [], //
resending: false, // loading
isResendMode: false, //
hasSavedInCheckMode: false, //
resendApprovalData: {
nodeList: [],
processTitle: '',
@ -671,6 +690,36 @@ export default {
isJustCheckMode() {
return this.dispatchType === 'justCheck'
},
//
shouldShowEditInCheckMode() {
// isJustCheckMode true !hideOperations
if (!this.isJustCheckMode || this.hideOperations) {
return false
}
// ""
// status, distributeStatus, approvalStatus
const status = this.detail?.status || ''
const distributeStatus = this.detail?.distributeStatus || ''
const approvalStatus = this.detail?.approvalStatus || ''
// status 'COMPLETE' distributeStatus ''
//
if (status === 'COMPLETE' || distributeStatus === '已分发') {
return true
}
//
if (this.flowNodes && this.flowNodes.length > 0) {
const allPassed = this.flowNodes.every(
(node) => node.result === 'PASS' || node.result === 'APPROVE' || node.result === '通过'
)
if (allPassed) {
return true
}
}
return false
},
// ""
isWholeEngineParamsSelected() {
if (!this.checkedKeys || this.checkedKeys.length === 0) {
@ -832,11 +881,11 @@ export default {
if (this.isApprovalMode) {
// 使 detail.createdBy
if (this.detail?.flowId && this.shouldShowResendButton) {
return this.detail?.createdBy || '--'
return this.detail?.createdBy || this.userInfo?.username || this.userInfo?.userName || '--'
}
// 使 detail.currentProcessor
// 使 userInfo.username
if (!this.detail?.flowId) {
return this.detail?.currentProcessor || '--'
return this.userInfo?.username || this.userInfo?.userName || this.detail?.currentProcessor || '--'
}
}
// 使 detail.createBy
@ -881,7 +930,7 @@ export default {
if (this.isApprovalMode) {
// 使 detail.currentProcessor
if (!this.detail?.flowId || (this.detail?.flowId && this.shouldShowResendButton)) {
return this.detail?.currentProcessor || '--'
return this.detail?.currentProcessor || this.userInfo?.userName || '--'
}
}
// 使 currentProcessor
@ -912,6 +961,7 @@ export default {
}
},
created() {
this.getUserInfo()
// // engineModelID使 props使 route query
// if (
// !this.engineModelID &&
@ -942,6 +992,25 @@ export default {
// this.loadEngineDetailInfo()
},
methods: {
getUserInfo() {
const request = {
...api.GET_USER_INFO,
params: {
userId: getUserId()
},
disableSuccessMsg: true
}
this.$request(request)
.asyncThen((resp) => {
if (resp && resp.data) {
console.log('resp.data', resp.data)
this.userInfo = resp.data
}
})
.asyncErrorCatch((err) => {
console.error('获取用户信息失败:', err)
})
},
getversions() {
// 使 props engineModelID modelId
if (!this.engineModelID) {
@ -1059,10 +1128,11 @@ export default {
},
// menuPath model
getMenuPath() {
// model
//
//
return '玉柴发动机数据' // ''
// detail
// detail ycOrOth
// detail ycOrOth 使
const engineType = this.detail?.ycOrOth || this.detail?.ycOrOt || '玉柴'
return engineType === '竞品' ? '竞品发动机数据' : '玉柴发动机数据'
},
// isAdmin === 1
hasAdminPermission() {
@ -1166,19 +1236,19 @@ export default {
const menuPath = this.getMenuPath()
return this.checkPermission(menuPath, subsystem, '编辑')
},
// parameterName
hasParameterEditPermission(parameterName, subsystemName = null) {
//
//
// parameterName:
// subsystemName:
// partsName:
hasParameterEditPermission(parameterName, subsystemName = null, partsName = null) {
// isAdmin 1
if (this.hasAdminPermission()) {
return true
}
//
if (this.hasGlobalEditPermission()) {
return true
}
if (!parameterName) {
return false
}
// permissionPath
const engineTypePath = this.getMenuPath() // '' ''
try {
const permissionDataStr = localStorage.getItem('user_self_role')
if (!permissionDataStr) {
@ -1189,31 +1259,86 @@ export default {
return false
}
const menuPath = this.getMenuPath()
// menuPathsubsystemparameterNameparameterPer""
const matchedPermissions = permissionData.filter((perm) => {
// menuPath
const menuMatch =
perm.menuPath && (perm.menuPath.includes(menuPath) || menuPath.includes(perm.menuPath))
if (!menuMatch) {
return false
}
// subsystemName
if (subsystemName && perm.subsystem !== subsystemName) {
return false
}
// parameterName
if (perm.parameterName !== parameterName) {
return false
}
// ""
return perm.parameterPer === '编辑'
// permissionPath """" parameterPer ""
const hasGlobalEdit = permissionData.some((perm) => {
const permissionPath = perm.permissionPath || ''
const parameterPer = perm.parameterPer || ''
// permissionPath engineTypePath parameterPer ""
return permissionPath === engineTypePath && parameterPer === '编辑'
})
return matchedPermissions.length > 0
if (hasGlobalEdit) {
return true
}
// permissionPath
// //线
//
const editPermissions = permissionData.filter((perm) => {
const permissionPath = perm.permissionPath || ''
const parameterPer = perm.parameterPer || ''
// permissionPath engineTypePath
return parameterPer === '编辑' && permissionPath.startsWith(engineTypePath + '/')
})
// false
if (editPermissions.length === 0) {
return false
}
//
for (const perm of editPermissions) {
const permissionPath = perm.permissionPath || ''
// //线
const pathParts = permissionPath.split('/').filter((part) => part.trim() !== '')
// engineTypePath// engineTypePath/
if (pathParts.length < 2) {
continue
}
const permEngineType = pathParts[0] //
//
if (permEngineType !== engineTypePath) {
continue
}
// engineTypePath/
if (pathParts.length === 2) {
const permSubsystem = pathParts[1] //
// subsystemName
if (subsystemName && permSubsystem === subsystemName) {
// partsName '/' null
if (!partsName || partsName === '/') {
return true
}
}
} else if (pathParts.length >= 3) {
// engineTypePath//
const permSubsystem = pathParts[1] //
const permPartsName = pathParts[2] //
// subsystemName
if (!subsystemName || permSubsystem !== subsystemName) {
continue
}
//
// partsName '/' null
if (!partsName || partsName === '/') {
continue
}
//
if (permPartsName === partsName) {
return true
}
}
}
return false
} catch (err) {
console.error('检查参数权限失败:', err)
return false
@ -1246,16 +1371,16 @@ export default {
return false
}
},
//
// 使
hasAnyEditPermission() {
//
// isAdmin 1
if (this.hasAdminPermission()) {
return true
}
//
if (this.hasGlobalEditPermission()) {
return true
}
// permissionPath
const engineTypePath = this.getMenuPath() // '' ''
try {
const permissionDataStr = localStorage.getItem('user_self_role')
if (!permissionDataStr) {
@ -1266,16 +1391,28 @@ export default {
return false
}
const menuPath = this.getMenuPath()
//
const matchedPermissions = permissionData.filter((perm) => {
const menuMatch =
perm.menuPath && (perm.menuPath.includes(menuPath) || menuPath.includes(perm.menuPath))
return menuMatch && perm.parameterPer === '编辑'
// permissionPath """" parameterPer ""
const hasGlobalEdit = permissionData.some((perm) => {
const permissionPath = perm.permissionPath || ''
const parameterPer = perm.parameterPer || ''
// permissionPath engineTypePath parameterPer ""
return permissionPath === engineTypePath && parameterPer === '编辑'
})
return matchedPermissions.length > 0
if (hasGlobalEdit) {
return true
}
// permissionPath engineTypePath + '/' parameterPer ""
// //线 /
const hasAnyEdit = permissionData.some((perm) => {
const permissionPath = perm.permissionPath || ''
const parameterPer = perm.parameterPer || ''
// permissionPath engineTypePath '/'
return parameterPer === '编辑' && permissionPath.startsWith(engineTypePath + '/')
})
return hasAnyEdit
} catch (err) {
console.error('检查编辑权限失败:', err)
return false
@ -1953,6 +2090,11 @@ export default {
this.originalData = null
this.changeData = [] //
// 便
if (this.isJustCheckMode) {
this.hasSavedInCheckMode = true
}
//
this.loadEngineDetail()
this.$message({
@ -1987,6 +2129,7 @@ export default {
this.isEditMode = false
this.originalData = null
this.changeData = [] //
// hasSavedInCheckMode
},
handleBatchModifyResponsible() {
//
@ -2284,6 +2427,7 @@ export default {
...api.GET_ENGINE_TABLE_DETAIL,
params: {
modelID: this.detail.id,
userID: getUserId(),
parameterVersion: this.currentVersionId || 1 // 1
},
disableSuccessMsg: true
@ -2399,24 +2543,11 @@ export default {
const secondLevelData = data[firstLevelKey]
if (typeof secondLevelData === 'object' && !Array.isArray(secondLevelData)) {
//
const isAdmin = this.hasAdminPermission()
// """"
Object.keys(secondLevelData).forEach((subsystemName, secondIdx) => {
const secondLevelId = `${firstLevelId}-${secondIdx}`
const isWholeEngineParams = subsystemName === '整车参数'
//
// ""
if (!isWholeEngineParams && !isAdmin) {
//
if (!this.hasSubsystemPermission(subsystemName)) {
//
return
}
}
const thirdLevelParams = secondLevelData[subsystemName] || []
const thirdLevelChildren = []
@ -3299,7 +3430,11 @@ export default {
this.isApprovalMode = true
//
const productModel = this.detail?.modelName || '产品型号'
const statusCode = this.detail?.productNumber || '状态代号'
//
const wholeEngineParams = this.wholeEngineParamsData['整车参数'] || []
const statusCodeParam = wholeEngineParams.find(param => param.parameterName === '状态代号' || param.parameterName === '产品代号')
const statusCode = statusCodeParam?.parameterValue || this.detail?.productNumber || '状态代号'
console.log('statusCode', statusCode,statusCodeParam)
this.approvalFormData = {
processTitle: `${productModel}-${statusCode}发起审批`,
description: ''
@ -3424,7 +3559,10 @@ export default {
this.isApprovalMode = true
//
const productModel = this.detail?.modelName || '产品型号'
const statusCode = this.detail?.productNumber || '状态代号'
const wholeEngineParams = this.wholeEngineParamsData['整车参数'] || []
const statusCodeParam = wholeEngineParams.find(param => param.parameterName === '状态代号' || param.parameterName === '产品代号')
const statusCode = statusCodeParam?.parameterValue || this.detail?.productNumber || '状态代号'
console.log('statusCode', statusCode,statusCodeParam)
this.approvalFormData = {
processTitle: `${productModel}-${statusCode}发起审批`,
description: ''
@ -3542,6 +3680,7 @@ export default {
loading: false
}
]
// hasSavedInCheckMode
},
//
canResendApproval() {
@ -3925,6 +4064,10 @@ export default {
})
this.approvalSubmitting = false
this.isApprovalMode = false
//
if (this.isJustCheckMode) {
this.hasSavedInCheckMode = false
}
this.handleBack()
})
.asyncErrorCatch((err) => {
@ -3959,6 +4102,10 @@ export default {
})
this.approvalSubmitting = false
this.isApprovalMode = false
//
if (this.isJustCheckMode) {
this.hasSavedInCheckMode = false
}
this.handleBack()
})
.asyncErrorCatch((err) => {
@ -4010,6 +4157,10 @@ export default {
})
this.approvalSubmitting = false
this.isApprovalMode = false
//
if (this.isJustCheckMode) {
this.hasSavedInCheckMode = false
}
this.handleBack()
})
.asyncErrorCatch((err) => {

View File

@ -5,7 +5,7 @@
<div class="title">
责任人管理
</div>
<div>
<div v-if="hasEditPermission()">
<el-button type="primary" @click="handleAdd">
新增
</el-button>
@ -61,6 +61,7 @@
align="center"
/>
<el-table-column
v-if="hasEditPermission()"
label="操作"
width="200"
align="center"
@ -83,6 +84,24 @@
</a>
</template>
</el-table-column>
<template slot="empty">
<div class="table-empty">
<template v-if="canViewData">
<div style="padding: 40px 0; text-align: center; color: #909399;">
<div style="font-size: 14px;">
暂无数据
</div>
</div>
</template>
<template v-else>
<div style="padding: 40px 0; text-align: center; color: #909399;">
<div style="font-size: 14px;">
无权限查看
</div>
</div>
</template>
</div>
</template>
</el-table>
<div class="pagination-section">
<el-pagination
@ -312,7 +331,8 @@ export default {
importDialogVisible: false, //
importFileList: [], //
selectedImportFile: null, //
importing: false //
importing: false, //
canViewData: false //
}
},
computed: {
@ -327,9 +347,36 @@ export default {
},
mounted() {
this.loadDepartmentList()
this.loadManagerData()
this.isResponsible()
this.loadSubsystemList()
// localStorage
if (this.hasViewPermission()) {
this.canViewData = true
this.loadManagerData()
} else {
this.canViewData = false
this.tableData = []
}
//
this.loadUserSelfRole()
.then(() => {
//
if (this.hasViewPermission()) {
this.canViewData = true
//
if (this.tableData.length === 0) {
this.loadManagerData()
}
} else {
this.canViewData = false
//
this.tableData = []
}
})
.catch(() => {
//
console.error('加载权限数据失败')
})
},
beforeDestroy() {
//
@ -340,6 +387,111 @@ export default {
this.currentRequest = null
},
methods: {
// isAdmin === 1
isAdmin() {
try {
const permissionDataStr = localStorage.getItem('user_self_role')
if (!permissionDataStr) {
return false
}
const permissionData = JSON.parse(permissionDataStr)
if (!Array.isArray(permissionData)) {
return false
}
// isAdmin === 1
return permissionData.some((perm) => perm.isAdmin === 1 || perm.isAdmin === '1')
} catch (err) {
console.error('检查管理员权限失败:', err)
return false
}
},
//
hasViewPermission() {
// 1.
if (this.isAdmin()) {
return true
}
try {
const permissionDataStr = localStorage.getItem('user_self_role')
if (!permissionDataStr) {
return false
}
const permissionData = JSON.parse(permissionDataStr)
if (!Array.isArray(permissionData)) {
return false
}
// 2. permissionPath ""
return permissionData.some((perm) => {
const permissionPath = perm.permissionPath || ''
return permissionPath === '基础管理模块'
})
} catch (err) {
console.error('检查查看权限失败:', err)
return false
}
},
//
hasEditPermission() {
// 1.
if (this.isAdmin()) {
return true
}
try {
const permissionDataStr = localStorage.getItem('user_self_role')
if (!permissionDataStr) {
return false
}
const permissionData = JSON.parse(permissionDataStr)
if (!Array.isArray(permissionData)) {
return false
}
// 2. permissionPath "" parameterPer ""
// user-self-role true
return permissionData.some((perm) => {
const permissionPath = perm.permissionPath || ''
const parameterPer = perm.parameterPer || ''
// permissionPath "" parameterPer "" 2
return (
permissionPath === '基础管理模块' &&
(parameterPer === '编辑' || parameterPer === 2 || parameterPer === '2')
)
})
} catch (err) {
console.error('检查编辑权限失败:', err)
return false
}
},
//
loadUserSelfRole() {
const request = {
...api.GET_USER_SELF_ROLE,
params: {
userOrDepID: getUserId()
},
disableSuccessMsg: true
}
return new Promise((resolve, reject) => {
this.$request(request)
.asyncThen((resp) => {
if (resp && resp.data) {
// localStorage
try {
localStorage.setItem('user_self_role', JSON.stringify(resp.data))
resolve(resp.data)
} catch (err) {
console.error('存储权限数据到 localStorage 失败:', err)
reject(err)
}
} else {
resolve(null)
}
})
.asyncErrorCatch((err) => {
console.error('获取用户自身角色失败:', err)
reject(err)
})
})
},
loadSubsystemList() {
const request = {
...api.GET_SUBSYSTEM_LIST,
@ -418,20 +570,17 @@ export default {
},
loadDepartmentList() {
const request = {
...api.QUERY_ORG_TREE,
// params: {
// departmentId: this.formData.departmentId
// },
...api.GET_DEPT_OF_USER,
disableSuccessMsg: true
}
this.$request(request)
.asyncThen((resp) => {
// { id, name, children }
// { id, name }
let result = []
if (resp && resp.data) {
result = resp.data.result || resp.data.data || resp.data || []
result = resp.data
}
//
//
this.departmentList = this.formatDepartmentTreeData(result)
})
.asyncErrorCatch((err) => {
@ -439,29 +588,17 @@ export default {
this.departmentList = []
})
},
//
//
formatDepartmentTreeData(data) {
if (!Array.isArray(data)) {
return []
}
// id name
const formatNode = (node) => {
const formatted = {
// id name
return data.map((node) => ({
id: node.id,
name: node.name || node.label || '',
children: undefined
}
//
if (node.children && Array.isArray(node.children) && node.children.length > 0) {
formatted.children = node.children.map(child => formatNode(child))
}
return formatted
}
return data.map(node => formatNode(node))
name: node.name
}))
},
handleAdd() {
this.dialogMode = 'add'

View File

@ -160,6 +160,7 @@
@close="handleAddModelDialogClose"
>
<div class="model-select-dialog">
<template v-if="!isUserPermissionsEmpty()">
<el-input
v-model="modelSearchText"
placeholder="请输入产品型号,状态代号/产品编号,平台,系列搜索"
@ -187,6 +188,14 @@
<el-table-column prop="series" label="系列" min-width="70" />
</el-table>
</div>
</template>
<template v-else>
<div style="padding: 40px 0; text-align: center; color: #909399;">
<div style="font-size: 14px;">
无权限查看
</div>
</div>
</template>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="handleAddModelDialogClose">取消</el-button>
@ -292,6 +301,7 @@
<script>
import api from '@/api'
import { getUserId } from '@/utils'
import '@/assets/scss/apaas-custom-hello.css'
export default {
name: 'ModelQuery',
@ -342,7 +352,9 @@ export default {
//
savedAllParametersData: {}, // { "": [{ parameterName, parameterId, ... }] }
// 使 true false
useCommonFilter: false
useCommonFilter: false,
//
userPermissions: [] // localStorage
}
},
computed: {
@ -596,13 +608,183 @@ export default {
if (this.$refs.paramTree && this.treeFilterText) {
this.$refs.paramTree.filter(this.treeFilterText)
}
},
//
userPermissions: {
handler() {
//
this.$nextTick(() => {
this.$forceUpdate()
})
},
deep: true
}
},
mounted() {
//
this.loadUserSelfRole()
// loadFavoritesList
console.log('加载树数据')
this.loadTreeData()
},
methods: {
//
loadUserSelfRole() {
// localStorage
try {
const permissionDataStr = localStorage.getItem('user_self_role')
if (permissionDataStr) {
this.userPermissions = JSON.parse(permissionDataStr)
}
} catch (err) {
console.error('从 localStorage 加载用户权限数据失败:', err)
}
// API
const request = {
...api.GET_USER_SELF_ROLE,
params: {
userOrDepID: getUserId()
},
disableSuccessMsg: true
}
this.$request(request)
.asyncThen((resp) => {
if (resp && resp.data) {
this.userPermissions = resp.data
// localStorage
try {
localStorage.setItem('user_self_role', JSON.stringify(resp.data))
} catch (err) {
console.error('存储权限数据到 localStorage 失败:', err)
}
//
this.$nextTick(() => {
this.$forceUpdate()
})
}
})
.asyncErrorCatch((err) => {
console.error('获取用户自身角色失败:', err)
})
},
// isAdmin === 1
isAdmin() {
if (!this.userPermissions || !Array.isArray(this.userPermissions)) {
return false
}
return this.userPermissions.some((perm) => perm.isAdmin === 1 || perm.isAdmin === '1')
},
//
isUserPermissionsEmpty() {
return !this.userPermissions || !Array.isArray(this.userPermissions) || this.userPermissions.length === 0
},
//
// model: id, parameterVersion
// param: subsystemName, partsName
hasParamPermission(model, param) {
// 1.
if (this.isAdmin()) {
return true
}
if (!this.userPermissions || !Array.isArray(this.userPermissions) || this.userPermissions.length === 0) {
// `-`
return false
}
// ycOrOth
const modelKey = `${model.id}_${model.parameterVersion || 1}`
const modelRawData = this.allModelRawData[modelKey]
const ycOrOth = (modelRawData && modelRawData.ycOrOth) || ''
//
// ycOrOth """YC"""
const isYuchai = ycOrOth === '玉柴' || ycOrOth === 'YC' || ycOrOth === 'yc'
const engineType = isYuchai ? '玉柴发动机数据' : '竞品发动机数据'
//
const subsystemName = param.subsystemName || ''
// partsName '/'
let partsName = param.partsName || ''
// partsName '/'使
if (partsName === '/') {
partsName = ''
}
//
const relevantPermissions = this.userPermissions.filter((perm) => {
const permissionPath = perm.permissionPath || ''
//
return permissionPath.includes(engineType)
})
if (relevantPermissions.length === 0) {
// 3 `-`
return false
}
// //
const exactPermissions = relevantPermissions.filter((perm) => {
const permissionPath = perm.permissionPath || ''
if (permissionPath.startsWith(engineType + '/')) {
const pathParts = permissionPath.split('/')
return pathParts.length >= 3
}
return false
})
// 2permissionPath """"
//
if (exactPermissions.length === 0) {
// /
const hasGeneralPermission = relevantPermissions.some((perm) => {
const permissionPath = perm.permissionPath || ''
// /
const pathParts = permissionPath.split('/')
return permissionPath === engineType || (permissionPath.startsWith(engineType + '/') && pathParts.length === 2)
})
if (hasGeneralPermission) {
// 2
return true
} else {
// 312 `-`
return false
}
}
// 4
// //
//
const hasExactPermission = exactPermissions.some((perm) => {
const permissionPath = perm.permissionPath || ''
if (permissionPath.startsWith(engineType + '/')) {
const pathParts = permissionPath.split('/')
if (pathParts.length >= 3) {
const permSubsystem = pathParts[1] || ''
const permPartsName = pathParts[2] || ''
//
// partsName
if (partsName === '' && permPartsName === '') {
//
return permSubsystem === subsystemName
}
//
return permSubsystem === subsystemName && permPartsName === partsName
}
}
return false
})
if (hasExactPermission) {
// 4
return true
}
// 312 `-`
return false
},
filterTreeNode(value, data) {
if (!value) return true
const searchValue = value.toLowerCase()
@ -659,7 +841,7 @@ export default {
this.reloadModelDetailsForCheckedNodes()
},
getParamValue(model, param) {
// param { parameterName, subsystemName, parameterId }
// param { parameterName, subsystemName, parameterId, partsName }
if (!model || !model.id || !param) {
return '-'
}
@ -668,6 +850,12 @@ export default {
const parameterVersion = model.parameterVersion || 1
const modelKey = `${model.id}_${parameterVersion}`
//
//
if (!this.hasParamPermission(model, param)) {
return '-'
}
// ""
if (param.subsystemName === '整车参数') {
const paramNameToFieldMap = {
@ -830,6 +1018,7 @@ export default {
productNumber: model.productNumber || '',
plate: model.plate || '',
platform: model.platform || '',
ycOrOth: model.ycOrOth || '',
series: model.series || '',
marketSegment: model.marketSegment || '',
projectName: model.projectName || '',
@ -1001,7 +1190,7 @@ export default {
}
}
// allModelRawData
// allModelRawData
const modelKey = `${modelId}_${parameterVersion}`
if (!this.allModelRawData[modelKey]) {
this.$set(this.allModelRawData, modelKey, {
@ -1009,12 +1198,18 @@ export default {
productNumber: modelData.productNumber || '',
plate: modelData.plate || '',
platform: modelData.platform || '',
ycOrOth: modelData.ycOrOth || '',
series: modelData.series || '',
marketSegment: modelData.marketSegment || '',
projectName: modelData.projectName || '',
projectNumber: modelData.projectNumber || '',
parameterNum: modelData.parameterNum || ''
})
} else {
// ycOrOth
if (!this.allModelRawData[modelKey].ycOrOth && modelData.ycOrOth) {
this.$set(this.allModelRawData[modelKey], 'ycOrOth', modelData.ycOrOth)
}
}
//
@ -1358,6 +1553,7 @@ export default {
},
//
updateCheckedKeysByDisplayParams() {
console.log('根据可显示的参数更新树节点选中状态(不改变树数据)');
// 使
this.treeData = JSON.parse(JSON.stringify(this.allTreeData))
this.nodeMap = JSON.parse(JSON.stringify(this.allNodeMap))
@ -1557,7 +1753,6 @@ export default {
if (subsystemNames.length === 0 && parameterTypes.length === 0) {
return
}
// subsystem -> Set<parameterKey>
// parameterKey 使 parameterId使 parameterName
// isGlobal === 1 ""
@ -2104,13 +2299,15 @@ export default {
},
//
loadTreeData() {
console.log('加载树数据,调用接口获取树数据')
// ""
this.loadAllParametersData().then(() => {
//
const request = {
...api.GET_ENGINE_DETAIL_QUERY,
params: {
tcData: 'tc'
tcData: 'tc',
userId: getUserId()
},
disableSuccessMsg: true
}
@ -2131,16 +2328,20 @@ export default {
// ""
const wholeEngineParamsNode = this.buildWholeEngineParamsNode()
console.log('根据接口返回的"整车参数"参数数据构建树结构', wholeEngineParamsNode);
// ""
treeDataResult = [wholeEngineParamsNode, ...treeDataResult]
console.log('将"整车参数"节点放在第一位,其他节点放在后面', treeDataResult);
//
this.allTreeData = JSON.parse(JSON.stringify(treeDataResult))
this.allNodeMap = JSON.parse(JSON.stringify(this.nodeMap))
console.log('保存完整的树数据(未过滤)', this.allTreeData);
// 使
this.treeData = JSON.parse(JSON.stringify(this.allTreeData))
console.log('始终使用完整的树数据', this.treeData);
//
if (this.currentCommonConfig) {
@ -2149,10 +2350,14 @@ export default {
this.updateCheckedKeysByDisplayParams()
// 2.
this.$nextTick(() => {
console.log('比较当前显示的参数和常用配置中的参数,找出不在常用中的参数,隐藏它们');
this.hideParamsNotInCommonByDisplayParams()
})
})
} else {
console.log('否则全选');
//
const allKeys = this.getAllNodeKeys(this.treeData)
this.defaultExpandedKeys = allKeys

View File

@ -301,13 +301,7 @@ export default {
minWidth: '150',
align: 'center'
},
{
prop: 'orderNum',
label: '排序号',
showOverflowTooltip: true,
minWidth: '80',
align: 'center'
},
{
prop: 'status',
customSlot: 'status',
@ -951,6 +945,9 @@ export default {
this.errorList = err.message || '导入失败,请稍后重试'
}
this.errorDialogVisible = true
setTimeout(() => {
this.loadData()
}, 1000)
})
.finally(() => {
// loading

View File

@ -1468,7 +1468,10 @@ export default {
this.isResendMode = false
this.resendApprovalData = null
this.getApprovalChange()
this.$message.warning('获取原审批流程信息失败,将使用空的人员列表')
this.$message({
type: 'warning',
message: '获取原审批流程信息失败,将使用空的人员列表'
})
})
},
// templateNamesubsystem
@ -1827,7 +1830,10 @@ export default {
}
}
if (!this.selectedDepartmentNode) {
this.$message.warning('请选择一个部门')
this.$message({
type: 'warning',
message: '请选择一个部门'
})
return
}
//
@ -2018,7 +2024,10 @@ export default {
handleImportConfirm() {
if (this.importing || !this.selectedImportFile) {
if (!this.selectedImportFile) {
this.$message.warning('请先选择要导入的文件')
this.$message({
type: 'warning',
message: '请先选择要导入的文件'
})
}
return
}
@ -2544,6 +2553,7 @@ export default {
this.resendFlowId = null
this.isProcessTitleEditing = false
this.originalProcessTitle = ''
this.handleSearch()
},
//
handleEditStep(stepIndex) {
@ -2567,7 +2577,10 @@ export default {
}
const userIds = (step.handlers || []).filter(Boolean)
if (userIds.length === 0) {
this.$message.warning('请至少选择一位处理人')
this.$message({
type: 'warning',
message: '请至少选择一位处理人'
})
return
}
// flowId detail resendFlowId
@ -2578,7 +2591,10 @@ export default {
flowId = this.resendFlowId
}
if (!flowId) {
this.$message.error('缺少流程ID无法保存')
this.$message({
type: 'error',
message: '缺少流程ID无法保存'
})
return
}
const request = {
@ -2784,7 +2800,10 @@ export default {
handleSaveProcessTitle() {
const newTitle = (this.approvalFormData.processTitle || '').trim()
if (!newTitle) {
this.$message.warning('流程主题不能为空')
this.$message({
type: 'warning',
message: '流程主题不能为空'
})
return
}
// flowId detail resendFlowId
@ -2873,7 +2892,21 @@ export default {
handleApprovalFormSubmit() {
const processTitle = (this.approvalFormData.processTitle || '').trim()
if (!processTitle) {
this.$message.warning('请填写流程主题')
this.$message({
type: 'warning',
message: '请填写流程主题'
})
return
}
//
const missingRequiredSteps = this.approvalWorkflowSteps.filter(
(step) => step.required && (!step.handlers || step.handlers.length === 0)
)
if (missingRequiredSteps.length > 0) {
this.$message({
type: 'warning',
message: '请为必填环节"校对、审核、批准"选择处理人'
})
return
}
// 使
@ -2909,7 +2942,10 @@ export default {
// ID
const templateRowId = this.getDetailTemplateId()
if (!templateRowId) {
this.$message.error('缺少模板ID无法发起审批')
this.$message({
type: 'error',
message: '缺少模板ID无法发起审批'
})
return
}
const processTitle = (this.approvalFormData.processTitle || '').trim()
@ -3361,13 +3397,19 @@ export default {
//
handleBatchDelete() {
if (!this.selectedRows || this.selectedRows.length === 0) {
this.$message.warning('请先选择要删除的参数')
this.$message({
type: 'warning',
message: '请先选择要删除的参数'
})
return
}
//
const validSelectedRows = this.selectedRows.filter((row) => row.operation !== 'delete')
if (validSelectedRows.length === 0) {
this.$message.warning('选中的参数中已包含已删除的项,请重新选择')
this.$message({
type: 'warning',
message: '选中的参数中已包含已删除的项,请重新选择'
})
return
}
this.$confirm(`确定要删除选中的 ${validSelectedRows.length} 个参数吗?`, '提示', {
@ -3390,7 +3432,10 @@ export default {
this.$refs.vxeTable.clearSelection()
}
if (deleteCount > 0) {
this.$message.success(`已标记 ${deleteCount} 个参数为删除`)
this.$message({
type: 'success',
message: `已标记 ${deleteCount} 个参数为删除`
})
}
})
.catch(() => {
@ -3400,13 +3445,19 @@ export default {
//
handleBatchModifyDepartment() {
if (!this.selectedRows || this.selectedRows.length === 0) {
this.$message.warning('请先选择要修改部门的参数')
this.$message({
type: 'warning',
message: '请先选择要修改部门的参数'
})
return
}
//
const validSelectedRows = this.selectedRows.filter((row) => row.operation !== 'delete')
if (validSelectedRows.length === 0) {
this.$message.warning('选中的参数中已包含已删除的项,请重新选择')
this.$message({
type: 'warning',
message: '选中的参数中已包含已删除的项,请重新选择'
})
return
}
//
@ -3446,13 +3497,19 @@ export default {
}
}
if (!this.selectedDepartmentNode) {
this.$message.warning('请选择一个部门')
this.$message({
type: 'warning',
message: '请选择一个部门'
})
return
}
//
const validSelectedRows = this.selectedRows.filter((row) => row.operation !== 'delete')
if (validSelectedRows.length === 0) {
this.$message.warning('选中的参数中已包含已删除的项,请重新选择')
this.$message({
type: 'warning',
message: '选中的参数中已包含已删除的项,请重新选择'
})
this.handleDepartmentDialogClose()
return
}
@ -3490,9 +3547,15 @@ export default {
//
this.handleDepartmentDialogClose()
if (updateCount > 0) {
this.$message.success(`已批量修改 ${updateCount} 个参数的部门`)
this.$message({
type: 'success',
message: `已批量修改 ${updateCount} 个参数的部门`
})
} else {
this.$message.warning('没有可修改的参数')
this.$message({
type: 'warning',
message: '没有可修改的参数'
})
}
},
getRowClassName({ row }) {

View File

@ -185,6 +185,8 @@ export default {
},
mounted() {
this.loadData()
// URLflowId
this.checkFlowIdFromUrl()
},
methods: {
pageSizeChange(size) {
@ -366,6 +368,35 @@ export default {
console.error('日期格式化错误:', error)
return cellValue
}
},
checkFlowIdFromUrl() {
// URLflowId
const flowId = this.$route && this.$route.query && this.$route.query.flowId
if (flowId) {
const request = {
...api.GET_YC_MY_DONE_LIST,
params: {
flowId: flowId
},
disableSuccessMsg: true
}
this.$request(request)
.asyncThen((resp) => {
// handleRowView
if (resp && resp.data) {
//
const rowData = resp.data.result || resp.data.data || resp.data
// rowData
if (rowData && (rowData.dataType || rowData.documentNo || rowData.modelId)) {
this.handleRowView(rowData)
}
}
})
.asyncErrorCatch((err) => {
console.error('根据flowId获取经办数据失败:', err)
this.$message.error('获取经办数据失败')
})
}
}
}
}

View File

@ -203,6 +203,8 @@ export default {
},
mounted() {
this.loadData()
// URLflowId
this.checkFlowIdFromUrl()
},
methods: {
pageSizeChange(size) {
@ -494,6 +496,35 @@ export default {
})
}
console.warn(row)
},
checkFlowIdFromUrl() {
// URLflowId
const flowId = this.$route && this.$route.query && this.$route.query.flowId
if (flowId) {
const request = {
...api.GET_YC_MY_SEND_LIST,
params: {
flowId: flowId
},
disableSuccessMsg: true
}
this.$request(request)
.asyncThen((resp) => {
// handleRowView
if (resp && resp.data) {
//
const rowData = resp.data.result || resp.data.data || resp.data
// rowData
if (rowData && (rowData.dataType || rowData.documentNo || rowData.modelId)) {
this.handleRowView(rowData)
}
}
})
.asyncErrorCatch((err) => {
console.error('根据flowId获取发起数据失败:', err)
this.$message.error('获取发起数据失败')
})
}
}
}
}

View File

@ -113,7 +113,14 @@
<template slot="empty">
<div class="table-empty">
<template v-if="canViewData">
<x-empty-page></x-empty-page>
</template>
<template v-else>
<div style="padding: 40px 0; text-align: center; color: #909399;">
<div style="font-size: 14px;">无权限查看</div>
</div>
</template>
</div>
</template>
</x-vxe-table>
@ -209,7 +216,8 @@ export default {
//
applicantOptions: [],
applicantLoading: false,
applicantSearchTimer: null //
applicantSearchTimer: null, //
canViewData: false //
}
},
computed: {
@ -276,9 +284,35 @@ export default {
}
}
},
created() {
this.loadUserSelfRole()
mounted() {
// localStorage
if (this.hasViewPermission()) {
this.canViewData = true
this.loadData()
} else {
this.canViewData = false
this.tableData = []
}
//
this.loadUserSelfRole()
.then(() => {
//
if (this.hasViewPermission()) {
this.canViewData = true
//
if (this.tableData.length === 0) {
this.loadData()
}
} else {
this.canViewData = false
//
this.tableData = []
}
})
.catch(() => {
//
console.error('加载权限数据失败')
})
},
beforeDestroy() {
//
@ -350,6 +384,49 @@ export default {
//
return this.isApplicant(row)
},
// isAdmin === 1
isAdmin() {
try {
const permissionDataStr = localStorage.getItem('user_self_role')
if (!permissionDataStr) {
return false
}
const permissionData = JSON.parse(permissionDataStr)
if (!Array.isArray(permissionData)) {
return false
}
// isAdmin === 1
return permissionData.some((perm) => perm.isAdmin === 1 || perm.isAdmin === '1')
} catch (err) {
console.error('检查管理员权限失败:', err)
return false
}
},
//
hasViewPermission() {
// 1.
if (this.isAdmin()) {
return true
}
try {
const permissionDataStr = localStorage.getItem('user_self_role')
if (!permissionDataStr) {
return false
}
const permissionData = JSON.parse(permissionDataStr)
if (!Array.isArray(permissionData)) {
return false
}
// 2. permissionPath ""
return permissionData.some((perm) => {
const permissionPath = perm.permissionPath || ''
return permissionPath.includes('竞品发动机数据审批流程')
})
} catch (err) {
console.error('检查查看权限失败:', err)
return false
}
},
//
loadUserSelfRole() {
const request = {
@ -359,19 +436,26 @@ export default {
},
disableSuccessMsg: true
}
return new Promise((resolve, reject) => {
this.$request(request)
.asyncThen((resp) => {
if (resp && resp.data) {
// localStorage
try {
localStorage.setItem('user_self_role', JSON.stringify(resp.data))
resolve(resp.data)
} catch (err) {
console.error('存储权限数据到 localStorage 失败:', err)
reject(err)
}
} else {
resolve(null)
}
})
.asyncErrorCatch((err) => {
console.error('获取用户自身角色失败:', err)
reject(err)
})
})
},
pageSizeChange(size) {

View File

@ -56,6 +56,7 @@
<el-option label="已分发" value="已分发" />
<el-option label="部分分发" value="部分分发" />
<el-option label="未分发" value="未分发" />
<el-option label="已完成" value="已完成" />
</el-select>
</div>
<div class="search-actions">
@ -139,6 +140,9 @@
<span v-else-if="row[colConfig.prop] === '未分发'" class="status-tag status-pending">
未分发
</span>
<span v-else-if="row[colConfig.prop] === '已完成'" class="status-tag status-done">
已完成
</span>
</div>
<div v-if="colConfig.customSlot === 'versionNumber'" :key="index + '' + rowIndex">
V{{ row[colConfig.prop] || '' }}
@ -147,7 +151,14 @@
<template slot="empty">
<div class="table-empty">
<template v-if="canViewData">
<x-empty-page></x-empty-page>
</template>
<template v-else>
<div style="padding: 40px 0; text-align: center; color: #909399;">
<div style="font-size: 14px;">无权限查看</div>
</div>
</template>
</div>
</template>
</x-vxe-table>
@ -249,7 +260,8 @@ export default {
importing: false,
selectedImportFile: null,
importFileList: [],
downloadingTemplate: false
downloadingTemplate: false,
canViewData: false //
}
},
computed: {
@ -349,13 +361,35 @@ export default {
}
}
},
created() {
this.loadUserSelfRole()
this.loadData()
},
mounted() {
this.loadUserSelfRole()
// localStorage
if (this.hasViewPermission()) {
this.canViewData = true
this.loadData()
} else {
this.canViewData = false
this.tableData = []
}
//
this.loadUserSelfRole()
.then(() => {
//
if (this.hasViewPermission()) {
this.canViewData = true
//
if (this.tableData.length === 0) {
this.loadData()
}
} else {
this.canViewData = false
//
this.tableData = []
}
})
.catch(() => {
//
console.error('加载权限数据失败')
})
},
methods: {
// isAdmin === 1
@ -376,6 +410,31 @@ export default {
return false
}
},
//
hasViewPermission() {
// 1.
if (this.isAdmin()) {
return true
}
try {
const permissionDataStr = localStorage.getItem('user_self_role')
if (!permissionDataStr) {
return false
}
const permissionData = JSON.parse(permissionDataStr)
if (!Array.isArray(permissionData)) {
return false
}
// 2. permissionPath ""
return permissionData.some((perm) => {
const permissionPath = perm.permissionPath || ''
return permissionPath.includes('竞品发动机数据')
})
} catch (err) {
console.error('检查查看权限失败:', err)
return false
}
},
//
hasEngineDataEditPermission() {
//
@ -411,19 +470,26 @@ export default {
},
disableSuccessMsg: true
}
return new Promise((resolve, reject) => {
this.$request(request)
.asyncThen((resp) => {
if (resp && resp.data) {
// localStorage
try {
localStorage.setItem('user_self_role', JSON.stringify(resp.data))
resolve(resp.data)
} catch (err) {
console.error('存储权限数据到 localStorage 失败:', err)
reject(err)
}
} else {
resolve(null)
}
})
.asyncErrorCatch((err) => {
console.error('获取用户自身角色失败:', err)
reject(err)
})
})
},
handleRowDispatch(row, rowIndex) {

View File

@ -118,7 +118,9 @@
>
查看
</el-checkbox>
<!-- 审批流程菜单项只有查看权限没有编辑权限 -->
<el-checkbox
v-if="!isApprovalFlowMenu(data.label)"
v-model="data.permissions.edit"
size="small"
@change="handleNodePermissionChange(data, 'edit')"
@ -341,11 +343,13 @@ export default {
addRoleMode: 'add', // 'add' 'edit'
addRoleFormData: {
roleName: '',
roleCode: '',
roleDescription: '',
roleId: '' // 使
},
addRoleFormRules: {
roleName: [{ required: true, message: '请输入角色名称', trigger: 'blur' }],
roleCode: [{ required: true, message: '请输入角色代码', trigger: 'blur' }],
roleDescription: [{ required: true, message: '请输入角色描述', trigger: 'blur' }]
},
//
@ -360,7 +364,7 @@ export default {
//
pendingPermissions: [],
//
menuList: ['参数模板管理', '玉柴发动机数据', '竞品发动机数据', '对标报告'],
menuList: ['参数模板管理', '玉柴发动机数据', '竞品发动机数据', '对标报告','参数模板审批流程','玉柴发动机数据审批流程','竞品发动机数据审批流程','对标报告审批流程','基础管理模块'],
//
templateList: [],
//
@ -476,6 +480,16 @@ export default {
this.currentPersonRequest = null
},
methods: {
//
isApprovalFlowMenu(menuName) {
const approvalFlowMenus = [
'参数模板审批流程',
'玉柴发动机数据审批流程',
'竞品发动机数据审批流程',
'对标报告审批流程'
]
return approvalFlowMenus.includes(menuName)
},
getUserSelfRole() {
const request = {
...api.GET_USER_SELF_ROLE,
@ -573,13 +587,21 @@ export default {
// 使
this.menuList.forEach((menuName, menuIdx) => {
const menuId = `menu-${menuIdx}`
//
const leafMenus = [
'对标报告',
'参数模板审批流程',
'玉柴发动机数据审批流程',
'竞品发动机数据审批流程',
'对标报告审批流程'
]
const menuNode = {
id: menuId,
label: menuName,
type: 'menu',
children: null, // null
//
isLeaf: menuName === '对标报告',
//
isLeaf: leafMenus.includes(menuName),
permissions: {
view: false,
edit: false
@ -611,8 +633,16 @@ export default {
}
//
if (node.data.type === 'menu') {
//
if (node.data.label === '对标报告') {
//
const leafMenus = [
'对标报告',
'参数模板审批流程',
'玉柴发动机数据审批流程',
'竞品发动机数据审批流程',
'对标报告审批流程',
'基础管理模块'
]
if (leafMenus.includes(node.data.label)) {
resolve([])
return
}
@ -639,7 +669,7 @@ export default {
...api.GET_MODEL_LIST,
params: {
pageNumber: 1,
pageSize: 999
pageSize: 9999
},
disableSuccessMsg: true
}
@ -861,6 +891,16 @@ export default {
},
//
handleNodePermissionChange(data, permissionType) {
//
if (permissionType === 'edit' && data.type === 'menu' && this.isApprovalFlowMenu(data.label)) {
// false
this.$set(data.permissions, 'edit', false)
if (data.id && this.nodeMap[data.id]) {
this.$set(this.nodeMap[data.id].permissions, 'edit', false)
}
return
}
//
if (permissionType === 'edit' && data.permissions && data.permissions.edit === true) {
//
@ -910,6 +950,16 @@ export default {
const isChecked = menuNode.permissions[permissionType]
const menuName = menuNode.label || ''
//
if (permissionType === 'edit' && this.isApprovalFlowMenu(menuName)) {
// false
this.$set(menuNode.permissions, 'edit', false)
if (menuNode.id && this.nodeMap[menuNode.id]) {
this.$set(this.nodeMap[menuNode.id].permissions, 'edit', false)
}
return
}
//
if (permissionType === 'edit' && isChecked) {
this.$set(menuNode.permissions, 'view', true)
@ -1004,8 +1054,12 @@ export default {
}
})
})
} else if (menuName === '对标报告') {
//
} else if (menuName === '对标报告' ||
menuName === '参数模板审批流程' ||
menuName === '玉柴发动机数据审批流程' ||
menuName === '竞品发动机数据审批流程' ||
menuName === '对标报告审批流程') {
//
const menuPath = this.buildPermissionPath(menuNode)
if (menuPath) {
const existingPerm = this.pendingPermissions.find(
@ -1059,7 +1113,11 @@ export default {
}
})
})
} else if (menuName === '对标报告') {
} else if (menuName === '对标报告' ||
menuName === '参数模板审批流程' ||
menuName === '玉柴发动机数据审批流程' ||
menuName === '竞品发动机数据审批流程' ||
menuName === '对标报告审批流程') {
const menuPath = this.buildPermissionPath(menuNode)
if (menuPath) {
const existingPerm = this.pendingPermissions.find(
@ -1079,14 +1137,23 @@ export default {
// pendingPermissions
if (this.pendingPermissions) {
const parameterPer = permissionType === 'view' ? 1 : 2
//
const leafMenus = [
'对标报告',
'参数模板审批流程',
'玉柴发动机数据审批流程',
'竞品发动机数据审批流程',
'对标报告审批流程'
]
//
this.pendingPermissions = this.pendingPermissions.filter((perm) => {
//
if (perm.permissionPath && perm.permissionPath.startsWith(menuName + '/')) {
return perm.parameterPer !== parameterPer
}
//
if (menuName === '对标报告' && perm.permissionPath === menuName) {
//
if (leafMenus.includes(menuName) && perm.permissionPath === menuName) {
return perm.parameterPer !== parameterPer
}
return true
@ -1099,7 +1166,7 @@ export default {
if (perm.permissionPath && perm.permissionPath.startsWith(menuName + '/')) {
return perm.parameterPer !== viewParameterPer
}
if (menuName === '对标报告' && perm.permissionPath === menuName) {
if (leafMenus.includes(menuName) && perm.permissionPath === menuName) {
return perm.parameterPer !== viewParameterPer
}
return true
@ -1278,6 +1345,7 @@ export default {
this.addRoleDialogVisible = true
this.addRoleFormData = {
roleName: '',
roleCode: '',
roleDescription: '',
roleId: ''
}
@ -1336,6 +1404,7 @@ export default {
this.addRoleMode = 'add'
this.addRoleFormData = {
roleName: '',
roleCode: '',
roleDescription: '',
roleId: ''
}
@ -1493,7 +1562,7 @@ export default {
//
loadDepartmentList() {
const request = {
...api.QUERY_ORG_TREE,
...api.GET_DEPT_OF_USER,
disableSuccessMsg: true
}
this.$request(request)
@ -1501,7 +1570,7 @@ export default {
// { id, name, children }
let result = []
if (resp && resp.data) {
result = resp.data.result || resp.data.data || resp.data || []
result = resp.data
}
//
this.departmentList = this.formatDepartmentTreeData(result)
@ -1854,6 +1923,7 @@ export default {
this.addRoleDialogVisible = true
this.addRoleFormData = {
roleName: row.roleName || '',
roleCode: row.roleCode || '',
roleDescription: row.roleDescription || '',
roleId: row.rowId || row.id || ''
}
@ -1915,9 +1985,12 @@ export default {
const permData = permissionMap.get(permissionPath)
// parameterPer 12
//
const isApprovalFlow = this.isApprovalFlowMenu(permissionPath)
if (perm.parameterPer === 1 || perm.parameterPer === '1' || perm.parameterPer === '查看') {
permData.view = true
} else if (perm.parameterPer === 2 || perm.parameterPer === '2' || perm.parameterPer === '编辑') {
} else if ((perm.parameterPer === 2 || perm.parameterPer === '2' || perm.parameterPer === '编辑') && !isApprovalFlow) {
//
permData.edit = true
}
})
@ -1942,6 +2015,10 @@ export default {
view: permData.view || false,
edit: permData.edit || false
}
//
if (node.type === 'menu' && this.isApprovalFlowMenu(node.label)) {
newPermissions.edit = false
}
//
if (newPermissions.edit && !newPermissions.view) {
newPermissions.view = true
@ -2042,6 +2119,11 @@ export default {
hasView = true
}
//
if (node.type === 'menu' && this.isApprovalFlowMenu(node.label)) {
hasEdit = false
}
// 使 $set
const newPermissions = {
view: hasView,
@ -2150,8 +2232,8 @@ export default {
permissions.push(perm)
}
//
if (nodePermissions.edit) {
//
if (nodePermissions.edit && !(node.type === 'menu' && this.isApprovalFlowMenu(node.label))) {
const perm = {
permissionPath: permissionPath,
parameterPer: 2, // 2

View File

@ -232,7 +232,14 @@
<template slot="empty">
<div class="table-empty">
<template v-if="canViewData">
<x-empty-page></x-empty-page>
</template>
<template v-else>
<div style="padding: 40px 0; text-align: center; color: #909399;">
<div style="font-size: 14px;">无权限查看</div>
</div>
</template>
</div>
</template>
</x-vxe-table>
@ -721,7 +728,8 @@ export default {
currentApprovalRow: null,
showReportDetail: false,
currentReportDetail: null,
downloadingRowId: ''
downloadingRowId: '',
canViewData: false //
}
},
computed: {
@ -767,13 +775,35 @@ export default {
}
}
},
created() {
this.loadUserSelfRole()
this.loadData()
},
mounted() {
this.loadUserSelfRole()
// localStorage
if (this.hasViewPermission()) {
this.canViewData = true
this.loadData()
} else {
this.canViewData = false
this.tableData = []
}
//
this.loadUserSelfRole()
.then(() => {
//
if (this.hasViewPermission()) {
this.canViewData = true
//
if (this.tableData.length === 0) {
this.loadData()
}
} else {
this.canViewData = false
//
this.tableData = []
}
})
.catch(() => {
//
console.error('加载权限数据失败')
})
},
methods: {
// isAdmin === 1
@ -794,6 +824,31 @@ export default {
return false
}
},
//
hasViewPermission() {
// 1.
if (this.isAdmin()) {
return true
}
try {
const permissionDataStr = localStorage.getItem('user_self_role')
if (!permissionDataStr) {
return false
}
const permissionData = JSON.parse(permissionDataStr)
if (!Array.isArray(permissionData)) {
return false
}
// 2. permissionPath ""
return permissionData.some((perm) => {
const permissionPath = perm.permissionPath || ''
return permissionPath.includes('对标报告')
})
} catch (err) {
console.error('检查查看权限失败:', err)
return false
}
},
//
hasReportEditPermission() {
//
@ -829,19 +884,26 @@ export default {
},
disableSuccessMsg: true
}
return new Promise((resolve, reject) => {
this.$request(request)
.asyncThen((resp) => {
if (resp && resp.data) {
// localStorage
try {
localStorage.setItem('user_self_role', JSON.stringify(resp.data))
resolve(resp.data)
} catch (err) {
console.error('存储权限数据到 localStorage 失败:', err)
reject(err)
}
} else {
resolve(null)
}
})
.asyncErrorCatch((err) => {
console.error('获取用户自身角色失败:', err)
reject(err)
})
})
},
handleCreate() {

View File

@ -183,7 +183,14 @@
<template slot="empty">
<div class="table-empty">
<template v-if="canViewData">
<x-empty-page></x-empty-page>
</template>
<template v-else>
<div style="padding: 40px 0; text-align: center; color: #909399;">
<div style="font-size: 14px;">无权限查看</div>
</div>
</template>
</div>
</template>
</x-vxe-table>
@ -568,7 +575,8 @@ export default {
currentApprovalRow: null,
showReportDetail: false,
currentReportDetail: null,
downloadingRowId: ''
downloadingRowId: '',
canViewData: false //
}
},
computed: {
@ -607,10 +615,111 @@ export default {
}
}
},
created() {
mounted() {
// localStorage
if (this.hasViewPermission()) {
this.canViewData = true
this.loadData()
} else {
this.canViewData = false
this.tableData = []
}
//
this.loadUserSelfRole()
.then(() => {
//
if (this.hasViewPermission()) {
this.canViewData = true
//
if (this.tableData.length === 0) {
this.loadData()
}
} else {
this.canViewData = false
//
this.tableData = []
}
})
.catch(() => {
//
console.error('加载权限数据失败')
})
},
methods: {
// isAdmin === 1
isAdmin() {
try {
const permissionDataStr = localStorage.getItem('user_self_role')
if (!permissionDataStr) {
return false
}
const permissionData = JSON.parse(permissionDataStr)
if (!Array.isArray(permissionData)) {
return false
}
// isAdmin === 1
return permissionData.some((perm) => perm.isAdmin === 1 || perm.isAdmin === '1')
} catch (err) {
console.error('检查管理员权限失败:', err)
return false
}
},
//
hasViewPermission() {
// 1.
if (this.isAdmin()) {
return true
}
try {
const permissionDataStr = localStorage.getItem('user_self_role')
if (!permissionDataStr) {
return false
}
const permissionData = JSON.parse(permissionDataStr)
if (!Array.isArray(permissionData)) {
return false
}
// 2. permissionPath ""
return permissionData.some((perm) => {
const permissionPath = perm.permissionPath || ''
return permissionPath.includes('对标报告审批流程')
})
} catch (err) {
console.error('检查查看权限失败:', err)
return false
}
},
//
loadUserSelfRole() {
const request = {
...api.GET_USER_SELF_ROLE,
params: {
userOrDepID: getUserId()
},
disableSuccessMsg: true
}
return new Promise((resolve, reject) => {
this.$request(request)
.asyncThen((resp) => {
if (resp && resp.data) {
// localStorage
try {
localStorage.setItem('user_self_role', JSON.stringify(resp.data))
resolve(resp.data)
} catch (err) {
console.error('存储权限数据到 localStorage 失败:', err)
reject(err)
}
} else {
resolve(null)
}
})
.asyncErrorCatch((err) => {
console.error('获取用户自身角色失败:', err)
reject(err)
})
})
},
handleCreate() {
this.dialogMode = 'create'
this.currentRestartRow = null

View File

@ -113,7 +113,14 @@
<template slot="empty">
<div class="table-empty">
<template v-if="canViewData">
<x-empty-page></x-empty-page>
</template>
<template v-else>
<div style="padding: 40px 0; text-align: center; color: #909399;">
<div style="font-size: 14px;">无权限查看</div>
</div>
</template>
</div>
</template>
</x-vxe-table>
@ -209,7 +216,8 @@ export default {
//
applicantOptions: [],
applicantLoading: false,
applicantSearchTimer: null //
applicantSearchTimer: null, //
canViewData: false //
}
},
computed: {
@ -276,9 +284,35 @@ export default {
}
}
},
created() {
this.loadUserSelfRole()
mounted() {
// localStorage
if (this.hasViewPermission()) {
this.canViewData = true
this.loadData()
} else {
this.canViewData = false
this.tableData = []
}
//
this.loadUserSelfRole()
.then(() => {
//
if (this.hasViewPermission()) {
this.canViewData = true
//
if (this.tableData.length === 0) {
this.loadData()
}
} else {
this.canViewData = false
//
this.tableData = []
}
})
.catch(() => {
//
console.error('加载权限数据失败')
})
},
beforeDestroy() {
//
@ -350,6 +384,49 @@ export default {
//
return this.isApplicant(row)
},
// isAdmin === 1
isAdmin() {
try {
const permissionDataStr = localStorage.getItem('user_self_role')
if (!permissionDataStr) {
return false
}
const permissionData = JSON.parse(permissionDataStr)
if (!Array.isArray(permissionData)) {
return false
}
// isAdmin === 1
return permissionData.some((perm) => perm.isAdmin === 1 || perm.isAdmin === '1')
} catch (err) {
console.error('检查管理员权限失败:', err)
return false
}
},
//
hasViewPermission() {
// 1.
if (this.isAdmin()) {
return true
}
try {
const permissionDataStr = localStorage.getItem('user_self_role')
if (!permissionDataStr) {
return false
}
const permissionData = JSON.parse(permissionDataStr)
if (!Array.isArray(permissionData)) {
return false
}
// 2. permissionPath ""
return permissionData.some((perm) => {
const permissionPath = perm.permissionPath || ''
return permissionPath.includes('玉柴发动机数据审批流程')
})
} catch (err) {
console.error('检查查看权限失败:', err)
return false
}
},
//
loadUserSelfRole() {
const request = {
@ -359,19 +436,26 @@ export default {
},
disableSuccessMsg: true
}
return new Promise((resolve, reject) => {
this.$request(request)
.asyncThen((resp) => {
if (resp && resp.data) {
// localStorage
try {
localStorage.setItem('user_self_role', JSON.stringify(resp.data))
resolve(resp.data)
} catch (err) {
console.error('存储权限数据到 localStorage 失败:', err)
reject(err)
}
} else {
resolve(null)
}
})
.asyncErrorCatch((err) => {
console.error('获取用户自身角色失败:', err)
reject(err)
})
})
},
pageSizeChange(size) {

View File

@ -56,6 +56,7 @@
<el-option label="已分发" value="已分发" />
<el-option label="部分分发" value="部分分发" />
<el-option label="未分发" value="未分发" />
<el-option label="已完成" value="已完成" />
</el-select>
</div>
<div class="search-actions">
@ -139,6 +140,9 @@
<span v-else-if="row[colConfig.prop] === '未分发'" class="status-tag status-pending">
未分发
</span>
<span v-else-if="row[colConfig.prop] === '已完成'" class="status-tag status-done">
已完成
</span>
</div>
<div v-if="colConfig.customSlot === 'versionNumber'" :key="index + '' + rowIndex">
V{{ row[colConfig.prop] || '' }}
@ -147,7 +151,14 @@
<template slot="empty">
<div class="table-empty">
<template v-if="canViewData">
<x-empty-page></x-empty-page>
</template>
<template v-else>
<div style="padding: 40px 0; text-align: center; color: #909399;">
<div style="font-size: 14px;">无权限查看</div>
</div>
</template>
</div>
</template>
</x-vxe-table>
@ -249,7 +260,8 @@ export default {
importing: false,
selectedImportFile: null,
importFileList: [],
downloadingTemplate: false
downloadingTemplate: false,
canViewData: false //
}
},
computed: {
@ -349,13 +361,35 @@ export default {
}
}
},
created() {
this.loadUserSelfRole()
this.loadData()
},
mounted() {
this.loadUserSelfRole()
// localStorage
if (this.hasViewPermission()) {
this.canViewData = true
this.loadData()
} else {
this.canViewData = false
this.tableData = []
}
//
this.loadUserSelfRole()
.then(() => {
//
if (this.hasViewPermission()) {
this.canViewData = true
//
if (this.tableData.length === 0) {
this.loadData()
}
} else {
this.canViewData = false
//
this.tableData = []
}
})
.catch(() => {
//
console.error('加载权限数据失败')
})
},
methods: {
// isAdmin === 1
@ -376,6 +410,31 @@ export default {
return false
}
},
//
hasViewPermission() {
// 1.
if (this.isAdmin()) {
return true
}
try {
const permissionDataStr = localStorage.getItem('user_self_role')
if (!permissionDataStr) {
return false
}
const permissionData = JSON.parse(permissionDataStr)
if (!Array.isArray(permissionData)) {
return false
}
// 2. permissionPath ""
return permissionData.some((perm) => {
const permissionPath = perm.permissionPath || ''
return permissionPath.includes('玉柴发动机数据')
})
} catch (err) {
console.error('检查查看权限失败:', err)
return false
}
},
//
hasEngineDataEditPermission() {
//
@ -411,19 +470,26 @@ export default {
},
disableSuccessMsg: true
}
return new Promise((resolve, reject) => {
this.$request(request)
.asyncThen((resp) => {
if (resp && resp.data) {
// localStorage
try {
localStorage.setItem('user_self_role', JSON.stringify(resp.data))
resolve(resp.data)
} catch (err) {
console.error('存储权限数据到 localStorage 失败:', err)
reject(err)
}
} else {
resolve(null)
}
})
.asyncErrorCatch((err) => {
console.error('获取用户自身角色失败:', err)
reject(err)
})
})
},
handleRowDispatch(row, rowIndex) {

View File

@ -88,8 +88,8 @@
:visible="showEngineCheck"
:engine-type="engineType"
:from-todo="fromTodo"
@refresh="handleBackFromCheck"
class="engine-check-wrapper"
@refresh="handleBackFromCheck"
@close="handleBackFromCheck"
/>
@ -224,6 +224,8 @@ export default {
mounted() {
this.loadData()
this.filterTemplateManagementPermissions()
// URLflowId
this.checkFlowIdFromUrl()
},
methods: {
pageSizeChange(size) {
@ -567,6 +569,35 @@ export default {
console.error('日期格式化错误:', error)
return cellValue
}
},
checkFlowIdFromUrl() {
// URLflowId
const flowId = this.$route && this.$route.query && this.$route.query.flowId
if (flowId) {
const request = {
...api.GET_YC_TODO_LIST,
params: {
flowId: flowId
},
disableSuccessMsg: true
}
this.$request(request)
.asyncThen((resp) => {
// handleRowView
if (resp && resp.data) {
//
const rowData = resp.data.result || resp.data.data || resp.data
// rowData
if (rowData && (rowData.dataType || rowData.documentNo || rowData.modelId)) {
this.handleRowView(rowData)
}
}
})
.asyncErrorCatch((err) => {
console.error('根据flowId获取待办数据失败:', err)
this.$message.error('获取待办数据失败')
})
}
}
}
}