소스 검색

调拨导出打印

lilei 2 년 전
부모
커밋
11c8c3b71a
2개의 변경된 파일35개의 추가작업 그리고 45개의 파일을 삭제
  1. 12 13
      src/views/allocationManagement/transferOut/detail.vue
  2. 23 32
      src/views/allocationManagement/transferOut/printModal.vue

+ 12 - 13
src/views/allocationManagement/transferOut/detail.vue

@@ -39,7 +39,7 @@
             v-if="$hasPermissions('B_transferOut_detail_export')"
             id="allocateBillDetail-export-btn"
             :disabled="localDataSource.length==0"
-            @click="handleExcel('ALLOCATE_BILL','调拨明细')">导出Excel</a-button>
+            @click="handlePrint('dbExport')">导出Excel</a-button>
           <a-button
             key="1"
             type="default"
@@ -97,7 +97,7 @@
       :openModal="openModal"
       :itemData="basicInfoData"
       :nowType="nowType"
-      @export="exportFl"
+      @export="exportOk"
       @ok="handleOk"
       @close="openModal=false" />
   </div>
@@ -204,25 +204,24 @@ export default {
     handleEdit () {
       this.$router.push({ path: `/allocationManagement/transferOut/edit/${this.basicInfoData.allocateSn}/${this.basicInfoData.dealerLevel}` })
     },
-    // 导出
-    handleExcel (printType, filename, data) {
+    // 打印/导出
+    handlePrint (type) {
+      this.nowType = type
+      this.openModal = true
+    },
+    // 导出成功
+    exportOk (data) {
       const _this = this
+      const filename = this.nowType == 'dbflExport' ? '调拨分类' : '调拨'
       this.spinning = true
-      const params = { allocateSn: this.outBizSn || this.$route.params.sn, printType: printType, ...data }
+      const params = { allocateSn: this.outBizSn || this.$route.params.sn, ...data }
       params.showCostFlag = this.$hasPermissions('B_isShowCost')
       params.showAmountFlag = this.$hasPermissions('B_isShowPrice')
       exportExcel(allocateBillDetailExcel, params, filename, function () {
         _this.spinning = false
       })
     },
-    exportFl (data) {
-      this.handleExcel(data.printType, '调拨分类', data)
-    },
-    // 打印预览/快捷打印
-    handlePrint (type) {
-      this.nowType = type
-      this.openModal = true
-    },
+    // 打印成功
     handleOk (objs) {
       const _this = this
       const params = JSON.parse(JSON.stringify(objs))

+ 23 - 32
src/views/allocationManagement/transferOut/printModal.vue

@@ -29,7 +29,7 @@
             </a-select-option>
           </a-select>
         </a-form-model-item>
-        <a-form-model-item label="产品价格" prop="priceType" v-if="nowType=='dbPrint'">
+        <a-form-model-item label="产品价格" prop="priceType" v-if="nowType=='dbPrint'||nowType=='dbExport'">
           <a-radio-group v-model="form.priceType">
             <a-radio value="ALLOCATE_BILL_PRICE">销售价</a-radio>
             <a-radio value="ALLOCATE_BILL_COST">成本价</a-radio>
@@ -40,20 +40,20 @@
       <div class="btn-cont">
         <a-button id="allocateBill-print-close" @click="handleClose('preview')">取消</a-button>
         <a-button
-          v-if="nowType!='dbflExport'"
+          v-if="nowType=='dbflPrint'||nowType=='dbPrint'"
           id="allocateBill-print-save"
           type="primary"
           class="button-info"
           @click="handleSave('preview')"
           style="margin-left: 15px;">打印预览</a-button>
         <a-button
-          v-if="hidePrint&&nowType!='dbflExport'"
+          v-if="hidePrint&&(nowType=='dbflPrint'||nowType=='dbPrint')"
           type="primary"
           id="allocateBill-print-back"
           @click="handleSave('print')"
           style="margin-left: 15px;">确定打印</a-button>
         <a-button
-          v-if="nowType=='dbflExport'"
+          v-if="nowType=='dbflExport'||nowType=='dbExport'"
           type="primary"
           id="allocateBill-print-back"
           @click="handleSave('export')"
@@ -110,6 +110,8 @@ export default {
         title = '调拨分类打印'
       } else if (this.nowType == 'dbflExport') {
         title = '调拨分类导出'
+      } else if (this.nowType == 'dbExport') {
+        title = '导出Excel'
       }
       return title
     },
@@ -123,39 +125,28 @@ export default {
       const _this = this
       this.$refs.ruleForm.validate(valid => {
         if (valid) {
-          if (_this.nowType == 'dbflPrint') {
+          // 普通打印/导出
+          const obj = {
+            allocateSn: _this.itemData.allocateSn,
+            allocateNo: _this.itemData.allocateNo,
+            printType: _this.form.priceType,
+            isPreview: type == 'preview' ? 1 : 0
+          }
+          // 分类打印/导出
+          if (_this.nowType == 'dbflPrint' || _this.nowType == 'dbflExport') {
             const item = _this.typeList.find(item => item.id == _this.form.id)
             if (item) {
-              const obj = {
-                allocateSn: _this.itemData.allocateSn,
-                allocateNo: _this.itemData.allocateNo,
-                productBrandSn: item.productBrandSn,
-                productTypeSn3: item.productTypeSn3,
-                printType: 'ALLOCATE_BILL_TYPE',
-                isPreview: type == 'preview' ? 1 : 0
-              }
-              _this.$emit('ok', obj)
-            }
-          } else if (_this.nowType == 'dbPrint') {
-            const obj = {
-              allocateSn: _this.itemData.allocateSn,
-              allocateNo: _this.itemData.allocateNo,
-              printType: _this.form.priceType,
-              isPreview: type == 'preview' ? 1 : 0
+              obj.productBrandSn = item.productBrandSn
+              obj.productTypeSn3 = item.productTypeSn3
+              obj.printType = 'ALLOCATE_BILL_TYPE'
             }
+          }
+          // 打印
+          if (_this.nowType == 'dbPrint' || _this.nowType == 'dbflPrint') {
             _this.$emit('ok', obj)
           } else {
-            const item = _this.typeList.find(item => item.id == _this.form.id)
-            if (item) {
-              const obj = {
-                allocateSn: _this.itemData.allocateSn,
-                allocateNo: _this.itemData.allocateNo,
-                productBrandSn: item.productBrandSn,
-                productTypeSn3: item.productTypeSn3,
-                printType: 'ALLOCATE_BILL_TYPE'
-              }
-              _this.$emit('export', obj)
-            }
+            // 导出
+            _this.$emit('export', obj)
           }
           _this.isShow = false
         } else {