Prechádzať zdrojové kódy

JLHWEB: 1、床垫报价列表页报价清单能导出Excel

JohnnyChan 2 dní pred
rodič
commit
b84b8d221d
1 zmenil súbory, kde vykonal 40 pridanie a 16 odobranie
  1. 40 16
      JLHWEB/src/views/quote/mattressQuote/index.vue

+ 40 - 16
JLHWEB/src/views/quote/mattressQuote/index.vue

@@ -59,7 +59,12 @@
     </template>
   </el-dialog>
 
-  <LjDrawerQuoteList ref="QuoteListDrawerRef" :iforigin="isShowOriginFormulaMattress" @closed="ifShowDrawer = false" />
+  <LjDrawerQuoteList
+    ref="QuoteListDrawerRef"
+    :iforigin="isShowOriginFormulaMattress"
+    @closed="ifShowDrawer = false"
+    @export="handleExportQuote"
+  />
 </template>
 
 <script setup lang="ts" name="mattressQuote">
@@ -114,7 +119,7 @@ const {
   getQuoteListMxData,
   gotoHisprice
 } = useHooks();
-const { toExcelQuote } = useHooksCpQuote();
+const { toExcelQuote, toExcelQuoteNew } = useHooksCpQuote();
 const { CheckPower, CheckOption, buttonNew, buttonDefault } = useAuthButtons(t);
 const { userInfo } = useUserStore();
 
@@ -213,6 +218,11 @@ const handleClickTable = ({ row, rowIndex, $rowIndex, column, columnIndex, $colu
   }
 };
 
+/**
+ * @description 记录当前行数据
+ */
+const currentRecord = reactive<any>({});
+
 const funcShowQuoteList = (curRecord: any) => {
   loadingStatus.showQd = !loadingStatus.showQd;
   GetComputeMattressById({
@@ -221,20 +231,19 @@ const funcShowQuoteList = (curRecord: any) => {
   })
     .then(res => {
       const isQuoteListMxData = getQuoteListMxData(funcChaifenTabPro(res.mattress, res.mattressMx));
-      let _data = {
-        data: res.mattress,
-        mxdata: isQuoteListMxData,
-        enumMap: vxeTableRef.value.enumMap,
-        fabricMx: fabricMxTabList.value,
-        formulakindenum: formulaKindEnum.value,
-        dannum_type: res.mattress.dannum_type,
-        formula: res.formulas, //
-        replace: res.replace, //
-        formula_ori: res.formulas_origin, //
-        formula_bednet: res.formulas_bednet, //
-        differ: res.differ //
-      };
-      QuoteListDrawerRef.value.show(_data);
+      currentRecord.data = res.mattress;
+      currentRecord.mxdata = isQuoteListMxData;
+      currentRecord.enumMap = vxeTableRef.value.enumMap;
+      currentRecord.fabricMx = fabricMxTabList.value;
+      currentRecord.formulakindenum = formulaKindEnum.value;
+      currentRecord.dannum_type = res.mattress.dannum_type;
+      currentRecord.formula = res.formulas;
+      currentRecord.replace = res.replace;
+      currentRecord.formula_ori = res.formulas_origin;
+      currentRecord.formula_bednet = res.formulas_bednet;
+      currentRecord.differ = res.differ;
+
+      QuoteListDrawerRef.value.show(currentRecord);
       ifShowDrawer.value = true;
 
       loadingStatus.showQd = !loadingStatus.showQd;
@@ -244,6 +253,21 @@ const funcShowQuoteList = (curRecord: any) => {
     });
 };
 
+const handleExportQuote = async (ifExpandAll: any, ifShowOrigin: any, fields: any) => {
+  console.log("handleExportQuote ifExpandAll :>> ", ifExpandAll, ifShowOrigin);
+  if (ifShowOrigin) {
+    loadingStatus.download = true;
+    await toExcelQuote(currentRecord, "床垫报价单_" + currentRecord.data.mattresscode);
+    loadingStatus.download = false;
+  } else {
+    loadingStatus.download = true;
+
+    currentRecord.fields = fields;
+    await toExcelQuoteNew(currentRecord, "床垫报价单_" + currentRecord.data.mattresscode, ifExpandAll);
+    loadingStatus.download = false;
+  }
+};
+
 const rowClsNameFunc = (data: any) => {
   const { row, rowIndex, $rowIndex } = data;
   if (Number(row.flag) == 0) {