123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487 |
- <template>
- <div class="stockPrint-wrap">
- <div style="background-color: #fff;">
- <a-tabs v-model="currentTab" @change="changeTab">
- <a-tab-pane :key="1" tab="全部">
- </a-tab-pane>
- <a-tab-pane :key="2" tab="待打印">
- </a-tab-pane>
- </a-tabs>
- </div>
- <a-card style="margin-top: 5px;" size="small" :bordered="false">
- <a-spin :spinning="spinning" tip="Loading...">
- <!-- 搜索条件 -->
- <div ref="tableSearch" class="table-page-search-wrapper">
- <a-form layout="inline">
- <a-row :gutter="15">
- <a-col :md="6" :sm="24">
- <a-form-item label="创建时间">
- <rangeDate ref="rangeDate" :value="time" @change="dateChange" />
- </a-form-item>
- </a-col>
- <a-col :md="6" :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-form-item label="销售单号">
- <a-input id="stockPrint-salesBillNo" v-model.trim="queryParam.salesBillNo" allowClear placeholder="请输入销售单号"/>
- </a-form-item>
- </a-col>
- <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>
- <template v-if="advanced">
- <a-col :md="6" :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-form-item label="业务状态">
- <v-select
- v-model="queryParam.billStatus"
- ref="billStatus"
- id="stockPrint-billStatus"
- code="DISPATCH_BILL_STATUS"
- placeholder="请选择业务状态"
- allowClear></v-select>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24" v-if="currentTab == 1">
- <a-form-item label="单据状态">
- <v-select
- v-model="queryParam.voidFlag"
- ref="voidFlag"
- id="pushOrder-voidFlag"
- code="VOID_FLAG"
- placeholder="请选择单据状态"
- allowClear></v-select>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24" v-if="currentTab == 1">
- <a-form-item label="备货打印状态">
- <v-select
- v-model="queryParam.printStatus"
- ref="printStatus"
- id="pushOrder-printStatus"
- code="PRINT_STATUS"
- placeholder="请选择备货打印状态"
- allowClear></v-select>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-model-item label="所在区域">
- <subarea id="stockPrint-subarea" ref="subarea" @change="subareaChange"></subarea>
- </a-form-model-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-model-item label="地区" prop="shippingAddrProvinceSn">
- <Area id="stockPrint-shippingAddrProvinceSn" v-model="queryParam.shippingAddrProvinceSn" placeholder="请选择省"></Area>
- </a-form-model-item>
- </a-col>
- <a-col :md="6" :sm="24" v-show="isShowWarehouse">
- <a-form-model-item label="仓库">
- <chooseWarehouse ref="warehouse" v-model="queryParam.warehouseSn" :isPermission="true"></chooseWarehouse>
- </a-form-model-item>
- </a-col>
- </template>
- <a-col :md="5" :sm="24">
- <span class="table-page-search-submitButtons">
- <a-button type="primary" :disabled="disabled" @click="$refs.table.refresh(true)">查询</a-button>
- <a-button style="margin-left: 8px" :disabled="disabled" @click="resetSearchForm()">重置</a-button>
- <a @click="advanced=!advanced" style="margin-left: 8px">
- {{ advanced ? '收起' : '展开' }}
- <a-icon :type="advanced ? 'up' : 'down'"/>
- </a>
- </span>
- </a-col>
- </a-row>
- </a-form>
- </div>
- <!-- 列表 -->
- <s-table
- class="sTable fixPagination"
- ref="table"
- :style="{ height: tableHeight+84.5+'px' }"
- size="small"
- :rowKey="(record) => record.id"
- :columns="columns"
- :data="loadData"
- :scroll="{ y:tableHeight, x: 1600 }"
- :defaultLoadData="false"
- bordered>
- <!-- 销售单号 -->
- <template slot="salesBillNo" slot-scope="text, record">
- <span class="link-bule" v-if="$hasPermissions('B_salesDetail')" @click="handleDetail(record,0)">{{ record.salesBillNo }}</span>
- <span v-else>{{ record.salesBillNo }}</span>
- </template>
- <!-- 备货单号 -->
- <template slot="dispatchBillNo" slot-scope="text, record">
- <span class="link-bule" v-if="$hasPermissions('B_dispatchDetail')" @click="handleDetail(record,1)">{{ record.dispatchBillNo }}</span>
- <span v-else>{{ record.dispatchBillNo }}</span>
- </template>
- <!-- 发货说明 -->
- <template slot="explainInfo" slot-scope="text, record">
- <span v-if="record.explainInfo" class="link-bule" @click="handleExplainInfo(record)" :title="record.explainInfo">{{ record.explainInfo||'--' }}</span>
- <span v-else>--</span>
- </template>
- <!-- 备货打印状态 -->
- <template slot="printStatus" slot-scope="text, record">
- <span v-if="record.printStatus=='NO_PRINT'&&$hasPermissions('B_noPrintStatus')" class="link-bule" @click="handlePrintStatus(record)">{{ record.printStatusDictValue }}</span>
- <span v-else>{{ record.printStatusDictValue }}</span>
- </template>
- <div slot="costTitle">
- <a-tooltip placement="top">
- <template slot="title">
- 如果收货客户名称不为空,则按照收货客户级别的价格计算得到(总售价内容包括促销产品)。
- </template>
- <span style="margin-right: 5px;">实际总售价</span> <a-icon type="question-circle" />
- </a-tooltip>
- </div>
- <!-- 操作 -->
- <template slot="action" slot-scope="text, record">
- <a-button
- size="small"
- type="link"
- v-if="record.printStatus == 'NO_PRINT'&&record.voidFlag==0&&$hasPermissions('B_sendTypePrint')"
- class="button-warning"
- @click="handlePrint(record)"
- >发货分类打印</a-button>
- <a-button
- size="small"
- type="link"
- class="button-warning"
- v-else-if="record.printStatus == 'PRINT'&&$hasPermissions('B_stockPrintRecord')"
- @click="viewPrint(record)"
- >打印记录</a-button>
- <span v-else>--</span>
- </template>
- </s-table>
- <!-- 分类打印 -->
- <sendTypeModal v-drag ref="typePrint" :openModal="showTipModal" @ok="handlePrintOk" @close="showTipModal=false" />
- <!-- 打印记录 -->
- <recordModal v-drag ref="recordModal" modalTit="打印记录" :openModal="showRecordModal" @cancel="showRecordModal=false"></recordModal>
- <!-- 查看销售单或备货单详情 -->
- <commonModal
- :modalTit="detailType?'备货单详情':'销售单详情'"
- bodyPadding="10px"
- width="70%"
- :showFooter="false"
- :openModal="showDetailModal"
- @cancel="cancelDetail">
- <salesDetail v-if="detailType==0" ref="salesDetail" :bizSn="bizSn"></salesDetail>
- <dispatchDetail v-if="detailType==1" ref="dispatchDetail" :bizSn="bizSn"></dispatchDetail>
- </commonModal>
- <!-- 操作提示 -->
- <commonModal modalTit="操作提示" okText="暂不打印" :openModal="showPrintModal" @cancel="canselModal" @ok="updatePrintStatus">
- <div style="display:flex;flex-direction: column;align-items: center;">
- <div style="margin-bottom: 15px;font-size: 14px;">如需将打印状态回退至<strong>【暂不打印】</strong>,请点击下方按钮</div>
- <div style="line-height: 24px;">
- <div>备货单号:{{ tipData&&tipData.dispatchBillNo }}</div>
- <div>客户名称:{{ tipData&&tipData.buyerName }}</div>
- </div>
- </div>
- </commonModal>
- <!-- 发货说明 -->
- <explainInfoModal v-drag mode="view" :rowData="tipData" :openModal="showInfoModal" @close="canselModal"></explainInfoModal>
- </a-spin>
- </a-card>
- </div>
- </template>
- <script>
- import { commonMixin } from '@/utils/mixin'
- import rangeDate from '@/views/common/rangeDate.vue'
- import { STable, VSelect } from '@/components'
- import subarea from '@/views/common/subarea.js'
- import Area from '@/views/common/area.js'
- import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
- import sendTypeModal from './sendTypeModal.vue'
- import recordModal from './recordModal.vue'
- import commonModal from '@/views/common/commonModal.vue'
- import chooseWarehouse from '@/views/common/chooseWarehouse'
- import salesDetail from '@/views/salesManagement/salesQueryNew/detailAll.vue'
- import dispatchDetail from '@/views/salesManagement/pushOrderManagement/detail.vue'
- import explainInfoModal from '@/views/salesManagement/pushOrderManagement/explainInfoModal.vue'
- import { dispatchlList, dispatchDetailPrint, dispatchPrintStatus } from '@/api/dispatch'
- import { printBase64Fun } from '@/libs/JGPrint.js'
- export default {
- name: 'StockPrintList',
- mixins: [commonMixin],
- components: { STable, VSelect, dealerSubareaScopeList, rangeDate, subarea, sendTypeModal, recordModal, Area, commonModal, salesDetail, dispatchDetail, explainInfoModal, chooseWarehouse },
- data () {
- return {
- spinning: false,
- advanced: true, // 高级搜索 展开/关闭
- disabled: false, // 查询、重置按钮是否可操作
- showDetailModal: false,
- detailType: 2,
- bizSn: null,
- tableHeight: 0,
- time: [],
- currentTab: 2,
- // 查询参数
- queryParam: {
- beginDate: '',
- endDate: '',
- buyerSn: undefined, // 客户名称
- receiverSn: undefined, // 收货客户名称
- salesBillNo: '', // 销售单号
- dispatchBillNo: '', // 备货单号
- billStatus: undefined, // 业务状态
- warehouseSn: undefined,
- subareaArea: {
- subareaSn: undefined,
- subareaAreaSn: undefined
- },
- shippingAddrProvinceSn: undefined,
- voidFlag: 0,
- printStatus: 'NO_PRINT'
- },
- showTipModal: false,
- showRecordModal: false,
- // 加载数据方法 必须为 Promise 对象
- loadData: parameter => {
- this.disabled = true
- this.spinning = true
- return dispatchlList(Object.assign(parameter, this.queryParam)).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
- })
- },
- tipData: null,
- showPrintModal: false,
- showInfoModal: false
- }
- },
- computed: {
- columns () {
- const arr = [
- { title: '序号', dataIndex: 'no', width: '40px', align: 'center' },
- { title: '创建时间', dataIndex: 'createDate', width: '80px', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '销售单号', scopedSlots: { customRender: 'salesBillNo' }, width: '110px', align: 'center' },
- { title: '备货单号', scopedSlots: { customRender: 'dispatchBillNo' }, width: '120px', align: 'center' },
- { title: '发货编号', dataIndex: 'sendNo', width: '40px', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '发货说明', scopedSlots: { customRender: 'explainInfo' }, width: '80px', align: 'center', ellipsis: true },
- { title: '客户名称', dataIndex: 'buyerName', width: '130px', align: 'left', customRender: function (text) { return text || '--' } },
- { title: '收货客户名称', dataIndex: 'receiverName', width: '130px', align: 'left', customRender: function (text) { return text || '--' } },
- { title: '产品款数', dataIndex: 'totalCategory', width: '60px', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '产品数量', dataIndex: 'totalQty', width: '60px', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '仓库', dataIndex: 'warehouseName', width: '80px', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
- { title: '业务状态', dataIndex: 'billStatusDictValue', width: '60px', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '单据状态', dataIndex: 'voidFlagDictValue', width: '60px', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '备货打印状态', width: '60px', align: 'center', scopedSlots: { customRender: 'printStatus' } },
- { title: '允许打印时间', dataIndex: 'allowPrintTime', width: '80px', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '打印次数', dataIndex: 'stockUpPrintTimes', width: '40px', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '操作', scopedSlots: { customRender: 'action' }, width: '80px', align: 'center', fixed: 'right' }
- ]
- if (this.$hasPermissions('M_stockPrintList_salesPrice')) { // 售价权限
- const ind = this.isShowWarehouse ? 10 : 9
- arr.splice(ind, 0, { slots: { title: 'costTitle' }, dataIndex: 'receiveTotalAmount', width: '60px', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
- arr.splice(ind + 1, 0, { title: '易损件售价', dataIndex: 'receiveYsjTotalAmount', width: '60px', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
- arr.splice(ind + 2, 0, { title: '电池售价', dataIndex: 'receiveDcTotalAmount', width: '60px', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
- arr.splice(ind + 3, 0, { title: '机油售价', dataIndex: 'receiveJyTotalAmount', width: '60px', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
- arr.splice(ind + 4, 0, { title: '轮胎售价', dataIndex: 'receiveLtTotalAmount', width: '60px', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
- }
- return arr
- }
- },
- methods: {
- changeTab (v) {
- this.currentTab = v
- this.resetSearchForm()
- },
- // 时间 change
- dateChange (date) {
- this.queryParam.beginDate = date[0]
- this.queryParam.endDate = date[1]
- },
- custChange (val) {
- this.queryParam.buyerSn = val.key
- },
- shcustChange (val) {
- this.queryParam.receiverSn = val.key
- },
- handleDetail (row, type) {
- this.detailType = type
- this.bizSn = type == 0 ? row.salesBillSn : row.dispatchBillSn
- this.$store.state.app.curActionPermission = type == 0 ? 'B_salesDetail' : 'B_dispatchDetail'
- this.showDetailModal = true
- },
- cancelDetail () {
- this.showDetailModal = false
- this.detailType = 2
- this.bizSn = null
- this.$store.state.app.curActionPermission = ''
- },
- // 发货分类打印
- handlePrint (row) {
- this.$refs.typePrint.setData(row, row.dispatchBillSn)
- this.showTipModal = true
- },
- // 发货分类打印
- handlePrintOk (obj, taskName, type) {
- const _this = this
- const params = {
- type: 'DISPATCH_BILL_TYPE',
- dispatchBillSn: obj.dispatchBillSn
- }
- // 货位编号
- if (obj.orderBy) {
- params.type = params.type + '_STACK_PLACE'
- }
- // 原厂编码
- if (obj.origCode == 1) {
- params.type = params.type + '_ORIG_CODE'
- }
- // 装箱号
- if (obj.packNo == 1) {
- params.type = params.type + '_PACK_NUM'
- }
- _this.spinning = true
- printBase64Fun(
- dispatchDetailPrint,
- Object.assign(params, obj || {}),
- type,
- taskName,
- () => {
- _this.$store.state.app.curActionPermission = ''
- _this.$refs.table.refresh(true)
- _this.spinning = false
- },
- {
- billType: 'DISPATCH',
- billSn: params.dispatchBillSn,
- billNo: obj.dispatchBillNo,
- printType: taskName + '打印'
- })
- },
- // 打印记录
- viewPrint (row) {
- this.showRecordModal = true
- this.$refs.recordModal.setData(row, {
- billType: 'DISPATCH',
- billSn: row.dispatchBillSn
- })
- },
- // 允许备货打印
- handlePrintStatus (row) {
- this.tipData = row
- this.showPrintModal = true
- },
- canselModal () {
- this.tipData = null
- this.showPrintModal = false
- this.showInfoModal = false
- },
- updatePrintStatus () {
- dispatchPrintStatus({ dispatchBillSn: this.tipData.dispatchBillSn, printStatus: 'UNABLE_PRINT' }).then(res => {
- if (res.status == 200) {
- this.canselModal()
- this.$message.info(res.message)
- this.$refs.table.refresh()
- }
- })
- },
- // 查看发货说明
- handleExplainInfo (row) {
- this.tipData = row
- this.showInfoModal = true
- },
- subareaChange (val) {
- this.queryParam.subareaArea.subareaSn = val[0] ? val[0] : undefined
- this.queryParam.subareaArea.subareaAreaSn = val[1] ? val[1] : undefined
- },
- // 重置
- resetSearchForm () {
- this.time = []
- this.$refs.rangeDate.resetDate(this.time)
- this.queryParam.beginDate = ''
- this.queryParam.endDate = ''
- this.queryParam.buyerSn = undefined
- this.queryParam.receiverSn = undefined
- this.$refs.dealerSubareaScopeList.resetForm()
- this.$refs.shbuyerName.resetForm()
- this.queryParam.salesBillNo = ''
- this.queryParam.dispatchBillNo = ''
- this.queryParam.billStatus = undefined
- this.queryParam.subareaArea.subareaSn = undefined
- this.queryParam.subareaArea.subareaAreaSn = undefined
- this.queryParam.shippingAddrProvinceSn = undefined
- this.queryParam.voidFlag = this.currentTab == 1 ? '' : '0'
- this.queryParam.warehouseSn = undefined
- this.queryParam.printStatus = this.currentTab == 1 ? '' : 'NO_PRINT'
- if (this.advanced) {
- this.$refs.subarea.clearData()
- }
- this.$refs.table.refresh(true)
- },
- pageInit () {
- const _this = this
- this.$nextTick(() => { // 页面渲染完成后的回调
- _this.setTableH()
- })
- },
- setTableH () {
- const tableSearchH = this.$refs.tableSearch.offsetHeight
- this.tableHeight = window.innerHeight - tableSearchH - 253
- }
- },
- watch: {
- advanced (newValue, oldValue) {
- const _this = this
- this.$nextTick(() => { // 页面渲染完成后的回调
- _this.setTableH()
- })
- },
- '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
- this.setTableH()
- }
- },
- mounted () {
- if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
- this.pageInit()
- this.resetSearchForm()
- }
- },
- activated () {
- // 如果是新页签打开,则重置当前页面
- if (this.$store.state.app.isNewTab) {
- this.pageInit()
- this.resetSearchForm()
- }
- // 仅刷新列表,不重置页面
- if (this.$store.state.app.updateList) {
- this.pageInit()
- this.$refs.table.refresh()
- }
- },
- beforeRouteEnter (to, from, next) {
- next(vm => {})
- }
- }
- </script>
- <style lang="less">
- .stockPrint-wrap{
- .sTable{
- margin-top: 10px;
- }
- .ant-tabs-bar{
- margin:0;
- }
- }
- </style>
|