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: { EDIT_CHART_COMMONLY_USED: {
url: '/custom/common/updateChartCommon', url: '/custom/common/updateChartCommon',
method: 'post' 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"> <template slot="empty">
<div class="table-empty"> <div class="table-empty">
<template v-if="canViewData">
<x-empty-page></x-empty-page> <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> </div>
</template> </template>
</x-vxe-table> </x-vxe-table>
@ -221,7 +228,8 @@ export default {
opinion: '' opinion: ''
}, },
approvalSubmitting: false, approvalSubmitting: false,
currentApprovalRow: null currentApprovalRow: null,
canViewData: false //
} }
}, },
computed: { computed: {
@ -267,11 +275,80 @@ export default {
} }
} }
}, },
created() { mounted() {
this.loadUserSelfRole() // localStorage
if (this.hasViewPermission()) {
this.canViewData = true
this.loadData() 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: { 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() { loadUserSelfRole() {
const request = { const request = {
@ -281,19 +358,26 @@ export default {
}, },
disableSuccessMsg: true disableSuccessMsg: true
} }
return new Promise((resolve, reject) => {
this.$request(request) this.$request(request)
.asyncThen((resp) => { .asyncThen((resp) => {
if (resp && resp.data) { if (resp && resp.data) {
// localStorage // localStorage
try { try {
localStorage.setItem('user_self_role', JSON.stringify(resp.data)) localStorage.setItem('user_self_role', JSON.stringify(resp.data))
resolve(resp.data)
} catch (err) { } catch (err) {
console.error('存储权限数据到 localStorage 失败:', err) console.error('存储权限数据到 localStorage 失败:', err)
reject(err)
} }
} else {
resolve(null)
} }
}) })
.asyncErrorCatch((err) => { .asyncErrorCatch((err) => {
console.error('获取用户自身角色失败:', err) console.error('获取用户自身角色失败:', err)
reject(err)
})
}) })
}, },
pageSizeChange(size) { pageSizeChange(size) {

View File

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

View File

@ -162,7 +162,16 @@
<template slot="empty"> <template slot="empty">
<div class="table-empty"> <div class="table-empty">
<template v-if="canViewData">
<x-empty-page></x-empty-page> <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> </div>
</template> </template>
</x-vxe-table> </x-vxe-table>
@ -509,7 +518,8 @@ export default {
currentApprovalRow: null, currentApprovalRow: null,
showReportDetail: false, showReportDetail: false,
currentReportDetail: null, currentReportDetail: null,
downloadingRowId: '' downloadingRowId: '',
canViewData: false //
} }
}, },
computed: { computed: {
@ -555,10 +565,137 @@ export default {
} }
} }
}, },
created() { mounted() {
// localStorage
if (this.hasViewPermission()) {
this.canViewData = true
this.loadData() 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: { 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() { handleCreate() {
this.dialogMode = 'create' this.dialogMode = 'create'
this.currentRestartRow = null this.currentRestartRow = null

View File

@ -997,7 +997,9 @@ export default {
const request = { const request = {
...api.GET_CHECK_DATA_Y_DATA, ...api.GET_CHECK_DATA_Y_DATA,
params: {}, params: {
userId: getUserId()
},
disableSuccessMsg: true disableSuccessMsg: true
} }
this.$request(request) 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-option v-for="ver in versions" :key="ver.id" :label="ver.label" :value="ver.id" />
</el-select> --> </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>
<el-button
v-if="hasAnyEditPermission() && detail && detail.distributeStatus === '已完成'"
size="small"
@click="handleEdit">
编辑
</el-button>
<el-button <el-button
v-if="!isEditMode && !isJustCheckMode" v-if="!isEditMode && !isJustCheckMode"
size="small" size="small"
@ -101,6 +107,17 @@
{{ shouldShowResendButton ? '发起' : '发起审批' }} {{ shouldShowResendButton ? '发起' : '发起审批' }}
</el-button> </el-button>
</template> </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"> <template v-else-if="isEditMode">
<el-button size="small" @click="handleSaveEdit">保存编辑</el-button> <el-button size="small" @click="handleSaveEdit">保存编辑</el-button>
<el-button size="small" @click="handleCancelEdit">取消</el-button> <el-button size="small" @click="handleCancelEdit">取消</el-button>
@ -242,6 +259,7 @@
size="small" size="small"
placeholder="请输入" placeholder="请输入"
class="param-input" class="param-input"
:disabled="!hasParameterEditPermission(row.parameterName, row.subsystemName, row.partsName)"
/> />
<span v-else-if="!isEditMode && !isDispatchMode && filledBy">{{ <span v-else-if="!isEditMode && !isDispatchMode && filledBy">{{
row.minorVersion || row.parameterValue || '/' row.minorVersion || row.parameterValue || '/'
@ -606,6 +624,7 @@ export default {
approvalChangeData: [], // approvalChangeData: [], //
resending: false, // loading resending: false, // loading
isResendMode: false, // isResendMode: false, //
hasSavedInCheckMode: false, //
resendApprovalData: { resendApprovalData: {
nodeList: [], nodeList: [],
processTitle: '', processTitle: '',
@ -671,6 +690,36 @@ export default {
isJustCheckMode() { isJustCheckMode() {
return this.dispatchType === 'justCheck' 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() { isWholeEngineParamsSelected() {
if (!this.checkedKeys || this.checkedKeys.length === 0) { if (!this.checkedKeys || this.checkedKeys.length === 0) {
@ -832,11 +881,11 @@ export default {
if (this.isApprovalMode) { if (this.isApprovalMode) {
// 使 detail.createdBy // 使 detail.createdBy
if (this.detail?.flowId && this.shouldShowResendButton) { 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) { if (!this.detail?.flowId) {
return this.detail?.currentProcessor || '--' return this.userInfo?.username || this.userInfo?.userName || this.detail?.currentProcessor || '--'
} }
} }
// 使 detail.createBy // 使 detail.createBy
@ -881,7 +930,7 @@ export default {
if (this.isApprovalMode) { if (this.isApprovalMode) {
// 使 detail.currentProcessor // 使 detail.currentProcessor
if (!this.detail?.flowId || (this.detail?.flowId && this.shouldShowResendButton)) { if (!this.detail?.flowId || (this.detail?.flowId && this.shouldShowResendButton)) {
return this.detail?.currentProcessor || '--' return this.detail?.currentProcessor || this.userInfo?.userName || '--'
} }
} }
// 使 currentProcessor // 使 currentProcessor
@ -912,6 +961,7 @@ export default {
} }
}, },
created() { created() {
this.getUserInfo()
// // engineModelID使 props使 route query // // engineModelID使 props使 route query
// if ( // if (
// !this.engineModelID && // !this.engineModelID &&
@ -942,6 +992,25 @@ export default {
// this.loadEngineDetailInfo() // this.loadEngineDetailInfo()
}, },
methods: { 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() { getversions() {
// 使 props engineModelID modelId // 使 props engineModelID modelId
if (!this.engineModelID) { if (!this.engineModelID) {
@ -1059,10 +1128,11 @@ export default {
}, },
// menuPath model // menuPath model
getMenuPath() { getMenuPath() {
// model // detail
// // detail ycOrOth
// // detail ycOrOth 使
return '玉柴发动机数据' // '' const engineType = this.detail?.ycOrOth || this.detail?.ycOrOt || '玉柴'
return engineType === '竞品' ? '竞品发动机数据' : '玉柴发动机数据'
}, },
// isAdmin === 1 // isAdmin === 1
hasAdminPermission() { hasAdminPermission() {
@ -1166,19 +1236,19 @@ export default {
const menuPath = this.getMenuPath() const menuPath = this.getMenuPath()
return this.checkPermission(menuPath, subsystem, '编辑') return this.checkPermission(menuPath, subsystem, '编辑')
}, },
// parameterName //
hasParameterEditPermission(parameterName, subsystemName = null) { // parameterName:
// // subsystemName:
// partsName:
hasParameterEditPermission(parameterName, subsystemName = null, partsName = null) {
// isAdmin 1
if (this.hasAdminPermission()) { if (this.hasAdminPermission()) {
return true return true
} }
//
if (this.hasGlobalEditPermission()) { // permissionPath
return true const engineTypePath = this.getMenuPath() // '' ''
}
if (!parameterName) {
return false
}
try { try {
const permissionDataStr = localStorage.getItem('user_self_role') const permissionDataStr = localStorage.getItem('user_self_role')
if (!permissionDataStr) { if (!permissionDataStr) {
@ -1189,31 +1259,86 @@ export default {
return false return false
} }
const menuPath = this.getMenuPath() // permissionPath """" parameterPer ""
const hasGlobalEdit = permissionData.some((perm) => {
// menuPathsubsystemparameterNameparameterPer"" const permissionPath = perm.permissionPath || ''
const matchedPermissions = permissionData.filter((perm) => { const parameterPer = perm.parameterPer || ''
// menuPath // permissionPath engineTypePath parameterPer ""
const menuMatch = return permissionPath === engineTypePath && parameterPer === '编辑'
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 === '编辑'
}) })
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) { } catch (err) {
console.error('检查参数权限失败:', err) console.error('检查参数权限失败:', err)
return false return false
@ -1246,16 +1371,16 @@ export default {
return false return false
} }
}, },
// // 使
hasAnyEditPermission() { hasAnyEditPermission() {
// // isAdmin 1
if (this.hasAdminPermission()) { if (this.hasAdminPermission()) {
return true return true
} }
//
if (this.hasGlobalEditPermission()) { // permissionPath
return true const engineTypePath = this.getMenuPath() // '' ''
}
try { try {
const permissionDataStr = localStorage.getItem('user_self_role') const permissionDataStr = localStorage.getItem('user_self_role')
if (!permissionDataStr) { if (!permissionDataStr) {
@ -1266,16 +1391,28 @@ export default {
return false return false
} }
const menuPath = this.getMenuPath() // permissionPath """" parameterPer ""
const hasGlobalEdit = permissionData.some((perm) => {
// const permissionPath = perm.permissionPath || ''
const matchedPermissions = permissionData.filter((perm) => { const parameterPer = perm.parameterPer || ''
const menuMatch = // permissionPath engineTypePath parameterPer ""
perm.menuPath && (perm.menuPath.includes(menuPath) || menuPath.includes(perm.menuPath)) return permissionPath === engineTypePath && parameterPer === '编辑'
return menuMatch && perm.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) { } catch (err) {
console.error('检查编辑权限失败:', err) console.error('检查编辑权限失败:', err)
return false return false
@ -1953,6 +2090,11 @@ export default {
this.originalData = null this.originalData = null
this.changeData = [] // this.changeData = [] //
// 便
if (this.isJustCheckMode) {
this.hasSavedInCheckMode = true
}
// //
this.loadEngineDetail() this.loadEngineDetail()
this.$message({ this.$message({
@ -1987,6 +2129,7 @@ export default {
this.isEditMode = false this.isEditMode = false
this.originalData = null this.originalData = null
this.changeData = [] // this.changeData = [] //
// hasSavedInCheckMode
}, },
handleBatchModifyResponsible() { handleBatchModifyResponsible() {
// //
@ -2284,6 +2427,7 @@ export default {
...api.GET_ENGINE_TABLE_DETAIL, ...api.GET_ENGINE_TABLE_DETAIL,
params: { params: {
modelID: this.detail.id, modelID: this.detail.id,
userID: getUserId(),
parameterVersion: this.currentVersionId || 1 // 1 parameterVersion: this.currentVersionId || 1 // 1
}, },
disableSuccessMsg: true disableSuccessMsg: true
@ -2399,24 +2543,11 @@ export default {
const secondLevelData = data[firstLevelKey] const secondLevelData = data[firstLevelKey]
if (typeof secondLevelData === 'object' && !Array.isArray(secondLevelData)) { if (typeof secondLevelData === 'object' && !Array.isArray(secondLevelData)) {
//
const isAdmin = this.hasAdminPermission()
// """" // """"
Object.keys(secondLevelData).forEach((subsystemName, secondIdx) => { Object.keys(secondLevelData).forEach((subsystemName, secondIdx) => {
const secondLevelId = `${firstLevelId}-${secondIdx}` const secondLevelId = `${firstLevelId}-${secondIdx}`
const isWholeEngineParams = subsystemName === '整车参数' const isWholeEngineParams = subsystemName === '整车参数'
//
// ""
if (!isWholeEngineParams && !isAdmin) {
//
if (!this.hasSubsystemPermission(subsystemName)) {
//
return
}
}
const thirdLevelParams = secondLevelData[subsystemName] || [] const thirdLevelParams = secondLevelData[subsystemName] || []
const thirdLevelChildren = [] const thirdLevelChildren = []
@ -3299,7 +3430,11 @@ export default {
this.isApprovalMode = true this.isApprovalMode = true
// //
const productModel = this.detail?.modelName || '产品型号' 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 = { this.approvalFormData = {
processTitle: `${productModel}-${statusCode}发起审批`, processTitle: `${productModel}-${statusCode}发起审批`,
description: '' description: ''
@ -3424,7 +3559,10 @@ export default {
this.isApprovalMode = true this.isApprovalMode = true
// //
const productModel = this.detail?.modelName || '产品型号' 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 = { this.approvalFormData = {
processTitle: `${productModel}-${statusCode}发起审批`, processTitle: `${productModel}-${statusCode}发起审批`,
description: '' description: ''
@ -3542,6 +3680,7 @@ export default {
loading: false loading: false
} }
] ]
// hasSavedInCheckMode
}, },
// //
canResendApproval() { canResendApproval() {
@ -3925,6 +4064,10 @@ export default {
}) })
this.approvalSubmitting = false this.approvalSubmitting = false
this.isApprovalMode = false this.isApprovalMode = false
//
if (this.isJustCheckMode) {
this.hasSavedInCheckMode = false
}
this.handleBack() this.handleBack()
}) })
.asyncErrorCatch((err) => { .asyncErrorCatch((err) => {
@ -3959,6 +4102,10 @@ export default {
}) })
this.approvalSubmitting = false this.approvalSubmitting = false
this.isApprovalMode = false this.isApprovalMode = false
//
if (this.isJustCheckMode) {
this.hasSavedInCheckMode = false
}
this.handleBack() this.handleBack()
}) })
.asyncErrorCatch((err) => { .asyncErrorCatch((err) => {
@ -4010,6 +4157,10 @@ export default {
}) })
this.approvalSubmitting = false this.approvalSubmitting = false
this.isApprovalMode = false this.isApprovalMode = false
//
if (this.isJustCheckMode) {
this.hasSavedInCheckMode = false
}
this.handleBack() this.handleBack()
}) })
.asyncErrorCatch((err) => { .asyncErrorCatch((err) => {

View File

@ -5,7 +5,7 @@
<div class="title"> <div class="title">
责任人管理 责任人管理
</div> </div>
<div> <div v-if="hasEditPermission()">
<el-button type="primary" @click="handleAdd"> <el-button type="primary" @click="handleAdd">
新增 新增
</el-button> </el-button>
@ -61,6 +61,7 @@
align="center" align="center"
/> />
<el-table-column <el-table-column
v-if="hasEditPermission()"
label="操作" label="操作"
width="200" width="200"
align="center" align="center"
@ -83,6 +84,24 @@
</a> </a>
</template> </template>
</el-table-column> </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> </el-table>
<div class="pagination-section"> <div class="pagination-section">
<el-pagination <el-pagination
@ -312,7 +331,8 @@ export default {
importDialogVisible: false, // importDialogVisible: false, //
importFileList: [], // importFileList: [], //
selectedImportFile: null, // selectedImportFile: null, //
importing: false // importing: false, //
canViewData: false //
} }
}, },
computed: { computed: {
@ -327,9 +347,36 @@ export default {
}, },
mounted() { mounted() {
this.loadDepartmentList() this.loadDepartmentList()
this.loadManagerData()
this.isResponsible() this.isResponsible()
this.loadSubsystemList() 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() { beforeDestroy() {
// //
@ -340,6 +387,111 @@ export default {
this.currentRequest = null this.currentRequest = null
}, },
methods: { 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() { loadSubsystemList() {
const request = { const request = {
...api.GET_SUBSYSTEM_LIST, ...api.GET_SUBSYSTEM_LIST,
@ -418,20 +570,17 @@ export default {
}, },
loadDepartmentList() { loadDepartmentList() {
const request = { const request = {
...api.QUERY_ORG_TREE, ...api.GET_DEPT_OF_USER,
// params: {
// departmentId: this.formData.departmentId
// },
disableSuccessMsg: true disableSuccessMsg: true
} }
this.$request(request) this.$request(request)
.asyncThen((resp) => { .asyncThen((resp) => {
// { id, name, children } // { id, name }
let result = [] let result = []
if (resp && resp.data) { if (resp && resp.data) {
result = resp.data.result || resp.data.data || resp.data || [] result = resp.data
} }
// //
this.departmentList = this.formatDepartmentTreeData(result) this.departmentList = this.formatDepartmentTreeData(result)
}) })
.asyncErrorCatch((err) => { .asyncErrorCatch((err) => {
@ -439,29 +588,17 @@ export default {
this.departmentList = [] this.departmentList = []
}) })
}, },
// //
formatDepartmentTreeData(data) { formatDepartmentTreeData(data) {
if (!Array.isArray(data)) { if (!Array.isArray(data)) {
return [] return []
} }
// id name // id name
const formatNode = (node) => { return data.map((node) => ({
const formatted = {
id: node.id, id: node.id,
name: node.name || node.label || '', name: node.name
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))
}, },
handleAdd() { handleAdd() {
this.dialogMode = 'add' this.dialogMode = 'add'

View File

@ -160,6 +160,7 @@
@close="handleAddModelDialogClose" @close="handleAddModelDialogClose"
> >
<div class="model-select-dialog"> <div class="model-select-dialog">
<template v-if="!isUserPermissionsEmpty()">
<el-input <el-input
v-model="modelSearchText" v-model="modelSearchText"
placeholder="请输入产品型号,状态代号/产品编号,平台,系列搜索" placeholder="请输入产品型号,状态代号/产品编号,平台,系列搜索"
@ -187,6 +188,14 @@
<el-table-column prop="series" label="系列" min-width="70" /> <el-table-column prop="series" label="系列" min-width="70" />
</el-table> </el-table>
</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> </div>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="handleAddModelDialogClose">取消</el-button> <el-button @click="handleAddModelDialogClose">取消</el-button>
@ -292,6 +301,7 @@
<script> <script>
import api from '@/api' import api from '@/api'
import { getUserId } from '@/utils' import { getUserId } from '@/utils'
import '@/assets/scss/apaas-custom-hello.css'
export default { export default {
name: 'ModelQuery', name: 'ModelQuery',
@ -342,7 +352,9 @@ export default {
// //
savedAllParametersData: {}, // { "": [{ parameterName, parameterId, ... }] } savedAllParametersData: {}, // { "": [{ parameterName, parameterId, ... }] }
// 使 true false // 使 true false
useCommonFilter: false useCommonFilter: false,
//
userPermissions: [] // localStorage
} }
}, },
computed: { computed: {
@ -596,13 +608,183 @@ export default {
if (this.$refs.paramTree && this.treeFilterText) { if (this.$refs.paramTree && this.treeFilterText) {
this.$refs.paramTree.filter(this.treeFilterText) this.$refs.paramTree.filter(this.treeFilterText)
} }
},
//
userPermissions: {
handler() {
//
this.$nextTick(() => {
this.$forceUpdate()
})
},
deep: true
} }
}, },
mounted() { mounted() {
//
this.loadUserSelfRole()
// loadFavoritesList // loadFavoritesList
console.log('加载树数据')
this.loadTreeData() this.loadTreeData()
}, },
methods: { 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) { filterTreeNode(value, data) {
if (!value) return true if (!value) return true
const searchValue = value.toLowerCase() const searchValue = value.toLowerCase()
@ -659,7 +841,7 @@ export default {
this.reloadModelDetailsForCheckedNodes() this.reloadModelDetailsForCheckedNodes()
}, },
getParamValue(model, param) { getParamValue(model, param) {
// param { parameterName, subsystemName, parameterId } // param { parameterName, subsystemName, parameterId, partsName }
if (!model || !model.id || !param) { if (!model || !model.id || !param) {
return '-' return '-'
} }
@ -668,6 +850,12 @@ export default {
const parameterVersion = model.parameterVersion || 1 const parameterVersion = model.parameterVersion || 1
const modelKey = `${model.id}_${parameterVersion}` const modelKey = `${model.id}_${parameterVersion}`
//
//
if (!this.hasParamPermission(model, param)) {
return '-'
}
// "" // ""
if (param.subsystemName === '整车参数') { if (param.subsystemName === '整车参数') {
const paramNameToFieldMap = { const paramNameToFieldMap = {
@ -830,6 +1018,7 @@ export default {
productNumber: model.productNumber || '', productNumber: model.productNumber || '',
plate: model.plate || '', plate: model.plate || '',
platform: model.platform || '', platform: model.platform || '',
ycOrOth: model.ycOrOth || '',
series: model.series || '', series: model.series || '',
marketSegment: model.marketSegment || '', marketSegment: model.marketSegment || '',
projectName: model.projectName || '', projectName: model.projectName || '',
@ -1001,7 +1190,7 @@ export default {
} }
} }
// allModelRawData // allModelRawData
const modelKey = `${modelId}_${parameterVersion}` const modelKey = `${modelId}_${parameterVersion}`
if (!this.allModelRawData[modelKey]) { if (!this.allModelRawData[modelKey]) {
this.$set(this.allModelRawData, modelKey, { this.$set(this.allModelRawData, modelKey, {
@ -1009,12 +1198,18 @@ export default {
productNumber: modelData.productNumber || '', productNumber: modelData.productNumber || '',
plate: modelData.plate || '', plate: modelData.plate || '',
platform: modelData.platform || '', platform: modelData.platform || '',
ycOrOth: modelData.ycOrOth || '',
series: modelData.series || '', series: modelData.series || '',
marketSegment: modelData.marketSegment || '', marketSegment: modelData.marketSegment || '',
projectName: modelData.projectName || '', projectName: modelData.projectName || '',
projectNumber: modelData.projectNumber || '', projectNumber: modelData.projectNumber || '',
parameterNum: modelData.parameterNum || '' 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() { updateCheckedKeysByDisplayParams() {
console.log('根据可显示的参数更新树节点选中状态(不改变树数据)');
// 使 // 使
this.treeData = JSON.parse(JSON.stringify(this.allTreeData)) this.treeData = JSON.parse(JSON.stringify(this.allTreeData))
this.nodeMap = JSON.parse(JSON.stringify(this.allNodeMap)) this.nodeMap = JSON.parse(JSON.stringify(this.allNodeMap))
@ -1557,7 +1753,6 @@ export default {
if (subsystemNames.length === 0 && parameterTypes.length === 0) { if (subsystemNames.length === 0 && parameterTypes.length === 0) {
return return
} }
// subsystem -> Set<parameterKey> // subsystem -> Set<parameterKey>
// parameterKey 使 parameterId使 parameterName // parameterKey 使 parameterId使 parameterName
// isGlobal === 1 "" // isGlobal === 1 ""
@ -2104,13 +2299,15 @@ export default {
}, },
// //
loadTreeData() { loadTreeData() {
console.log('加载树数据,调用接口获取树数据')
// "" // ""
this.loadAllParametersData().then(() => { this.loadAllParametersData().then(() => {
// //
const request = { const request = {
...api.GET_ENGINE_DETAIL_QUERY, ...api.GET_ENGINE_DETAIL_QUERY,
params: { params: {
tcData: 'tc' tcData: 'tc',
userId: getUserId()
}, },
disableSuccessMsg: true disableSuccessMsg: true
} }
@ -2131,16 +2328,20 @@ export default {
// "" // ""
const wholeEngineParamsNode = this.buildWholeEngineParamsNode() const wholeEngineParamsNode = this.buildWholeEngineParamsNode()
console.log('根据接口返回的"整车参数"参数数据构建树结构', wholeEngineParamsNode);
// "" // ""
treeDataResult = [wholeEngineParamsNode, ...treeDataResult] treeDataResult = [wholeEngineParamsNode, ...treeDataResult]
console.log('将"整车参数"节点放在第一位,其他节点放在后面', treeDataResult);
// //
this.allTreeData = JSON.parse(JSON.stringify(treeDataResult)) this.allTreeData = JSON.parse(JSON.stringify(treeDataResult))
this.allNodeMap = JSON.parse(JSON.stringify(this.nodeMap)) this.allNodeMap = JSON.parse(JSON.stringify(this.nodeMap))
console.log('保存完整的树数据(未过滤)', this.allTreeData);
// 使 // 使
this.treeData = JSON.parse(JSON.stringify(this.allTreeData)) this.treeData = JSON.parse(JSON.stringify(this.allTreeData))
console.log('始终使用完整的树数据', this.treeData);
// //
if (this.currentCommonConfig) { if (this.currentCommonConfig) {
@ -2149,10 +2350,14 @@ export default {
this.updateCheckedKeysByDisplayParams() this.updateCheckedKeysByDisplayParams()
// 2. // 2.
this.$nextTick(() => { this.$nextTick(() => {
console.log('比较当前显示的参数和常用配置中的参数,找出不在常用中的参数,隐藏它们');
this.hideParamsNotInCommonByDisplayParams() this.hideParamsNotInCommonByDisplayParams()
}) })
}) })
} else { } else {
console.log('否则全选');
// //
const allKeys = this.getAllNodeKeys(this.treeData) const allKeys = this.getAllNodeKeys(this.treeData)
this.defaultExpandedKeys = allKeys this.defaultExpandedKeys = allKeys

View File

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

View File

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

View File

@ -185,6 +185,8 @@ export default {
}, },
mounted() { mounted() {
this.loadData() this.loadData()
// URLflowId
this.checkFlowIdFromUrl()
}, },
methods: { methods: {
pageSizeChange(size) { pageSizeChange(size) {
@ -366,6 +368,35 @@ export default {
console.error('日期格式化错误:', error) console.error('日期格式化错误:', error)
return cellValue 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() { mounted() {
this.loadData() this.loadData()
// URLflowId
this.checkFlowIdFromUrl()
}, },
methods: { methods: {
pageSizeChange(size) { pageSizeChange(size) {
@ -494,6 +496,35 @@ export default {
}) })
} }
console.warn(row) 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"> <template slot="empty">
<div class="table-empty"> <div class="table-empty">
<template v-if="canViewData">
<x-empty-page></x-empty-page> <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> </div>
</template> </template>
</x-vxe-table> </x-vxe-table>
@ -209,7 +216,8 @@ export default {
// //
applicantOptions: [], applicantOptions: [],
applicantLoading: false, applicantLoading: false,
applicantSearchTimer: null // applicantSearchTimer: null, //
canViewData: false //
} }
}, },
computed: { computed: {
@ -276,9 +284,35 @@ export default {
} }
} }
}, },
created() { mounted() {
this.loadUserSelfRole() // localStorage
if (this.hasViewPermission()) {
this.canViewData = true
this.loadData() 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() { beforeDestroy() {
// //
@ -350,6 +384,49 @@ export default {
// //
return this.isApplicant(row) 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() { loadUserSelfRole() {
const request = { const request = {
@ -359,19 +436,26 @@ export default {
}, },
disableSuccessMsg: true disableSuccessMsg: true
} }
return new Promise((resolve, reject) => {
this.$request(request) this.$request(request)
.asyncThen((resp) => { .asyncThen((resp) => {
if (resp && resp.data) { if (resp && resp.data) {
// localStorage // localStorage
try { try {
localStorage.setItem('user_self_role', JSON.stringify(resp.data)) localStorage.setItem('user_self_role', JSON.stringify(resp.data))
resolve(resp.data)
} catch (err) { } catch (err) {
console.error('存储权限数据到 localStorage 失败:', err) console.error('存储权限数据到 localStorage 失败:', err)
reject(err)
} }
} else {
resolve(null)
} }
}) })
.asyncErrorCatch((err) => { .asyncErrorCatch((err) => {
console.error('获取用户自身角色失败:', err) console.error('获取用户自身角色失败:', err)
reject(err)
})
}) })
}, },
pageSizeChange(size) { 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-option label="未分发" value="未分发" /> <el-option label="未分发" value="未分发" />
<el-option label="已完成" value="已完成" />
</el-select> </el-select>
</div> </div>
<div class="search-actions"> <div class="search-actions">
@ -139,6 +140,9 @@
<span v-else-if="row[colConfig.prop] === '未分发'" class="status-tag status-pending"> <span v-else-if="row[colConfig.prop] === '未分发'" class="status-tag status-pending">
未分发 未分发
</span> </span>
<span v-else-if="row[colConfig.prop] === '已完成'" class="status-tag status-done">
已完成
</span>
</div> </div>
<div v-if="colConfig.customSlot === 'versionNumber'" :key="index + '' + rowIndex"> <div v-if="colConfig.customSlot === 'versionNumber'" :key="index + '' + rowIndex">
V{{ row[colConfig.prop] || '' }} V{{ row[colConfig.prop] || '' }}
@ -147,7 +151,14 @@
<template slot="empty"> <template slot="empty">
<div class="table-empty"> <div class="table-empty">
<template v-if="canViewData">
<x-empty-page></x-empty-page> <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> </div>
</template> </template>
</x-vxe-table> </x-vxe-table>
@ -249,7 +260,8 @@ export default {
importing: false, importing: false,
selectedImportFile: null, selectedImportFile: null,
importFileList: [], importFileList: [],
downloadingTemplate: false downloadingTemplate: false,
canViewData: false //
} }
}, },
computed: { computed: {
@ -349,13 +361,35 @@ export default {
} }
} }
}, },
created() {
this.loadUserSelfRole()
this.loadData()
},
mounted() { mounted() {
this.loadUserSelfRole() // localStorage
if (this.hasViewPermission()) {
this.canViewData = true
this.loadData() 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: { methods: {
// isAdmin === 1 // isAdmin === 1
@ -376,6 +410,31 @@ export default {
return false 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() { hasEngineDataEditPermission() {
// //
@ -411,19 +470,26 @@ export default {
}, },
disableSuccessMsg: true disableSuccessMsg: true
} }
return new Promise((resolve, reject) => {
this.$request(request) this.$request(request)
.asyncThen((resp) => { .asyncThen((resp) => {
if (resp && resp.data) { if (resp && resp.data) {
// localStorage // localStorage
try { try {
localStorage.setItem('user_self_role', JSON.stringify(resp.data)) localStorage.setItem('user_self_role', JSON.stringify(resp.data))
resolve(resp.data)
} catch (err) { } catch (err) {
console.error('存储权限数据到 localStorage 失败:', err) console.error('存储权限数据到 localStorage 失败:', err)
reject(err)
} }
} else {
resolve(null)
} }
}) })
.asyncErrorCatch((err) => { .asyncErrorCatch((err) => {
console.error('获取用户自身角色失败:', err) console.error('获取用户自身角色失败:', err)
reject(err)
})
}) })
}, },
handleRowDispatch(row, rowIndex) { handleRowDispatch(row, rowIndex) {

View File

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

View File

@ -232,7 +232,14 @@
<template slot="empty"> <template slot="empty">
<div class="table-empty"> <div class="table-empty">
<template v-if="canViewData">
<x-empty-page></x-empty-page> <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> </div>
</template> </template>
</x-vxe-table> </x-vxe-table>
@ -721,7 +728,8 @@ export default {
currentApprovalRow: null, currentApprovalRow: null,
showReportDetail: false, showReportDetail: false,
currentReportDetail: null, currentReportDetail: null,
downloadingRowId: '' downloadingRowId: '',
canViewData: false //
} }
}, },
computed: { computed: {
@ -767,13 +775,35 @@ export default {
} }
} }
}, },
created() {
this.loadUserSelfRole()
this.loadData()
},
mounted() { mounted() {
this.loadUserSelfRole() // localStorage
if (this.hasViewPermission()) {
this.canViewData = true
this.loadData() 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: { methods: {
// isAdmin === 1 // isAdmin === 1
@ -794,6 +824,31 @@ export default {
return false 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() { hasReportEditPermission() {
// //
@ -829,19 +884,26 @@ export default {
}, },
disableSuccessMsg: true disableSuccessMsg: true
} }
return new Promise((resolve, reject) => {
this.$request(request) this.$request(request)
.asyncThen((resp) => { .asyncThen((resp) => {
if (resp && resp.data) { if (resp && resp.data) {
// localStorage // localStorage
try { try {
localStorage.setItem('user_self_role', JSON.stringify(resp.data)) localStorage.setItem('user_self_role', JSON.stringify(resp.data))
resolve(resp.data)
} catch (err) { } catch (err) {
console.error('存储权限数据到 localStorage 失败:', err) console.error('存储权限数据到 localStorage 失败:', err)
reject(err)
} }
} else {
resolve(null)
} }
}) })
.asyncErrorCatch((err) => { .asyncErrorCatch((err) => {
console.error('获取用户自身角色失败:', err) console.error('获取用户自身角色失败:', err)
reject(err)
})
}) })
}, },
handleCreate() { handleCreate() {

View File

@ -183,7 +183,14 @@
<template slot="empty"> <template slot="empty">
<div class="table-empty"> <div class="table-empty">
<template v-if="canViewData">
<x-empty-page></x-empty-page> <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> </div>
</template> </template>
</x-vxe-table> </x-vxe-table>
@ -568,7 +575,8 @@ export default {
currentApprovalRow: null, currentApprovalRow: null,
showReportDetail: false, showReportDetail: false,
currentReportDetail: null, currentReportDetail: null,
downloadingRowId: '' downloadingRowId: '',
canViewData: false //
} }
}, },
computed: { computed: {
@ -607,10 +615,111 @@ export default {
} }
} }
}, },
created() { mounted() {
// localStorage
if (this.hasViewPermission()) {
this.canViewData = true
this.loadData() 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: { 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() { handleCreate() {
this.dialogMode = 'create' this.dialogMode = 'create'
this.currentRestartRow = null this.currentRestartRow = null

View File

@ -113,7 +113,14 @@
<template slot="empty"> <template slot="empty">
<div class="table-empty"> <div class="table-empty">
<template v-if="canViewData">
<x-empty-page></x-empty-page> <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> </div>
</template> </template>
</x-vxe-table> </x-vxe-table>
@ -209,7 +216,8 @@ export default {
// //
applicantOptions: [], applicantOptions: [],
applicantLoading: false, applicantLoading: false,
applicantSearchTimer: null // applicantSearchTimer: null, //
canViewData: false //
} }
}, },
computed: { computed: {
@ -276,9 +284,35 @@ export default {
} }
} }
}, },
created() { mounted() {
this.loadUserSelfRole() // localStorage
if (this.hasViewPermission()) {
this.canViewData = true
this.loadData() 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() { beforeDestroy() {
// //
@ -350,6 +384,49 @@ export default {
// //
return this.isApplicant(row) 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() { loadUserSelfRole() {
const request = { const request = {
@ -359,19 +436,26 @@ export default {
}, },
disableSuccessMsg: true disableSuccessMsg: true
} }
return new Promise((resolve, reject) => {
this.$request(request) this.$request(request)
.asyncThen((resp) => { .asyncThen((resp) => {
if (resp && resp.data) { if (resp && resp.data) {
// localStorage // localStorage
try { try {
localStorage.setItem('user_self_role', JSON.stringify(resp.data)) localStorage.setItem('user_self_role', JSON.stringify(resp.data))
resolve(resp.data)
} catch (err) { } catch (err) {
console.error('存储权限数据到 localStorage 失败:', err) console.error('存储权限数据到 localStorage 失败:', err)
reject(err)
} }
} else {
resolve(null)
} }
}) })
.asyncErrorCatch((err) => { .asyncErrorCatch((err) => {
console.error('获取用户自身角色失败:', err) console.error('获取用户自身角色失败:', err)
reject(err)
})
}) })
}, },
pageSizeChange(size) { 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-option label="未分发" value="未分发" /> <el-option label="未分发" value="未分发" />
<el-option label="已完成" value="已完成" />
</el-select> </el-select>
</div> </div>
<div class="search-actions"> <div class="search-actions">
@ -139,6 +140,9 @@
<span v-else-if="row[colConfig.prop] === '未分发'" class="status-tag status-pending"> <span v-else-if="row[colConfig.prop] === '未分发'" class="status-tag status-pending">
未分发 未分发
</span> </span>
<span v-else-if="row[colConfig.prop] === '已完成'" class="status-tag status-done">
已完成
</span>
</div> </div>
<div v-if="colConfig.customSlot === 'versionNumber'" :key="index + '' + rowIndex"> <div v-if="colConfig.customSlot === 'versionNumber'" :key="index + '' + rowIndex">
V{{ row[colConfig.prop] || '' }} V{{ row[colConfig.prop] || '' }}
@ -147,7 +151,14 @@
<template slot="empty"> <template slot="empty">
<div class="table-empty"> <div class="table-empty">
<template v-if="canViewData">
<x-empty-page></x-empty-page> <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> </div>
</template> </template>
</x-vxe-table> </x-vxe-table>
@ -249,7 +260,8 @@ export default {
importing: false, importing: false,
selectedImportFile: null, selectedImportFile: null,
importFileList: [], importFileList: [],
downloadingTemplate: false downloadingTemplate: false,
canViewData: false //
} }
}, },
computed: { computed: {
@ -349,13 +361,35 @@ export default {
} }
} }
}, },
created() {
this.loadUserSelfRole()
this.loadData()
},
mounted() { mounted() {
this.loadUserSelfRole() // localStorage
if (this.hasViewPermission()) {
this.canViewData = true
this.loadData() 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: { methods: {
// isAdmin === 1 // isAdmin === 1
@ -376,6 +410,31 @@ export default {
return false 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() { hasEngineDataEditPermission() {
// //
@ -411,19 +470,26 @@ export default {
}, },
disableSuccessMsg: true disableSuccessMsg: true
} }
return new Promise((resolve, reject) => {
this.$request(request) this.$request(request)
.asyncThen((resp) => { .asyncThen((resp) => {
if (resp && resp.data) { if (resp && resp.data) {
// localStorage // localStorage
try { try {
localStorage.setItem('user_self_role', JSON.stringify(resp.data)) localStorage.setItem('user_self_role', JSON.stringify(resp.data))
resolve(resp.data)
} catch (err) { } catch (err) {
console.error('存储权限数据到 localStorage 失败:', err) console.error('存储权限数据到 localStorage 失败:', err)
reject(err)
} }
} else {
resolve(null)
} }
}) })
.asyncErrorCatch((err) => { .asyncErrorCatch((err) => {
console.error('获取用户自身角色失败:', err) console.error('获取用户自身角色失败:', err)
reject(err)
})
}) })
}, },
handleRowDispatch(row, rowIndex) { handleRowDispatch(row, rowIndex) {

View File

@ -88,8 +88,8 @@
:visible="showEngineCheck" :visible="showEngineCheck"
:engine-type="engineType" :engine-type="engineType"
:from-todo="fromTodo" :from-todo="fromTodo"
@refresh="handleBackFromCheck"
class="engine-check-wrapper" class="engine-check-wrapper"
@refresh="handleBackFromCheck"
@close="handleBackFromCheck" @close="handleBackFromCheck"
/> />
@ -224,6 +224,8 @@ export default {
mounted() { mounted() {
this.loadData() this.loadData()
this.filterTemplateManagementPermissions() this.filterTemplateManagementPermissions()
// URLflowId
this.checkFlowIdFromUrl()
}, },
methods: { methods: {
pageSizeChange(size) { pageSizeChange(size) {
@ -567,6 +569,35 @@ export default {
console.error('日期格式化错误:', error) console.error('日期格式化错误:', error)
return cellValue 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('获取待办数据失败')
})
}
} }
} }
} }