hurx 4 päivää sitten
vanhempi
sitoutus
3364780e08
1 muutettua tiedostoa jossa 6 lisäystä ja 35 poistoa
  1. 6 35
      src/views/order/orderMain/index.vue

+ 6 - 35
src/views/order/orderMain/index.vue

@@ -173,18 +173,13 @@
         </el-row>
 
         <el-row :gutter="20">
-          <!-- 第八行 -->
           <el-col :span="24">
             <el-form-item label="附件" prop="attachmentPath">
-              <div class="attachment-upload">
-                <el-button type="primary" plain @click="showFileSelectorDialog = true">选择附件</el-button>
-                <span v-if="attachmentList.length > 0" class="ml-2">已选择 {{ attachmentList.length }} 个文件</span>
-                <div v-if="attachmentList.length > 0" class="attachment-list mt-2">
-                  <el-tag v-for="(file, index) in attachmentList" :key="index" closable @close="removeAttachment(index)" class="mr-2 mb-2">
-                    {{ file.fileName }}
-                  </el-tag>
-                </div>
-              </div>
+              <FileUpload
+                v-model="form.attachmentPath"
+                :limit="3"
+                :file-type="['doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'txt', 'pdf', 'jpg', 'jpeg', 'png', 'gif']"
+              />
             </el-form-item>
           </el-col>
         </el-row>
@@ -331,16 +326,13 @@
 
     <!-- 查询商品明细对话框 -->
     <SelectProductDetail v-model="showProductDetailDialog" :product-data="currentProductDetail" />
-
-    <!-- 文件选择器对话框 -->
-    <FileSelector v-model="showFileSelectorDialog" :multiple="true" :allowed-types="[1, 2, 3, 4, 5]" title="选择附件" @confirm="handleFileConfirm" />
   </div>
 </template>
 
 <script setup name="OrderMain" lang="ts">
 import { listOrderMain, getOrderMain, delOrderMain, addOrderMain, updateOrderMain } from '@/api/order/orderMain';
 import { OrderMainVO, OrderMainQuery, OrderMainForm } from '@/api/order/orderMain/types';
-import FileSelector from '@/components/FileSelector/index.vue';
+import FileUpload from '@/components/FileUpload/index.vue';
 import { listCompany } from '@/api/company/company';
 import { listCustomerDept } from '@/api/system/dept';
 import { getInvoiceType } from '@/api/customer/invoiceType';
@@ -355,7 +347,6 @@ import ChooseAddress from './components/chooseAddress.vue';
 import AddAddress from './components/addressDialog.vue';
 import ChooseProduct from './components/chooseProduct.vue';
 import SelectProductDetail from './components/selectProductDetail.vue';
-
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
 const { order_status, fee_type, pay_method } = toRefs<any>(proxy?.useDict('order_status', 'fee_type', 'pay_method'));
 const buttonLoading = ref(false);
@@ -394,11 +385,6 @@ const showProductDialog = ref(false);
 const showProductDetailDialog = ref(false);
 const currentProductDetail = ref({});
 
-// 文件选择器对话框
-const showFileSelectorDialog = ref(false);
-// 附件列表
-const attachmentList = ref<any[]>([]);
-
 // 计算商品总数(所有商品的数量之和)
 const totalQuantity = computed(() => {
   return productList.value.reduce((sum, item) => {
@@ -797,21 +783,6 @@ const handleDeleteProduct = (index: number) => {
   proxy?.$modal.msgSuccess('删除成功');
 };
 
-/** 确认选择文件 */
-const handleFileConfirm = (files: any[]) => {
-  attachmentList.value = files;
-  // 将文件路径拼接成字符串保存到form.attachmentPath
-  form.value.attachmentPath = files.map((file) => file.filePath).join(',');
-  proxy?.$modal.msgSuccess(`成功选择${files.length}个附件`);
-};
-
-/** 删除附件 */
-const removeAttachment = (index: number) => {
-  attachmentList.value.splice(index, 1);
-  // 更新form.attachmentPath
-  form.value.attachmentPath = attachmentList.value.map((file) => file.filePath).join(',');
-};
-
 /** 查询商品明细 */
 const handleSelect = (index: number) => {
   if (form.value.warehouseId === undefined) {