123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192 |
- <template>
- <a-card size="small" :bordered="false" class="pushOrder-wrap">
- <!-- 搜索条件 -->
- <div 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" @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}">
- <custList id="pushOrder-buyerName" ref="custList" @change="custChange"></custList>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="关联销售单号">
- <a-input id="pushOrder-salesBillNo" v-model.trim="queryParam.salesBillNo" allowClear placeholder="请输入销售单号"/>
- </a-form-item>
- </a-col>
- <template v-if="advanced">
- <a-col :md="6" :sm="24">
- <a-form-item label="备货单号">
- <a-input id="pushOrder-dispatchBillNo" v-model.trim="queryParam.dispatchBillNo" allowClear placeholder="请输入备货单号"/>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="业务状态">
- <v-select
- v-model="queryParam.billStatus"
- ref="billStatus"
- id="pushOrder-billStatus"
- code="DISPATCH_BILL_STATUS"
- placeholder="请选择业务状态"
- allowClear></v-select>
- </a-form-item>
- </a-col>
- </template>
- <a-col :md="6" :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>
- <!-- alert -->
- <a-alert type="info" showIcon style="margin-bottom:15px">
- <div slot="message">
- 下推总单数::<strong>{{ totalData.totalRecord }}</strong>;
- 下推总数量:<strong>{{ totalData.totalQty }}</strong>;
- 下推总金额:<strong>{{ totalData.totalAmount }}</strong>元;
- </div>
- </a-alert>
- <!-- 列表 -->
- <s-table
- class="sTable"
- ref="table"
- size="default"
- :rowKey="(record) => record.id"
- :columns="columns"
- :data="loadData"
- :scroll="{ x: 1510, y:tableHeight }"
- bordered>
- <!-- 销售单号 -->
- <template slot="salesBillNo" slot-scope="text, record">
- <span style="color: #ed1c24;cursor: pointer;" @click="handleDetail(record,0)">{{ record.salesBillNo }}</span>
- </template>
- <!-- 备货单号 -->
- <template slot="dispatchBillNo" slot-scope="text, record">
- <span style="color: #ed1c24;cursor: pointer;" @click="handleDetail(record,1)">{{ record.dispatchBillNo }}</span>
- </template>
- </s-table>
- </a-card>
- </template>
- <script>
- import rangeDate from '@/views/common/rangeDate.vue'
- import { STable, VSelect } from '@/components'
- import custList from '@/views/common/custList.vue'
- import { dispatchlList, dispatchQueryCount } from '@/api/dispatch'
- export default {
- name: 'TableList',
- components: { STable, VSelect, custList, rangeDate },
- data () {
- return {
- tableHeight: 0,
- advanced: false, // 高级搜索 展开/关闭
- disabled: false, // 查询、重置按钮是否可操作
- // 查询参数
- queryParam: {
- beginDate: '',
- endDate: '',
- buyerSn: undefined, // 客户名称
- salesBillNo: '', // 销售单号
- dispatchBillNo: '', // 备货单号
- billStatus: undefined // 业务状态
- },
- totalData: {
- totalAmount: 0,
- totalQty: 0,
- totalRecord: 0
- },
- // 表头
- columns: [
- { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
- // { title: '区域', dataIndex: 'shippingAddrCountyName', width: 120, align: 'center' },
- // { title: '省份', dataIndex: 'shippingAddrProvinceName', width: 120, align: 'center' },
- { title: '创建时间', dataIndex: 'createDate', width: 160, align: 'center' },
- { title: '备货单号', scopedSlots: { customRender: 'dispatchBillNo' }, width: 210, align: 'center' },
- { title: '关联销售单号', scopedSlots: { customRender: 'salesBillNo' }, width: 210, align: 'center' },
- { title: '客户名称', dataIndex: 'buyerName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
- { title: '下推数量', dataIndex: 'totalQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '下推金额', dataIndex: 'totalAmount', width: 100, align: 'center', customRender: function (text) { return '¥' + (text || 0) } },
- { title: '备货时间', dataIndex: 'stockUpDate', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
- { title: '出库时间', dataIndex: 'stockOutDate', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
- { title: '业务状态', dataIndex: 'billStatusDictValue', width: 110, align: 'center' }
- ],
- // 加载数据方法 必须为 Promise 对象
- loadData: parameter => {
- this.disabled = true
- if (this.tableHeight == 0) {
- this.tableHeight = window.innerHeight - 440
- }
- // 查询总计
- dispatchQueryCount(Object.assign(parameter, this.queryParam)).then(res => {
- console.log(res)
- this.totalData = Object.assign(this.totalData, res.data || {})
- })
- return dispatchlList(Object.assign(parameter, this.queryParam)).then(res => {
- const 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
- return data
- })
- }
- }
- },
- methods: {
- // 时间 change
- dateChange (date) {
- this.queryParam.beginDate = date[0]
- this.queryParam.endDate = date[1]
- },
- custChange (val) {
- this.queryParam.buyerSn = val.key
- },
- // 详情
- handleDetail (row, type) {
- if (type == 0) {
- this.$router.push({ name: 'salesDetail', params: { sn: row.salesBillSn } })
- } else {
- this.$router.push({ name: 'pushOrderDetail', params: { sn: row.dispatchBillSn, type: 'pushOrder' } })
- }
- },
- // 重置
- resetSearchForm () {
- this.$refs.rangeDate.resetDate()
- this.queryParam.beginDate = ''
- this.queryParam.endDate = ''
- this.queryParam.buyerSn = undefined
- this.$refs.custList.resetForm()
- this.queryParam.salesBillNo = ''
- this.queryParam.purchaseBillNo = ''
- this.queryParam.payType = undefined
- this.queryParam.billStatus = undefined
- this.queryParam.financialStatus = undefined
- this.$refs.table.refresh(true)
- }
- },
- beforeRouteEnter (to, from, next) {
- next(vm => {
- })
- }
- }
- </script>
- <style lang="less">
- .pushOrder-wrap{
- .sTable{
- margin-top: 15px;
- }
- }
- </style>
|