Ver Fonte

Merge branch 'master' into 测试

lxf há 1 ano atrás
pai
commit
c63dcc2ff9

+ 77 - 61
src/views/production/warehouse/finished-parts-storage/index.vue

@@ -1,51 +1,54 @@
 <template>
-  <div>
-    <el-card class="box-card">
-      <el-tabs v-model="activeName" type="card" @tab-change="changeActiveName">
-        <el-tab-pane label="成品库" name="first">
-          <byTable
-            :source="sourceList.data"
-            :pagination="sourceList.pagination"
-            :config="config"
-            :loading="loading"
-            :searchConfig="searchConfig"
-            highlight-current-row
-            :action-list="[
-              {
-                text: '导出Excel',
-                action: () => deriveExcel(),
-              },
-            ]"
-            @get-list="getList"
-            @clickReset="clickReset">
-          </byTable>
-        </el-tab-pane>
-        <el-tab-pane label="成品库明细" name="second">
-          <byTable
-            :source="sourceListTwo.data"
-            :pagination="sourceListTwo.pagination"
-            :config="configTwo"
-            :loading="loading"
-            :searchConfig="searchConfigTwo"
-            highlight-current-row
-            :action-list="[
-              {
-                text: '导出Excel',
-                action: () => deriveExcelTwo(),
-              },
-            ]"
-            @get-list="getListTwo"
-            @clickReset="clickResetTwo">
-          </byTable>
-        </el-tab-pane>
-      </el-tabs>
-    </el-card>
-  </div>
+  <el-card class="box-card">
+    <el-tabs v-model="activeName" type="card" @tab-change="changeActiveName">
+      <el-tab-pane label="成品库" name="first">
+        <byTable
+          :source="sourceList.data"
+          :pagination="sourceList.pagination"
+          :config="config"
+          :loading="loading"
+          :searchConfig="searchConfig"
+          highlight-current-row
+          @get-list="getList"
+          @clickReset="clickReset">
+        </byTable>
+      </el-tab-pane>
+      <el-tab-pane label="成品库明细" name="second">
+        <byTable
+          :source="sourceListTwo.data"
+          :pagination="sourceListTwo.pagination"
+          :config="configTwo"
+          :loading="loading"
+          :searchConfig="searchConfigTwo"
+          highlight-current-row
+          :action-list="[
+            {
+              text: '导出Excel',
+              action: () => clickGiveaway(),
+            },
+          ]"
+          @get-list="getListTwo"
+          @clickReset="clickResetTwo">
+        </byTable>
+      </el-tab-pane>
+    </el-tabs>
+
+    <el-dialog title="上传" v-if="openGiveaway" v-model="openGiveaway" width="600">
+      <div v-loading="loadingGiveaway">
+        <el-upload :show-file-list="false" action="##" :http-request="giveawayServerLog" :before-upload="handleBeforeGiveaway">
+          <el-button style="background: #20b2aa; color: #fff; border: 1px solid #20b2aa">上传</el-button>
+        </el-upload>
+        <div style="text-align: center; margin: 10px">
+          <el-button @click="openGiveaway = false" size="large">关 闭</el-button>
+        </div>
+      </div>
+    </el-dialog>
+  </el-card>
 </template>
 
 <script setup>
 import byTable from "/src/components/byTable/index";
-import { ElMessageBox } from "element-plus";
+import { ElMessage, ElMessageBox } from "element-plus";
 import moment from "moment";
 
 const { proxy } = getCurrentInstance();
@@ -150,7 +153,7 @@ const configTwo = computed(() => {
       attrs: {
         label: "订单号",
         prop: "orderCode",
-        width: 160,
+        width: 200,
       },
     },
     {
@@ -164,14 +167,14 @@ const configTwo = computed(() => {
       attrs: {
         label: "事业部",
         prop: "departmentName",
-        width: 140,
+        width: 120,
       },
     },
     {
       attrs: {
         label: "SKU品号",
         prop: "skuSpecCode",
-        width: 140,
+        width: 160,
       },
     },
     {
@@ -184,14 +187,14 @@ const configTwo = computed(() => {
       attrs: {
         label: "数量",
         prop: "quantity",
-        width: 120,
+        width: 100,
       },
     },
     {
       attrs: {
         label: "操作类型",
         prop: "operationType",
-        width: 120,
+        width: 100,
       },
       render(val) {
         if (val == "1") {
@@ -276,20 +279,33 @@ const changeActiveName = (val) => {
     getListTwo();
   }
 };
-const deriveExcel = () => {
-  ElMessageBox.confirm("你是否确认此操作", "提示", {
-    confirmButtonText: "确定",
-    cancelButtonText: "取消",
-    type: "warning",
-  })
-    .then(() => {
-      proxy.getFile("/inventoryFinished/excelExport", sourceList.value.pagination).then((res) => {
-        proxy.downloadFile(res, "成品库-" + moment().format("yyyy-MM-DD") + ".xlsx");
-      });
-    })
-    .catch(() => {});
+const openGiveaway = ref(false);
+const loadingGiveaway = ref(false);
+const clickGiveaway = () => {
+  loadingGiveaway.value = false;
+  openGiveaway.value = true;
 };
-const deriveExcelTwo = () => {
+const handleBeforeGiveaway = () => {
+  loadingGiveaway.value = true;
+};
+const giveawayServerLog = (params) => {
+  let file = params.file;
+  let formFile = new FormData();
+  formFile.append("file", file);
+  proxy.postUploadFile("/inventoryFinishedOrder/erpExcelExport", formFile).then(
+    (res) => {
+      ElMessage({ message: "操作成功", type: "success" });
+      proxy.downloadFile(res, "成品库明细-" + moment().format("yyyy-MM-DD") + ".xlsx");
+      loadingGiveaway.value = false;
+      openGiveaway.value = false;
+    },
+    (err) => {
+      console.log(err);
+      loadingGiveaway.value = false;
+    }
+  );
+};
+const deriveExcel = () => {
   ElMessageBox.confirm("你是否确认此操作", "提示", {
     confirmButtonText: "确定",
     cancelButtonText: "取消",