Huanyi 3 месяцев назад
Родитель
Сommit
e5aacc6a91
2 измененных файлов с 263 добавлено и 15 удалено
  1. 190 11
      pages/scan/fileSelect/index.vue
  2. 73 4
      pages/scan/folderSelect/index.vue

+ 190 - 11
pages/scan/fileSelect/index.vue

@@ -67,13 +67,42 @@
       >
         <text class="submit-text">直接上传</text>
       </view>
-      <!-- <view 
-        class="submit-btn" 
-        :class="{ 'full-width': fileList.length === 0 }"
-        @click="fileList.length > 0 ? handleSubmitAll() : handleDirectUpload()"
-      >
-        <text class="submit-text">{{ fileList.length > 0 ? '提交' : '直接上传' }}</text>
-      </view> -->
+    </view>
+    
+    <!-- 生效日期选择弹窗 -->
+    <view v-if="showDateModal" class="modal-overlay" @click="handleCloseModal">
+      <view class="modal-content" @click.stop>
+        <view class="modal-header">
+          <text class="modal-title">选择生效日期</text>
+        </view>
+        
+        <view class="modal-body">
+          <view class="date-picker-wrapper">
+            <picker 
+              mode="date" 
+              :value="selectedDate"
+              @change="handleDateChange"
+            >
+              <view class="date-display">
+                <text class="date-label">生效日期:</text>
+                <text class="date-value" :class="{ placeholder: !selectedDate }">
+                  {{ selectedDate || '请选择日期' }}
+                </text>
+                <text class="date-arrow">›</text>
+              </view>
+            </picker>
+          </view>
+        </view>
+        
+        <view class="modal-footer">
+          <view class="modal-btn cancel" @click="handleCloseModal">
+            <text class="modal-btn-text">取消</text>
+          </view>
+          <view class="modal-btn confirm" @click="handleConfirmDate">
+            <text class="modal-btn-text">确认</text>
+          </view>
+        </view>
+      </view>
     </view>
   </view>
 </template>
@@ -93,6 +122,11 @@ const pageSize = ref(10)
 const total = ref(0)
 const loading = ref(false)
 
+// 日期选择弹窗
+const showDateModal = ref(false)
+const selectedDate = ref('')
+const selectedFile = ref(null)
+
 onMounted(() => {
   // 获取系统信息
   const windowInfo = uni.getWindowInfo()
@@ -155,8 +189,43 @@ const handleLoadMore = () => {
   loadFileList()
 }
 
-// 选择文件
-const handleSelectFile = async (file) => {
+// 选择文件 - 先弹出日期选择框
+const handleSelectFile = (file) => {
+  selectedFile.value = file
+  selectedDate.value = ''
+  showDateModal.value = true
+}
+
+// 关闭弹窗
+const handleCloseModal = () => {
+  showDateModal.value = false
+  selectedFile.value = null
+  selectedDate.value = ''
+}
+
+// 日期选择变化
+const handleDateChange = (e) => {
+  selectedDate.value = e.detail.value
+}
+
+// 确认日期并提交
+const handleConfirmDate = async () => {
+  if (!selectedDate.value) {
+    uni.showToast({
+      title: '请选择生效日期',
+      icon: 'none'
+    })
+    return
+  }
+  
+  if (!selectedFile.value) {
+    uni.showToast({
+      title: '未选择文件',
+      icon: 'none'
+    })
+    return
+  }
+  
   try {
     // 从全局数据中获取扫描的fileBase64List
     const fileBase64List = getApp().globalData.scannedFileBase64List
@@ -169,6 +238,9 @@ const handleSelectFile = async (file) => {
       return
     }
     
+    // 关闭弹窗
+    showDateModal.value = false
+    
     uni.showLoading({
       title: '提交中...',
       mask: true
@@ -176,8 +248,9 @@ const handleSelectFile = async (file) => {
     
     // 调用上传接口
     const response = await uploadOnSubmit({
-      documentId: file.id,
-      fileBase64List: fileBase64List
+      documentId: selectedFile.value.id,
+      fileBase64List: fileBase64List,
+      effectiveDate: selectedDate.value
     })
     
     uni.hideLoading()
@@ -466,5 +539,111 @@ const formatDate = (dateStr) => {
       }
     }
   }
+  
+  // 日期选择弹窗
+  .modal-overlay {
+    position: fixed;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 0;
+    background: rgba(0, 0, 0, 0.5);
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    z-index: 1000;
+    
+    .modal-content {
+      width: 600rpx;
+      background: #ffffff;
+      border-radius: 24rpx;
+      overflow: hidden;
+      
+      .modal-header {
+        padding: 32rpx;
+        border-bottom: 1rpx solid #f5f5f5;
+        
+        .modal-title {
+          font-size: 32rpx;
+          font-weight: 600;
+          color: #333333;
+          text-align: center;
+          display: block;
+        }
+      }
+      
+      .modal-body {
+        padding: 32rpx;
+        
+        .date-picker-wrapper {
+          .date-display {
+            background: #f5f5f5;
+            border-radius: 12rpx;
+            padding: 24rpx;
+            display: flex;
+            align-items: center;
+            
+            .date-label {
+              font-size: 28rpx;
+              color: #666666;
+              margin-right: 16rpx;
+            }
+            
+            .date-value {
+              flex: 1;
+              font-size: 28rpx;
+              color: #333333;
+              
+              &.placeholder {
+                color: #999999;
+              }
+            }
+            
+            .date-arrow {
+              font-size: 40rpx;
+              color: #999999;
+              font-weight: 300;
+            }
+          }
+        }
+      }
+      
+      .modal-footer {
+        display: flex;
+        border-top: 1rpx solid #f5f5f5;
+        
+        .modal-btn {
+          flex: 1;
+          height: 88rpx;
+          display: flex;
+          align-items: center;
+          justify-content: center;
+          
+          &:active {
+            background: #f5f5f5;
+          }
+          
+          &.cancel {
+            border-right: 1rpx solid #f5f5f5;
+            
+            .modal-btn-text {
+              color: #666666;
+            }
+          }
+          
+          &.confirm {
+            .modal-btn-text {
+              color: #1ec9c9;
+              font-weight: 600;
+            }
+          }
+          
+          .modal-btn-text {
+            font-size: 32rpx;
+          }
+        }
+      }
+    }
+  }
 }
 </style>

+ 73 - 4
pages/scan/folderSelect/index.vue

@@ -44,9 +44,9 @@
         </view>
         
         <!-- 名称输入 -->
-        <view class="form-item">
-          <view class="form-label">名称:</view>
-          <view class="input-wrapper">
+        <view class="form-item highlight-item">
+          <view class="form-label required">名称:</view>
+          <view class="input-wrapper highlight">
             <input
               v-model="fileName"
               type="text"
@@ -56,6 +56,23 @@
           </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>
+        
         <!-- 提交按钮 -->
         <button 
           class="confirm-btn" 
@@ -112,7 +129,10 @@ export default {
       selectedCenterIndex: 0, // 默认选中第一个(NA)
       
       // 名称输入
-      fileName: ''
+      fileName: '',
+      
+      // 生效日期
+      effectiveDate: ''
     }
   },
   computed: {
@@ -315,6 +335,12 @@ export default {
       return '请选择国家和中心'
     },
     
+    // 日期选择变化
+    handleDateChange(e) {
+      this.effectiveDate = e.detail.value
+      console.log('选择的生效日期:', this.effectiveDate)
+    },
+    
     // 获取所有不属于任何国家的中心
     getIndependentCenters() {
       // 收集所有国家下的中心ID
@@ -415,6 +441,7 @@ export default {
           country: selectedCountry.id === 'NA' ? 0 : selectedCountry.id,
           center: selectedCenter.id === 'NA' ? 0 : selectedCenter.id,
           name: this.fileName.trim(),
+          effectiveDate: this.effectiveDate || '',
           files: fileBase64List
         }
         
@@ -555,6 +582,18 @@ export default {
   .form-item {
     margin-bottom: 32rpx;
     
+    &.highlight-item {
+      .form-label {
+        font-size: 32rpx;
+        color: #1ec9c9;
+        
+        &.required::after {
+          content: ' *';
+          color: #ff4444;
+        }
+      }
+    }
+    
     .form-label {
       font-size: 28rpx;
       color: #333333;
@@ -562,6 +601,36 @@ export default {
       margin-bottom: 16rpx;
     }
     
+    .input-wrapper {
+      background: #ffffff;
+      border: 2rpx solid #e0e0e0;
+      border-radius: 12rpx;
+      padding: 24rpx;
+      transition: all 0.3s;
+      
+      &.highlight {
+        border: 3rpx solid #1ec9c9;
+        background: linear-gradient(135deg, #f0fffe 0%, #ffffff 100%);
+        box-shadow: 0 4rpx 12rpx rgba(30, 201, 201, 0.15);
+        padding: 28rpx;
+      }
+      
+      &:focus-within {
+        border-color: #1ec9c9;
+        box-shadow: 0 0 0 4rpx rgba(30, 201, 201, 0.1);
+      }
+      
+      .input-field {
+        width: 100%;
+        font-size: 28rpx;
+        color: #333333;
+        
+        &::placeholder {
+          color: #999999;
+        }
+      }
+    }
+    
     .picker-display {
       background: #ffffff;
       border: 2rpx solid #e0e0e0;