fix:修改权限管理相关内容
This commit is contained in:
parent
6119956bd4
commit
3e4253d9a9
Binary file not shown.
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
@ -1,139 +0,0 @@
|
|||||||
{
|
|
||||||
"entry": "index.js",
|
|
||||||
"copyAssets": ["public/custom/apaas-custom-mydemo"],
|
|
||||||
"router": {
|
|
||||||
"apaas-custom-modalContorl":{
|
|
||||||
"name": "apaas-custom-modalContorl",
|
|
||||||
"path": "apaas-custom-modalContorl",
|
|
||||||
"meta": {
|
|
||||||
"title": "模板管理"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"apaas-custom-selfEnginedata":{
|
|
||||||
"name": "apaas-custom-selfEnginedata",
|
|
||||||
"path": "apaas-custom-selfEnginedata",
|
|
||||||
"meta": {
|
|
||||||
"title": "玉柴发动机数据"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"apaas-custom-otherEnginedata":{
|
|
||||||
"name": "apaas-custom-otherEnginedata",
|
|
||||||
"path": "apaas-custom-otherEnginedata",
|
|
||||||
"meta": {
|
|
||||||
"title": "竞品发动机数据"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"apaas-custom-checkData":{
|
|
||||||
"name": "apaas-custom-checkData",
|
|
||||||
"path": "apaas-custom-checkData",
|
|
||||||
"meta": {
|
|
||||||
"title": "数据检查"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"apaas-custom-report":{
|
|
||||||
"name": "apaas-custom-report",
|
|
||||||
"path": "apaas-custom-report",
|
|
||||||
"meta": {
|
|
||||||
"title": "对标报告"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"apaas-custom-reportDetail":{
|
|
||||||
"name": "apaas-custom-reportDetail",
|
|
||||||
"path": "apaas-custom-reportDetail",
|
|
||||||
"meta": {
|
|
||||||
"title": "报告详情"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"apaas-custom-reportCheck":{
|
|
||||||
"name": "apaas-custom-reportCheck",
|
|
||||||
"path": "apaas-custom-reportCheck",
|
|
||||||
"meta": {
|
|
||||||
"title": "报告检查"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"apaas-custom-modelDetail":{
|
|
||||||
"name": "apaas-custom-modelDetail",
|
|
||||||
"path": "apaas-custom-modelDetail",
|
|
||||||
"meta": {
|
|
||||||
"title": "系统参数管理"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"apaas-custom-engineDetail":{
|
|
||||||
"name": "apaas-custom-engineDetail",
|
|
||||||
"path": "apaas-custom-engineDetail",
|
|
||||||
"meta": {
|
|
||||||
"title": "发动机参数详情"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"apaas-custom-approvalManagement":{
|
|
||||||
"name": "apaas-custom-approvalManagement",
|
|
||||||
"path": "apaas-custom-approvalManagement",
|
|
||||||
"meta": {
|
|
||||||
"title": "模板审批管理"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"apaas-custom-toDoList":{
|
|
||||||
"name": "apaas-custom-toDoList",
|
|
||||||
"path": "apaas-custom-toDoList",
|
|
||||||
"meta": {
|
|
||||||
"title": "数据待办"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"apaas-custom-myDone":{
|
|
||||||
"name": "apaas-custom-myDone",
|
|
||||||
"path": "apaas-custom-myDone",
|
|
||||||
"meta": {
|
|
||||||
"title": "我的已办"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"apaas-custom-mySend":{
|
|
||||||
"name": "apaas-custom-mySend",
|
|
||||||
"path": "apaas-custom-mySend",
|
|
||||||
"meta": {
|
|
||||||
"title": "我发起的"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"apaas-custom-selfEngineCheck":{
|
|
||||||
"name": "apaas-custom-selfEngineCheck",
|
|
||||||
"path": "apaas-custom-selfEngineCheck",
|
|
||||||
"meta": {
|
|
||||||
"title": "玉柴发动机审核"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"apaas-custom-otherEngineCheck":{
|
|
||||||
"name": "apaas-custom-otherEngineCheck",
|
|
||||||
"path": "apaas-custom-otherEngineCheck",
|
|
||||||
"meta": {
|
|
||||||
"title": "竞品发动机审核"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"apaas-custom-managerData":{
|
|
||||||
"name": "apaas-custom-managerData",
|
|
||||||
"path": "apaas-custom-managerData",
|
|
||||||
"meta": {
|
|
||||||
"title": "责任人管理"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"apaas-custom-fillerData":{
|
|
||||||
"name": "apaas-custom-fillerData",
|
|
||||||
"path": "apaas-custom-fillerData",
|
|
||||||
"meta": {
|
|
||||||
"title": "填写人管理"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"apaas-custom-permissionManagement":{
|
|
||||||
"name": "apaas-custom-permissionManagement",
|
|
||||||
"path": "apaas-custom-permissionManagement",
|
|
||||||
"meta": {
|
|
||||||
"title": "权限管理"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"customWidgetList": [
|
|
||||||
{
|
|
||||||
"code": "mydemo",
|
|
||||||
"text": "mydemo"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"outputName": "apaas-custom-mydemo"
|
|
||||||
}
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
<meta charset="utf-8">
|
|
||||||
<title>apaas-custom-mydemo demo</title>
|
|
||||||
<script src="./apaas-custom-mydemo.umd.js"></script>
|
|
||||||
|
|
||||||
<link rel="stylesheet" href="./apaas-custom-mydemo.css">
|
|
||||||
|
|
||||||
|
|
||||||
<script>
|
|
||||||
console.log(apaas-custom-mydemo)
|
|
||||||
</script>
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 12 KiB |
@ -413,6 +413,10 @@ export default {
|
|||||||
url: '/custom/tcDataQuery/tcDataSelectByPartsNames',
|
url: '/custom/tcDataQuery/tcDataSelectByPartsNames',
|
||||||
method: 'post'
|
method: 'post'
|
||||||
},
|
},
|
||||||
|
DOWNLOAD_MODEL_QUERY_DATA: {
|
||||||
|
url: '/custom/tcDataQuery/modelComparisonExport',
|
||||||
|
method: 'post'
|
||||||
|
},
|
||||||
GET_MY_SEND_LIST: {
|
GET_MY_SEND_LIST: {
|
||||||
url: '/custom/todoTaskPojo/selectByPageByCreate',
|
url: '/custom/todoTaskPojo/selectByPageByCreate',
|
||||||
method: 'post'
|
method: 'post'
|
||||||
|
|||||||
@ -37,6 +37,13 @@
|
|||||||
"title": "对标报告"
|
"title": "对标报告"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"apaas-custom-reportList":{
|
||||||
|
"name": "apaas-custom-reportList",
|
||||||
|
"path": "apaas-custom-reportList",
|
||||||
|
"meta": {
|
||||||
|
"title": "报告列表"
|
||||||
|
}
|
||||||
|
},
|
||||||
"apaas-custom-reportDetail":{
|
"apaas-custom-reportDetail":{
|
||||||
"name": "apaas-custom-reportDetail",
|
"name": "apaas-custom-reportDetail",
|
||||||
"path": "apaas-custom-reportDetail",
|
"path": "apaas-custom-reportDetail",
|
||||||
|
|||||||
@ -263,7 +263,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
// this.loadUserSelfRole()
|
this.loadUserSelfRole()
|
||||||
this.loadData()
|
this.loadData()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|||||||
@ -34,13 +34,30 @@
|
|||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item v-if="dispatchType === 'update_param'" label="零部件名称:" prop="partsName">
|
||||||
|
<el-select
|
||||||
|
v-model="formData.partsName"
|
||||||
|
placeholder="请选择零部件名称"
|
||||||
|
clearable
|
||||||
|
style="width: 100%"
|
||||||
|
:disabled="!formData.subsystem"
|
||||||
|
@change="handlePartsNameChange"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in availablePartsNames"
|
||||||
|
:key="item"
|
||||||
|
:label="item"
|
||||||
|
:value="item"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label="部门:" prop="department">
|
<el-form-item label="部门:" prop="department">
|
||||||
<el-select
|
<el-select
|
||||||
v-model="formData.department"
|
v-model="formData.department"
|
||||||
placeholder="请选择部门"
|
placeholder="请选择部门"
|
||||||
clearable
|
clearable
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
:disabled="!formData.subsystem"
|
:disabled="!formData.subsystem || (dispatchType === 'update_param' && !formData.partsName)"
|
||||||
@change="handleDepartmentChange"
|
@change="handleDepartmentChange"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
@ -53,8 +70,8 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-if="dispatchType !== 'update_param'" label="现责任人:">
|
<el-form-item v-if="dispatchType !== 'update_param'" label="现责任人:">
|
||||||
<el-input
|
<el-input
|
||||||
disabled
|
|
||||||
v-model="formData.currentResponsibleName"
|
v-model="formData.currentResponsibleName"
|
||||||
|
disabled
|
||||||
placeholder="暂无责任人"
|
placeholder="暂无责任人"
|
||||||
readonly
|
readonly
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
@ -66,7 +83,7 @@
|
|||||||
:placeholder="dispatchType === 'update_param' ? '请输入填写人姓名进行搜索' : '请输入责任人姓名进行搜索'"
|
:placeholder="dispatchType === 'update_param' ? '请输入填写人姓名进行搜索' : '请输入责任人姓名进行搜索'"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
clearable
|
clearable
|
||||||
:disabled="!formData.department"
|
:disabled="!formData.department || (dispatchType === 'update_param' && !formData.partsName)"
|
||||||
filterable
|
filterable
|
||||||
remote
|
remote
|
||||||
reserve-keyword
|
reserve-keyword
|
||||||
@ -134,6 +151,7 @@ export default {
|
|||||||
submitting: false,
|
submitting: false,
|
||||||
formData: {
|
formData: {
|
||||||
subsystem: '',
|
subsystem: '',
|
||||||
|
partsName: '', // 零部件名称(仅用于批量修改填写人)
|
||||||
department: '',
|
department: '',
|
||||||
currentResponsibleId: '', // 现责任人的ID(用于判断是新增还是修改)
|
currentResponsibleId: '', // 现责任人的ID(用于判断是新增还是修改)
|
||||||
currentResponsibleName: '', // 现责任人名称(只读显示)
|
currentResponsibleName: '', // 现责任人名称(只读显示)
|
||||||
@ -143,6 +161,7 @@ export default {
|
|||||||
rowId: '' // 如果有现责任人,用于修改时的rowId
|
rowId: '' // 如果有现责任人,用于修改时的rowId
|
||||||
},
|
},
|
||||||
subsystemList: [],
|
subsystemList: [],
|
||||||
|
availablePartsNames: [], // 根据子系统筛选出的零部件名称列表(仅用于批量修改填写人)
|
||||||
availableDepartments: [], // 根据子系统筛选出的部门列表
|
availableDepartments: [], // 根据子系统筛选出的部门列表
|
||||||
allManagerData: [], // 所有责任人数据(用于查找现责任人和部门)
|
allManagerData: [], // 所有责任人数据(用于查找现责任人和部门)
|
||||||
departmentTreeData: [], // 部门树数据(用于根据部门名称查找部门ID)
|
departmentTreeData: [], // 部门树数据(用于根据部门名称查找部门ID)
|
||||||
@ -155,7 +174,7 @@ export default {
|
|||||||
return this.dispatchType === 'update_param' ? '批量修改填写人' : '批量修改责任人'
|
return this.dispatchType === 'update_param' ? '批量修改填写人' : '批量修改责任人'
|
||||||
},
|
},
|
||||||
formRules() {
|
formRules() {
|
||||||
return {
|
const rules = {
|
||||||
subsystem: [
|
subsystem: [
|
||||||
{ required: true, message: '请选择子系统', trigger: 'change' }
|
{ required: true, message: '请选择子系统', trigger: 'change' }
|
||||||
],
|
],
|
||||||
@ -166,6 +185,13 @@ export default {
|
|||||||
{ required: true, message: this.dispatchType === 'update_param' ? '请选择填写人' : '请选择责任人', trigger: 'change' }
|
{ required: true, message: this.dispatchType === 'update_param' ? '请选择填写人' : '请选择责任人', trigger: 'change' }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
// 如果是批量修改填写人,添加零部件名称验证
|
||||||
|
if (this.dispatchType === 'update_param') {
|
||||||
|
rules.partsName = [
|
||||||
|
{ required: true, message: '请选择零部件名称', trigger: 'change' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
return rules
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -189,6 +215,7 @@ export default {
|
|||||||
// 重置表单数据
|
// 重置表单数据
|
||||||
this.formData = {
|
this.formData = {
|
||||||
subsystem: '',
|
subsystem: '',
|
||||||
|
partsName: '',
|
||||||
department: '',
|
department: '',
|
||||||
currentResponsibleId: '',
|
currentResponsibleId: '',
|
||||||
currentResponsibleName: '',
|
currentResponsibleName: '',
|
||||||
@ -197,6 +224,7 @@ export default {
|
|||||||
username: '',
|
username: '',
|
||||||
rowId: ''
|
rowId: ''
|
||||||
}
|
}
|
||||||
|
this.availablePartsNames = []
|
||||||
this.availableDepartments = []
|
this.availableDepartments = []
|
||||||
this.userOptions = []
|
this.userOptions = []
|
||||||
this.userLoading = false
|
this.userLoading = false
|
||||||
@ -218,6 +246,7 @@ export default {
|
|||||||
this.visible = false
|
this.visible = false
|
||||||
this.formData = {
|
this.formData = {
|
||||||
subsystem: '',
|
subsystem: '',
|
||||||
|
partsName: '',
|
||||||
department: '',
|
department: '',
|
||||||
currentResponsibleId: '',
|
currentResponsibleId: '',
|
||||||
currentResponsibleName: '',
|
currentResponsibleName: '',
|
||||||
@ -226,6 +255,7 @@ export default {
|
|||||||
username: '',
|
username: '',
|
||||||
rowId: ''
|
rowId: ''
|
||||||
}
|
}
|
||||||
|
this.availablePartsNames = []
|
||||||
this.availableDepartments = []
|
this.availableDepartments = []
|
||||||
this.userOptions = []
|
this.userOptions = []
|
||||||
this.userLoading = false
|
this.userLoading = false
|
||||||
@ -274,7 +304,8 @@ export default {
|
|||||||
},
|
},
|
||||||
// 处理子系统选择变化
|
// 处理子系统选择变化
|
||||||
handleSubsystemChange(subsystem) {
|
handleSubsystemChange(subsystem) {
|
||||||
// 清空部门和现责任人
|
// 清空零部件名称、部门和现责任人
|
||||||
|
this.formData.partsName = ''
|
||||||
this.formData.department = ''
|
this.formData.department = ''
|
||||||
this.formData.currentResponsibleId = ''
|
this.formData.currentResponsibleId = ''
|
||||||
this.formData.currentResponsibleName = ''
|
this.formData.currentResponsibleName = ''
|
||||||
@ -282,12 +313,14 @@ export default {
|
|||||||
this.formData.userId = ''
|
this.formData.userId = ''
|
||||||
this.formData.userNumber = ''
|
this.formData.userNumber = ''
|
||||||
this.formData.username = ''
|
this.formData.username = ''
|
||||||
|
this.availablePartsNames = []
|
||||||
|
this.availableDepartments = []
|
||||||
this.userOptions = []
|
this.userOptions = []
|
||||||
// 根据子系统筛选部门列表
|
// 根据子系统筛选零部件名称和部门列表
|
||||||
if (subsystem) {
|
if (subsystem) {
|
||||||
// 从 versionData 中筛选出该子系统下所有零部件名称(partsName)下所有参数的部门名称(去重)
|
|
||||||
const departmentSet = new Set()
|
|
||||||
const currentVersionData = this.versionData[this.currentVersionId] || {}
|
const currentVersionData = this.versionData[this.currentVersionId] || {}
|
||||||
|
const partsNameSet = new Set()
|
||||||
|
const departmentSet = new Set()
|
||||||
|
|
||||||
// 遍历所有零部件名称(partsName)
|
// 遍历所有零部件名称(partsName)
|
||||||
Object.keys(currentVersionData).forEach((partsName) => {
|
Object.keys(currentVersionData).forEach((partsName) => {
|
||||||
@ -295,7 +328,65 @@ export default {
|
|||||||
// 遍历该零部件下的所有参数
|
// 遍历该零部件下的所有参数
|
||||||
params.forEach((param) => {
|
params.forEach((param) => {
|
||||||
// 检查参数是否属于选中的子系统
|
// 检查参数是否属于选中的子系统
|
||||||
if (param.subsystemName === subsystem && param.department) {
|
if (param.subsystemName === subsystem) {
|
||||||
|
// 如果是批量修改填写人,收集零部件名称
|
||||||
|
if (this.dispatchType === 'update_param') {
|
||||||
|
const paramPartsName = param.partsName || partsName
|
||||||
|
if (paramPartsName && paramPartsName !== '/') {
|
||||||
|
partsNameSet.add(paramPartsName)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 收集部门名称
|
||||||
|
if (param.department) {
|
||||||
|
departmentSet.add(param.department)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
// 如果是批量修改填写人,设置零部件名称列表
|
||||||
|
if (this.dispatchType === 'update_param') {
|
||||||
|
this.availablePartsNames = Array.from(partsNameSet).sort()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果是批量修改责任人,直接设置部门列表(不依赖零部件名称)
|
||||||
|
if (this.dispatchType !== 'update_param') {
|
||||||
|
// 转换为数组格式
|
||||||
|
this.availableDepartments = Array.from(departmentSet).map((dept) => ({
|
||||||
|
department: dept
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.availablePartsNames = []
|
||||||
|
this.availableDepartments = []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 处理零部件名称选择变化(仅用于批量修改填写人)
|
||||||
|
handlePartsNameChange(partsName) {
|
||||||
|
// 清空部门和填写人
|
||||||
|
this.formData.department = ''
|
||||||
|
this.formData.userId = ''
|
||||||
|
this.formData.userNumber = ''
|
||||||
|
this.formData.username = ''
|
||||||
|
this.availableDepartments = []
|
||||||
|
this.userOptions = []
|
||||||
|
// 根据子系统和零部件名称筛选部门列表
|
||||||
|
if (partsName && this.formData.subsystem) {
|
||||||
|
const departmentSet = new Set()
|
||||||
|
const currentVersionData = this.versionData[this.currentVersionId] || {}
|
||||||
|
|
||||||
|
// 遍历所有零部件名称(partsName)
|
||||||
|
Object.keys(currentVersionData).forEach((dataPartsName) => {
|
||||||
|
const params = currentVersionData[dataPartsName] || []
|
||||||
|
// 遍历该零部件下的所有参数
|
||||||
|
params.forEach((param) => {
|
||||||
|
// 检查参数是否属于选中的子系统和零部件名称
|
||||||
|
const paramPartsName = param.partsName || dataPartsName
|
||||||
|
if (
|
||||||
|
param.subsystemName === this.formData.subsystem &&
|
||||||
|
paramPartsName === partsName &&
|
||||||
|
param.department
|
||||||
|
) {
|
||||||
departmentSet.add(param.department)
|
departmentSet.add(param.department)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -348,9 +439,18 @@ export default {
|
|||||||
},
|
},
|
||||||
// 远程搜索责任人
|
// 远程搜索责任人
|
||||||
handleRemoteSearch(query) {
|
handleRemoteSearch(query) {
|
||||||
if (!this.formData.department) {
|
// 如果是批量修改填写人,需要检查零部件名称和部门
|
||||||
this.userOptions = []
|
if (this.dispatchType === 'update_param') {
|
||||||
return
|
if (!this.formData.partsName || !this.formData.department) {
|
||||||
|
this.userOptions = []
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 批量修改责任人,只需要检查部门
|
||||||
|
if (!this.formData.department) {
|
||||||
|
this.userOptions = []
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!query || query.trim() === '') {
|
if (!query || query.trim() === '') {
|
||||||
if (this.formData.userId) {
|
if (this.formData.userId) {
|
||||||
@ -461,12 +561,18 @@ export default {
|
|||||||
|
|
||||||
// 如果是批量修改填写人,不调用接口,直接触发确认事件
|
// 如果是批量修改填写人,不调用接口,直接触发确认事件
|
||||||
if (this.dispatchType === 'update_param') {
|
if (this.dispatchType === 'update_param') {
|
||||||
|
// 验证零部件名称
|
||||||
|
if (!this.formData.partsName) {
|
||||||
|
this.$message.warning('请选择零部件名称')
|
||||||
|
return
|
||||||
|
}
|
||||||
// 确保所有必要参数都有值
|
// 确保所有必要参数都有值
|
||||||
// 如果 userNumber 为空,使用 userId 作为 userNumber(降级处理)
|
// 如果 userNumber 为空,使用 userId 作为 userNumber(降级处理)
|
||||||
const confirmData = {
|
const confirmData = {
|
||||||
subsystem: this.formData.subsystem,
|
subsystem: this.formData.subsystem,
|
||||||
|
partsName: this.formData.partsName,
|
||||||
department: this.formData.department,
|
department: this.formData.department,
|
||||||
userId: this.formData.userId,
|
userId: this.formData.userId, // 确保传递userId
|
||||||
userNumber: this.formData.userNumber || this.formData.userId, // 如果没有 userNumber,使用 userId
|
userNumber: this.formData.userNumber || this.formData.userId, // 如果没有 userNumber,使用 userId
|
||||||
username: this.formData.username || ''
|
username: this.formData.username || ''
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1450,9 +1450,9 @@ export default {
|
|||||||
|
|
||||||
// 如果是批量修改填写人,直接更新页面数据
|
// 如果是批量修改填写人,直接更新页面数据
|
||||||
if (this.dispatchType === 'update_param') {
|
if (this.dispatchType === 'update_param') {
|
||||||
const { subsystem, department, userId, userNumber, username } = change
|
const { subsystem, partsName, department, userId, userNumber, username } = change
|
||||||
console.log(change, 'change', subsystem, department, userId, userNumber, username)
|
console.log(change, 'change', subsystem, partsName, department, userId, userNumber, username)
|
||||||
if (!subsystem || !department || !userId) {
|
if (!subsystem || !partsName || !department || !userId) {
|
||||||
this.$message({
|
this.$message({
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
message: '缺少必要参数'
|
message: '缺少必要参数'
|
||||||
@ -1476,21 +1476,29 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 遍历所有零部件名称(partsName)
|
// 遍历所有零部件名称(partsName)
|
||||||
Object.keys(currentData).forEach((partsName) => {
|
Object.keys(currentData).forEach((dataPartsName) => {
|
||||||
const params = currentData[partsName] || []
|
const params = currentData[dataPartsName] || []
|
||||||
// 遍历该零部件下的所有参数
|
// 遍历该零部件下的所有参数
|
||||||
params.forEach((param, index) => {
|
params.forEach((param, index) => {
|
||||||
// 标准化参数的部门路径(将 · 替换为 -)
|
// 标准化参数的部门路径(将 · 替换为 -)
|
||||||
const normalizedParamDept = (param.department || '').replace(/·/g, '-')
|
const normalizedParamDept = (param.department || '').replace(/·/g, '-')
|
||||||
|
// 获取参数的零部件名称(优先使用param.partsName,否则使用dataPartsName)
|
||||||
|
const paramPartsName = param.partsName || dataPartsName
|
||||||
|
|
||||||
// 检查参数是否匹配子系统和部门(使用标准化后的部门路径进行匹配)
|
// 检查参数是否匹配子系统、零部件名称和部门(使用标准化后的部门路径进行匹配)
|
||||||
if (param.subsystemName === subsystem && normalizedParamDept === normalizedDepartment) {
|
if (
|
||||||
|
param.subsystemName === subsystem &&
|
||||||
|
paramPartsName === partsName &&
|
||||||
|
normalizedParamDept === normalizedDepartment
|
||||||
|
) {
|
||||||
// 更新填写人信息
|
// 更新填写人信息
|
||||||
param.filledBy = userId // 填写人ID(userId,用于提交)
|
param.filledBy = userId // 填写人ID(userId,用于提交)
|
||||||
param.filledByUserId = userId // 填写人userId(用于 el-select 的 v-model)
|
param.filledByUserId = userId // 填写人userId(用于 el-select 的 v-model)
|
||||||
|
// 同步更新部门信息
|
||||||
|
param.department = department
|
||||||
|
|
||||||
// 使用 Vue.set 确保响应式更新
|
// 使用 Vue.set 确保响应式更新
|
||||||
this.$set(currentData[partsName], index, param)
|
this.$set(currentData[dataPartsName], index, param)
|
||||||
|
|
||||||
// 更新该行的填写人选项,确保选择框能正确显示
|
// 更新该行的填写人选项,确保选择框能正确显示
|
||||||
const rowId = param.id || `${param.subsystemName}-${param.parameterName}`
|
const rowId = param.id || `${param.subsystemName}-${param.parameterName}`
|
||||||
|
|||||||
@ -68,17 +68,20 @@
|
|||||||
>
|
>
|
||||||
<el-form ref="form" :model="formData" :rules="formRules" label-width="100px">
|
<el-form ref="form" :model="formData" :rules="formRules" label-width="100px">
|
||||||
<el-form-item label="责任部门:" prop="department">
|
<el-form-item label="责任部门:" prop="department">
|
||||||
<el-cascader
|
<el-input
|
||||||
ref="departmentCascader"
|
v-model="formData.selectDeptName"
|
||||||
v-model="formData.department"
|
|
||||||
:options="departmentList"
|
|
||||||
:props="departmentCascaderProps"
|
|
||||||
filterable
|
|
||||||
placeholder="请选择责任部门"
|
placeholder="请选择责任部门"
|
||||||
clearable
|
readonly
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
@change="handleDepartmentChange"
|
@click.native="handleOpenDepartmentDialog"
|
||||||
/>
|
>
|
||||||
|
<i
|
||||||
|
slot="suffix"
|
||||||
|
class="el-input__icon el-icon-search"
|
||||||
|
style="cursor: pointer;"
|
||||||
|
@click.stop="handleOpenDepartmentDialog"
|
||||||
|
></i>
|
||||||
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="子系统:" prop="subsystem">
|
<el-form-item label="子系统:" prop="subsystem">
|
||||||
<el-select
|
<el-select
|
||||||
@ -148,6 +151,45 @@
|
|||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
|
<!-- 部门选择弹窗 -->
|
||||||
|
<el-dialog
|
||||||
|
title="选择责任部门"
|
||||||
|
:visible.sync="departmentDialogVisible"
|
||||||
|
width="500px"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
append-to-body
|
||||||
|
@close="handleDepartmentDialogClose"
|
||||||
|
>
|
||||||
|
<el-input
|
||||||
|
v-model="departmentTreeFilterText"
|
||||||
|
size="small"
|
||||||
|
placeholder="请输入部门名称进行搜索"
|
||||||
|
clearable
|
||||||
|
class="department-tree-search"
|
||||||
|
>
|
||||||
|
<i slot="prefix" class="el-input__icon el-icon-search"></i>
|
||||||
|
</el-input>
|
||||||
|
<el-tree
|
||||||
|
ref="departmentTree"
|
||||||
|
:data="departmentList"
|
||||||
|
:props="{ children: 'children', label: 'name' }"
|
||||||
|
node-key="id"
|
||||||
|
:filter-node-method="filterDepartmentNode"
|
||||||
|
highlight-current
|
||||||
|
:expand-on-click-node="false"
|
||||||
|
class="department-tree"
|
||||||
|
@node-click="handleDepartmentNodeClick"
|
||||||
|
/>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="handleDepartmentDialogClose">
|
||||||
|
取消
|
||||||
|
</el-button>
|
||||||
|
<el-button type="primary" :disabled="!selectedDepartmentId" @click="handleDepartmentDialogConfirm">
|
||||||
|
确定
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -167,7 +209,7 @@ export default {
|
|||||||
dialogMode: 'add', // 'add' 或 'edit'
|
dialogMode: 'add', // 'add' 或 'edit'
|
||||||
currentEditIndex: -1,
|
currentEditIndex: -1,
|
||||||
formData: {
|
formData: {
|
||||||
department: '', // 级联选择器绑定的部门ID
|
department: '', // 部门ID(用于表单验证)
|
||||||
subsystem: '', // 子系统(单选,字符串)
|
subsystem: '', // 子系统(单选,字符串)
|
||||||
partsName: '', // 零部件名称(单选,字符串)
|
partsName: '', // 零部件名称(单选,字符串)
|
||||||
filler: [], // 填写人用户ID数组(多选,用于提交)
|
filler: [], // 填写人用户ID数组(多选,用于提交)
|
||||||
@ -193,15 +235,11 @@ export default {
|
|||||||
departmentList: [],
|
departmentList: [],
|
||||||
searchTimer: null, // 防抖定时器
|
searchTimer: null, // 防抖定时器
|
||||||
currentRequest: null, // 当前请求引用
|
currentRequest: null, // 当前请求引用
|
||||||
// 部门级联选择器相关
|
departmentDialogVisible: false, // 部门选择弹窗显示状态
|
||||||
departmentCascaderProps: {
|
departmentTreeFilterText: '', // 部门树搜索文本
|
||||||
value: 'id',
|
selectedDepartmentId: '', // 选中的部门ID
|
||||||
label: 'name',
|
selectedDepartmentName: '', // 选中的部门名称
|
||||||
children: 'children',
|
selectedDepartmentNode: null // 选中的部门节点
|
||||||
checkStrictly: true, // 允许选择任意一级(单选)
|
|
||||||
emitPath: false, // 只返回最后一级的值(单选时只返回选中的id)
|
|
||||||
multiple: false // 明确指定为单选
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -209,6 +247,13 @@ export default {
|
|||||||
return this.dialogMode === 'add' ? '新增' : '修改'
|
return this.dialogMode === 'add' ? '新增' : '修改'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
departmentTreeFilterText(val) {
|
||||||
|
if (this.$refs.departmentTree) {
|
||||||
|
this.$refs.departmentTree.filter(val)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.loadDepartmentList()
|
this.loadDepartmentList()
|
||||||
this.loadFillerData()
|
this.loadFillerData()
|
||||||
@ -340,7 +385,7 @@ export default {
|
|||||||
if (resp && resp.data) {
|
if (resp && resp.data) {
|
||||||
result = resp.data.result || resp.data.data || resp.data || []
|
result = resp.data.result || resp.data.data || resp.data || []
|
||||||
}
|
}
|
||||||
// 格式化数据为级联选择器需要的格式
|
// 格式化数据为树形结构格式
|
||||||
this.departmentList = this.formatDepartmentTreeData(result)
|
this.departmentList = this.formatDepartmentTreeData(result)
|
||||||
})
|
})
|
||||||
.asyncErrorCatch((err) => {
|
.asyncErrorCatch((err) => {
|
||||||
@ -348,7 +393,7 @@ export default {
|
|||||||
this.departmentList = []
|
this.departmentList = []
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 格式化部门树数据为级联选择器格式
|
// 格式化部门树数据为树形结构格式
|
||||||
formatDepartmentTreeData(data) {
|
formatDepartmentTreeData(data) {
|
||||||
if (!Array.isArray(data)) {
|
if (!Array.isArray(data)) {
|
||||||
return []
|
return []
|
||||||
@ -457,7 +502,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.formData = {
|
this.formData = {
|
||||||
department: row.departmentId || '', // 级联选择器需要部门ID
|
department: row.departmentId || '', // 部门ID(用于表单验证)
|
||||||
subsystem: subsystemValue, // 子系统改为单选,字符串
|
subsystem: subsystemValue, // 子系统改为单选,字符串
|
||||||
partsName: row.partsName || '', // 零部件名称
|
partsName: row.partsName || '', // 零部件名称
|
||||||
filler: userIds, // 填写人改为多选,数组
|
filler: userIds, // 填写人改为多选,数组
|
||||||
@ -580,25 +625,70 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 处理部门选择变化
|
// 打开部门选择弹窗
|
||||||
handleDepartmentChange(value) {
|
handleOpenDepartmentDialog() {
|
||||||
if (value) {
|
// 如果有已选择的部门,设置树的高亮
|
||||||
// 获取最后一级的id
|
if (this.formData.selectDeptId) {
|
||||||
this.formData.selectDeptId = value
|
this.selectedDepartmentId = this.formData.selectDeptId
|
||||||
// 查找部门路径名称
|
this.selectedDepartmentName = this.formData.selectDeptName
|
||||||
this.formData.selectDeptName = this.getDepartmentPathName(value)
|
this.$nextTick(() => {
|
||||||
|
if (this.$refs.departmentTree) {
|
||||||
|
this.$refs.departmentTree.setCurrentKey(this.formData.selectDeptId)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.selectedDepartmentId = ''
|
||||||
|
this.selectedDepartmentName = ''
|
||||||
|
}
|
||||||
|
this.departmentTreeFilterText = ''
|
||||||
|
this.departmentDialogVisible = true
|
||||||
|
},
|
||||||
|
// 关闭部门选择弹窗
|
||||||
|
handleDepartmentDialogClose() {
|
||||||
|
this.departmentDialogVisible = false
|
||||||
|
this.departmentTreeFilterText = ''
|
||||||
|
// 如果取消,恢复之前的选择
|
||||||
|
if (this.formData.selectDeptId) {
|
||||||
|
this.selectedDepartmentId = this.formData.selectDeptId
|
||||||
|
this.selectedDepartmentName = this.formData.selectDeptName
|
||||||
|
} else {
|
||||||
|
this.selectedDepartmentId = ''
|
||||||
|
this.selectedDepartmentName = ''
|
||||||
|
this.selectedDepartmentNode = null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 确认选择部门
|
||||||
|
handleDepartmentDialogConfirm() {
|
||||||
|
if (this.selectedDepartmentId && this.selectedDepartmentNode) {
|
||||||
|
// 更新表单数据
|
||||||
|
this.formData.selectDeptId = this.selectedDepartmentId
|
||||||
|
this.formData.selectDeptName = this.selectedDepartmentName
|
||||||
|
this.formData.department = this.selectedDepartmentId
|
||||||
// 清空填写人选择(改为数组)
|
// 清空填写人选择(改为数组)
|
||||||
this.formData.filler = []
|
this.formData.filler = []
|
||||||
this.formData.fillerName = ''
|
this.formData.fillerName = ''
|
||||||
} else {
|
this.userOptions = []
|
||||||
// 清空时重置
|
// 关闭弹窗
|
||||||
this.formData.selectDeptId = ''
|
this.departmentDialogVisible = false
|
||||||
this.formData.selectDeptName = ''
|
// 清除表单验证错误
|
||||||
this.formData.filler = []
|
this.$nextTick(() => {
|
||||||
this.formData.fillerName = ''
|
if (this.$refs.form) {
|
||||||
this.fillerPersons = []
|
this.$refs.form.clearValidate('department')
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
// 处理部门树节点点击
|
||||||
|
handleDepartmentNodeClick(data) {
|
||||||
|
this.selectedDepartmentId = data.id
|
||||||
|
this.selectedDepartmentName = this.getDepartmentPathName(data.id)
|
||||||
|
this.selectedDepartmentNode = data
|
||||||
|
},
|
||||||
|
// 过滤部门树节点
|
||||||
|
filterDepartmentNode(value, data) {
|
||||||
|
if (!value) return true
|
||||||
|
return (data.name || '').toLowerCase().includes(value.toLowerCase())
|
||||||
|
},
|
||||||
// 远程搜索填写人(用于 el-select)
|
// 远程搜索填写人(用于 el-select)
|
||||||
handleRemoteSearch(query) {
|
handleRemoteSearch(query) {
|
||||||
// 如果查询为空,保留已选择的人员信息
|
// 如果查询为空,保留已选择的人员信息
|
||||||
@ -888,4 +978,14 @@ export default {
|
|||||||
margin-left: 20px;
|
margin-left: 20px;
|
||||||
text-align: right !important;
|
text-align: right !important;
|
||||||
}
|
}
|
||||||
|
.department-tree-search {
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
.department-tree {
|
||||||
|
max-height: 400px;
|
||||||
|
overflow-y: auto;
|
||||||
|
border: 1px solid #ebeef5;
|
||||||
|
border-radius: 4px;
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -25,6 +25,9 @@
|
|||||||
已隐藏参数
|
已隐藏参数
|
||||||
<span v-if="hiddenParams.length > 0" class="hidden-count">({{ hiddenParams.length }})</span>
|
<span v-if="hiddenParams.length > 0" class="hidden-count">({{ hiddenParams.length }})</span>
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<el-button class="download-comparison-data-button" @click="handleDownloadComparisonData">
|
||||||
|
下载对比数据
|
||||||
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -132,7 +135,7 @@
|
|||||||
<div class="model-select-dialog">
|
<div class="model-select-dialog">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="modelSearchText"
|
v-model="modelSearchText"
|
||||||
placeholder="请输入机型名称搜索"
|
placeholder="请输入产品型号,状态代号/产品编号,平台,系列搜索"
|
||||||
prefix-icon="el-icon-search"
|
prefix-icon="el-icon-search"
|
||||||
clearable
|
clearable
|
||||||
class="model-search-input"
|
class="model-search-input"
|
||||||
@ -469,12 +472,19 @@ export default {
|
|||||||
return !addedModelIds.has(modelId)
|
return !addedModelIds.has(modelId)
|
||||||
})
|
})
|
||||||
|
|
||||||
// 根据搜索文本过滤
|
// 根据搜索文本过滤(支持 modelName、productNumber、platform、series 四个字段)
|
||||||
if (this.modelSearchText) {
|
if (this.modelSearchText) {
|
||||||
const searchText = this.modelSearchText.toLowerCase()
|
const searchText = this.modelSearchText.toLowerCase()
|
||||||
filtered = filtered.filter(model => {
|
filtered = filtered.filter(model => {
|
||||||
const modelName = (model.modelName || model.productFullName || '').toLowerCase()
|
const modelName = (model.modelName || model.productFullName || '').toLowerCase()
|
||||||
return modelName.includes(searchText)
|
const productNumber = (model.productNumber || '').toLowerCase()
|
||||||
|
const platform = (model.platform || '').toLowerCase()
|
||||||
|
const series = (model.series || '').toLowerCase()
|
||||||
|
// 只要任一字段包含搜索关键字,就显示该机型
|
||||||
|
return modelName.includes(searchText) ||
|
||||||
|
productNumber.includes(searchText) ||
|
||||||
|
platform.includes(searchText) ||
|
||||||
|
series.includes(searchText)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -692,6 +702,7 @@ export default {
|
|||||||
...api.GET_MODEL_QUERY,
|
...api.GET_MODEL_QUERY,
|
||||||
params: {
|
params: {
|
||||||
engineModelID: modelId,
|
engineModelID: modelId,
|
||||||
|
userID: getUserId(),
|
||||||
subsystemParts: subsystemTypes // 格式:["子系统名称-参数类型"]
|
subsystemParts: subsystemTypes // 格式:["子系统名称-参数类型"]
|
||||||
},
|
},
|
||||||
disableSuccessMsg: true
|
disableSuccessMsg: true
|
||||||
@ -1025,6 +1036,84 @@ export default {
|
|||||||
console.log('树数据还未加载完成,等待加载完成后再更新选中状态')
|
console.log('树数据还未加载完成,等待加载完成后再更新选中状态')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
// 下载
|
||||||
|
handleDownloadComparisonData() {
|
||||||
|
// 获取已添加在右侧的机型ID
|
||||||
|
const allSelectedIds = this.comparisonModels.map(item => item.id).filter(id => id)
|
||||||
|
if (allSelectedIds.length === 0) {
|
||||||
|
this.$message.warning('请先添加机型')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// 获取选中的参数类型
|
||||||
|
const { subsystemTypes } = this.getSelectedSubsystemsAndTypes()
|
||||||
|
const { url, method = 'post', headers = {} } = api.DOWNLOAD_MODEL_QUERY_DATA || {}
|
||||||
|
const requestConfig = {
|
||||||
|
url,
|
||||||
|
method,
|
||||||
|
data: {
|
||||||
|
userID: getUserId(),
|
||||||
|
modelIds: allSelectedIds,
|
||||||
|
subsystemParts: subsystemTypes
|
||||||
|
},
|
||||||
|
responseType: 'blob',
|
||||||
|
headers,
|
||||||
|
disableSuccessMsg: true
|
||||||
|
}
|
||||||
|
this.$axios(requestConfig)
|
||||||
|
.then((response) => {
|
||||||
|
const blobData = response.data
|
||||||
|
if (!blobData) {
|
||||||
|
console.log('下载失败,文件内容为空')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const contentType =
|
||||||
|
response.headers &&
|
||||||
|
(response.headers['content-type'] || response.headers['Content-Type'])
|
||||||
|
if (contentType && contentType.includes('application/json')) {
|
||||||
|
try {
|
||||||
|
const reader = new FileReader()
|
||||||
|
reader.onload = () => {
|
||||||
|
console.log(`下载失败: ${reader.result}`)
|
||||||
|
}
|
||||||
|
reader.readAsText(blobData)
|
||||||
|
} catch (err) {
|
||||||
|
console.error('解析下载失败响应异常:', err)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const disposition =
|
||||||
|
response.headers &&
|
||||||
|
(response.headers['content-disposition'] || response.headers['Content-Disposition'])
|
||||||
|
let filename = '对比数据.xlsx'
|
||||||
|
if (disposition) {
|
||||||
|
const filenameMatch = /filename\*=UTF-8''([^;]+)|filename="?([^";]+)"?/i.exec(
|
||||||
|
disposition
|
||||||
|
)
|
||||||
|
const matchedName = filenameMatch ? filenameMatch[1] || filenameMatch[2] : ''
|
||||||
|
if (matchedName) {
|
||||||
|
try {
|
||||||
|
filename = decodeURIComponent(matchedName)
|
||||||
|
} catch (err) {
|
||||||
|
filename = matchedName
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const downloadUrl = window.URL.createObjectURL(blobData)
|
||||||
|
const link = document.createElement('a')
|
||||||
|
link.href = downloadUrl
|
||||||
|
link.download = filename
|
||||||
|
document.body.appendChild(link)
|
||||||
|
link.click()
|
||||||
|
document.body.removeChild(link)
|
||||||
|
window.URL.revokeObjectURL(downloadUrl)
|
||||||
|
console.log('下载开始,请查看浏览器下载列表')
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.error('下载失败:', err)
|
||||||
|
console.log('下载失败,请稍后重试')
|
||||||
|
})
|
||||||
|
|
||||||
|
},
|
||||||
// 根据可显示的参数更新树节点选中状态(不改变树数据)
|
// 根据可显示的参数更新树节点选中状态(不改变树数据)
|
||||||
updateCheckedKeysByDisplayParams() {
|
updateCheckedKeysByDisplayParams() {
|
||||||
// 确保使用完整的树数据和节点映射
|
// 确保使用完整的树数据和节点映射
|
||||||
@ -1549,9 +1638,6 @@ export default {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 保存要恢复的参数数量
|
|
||||||
const restoreCount = keysToRestore.length
|
|
||||||
|
|
||||||
// 从 hiddenParams 中移除选中的参数
|
// 从 hiddenParams 中移除选中的参数
|
||||||
keysToRestore.forEach(key => {
|
keysToRestore.forEach(key => {
|
||||||
const index = this.hiddenParams.indexOf(key)
|
const index = this.hiddenParams.indexOf(key)
|
||||||
|
|||||||
@ -16,21 +16,22 @@
|
|||||||
<div class="search-fields">
|
<div class="search-fields">
|
||||||
<div class="search-field">
|
<div class="search-field">
|
||||||
<span class="field-label">模板名称</span>
|
<span class="field-label">模板名称</span>
|
||||||
<el-autocomplete
|
<el-select
|
||||||
v-model="searchPanelValue.templateName"
|
v-model="searchPanelValue.templateName"
|
||||||
:fetch-suggestions="remoteSearchTemplate"
|
|
||||||
:loading="templateSelectLoading"
|
:loading="templateSelectLoading"
|
||||||
placeholder="请输入模板名称"
|
placeholder="请选择模板名称"
|
||||||
clearable
|
clearable
|
||||||
|
filterable
|
||||||
style="width: 220px"
|
style="width: 220px"
|
||||||
@change="handleSearch"
|
@change="handleSearch"
|
||||||
@select="handleSearch"
|
|
||||||
@keyup.enter.native="handleSearch"
|
|
||||||
>
|
>
|
||||||
<template slot-scope="{ item }">
|
<el-option
|
||||||
<div>{{ item.value }}</div>
|
v-for="item in templateOptions"
|
||||||
</template>
|
:key="item.value"
|
||||||
</el-autocomplete>
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
</div>
|
</div>
|
||||||
<div class="search-actions">
|
<div class="search-actions">
|
||||||
<el-button type="primary" @click="handleDownloadImportTemplate">
|
<el-button type="primary" @click="handleDownloadImportTemplate">
|
||||||
@ -172,6 +173,7 @@
|
|||||||
:template-version="currentVersion"
|
:template-version="currentVersion"
|
||||||
:version-list="versionList"
|
:version-list="versionList"
|
||||||
:detail="currentDetail"
|
:detail="currentDetail"
|
||||||
|
:template-management-permissions="templateManagementPermissions"
|
||||||
class="model-detail-wrapper"
|
class="model-detail-wrapper"
|
||||||
@back="handleBackFromDetail"
|
@back="handleBackFromDetail"
|
||||||
/>
|
/>
|
||||||
@ -260,7 +262,8 @@ export default {
|
|||||||
downloadingRowId: '',
|
downloadingRowId: '',
|
||||||
tenantId: '1764149921900',
|
tenantId: '1764149921900',
|
||||||
userId: getUserId(),
|
userId: getUserId(),
|
||||||
errorDialogVisible: false
|
errorDialogVisible: false,
|
||||||
|
templateManagementPermissions: [] // 暂存 menuPath 为 "数据录入/模板管理" 的权限数组
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -322,11 +325,13 @@ export default {
|
|||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
// this.loadUserSelfRole()
|
// this.loadUserSelfRole()
|
||||||
|
this.loadTemplateOptions()
|
||||||
this.loadData()
|
this.loadData()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 加载用户自身角色权限
|
// 加载用户自身角色权限
|
||||||
loadUserSelfRole() {
|
loadUserSelfRole() {
|
||||||
|
localStorage.setItem('user_self_role', [])
|
||||||
const request = {
|
const request = {
|
||||||
...api.GET_USER_SELF_ROLE,
|
...api.GET_USER_SELF_ROLE,
|
||||||
params: {
|
params: {
|
||||||
@ -343,12 +348,41 @@ export default {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('存储权限数据到 localStorage 失败:', err)
|
console.error('存储权限数据到 localStorage 失败:', err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 遍历 user_self_role 数组,查找 menuPath 为 "数据录入/模板管理" 的内容
|
||||||
|
this.filterTemplateManagementPermissions()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.asyncErrorCatch((err) => {
|
.asyncErrorCatch((err) => {
|
||||||
console.error('获取用户自身角色失败:', err)
|
console.error('获取用户自身角色失败:', err)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
// 过滤模板管理相关的权限
|
||||||
|
filterTemplateManagementPermissions() {
|
||||||
|
try {
|
||||||
|
const permissionDataStr = localStorage.getItem('user_self_role')
|
||||||
|
if (!permissionDataStr) {
|
||||||
|
this.templateManagementPermissions = []
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const permissionData = JSON.parse(permissionDataStr)
|
||||||
|
if (!Array.isArray(permissionData)) {
|
||||||
|
this.templateManagementPermissions = []
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查找 menuPath 为 "数据录入/模板管理" 的所有权限项
|
||||||
|
this.templateManagementPermissions = permissionData.filter((perm) => {
|
||||||
|
return perm.menuPath === '数据录入/模板管理'
|
||||||
|
})
|
||||||
|
|
||||||
|
console.log('模板管理权限数据:', this.templateManagementPermissions)
|
||||||
|
} catch (err) {
|
||||||
|
console.error('过滤模板管理权限失败:', err)
|
||||||
|
this.templateManagementPermissions = []
|
||||||
|
}
|
||||||
|
},
|
||||||
// 检查权限
|
// 检查权限
|
||||||
// menuPath: 模块路径,如 "数据录入/模板管理"
|
// menuPath: 模块路径,如 "数据录入/模板管理"
|
||||||
// subsystem: 子系统名称(可选,如果提供则检查该子系统的权限)
|
// subsystem: 子系统名称(可选,如果提供则检查该子系统的权限)
|
||||||
@ -449,6 +483,10 @@ export default {
|
|||||||
}
|
}
|
||||||
// 获取版本列表
|
// 获取版本列表
|
||||||
this.loadVersionList(row)
|
this.loadVersionList(row)
|
||||||
|
// 确保权限数据已加载
|
||||||
|
if (this.templateManagementPermissions.length === 0) {
|
||||||
|
this.loadUserSelfRole()
|
||||||
|
}
|
||||||
this.showModelDetail = true
|
this.showModelDetail = true
|
||||||
},
|
},
|
||||||
loadVersionList(row) {
|
loadVersionList(row) {
|
||||||
@ -838,7 +876,7 @@ export default {
|
|||||||
},
|
},
|
||||||
resetSearch() {
|
resetSearch() {
|
||||||
Object.assign(this.searchPanelValue, createDefaultSearch())
|
Object.assign(this.searchPanelValue, createDefaultSearch())
|
||||||
this.templateOptions = []
|
|
||||||
this.handleSearch()
|
this.handleSearch()
|
||||||
},
|
},
|
||||||
handleSearch() {
|
handleSearch() {
|
||||||
@ -871,18 +909,14 @@ export default {
|
|||||||
console.error('查询失败:', err)
|
console.error('查询失败:', err)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
remoteSearchTemplate(query, callback) {
|
// 加载模板名称下拉框数据
|
||||||
if (!query) {
|
loadTemplateOptions() {
|
||||||
callback([])
|
|
||||||
return
|
|
||||||
}
|
|
||||||
this.templateSelectLoading = true
|
this.templateSelectLoading = true
|
||||||
const request = {
|
const request = {
|
||||||
...api.GET_MODEL_LIST,
|
...api.GET_MODEL_LIST,
|
||||||
params: {
|
params: {
|
||||||
pageNumber: 1,
|
pageNumber: 1,
|
||||||
pageSize: 10,
|
pageSize: 999
|
||||||
templateName: query
|
|
||||||
},
|
},
|
||||||
disableSuccessMsg: true
|
disableSuccessMsg: true
|
||||||
}
|
}
|
||||||
@ -890,7 +924,7 @@ export default {
|
|||||||
.asyncThen((resp) => {
|
.asyncThen((resp) => {
|
||||||
const list = resp.data.result || []
|
const list = resp.data.result || []
|
||||||
const seen = new Set()
|
const seen = new Set()
|
||||||
const suggestions = list
|
const options = list
|
||||||
.map((item) => item.templateName || item.po_name || '')
|
.map((item) => item.templateName || item.po_name || '')
|
||||||
.filter((name) => {
|
.filter((name) => {
|
||||||
if (!name || seen.has(name)) {
|
if (!name || seen.has(name)) {
|
||||||
@ -900,15 +934,16 @@ export default {
|
|||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
.map((name) => ({
|
.map((name) => ({
|
||||||
|
label: name,
|
||||||
value: name
|
value: name
|
||||||
}))
|
}))
|
||||||
|
this.templateOptions = options
|
||||||
this.templateSelectLoading = false
|
this.templateSelectLoading = false
|
||||||
callback(suggestions)
|
|
||||||
})
|
})
|
||||||
.asyncErrorCatch((err) => {
|
.asyncErrorCatch((err) => {
|
||||||
console.error('搜索模板失败:', err)
|
console.error('加载模板列表失败:', err)
|
||||||
|
this.templateOptions = []
|
||||||
this.templateSelectLoading = false
|
this.templateSelectLoading = false
|
||||||
callback([])
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 生成UUID
|
// 生成UUID
|
||||||
|
|||||||
@ -132,21 +132,23 @@
|
|||||||
<span class="deleted-text">已删除</span>
|
<span class="deleted-text">已删除</span>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<a
|
<template v-if="canEditOrDeleteRow(row)">
|
||||||
href="javascript:void(0)"
|
<a
|
||||||
class="el-link el-link--primary"
|
href="javascript:void(0)"
|
||||||
@click.stop="handleRowEdit(row)"
|
class="el-link el-link--primary"
|
||||||
>
|
@click.stop="handleRowEdit(row)"
|
||||||
修改
|
>
|
||||||
</a>
|
修改
|
||||||
<span class="link-separator"></span>
|
</a>
|
||||||
<a
|
<span class="link-separator"></span>
|
||||||
href="javascript:void(0)"
|
<a
|
||||||
class="el-link el-link--primary"
|
href="javascript:void(0)"
|
||||||
@click.stop="handleRowDelete(row, rowIndex)"
|
class="el-link el-link--primary"
|
||||||
>
|
@click.stop="handleRowDelete(row, rowIndex)"
|
||||||
删除
|
>
|
||||||
</a>
|
删除
|
||||||
|
</a>
|
||||||
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -480,6 +482,10 @@ export default {
|
|||||||
detail: {
|
detail: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => ({})
|
default: () => ({})
|
||||||
|
},
|
||||||
|
templateManagementPermissions: {
|
||||||
|
type: Array,
|
||||||
|
default: () => []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data: function() {
|
data: function() {
|
||||||
@ -595,7 +601,20 @@ export default {
|
|||||||
// 检查是否应该显示维护参数按钮(在 DRAFT 或 COMPLETED 状态下都显示,且当前版本是最新版本)
|
// 检查是否应该显示维护参数按钮(在 DRAFT 或 COMPLETED 状态下都显示,且当前版本是最新版本)
|
||||||
shouldShowMaintainButton() {
|
shouldShowMaintainButton() {
|
||||||
const status = this.currentStatus || (this.detail && this.detail.status) || ''
|
const status = this.currentStatus || (this.detail && this.detail.status) || ''
|
||||||
return (status === 'DRAFT' || status === 'COMPLETE') && this.isLatestVersion
|
const baseCondition = (status === 'DRAFT' || status === 'COMPLETE') && this.isLatestVersion
|
||||||
|
if (!baseCondition) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
// 检查是否有对应子系统的权限
|
||||||
|
const templateName = this.displayTemplateName
|
||||||
|
if (!templateName || !this.templateManagementPermissions || this.templateManagementPermissions.length === 0) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
// 查找是否有匹配的子系统权限
|
||||||
|
const hasSubsystemPermission = this.templateManagementPermissions.some((perm) => {
|
||||||
|
return perm.subsystem === templateName
|
||||||
|
})
|
||||||
|
return hasSubsystemPermission
|
||||||
},
|
},
|
||||||
// 判断当前版本是否是最新版本
|
// 判断当前版本是否是最新版本
|
||||||
isLatestVersion() {
|
isLatestVersion() {
|
||||||
@ -1050,6 +1069,27 @@ export default {
|
|||||||
if (!parameterName) {
|
if (!parameterName) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
// 优先使用传入的权限数组
|
||||||
|
if (this.templateManagementPermissions && this.templateManagementPermissions.length > 0) {
|
||||||
|
const templateName = this.displayTemplateName
|
||||||
|
const matchedPermissions = this.templateManagementPermissions.filter((perm) => {
|
||||||
|
// 检查 subsystem 是否匹配 templateName
|
||||||
|
if (templateName && perm.subsystem !== templateName) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查 parameterName 是否匹配
|
||||||
|
if (perm.parameterName !== parameterName) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查权限类型是否为"编辑"
|
||||||
|
return perm.parameterPer === '编辑'
|
||||||
|
})
|
||||||
|
|
||||||
|
return matchedPermissions.length > 0
|
||||||
|
}
|
||||||
|
// 如果没有传入权限数组,从 localStorage 读取
|
||||||
try {
|
try {
|
||||||
const permissionDataStr = localStorage.getItem('user_self_role')
|
const permissionDataStr = localStorage.getItem('user_self_role')
|
||||||
if (!permissionDataStr) {
|
if (!permissionDataStr) {
|
||||||
@ -1089,6 +1129,22 @@ export default {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
// 检查是否可以编辑或删除某一行
|
||||||
|
canEditOrDeleteRow(row) {
|
||||||
|
if (!row) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
// 如果该行的 createdBy 等于当前用户ID,可以编辑/删除
|
||||||
|
if (row.createdBy === getUserId()) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
// 如果参数名称在权限数组中,且权限类型为"编辑",可以编辑/删除
|
||||||
|
const parameterName = row.parameterName
|
||||||
|
if (parameterName && this.hasParameterEditPermission(parameterName)) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
},
|
||||||
loadDepartmentList() {
|
loadDepartmentList() {
|
||||||
const request = {
|
const request = {
|
||||||
...api.QUERY_ORG_TREE,
|
...api.QUERY_ORG_TREE,
|
||||||
|
|||||||
@ -136,7 +136,7 @@
|
|||||||
<span v-if="data.type === 'subsystem'" class="type-tag subsystem-tag">子系统</span>
|
<span v-if="data.type === 'subsystem'" class="type-tag subsystem-tag">子系统</span>
|
||||||
<span v-if="data.type === 'parameter'" class="type-tag parameter-tag">参数类型</span> -->
|
<span v-if="data.type === 'parameter'" class="type-tag parameter-tag">参数类型</span> -->
|
||||||
</span>
|
</span>
|
||||||
<span v-if="data.type === 'parameter'" class="permission-checkboxes">
|
<span v-if="data.type === 'subsystem' || data.type === 'parameter'" class="permission-checkboxes">
|
||||||
<el-checkbox
|
<el-checkbox
|
||||||
v-model="data.permissions.view"
|
v-model="data.permissions.view"
|
||||||
size="small"
|
size="small"
|
||||||
@ -242,14 +242,18 @@
|
|||||||
clearable
|
clearable
|
||||||
:remote-method="queryPersonByDepartment"
|
:remote-method="queryPersonByDepartment"
|
||||||
:loading="personSearchLoading"
|
:loading="personSearchLoading"
|
||||||
value-key="userId"
|
value-key="userNumber"
|
||||||
|
class="person-select"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in personOptions"
|
v-for="item in personOptions"
|
||||||
:key="item.userId"
|
:key="item.userNumber"
|
||||||
:label="item.username"
|
:label="item.username"
|
||||||
:value="item"
|
:value="item.userNumber"
|
||||||
/>
|
>
|
||||||
|
<span class="username-text">{{ item.username }}</span>
|
||||||
|
<span class="user-id-text">{{ item.userNumber }}</span>
|
||||||
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</template>
|
</template>
|
||||||
@ -371,7 +375,7 @@ export default {
|
|||||||
menuList: [
|
menuList: [
|
||||||
'模板管理',
|
'模板管理',
|
||||||
'玉柴发动机数据',
|
'玉柴发动机数据',
|
||||||
'竞品发动机数据',
|
'竞品发动机数据'
|
||||||
],
|
],
|
||||||
// 人员配置相关
|
// 人员配置相关
|
||||||
personConfigDialogVisible: false,
|
personConfigDialogVisible: false,
|
||||||
@ -379,7 +383,7 @@ export default {
|
|||||||
personConfigFormData: {
|
personConfigFormData: {
|
||||||
configType: 'person', // 配置类型:'person' 配置人员,'department' 配置部门
|
configType: 'person', // 配置类型:'person' 配置人员,'department' 配置部门
|
||||||
department: '', // 级联选择器绑定的部门ID(配置人员时为单个,配置部门时为数组)
|
department: '', // 级联选择器绑定的部门ID(配置人员时为单个,配置部门时为数组)
|
||||||
person: [], // 人员数组(用于提交,包含 {userId, username} 对象)
|
person: [], // 人员工号数组(用于 el-select 的 v-model,存储 userNumber)
|
||||||
selectDeptId: '', // 选中的部门ID(用于搜索人员,配置人员模式使用)
|
selectDeptId: '', // 选中的部门ID(用于搜索人员,配置人员模式使用)
|
||||||
selectDeptName: '', // 选中的部门名称(用于提交)
|
selectDeptName: '', // 选中的部门名称(用于提交)
|
||||||
selectDeptIds: [], // 选中的部门ID数组(配置部门模式使用)
|
selectDeptIds: [], // 选中的部门ID数组(配置部门模式使用)
|
||||||
@ -503,10 +507,19 @@ export default {
|
|||||||
},
|
},
|
||||||
// 验证权限
|
// 验证权限
|
||||||
validatePermissions(rule, value, callback) {
|
validatePermissions(rule, value, callback) {
|
||||||
const hasPermission = this.allParameterNodes.some(node => {
|
// 检查是否有参数节点被选中
|
||||||
|
const hasParameterPermission = this.allParameterNodes.some(node => {
|
||||||
return node.permissions.view || node.permissions.edit
|
return node.permissions.view || node.permissions.edit
|
||||||
})
|
})
|
||||||
if (!hasPermission) {
|
|
||||||
|
// 检查是否有子系统节点被选中
|
||||||
|
const hasSubsystemPermission = Object.keys(this.nodeMap).some(nodeId => {
|
||||||
|
const node = this.nodeMap[nodeId]
|
||||||
|
return node && node.type === 'subsystem' && node.permissions &&
|
||||||
|
(node.permissions.view || node.permissions.edit)
|
||||||
|
})
|
||||||
|
|
||||||
|
if (!hasParameterPermission && !hasSubsystemPermission) {
|
||||||
callback(new Error('请至少分配一个权限'))
|
callback(new Error('请至少分配一个权限'))
|
||||||
} else {
|
} else {
|
||||||
callback()
|
callback()
|
||||||
@ -626,6 +639,10 @@ export default {
|
|||||||
type: 'subsystem',
|
type: 'subsystem',
|
||||||
menuName: menuNode.label,
|
menuName: menuNode.label,
|
||||||
subsystem: subsystemNameStr,
|
subsystem: subsystemNameStr,
|
||||||
|
permissions: {
|
||||||
|
view: false,
|
||||||
|
edit: false
|
||||||
|
},
|
||||||
children: null, // 初始为 null,懒加载时加载
|
children: null, // 初始为 null,懒加载时加载
|
||||||
isLeaf: false // 明确标记为非叶子节点,让 el-tree 显示展开按钮
|
isLeaf: false // 明确标记为非叶子节点,让 el-tree 显示展开按钮
|
||||||
}
|
}
|
||||||
@ -723,6 +740,10 @@ export default {
|
|||||||
parameterNodes.forEach(node => {
|
parameterNodes.forEach(node => {
|
||||||
this.applyPendingPermissionsToNode(node)
|
this.applyPendingPermissionsToNode(node)
|
||||||
})
|
})
|
||||||
|
// 更新子系统权限状态(如果有参数节点)
|
||||||
|
if (parameterNodes.length > 0) {
|
||||||
|
this.updateSubsystemPermissionFromChildren(parameterNodes[0])
|
||||||
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.asyncErrorCatch((err) => {
|
.asyncErrorCatch((err) => {
|
||||||
@ -739,6 +760,15 @@ export default {
|
|||||||
// 使用 $set 确保响应式更新
|
// 使用 $set 确保响应式更新
|
||||||
this.$set(this.nodeMap[data.id].permissions, permissionType, data.permissions[permissionType])
|
this.$set(this.nodeMap[data.id].permissions, permissionType, data.permissions[permissionType])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 如果是子系统节点,全选/取消全选其下所有参数
|
||||||
|
if (data.type === 'subsystem') {
|
||||||
|
this.updateSubsystemChildParameters(data, permissionType)
|
||||||
|
} else if (data.type === 'parameter') {
|
||||||
|
// 如果是参数节点,更新其父子系统节点的权限状态
|
||||||
|
this.updateSubsystemPermissionFromChildren(data)
|
||||||
|
}
|
||||||
|
|
||||||
// 触发验证
|
// 触发验证
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
if (this.$refs.form) {
|
if (this.$refs.form) {
|
||||||
@ -746,6 +776,77 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
// 更新子系统下所有参数的权限
|
||||||
|
updateSubsystemChildParameters(subsystemNode, permissionType) {
|
||||||
|
const subsystemId = subsystemNode.id
|
||||||
|
const newValue = subsystemNode.permissions[permissionType]
|
||||||
|
|
||||||
|
// 查找该子系统下的所有参数节点
|
||||||
|
Object.keys(this.nodeMap).forEach(nodeId => {
|
||||||
|
const node = this.nodeMap[nodeId]
|
||||||
|
if (node && node.type === 'parameter' && node.id && node.id.startsWith(subsystemId + '-param-')) {
|
||||||
|
// 确保权限对象存在
|
||||||
|
if (!node.permissions) {
|
||||||
|
this.$set(node, 'permissions', { view: false, edit: false })
|
||||||
|
}
|
||||||
|
// 更新参数节点的权限
|
||||||
|
this.$set(node.permissions, permissionType, newValue)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 根据子参数节点的权限状态更新子系统节点的权限状态
|
||||||
|
updateSubsystemPermissionFromChildren(parameterNode) {
|
||||||
|
if (!parameterNode || !parameterNode.id) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查找该参数节点的父子系统节点
|
||||||
|
const subsystemId = parameterNode.id.split('-param-')[0]
|
||||||
|
const subsystemNode = this.nodeMap[subsystemId]
|
||||||
|
|
||||||
|
if (!subsystemNode || subsystemNode.type !== 'subsystem') {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 确保子系统权限对象存在
|
||||||
|
if (!subsystemNode.permissions) {
|
||||||
|
this.$set(subsystemNode, 'permissions', { view: false, edit: false })
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查找该子系统下的所有参数节点
|
||||||
|
const childParameterNodes = []
|
||||||
|
Object.keys(this.nodeMap).forEach(nodeId => {
|
||||||
|
const node = this.nodeMap[nodeId]
|
||||||
|
if (node && node.type === 'parameter' && node.id && node.id.startsWith(subsystemId + '-param-')) {
|
||||||
|
childParameterNodes.push(node)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
if (childParameterNodes.length === 0) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 计算查看权限状态:如果所有参数都有查看权限,则子系统也选中;如果都没有,则不选中;否则保持当前状态
|
||||||
|
const allViewSelected = childParameterNodes.every(node => node.permissions && node.permissions.view)
|
||||||
|
const noneViewSelected = childParameterNodes.every(node => !node.permissions || !node.permissions.view)
|
||||||
|
|
||||||
|
// 计算编辑权限状态
|
||||||
|
const allEditSelected = childParameterNodes.every(node => node.permissions && node.permissions.edit)
|
||||||
|
const noneEditSelected = childParameterNodes.every(node => !node.permissions || !node.permissions.edit)
|
||||||
|
|
||||||
|
// 更新子系统权限
|
||||||
|
if (allViewSelected) {
|
||||||
|
this.$set(subsystemNode.permissions, 'view', true)
|
||||||
|
} else if (noneViewSelected) {
|
||||||
|
this.$set(subsystemNode.permissions, 'view', false)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (allEditSelected) {
|
||||||
|
this.$set(subsystemNode.permissions, 'edit', true)
|
||||||
|
} else if (noneEditSelected) {
|
||||||
|
this.$set(subsystemNode.permissions, 'edit', false)
|
||||||
|
}
|
||||||
|
},
|
||||||
// 加载权限数据
|
// 加载权限数据
|
||||||
loadPermissionData() {
|
loadPermissionData() {
|
||||||
const request = {
|
const request = {
|
||||||
@ -802,11 +903,11 @@ export default {
|
|||||||
: {
|
: {
|
||||||
roleName: this.addRoleFormData.roleName,
|
roleName: this.addRoleFormData.roleName,
|
||||||
roleDescription: this.addRoleFormData.roleDescription
|
roleDescription: this.addRoleFormData.roleDescription
|
||||||
}
|
},
|
||||||
|
disableSuccessMsg: true
|
||||||
}
|
}
|
||||||
this.$request(request)
|
this.$request(request)
|
||||||
.asyncThen((resp) => {
|
.asyncThen((resp) => {
|
||||||
|
|
||||||
this.handleAddRoleDialogClose()
|
this.handleAddRoleDialogClose()
|
||||||
this.loadPermissionData()
|
this.loadPermissionData()
|
||||||
})
|
})
|
||||||
@ -919,13 +1020,33 @@ export default {
|
|||||||
this.$request(request)
|
this.$request(request)
|
||||||
.asyncThen((resp) => {
|
.asyncThen((resp) => {
|
||||||
if (resp && resp.data) {
|
if (resp && resp.data) {
|
||||||
this.personOptions = resp.data
|
// 处理返回的数据,转换为选项格式
|
||||||
|
let result = []
|
||||||
|
if (Array.isArray(resp.data)) {
|
||||||
|
result = resp.data
|
||||||
|
} else if (resp.data.result && Array.isArray(resp.data.result)) {
|
||||||
|
result = resp.data.result
|
||||||
|
} else if (resp.data.data && Array.isArray(resp.data.data)) {
|
||||||
|
result = resp.data.data
|
||||||
|
}
|
||||||
|
// 转换为选项格式:{userId: user.userId, username: user.username, userNumber: user.userNumber}
|
||||||
|
this.personOptions = result.map((user) => ({
|
||||||
|
userId: user.userId || user.id,
|
||||||
|
username: user.username || user.name,
|
||||||
|
userNumber: user.userNumber || user.userId || user.id
|
||||||
|
}))
|
||||||
|
// 设置已选择的人员 userNumber 数组
|
||||||
|
this.personConfigFormData.person = this.personOptions.map(opt => opt.userNumber)
|
||||||
|
} else {
|
||||||
|
this.personOptions = []
|
||||||
|
this.personConfigFormData.person = []
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.asyncErrorCatch((err) => {
|
.asyncErrorCatch((err) => {
|
||||||
console.error('加载人员列表失败:', err)
|
console.error('加载人员列表失败:', err)
|
||||||
|
this.personOptions = []
|
||||||
|
this.personConfigFormData.person = []
|
||||||
})
|
})
|
||||||
this.personOptions = []
|
|
||||||
this.personConfigDialogVisible = true
|
this.personConfigDialogVisible = true
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
if (this.$refs.personConfigForm) {
|
if (this.$refs.personConfigForm) {
|
||||||
@ -1047,20 +1168,14 @@ export default {
|
|||||||
},
|
},
|
||||||
// 远程搜索人员(用于 el-select)
|
// 远程搜索人员(用于 el-select)
|
||||||
queryPersonByDepartment(queryString) {
|
queryPersonByDepartment(queryString) {
|
||||||
|
// 如果查询为空,保留已选择的人员信息
|
||||||
if (!queryString || queryString.trim() === '') {
|
if (!queryString || queryString.trim() === '') {
|
||||||
// 空查询时,只保留已选择的人员在选项中
|
|
||||||
if (this.personConfigFormData.person && this.personConfigFormData.person.length > 0) {
|
if (this.personConfigFormData.person && this.personConfigFormData.person.length > 0) {
|
||||||
const selectedOptions = this.personOptions.filter(opt =>
|
// 从现有 options 中查找已选择的人员信息
|
||||||
this.personConfigFormData.person.some(p => p.userId === opt.userId)
|
const selectedOptions = this.personOptions.filter((opt) =>
|
||||||
|
this.personConfigFormData.person.includes(opt.userNumber)
|
||||||
)
|
)
|
||||||
const missingIds = this.personConfigFormData.person.filter(p =>
|
this.personOptions = selectedOptions
|
||||||
!selectedOptions.some(opt => opt.userId === p.userId)
|
|
||||||
)
|
|
||||||
if (missingIds.length > 0) {
|
|
||||||
this.personOptions = [...selectedOptions, ...missingIds]
|
|
||||||
} else {
|
|
||||||
this.personOptions = selectedOptions
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
this.personOptions = []
|
this.personOptions = []
|
||||||
}
|
}
|
||||||
@ -1104,36 +1219,38 @@ export default {
|
|||||||
result = respData.data
|
result = respData.data
|
||||||
}
|
}
|
||||||
|
|
||||||
// 转换为选项格式:{userId: user.userId, username: user.username}
|
// 转换为选项格式:{userId: user.userId, username: user.username, userNumber: user.userNumber}
|
||||||
const users = result
|
const users = result
|
||||||
.map(user => ({
|
.map((user) => ({
|
||||||
userId: user.userId || user.id,
|
userId: user.userId || user.id,
|
||||||
username: user.username || user.name
|
username: user.username || user.name,
|
||||||
|
userNumber: user.userNumber || user.userId || user.id
|
||||||
}))
|
}))
|
||||||
.filter(user => user.userId && user.username) // 过滤掉没有 userId 或 username 的数据
|
.filter((user) => user.userId && user.userNumber) // 过滤掉没有 userId 或 userNumber 的数据
|
||||||
|
|
||||||
// personConfigFormData.person 现在是对象数组(包含 {userId, username})
|
// personConfigFormData.person 现在是 userNumber 数组
|
||||||
const existingIds = new Set(
|
const existingUserNumbers = new Set(
|
||||||
(this.personConfigFormData.person || []).map(p => p.userId)
|
(this.personConfigFormData.person || []).map(p => p)
|
||||||
)
|
)
|
||||||
// 过滤掉已选择的人员
|
// 过滤掉已选择的人员
|
||||||
const filteredUsers = users.filter(user => !existingIds.has(user.userId))
|
const filteredUsers = users.filter(user => !existingUserNumbers.has(user.userNumber))
|
||||||
// 合并:已选择的人员信息(从现有 options 中获取)+ 新的搜索结果
|
// 合并:已选择的人员信息(从现有 options 中获取)+ 新的搜索结果
|
||||||
const selectedOptions = (this.personOptions || []).filter(opt =>
|
const selectedOptions = this.personOptions.filter(
|
||||||
opt.userId && this.personConfigFormData.person && this.personConfigFormData.person.some(p => p.userId === opt.userId)
|
(opt) => opt.userNumber && this.personConfigFormData.person && this.personConfigFormData.person.includes(opt.userNumber)
|
||||||
)
|
)
|
||||||
// 去重:使用 Map 确保每个 userId 只出现一次
|
|
||||||
|
// 去重:使用 Map 确保每个 userNumber 只出现一次
|
||||||
const optionsMap = new Map()
|
const optionsMap = new Map()
|
||||||
// 先添加已选择的选项
|
// 先添加已选择的选项
|
||||||
selectedOptions.forEach(opt => {
|
selectedOptions.forEach((opt) => {
|
||||||
if (opt.userId) {
|
if (opt.userNumber) {
|
||||||
optionsMap.set(opt.userId, opt)
|
optionsMap.set(opt.userNumber, opt)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// 再添加新的搜索结果
|
// 再添加新的搜索结果
|
||||||
filteredUsers.forEach(user => {
|
filteredUsers.forEach((user) => {
|
||||||
if (user.userId && !optionsMap.has(user.userId)) {
|
if (user.userNumber && !optionsMap.has(user.userNumber)) {
|
||||||
optionsMap.set(user.userId, user)
|
optionsMap.set(user.userNumber, user)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
this.personOptions = Array.from(optionsMap.values())
|
this.personOptions = Array.from(optionsMap.values())
|
||||||
@ -1144,8 +1261,8 @@ export default {
|
|||||||
console.error('搜索人员失败:', err)
|
console.error('搜索人员失败:', err)
|
||||||
// 搜索失败时,保留已选择的人员信息
|
// 搜索失败时,保留已选择的人员信息
|
||||||
if (this.personConfigFormData.person && this.personConfigFormData.person.length > 0) {
|
if (this.personConfigFormData.person && this.personConfigFormData.person.length > 0) {
|
||||||
const selectedOptions = this.personOptions.filter(opt =>
|
const selectedOptions = this.personOptions.filter((opt) =>
|
||||||
this.personConfigFormData.person.some(p => p.userId === opt.userId)
|
this.personConfigFormData.person.includes(opt.userNumber)
|
||||||
)
|
)
|
||||||
this.personOptions = selectedOptions
|
this.personOptions = selectedOptions
|
||||||
} else {
|
} else {
|
||||||
@ -1218,7 +1335,12 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
// 配置人员模式:传人员ID数组
|
// 配置人员模式:传人员ID数组
|
||||||
isDept = 0
|
isDept = 0
|
||||||
userOrDeptId = this.personConfigFormData.person.map(p => p.userId || p.id).filter(id => id)
|
// personConfigFormData.person 是 userNumber 数组,需要转换为 userId 数组
|
||||||
|
userOrDeptId = this.personConfigFormData.person.map(userNumber => {
|
||||||
|
// 从 personOptions 中查找对应的 userId
|
||||||
|
const option = this.personOptions.find(opt => opt.userNumber === userNumber)
|
||||||
|
return option ? option.userId : null
|
||||||
|
}).filter(id => id)
|
||||||
if (userOrDeptId.length === 0) {
|
if (userOrDeptId.length === 0) {
|
||||||
this.$message.warning('请至少选择一个人员')
|
this.$message.warning('请至少选择一个人员')
|
||||||
this.personConfigSubmitting = false
|
this.personConfigSubmitting = false
|
||||||
@ -1240,12 +1362,12 @@ export default {
|
|||||||
roleId: this.personConfigFormData.roleId,
|
roleId: this.personConfigFormData.roleId,
|
||||||
userOrDeptIds: userOrDeptId,
|
userOrDeptIds: userOrDeptId,
|
||||||
isDept: isDept
|
isDept: isDept
|
||||||
}
|
},
|
||||||
|
disableSuccessMsg: true
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$request(request)
|
this.$request(request)
|
||||||
.asyncThen((resp) => {
|
.asyncThen((resp) => {
|
||||||
|
|
||||||
this.handlePersonConfigDialogClose()
|
this.handlePersonConfigDialogClose()
|
||||||
this.loadPermissionData()
|
this.loadPermissionData()
|
||||||
})
|
})
|
||||||
@ -1305,14 +1427,24 @@ export default {
|
|||||||
if (node && node.permissions) {
|
if (node && node.permissions) {
|
||||||
node.permissions.view = false
|
node.permissions.view = false
|
||||||
node.permissions.edit = false
|
node.permissions.edit = false
|
||||||
|
} else if (node && (node.type === 'subsystem' || node.type === 'parameter')) {
|
||||||
|
// 如果节点没有权限对象,创建一个
|
||||||
|
this.$set(node, 'permissions', { view: false, edit: false })
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 从 menuPath 中提取第一级菜单名
|
// 从 menuPath 中提取第一级菜单名
|
||||||
// menuPath 格式: "数据录入/模板管理" -> 提取 "模板管理"
|
// menuPath 格式: "数据录入/模板管理" -> 提取 "模板管理"
|
||||||
|
// 根据 menuList 中的菜单名来匹配 menuPath 中的内容
|
||||||
extractMenuNameFromPath(menuPath) {
|
extractMenuNameFromPath(menuPath) {
|
||||||
if (!menuPath) return ''
|
if (!menuPath) return ''
|
||||||
// 按 "/" 分割,取最后一部分作为菜单名
|
// 首先尝试从 menuList 中匹配
|
||||||
|
for (const menuName of this.menuList) {
|
||||||
|
if (menuPath.includes(menuName)) {
|
||||||
|
return menuName
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 如果没有匹配到,按 "/" 分割,取最后一部分作为菜单名
|
||||||
const parts = menuPath.split('/')
|
const parts = menuPath.split('/')
|
||||||
return parts.length > 0 ? parts[parts.length - 1].trim() : menuPath.trim()
|
return parts.length > 0 ? parts[parts.length - 1].trim() : menuPath.trim()
|
||||||
},
|
},
|
||||||
@ -1320,7 +1452,7 @@ export default {
|
|||||||
setPermissionsFromData(permissions) {
|
setPermissionsFromData(permissions) {
|
||||||
// permissions 格式是数组,每个元素包含:
|
// permissions 格式是数组,每个元素包含:
|
||||||
// { id, menuPath, subsystem, parameterName, parameterId, parameterPer }
|
// { id, menuPath, subsystem, parameterName, parameterId, parameterPer }
|
||||||
// parameterPer 是字符串:"查看" 或 "编辑"
|
// parameterPer 可能是字符串:"查看" 或 "编辑",也可能是数字:1(查看)或 2(编辑)
|
||||||
const permArray = Array.isArray(permissions) ? permissions : []
|
const permArray = Array.isArray(permissions) ? permissions : []
|
||||||
|
|
||||||
// 先重置所有权限
|
// 先重置所有权限
|
||||||
@ -1331,33 +1463,74 @@ export default {
|
|||||||
|
|
||||||
// 处理权限数据,提取第一级菜单名并转换权限类型
|
// 处理权限数据,提取第一级菜单名并转换权限类型
|
||||||
const processedPerms = permArray.map(perm => {
|
const processedPerms = permArray.map(perm => {
|
||||||
|
// 根据 menuPath 提取第一级菜单名(匹配 menuList 中的菜单)
|
||||||
const menuName = this.extractMenuNameFromPath(perm.menuPath || '')
|
const menuName = this.extractMenuNameFromPath(perm.menuPath || '')
|
||||||
|
|
||||||
|
// 处理 parameterPer:支持字符串和数字格式
|
||||||
|
let isView = false
|
||||||
|
let isEdit = false
|
||||||
|
const parameterPer = perm.parameterPer
|
||||||
|
if (typeof parameterPer === 'string') {
|
||||||
|
isView = parameterPer === '查看'
|
||||||
|
isEdit = parameterPer === '编辑'
|
||||||
|
} else if (typeof parameterPer === 'number') {
|
||||||
|
isView = parameterPer === 1
|
||||||
|
isEdit = parameterPer === 2
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...perm,
|
...perm,
|
||||||
menuName: menuName, // 提取的第一级菜单名
|
menuName: menuName, // 提取的第一级菜单名
|
||||||
view: perm.parameterPer === '查看',
|
view: isView,
|
||||||
edit: perm.parameterPer === '编辑'
|
edit: isEdit
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// 根据 menuName、subsystem、parameterName 匹配节点并设置权限(只设置已加载的节点)
|
// 根据 menuName、subsystem、parameterName 匹配节点并设置权限(只设置已加载的节点)
|
||||||
|
// 先按参数分组,合并同一个参数的所有权限记录
|
||||||
|
const parameterPermMap = new Map()
|
||||||
processedPerms.forEach(perm => {
|
processedPerms.forEach(perm => {
|
||||||
|
const key = `${perm.menuName || ''}_${perm.subsystem || ''}_${perm.parameterName || ''}`
|
||||||
|
if (!parameterPermMap.has(key)) {
|
||||||
|
parameterPermMap.set(key, {
|
||||||
|
menuName: perm.menuName,
|
||||||
|
subsystem: perm.subsystem,
|
||||||
|
parameterName: perm.parameterName,
|
||||||
|
view: false,
|
||||||
|
edit: false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
const paramPerm = parameterPermMap.get(key)
|
||||||
|
if (perm.view) {
|
||||||
|
paramPerm.view = true
|
||||||
|
}
|
||||||
|
if (perm.edit) {
|
||||||
|
paramPerm.edit = true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// 设置已加载节点的权限
|
||||||
|
parameterPermMap.forEach((paramPerm, key) => {
|
||||||
Object.keys(this.nodeMap).forEach(nodeId => {
|
Object.keys(this.nodeMap).forEach(nodeId => {
|
||||||
const node = this.nodeMap[nodeId]
|
const node = this.nodeMap[nodeId]
|
||||||
if (node && node.type === 'parameter') {
|
if (node && node.type === 'parameter') {
|
||||||
// 匹配第一级:menuPath 中包含第一级菜单名
|
// 匹配第一级:menuPath 中包含第一级菜单名
|
||||||
const menuMatch = perm.menuName && node.menuName && perm.menuName === node.menuName
|
const menuMatch = paramPerm.menuName && node.menuName && paramPerm.menuName === node.menuName
|
||||||
// 匹配第二级:subsystem
|
// 匹配第二级:subsystem
|
||||||
const subsystemMatch = perm.subsystem && node.subsystem && perm.subsystem === node.subsystem
|
const subsystemMatch = paramPerm.subsystem && node.subsystem && paramPerm.subsystem === node.subsystem
|
||||||
// 匹配第三级:parameterName
|
// 匹配第三级:parameterName
|
||||||
const parameterNameMatch = perm.parameterName && (node.parameterName || node.label) &&
|
const parameterNameMatch = paramPerm.parameterName && (node.parameterName || node.label) &&
|
||||||
perm.parameterName === (node.parameterName || node.label)
|
paramPerm.parameterName === (node.parameterName || node.label)
|
||||||
|
|
||||||
if (menuMatch && subsystemMatch && parameterNameMatch) {
|
if (menuMatch && subsystemMatch && parameterNameMatch) {
|
||||||
// 使用 $set 确保响应式更新,直接替换整个权限对象
|
// 确保权限对象存在
|
||||||
|
if (!node.permissions) {
|
||||||
|
this.$set(node, 'permissions', { view: false, edit: false })
|
||||||
|
}
|
||||||
|
// 合并权限:如果已有权限,则合并(取或运算)
|
||||||
const newPermissions = {
|
const newPermissions = {
|
||||||
view: perm.view || false,
|
view: node.permissions.view || paramPerm.view,
|
||||||
edit: perm.edit || false
|
edit: node.permissions.edit || paramPerm.edit
|
||||||
}
|
}
|
||||||
this.$set(node, 'permissions', newPermissions)
|
this.$set(node, 'permissions', newPermissions)
|
||||||
console.log('设置已加载节点权限:', node.id, node.label, {
|
console.log('设置已加载节点权限:', node.id, node.label, {
|
||||||
@ -1370,6 +1543,23 @@ export default {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 更新所有子系统权限状态
|
||||||
|
this.$nextTick(() => {
|
||||||
|
Object.keys(this.nodeMap).forEach(nodeId => {
|
||||||
|
const node = this.nodeMap[nodeId]
|
||||||
|
if (node && node.type === 'subsystem') {
|
||||||
|
// 查找该子系统下的任意一个参数节点来触发更新
|
||||||
|
const childParameterNode = Object.keys(this.nodeMap).find(id => {
|
||||||
|
const childNode = this.nodeMap[id]
|
||||||
|
return childNode && childNode.type === 'parameter' && childNode.id && childNode.id.startsWith(nodeId + '-param-')
|
||||||
|
})
|
||||||
|
if (childParameterNode) {
|
||||||
|
this.updateSubsystemPermissionFromChildren(this.nodeMap[childParameterNode])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
console.log('权限数据已保存,待应用权限数量:', this.pendingPermissions.length, '处理后的权限:', processedPerms)
|
console.log('权限数据已保存,待应用权限数量:', this.pendingPermissions.length, '处理后的权限:', processedPerms)
|
||||||
},
|
},
|
||||||
// 将待应用的权限应用到新加载的节点
|
// 将待应用的权限应用到新加载的节点
|
||||||
@ -1399,14 +1589,23 @@ export default {
|
|||||||
this.$set(node, 'permissions', { view: false, edit: false })
|
this.$set(node, 'permissions', { view: false, edit: false })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 应用权限:parameterPer 是字符串 "查看" 或 "编辑"
|
// 应用权限:parameterPer 可能是字符串 "查看" 或 "编辑",也可能是数字 1(查看)或 2(编辑)
|
||||||
let hasView = false
|
let hasView = false
|
||||||
let hasEdit = false
|
let hasEdit = false
|
||||||
matchingPerms.forEach(perm => {
|
matchingPerms.forEach(perm => {
|
||||||
if (perm.parameterPer === '查看') {
|
const parameterPer = perm.parameterPer
|
||||||
hasView = true
|
if (typeof parameterPer === 'string') {
|
||||||
} else if (perm.parameterPer === '编辑') {
|
if (parameterPer === '查看') {
|
||||||
hasEdit = true
|
hasView = true
|
||||||
|
} else if (parameterPer === '编辑') {
|
||||||
|
hasEdit = true
|
||||||
|
}
|
||||||
|
} else if (typeof parameterPer === 'number') {
|
||||||
|
if (parameterPer === 1) {
|
||||||
|
hasView = true
|
||||||
|
} else if (parameterPer === 2) {
|
||||||
|
hasEdit = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -1435,14 +1634,27 @@ export default {
|
|||||||
const roleId = this.formData.rowId || ''
|
const roleId = this.formData.rowId || ''
|
||||||
const userId = getUserId()
|
const userId = getUserId()
|
||||||
|
|
||||||
// 直接从 nodeMap 中收集所有参数节点,确保包含所有已加载的节点
|
// 收集所有参数节点的权限
|
||||||
|
// 如果子系统权限被选中,其下所有参数都会被收集(无论参数是否单独选中)
|
||||||
Object.keys(this.nodeMap).forEach(nodeId => {
|
Object.keys(this.nodeMap).forEach(nodeId => {
|
||||||
const node = this.nodeMap[nodeId]
|
const node = this.nodeMap[nodeId]
|
||||||
if (node && node.type === 'parameter') {
|
if (node && node.type === 'parameter') {
|
||||||
// 确保权限对象存在
|
// 确保权限对象存在
|
||||||
const nodePermissions = node.permissions || { view: false, edit: false }
|
const nodePermissions = node.permissions || { view: false, edit: false }
|
||||||
|
|
||||||
|
// 检查该参数所属的子系统权限状态
|
||||||
|
const subsystemId = node.id.split('-param-')[0]
|
||||||
|
const subsystemNode = this.nodeMap[subsystemId]
|
||||||
|
const subsystemPermissions = subsystemNode && subsystemNode.permissions
|
||||||
|
? subsystemNode.permissions
|
||||||
|
: { view: false, edit: false }
|
||||||
|
|
||||||
|
// 如果子系统权限被选中,或者参数本身被选中,都需要收集
|
||||||
|
const shouldCollectView = nodePermissions.view || subsystemPermissions.view
|
||||||
|
const shouldCollectEdit = nodePermissions.edit || subsystemPermissions.edit
|
||||||
|
|
||||||
// 如果选中了查看权限,添加一条记录(parameterPer = 1)
|
// 如果选中了查看权限,添加一条记录(parameterPer = 1)
|
||||||
if (nodePermissions.view) {
|
if (shouldCollectView) {
|
||||||
permissions.push({
|
permissions.push({
|
||||||
roleId: roleId,
|
roleId: roleId,
|
||||||
menuName: node.menuName || '',
|
menuName: node.menuName || '',
|
||||||
@ -1452,7 +1664,7 @@ export default {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 如果选中了控制权限,添加一条记录(parameterPer = 2)
|
// 如果选中了控制权限,添加一条记录(parameterPer = 2)
|
||||||
if (nodePermissions.edit) {
|
if (shouldCollectEdit) {
|
||||||
permissions.push({
|
permissions.push({
|
||||||
roleId: roleId,
|
roleId: roleId,
|
||||||
menuName: node.menuName || '',
|
menuName: node.menuName || '',
|
||||||
@ -1501,7 +1713,6 @@ export default {
|
|||||||
}
|
}
|
||||||
this.$request(request)
|
this.$request(request)
|
||||||
.asyncThen((resp) => {
|
.asyncThen((resp) => {
|
||||||
|
|
||||||
this.handleDialogClose()
|
this.handleDialogClose()
|
||||||
this.loadPermissionData()
|
this.loadPermissionData()
|
||||||
})
|
})
|
||||||
@ -1532,7 +1743,6 @@ export default {
|
|||||||
this.$request(request)
|
this.$request(request)
|
||||||
.asyncThen((resp) => {
|
.asyncThen((resp) => {
|
||||||
this.loadPermissionData()
|
this.loadPermissionData()
|
||||||
|
|
||||||
})
|
})
|
||||||
.asyncErrorCatch((err) => {
|
.asyncErrorCatch((err) => {
|
||||||
console.error('删除失败:', err)
|
console.error('删除失败:', err)
|
||||||
@ -1703,4 +1913,30 @@ export default {
|
|||||||
.page-content {
|
.page-content {
|
||||||
width: calc(100% - 80px) !important;
|
width: calc(100% - 80px) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.person-select {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
::v-deep .person-select {
|
||||||
|
.el-select-dropdown__item {
|
||||||
|
display: flex !important;
|
||||||
|
justify-content: space-between !important;
|
||||||
|
padding-right: 20px !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.username-text {
|
||||||
|
color: #303133 !important;
|
||||||
|
display: inline-block;
|
||||||
|
text-align: right !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-id-text {
|
||||||
|
color: #909399 !important;
|
||||||
|
display: inline-block;
|
||||||
|
margin-left: 20px;
|
||||||
|
margin-right: 30px;
|
||||||
|
text-align: right !important;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
1660
src/custom/apaas-custom-mydemo/custom-page/reportList.vue
Normal file
1660
src/custom/apaas-custom-mydemo/custom-page/reportList.vue
Normal file
File diff suppressed because it is too large
Load Diff
@ -8,6 +8,7 @@ import ApaasCustomOtherEnginedata from './custom-page/otherEnginedata.vue'
|
|||||||
import ApaasCustomCheckData from './custom-page/checkData.vue'
|
import ApaasCustomCheckData from './custom-page/checkData.vue'
|
||||||
import ApaasCustomReportCheck from './custom-page/reportCheck.vue'
|
import ApaasCustomReportCheck from './custom-page/reportCheck.vue'
|
||||||
import ApaasCustomReport from './custom-page/report.vue'
|
import ApaasCustomReport from './custom-page/report.vue'
|
||||||
|
import ApaasCustomReportList from './custom-page/reportList.vue'
|
||||||
import ApaasSelfEngineCheck from './custom-page/selfEngineCheck.vue'
|
import ApaasSelfEngineCheck from './custom-page/selfEngineCheck.vue'
|
||||||
import ApaasOtherEngineCheck from './custom-page/otherEngineCheck.vue'
|
import ApaasOtherEngineCheck from './custom-page/otherEngineCheck.vue'
|
||||||
import ApaasCustomManagerData from './custom-page/managerData.vue'
|
import ApaasCustomManagerData from './custom-page/managerData.vue'
|
||||||
@ -34,6 +35,7 @@ const install = function(Vue, opts) {
|
|||||||
Vue.component('apaas-custom-reportCheck', ApaasCustomReportCheck)
|
Vue.component('apaas-custom-reportCheck', ApaasCustomReportCheck)
|
||||||
Vue.component('apaas-custom-engineDetail', ApaasCustomEngineDetail)
|
Vue.component('apaas-custom-engineDetail', ApaasCustomEngineDetail)
|
||||||
Vue.component('apaas-custom-report', ApaasCustomReport)
|
Vue.component('apaas-custom-report', ApaasCustomReport)
|
||||||
|
Vue.component('apaas-custom-reportList', ApaasCustomReportList)
|
||||||
Vue.component('apaas-custom-reportDetail', ApaasCustomReportDetail)
|
Vue.component('apaas-custom-reportDetail', ApaasCustomReportDetail)
|
||||||
Vue.component('apaas-custom-approvalManagement', ApaasCustomApprovalManagement)
|
Vue.component('apaas-custom-approvalManagement', ApaasCustomApprovalManagement)
|
||||||
Vue.component('apaas-custom-toDoList', ApaasCustomTodoList)
|
Vue.component('apaas-custom-toDoList', ApaasCustomTodoList)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user