Browse Source

订单 上传图稿

lxf 1 year ago
parent
commit
24f9a42d4b

+ 1 - 1
src/components/makeGroupProduct/index.vue

@@ -212,7 +212,7 @@
       </template>
     </el-dialog>
 
-    <el-dialog title="选择BOM" v-if="openDrawingFile" v-model="openDrawingFile" width="70%">
+    <el-dialog title="选择图稿文件" v-if="openDrawingFile" v-model="openDrawingFile" width="70%">
       <SelectPicture @selectPic="selectPic"></SelectPicture>
       <template #footer>
         <el-button @click="openDrawingFile = false" size="large">关 闭</el-button>

+ 8 - 17
src/views/group/order/management/detail.vue

@@ -181,26 +181,17 @@
                     <el-table-column label="图稿(设计图)" width="180">
                       <template #default="{ row }">
                         <el-form-item :prop="'orderSkuList.' + index + '.blueprint'">
-                          <el-upload
-                            class="avatar-uploader"
-                            action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
-                            :data="uploadProductData"
-                            :show-file-list="false"
-                            :on-success="
-                              (response, uploadFile) => {
-                                return handleProductSuccess(uploadFile, index);
-                              }
-                            "
-                            :before-upload="uploadProductFile">
-                            <el-image v-if="row.blueprint" :src="row.blueprint" fit="scale-down" class="avatar" />
-                            <el-icon v-else class="avatar-uploader-icon"><Plus /></el-icon>
-                          </el-upload>
+                          <el-image
+                            fit="scale-down"
+                            style="width: 148px; height: 148px; margin-top: 20px"
+                            v-if="row.blueprint"
+                            :src="row.blueprint"
+                            @click="openFile(row.blueprint)" />
                         </el-form-item>
                       </template>
                     </el-table-column>
                     <el-table-column label="图稿(生产文件)" width="320">
                       <template #default="{ row }">
-                        <div style="color: black; line-height: 35px">共享文件夹路径(点击下方链接并上传文件):</div>
                         <div v-if="row.productionDocument">
                           <a style="color: #409eff; cursor: pointer; word-break: break-all" @click="openFile(row.productionDocument)">
                             {{ row.productionDocument }}
@@ -648,11 +639,11 @@ const getStyle = (text) => {
 };
 const printType = ref([
   {
-    dictKey: "1",
+    dictKey: 1,
     dictValue: "单面",
   },
   {
-    dictKey: "2",
+    dictKey: 2,
     dictValue: "双面",
   },
 ]);

+ 28 - 132
src/views/subsidiary/order/management/add.vue

@@ -144,43 +144,23 @@
                     <el-table-column label="图稿(设计图)" width="180">
                       <template #default="{ row }">
                         <el-form-item :prop="'orderSkuList.' + index + '.blueprint'">
-                          <el-upload
-                            class="avatar-uploader"
-                            action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
-                            :data="uploadProductData"
-                            :show-file-list="false"
-                            :on-success="
-                              (response, uploadFile) => {
-                                return handleProductSuccess(uploadFile, index);
-                              }
-                            "
-                            :before-upload="uploadProductFile">
-                            <el-image v-if="row.blueprint" :src="row.blueprint" fit="scale-down" class="avatar" />
-                            <el-icon v-else class="avatar-uploader-icon"><Plus /></el-icon>
-                          </el-upload>
+                          <el-button style="background: #20b2aa; color: #fff; border: 1px solid #20b2aa" @click="clickDrawingFile(index)">选择</el-button>
+                          <el-image
+                            fit="scale-down"
+                            style="width: 148px; height: 148px; margin-top: 20px;"
+                            v-if="row.blueprint"
+                            :src="row.blueprint"
+                            @click="openFile(row.blueprint)" />
                         </el-form-item>
                       </template>
                     </el-table-column>
                     <el-table-column label="图稿(生产文件)" width="320">
                       <template #default="{ row }">
-                        <div style="color: black; line-height: 35px">共享文件夹路径(点击下方链接并上传文件):</div>
                         <div v-if="row.productionDocument">
                           <a style="color: #409eff; cursor: pointer; word-break: break-all" @click="openFile(row.productionDocument)">
                             {{ row.productionDocument }}
                           </a>
                         </div>
-                        <el-upload
-                          action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
-                          :data="uploadData"
-                          :show-file-list="false"
-                          :before-upload="beforeUpload"
-                          :on-success="
-                            (response, uploadFile) => {
-                              return handleSuccess(uploadFile, index);
-                            }
-                          ">
-                          <el-button style="background: #20b2aa; color: #fff; border: 1px solid #20b2aa">上传</el-button>
-                        </el-upload>
                       </template>
                     </el-table-column>
                     <el-table-column label="包材配件/单品" min-width="400">
@@ -289,20 +269,6 @@
             </div>
           </div>
         </template>
-        <!-- <template #attachments>
-          <div style="width: 100%">
-            <el-upload
-              v-model:fileList="fileList"
-              action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
-              :data="uploadData"
-              multiple
-              :before-upload="beforeUpload"
-              :on-success="handleSuccess"
-              :on-preview="onPreviewFile">
-              <el-button style="background: #20b2aa; color: #fff; border: 1px solid #20b2aa">上传</el-button>
-            </el-upload>
-          </div>
-        </template> -->
         <template #remark>
           <div style="width: 100%">
             <div v-if="route.query && route.query.detailId">
@@ -333,6 +299,13 @@
         <el-button @click="openPackingFittings = false" size="large">关 闭</el-button>
       </template>
     </el-dialog>
+
+    <el-dialog title="选择图稿文件" v-if="openDrawingFile" v-model="openDrawingFile" width="70%">
+      <SelectPicture @selectPic="selectPic"></SelectPicture>
+      <template #footer>
+        <el-button @click="openDrawingFile = false" size="large">关 闭</el-button>
+      </template>
+    </el-dialog>
   </div>
 </template>
 
@@ -344,6 +317,7 @@ import { useRouter, useRoute } from "vue-router";
 import SelectProduct from "@/views/group/product/management/index";
 import SelectBOM from "@/views/group/BOM/management/index";
 import useTagsViewStore from "@/store/modules/tagsView";
+import SelectPicture from "@/components/select-picture/index.vue";
 
 const { proxy } = getCurrentInstance();
 const router = useRouter();
@@ -361,7 +335,6 @@ const formOption = reactive({
 const formData = reactive({
   data: {
     remark: "",
-    fileList: [],
     orderSkuList: [],
   },
 });
@@ -480,34 +453,18 @@ const getDemandData = () => {
   });
 };
 getDemandData();
-const uploadProductData = ref({});
-const uploadProductFile = async (file) => {
-  const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
-  uploadProductData.value = res.uploadBody;
-  file.id = res.id;
-  file.fileName = res.fileName;
-  file.fileUrl = res.fileUrl;
-  return true;
+const drawingFileIndex = ref(0);
+const openDrawingFile = ref(false);
+const clickDrawingFile = (index) => {
+  drawingFileIndex.value = index;
+  openDrawingFile.value = true;
 };
-const handleProductSuccess = (uploadFile, index) => {
-  formData.data.orderSkuList[index].blueprint = uploadFile.raw.fileUrl;
-};
-const uploadData = ref({});
-const fileList = ref([]);
-const beforeUpload = 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;
-  file.uploadState = true;
-  return true;
-};
-const handleSuccess = (uploadFile, index) => {
-  formData.data.orderSkuList[index].productionDocument = uploadFile.raw.fileUrl;
-};
-const onPreviewFile = (file) => {
-  window.open(file.raw.fileUrl, "_blank");
+const selectPic = (row) => {
+  console.log(row);
+  formData.data.orderSkuList[drawingFileIndex.value].blueprint = row.imgUrl;
+  formData.data.orderSkuList[drawingFileIndex.value].productionDocument = row.fileUrl;
+  ElMessage({ message: "选择完成", type: "success" });
+  openDrawingFile.value = false;
 };
 const openFile = (path) => {
   window.open(path);
@@ -525,22 +482,6 @@ const updateValue = (val) => {
 const submitForm = (status) => {
   submit.value.handleSubmit(() => {
     if (formData.data.orderSkuList && formData.data.orderSkuList.length > 0) {
-      if (fileList.value && fileList.value.length > 0) {
-        for (let i = 0; i < fileList.value.length; i++) {
-          if (fileList.value[i].raw.uploadState) {
-            return ElMessage("文件上传中,请稍后提交");
-          }
-        }
-        formData.data.fileList = fileList.value.map((item) => {
-          return {
-            id: item.raw.id,
-            fileName: item.raw.fileName,
-            fileUrl: item.raw.fileUrl,
-          };
-        });
-      } else {
-        formData.data.fileList = [];
-      }
       if (route.query.status) {
         for (let i = 0; i < formData.data.orderSkuList.length; i++) {
           if (!formData.data.orderSkuList[i].blueprint) {
@@ -670,26 +611,6 @@ const getOrderDetail = (parameter) => {
     if (res.orderSkuList && res.orderSkuList.length > 0) {
       list = list.concat(res.orderSkuList.map((item) => item.id));
     }
-    proxy.post("/fileInfo/getList", { businessIdList: list }).then((fileObj) => {
-      if (fileObj) {
-        if (fileObj[res.id] && fileObj[res.id].length > 0) {
-          fileList.value = fileObj[res.id].map((item) => {
-            return {
-              raw: item,
-              name: item.fileName,
-              url: item.fileUrl,
-            };
-          });
-        }
-        if (formData.data.orderSkuList && formData.data.orderSkuList.length > 0) {
-          for (let i = 0; i < formData.data.orderSkuList.length; i++) {
-            if (fileObj[formData.data.orderSkuList[i].id] && fileObj[formData.data.orderSkuList[i].id].length > 0) {
-              formData.data.orderSkuList[i].blueprint = fileObj[formData.data.orderSkuList[i].id][0];
-            }
-          }
-        }
-      }
-    });
   });
 };
 const getStyle = (text) => {
@@ -705,11 +626,11 @@ const clickAddProduct = () => {
 };
 const printType = ref([
   {
-    dictKey: "1",
+    dictKey: 1,
     dictValue: "单面",
   },
   {
-    dictKey: "2",
+    dictKey: 2,
     dictValue: "双面",
   },
 ]);
@@ -920,31 +841,6 @@ const calculatedAmount = () => {
 :deep(.el-collapse-item__arrow) {
   margin: 0;
 }
-.avatar-uploader .avatar {
-  width: 148px;
-  height: 148px;
-  display: block;
-  background-color: black;
-}
-.avatar-uploader .el-upload {
-  border: 1px dashed var(--el-border-color);
-  border-radius: 6px;
-  cursor: pointer;
-  position: relative;
-  overflow: hidden;
-  transition: var(--el-transition-duration-fast);
-}
-.avatar-uploader .el-upload:hover {
-  border-color: var(--el-color-primary);
-}
-.el-icon.avatar-uploader-icon {
-  font-size: 28px;
-  color: #8c939d;
-  width: 148px;
-  height: 148px;
-  text-align: center;
-  border: 1px dashed var(--el-border-color);
-}
 :deep(.el-table__cell) {
   vertical-align: top;
 }