Эх сурвалжийг харах

新增订单,上传图稿:增加本地文件上传

lxf 1 жил өмнө
parent
commit
fa96c2c95d

+ 57 - 2
src/views/subsidiary/order/management/add.vue

@@ -153,7 +153,23 @@
                                 v-if="row.blueprint"
                                 :src="row.blueprint"
                                 @click="openFile(row.blueprint)" />
-                              <el-button type="primary" style="transform: translateY(-2px)" @click="clickDrawingFile(index)" text>选择文件</el-button>
+                              <div style="display: flex">
+                                <el-button type="primary" @click="clickDrawingFile(index)" text>选择图稿</el-button>
+                                <el-upload
+                                  :show-file-list="false"
+                                  action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
+                                  :data="uploadImgData"
+                                  :before-upload="uploadImgFile"
+                                  :on-success="
+                                    (response, uploadFile) => {
+                                      return handleImgSuccess(uploadFile, index);
+                                    }
+                                  "
+                                  style="width: 100%"
+                                  accept=".docx,.jpg,.jpeg,.png,.GIF,.JPG,.PNG">
+                                  <el-button type="primary" style="margin-left: 12px" text>上传图片</el-button>
+                                </el-upload>
+                              </div>
                             </div>
                           </div>
                           <div style="display: flex; margin-top: 20px; width: 100%">
@@ -165,7 +181,22 @@
                                 v-if="row.productionDocument">
                                 {{ row.productionDocument }}
                               </a>
-                              <el-button type="primary" style="transform: translateY(-2px)" @click="clickDrawingFile(index)" text>选择文件</el-button>
+                              <div style="display: flex">
+                                <el-button type="primary" @click="clickDrawingFile(index)" text>选择图稿</el-button>
+                                <el-upload
+                                  :show-file-list="false"
+                                  action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
+                                  :data="uploadData"
+                                  :before-upload="uploadFile"
+                                  :on-success="
+                                    (response, uploadFile) => {
+                                      return handleSuccess(uploadFile, index);
+                                    }
+                                  "
+                                  style="width: 100%">
+                                  <el-button type="primary" style="margin-left: 12px" text>上传文件</el-button>
+                                </el-upload>
+                              </div>
                             </div>
                           </div>
                         </el-form-item>
@@ -831,6 +862,30 @@ const cellStyleName = ({ row, column, rowIndex, columnIndex }) => {
     return "vertical-align";
   }
 };
+const uploadData = ref({});
+const uploadFile = async (file) => {
+  const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
+  uploadData.value = res.uploadBody;
+  file.id = res.id;
+  file.fileName = res.fileName;
+  file.fileUrl = res.fileUrl;
+  return true;
+};
+const handleSuccess = (UploadFile, index) => {
+  formData.data.orderSkuList[index].productionDocument = UploadFile.raw.fileUrl;
+};
+const uploadImgData = ref({});
+const uploadImgFile = async (file) => {
+  const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
+  uploadImgData.value = res.uploadBody;
+  file.id = res.id;
+  file.fileName = res.fileName;
+  file.fileUrl = res.fileUrl;
+  return true;
+};
+const handleImgSuccess = (UploadFile, index) => {
+  formData.data.orderSkuList[index].blueprint = UploadFile.raw.fileUrl;
+};
 </script>
 
 <style lang="scss" scoped>

+ 58 - 3
src/views/subsidiary/order/management/design.vue

@@ -82,19 +82,50 @@
                                 v-if="row.blueprint"
                                 :src="row.blueprint"
                                 @click="openFile(row.blueprint)" />
-                              <el-button type="primary" style="transform: translateY(-2px)" @click="clickDrawingFile(index)" text>选择文件</el-button>
+                              <div style="display: flex">
+                                <el-button type="primary" @click="clickDrawingFile(index)" text>选择图稿</el-button>
+                                <el-upload
+                                  :show-file-list="false"
+                                  action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
+                                  :data="uploadImgData"
+                                  :before-upload="uploadImgFile"
+                                  :on-success="
+                                    (response, uploadFile) => {
+                                      return handleImgSuccess(uploadFile, index);
+                                    }
+                                  "
+                                  style="width: 100%"
+                                  accept=".docx,.jpg,.jpeg,.png,.GIF,.JPG,.PNG">
+                                  <el-button type="primary" style="margin-left: 12px" text>上传图片</el-button>
+                                </el-upload>
+                              </div>
                             </div>
                           </div>
                           <div style="display: flex; margin-top: 20px; width: 100%">
                             <div style="width: 65px">图稿文件:</div>
                             <div style="width: calc(100% - 65px)">
                               <a
-                                style="color: #409eff; cursor: pointer; word-break: break-all; margin-right: 10px"
+                                style="color: #16e5c1; cursor: pointer; word-break: break-all; margin-right: 10px"
                                 @click="openFile(row.productionDocument)"
                                 v-if="row.productionDocument">
                                 {{ row.productionDocument }}
                               </a>
-                              <el-button type="primary" style="transform: translateY(-2px)" @click="clickDrawingFile(index)" text>选择文件</el-button>
+                              <div style="display: flex">
+                                <el-button type="primary" @click="clickDrawingFile(index)" text>选择图稿</el-button>
+                                <el-upload
+                                  :show-file-list="false"
+                                  action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
+                                  :data="uploadData"
+                                  :before-upload="uploadFile"
+                                  :on-success="
+                                    (response, uploadFile) => {
+                                      return handleSuccess(uploadFile, index);
+                                    }
+                                  "
+                                  style="width: 100%">
+                                  <el-button type="primary" style="margin-left: 12px" text>上传文件</el-button>
+                                </el-upload>
+                              </div>
                             </div>
                           </div>
                         </el-form-item>
@@ -452,6 +483,30 @@ const printType = ref([
     dictValue: "双面",
   },
 ]);
+const uploadData = ref({});
+const uploadFile = async (file) => {
+  const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
+  uploadData.value = res.uploadBody;
+  file.id = res.id;
+  file.fileName = res.fileName;
+  file.fileUrl = res.fileUrl;
+  return true;
+};
+const handleSuccess = (UploadFile, index) => {
+  formData.data.orderSkuList[index].productionDocument = UploadFile.raw.fileUrl;
+};
+const uploadImgData = ref({});
+const uploadImgFile = async (file) => {
+  const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
+  uploadImgData.value = res.uploadBody;
+  file.id = res.id;
+  file.fileName = res.fileName;
+  file.fileUrl = res.fileUrl;
+  return true;
+};
+const handleImgSuccess = (UploadFile, index) => {
+  formData.data.orderSkuList[index].blueprint = UploadFile.raw.fileUrl;
+};
 </script>
 
 <style lang="scss" scoped>