feat:修改bug

This commit is contained in:
大黑 2025-12-23 17:09:02 +08:00
parent 662ea9a8ec
commit 280546c410
17 changed files with 1677 additions and 1009 deletions

1
.gitignore vendored
View File

@ -25,3 +25,4 @@ yarn-error.log*
*.sln
*.sw?
node_modules.zip
apaas-custom-mydemo.zip

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

View File

@ -34,29 +34,25 @@
</div>
</div>
<div class="detail-content">
<!-- <section class="block-section">
<section class="block-section">
<div class="section-title">
基础信息
</div>
<div class="info-grid">
<div class="info-item">
<span class="label">模板名称</span>
<span class="label">流程主题</span>
<span class="value">{{ progressDetail.modelName || '--' }}</span>
</div>
<div class="info-item">
<span class="label">申请人</span>
<span class="label">模板名称</span>
<span class="value">{{ progressDetail.applicant || '--' }}</span>
</div>
<div class="info-item">
<span class="label">所属部门</span>
<span class="value">{{ progressDetail.department || '--' }}</span>
</div>
<div class="info-item">
<span class="label">提交时间</span>
<span class="label">版本</span>
<span class="value">{{ progressDetail.submitTime || '--' }}</span>
</div>
</div>
</section> -->
</section>
<section class="block-section">
<div class="section-title">

View File

@ -39,6 +39,7 @@
v-model="formData.partsName"
placeholder="请选择零部件名称"
clearable
multiple
style="width: 100%"
:disabled="!formData.subsystem"
@change="handlePartsNameChange"
@ -57,7 +58,7 @@
placeholder="请选择部门"
clearable
style="width: 100%"
:disabled="dispatchType === 'update_param' ? (!formData.subsystem || !formData.partsName) : !formData.subsystem"
:disabled="dispatchType === 'update_param' ? (!formData.subsystem || !formData.partsName || !Array.isArray(formData.partsName) || formData.partsName.length === 0) : !formData.subsystem"
@change="handleDepartmentChange"
>
<el-option
@ -151,7 +152,7 @@ export default {
submitting: false,
formData: {
subsystem: '',
partsName: '', //
partsName: [], //
department: '',
currentResponsibleId: '', // ID
currentResponsibleName: '', //
@ -191,7 +192,13 @@ export default {
//
if (this.dispatchType === 'update_param') {
rules.partsName = [
{ required: true, message: '请选择零部件名称', trigger: 'change' }
{
required: true,
type: 'array',
min: 1,
message: '请至少选择一个零部件名称',
trigger: 'change'
}
]
}
return rules
@ -218,7 +225,7 @@ export default {
//
this.formData = {
subsystem: '',
partsName: '',
partsName: [],
department: '',
currentResponsibleId: '',
currentResponsibleName: '',
@ -251,7 +258,7 @@ export default {
this.visible = false
this.formData = {
subsystem: '',
partsName: '',
partsName: [],
department: '',
currentResponsibleId: '',
currentResponsibleName: '',
@ -312,7 +319,7 @@ export default {
//
handleSubsystemChange(subsystem) {
// /
this.formData.partsName = ''
this.formData.partsName = []
this.formData.department = ''
this.formData.currentResponsibleId = ''
this.formData.currentResponsibleName = ''
@ -375,7 +382,8 @@ export default {
}
},
//
handlePartsNameChange(partsName) {
handlePartsNameChange(partsNames) {
// partsNames
//
this.formData.department = ''
this.formData.currentFillerId = ''
@ -386,13 +394,13 @@ export default {
this.availableDepartments = []
this.userOptions = []
//
if (partsName && this.formData.subsystem) {
if (partsNames && Array.isArray(partsNames) && partsNames.length > 0 && this.formData.subsystem) {
this.filterDepartmentsByPartsName()
}
},
//
filterDepartmentsByPartsName() {
if (!this.formData.subsystem || !this.formData.partsName) {
if (!this.formData.subsystem || !this.formData.partsName || !Array.isArray(this.formData.partsName) || this.formData.partsName.length === 0) {
this.availableDepartments = []
return
}
@ -405,11 +413,11 @@ export default {
const params = currentVersionData[dataPartsName] || []
//
params.forEach((param) => {
//
//
const paramPartsName = param.partsName || dataPartsName
if (
param.subsystemName === this.formData.subsystem &&
paramPartsName === this.formData.partsName &&
this.formData.partsName.includes(paramPartsName) &&
param.department
) {
departmentSet.add(param.department)
@ -576,15 +584,15 @@ export default {
//
if (this.dispatchType === 'update_param') {
//
if (!this.formData.partsName) {
this.$message.warning('请选择零部件名称')
if (!this.formData.partsName || !Array.isArray(this.formData.partsName) || this.formData.partsName.length === 0) {
this.$message.warning('请至少选择一个零部件名称')
return
}
//
// userNumber 使 userId userNumber
const confirmData = {
subsystem: this.formData.subsystem,
partsName: this.formData.partsName,
partsName: this.formData.partsName, //
department: this.formData.department,
userId: this.formData.userId, // userId
userNumber: this.formData.userNumber || this.formData.userId, // userNumber使 userId

View File

@ -18,16 +18,35 @@
</div>
</div>
</div>
<div class="header-right">
<div v-if="detail.statusDescription === '审核中'" class="header-right">
<el-button size="small" @click="handleReject">
退回
</el-button>
<el-button type="primary" size="small" @click="handleSubmit">
<el-button v-if="detail.statusDescription === '审核中'" type="primary" size="small" @click="handleSubmit">
提交
</el-button>
</div>
</div>
<div class="detail-content">
<section class="block-section">
<div class="section-title">
基础信息
</div>
<div class="info-grid">
<div class="info-item">
<span class="label">流程主题</span>
<span class="value">{{ progressDetail.modelName || '--' }}</span>
</div>
<div class="info-item">
<span class="label">机型名称</span>
<span class="value">{{ progressDetail.applicant || '--' }}</span>
</div>
<div class="info-item">
<span class="label">版本</span>
<span class="value">{{ progressDetail.submitTime || '--' }}</span>
</div>
</div>
</section>
<section class="block-section">
<div class="section-title">
审批内容
@ -271,35 +290,32 @@ export default {
// 使 activitiRecordDTOS
if (this.activitiRecordDTOS && this.activitiRecordDTOS.length > 0) {
// ""
const isPassed = this.detail && this.detail.statusDescription === '已通过'
const isWithdrawn = this.detail && this.detail.statusDescription === '已撤回'
const isReject = this.detail && this.detail.statusDescription === '驳回'
this.activitiRecordDTOS.forEach((record, index) => {
const isLast = index === this.activitiRecordDTOS.length - 1
//
// 1. """"""
// 2. """"
// 3. ""
let result = 'PASS'
let status = 'PASS'
if (isLast) {
if (isWithdrawn || isReject) {
this.activitiRecordDTOS.forEach((record) => {
// operate
// REJECT ->
// APPROVING ->
// PASS -> 绿
let result = 'APPROVING' //
let status = 'APPROVING'
if (record.operate) {
const operate = String(record.operate).toUpperCase()
if (operate === 'REJECT') {
result = 'REJECT'
status = 'REJECT'
} else if (isPassed) {
result = 'PASS'
status = 'PASS'
} else {
} else if (operate === 'APPROVING') {
result = 'APPROVING'
status = 'APPROVING'
} else if (operate === 'PASS') {
result = 'PASS'
status = 'PASS'
}
}
nodes.push({
title: record.node || '审批节点',
userName: record.approverPersons || '--',
time: record.approvalTime || record.handleTime || record.createTime || '',
operateTime: record.approvalTime || record.handleTime || record.createTime || '',
result: result,
status: status,
opinion: record.common || record.comment || record.opinion || null
@ -423,7 +439,7 @@ export default {
setStatusText(result) {
const statusMap = {
PASS: '通过',
REJECT: '驳回',
REJECT: '拒绝',
REFUSE: '驳回',
APPROVE: '批准',
APPROVING: '审批中',

View File

@ -1452,7 +1452,8 @@ export default {
if (this.dispatchType === 'update_param') {
const { subsystem, partsName, department, userId, userNumber, username } = change
console.log(change, 'change', subsystem, partsName, department, userId, userNumber, username)
if (!subsystem || !partsName || !department || !userId) {
// partsName
if (!subsystem || !partsName || !Array.isArray(partsName) || partsName.length === 0 || !department || !userId) {
this.$message({
type: 'warning',
message: '缺少必要参数'
@ -1480,11 +1481,12 @@ export default {
// 使param.partsName使dataPartsName
const paramPartsName = param.partsName || dataPartsName
//
// partsName '/' partsName '/'
//
// partsName '/' partsName '/'
// partsName
if (
param.subsystemName === subsystem &&
paramPartsName === partsName &&
partsName.includes(paramPartsName) &&
param.department === department
) {
//

View File

@ -438,7 +438,9 @@
:on-remove="handleImportFileRemove"
>
<i class="el-icon-upload"></i>
<div class="el-upload__text"> 将文件拖到此处<em>点击上传</em> </div>
<div class="el-upload__text">
将文件拖到此处<em>点击上传</em>
</div>
<div slot="tip" class="el-upload__tip">
仅支持Excel或CSV模板文件
</div>
@ -1256,6 +1258,22 @@ export default {
}
return findPath(this.departmentList, departmentId) || ''
},
//
formatDepartmentDisplay(department) {
if (!department) {
return '平台部'
}
// · -
const normalizedDept = department.replace(/·/g, '-')
// -
const parts = normalizedDept.split('-').filter(part => part.trim() !== '')
//
if (parts.length > 0) {
return parts[parts.length - 1]
}
//
return normalizedDept
},
handleBack() {
//
if (this.isApprovalMode) {
@ -1385,7 +1403,7 @@ export default {
}
return
}
const templateId = this.internalTemplateId || this.templateId
const templateId = this.getDetailTemplateId()
if (!templateId) {
this.$message.error('缺少模板ID无法导入')
return
@ -1451,7 +1469,7 @@ export default {
this.importDialogVisible = false
},
handleDownloadTemplate() {
const templateRowId = this.templateId
const templateRowId = this.getDetailTemplateId()
if (!templateRowId) {
console.log('未找到模板ID无法下载')
return
@ -1568,10 +1586,9 @@ export default {
item.number ||
(this.pagination.currentPage - 1) * this.pagination.pageSize + index + 1
}
// department 使
// · -
// department
if (item.department) {
processedItem.department = item.department.replace(/·/g, '-')
processedItem.department = this.formatDepartmentDisplay(item.department)
}
return processedItem
})
@ -1679,7 +1696,7 @@ export default {
},
handleApprovalFormSubmit() {
// ID
const templateRowId = this.internalTemplateId || this.templateId
const templateRowId = this.getDetailTemplateId()
if (!templateRowId) {
this.$message.error('缺少模板ID无法发起审批')
return
@ -1923,7 +1940,7 @@ export default {
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
const templateRowId = this.internalTemplateId || this.templateId
const templateRowId = this.getDetailTemplateId()
if (!templateRowId) {
console.log('缺少模板ID无法提交')
return
@ -1957,23 +1974,23 @@ export default {
this.isMaintainMode = false
this.originalTableData = []
this.submitting = false
this.internalTemplateId = res.data.templateRowId
const newTemplateId = res.data && (res.data.templateId || res.data.templateRowId)
this.setDetailTemplateId(newTemplateId)
this.internalTemplateVersion = res.data.version
this.templateVersion = res.data.version
this.templateId = res.data.templateRowId
console.log(this.templateId, res.data.templateRowId)
if (!this.versionList.some((v) => v.version === res.data.version)) {
this.versionList.push({
version: res.data.version,
status: 'DRAFT',
rowId: res.data.templateRowId,
id: res.data.templateId
rowId: newTemplateId,
id: newTemplateId
})
} else {
const versionItem = this.versionList.find((v) => v.version === res.data.version)
versionItem.status = 'DRAFT'
versionItem.rowId = res.data.templateRowId
versionItem.id = res.data.templateId
versionItem.rowId = newTemplateId
versionItem.id = newTemplateId
}
this.loadData()
})
@ -2247,7 +2264,7 @@ export default {
loadTemplateInfo() {
// ID
// API
const id = this.internalTemplateId || this.templateId
const id = this.getDetailTemplateId()
if (id) {
// TODO: API
// this.$request(...).then(res => {
@ -2258,7 +2275,7 @@ export default {
loadLatestVersion() {
//
//
const id = this.internalTemplateId || this.templateId
const id = this.getDetailTemplateId()
if (id && !this.internalTemplateVersion) {
// TODO: API
// this.$request(...).then(res => {
@ -2275,7 +2292,7 @@ export default {
},
loadAllData() {
//
const templateId = this.internalTemplateId || this.templateId
const templateId = this.getDetailTemplateId()
if (!templateId) {
this.tableData = []
this.$set(this.pagination, 'total', 0)
@ -2313,7 +2330,8 @@ export default {
return {
...item,
parameterType: item.parameterType || item.type || '',
number: item.number || index + 1
number: item.number || index + 1,
department: item.department ? this.formatDepartmentDisplay(item.department) : (item.department || '')
}
})
// 使 Vue.set 使 totalNumber
@ -2333,11 +2351,23 @@ export default {
//
return version.version || version.name || version.rowId || ''
},
// 使 templateId
getDetailTemplateId() {
return this.internalTemplateId || this.templateId || ''
},
// 使 templateId使
setDetailTemplateId(newTemplateId) {
if (!newTemplateId) return
this.internalTemplateId = newTemplateId
this.templateId = newTemplateId
},
handleVersionChange(versionName) {
//
this.internalTemplateVersion = versionName
this.changeId = this.versionList.find((v) => v.version === versionName)?.id || ''
this.internalTemplateId = this.versionList.find((v) => v.version === versionName)?.rowId || ''
const versionItem = this.versionList.find((v) => v.version === versionName)
const newTemplateId = (versionItem && (versionItem.id || versionItem.rowId)) || ''
this.setDetailTemplateId(newTemplateId)
//
this.$set(this.pagination, 'currentPage', 1)
// 使
@ -2371,7 +2401,7 @@ export default {
}
},
loadData() {
const templateId = this.internalTemplateId || this.templateId
const templateId = this.getDetailTemplateId()
if (!templateId) {
this.tableData = []
this.$set(this.pagination, 'total', 0)
@ -2412,7 +2442,8 @@ export default {
return {
...item,
parameterType: item.parameterType || item.type || '',
number: item.number || startIndex + index + 1
number: item.number || startIndex + index + 1,
department: item.department ? this.formatDepartmentDisplay(item.department) : (item.department || '')
}
})
// resp.data result

View File

@ -104,8 +104,8 @@
<span v-else-if="row[colConfig.prop] === '已通过'" class="status-tag status-approved"
>已通过</span
>
<span v-else-if="row[colConfig.prop] === '撤回'" class="status-tag status-withdrawn"
>撤回</span
<span v-else-if="row[colConfig.prop] === '拒绝'" class="status-tag status-withdrawn"
>拒绝</span
>
<span v-else class="status-tag status-default">{{ row[colConfig.prop] }}</span>
</div>
@ -508,7 +508,10 @@ export default {
// API
const flowId = row.flowId || row.id
if (!flowId) {
this.$message.error('缺少审批ID无法查看详情')
this.$message({
type: 'error',
message: '缺少审批ID无法查看详情'
})
return
}
this.showEngineCheck = true
@ -566,12 +569,11 @@ export default {
this.$request(request)
.asyncThen((resp) => {
console.log('审批提交成功')
this.loadData()
this.approvalDialogVisible = false
this.currentApprovalRow = null
this.approvalSubmitting = false
//
this.loadData()
})
.asyncErrorCatch((err) => {
console.error('审批提交失败:', err)
@ -617,7 +619,7 @@ export default {
page: this.pagination.currentPage,
size: this.pagination.pageSize,
ycOrOth: '竞品',
userID: getUserId(),
// userID: getUserId(),
...this.searchPanelValue
},
disableSuccessMsg: true
@ -774,8 +776,8 @@ export default {
}
&.status-withdrawn {
background: #f5f7fa;
color: #606266;
background: #f56c6c;
color: white;
}
}
}

View File

@ -6,6 +6,7 @@
竞品发动机数据
</div>
<div class="operation">
<el-button type="primary" @click="handleDownloadTemplate">下载模板</el-button>
<el-button class="import-button" @click="handleImport">
导入机型
</el-button>
@ -23,7 +24,7 @@
</div>
<div class="searched-field">
<span class="fielded-label">状态代号</span>
<el-input v-model="searchPanelValue.statusCode" placeholder="请输入" />
<el-input v-model="searchPanelValue.productNumber" placeholder="请输入" />
</div>
<div class="searched-field">
<span class="fielded-label">板块</span>
@ -184,6 +185,7 @@
</div>
</el-upload>
<span slot="footer" class="dialog-footer">
<el-button @click="handleImportDialogClose">取消</el-button>
<el-button type="primary" :loading="importing" @click="handleImportConfirm">
开始导入
@ -235,7 +237,8 @@ export default {
importDialogVisible: false,
importing: false,
selectedImportFile: null,
importFileList: []
importFileList: [],
downloadingTemplate: false
}
},
computed: {
@ -512,7 +515,6 @@ export default {
.then((resp) => {
console.log('导入成功:', resp)
loadingInstance.close()
//
this.handleImportDialogClose()
this.loadData()
@ -530,6 +532,89 @@ export default {
this.importing = false
})
},
handleDownloadTemplate() {
if (this.downloadingTemplate) {
return
}
const { url, method = 'get', headers = {} } = api.DOWNLOAD_ENGINE_DEMO || {}
const requestConfig = {
url,
method,
params: {},
responseType: 'blob',
headers
}
if (!requestConfig.url) {
console.log('未配置下载地址')
return
}
if ((requestConfig.method || '').toLowerCase() === 'post') {
requestConfig.data = requestConfig.params
delete requestConfig.params
}
const defaultFilename = '机型导入模板.xlsx'
this.downloadingTemplate = 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 = defaultFilename
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)
this.$message({
type: 'success',
message: '下载成功'
})
console.log('下载开始,请查看浏览器下载列表')
})
.catch((err) => {
console.error('下载失败:', err)
this.$message.error('下载失败,请稍后重试')
})
.finally(() => {
this.downloadingTemplate = false
})
},
handleAdd() {
// selfEnginedata.vue ycOrOth ""
this.$refs.addEngineModelModal.showModal('竞品')

View File

@ -898,32 +898,99 @@ export default {
this.$request(request)
.asyncThen((resp) => {
if (resp && 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
// { "": [], "": ["-yc90117847"] }
const responseData = resp.data
const deptArray = responseData['部门'] || responseData.department || []
const personArray = responseData['人员'] || responseData.person || []
// ["userName-userId"]
if (personArray && personArray.length > 0) {
const personOptions = []
const personUserNumbers = []
personArray.forEach((personStr) => {
if (typeof personStr === 'string' && personStr.includes('-')) {
// userName-userId
const parts = personStr.split('-')
if (parts.length >= 2) {
// userId userName
const userId = parts[parts.length - 1]
const userName = parts.slice(0, -1).join('-')
personOptions.push({
userId: userId,
username: userName,
userNumber: userId // userNumber 使 userId
})
personUserNumbers.push(userId)
}
// {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)
}
})
this.personOptions = personOptions
this.personConfigFormData.person = personUserNumbers
//
this.personConfigFormData.configType = 'person'
} else {
this.personOptions = []
this.personConfigFormData.person = []
}
// ["deptName-deptId"]
if (deptArray && deptArray.length > 0) {
const deptIds = []
const deptPaths = []
deptArray.forEach((deptStr) => {
if (typeof deptStr === 'string' && deptStr.includes('-')) {
// deptName-deptId
const parts = deptStr.split('-')
if (parts.length >= 2) {
// deptId deptName
const deptId = parts[parts.length - 1]
// deptName
// const deptName = parts.slice(0, -1).join('-')
//
const deptPath = this.findDepartmentPath(deptId)
if (deptPath && deptPath.length > 0) {
deptPaths.push(deptPath)
deptIds.push(deptId)
} else {
// 使 deptId
deptIds.push(deptId)
//
deptPaths.push([deptId])
}
}
}
})
if (deptIds.length > 0) {
this.personConfigFormData.selectDeptIds = deptIds
this.personConfigFormData.department = deptPaths
//
if (!personArray || personArray.length === 0) {
this.personConfigFormData.configType = 'department'
}
}
} else {
this.personConfigFormData.selectDeptIds = []
this.personConfigFormData.department = []
}
} else {
this.personOptions = []
this.personConfigFormData.person = []
this.personConfigFormData.selectDeptIds = []
this.personConfigFormData.department = []
}
})
.asyncErrorCatch((err) => {
console.error('加载人员列表失败:', err)
this.personOptions = []
this.personConfigFormData.person = []
this.personConfigFormData.selectDeptIds = []
this.personConfigFormData.department = []
})
this.personConfigDialogVisible = true
this.$nextTick(() => {
@ -1179,6 +1246,33 @@ export default {
const path = findNodePath(this.departmentList, deptId)
return path ? path.join('-') : ''
},
// idID
findDepartmentPath(deptId) {
if (!deptId || !this.departmentList || this.departmentList.length === 0) {
return null
}
// ID
const findNodeIdPath = (nodes, targetId, path = []) => {
for (const node of nodes) {
const currentPath = [...path, node.id]
if (node.id === targetId) {
return currentPath
}
if (node.children && node.children.length > 0) {
const found = findNodeIdPath(node.children, targetId, currentPath)
if (found) {
return found
}
}
}
return null
}
return findNodeIdPath(this.departmentList, deptId)
},
//
handlePersonConfigSubmit() {
this.$refs.personConfigForm.validate((valid) => {

View File

@ -153,13 +153,13 @@
>查看</a
>
<span style="width: 6px; display: inline-block"></span>
<!-- <a
<a
v-if="false"
href="javascript:void(0)"
class="el-link el-link--primary"
@click.stop="handleEdit(row)"
>修改</a
> -->
>
<span style="width: 6px; display: inline-block"></span>
<a
v-if="row.status === 'APPROVING'"

View File

@ -6,6 +6,7 @@
玉柴发动机数据
</div>
<div class="operation">
<el-button type="primary" @click="handleDownloadTemplate">下载模板</el-button>
<el-button class="import-button" @click="handleImport">
导入机型
</el-button>
@ -184,7 +185,7 @@
</div>
</el-upload>
<span slot="footer" class="dialog-footer">
<el-button @click="handleDownloadTemplate">下载模板</el-button>
<el-button @click="handleImportDialogClose">取消</el-button>
<el-button type="primary" :loading="importing" @click="handleImportConfirm">
开始导入