123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239 |
- <template>
- <a-modal
- centered
- class="collection-detail-modal"
- :footer="null"
- :maskClosable="false"
- v-model="isShow"
- :title="modalTit"
- :bodyStyle="{padding: modalTit?'25px 32px 20px':'50px 32px 15px'}"
- @cancel="isShow=false"
- width="80%">
- <a-spin :spinning="spinning" tip="Loading...">
- <div class="common-main">
- <!-- 搜索条件 -->
- <div ref="tableSearch" class="table-page-search-wrapper">
- <a-form layout="inline">
- <a-row type="flex" :gutter="15">
- <a-col flex="300px">
- <a-form-item label="业务单号">
- <a-input v-model.trim="queryParam.outBizSubNo" allowClear placeholder="请输入业务单号"/>
- </a-form-item>
- </a-col>
- <a-col flex="300px">
- <a-form-item label="客户名称">
- <a-input v-model.trim="queryParam.demanderName" allowClear placeholder="请输入客户名称"/>
- </a-form-item>
- </a-col>
- <a-col flex="300px">
- <a-form-item label="收货客户名称">
- <dealerSubareaScopeList ref="dealerSubareaScopeList" defValKey="buyerSn" @change="custChange" v-model="queryParam.receiverSn" />
- </a-form-item>
- </a-col>
- <a-col flex="300px" v-show="isShowWarehouse">
- <a-form-item label="仓库">
- <warehouse
- v-model="queryParam.warehouseSn"
- isPermission
- placeholder="请选择仓库"
- />
- </a-form-item>
- </a-col>
- <a-col flex="auto">
- <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>
- </span>
- </a-col>
- </a-row>
- </a-form>
- </div>
- <!-- 表格数据 -->
- <s-table
- class="sTable"
- ref="table"
- size="small"
- :rowKey="(record) => record.id"
- :columns="columns"
- :data="loadData"
- :scroll="{ y: 400 }"
- :pageSize="10"
- bordered>
- <!-- 操作 -->
- <template slot="action" slot-scope="text, record">
- <div v-if="!(record.outBizType == 'SALES'&&record.financialStatus=='WAIT')&&record.sendFlag==0">
- <a-button
- size="small"
- type="link"
- class="button-warning"
- v-if="!record.checked"
- @click="handleChoose(record)"
- >选择</a-button>
- <span style="color:#55aa00;" v-else>已选</span>
- </div>
- <span style="color:#55aa00;" v-else>
- {{ record.checked?'已选':'--' }}
- </span>
- </template>
- </s-table>
- </div>
- </a-spin>
- </a-modal>
- </template>
- <script>
- import { commonMixin } from '@/utils/mixin'
- import { STable, VSelect } from '@/components'
- import { stockOutList } from '@/api/stockOut'
- import warehouse from '@/views/common/chooseWarehouse.js'
- import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
- export default {
- name: 'SelectGlOrderModal',
- mixins: [commonMixin],
- components: { STable, VSelect, dealerSubareaScopeList, warehouse },
- props: {
- openModal: { // 弹框显示状态
- type: Boolean,
- default: false
- },
- modalTit: { // 弹框标题
- type: String,
- default: null
- },
- chooseData: {
- type: Array,
- default: function () {
- return []
- }
- }
- },
- data () {
- return {
- isShow: this.openModal, // 是否打开弹框
- disabled: false,
- spinning: false,
- handlePlData: [],
- queryParam: {
- outBizSubNo: '',
- demanderName: '',
- receiverSn: undefined,
- warehouseSn: undefined,
- outBizTypeList: ['SALES', 'ALLOCATE']
- },
- orginData: [],
- // 加载数据方法 必须为 Promise 对象
- loadData: parameter => {
- this.disabled = true
- this.spinning = true
- return stockOutList(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
- const index = this.chooseData.findIndex(item => data.list[i].stockOutSn == item.stockOutSn)
- data.list[i].checked = index >= 0
- }
- this.disabled = false
- }
- this.spinning = false
- this.orginData = data.list
- return data
- })
- },
- snList: []
- }
- },
- computed: {
- columns () {
- const _this = this
- const arr = [
- { title: '序号', dataIndex: 'no', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '出库单号', dataIndex: 'stockOutNo', width: '8%', align: 'center' },
- { title: '业务单号', dataIndex: 'outBizSubNo', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '出库类型', dataIndex: 'outBizTypeDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '发货编号', dataIndex: 'sendNo', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '客户名称', dataIndex: 'demanderName', width: '10%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
- { title: '收货客户名称', dataIndex: 'receiverName', width: '10%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
- { title: '产品款数', dataIndex: 'productTotalCategory', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '产品数量', dataIndex: 'productTotalQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '单据审核时间', dataIndex: 'auditTime', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '收款状态', dataIndex: 'financialStatusDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '发货状态', dataIndex: 'sendFlagDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '操作', scopedSlots: { customRender: 'action' }, width: '6%', align: 'center' }
- ]
- if(this.isShowWarehouse){
- arr.splice(7,0,{ title: '仓库', dataIndex: 'warehouseName', width: '10%', align: 'center', customRender: function (text) { return text || '--' } })
- }
- return arr
- },
- totalAmount () {
- let ret = 0
- this.handlePlData.map(item => {
- ret = ret + item.totalAmount
- })
- return ret.toFixed(2)
- }
- },
- methods: {
- custChange (val) {
- this.queryParam.receiverSn = val.key || ''
- },
- // 删除
- handleDel (row) {
- const i = this.chooseData.findIndex(item => row.stockOutSn == item.stockOutSn)
- this.chooseData.splice(i, 1)
- const oi = this.orginData.findIndex(item => row.stockOutSn == item.stockOutSn)
- if (oi >= 0) {
- this.orginData[oi].checked = false
- }
- },
- // 选择
- handleChoose (row) {
- row.checked = true
- this.chooseData.push(row)
- this.$emit('choose')
- },
- // 取消
- handleCommonCancel () {
- this.$emit('cancel')
- },
- // 重置
- resetSearchForm () {
- this.queryParam = {
- outBizSubNo: '',
- demanderName: '',
- receiverSn: undefined,
- warehouseSn: undefined,
- outBizTypeList: ['SALES', 'ALLOCATE']
- }
- this.orginData = []
- this.$nextTick(() => {
- this.$refs.dealerSubareaScopeList.resetForm()
- })
- if (this.$refs.table) {
- this.$refs.table.refresh(true)
- }
- }
- },
- watch: {
- // 父页面传过来的弹框状态
- openModal (newValue, oldValue) {
- this.isShow = newValue
- },
- // 重定义的弹框状态
- isShow (newValue, oldValue) {
- if (!newValue) {
- this.handleCommonCancel()
- } else {
- this.resetSearchForm()
- }
- }
- }
- }
- </script>
- <style lang="less">
- </style>
|