lilei 3 лет назад
Родитель
Сommit
af97c45431

+ 4 - 4
src/views/salesManagement/pushOrderManagement/detail.vue

@@ -91,7 +91,7 @@
       </a-card>
     </a-spin>
     <!-- 发货分类打印 -->
-    <sendTypeModal ref="typePrint" :openModal="openModal" @ok="requestFun" @close="openModal=false" />
+    <sendTypeModal ref="typePrint" :openModal="openModal" @ok="handlePrintOk" @close="openModal=false" />
     <!-- 导出Excel -->
     <export-excel-modal :openModal="openExcelModal" :itemData="detailData" @ok="handleExcelOk" @close="openExcelModal=false" />
     <!-- 打印 -->
@@ -221,21 +221,21 @@ export default {
     handlePrint (type) {
       this.nowPrintType = type
       if (type == 'DISPATCH_BILL') { // 发货打印
-        this.requestFun(null, '发货')
+        this.handlePrintOk(null, '发货', 'preview')
       } else if (type == 'DISPATCH_BILL_TYPE') { // 发货分类打印
         this.openModal = true
         this.$refs.typePrint.setData(this.detailData, this.outBizSubSn || this.$route.params.sn)
       }
     },
     // 发货分类打印
-    requestFun (obj, taskName) {
+    handlePrintOk (obj, taskName, type) {
       const _this = this
       const params = {
         type: this.nowPrintType,
         dispatchBillSn: this.outBizSubSn || this.$route.params.sn
       }
       _this.spinning = true
-      printFun(dispatchDetailPrint, Object.assign(params, obj || {}), 'print', taskName, () => { _this.spinning = false })
+      printFun(dispatchDetailPrint, Object.assign(params, obj || {}), type, taskName, () => { _this.spinning = false })
     }
   },
   mounted () {

+ 6 - 4
src/views/salesManagement/pushOrderManagement/sendTypeModal.vue

@@ -24,7 +24,7 @@
           {{ detailData&&detailData.dispatchBillNo || '--' }}
         </a-form-model-item>
         <a-form-model-item label="发货编号" style="margin-bottom: 0;">
-          {{ detailData&&detailData.settleStyleSnDictValue || '--' }}
+          {{ detailData&&detailData.sendNo || '--' }}
         </a-form-model-item>
         <a-form-model-item label="客户名称" style="margin-bottom: 0;">
           {{ detailData&&detailData.buyerName || '--' }}
@@ -42,8 +42,9 @@
         </a-form-model-item>
       </a-form-model>
       <div class="btn-cont">
-        <a-button type="primary" id="pushOrderManagement-print-save" @click="handleSave">确定</a-button>
         <a-button id="pushOrderManagement-print-back" @click="handleCancel" style="margin-left: 15px;">取消</a-button>
+        <a-button id="pushOrderManagement-print-save" @click="handleSave('preview')" style="margin-left: 15px;">打印预览</a-button>
+        <a-button type="primary" id="pushOrderManagement-print-save" @click="handleSave('print')" style="margin-left: 15px;">确定</a-button>
       </div>
     </a-spin>
   </a-modal>
@@ -82,7 +83,7 @@ export default {
   },
   methods: {
     // 确认
-    handleSave () {
+    handleSave (type) {
       const _this = this
       this.$refs.ruleForm.validate(valid => {
         if (valid) {
@@ -93,7 +94,7 @@ export default {
               productTypeSn: item.productTypeSn,
               dispatchBillSn: this.detailData.dispatchBillSn
             }
-            _this.$emit('ok', obj, '发货分类')
+            _this.$emit('ok', obj, '发货分类', type)
           }
           _this.isShow = false
         } else {
@@ -106,6 +107,7 @@ export default {
     handleCancel () {
       this.isShow = false
       this.$refs.ruleForm.resetFields()
+      this.form.id = 'all'
     },
     // 获取该销售单产品二级分类
     getTypeData (dispatchBillSn) {

+ 31 - 50
src/views/salesManagement/stockPrint/list.vue

@@ -19,28 +19,28 @@
                   <rangeDate ref="rangeDate" :value="time" @change="dateChange" />
                 </a-form-item>
               </a-col>
-              <a-col :md="6" :sm="24">
+              <a-col :md="5" :sm="24">
                 <a-form-item label="客户名称" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
                   <dealerSubareaScopeList ref="dealerSubareaScopeList" id="stockPrint-buyerName" @change="custChange" />
                 </a-form-item>
               </a-col>
-              <a-col :md="6" :sm="24">
+              <a-col :md="4" :sm="24">
                 <a-form-item label="销售单号">
                   <a-input id="stockPrint-salesBillNo" v-model.trim="queryParam.salesBillNo" allowClear placeholder="请输入销售单号"/>
                 </a-form-item>
               </a-col>
+              <a-col :md="4" :sm="24">
+                <a-form-item label="备货单号">
+                  <a-input id="stockPrint-dispatchBillNo" v-model.trim="queryParam.dispatchBillNo" allowClear placeholder="请输入备货单号"/>
+                </a-form-item>
+              </a-col>
               <template v-if="advanced">
-                <a-col :md="6" :sm="24">
-                  <a-form-item label="备货单号">
-                    <a-input id="stockPrint-dispatchBillNo" v-model.trim="queryParam.dispatchBillNo" allowClear placeholder="请输入备货单号"/>
-                  </a-form-item>
-                </a-col>
-                <a-col :md="6" :sm="24">
+                <a-col :md="5" :sm="24">
                   <a-form-item label="收货客户名称" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
                     <dealerSubareaScopeList ref="shbuyerName" id="stockPrint-shbuyerName" @change="shcustChange" />
                   </a-form-item>
                 </a-col>
-                <a-col :md="6" :sm="24">
+                <a-col :md="3" :sm="24">
                   <a-form-item label="业务状态">
                     <v-select
                       v-model="queryParam.billStatus"
@@ -51,7 +51,7 @@
                       allowClear></v-select>
                   </a-form-item>
                 </a-col>
-                <a-col :md="6" :sm="24" v-if="currentTab == 1">
+                <a-col :md="3" :sm="24" v-if="currentTab == 1">
                   <a-form-item label="单据状态">
                     <v-select
                       v-model="queryParam.voidFlag"
@@ -62,7 +62,7 @@
                       allowClear></v-select>
                   </a-form-item>
                 </a-col>
-                <a-col :md="6" :sm="24" v-if="currentTab == 1">
+                <a-col :md="4" :sm="24" v-if="currentTab == 1">
                   <a-form-item label="备货打印状态">
                     <v-select
                       v-model="queryParam.printStatus"
@@ -73,12 +73,12 @@
                       allowClear></v-select>
                   </a-form-item>
                 </a-col>
-                <a-col :md="6" :sm="24">
+                <a-col :md="3" :sm="24">
                   <a-form-model-item label="所在区域">
                     <subarea id="stockPrint-subarea" v-model="queryParam.subareaSn"></subarea>
                   </a-form-model-item>
                 </a-col>
-                <a-col :md="6" :sm="24">
+                <a-col :md="3" :sm="24">
                   <a-form-model-item label="地区">
                     <a-form-model-item prop="shippingAddrProvinceSn">
                       <Area id="stockPrint-shippingAddrProvinceSn" v-model="queryParam.shippingAddrProvinceSn" placeholder="请选择省"></Area>
@@ -134,21 +134,24 @@
             <a-button
               size="small"
               type="link"
+              v-if="record.printStatus == 'NO_PRINT'&&record.voidFlag==0"
               class="button-warning"
-              @click="viewPrint(record)"
-            >打印记录</a-button>
+              @click="handlePrint(record)"
+            >发货分类打印</a-button>
             <a-button
               size="small"
               type="link"
               class="button-warning"
-              @click="handlePrint(record)"
-            >发货分类打印</a-button>
+              v-else-if="record.printStatus == 'PRINT'"
+              @click="viewPrint(record)"
+            >打印记录</a-button>
+            <span v-else>--</span>
           </template>
         </s-table>
         <!-- 分类打印 -->
         <sendTypeModal ref="typePrint" :openModal="showTipModal" @ok="handlePrintOk" @close="showTipModal=false" />
         <!-- 打印记录 -->
-        <recordModal modalTit="打印记录" :openModal="showRecordModal" @cancel="showRecordModal=false"></recordModal>
+        <recordModal ref="recordModal" modalTit="打印记录" :openModal="showRecordModal" @cancel="showRecordModal=false"></recordModal>
       </a-spin>
     </a-card>
   </div>
@@ -164,6 +167,7 @@ import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
 import sendTypeModal from '@/views/salesManagement/pushOrderManagement/sendTypeModal.vue'
 import recordModal from './recordModal.vue'
 import { dispatchlList, dispatchDetailPrint } from '@/api/dispatch'
+import { printFun } from '@/libs/JGPrint.js'
 export default {
   name: 'PushOrderManagementList',
   mixins: [commonMixin],
@@ -188,11 +192,10 @@ export default {
         subareaSn: undefined,
         shippingAddrProvinceSn: undefined,
         voidFlag: undefined,
-        printStatus: undefined
+        printStatus: 'NO_PRINT'
       },
       showTipModal: false,
       showRecordModal: false,
-      recordData: null,
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
@@ -270,45 +273,23 @@ export default {
       this.$refs.typePrint.setData(row, row.dispatchBillSn)
       this.showTipModal = true
     },
-    // 打印
-    handlePrintOk (obj) {
+    // 发货分类打印
+    handlePrintOk (obj, taskName, type) {
       const _this = this
       const params = {
         type: 'DISPATCH_BILL_TYPE',
         dispatchBillSn: obj.dispatchBillSn
       }
       _this.spinning = true
-      dispatchDetailPrint(Object.assign(params, obj || {})).then(res => {
-        _this.spinning = false
-        if (res.type == 'application/json') {
-          var reader = new FileReader()
-          reader.addEventListener('loadend', function () {
-            const obj = JSON.parse(reader.result)
-            _this.$notification.error({
-              message: '提示',
-              description: obj.message
-            })
-          })
-          reader.readAsText(res)
-        } else {
-          this.print(res)
-        }
-      })
-    },
-    print (data) {
-      this.spinLoading = false
-      if (!data) {
-        return
-      }
-      const url = window.URL.createObjectURL(new Blob([data], { type: 'application/pdf' }))
-      document.getElementById('print').innerHTML = '<iframe id="printfpmd" name="printfpmd" src="' + url + '" hidden></iframe>'
-      window.frames['printfpmd'].focus()
-      window.frames['printfpmd'].print()
+      printFun(dispatchDetailPrint, Object.assign(params, obj || {}), type, taskName, () => { _this.spinning = false })
     },
     // 打印记录
     viewPrint (row) {
-      this.recordData = row
       this.showRecordModal = true
+      this.$refs.recordModal.setData(row, {
+        billType: 'SETTLE_RECEIPT',
+        billSn: row.accountReceiptSn
+      })
     },
     // 重置
     resetSearchForm () {
@@ -325,7 +306,7 @@ export default {
       this.queryParam.subareaSn = undefined
       this.queryParam.shippingAddrProvinceSn = undefined
       this.queryParam.voidFlag = undefined
-      this.queryParam.printStatus = undefined
+      this.queryParam.printStatus = this.currentTab == 1 ? '' : 'NO_PRINT'
       this.$refs.table.refresh(true)
     },
     pageInit () {

+ 48 - 19
src/views/salesManagement/stockPrint/recordModal.vue

@@ -12,21 +12,30 @@
       <div class="common-main">
         <a-descriptions :column="2">
           <a-descriptions-item label="销售单号">
-            {{ tipData&&tipData.buyerName }}
+            {{ tipData&&tipData.bizNo }}
           </a-descriptions-item>
           <a-descriptions-item label="备货单号">
-            {{ tipData&&tipData.buyerName }}
+            {{ tipData&&tipData.dispatchBillNo }}
           </a-descriptions-item>
           <a-descriptions-item label="客户名称">
-            {{ tipData&&tipData.buyerName }}
+            {{ tipData&&tipData.settleClientName }}
           </a-descriptions-item>
           <a-descriptions-item label="收货客户名称">
-            {{ tipData&&tipData.buyerName }}
+            {{ tipData&&tipData.receiverName||'--' }}
           </a-descriptions-item>
         </a-descriptions>
         <div>
-          <a-table :columns="columns" :data-source="tableData" bordered>
-          </a-table>
+          <s-table
+            class="sTable"
+            ref="table"
+            size="small"
+            :rowKey="(record) => record.id"
+            :columns="columns"
+            :data="loadData"
+            :defaultLoadData="false"
+            :scroll="{ y: 240 }"
+            bordered>
+          </s-table>
         </div>
         <div class="btn-box">
           <a-button @click="handleCommonCancel" v-if="isCancel">{{ cancelText }}</a-button>
@@ -38,8 +47,9 @@
 
 <script>
 import { STable, VSelect } from '@/components'
+import { printLogQueryPage } from '@/api/data'
 export default {
-  name: 'CommonModal',
+  name: 'RecordModal',
   components: { STable, VSelect },
   props: {
     openModal: { //  弹框显示状态
@@ -64,23 +74,42 @@ export default {
       isShow: this.openModal, //  是否打开弹框
       disabled: false,
       spinning: false,
-      detail: [],
-      queryParam: {
-
-      },
-      tableData: [],
+      tipData: null,
+      params: null,
       columns: [
         { title: '序号', dataIndex: 'no', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '打印时间', dataIndex: 'buyerName', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '打印人', dataIndex: 'buyerName', width: '25%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: 'IP', dataIndex: 'buyerName1', width: '25%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '打印方式', dataIndex: 'buyerName', width: '20%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true }
-      ]
+        { title: '打印时间', dataIndex: 'printDate', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '打印人', dataIndex: 'printPersonName', width: '25%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: 'IP', dataIndex: 'printIp', width: '25%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '打印方式', dataIndex: 'printType', width: '20%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true }
+      ],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        this.spinning = true
+        return printLogQueryPage(Object.assign(parameter, this.params || {})).then(res => {
+          let data
+          if (res.status == 200) {
+            data = res.data
+            const no = (data.pageNo - 1) * data.pageSize
+            for (var i = 0; i < data.list.length; i++) {
+              data.list[i].no = no + i + 1
+            }
+            this.disabled = false
+          }
+          this.spinning = false
+          return data
+        })
+      }
     }
   },
   methods: {
-    setData (data) {
-      this.detail = data
+    setData (data, params) {
+      this.tipData = data
+      this.params = params
+      this.$nextTick(() => {
+        this.$refs.table.refresh(true)
+      })
     },
     // 取消
     handleCommonCancel () {