|
|
@@ -43,69 +43,52 @@
|
|
|
</picker>
|
|
|
</view>
|
|
|
|
|
|
- <!-- 名称输入 -->
|
|
|
+ <!-- 名称和生效日期合并 -->
|
|
|
<view class="form-item highlight-item">
|
|
|
<view class="form-label required">名称:</view>
|
|
|
<view class="input-wrapper highlight">
|
|
|
<input
|
|
|
- v-model="fileName"
|
|
|
+ v-model="documentName"
|
|
|
type="text"
|
|
|
- placeholder="请输入名称"
|
|
|
+ placeholder="请输入具体文档名"
|
|
|
class="input-field"
|
|
|
/>
|
|
|
</view>
|
|
|
- </view>
|
|
|
-
|
|
|
- <!-- 生效日期选择 -->
|
|
|
- <view class="form-item">
|
|
|
- <view class="form-label">生效日期:</view>
|
|
|
- <picker
|
|
|
- mode="date"
|
|
|
- :value="effectiveDate"
|
|
|
- @change="handleDateChange"
|
|
|
- >
|
|
|
- <view class="picker-display">
|
|
|
- <text class="picker-text" :class="{ placeholder: !effectiveDate }">
|
|
|
- {{ effectiveDate || '请选择生效日期' }}
|
|
|
- </text>
|
|
|
- <text class="picker-arrow">›</text>
|
|
|
- </view>
|
|
|
- </picker>
|
|
|
+ <view class="date-picker-wrapper">
|
|
|
+ <picker
|
|
|
+ mode="date"
|
|
|
+ :value="effectiveDate"
|
|
|
+ @change="handleDateChange"
|
|
|
+ >
|
|
|
+ <view class="picker-display">
|
|
|
+ <text class="picker-text" :class="{ placeholder: !effectiveDate }">
|
|
|
+ {{ effectiveDate || '请输入生效日期' }}
|
|
|
+ </text>
|
|
|
+ <text class="picker-arrow">›</text>
|
|
|
+ </view>
|
|
|
+ </picker>
|
|
|
+ </view>
|
|
|
+ <view class="final-name-preview">
|
|
|
+ <text class="preview-label">完整名称预览:</text>
|
|
|
+ <text class="preview-text">{{ getFinalName() }}</text>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
|
|
|
<!-- 提交按钮 -->
|
|
|
<button
|
|
|
class="confirm-btn"
|
|
|
- :disabled="selectedCountryIndex < 0 || selectedCenterIndex < 0 || !fileName.trim()"
|
|
|
+ :disabled="selectedCountryIndex < 0 || selectedCenterIndex < 0 || !documentName.trim()"
|
|
|
@click="handleSubmit"
|
|
|
>
|
|
|
提交
|
|
|
</button>
|
|
|
-
|
|
|
- <!-- 调试信息 -->
|
|
|
- <view class="debug-section">
|
|
|
- <view class="debug-title">调试信息:</view>
|
|
|
- <view class="debug-item">国家数量: {{ countryList.length }}</view>
|
|
|
- <view class="debug-item">中心数量: {{ centerList.length }}</view>
|
|
|
- <view class="debug-item">选中国家: {{ selectedCountryIndex === -1 ? '未选择' : countryList[selectedCountryIndex]?.name }}</view>
|
|
|
- <view class="debug-item">选中中心: {{ selectedCenterIndex === -1 ? '未选择' : centerList[selectedCenterIndex]?.name }}</view>
|
|
|
- </view>
|
|
|
-
|
|
|
- <!-- 原始数据展示 -->
|
|
|
- <view class="raw-data-section">
|
|
|
- <view class="raw-data-title" @click="showRawData = !showRawData">
|
|
|
- 原始数据 {{ showRawData ? '▼' : '▶' }}
|
|
|
- </view>
|
|
|
- <view v-if="showRawData" class="json-display">{{ JSON.stringify(rawData, null, 2) }}</view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { getFolderList } from '@/apis/scan'
|
|
|
-import request from '@/utils/request.js'
|
|
|
+import { getFolderList, uploadScanFile } from '@/apis/scan'
|
|
|
|
|
|
export default {
|
|
|
data() {
|
|
|
@@ -128,8 +111,8 @@ export default {
|
|
|
centerList: [],
|
|
|
selectedCenterIndex: 0, // 默认选中第一个(NA)
|
|
|
|
|
|
- // 名称输入
|
|
|
- fileName: '',
|
|
|
+ // 文档名称输入
|
|
|
+ documentName: '',
|
|
|
|
|
|
// 生效日期
|
|
|
effectiveDate: ''
|
|
|
@@ -341,6 +324,28 @@ export default {
|
|
|
console.log('选择的生效日期:', this.effectiveDate)
|
|
|
},
|
|
|
|
|
|
+ // 格式化日期为 YYYYMMDD 格式
|
|
|
+ formatDate(dateStr) {
|
|
|
+ if (!dateStr) return ''
|
|
|
+ // 将 2026-01-21 转换为 20260121
|
|
|
+ return dateStr.replace(/-/g, '')
|
|
|
+ },
|
|
|
+
|
|
|
+ // 获取名称前缀(项目名-中心ID)
|
|
|
+ getNamePrefix() {
|
|
|
+ const center = this.centerList[this.selectedCenterIndex]
|
|
|
+ const centerId = center && center.id !== 'NA' ? center.id : 'NA'
|
|
|
+ return `${this.projectName}-${centerId}-`
|
|
|
+ },
|
|
|
+
|
|
|
+ // 获取最终完整名称
|
|
|
+ getFinalName() {
|
|
|
+ const prefix = this.getNamePrefix()
|
|
|
+ const docName = this.documentName.trim() || '[请输入具体文档名]'
|
|
|
+ const date = this.formatDate(this.effectiveDate) || '[请输入生效日期]'
|
|
|
+ return `${prefix}${docName}-${date}`
|
|
|
+ },
|
|
|
+
|
|
|
// 获取所有不属于任何国家的中心
|
|
|
getIndependentCenters() {
|
|
|
// 收集所有国家下的中心ID
|
|
|
@@ -407,9 +412,17 @@ export default {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- if (!this.fileName.trim()) {
|
|
|
+ if (!this.documentName.trim()) {
|
|
|
uni.showToast({
|
|
|
- title: '请输入名称',
|
|
|
+ title: '请输入具体文档名',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!this.effectiveDate) {
|
|
|
+ uni.showToast({
|
|
|
+ title: '请输入生效日期',
|
|
|
icon: 'none'
|
|
|
})
|
|
|
return
|
|
|
@@ -436,12 +449,13 @@ export default {
|
|
|
})
|
|
|
|
|
|
// 构建请求参数
|
|
|
+ const finalName = this.getFinalName()
|
|
|
const params = {
|
|
|
projectId: this.projectId,
|
|
|
country: selectedCountry.id === 'NA' ? 0 : selectedCountry.id,
|
|
|
center: selectedCenter.id === 'NA' ? 0 : selectedCenter.id,
|
|
|
- name: this.fileName.trim(),
|
|
|
- effectiveDate: this.effectiveDate || '',
|
|
|
+ name: finalName,
|
|
|
+ effectiveDate: this.formatDate(this.effectiveDate),
|
|
|
files: fileBase64List
|
|
|
}
|
|
|
|
|
|
@@ -449,11 +463,7 @@ export default {
|
|
|
console.log('params:', params)
|
|
|
|
|
|
// 调用上传接口
|
|
|
- const response = await request({
|
|
|
- url: '/applet/scan/upload',
|
|
|
- method: 'POST',
|
|
|
- data: params
|
|
|
- })
|
|
|
+ const response = await uploadScanFile(params)
|
|
|
|
|
|
console.log('========== 上传响应 ==========')
|
|
|
console.log('response:', response)
|
|
|
@@ -601,6 +611,32 @@ export default {
|
|
|
margin-bottom: 16rpx;
|
|
|
}
|
|
|
|
|
|
+ .date-picker-wrapper {
|
|
|
+ margin-top: 16rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ .final-name-preview {
|
|
|
+ margin-top: 16rpx;
|
|
|
+ padding: 20rpx 24rpx;
|
|
|
+ background: #f5f5f5;
|
|
|
+ border-radius: 12rpx;
|
|
|
+ border: 2rpx dashed #cccccc;
|
|
|
+
|
|
|
+ .preview-label {
|
|
|
+ font-size: 24rpx;
|
|
|
+ color: #666666;
|
|
|
+ display: block;
|
|
|
+ margin-bottom: 8rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ .preview-text {
|
|
|
+ font-size: 26rpx;
|
|
|
+ color: #333333;
|
|
|
+ font-weight: 500;
|
|
|
+ word-break: break-all;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
.input-wrapper {
|
|
|
background: #ffffff;
|
|
|
border: 2rpx solid #e0e0e0;
|