123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230 |
- <template>
- <a-modal
- centered
- :footer="null"
- :maskClosable="false"
- class="allocateBill-print-type-modal"
- :title="modalTit"
- v-model="isShow"
- @cancel="isShow=false"
- :width="600">
- <a-spin :spinning="spinning" tip="Loading...">
- <a-form-model
- id="allocateBill-print-form"
- ref="ruleForm"
- :model="form"
- :rules="rules"
- :label-col="formItemLayout.labelCol"
- :wrapper-col="formItemLayout.wrapperCol"
- >
- <a-form-model-item style="margin-bottom: 0;" label="调拨单号">{{ itemData&&itemData.allocateNo || '--' }}</a-form-model-item>
- <a-form-model-item style="margin-bottom: 0;" label="调往对象">{{ itemData&&itemData.targetName || '--' }}</a-form-model-item>
- <a-form-model-item style="margin-bottom: 0;" label="发货编号">{{ itemData&&itemData.sendNo || '--' }}</a-form-model-item>
- <a-form-model-item style="margin-bottom: 0;" label="收货客户名称">{{ itemData&&itemData.receiverName || '--' }}</a-form-model-item>
- <a-form-model-item style="margin-bottom: 0;" label="产品分类" prop="id" v-if="nowType=='dbflPrint'||nowType=='dbflExport'">
- <a-select id="allocateBill-print-form" v-model="form.id" placeholder="请选择产品分类">
- <a-select-option v-for="item in typeList" :value="item.id" :key="item.id">
- <span v-if="item.id != 'all'">{{ item.productBrandName }} - {{ item.productTypeName3 }}</span>
- <span v-else>全部</span>
- </a-select-option>
- </a-select>
- </a-form-model-item>
- <a-form-model-item label="货位编号" prop="orderBy" v-if="nowType=='dbflPrint'">
- <a-radio-group v-model="form.orderBy">
- <a-radio value="ASC">打印(↑升序)</a-radio>
- <a-radio value="DESC">打印(↓降序)</a-radio>
- <a-radio value="-1">不打印</a-radio>
- </a-radio-group>
- </a-form-model-item>
- <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>
- <a-radio value="ALLOCATE_BILL">不打印</a-radio>
- </a-radio-group>
- </a-form-model-item>
- </a-form-model>
- <div class="btn-cont">
- <a-button id="allocateBill-print-close" @click="handleClose('preview')">取消</a-button>
- <a-button
- 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=='dbflPrint'||nowType=='dbPrint')"
- type="primary"
- id="allocateBill-print-back"
- @click="handleSave('print')"
- style="margin-left: 15px;">确定打印</a-button>
- <a-button
- v-if="nowType=='dbflExport'||nowType=='dbExport'"
- type="primary"
- id="allocateBill-print-back"
- @click="handleSave('export')"
- style="margin-left: 15px;">确定导出</a-button>
- </div>
- </a-spin>
- </a-modal>
- </template>
- <script>
- import { allocateBillProductTypeList } from '@/api/allocateBill'
- export default {
- props: {
- openModal: { // 弹框显示状态
- type: Boolean,
- default: false
- },
- itemData: {
- type: Object,
- default: () => {
- return null
- }
- },
- nowType: {
- type: String,
- default: ''
- }
- },
- data () {
- return {
- isShow: this.openModal, // 是否打开弹框
- form: {
- id: 'all',
- priceType: undefined,
- orderBy: undefined
- },
- rules: {
- id: [{ required: true, message: '请选择产品分类', trigger: 'change' }],
- priceType: [{ required: true, message: '请选择产品价格', trigger: 'change' }],
- orderBy: [{ required: true, message: '请选择货位编号', trigger: 'change' }]
- },
- formItemLayout: {
- labelCol: { span: 6 },
- wrapperCol: { span: 16 }
- },
- spinning: false,
- typeList: []
- }
- },
- computed: {
- modalTit () {
- let title = ''
- if (this.nowType == 'dbPrint') {
- title = '调拨打印'
- } else if (this.nowType == 'dbflPrint') {
- title = '调拨分类打印'
- } else if (this.nowType == 'dbflExport') {
- title = '调拨分类导出'
- } else if (this.nowType == 'dbExport') {
- title = '导出Excel'
- }
- return title
- },
- hidePrint () {
- return this.itemData && this.itemData.printState && this.itemData.printState != 'UNABLE_PRINT' && this.itemData.printState != 'CANCEL_PRINT'
- }
- },
- methods: {
- // 确认
- handleSave (type) {
- const _this = this
- this.$refs.ruleForm.validate(valid => {
- if (valid) {
- let authCode = ''
- if (this.nowType == 'dbPrint') {
- authCode = 'B_transferOut_print'
- } else if (this.nowType == 'dbflPrint') {
- authCode = 'B_transferOutType_print'
- } else if (this.nowType == 'dbflExport') {
- authCode = 'B_transferOutType_export'
- } else if (this.nowType == 'dbExport') {
- authCode = 'B_transferOut_detail_export'
- }
- this.$store.state.app.curActionPermission = authCode
- // 普通打印/导出
- 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) {
- obj.productBrandSn = item.productBrandSn
- obj.productTypeSn3 = item.productTypeSn3
- obj.printType = 'ALLOCATE_BILL_TYPE'
- }
- // 打印货位编号
- if (_this.nowType == 'dbflPrint') {
- if (_this.form.orderBy != '-1') {
- obj.orderBy = _this.form.orderBy
- }
- }
- }
- // 打印
- if (_this.nowType == 'dbPrint' || _this.nowType == 'dbflPrint') {
- _this.$emit('ok', obj)
- } else {
- // 导出
- _this.$emit('export', obj)
- }
- _this.isShow = false
- } else {
- console.log('error submit!!')
- return false
- }
- })
- },
- // 获取该销售单产品二级分类
- getTypeData () {
- this.typeList = [{ id: 'all' }]
- allocateBillProductTypeList({ sn: this.itemData.allocateSn || null }).then(res => {
- if (res.status == 200) {
- if (res.data && res.data.length > 0) {
- this.typeList = [...this.typeList, ...res.data]
- }
- }
- })
- },
- handleClose () {
- this.$emit('close')
- this.$refs.ruleForm.resetFields()
- this.form = {
- id: 'all',
- priceType: undefined
- }
- }
- },
- watch: {
- // 父页面传过来的弹框状态
- openModal (newValue, oldValue) {
- this.isShow = newValue
- },
- // 重定义的弹框状态
- isShow (newValue, oldValue) {
- if (!newValue) {
- this.handleClose()
- } else {
- if (this.nowType == 'dbflPrint' || this.nowType == 'dbflExport') {
- this.getTypeData()
- }
- }
- }
- }
- }
- </script>
- <style lang="less">
- .allocateBill-print-type-modal{
- .btn-cont {
- text-align: center;
- margin: 35px 0 10px;
- }
- }
- </style>
|