This commit is contained in:
大黑 2025-12-25 15:24:54 +08:00
parent f280a779b3
commit 94897e9265
13 changed files with 1973 additions and 1707 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

@ -189,11 +189,6 @@
添加/修改公式 添加/修改公式
</el-button> </el-button>
</div> </div>
<div v-if="chart.chartType === 'scatter'" class="config-item">
<el-checkbox v-model="chart.scatterTrendline" @change="updateChart(index)">
显示趋势线
</el-checkbox>
</div>
<div v-if="chart.chartType !== 'pie'" class="config-item"> <div v-if="chart.chartType !== 'pie'" class="config-item">
<span class="config-label">Y轴范围:</span> <span class="config-label">Y轴范围:</span>
<el-input <el-input
@ -254,25 +249,20 @@
class="formula-dialog" class="formula-dialog"
> >
<div class="formula-dialog-content"> <div class="formula-dialog-content">
<div class="formula-input-section"> <el-form :model="formulaFormData" label-width="100px">
<el-form-item label="公式名称:" required> <el-form-item label="公式名称:" required>
<el-input <el-input
v-model="formulaName" v-model="formulaFormData.name"
placeholder="请输入公式名称" placeholder="请输入公式名称"
maxlength="50" maxlength="50"
show-word-limit show-word-limit
/> />
</el-form-item> </el-form-item>
<div class="formula-input-section"> <el-form-item label="参数1:" required>
<span class="formula-label">*计算公式:</span>
<div class="formula-editor">
<div v-for="(item, index) in formulaItems" :key="index" class="formula-item">
<el-select <el-select
v-if="item.type === 'param'" v-model="formulaFormData.param1"
v-model="item.value" placeholder="请选择参数"
class="formula-select" style="width: 100%"
placeholder="选择参数"
@change="updateFormula"
> >
<el-option <el-option
v-for="opt in yAxisParamOptions" v-for="opt in yAxisParamOptions"
@ -281,12 +271,12 @@
:value="opt.value" :value="opt.value"
/> />
</el-select> </el-select>
</el-form-item>
<el-form-item label="运算符:" required>
<el-select <el-select
v-else-if="item.type === 'operator'" v-model="formulaFormData.operator"
v-model="item.value" placeholder="请选择运算符"
class="formula-select" style="width: 100%"
placeholder="选择运算符"
@change="updateFormula"
> >
<el-option <el-option
v-for="opt in operatorOptions" v-for="opt in operatorOptions"
@ -295,28 +285,33 @@
:value="opt.value" :value="opt.value"
/> />
</el-select> </el-select>
<i class="el-icon-delete formula-delete-icon" @click="removeFormulaItem(index)"></i> </el-form-item>
</div> <el-form-item label="参数2:" required>
<div v-if="formulaItems.length === 0" class="formula-empty-hint"> <el-select
请添加参数和运算符 v-model="formulaFormData.param2"
</div> placeholder="请选择参数"
</div> style="width: 100%"
</div> >
</div> <el-option
<div class="formula-buttons"> v-for="opt in yAxisParamOptions"
<el-button type="primary" :disabled="yAxisParamOptions.length === 0" @click="addFormulaParam"> :key="opt.value"
添加参数 :label="opt.label"
</el-button> :value="opt.value"
<el-button type="primary" @click="addFormulaOperator"> />
添加符号 </el-select>
</el-button> </el-form-item>
<el-form-item label="公式预览:">
<div class="formula-preview">
{{ getFormulaPreview() }}
</div> </div>
</el-form-item>
</el-form>
</div> </div>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="handleFormulaDialogClose"> <el-button @click="handleFormulaDialogClose">
取消 取消
</el-button> </el-button>
<el-button type="primary" :disabled="!formulaName || formulaItems.length === 0" @click="handleSaveFormula"> <el-button type="primary" :disabled="!isFormulaValid" @click="handleSaveFormula">
确定 确定
</el-button> </el-button>
</span> </span>
@ -379,14 +374,18 @@ export default {
formulaDialogVisible: false, formulaDialogVisible: false,
currentFormulaChartIndex: -1, currentFormulaChartIndex: -1,
currentFormulaId: null, // IDnull currentFormulaId: null, // IDnull
formulaName: '', // formulaFormData: {
name: '',
param1: '',
operator: '+',
param2: ''
},
isResizing: false, isResizing: false,
resizingChartIndex: -1, resizingChartIndex: -1,
resizeStartY: 0, resizeStartY: 0,
resizeStartHeight: 0, resizeStartHeight: 0,
formulaItems: [],
// //
savedFormulas: [], // : [{ id: 'formula1', name: '1', formulaItems: [...] }] savedFormulas: [], // : [{ id: 'formula1', name: '1', param1: '1', operator: '+', param2: '2' }]
formulaIdCounter: 0, // ID formulaIdCounter: 0, // ID
operatorOptions: [ operatorOptions: [
{ label: '+', value: '+' }, { label: '+', value: '+' },
@ -396,6 +395,19 @@ export default {
] ]
} }
}, },
computed: {
//
isFormulaValid() {
return !!(
this.formulaFormData.name &&
this.formulaFormData.name.trim() &&
this.formulaFormData.param1 &&
this.formulaFormData.param2 &&
this.formulaFormData.operator &&
this.formulaFormData.param1 !== this.formulaFormData.param2
)
}
},
watch: { watch: {
activeTab: { activeTab: {
immediate: true, immediate: true,
@ -451,13 +463,7 @@ export default {
// }) // })
// 使 // 使
this.yAxisParamOptions = [ this.yAxisParamOptions = []
{ label: '参数1', value: 'param1' },
{ label: '参数2', value: 'param2' },
{ label: '参数3', value: 'param3' },
{ label: '参数4', value: 'param4' },
{ label: '参数5', value: 'param5' }
]
}, },
handleTabClick(tab) { handleTabClick(tab) {
// Tab // Tab
@ -694,8 +700,8 @@ export default {
let formulaData = null let formulaData = null
if (chart.yAxisFormula) { if (chart.yAxisFormula) {
const selectedFormula = this.savedFormulas.find(f => f.id === chart.yAxisFormula) const selectedFormula = this.savedFormulas.find(f => f.id === chart.yAxisFormula)
if (selectedFormula && selectedFormula.formulaItems && selectedFormula.formulaItems.length > 0) { if (selectedFormula && selectedFormula.param1 && selectedFormula.param2 && selectedFormula.operator) {
formulaData = this.calculateFormula(selectedFormula.formulaItems, xAxisData, xAxisDataMap) formulaData = this.calculateFormula(selectedFormula, xAxisData, xAxisDataMap)
} }
} }
@ -725,8 +731,7 @@ export default {
trigger: 'item', trigger: 'item',
formatter(params) { formatter(params) {
const value = parseFloat(params.value).toFixed(2) const value = parseFloat(params.value).toFixed(2)
const percent = parseFloat(params.percent).toFixed(2) return `${params.seriesName}<br/>${params.name}: ${value} `
return `${params.seriesName}<br/>${params.name}: ${value}% (${percent}%)`
} }
}, },
legend: { legend: {
@ -837,15 +842,15 @@ export default {
const formulaName = selectedFormula ? selectedFormula.name : '公式' const formulaName = selectedFormula ? selectedFormula.name : '公式'
series.push({ series.push({
name: formulaName, name: formulaName,
type: 'line', type: chartType === 'bar' ? 'bar' : chartType === 'scatter' ? 'scatter' : 'line',
data: formulaData, data: formulaData,
lineStyle: { lineStyle: {
color: '#F56C6C', color: '#F56C6C',
type: 'dashed', type: 'dashed',
width: 2 width: 2
}, },
symbol: 'circle', symbol: chartType === 'scatter' ? 'diamond' : 'circle',
symbolSize: 6, symbolSize: chartType === 'scatter' ? 8 : 6,
itemStyle: { color: '#F56C6C' } itemStyle: { color: '#F56C6C' }
}) })
legendData.push(formulaName) legendData.push(formulaName)
@ -907,13 +912,13 @@ export default {
let result = `${params[0].axisValue}<br/>` let result = `${params[0].axisValue}<br/>`
params.forEach((item) => { params.forEach((item) => {
if (item.value !== undefined && item.value !== null && item.value !== '') { if (item.value !== undefined && item.value !== null && item.value !== '') {
result += `${item.marker}${item.seriesName}: ${item.value}%<br/>` result += `${item.marker}${item.seriesName}: ${item.value}<br/>`
} }
}) })
return result return result
} }
if (params.value !== undefined && params.value !== null && params.value !== '') { if (params.value !== undefined && params.value !== null && params.value !== '') {
return `${params.seriesName}<br/>${params.marker}${params.name}: ${params.value}%` return `${params.seriesName}<br/>${params.marker}${params.name}: ${params.value}`
} }
return '' return ''
} }
@ -1033,19 +1038,8 @@ export default {
const chart = this.chartList[index] const chart = this.chartList[index]
if (!chart) return if (!chart) return
// //
if (chart.yAxisFormula) {
const selectedFormula = this.savedFormulas.find(f => f.id === chart.yAxisFormula)
if (selectedFormula) {
//
chart.formulaItems = JSON.parse(JSON.stringify(selectedFormula.formulaItems))
this.updateChart(index) this.updateChart(index)
}
} else {
//
chart.formulaItems = []
this.updateChart(index)
}
}, },
startEditTitle(index) { startEditTitle(index) {
const chart = this.chartList[index] const chart = this.chartList[index]
@ -1063,6 +1057,16 @@ export default {
}) })
} }
}, },
//
getFormulaPreview() {
if (!this.formulaFormData.param1 || !this.formulaFormData.param2 || !this.formulaFormData.operator) {
return '请选择参数和运算符'
}
const param1Label = this.yAxisParamOptions.find(opt => opt.value === this.formulaFormData.param1)?.label || this.formulaFormData.param1
const param2Label = this.yAxisParamOptions.find(opt => opt.value === this.formulaFormData.param2)?.label || this.formulaFormData.param2
const operatorLabel = this.operatorOptions.find(opt => opt.value === this.formulaFormData.operator)?.label || this.formulaFormData.operator
return `${param1Label} ${operatorLabel} ${param2Label}`
},
handleEditFormula(index) { handleEditFormula(index) {
this.currentFormulaChartIndex = index this.currentFormulaChartIndex = index
const chart = this.chartList[index] const chart = this.chartList[index]
@ -1074,57 +1078,39 @@ export default {
const existingFormula = this.savedFormulas.find(f => f.id === chart.yAxisFormula) const existingFormula = this.savedFormulas.find(f => f.id === chart.yAxisFormula)
if (existingFormula) { if (existingFormula) {
this.currentFormulaId = existingFormula.id this.currentFormulaId = existingFormula.id
this.formulaName = existingFormula.name this.formulaFormData = {
this.formulaItems = JSON.parse(JSON.stringify(existingFormula.formulaItems)) name: existingFormula.name || '',
param1: existingFormula.param1 || '',
operator: existingFormula.operator || '+',
param2: existingFormula.param2 || ''
}
} else { } else {
// //
this.currentFormulaId = null this.currentFormulaId = null
this.formulaName = '' this.formulaFormData = {
this.formulaItems = JSON.parse(JSON.stringify(chart.formulaItems || [])) name: '',
param1: '',
operator: '+',
param2: ''
}
} }
} else { } else {
// //
this.currentFormulaId = null this.currentFormulaId = null
this.formulaName = '' this.formulaFormData = {
this.formulaItems = JSON.parse(JSON.stringify(chart.formulaItems || [])) name: '',
param1: '',
operator: '+',
param2: ''
}
} }
this.formulaDialogVisible = true this.formulaDialogVisible = true
}, },
addFormulaParam() {
// 使Y
const defaultParam = this.yAxisParamOptions.length > 0 ? this.yAxisParamOptions[0].value : ''
this.formulaItems.push({ type: 'param', value: defaultParam })
this.updateFormula()
},
addFormulaOperator() {
this.formulaItems.push({ type: 'operator', value: '+' })
this.updateFormula()
},
removeFormulaItem(index) {
this.formulaItems.splice(index, 1)
this.updateFormula()
},
updateFormula() {
//
},
handleSaveFormula() { handleSaveFormula() {
// //
if (!this.formulaName || this.formulaName.trim() === '') { if (!this.isFormulaValid) {
this.$message.warning('请输入公式名称') this.$message.warning('请完整填写公式信息,且两个参数不能相同')
return
}
//
if (this.formulaItems.length === 0) {
this.$message.warning('请至少添加一个参数')
return
}
//
const paramCount = this.formulaItems.filter(item => item.type === 'param').length
if (paramCount < 1) {
this.$message.warning('公式至少需要包含一个参数')
return return
} }
@ -1134,16 +1120,23 @@ export default {
// //
const formulaIndex = this.savedFormulas.findIndex(f => f.id === formulaId) const formulaIndex = this.savedFormulas.findIndex(f => f.id === formulaId)
if (formulaIndex >= 0) { if (formulaIndex >= 0) {
this.savedFormulas[formulaIndex].name = this.formulaName.trim() this.savedFormulas[formulaIndex] = {
this.savedFormulas[formulaIndex].formulaItems = JSON.parse(JSON.stringify(this.formulaItems)) ...this.savedFormulas[formulaIndex],
name: this.formulaFormData.name.trim(),
param1: this.formulaFormData.param1,
operator: this.formulaFormData.operator,
param2: this.formulaFormData.param2
}
} }
} else { } else {
// //
formulaId = `formula_${this.formulaIdCounter++}` formulaId = `formula_${this.formulaIdCounter++}`
this.savedFormulas.push({ this.savedFormulas.push({
id: formulaId, id: formulaId,
name: this.formulaName.trim(), name: this.formulaFormData.name.trim(),
formulaItems: JSON.parse(JSON.stringify(this.formulaItems)) param1: this.formulaFormData.param1,
operator: this.formulaFormData.operator,
param2: this.formulaFormData.param2
}) })
} }
@ -1152,7 +1145,6 @@ export default {
const chart = this.chartList[this.currentFormulaChartIndex] const chart = this.chartList[this.currentFormulaChartIndex]
if (chart) { if (chart) {
chart.yAxisFormula = formulaId chart.yAxisFormula = formulaId
chart.formulaItems = JSON.parse(JSON.stringify(this.formulaItems))
this.updateChart(this.currentFormulaChartIndex) this.updateChart(this.currentFormulaChartIndex)
} }
} }
@ -1164,16 +1156,19 @@ export default {
this.formulaDialogVisible = false this.formulaDialogVisible = false
this.currentFormulaChartIndex = -1 this.currentFormulaChartIndex = -1
this.currentFormulaId = null this.currentFormulaId = null
this.formulaName = '' this.formulaFormData = {
this.formulaItems = [] name: '',
param1: '',
operator: '+',
param2: ''
}
}, },
// // param1, operator, param2
calculateFormula(formulaItems, xAxisData, xAxisDataMap) { calculateFormula(formula, xAxisData, xAxisDataMap) {
if (!formulaItems || formulaItems.length === 0) { if (!formula || !formula.param1 || !formula.param2 || !formula.operator) {
return [] return []
} }
//
const formulaData = [] const formulaData = []
xAxisData.forEach(xValue => { xAxisData.forEach(xValue => {
@ -1181,59 +1176,34 @@ export default {
let result = null let result = null
try { try {
// // 1
const stack = [] const param1Value = this.getParamValueFromData(formula.param1, xValue, xAxisDataMap)
// 2
const param2Value = this.getParamValueFromData(formula.param2, xValue, xAxisDataMap)
formulaItems.forEach(item => { if (param1Value !== null && param1Value !== undefined && param2Value !== null && param2Value !== undefined) {
if (item.type === 'param') { const num1 = parseFloat(param1Value)
// const num2 = parseFloat(param2Value)
const paramValue = this.getParamValueFromData(item.value, xValue, xAxisDataMap)
if (paramValue !== null && paramValue !== undefined) {
const numValue = parseFloat(paramValue)
if (!isNaN(numValue)) {
stack.push(numValue)
} else {
stack.push(null)
}
} else {
stack.push(null)
}
} else if (item.type === 'operator') {
//
if (stack.length >= 2) {
const b = stack.pop()
const a = stack.pop()
if (a !== null && b !== null && !isNaN(a) && !isNaN(b)) { if (!isNaN(num1) && !isNaN(num2)) {
let calcResult = null switch (formula.operator) {
switch (item.value) {
case '+': case '+':
calcResult = a + b result = num1 + num2
break break
case '-': case '-':
calcResult = a - b result = num1 - num2
break break
case '*': case '*':
calcResult = a * b result = num1 * num2
break break
case '/': case '/':
calcResult = b !== 0 ? a / b : null result = num2 !== 0 ? num1 / num2 : null
break break
default: default:
calcResult = null result = null
}
stack.push(calcResult)
} else {
stack.push(null)
} }
} }
} }
})
//
if (stack.length === 1) {
result = stack[0]
}
} catch (err) { } catch (err) {
console.error('计算公式失败:', err) console.error('计算公式失败:', err)
result = null result = null
@ -1708,63 +1678,16 @@ export default {
} }
.formula-dialog-content { .formula-dialog-content {
.formula-note { .formula-preview {
color: #f56c6c;
font-size: 12px;
margin-bottom: 16px;
}
.formula-input-section {
.formula-label {
display: block;
margin-bottom: 8px;
font-size: 14px;
font-weight: 500;
}
.formula-editor {
display: flex;
flex-wrap: wrap;
gap: 8px;
padding: 12px; padding: 12px;
background: #f5f7fa; background: #f5f7fa;
border-radius: 4px; border-radius: 4px;
min-height: 50px;
align-items: center;
border: 1px solid #dcdfe6; border: 1px solid #dcdfe6;
font-size: 14px;
.formula-item { color: #303133;
min-height: 40px;
display: flex; display: flex;
align-items: center; align-items: center;
gap: 4px;
.formula-select {
width: 120px;
::v-deep .el-input__inner {
background: white;
}
}
.formula-delete-icon {
cursor: pointer;
color: #909399;
font-size: 16px;
margin-left: 4px;
padding: 4px;
&:hover {
color: #f56c6c;
}
}
}
}
}
.formula-buttons {
margin-top: 16px;
display: flex;
gap: 8px;
} }
} }
} }

View File

@ -20,9 +20,6 @@
<el-form-item label="名称:" prop="name"> <el-form-item label="名称:" prop="name">
<el-input v-model="formData.templateName" placeholder="请输入名称" maxlength="100" /> <el-input v-model="formData.templateName" placeholder="请输入名称" maxlength="100" />
</el-form-item> </el-form-item>
<el-form-item label="排序号:" prop="orderNum">
<el-input-number v-model="formData.orderNum" placeholder="请输入排序号" min="0" />
</el-form-item>
</el-form> </el-form>
<template v-slot:footer> <template v-slot:footer>
<div class="dialog-footer"> <div class="dialog-footer">
@ -51,12 +48,10 @@ export default {
formData: { formData: {
templateName: '', templateName: '',
template_status: '', template_status: '',
createdBy: '', createdBy: ''
orderNum: ''
}, },
formRules: { formRules: {
templateName: [{ required: true, message: '请输入名称', trigger: 'blur' }], templateName: [{ required: true, message: '请输入名称', trigger: 'blur' }]
orderNum: [{ required: true, message: '请输入排序号', trigger: 'blur' }]
}, },
statusOptions: [ statusOptions: [
{ label: '草稿', value: '草稿' }, { label: '草稿', value: '草稿' },

View File

@ -1256,13 +1256,18 @@ export default {
this.$forceUpdate() this.$forceUpdate()
}, },
shouldShowSection(sectionName) { shouldShowSection(sectionName) {
// "" // ""
if (this.isWholeEngineParamsSelected && !this.checkedKeys.some(nodeId => { if (this.isWholeEngineParamsSelected) {
//
const hasNonWholeEngineParamsNode = this.checkedKeys.some(nodeId => {
const nodeInfo = this.nodeMap[nodeId] const nodeInfo = this.nodeMap[nodeId]
return nodeInfo && !nodeInfo.isWholeEngineParams && !nodeInfo.isParent return nodeInfo && !nodeInfo.isWholeEngineParams
})) { })
//
if (!hasNonWholeEngineParamsNode) {
return false return false
} }
}
// sectionName"" // sectionName""
const data = this.versionData[this.currentVersionId] || {} const data = this.versionData[this.currentVersionId] || {}
if (!data[sectionName] || data[sectionName].length === 0) { if (!data[sectionName] || data[sectionName].length === 0) {
@ -1286,12 +1291,6 @@ export default {
// section // section
if (nodeInfo.isParent) { if (nodeInfo.isParent) {
const sectionData = data[sectionName] || [] const sectionData = data[sectionName] || []
// sectionName "/"
// sectionName
if (sectionName === nodeInfo.label) {
hasMatch = true
} else {
// section
const hasDataInSubsystem = sectionData.some( const hasDataInSubsystem = sectionData.some(
(param) => param.subsystemName === nodeInfo.label (param) => param.subsystemName === nodeInfo.label
) )
@ -1300,7 +1299,6 @@ export default {
} }
} }
} }
}
}) })
return hasMatch return hasMatch
}, },

View File

@ -347,6 +347,30 @@ export default {
// parameterTypes subsystemTypes - // parameterTypes subsystemTypes -
shouldInclude = parameterTypes.includes(displayPartsName) || shouldInclude = parameterTypes.includes(displayPartsName) ||
subsystemTypes.includes(`${subsystemName}-${displayPartsName}`) subsystemTypes.includes(`${subsystemName}-${displayPartsName}`)
//
// partsName '/'
if (!shouldInclude) {
//
const isSubsystemDirectlySelected = this.checkedKeys.some(nodeId => {
const nodeInfo = this.nodeMap[nodeId]
return nodeInfo &&
nodeInfo.isParent &&
nodeInfo.label === subsystemName &&
//
!this.checkedKeys.some(childNodeId => {
const childNodeInfo = this.nodeMap[childNodeId]
return childNodeInfo &&
!childNodeInfo.isParent &&
childNodeInfo.parentLabel === subsystemName
})
})
// partsName '/'
if (isSubsystemDirectlySelected && (partsName === '/' || displayPartsName === subsystemName)) {
shouldInclude = true
}
}
} }
if (shouldInclude) { if (shouldInclude) {
@ -1023,6 +1047,9 @@ export default {
// //
this.currentCommonConfig = selectedFavorite.data this.currentCommonConfig = selectedFavorite.data
//
this.hideMissingParamsByNode()
// //
// hideParamsNotInCommon displayParams // hideParamsNotInCommon displayParams
// //
@ -1112,7 +1139,6 @@ export default {
console.error('下载失败:', err) console.error('下载失败:', err)
console.log('下载失败,请稍后重试') console.log('下载失败,请稍后重试')
}) })
}, },
// //
updateCheckedKeysByDisplayParams() { updateCheckedKeysByDisplayParams() {
@ -1266,7 +1292,84 @@ export default {
} }
}) })
}, },
// //
hideMissingParamsByNode() {
if (!this.currentCommonConfig || !this.currentCommonConfig.subsystems) {
return
}
if (!this.allParametersData || Object.keys(this.allParametersData).length === 0) {
return
}
// subsystem -> Set<parameterKey>
// parameterKey 使 parameterId使 parameterName
const commonParamsMap = new Map()
this.currentCommonConfig.subsystems.forEach(subsystemConfig => {
const subsystemName = subsystemConfig.subsystem
const paramKeys = new Set()
subsystemConfig.parameters.forEach(p => {
// 使 parameterId使 parameterName
const key = p.parameterId || p.parameterName
if (key) {
paramKeys.add(key)
}
})
commonParamsMap.set(subsystemName, paramKeys)
})
//
const paramsToHide = []
Object.keys(this.allParametersData).forEach(subsystemName => {
const paramList = this.allParametersData[subsystemName]
if (!Array.isArray(paramList) || paramList.length === 0) {
return
}
//
const commonParamKeys = commonParamsMap.get(subsystemName) || new Set()
//
if (!commonParamsMap.has(subsystemName)) {
paramList.forEach(item => {
const parameterName = item.parameterName || ''
const key = `${subsystemName}-${parameterName}`
if (!paramsToHide.includes(key)) {
paramsToHide.push(key)
}
})
return
}
//
//
paramList.forEach(item => {
const parameterName = item.parameterName || ''
const parameterId = item.parameterId || ''
// 使 parameterId parameterName
const matchKey = parameterId || parameterName
//
const isInCommon = commonParamKeys.has(matchKey)
if (!isInCommon) {
//
const key = `${subsystemName}-${parameterName}`
if (!paramsToHide.includes(key)) {
paramsToHide.push(key)
}
}
})
})
//
paramsToHide.forEach(key => {
if (!this.hiddenParams.includes(key)) {
this.hiddenParams.push(key)
}
})
},
//
hideParamsNotInCommon() { hideParamsNotInCommon() {
if (!this.currentCommonConfig || !this.currentCommonConfig.subsystems) { if (!this.currentCommonConfig || !this.currentCommonConfig.subsystems) {
return return

View File

@ -37,10 +37,10 @@
<el-button type="primary" @click="handleDownloadImportTemplate"> <el-button type="primary" @click="handleDownloadImportTemplate">
下载导入模板 下载导入模板
</el-button> </el-button>
<el-button class="import-btn" @click="handleImportTemplate()"> <el-button v-if="isAdmin()" class="import-btn" @click="handleImportTemplate()">
导入参数模板 导入参数模板
</el-button> </el-button>
<el-button type="primary" @click="handleAddTemplate()"> <el-button v-if="isAdmin()" type="primary" @click="handleAddTemplate()">
添加参数模板 添加参数模板
</el-button> </el-button>
</div> </div>
@ -104,7 +104,7 @@
</a> </a>
<span class="link-separator"></span> <span class="link-separator"></span>
<a <a
v-if="row.status === 'DRAFT'" v-if="row.status === 'DRAFT' && isAdmin()"
href="javascript:void(0)" href="javascript:void(0)"
class="el-link el-link--primary" class="el-link el-link--primary"
@click.stop="handleRowEdit(row)" @click.stop="handleRowEdit(row)"
@ -330,6 +330,24 @@ export default {
this.loadData() this.loadData()
}, },
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
}
},
// //
loadUserSelfRole() { loadUserSelfRole() {
localStorage.setItem('user_self_role', []) localStorage.setItem('user_self_role', [])

View File

@ -1217,20 +1217,36 @@ export default {
const checkSubsystem = subsystem || this.displayTemplateName const checkSubsystem = subsystem || this.displayTemplateName
return this.checkPermission('模板管理', checkSubsystem, '编辑') return this.checkPermission('模板管理', checkSubsystem, '编辑')
}, },
// 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
}
},
// subsystempartsName // subsystempartsName
hasParameterEditPermission(subsystem, partsName) { hasParameterEditPermission(subsystem, partsName) {
//
if (this.isAdmin()) {
return true
}
if (!subsystem || !partsName) { if (!subsystem || !partsName) {
return false return false
} }
// 使 // 使
if (this.templateManagementPermissions && this.templateManagementPermissions.length > 0) { if (this.templateManagementPermissions && this.templateManagementPermissions.length > 0) {
const templateName = this.displayTemplateName
const matchedPermissions = this.templateManagementPermissions.filter((perm) => { const matchedPermissions = this.templateManagementPermissions.filter((perm) => {
// subsystem templateName
if (templateName && perm.subsystem !== templateName) {
return false
}
// subsystem // subsystem
if (perm.subsystem !== subsystem) { if (perm.subsystem !== subsystem) {
return false return false
@ -1247,7 +1263,7 @@ export default {
return matchedPermissions.length > 0 return matchedPermissions.length > 0
} }
// localStorage // localStorage user_self_role
try { try {
const permissionDataStr = localStorage.getItem('user_self_role') const permissionDataStr = localStorage.getItem('user_self_role')
if (!permissionDataStr) { if (!permissionDataStr) {
@ -1258,27 +1274,20 @@ export default {
return false return false
} }
// menuPath""subsystempartsNameparameterPer"" // subsystempartsNameparameterPer""
const templateName = this.displayTemplateName
const matchedPermissions = permissionData.filter((perm) => { const matchedPermissions = permissionData.filter((perm) => {
// menuPath // menuPath ""
const menuMatch = perm.menuPath && perm.menuPath.includes('模板管理') if (perm.menuPath && perm.menuPath.trim() !== '' && !perm.menuPath.includes('模板管理')) {
if (!menuMatch) {
return false
}
// subsystem templateName templateName
if (templateName && perm.subsystem !== templateName) {
return false return false
} }
// subsystem // subsystem
if (perm.subsystem !== subsystem) { if (!perm.subsystem || perm.subsystem !== subsystem) {
return false return false
} }
// partsName // partsName
if (perm.partsName !== partsName) { if (!perm.partsName || perm.partsName !== partsName) {
return false return false
} }
@ -1297,6 +1306,10 @@ export default {
if (!row) { if (!row) {
return false return false
} }
// /
if (this.isAdmin()) {
return true
}
// createdBy ID/ // createdBy ID/
if (row.createdBy === getUserId()) { if (row.createdBy === getUserId()) {
return true return true

View File

@ -1,6 +1,10 @@
<template> <template>
<div class="apaas-custom-page-todo custom-page"> <div class="apaas-custom-page-todo custom-page">
<template v-if="!showEngineDetail && !showEngineCheck && !showApprovalProgressDetail && !showReportDetail"> <template
v-if="
!showEngineDetail && !showEngineCheck && !showApprovalProgressDetail && !showReportDetail
"
>
<div class="page-header"> <div class="page-header">
<div class="title"> <div class="title">
我的已办 我的已办
@ -35,9 +39,17 @@
@current-page-change="currentChange" @current-page-change="currentChange"
@select-data-change="selectDataChange" @select-data-change="selectDataChange"
> >
<template v-for="(colConfig, index) in tableConfig.colConfigs" v-slot:[colConfig.customSlot]="{ row, rowIndex }"> <template
v-for="(colConfig, index) in tableConfig.colConfigs"
v-slot:[colConfig.customSlot]="{ row, rowIndex }"
>
<div v-if="colConfig.customSlot === 'options'" :key="'op' + index + '' + rowIndex"> <div v-if="colConfig.customSlot === 'options'" :key="'op' + index + '' + rowIndex">
<a href="javascript:void(0)" class="el-link el-link--primary" @click.stop="handleRowView(row)">查看</a> <a
href="javascript:void(0)"
class="el-link el-link--primary"
@click.stop="handleRowView(row)"
>查看</a
>
</div> </div>
</template> </template>
@ -140,10 +152,29 @@
{ prop: 'currentNode', label: '当前环节', showOverflowTooltip: true, minWidth: '140' }, { prop: 'currentNode', label: '当前环节', showOverflowTooltip: true, minWidth: '140' },
// { prop: 'statusCode', label: '', showOverflowTooltip: true, minWidth: '120' }, // { prop: 'statusCode', label: '', showOverflowTooltip: true, minWidth: '120' },
// { prop: 'modelName', label: '', showOverflowTooltip: true, minWidth: '120' }, // { prop: 'modelName', label: '', showOverflowTooltip: true, minWidth: '120' },
{ prop: 'currentProcessor', label: '当前处理人', showOverflowTooltip: true, minWidth: '120' }, {
prop: 'currentProcessor',
label: '当前处理人',
showOverflowTooltip: true,
minWidth: '120'
},
{ prop: 'createdBy', label: '创建人', showOverflowTooltip: true, minWidth: '120' }, { prop: 'createdBy', label: '创建人', showOverflowTooltip: true, minWidth: '120' },
{ prop: 'creationDate', label: '创建时间', showOverflowTooltip: true, minWidth: '160', align: 'center', formatter: this.formatDateTime }, {
{ prop: 'options', label: '操作', customSlot: 'options', align: 'center', width: '100', fixed: 'right' } prop: 'creationDate',
label: '创建时间',
showOverflowTooltip: true,
minWidth: '160',
align: 'center',
formatter: this.formatDateTime
},
{
prop: 'options',
label: '操作',
customSlot: 'options',
align: 'center',
width: '100',
fixed: 'right'
}
], ],
seqType: '', seqType: '',
seqConfig: {}, seqConfig: {},
@ -165,12 +196,12 @@
}, },
handleRowView(row) { handleRowView(row) {
// //
const processTitle = row.processTitle || '' const dataType = row.dataType
const isFillParameterMode = processTitle === '数据维护' const isFillParameterMode = dataType === '数据维护'
const isResponsibleDispatchMode = processTitle === '任务分解' const isResponsibleDispatchMode = dataType === '任务分解'
const isInApprovalMode = processTitle === '数据审批' const isInApprovalMode = dataType === '数据审批'
const isModelCheck = processTitle === '模板审核' const isModelCheck = dataType === '模板审核'
const isReportCheck = processTitle === '对标报告审核' const isReportCheck = dataType === '对标报告审核'
// //
this.currentModel = row.modelName || row.productFullName || '' this.currentModel = row.modelName || row.productFullName || ''
@ -200,6 +231,7 @@
this.currentApprovalDetail = { this.currentApprovalDetail = {
flowId: row.documentNo || '', flowId: row.documentNo || '',
templateId: row.modelId || '', templateId: row.modelId || '',
id: row.documentNo || '',
...row ...row
} }
return return
@ -420,4 +452,3 @@
} }
} }
</style> </style>

View File

@ -186,12 +186,12 @@ export default {
}, },
handleRowView(row) { handleRowView(row) {
// //
const processTitle = row.processTitle || '' const dataType = row.dataType || ''
const isFillParameterMode = processTitle === '数据维护' const isFillParameterMode = dataType === '数据维护'
const isResponsibleDispatchMode = processTitle === '任务分解' const isResponsibleDispatchMode = dataType === '任务分解'
const isInApprovalMode = processTitle === '数据审批' const isInApprovalMode = dataType === '数据审批'
const isModelCheck = processTitle === '模板审核' const isModelCheck = dataType === '模板审核'
const isReportCheck = processTitle === '对标报告审核' const isReportCheck = dataType === '对标报告审核'
// //
this.currentModel = row.modelName || row.productFullName || '' this.currentModel = row.modelName || row.productFullName || ''

View File

@ -1037,6 +1037,8 @@ export default {
} }
const file = this.selectedFile const file = this.selectedFile
console.log(file,2222);
const formData = new FormData() const formData = new FormData()
formData.append('file', file) formData.append('file', file)
formData.append('createBy', getUserId()) formData.append('createBy', getUserId())
@ -1095,6 +1097,7 @@ export default {
const fileUrl = await this.handleFileUpload() const fileUrl = await this.handleFileUpload()
// formData // formData
this.createFormData.fileUrl = fileUrl || '' this.createFormData.fileUrl = fileUrl || ''
this.createFormData.fileName = this.selectedFile.name
} catch (err) { } catch (err) {
console.error('文件上传失败:', err) console.error('文件上传失败:', err)
this.$message.error('文件上传失败,请重试') this.$message.error('文件上传失败,请重试')