123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447 |
- <template>
- <a-card size="small" :bordered="false" class="allocationPresentationList-wrap">
- <a-spin :spinning="spinning" tip="Loading...">
- <!-- 搜索条件 -->
- <div class="table-page-search-wrapper">
- <a-form-model
- id="allocationPresentationList-form"
- ref="ruleForm"
- class="form-model-con"
- layout="inline"
- :model="queryParam"
- :rules="rules"
- @keyup.enter.native="handleSearch">
- <a-row :gutter="15">
- <a-col :md="6" :sm="24">
- <a-form-model-item label="调拨日期" prop="time">
- <rangeDateTime ref="rangeDate" :value="queryParam.time" @change="dateChange" />
- </a-form-model-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-model-item label="客户名称">
- <a-input id="allocationPresentationList-targetName" v-model.trim="queryParam.targetName" allowClear placeholder="请输入客户名称"/>
- </a-form-model-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-model-item label="客户级别">
- <v-select
- v-model="queryParam.dealer.dealerLevel"
- ref="dealerLevel"
- id="allocationPresentationList-dealerLevel"
- code="DEALER_LEVEL"
- placeholder="请选择客户级别"
- allowClear></v-select>
- </a-form-model-item>
- </a-col>
- <template v-if="advanced">
- <a-col :md="6" :sm="24">
- <a-form-model-item label="调拨单号">
- <a-input id="allocationPresentationList-allocateNo" v-model.trim="queryParam.allocateNo" allowClear placeholder="请输入调拨单号"/>
- </a-form-model-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-model-item label="所在区域">
- <subarea id="allocationPresentationList-subareaSn" v-model="queryParam.dealer.subareaSn"></subarea>
- </a-form-model-item>
- </a-col>
- <a-col :md="12" :sm="24">
- <a-row>
- <a-form-model-item label="地区" style="margin-bottom: 0!important;">
- <a-col span="7">
- <a-form-model-item prop="dealerProvinceSn" style="margin: 0;">
- <a-select v-model="queryParam.dealer.provinceSn" allowClear @change="getCityList" placeholder="请选择省">
- <a-select-option v-for="item in addrProvinceList" :value="item.id" :key="item.id + 'a'">{{ item.name }}</a-select-option>
- </a-select>
- </a-form-model-item>
- </a-col>
- <a-col span="7" offset="1">
- <a-form-model-item prop="dealerCitySn" style="margin: 0;">
- <a-select v-model="queryParam.dealer.citySn" allowClear @change="getAreaList" placeholder="请选择市">
- <a-select-option v-for="item in addrCityList" :value="item.id" :key="item.id + 'b'">{{ item.name }}</a-select-option>
- </a-select>
- </a-form-model-item>
- </a-col>
- <a-col span="7" offset="1">
- <a-form-model-item prop="dealerCountySn" style="margin: 0;">
- <a-select v-model="queryParam.dealer.districtSn" allowClear placeholder="请选择区/县">
- <a-select-option v-for="item in addrDistrictList" :value="item.id" :key="item.id + 'c'">{{ item.name }}</a-select-option>
- </a-select>
- </a-form-model-item>
- </a-col>
- </a-form-model-item>
- </a-row>
- </a-col>
- </template>
- <a-col :md="6" :sm="24">
- <a-button type="primary" @click="handleSearch" :disabled="disabled" id="allocationPresentationList-refresh">查询</a-button>
- <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="allocationPresentationList-reset">重置</a-button>
- <a-button
- style="margin-left: 5px"
- type="primary"
- class="button-warning"
- @click="handleExport"
- :disabled="disabled"
- :loading="exportLoading"
- v-if="$hasPermissions('B_allocationPresentationExport')"
- id="allocationPresentationList-export">导出</a-button>
- <a @click="advanced=!advanced" style="margin-left: 5px">
- {{ advanced ? '收起' : '展开' }}
- <a-icon :type="advanced ? 'up' : 'down'"/>
- </a>
- </a-col>
- </a-row>
- </a-form-model>
- </div>
- <!-- 列表 -->
- <s-table
- class="sTable"
- ref="table"
- size="small"
- :defaultLoadData="false"
- :rowKey="(record) => record.id"
- :columns="columns"
- :data="loadData"
- :scroll="{ x: 1840 }"
- bordered>
- <template slot="footer">
- <a-row>
- <a-col span="2">合计:</a-col>
- <a-col span="22">
- <a-row>
- <a-col span="4">配送品调拨:{{ (totalData && (totalData.pspdb || totalData.pspdb==0)) ? totalData.pspdb : '--' }}</a-col>
- <a-col span="4">有偿调拨:{{ (totalData && (totalData.ycdb || totalData.ycdb==0)) ? totalData.ycdb : '--' }}</a-col>
- <a-col span="4">促销调拨:{{ (totalData && (totalData.cxdb || totalData.cxdb==0)) ? totalData.cxdb : '--' }}</a-col>
- <a-col span="4">退换品调拨:{{ (totalData && (totalData.thpdb || totalData.thpdb==0)) ? totalData.thpdb : '--' }}</a-col>
- <a-col span="4">样品调拨:{{ (totalData && (totalData.ypdb || totalData.ypdb==0)) ? totalData.ypdb : '--' }}</a-col>
- <a-col span="4">仓库误差调拨:{{ (totalData && (totalData.ckwcdb || totalData.ckwcdb==0)) ? totalData.ckwcdb : '--' }}</a-col>
- <a-col span="4">TBU刹车片配送品调拨:{{ (totalData && (totalData.tbudb || totalData.tbudb==0)) ? totalData.tbudb : '--' }}</a-col>
- <a-col span="4">NGK配送品调拨:{{ (totalData && (totalData.ngkdb || totalData.ngkdb==0)) ? totalData.ngkdb : '--' }}</a-col>
- <a-col span="4">德路斯调拨:{{ (totalData && (totalData.dlsdb || totalData.dlsdb==0)) ? totalData.dlsdb : '--' }}</a-col>
- <a-col span="4">新加盟商政策调拨:{{ (totalData && (totalData.xjmszcdb || totalData.xjmszcdb==0)) ? totalData.xjmszcdb : '--' }}</a-col>
- <a-col span="4">特殊申请配送品调拨:{{ (totalData && (totalData.tssqpspdb || totalData.tssqpspdb==0)) ? totalData.tssqpspdb : '--' }}</a-col>
- <a-col span="4">特殊申请促销调拨:{{ (totalData && (totalData.tssqcxdb || totalData.tssqcxdb==0)) ? totalData.tssqcxdb : '--' }}</a-col>
- <a-col span="4">卡扣配送品调拨:{{ (totalData && (totalData.kkpspdb || totalData.kkpspdb==0)) ? totalData.kkpspdb : '--' }}</a-col>
- <a-col span="4">客诉样品调拨:{{ (totalData && (totalData.ksypdb || totalData.ksypdb==0)) ? totalData.ksypdb : '--' }}</a-col>
- <a-col span="6" v-if="$hasPermissions('B_isShowPrice')">调拨单合计金额:{{ (totalData && (totalData.totalCost || totalData.totalCost==0)) ? totalData.totalCost : '--' }}</a-col>
- </a-row>
- </a-col>
- </a-row>
- </template>
- </s-table>
- </a-spin>
- </a-card>
- </template>
- <script>
- import { STable, VSelect } from '@/components'
- import rangeDateTime from '@/views/common/rangeDateTime.vue'
- import subarea from '@/views/common/subarea.js'
- import { getArea } from '@/api/data'
- import { hdExportExcel } from '@/libs/exportExcel'
- import { reportAllocateDbjdReportList, reportAllocateDbjdReportCount, reportAllocateDbjdReportExport } from '@/api/reportData'
- export default {
- components: { STable, VSelect, rangeDateTime, subarea },
- data () {
- return {
- spinning: false,
- advanced: true, // 高级搜索 展开/关闭
- queryParam: { // 查询条件
- time: [],
- beginDate: '',
- endDate: '',
- allocateNo: '',
- targetName: '',
- dealer: {
- 'provinceSn': undefined,
- 'citySn': undefined,
- 'districtSn': undefined,
- 'subareaSn': undefined,
- 'dealerLevel': undefined
- }
- },
- rules: {
- 'time': [{ required: true, message: '请选择调拨日期', trigger: 'change' }]
- },
- disabled: false, // 查询、重置按钮是否可操作
- exportLoading: false,
- // 加载数据方法 必须为 Promise 对象
- loadData: parameter => {
- this.disabled = true
- this.spinning = true
- const paramsPage = Object.assign(this.queryParam, { pageNo: parameter.pageNo, pageSize: parameter.pageSize }) // 有分页
- return reportAllocateDbjdReportList(paramsPage).then(res => {
- let data
- if (res.status == 200) {
- data = res.data
- this.getCount(paramsPage)
- 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
- })
- },
- totalData: null,
- addrProvinceList: [], // 省下拉
- addrCityList: [], // 市下拉
- addrDistrictList: [] // 区下拉
- }
- },
- computed: {
- columns () {
- const arr = [
- { title: '区域', dataIndex: 'dealerEntity.subareaNameSet', width: 120, align: 'center', customRender: function (text) { return (text && text.length > 0) ? text.join('/') : '--' } },
- { title: '调拨单号', dataIndex: 'allocateNo', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
- { title: '省份', dataIndex: 'dealerEntity.provinceName', width: 90, align: 'center', customRender: function (text) { return text || '--' } },
- { title: '客户名称', dataIndex: 'targetName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
- { title: '客户级别', dataIndex: 'dealerEntity.dealerLevelDictValue', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
- { title: '调拨类型',
- align: 'center',
- children: [
- {
- title: '配送品调拨',
- dataIndex: 'pspdb',
- align: 'center',
- width: 80,
- customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
- },
- {
- title: '有偿调拨',
- dataIndex: 'ycdb',
- align: 'center',
- width: 80,
- customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
- },
- {
- title: '促销调拨',
- dataIndex: 'cxdb',
- align: 'center',
- width: 80,
- customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
- },
- {
- title: '退换品调拨',
- dataIndex: 'thpdb',
- align: 'center',
- width: 80,
- customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
- },
- {
- title: '样品调拨',
- dataIndex: 'ypdb',
- align: 'center',
- width: 80,
- customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
- },
- {
- title: '仓库误差调拨',
- dataIndex: 'ckwcdb',
- align: 'center',
- width: 80,
- customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
- },
- {
- title: 'TBU刹车片配送品调拨',
- dataIndex: 'tbudb',
- align: 'center',
- width: 80,
- customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
- },
- {
- title: 'NGK配送品调拨',
- dataIndex: 'ngkdb',
- align: 'center',
- width: 80,
- customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
- },
- {
- title: '德路斯调拨',
- dataIndex: 'dlsdb',
- align: 'center',
- width: 80,
- customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
- },
- {
- title: '新加盟商政策调拨',
- dataIndex: 'xjmszcdb',
- align: 'center',
- width: 80,
- customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
- },
- {
- title: '特殊申请配送品调拨',
- dataIndex: 'tssqpspdb',
- align: 'center',
- width: 80,
- customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
- },
- {
- title: '特殊申请促销调拨',
- dataIndex: 'tssqcxdb',
- align: 'center',
- width: 80,
- customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
- },
- {
- title: '卡扣配送品调拨',
- dataIndex: 'kkpspdb',
- align: 'center',
- width: 80,
- customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
- },
- {
- title: '客诉样品调拨',
- dataIndex: 'ksypdb',
- align: 'center',
- width: 80,
- customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
- }
- ]
- }
- // { title: '调拨单合计金额', width: 90, dataIndex: 'totalCost', align: 'center', customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' } }
- ]
- if (this.$hasPermissions('B_isShowPrice')) { // 售价权限
- arr.splice(arr.length, 0, { title: '调拨单合计金额', width: 90, dataIndex: 'totalCost', align: 'center', customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' } })
- }
- return arr
- }
- },
- methods: {
- // 导出
- handleExport () {
- const _this = this
- this.$refs.ruleForm.validate(valid => {
- if (valid) {
- const params = _this.queryParam
- delete params.time
- _this.exportLoading = true
- _this.spinning = true
- hdExportExcel(reportAllocateDbjdReportExport, params, '调拨交单报表', function () {
- _this.exportLoading = false
- _this.spinning = false
- })
- } else {
- return false
- }
- })
- },
- // 总计
- getCount (params) {
- reportAllocateDbjdReportCount(params).then(res => {
- if (res.status == 200 && res.data) {
- this.totalData = res.data
- } else {
- this.totalData = null
- }
- })
- },
- handleSearch () {
- const _this = this
- this.$refs.ruleForm.validate(valid => {
- if (valid) {
- _this.$refs.table.refresh(true)
- } else {
- return false
- }
- })
- },
- // 创建时间 change
- dateChange (date) {
- if (date[0] && date[1]) {
- this.queryParam.time = date
- } else {
- this.queryParam.time = []
- }
- this.queryParam.beginDate = date[0] || ''
- this.queryParam.endDate = date[1] || ''
- },
- // 重置
- resetSearchForm () {
- this.queryParam.time = []
- this.$refs.rangeDate.resetDate(this.queryParam.time)
- this.queryParam.beginDate = ''
- this.queryParam.endDate = ''
- this.queryParam.allocateNo = ''
- this.queryParam.targetName = ''
- this.queryParam.dealer = {
- 'provinceSn': undefined,
- 'citySn': undefined,
- 'districtSn': undefined,
- 'subareaSn': undefined,
- 'dealerLevel': undefined
- }
- this.totalData = null
- this.$refs.ruleForm.resetFields()
- this.$refs.table.clearTable()
- },
- // 获取城市列表
- getCityList (val) {
- this.addrCityList = []
- this.addrDistrictList = []
- this.queryParam.dealer.citySn = undefined
- this.queryParam.dealer.districtSn = undefined
- if (val) {
- this.getArea('city', val)
- }
- },
- // 获取区县列表
- getAreaList (val) {
- this.addrDistrictList = []
- this.queryParam.dealer.districtSn = undefined
- if (val) {
- this.getArea('district', val)
- }
- },
- // 省/市/区
- getArea (leve, sn) {
- let params
- if (leve == 'province') {
- params = { type: '2' }
- } else {
- params = { parentId: sn, type: leve == 'city' ? '3' : '4' }
- }
- getArea(params).then(res => {
- if (res.status == 200) {
- if (leve == 'province') {
- this.addrProvinceList = res.data || []
- } else if (leve == 'city') {
- this.addrCityList = res.data || []
- } else if (leve == 'district') {
- this.addrDistrictList = res.data || []
- }
- } else {
- if (leve == 'province') {
- this.addrProvinceList = []
- } else if (leve == 'city') {
- this.addrCityList = []
- } else if (leve == 'district') {
- this.addrDistrictList = []
- }
- }
- })
- },
- pageInit () {
- this.getArea('province')
- }
- },
- mounted () {
- if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
- this.pageInit()
- this.resetSearchForm()
- }
- },
- activated () {
- // 如果是新页签打开,则重置当前页面
- if (this.$store.state.app.isNewTab) {
- this.pageInit()
- this.resetSearchForm()
- }
- },
- beforeRouteEnter (to, from, next) {
- next(vm => {})
- }
- }
- </script>
|