|
|
@@ -96,6 +96,7 @@ export default {
|
|
|
statusBarHeight: 0,
|
|
|
projectId: 0,
|
|
|
projectName: '',
|
|
|
+ projectCode: '',
|
|
|
rawData: null,
|
|
|
loading: false,
|
|
|
showRawData: false,
|
|
|
@@ -134,9 +135,11 @@ export default {
|
|
|
|
|
|
this.projectId = parseInt(options.projectId) || 0
|
|
|
this.projectName = decodeURIComponent(options.projectName || '')
|
|
|
+ this.projectCode = decodeURIComponent(options.projectCode || '')
|
|
|
|
|
|
console.log('解析后的projectId:', this.projectId)
|
|
|
console.log('解析后的projectName:', this.projectName)
|
|
|
+ console.log('解析后的projectCode:', this.projectCode)
|
|
|
},
|
|
|
onReady() {
|
|
|
// 获取系统信息
|
|
|
@@ -324,26 +327,74 @@ export default {
|
|
|
console.log('选择的生效日期:', this.effectiveDate)
|
|
|
},
|
|
|
|
|
|
- // 格式化日期为 YYYYMMDD 格式
|
|
|
+ // 格式化日期为 YYYYMMDD 格式(用于显示)
|
|
|
formatDate(dateStr) {
|
|
|
if (!dateStr) return ''
|
|
|
// 将 2026-01-21 转换为 20260121
|
|
|
return dateStr.replace(/-/g, '')
|
|
|
},
|
|
|
|
|
|
- // 获取名称前缀(项目名-中心ID)
|
|
|
- getNamePrefix() {
|
|
|
+ // 格式化日期为 YYYY-MM-DD HH:mm:ss 格式(用于提交)
|
|
|
+ formatDateTimeForSubmit(dateStr) {
|
|
|
+ if (!dateStr) return ''
|
|
|
+ // 将 2026-01-21 转换为 2026-01-21 00:00:00
|
|
|
+ return `${dateStr} 00:00:00`
|
|
|
+ },
|
|
|
+
|
|
|
+ // 获取文件夹ID(folder参数的逻辑)
|
|
|
+ getFolderId() {
|
|
|
+ const selectedCountry = this.countryList[this.selectedCountryIndex]
|
|
|
+ const selectedCenter = this.centerList[this.selectedCenterIndex]
|
|
|
+
|
|
|
+ // 如果选择了中心(且不是NA),使用中心ID
|
|
|
+ if (selectedCenter && selectedCenter.id !== 'NA') {
|
|
|
+ return selectedCenter.id
|
|
|
+ }
|
|
|
+
|
|
|
+ // 如果选择了国家(且不是NA),使用国家ID
|
|
|
+ if (selectedCountry && selectedCountry.id !== 'NA') {
|
|
|
+ return selectedCountry.id
|
|
|
+ }
|
|
|
+
|
|
|
+ // 否则使用0
|
|
|
+ return 0
|
|
|
+ },
|
|
|
+
|
|
|
+ // 获取完整名称(用于提交)
|
|
|
+ // 格式:{项目编号}-{国家名/NA}-{中心号/NA}-[具体文档名]-[生效日期]
|
|
|
+ getFullNameForSubmit() {
|
|
|
+ const projectCode = this.projectCode || 'NA'
|
|
|
+
|
|
|
+ const country = this.countryList[this.selectedCountryIndex]
|
|
|
+ const countryName = country && country.id !== 'NA' ? country.name : 'NA'
|
|
|
+
|
|
|
const center = this.centerList[this.selectedCenterIndex]
|
|
|
const centerId = center && center.id !== 'NA' ? center.id : 'NA'
|
|
|
- return `${this.projectName}-${centerId}-`
|
|
|
+
|
|
|
+ const docName = this.documentName.trim() || '[请输入具体文档名]'
|
|
|
+ const date = this.formatDate(this.effectiveDate) || '[请输入生效日期]'
|
|
|
+
|
|
|
+ return `${projectCode}-${countryName}-${centerId}-${docName}-${date}`
|
|
|
},
|
|
|
|
|
|
- // 获取最终完整名称
|
|
|
+ // 获取显示名称(用于前端显示,NA时隐藏)
|
|
|
+ // 格式:{项目编号}-[国家名(如果不是NA)]-[中心号(如果不是NA)]-[具体文档名]-[生效日期]
|
|
|
getFinalName() {
|
|
|
- const prefix = this.getNamePrefix()
|
|
|
+ const projectCode = this.projectCode || 'NA'
|
|
|
+
|
|
|
+ const country = this.countryList[this.selectedCountryIndex]
|
|
|
+ const countryName = country && country.id !== 'NA' ? country.name : ''
|
|
|
+
|
|
|
+ const center = this.centerList[this.selectedCenterIndex]
|
|
|
+ const centerId = center && center.id !== 'NA' ? center.id : ''
|
|
|
+
|
|
|
const docName = this.documentName.trim() || '[请输入具体文档名]'
|
|
|
const date = this.formatDate(this.effectiveDate) || '[请输入生效日期]'
|
|
|
- return `${prefix}${docName}-${date}`
|
|
|
+
|
|
|
+ // 构建名称数组,过滤掉空值
|
|
|
+ const nameParts = [projectCode, countryName, centerId, docName, date].filter(part => part !== '')
|
|
|
+
|
|
|
+ return nameParts.join('-')
|
|
|
},
|
|
|
|
|
|
// 获取所有不属于任何国家的中心
|
|
|
@@ -449,13 +500,15 @@ export default {
|
|
|
})
|
|
|
|
|
|
// 构建请求参数
|
|
|
- const finalName = this.getFinalName()
|
|
|
+ const fullName = this.getFullNameForSubmit() // 完整名称用于提交
|
|
|
+ const folderId = this.getFolderId()
|
|
|
+
|
|
|
const params = {
|
|
|
projectId: this.projectId,
|
|
|
- country: selectedCountry.id === 'NA' ? 0 : selectedCountry.id,
|
|
|
- center: selectedCenter.id === 'NA' ? 0 : selectedCenter.id,
|
|
|
- name: finalName,
|
|
|
- effectiveDate: this.formatDate(this.effectiveDate),
|
|
|
+ folder: folderId,
|
|
|
+ specificName: this.documentName.trim(),
|
|
|
+ name: fullName,
|
|
|
+ effectiveDate: this.formatDateTimeForSubmit(this.effectiveDate),
|
|
|
files: fileBase64List
|
|
|
}
|
|
|
|